summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2000-06-08 09:59:00 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2000-06-08 09:59:00 +0000
commit45d95dde4817285de344aea414e4543ef79efaab (patch)
treefd5f4223729d4e897521c89ea5efcc67a8005924
parenta95d0518267c37905f7cbab651429147a3dcd85a (diff)
downloadzsh-45d95dde4817285de344aea414e4543ef79efaab.tar.gz
zsh-45d95dde4817285de344aea414e4543ef79efaab.zip
11820: metafication of command line arguments
-rw-r--r--ChangeLog5
-rw-r--r--Src/main.c41
2 files changed, 36 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index b8addbf7c..f7aca4352 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2000-06-08 Peter Stephenson <pws@cambridgesiliconradio.com>
+
+ * pws: 11820: Src/main.c: metafication of command line arguments
+ didn't work because type table wasn't set up.
+
2000-06-08 Sven Wischnowsky <wischnow@zsh.org>
* 11817: Src/Zle/compmatch.c: more anchor matching fixes
diff --git a/Src/main.c b/Src/main.c
index 7ec8f07bd..dbf1addc5 100644
--- a/Src/main.c
+++ b/Src/main.c
@@ -35,22 +35,44 @@ int
main(int argc, char **argv)
{
char **t;
-#ifdef LC_ALL
+ int t0;
+#ifdef USE_LOCALE
setlocale(LC_ALL, "");
#endif
- global_permalloc();
-
init_hackzero(argv, environ);
+ /*
+ * Provisionally set up the type table to allow metafication.
+ * This will be done properly when we have decided if we are
+ * interactive
+ */
+ typtab['\0'] |= IMETA;
+ typtab[STOUC(Meta) ] |= IMETA;
+ typtab[STOUC(Marker)] |= IMETA;
+ for (t0 = (int)STOUC(Pound); t0 <= (int)STOUC(Nularg); t0++)
+ typtab[t0] |= ITOK | IMETA;
+
for (t = argv; *t; *t = metafy(*t, -1, META_ALLOC), t++);
- if (!(zsh_name = strrchr(argv[0], '/')))
- zsh_name = argv[0];
- else
- zsh_name++;
- if (*zsh_name == '-')
- zsh_name++;
+ zsh_name = argv[0];
+ do {
+ char *arg0 = zsh_name;
+ if (!(zsh_name = strrchr(arg0, '/')))
+ zsh_name = arg0;
+ else
+ zsh_name++;
+ if (*zsh_name == '-')
+ zsh_name++;
+ if (strcmp(zsh_name, "su") == 0) {
+ char *sh = zgetenv("SHELL");
+ if (sh && *sh && arg0 != sh)
+ zsh_name = sh;
+ else
+ break;
+ } else
+ break;
+ } while (zsh_name);
fdtable_size = OPEN_MAX;
fdtable = zcalloc(fdtable_size);
@@ -67,7 +89,6 @@ main(int argc, char **argv)
init_io();
setupvals();
init_signals();
- global_heapalloc();
init_bltinmods();
run_init_scripts();
init_misc();