Updated configure for OpenBSD

This commit is contained in:
Michiel Broek 2004-12-29 13:06:09 +00:00
parent c756663370
commit fe48a306c3
4 changed files with 160 additions and 156 deletions

2
configure vendored
View File

@ -4904,7 +4904,7 @@ if test "$SYSTEM" = "NetBSD"; then
fi fi
if test "$SYSTEM" = "FreeBSD"; then if test "$SYSTEM" = "FreeBSD" || test "$SYSTEM" = "OpenBSD"; then
CFLAGS="-pthread $CFLAGS" CFLAGS="-pthread $CFLAGS"
else else
echo "$as_me:$LINENO: checking for pthread_create in -lpthread" >&5 echo "$as_me:$LINENO: checking for pthread_create in -lpthread" >&5

View File

@ -51,7 +51,7 @@ char SigName[32][16] = { "NOSIGNAL",
#elif defined(__PPC__) #elif defined(__PPC__)
char SgName[32][16] = { "NOSIGNAL", char SigName[32][16] = { "NOSIGNAL",
"SIGHUP", "SIGINT", "SIGQUIT", "SIGILL", "SIGHUP", "SIGINT", "SIGQUIT", "SIGILL",
"SIGTRAP", "SIGIOT", "SIGBUS", "SIGFPE", "SIGTRAP", "SIGIOT", "SIGBUS", "SIGFPE",
"SIGKILL", "SIGUSR1", "SIGSEGV", "SIGUSR2", "SIGKILL", "SIGUSR1", "SIGSEGV", "SIGUSR2",
@ -64,7 +64,7 @@ char SgName[32][16] = { "NOSIGNAL",
#elif defined(__sparc__) #elif defined(__sparc__)
char SgName[32][16] = { "NOSIGNAL", char SigName[32][16] = { "NOSIGNAL",
"SIGHUP", "SIGINT", "SIGQUIT", "SIGILL", "SIGHUP", "SIGINT", "SIGQUIT", "SIGILL",
"SIGTRAP", "SIGIOT", "SIGEMT", "SIGFPE", "SIGTRAP", "SIGIOT", "SIGEMT", "SIGFPE",
"SIGKILL", "SIGBUS", "SIGSEGV", "SIGSYS", "SIGKILL", "SIGBUS", "SIGSEGV", "SIGSYS",
@ -76,7 +76,7 @@ char SgName[32][16] = { "NOSIGNAL",
#elif defined(__alpha__) #elif defined(__alpha__)
char SgName[32][16] = { "NOSIGNAL", char SigName[32][16] = { "NOSIGNAL",
"SIGHUP", "SIGINT", "SIGQUIT", "SIGILL", "SIGHUP", "SIGINT", "SIGQUIT", "SIGILL",
"SIGTRAP", "SIGABRT", "SIGEMT", "SIGFPE", "SIGTRAP", "SIGABRT", "SIGEMT", "SIGFPE",
"SIGKILL", "SIGBUS", "SIGSEGV", "SIGSYS", "SIGKILL", "SIGBUS", "SIGSEGV", "SIGSYS",

View File

@ -94,44 +94,44 @@ extern int Processing; /* Is system running */
*/ */
void status_init() void status_init()
{ {
size_t cnt; size_t cnt;
int stat_fd; int stat_fd;
sprintf(stat_fn, "%s/var/status.mbsed", getenv("MBSE_ROOT")); sprintf(stat_fn, "%s/var/status.mbsed", getenv("MBSE_ROOT"));
/* /*
* First check if this is the very first time we start the show. * First check if this is the very first time we start the show.
* If so, we generate an empty status file with only the start * If so, we generate an empty status file with only the start
* date in it. * date in it.
*/ */
stat_fd = open(stat_fn, O_RDWR); stat_fd = open(stat_fn, O_RDWR);
if (stat_fd == -1) { if (stat_fd == -1) {
memset((char *)&status, 0, sizeof(status_r)); memset((char *)&status, 0, sizeof(status_r));
status.start = time(NULL); status.start = time(NULL);
status.daily = time(NULL); status.daily = time(NULL);
status.sequence = (unsigned long)time(NULL); status.sequence = (unsigned long)time(NULL);
stat_fd = open(stat_fn, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR); stat_fd = open(stat_fn, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
cnt = write(stat_fd, &status, sizeof(status_r));
Syslog('+', "New statusfile created");
lseek(stat_fd, 0, SEEK_SET);
}
cnt = read(stat_fd, &status, sizeof(status_r));
if (cnt != sizeof(status_r)) {
printf("Error reading status file\n");
exit(MBERR_INIT_ERROR);
}
status.startups++;
status.laststart = time(NULL);
status.clients = 1; /* We are a client ourself */
s_bbsopen = status.open;
lseek(stat_fd, 0, SEEK_SET);
cnt = write(stat_fd, &status, sizeof(status_r)); cnt = write(stat_fd, &status, sizeof(status_r));
if (cnt != sizeof(status_r)) { Syslog('+', "New statusfile created");
Syslog('?', "$Error rewrite status file\n"); lseek(stat_fd, 0, SEEK_SET);
exit(MBERR_INIT_ERROR); }
}
close(stat_fd); cnt = read(stat_fd, &status, sizeof(status_r));
if (cnt != sizeof(status_r)) {
printf("Error reading status file\n");
exit(MBERR_INIT_ERROR);
}
status.startups++;
status.laststart = time(NULL);
status.clients = 1; /* We are a client ourself */
s_bbsopen = status.open;
lseek(stat_fd, 0, SEEK_SET);
cnt = write(stat_fd, &status, sizeof(status_r));
if (cnt != sizeof(status_r)) {
Syslog('?', "$Error rewrite status file\n");
exit(MBERR_INIT_ERROR);
}
close(stat_fd);
} }
@ -209,109 +209,109 @@ void status_write(void)
*/ */
int get_zmh() int get_zmh()
{ {
struct tm l_date; struct tm l_date;
char sstime[6]; char sstime[6];
time_t Now; time_t Now;
Now = time(NULL); Now = time(NULL);
#if defined(__OpenBSD__) #if defined(__OpenBSD__)
gmtime_r(&Now, &l_date); gmtime_r(&Now, &l_date);
#else #else
l_date = *gmtime(&Now); l_date = *gmtime(&Now);
#endif #endif
sprintf(sstime, "%02d:%02d", l_date.tm_hour, l_date.tm_min); sprintf(sstime, "%02d:%02d", l_date.tm_hour, l_date.tm_min);
if ((strncmp(sstime, TCFG.zmh_start, 5) >= 0) && (strncmp(sstime, TCFG.zmh_end, 5) < 0)) { if ((strncmp(sstime, TCFG.zmh_start, 5) >= 0) && (strncmp(sstime, TCFG.zmh_end, 5) < 0)) {
if (!ZMH) { if (!ZMH) {
CreateSema((char *)"zmh"); CreateSema((char *)"zmh");
Syslog('!', "Start of Zone Mail Hour"); Syslog('!', "Start of Zone Mail Hour");
ZMH = TRUE; ZMH = TRUE;
}
} else {
if (ZMH) {
RemoveSema((char *)"zmh");
Syslog('!', "End of Zone Mail Hour");
ZMH = FALSE;
}
} }
return ZMH; } else {
if (ZMH) {
RemoveSema((char *)"zmh");
Syslog('!', "End of Zone Mail Hour");
ZMH = FALSE;
}
}
return ZMH;
} }
void stat_inc_clients() void stat_inc_clients()
{ {
status.clients++; status.clients++;
status.total.tot_clt++; status.total.tot_clt++;
status.today.tot_clt++; status.today.tot_clt++;
if (status.clients >= status.total.peak_clt) if (status.clients >= status.total.peak_clt)
status.total.peak_clt = status.clients; status.total.peak_clt = status.clients;
if (status.clients >= status.today.peak_clt) if (status.clients >= status.today.peak_clt)
status.today.peak_clt = status.clients; status.today.peak_clt = status.clients;
status_write(); status_write();
} }
void stat_dec_clients() void stat_dec_clients()
{ {
status.clients--; status.clients--;
status_write(); status_write();
} }
void stat_set_open(int op) void stat_set_open(int op)
{ {
if (op) { if (op) {
if (!s_bbsopen) { if (!s_bbsopen) {
Syslog('!', "The bbs is open"); Syslog('!', "The bbs is open");
sem_set((char *)"scanout", TRUE); sem_set((char *)"scanout", TRUE);
}
} else {
if (s_bbsopen) {
Syslog('!', "The bbs is closed");
}
} }
s_bbsopen = status.open = op; } else {
status_write(); if (s_bbsopen) {
Syslog('!', "The bbs is closed");
}
}
s_bbsopen = status.open = op;
status_write();
} }
void stat_inc_serr() void stat_inc_serr()
{ {
status.total.s_error++; status.total.s_error++;
status.today.s_error++; status.today.s_error++;
status_write(); status_write();
} }
void stat_inc_cerr() void stat_inc_cerr()
{ {
status.total.c_error++; status.total.c_error++;
status.today.c_error++; status.today.c_error++;
status_write(); status_write();
} }
char *stat_status() char *stat_status()
{ {
static char buf[160]; static char buf[160];
buf[0] = '\0'; buf[0] = '\0';
sprintf(buf, "100:20,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%d,%d,%d,%d,%d,%2.2f,%lu;", sprintf(buf, "100:20,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%d,%d,%d,%d,%d,%2.2f,%lu;",
(long)status.start, (long)status.laststart, (long)status.daily, (long)status.start, (long)status.laststart, (long)status.daily,
status.startups, status.clients, status.startups, status.clients,
status.total.tot_clt, status.total.peak_clt, status.total.tot_clt, status.total.peak_clt,
status.total.s_error, status.total.c_error, status.total.s_error, status.total.c_error,
status.today.tot_clt, status.today.peak_clt, status.today.tot_clt, status.today.peak_clt,
status.today.s_error, status.today.c_error, status.today.s_error, status.today.c_error,
status.open, get_zmh(), internet, s_do_inet, Processing, Load, status.sequence); status.open, get_zmh(), internet, s_do_inet, Processing, Load, status.sequence);
return buf; return buf;
} }
@ -324,11 +324,11 @@ char *stat_status()
*/ */
int stat_bbs_stat() int stat_bbs_stat()
{ {
if (!status.open) if (!status.open)
return 1; return 1;
if (get_zmh()) if (get_zmh())
return 2; return 2;
return 0; return 0;
} }
@ -338,13 +338,13 @@ int stat_bbs_stat()
*/ */
char *getseq(void) char *getseq(void)
{ {
static char buf[80]; static char buf[80];
buf[0] = '\0'; buf[0] = '\0';
status.sequence++; status.sequence++;
status_write(); status_write();
sprintf(buf, "100:1,%lu;", status.sequence); sprintf(buf, "100:1,%lu;", status.sequence);
return buf; return buf;
} }

View File

@ -267,13 +267,13 @@ char *xstrcat(char *src, char *add)
void CreateSema(char *sem) void CreateSema(char *sem)
{ {
char temp[PATH_MAX]; char temp[PATH_MAX];
int fd; FILE *fp;
sprintf(temp, "%s/var/sema/%s", getenv("MBSE_ROOT"), sem); sprintf(temp, "%s/var/sema/%s", getenv("MBSE_ROOT"), sem);
if (access(temp, F_OK) == 0) if (access(temp, F_OK) == 0)
return; return;
if ((fd = open(temp, O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)) >= 0) if ((fp = fopen(temp, "w"))) {
close(fd); fclose(fp);
else else
Syslog('?', "Can't create semafore %s", temp); Syslog('?', "Can't create semafore %s", temp);
} }
@ -283,11 +283,11 @@ void CreateSema(char *sem)
void TouchSema(char *sem) void TouchSema(char *sem)
{ {
char temp[PATH_MAX]; char temp[PATH_MAX];
int fd; FILE *fp;
sprintf(temp, "%s/var/sema/%s", getenv("MBSE_ROOT"), sem); sprintf(temp, "%s/var/sema/%s", getenv("MBSE_ROOT"), sem);
if ((fd = open(temp, O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)) >= 0) { if ((fp = fopen(temp, "w"))) {
close(fd); fclose(fp);
} else } else
Syslog('?', "Can't touch semafore %s", temp); Syslog('?', "Can't touch semafore %s", temp);
} }
@ -333,6 +333,7 @@ int file_exist(char *path, int mode)
} }
/* /*
* Make directory tree, the name must end with a / * Make directory tree, the name must end with a /
*/ */
@ -399,6 +400,7 @@ time_t file_time(char *path)
} }
/* /*
* Return ASCII string for node, the bits in 'fl' set the output format. * Return ASCII string for node, the bits in 'fl' set the output format.
*/ */
@ -443,34 +445,36 @@ char *fido2str(fidoaddr a, int fl)
return buf; return buf;
} }
char *Dos2Unix(char *dosname) char *Dos2Unix(char *dosname)
{ {
char buf[PATH_MAX]; char buf[PATH_MAX];
static char buf2[PATH_MAX]; static char buf2[PATH_MAX];
char *p, *q; char *p, *q;
memset(&buf, 0, sizeof(buf)); memset(&buf, 0, sizeof(buf));
memset(&buf2, 0, sizeof(buf2)); memset(&buf2, 0, sizeof(buf2));
sprintf(buf, "%s", dosname); sprintf(buf, "%s", dosname);
p = buf; p = buf;
if (strlen(CFG.dospath)) { if (strlen(CFG.dospath)) {
if (strncasecmp(p, CFG.dospath, strlen(CFG.dospath)) == 0) { if (strncasecmp(p, CFG.dospath, strlen(CFG.dospath)) == 0) {
strcpy((char *)buf2, CFG.uxpath); strcpy((char *)buf2, CFG.uxpath);
for (p+=strlen(CFG.dospath), q = buf2 + strlen(buf2); *p; p++, q++) for (p+=strlen(CFG.dospath), q = buf2 + strlen(buf2); *p; p++, q++)
*q = ((*p) == '\\')?'/':tolower(*p); *q = ((*p) == '\\')?'/':tolower(*p);
*q = '\0'; *q = '\0';
p = buf2; p = buf2;
} else { } else {
if (strncasecmp(p, CFG.uxpath, strlen(CFG.uxpath)) == 0) { if (strncasecmp(p, CFG.uxpath, strlen(CFG.uxpath)) == 0) {
for (p+=strlen(CFG.uxpath), q = buf2 + strlen(buf2); *p; p++, q++) for (p+=strlen(CFG.uxpath), q = buf2 + strlen(buf2); *p; p++, q++)
*q = ((*p) == '\\')?'/':tolower(*p); *q = ((*p) == '\\')?'/':tolower(*p);
*q = '\0'; *q = '\0';
p = buf2; p = buf2;
} }
}
} }
return buf2; }
return buf2;
} }
@ -499,33 +503,33 @@ char *dayname(void)
void InitFidonet(void) void InitFidonet(void)
{ {
memset(&fidonet, 0, sizeof(fidonet)); memset(&fidonet, 0, sizeof(fidonet));
} }
int SearchFidonet(unsigned short zone) int SearchFidonet(unsigned short zone)
{ {
FILE *fil; FILE *fil;
char fidonet_fil[PATH_MAX]; char fidonet_fil[PATH_MAX];
int i; int i;
sprintf(fidonet_fil, "%s/etc/fidonet.data", getenv("MBSE_ROOT")); sprintf(fidonet_fil, "%s/etc/fidonet.data", getenv("MBSE_ROOT"));
if ((fil = fopen(fidonet_fil, "r")) == NULL) { if ((fil = fopen(fidonet_fil, "r")) == NULL) {
return FALSE;
}
fread(&fidonethdr, sizeof(fidonethdr), 1, fil);
while (fread(&fidonet, fidonethdr.recsize, 1, fil) == 1) {
for (i = 0; i < 6; i++) {
if (zone == fidonet.zone[i]) {
fclose(fil);
return TRUE;
}
}
}
fclose(fil);
return FALSE; return FALSE;
}
fread(&fidonethdr, sizeof(fidonethdr), 1, fil);
while (fread(&fidonet, fidonethdr.recsize, 1, fil) == 1) {
for (i = 0; i < 6; i++) {
if (zone == fidonet.zone[i]) {
fclose(fil);
return TRUE;
}
}
}
fclose(fil);
return FALSE;
} }