[mw-devel] MW3 r1023 - trunk/src

welshbyte at sucs.org welshbyte at sucs.org
Sun Mar 30 03:40:56 BST 2008


Author: welshbyte
Date: 2008-03-30 03:40:55 +0100 (Sun, 30 Mar 2008)
New Revision: 1023

Modified:
   trunk/src/main.c
   trunk/src/newmain.c
Log:
If get_folder_number fails on startup, don't set a current folder


Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c	2008-03-30 00:26:53 UTC (rev 1022)
+++ trunk/src/main.c	2008-03-30 02:40:55 UTC (rev 1023)
@@ -642,7 +642,11 @@
 
 	/* list new BBS items */
 	list_new_items(user,TRUE);
-	get_folder_number(fold,currentfolder);
+	if (!get_folder_number(fold,currentfolder))
+	{
+		currentfolder = -1;
+		fold->name[0] = '\0';
+	}
 
 	InitParser();
 	set_rights();

Modified: trunk/src/newmain.c
===================================================================
--- trunk/src/newmain.c	2008-03-30 00:26:53 UTC (rev 1022)
+++ trunk/src/newmain.c	2008-03-30 02:40:55 UTC (rev 1023)
@@ -101,6 +101,9 @@
 
 void c_last(CommandList *cm, int argc, char **argv, char *args)
 {
+	if (currentfolder < 0)
+		printf(_("No current folder.\n"));
+		return;
 	last_mesg=fold->last;
 	printf(_("Moved to end of folder. (message %d)\n"),last_mesg);
 	read_msg(currentfolder,last_mesg,user);
@@ -467,6 +470,9 @@
 
 void c_pwd(CommandList *cm, int argc, char **argv, char *args)
 {
+	if (currentfolder < 0)
+		printf(_("No current folder.\n"));
+		return;
 	printf(_("Current folder = %s\n"),fold->name);
 	if (last_mesg==0)
 		printf(_("You haven't read any messages in this folder yet.\n"));
@@ -735,6 +741,11 @@
 	int i,n;
 	struct folder f;
 
+	if (nofolders())
+	{
+		printf(_("No folders found.\n"));
+		return;
+	}
 	if (argc>1 && !strcasecmp(argv[1], "all"))
 	{
 		printf(_("Marking ALL folders as read.\n"));





More information about the mw-devel mailing list