Fix errno usage and add DragonFly support

Signed-off-by: Masanori Ogino <mogino@acm.org>
This commit is contained in:
Jörg Sonnenberger 2005-12-02 22:57:32 +00:00 • committed by Masanori Ogino
commit 0a67b18647
10 changed files with 18 additions and 31 deletions

View file

@ -124,7 +124,7 @@ char *filename;
{
struct stat buf;
#if defined(__NetBSD__) || defined(__FreeBSD__)
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
if (stat(filename, &buf) == 0) return (long)buf.st_size;
#else
if (stat(filename, &buf) == 0) return buf.st_size;

View file

@ -70,11 +70,11 @@
#define ProtoName "tcp"
#define PortNumber "3000"
#else
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#define PortNumber 3086
#else /* ! __FreeBSD__ __NetBSD__ __OpenBSD__ */
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
#define PortNumber 3086
#else /* ! __FreeBSD__ __NetBSD__ __OpenBSD__ __DragonFly__ */
#define PortNumber 3000
#endif /* ! __FreeBSD__ __NetBSD__ __OpenBSD__ */
#endif /* ! __FreeBSD__ __NetBSD__ __OpenBSD__ __DragonFly__ */
#endif
#define DirectryMode 0755
#define DictFileMode 0644

View file

@ -43,7 +43,7 @@
* This default value is "/dev/null" in document.
* Patched by Hidekazu Kuroki(hidekazu@cs.titech.ac.jp) 1996/8/11
*/
#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__DragonFly__)
#define ErrorOutFile "/dev/console"
#else
/* #define ErrorOutFile "/dev/stderr" */ /* for test */

View file

@ -50,7 +50,6 @@
# define FD_CLR __FD_CLR
#endif
extern int errno;
extern int serv_errno;
extern Global *work_base;
char *malloc();
@ -318,7 +317,7 @@ char *passwd;
serv_errno = SJ3_IncorrectPasswd; goto error1;
}
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__bsdi__)
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__bsdi__) || defined(__DragonFly__)
if ((dp = (Uchar *)malloc((long)sbuf.st_size)) == NULL) {
#else
if ((dp = (Uchar *)malloc(sbuf.st_size)) == NULL) {
@ -330,7 +329,7 @@ char *passwd;
}
memset(dfp, '\0', sizeof(*dfp));
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__bsdi__)
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__bsdi__) || defined(__DragonFly__)
if (fgetfile(fp, 0L, (long)sbuf.st_size, dp) == ERROR) goto error3;
#else
if (fgetfile(fp, 0L, sbuf.st_size, dp) == ERROR) goto error3;

View file

@ -98,7 +98,6 @@ extern char *proto_name;
extern int port_number;
#endif
extern int max_client;
extern int errno;
static int fd_inet = -1;
static int fd_unix = -1;

View file

@ -53,8 +53,6 @@
#define SJIS_PROTO 1
#define EUC_PROTO 2
extern int errno;
extern Global *work_base;
extern STDY *stdy_base;
extern int serv_errno;
@ -82,7 +80,6 @@ static Client *cur_cli;
static Uchar defaultchar[2] = {(Uchar)0x81, (Uchar)0x40};
static int defuse=0, defuse2=0;
char *malloc();
DictFile *opendict();
int closedict();
StdyFile *openstdy();

View file

@ -35,7 +35,7 @@
#include <sys/errno.h>
#include <errno.h>
#include "wchar16.h"
#include "select.h"
#include "key.h"
@ -204,7 +204,6 @@ register int *count;
register int n;
SELECT_FD ifds;
struct timeval t;
extern int errno;
register wchar16_t *s;
int value;

View file

@ -36,7 +36,7 @@
#include "sj_sysvdef.h"
#include <sys/errno.h>
#include <errno.h>
#include "common.h"
#include "inkey.h"
#include "select.h"
@ -201,7 +201,6 @@ master_flush ()
SELECT_FD ifds;
int nc;
struct timeval t;
extern int errno;
do {
cont:

View file

@ -38,14 +38,12 @@
#include "sj_sysvdef.h"
#include "wchar16.h"
#include <signal.h>
#include <sys/errno.h>
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__bsdi__)
#if defined(__NetBSD__) || defined(__bsdi__)
#include <errno.h>
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__bsdi__) || defined(__DragonFly__)
#define USE_OLD_TTY
#if defined(__NetBSD__)
#define LACKOF_SETLOCALE
#endif
#endif
#include <curses.h>
#endif
@ -473,7 +471,7 @@ getmaster ()
* Because FreeBSD's master pseudo-devices are pty[p-sP-S][0-9a-v].
* Patched by Hidekazu Kuroki(hidekazu@cs.titech.ac.jp) 1996/8/10
*/
#if defined(__FreeBSD__)
#if defined(__FreeBSD__) || defined(__DragonFly__)
struct stat stb;
int h, i, j, k1, k2;
#else /* !__FreeBSD__ */
@ -492,7 +490,7 @@ getmaster ()
* Because FreeBSD's master pseudo-devices are pty[p-sP-S][0-9a-v].
* Patched by Hidekazu Kuroki(hidekazu@cs.titech.ac.jp) 1996/8/10
*/
#if defined(__FreeBSD__)
#if defined(__FreeBSD__) || defined(__DragonFly__)
for (h = 0; h < 8; h++) {
line[k1] = "pqrsPQRS"[h];
line[k2] = '0';
@ -852,7 +850,7 @@ shellprocess ()
SCPYN(Utmp.ut_line, strrchr (slave_name, '/') + 1);
time (&Utmp.ut_time);
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__bsdi__)
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__bsdi__) || defined(__DragonFly__)
if (setsid() < 0)
perror("setsid()");
#else
@ -937,7 +935,7 @@ getslave ()
done2 ();
}
#ifndef SYSV_TERMIOS
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__bsdi__)
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__bsdi__) || defined(__DragonFly__)
ioctl(slave, TIOCSCTTY, NULL);
#endif
ioctl (slave, TIOCSETP, (char *)&b);
@ -1085,7 +1083,6 @@ suspend ()
SELECT_FD ifds;
int nc;
struct timeval t;
extern int errno;
clear_guide_line ();

View file

@ -48,14 +48,12 @@
#include <sys/types.h>
#include <sys/fcntl.h>
#endif
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__bsdi__)
#if defined(__NetBSD__) || defined(__bsdi__)
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__bsdi__) || defined(__DragonFly__)
#define USE_OLD_TTY
#endif
#include <curses.h>
#endif
#include <sys/errno.h>
#include <errno.h>
#include <sys/file.h>
#include "sj2.h"
#include "select.h"
@ -72,7 +70,6 @@ static wchar16_t backup = (wchar16_t) 0;
static int eucmode = 0;
extern int master;
extern int errno;
wchar16_t SJ_getchar()
{