sbase

suckless unix tools
git clone git://git.2f30.org/sbase.git
Log | Files | Refs | README | LICENSE

commit af8e38f5fa0f5d29f619ac2cabae3fbc98ad6073
parent cb7cbde72233be91b1a5fdbae5aa6f78a8ba4cd9
Author: sin <sin@2f30.org>
Date:   Mon Nov 17 16:22:01 +0000

Fix some error messages

There's many more to go.

Diffstat:
chgrp.c | 4++--
comm.c | 6+++---
rmdir.c | 6+-----
unexpand.c | 5++---
util/crypt.c | 2+-
5 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/chgrp.c b/chgrp.c @@ -53,12 +53,12 @@ main(int argc, char *argv[]) if (errno) eprintf("getgrnam %s:"); else if (!gr) - eprintf("chgrp: '%s': No such group\n", argv[0]); + eprintf("getgrnam %s: no such group\n", argv[0]); gid = gr->gr_gid; while (*++argv) { if (stat(*argv, &st) == -1) { - fprintf(stderr, "chgrp: '%s': %s\n", *argv, + fprintf(stderr, "stat %s: %s\n", *argv, strerror(errno)); failures++; continue; diff --git a/comm.c b/comm.c @@ -44,7 +44,7 @@ main(int argc, char *argv[]) if (argv[i][0] == '-') argv[i] = "/dev/fd/0"; if (!(fp[i] = fopen(argv[i], "r"))) - eprintf("comm: '%s':", argv[i]); + eprintf("fopen %s:", argv[i]); } for (;;) { @@ -94,9 +94,9 @@ nextline(char *buf, int n, FILE *f, char *name) { buf = fgets(buf, n, f); if (!buf && !feof(f)) - eprintf("comm: '%s':", name); + eprintf("%s: read error:", name); if (buf && !strchr(buf, '\n')) - eprintf("comm: '%s': line too long.\n", name); + eprintf("%s: line too long\n", name); return buf; } diff --git a/rmdir.c b/rmdir.c @@ -1,8 +1,6 @@ /* See LICENSE file for copyright and license details. */ -#include <errno.h> #include <stdio.h> #include <stdlib.h> -#include <string.h> #include <unistd.h> #include "util.h" @@ -26,8 +24,6 @@ main(int argc, char *argv[]) for (; argc > 0; argc--, argv++) if (rmdir(argv[0]) == -1) - fprintf(stderr, "rmdir: '%s': %s\n", - argv[0], strerror(errno)); - + weprintf("rmdir %s:", argv[0]); return 0; } diff --git a/unexpand.c b/unexpand.c @@ -66,8 +66,7 @@ in(Fdescr *f) wint_t c = fgetwc(f->fp); if (c == WEOF && ferror(f->fp)) - eprintf("'%s' read error:", f->name); - + eprintf("%s: read error:", f->name); return c; } @@ -76,7 +75,7 @@ out(wint_t c) { putwchar(c); if (ferror(stdout)) - eprintf("write error:"); + eprintf("stdout: write error:"); } static void diff --git a/util/crypt.c b/util/crypt.c @@ -138,7 +138,7 @@ cryptsum(struct crypt_ops *ops, FILE *fp, const char *f, while ((n = fread(buf, 1, sizeof(buf), fp)) > 0) ops->update(ops->s, buf, n); if (ferror(fp)) { - weprintf("read error: %s:", f); + weprintf("%s: read error:", f); return 1; } ops->sum(ops->s, md);