Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: 3.1.6-dev-20: runtime determination of MACHTYPE



This patch allows zsh to determine MACHTYPE at run-time, rather
than from the configure results of the build-machine, assuming
uname(2) is available.

I assume that the overhead is low enough that no one will feel
the need to disable this.

Index: configure.in
===================================================================
RCS file: /cvs/zsh/zsh/configure.in,v
retrieving revision 1.1.1.64
diff -u -r1.1.1.64 configure.in
--- configure.in	2000/03/13 01:52:19	1.1.1.64
+++ configure.in	2000/03/25 15:34:25
@@ -826,7 +826,8 @@
 	       mmap munmap msync \
 	       cap_get_proc \
 	       getrlimit \
-	       setlocale)
+	       setlocale \
+	       uname)
 AC_FUNC_STRCOLL
 
 if test $ac_cv_func_setpgrp = yes; then
Index: Src/params.c
===================================================================
RCS file: /cvs/zsh/zsh/Src/params.c,v
retrieving revision 1.1.1.48
diff -u -r1.1.1.48 params.c
--- Src/params.c	2000/03/14 08:17:02	1.1.1.48
+++ Src/params.c	2000/03/25 15:34:25
@@ -453,6 +453,10 @@
     char **new_environ, **envp, **envp2, **sigptr, **t;
     char buf[50], *str, *iname;
     int num_env, oae = opts[ALLEXPORT];
+#ifdef HAVE_UNAME
+    struct utsname unamebuf;
+    char *machinebuf;
+#endif
 
     paramtab = realparamtab = newparamtable(151, "paramtab");
 
@@ -538,7 +542,17 @@
 
     /* Add the standard non-special parameters */
     set_pwd_env();
+#ifdef HAVE_UNAME
+    if(uname(&unamebuf)) setsparam("MACHTYPE", ztrdup(MACHTYPE));
+    else
+    {
+       machinebuf = ztrdup(unamebuf.machine);
+       setsparam("MACHTYPE", machinebuf);
+    }
+	
+#else
     setsparam("MACHTYPE", ztrdup(MACHTYPE));
+#endif
     setsparam("OSTYPE", ztrdup(OSTYPE));
     setsparam("TTY", ztrdup(ttystrname));
     setsparam("VENDOR", ztrdup(VENDOR));



Messages sorted by: Reverse Date, Date, Thread, Author