=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rdist/common.c,v retrieving revision 1.19 retrieving revision 1.20 diff -c -r1.19 -r1.20 *** src/usr.bin/rdist/common.c 2003/05/06 21:52:25 1.19 --- src/usr.bin/rdist/common.c 2003/05/14 01:34:35 1.20 *************** *** 1,4 **** ! /* $OpenBSD: common.c,v 1.19 2003/05/06 21:52:25 millert Exp $ */ /* * Copyright (c) 1983 Regents of the University of California. --- 1,4 ---- ! /* $OpenBSD: common.c,v 1.20 2003/05/14 01:34:35 millert Exp $ */ /* * Copyright (c) 1983 Regents of the University of California. *************** *** 33,50 **** * SUCH DAMAGE. */ #ifndef lint #if 0 ! static char RCSid[] = ! "$From: common.c,v 6.82 1998/03/23 23:27:33 michaelc Exp $"; #else ! static char RCSid[] = ! "$OpenBSD: common.c,v 1.19 2003/05/06 21:52:25 millert Exp $"; #endif ! static char sccsid[] = "@(#)common.c"; ! static char copyright[] = "@(#) Copyright (c) 1983 Regents of the University of California.\n\ All rights reserved.\n"; #endif /* !lint */ --- 33,52 ---- * SUCH DAMAGE. */ + #include "defs.h" #ifndef lint #if 0 ! static char RCSid[] __attribute__((__unused__)) = ! "$From: common.c,v 1.8 2001/03/12 18:16:36 kim Exp $"; #else ! static char RCSid[] __attribute__((__unused__)) = ! "$OpenBSD: common.c,v 1.20 2003/05/14 01:34:35 millert Exp $"; #endif ! static char sccsid[] __attribute__((__unused__)) = ! "@(#)common.c"; ! static char copyright[] __attribute__((__unused__)) = "@(#) Copyright (c) 1983 Regents of the University of California.\n\ All rights reserved.\n"; #endif /* !lint */ *************** *** 53,64 **** * Things common to both the client and server. */ - #include "defs.h" #if defined(NEED_UTIME_H) #include #endif /* defined(NEED_UTIME_H) */ - #include #include /* * Variables common to both client and server --- 55,65 ---- * Things common to both the client and server. */ #if defined(NEED_UTIME_H) #include #endif /* defined(NEED_UTIME_H) */ #include + #include /* * Variables common to both client and server *************** *** 76,82 **** int rem_r = -1; /* Client file descriptor */ int rem_w = -1; /* Client file descriptor */ struct passwd *pw = NULL; /* Local user's pwd entry */ ! int contimedout = FALSE; /* Connection timed out */ int proto_version = -1; /* Protocol version */ int rtimeout = RTIMEOUT; /* Response time out */ jmp_buf finish_jmpbuf; /* Finish() jmp buffer */ --- 77,83 ---- int rem_r = -1; /* Client file descriptor */ int rem_w = -1; /* Client file descriptor */ struct passwd *pw = NULL; /* Local user's pwd entry */ ! volatile sig_atomic_t contimedout = FALSE; /* Connection timed out */ int proto_version = -1; /* Protocol version */ int rtimeout = RTIMEOUT; /* Response time out */ jmp_buf finish_jmpbuf; /* Finish() jmp buffer */ *************** *** 84,97 **** char **realargv; /* Real main() argv */ int realargc; /* Real main() argc */ opt_t options = 0; /* Global install options */ /* * Front end to write() that handles partial write() requests. */ ! extern WRITE_RETURN_T xwrite(fd, buf, len) ! int fd; ! void *buf; ! WRITE_AMT_T len; { WRITE_AMT_T nleft = len; WRITE_RETURN_T nwritten; --- 85,102 ---- char **realargv; /* Real main() argv */ int realargc; /* Real main() argc */ opt_t options = 0; /* Global install options */ + char defowner[64] = "bin"; /* Default owner */ + char defgroup[64] = "bin"; /* Default group */ + static int sendcmdmsg(int, char *, size_t); + static int remread(int, u_char *, int); + static int remmore(void); + /* * Front end to write() that handles partial write() requests. */ ! WRITE_RETURN_T ! xwrite(int fd, void *buf, WRITE_AMT_T len) { WRITE_AMT_T nleft = len; WRITE_RETURN_T nwritten; *************** *** 109,147 **** } /* - * Set program name - */ - extern void setprogname(argv) - char **argv; - { - char *cp; - - if (!progname) { - progname = xstrdup(argv[0]); - if ((cp = strrchr(progname, '/'))) - progname = cp + 1; - } - } - - /* * Do run-time initialization */ ! extern int init(argc, argv, envp) ! /*ARGSUSED*/ ! int argc; ! char **argv; ! char **envp; { int i; - char *cp; #ifdef SIGSEGV_CHECK if (!isserver) (void) signal(SIGSEGV, sighandler); #endif - setprogname(argv); - /* * Save a copy of our argc and argv before setargs() overwrites them */ --- 114,131 ---- } /* * Do run-time initialization */ ! int ! init(int argc, char **argv, char **envp) { int i; #ifdef SIGSEGV_CHECK if (!isserver) (void) signal(SIGSEGV, sighandler); #endif /* * Save a copy of our argc and argv before setargs() overwrites them */ *************** *** 161,174 **** return(-1); } ! debugmsg(DM_MISC, "UserID = %d pwname = '%s' home = '%s'\n", userid, pw->pw_name, pw->pw_dir); homedir = xstrdup(pw->pw_dir); locuser = xstrdup(pw->pw_name); groupid = pw->pw_gid; gethostname(host, sizeof(host)); if ((cp = strchr(host, '.')) != NULL) *cp = CNULL; /* * If we're not root, disable paranoid ownership checks --- 145,160 ---- return(-1); } ! debugmsg(DM_MISC, "UserID = %u pwname = '%s' home = '%s'\n", userid, pw->pw_name, pw->pw_dir); homedir = xstrdup(pw->pw_dir); locuser = xstrdup(pw->pw_name); groupid = pw->pw_gid; gethostname(host, sizeof(host)); + #if 0 if ((cp = strchr(host, '.')) != NULL) *cp = CNULL; + #endif /* * If we're not root, disable paranoid ownership checks *************** *** 185,198 **** /* * Finish things up before ending. */ ! extern void finish() { extern jmp_buf finish_jmpbuf; debugmsg(DM_CALL, "finish() called: do_fork = %d amchild = %d isserver = %d", do_fork, amchild, isserver); ! cleanup(); /* * There's no valid finish_jmpbuf for the rdist master parent. --- 171,185 ---- /* * Finish things up before ending. */ ! void ! finish(void) { extern jmp_buf finish_jmpbuf; debugmsg(DM_CALL, "finish() called: do_fork = %d amchild = %d isserver = %d", do_fork, amchild, isserver); ! cleanup(0); /* * There's no valid finish_jmpbuf for the rdist master parent. *************** *** 219,225 **** /* * Handle lost connections */ ! extern void lostconn() { /* Prevent looping */ (void) signal(SIGPIPE, SIG_IGN); --- 206,213 ---- /* * Handle lost connections */ ! void ! lostconn(void) { /* Prevent looping */ (void) signal(SIGPIPE, SIG_IGN); *************** *** 236,245 **** /* * Do a core dump */ ! extern void coredump() { ! error("Segmentation violation - dumping core [PID = %ld, %s]", ! (long)getpid(), (isserver) ? "isserver" : ((amchild) ? "amchild" : "parent")); abort(); /*NOTREACHED*/ --- 224,234 ---- /* * Do a core dump */ ! void ! coredump(void) { ! error("Segmentation violation - dumping core [PID = %d, %s]", ! getpid(), (isserver) ? "isserver" : ((amchild) ? "amchild" : "parent")); abort(); /*NOTREACHED*/ *************** *** 250,257 **** /* * General signal handler */ ! extern void sighandler(sig) ! int sig; { int save_errno = errno; --- 239,246 ---- /* * General signal handler */ ! void ! sighandler(int sig) { int save_errno = errno; *************** *** 296,305 **** * Function to actually send the command char and message to the * remote host. */ ! static int sendcmdmsg(cmd, msg, msgsize) ! char cmd; ! char *msg; ! size_t msgsize; { int len; --- 285,292 ---- * Function to actually send the command char and message to the * remote host. */ ! static int ! sendcmdmsg(int cmd, char *msg, size_t msgsize) { int len; *************** *** 336,342 **** /* * Stdarg frontend to sendcmdmsg() */ ! extern int sendcmd(char cmd, char *fmt, ...) { static char buf[BUFSIZ]; va_list args; --- 323,330 ---- /* * Stdarg frontend to sendcmdmsg() */ ! int ! sendcmd(char cmd, char *fmt, ...) { static char buf[BUFSIZ]; va_list args; *************** *** 344,350 **** va_start(args, fmt); if (fmt) (void) vsnprintf(buf + (cmd != C_NONE), ! sizeof(buf) - (cmd != C_NONE), fmt, args); else buf[1] = CNULL; va_end(args); --- 332,338 ---- va_start(args, fmt); if (fmt) (void) vsnprintf(buf + (cmd != C_NONE), ! sizeof(buf) - (cmd != C_NONE), fmt, args); else buf[1] = CNULL; va_end(args); *************** *** 357,363 **** /* * Varargs frontend to sendcmdmsg() */ ! extern int sendcmd(va_alist) va_dcl { static char buf[BUFSIZ]; --- 345,352 ---- /* * Varargs frontend to sendcmdmsg() */ ! int ! sendcmd(va_alist) va_dcl { static char buf[BUFSIZ]; *************** *** 371,377 **** fmt = va_arg(args, char *); if (fmt) (void) vsnprintf(buf + (cmd != C_NONE), ! sizeof(buf) - (cmd != C_NONE), fmt, args); else buf[1] = CNULL; va_end(args); --- 360,366 ---- fmt = va_arg(args, char *); if (fmt) (void) vsnprintf(buf + (cmd != C_NONE), ! sizeof(buf) - (cmd != C_NONE), fmt, args); else buf[1] = CNULL; va_end(args); *************** *** 380,408 **** } #endif /* ARG_TYPE == ARG_VARARGS */ - #if !defined(ARG_TYPE) /* - * Stupid frontend to sendcmdmsg() - */ - /*VARARGS2*/ - extern int sendcmd(cmd, fmt, a1, a2, a3, a4, a5, a6, a7, a8) - char cmd; - char *fmt; - { - static char buf[BUFSIZ]; - - if (fmt) - (void) snprintf(buf + (cmd != C_NONE), - sizeof(buf) - (cmd != C_NONE), - fmt, a1, a2, a3, a4, a5, a6, a7, a8); - else - buf[1] = CNULL; - - return(sendcmdmsg(cmd, buf, sizeof(buf))); - } - #endif /* !ARG_TYPE */ - - /* * Internal variables and routines for reading lines from the remote. */ static u_char rembuf[BUFSIZ]; --- 369,375 ---- *************** *** 414,428 **** /* * Back end to remote read() */ ! static int remread(fd, buf, bufsiz) ! int fd; ! u_char *buf; ! int bufsiz; { return(read(fd, (char *)buf, bufsiz)); } ! static int remmore() { (void) signal(SIGALRM, sighandler); (void) alarm(rtimeout); --- 381,394 ---- /* * Back end to remote read() */ ! static int ! remread(int fd, u_char *buf, int bufsiz) { return(read(fd, (char *)buf, bufsiz)); } ! static int ! remmore(void) { (void) signal(SIGALRM, sighandler); (void) alarm(rtimeout); *************** *** 447,456 **** * errors, call cleanup() or lostconn(). In other words, unless * the third argument is nonzero, this routine never returns failure. */ ! extern int remline(buffer, space, doclean) ! u_char *buffer; ! int space; ! int doclean; { int c, left = space; u_char *p = buffer; --- 413,420 ---- * errors, call cleanup() or lostconn(). In other words, unless * the third argument is nonzero, this routine never returns failure. */ ! int ! remline(u_char *buffer, int space, int doclean) { int c, left = space; u_char *p = buffer; *************** *** 485,491 **** if (debug) { static char mbuf[BUFSIZ]; ! (void) snprintf(mbuf, sizeof mbuf, "<<< Cmd = %c (\\%3.3o) Msg = \"%s\"", buffer[0], buffer[0], buffer + 1); --- 449,455 ---- if (debug) { static char mbuf[BUFSIZ]; ! (void) snprintf(mbuf, sizeof(mbuf), "<<< Cmd = %c (\\%3.3o) Msg = \"%s\"", buffer[0], buffer[0], buffer + 1); *************** *** 509,517 **** * Non-line-oriented remote read. */ int ! readrem(p, space) ! char *p; ! int space; { if (remleft <= 0) { /* --- 473,479 ---- * Non-line-oriented remote read. */ int ! readrem(char *p, int space) { if (remleft <= 0) { /* *************** *** 531,537 **** if (remleft < space) space = remleft; ! bcopy((char *) remptr, p, space); remptr += space; remleft -= space; --- 493,499 ---- if (remleft < space) space = remleft; ! memcpy(p, remptr, space); remptr += space; remleft -= space; *************** *** 542,551 **** /* * Get the user name for the uid. */ ! extern char *getusername(uid, file, opts) ! UID_T uid; ! char *file; ! opt_t opts; { static char buf[100]; static UID_T lastuid = (UID_T)-1; --- 504,511 ---- /* * Get the user name for the uid. */ ! char * ! getusername(UID_T uid, char *file, opt_t opts) { static char buf[100]; static UID_T lastuid = (UID_T)-1; *************** *** 556,562 **** * do the opts check. */ if (IS_ON(opts, DO_NUMCHKOWNER)) { ! (void) snprintf(buf, sizeof buf, ":%u", uid); return(buf); } --- 516,522 ---- * do the opts check. */ if (IS_ON(opts, DO_NUMCHKOWNER)) { ! (void) snprintf(buf, sizeof(buf), ":%u", uid); return(buf); } *************** *** 569,579 **** lastuid = uid; if ((pwd = getpwuid(uid)) == NULL) { ! message(MT_WARNING, ! "%s: No password entry for uid %u", file, uid); ! (void) snprintf(buf, sizeof buf, ":%u", uid); ! } else ! (void) strlcpy(buf, pwd->pw_name, sizeof buf); return(buf); } --- 529,544 ---- lastuid = uid; if ((pwd = getpwuid(uid)) == NULL) { ! if (IS_ON(opts, DO_DEFOWNER) && !isserver) ! (void) strlcpy(buf, defowner, sizeof(buf)); ! else { ! message(MT_WARNING, ! "%s: No password entry for uid %u", file, uid); ! (void) snprintf(buf, sizeof(buf), ":%u", uid); ! } ! } else { ! (void) strlcpy(buf, pwd->pw_name, sizeof(buf)); ! } return(buf); } *************** *** 581,590 **** /* * Get the group name for the gid. */ ! extern char *getgroupname(gid, file, opts) ! GID_T gid; ! char *file; ! opt_t opts; { static char buf[100]; static GID_T lastgid = (GID_T)-1; --- 546,553 ---- /* * Get the group name for the gid. */ ! char * ! getgroupname(GID_T gid, char *file, opt_t opts) { static char buf[100]; static GID_T lastgid = (GID_T)-1; *************** *** 595,601 **** * do the opts check. */ if (IS_ON(opts, DO_NUMCHKGROUP)) { ! (void) snprintf(buf, sizeof buf, ":%u", gid); return(buf); } --- 558,564 ---- * do the opts check. */ if (IS_ON(opts, DO_NUMCHKGROUP)) { ! (void) snprintf(buf, sizeof(buf), ":%u", gid); return(buf); } *************** *** 608,617 **** lastgid = gid; if ((grp = (struct group *)getgrgid(gid)) == NULL) { ! message(MT_WARNING, "%s: No name for group %u", file, gid); ! (void) snprintf(buf, sizeof buf, ":%u", gid); } else ! (void) strlcpy(buf, grp->gr_name, sizeof buf); return(buf); } --- 571,585 ---- lastgid = gid; if ((grp = (struct group *)getgrgid(gid)) == NULL) { ! if (IS_ON(opts, DO_DEFGROUP) && !isserver) ! (void) strlcpy(buf, defgroup, sizeof(buf)); ! else { ! message(MT_WARNING, "%s: No name for group %u", ! file, gid); ! (void) snprintf(buf, sizeof(buf), ":%u", gid); ! } } else ! (void) strlcpy(buf, grp->gr_name, sizeof(buf)); return(buf); } *************** *** 619,625 **** /* * Read a response from the remote host. */ ! extern int response() { static u_char resp[BUFSIZ]; u_char *s; --- 587,594 ---- /* * Read a response from the remote host. */ ! int ! response(void) { static u_char resp[BUFSIZ]; u_char *s; *************** *** 660,665 **** --- 629,635 ---- if (s) message(MT_FERROR, "%s", s); finish(); + return(-1); } /*NOTREACHED*/ } *************** *** 672,681 **** * user's home directory path name. Return a pointer in buf to the * part corresponding to `file'. */ ! extern char *exptilde(ebuf, file, ebufsize) ! char *ebuf; ! size_t ebufsize; ! char *file; { char *pw_dir, *rest; size_t len; --- 642,649 ---- * user's home directory path name. Return a pointer in buf to the * part corresponding to `file'. */ ! char * ! exptilde(char *ebuf, char *file, size_t ebufsize) { char *pw_dir, *rest; size_t len; *************** *** 728,734 **** * Set our effective user id to the user running us. * This should be the uid we do most of our work as. */ ! extern int becomeuser() { int r = 0; --- 696,703 ---- * Set our effective user id to the user running us. * This should be the uid we do most of our work as. */ ! int ! becomeuser(void) { int r = 0; *************** *** 739,745 **** #endif /* HAVE_SAVED_IDS */ if (r < 0) ! error("becomeuser %d failed: %s (ruid = %u euid = %u)", userid, SYSERR, getuid(), geteuid()); return(r); --- 708,714 ---- #endif /* HAVE_SAVED_IDS */ if (r < 0) ! error("becomeuser %u failed: %s (ruid = %u euid = %u)", userid, SYSERR, getuid(), geteuid()); return(r); *************** *** 750,756 **** /* * Set our effective user id to "root" (uid = 0) */ ! extern int becomeroot() { int r = 0; --- 719,726 ---- /* * Set our effective user id to "root" (uid = 0) */ ! int ! becomeroot(void) { int r = 0; *************** *** 771,780 **** /* * Set access and modify times of a given file */ ! extern int setfiletime(file, atime, mtime) ! char *file; ! time_t atime; ! time_t mtime; { #if SETFTIME_TYPE == SETFTIME_UTIMES struct timeval tv[2]; --- 741,748 ---- /* * Set access and modify times of a given file */ ! int ! setfiletime(char *file, time_t atime, time_t mtime) { #if SETFTIME_TYPE == SETFTIME_UTIMES struct timeval tv[2]; *************** *** 808,818 **** /* * Get version info */ ! extern char *getversion() { static char buff[BUFSIZ]; ! (void) snprintf(buff, sizeof buff, "Version %s.%d (%s) - Protocol Version %d, Release %s, Patch level %d", DISTVERSION, PATCHLEVEL, DISTSTATUS, VERSION, DISTVERSION, PATCHLEVEL); --- 776,787 ---- /* * Get version info */ ! char * ! getversion(void) { static char buff[BUFSIZ]; ! (void) snprintf(buff, sizeof(buff), "Version %s.%d (%s) - Protocol Version %d, Release %s, Patch level %d", DISTVERSION, PATCHLEVEL, DISTSTATUS, VERSION, DISTVERSION, PATCHLEVEL); *************** *** 824,838 **** * Execute a shell command to handle special cases. * This is now common to both server and client */ ! void runcommand(cmd) ! char *cmd; { ! int fd[2]; ! int status; char *cp, *s; char sbuf[BUFSIZ], buf[BUFSIZ]; ! pid_t pid, i; ! if (pipe(fd) < 0) { error("pipe of %s failed: %s", cmd, SYSERR); return; --- 793,807 ---- * Execute a shell command to handle special cases. * This is now common to both server and client */ ! void ! runcommand(char *cmd) { ! ssize_t nread; ! pid_t pid, wpid; char *cp, *s; char sbuf[BUFSIZ], buf[BUFSIZ]; ! int fd[2], status; ! if (pipe(fd) < 0) { error("pipe of %s failed: %s", cmd, SYSERR); return; *************** *** 856,862 **** (void) close(fd[PIPE_WRITE]); s = sbuf; *s++ = C_LOGMSG; ! while ((i = read(fd[PIPE_READ], buf, sizeof(buf))) > 0) { cp = buf; do { *s++ = *cp++; --- 825,831 ---- (void) close(fd[PIPE_WRITE]); s = sbuf; *s++ = C_LOGMSG; ! while ((nread = read(fd[PIPE_READ], buf, sizeof(buf))) > 0) { cp = buf; do { *s++ = *cp++; *************** *** 879,885 **** message(MT_INFO, "%s", sbuf+1); } s = &sbuf[1]; ! } while (--i); } if (s > (char *) &sbuf[1]) { *s++ = '\n'; --- 848,854 ---- message(MT_INFO, "%s", sbuf+1); } s = &sbuf[1]; ! } while (--nread); } if (s > (char *) &sbuf[1]) { *s++ = '\n'; *************** *** 890,898 **** message(MT_INFO, "%s", sbuf+1); } } ! while ((i = wait(&status)) != pid && i != -1) ; ! if (i == -1) status = -1; (void) close(fd[PIPE_READ]); if (status) --- 859,867 ---- message(MT_INFO, "%s", sbuf+1); } } ! while ((wpid = wait(&status)) != pid && wpid != -1) ; ! if (wpid == -1) status = -1; (void) close(fd[PIPE_READ]); if (status) *************** *** 904,914 **** /* * Malloc with error checking */ ! char *xmalloc(amt) ! int amt; { char *ptr; - extern POINTER *malloc(); if ((ptr = (char *)malloc(amt)) == NULL) fatalerr("Cannot malloc %d bytes of memory.", amt); --- 873,882 ---- /* * Malloc with error checking */ ! char * ! xmalloc(size_t amt) { char *ptr; if ((ptr = (char *)malloc(amt)) == NULL) fatalerr("Cannot malloc %d bytes of memory.", amt); *************** *** 919,930 **** /* * realloc with error checking */ ! char *xrealloc(baseptr, amt) ! char *baseptr; ! unsigned int amt; { char *new; - extern POINTER *realloc(); if ((new = (char *)realloc(baseptr, amt)) == NULL) fatalerr("Cannot realloc %d bytes of memory.", amt); --- 887,896 ---- /* * realloc with error checking */ ! char * ! xrealloc(char *baseptr, size_t amt) { char *new; if ((new = (char *)realloc(baseptr, amt)) == NULL) fatalerr("Cannot realloc %d bytes of memory.", amt); *************** *** 935,946 **** /* * calloc with error checking */ ! char *xcalloc(num, esize) ! unsigned int num; ! unsigned int esize; { char *ptr; - extern POINTER *calloc(); if ((ptr = (char *)calloc(num, esize)) == NULL) fatalerr("Cannot calloc %d * %d = %d bytes of memory.", --- 901,910 ---- /* * calloc with error checking */ ! char * ! xcalloc(size_t num, size_t esize) { char *ptr; if ((ptr = (char *)calloc(num, esize)) == NULL) fatalerr("Cannot calloc %d * %d = %d bytes of memory.", *************** *** 952,977 **** /* * Strdup with error checking */ ! char *xstrdup(str) ! char *str; { ! char *nstr; ! if ((nstr = strdup(str)) == NULL) ! fatalerr("Cannot malloc %d bytes of memory.", strlen(str) + 1); ! return(nstr); } /* * Private version of basename() */ ! extern char *xbasename(path) ! char *path; { char *cp; ! if ((cp = strrchr(path, '/'))) return(cp+1); else return(path); --- 916,942 ---- /* * Strdup with error checking */ ! char * ! xstrdup(const char *str) { ! size_t len = strlen(str) + 1; ! char *nstr = (char *) malloc(len); ! if (nstr == NULL) ! fatalerr("Cannot malloc %u bytes of memory.", len); ! return(memcpy(nstr, str, len)); } /* * Private version of basename() */ ! char * ! xbasename(char *path) { char *cp; ! if ((cp = strrchr(path, '/')) != NULL) return(cp+1); else return(path); *************** *** 982,989 **** * search until a component of that path is found and * return the found file name. */ ! extern char *searchpath(path) ! char *path; { char *file; char *space; --- 947,954 ---- * search until a component of that path is found and * return the found file name. */ ! char * ! searchpath(char *path) { char *file; char *space; *************** *** 1003,1017 **** /* * Set line buffering. */ ! extern void ! mysetlinebuf(fp) ! FILE *fp; { #if SETBUF_TYPE == SETBUF_SETLINEBUF ! setlinebuf(fp); #endif /* SETBUF_SETLINEBUF */ #if SETBUF_TYPE == SETBUF_SETVBUF ! setvbuf(stdout, NULL, _IOLBF, BUFSIZ); #endif /* SETBUF_SETVBUF */ #if !defined(SETBUF_TYPE) No SETBUF_TYPE is defined! --- 968,981 ---- /* * Set line buffering. */ ! int ! mysetlinebuf(FILE *fp) { #if SETBUF_TYPE == SETBUF_SETLINEBUF ! return(setlinebuf(fp)); #endif /* SETBUF_SETLINEBUF */ #if SETBUF_TYPE == SETBUF_SETVBUF ! return(setvbuf(stdout, NULL, _IOLBF, BUFSIZ)); #endif /* SETBUF_SETVBUF */ #if !defined(SETBUF_TYPE) No SETBUF_TYPE is defined! *************** *** 1022,1032 **** * Our interface to system call to get a socket pair. */ int ! getsocketpair(domain, type, protocol, sv) ! int domain; ! int type; ! int protocol; ! int sv[]; { #if SOCKPAIR_TYPE == SOCKPAIR_SOCKETPAIR return(socketpair(domain, type, protocol, sv)); --- 986,992 ---- * Our interface to system call to get a socket pair. */ int ! getsocketpair(int domain, int type, int protocol, int sv[]) { #if SOCKPAIR_TYPE == SOCKPAIR_SOCKETPAIR return(socketpair(domain, type, protocol, sv));