[mw-devel] MW3 r1144 - trunk/src

welshbyte at sucs.org welshbyte at sucs.org
Tue Jan 5 17:31:31 GMT 2010


Author: welshbyte
Date: 2010-01-05 17:31:31 +0000 (Tue, 05 Jan 2010)
New Revision: 1144

Modified:
   trunk/src/
   trunk/src/alarm.c
   trunk/src/edit.c
   trunk/src/files.c
   trunk/src/hash.c
   trunk/src/newmain.c
   trunk/src/script_inst.c
   trunk/src/user.c
Log:
Various minor, educational tweaks.
Attempting to build mw on FreeBSD I found a few areas where portability could be improved and where deprecated things were being used:
- Include stdlib.h instead of malloc.h
- Include unistd.h to provide crypt(3) instead of crypt.h
- Explicitly include <sys/stat.h> to provide S_* constants
- REG_NOERROR isn't provided on FreeBSD (or documented anywhere), regcomp(3) returns 0 on success
- sigaction(2): "The sa_restorer element is obsolete and should not be used."
- Add tags file to svn:ignore




Property changes on: trunk/src
___________________________________________________________________
Modified: svn:ignore
   - *.o
*.d
core
newbbs
cscope.out
test
mwtest
mw
*~

   + *.o
*.d
core
newbbs
cscope.out
tags
test
mwtest
mw
*~


Modified: trunk/src/alarm.c
===================================================================
--- trunk/src/alarm.c	2010-01-03 20:41:14 UTC (rev 1143)
+++ trunk/src/alarm.c	2010-01-05 17:31:31 UTC (rev 1144)
@@ -15,7 +15,6 @@
 	s.sa_handler = &alarm_handler;
 	s.sa_mask = mask;
 	s.sa_flags = SA_RESTART;
-	s.sa_restorer = NULL;
 	sigaction(SIGALRM, &s, NULL);
 }
 
@@ -46,7 +45,6 @@
 	sigemptyset(&mask);
 	s.sa_handler = SIG_DFL;
 	s.sa_flags = 0;
-	s.sa_restorer = NULL;
 	s.sa_mask = mask;
 	sigaction(SIGALRM, &s, NULL);	
 	next_alarm = NULL;

Modified: trunk/src/edit.c
===================================================================
--- trunk/src/edit.c	2010-01-03 20:41:14 UTC (rev 1143)
+++ trunk/src/edit.c	2010-01-05 17:31:31 UTC (rev 1144)
@@ -8,7 +8,7 @@
 #include <signal.h>
 #include <string.h>
 #include <errno.h>
-#include <crypt.h>
+#include <unistd.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <stdarg.h>

Modified: trunk/src/files.c
===================================================================
--- trunk/src/files.c	2010-01-03 20:41:14 UTC (rev 1143)
+++ trunk/src/files.c	2010-01-05 17:31:31 UTC (rev 1144)
@@ -9,6 +9,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <sys/types.h>
+#include <sys/stat.h>
 #include <string.h>
 #include <errno.h>
 #include "strings.h"

Modified: trunk/src/hash.c
===================================================================
--- trunk/src/hash.c	2010-01-03 20:41:14 UTC (rev 1143)
+++ trunk/src/hash.c	2010-01-05 17:31:31 UTC (rev 1144)
@@ -4,11 +4,9 @@
 
 #include "hash.h"
 
-#include <malloc.h>
+#include <stdlib.h>
 #include <string.h>
-#include <ctype.h>
 #include <stdio.h>
-#include <readline/readline.h>
 
 #define INITIALBUCKETS 256
 #define INITIALFIELDS 64

Modified: trunk/src/newmain.c
===================================================================
--- trunk/src/newmain.c	2010-01-03 20:41:14 UTC (rev 1143)
+++ trunk/src/newmain.c	2010-01-05 17:31:31 UTC (rev 1144)
@@ -7,7 +7,7 @@
 #include <sys/types.h>
 #include <dirent.h>
 #include <errno.h>
-#include <crypt.h>
+#include <unistd.h>
 #include <string.h>
 #include <locale.h>
 #include "bb.h"

Modified: trunk/src/script_inst.c
===================================================================
--- trunk/src/script_inst.c	2010-01-03 20:41:14 UTC (rev 1143)
+++ trunk/src/script_inst.c	2010-01-05 17:31:31 UTC (rev 1144)
@@ -1823,7 +1823,7 @@
 	pattern=eval_arg(pc->argv[1], fargc, fargv);
 	if (replace) a=eval_arg(pc->argv[2], fargc, fargv);
 
-	if ((err=regcomp(&preg, pattern, regex_flags)) != REG_NOERROR)
+	if ((err=regcomp(&preg, pattern, regex_flags)))
 	{
 		regerror(err, &preg, buff, 80);
 		scr_devel_msg(pc, "%s", buff);

Modified: trunk/src/user.c
===================================================================
--- trunk/src/user.c	2010-01-03 20:41:14 UTC (rev 1143)
+++ trunk/src/user.c	2010-01-05 17:31:31 UTC (rev 1144)
@@ -8,7 +8,7 @@
 #include <fcntl.h>
 #include <ctype.h>
 #include <string.h>
-#include <crypt.h>
+#include <unistd.h>
 #include <stdlib.h>
 #include <pwd.h>
 #include "bb.h"




More information about the mw-devel mailing list