Added archiver selection

This commit is contained in:
Michiel Broek
2006-03-05 12:57:50 +00:00
parent d2ebff86f1
commit 134536cc27
20 changed files with 203 additions and 80 deletions

View File

@@ -4,7 +4,7 @@
* Purpose ...............: Change user settings
*
*****************************************************************************
* Copyright (C) 1997-2005
* Copyright (C) 1997-2006
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@@ -804,6 +804,98 @@ void Chg_DOB()
/*
* Change default archiver.
*/
void Chg_Archiver()
{
FILE *fp;
int Found = FALSE;
char *temp;
temp = calloc(PATH_MAX, sizeof(char));
ReadExitinfo();
Syslog('+', "Old archiver %s", exitinfo.Archiver);
while(TRUE) {
snprintf(temp, PATH_MAX, "%s/etc/archiver.data", getenv("MBSE_ROOT"));
if ((fp = fopen(temp, "r")) == NULL) {
WriteError("$Can't open %s", temp);
/* Can't open archiver file. */
Enter(1);
PUTSTR((char *) Language(86));
Enter(2);
Pause();
free(temp);
return;
}
fread(&archiverhdr, sizeof(archiverhdr), 1, fp);
Enter(1);
/* Select your preferred archiver */
pout(CFG.HiliteF, CFG.HiliteB, (char *) Language(87));
Enter(2);
while (fread(&archiver, archiverhdr.recsize, 1, fp) == 1) {
if (archiver.available && strlen(archiver.marc) && strlen(archiver.farc)) {
colour(LIGHTBLUE, BLACK);
snprintf(temp, 81, "%-6s", archiver.name);
PUTSTR(temp);
colour(WHITE, BLACK);
snprintf(temp, 81, "%s\r\n", archiver.comment);
PUTSTR(temp);
}
}
Enter(1);
/* Select Archiver (Enter to Quit): */
pout(CFG.HiliteF, CFG.HiliteB, (char *) Language(88));
alarm_on();
memset(temp, 0, PATH_MAX);
GetstrC(temp, 5);
if (strlen(temp) == 0) {
free(temp);
return;
}
Found = FALSE;
fseek(fp, archiverhdr.hdrsize, SEEK_SET);
while (fread(&archiver, archiverhdr.recsize, 1, fp) == 1) {
if (archiver.available && strlen(archiver.marc) && strlen(archiver.farc)) {
if (strcasecmp(archiver.name, temp) == 0) {
/* Valid input, set new archiver */
Found = TRUE;
break;
}
}
}
fclose(fp);
if (Found)
break;
Enter(2);
/* Invalid selection, please try again! */
pout(LIGHTGREEN, BLACK, (char *) Language(265));
Enter(2);
/* Loop for new attempt */
}
strncpy(exitinfo.Archiver, archiver.name, 6);
/* Archiver now set to: */
snprintf(temp, 81, "%s %s", Language(89), exitinfo.Archiver);
colour(WHITE, BLACK);
PUTSTR(temp);
Syslog('+', "New archiver %s", exitinfo.Archiver);
WriteExitinfo();
free(temp);
Enter(2);
Pause();
}
/*
* Change default protocol.
*/

View File

@@ -20,6 +20,7 @@ void Chg_DataPhone(void); /* Change dataphone */
void Chg_News(void); /* Toggle News Bulletins */
int Test_DOB(char *); /* Test of Date of Birth is valid */
void Chg_DOB(void); /* Change Date of Birth */
void Chg_Archiver(void); /* Change default archiver */
void Chg_Protocol(void); /* Change default transfer protocol. */
void Set_Protocol(char *); /* Set default protocol */
void Chg_OLR_ExtInfo(void); /* Set OLR Extended Info */

View File

@@ -4,7 +4,7 @@
* Purpose ...............: Display ANSI/ASCII textfiles
*
*****************************************************************************
* Copyright (C) 1997-2005
* Copyright (C) 1997-2006
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@@ -562,6 +562,10 @@ void ControlCodeU(int ch)
snprintf(temp, 81, "%s", getftnchrs(exitinfo.Charset));
break;
case '0':
snprintf(temp, 81, "%s", exitinfo.Archiver);
break;
default:
snprintf(temp, 81, " ");
}

View File

@@ -4,7 +4,7 @@
* Purpose ...............: Display and handle the menus.
*
*****************************************************************************
* Copyright (C) 1997-2005
* Copyright (C) 1997-2006
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@@ -659,6 +659,10 @@ void DoMenu(int Type)
Chg_Charset();
break;
case 322:
Chg_Archiver();
break;
case 401:
Oneliner_Add();
break;