ypupdated_main.c (26237) | ypupdated_main.c (30378) |
---|---|
1/* 2 * Copyright (c) 1995, 1996 3 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR CONTRIBUTORS BE LIABLE 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. | 1/* 2 * Copyright (c) 1995, 1996 3 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR CONTRIBUTORS BE LIABLE 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. |
31 * 32 * $Id: ypupdated_main.c,v 1.1 1996/12/25 19:31:28 wpaul Exp wpaul $ | |
33 */ 34 | 31 */ 32 |
33#ifndef lint 34static const char rcsid[] = 35 "$Id$"; 36#endif /* not lint */ 37 |
|
35#include "ypupdate_prot.h" 36#include <stdio.h> 37#include <stdlib.h> /* getenv, exit */ 38#include <rpc/pmap_clnt.h> /* for pmap_unset */ 39#include <string.h> /* strcmp */ 40#include <signal.h> 41#include <sys/ttycom.h> /* TIOCNOTTY */ 42#ifdef __cplusplus --- 15 unchanged lines hidden (view full) --- 58#define SIG_PF void(*)(int) 59#endif 60 61#ifdef DEBUG 62#define RPC_SVC_FG 63#endif 64 65#define _RPCSVC_CLOSEDOWN 120 | 38#include "ypupdate_prot.h" 39#include <stdio.h> 40#include <stdlib.h> /* getenv, exit */ 41#include <rpc/pmap_clnt.h> /* for pmap_unset */ 42#include <string.h> /* strcmp */ 43#include <signal.h> 44#include <sys/ttycom.h> /* TIOCNOTTY */ 45#ifdef __cplusplus --- 15 unchanged lines hidden (view full) --- 61#define SIG_PF void(*)(int) 62#endif 63 64#ifdef DEBUG 65#define RPC_SVC_FG 66#endif 67 68#define _RPCSVC_CLOSEDOWN 120 |
66#ifndef lint 67static const char rcsid[] = "$Id: ypupdated_main.c,v 1.1 1996/12/25 19:31:28 wpaul Exp wpaul $"; 68#endif /* not lint */ | |
69int _rpcpmstart; /* Started by a port monitor ? */ 70static int _rpcfdtype; 71 /* Whether Stream or Datagram ? */ 72 /* States a server can be in wrt request */ 73 74#define _IDLE 0 75#define _SERVED 1 76#define _SERVING 2 --- 5 unchanged lines hidden (view full) --- 82 83static 84void _msgout(char* msg) 85{ 86#ifdef RPC_SVC_FG 87 if (_rpcpmstart) 88 syslog(LOG_ERR, msg); 89 else | 69int _rpcpmstart; /* Started by a port monitor ? */ 70static int _rpcfdtype; 71 /* Whether Stream or Datagram ? */ 72 /* States a server can be in wrt request */ 73 74#define _IDLE 0 75#define _SERVED 1 76#define _SERVING 2 --- 5 unchanged lines hidden (view full) --- 82 83static 84void _msgout(char* msg) 85{ 86#ifdef RPC_SVC_FG 87 if (_rpcpmstart) 88 syslog(LOG_ERR, msg); 89 else |
90 (void) fprintf(stderr, "%s\n", msg); | 90 warnx("%s", msg); |
91#else 92 syslog(LOG_ERR, msg); 93#endif 94} 95 96static void 97closedown(int sig) 98{ --- 42 unchanged lines hidden (view full) --- 141 readfds = svc_fds; 142#endif /* def FD_SETSIZE */ 143 switch (select(fd_setsize, &readfds, NULL, NULL, 144 (struct timeval *)0)) { 145 case -1: 146 if (errno == EINTR) { 147 continue; 148 } | 91#else 92 syslog(LOG_ERR, msg); 93#endif 94} 95 96static void 97closedown(int sig) 98{ --- 42 unchanged lines hidden (view full) --- 141 readfds = svc_fds; 142#endif /* def FD_SETSIZE */ 143 switch (select(fd_setsize, &readfds, NULL, NULL, 144 (struct timeval *)0)) { 145 case -1: 146 if (errno == EINTR) { 147 continue; 148 } |
149 perror("svc_run: - select failed"); | 149 warn("svc_run: - select failed"); |
150 return; 151 case 0: 152 continue; 153 default: 154 svc_getreqset(&readfds); 155 if (forked && pid != getpid()) 156 exit(0); 157 } --- 18 unchanged lines hidden (view full) --- 176 } else { 177 (void) pmap_unset(YPU_PROG, YPU_VERS); 178 exit(0); 179 } 180} 181 182void usage() 183{ | 150 return; 151 case 0: 152 continue; 153 default: 154 svc_getreqset(&readfds); 155 if (forked && pid != getpid()) 156 exit(0); 157 } --- 18 unchanged lines hidden (view full) --- 176 } else { 177 (void) pmap_unset(YPU_PROG, YPU_VERS); 178 exit(0); 179 } 180} 181 182void usage() 183{ |
184 fprintf(stderr, "%s [-p path]\n", progname); | 184 fprintf(stderr, "rpc.ypupdatedd [-p path]\n"); |
185 exit(0); 186} 187 | 185 exit(0); 186} 187 |
188int |
|
188main(argc, argv) 189 int argc; 190 char *argv[]; 191{ 192 register SVCXPRT *transp = NULL; 193 int sock; 194 int proto = 0; 195 struct sockaddr_in saddr; --- 93 unchanged lines hidden --- | 189main(argc, argv) 190 int argc; 191 char *argv[]; 192{ 193 register SVCXPRT *transp = NULL; 194 int sock; 195 int proto = 0; 196 struct sockaddr_in saddr; --- 93 unchanged lines hidden --- |