Code cleanup
This commit is contained in:
parent
5705cb1538
commit
d224ff61eb
@ -2,6 +2,12 @@ $Id$
|
|||||||
|
|
||||||
v0.71.5 18-Aug-2005
|
v0.71.5 18-Aug-2005
|
||||||
|
|
||||||
|
mbfido:
|
||||||
|
Removed debug logging for solved crash.
|
||||||
|
|
||||||
|
mbdiff:
|
||||||
|
Code cleanup.
|
||||||
|
|
||||||
|
|
||||||
v0.71.4 12-Aug-2005 - 18-Aug-2005
|
v0.71.4 12-Aug-2005 - 18-Aug-2005
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* Original ideas ........: Eugene G. Crosser.
|
* Original ideas ........: Eugene G. Crosser.
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2004
|
* Copyright (C) 1997-2005
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -55,55 +55,55 @@ time_t t_end; /* End time */
|
|||||||
|
|
||||||
void ProgName(void)
|
void ProgName(void)
|
||||||
{
|
{
|
||||||
if (do_quiet)
|
if (do_quiet)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mbse_colour(15, 0);
|
mbse_colour(15, 0);
|
||||||
printf("\nMBDIFF: MBSE BBS %s Nodelist diff processor\n", VERSION);
|
printf("\nMBDIFF: MBSE BBS %s Nodelist diff processor\n", VERSION);
|
||||||
mbse_colour(14, 0);
|
mbse_colour(14, 0);
|
||||||
printf(" %s\n", COPYRIGHT);
|
printf(" %s\n", COPYRIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void die(int onsig)
|
void die(int onsig)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* First check if a child is running, if so, kill it.
|
||||||
|
*/
|
||||||
|
if (e_pid) {
|
||||||
|
if ((kill(e_pid, SIGTERM)) == 0)
|
||||||
|
Syslog('+', "SIGTERM to pid %d succeeded", e_pid);
|
||||||
|
else {
|
||||||
|
if ((kill(e_pid, SIGKILL)) == 0)
|
||||||
|
Syslog('+', "SIGKILL to pid %d succeded", e_pid);
|
||||||
|
else
|
||||||
|
WriteError("$Failed to kill pid %d", e_pid);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* First check if a child is running, if so, kill it.
|
* In case the child had the tty in raw mode...
|
||||||
*/
|
*/
|
||||||
if (e_pid) {
|
execute_pth((char *)"stty", (char *)"sane", (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null");
|
||||||
if ((kill(e_pid, SIGTERM)) == 0)
|
}
|
||||||
Syslog('+', "SIGTERM to pid %d succeeded", e_pid);
|
|
||||||
else {
|
|
||||||
if ((kill(e_pid, SIGKILL)) == 0)
|
|
||||||
Syslog('+', "SIGKILL to pid %d succeded", e_pid);
|
|
||||||
else
|
|
||||||
WriteError("$Failed to kill pid %d", e_pid);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
signal(onsig, SIG_IGN);
|
||||||
* In case the child had the tty in raw mode...
|
|
||||||
*/
|
|
||||||
execute_pth((char *)"stty", (char *)"sane", (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null");
|
|
||||||
}
|
|
||||||
|
|
||||||
signal(onsig, SIG_IGN);
|
if (onsig) {
|
||||||
|
if (onsig <= NSIG)
|
||||||
|
WriteError("Terminated on signal %d (%s)", onsig, SigName[onsig]);
|
||||||
|
else
|
||||||
|
WriteError("Terminated with error %d", onsig);
|
||||||
|
}
|
||||||
|
|
||||||
if (onsig) {
|
t_end = time(NULL);
|
||||||
if (onsig <= NSIG)
|
Syslog(' ', "MBDIFF finished in %s", t_elapsed(t_start, t_end));
|
||||||
WriteError("Terminated on signal %d (%s)", onsig, SigName[onsig]);
|
|
||||||
else
|
|
||||||
WriteError("Terminated with error %d", onsig);
|
|
||||||
}
|
|
||||||
|
|
||||||
t_end = time(NULL);
|
if (!do_quiet) {
|
||||||
Syslog(' ', "MBDIFF finished in %s", t_elapsed(t_start, t_end));
|
mbse_colour(7, 0);
|
||||||
|
printf("\n");
|
||||||
if (!do_quiet) {
|
}
|
||||||
mbse_colour(7, 0);
|
ExitClient(onsig);
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
ExitClient(onsig);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -252,9 +252,9 @@ int main(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
if ((arc = unpacker(nd)) == NULL) {
|
if ((arc = unpacker(nd)) == NULL) {
|
||||||
show_log = TRUE;
|
show_log = TRUE;
|
||||||
|
WriteError("Can't get filetype for %s", nd);
|
||||||
free(onl);
|
free(onl);
|
||||||
free(wrk);
|
free(wrk);
|
||||||
WriteError("Can't get filetype for %s", nd);
|
|
||||||
die(MBERR_CONFIG_ERROR);
|
die(MBERR_CONFIG_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,18 +290,13 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (execute_str(cmd, nd, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null")) {
|
if (execute_str(cmd, nd, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null")) {
|
||||||
WriteError("Warning: unpack error, trying again after a sync");
|
show_log = TRUE;
|
||||||
sync();
|
free(cmd);
|
||||||
sleep(1);
|
free(onl);
|
||||||
if (execute_str(cmd, nd, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null")) {
|
free(wrk);
|
||||||
show_log = TRUE;
|
free(ond);
|
||||||
free(cmd);
|
WriteError("Fatal: unpack error");
|
||||||
free(onl);
|
die(MBERR_EXEC_FAILED);
|
||||||
free(wrk);
|
|
||||||
free(ond);
|
|
||||||
WriteError("Fatal: unpack error");
|
|
||||||
die(MBERR_EXEC_FAILED);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
free(cmd);
|
free(cmd);
|
||||||
|
|
||||||
@ -339,7 +334,6 @@ int main(int argc, char **argv)
|
|||||||
WriteError("Copy %s failed, %s", nd, strerror(rc));
|
WriteError("Copy %s failed, %s", nd, strerror(rc));
|
||||||
die(MBERR_DIFF_ERROR);
|
die(MBERR_DIFF_ERROR);
|
||||||
}
|
}
|
||||||
Syslog('s', "Copied %s", nd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((p = strrchr(onl, '.'))) && ((q = strrchr(ond, '.'))) && (strlen(p) == strlen(q))) {
|
if (((p = strrchr(onl, '.'))) && ((q = strrchr(ond, '.'))) && (strlen(p) == strlen(q))) {
|
||||||
|
@ -610,7 +610,7 @@ int ProcessTic(fa_list **sbl)
|
|||||||
sprintf(temp1, "%s/%s", TIC.Inbound, TIC.NewFile);
|
sprintf(temp1, "%s/%s", TIC.Inbound, TIC.NewFile);
|
||||||
sprintf(Temp, "%s/etc/%s", getenv("MBSE_ROOT"), tic.Banner);
|
sprintf(Temp, "%s/etc/%s", getenv("MBSE_ROOT"), tic.Banner);
|
||||||
if (execute_str(cmd, temp1, (char *)NULL, Temp, (char *)"/dev/null", (char *)"/dev/null")) {
|
if (execute_str(cmd, temp1, (char *)NULL, Temp, (char *)"/dev/null", (char *)"/dev/null")) {
|
||||||
WriteError("$Changing the banner failed");
|
WriteError("Changing the banner failed");
|
||||||
} else {
|
} else {
|
||||||
Syslog('+', "New banner %s", tic.Banner);
|
Syslog('+', "New banner %s", tic.Banner);
|
||||||
TIC.FileSize = file_size(temp1);
|
TIC.FileSize = file_size(temp1);
|
||||||
@ -717,8 +717,6 @@ int ProcessTic(fa_list **sbl)
|
|||||||
if (tmpq->send) {
|
if (tmpq->send) {
|
||||||
sprintf(sbe, "%u:%u/%u", tmpq->aka.zone, tmpq->aka.net, tmpq->aka.node);
|
sprintf(sbe, "%u:%u/%u", tmpq->aka.zone, tmpq->aka.net, tmpq->aka.node);
|
||||||
fill_list(sbl, sbe, NULL);
|
fill_list(sbl, sbe, NULL);
|
||||||
} else {
|
|
||||||
Syslog('f', "Skip SB %u:%u/%u", tmpq->aka.zone, tmpq->aka.net, tmpq->aka.node);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
uniq_list(sbl);
|
uniq_list(sbl);
|
||||||
@ -746,7 +744,6 @@ int ProcessTic(fa_list **sbl)
|
|||||||
|
|
||||||
free(Temp);
|
free(Temp);
|
||||||
tidy_qualify(&qal);
|
tidy_qualify(&qal);
|
||||||
Syslog('f', "ProcessTic: post processing end");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,9 +484,7 @@ int LoadTic(char *inb, char *tfn)
|
|||||||
|
|
||||||
tic_in++;
|
tic_in++;
|
||||||
rc = ProcessTic(&sbl);
|
rc = ProcessTic(&sbl);
|
||||||
Syslog('f', "back from ProcessTic");
|
|
||||||
tidy_falist(&sbl);
|
tidy_falist(&sbl);
|
||||||
Syslog('f', "tidy_falist(&sbl) done");
|
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user