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

[MiNT] scriptability patch



A patch to just check UNIXMODE once at startup rather than later when
spawning for scriptability.

Alan.
Index: mintlib/globals.c
===================================================================
RCS file: /mint/mintlib/mintlib/globals.c,v
retrieving revision 1.8
diff -u -r1.8 globals.c
--- mintlib/globals.c	6 Dec 2005 19:27:57 -0000	1.8
+++ mintlib/globals.c	29 May 2008 20:46:08 -0000
@@ -39,6 +39,8 @@
 
 int __has_no_ssystem;
 
+int __scriptable;
+
 BASEPAGE *_base;
 char **environ;
 long __libc_argc = 1;
Index: mintlib/lib.h
===================================================================
RCS file: /mint/mintlib/mintlib/lib.h,v
retrieving revision 1.11
diff -u -r1.11 lib.h
--- mintlib/lib.h	28 Feb 2008 18:26:33 -0000	1.11
+++ mintlib/lib.h	29 May 2008 20:46:08 -0000
@@ -32,6 +32,7 @@
 extern int __has_no_ssystem;
 extern int __libc_enable_secure;
 extern int __libc_unix_names;
+extern int __scriptable;
 
 extern int _pdomain;
 extern char _rootdir;
Index: mintlib/main.c
===================================================================
RCS file: /mint/mintlib/mintlib/main.c,v
retrieving revision 1.10
diff -u -r1.10 main.c
--- mintlib/main.c	22 Jan 2008 10:08:18 -0000	1.10
+++ mintlib/main.c	29 May 2008 20:46:08 -0000
@@ -84,6 +85,7 @@
 
 	__libc_enable_secure = 1;
 	__libc_unix_names = 0;
+	__scriptable = 0;
 
 	__has_no_ssystem = Ssystem (-1, NULL, NULL);
 	_starttime = get_sysvar (_hz_200);
@@ -119,7 +121,7 @@
      
 	/* initialize UNIXMODE stuff. Note that this library supports only
 	 * a few of the UNIXMODE variables, namely "b" (binary mode default)
-	 * and "r<c>" (default root directory).
+	 * and "r<c>" (default root directory). And "s" for scriptability.
 	 */
 #if 1
  	if (__libc_enable_secure) {
@@ -137,6 +139,8 @@
 				__default_mode__.__binary = 1;
 			else if (*s == 'r' && s[1])
 				_rootdir = *++s;
+			else if (*s == 's')
+				__scriptable = 1;
 			else if (*s == '.' && s[1])
 				s++;	/* ignore */
 			s++;
Index: mintlib/spawn.c
===================================================================
RCS file: /mint/mintlib/mintlib/spawn.c,v
retrieving revision 1.6
diff -u -r1.6 spawn.c
--- mintlib/spawn.c	6 Dec 2005 19:27:57 -0000	1.6
+++ mintlib/spawn.c	29 May 2008 20:46:09 -0000
@@ -485,9 +485,7 @@
 		if (rval == -ENOEXEC) {
 			char	*umode;
 
-			 /* try to find UNIXMODE in environment */
-			if ((umode = getenv("UNIXMODE")) != NULL &&
-					strchr(umode, 's') != NULL ) {
+			if (__scriptable) {
 				(void)Mfree(env);
 				return interpret_script(mode, path, _path, _argv, _envp);
 			}