commit 5ebf72443b04d110e41c9f2f9dbc6a9796862e38
parent 94fa27339355b25aeb93a02ac36ab3b7921810b5
Author: tjg <tjg>
Date: Wed, 3 Apr 2002 14:57:21 +0000
Feature: make $version less magical, and exportable.
Bug: make $bqstatus and $status not exportable.
Diffstat:
5 files changed, 18 insertions(+), 20 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -769,6 +769,8 @@ Changes since rc-1.5b2
Release: rc-1.6c6.
-2002-03-27
+2002-04-03
- Feature: rename $version to $rc_version.
+ Feature: make $version less magical, and exportable.
+
+ Bug: make $bqstatus and $status not exportable.
diff --git a/hash.c b/hash.c
@@ -230,8 +230,8 @@ extern void initenv(char **envp) {
static bool var_exportable(char *s) {
static char *notforexport[] = {
- "apid", "apids", "cdpath", "home", "ifs",
- "path", "pid", "version", "*"
+ "apid", "apids", "bqstatus", "cdpath", "home", "ifs",
+ "path", "pid", "status", "*"
};
int i;
for (i = 0; i < arraysize(notforexport); i++)
diff --git a/main.c b/main.c
@@ -74,12 +74,13 @@ quitopts:
initsignal();
inithash();
initparse();
- assigndefault("prompt", "; ", "", (void *)0);
+ assigndefault("ifs", " ", "\t", "\n", (void *)0);
#ifdef DEFAULTPATH
assigndefault("path", DEFAULTPATH, (void *)0);
#endif
- assigndefault("ifs", " ", "\t", "\n", (void *)0);
assigndefault("pid", nprint("%d", rc_pid), (void *)0);
+ assigndefault("prompt", "; ", "", (void *)0);
+ assigndefault("version", VERSION, "$Release: @(#)" PACKAGE " " VERSION " " RELDATE " $", (void *)0);
initenv(envp);
initinput();
null[0] = NULL;
diff --git a/rc.1 b/rc.1
@@ -1399,15 +1399,6 @@ If this function is defined, then it gets executed every time
is about to print
.Cr "$prompt(1)" .
.TP
-.Cr rc_version " (read only)"
-The first element of this list variable is a string which identifies this
-version of
-.IR rc .
-The second element is a string which can be found by
-.B ident
-and
-.BR "sccs what" .
-.TP
.Cr status " (read only)"
The exit status of the last command.
If the command exited with a numeric value, that number is the status.
@@ -1429,6 +1420,15 @@ usually sets
.Cr $status
to
.Cr "(0 0)" .
+.TP
+.Cr version
+The first element of this list variable is a string which identifies this
+version of
+.IR rc .
+The second element is a string which can be found by
+.B ident
+and
+.BR "sccs what" .
.PP
The values of
.Cr "$path" ,
diff --git a/var.c b/var.c
@@ -57,9 +57,6 @@ extern bool varassign_string(char *extdef) {
associated with $status)
*/
-static List id2 = { "$Release: @(#)" PACKAGE " " VERSION " " RELDATE " $", 0, 0 };
-static List id1 = { VERSION, 0, &id2 };
-
extern List *varlookup(char *name) {
Variable *look;
List *ret, *l;
@@ -68,8 +65,6 @@ extern List *varlookup(char *name) {
return sgetapids();
if (streq(name, "status"))
return sgetstatus();
- if (streq(name, "rc_version"))
- return &id1;
if (*name != '\0' && (sub = a2u(name)) != -1) { /* handle $1, $2, etc. */
for (l = varlookup("*"); l != NULL && sub != 0; --sub)
l = l->n;