Added OS and CPU nameing functions

This commit is contained in:
Michiel Broek 2002-02-10 15:57:05 +00:00
parent 4f76ee06db
commit 054987b525
21 changed files with 79 additions and 98 deletions

View File

@ -4591,4 +4591,7 @@ v0.33.20 10-Feb-2002
Added structures for area maintenance with area lists.
common.a:
Added 2 functions to return the OS name and CPU family.
Added a function to return the right tearline.

View File

@ -538,6 +538,9 @@ char *GetLocalHMS(void);
char *StrDateMDY(time_t *);
char *StrDateDMY(time_t);
char *GetDateDMY(void);
char *OsName(void);
char *OsCPU(void);
char *TearLine(void);

View File

@ -35,6 +35,7 @@
#define Max_passlen 14 /* Define maximum passwd length */
/*****************************************************************************
*
* Global typedefs.

View File

@ -334,3 +334,48 @@ char *GetDateDMY()
}
char *OsName()
{
#ifdef __linux__
return (char *)"Linux";
#elif __FreeBSD__
return (char *)"FreeBSD";
#elif __NetBSD__
return (char *)"NetBSD";
#else
return (char *)"Unknown";
#endif
}
char *OsCPU()
{
#ifdef __i386__
return (char *)"i386";
#elif __PPC__
return (char *)"PPC";
#elif __sparc__
return (char *)"Sparc";
#elif __alpha__
return (char *)"Alpha";
#else
return (char *)"Unknown";
#endif
}
/*
* Return universal tearline, note if OS and CPU are
* unknow, the tearline is already 39 characters.
*/
char *TearLine()
{
static char tearline[41];
sprintf(tearline, "--- MBSE BBS v%s (%s-%s)", VERSION, OsName(), OsCPU());
return tearline;
}

View File

@ -546,7 +546,7 @@ file_list *respmagic(char *cmd) /* must free(cmd) before exit */
}
fputs(buf, fp);
}
fprintf(fp, "\r--- mbcico v%s\r", VERSION);
fprintf(fp, "\r%s\r", TearLine());
free(buf);
}
fwrite(&zeroes, 1, 3, fp);
@ -622,7 +622,7 @@ static void attach_report(file_list **fl)
fclose(fp);
}
add_report((char *)"\r--- mbcico v%s\r", VERSION);
add_report((char *)"\r%s\r", TearLine());
sprintf(tmpfn, "%s/tmp/%08lX.rpl", getenv((char *)"MBSE_ROOT"), (unsigned long)sequencer());
if ((fp = fopen(tmpfn,"w"))) {

View File

@ -53,7 +53,6 @@
* External declarations
*/
extern int do_quiet;
extern char *tearline;
@ -125,7 +124,7 @@ void A_Help(faddr *t, char *replyid)
fprintf(fp, " -GENERAL\r");
fprintf(fp, " %%QUERY\r");
fprintf(fp, " %%LIST\r\r");
fprintf(fp, "%s\r", tearline);
fprintf(fp, "%s\r", TearLine());
CloseMail(fp, t);
net_out++;
} else
@ -231,7 +230,7 @@ void A_Query(faddr *t, char *replyid)
fprintf(qp, " P - The message area is temporary paused\r");
fprintf(qp, " C - You are cutoff from this area\r\r");
fprintf(qp, "With regards, %s\r\r", CFG.sysop_name);
fprintf(qp, "%s\r", tearline);
fprintf(qp, "%s\r", TearLine());
CloseMail(qp, t);
net_out++;
free(temp);
@ -338,7 +337,7 @@ void A_List(faddr *t, char *replyid, int Notify)
fprintf(qp, " P - The message area is temporary paused\r");
fprintf(qp, " C - You are cutoff from this area\r\r");
fprintf(qp, "With regards, %s\r\r", CFG.sysop_name);
fprintf(qp, "%s\r", tearline);
fprintf(qp, "%s\r", TearLine());
CloseMail(qp, t);
net_out++;
free(temp);
@ -452,7 +451,7 @@ void A_Flow(faddr *t, char *replyid, int Notify)
fprintf(qp, "Con means:\r");
fprintf(qp, " C - You connected to this area\r");
fprintf(qp, "With regards, %s\r\r", CFG.sysop_name);
fprintf(qp, "%s\r", tearline);
fprintf(qp, "%s\r", TearLine());
CloseMail(qp, t);
net_out++;
free(temp);
@ -493,7 +492,7 @@ void A_Status(faddr *t, char *replyid)
fprintf(fp, "\rWith regards, %s\r\r", CFG.sysop_name);
fprintf(fp, "%s\r", tearline);
fprintf(fp, "%s\r", TearLine());
CloseMail(fp, t);
net_out++;
} else
@ -599,7 +598,7 @@ void A_Unlinked(faddr *t, char *replyid)
fprintf(qp, " P - The message area is temporary paused\r");
fprintf(qp, " C - You are cutoff from this area\r\r");
fprintf(qp, "With regards, %s\r\r", CFG.sysop_name);
fprintf(qp, "%s\r", tearline);
fprintf(qp, "%s\r", TearLine());
CloseMail(qp, t);
net_out++;
free(temp);
@ -1068,7 +1067,7 @@ int AreaMgr(faddr *f, faddr *t, char *replyid, char *subj, time_t mdate, int fla
}
fprintf(np, "\rWith regards, %s\r\r", CFG.sysop_name);
fprintf(np, "%s\r", tearline);
fprintf(np, "%s\r", TearLine());
CloseMail(np, t);
net_out++;
} else

View File

@ -53,7 +53,6 @@
* External declarations
*/
extern int do_quiet;
extern char *tearline;
@ -135,7 +134,7 @@ int Bounce(faddr *f, faddr *t, FILE *fp, char *reason)
}
fprintf(np, "\rWith regards, %s\r\r", CFG.sysop_name);
fprintf(np, "%s\r", tearline);
fprintf(np, "%s\r", TearLine());
Now = time(NULL) - (gmt_offset((time_t)0) * 60);
rc = postnetmail(np, from, f, NULL, (char *)"Bounced message", Now, 0x0000, FALSE);
tidy_faddr(from);

View File

@ -52,7 +52,6 @@
* External declarations
*/
extern int do_quiet;
extern char *tearline;
@ -124,7 +123,7 @@ void F_Help(faddr *t, char *replyid)
fprintf(fp, " %%QUERY\r");
fprintf(fp, " %%LIST\r\r");
fprintf(fp, "%s\r", tearline);
fprintf(fp, "%s\r", TearLine());
CloseMail(fp, t);
net_out++;
} else
@ -226,7 +225,7 @@ void F_Query(faddr *t, char *replyid)
fprintf(qp, " S - You may send files in this area\r");
fprintf(qp, " P - The file area is temporary paused\r\r");
fprintf(qp, "With regards, %s\r\r", CFG.sysop_name);
fprintf(qp, "%s\r", tearline);
fprintf(qp, "%s\r", TearLine());
CloseMail(qp, t);
net_out++;
free(temp);
@ -329,7 +328,7 @@ void F_List(faddr *t, char *replyid, int Notify)
fprintf(qp, " S - You may send files in this area\r");
fprintf(qp, " P - The file area is temporary paused\r\r");
fprintf(qp, "With regards, %s\r\r", CFG.sysop_name);
fprintf(qp, "%s\r", tearline);
fprintf(qp, "%s\r", TearLine());
CloseMail(qp, t);
net_out++;
free(temp);
@ -379,7 +378,7 @@ void F_Status(faddr *t, char *replyid)
fprintf(fp, "\rWith regards, %s\r\r", CFG.sysop_name);
fprintf(fp, "%s\r", tearline);
fprintf(fp, "%s\r", TearLine());
CloseMail(fp, t);
net_out++;
} else
@ -481,7 +480,7 @@ void F_Unlinked(faddr *t, char *replyid)
fprintf(qp, " S - You may send files in this area\r");
fprintf(qp, " P - The file area is temporary paused\r\r");
fprintf(qp, "With regards, %s\r\r", CFG.sysop_name);
fprintf(qp, "%s\r", tearline);
fprintf(qp, "%s\r", TearLine());
CloseMail(qp, t);
net_out++;
free(temp);
@ -942,7 +941,7 @@ int FileMgr(faddr *f, faddr *t, char *replyid, char *subj, time_t mdate, int fla
}
fprintf(np, "\rWith regards, %s\r\r", CFG.sysop_name);
fprintf(np, "%s\r", tearline);
fprintf(np, "%s\r", TearLine());
CloseMail(np, t);
net_out++;
} else

View File

@ -44,6 +44,7 @@
void ForwardFile(fidoaddr Node, fa_list *sbl)
{
char *subject = NULL, *temp, *fwdfile = NULL, *ticfile = NULL, fname[PATH_MAX];
@ -150,7 +151,7 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
fprintf(net, "\r\r");
fprintf(net, "With regards, %s\r\r", CFG.sysop_name);
fprintf(net, "... %s\r\r", Cookie());
fprintf(net, "--- MBSE BBS %s\r", VERSION);
fprintf(net, "%s\r", TearLine());
CloseMail(net, fido2faddr(Node));
} else {
WriteError("$Can't create netmail");

View File

@ -48,7 +48,6 @@ extern int do_quiet; /* Supress screen output */
extern int show_log; /* Show logging */
time_t t_start; /* Start time */
time_t t_end; /* End time */
char *tearline; /* Standard tearline */
@ -83,7 +82,6 @@ void die(int onsig)
colour(7, 0);
printf("\n");
}
free(tearline);
ExitClient(onsig);
}
@ -107,16 +105,6 @@ int main(int argc, char **argv)
Miy = t->tm_mon;
umask(002);
tearline = calloc(41, sizeof(char *));
#ifdef __linux__
sprintf(tearline, "--- MBSE BBS v%s (Linux)", VERSION);
#elif __FreeBSD__
sprintf(tearline, "--- MBSE BBS v%s (FreeBSD)", VERSION);
#elif __NetBSD__
sprintf(tearline, "--- MBSE BBS v%s (NetBSD)", VERSION);
#else
sprintf(tearline, "--- MBSE BBS v%s (Unknown)", VERSION);
#endif
/*
* Catch all signals we can, and ignore the rest.

View File

@ -93,7 +93,6 @@ time_t t_end; /* End time */
int packets = 0; /* Tossed packets */
int packets_ok = 0; /* Tossed packets Ok. */
char *envptr = NULL;
char *tearline; /* Standard tearline for mail */
extern int net_in, net_imp, net_out, net_bad;
extern int echo_in, echo_imp, echo_out, echo_bad, echo_dupe;
@ -242,7 +241,6 @@ void die(int onsig)
if (!do_quiet)
colour(7, 0);
free(tearline);
ExitClient(onsig);
}
@ -305,16 +303,6 @@ int main(int argc, char **argv)
Miy = t->tm_mon;
umask(002);
tearline = calloc(41, sizeof(char *));
#ifdef __linux__
sprintf(tearline, "--- MBSE BBS v%s (Linux)", VERSION);
#elif __FreeBSD__
sprintf(tearline, "--- MBSE BBS v%s (FreeBSD)", VERSION);
#elif __NetBSD__
sprintf(tearline, "--- MBSE BBS v%s (NetBSD)", VERSION);
#else
sprintf(tearline, "--- MBSE BBS v%s (Unknown)", VERSION);
#endif
/*
* Catch all the signals we can, and ignore the rest.

View File

@ -58,7 +58,6 @@ int msg_del = 0; /* Deleted messages */
int msg_link = 0; /* Linked messages */
int processed = FALSE; /* Did process something */
int oldmask;
char *tearline; /* Standard tearline */
@ -96,17 +95,6 @@ int main(int argc, char **argv)
oldmask = umask(007);
t_start = time(NULL);
tearline = calloc(41, sizeof(char *));
#ifdef __linux__
sprintf(tearline, "--- MBSE BBS v%s (Linux)", VERSION);
#elif __FreeBSD__
sprintf(tearline, "--- MBSE BBS v%s (FreeBSD)", VERSION);
#elif __NetBSD__
sprintf(tearline, "--- MBSE BBS v%s (NetBSD)", VERSION);
#else
sprintf(tearline, "--- MBSE BBS v%s (Unknown)", VERSION);
#endif
/*
* Catch all signals we can, and ignore or catch them
*/
@ -256,7 +244,6 @@ void die(int onsig)
colour(7, 0);
printf("\r \n");
}
free(tearline);
ExitClient(onsig);
}

View File

@ -41,7 +41,6 @@
extern int do_quiet; /* Supress screen output */
extern char *tearline;
/*
@ -157,7 +156,7 @@ void Msg_Bot(fidoaddr UseAka, char *Org)
sprintf(temp, "With regards, %s", CFG.sysop_name);
MsgText_Add2(temp);
MsgText_Add2((char *)"");
MsgText_Add2(tearline);
MsgText_Add2(TearLine());
if (UseAka.point)
sprintf(aka, "(%d:%d/%d.%d)", UseAka.zone, UseAka.net, UseAka.node, UseAka.point);

View File

@ -53,7 +53,6 @@
* External declarations
*/
extern int do_quiet;
extern char *tearline;
@ -134,7 +133,7 @@ int Ping(faddr *f, faddr *t, FILE *fp, int intransit)
fprintf(np, "======================================================================\r");
fprintf(np, "\rWith regards, %s\r\r", CFG.sysop_name);
fprintf(np, "%s\r", tearline);
fprintf(np, "%s\r", TearLine());
Now = time(NULL) - (gmt_offset((time_t)0) * 60);
rc = postnetmail(np, from, f, NULL, (char *)"Re: Ping", Now, 0x0000, FALSE);
tidy_faddr(from);

View File

@ -41,7 +41,6 @@
extern int do_quiet; /* Supress screen output */
extern char *tearline;
@ -211,7 +210,7 @@ void Post(char *To, long Area, char *Subj, char *File, char *Flavor)
*/
aka = calloc(40, sizeof(char));
MsgText_Add2((char *)"");
MsgText_Add2(tearline);
MsgText_Add2(TearLine());
if (msgs.Aka.point)
sprintf(aka, "(%d:%d/%d.%d)", msgs.Aka.zone, msgs.Aka.net, msgs.Aka.node, msgs.Aka.point);

View File

@ -699,7 +699,7 @@ int rfc2ftn(FILE *fp, faddr *recipient)
else
charwrite(p,ofp);
} else
fprintf(ofp,"--- MBSE BBSv.%s\n",VERSION);
fprintf(ofp,"%s\n", TearLine());
if ((p = hdr((char *)"X-FTN-Origin",msg))) {
if (*(q=p+strlen(p)-1) == '\n')

View File

@ -310,16 +310,13 @@ int Save_Email(int IsReply)
} else
Msg.ReplyCRC = 0xffffffff;
/*
* Add message text
*/
for (i = 1; i < Line; i++) {
MsgText_Add2(Message[i]);
}
sprintf(temp, "--- MBSE BBS v%s (Linux)", VERSION);
MsgText_Add2(temp);
MsgText_Add2(TearLine());
/*
* Save if to disk

View File

@ -436,7 +436,7 @@ void Masterlist()
MidLine((char *)"", fp, TRUE);
MidLine((char *)"", np, TRUE);
sprintf(temp, "Created by MBSE BBS v%s (Linux) at %s", VERSION, StrDateDMY(t_start));
sprintf(temp, "Created by MBSE BBS v%s (%s-%s) at %s", VERSION, OsName(), OsCPU(), StrDateDMY(t_start));
MidLine(temp, fp, TRUE);
MidLine(temp, np, TRUE);

View File

@ -274,17 +274,7 @@ void Add_Footkludges(int Quote)
MsgText_Add2(temp);
MsgText_Add2((char *)"");
}
#ifdef __linux__
sprintf(temp, "--- MBSE BBS v%s (Linux)", VERSION);
#elif __FreeBSD__
sprintf(temp, "--- MBSE BBS v%s (FreeBSD)", VERSION);
#elif __NetBSD__
sprintf(temp, "--- MBSE BBS v%s (NetBSD)", VERSION);
#else
sprintf(temp, "--- MBSE BBS v%s (Unknown)", VERSION);
#endif
MsgText_Add2(temp);
MsgText_Add2(TearLine());
if ((msgs.Type == ECHOMAIL) || (msgs.Type == LIST)) {
/* RANDOM ORIGIN LINES IMPLEMENTEREN */

View File

@ -91,15 +91,7 @@ void cr(void)
wl(a);
ls(a);
#ifdef __linux__
sprintf(temp, "MBSE Bulletin Board System %s (Linux)", VERSION);
#elif __FreeBSD__
sprintf(temp, "MBSE Bulletin Board System %s (FreeBSD)", VERSION);
#elif __NetBSD__
sprintf(temp, "MBSE Bulletin Board System %s (NetBSD)", VERSION);
#else
sprintf(temp, "MBSE Bulletin Board System %s (Unknown OS)", VERSION);
#endif
sprintf(temp, "MBSE Bulletin Board System %s (%s-%s)", VERSION, OsName(), OsCPU());
pout(14, 0, padleft(temp, 76, ' '));
rs(a);
wl(a);

View File

@ -136,15 +136,7 @@ void soft_info(void)
temp = calloc(81, sizeof(char));
clr_index();
set_color(YELLOW, BLACK);
#ifdef __linux__
center_addstr( 6, (char *)"MBSE BBS (Linux)");
#elif __FreeBSD__
center_addstr( 6, (char *)"MBSE BBS (FreeBSD)");
#elif __NetBSD__
center_addstr( 6, (char *)"MBSE BBS (NetBSD)");
#else
center_addstr( 6, (char *)"MBSE BBS (Unknown)");
#endif
center_addstr( 6, (char *)"MBSE BBS (%s-%s)", OsName(), OsCPU());
set_color(WHITE, BLACK);
center_addstr( 8, (char *)COPYRIGHT);
set_color(YELLOW, BLACK);