Codecleanup for nodelist
This commit is contained in:
parent
d7a6aeb162
commit
19ad88a5db
@ -139,12 +139,11 @@ struct icmp_filter {
|
||||
*
|
||||
* Defines
|
||||
*/
|
||||
|
||||
#define PRODCODE 0x11ff /* Official MBSE FTSC product code */
|
||||
|
||||
#define Max_passlen 14 /* Define maximum passwd length */
|
||||
|
||||
#define SS_BUFSIZE 1024 /* Socket buffersize */
|
||||
#define MAXNLLINELEN 1024 /* Maximum nodelist line length */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
#define MAXNAME 35
|
||||
#define MAXUFLAGS 16
|
||||
#define MAXNLLINELEN 1024
|
||||
|
||||
|
||||
/*
|
||||
|
@ -65,13 +65,13 @@ void Help(void)
|
||||
do_quiet = FALSE;
|
||||
ProgName();
|
||||
|
||||
colour(11, 0);
|
||||
colour(LIGHTCYAN, BLACK);
|
||||
printf("\nUsage: mbindex <options>\n\n");
|
||||
colour(9, 0);
|
||||
colour(LIGHTBLUE, BLACK);
|
||||
printf(" Options are:\n\n");
|
||||
colour(3, 0);
|
||||
colour(CYAN, BLACK);
|
||||
printf(" -quiet Quiet mode\n");
|
||||
colour(7, 0);
|
||||
colour(LIGHTGRAY, BLACK);
|
||||
printf("\n");
|
||||
die(MBERR_COMMANDLINE);
|
||||
}
|
||||
@ -86,11 +86,11 @@ void ProgName(void)
|
||||
if (do_quiet)
|
||||
return;
|
||||
|
||||
colour(15, 0);
|
||||
colour(WHITE, BLACK);
|
||||
printf("\nMBINDEX: MBSE BBS %s Nodelist Index Compiler\n", VERSION);
|
||||
colour(14, 0);
|
||||
colour(YELLOW, BLACK);
|
||||
printf(" %s\n", COPYRIGHT);
|
||||
colour(3, 0);
|
||||
colour(CYAN, BLACK);
|
||||
}
|
||||
|
||||
|
||||
@ -103,7 +103,7 @@ void die(int onsig)
|
||||
ulockprogram((char *)"mbindex");
|
||||
|
||||
if (!do_quiet) {
|
||||
colour(3, 0);
|
||||
colour(CYAN, BLACK);
|
||||
show_log = TRUE;
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ void die(int onsig)
|
||||
Syslog(' ', "MBINDEX finished in %s", t_elapsed(t_start, t_end));
|
||||
|
||||
if (!do_quiet)
|
||||
colour(7, 0);
|
||||
colour(LIGHTGRAY, BLACK);
|
||||
|
||||
ExitClient(onsig);
|
||||
}
|
||||
@ -212,7 +212,7 @@ int in_nllist(struct _nlidx idx, nl_list **fap, int replace)
|
||||
{
|
||||
nl_list *tmp;
|
||||
|
||||
for (tmp = *fap; tmp; tmp = tmp->next)
|
||||
for (tmp = *fap; tmp; tmp = tmp->next) {
|
||||
if ((tmp->idx.zone == idx.zone) && (tmp->idx.net == idx.net) &&
|
||||
(tmp->idx.node == idx.node) && (tmp->idx.point == idx.point)) {
|
||||
if (replace) {
|
||||
@ -222,6 +222,7 @@ int in_nllist(struct _nlidx idx, nl_list **fap, int replace)
|
||||
regio = tmp->idx.region;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -269,8 +270,7 @@ void sort_nllist(nl_list **fap)
|
||||
vector[i++] = ta;
|
||||
}
|
||||
|
||||
qsort(vector, n, sizeof(nl_list *),
|
||||
(int(*)(const void*, const void *))comp_node);
|
||||
qsort(vector, n, sizeof(nl_list *), (int(*)(const void*, const void *))comp_node);
|
||||
|
||||
(*fap) = vector[0];
|
||||
i = 1;
|
||||
@ -304,10 +304,9 @@ int comp_node(nl_list **fap1, nl_list **fap2)
|
||||
|
||||
int compile(char *nlname, unsigned short zo, unsigned short ne, unsigned short no)
|
||||
{
|
||||
int num, i, rc = 0;
|
||||
int lineno, boss = FALSE, bossvalid = FALSE;
|
||||
int num, i, rc = 0, lineno, boss = FALSE, bossvalid = FALSE;
|
||||
unsigned short upnet, upnode;
|
||||
char buf[256], *p, *q;
|
||||
char buf[MAXNLLINELEN], *p, *q;
|
||||
faddr *tmpa;
|
||||
FILE *nl;
|
||||
struct _nlidx ndx;
|
||||
@ -352,8 +351,7 @@ int compile(char *nlname, unsigned short zo, unsigned short ne, unsigned short n
|
||||
* Next check at <lf> and <eof> characters
|
||||
*/
|
||||
if ((*(buf+strlen(buf) -1) != '\n') && (*(buf + strlen(buf) -1) != '\012')) {
|
||||
while (fgets(buf, sizeof(buf) -1, nl) &&
|
||||
(*(buf + strlen(buf) -1) != '\n')) /*void*/;
|
||||
while (fgets(buf, sizeof(buf) -1, nl) && (*(buf + strlen(buf) -1) != '\n')) /*void*/;
|
||||
if (strlen(buf) > 1) /* Suppress EOF character */
|
||||
Syslog('-', "Nodelist: too long line junked (%d)", lineno);
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user