mc on SunOS



Hi,

any complaints about this patch?

Roland
This patch is needed for Solaris, as it does not have the setenv(3)
function.
Index: src/utilunix.c
===================================================================
RCS file: /cvsroot/mc/mc/src/utilunix.c,v
retrieving revision 1.76
diff -u -p -r1.76 utilunix.c
--- src/utilunix.c	11 Oct 2004 21:53:30 -0000	1.76
+++ src/utilunix.c	18 Oct 2004 21:48:54 -0000
@@ -292,6 +292,15 @@ tilde_expand (const char *directory)
     return g_strconcat (passwd->pw_dir, PATH_SEP_STR, q, (char *) NULL);
 }
 
+#if !defined(HAVE_SETENV) && defined(HAVE_PUTENV) && !defined(setenv)
+#define setenv mc_setenv
+static void
+mc_setenv (const char *name, const char *value, int overwrite_flag)
+{
+    if (overwrite_flag || getenv (name) == NULL)
+        putenv (g_strconcat (name, "=", value, (char *) NULL));
+}
+#endif
 
 /*
  * Return the directory where mc should keep its temporary files.
@@ -326,7 +335,7 @@ mc_tmpdir (void)
 		pwd->pw_name);
     else
 	g_snprintf (buffer, sizeof (buffer), "%s/mc-%d", sys_tmp,
-		getuid ());
+		(int) getuid ());
 
     canonicalize_pathname (buffer);
 


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