(parse_obsolescent_option): Issue a warning for obsolete usage,
authorJim Meyering <jim@meyering.net>
Fri, 18 Jan 2002 23:39:37 +0000 (23:39 +0000)
committerJim Meyering <jim@meyering.net>
Fri, 18 Jan 2002 23:39:37 +0000 (23:39 +0000)
unless POSIXLY_CORRECT.

src/tail.c

index d00a89d6d11e006cb1bfc89ded3840ae69322d2d..2131c1d4b58eb8103a43cfa8a9140631ed2a6fe9 100644 (file)
@@ -1381,10 +1381,10 @@ parse_obsolescent_option (int argc, const char *const *argv,
 
   if (!*fail)
     {
+      bool posix_pedantic = (getenv ("POSIXLY_CORRECT") != NULL);
+
       if (argc > 3)
        {
-         int posix_pedantic = (getenv ("POSIXLY_CORRECT") != NULL);
-
          /* When POSIXLY_CORRECT is set, enforce the `at most one
             file argument' requirement.  */
          if (posix_pedantic)
@@ -1405,6 +1405,11 @@ option instead."), argv[1]);
 #endif
        }
 
+      if (! posix_pedantic)
+       error (0, 0,
+              _("warning: `tail %s' is obsolete; use -n or -c instead"),
+              argv[1]);
+
       /* Set globals.  */
       from_start = t_from_start;
       count_lines = t_count_lines;