Added length check when importing taglines
This commit is contained in:
parent
5667926eab
commit
5bdc0a6cf6
@ -47,6 +47,7 @@ v0.35.05 19-Oct-2002
|
|||||||
Removed the default Virnet record from the fidonet setup.
|
Removed the default Virnet record from the fidonet setup.
|
||||||
In node setup the pack netmail switch is renamed and is now
|
In node setup the pack netmail switch is renamed and is now
|
||||||
for all mail.
|
for all mail.
|
||||||
|
Added length check when importing taglines.
|
||||||
|
|
||||||
mbfido:
|
mbfido:
|
||||||
With ticfile processing, the KeepDate setup setting now works.
|
With ticfile processing, the KeepDate setup setting now works.
|
||||||
|
@ -404,10 +404,8 @@ void InitOneline(void)
|
|||||||
void PurgeOneline(void)
|
void PurgeOneline(void)
|
||||||
{
|
{
|
||||||
FILE *pOneline, *fp;
|
FILE *pOneline, *fp;
|
||||||
int recno = 0;
|
int recno = 0, iCount = 0;
|
||||||
int iCount = 0;
|
char *sFileName, temp[81];
|
||||||
char sFileName[PATH_MAX];
|
|
||||||
char temp[81];
|
|
||||||
|
|
||||||
clr_index();
|
clr_index();
|
||||||
set_color(WHITE, BLACK);
|
set_color(WHITE, BLACK);
|
||||||
@ -422,9 +420,11 @@ void PurgeOneline(void)
|
|||||||
|
|
||||||
IsDoing("Purge Oneliners");
|
IsDoing("Purge Oneliners");
|
||||||
|
|
||||||
|
sFileName = calloc(PATH_MAX, sizeof(char));
|
||||||
sprintf(sFileName,"%s/etc/oneline.data", getenv("MBSE_ROOT"));
|
sprintf(sFileName,"%s/etc/oneline.data", getenv("MBSE_ROOT"));
|
||||||
|
|
||||||
if ((pOneline = fopen(sFileName, "r")) == NULL) {
|
if ((pOneline = fopen(sFileName, "r")) == NULL) {
|
||||||
|
free(sFileName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -441,6 +441,7 @@ void PurgeOneline(void)
|
|||||||
if (iCount == 0) {
|
if (iCount == 0) {
|
||||||
mvprintw(9, 6, "Press any key");
|
mvprintw(9, 6, "Press any key");
|
||||||
readkey(9, 20, LIGHTGRAY, BLACK);
|
readkey(9, 20, LIGHTGRAY, BLACK);
|
||||||
|
free(sFileName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -459,6 +460,7 @@ void PurgeOneline(void)
|
|||||||
working(2, 0, 0);
|
working(2, 0, 0);
|
||||||
unlink("tmp.1");
|
unlink("tmp.1");
|
||||||
working(0, 0, 0);
|
working(0, 0, 0);
|
||||||
|
free(sFileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -467,24 +469,27 @@ void PurgeOneline(void)
|
|||||||
void ImportOneline(void)
|
void ImportOneline(void)
|
||||||
{
|
{
|
||||||
FILE *Imp, *pOneline;
|
FILE *Imp, *pOneline;
|
||||||
char temp[PATH_MAX];
|
int recno = 0, skipped = 0;
|
||||||
int recno = 0;
|
|
||||||
struct tm *l_date;
|
struct tm *l_date;
|
||||||
char buf[12];
|
char *temp, buf[12];
|
||||||
time_t Time;
|
time_t Time;
|
||||||
|
|
||||||
clr_index();
|
clr_index();
|
||||||
set_color(WHITE, BLACK);
|
set_color(WHITE, BLACK);
|
||||||
mvprintw(5, 6, "8.7.3 IMPORT ONELINERS");
|
mvprintw(5, 6, "8.7.3 IMPORT ONELINERS");
|
||||||
set_color(CYAN, BLACK);
|
set_color(CYAN, BLACK);
|
||||||
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
memset(&temp, 0, sizeof(temp));
|
memset(&temp, 0, sizeof(temp));
|
||||||
strcpy(temp, edit_str(21, 6,64, temp, (char *)"The ^full path and filename^ of the file to import"));
|
strcpy(temp, edit_str(21, 6,64, temp, (char *)"The ^full path and filename^ of the file to import"));
|
||||||
if (strlen(temp) == 0)
|
if (strlen(temp) == 0) {
|
||||||
|
free(temp);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
working(1, 0, 0);
|
working(1, 0, 0);
|
||||||
if (config_read() == -1) {
|
if (config_read() == -1) {
|
||||||
working(2, 0, 0);
|
working(2, 0, 0);
|
||||||
|
free(temp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -493,6 +498,7 @@ void ImportOneline(void)
|
|||||||
working(0, 0, 0);
|
working(0, 0, 0);
|
||||||
mvprintw(21, 6, temp);
|
mvprintw(21, 6, temp);
|
||||||
readkey(22, 6, LIGHTGRAY, BLACK);
|
readkey(22, 6, LIGHTGRAY, BLACK);
|
||||||
|
free(temp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -520,6 +526,7 @@ void ImportOneline(void)
|
|||||||
fclose(Imp);
|
fclose(Imp);
|
||||||
mvprintw(21, 6, temp);
|
mvprintw(21, 6, temp);
|
||||||
readkey(22, 6, LIGHTGRAY, BLACK);
|
readkey(22, 6, LIGHTGRAY, BLACK);
|
||||||
|
free(temp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -529,7 +536,7 @@ void ImportOneline(void)
|
|||||||
|
|
||||||
while ((fgets(temp, 80, Imp)) != NULL) {
|
while ((fgets(temp, 80, Imp)) != NULL) {
|
||||||
Striplf(temp);
|
Striplf(temp);
|
||||||
if ((strlen(temp) > 0) && (strlen(temp) < 78)) {
|
if ((strlen(temp) > 0) && (strlen(temp) < 69)) {
|
||||||
memset(&ol, 0, sizeof(ol));
|
memset(&ol, 0, sizeof(ol));
|
||||||
strcpy(ol.Oneline, temp);
|
strcpy(ol.Oneline, temp);
|
||||||
strcpy(ol.UserName, CFG.sysop_name);
|
strcpy(ol.UserName, CFG.sysop_name);
|
||||||
@ -537,6 +544,8 @@ void ImportOneline(void)
|
|||||||
ol.Available = TRUE;
|
ol.Available = TRUE;
|
||||||
fwrite(&ol, sizeof(ol), 1, pOneline);
|
fwrite(&ol, sizeof(ol), 1, pOneline);
|
||||||
recno++;
|
recno++;
|
||||||
|
} else {
|
||||||
|
skipped++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -544,9 +553,10 @@ void ImportOneline(void)
|
|||||||
fclose(pOneline);
|
fclose(pOneline);
|
||||||
working(0, 0, 0);
|
working(0, 0, 0);
|
||||||
|
|
||||||
sprintf(temp, "Imported %d records", recno);
|
sprintf(temp, "Imported %d records, skipped %d long/empty lines", recno, skipped);
|
||||||
mvprintw(21, 6, temp);
|
mvprintw(21, 6, temp);
|
||||||
readkey(21, 27, LIGHTGRAY, BLACK);
|
readkey(21, 27, LIGHTGRAY, BLACK);
|
||||||
|
free(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -563,21 +573,13 @@ void ol_menu(void)
|
|||||||
mvprintw( 9, 6, "3. Import Oneliners");
|
mvprintw( 9, 6, "3. Import Oneliners");
|
||||||
|
|
||||||
switch(select_menu(3)) {
|
switch(select_menu(3)) {
|
||||||
case 0:
|
case 0: return;
|
||||||
return;
|
case 1: EditOneline();
|
||||||
|
|
||||||
case 1:
|
|
||||||
EditOneline();
|
|
||||||
break;
|
break;
|
||||||
|
case 2: PurgeOneline();
|
||||||
case 2:
|
|
||||||
PurgeOneline();
|
|
||||||
break;
|
break;
|
||||||
|
case 3: ImportOneline();
|
||||||
case 3:
|
|
||||||
ImportOneline();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user