From 5e52163ff74f6484dbfa9899463feef25a7680a3 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Fri, 11 Jan 2002 19:01:00 +0000 Subject: [PATCH] Small updates for NetBSD port --- lib/mbfile.c | 7 +++---- mbcico/ulock.c | 2 +- mbmon/mbmon.c | 7 ++++--- mbsebbs/msgutil.c | 2 ++ mbsebbs/pinfo.c | 2 ++ mbsetup/m_tty.c | 10 ++++++++++ mbsetup/mbsetup.c | 2 ++ mbtask/libs.h | 9 ++++----- mbtask/mbtask.c | 6 +++--- mbtask/taskdisk.c | 4 ++-- unix/mbpasswd.c | 16 ++++++++-------- unix/mbpasswd.h | 2 +- unix/mbuseradd.c | 9 ++++----- unix/pw_util.c | 6 +++--- unix/pw_util.h | 2 +- unix/pwio.c | 11 +++++------ unix/pwio.h | 2 +- unix/utmp.c | 6 +++--- unix/utmp.h | 2 +- 19 files changed, 60 insertions(+), 47 deletions(-) diff --git a/lib/mbfile.c b/lib/mbfile.c index ccea838a..8717762f 100644 --- a/lib/mbfile.c +++ b/lib/mbfile.c @@ -1,11 +1,10 @@ /***************************************************************************** * - * File ..................: mbfile + * $Id$ * Purpose ...............: Basic File I/O - * Last modification date : 29-Oct-2001 * ***************************************************************************** - * Copyright (C) 1997-2001 + * Copyright (C) 1997-2002 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -275,7 +274,7 @@ int diskfree(int needed) #ifdef __linux__ if ((fp = fopen((char *)"/etc/mtab", "r")) == 0) { WriteError("$Can't open /etc/mtab"); -#elif __FreeBSD__ +#elif __FreeBSD__ || __NetBSD__ if ((fp = fopen((char *)"/etc/fstab", "r")) == 0) { WriteError("$Can't open /etc/fstab"); #endif diff --git a/mbcico/ulock.c b/mbcico/ulock.c index fc492f5a..aed5a13f 100644 --- a/mbcico/ulock.c +++ b/mbcico/ulock.c @@ -32,7 +32,7 @@ #include "../lib/clcomm.h" #ifndef LOCKDIR -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__NetBSD__) #define LOCKDIR "/var/spool/lock" #else #define LOCKDIR "/var/lock" diff --git a/mbmon/mbmon.c b/mbmon/mbmon.c index a532b313..d7e1cdf3 100644 --- a/mbmon/mbmon.c +++ b/mbmon/mbmon.c @@ -1,12 +1,11 @@ /***************************************************************************** * - * File ..................: mbmon/mbmon.c + * $Id$ * Purpose ...............: Monitor Program - * Last modification date : 26-Oct-2001 * Todo ..................: Chat with user via server * ***************************************************************************** - * Copyright (C) 1997-2001 + * Copyright (C) 1997-2002 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -373,6 +372,8 @@ void soft_info(void) 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 diff --git a/mbsebbs/msgutil.c b/mbsebbs/msgutil.c index 86c77f93..a868015d 100644 --- a/mbsebbs/msgutil.c +++ b/mbsebbs/msgutil.c @@ -279,6 +279,8 @@ void Add_Footkludges(int Quote) 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 diff --git a/mbsebbs/pinfo.c b/mbsebbs/pinfo.c index 7814e80e..653b3525 100644 --- a/mbsebbs/pinfo.c +++ b/mbsebbs/pinfo.c @@ -95,6 +95,8 @@ void cr(void) 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 diff --git a/mbsetup/m_tty.c b/mbsetup/m_tty.c index c9b95fd3..4b42ed31 100644 --- a/mbsetup/m_tty.c +++ b/mbsetup/m_tty.c @@ -107,6 +107,9 @@ int CountTtyinfo(void) #endif #ifdef __FreeBSD__ sprintf(ttyinfo.tty, "cuaia%d", i); +#endif +#ifdef __NetBSD__ + sprintf(ttyinfo.tty, "ttyi%c", i + 'a'); // NetBSD on a Sparc, how about PC's? #endif sprintf(ttyinfo.speed, "64 kbits"); sprintf(ttyinfo.flags, "XA,X75,CM"); @@ -126,6 +129,9 @@ int CountTtyinfo(void) #endif #ifdef __FreeBSD__ sprintf(ttyinfo.tty, "cuaa%d", i); +#endif +#ifdef __NetBSD__ + sprintf(ttyinfo.tty, "tty%c", i + 'a'); // NetBSD on a Sparc, how about PC's? #endif sprintf(ttyinfo.speed, "33.6 kbits"); sprintf(ttyinfo.flags, "CM,XA,V32B,V42B,V34"); @@ -133,7 +139,11 @@ int CountTtyinfo(void) ttyinfo.available = FALSE; ttyinfo.callout = TRUE; ttyinfo.honor_zmh = TRUE; +#ifdef __sparc__ + ttyinfo.portspeed = 38400; // Safe, ULTRA has a higher maxmimum speed +#else ttyinfo.portspeed = 57600; +#endif sprintf(ttyinfo.name, "Modem line #%d", i+1); fwrite(&ttyinfo, sizeof(ttyinfo), 1, fil); } diff --git a/mbsetup/mbsetup.c b/mbsetup/mbsetup.c index 395e606b..ae483867 100644 --- a/mbsetup/mbsetup.c +++ b/mbsetup/mbsetup.c @@ -140,6 +140,8 @@ void soft_info(void) 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 diff --git a/mbtask/libs.h b/mbtask/libs.h index 012f9ca9..7010a1ab 100644 --- a/mbtask/libs.h +++ b/mbtask/libs.h @@ -1,11 +1,10 @@ /***************************************************************************** * - * File ..................: libs.h - * Purpose ...............: Libraries include list - * Last modification date : 11-Aug-2001 + * $Id$ + * Purpose ...............: Libraries include list for mbtask * ***************************************************************************** - * Copyright (C) 1997-2001 + * Copyright (C) 1997-2002 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 Internet: mbse@user.sourceforge.net @@ -70,7 +69,7 @@ #include #include -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__NetBSD__) #include #endif #include diff --git a/mbtask/mbtask.c b/mbtask/mbtask.c index b0ddfaaf..2b75f0cb 100644 --- a/mbtask/mbtask.c +++ b/mbtask/mbtask.c @@ -4,7 +4,7 @@ * Purpose ...............: MBSE BBS Task Manager * ***************************************************************************** - * Copyright (C) 1997-2001 + * Copyright (C) 1997-2002 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -870,7 +870,7 @@ void ulocktask(void) /* different names, same thing... be careful, as these are macros... */ -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__NetBSD__) # define icmphdr icmp # define iphdr ip # define ip_saddr ip_src.s_addr @@ -897,7 +897,7 @@ void ulocktask(void) # define icmp_seq un.echo.sequence #endif -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__NetBSD__) # define ICMP_DEST_UNREACH ICMP_UNREACH # define ICMP_TIME_EXCEEDED ICMP_TIMXCEED #endif diff --git a/mbtask/taskdisk.c b/mbtask/taskdisk.c index 84fb8353..02830eef 100644 --- a/mbtask/taskdisk.c +++ b/mbtask/taskdisk.c @@ -4,7 +4,7 @@ * Purpose ...............: Give status of all filesystems * ***************************************************************************** - * Copyright (C) 1997-2001 + * Copyright (C) 1997-2002 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 Internet: mbse@user.sourceforge.net @@ -53,7 +53,7 @@ char *get_diskstat() mtab = calloc(PATH_MAX, sizeof(char)); #ifdef __linux__ if ((fp = fopen((char *)"/etc/mtab", "r")) == 0) { -#elif __FreeBSD__ +#elif __FreeBSD__ || __NetBSD__ if ((fp = fopen((char *)"/etc/fstab", "r")) == 0) { #endif sprintf(buf, "100:0;"); diff --git a/unix/mbpasswd.c b/unix/mbpasswd.c index 8f650f50..6d52f168 100644 --- a/unix/mbpasswd.c +++ b/unix/mbpasswd.c @@ -117,7 +117,7 @@ static int force; /* Force update of locked passwords */ -#ifndef __FreeBSD__ +#if !defined(__FreeBSD__) && !defined(__NetBSD__) static void fail_exit(int status) { // gr_unlock(); @@ -239,7 +239,7 @@ void pwd_init(void) umask(077); } -#endif /* not FreeBSD */ +#endif /* not FreeBSD && NetBSD */ /* @@ -531,7 +531,7 @@ static int new_password(const struct passwd *pw, char *newpasswd) } -#ifndef __FreeBSD__ +#if !defined(__FreeBSD__) && !defined(__NetBSD__) static void update_noshadow(int shadow_locked) { @@ -655,7 +655,7 @@ static void update_noshadow(int shadow_locked) pw_unlock(); } -#endif /* Not __FreeBSD__ */ +#endif /* Not __FreeBSD__ && __NetBSD__ */ #ifdef SHADOW_PASSWORD @@ -719,7 +719,7 @@ static void update_shadow(void) */ int main(int argc, char *argv[]) { -#ifndef __FreeBSD__ +#if !defined(__FreeBSD__) && !defined(__NetBSD__) const struct passwd *pw; const struct group *gr; #ifdef SHADOW_PASSWORD @@ -858,7 +858,7 @@ int main(int argc, char *argv[]) * to root to protect against unexpected signals. Any * keyboard signals are set to be ignored. */ -#ifndef __FreeBSD__ +#if !defined(__FreeBSD__) && !defined(__NetBSD__) pwd_init(); #else pw_init(); @@ -871,7 +871,7 @@ int main(int argc, char *argv[]) exit(E_FAILURE); } -#ifndef __FreeBSD__ +#if !defined(__FreeBSD__) && !defined(__NetBSD__) #ifdef HAVE_USERSEC_H update_userpw(pw->pw_passwd); @@ -885,7 +885,7 @@ int main(int argc, char *argv[]) update_noshadow(0); #endif /* !HAVE_USERSEC_H */ -#else /* __FreeBSD__ */ +#else /* __FreeBSD__ && __NetBSD__ */ /* * FreeBSD password change, borrowed from the original FreeBSD sources */ diff --git a/unix/mbpasswd.h b/unix/mbpasswd.h index dabf3a13..b95d8487 100644 --- a/unix/mbpasswd.h +++ b/unix/mbpasswd.h @@ -30,7 +30,7 @@ char *crypt_make_salt(void); char *pw_encrypt(const char *, const char *); int i64c(int); char *l64a(long); -#ifndef __FreeBSD__ +#if !defined(__FreeBSD__) && !defined(__NetBSD__) static void fail_exit(int); static void oom(void); static void update_noshadow(int); diff --git a/unix/mbuseradd.c b/unix/mbuseradd.c index ec6d23ed..df984003 100644 --- a/unix/mbuseradd.c +++ b/unix/mbuseradd.c @@ -1,11 +1,10 @@ /***************************************************************************** * - * File ..................: mbuseradd.c + * $Id$ * Purpose ...............: setuid root version of useradd - * Last modification date : 25-Aug-2001 * ***************************************************************************** - * Copyright (C) 1997-2001 + * Copyright (C) 1997-2002 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -165,7 +164,7 @@ int main(int argc, char *argv[]) * Build command to add user entry to the /etc/passwd and /etc/shadow * files. We use the systems own useradd program. */ -#ifdef __linux__ +#if defined(__linux__) || defined(__NetBSD__) if ((access("/usr/bin/useradd", R_OK)) == 0) strcpy(temp, "/usr/bin/useradd"); else if ((access("/bin/useradd", R_OK)) == 0) @@ -194,7 +193,7 @@ int main(int argc, char *argv[]) sprintf(shell, "%s/bin/mbsebbs", getenv("MBSE_ROOT")); -#ifdef __linux__ +#if defined(__linux__) || defined(__NetBSD__) sprintf(PassEnt, "%s -c \"%s\" -d %s/%s -g %s -s %s %s", temp, argv[3], argv[4], argv[2], argv[1], shell, argv[2]); #endif diff --git a/unix/pw_util.c b/unix/pw_util.c index 48d499e2..ede0a5b6 100644 --- a/unix/pw_util.c +++ b/unix/pw_util.c @@ -1,11 +1,11 @@ /***************************************************************************** * * $Id$ - * Purpose ...............: FreeBSD password utilities. + * Purpose ...............: FreeBSD/NetBSD password utilities. * Remark ................: Taken from FreeBSD and modified for MBSE BBS. * ***************************************************************************** - * Copyright (C) 1997-2001 + * Copyright (C) 1997-2002 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -62,7 +62,7 @@ * SUCH DAMAGE. */ -#ifdef __FreeBSD__ +#ifdef __FreeBSD__ || __NetBSD__ #include #include diff --git a/unix/pw_util.h b/unix/pw_util.h index de72fdd9..935aa7b3 100644 --- a/unix/pw_util.h +++ b/unix/pw_util.h @@ -37,7 +37,7 @@ #ifndef _PW_UTIL_H #define _PW_UTIL_H -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__NetBSD__) void pw_error __P((char *, int, int)); void pw_init __P((void)); diff --git a/unix/pwio.c b/unix/pwio.c index 8e99a713..9a6b8ca2 100644 --- a/unix/pwio.c +++ b/unix/pwio.c @@ -1,13 +1,12 @@ /***************************************************************************** * - * File ..................: mbuseradd/pwio.c + * $Id$ * Purpose ...............: MBSE BBS Shadow Password Suite - * Last modification date : 09-Aug-2001 * Original Source .......: Shadow Password Suite - * Original Copyrioght ...: Julianne Frances Haugh and others. + * Original Copyright ....: Julianne Frances Haugh and others. * ***************************************************************************** - * Copyright (C) 1997-2001 + * Copyright (C) 1997-2002 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -31,7 +30,7 @@ * Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. *****************************************************************************/ -#ifndef __FreeBSD__ +#if !defined(__FreeBSD__) && !defined(__netBSD__) #include "../config.h" #include @@ -169,7 +168,7 @@ int pw_name(const char *filename) -#ifndef __FreeBSD__ +#if !defined(__FreeBSD__) && !defined(__NetBSD__) int pw_lock(void) { return commonio_lock(&passwd_db); diff --git a/unix/pwio.h b/unix/pwio.h index 8800894c..af736805 100644 --- a/unix/pwio.h +++ b/unix/pwio.h @@ -3,7 +3,7 @@ #ifndef _PWIO_H #define _PWIO_H -#ifndef __FreeBSD__ +#if !defined(__FreeBSD__) && !defined(__NetBSD__) #ifndef PASSWD_FILE #define PASSWD_FILE "/etc/passwd" diff --git a/unix/utmp.c b/unix/utmp.c index a5169d62..b41aba4b 100644 --- a/unix/utmp.c +++ b/unix/utmp.c @@ -38,7 +38,7 @@ #include #endif -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__NetBSD__) #include #include #endif @@ -389,10 +389,10 @@ void setutmp(const char *name, const char *line, const char *host) utent = utline; } -#elif __FreeBSD__ +#elif __FreeBSD__ || __NetBSD__ /* - * FreeBSD version, simple and mean. + * FreeBSD/NetBSD version, simple and mean. */ void setutmp(const char *name, const char *line, const char *host) { diff --git a/unix/utmp.h b/unix/utmp.h index f55574cd..d6a52e34 100644 --- a/unix/utmp.h +++ b/unix/utmp.h @@ -20,7 +20,7 @@ static void updwtmpx(const char *, const struct utmpx *); void setutmp(const char *, const char *, const char *); #elif HAVE_UTMPX_H void setutmp(const char *, const char *, const char *); -#elif __FreeBSD__ +#elif __FreeBSD__ || __NetBSD__ void setutmp(const char *, const char *, const char *); #else /* !SVR4 */ void setutmp(const char *, const char *);