[mw-devel] MW3 r1158 - trunk/src

welshbyte at sucs.org welshbyte at sucs.org
Fri Jul 23 12:02:41 BST 2010


Author: welshbyte
Date: 2010-07-23 12:02:40 +0100 (Fri, 23 Jul 2010)
New Revision: 1158

Removed:
   trunk/src/bool.h
Modified:
   trunk/src/del_user.c
   trunk/src/edit.c
   trunk/src/files.c
   trunk/src/folders.c
   trunk/src/main.c
   trunk/src/new.c
   trunk/src/newmain.c
   trunk/src/perms.c
   trunk/src/read.c
   trunk/src/script.c
   trunk/src/special.c
   trunk/src/strings.c
   trunk/src/talker.c
   trunk/src/talker_privs.c
   trunk/src/user.c
   trunk/src/who.c
Log:
Use <stdbool.h> instead of "bool.h"


Deleted: trunk/src/bool.h
===================================================================
--- trunk/src/bool.h	2010-07-23 09:41:42 UTC (rev 1157)
+++ trunk/src/bool.h	2010-07-23 11:02:40 UTC (rev 1158)
@@ -1,7 +0,0 @@
-#ifndef BOOL_H
-#define BOOL_H
-
-#define FALSE 0
-#define TRUE  !FALSE
-
-#endif /* BOOL_H */

Modified: trunk/src/del_user.c
===================================================================
--- trunk/src/del_user.c	2010-07-23 09:41:42 UTC (rev 1157)
+++ trunk/src/del_user.c	2010-07-23 11:02:40 UTC (rev 1158)
@@ -36,7 +36,7 @@
 			time_t when = user.lastlogout;
 			printf("Name: %s\tRname: %s\n",user.name,user.realname);
 			printf("Contact: %s\n",user.contact);
-			show_user_stats(user.status,buff,TRUE);
+			show_user_stats(user.status,buff,true);
 			printf("Status [%s]\n",buff);
 			printf("Lastlogin %s", ctime(&when));
 			printf("\nDelete(y/n)?");

Modified: trunk/src/edit.c
===================================================================
--- trunk/src/edit.c	2010-07-23 09:41:42 UTC (rev 1157)
+++ trunk/src/edit.c	2010-07-23 11:02:40 UTC (rev 1158)
@@ -14,7 +14,7 @@
 #include <stdarg.h>
 #include <stdlib.h>
 #include <time.h>
-#include "bool.h"
+#include <stdbool.h>
 #include "talker_privs.h"
 #include "special.h"
 #include "rooms.h"
@@ -76,13 +76,13 @@
 		sprintf(tmp, "%d:%d", i, r);
 		ipc_send_to_username(usr->name, IPC_LASTREAD, tmp);
 	}
-	show_user_stats(usr->status,tmp,TRUE);
+	show_user_stats(usr->status,tmp,true);
 	printf("current status %s\nnew status: ",tmp);
 	get_str(tmp,20);
 	if (*tmp) 
 	{
 		usr->status=user_stats(tmp,usr->status);
-		show_user_stats(usr->status,tmp,FALSE);
+		show_user_stats(usr->status,tmp,false);
 		printf("status now set to [%s]\n",tmp);
 	}
 }
@@ -157,11 +157,11 @@
 		char stats[12];
 		char *oldstats;
 
-		show_user_stats(usr.status,stats,FALSE);
+		show_user_stats(usr.status,stats,false);
 		oldstats = strdup(stats);
 		printf(_("Current status set to [%s]\n"),oldstats);
 
-		show_user_stats(255,stats,FALSE);
+		show_user_stats(255,stats,false);
 		printf(_("New status [+-=][%s]: "),stats);
 		get_str(stats,9);
 		if (*stats)
@@ -179,7 +179,7 @@
 			else
 				usr.status=i;
 
-			show_user_stats(usr.status,statout,FALSE);
+			show_user_stats(usr.status,statout,false);
 			printf(_("Status set to [%s].\n"),statout);
 			ipc_send_to_username(usr.name, IPC_STATUS, stats);
 			show_change(oldstats, statout, "%s has just changed %s's status", user->name, usr.name);
@@ -192,17 +192,17 @@
 		char stats[20];
 		char *oldstats;
 
-		show_special(usr.special,stats,FALSE);
+		show_special(usr.special,stats,false);
 		oldstats = strdup(stats);
 		printf(_("Current specials set to [%s]\n"),oldstats);
 
-		show_special(65535,stats,FALSE);
+		show_special(65535,stats,false);
 		printf(_("New specials [+-=][%s]: "),stats);
 		get_str(stats,18);
 		if (*stats)
 		{	char statout[20];
 			usr.special=set_special(stats,usr.special);
-			show_special(usr.special,statout,FALSE);
+			show_special(usr.special,statout,false);
 			printf(_("Specials set to [%s].\n"),statout);
 			ipc_send_to_username(usr.name, IPC_SPECIAL, stats);
 			show_change(oldstats, statout, "%s has just changed %s's specials", user->name, usr.name);
@@ -293,7 +293,7 @@
 		char stats[11];
 		char *oldstats;
 
-		show_fold_groups(usr.groups,stats,TRUE);
+		show_fold_groups(usr.groups,stats,true);
 		oldstats = strdup(stats);
 		printf(_("User currently in groups [%s]\n"),oldstats);
 		printf(_("New Groups [+-=][12345678]: "));
@@ -304,7 +304,7 @@
 			ipc_send_to_username(usr.name, IPC_GROUPS, stats);
 			mwlog("CHANGE(GROUPS) of %s by %s", usr.name, stats);
 
-			show_fold_groups(usr.groups,stats,FALSE);
+			show_fold_groups(usr.groups,stats,false);
 			show_change(oldstats, stats, "%s has just changed %s's groups", user->name, usr.name);
 			printf(_("Groups changed to [%s]\n"),stats);
 		}
@@ -547,12 +547,12 @@
 		char stats[10],specs[20];
 		long timeon;
 
-		show_user_stats(usr.status,stats,TRUE);
-		show_special(usr.special,specs,TRUE);
+		show_user_stats(usr.status,stats,true);
+		show_special(usr.special,specs,true);
 		printf(_("Username: %s\nReal Name: %s\n"),usr.name,usr.realname);
 		printf(_("Contact: %s\nStatus [%s]\tSpecials [%s]\n"),usr.contact,stats,specs);
 		
-		show_fold_groups(usr.groups,stats,TRUE);
+		show_fold_groups(usr.groups,stats,true);
 		printf(_("Groups [%s]\n"),stats);
 
 		show_protection(usr.chatmode, usr.chatprivs, stats, 9);
@@ -632,10 +632,10 @@
 	if (!get_folder_number(&fold,folnum)) return;
 	if (stringcmp(args,"status",2))
 	{
-		show_fold_stats(fold.status,tmp,TRUE);
+		show_fold_stats(fold.status,tmp,true);
 		printf(_("Folder %s\nCurrent status:-\n"),fold.name);
 		printf(_("User not in group [%s]\n"),tmp);
-		show_fold_stats(fold.g_status,tmp,TRUE);
+		show_fold_stats(fold.g_status,tmp,true);
 		printf(_("User in group [%s]\n"),tmp);
 		printf(_("Change to :-\n"));
 		printf(_("User not in group [+-=][arwRWpm]: "));
@@ -644,7 +644,7 @@
 		{
 			fold.status=folder_stats(tmp,fold.status);
 			snprintf(fullpath, 255, "FOLDER(STATUS) of %s by %s", fold.name, tmp);
-			show_fold_stats(fold.status,tmp,TRUE);
+			show_fold_stats(fold.status,tmp,true);
 			printf(_("Status changed to [%s]\n"),tmp);
 			if(!f_active(fold.status))
 				printf(_("WARNING: folder may get written over by the next folder created.\n"));
@@ -655,7 +655,7 @@
 		{
 			fold.g_status=folder_stats(tmp,fold.g_status);
 			snprintf(fullpath, 255, "%s %s", fullpath, tmp);
-			show_fold_stats(fold.g_status,tmp,TRUE);
+			show_fold_stats(fold.g_status,tmp,true);
 			printf(_("Status changed to [%s]\n"),tmp);
 			if(!f_active(fold.g_status))
 				printf(_("WARNING: folder may get written over by the next folder created.\n"));
@@ -664,7 +664,7 @@
 	}else
 	if (stringcmp(args,"groups",2))
 	{
-		show_fold_groups(fold.groups,tmp,TRUE);
+		show_fold_groups(fold.groups,tmp,true);
 		printf(_("Folder %s is currently in groups [%s]\n"),fold.name,tmp);
 		printf(_("Folder groups [+-=][12345678]: "));
 		get_str(tmp,10);
@@ -672,7 +672,7 @@
 		{
 			fold.groups=folder_groups(tmp,fold.groups);
 			mwlog("FOLDER(GROUPS) of %s by %s", fold.name, tmp);
-			show_fold_groups(fold.groups,tmp,TRUE);
+			show_fold_groups(fold.groups,tmp,true);
 			printf(_("Groups changed to [%s]\n"),tmp);
 		}
 	}else
@@ -728,13 +728,13 @@
 	if (stringcmp(args,"view",2))
 	{
 		char buff[10];
-		show_fold_stats(fold.status,buff,TRUE);
+		show_fold_stats(fold.status,buff,true);
 		printf(_("\nFolder Name: %s\nTopic: %s\nMessage range %d to %d\n"),
 		fold.name,fold.topic,fold.first,fold.last);
 		printf(_("Status (out of group) [%s]"),buff);
-		show_fold_stats(fold.g_status,buff,TRUE);
+		show_fold_stats(fold.g_status,buff,true);
 		printf(_("    (in group) [%s]\n"),buff);
-		show_fold_groups(fold.groups,buff,TRUE);
+		show_fold_groups(fold.groups,buff,true);
 		printf(_("Groups [%s]\n"),buff);
 	}
 	else

Modified: trunk/src/files.c
===================================================================
--- trunk/src/files.c	2010-07-23 09:41:42 UTC (rev 1157)
+++ trunk/src/files.c	2010-07-23 11:02:40 UTC (rev 1158)
@@ -12,13 +12,13 @@
 #include <sys/file.h>
 #include <string.h>
 #include <errno.h>
+#include <stdbool.h>
 #include "strings.h"
 #include "user.h"
 #include "perms.h"
 #include "files.h"
 #include "util.h"
 #include "who.h"
-#include "bool.h"
 #include "bb.h" // Just for MAXTEXTLENGTH, sigh
 
 int incoming_pipe;
@@ -105,13 +105,13 @@
 
 int is_old(struct person *usr, const char *name, int32_t *userposn)
 {
-	int file,found=FALSE;
+	int file,found=false;
 
-	if (access(USERFILE,00)) return(FALSE);
+	if (access(USERFILE,00)) return(false);
 	file=openuserfile(O_RDONLY);
 	while (!found && get_person(file,usr))
 		if (stringcmp(usr->name,name,-1) && !u_del(usr->status))
-			found=TRUE;
+			found=true;
 	if (found) 
 		*userposn=lseek(file,0,1)-sizeof(struct person);
 	close(file);

Modified: trunk/src/folders.c
===================================================================
--- trunk/src/folders.c	2010-07-23 09:41:42 UTC (rev 1157)
+++ trunk/src/folders.c	2010-07-23 11:02:40 UTC (rev 1158)
@@ -11,13 +11,13 @@
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <stdbool.h>
 #include "ipc.h"
 #include "files.h"
 #include "strings.h"
 #include "perms.h"
 #include "folders.h"
 #include "user.h"
-#include "bool.h"
 #include "intl.h"
 
 void add_folder(void)
@@ -64,7 +64,7 @@
 	new->last=0;
 	printf(_("Creating folder %s - %s\n"),new->name,new->topic);
 
-	auto_subscribe(folnum,TRUE);
+	auto_subscribe(folnum,true);
 	Lock_File(file); /* folder file */
 	if (write(file,new,sizeof(*new))<0)
 	{

Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c	2010-07-23 09:41:42 UTC (rev 1157)
+++ trunk/src/main.c	2010-07-23 11:02:40 UTC (rev 1158)
@@ -16,6 +16,7 @@
 #include <termcap.h>
 #include <wchar.h>
 #include <wctype.h>
+#include <stdbool.h>
 #include "bb.h"
 
 #include "Parse.h"
@@ -54,7 +55,6 @@
 #include "add.h"
 #include "colour.h"
 #include "init.h"
-#include "bool.h"
 #include "intl.h"
 
 #include <pwd.h>
@@ -97,7 +97,7 @@
 extern int script_terminate;
 extern int script_running;
 int idle_count;
-int remote=FALSE;
+int remote=false;
 FILE *output;
 int busy=0; /* if true dont display messages  i.e. during new/write */
 int quietmode=0;
@@ -499,7 +499,7 @@
 		if (b!=NULL)
 		{
 			if (is_old(user,b,&userposn))
-				list_new_items(user,TRUE);
+				list_new_items(user,true);
 		}else
 			printf(_("Username not permitted.\n"));
 	}
@@ -599,7 +599,7 @@
 			fprintf(stderr,_("%s: User %s not found.\n"),argv[0],argv[msguser_num]);
 			exit(-1);
 		}
-		remote=TRUE;
+		remote=true;
 		new(user);  
 		update_user(user,tmp);
 		free(user);
@@ -628,7 +628,7 @@
 			exit(-1);
 		}
 		rt = atoi(argv[folderuser_replyto]);
-		remote=TRUE;
+		remote=true;
 		add_msg(currentfolder,user,rt);
 		free(user);
 		free(fold);
@@ -753,7 +753,7 @@
 	who_add(getpid(),userposn);
 
 	/* list new BBS items */
-	list_new_items(user,TRUE);
+	list_new_items(user,true);
 	if (!get_folder_number(fold,currentfolder))
 	{
 		currentfolder = -1;

Modified: trunk/src/new.c
===================================================================
--- trunk/src/new.c	2010-07-23 09:41:42 UTC (rev 1157)
+++ trunk/src/new.c	2010-07-23 11:02:40 UTC (rev 1158)
@@ -8,7 +8,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <time.h>
-#include "bool.h"
+#include <stdbool.h>
 #include "alarm.h"
 #include "incoming.h"
 #include "strings.h"
@@ -150,7 +150,7 @@
 			}else
 			if (stringcmp(tmp,"unsubscribe",5))
 			{
-				set_subscribe(user,folnum,FALSE);
+				set_subscribe(user,folnum,false);
 				printf(_("Unsubscribing from %s.\n"),data->name);
 				break;
 			}else
@@ -162,7 +162,7 @@
 				stack_str(tmp);
 				currentfolder=folnum;
 				last_mesg=head.Ref;
-				return(TRUE);
+				return(true);
 			}
 		}
 	    }

Modified: trunk/src/newmain.c
===================================================================
--- trunk/src/newmain.c	2010-07-23 09:41:42 UTC (rev 1157)
+++ trunk/src/newmain.c	2010-07-23 11:02:40 UTC (rev 1158)
@@ -11,7 +11,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <time.h>
-#include "bool.h"
+#include <stdbool.h>
 #include "Parse.h"
 #include "iconv.h"
 #include "strings.h"
@@ -68,7 +68,7 @@
 {
 	CommandList	*c;
 	char		*x = NULL;
-	int		found=FALSE;
+	int		found=false;
 
 	if (topic!=NULL && (strchr(topic,'.')!=NULL || strchr(topic,'/')!=NULL))
 	{
@@ -84,14 +84,14 @@
 		{
 			/* search for best help file */
 			x = makepath(WIZHELP, "/", "general");
-			if (!access(x, 00)) found=TRUE;
+			if (!access(x, 00)) found=true;
 		}
 		/* no high-level help allowed, or available */
 		if (!found)
 		{
 			/* search for normal help */
 			x = makepath(HELPDIR, "/", "general");
-			if (!access(x, 00)) found=TRUE;
+			if (!access(x, 00)) found=true;
 		}
 		/* display message as to whether help was found */
 		if (found)
@@ -121,14 +121,14 @@
 		{
 			/* search for the best topic help */
 			x = makepath(WIZHELP, "/", topic);
-			if (!access(x, 00)) found=TRUE;
+			if (!access(x, 00)) found=true;
 		}
 		/* no high-level help allowed, or available */
 		if (!found)
 		{
 			/* search for normal topic help */
 			x = makepath(HELPDIR, "/", topic);
-			if (!access(x, 00)) found=TRUE;
+			if (!access(x, 00)) found=true;
 		}
 
 		/* display the file, or appropriate help message */
@@ -176,12 +176,12 @@
 
 void c_listnew(CommandList *cm, int argc, char **argv, char *args)
 {
-	list_new_items(user,TRUE);
+	list_new_items(user,true);
 }
 
 void c_listall(CommandList *cm, int argc, char **argv, char *args)
 {
-	list_new_items(user,FALSE);
+	list_new_items(user,false);
 }
 
 void c_new(CommandList *cm, int argc, char **argv, char *args)
@@ -642,12 +642,12 @@
 
 void c_listusers(CommandList *cm, int argc, char **argv, char *args)
 {
-	list_users(FALSE);
+	list_users(false);
 }
 
 void c_newusers(CommandList *cm, int argc, char **argv, char *args)
 {
-	list_users(TRUE);
+	list_users(true);
 }
 
 void c_since(CommandList *cm, int argc, char **argv, char *args)
@@ -687,22 +687,22 @@
 
 void c_resub(CommandList *cm, int argc, char **argv, char *args)
 {
-	if (get_subscribe(user,currentfolder)==TRUE)
+	if (get_subscribe(user,currentfolder)==true)
 		printf(_("You are already subscribed to %s.\n"),fold->name);
 	else
 	{
-		set_subscribe(user,currentfolder,TRUE);
+		set_subscribe(user,currentfolder,true);
 		printf(_("Resubscribing to %s.\n"),fold->name);
 	}
 }
 
 void c_unsub(CommandList *cm, int argc, char **argv, char *args)
 {
-	if (get_subscribe(user,currentfolder)==FALSE)
+	if (get_subscribe(user,currentfolder)==false)
 		printf(_("Already Unsubscribed from %s.\n"),fold->name);
 	else
 	{
-		set_subscribe(user,currentfolder,FALSE);
+		set_subscribe(user,currentfolder,false);
 		printf(_("Unsubscribing from %s.\n"),fold->name);
 	}
 }
@@ -731,9 +731,9 @@
 	char stats[10],gr[10], specials[20];
 	int protPower;
 
-	show_user_stats(user->status,stats,FALSE);
-	show_fold_groups(user->groups,gr,FALSE);
-	show_special(user->special,specials,FALSE);
+	show_user_stats(user->status,stats,false);
+	show_fold_groups(user->groups,gr,false);
+	show_special(user->special,specials,false);
 	printf(_("Current Status of %s\n"),user->name);
 	printf(_("Your real name is %s\n"),user->realname);
 	printf(_("Your contact address is %s\n"),user->contact);

Modified: trunk/src/perms.c
===================================================================
--- trunk/src/perms.c	2010-07-23 09:41:42 UTC (rev 1157)
+++ trunk/src/perms.c	2010-07-23 11:02:40 UTC (rev 1158)
@@ -9,25 +9,25 @@
 #include <string.h>
 #include <stdarg.h>
 #include <unistd.h>
+#include <stdbool.h>
 
 #include "bb.h"
-#include "bool.h"
 #include "perms.h"
 
 int allowed_r(struct folder *fol, struct person *usr)
 /* permission to read from folder */
 {
-	if (u_god(usr->status)) return(TRUE); /* superuser */
+	if (u_god(usr->status)) return(true); /* superuser */
 	if ((fol->groups)&(usr->groups)) /* you are in a common group */
 	{
-	if (u_reg(usr->status) && f_r_reg(fol->g_status)) return(TRUE); /* registered */
-	if (!u_reg(usr->status) && f_r_unreg(fol->g_status)) return(TRUE); /* unregistered */
+	if (u_reg(usr->status) && f_r_reg(fol->g_status)) return(true); /* registered */
+	if (!u_reg(usr->status) && f_r_unreg(fol->g_status)) return(true); /* unregistered */
 	}else  /* not in a common group */
 	{
-	if (u_reg(usr->status) && f_r_reg(fol->status)) return(TRUE); /* registered */
-	if (!u_reg(usr->status) && f_r_unreg(fol->status)) return(TRUE); /* unregistered */
+	if (u_reg(usr->status) && f_r_reg(fol->status)) return(true); /* registered */
+	if (!u_reg(usr->status) && f_r_unreg(fol->status)) return(true); /* unregistered */
 	}
-	return(FALSE);
+	return(false);
 }
 
 int is_private(struct folder *fol, struct person *usr)
@@ -40,7 +40,7 @@
 
 int is_moderated(struct folder *fol, struct person *usr)
 {
-	if (u_god(usr->status)) return(FALSE);
+	if (u_god(usr->status)) return(false);
 	if ((fol->groups)&(usr->groups))
 		return(f_moderated(fol->g_status));
 	else
@@ -49,136 +49,136 @@
 
 int allowed_w(struct folder *fol, struct person *usr) /* permission to write to folder */
 {
-	if (u_god(usr->status)) return(TRUE); /* superuser */
+	if (u_god(usr->status)) return(true); /* superuser */
 	if ((fol->groups)&(usr->groups)) /* you are in a common group */
 	{
-	if (u_reg(usr->status) && f_w_reg(fol->g_status)) return(TRUE); /* registered */
-	if (!u_reg(usr->status) && f_w_unreg(fol->g_status)) return(TRUE); /* unregistered */
+	if (u_reg(usr->status) && f_w_reg(fol->g_status)) return(true); /* registered */
+	if (!u_reg(usr->status) && f_w_unreg(fol->g_status)) return(true); /* unregistered */
 	}else  /* not in a common group */
 	{
-	if (u_reg(usr->status) && f_w_reg(fol->status)) return(TRUE); /* registered */
-	if (!u_reg(usr->status) && f_w_unreg(fol->status)) return(TRUE); /* unregistered */
+	if (u_reg(usr->status) && f_w_reg(fol->status)) return(true); /* registered */
+	if (!u_reg(usr->status) && f_w_unreg(fol->status)) return(true); /* unregistered */
 	}
-	return(FALSE);
+	return(false);
 }
 
 int u_ban(int user) /* is banned */
 {
 	if (user&(1<<3))
-		return(TRUE);
+		return(true);
 	else
-		return(FALSE);
+		return(false);
 }
 
 int u_del(int user) /* marked for deletion */
 {
 	if (user&(1<<7))
-		return(TRUE);
+		return(true);
 	else
-		return(FALSE);
+		return(false);
 }
 
 int u_god(int user) /* is a superuser */
 {
 	if (user&(1<<2))
-		return(TRUE);
+		return(true);
 	else
-		return(FALSE);
+		return(false);
 }
 
 int u_inform(int user) /* gets informed of logins/logouts */
 {
 	if (user&(1<<5))
-		return(TRUE);
+		return(true);
 	else
-		return(FALSE);
+		return(false);
 }
 
 int u_mesg(int user) /* messages off */
 {
 	if (user&(1<<4))
-		return(TRUE);
+		return(true);
 	else
-		return(FALSE);
+		return(false);
 }
 
 int u_beep(int user) /* beeps off */
 {
 	if (user&(1<<6))
-		return(TRUE);
+		return(true);
 	else
-		return(FALSE);
+		return(false);
 }
 
 int u_mod(int user) /* is a moderator */
 {
 	if (user&(1<<1))
-		return(TRUE);
+		return(true);
 	else
-		return(FALSE);}
+		return(false);}
 
 int u_reg(int user) /* is registered */
 {
 	if (user&1)
-		return(TRUE);
+		return(true);
 	else
-		return(FALSE);
+		return(false);
 }
 
 int f_active(int stat)
 {
 	if (stat&1)
-		return(TRUE);
+		return(true);
 	else
-		return(FALSE);
+		return(false);
 }
 
 int f_r_unreg(int stat)
 {
 	if (stat&(1<<1))
-		return(TRUE);
+		return(true);
 	else
-		return(FALSE);
+		return(false);
 }
 
 int f_w_unreg(int stat)
 {
 	if (stat&(1<<2))
-		return(TRUE);
+		return(true);
 	else
-		return(FALSE);
+		return(false);
 }
 
 int f_r_reg(int stat)
 {
 	if (stat&(1<<3))
-		return(TRUE);
+		return(true);
 	else
-		return(FALSE);
+		return(false);
 }
 
 int f_w_reg(int stat)
 {
 	if (stat&(1<<4))
-		return(TRUE);
+		return(true);
 	else
-		return(FALSE);
+		return(false);
 }
 
 int f_private(int stat)
 {
 	if (stat&(1<<5))
-		return(TRUE);
+		return(true);
 	else
-		return(FALSE);
+		return(false);
 }
 
 int f_moderated(int stat)
 {
 	if (stat&(1<<6))
-		return(TRUE);
+		return(true);
 	else
-		return(FALSE);
+		return(false);
 }
 
 char user_stats(char *string,char stat)
@@ -373,20 +373,20 @@
 	if (folder<=31 && folder>=0)
 	{
 		if (user->folders[0] & (1<<folder) )
-			return(TRUE);
+			return(true);
 		else
-			return(FALSE);
+			return(false);
 	}else
 	if (folder>=32 && folder <=63)
 	{
 		if (user->folders[1] & (1<< (folder-32)))
-			return(TRUE);
+			return(true);
 		else
-			return(FALSE);
+			return(false);
 	}else
 	{
 		printf("Error in get_subscribe folder %d\n",folder);
-		return(FALSE);
+		return(false);
 	}
 }
 
@@ -394,11 +394,11 @@
 {
 	if (folder>=0 && folder<=31)
 	{
-		if (status==TRUE)
+		if (status==true)
 		{
 			user->folders[0]|=(1<<folder);
 		}else
-		if (status==FALSE)
+		if (status==false)
 		{
 			user->folders[0]&=~(1<<folder);
 		}else
@@ -406,11 +406,11 @@
 	}else
 	if (folder>=32 && folder<=63)
 	{
-		if (status==TRUE)
+		if (status==true)
 		{
 			user->folders[1]|=(1<<(folder-32));
 		}else
-		if (status==FALSE)
+		if (status==false)
 		{
 			user->folders[1]&=~(1<<(folder-32));
 		}else

Modified: trunk/src/read.c
===================================================================
--- trunk/src/read.c	2010-07-23 09:41:42 UTC (rev 1157)
+++ trunk/src/read.c	2010-07-23 11:02:40 UTC (rev 1158)
@@ -9,7 +9,7 @@
 #include <stdio.h>
 #include <time.h>
 #include <string.h>
-#include "bool.h"
+#include <stdbool.h>
 #include "strings.h"
 #include "perms.h"
 #include "read.h"
@@ -25,14 +25,14 @@
 {
 	int no;
 	no=read(afile,tmp,sizeof(*tmp));
-	if (!no) return(FALSE); else
+	if (!no) return(false); else
 	if (no<sizeof(*tmp))
 	{
 		printf("Failed to read entire record. Folder Damaged.");
 		perror("read");
 		return(0);
 	}
-	return(TRUE);
+	return(true);
 }
 	
 void display_article(struct Header *tmp, int datafile)
@@ -57,7 +57,7 @@
 	}else
 	{
 		printf("Message: %d\nFrom: %s\nDate: %ld\n",tmp->Ref,tmp->from,(long)tmp->date);
-		show_mesg_stats(tmp->status,title,FALSE);
+		show_mesg_stats(tmp->status,title,false);
 		printf("Flags: %s\n",title);
 	}	
 	fprintf(output,"To: %s\nSubject: %s\n",tmp->to,tmp->subject);
@@ -105,7 +105,7 @@
 	char *x;	
 
 	if (nofolders())
-		{printf("There are no folders to read.\n");return(FALSE);}
+		{printf("There are no folders to read.\n");return(false);}
 
 	file=openfolderfile(O_RDONLY);
 	memset(&data, 0, sizeof(struct folder));
@@ -114,19 +114,19 @@
 	close(file);
 	
 	if (!(data.status&1))
-		{printf("That folder does not exist.\n");return(FALSE);}
+		{printf("That folder does not exist.\n");return(false);}
 	if (msgnum>data.last || msgnum<data.first)
-		{printf("There is no message %d.\n",msgnum);return(FALSE);}
+		{printf("There is no message %d.\n",msgnum);return(false);}
 	if (data.last<data.first || data.last==0)
-		{printf("Folder %s is empty.\n",data.name);return(FALSE);}
+		{printf("Folder %s is empty.\n",data.name);return(false);}
 	if ( !u_god(user->status) && !allowed_r(&data,user))
-		{printf("You are not permitted to read this folder.\n");return(FALSE);}
+		{printf("You are not permitted to read this folder.\n");return(false);}
 		
 	x=buildpath(STATEDIR,data.name,INDEX_END,"");
 	if (access(x,0)) 
 	{
 		printf("Error: cannot find index file for folder %s\n",data.name);
-		return(FALSE);
+		return(false);
 	}
 	if ((headfile=err_open(x,O_RDONLY,0))<0)
 		{exit(-1);}
@@ -136,7 +136,7 @@
 	{
 		printf("Error: cannot find text file for folder %s\n",data.name);
 		close(headfile);
-		return(FALSE);
+		return(false);
 	}
 	if ((textfile=err_open(x,O_RDONLY,0))<0)
 		{exit(-1);}
@@ -169,7 +169,7 @@
 	}
 	close(headfile);
 	close(textfile);
-	return(TRUE);
+	return(true);
 }
 
 void ls(int folnum, struct person *user, int many)
@@ -281,7 +281,7 @@
 	}
 }
 
-/* returns TRUE if okay, FALSE if failed for some reason */
+/* returns true if okay, false if failed for some reason */
 int get_mesg_header(struct folder *data, int msgnum, struct Header *head)
 {
 	int		headfile;
@@ -290,20 +290,20 @@
 	char		*x;	
 
 	/* folder data doesnt exist */
-	if (!data) return(FALSE);
-	if (!(data->status & 1)) return(FALSE);
+	if (!data) return(false);
+	if (!(data->status & 1)) return(false);
 
 	/* no message of that number */
-	if (msgnum > data->last || msgnum < data->first) return(FALSE);
+	if (msgnum > data->last || msgnum < data->first) return(false);
 
 	/* empty folder */
-	if (data->last < data->first || data->last == 0) return(FALSE);
+	if (data->last < data->first || data->last == 0) return(false);
 
 	x=buildpath(STATEDIR,data->name,INDEX_END,"");
 	/* no data file */
-	if (access(x,0)) return(FALSE);
+	if (access(x,0)) return(false);
 	/* cant open file */
-	if ((headfile=err_open(x,O_RDONLY,0))<0) return(FALSE);
+	if ((headfile=err_open(x,O_RDONLY,0))<0) return(false);
 
 	/* no message - file too small */
 	tmppos = lseek(headfile, 0, 2);

Modified: trunk/src/script.c
===================================================================
--- trunk/src/script.c	2010-07-23 09:41:42 UTC (rev 1157)
+++ trunk/src/script.c	2010-07-23 11:02:40 UTC (rev 1158)
@@ -11,6 +11,7 @@
 #include <pwd.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <stdbool.h>
 #include "bb.h"
 #include "talker_privs.h"
 #include "rooms.h"
@@ -20,7 +21,6 @@
 #include "talker.h"
 #include "init.h"
 #include "user.h"
-#include "bool.h"
 #include "alias.h"
 #include "script_inst.h"
 #include "scrcomplete.h"
@@ -130,7 +130,7 @@
 				if (func->flags & FUNCFLAG_AUTOINIT)
 				{
 					ExecEvent(func->name,autoexec_arg,"AutoExec",NULL,0);
-					func->new = FALSE;
+					func->new = false;
 				}
 			}
 			else
@@ -138,7 +138,7 @@
 				if (func->flags & FUNCFLAG_BOARDINIT)
 				{
 					ExecEvent(func->name,autoexec_arg,"AutoExec",NULL,0);
-					func->new = FALSE;
+					func->new = false;
 				}
 			}
 		}
@@ -185,7 +185,7 @@
 	/* insert new function into the list */
 	new=(struct function *)malloc(sizeof(struct function));
 	new->name=strdup(funcname);
-	new->new=TRUE;
+	new->new=true;
 	new->code=NULL;
 	new->jump=NULL;
 	new->flags = flags;
@@ -479,7 +479,7 @@
 {
 	char *x;
 	Instruction *inst;
-	int found=FALSE;
+	int found=false;
 
 	if (args!=NULL &&(strchr(args,'.')!=NULL || strchr(args,'/')!=NULL))
 	{
@@ -513,7 +513,7 @@
 		if (!access(x,00))
 		{
 			printfile(x);
-			found=TRUE;
+			found=true;
 		}
 		if (!found)
 			printf("No help available on that subject.\n");
@@ -1090,7 +1090,7 @@
 		if (len == 0 || !strncasecmp(name, text, len))
 		{
 			/* only if an interface function (default) */
-			if (hidden == FALSE)
+			if (hidden == false)
 			{
 				return dupstr(name, "");
 			}

Modified: trunk/src/special.c
===================================================================
--- trunk/src/special.c	2010-07-23 09:41:42 UTC (rev 1157)
+++ trunk/src/special.c	2010-07-23 11:02:40 UTC (rev 1158)
@@ -7,7 +7,7 @@
 #include <fcntl.h>
 #include <stdio.h>
 #include <string.h>
-#include "bool.h"
+#include <stdbool.h>
 
 /* short = 16 bits */
 unsigned short set_special(char *string, unsigned short stat)
@@ -72,112 +72,112 @@
 int s_coventry(unsigned short stat)
 {
 	if (stat&(1<<0))
-		return(TRUE);
+		return(true);
 	else
-		return(FALSE);
+		return(false);
 }
 
 int s_superuser(unsigned short stat)
 {
 	if (stat&(1<<1))
-		return(TRUE);
+		return(true);
 	else
-		return(FALSE);
+		return(false);
 }
 
 int s_wizchat(unsigned short stat)
 {
 	if (stat&(1<<2))
-		return(TRUE);
+		return(true);
 	else
-		return(FALSE);
+		return(false);
 }
 
 
 int s_chatoff(unsigned short stat)
 {
 	if (stat&(1<<3))
-		return(TRUE);
+		return(true);
 	else
-		return(FALSE);
+		return(false);
 }
 
 int s_timeout(unsigned short stat)
 {
 	if (stat&(1<<4))
-		return(TRUE);
+		return(true);
 	else
-		return(FALSE);
+		return(false);
 }
 
 int s_timestamp (unsigned short stat)
 {
 	if (stat&(1<<5))
-		return(TRUE);
+		return(true);
 	else
-		return(FALSE);
+		return(false);
 }
 
 int s_postinfo (unsigned short stat)
 {
 	if (stat&(1<<6))
-		return(TRUE);
+		return(true);
 	else
-		return(FALSE);
+		return(false);
 }
 
 int s_colouroff (unsigned short stat)
 {
 	if (stat&(1<<8))
-		return(TRUE);
+		return(true);
 	else
-		return(FALSE);
+		return(false);
 }
 
 int s_changeinfo (unsigned short stat)
 {
         if (stat&(1<<9))
-                return(TRUE);
+                return(true);
         else
-                return(FALSE);
+                return(false);
 }
 
 int s_quiet (unsigned short stat)
 {
 	if (stat&(1<<11))
-		return(TRUE);
+		return(true);
 	else
-		return(FALSE);
+		return(false);
 }
 
 int s_tcunames (unsigned short stat)
 {
         if (stat&(1<<12))
-                return(TRUE);
+                return(true);
         else
-                return(FALSE);
+                return(false);
 }
 
 int s_devel (unsigned short stat)
 {
         if (stat&(1<<13))
-                return(TRUE);
+                return(true);
         else
-                return(FALSE);
+                return(false);
 }
 
 int s_fixedcontact(unsigned short stat)
 {
 	if (stat&(1<<14))
-		return (TRUE);
+		return (true);
 	else
-		return (FALSE);
+		return (false);
 }
 
 int s_nolinewrap(unsigned short stat)
 {
 	if (stat&(1<<15))
-		return (TRUE);
+		return (true);
 	else
-		return (FALSE);
+		return (false);
 }

Modified: trunk/src/strings.c
===================================================================
--- trunk/src/strings.c	2010-07-23 09:41:42 UTC (rev 1157)
+++ trunk/src/strings.c	2010-07-23 11:02:40 UTC (rev 1158)
@@ -12,8 +12,8 @@
 #include "strings.h"
 #include "main.h"
 
-#define FALSE 	0
-#define TRUE	!FALSE
+#define false 	0
+#define true	!false
 
 extern char *mw_fgets();
 
@@ -37,17 +37,17 @@
 	/* match by atleast n (or shortest string) */
 	else
 	{
-		if (strlen(a)<n) return(FALSE);
+		if (strlen(a)<n) return(false);
 		length=strlen(a)>strlen(b)?strlen(a):strlen(b);
 		length=n<length?n:length;
 	}
 
-	if (length==0) return(FALSE);
+	if (length==0) return(false);
 
 	if (!strncasecmp(a,b,length)) 
-		return(TRUE);
+		return(true);
 	else 
-		return(FALSE);
+		return(false);
 }
 
 struct stacked_str *cmd_stack = NULL;

Modified: trunk/src/talker.c
===================================================================
--- trunk/src/talker.c	2010-07-23 09:41:42 UTC (rev 1157)
+++ trunk/src/talker.c	2010-07-23 11:02:40 UTC (rev 1158)
@@ -10,6 +10,7 @@
 #include <sys/types.h>
 #include <regex.h>
 #include <sqlite3.h>
+#include <stdbool.h>
 
 #include "bb.h"
 #include "Parse.h"
@@ -29,7 +30,6 @@
 #include "main.h"
 #include "init.h"
 #include "echo.h"
-#include "bool.h"
 #include "rooms.h"
 #include "ipc.h"
 #include "log.h"
@@ -1722,7 +1722,7 @@
 {
 	CommandList	*c;
 	char		*x;
-	int		found=FALSE;
+	int		found=false;
 
 	if (args!=NULL && (strchr(args,'.')!=NULL || strchr(args,'/')!=NULL))
 	{
@@ -1758,7 +1758,7 @@
 		if (!access(x,00))
 		{
 			printfile(x);
-			found=TRUE;
+			found=true;
 		}
 		if (!found) printf("Sorry, no help available on that subject.\n");
 	}

Modified: trunk/src/talker_privs.c
===================================================================
--- trunk/src/talker_privs.c	2010-07-23 09:41:42 UTC (rev 1157)
+++ trunk/src/talker_privs.c	2010-07-23 11:02:40 UTC (rev 1158)
@@ -9,8 +9,8 @@
 #include "main.h"
 #include "user.h"
 
-#define FALSE 0
-#define TRUE !FALSE
+#define false 0
+#define true !false
 
 extern struct person *user;
 extern long userposn;
@@ -124,10 +124,10 @@
 	if (mode==CM_MODE_SET) return(cm | flags); 
 	else
 	if (mode==CM_MODE_ANY) {
-		if ((cm&flags)>0) return(TRUE); else return(FALSE);
+		if ((cm&flags)>0) return(true); else return(false);
 	} else
 	if (mode==CM_MODE_ALL) {
-		if ((cm&flags)==flags) return(TRUE); else return(FALSE);
+		if ((cm&flags)==flags) return(true); else return(false);
 	}
 	return(0);
 }
@@ -514,10 +514,10 @@
 	if (mode==CM_MODE_CLEAR) return( cm & (~flags) ); 
 	else
 	if (mode==CM_MODE_ANY) { 
-		if ((cm&flags)>0) return(TRUE); else return(FALSE);
+		if ((cm&flags)>0) return(true); else return(false);
 	} else
 	if (mode==CM_MODE_ALL) {
-		if ((cm&flags)==flags) return(TRUE); else return(FALSE);
+		if ((cm&flags)==flags) return(true); else return(false);
 	}
 	return(0);
 }

Modified: trunk/src/user.c
===================================================================
--- trunk/src/user.c	2010-07-23 09:41:42 UTC (rev 1157)
+++ trunk/src/user.c	2010-07-23 11:02:40 UTC (rev 1158)
@@ -12,6 +12,7 @@
 #include <stdlib.h>
 #include <pwd.h>
 #include <time.h>
+#include <stdbool.h>
 #include "special.h"
 #include "talker_privs.h"
 #include "talker.h"
@@ -24,7 +25,6 @@
 #include "read.h"
 #include "who.h"
 #include "echo.h"
-#include "bool.h"
 #include "util.h"
 #include "intl.h"
 
@@ -106,7 +106,7 @@
 	}
 #endif
 	printf(_("Hello %s.\n"),usr->name);
-	return(TRUE);
+	return(true);
 }
 
 void strip_name(char *string)
@@ -166,7 +166,7 @@
 	int no;
 	if (!(no=read(file,tmp,sizeof(*tmp))))
 	{
-		return(FALSE);
+		return(false);
 	}else
 	if (no<sizeof(*tmp))
 	{	
@@ -177,7 +177,7 @@
 		exit(-1);
 	}
 
-	return(TRUE);
+	return(true);
 }
 
 void pick_salt(char *salt)
@@ -262,7 +262,7 @@
 		printf(_("What status do you want to be ? [rms] "));
 		get_str(buff,10);
 		tmp->status=user_stats(buff,0);
-		show_user_stats(tmp->status,buff,FALSE);
+		show_user_stats(tmp->status,buff,false);
 		printf(_("Status set to [%s]\n"),buff);
 	/* if you have a SUCS account, allow auto-registering if the logon name matches the sucs name */
 	}else if (!internet && getmylogin()!=NULL && !strcasecmp(getmylogin(),tmp->name))
@@ -285,7 +285,7 @@
 	}while (!*c);
 	if(*c=='y' || *c=='Y')
 	{
-		int diff=FALSE;
+		int diff=false;
 #ifndef RELEASE
 		if (getuid()!=geteuid())
 		{
@@ -341,9 +341,9 @@
 		printf(_("Creating new user %s\n"),name);
 
 		write_usr(usr,userposn);
-		return(TRUE);
+		return(true);
 	}
-	else return(FALSE);	
+	else return(false);	
 }
 
 void login_ok(struct person *usr, int32_t *userposn, int *autochat)
@@ -381,8 +381,8 @@
 		if (!newonly || ( newonly && !u_reg(usr.status) ) )
 		{
 			time=usr.lastlogout;
-			show_user_stats(usr.status,stats,TRUE);
-			show_fold_groups(usr.groups,gr,TRUE);
+			show_user_stats(usr.status,stats,true);
+			show_fold_groups(usr.groups,gr,true);
 			if (!u_del(usr.status))
 			{
 				linecount++;
@@ -420,8 +420,8 @@
 		if (usr.lastlogout>date)
 		{
 			time=usr.lastlogout;
-			show_user_stats(usr.status,stats,TRUE);
-			show_fold_groups(usr.groups,gr,TRUE);
+			show_user_stats(usr.status,stats,true);
+			show_fold_groups(usr.groups,gr,true);
 			if (!u_del(usr.status))
 			{
 				linecount++;
@@ -476,11 +476,11 @@
 		if (inv?check==0:check!=0)
 		{
 			time=usr.lastlogout;
-			show_user_stats(usr.status,stats,TRUE);
-			show_special(usr.special,spec,TRUE);
-			show_fold_groups(usr.groups,gr,TRUE);
-			show_chatmodes(usr.chatmode,cmodes,TRUE);
-			show_chatprivs(usr.chatprivs,cprivs,TRUE);
+			show_user_stats(usr.status,stats,true);
+			show_special(usr.special,spec,true);
+			show_fold_groups(usr.groups,gr,true);
+			show_chatmodes(usr.chatmode,cmodes,true);
+			show_chatprivs(usr.chatprivs,cprivs,true);
 			show_protection(usr.chatmode, usr.chatprivs, prot, 9);
 
 			if (!u_del(usr.status))

Modified: trunk/src/who.c
===================================================================
--- trunk/src/who.c	2010-07-23 09:41:42 UTC (rev 1157)
+++ trunk/src/who.c	2010-07-23 11:02:40 UTC (rev 1158)
@@ -12,6 +12,7 @@
 #include <string.h>
 #include <fcntl.h>
 #include <time.h>
+#include <stdbool.h>
 
 #include "talker_privs.h"
 #include "special.h"
@@ -22,7 +23,6 @@
 #include "perms.h"
 #include "who.h"
 #include "talker.h"
-#include "bool.h"
 
 extern int busy;
 extern struct person *user;
@@ -114,7 +114,7 @@
 		lseek(ufile,w.posn,0);
 		read(ufile,&u,sizeof(u));
 
-		show_user_stats(u.status,stats,TRUE);
+		show_user_stats(u.status,stats,true);
 
 		/* can they hear wiz messages ? */
 		if (s_wizchat(u.special) && !s_chatoff(u.special))




More information about the mw-devel mailing list