Source-Changes-HG archive

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

[src/trunk]: src/bin/sh Implement unset variable error messages from Ben Harris.



details:   https://anonhg.NetBSD.org/src/rev/ceb6b14fe8e6
branches:  trunk
changeset: 526998:ceb6b14fe8e6
user:      christos <christos%NetBSD.org@localhost>
date:      Wed May 15 14:59:21 2002 +0000

description:
Implement unset variable error messages from Ben Harris.

diffstat:

 bin/sh/expand.c |  15 +++++++++++++--
 bin/sh/sh.1     |   3 +--
 2 files changed, 14 insertions(+), 4 deletions(-)

diffs (53 lines):

diff -r 53d50a5a593e -r ceb6b14fe8e6 bin/sh/expand.c
--- a/bin/sh/expand.c   Wed May 15 14:15:17 2002 +0000
+++ b/bin/sh/expand.c   Wed May 15 14:59:21 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: expand.c,v 1.52 2001/09/19 06:38:19 itojun Exp $       */
+/*     $NetBSD: expand.c,v 1.53 2002/05/15 14:59:21 christos Exp $     */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)expand.c   8.5 (Berkeley) 5/15/95";
 #else
-__RCSID("$NetBSD: expand.c,v 1.52 2001/09/19 06:38:19 itojun Exp $");
+__RCSID("$NetBSD: expand.c,v 1.53 2002/05/15 14:59:21 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -657,6 +657,17 @@
        }
        varlen = 0;
        startloc = expdest - stackblock();
+       if (!set && uflag)
+               switch (subtype) {
+               case VSNORMAL:
+               case VSTRIMLEFT:
+               case VSTRIMLEFTMAX:
+               case VSTRIMRIGHT:
+               case VSTRIMRIGHTMAX:
+               case VSLENGTH:
+                       error("%.*s: parameter not set", p - var - 1, var);
+                       /* NOTREACHED */
+               }
        if (set && subtype != VSPLUS) {
                /* insert the value of the variable */
                if (special) {
diff -r 53d50a5a593e -r ceb6b14fe8e6 bin/sh/sh.1
--- a/bin/sh/sh.1       Wed May 15 14:15:17 2002 +0000
+++ b/bin/sh/sh.1       Wed May 15 14:59:21 2002 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: sh.1,v 1.46 2002/02/24 21:41:52 lukem Exp $
+.\"    $NetBSD: sh.1,v 1.47 2002/05/15 14:59:21 christos Exp $
 .\" Copyright (c) 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
 .\"
@@ -201,7 +201,6 @@
 .It Fl u Em nounset
 Write a message to standard error when attempting to expand a variable
 that is not set, and if the shell is not interactive, exit immediately.
-(UNIMPLEMENTED for 4.4alpha)
 .It Fl v Em verbose
 The shell writes its input to standard error as it is read.  Useful for
 debugging.



Home | Main Index | Thread Index | Old Index