Code cleanup

This commit is contained in:
Michiel Broek 2005-08-19 20:48:54 +00:00
parent ccc8390ad3
commit 9e51c6dba7
29 changed files with 448 additions and 459 deletions

View File

@ -4,6 +4,7 @@ v0.71.5 18-Aug-2005
mbfido: mbfido:
Removed debug logging for solved crash. Removed debug logging for solved crash.
Code cleanup.
mbdiff: mbdiff:
Code cleanup. Code cleanup.
@ -17,6 +18,15 @@ v0.71.5 18-Aug-2005
mbuser: mbuser:
Code cleanup. Code cleanup.
mbfile:
Code cleanup.
mbmsg:
Code cleanup and removed dead code.
mbout:
Code cleanup.
v0.71.4 12-Aug-2005 - 18-Aug-2005 v0.71.4 12-Aug-2005 - 18-Aug-2005

View File

@ -4,7 +4,7 @@
* Purpose ...............: Global message base functions * Purpose ...............: Global message base functions
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2004 * Copyright (C) 1997-2005
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -389,9 +389,9 @@ int Msg_Link(char *Path, int do_quiet, int slow_util)
} }
if (!do_quiet) { if (!do_quiet) {
msg_colour(12, 0); msg_colour(LIGHTRED, BLACK);
printf(" (linking)"); printf(" (linking)");
msg_colour(13, 0); msg_colour(LIGHTMAGENTA, BLACK);
fflush(stdout); fflush(stdout);
} }

View File

@ -4,7 +4,7 @@
* Purpose ...............: ReArc an archive. * Purpose ...............: ReArc an archive.
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2004 * Copyright (C) 1997-2005
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -44,7 +44,7 @@ int rearc(char *filename, char *arctype, int do_quiet)
Syslog('f', "rearc(%s, %s)", filename, arctype); Syslog('f', "rearc(%s, %s)", filename, arctype);
if (!do_quiet) { if (!do_quiet) {
mbse_colour(12, 0); mbse_colour(LIGHTRED, BLACK);
printf(" ReArc file %s ", filename); printf(" ReArc file %s ", filename);
fflush(stdout); fflush(stdout);
} }
@ -145,7 +145,7 @@ int rearc(char *filename, char *arctype, int do_quiet)
} }
if (!do_quiet) { if (!do_quiet) {
mbse_colour(11, 0); mbse_colour(LIGHTCYAN, BLACK);
printf("\rUnpacking file %s ", filename); printf("\rUnpacking file %s ", filename);
fflush(stdout); fflush(stdout);
} }
@ -165,7 +165,7 @@ int rearc(char *filename, char *arctype, int do_quiet)
} }
if (!do_quiet) { if (!do_quiet) {
mbse_colour(10, 0); mbse_colour(LIGHTGREEN, BLACK);
printf("\r Packing file %s ", newname); printf("\r Packing file %s ", newname);
} }

View File

@ -4,7 +4,7 @@
* Purpose: MBSE BBS Outbound Manager * Purpose: MBSE BBS Outbound Manager
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2004 * Copyright (C) 1997-2005
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -59,9 +59,9 @@ void ProgName()
if (do_quiet) if (do_quiet)
return; return;
mbse_colour(15, 0); mbse_colour(WHITE, BLACK);
printf("\nMBOUT: MBSE BBS %s Outbound Manager\n", VERSION); printf("\nMBOUT: MBSE BBS %s Outbound Manager\n", VERSION);
mbse_colour(14, 0); mbse_colour(YELLOW, BLACK);
printf(" %s\n", COPYRIGHT); printf(" %s\n", COPYRIGHT);
} }
@ -97,7 +97,7 @@ void die(int onsig)
do_quiet = FALSE; do_quiet = FALSE;
if (!do_quiet) if (!do_quiet)
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
if (onsig) { if (onsig) {
if (onsig <= NSIG) if (onsig <= NSIG)
@ -110,7 +110,7 @@ void die(int onsig)
Syslog(' ', "MBOUT finished in %s", t_elapsed(t_start, t_end)); Syslog(' ', "MBOUT finished in %s", t_elapsed(t_start, t_end));
if (!do_quiet) { if (!do_quiet) {
mbse_colour(7, 0); mbse_colour(LIGHTGRAY, BLACK);
printf("\n"); printf("\n");
} }
ExitClient(onsig); ExitClient(onsig);
@ -124,11 +124,11 @@ void Help()
do_quiet = FALSE; do_quiet = FALSE;
ProgName(); ProgName();
mbse_colour(11, 0); mbse_colour(LIGHTCYAN, BLACK);
printf("\nUsage: mbout [command] <params> <options>\n\n"); printf("\nUsage: mbout [command] <params> <options>\n\n");
mbse_colour(9, 0); mbse_colour(LIGHTBLUE, BLACK);
printf(" Commands are:\n\n"); printf(" Commands are:\n\n");
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
printf(" a att <node> <flavor> <file> Attach a file to a node\n"); printf(" a att <node> <flavor> <file> Attach a file to a node\n");
printf(" n node <node> Show nodelist information\n"); printf(" n node <node> Show nodelist information\n");
printf(" p poll <node> [node..node] Poll node(s) (always crash)\n"); printf(" p poll <node> [node..node] Poll node(s) (always crash)\n");
@ -139,11 +139,11 @@ void Help()
printf("\n"); printf("\n");
printf(" <node> Should be in domain form, e.g. f16.n2801.z2.domain\n"); printf(" <node> Should be in domain form, e.g. f16.n2801.z2.domain\n");
printf(" <flavor> Flavor's are: crash | immediate | normal | hold\n"); printf(" <flavor> Flavor's are: crash | immediate | normal | hold\n");
mbse_colour(9, 0); mbse_colour(LIGHTBLUE, BLACK);
printf("\n Options are:\n\n"); printf("\n Options are:\n\n");
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
printf(" -quiet Quiet mode\n"); printf(" -quiet Quiet mode\n");
mbse_colour(7, 0); mbse_colour(LIGHTGRAY, BLACK);
die(MBERR_OK); die(MBERR_OK);
} }
@ -154,7 +154,7 @@ void Fatal(char *msg, int error)
{ {
show_log = TRUE; show_log = TRUE;
if (!do_quiet) { if (!do_quiet) {
mbse_colour(12, 0); mbse_colour(LIGHTRED, BLACK);
printf("%s\n", msg); printf("%s\n", msg);
} }
WriteError(msg); WriteError(msg);
@ -234,7 +234,7 @@ int main(int argc, char *argv[])
free(cmd); free(cmd);
if (!do_quiet) { if (!do_quiet) {
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
printf("\n"); printf("\n");
} }

View File

@ -4,7 +4,7 @@
* Purpose ...............: MBSE BBS Outbound Manager - show node info * Purpose ...............: MBSE BBS Outbound Manager - show node info
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2004 * Copyright (C) 1997-2005
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -50,7 +50,7 @@ int nlinfo(faddr *addr)
nlent = getnlent(addr); nlent = getnlent(addr);
if (nlent->pflag != NL_DUMMY) { if (nlent->pflag != NL_DUMMY) {
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
printf("System : %s\n", nlent->name); printf("System : %s\n", nlent->name);
printf("Sysop : %s@%s\n", nlent->sysop, ascinode(addr, 0x3f)); printf("Sysop : %s@%s\n", nlent->sysop, ascinode(addr, 0x3f));
printf("Location : %s\n", nlent->location); printf("Location : %s\n", nlent->location);

View File

@ -4,7 +4,7 @@
* Purpose ...............: Show mail outbound status * Purpose ...............: Show mail outbound status
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2004 * Copyright (C) 1997-2005
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -151,7 +151,7 @@ int outstat()
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s/etc/nodes.data", getenv("MBSE_ROOT")); sprintf(temp, "%s/etc/nodes.data", getenv("MBSE_ROOT"));
if ((fp = fopen(temp, "r")) == NULL) { if ((fp = fopen(temp, "r")) == NULL) {
WriteError("Error open %s, aborting", temp); WriteError("$Error open %s, aborting", temp);
free(temp); free(temp);
return MBERR_OUTBOUND_SCAN; return MBERR_OUTBOUND_SCAN;
} }
@ -282,9 +282,9 @@ int outstat()
} }
if (!do_quiet) { if (!do_quiet) {
mbse_colour(10, 0); mbse_colour(LIGHTGREEN, BLACK);
printf("flavor try size age address\n"); printf("flavor try size age address\n");
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
} }
Syslog('+', "Flavor Try Size Age Address"); Syslog('+', "Flavor Try Size Age Address");
@ -422,7 +422,7 @@ int each(faddr *addr, char flavor, int isflo, char *fname)
} }
fclose(fp); fclose(fp);
} else } else
WriteError("Can't open %s", fname); WriteError("$Can't open %s", fname);
} else if (isflo == OUT_PKT) { } else if (isflo == OUT_PKT) {
(*tmp)->size += st.st_size; (*tmp)->size += st.st_size;
@ -562,8 +562,6 @@ int freq(faddr *addr, char *fname)
char *req; char *req;
FILE *fp; FILE *fp;
Syslog('o', "Freq %s %s", ascfnode(addr, 0x1f), fname);
/* /*
* Append filename to .req file * Append filename to .req file
*/ */

View File

@ -4,7 +4,7 @@
* Purpose ...............: Announce new files and FileFind * Purpose ...............: Announce new files and FileFind
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2004 * Copyright (C) 1997-2005
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -67,7 +67,7 @@ void Uploads()
IsDoing("Check uploads"); IsDoing("Check uploads");
if (!do_quiet) { if (!do_quiet) {
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
printf(" Checking uploads...\n"); printf(" Checking uploads...\n");
} }
@ -373,7 +373,7 @@ int Announce()
int i, groups, any; int i, groups, any;
if (!do_quiet) { if (!do_quiet) {
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
printf("Announce new files\n"); printf("Announce new files\n");
} }

View File

@ -4,7 +4,7 @@
* Purpose ...............: Announce new files and FileFind * Purpose ...............: Announce new files and FileFind
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2004 * Copyright (C) 1997-2005
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -94,11 +94,11 @@ void ScanArea(ff_list **ffl)
unsigned long Number, Highest; unsigned long Number, Highest;
if (!do_quiet) { if (!do_quiet) {
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
printf("\r %-40s", scanmgr.Comment); printf("\r %-40s", scanmgr.Comment);
mbse_colour(12, 0); mbse_colour(LIGHTRED, BLACK);
printf(" (Scanning) "); printf(" (Scanning) ");
mbse_colour(13, 0); mbse_colour(LIGHTMAGENTA, BLACK);
fflush(stdout); fflush(stdout);
} }
Syslog('+', "Scanning %s", scanmgr.Comment); Syslog('+', "Scanning %s", scanmgr.Comment);
@ -267,12 +267,12 @@ void ScanFiles(ff_list *tmp)
Syslog('+', "ff: %s [%s]", temp, tmp->subject); Syslog('+', "ff: %s [%s]", temp, tmp->subject);
if (!do_quiet) { if (!do_quiet) {
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
temp[40] = '\0'; temp[40] = '\0';
printf("\r %-40s", temp); printf("\r %-40s", temp);
mbse_colour(12, 0); mbse_colour(LIGHTRED, BLACK);
printf(" (Searching)"); printf(" (Searching)");
mbse_colour(13, 0); mbse_colour(LIGHTMAGENTA, BLACK);
fflush(stdout); fflush(stdout);
} }
@ -363,7 +363,7 @@ void ScanFiles(ff_list *tmp)
if (found) { if (found) {
if (!do_quiet) { if (!do_quiet) {
mbse_colour(14, 0); mbse_colour(YELLOW, BLACK);
printf(" (Replying)"); printf(" (Replying)");
fflush(stdout); fflush(stdout);
} }
@ -488,7 +488,7 @@ int Filefind()
IsDoing("FileFind"); IsDoing("FileFind");
if (!do_quiet) { if (!do_quiet) {
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
printf("Processing FileFind requests\n"); printf("Processing FileFind requests\n");
} }
Syslog('+', "Processing FileFind requests"); Syslog('+', "Processing FileFind requests");
@ -520,7 +520,7 @@ int Filefind()
if (Replies) if (Replies)
rc = TRUE; rc = TRUE;
if (!do_quiet) { if (!do_quiet) {
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
printf("Processed %d requests, created %d replies\n", Requests, Replies); printf("Processed %d requests, created %d replies\n", Requests, Replies);
} }
} }

View File

@ -4,7 +4,7 @@
* Purpose ...............: Announce new files and FileFind * Purpose ...............: Announce new files and FileFind
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2004 * Copyright (C) 1997-2005
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -53,9 +53,9 @@ void ProgName(void)
if (do_quiet) if (do_quiet)
return; return;
mbse_colour(15, 0); mbse_colour(WHITE, BLACK);
printf("\nMBAFF: MBSE BBS %s Announce new files and FileFind\n", VERSION); printf("\nMBAFF: MBSE BBS %s Announce new files and FileFind\n", VERSION);
mbse_colour(14, 0); mbse_colour(YELLOW, BLACK);
printf(" %s\n", COPYRIGHT); printf(" %s\n", COPYRIGHT);
} }
@ -77,7 +77,7 @@ void die(int onsig)
Syslog(' ', "MBAFF finished in %s", t_elapsed(t_start, t_end)); Syslog(' ', "MBAFF finished in %s", t_elapsed(t_start, t_end));
if (!do_quiet) { if (!do_quiet) {
mbse_colour(7, 0); mbse_colour(LIGHTGRAY, BLACK);
printf("\n"); printf("\n");
} }
ExitClient(onsig); ExitClient(onsig);
@ -178,18 +178,18 @@ void Help(void)
do_quiet = FALSE; do_quiet = FALSE;
ProgName(); ProgName();
mbse_colour(11, 0); mbse_colour(LIGHTMAGENTA, BLACK);
printf("\nUsage: mbaff [command] <options>\n\n"); printf("\nUsage: mbaff [command] <options>\n\n");
mbse_colour(9, 0); mbse_colour(LIGHTBLUE, BLACK);
printf(" Commands are:\n\n"); printf(" Commands are:\n\n");
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
printf(" a announce Announce new files\n"); printf(" a announce Announce new files\n");
printf(" f filefind FileFind service\n"); printf(" f filefind FileFind service\n");
mbse_colour(9, 0); mbse_colour(LIGHTBLUE, BLACK);
printf("\n Options are:\n\n"); printf("\n Options are:\n\n");
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
printf(" -q -quiet Quiet mode\n"); printf(" -q -quiet Quiet mode\n");
mbse_colour(7, 0); mbse_colour(LIGHTGRAY, BLACK);
printf("\n"); printf("\n");
die(MBERR_COMMANDLINE); die(MBERR_COMMANDLINE);
} }

View File

@ -4,7 +4,7 @@
* Purpose: File Database Maintenance - Check filebase * Purpose: File Database Maintenance - Check filebase
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2004 * Copyright (C) 1997-2005
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -80,7 +80,7 @@ void Check(long AreaNr)
newdir = calloc(PATH_MAX, sizeof(char)); newdir = calloc(PATH_MAX, sizeof(char));
if (!do_quiet) { if (!do_quiet) {
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
printf("Checking file database...\n"); printf("Checking file database...\n");
} }

View File

@ -4,7 +4,7 @@
* Purpose: File Database Maintenance - Build index for request processor * Purpose: File Database Maintenance - Build index for request processor
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2004 * Copyright (C) 1997-2005
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -328,7 +328,7 @@ void ReqIndex(void)
IsDoing("Index files"); IsDoing("Index files");
if (!do_quiet) { if (!do_quiet) {
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
printf("Create index files...\n"); printf("Create index files...\n");
} }
@ -513,7 +513,7 @@ void HtmlIndex(char *Lang)
IsDoing("Create html"); IsDoing("Create html");
if (!do_quiet) { if (!do_quiet) {
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
printf("\rCreate html pages... \n"); printf("\rCreate html pages... \n");
} }

View File

@ -4,7 +4,7 @@
* Purpose: File Database Maintenance, kill or move old files * Purpose: File Database Maintenance, kill or move old files
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2004 * Copyright (C) 1997-2005
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -63,7 +63,7 @@ void Kill(void)
IsDoing("Kill files"); IsDoing("Kill files");
if (!do_quiet) { if (!do_quiet) {
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
printf("Kill/move files...\n"); printf("Kill/move files...\n");
} }

View File

@ -4,7 +4,7 @@
* Purpose: File Database Maintenance - Pack filebase * Purpose: File Database Maintenance - Pack filebase
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2004 * Copyright (C) 1997-2005
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -57,7 +57,7 @@ void PackFileBase(void)
IsDoing("Pack filebase"); IsDoing("Pack filebase");
if (!do_quiet) { if (!do_quiet) {
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
printf("Packing file database...\n"); printf("Packing file database...\n");
} }

View File

@ -4,7 +4,7 @@
* Purpose: File Database Maintenance - ReArc file(s) * Purpose: File Database Maintenance - ReArc file(s)
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2004 * Copyright (C) 1997-2005
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -99,7 +99,7 @@ void ReArc(int Area, char *File)
* Success, update the file entry * Success, update the file entry
*/ */
if (!do_quiet) { if (!do_quiet) {
mbse_colour(9, 0); mbse_colour(LIGHTBLUE, BLACK);
printf("\r Update file %s ", temp); printf("\r Update file %s ", temp);
fflush(stdout); fflush(stdout);
} }
@ -197,7 +197,7 @@ void ReArc(int Area, char *File)
break; // stop when something goes wrong break; // stop when something goes wrong
} }
if (!do_quiet) { if (!do_quiet) {
mbse_colour(7, 0); mbse_colour(LIGHTGRAY, BLACK);
printf("\r"); printf("\r");
for (i = 0; i < (strlen(temp) + 20); i++) for (i = 0; i < (strlen(temp) + 20); i++)
printf(" "); printf(" ");

View File

@ -4,7 +4,7 @@
* Purpose: File Database Maintenance - Sort filebase * Purpose: File Database Maintenance - Sort filebase
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2004 * Copyright (C) 1997-2005
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -56,7 +56,7 @@ void SortFileBase(int Area)
IsDoing("Sort filebase"); IsDoing("Sort filebase");
if (!do_quiet) { if (!do_quiet) {
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
} }
sprintf(sAreas, "%s/etc/fareas.data", getenv("MBSE_ROOT")); sprintf(sAreas, "%s/etc/fareas.data", getenv("MBSE_ROOT"));

View File

@ -4,7 +4,7 @@
* Purpose ...............: Message Base Maintenance * Purpose ...............: Message Base Maintenance
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2004 * Copyright (C) 1997-2005
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -40,7 +40,6 @@
int do_pack = FALSE; /* Pack flag */ int do_pack = FALSE; /* Pack flag */
int do_kill = FALSE; /* Kill flag (age and maxmsgs) */ int do_kill = FALSE; /* Kill flag (age and maxmsgs) */
int do_index = FALSE; /* Index flag */
int do_link = FALSE; /* Link messages */ int do_link = FALSE; /* Link messages */
int do_post = FALSE; /* Post a Message */ int do_post = FALSE; /* Post a Message */
extern int do_quiet; /* Quiet flag */ extern int do_quiet; /* Quiet flag */
@ -67,11 +66,11 @@ void ProgName()
if (do_quiet) if (do_quiet)
return; return;
mbse_colour(15, 0); mbse_colour(WHITE, BLACK);
printf("\nMBMSG: MBSE BBS %s - Message Base Maintenance Utility\n", VERSION); printf("\nMBMSG: MBSE BBS %s - Message Base Maintenance Utility\n", VERSION);
mbse_colour(14, 0); mbse_colour(YELLOW, BLACK);
printf(" %s\n", COPYRIGHT); printf(" %s\n", COPYRIGHT);
mbse_colour(7, 0); mbse_colour(LIGHTGRAY, BLACK);
} }
@ -108,8 +107,6 @@ int main(int argc, char **argv)
cmd = xstrcat(cmd, (char *)" "); cmd = xstrcat(cmd, (char *)" ");
cmd = xstrcat(cmd, argv[i]); cmd = xstrcat(cmd, argv[i]);
if (strncasecmp(argv[i], "i", 1) == 0)
do_index = TRUE;
if (strncasecmp(argv[i], "l", 1) == 0) if (strncasecmp(argv[i], "l", 1) == 0)
do_link = TRUE; do_link = TRUE;
if (strncasecmp(argv[i], "k", 1) == 0) if (strncasecmp(argv[i], "k", 1) == 0)
@ -144,7 +141,7 @@ int main(int argc, char **argv)
do_quiet = TRUE; do_quiet = TRUE;
} }
if (!(do_index || do_link || do_kill || do_pack || do_post)) if (!(do_link || do_kill || do_pack || do_post))
Help(); Help();
ProgName(); ProgName();
@ -159,10 +156,10 @@ int main(int argc, char **argv)
if (!do_quiet) { if (!do_quiet) {
printf("\n"); printf("\n");
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
} }
if (do_index || do_link || do_kill || do_pack) { if (do_link || do_kill || do_pack) {
memset(&MsgBase, 0, sizeof(MsgBase)); memset(&MsgBase, 0, sizeof(MsgBase));
DoMsgBase(); DoMsgBase();
} }
@ -183,19 +180,18 @@ void Help()
do_quiet = FALSE; do_quiet = FALSE;
ProgName(); ProgName();
mbse_colour(12, 0); mbse_colour(LIGHTCYAN, BLACK);
printf("\n Usage: mbmsg [command(s)] <options>\n\n"); printf("\n Usage: mbmsg [command(s)] <options>\n\n");
mbse_colour(9, 0); mbse_colour(LIGHTBLUE, BLACK);
printf(" Commands are:\n\n"); printf(" Commands are:\n\n");
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
// printf(" i index Create new index files\n");
printf(" l link Link messages by subject\n"); printf(" l link Link messages by subject\n");
printf(" k kill Kill messages (age & count)\n"); printf(" k kill Kill messages (age & count)\n");
printf(" pa pack Pack deleted messages\n"); printf(" pa pack Pack deleted messages\n");
printf(" po post <to> <#> <subj> <file> <flavor> Post file in message area #\n\n"); printf(" po post <to> <#> <subj> <file> <flavor> Post file in message area #\n\n");
mbse_colour(9, 0); mbse_colour(LIGHTBLUE, BLACK);
printf(" Options are:\n\n"); printf(" Options are:\n\n");
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
printf(" -a -area <#> Process area <#> only\n"); printf(" -a -area <#> Process area <#> only\n");
printf(" -q -quiet Quiet mode\n"); printf(" -q -quiet Quiet mode\n");
@ -210,7 +206,7 @@ void die(int onsig)
signal(onsig, SIG_IGN); signal(onsig, SIG_IGN);
if (!do_quiet) { if (!do_quiet) {
printf("\r"); printf("\r");
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
} }
if (MsgBase.Locked) if (MsgBase.Locked)
@ -238,7 +234,7 @@ void die(int onsig)
umask(oldmask); umask(oldmask);
if (!do_quiet) { if (!do_quiet) {
mbse_colour(7, 0); mbse_colour(LIGHTGRAY, BLACK);
printf("\r \n"); printf("\r \n");
} }
ExitClient(onsig); ExitClient(onsig);
@ -253,8 +249,8 @@ void DoMsgBase()
long arearec; long arearec;
int Del = 0; int Del = 0;
sAreas = calloc(81, sizeof(char)); sAreas = calloc(PATH_MAX, sizeof(char));
Name = calloc(81, sizeof(char )); Name = calloc(PATH_MAX, sizeof(char ));
IsDoing("Msg Maintenance"); IsDoing("Msg Maintenance");
@ -270,8 +266,8 @@ void DoMsgBase()
sprintf(sAreas, "%s/etc/mareas.data", getenv("MBSE_ROOT")); sprintf(sAreas, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
if(( pAreas = fopen (sAreas, "r")) == NULL) { if(( pAreas = fopen (sAreas, "r")) == NULL) {
WriteError("$Can't open Messages Areas File."); WriteError("$Can't open %s", sAreas);
die(MBERR_INIT_ERROR); die(MBERR_GENERAL);
} }
fread(&msgshdr, sizeof(msgshdr), 1, pAreas); fread(&msgshdr, sizeof(msgshdr), 1, pAreas);
@ -284,7 +280,7 @@ void DoMsgBase()
die(MBERR_DISK_FULL); die(MBERR_DISK_FULL);
if (!do_quiet) { if (!do_quiet) {
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
printf("\r%5ld .. %-40s", do_area, msgs.Name); printf("\r%5ld .. %-40s", do_area, msgs.Name);
fflush(stdout); fflush(stdout);
} }
@ -294,8 +290,6 @@ void DoMsgBase()
KillArea(msgs.Base, msgs.Name, msgs.DaysOld, msgs.MaxMsgs, do_area); KillArea(msgs.Base, msgs.Name, msgs.DaysOld, msgs.MaxMsgs, do_area);
if (do_pack || msg_del) if (do_pack || msg_del)
PackArea(msgs.Base, do_area); PackArea(msgs.Base, do_area);
if (do_index)
IndexArea(msgs.Base, do_area);
if (do_link) if (do_link)
LinkArea(msgs.Base, do_area); LinkArea(msgs.Base, do_area);
if (processed) if (processed)
@ -314,7 +308,7 @@ void DoMsgBase()
Nopper(); Nopper();
if (!do_quiet) { if (!do_quiet) {
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
printf("\r%5ld .. %-40s", arearec, msgs.Name); printf("\r%5ld .. %-40s", arearec, msgs.Name);
fflush(stdout); fflush(stdout);
} }
@ -327,8 +321,6 @@ void DoMsgBase()
PackArea(msgs.Base, arearec); PackArea(msgs.Base, arearec);
} }
Del = msg_del; Del = msg_del;
if (do_index)
IndexArea(msgs.Base, arearec);
if (do_link) if (do_link)
LinkArea(msgs.Base, arearec); LinkArea(msgs.Base, arearec);
if (processed) if (processed)
@ -341,8 +333,8 @@ void DoMsgBase()
if (!do_area) { if (!do_area) {
sprintf(sAreas, "%s/etc/users.data", getenv("MBSE_ROOT")); sprintf(sAreas, "%s/etc/users.data", getenv("MBSE_ROOT"));
if ((pAreas = fopen (sAreas, "r")) == NULL) { if ((pAreas = fopen (sAreas, "r")) == NULL) {
WriteError("$Can't open Messages Areas File."); WriteError("$Can't open %s", sAreas);
die(SIGILL); die(MBERR_GENERAL);
} }
fread(&usrconfighdr, sizeof(usrconfighdr), 1, pAreas); fread(&usrconfighdr, sizeof(usrconfighdr), 1, pAreas);
@ -351,7 +343,7 @@ void DoMsgBase()
Nopper(); Nopper();
sprintf(Name, "User %s email area: mailbox", usrconfig.Name); sprintf(Name, "User %s email area: mailbox", usrconfig.Name);
if (!do_quiet) { if (!do_quiet) {
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
printf("\r .. %-40s", Name); printf("\r .. %-40s", Name);
fflush(stdout); fflush(stdout);
} }
@ -364,8 +356,6 @@ void DoMsgBase()
PackArea(sAreas, 0); PackArea(sAreas, 0);
} }
Del = msg_del; Del = msg_del;
if (do_index)
IndexArea(sAreas, 0);
if (do_link) if (do_link)
LinkArea(sAreas, 0); LinkArea(sAreas, 0);
if (processed) if (processed)
@ -379,8 +369,6 @@ void DoMsgBase()
if (do_pack || (Del != msg_del)) if (do_pack || (Del != msg_del))
PackArea(sAreas, 0); PackArea(sAreas, 0);
Del = msg_del; Del = msg_del;
if (do_index)
IndexArea(sAreas, 0);
if (do_link) if (do_link)
LinkArea(sAreas, 0); LinkArea(sAreas, 0);
if (processed) if (processed)
@ -394,8 +382,6 @@ void DoMsgBase()
if (do_pack || (Del != msg_del)) if (do_pack || (Del != msg_del))
PackArea(sAreas, 0); PackArea(sAreas, 0);
Del = msg_del; Del = msg_del;
if (do_index)
IndexArea(sAreas, 0);
if (do_link) if (do_link)
LinkArea(sAreas, 0); LinkArea(sAreas, 0);
if (processed) if (processed)
@ -447,9 +433,9 @@ void KillArea(char *Path, char *Name, int DaysOld, int MaxMsgs, long Areanr)
if (Msg_Open(Path)) { if (Msg_Open(Path)) {
if (!do_quiet) { if (!do_quiet) {
mbse_colour(12, 0); mbse_colour(LIGHTRED, BLACK);
printf(" (Killing)"); printf(" (Killing)");
mbse_colour(13, 0); mbse_colour(LIGHTMAGENTA, BLACK);
fflush(stdout); fflush(stdout);
} }
@ -550,12 +536,6 @@ void KillArea(char *Path, char *Name, int DaysOld, int MaxMsgs, long Areanr)
void IndexArea(char *Path, long Areanr)
{
}
/* /*
* Pack message area if there are deleted messages. * Pack message area if there are deleted messages.
*/ */
@ -565,7 +545,7 @@ void PackArea(char *Path, long Areanr)
if (Msg_Open(Path)) { if (Msg_Open(Path)) {
if (!do_quiet) { if (!do_quiet) {
mbse_colour(12, 0); mbse_colour(LIGHTRED, BLACK);
printf(" (Packing)"); printf(" (Packing)");
fflush(stdout); fflush(stdout);
} }

View File

@ -1,13 +1,14 @@
#ifndef _MBMSG_H #ifndef _MBMSG_H
#define _MBMSG_H #define _MBMSG_H
/* $Id$ */
void ProgName(void); void ProgName(void);
void Help(void); void Help(void);
void die(int); void die(int);
void DoMsgBase(void); void DoMsgBase(void);
void PackArea(char *, long); void PackArea(char *, long);
void LinkArea(char *, long); void LinkArea(char *, long);
void IndexArea(char *, long);
void KillArea(char *, char *, int, int, long); void KillArea(char *, char *, int, int, long);
#endif #endif

View File

@ -535,7 +535,7 @@ int Areas(void)
Mgrlog("Process areas taglists"); Mgrlog("Process areas taglists");
if (!do_quiet) { if (!do_quiet) {
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
printf("Processing areas taglists...\n"); printf("Processing areas taglists...\n");
} }

View File

@ -4,7 +4,7 @@
* Purpose ...............: Write notify messages. * Purpose ...............: Write notify messages.
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2004 * Copyright (C) 1997-2005
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -62,9 +62,9 @@ int Notify(char *Options)
Syslog('+', "Notify \"%s\"", Options); Syslog('+', "Notify \"%s\"", Options);
if (!do_quiet) { if (!do_quiet) {
mbse_colour(9, 0); mbse_colour(LIGHTBLUE, BLACK);
printf("Writing notify messages\n"); printf("Writing notify messages\n");
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
} }
if (strlen(Options)) { if (strlen(Options)) {

View File

@ -53,7 +53,7 @@ int Post(char *To, long Area, char *Subj, char *File, char *Flavor)
mbse_CleanSubject(Subj); mbse_CleanSubject(Subj);
if (!do_quiet) { if (!do_quiet) {
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
printf("Post \"%s\" to \"%s\" in area %ld\n", File, To, Area); printf("Post \"%s\" to \"%s\" in area %ld\n", File, To, Area);
} }

View File

@ -91,7 +91,7 @@ int ProcessTic(fa_list **sbl)
Temp = calloc(PATH_MAX, sizeof(char)); Temp = calloc(PATH_MAX, sizeof(char));
if (!do_quiet) { if (!do_quiet) {
mbse_colour(10, 0); mbse_colour(LIGHTGREEN, BLACK);
printf("Checking \b\b\b\b\b\b\b\b\b\b"); printf("Checking \b\b\b\b\b\b\b\b\b\b");
fflush(stdout); fflush(stdout);
} }

View File

@ -5,7 +5,7 @@
* Remarks ...............: Most of these functions are borrowed from inn. * Remarks ...............: Most of these functions are borrowed from inn.
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2004 * Copyright (C) 1997-2005
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -543,7 +543,7 @@ void NewsUUCP(void)
IsDoing((char *)"UUCP Batch"); IsDoing((char *)"UUCP Batch");
if (!do_quiet) { if (!do_quiet) {
mbse_colour(10, 0); mbse_colour(LIGHTGREEN, BLACK);
printf("Process UUCP Newsbatch\n"); printf("Process UUCP Newsbatch\n");
} }

View File

@ -157,9 +157,9 @@ void ScanFull()
IsDoing("Scanning mail"); IsDoing("Scanning mail");
if (!do_quiet) { if (!do_quiet) {
mbse_colour(9, 0); mbse_colour(LIGHTBLUE, BLACK);
printf("Scanning mail\n"); printf("Scanning mail\n");
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
fflush(stdout); fflush(stdout);
} }
@ -173,9 +173,9 @@ void ScanFull()
Nopper(); Nopper();
if (!do_quiet) { if (!do_quiet) {
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
printf("\r%8s %-40s", usrconfig.Name, usrconfig.sUserName); printf("\r%8s %-40s", usrconfig.Name, usrconfig.sUserName);
mbse_colour(13, 0); mbse_colour(LIGHTMAGENTA, BLACK);
fflush(stdout); fflush(stdout);
} }
@ -237,9 +237,9 @@ void ScanFull()
Nopper(); Nopper();
if (!do_quiet) { if (!do_quiet) {
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
printf("\r%5ld .. %-40s", arearec, msgs.Name); printf("\r%5ld .. %-40s", arearec, msgs.Name);
mbse_colour(13, 0); mbse_colour(LIGHTMAGENTA, BLACK);
fflush(stdout); fflush(stdout);
} }
@ -352,9 +352,9 @@ void ScanOne(char *path, unsigned long MsgNum)
IsDoing("Scanning mail"); IsDoing("Scanning mail");
if (!do_quiet) { if (!do_quiet) {
mbse_colour(9, 0); mbse_colour(LIGHTBLUE, BLACK);
printf("Scanning mail\n"); printf("Scanning mail\n");
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
fflush(stdout); fflush(stdout);
} }
@ -405,9 +405,9 @@ void ScanOne(char *path, unsigned long MsgNum)
if ((msgs.Active) && (msgs.Type == ECHOMAIL || msgs.Type == NETMAIL || msgs.Type == NEWS)) { if ((msgs.Active) && (msgs.Type == ECHOMAIL || msgs.Type == NETMAIL || msgs.Type == NEWS)) {
if (!do_quiet) { if (!do_quiet) {
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
printf("\r%5ld .. %-40s", Area, msgs.Name); printf("\r%5ld .. %-40s", Area, msgs.Name);
mbse_colour(13, 0); mbse_colour(LIGHTMAGENTA, BLACK);
fflush(stdout); fflush(stdout);
} }
@ -500,9 +500,9 @@ int RescanOne(faddr *L, char *marea, unsigned long Num)
IsDoing("ReScan mail"); IsDoing("ReScan mail");
if (!do_quiet) { if (!do_quiet) {
mbse_colour(9, 0); mbse_colour(LIGHTBLUE, BLACK);
printf("ReScan mail\n"); printf("ReScan mail\n");
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
fflush(stdout); fflush(stdout);
} }
@ -529,9 +529,9 @@ int RescanOne(faddr *L, char *marea, unsigned long Num)
if ((msgs.Active) && ((msgs.Type == ECHOMAIL) || (msgs.Type == NEWS) || (msgs.Type == LIST))) { if ((msgs.Active) && ((msgs.Type == ECHOMAIL) || (msgs.Type == NEWS) || (msgs.Type == LIST))) {
if (!do_quiet) { if (!do_quiet) {
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
printf("\r%5ld .. %-40s", Area, msgs.Name); printf("\r%5ld .. %-40s", Area, msgs.Name);
mbse_colour(13, 0); mbse_colour(LIGHTMAGENTA, BLACK);
fflush(stdout); fflush(stdout);
} }

View File

@ -4,7 +4,7 @@
* Purpose ...............: Scan for new News * Purpose ...............: Scan for new News
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2004 * Copyright (C) 1997-2005
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -191,7 +191,7 @@ void ScanNews(void)
} }
if (!do_quiet) { if (!do_quiet) {
mbse_colour(10, 0); mbse_colour(LIGHTGREEN, BLACK);
printf("Scan for new news articles\n"); printf("Scan for new news articles\n");
} }
@ -216,7 +216,7 @@ void ScanNews(void)
} }
Syslog('m', "Scan newsgroup: %s", Msgs.Newsgroup); Syslog('m', "Scan newsgroup: %s", Msgs.Newsgroup);
if (!do_quiet) { if (!do_quiet) {
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
printf("\r%-40s", Msgs.Newsgroup); printf("\r%-40s", Msgs.Newsgroup);
fflush(stdout); fflush(stdout);
} }

View File

@ -106,7 +106,7 @@ int storeecho(faddr *f, faddr *t, time_t mdate, int flags, char *subj, char *msg
echo_imp++; echo_imp++;
if (!do_quiet) { if (!do_quiet) {
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
printf("\r%6u => %-40s\r", echo_in, msgs.Name); printf("\r%6u => %-40s\r", echo_in, msgs.Name);
fflush(stdout); fflush(stdout);
} }

View File

@ -355,7 +355,7 @@ int LoadTic(char *inb, char *tfn)
* Show on screen what we are doing * Show on screen what we are doing
*/ */
if (!do_quiet) { if (!do_quiet) {
mbse_colour(3, 0); mbse_colour(CYAN, BLACK);
printf("\r"); printf("\r");
for (i = 0; i < 79; i++) for (i = 0; i < 79; i++)
printf(" "); printf(" ");

View File

@ -4,7 +4,7 @@
* Purpose ...............: Toss a single *.pkt file * Purpose ...............: Toss a single *.pkt file
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2004 * Copyright (C) 1997-2005
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -268,7 +268,7 @@ int TossPkt(char *fn)
FILE *pkt; FILE *pkt;
if (!do_quiet) { if (!do_quiet) {
mbse_colour(10, 0); mbse_colour(LIGHTGREEN, BLACK);
printf("Tossing packet %s\n", fn); printf("Tossing packet %s\n", fn);
} }

View File

@ -4,7 +4,7 @@
* Purpose ...............: Netmail tracker / router * Purpose ...............: Netmail tracker / router
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2004 * Copyright (C) 1997-2005
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -712,7 +712,7 @@ void TestTracker(faddr *dest)
addr.node = dest->node; addr.node = dest->node;
addr.point = dest->point; addr.point = dest->point;
mbse_colour(7, 0); mbse_colour(LIGHTGRAY, BLACK);
Syslog('+', "Test route to %s", aka2str(addr)); Syslog('+', "Test route to %s", aka2str(addr));
rc = TrackMail(addr, &result); rc = TrackMail(addr, &result);

View File

@ -4,7 +4,7 @@
* Purpose ...............: Unpacker * Purpose ...............: Unpacker
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2004 * Copyright (C) 1997-2005
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -70,7 +70,7 @@ int unpack(char *fn)
int rc = 0, ld; int rc = 0, ld;
if (!do_quiet) { if (!do_quiet) {
mbse_colour(11, 0); mbse_colour(LIGHTCYAN, BLACK);
printf("Unpacking file %s\n", fn); printf("Unpacking file %s\n", fn);
} }