[GRASS-CVS] markus: grass6/lib/gis color_rand.c, 2.2, 2.2.6.1 error.c, 1.23, 1.23.2.1 gets.c, 2.4, 2.4.2.1 ls.c, 1.9, 1.9.2.1 popen.c, 2.4, 2.4.2.1 putenv.c, 2.1, 2.1.6.1 system.c, 2.5, 2.5.2.1

grass at intevation.de grass at intevation.de
Sun Nov 18 15:02:32 EST 2007


Author: markus

Update of /grassrepository/grass6/lib/gis
In directory doto:/tmp/cvs-serv23368

Modified Files:
      Tag: releasebranch_6_3
	color_rand.c error.c gets.c ls.c popen.c putenv.c system.c 
Log Message:
Portability fixes (merge from HEAD)

Index: color_rand.c
===================================================================
RCS file: /grassrepository/grass6/lib/gis/color_rand.c,v
retrieving revision 2.2
retrieving revision 2.2.6.1
diff -u -d -r2.2 -r2.2.6.1
--- color_rand.c	9 Feb 2006 03:08:56 -0000	2.2
+++ color_rand.c	18 Nov 2007 20:02:30 -0000	2.2.6.1
@@ -1,4 +1,5 @@
 #include <time.h>	/*  For time()	*/
+#include <stdio.h>	/*  For NULL */
 #include <stdlib.h>	/*  For rand() and srand() */
 #include <grass/gis.h>
 
@@ -27,7 +28,7 @@
     G_init_colors (colors);
     if (min > max) return -1;
 
-    srand(time ((long *)0));
+    srand(time(NULL));
 
     count = MAX_COLORS-DEVIATION + rand() % DEVIATION;
     if (count > max-min+1)

Index: error.c
===================================================================
RCS file: /grassrepository/grass6/lib/gis/error.c,v
retrieving revision 1.23
retrieving revision 1.23.2.1
diff -u -d -r1.23 -r1.23.2.1
--- error.c	9 Aug 2007 17:35:18 -0000	1.23
+++ error.c	18 Nov 2007 20:02:30 -0000	1.23.2.1
@@ -85,7 +85,6 @@
 static int no_sleep = 1;
 static int message_id = 1;
 
-extern char *getenv();
 static int print_word (FILE *, char **, int *, const int);
 static void print_sentence (FILE *, const int, const char *);
 static int print_error (const char *, const int);

Index: gets.c
===================================================================
RCS file: /grassrepository/grass6/lib/gis/gets.c,v
retrieving revision 2.4
retrieving revision 2.4.2.1
diff -u -d -r2.4 -r2.4.2.1
--- gets.c	10 Nov 2006 10:02:02 -0000	2.4
+++ gets.c	18 Nov 2007 20:02:30 -0000	2.4.2.1
@@ -37,8 +37,10 @@
 
 int G_gets (char *buf)
   {
-  	void (*sigtstp)();
+#ifdef SIGTSTP
+  	RETSIGTYPE (*sigtstp)();
   	int tty;
+#endif
 	char p[128];
 	char *eof;
   
@@ -47,7 +49,7 @@
   	if ((tty = isatty(0)))
   	{
 		sigtstp = signal (SIGTSTP, catch_ctrlz);
-		if (sigtstp != (void (*)()) SIG_DFL)
+		if (sigtstp != (RETSIGTYPE (*)()) SIG_DFL)
   		    signal (SIGTSTP, sigtstp);
   	}
 #endif
@@ -78,7 +80,7 @@
       G_warning ( "catch_ctrlz: ignored Ctrl-z" );
 #else
       
-  	void (*sigint)();
+  	RETSIGTYPE (*sigint)();
   
   /* having caught ctrlz - effect a ctrl-z using kill */
   	ctrlz = 1;

Index: ls.c
===================================================================
RCS file: /grassrepository/grass6/lib/gis/ls.c,v
retrieving revision 1.9
retrieving revision 1.9.2.1
diff -u -d -r1.9 -r1.9.2.1
--- ls.c	21 Sep 2007 22:01:51 -0000	1.9
+++ ls.c	18 Nov 2007 20:02:30 -0000	1.9.2.1
@@ -30,8 +30,8 @@
 
 static int cmp_names(const void *aa, const void *bb)
 {
-   char * const *a = aa;
-   char * const *b = bb;
+   char * const *a = (char * const *) aa;
+   char * const *b = (char * const *) bb;
    
    return strcmp(*a, *b);
 }

Index: popen.c
===================================================================
RCS file: /grassrepository/grass6/lib/gis/popen.c,v
retrieving revision 2.4
retrieving revision 2.4.2.1
diff -u -d -r2.4 -r2.4.2.1
--- popen.c	14 Apr 2007 23:02:00 -0000	2.4
+++ popen.c	18 Nov 2007 20:02:30 -0000	2.4.2.1
@@ -82,14 +82,17 @@
 
 int G_pclose( FILE *ptr)
 {
-    void (*sigint)();
+    RETSIGTYPE (*sigint)();
 #ifdef SIGHUP    
-    void (*sighup)();
+    RETSIGTYPE (*sighup)();
 #endif
 #ifdef SIGQUIT
-    void (*sigquit)();
+    RETSIGTYPE (*sigquit)();
+#endif
+    int f;
+#ifndef __MINGW32__
+    int r;
 #endif
-    int f, r;
     int status;
 
     f = fileno(ptr);

Index: putenv.c
===================================================================
RCS file: /grassrepository/grass6/lib/gis/putenv.c,v
retrieving revision 2.1
retrieving revision 2.1.6.1
diff -u -d -r2.1 -r2.1.6.1
--- putenv.c	9 Feb 2006 03:08:56 -0000	2.1
+++ putenv.c	18 Nov 2007 20:02:30 -0000	2.1.6.1
@@ -11,7 +11,9 @@
  * this routine sets the UNIX environment variable name to value
  ******************************************************************/
 
+#if !defined(HAVE_PUTENV) && !defined(HAVE_SETENV)
 extern char **environ;
+#endif
 
 void G_putenv(const char *name, const char *value)
 {

Index: system.c
===================================================================
RCS file: /grassrepository/grass6/lib/gis/system.c,v
retrieving revision 2.5
retrieving revision 2.5.2.1
diff -u -d -r2.5 -r2.5.2.1
--- system.c	14 Apr 2007 23:02:00 -0000	2.5
+++ system.c	18 Nov 2007 20:02:30 -0000	2.5.2.1
@@ -49,12 +49,14 @@
 
 int G_system (const char *command)
 {
-    int status, pid, w;
-    void (*sigint)()
+    int status;
+#ifndef __MINGW32__
+    int pid, w;
+#endif
+    RETSIGTYPE (*sigint)();
 #ifdef SIGQUIT
-        , (*sigquit)()
+    RETSIGTYPE (*sigquit)();
 #endif
-            ;
 
     sigint  = signal (SIGINT,  SIG_IGN);
 #ifdef SIGQUIT
@@ -72,6 +74,7 @@
               "/c",
               command,
               NULL );
+    status = 0;
 #else    
     if ( (pid = fork()) == 0)
     {




More information about the grass-commit mailing list