From 77aba9d02490a7cac75c15d44ef6f9a9a79d3fbf Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Wed, 30 Aug 2000 10:11:30 +1100 Subject: [PATCH] - (djm) NeXT patch from Ben Lindstrom --- CREDITS | 1 + ChangeLog | 1 + configure.in | 1 - next-posix.c | 28 ++++++++++++++++++++++++++++ next-posix.h | 30 ++++++++++++++++-------------- scp.c | 2 +- 6 files changed, 47 insertions(+), 16 deletions(-) diff --git a/CREDITS b/CREDITS index 4329838cd..63a5e9409 100644 --- a/CREDITS +++ b/CREDITS @@ -47,6 +47,7 @@ Kevin O'Connor - RSAless operation Kiyokazu SUTO - Bugfixes Lutz Jaenicke - Bugfixes Marc G. Fournier - Solaris patches +Mark Miller - Bugfixes Matt Richards - AIX patches Michael Stone - Irix enhancements Nalin Dahyabhai - PAM environment patch diff --git a/ChangeLog b/ChangeLog index d1bfec9bb..fae5c7c48 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,7 @@ - (djm) Quieten the pam delete credentials error message - (djm) Fix printing of $DISPLAY hack if set by system type. Report from Kevin Steves + - (djm) NeXT patch from Ben Lindstrom 20000829 - (djm) Fix ^C ignored issue on Solaris. Diagnosis from Gert diff --git a/configure.in b/configure.in index 5321aedc4..d281c7d23 100644 --- a/configure.in +++ b/configure.in @@ -126,7 +126,6 @@ case "$host" in MAIL=/usr/spool/mail AC_DEFINE(HAVE_NEXT) CFLAGS="$CFLAGS -I/usr/local/include" - AC_MSG_WARN([*** Tested: PA-RISC/m68k Untested: Sparc/Intel]) ;; *-*-solaris*) CFLAGS="$CFLAGS -I/usr/local/include" diff --git a/next-posix.c b/next-posix.c index 0f0c0ea49..7bb34ef00 100644 --- a/next-posix.c +++ b/next-posix.c @@ -2,8 +2,36 @@ #ifdef HAVE_NEXT #include +#include #include "next-posix.h" +pid_t +posix_wait(int *status) +{ + #undef wait /* Use NeXT's wait() function */ + union wait statusp; + pid_t wait_pid; + + wait_pid = wait(&statusp); + status = (int *) statusp.w_status; + + return wait_pid; +} + + +int +posix_utime(char *filename,struct utimbuf *buf) +{ + time_t timep[2]; + + timep[0] = buf->actime; + timep[1] = buf->modtime; + + #undef utime /* Use NeXT's utime() function */ + return utime(filename,timep); +} + + int waitpid(int pid, int *stat_loc, int options) { diff --git a/next-posix.h b/next-posix.h index 86683db59..13aaaa2cb 100644 --- a/next-posix.h +++ b/next-posix.h @@ -10,15 +10,10 @@ #include #include -#define NAME_MAX 255 -struct dirent { - off_t d_off; - unsigned long d_fileno; - unsigned short d_reclen; - unsigned short d_namlen; - char d_name[NAME_MAX + 1]; -}; +/* readdir() returns struct direct (BSD) not struct dirent (POSIX) */ +#define dirent direct +/* POSIX utime() struct */ struct utimbuf { time_t actime; time_t modtime; @@ -32,15 +27,22 @@ struct utimbuf { #undef WIFSTOPPED #undef WIFSIGNALED -#define _W_INT(w) (*(int*)&(w)) /* convert union wait to int */ -#define WIFEXITED(w) (!((_W_INT(w)) & 0377)) -#define WIFSTOPPED(w) ((_W_INT(w)) & 0100) +#define WIFEXITED(w) (!((w) & 0377)) +#define WIFSTOPPED(w) ((w) & 0100) #define WIFSIGNALED(w) (!WIFEXITED(w) && !WIFSTOPPED(w)) -#define WEXITSTATUS(w) (int)(WIFEXITED(w) ? ((_W_INT(w) >> 8) & 0377) : -1) -#define WTERMSIG(w) (int)(WIFSIGNALED(w) ? (_W_INT(w) & 0177) : -1) +#define WEXITSTATUS(w) (int)(WIFEXITED(w) ? ((w >> 8) & 0377) : -1) +#define WTERMSIG(w) (int)(WIFSIGNALED(w) ? (w & 0177) : -1) #define WCOREFLAG 0x80 -#define WCOREDUMP(w) ((_W_INT(w)) & WCOREFLAG) +#define WCOREDUMP(w) ((w) & WCOREFLAG) +/* POSIX "wrapper" functions to replace to BSD functions */ +int posix_utime(char *filename, struct utimbuf *buf); /* new utime() */ +#define utime posix_utime + +pid_t posix_wait(int *status); /* new wait() */ +#define wait posix_wait + +/* MISC functions */ int waitpid(int pid,int *stat_loc,int options); #define getpgrp() getpgrp(0) pid_t setsid(void); diff --git a/scp.c b/scp.c index 5a5d0f469..3b356a9c0 100644 --- a/scp.c +++ b/scp.c @@ -1212,7 +1212,7 @@ progressmeter(int flag) if (flag == -1) { struct sigaction sa; sa.sa_handler = updateprogressmeter; - sigemptyset(&sa.sa_mask); + sigemptyset((sigset_t *)&sa.sa_mask); #ifdef SA_RESTART sa.sa_flags = SA_RESTART; #endif