Hi,

This hack adds "-R" switch which sets ENV environment variable.

P.S.: the only tested command is: ./mksh -i -R ./clean.mkshrc
I don't know if it has other flows.

Regards,
Roy

Index: main.c
===================================================================
RCS file: /cvs/src/bin/mksh/main.c,v
retrieving revision 1.260
diff -u -r1.260 main.c
--- main.c      10 Feb 2013 21:42:40 -0000      1.260
+++ main.c      8 Mar 2013 01:43:49 -0000
@@ -453,6 +453,10 @@
        utf_flag = UTFMODE;
        UTFMODE = 0;

+       if (argi < argc && Flag(FRCFILE)) {
+               vp = global("ENV");
+               setstr(vp, argv[argi++], KSH_RETURN_ERROR);
+       }
        if (Flag(FAS_BUILTIN)) {
                /* auto-detect from environment variables, always */
                utf_flag = 3;
Index: sh_flags.h
===================================================================
RCS file: /cvs/src/bin/mksh/sh_flags.h,v
retrieving revision 1.12
diff -u -r1.12 sh_flags.h
--- sh_flags.h  28 Jun 2012 20:14:41 -0000      1.12
+++ sh_flags.h  8 Mar 2013 01:01:15 -0000
@@ -97,6 +97,9 @@
 /* -r  restricted shell */
 FN("restricted", FRESTRICTED, 'r', OF_CMDLINE)

+/* -R  rc file */
+FN("rcfile", FRCFILE, 'R', OF_CMDLINE)
+
 /* ./. pdksh compat: called as sh not mksh; kludge mode (non-standard) */
 FN("sh", FSH, 0, OF_ANY)


Reply via email to