Source-Changes-HG archive

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

[src/trunk]: src/bin/sh Support $OLDPWD. (christos@ will update the manual.)



details:   https://anonhg.NetBSD.org/src/rev/bbb56e830ba1
branches:  trunk
changeset: 765913:bbb56e830ba1
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Fri Jun 10 02:19:10 2011 +0000

description:
Support $OLDPWD.  (christos@ will update the manual.)

Reviewd By:     christos

diffstat:

 bin/sh/cd.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (47 lines):

diff -r cce8091c9ca6 -r bbb56e830ba1 bin/sh/cd.c
--- a/bin/sh/cd.c       Fri Jun 10 00:32:52 2011 +0000
+++ b/bin/sh/cd.c       Fri Jun 10 02:19:10 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cd.c,v 1.41 2011/02/17 15:13:49 pooka Exp $    */
+/*     $NetBSD: cd.c,v 1.42 2011/06/10 02:19:10 uebayasi Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)cd.c       8.2 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: cd.c,v 1.41 2011/02/17 15:13:49 pooka Exp $");
+__RCSID("$NetBSD: cd.c,v 1.42 2011/06/10 02:19:10 uebayasi Exp $");
 #endif
 #endif /* not lint */
 
@@ -264,9 +264,10 @@
                curdir = NULL;
                getpwd(1);
                INTON;
-               if (curdir)
+               if (curdir) {
+                       setvar("OLDPWD", prevdir, VEXPORT);
                        setvar("PWD", curdir, VEXPORT);
-               else
+               } else
                        unsetvar("PWD", 0);
                return;
        }
@@ -297,6 +298,7 @@
                ckfree(prevdir);
        prevdir = curdir;
        curdir = savestr(stackblock());
+       setvar("OLDPWD", prevdir, VEXPORT);
        setvar("PWD", curdir, VEXPORT);
        INTON;
 }
@@ -325,6 +327,7 @@
        else
                find_curdir(0);
 
+       setvar("OLDPWD", prevdir, VEXPORT);
        setvar("PWD", curdir, VEXPORT);
        out1str(curdir);
        out1c('\n');



Home | Main Index | Thread Index | Old Index