Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/sh Avoid generating error messages implying that user er...



details:   https://anonhg.NetBSD.org/src/rev/f13079c2d608
branches:  trunk
changeset: 365256:f13079c2d608
user:      kre <kre%NetBSD.org@localhost>
date:      Sat Apr 16 14:20:45 2022 +0000

description:
Avoid generating error messages implying that user errors are illegal.

diffstat:

 bin/sh/miscbltin.c |   7 ++++---
 bin/sh/mystring.c  |   6 +++---
 bin/sh/options.c   |  12 ++++++------
 bin/sh/parser.c    |   7 ++++---
 4 files changed, 17 insertions(+), 15 deletions(-)

diffs (137 lines):

diff -r e7c7384342dd -r f13079c2d608 bin/sh/miscbltin.c
--- a/bin/sh/miscbltin.c        Sat Apr 16 14:06:10 2022 +0000
+++ b/bin/sh/miscbltin.c        Sat Apr 16 14:20:45 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: miscbltin.c,v 1.47 2021/12/12 11:18:46 andvar Exp $    */
+/*     $NetBSD: miscbltin.c,v 1.48 2022/04/16 14:20:45 kre Exp $       */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)miscbltin.c        8.4 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: miscbltin.c,v 1.47 2021/12/12 11:18:46 andvar Exp $");
+__RCSID("$NetBSD: miscbltin.c,v 1.48 2022/04/16 14:20:45 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -268,7 +268,8 @@
                        mask = 0;
                        do {
                                if (*ap >= '8' || *ap < '0')
-                                       error("Illegal number: %s", argv[1]);
+                                       error("Not a valid octal number: '%s'",
+                                           argv[1]);
                                mask = (mask << 3) + (*ap - '0');
                        } while (*++ap != '\0');
                        umask(mask);
diff -r e7c7384342dd -r f13079c2d608 bin/sh/mystring.c
--- a/bin/sh/mystring.c Sat Apr 16 14:06:10 2022 +0000
+++ b/bin/sh/mystring.c Sat Apr 16 14:20:45 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mystring.c,v 1.18 2018/07/13 22:43:44 kre Exp $        */
+/*     $NetBSD: mystring.c,v 1.19 2022/04/16 14:20:45 kre Exp $        */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)mystring.c 8.2 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: mystring.c,v 1.18 2018/07/13 22:43:44 kre Exp $");
+__RCSID("$NetBSD: mystring.c,v 1.19 2022/04/16 14:20:45 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -117,7 +117,7 @@
 
        if (!is_digit(*s) || ((n = strtoimax(s, &ep, 10)), 
            (ep == NULL || ep == s || *ep != '\0')))
-               error("Illegal number: '%s'", s);
+               error("Invalid number: '%s'", s);
        if (n < INT_MIN || n > INT_MAX)
                error("Number out of range: %s", s);
        return (int)n;
diff -r e7c7384342dd -r f13079c2d608 bin/sh/options.c
--- a/bin/sh/options.c  Sat Apr 16 14:06:10 2022 +0000
+++ b/bin/sh/options.c  Sat Apr 16 14:20:45 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: options.c,v 1.56 2021/10/26 00:05:38 kre Exp $ */
+/*     $NetBSD: options.c,v 1.57 2022/04/16 14:20:45 kre Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)options.c  8.2 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: options.c,v 1.56 2021/10/26 00:05:38 kre Exp $");
+__RCSID("$NetBSD: options.c,v 1.57 2022/04/16 14:20:45 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -325,7 +325,7 @@
 #endif
                                return;
                        }
-               error("Illegal option %co %s", "+-"[val], name);
+               error("Unknown option %co %s", "+-"[val], name);
        }
 }
 
@@ -344,7 +344,7 @@
 #endif
                        return;
                }
-       error("Illegal option %c%c", "+-"[val], flag);
+       error("Unknown option %c%c", "+-"[val], flag);
        /* NOTREACHED */
 }
 
@@ -540,7 +540,7 @@
                                s[1] = '\0';
                                err |= setvarsafe("OPTARG", s, 0);
                        } else {
-                               outfmt(&errout, "Illegal option -%c\n", c);
+                               outfmt(&errout, "Unknown option -%c\n", c);
                                (void) unsetvar("OPTARG", 0);
                        }
                        c = '?';
@@ -631,7 +631,7 @@
        c = *p++;
        for (q = optstring ; *q != c ; ) {
                if (*q == '\0')
-                       error("Illegal option -%c", c);
+                       error("Unknown option -%c", c);
                if (*++q == ':')
                        q++;
        }
diff -r e7c7384342dd -r f13079c2d608 bin/sh/parser.c
--- a/bin/sh/parser.c   Sat Apr 16 14:06:10 2022 +0000
+++ b/bin/sh/parser.c   Sat Apr 16 14:20:45 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parser.c,v 1.177 2021/12/08 20:21:09 andvar Exp $      */
+/*     $NetBSD: parser.c,v 1.178 2022/04/16 14:20:45 kre Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)parser.c   8.7 (Berkeley) 5/16/95";
 #else
-__RCSID("$NetBSD: parser.c,v 1.177 2021/12/08 20:21:09 andvar Exp $");
+__RCSID("$NetBSD: parser.c,v 1.178 2022/04/16 14:20:45 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -795,7 +795,8 @@
                 * So, leave it like this until the rest of the parser is fixed.
                 */
                if (!noexpand(wordtext))
-                       synerror("Illegal eof marker for << redirection");
+                       synerror("Unimplemented form of eof marker"
+                           " for << redirection");
 
                rmescapes(wordtext);
                here->eofmark = wordtext;



Home | Main Index | Thread Index | Old Index