diff options
-rw-r--r-- | include/bbs.h | 22 | ||||
-rw-r--r-- | include/osdep.h | 64 | ||||
-rw-r--r-- | include/proto.h | 34 | ||||
-rw-r--r-- | innbbsd/Makefile | 8 | ||||
-rw-r--r-- | innbbsd/bbsnnrp.c | 17 | ||||
-rw-r--r-- | innbbsd/connectsock.c | 23 | ||||
-rw-r--r-- | innbbsd/rfc931.c | 3 | ||||
-rw-r--r-- | mbbsd/admin.c | 4 | ||||
-rw-r--r-- | mbbsd/bbs.c | 4 | ||||
-rw-r--r-- | mbbsd/brc.c | 12 | ||||
-rw-r--r-- | mbbsd/cache.c | 2 | ||||
-rw-r--r-- | mbbsd/chat.c | 2 | ||||
-rw-r--r-- | mbbsd/chc.c | 12 | ||||
-rw-r--r-- | mbbsd/edit.c | 20 | ||||
-rw-r--r-- | mbbsd/io.c | 2 | ||||
-rw-r--r-- | mbbsd/mail.c | 6 | ||||
-rw-r--r-- | mbbsd/mbbsd.c | 45 | ||||
-rw-r--r-- | mbbsd/name.c | 2 | ||||
-rw-r--r-- | mbbsd/osdep.c | 487 | ||||
-rw-r--r-- | mbbsd/talk.c | 8 | ||||
-rw-r--r-- | mbbsd/term.c | 6 | ||||
-rw-r--r-- | mbbsd/topsong.c | 2 | ||||
-rw-r--r-- | mbbsd/user.c | 8 | ||||
-rw-r--r-- | pttbbs.mk | 20 | ||||
-rw-r--r-- | util/bbsrf.c | 75 | ||||
-rw-r--r-- | util/diskstat.c | 4 | ||||
-rw-r--r-- | util/outmail.c | 2 | ||||
-rw-r--r-- | util/xchatd.c | 18 |
28 files changed, 697 insertions, 215 deletions
diff --git a/include/bbs.h b/include/bbs.h index 45ca1292..5b4dca21 100644 --- a/include/bbs.h +++ b/include/bbs.h @@ -34,27 +34,7 @@ #include <sys/sem.h> #include <sys/msg.h> -/* os dependant include file, define */ -#ifdef __FreeBSD__ - #if __FreeBSD__ >=5 - #include <sys/limits.h> - #else - #include <machine/limits.h> - #endif - #include <machine/param.h> -#endif -#ifdef __linux__ - #include <sys/param.h> - #include <sys/ioctl.h> - #include <limits.h> - #include <sys/file.h> /* for flock() */ - #include <strings.h> /* for strcasecmp() */ - size_t - strlcpy(char *dst, const char *src, size_t size); - - size_t - strlcat(char *dst, const char *src, size_t size); -#endif +#include "osdep.h" /* our header */ #include "config.h" diff --git a/include/osdep.h b/include/osdep.h new file mode 100644 index 00000000..a7c719d1 --- /dev/null +++ b/include/osdep.h @@ -0,0 +1,64 @@ + +#ifndef __OSDEP_H__ +#define __OSDEP_H__ + +/* os dependant include file, define */ +#ifdef __FreeBSD__ + #if __FreeBSD__ >= 5 + #include <sys/limits.h> + #else + #include <machine/limits.h> + #endif + #include <machine/param.h> + +#elif defined(__linux__) + + #include <sys/param.h> + #include <sys/ioctl.h> + #include <limits.h> + #include <sys/file.h> /* for flock() */ + #include <strings.h> /* for strcasecmp() */ + + #define NEED_STRCASESTR + #define NEED_STRLCPY + #define NEED_STRLCAT + +#elif defined(Solaris) + + #include <alloca.h> + #include <crypt.h> + #include <sys/param.h> + #include <sys/ioctl.h> + #include <limits.h> + #include <strings.h> /* for strcasecmp() */ + + #define NEED_FLOCK + #define NEED_UNSETENV + #define NEED_SCANDIR + #define NEED_STRCASESTR + + #if __OS_MAJOR_VERSION__ == 5 && __OS_MINOR_VERSION__ < 8 + #define NEED_STRLCPY + #define NEED_STRLCAT + #define NEED_INET_PTON + #endif + + #if __OS_MAJOR_VERSION__ == 5 && __OS_MAJOR_VERSION__ < 6 + #define NEED_BSD_SIGNAL + #endif + +#else + + #warning "Unknown OSTYPE" + +#endif + + +#ifdef Solaris + #define Signal (bsd_signal) +#else + #define Signal (signal) +#endif + + +#endif diff --git a/include/proto.h b/include/proto.h index f86e0a24..6c42c241 100644 --- a/include/proto.h +++ b/include/proto.h @@ -375,11 +375,41 @@ int completeutmp_compar(int where, char *str, int len); int completeutmp_permission(int where); char *completeutmp_getname(int where); + /* osdep */ int cpuload(char *str); double swapused(int *total, int *used); -#ifdef __linux__ -char *strcasestr(const char *big, const char *little); + +#ifdef NEED_FLOCK + #define LOCK_EX 1 + #define LOCK_UN 2 + + int flock(int, int); +#endif + +#ifdef NEED_UNSETENV + void unsetenv(char *name); +#endif + +#ifdef NEED_STRCASESTR + char *strcasestr(const char *big, const char *little); +#endif + +#ifdef NEED_STRLCPY + size_t strlcpy(char *dst, const char *src, size_t size); +#endif + +#ifdef NEED_STRLCAT + size_t strlcat(char *dst, const char *src, size_t size); +#endif + +#ifdef NEED_SCANDIR + int scandir(const char *dirname, struct dirent ***namelist, int (*select)(struct dirent *), int (*compar)(const void *, const void *)); + int alphasort(const void *d1, const void *d2); +#endif + +#ifdef NEED_INET_PTON + int inet_pton(int af, const char *src, void *dst); #endif /* othello */ diff --git a/innbbsd/Makefile b/innbbsd/Makefile index 9bb71f52..9399d32d 100644 --- a/innbbsd/Makefile +++ b/innbbsd/Makefile @@ -7,7 +7,8 @@ # ------------------------------------------------------- # # stdarg.h patch for pttbbs by in2 03/05/05 # -OSTYPE!=uname +OS!=uname +OSTYPE?=$(OS) #################################################### # this is a bbs <--> news gateway ##################################################### @@ -30,6 +31,7 @@ BBS_REC = $(BBS_UTIL)/util_record.o $(BBS_UTIL)/util_cache.o \ $(BBS_UTIL)/util_var.o $(BBS_REC_EXTRA_$(OSTYPE)) BBS_REC_EXTRA_Linux = $(BBS_UTIL)/util_osdep.o +BBS_REC_EXTRA_Solaris = $(BBS_UTIL)/util_osdep.o ######################### # @@ -92,8 +94,10 @@ hpux: irix: @$(MAKE) EXTRAFLAGS="-DMMAP -DIRIX -DSYSV" target +Solaris: solaris + solaris: - @$(MAKE) EXTRAFLAGS="-DMMAP -DSOLARIS -DSYSV" LDFLAGS="-lsocket -lnsl" YACC="bison -y" target + @$(MAKE) EXTRAFLAGS="-DMMAP -DSOLARIS -DSYSV -I/usr/local/include/ -I../include/" LDFLAGS="-L/usr/local/lib -liconv -lsocket -lnsl -lkstat ../mbbsd/osdep.o" YACC="bison -y" target FreeBSD: @$(MAKE) CC=cc EXTRAFLAGS="-DBSD44 -DMMAP -DGETRUSAGE" LDFLAGS="-lcrypt -liconv" target diff --git a/innbbsd/bbsnnrp.c b/innbbsd/bbsnnrp.c index fadafe72..544e3336 100644 --- a/innbbsd/bbsnnrp.c +++ b/innbbsd/bbsnnrp.c @@ -18,6 +18,7 @@ #include "bbslib.h" #include "daemon.h" #include "nntp.h" +#include "osdep.h" #ifndef MAX_ARTS #define MAX_ARTS 100 @@ -288,10 +289,10 @@ main(argc, argv) sprintf(BBSNNRP.rcfile, "%s/.newsrc.%s.%s", INNDHOME, server, ptr); initrcfiles(&BBSNNRP); - signal(SIGTERM, doterm); - signal(SIGKILL, doterm); - signal(SIGHUP, doterm); - signal(SIGPIPE, doterm); + Signal(SIGTERM, doterm); + Signal(SIGKILL, doterm); + Signal(SIGHUP, doterm); + Signal(SIGPIPE, doterm); readnews(server, &BBSNNRP); writerc(&BBSNNRP); @@ -310,10 +311,10 @@ main(argc, argv) exit(1); } initsockets(server, &BBSNNRP, inputtype); - signal(SIGTERM, doterm); - signal(SIGKILL, doterm); - signal(SIGHUP, doterm); - signal(SIGPIPE, doterm); + Signal(SIGTERM, doterm); + Signal(SIGKILL, doterm); + Signal(SIGHUP, doterm); + Signal(SIGPIPE, doterm); stdinreadnews(&BBSNNRP); closesockets(); diff --git a/innbbsd/connectsock.c b/innbbsd/connectsock.c index 1c401dbc..f61ff160 100644 --- a/innbbsd/connectsock.c +++ b/innbbsd/connectsock.c @@ -2,6 +2,7 @@ #include "daemon.h" #include <signal.h> #include <setjmp.h> +#include "osdep.h" static jmp_buf timebuf; @@ -112,12 +113,12 @@ initunixserver(path, protocol) return -1; } /* standalonesetup(s); */ - signal(SIGHUP, SIG_IGN); - signal(SIGUSR1, SIG_IGN); - signal(SIGCHLD, reapchild); + Signal(SIGHUP, SIG_IGN); + Signal(SIGUSR1, SIG_IGN); + Signal(SIGCHLD, reapchild); UNIX_SERVER_PATH = path; - signal(SIGINT, doremove); - signal(SIGTERM, doremove); + Signal(SIGINT, doremove); + Signal(SIGTERM, doremove); chdir("/"); if (bind(s, (struct sockaddr *) & s_un, sizeof(struct sockaddr_un)) < 0) { @@ -176,11 +177,11 @@ initinetserver(service, protocol) return -1; } standalonesetup(s); - signal(SIGHUP, SIG_IGN); - signal(SIGUSR1, SIG_IGN); - signal(SIGCHLD, reapchild); - signal(SIGINT, dokill); - signal(SIGTERM, dokill); + Signal(SIGHUP, SIG_IGN); + Signal(SIGUSR1, SIG_IGN); + Signal(SIGCHLD, reapchild); + Signal(SIGINT, dokill); + Signal(SIGTERM, dokill); chdir("/"); if (bind(s, (struct sockaddr *) & sin, sizeof(struct sockaddr_in)) < 0) { @@ -404,7 +405,7 @@ inetclient(server, service, protocol) return -1; } if (setjmp(timebuf) == 0) { - signal(SIGALRM, timeout); + Signal(SIGALRM, timeout); alarm(5); if (connect(s, (struct sockaddr *) & sin, sizeof(sin)) < 0) { alarm(0); diff --git a/innbbsd/rfc931.c b/innbbsd/rfc931.c index d8428119..187f7929 100644 --- a/innbbsd/rfc931.c +++ b/innbbsd/rfc931.c @@ -23,6 +23,7 @@ static char sccsid[] = "@(#) rfc931.c 1.4 93/03/07 22:47:52"; #include <netinet/in.h> #include <setjmp.h> #include <signal.h> +#include "osdep.h" /* #include "log_tcp.h" */ @@ -90,7 +91,7 @@ my_rfc931_name(herefd, there) } /* Set up timer so we won't get stuck. */ - signal(SIGALRM, timeout); + Signal(SIGALRM, timeout); if (setjmp(timebuf)) { close(s); /* not: fclose(fp) */ return (result); diff --git a/mbbsd/admin.c b/mbbsd/admin.c index f115bf46..de40efe1 100644 --- a/mbbsd/admin.c +++ b/mbbsd/admin.c @@ -1012,7 +1012,7 @@ auto_scan(char fdata[][STRLEN], char ans[]) } } for (i = 0; fdata[5][i]; i++) { - if (isdigit(fdata[5][i])) + if (isdigit((int)fdata[5][i])) count++; } @@ -1196,7 +1196,7 @@ scan_register_form(char *regfile, int automode, int neednum) fp = fopen(buf1, "w"); for(i = 0; buf[i] && i < sizeof(buf); i++){ - if (!isdigit(buf[i])) + if (!isdigit((int)buf[i])) continue; fprintf(fp, "[退回原因] 請%s\n", reason[buf[i] - '0']); diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index 26080e1d..94a4b7f7 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -798,7 +798,7 @@ invalid_brdname(char *brd) register char ch, rv=0; ch = *brd++; - if (!isalpha(ch)) + if (!isalpha((int)ch)) rv = 2; while ((ch = *brd++)) { if (not_alnum(ch) && ch != '_' && ch != '-' && ch != '.') @@ -1802,7 +1802,7 @@ view_postmoney(int ent, fileheader_t * fhdr, char *direct) /* When the file is anonymous posted, fhdr->money is author. * see do_general() */ vmsg("匿名管理編號: %d (同一人號碼會一樣)", - fhdr->money + currutmp->pid); + fhdr->money + (int)currutmp->pid); else vmsg("這一篇文章值 %d 銀", fhdr->money); return FULLUPDATE; diff --git a/mbbsd/brc.c b/mbbsd/brc.c index 7e61e578..45b001a4 100644 --- a/mbbsd/brc.c +++ b/mbbsd/brc.c @@ -96,8 +96,9 @@ time_t * brc_find_record(int bid, int *num) { char *p; - *num = 0; - p = brc_findrecord_in(brc_buf, brc_buf + brc_size, bid, (brcnbrd_t*)num); + brcnbrd_t tnum; + p = brc_findrecord_in(brc_buf, brc_buf + brc_size, bid, &tnum); + *num = tnum; if (p) return (time_t*)(p + sizeof(brcbid_t) + sizeof(brcnbrd_t)); *num = 0; @@ -187,7 +188,7 @@ brc_insert_record(brcbid_t bid, brcnbrd_t num, time_t* list) num--; /* don't write the times before brc_expire_time */ if (!ptr) { - brc_size -= tnum; + brc_size -= (int)tnum; /* put on the beginning */ if (num){ @@ -333,8 +334,9 @@ brc_initialize(){ int brc_read_record(int bid, int *num, time_t *list){ char *ptr; - *num = 0; - ptr = brc_findrecord_in(brc_buf, brc_buf + brc_size, bid, (brcnbrd_t*)num); + brcnbrd_t tnum; + ptr = brc_findrecord_in(brc_buf, brc_buf + brc_size, bid, &tnum); + *num = tnum; if ( ptr ){ memcpy(list, ptr + sizeof(brcbid_t) + sizeof(brcnbrd_t), *num * sizeof(time_t)); diff --git a/mbbsd/cache.c b/mbbsd/cache.c index 4756b359..d826199f 100644 --- a/mbbsd/cache.c +++ b/mbbsd/cache.c @@ -741,7 +741,7 @@ void buildBMcache(int bid) /* bid starts from 1 */ strncpy(s, bcache[bid].BM, sizeof(s)); for( i = 0 ; s[i] != 0 ; ++i ) - if( !isalpha(s[i]) && !isdigit(s[i]) ) + if( !isalpha((int)s[i]) && !isdigit((int)s[i]) ) s[i] = ' '; for( ptr = strtok(s, " "), i = 0 ; diff --git a/mbbsd/chat.c b/mbbsd/chat.c index b911b47c..caf3f1b8 100644 --- a/mbbsd/chat.c +++ b/mbbsd/chat.c @@ -268,7 +268,7 @@ const static chat_command_t chat_cmdtbl[] = { static int chat_cmd_match(char *buf, char *str) { - while (*str && *buf && !isspace(*buf)) + while (*str && *buf && !isspace((int)*buf)) if (tolower(*buf++) != *str++) return 0; return 1; diff --git a/mbbsd/chc.c b/mbbsd/chc.c index 759c9749..a0154e6c 100644 --- a/mbbsd/chc.c +++ b/mbbsd/chc.c @@ -306,7 +306,7 @@ chc_log_step(board_t board, rc_t *from, rc_t *to) } static int -#ifdef __linux__ +#if defined(__linux__) chc_filter(const struct dirent *dir) #else chc_filter(struct dirent *dir) @@ -902,7 +902,7 @@ chc_init(int s, chcusr_t *user1, chcusr_t *user2, board_t board, play_func_t pla chc_redraw(user1, user2, board); add_io(s, 0); - signal(SIGUSR1, chc_watch_request); + Signal(SIGUSR1, chc_watch_request); if (my->turn && !(chc_mode & CHC_WATCH)) chc_broadcast_recv(act_list, board); @@ -932,7 +932,7 @@ chc(int s, int mode) char mode0 = currutmp->mode; char file[80]; - signal(SIGUSR1, SIG_IGN); + Signal(SIGUSR1, SIG_IGN); chc_mode = mode; chc_bp = &board; @@ -969,7 +969,7 @@ chc(int s, int mode) } else chc_log_close(); - signal(SIGUSR1, talk_request); + Signal(SIGUSR1, talk_request); } static userinfo_t * @@ -1036,7 +1036,11 @@ chc_watch(void) vmsg("無法建立連線"); return -1; } +#if defined(Solaris) && __OS_MAJOR_VERSION__ == 5 && __OS_MINOR_VERSION__ < 7 + msgsock = accept(sock, (struct sockaddr *) 0, 0); +#else msgsock = accept(sock, (struct sockaddr *) 0, (socklen_t *) 0); +#endif close(sock); if (msgsock < 0) return -1; diff --git a/mbbsd/edit.c b/mbbsd/edit.c index aa08e7c7..088c7717 100644 --- a/mbbsd/edit.c +++ b/mbbsd/edit.c @@ -132,7 +132,7 @@ ansi2n(int ansix, textline_t * line) while (*tmp) { if (*tmp == KEY_ESC) { - while ((ch = *tmp) && !isalpha(ch)) + while ((ch = *tmp) && !isalpha((int)ch)) tmp++; if (ch) tmp++; @@ -158,7 +158,7 @@ n2ansi(int nx, textline_t * line) while (*tmp) { if (*tmp == KEY_ESC) { - while ((ch = *tmp) && !isalpha(ch)) + while ((ch = *tmp) && !isalpha((int)ch)) tmp++; if (ch) tmp++; @@ -992,7 +992,7 @@ addsignature(FILE * fp, int ifuseanony) if (!buf[0]) buf[0] = ch; - if (isdigit(buf[0])) + if (isdigit((int)buf[0])) ch = buf[0]; else ch = '1' + rand() % num; @@ -2012,7 +2012,7 @@ vedit(char *fpath, int saveheader, int *islocal) int fg, bg; strcpy(color, "\033["); - if (isdigit(*apos)) { + if (isdigit((int)*apos)) { sprintf(color,"%s%c", color, *(apos++)); if (*apos) strcat(color, ";"); @@ -2133,25 +2133,25 @@ vedit(char *fpath, int saveheader, int *islocal) break; case 'f': while (currpnt < currline->len && - isalnum(currline->data[++currpnt])); + isalnum((int)currline->data[++currpnt])); while (currpnt < currline->len && - isspace(currline->data[++currpnt])); + isspace((int)currline->data[++currpnt])); line_dirty = 1; break; case 'b': - while (currpnt && isalnum(currline->data[--currpnt])); - while (currpnt && isspace(currline->data[--currpnt])); + while (currpnt && isalnum((int)currline->data[--currpnt])); + while (currpnt && isspace((int)currline->data[--currpnt])); line_dirty = 1; break; case 'd': while (currpnt < currline->len) { delete_char(); - if (!isalnum(currline->data[currpnt])) + if (!isalnum((int)currline->data[currpnt])) break; } while (currpnt < currline->len) { delete_char(); - if (!isspace(currline->data[currpnt])) + if (!isspace((int)currline->data[currpnt])) break; } line_dirty = 1; @@ -636,7 +636,7 @@ oldgetdata(int line, int col, char *prompt, char *buf, int len, int echo) outc('\n'); refresh(); } - if ((echo == LCECHO) && isupper(buf[0])) + if ((echo == LCECHO) && isupper((int)buf[0])) buf[0] = tolower(buf[0]); return clen; } diff --git a/mbbsd/mail.c b/mbbsd/mail.c index 767bf5e2..94f936cd 100644 --- a/mbbsd/mail.c +++ b/mbbsd/mail.c @@ -1587,15 +1587,15 @@ doforward(char *direct, fileheader_t * fh, int mode) } else if (mode == 'U') { char tmp_buf[128]; - snprintf(fname, sizeof(fname), "/tmp/bbs.uu%05d", currpid); + snprintf(fname, sizeof(fname), "/tmp/bbs.uu%05d", (int)currpid); snprintf(tmp_buf, sizeof(tmp_buf), "/usr/bin/uuencode %s/%s uu.%05d > %s", - direct, fh->filename, currpid, fname); + direct, fh->filename, (int)currpid, fname); system(tmp_buf); } else if (mode == 'F') { char tmp_buf[128]; - snprintf(fname, sizeof(fname), "/tmp/bbs.f%05d", currpid); + snprintf(fname, sizeof(fname), "/tmp/bbs.f%05d", (int)currpid); snprintf(tmp_buf, sizeof(tmp_buf), "cp %s/%s %s", direct, fh->filename, fname); system(tmp_buf); diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index eb935696..eb6ae50f 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -1007,17 +1007,17 @@ start_client() login_start_time = time(0); currmode = 0; - signal(SIGHUP, abort_bbs); - signal(SIGTERM, abort_bbs); - signal(SIGPIPE, abort_bbs); - - signal(SIGINT, abort_bbs_debug); - signal(SIGQUIT, abort_bbs_debug); - signal(SIGILL, abort_bbs_debug); - signal(SIGABRT, abort_bbs_debug); - signal(SIGFPE, abort_bbs_debug); - signal(SIGBUS, abort_bbs_debug); - signal(SIGSEGV, abort_bbs_debug); + Signal(SIGHUP, abort_bbs); + Signal(SIGTERM, abort_bbs); + Signal(SIGPIPE, abort_bbs); + + Signal(SIGINT, abort_bbs_debug); + Signal(SIGQUIT, abort_bbs_debug); + Signal(SIGILL, abort_bbs_debug); + Signal(SIGABRT, abort_bbs_debug); + Signal(SIGFPE, abort_bbs_debug); + Signal(SIGBUS, abort_bbs_debug); + Signal(SIGSEGV, abort_bbs_debug); signal_restart(SIGUSR1, talk_request); signal_restart(SIGUSR2, write_request); @@ -1029,7 +1029,7 @@ start_client() exit(1); do_term_init(); - signal(SIGALRM, abort_bbs); + Signal(SIGALRM, abort_bbs); alarm(600); login_query(); /* Ptt 加上login time out */ @@ -1042,7 +1042,7 @@ start_client() b_closepolls(); SHM->close_vote_time = now; } - signal(SIGALRM, SIG_IGN); + Signal(SIGALRM, SIG_IGN); domenu(MMENU, "主功\能表", (currutmp->mailalert ? 'M' : 'C'), cmdlist); } @@ -1122,7 +1122,7 @@ getremotename(struct sockaddr_in * from, char *rhost, char *rname) hp = NULL; if (setjmp(byebye) == 0) { - signal(SIGALRM, timeout); + Signal(SIGALRM, timeout); alarm(3); hp = gethostbyaddr((char *)&from->sin_addr, sizeof(struct in_addr), from->sin_family); @@ -1153,7 +1153,7 @@ getremotename(struct sockaddr_in * from, char *rhost, char *rname) } /* Set up a timer so we won't get stuck while waiting for the server. */ if (setjmp(byebye) == 0) { - signal(SIGALRM, timeout); + Signal(SIGALRM, timeout); alarm(RFC931_TIMEOUT); /* @@ -1251,11 +1251,11 @@ main(int argc, char *argv[], char *envp[]) start_time = time(NULL); /* avoid SIGPIPE */ - signal(SIGPIPE, SIG_IGN); + Signal(SIGPIPE, SIG_IGN); /* avoid erroneous signal from other mbbsd */ - signal(SIGUSR1, SIG_IGN); - signal(SIGUSR2, SIG_IGN); + Signal(SIGUSR1, SIG_IGN); + Signal(SIGUSR2, SIG_IGN); attach_SHM(); if( (argc == 3 && shell_login(argc, argv, envp)) || @@ -1362,17 +1362,22 @@ daemon_login(int argc, char *argv[], char *envp[]) #endif #endif - snprintf(buf, sizeof(buf), "run/mbbsd.%d.%d.pid", listen_port, getpid()); + snprintf(buf, sizeof(buf), "run/mbbsd.%d.%d.pid", listen_port, (int)getpid()); if ((fp = fopen(buf, "w"))) { - fprintf(fp, "%d\n", getpid()); + fprintf(fp, "%d\n", (int)getpid()); fclose(fp); } /* main loop */ while( 1 ){ len_of_sock_addr = sizeof(xsin); +#if defined(Solaris) && __OS_MAJOR_VERSION__ == 5 && __OS_MINOR_VERSION__ < 7 + if( (csock = accept(msock, (struct sockaddr *)&xsin, + &len_of_sock_addr)) < 0 ){ +#else if( (csock = accept(msock, (struct sockaddr *)&xsin, (socklen_t *)&len_of_sock_addr)) < 0 ){ +#endif if (errno != EINTR) sleep(1); continue; diff --git a/mbbsd/name.c b/mbbsd/name.c index 6ee8849f..db96eb08 100644 --- a/mbbsd/name.c +++ b/mbbsd/name.c @@ -449,7 +449,7 @@ usercomplete(char *prompt, char *data) outc(' '); move(y, x); continue; - } else if (count < STRLEN && isprint(ch)) { + } else if (count < STRLEN && isprint((int)ch)) { int n; *temp++ = ch; diff --git a/mbbsd/osdep.c b/mbbsd/osdep.c index 7b3fac06..b04a396a 100644 --- a/mbbsd/osdep.c +++ b/mbbsd/osdep.c @@ -1,7 +1,8 @@ /* $Id$ */ #include "bbs.h" -#ifdef __linux__ +#ifdef NEED_STRLCAT + #include <sys/types.h> #include <string.h> @@ -44,35 +45,39 @@ */ size_t strlcat(dst, src, siz) - char *dst; - const char *src; - size_t siz; + char *dst; + const char *src; + size_t siz; { - char *d = dst; - const char *s = src; - size_t n = siz; - size_t dlen; - - /* Find the end of dst and adjust bytes left but don't go past end */ - while (n-- != 0 && *d != '\0') - d++; - dlen = d - dst; - n = siz - dlen; - - if (n == 0) - return(dlen + strlen(s)); - while (*s != '\0') { - if (n != 1) { - *d++ = *s; - n--; - } - s++; + char *d = dst; + const char *s = src; + size_t n = siz; + size_t dlen; + + /* Find the end of dst and adjust bytes left but don't go past end */ + while (n-- != 0 && *d != '\0') + d++; + dlen = d - dst; + n = siz - dlen; + + if (n == 0) + return(dlen + strlen(s)); + while (*s != '\0') { + if (n != 1) { + *d++ = *s; + n--; } - *d = '\0'; + s++; + } + *d = '\0'; - return(dlen + (s - src)); /* count does not include NUL */ + return(dlen + (s - src)); /* count does not include NUL */ } +#endif + +#ifdef NEED_STRLCPY + /* ------------------------------------------------------------------------ */ /* size_t @@ -112,33 +117,37 @@ strlcat(dst, src, siz) * Returns strlen(src); if retval >= siz, truncation occurred. */ size_t strlcpy(dst, src, siz) - char *dst; - const char *src; - size_t siz; + char *dst; + const char *src; + size_t siz; { - char *d = dst; - const char *s = src; - size_t n = siz; - - /* Copy as many bytes as will fit */ - if (n != 0 && --n != 0) { - do { - if ((*d++ = *s++) == 0) - break; - } while (--n != 0); - } + char *d = dst; + const char *s = src; + size_t n = siz; - /* Not enough room in dst, add NUL and traverse rest of src */ - if (n == 0) { - if (siz != 0) - *d = '\0'; /* NUL-terminate dst */ - while (*s++) - ; - } + /* Copy as many bytes as will fit */ + if (n != 0 && --n != 0) { + do { + if ((*d++ = *s++) == 0) + break; + } while (--n != 0); + } - return(s - src - 1); /* count does not include NUL */ + /* Not enough room in dst, add NUL and traverse rest of src */ + if (n == 0) { + if (siz != 0) + *d = '\0'; /* NUL-terminate dst */ + while (*s++) + ; + } + + return(s - src - 1); /* count does not include NUL */ } +#endif + +#ifdef NEED_STRCASESTR + char * strcasestr(const char *big, const char *little) { @@ -156,24 +165,299 @@ strcasestr(const char *big, const char *little) #endif -#if __FreeBSD__ +#ifdef NEED_SCANDIR + +/* + * Scan the directory dirname calling select to make a list of selected + * directory entries then sort using qsort and compare routine dcomp. + * Returns the number of entries and a pointer to a list of pointers to + * struct dirent (through namelist). Returns -1 if there were any errors. + */ + +<<<<<<< .working +======= +#include <sys/types.h> +#include <sys/stat.h> +#include <dirent.h> +#include <stdlib.h> +#include <string.h> -#include <kvm.h> +/* + * The DIRSIZ macro is the minimum record length which will hold the directory + * entry. This requires the amount of space in struct dirent without the + * d_name field, plus enough space for the name and a terminating nul byte + * (dp->d_namlen + 1), rounded up to a 4 byte boundary. + */ +#undef DIRSIZ +#define DIRSIZ(dp) \ + ((sizeof(struct dirent) - sizeof(dp)->d_name) + \ + ((strlen((dp)->d_name) + 1 + 3) &~ 3)) +#if 0 +((sizeof(struct dirent) - sizeof(dp)->d_name) + \ + (((dp)->d_namlen + 1 + 3) &~ 3)) +#endif int -cpuload(char *str) +scandir(dirname, namelist, select, dcomp) + const char *dirname; + struct dirent ***namelist; + int (*select) (struct dirent *); + int (*dcomp) (const void *, const void *); { - double l[3] = {-1, -1, -1}; - if (getloadavg(l, 3) != 3) - l[0] = -1; + register struct dirent *d, *p, **names; + register size_t nitems; + struct stat stb; + long arraysz; + DIR *dirp; - if (str) { - if (l[0] != -1) - sprintf(str, " %.2f %.2f %.2f", l[0], l[1], l[2]); - else - strcpy(str, " (unknown) "); + if ((dirp = opendir(dirname)) == NULL) + return(-1); + if (fstat(dirp->dd_fd, &stb) < 0) + return(-1); + + /* + * estimate the array size by taking the size of thedirectory file + * and dividing it by a multiple of the minimum sizeentry. + */ + arraysz = (stb.st_size / 24); + names = (struct dirent **)malloc(arraysz * sizeof(struct dirent *)); + if (names == NULL) + return(-1); + + nitems = 0; + while ((d = readdir(dirp)) != NULL) { + if (select != NULL && !(*select)(d)) + continue; /* just selected names */ + /* + * Make a minimum size copy of the data + */ + p = (struct dirent *)malloc(DIRSIZ(d)); + if (p == NULL) + return(-1); + p->d_ino = d->d_ino; + p->d_off = d->d_off; + p->d_reclen = d->d_reclen; + memcpy(p->d_name, d->d_name, strlen(d->d_name) +1); +#if 0 + p->d_fileno = d->d_fileno; + p->d_type = d->d_type; + p->d_reclen = d->d_reclen; + p->d_namlen = d->d_namlen; + bcopy(d->d_name, p->d_name, p->d_namlen + 1); +#endif + /* + * Check to make sure the array has space left and + * realloc the maximum size. + */ + if (++nitems >= arraysz) { + if (fstat(dirp->dd_fd, &stb) < 0) + return(-1); /* just might have grown */ + arraysz = stb.st_size / 12; + names = (struct dirent **)realloc((char*)names, + arraysz * sizeof(struct dirent*)); + if (names == NULL) + return(-1); + } + names[nitems-1] = p; } - return (int)l[0]; + closedir(dirp); + if (nitems && dcomp != NULL) + qsort(names, nitems, sizeof(struct dirent *),dcomp); + *namelist = names; + return(nitems); +} + +/* + * Alphabetic order comparison routine for those who want it. + */ +int +alphasort(d1, d2) + const void *d1; + const void *d2; +{ + return(strcmp((*(struct dirent **)d1)->d_name, + (*(struct dirent **)d2)->d_name)); +} + +#endif + +#ifdef NEED_FLOCK + +int +flock (int fd, int f) +{ + if( f == LOCK_EX ) + return lockf(fd, F_LOCK, 0L); + + if( f == LOCK_UN ) + return lockf(fd, F_ULOCK, 0L); + + return -1; +} + +#endif + +#ifdef NEED_UNSETENV + +void +unsetenv(name) + char *name; +{ + extern char **environ; + register char **pp; + int len = strlen(name); + + for (pp = environ; *pp != NULL; pp++) + { + if (strncmp(name, *pp, len) == 0 && + ((*pp)[len] == '=' || (*pp)[len] == '\0')) + break; + } + + for (; *pp != NULL; pp++) + *pp = pp[1]; +} + +#endif + +#ifdef NEED_INET_PTON + +#include <arpa/nameser.h> + +/* + * Copyright (c) 1996 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +int +inet_pton(int af, const char *src, void *dst) +{ + static const char digits[] = "0123456789"; + int saw_digit, octets, ch; + u_char tmp[INADDRSZ], *tp; + + saw_digit = 0; + octets = 0; + *(tp = tmp) = 0; + while ((ch = *src++) != '\0') { + const char *pch; + + if ((pch = strchr(digits, ch)) != NULL) { + u_int new = *tp * 10 + (pch - digits); + + if (new > 255) + return (0); + *tp = new; + if (! saw_digit) { + if (++octets > 4) + return (0); + saw_digit = 1; + } + } else if (ch == '.' && saw_digit) { + if (octets == 4) + return (0); + *++tp = 0; + saw_digit = 0; + } else + return (0); + } + if (octets < 4) + return (0); + + memcpy(dst, tmp, INADDRSZ); + + return (1); +} +#endif + +#ifdef NEED_BSD_SIGNAL + +void (*bsd_signal(int sig, void (*func)(int)))(int) +{ + struct sigaction act, oact; + + act.sa_handler = func; + act.sa_flags = SA_RESTART; + sigemptyset(&act.sa_mask); + sigaddset(&act.sa_mask, sig); + if (sigaction(sig, &act, &oact) == -1) + return(SIG_ERR); + return(oact.sa_handler); +} + + +#endif + + +#ifdef Solaris + +#include <sys/stat.h> +#include <sys/swap.h> + + +double swapused(int *total, int *used) +{ + double percent = -1; + register int cnt, i; + register int free; + struct swaptable *swt; + struct swapent *ste; + static char path[256]; + cnt = swapctl(SC_GETNSWP, 0); + swt = (struct swaptable *)malloc(sizeof(int) + + cnt * sizeof(struct swapent)); + if (swt == NULL) + { + return 0; + } + swt->swt_n = cnt; + + /* fill in ste_path pointers: we don't care about the paths, so we point + them all to the same buffer */ + ste = &(swt->swt_ent[0]); + i = cnt; + while (--i >= 0) + { + ste++->ste_path = path; + } + /* grab all swap info */ + swapctl(SC_LIST, swt); + + /* walk thru the structs and sum up the fields */ + *total = free = 0; + ste = &(swt->swt_ent[0]); + i = cnt; + while (--i >= 0) + { + /* dont count slots being deleted */ + if (!(ste->ste_flags & ST_INDEL) && + !(ste->ste_flags & ST_DOINGDEL)) + { + *total += ste->ste_pages; + free += ste->ste_free; + } + ste++; + } + + *used = *total - free; + if( total != 0) + percent = (double)*used / (double)*total; + else + percent = 0; + + return percent; } double @@ -198,7 +482,90 @@ swapused(int *total, int *used) return percent; } -#else +#endif + +#if __FreeBSD__ + +int +cpuload(char *str) +{ + double l[3] = {-1, -1, -1}; + if (getloadavg(l, 3) != 3) + l[0] = -1; + + if (str) { + if (l[0] != -1) + sprintf(str, " %.2f %.2f %.2f", l[0], l[1], l[2]); + else + strcpy(str, " (unknown) "); + } + return (int)l[0]; +} +#endif + + +#ifdef Solaris + +#include <kstat.h> +#include <sys/param.h> + +#define loaddouble(la) ((double)(la) / FSCALE) + +int +cpuload(char *str) +{ + kstat_ctl_t *kc; + kstat_t *ks; + kstat_named_t *kn; + double l[3] = {-1, -1, -1}; + + kc = kstat_open(); + + if( !kc ){ + strcpy(str, "(unknown) "); + return -1; + } + + ks = kstat_lookup( kc, "unix", 0, "system_misc"); + + if( kstat_read( kc, ks, 0) == -1){ + strcpy( str, "( unknown "); + return -1; + } + + kn = kstat_data_lookup( ks, "avenrun_1min" ); + + if( kn ) { + l[0] = loaddouble(kn->value.ui32); + } + + kn = kstat_data_lookup( ks, "avenrun_5min" ); + + if( kn ) { + l[1] = loaddouble(kn->value.ui32); + } + + kn = kstat_data_lookup( ks, "avenrun_15min" ); + + if( kn ) { + l[2] = loaddouble(kn->value.ui32); + } + + if (str) { + + if (l[0] != -1) + sprintf(str, " %.2f %.2f %.2f", l[0], l[1], l[2]); + else + strcpy(str, " (unknown) "); + } + + kstat_close(kc); + return (int)l[0]; +} + +#endif + +#ifdef __linux__ int cpuload(char *str) { diff --git a/mbbsd/talk.c b/mbbsd/talk.c index eb51d4f4..5d69f85e 100644 --- a/mbbsd/talk.c +++ b/mbbsd/talk.c @@ -1259,7 +1259,11 @@ int make_connection_to_somebody(userinfo_t *uin, int timeout){ return -1; } length = sizeof(server); +#if defined(Solaris) && __OS_MAJOR_VERSION__ == 5 && __OS_MINOR_VERSION__ < 7 + if (getsockname(sock, (struct sockaddr *) & server, & length) < 0) { +#else if (getsockname(sock, (struct sockaddr *) & server, (socklen_t *) & length) < 0) { +#endif close(sock); perror("sock name err"); unlockutmpmode(); @@ -1426,7 +1430,11 @@ my_talk(userinfo_t * uin, int fri_stat, char defact) sock = make_connection_to_somebody(uin, 5); +#if defined(Solaris) && __OS_MAJOR_VERSION__ == 5 && __OS_MINOR_VERSION__ < 7 + msgsock = accept(sock, (struct sockaddr *) 0, 0); +#else msgsock = accept(sock, (struct sockaddr *) 0, (socklen_t *) 0); +#endif if (msgsock == -1) { perror("accept"); unlockutmpmode(); diff --git a/mbbsd/term.c b/mbbsd/term.c index 555840d1..9d766fe4 100644 --- a/mbbsd/term.c +++ b/mbbsd/term.c @@ -58,7 +58,7 @@ term_resize(int sig) struct winsize newsize; screenline_t *new_picture; - signal(SIGWINCH, SIG_IGN); /* Don't bother me! */ + Signal(SIGWINCH, SIG_IGN); /* Don't bother me! */ ioctl(0, TIOCGWINSZ, &newsize); /* make sure reasonable size */ @@ -82,13 +82,13 @@ term_resize(int sig) b_lines = t_lines - 1; p_lines = t_lines - 4; - signal(SIGWINCH, term_resize); + Signal(SIGWINCH, term_resize); } int term_init() { - signal(SIGWINCH, term_resize); + Signal(SIGWINCH, term_resize); return YEA; } diff --git a/mbbsd/topsong.c b/mbbsd/topsong.c index 073f0138..07931aa0 100644 --- a/mbbsd/topsong.c +++ b/mbbsd/topsong.c @@ -55,7 +55,7 @@ sortsong() while (fgets(buf, 200, fp)) { strtok(buf, "\n\r"); strip_blank(cbuf, buf); - if (!cbuf[0] || !isprint2(cbuf[0])) + if (!cbuf[0] || !isprint2((int)cbuf[0])) continue; for (n = 0; n < MAX_SONGS && songs[n].name[0]; n++) diff --git a/mbbsd/user.c b/mbbsd/user.c index 5ce60d71..eb93217e 100644 --- a/mbbsd/user.c +++ b/mbbsd/user.c @@ -911,7 +911,7 @@ ispersonalid(char *inid) strlcpy(id, inid, sizeof(id)); i = cksum = 0; - if (!isalpha(id[0]) && (strlen(id) != 10)) + if (!isalpha((int)id[0]) && (strlen(id) != 10)) return 0; if (!(id[1] == '1' || id[1] == '2')) return 0; @@ -927,12 +927,12 @@ ispersonalid(char *inid) i++; i += 10; id[0] = i % 10 + '0'; - if (!isdigit(id[9])) + if (!isdigit((int)id[9])) return 0; cksum += (id[9] - '0') + (i / 10); for (j = 0; j < 9; ++j) { - if (!isdigit(id[j])) + if (!isdigit((int)id[j])) return 0; cksum += (id[j] - '0') * (9 - j); } @@ -1196,7 +1196,7 @@ static char *isvalidphone(char *phone) { int i; for( i = 0 ; phone[i] != 0 ; ++i ) - if( !isdigit(phone[i]) ) + if( !isdigit((int)phone[i]) ) return "請不要加分隔符號"; if (!removespace(phone) || strlen(phone) < 9 || @@ -2,8 +2,13 @@ # 定義基本初值 BBSHOME?= $(HOME) BBSHOME?= /home/bbs -OSTYPE!= uname -CC?= gcc + +OS!= uname +OS_MAJOR_VER!= uname -r|cut -d . -f 1 +OS_MINOR_VER!= uname -r|cut -d . -f 2 +OSTYPE?= $(OS) + +CC= gcc CCACHE!= which ccache|sed -e 's/^.*\///' PTT_CFLAGS= -Wall -pipe -DBBSHOME='"$(BBSHOME)"' -I../include PTT_LDFLAGS= -pipe -Wall -L/usr/local/lib @@ -23,11 +28,20 @@ CFLAGS_Linux= LDFLAGS_Linux= -pipe -Wall LIBS_Linux= +# SunOS特有的環境 +CFLAGS_Solaris= -DSolaris -DHAVE_DES_CRYPT -I/usr/local/include +LDFLAGS_Solaris= -L/usr/local/lib -L/usr/lib/ +LIBS_Solaris= -lnsl -lsocket -liconv -lkstat + +OS_FLAGS= -D__OS_MAJOR_VERSION__=$(OS_MAJOR_VER) \ + -D__OS_MINOR_VERSION__=$(OS_MINOR_VER) + # CFLAGS, LDFLAGS, LIBS 加入 OS 相關參數 -PTT_CFLAGS+= $(CFLAGS_$(OSTYPE)) +PTT_CFLAGS+= $(CFLAGS_$(OSTYPE)) $(OS_FLAGS) PTT_LDFLAGS+= $(LDFLAGS_$(OSTYPE)) PTT_LIBS+= $(LIBS_$(OSTYPE)) + # 若有定義 PROFILING .if defined(PROFILING) PTT_CFLAGS+= -pg diff --git a/util/bbsrf.c b/util/bbsrf.c index c527d761..c3bf44a9 100644 --- a/util/bbsrf.c +++ b/util/bbsrf.c @@ -6,7 +6,6 @@ #include <stdlib.h> #include <sys/param.h> #include <sys/types.h> -#include <utmp.h> #include <pwd.h> #include <syslog.h> #include <fcntl.h> @@ -14,34 +13,56 @@ #include <sys/uio.h> #include "config.h" +#ifdef Solaris + #include <utmpx.h> + #define U_FILE UTMPX_FILE +#else + #include <utmp.h> + #define U_FILE UTMP_FILE +#endif + +#ifdef FreeBSD + #define UTMP_FILE _PATH_UTMP +#endif + +#ifndef Solaris + #if MAXHOSTNAMELEN < UT_HOSTSIZE + #define MAX_HOMENAME_LEN MAXHOSTNAMELEN + #else + #define MAX_HOMENAME_LEN UT_HOSTSIZE + #endif +#else + /* according to /usr/include/utmpx.h ... */ + #define MAX_HOMENAME_LEN 256 +#endif + /* fill the hid with from hostname */ void gethid(char *hid, char *tty) { int fd; char *tp; +#ifdef Solaris + struct utmpx data; +#else struct utmp data; +#endif - gethostname(hid, MAXHOSTNAMELEN); - hid[MAXHOSTNAMELEN] = '\0'; + gethostname(hid, MAX_HOMENAME_LEN); + hid[MAX_HOMENAME_LEN] = '\0'; tp = strrchr(tty, '/') + 1; if (tp && strlen(tp) == 5) { - fd = open(_PATH_UTMP, O_RDONLY); + fd = open(U_FILE, O_RDONLY); if (fd < 0) - syslog(LOG_ERR, "%s: %m", _PATH_UTMP); + syslog(LOG_ERR, "%s: %m", U_FILE); else { while (read(fd, &data, sizeof(data)) == sizeof(data)) if (strcmp(data.ut_line, tp) == 0) { if (data.ut_host[0]) { -#if MAXHOSTNAMELEN < UT_HOSTSIZE - strncpy(hid, data.ut_host, MAXHOSTNAMELEN); - hid[MAXHOSTNAMELEN] = '\0'; -#else - strncpy(hid, data.ut_host, UT_HOSTSIZE); - hid[UT_HOSTSIZE] = '\0'; -#endif + strncpy(hid, data.ut_host, MAX_HOMENAME_LEN); + hid[MAX_HOMENAME_LEN] = '\0'; } break; } @@ -51,30 +72,6 @@ void gethid(char *hid, char *tty) } /* - get system load averages - return 0 if success; otherwise, return -1. - */ -int getload(double load[3]) -{ - int rtv = -1; -#if defined(linux) - FILE *fp; - - fp = fopen(LOAD_FILE, "r"); - if (fp) - { - if (fscanf(fp, "%lf %lf %lf", &load[0], &load[1], &load[2]) == 3) - rtv = 0; - fclose(fp); - } -#elif defined(__FreeBSD__) - if (getloadavg(load, 3) == 3) - rtv = 0; -#endif - return rtv; -} - -/* show ban file if filename exist, print it out, sleep 1 second, and return 0; otherwise, return -1. @@ -100,9 +97,13 @@ int showbanfile(char *filename) int main(void) { int uid, rtv = 0; - char *tty, ttybuf[32], hid[MAXHOSTNAMELEN + 1]; + char *tty, ttybuf[32], hid[MAX_HOMENAME_LEN + 1]; +#ifndef Solaris openlog("bbsrf", LOG_PID | LOG_PERROR, LOG_USER); +#else + openlog("bbsrf", LOG_PID, LOG_USER); +#endif chdir(BBSHOME); uid = getuid(); diff --git a/util/diskstat.c b/util/diskstat.c index 370c1a7b..1b785120 100644 --- a/util/diskstat.c +++ b/util/diskstat.c @@ -305,7 +305,7 @@ main(int argc, char **argv) } #endif - signal(SIGINT, printresult); + Signal(SIGINT, printresult); /* find out how many devices we have */ if ((num_devices = getnumdevs()) < 0) err(1, "can't get number of devices"); @@ -424,7 +424,7 @@ main(int argc, char **argv) * If the user stops the program (control-Z) and then resumes it, * print out the header again. */ - (void)signal(SIGCONT, phdr); + (void)Signal(SIGCONT, phdr); for (headercount = 1;;) { struct devinfo *tmp_dinfo; diff --git a/util/outmail.c b/util/outmail.c index 508d857b..8f01c486 100644 --- a/util/outmail.c +++ b/util/outmail.c @@ -218,7 +218,7 @@ void parseserver(char *sx, char **name, int *port) int main(int argc, char **argv, char **envp) { int ch; - signal(SIGHUP, wakeup); + Signal(SIGHUP, wakeup); initsetproctitle(argc, argv, envp); if(chdir(BBSHOME)) diff --git a/util/xchatd.c b/util/xchatd.c index 862ecf2c..22be9620 100644 --- a/util/xchatd.c +++ b/util/xchatd.c @@ -3135,7 +3135,7 @@ start_daemon() if (fd >= 0) { /* sprintf(buf, "%5d\n", value); */ - sprintf(buf, "%5d\n", getpid()); + sprintf(buf, "%5d\n", (int)getpid()); write(fd, buf, 6); close(fd); } @@ -3148,7 +3148,7 @@ start_daemon() for (fd = 1; fd < NSIG; fd++) { - signal(fd, SIG_IGN); + Signal(fd, SIG_IGN); } #endif @@ -3297,16 +3297,16 @@ main() log_init(); - signal(SIGBUS, SIG_IGN); - signal(SIGSEGV, SIG_IGN); - signal(SIGPIPE, SIG_IGN); - signal(SIGURG, SIG_IGN); + Signal(SIGBUS, SIG_IGN); + Signal(SIGSEGV, SIG_IGN); + Signal(SIGPIPE, SIG_IGN); + Signal(SIGURG, SIG_IGN); - signal(SIGCHLD, reaper); - signal(SIGTERM, abort_server); + Signal(SIGCHLD, reaper); + Signal(SIGTERM, abort_server); #ifdef SERVER_USAGE - signal(SIGPROF, server_usage); + Signal(SIGPROF, server_usage); #endif /* ----------------------------- */ |