[hackers] [sbase] Fix some error messages || sin

From: <git_AT_suckless.org>
Date: Mon, 17 Nov 2014 17:22:15 +0100

commit af8e38f5fa0f5d29f619ac2cabae3fbc98ad6073
Author: sin <sin_AT_2f30.org>
Date: Mon Nov 17 16:22:01 2014 +0000

    Fix some error messages
    
    There's many more to go.

diff --git a/chgrp.c b/chgrp.c
index a6ba4bc..51e99b4 100644
--- a/chgrp.c
+++ b/chgrp.c
_AT_@ -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
index 1864c9f..59cfc3d 100644
--- a/comm.c
+++ b/comm.c
_AT_@ -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 (;;) {
_AT_@ -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
index 74fa907..b58f22c 100644
--- a/rmdir.c
+++ b/rmdir.c
_AT_@ -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"
_AT_@ -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
index ecf6ba3..48b0fb6 100644
--- a/unexpand.c
+++ b/unexpand.c
_AT_@ -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;
 }
 
_AT_@ -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
index c331cf4..458f11c 100644
--- a/util/crypt.c
+++ b/util/crypt.c
_AT_@ -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);
Received on Mon Nov 17 2014 - 17:22:15 CET

This archive was generated by hypermail 2.3.0 : Mon Nov 17 2014 - 17:24:09 CET