Code cleanup for ports
This commit is contained in:
parent
e5457c6187
commit
8149bb99f6
@ -7,14 +7,17 @@ v0.71.1 28-Nov-2004
|
||||
Compiles more or less on x86_64, there are issues with utmp
|
||||
and struct lastlog
|
||||
Compiles on NetBSD i386.
|
||||
Compiles in Alpha.
|
||||
Compiles on Alpha.
|
||||
Doesn't compile on Mac OS X.
|
||||
|
||||
upgrade:
|
||||
Make sure you remove everything related to bbslist menus from
|
||||
your menus and txtfiles.
|
||||
|
||||
general:
|
||||
Added port to OpenBSD, is under test.
|
||||
Added port to OpenBSD, is under test (and doesn't work).
|
||||
Code cleanup so that compile stops on unknown OSes and CPUs
|
||||
instead of missing code parts.
|
||||
|
||||
mbsebbs:
|
||||
The creation of the mailout semafore is now after the hangup
|
||||
|
@ -1278,16 +1278,7 @@ struct menufile {
|
||||
unsigned int xMaxSecurity;
|
||||
char DoorName[15]; /* Door name */
|
||||
char TypeDesc[30]; /* Menu Type Description */
|
||||
#ifdef __i386__
|
||||
unsigned AutoExec : 1; /* Auto Exec Menu Type */
|
||||
unsigned NoDoorsys : 1; /* Suppress door.sys */
|
||||
unsigned Y2Kdoorsys : 1; /* Write Y2K style door.sys */
|
||||
unsigned Comport : 1; /* Vmodem comport mode */
|
||||
unsigned NoSuid : 1; /* Execute door nosuid */
|
||||
unsigned NoPrompt : 1; /* No prompt after door */
|
||||
unsigned SingleUser : 1; /* Single user door */
|
||||
unsigned HideDoor : 1; /* Hide door from lists */
|
||||
#else
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
/* All bits swapped */
|
||||
unsigned HideDoor : 1; /* Hide door from lists */
|
||||
unsigned SingleUser : 1; /* Single user door */
|
||||
@ -1297,6 +1288,15 @@ struct menufile {
|
||||
unsigned Y2Kdoorsys : 1; /* Write Y2K style door.sys */
|
||||
unsigned NoDoorsys : 1; /* Suppress door.sys */
|
||||
unsigned AutoExec : 1; /* Auto Exec Menu Type */
|
||||
#else
|
||||
unsigned AutoExec : 1; /* Auto Exec Menu Type */
|
||||
unsigned NoDoorsys : 1; /* Suppress door.sys */
|
||||
unsigned Y2Kdoorsys : 1; /* Write Y2K style door.sys */
|
||||
unsigned Comport : 1; /* Vmodem comport mode */
|
||||
unsigned NoSuid : 1; /* Execute door nosuid */
|
||||
unsigned NoPrompt : 1; /* No prompt after door */
|
||||
unsigned SingleUser : 1; /* Single user door */
|
||||
unsigned HideDoor : 1; /* Hide door from lists */
|
||||
#endif
|
||||
long xUnused;
|
||||
int HiForeGnd; /* High ForeGround color */
|
||||
|
@ -344,7 +344,7 @@ char *OsName()
|
||||
#elif __OpenBSD__
|
||||
return (char *)"OpenBSD";
|
||||
#else
|
||||
return (char *)"Unknown";
|
||||
#error "Unknown target OS"
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -365,7 +365,7 @@ char *OsCPU()
|
||||
#elif __hppa__
|
||||
return (char *)"HPPA";
|
||||
#else
|
||||
return (char *)"Unknown";
|
||||
#error "Unknown CPU"
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -406,30 +406,35 @@ void soft_info(void)
|
||||
|
||||
clr_index();
|
||||
set_color(YELLOW, BLACK);
|
||||
#ifdef __linux__
|
||||
|
||||
#if defined(__linux__)
|
||||
p = xstrcpy((char *)"MBSE BBS (GNU/Linux");
|
||||
#elif __FreeBSD__
|
||||
#elif defined(__FreeBSD__)
|
||||
p = xstrcpy((char *)"MBSE BBS (FreeBSD");
|
||||
#elif __NetBSD__
|
||||
#elif defined(__NetBSD__)
|
||||
p = xstrcpy((char *)"MBSE BBS (NetBSD");
|
||||
#elif __OpenBSD__
|
||||
#elif defined(__OpenBSD__)
|
||||
p = xstrcpy((char *)"MBSE BBS (OpenBSD");
|
||||
#else
|
||||
p = xstrcpy((char *)"MBSE BBS (Unknown");
|
||||
#error "Unknown OS"
|
||||
#endif
|
||||
#ifdef __i386__
|
||||
|
||||
#if defined(__i386__)
|
||||
p = xstrcat(p, (char *)" i386)");
|
||||
#elif __PPC__
|
||||
#elif defined(__x86_64__)
|
||||
p = xstrcat(p, (char *)" x86-64");
|
||||
#elif defined(__PPC__) || defined(__ppc__)
|
||||
p = xstrcat(p, (char *)" PPC)");
|
||||
#elif __sparc__
|
||||
#elif defined(__sparc__)
|
||||
p = xstrcat(p, (char *)" Sparc)");
|
||||
#elif __alpha__
|
||||
#elif defined(__alpha__)
|
||||
p = xstrcat(p, (char *)" Alpha)");
|
||||
#elif __hppa__
|
||||
#elif defined(__hppa__)
|
||||
p = xstrcat(p, (char *)" HPPA)");
|
||||
#else
|
||||
p = xstrcat(p, (char *)" Unknown)");
|
||||
#error "Unknown CPU"
|
||||
#endif
|
||||
|
||||
center_addstr( 6, p);
|
||||
free(p);
|
||||
set_color(WHITE, BLACK);
|
||||
|
@ -1691,14 +1691,14 @@ int global_doc(FILE *fp, FILE *toc, int page)
|
||||
if (uname(&utsbuf) == 0) {
|
||||
add_webtable(wp, (char *)"Node name", utsbuf.nodename);
|
||||
fprintf(fp, " Node name %s\n", utsbuf.nodename);
|
||||
#ifdef __USE_GNU
|
||||
#if defined(__USE_GNU)
|
||||
add_webtable(wp, (char *)"Domain name", utsbuf.domainname);
|
||||
fprintf(fp, " Domain name %s\n", utsbuf.domainname);
|
||||
#else
|
||||
#ifdef __linux__
|
||||
#elif defined(__linux__)
|
||||
add_webtable(wp, (char *)"Domain name", utsbuf.__domainname);
|
||||
fprintf(fp, " Domain name %s\n", utsbuf.__domainname);
|
||||
#endif
|
||||
#else
|
||||
#error "Don't know utsbuf.domainname on this OS"
|
||||
#endif
|
||||
sprintf(temp, "%s %s", utsbuf.sysname, utsbuf.release);
|
||||
add_webtable(wp, (char *)"Operating system", temp);
|
||||
|
@ -140,17 +140,16 @@ int CountTtyinfo(void)
|
||||
for (i = 0; i < 4; i++) {
|
||||
memset(&ttyinfo, 0, sizeof(ttyinfo));
|
||||
sprintf(ttyinfo.comment, "ISDN line %d", i+1);
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__)
|
||||
sprintf(ttyinfo.tty, "ttyI%d", i);
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
#elif defined(__FreeBSD__)
|
||||
sprintf(ttyinfo.tty, "cuaia%d", i);
|
||||
#endif
|
||||
#ifdef __NetBSD__
|
||||
#elif defined(__NetBSD__)
|
||||
sprintf(ttyinfo.tty, "ttyi%c", i + 'a'); // NetBSD on a Sparc, how about PC's?
|
||||
#endif
|
||||
#ifdef __OpenBSD__
|
||||
#elif defined(__OpenBSD__)
|
||||
sprintf(ttyinfo.tty, "cuaia%d", i); // I think this is wrong!
|
||||
#else
|
||||
#error "Don't know the tty name for ISDN on this OS"
|
||||
#endif
|
||||
sprintf(ttyinfo.speed, "64 kbits");
|
||||
sprintf(ttyinfo.flags, "XA,X75,CM");
|
||||
@ -166,17 +165,16 @@ int CountTtyinfo(void)
|
||||
for (i = 0; i < 4; i++) {
|
||||
memset(&ttyinfo, 0, sizeof(ttyinfo));
|
||||
sprintf(ttyinfo.comment, "Modem line %d", i+1);
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__)
|
||||
sprintf(ttyinfo.tty, "ttyS%d", i);
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
#elif defined(__FreeBSD__)
|
||||
sprintf(ttyinfo.tty, "cuaa%d", i);
|
||||
#endif
|
||||
#ifdef __NetBSD__
|
||||
#elif defined(__NetBSD__)
|
||||
sprintf(ttyinfo.tty, "tty%c", i + 'a'); // NetBSD on a Sparc, how about PC's?
|
||||
#endif
|
||||
#ifdef __OpenBSD__
|
||||
#elif defined(__OpenBSD__)
|
||||
sprintf(ttyinfo.tty, "tty0%d", i);
|
||||
#else
|
||||
#error "Don't know the tty name of the serial ports on this OS"
|
||||
#endif
|
||||
sprintf(ttyinfo.speed, "33.6 kbits");
|
||||
sprintf(ttyinfo.flags, "CM,XA,V32B,V42B,V34");
|
||||
|
@ -149,12 +149,12 @@ void load_maincfg(void)
|
||||
*/
|
||||
sprintf(CFG.bbs_name, "MBSE BBS");
|
||||
uname((struct utsname *)&un);
|
||||
#ifdef __USE_GNU
|
||||
#if defined(__USE_GNU)
|
||||
sprintf(CFG.sysdomain, "%s.%s", un.nodename, un.domainname);
|
||||
#else
|
||||
#ifdef __linux__
|
||||
#elif defined(__linux__)
|
||||
sprintf(CFG.sysdomain, "%s.%s", un.nodename, un.__domainname);
|
||||
#endif
|
||||
#else
|
||||
#error "Don't know un.domainname on this OS"
|
||||
#endif
|
||||
sprintf(CFG.comment, "MBSE BBS development");
|
||||
sprintf(CFG.origin, "MBSE BBS. Made in the Netherlands");
|
||||
@ -1107,6 +1107,8 @@ void *scheduler(void)
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
#else
|
||||
#error "Don't know how to get the loadaverage on this OS"
|
||||
#endif
|
||||
if (Load >= TCFG.maxload) {
|
||||
if (!LOADhi) {
|
||||
|
@ -49,7 +49,7 @@ char SigName[32][16] = { "NOSIGNAL",
|
||||
"SIGIO", "SIGPWR", "SIGUNUSED"};
|
||||
|
||||
|
||||
#elif defined(__PPC__)
|
||||
#elif defined(__PPC__) || defined(__ppc__)
|
||||
|
||||
char SigName[32][16] = { "NOSIGNAL",
|
||||
"SIGHUP", "SIGINT", "SIGQUIT", "SIGILL",
|
||||
|
@ -363,6 +363,8 @@ void update_diskstat(void)
|
||||
* XxxxBSD has the info in the statfs structure.
|
||||
*/
|
||||
tmp->ro = (sfs.f_flags & MNT_RDONLY);
|
||||
#else
|
||||
#error "Don't know how to get sfs read-only status"
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -385,6 +387,8 @@ void add_path(char *lpath)
|
||||
struct statfs *mntbuf;
|
||||
long mntsize;
|
||||
int i;
|
||||
#else
|
||||
#error "Don't know how to get mount paths"
|
||||
#endif
|
||||
|
||||
if (strlen(lpath) == 0) {
|
||||
|
@ -221,8 +221,7 @@ int main(int argc, char *argv[])
|
||||
exit(1);
|
||||
}
|
||||
#else
|
||||
syslog(LOG_WARNING, "Don't know how to add a user on this OS");
|
||||
exit(1);
|
||||
#error "Don't know how to add a user on this OS"
|
||||
#endif
|
||||
|
||||
sprintf(shell, "%s/bin/mbsebbs", getenv("MBSE_ROOT"));
|
||||
@ -239,8 +238,7 @@ int main(int argc, char *argv[])
|
||||
args[8] = shell;
|
||||
args[9] = argv[2];
|
||||
args[10] = NULL;
|
||||
#endif
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
args[1] = (char *)"-c";
|
||||
args[2] = argv[3];
|
||||
args[3] = (char *)"-d";
|
||||
@ -252,8 +250,7 @@ int main(int argc, char *argv[])
|
||||
args[9] = (char *)"-m";
|
||||
args[10] = argv[2];
|
||||
args[11] = NULL;
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
#elif defined(__FreeBSD__)
|
||||
args[1] = (char *)"useradd";
|
||||
args[2] = argv[2];
|
||||
args[3] = (char *)"-c";
|
||||
@ -265,6 +262,8 @@ int main(int argc, char *argv[])
|
||||
args[9] = (char *)"-s";
|
||||
args[10] = shell;
|
||||
args[11] = NULL;
|
||||
#else
|
||||
#error "Don't know how to add a user on this OS"
|
||||
#endif
|
||||
|
||||
if (execute(args, (char *)"/dev/tty", (char *)"/dev/tty", (char *)"/dev/tty") != 0) {
|
||||
|
Reference in New Issue
Block a user