[mw-devel] [Git][arthur/mw][master] Misc decluttering and tidying

Andrew Price welshbyte at sucs.org
Fri Sep 22 20:39:10 BST 2017


Andrew Price pushed to branch master at Justin Mitchell / mw


Commits:
d4db3190 by Andrew Price at 2017-09-22T20:36:33+01:00
Misc decluttering and tidying

- Lowercase some unnecessary title casing
- Remove some low-value login/folder-related messages
- A couple of other tweaks

- - - - -


9 changed files:

- src/client/chattable.c
- src/client/edit.c
- src/client/incoming.c
- src/client/main.c
- src/client/new.c
- src/client/talker.c
- src/client/talker_privs.c
- src/client/user.c
- src/folders.c


Changes:

=====================================
src/client/chattable.c
=====================================
--- a/src/client/chattable.c
+++ b/src/client/chattable.c
@@ -51,7 +51,7 @@ CommandList chattable[]={
 {"mwrc"		,0x0200	,0, "Usage: mwrc [filename]", "Set/View your mwrc startup file", t_mwrc, 1},
 {"notsayto"	,0x0003	,2, "Usage: notsayto <user> <message>", "Talk normally but exclude a single user", t_notsayto, 1},
 {"protect"	,0x0020	,1, "Usage: protect <user> [level]", "Protect user from harm [to optional level]", t_protect, 1},
-{"quit"		,0x0000	,0, "Usage: quit", "Leave Talker", t_quit, 1},
+{"quit"		,0x0000	,0, "Usage: quit", "Leave talker", t_quit, 1},
 {"raw"		,0x0001	,1, "Usage: raw <message>", "Send raw message", t_raw, 1},
 {"remove"	,0x0808	,1, "Usage: remove <user> [reason]", "Eject user from BBS, ignoring protection", t_remove, 1},
 {"replay"	,0x0000	,2, "Usage: replay {since|serial|count} <number>", "Replay previous messages", t_replay, 1},


=====================================
src/client/edit.c
=====================================
--- a/src/client/edit.c
+++ b/src/client/edit.c
@@ -567,14 +567,14 @@ void edit_user(const char *args, const char *name)
 
 		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(_("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);
 		printf(_("Groups [%s]\n"), stats);
 
 		show_protection(usr->chatmode, usr->chatprivs, stats, 9);
-		printf(_("Talker: Modes=[%s]  Privs=[%s]  Protection=[%s]\n"),
+		printf(_("Talker: modes=[%s]  privs=[%s]  protection=[%s]\n"),
 		       display_cmflags(usr->chatmode),
 		       display_cpflags(usr->chatprivs),
 		       stats);


=====================================
src/client/incoming.c
=====================================
--- a/src/client/incoming.c
+++ b/src/client/incoming.c
@@ -501,9 +501,9 @@ static void display_error(ipc_message_t *msg)
 	int len = MAXTEXTLENGTH;
 
 	if (msg->head.type == IPC_TALKERROR) {
-		snprintf(tb, len, "Talker Error: %s", text);
+		snprintf(tb, len, "Talker error: %s", text);
 	} else {
-		snprintf(tb, len, "Unknown %s Error: %s", type, text);
+		snprintf(tb, len, "Unknown %s error: %s", type, text);
 	}
 
 	force_text(msg, buff, "System");


=====================================
src/client/main.c
=====================================
--- a/src/client/main.c
+++ b/src/client/main.c
@@ -653,7 +653,7 @@ int main(int argc, char **argv)
 	}
 
 	time_t when = user->record.lastlogout;
-	printf(_("\nLast logged out %s\n\n"),ctime(&when));
+	printf(_("Last logged out %s\n"),ctime(&when));
 	if (u_reg(user)) {
 		if (!autochat) {
 		printf(_("Type 'talker' to enter chat mode.\n"));


=====================================
src/client/new.c
=====================================
--- a/src/client/new.c
+++ b/src/client/new.c
@@ -37,7 +37,7 @@ void list_new_items(struct user *user, int flag)
 	int screen_height=screen_h();
 
 	if (nofolders())
-		{printf(_("There are no folders to read !\n")); return;}
+		return;
 	file=openfolderfile(O_RDONLY);
 	while (get_folder_entry(file,fol))
 	{
@@ -184,14 +184,15 @@ void show_new(struct user *user)
 	int folderfile;
 	int folnum=0;
 
-	data=(struct folder *)malloc(sizeof(*data));
-
 	if (nofolders())
-	{
-		printf(_("There are no folders to read !\n"));
-		free(data);
+		return;
+
+	data = malloc(sizeof(*data));
+	if (data == NULL) {
+		perror("Failed to show new messages");
 		return;
 	}
+
 	folderfile=openfolderfile(O_RDONLY);
 	while (get_folder_entry(folderfile,data))
 	{
@@ -221,10 +222,7 @@ void latest(struct user *user)
 	char datestr[30],sub[40];
 
 	if (nofolders())
-	{
-		printf(_("There are no folders to read !\n"));
 		return;
-	}
 	ffile=openfolderfile(O_RDONLY);
 
 	printf(_("    Folder  Mesg        Date                 From    Subject\n"));


=====================================
src/client/talker.c
=====================================
--- a/src/client/talker.c
+++ b/src/client/talker.c
@@ -1121,7 +1121,7 @@ void t_chaton(void)
 	snprintf(text, MAXTEXTLENGTH-1, "\03310%s has just joined talker room %d",
 	         urec->name, urec->room);
 	if (!quietmode) talk_send_rawbcast(text);
-	printf("\nNow entering the Talker. Use \".quit\" to leave and \".help\" for help.\n");
+	printf("Now entering the talker. Use \".quit\" to leave and \".help\" for help.\n");
 
 	/* run the common stuff for entering the talker */
 	enter_talker(1);


=====================================
src/client/talker_privs.c
=====================================
--- a/src/client/talker_privs.c
+++ b/src/client/talker_privs.c
@@ -156,7 +156,7 @@ unsigned long chatmode_describe(unsigned long old, unsigned long new, int ourapl
 		         user->record.name, user->record.room);
 		if (!quietmode) talk_send_rawbcast(text);
 
-		printf("\nNow entering the Talker. Use \".quit\" to leave and \".help\" for help.\n");
+		printf("Now entering the talker. Use \".quit\" to leave and \".help\" for help.\n");
 
 		/* run the common stuff for entering the talker */
 		enter_talker(3);


=====================================
src/client/user.c
=====================================
--- a/src/client/user.c
+++ b/src/client/user.c
@@ -69,7 +69,6 @@ static int old_usr(struct user *usr)
 		printf(_("Have a nice day. *:-)\n"));
 		exit(0);
 	}
-	printf(_("Hello %s.\n"), usr->record.name);
 	return 1;
 }
 


=====================================
src/folders.c
=====================================
--- a/src/folders.c
+++ b/src/folders.c
@@ -26,9 +26,7 @@ int openfolderfile(int mode)
 	int x;
 	x=open(FOLDERFILE,mode);
 	if (x<0)
-	{
-		perror("Open Folder File");
-	}
+		perror(FOLDERFILE);
 	return(x);
 }
 
@@ -105,10 +103,9 @@ int get_folder_number(struct folder *fol, int num)
 	int file;
 
 	if (nofolders())
-		{printf("There are no folders !\n");return 0;}
+		return 0;
 	if ((file=openfolderfile(O_RDONLY)) < 0) return 0;
-	lseek(file, sizeof(*fol) * num, SEEK_SET);
-	if (read(file,fol,sizeof(*fol))<0)
+	if (pread(file, fol, sizeof(*fol), sizeof(*fol) * num) < 0)
 	{
 		perror("get_folder_number");
 		return 0;



View it on GitLab: https://projects.sucs.org/arthur/mw/commit/d4db3190c20c42b7a540704c73ce8740e02cd410

---
View it on GitLab: https://projects.sucs.org/arthur/mw/commit/d4db3190c20c42b7a540704c73ce8740e02cd410
You're receiving this email because of your account on projects.sucs.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sucs.org/pipermail/mw-devel/attachments/20170922/991fd0d4/attachment-0001.html>


More information about the mw-devel mailing list