Small updates for NetBSD port

This commit is contained in:
Michiel Broek 2002-01-11 19:01:00 +00:00
parent da6dd3b898
commit 5e52163ff7
19 changed files with 60 additions and 47 deletions

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);
}

View File

@ -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

View File

@ -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 <stddef.h>
#include <fcntl.h>
#ifdef __FreeBSD__
#if defined(__FreeBSD__) || defined(__NetBSD__)
#include <netinet/in_systm.h>
#endif
#include <netinet/ip.h>

View File

@ -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

View File

@ -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;");

View File

@ -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
*/

View File

@ -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);

View File

@ -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

View File

@ -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 <sys/param.h>
#include <sys/errno.h>

View File

@ -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));

View File

@ -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 <stdio.h>
@ -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);

View File

@ -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"

View File

@ -38,7 +38,7 @@
#include <utmpx.h>
#endif
#ifdef __FreeBSD__
#if defined(__FreeBSD__) || defined(__NetBSD__)
#include <sys/types.h>
#include <libutil.h>
#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)
{

View File

@ -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 *);