diff --git a/ChangeLog b/ChangeLog index 17b828b7..90b0afc6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -50,6 +50,8 @@ v0.35.05 19-Oct-2002 In node setup the pack netmail switch is renamed and is now for all mail. Default for new records is Yes. Added length check when importing taglines. + Now writes also ~/etc/msg.txt for MsgEd after messagebase is + updated. mbfido: With ticfile processing, the KeepDate setup setting now works. diff --git a/mbsetup/m_marea.c b/mbsetup/m_marea.c index b601ff89..7dc503a0 100644 --- a/mbsetup/m_marea.c +++ b/mbsetup/m_marea.c @@ -1615,6 +1615,59 @@ int NodeInMarea(fidoaddr A) +void msged_areas(FILE *fp) +{ + char *temp, *aka; + FILE *no; + int i = 0; + + temp = calloc(PATH_MAX, sizeof(char)); + sprintf(temp, "%s/etc/mareas.data", getenv("MBSE_ROOT")); + if ((no = fopen(temp, "r")) == NULL) + return; + + fread(&msgshdr, sizeof(msgshdr), 1, no); + fseek(no, 0, SEEK_SET); + fread(&msgshdr, msgshdr.hdrsize, 1, no); + + while (fread(&msgs, msgshdr.recsize, 1, no) == 1) { + + i++; + if (msgs.Active) { + + fprintf(fp, "Jam "); + + switch (msgs.Type) { + case LOCALMAIL: fprintf(fp, "l"); break; + case NETMAIL: fprintf(fp, "mp"); break; + case ECHOMAIL: fprintf(fp, "e"); break; + case NEWS: fprintf(fp, "e"); break; + } + + if (((msgs.Type == NEWS) || (msgs.Type == ECHOMAIL)) && strlen(msgs.Tag) && strlen(msgs.Newsgroup)) { + fprintf(fp, "u"); + } + fprintf(fp, "8"); + fprintf(fp, " \"%s\" %s", msgs.Name, msgs.Base); + if (msgs.Type == ECHOMAIL) + fprintf(fp, " %s", msgs.Tag); + if (msgs.Type != LOCALMAIL) { + aka = xstrcpy(strtok(aka2str(msgs.Aka), "@")); + fprintf(fp, " %s", aka); + free(aka); + } + fprintf(fp, "\n"); + } + fseek(no, msgshdr.syssize, SEEK_CUR); + } + + fclose(no); + free(temp); + fprintf(fp, "\n"); +} + + + void gold_areas(FILE *fp) { char *temp, *aka; diff --git a/mbsetup/m_marea.h b/mbsetup/m_marea.h index ef19a584..58f5bde9 100644 --- a/mbsetup/m_marea.h +++ b/mbsetup/m_marea.h @@ -1,6 +1,7 @@ #ifndef _MAREA_H #define _MAREA_H +/* $Id$ */ int OpenMsgarea(void); void CloseMsgarea(int); @@ -10,6 +11,7 @@ int CountMsgarea(void); void EditMsgarea(void); void InitMsgarea(void); void gold_areas(FILE *); +void msged_areas(FILE *); int mail_area_doc(FILE *, FILE *, int); char *PickMsgarea(char *); diff --git a/mbsetup/mbsetup.c b/mbsetup/mbsetup.c index 7597345b..26f4a670 100644 --- a/mbsetup/mbsetup.c +++ b/mbsetup/mbsetup.c @@ -84,54 +84,69 @@ int init = FALSE; /* Run init only */ static void die(int onsig) { - FILE *fp; - char *temp; - int i; + FILE *fp; + char *temp; + int i; - signal(onsig, SIG_IGN); - if (!init) - screen_stop(); + signal(onsig, SIG_IGN); + if (!init) + screen_stop(); - if (exp_golded && (config_read() != -1)) { - temp = calloc(128, sizeof(char)); - sprintf(temp, "%s/etc/golded.inc", getenv("MBSE_ROOT")); + if (exp_golded && (config_read() != -1)) { + temp = calloc(PATH_MAX, sizeof(char)); - if ((fp = fopen(temp, "w")) != NULL) { - fprintf(fp, "; GoldED.inc -- Automatic created by mbsetup %s -- Do not edit!\n\n", VERSION); - fprintf(fp, "; Basic information\n;\n"); - if (strlen(CFG.sysop_name) && CFG.akavalid[0] && CFG.aka[0].zone) { - fprintf(fp, "USERNAME %s\n\n", CFG.sysop_name); - fprintf(fp, "ADDRESS %s\n", aka2str(CFG.aka[0])); - for (i = 1; i < 40; i++) - if (CFG.akavalid[i]) - fprintf(fp, "AKA %s\n", aka2str(CFG.aka[i])); - fprintf(fp, "\n"); - - gold_akamatch(fp); - fprintf(fp, "; JAM MessageBase Setup\n;\n"); - fprintf(fp, "JAMPATH %s/tmp/\n", getenv("MBSE_ROOT")); - fprintf(fp, "JAMHARDDELETE NO\n\n"); - - fprintf(fp, "; Semaphore files\n;\n"); - fprintf(fp, "SEMAPHORE NETSCAN %s/sema/mailout\n", getenv("MBSE_ROOT")); - fprintf(fp, "SEMAPHORE ECHOSCAN %s/sema/mailout\n\n", getenv("MBSE_ROOT")); - - gold_areas(fp); - } - Syslog('+', "Created new %s", temp); - } else { - WriteError("$Could not create %s", temp); - } - - free(temp); + /* + * Export ~/etc/msg.txt for MsgEd. + */ + sprintf(temp, "%s/etc/msg.txt", getenv("MBSE_ROOT")); + if ((fp = fopen(temp, "w")) != NULL) { + msged_areas(fp); + fclose(fp); + Syslog('+', "Created new %s", temp); + } else { + WriteError("$Could not create %s", temp); } - umask(oldmask); - if (onsig && (onsig <= NSIG)) - WriteError("MBSETUP finished on signal %s", SigName[onsig]); - else - Syslog(' ', "MBSETUP finished"); - ExitClient(onsig); + /* + * Export ~/etc/golded.inc for GoldED + */ + sprintf(temp, "%s/etc/golded.inc", getenv("MBSE_ROOT")); + if ((fp = fopen(temp, "w")) != NULL) { + fprintf(fp, "; GoldED.inc -- Automatic created by mbsetup %s -- Do not edit!\n\n", VERSION); + fprintf(fp, "; Basic information\n;\n"); + if (strlen(CFG.sysop_name) && CFG.akavalid[0] && CFG.aka[0].zone) { + fprintf(fp, "USERNAME %s\n\n", CFG.sysop_name); + fprintf(fp, "ADDRESS %s\n", aka2str(CFG.aka[0])); + for (i = 1; i < 40; i++) + if (CFG.akavalid[i]) + fprintf(fp, "AKA %s\n", aka2str(CFG.aka[i])); + fprintf(fp, "\n"); + + gold_akamatch(fp); + fprintf(fp, "; JAM MessageBase Setup\n;\n"); + fprintf(fp, "JAMPATH %s/tmp/\n", getenv("MBSE_ROOT")); + fprintf(fp, "JAMHARDDELETE NO\n\n"); + + fprintf(fp, "; Semaphore files\n;\n"); + fprintf(fp, "SEMAPHORE NETSCAN %s/sema/mailout\n", getenv("MBSE_ROOT")); + fprintf(fp, "SEMAPHORE ECHOSCAN %s/sema/mailout\n\n", getenv("MBSE_ROOT")); + + gold_areas(fp); + } + Syslog('+', "Created new %s", temp); + } else { + WriteError("$Could not create %s", temp); + } + + free(temp); + } + + umask(oldmask); + if (onsig && (onsig <= NSIG)) + WriteError("MBSETUP finished on signal %s", SigName[onsig]); + else + Syslog(' ', "MBSETUP finished"); + ExitClient(onsig); }