summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjonb <none@none>2006-01-20 10:51:59 -0800
committerjonb <none@none>2006-01-20 10:51:59 -0800
commit1de7ff79aa681dad1598edaf52be6493d01ff971 (patch)
tree172dfefaa1290084b4e3b438f482f30977bd1a9d
parent865e09a46b399ddcc8d4eec1badf3470c04f0f9a (diff)
downloadillumos-joyent-1de7ff79aa681dad1598edaf52be6493d01ff971.tar.gz
PSARC/2005/460 Increasing the shell variable name length in csh
1191119 *csh* : can't use the set command for variable larger than 21 characters in csh
-rw-r--r--usr/src/cmd/csh/sh.c11
-rw-r--r--usr/src/cmd/csh/sh.h6
-rw-r--r--usr/src/cmd/csh/sh.tconst.c4
3 files changed, 16 insertions, 5 deletions
diff --git a/usr/src/cmd/csh/sh.c b/usr/src/cmd/csh/sh.c
index 7423f34482..f03ffbbaf6 100644
--- a/usr/src/cmd/csh/sh.c
+++ b/usr/src/cmd/csh/sh.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -120,6 +120,8 @@ main(int c, char **av)
struct sigvec osv;
struct sigaction sa;
tchar s_prompt[MAXHOSTNAMELEN+3];
+ char *c_max_var_len;
+ int c_max_var_len_size;
pfcshflag = 0;
@@ -203,6 +205,13 @@ main(int c, char **av)
* CHILD is munged when forking/waiting
*/
+ c_max_var_len_size = snprintf(NULL, 0, "%ld", MAX_VAR_LEN);
+ c_max_var_len = (char *)xalloc(c_max_var_len_size + 1);
+ (void) snprintf(c_max_var_len, (c_max_var_len_size + 1),
+ "%ld", MAX_VAR_LEN);
+ set(S_SUNW_VARLEN, strtots(NOSTR, c_max_var_len));
+ xfree(c_max_var_len);
+
/* don't do globbing here, just set exact copies */
setNS(S_noglob);
diff --git a/usr/src/cmd/csh/sh.h b/usr/src/cmd/csh/sh.h
index 590f646834..a8f4ec9cb1 100644
--- a/usr/src/cmd/csh/sh.h
+++ b/usr/src/cmd/csh/sh.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -386,9 +386,9 @@ struct varent *adrof1();
#define value(v) value1(v, &shvhed)
/*
- * MAX_VAR_LEN - maximum variable name defined by csh man page to be 20
+ * MAX_VAR_LEN - maximum variable name defined by csh man page to be 128
*/
-#define MAX_VAR_LEN 20
+#define MAX_VAR_LEN 128
/*
* MAX_VREF_LEN - maximum variable reference $name[...]
diff --git a/usr/src/cmd/csh/sh.tconst.c b/usr/src/cmd/csh/sh.tconst.c
index e8f16a346f..e7c54a9804 100644
--- a/usr/src/cmd/csh/sh.tconst.c
+++ b/usr/src/cmd/csh/sh.tconst.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2000 by Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -90,6 +90,8 @@ tchar S_SPLESLESSP[] = {' ', '<', '<', ' ', 0}; /* << */
tchar S_SPLESSP[] = {' ', '<', ' ', 0}; /* < */
tchar S_SPPPP[] = {' ', '.', '.', '.', 0}; /* ... */
tchar S_SPRBRA[] = {' ', ')', 0}; /* )*/
+tchar S_SUNW_VARLEN[] = {'S', 'U', 'N', 'W', '_',
+ 'V', 'A', 'R', 'L', 'E', 'N', 0};
tchar S_TERM[] = {'T','E','R','M',0};/*TERM*/
tchar S_TIL[] = {'~', 0}; /* ~ */
tchar S_TOPBIT[] = {(tchar)QUOTE, 0}; /* Was "\200". A hack! */