summaryrefslogtreecommitdiff
path: root/head.c
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-08-06 08:04:06 -0400
committerJakob Kaivo <jkk@ung.org>2019-08-06 08:04:06 -0400
commitb678a1801836b49f61f4993c18fc6bc4861b2e08 (patch)
tree656cf2cf0673dc0d99bd63f3f23d8f8384b0f3f3 /head.c
parent9a0f2b84e66cc68654f7f7391b864744bc4139f0 (diff)
formatting of error messages
Diffstat (limited to 'head.c')
-rw-r--r--head.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/head.c b/head.c
index 9f54706..1642186 100644
--- a/head.c
+++ b/head.c
@@ -37,7 +37,7 @@ static int head(const char *path, int nlines)
}
if (f == NULL) {
- fprintf(stderr, "FIXME: Couldn't open %s: %s\n", path ? path : "stdin", strerror(errno));
+ fprintf(stderr, "head: %s: %s\n", path, strerror(errno));
return 1;
}
@@ -64,12 +64,12 @@ int main(int argc, char **argv)
char *end;
int c;
- while ((c = getopt(argc, argv, ":n:")) != -1) {
+ while ((c = getopt(argc, argv, "n:")) != -1) {
switch (c) {
case 'n':
lines = strtol(optarg, &end, 10);
- if (end != NULL && strlen(end) > 0) {
- fprintf(stderr, "head: Invalid number %s\n", optarg);
+ if (*end != '\0') {
+ fprintf(stderr, "head: invalid number %s\n", optarg);
return 1;
}
break;