summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1994-12-16 05:45:57 +0000
committerJim Meyering <jim@meyering.net>1994-12-16 05:45:57 +0000
commit73d8d0a43fb21cafc27b2380016a2e534c93763a (patch)
tree99954717848d026bd7ca0fd856607c6ed9b07b93 /src
parent7323b7d9f2c7710bf836cd31213b7e0c644cebe5 (diff)
downloadcoreutils-73d8d0a43fb21cafc27b2380016a2e534c93763a.tar.xz
Include "error.h" instead of simply declaring `void error ();'.
(main): Don't advance optarg past leading sign -- otherwise, we'd be making tail accept invalid options like `-+1'. (tail_file): Fix call to error with %s in format, but no corresponding argument.
Diffstat (limited to 'src')
-rw-r--r--src/tail.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/tail.c b/src/tail.c
index a2025f3ce..a63329b7b 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -55,6 +55,7 @@
#include "system.h"
#include "version.h"
#include "xstrtol.h"
+#include "error.h"
/* Disable assertions. Some systems have broken assert macros. */
#define NDEBUG 1
@@ -106,7 +107,6 @@ enum header_mode
};
char *xmalloc ();
-void error ();
int safe_read ();
static int file_lines ();
@@ -249,13 +249,11 @@ main (argc, argv)
if (*optarg == '+')
{
from_start = 1;
- ++optarg;
}
- else if (*optarg == '-')
- ++optarg;
- /* FIXME: make sure tmp_long can't be negative. */
s_err = xstrtol (optarg, NULL, 0, &tmp_long, 1);
+ if (tmp_long < 0)
+ tmp_long = -tmp_long;
n_units = tmp_long;
if (s_err != LONGINT_OK)
{
@@ -401,7 +399,8 @@ tail_file (filename, n_units, filenum)
}
else if (!S_ISREG (stats.st_mode))
{
- error (0, 0, "%s: cannot follow end of non-regular file");
+ error (0, 0, "%s: cannot follow end of non-regular file",
+ filename);
errors = 1;
}
if (errors)