3 --- xisp.c.orig Mon Oct 26 05:35:01 1998
4 +++ xisp.c Tue Dec 1 04:02:05 1998
7 char emsg[MSGLEN_ERR+1];
11 + sprintf(emsg, "xISP: %s: %s\n", msg, strerror(errno));
14 sprintf(emsg, "xISP: %s: %s\n", msg, sys_errlist[errno]);
16 sprintf(emsg, "xISP: %s: error #%d\n", msg, errno);
18 - sprintf(emsg, "xISP: %s: %s\n", msg, strerror(errno));
23 global.pipePath, global.pipePath);
26 +#if (defined(BSD) && BSD >= 199306)
27 + if (mkfifo(Pipe, 0600)) /* directory is OK, so */
28 + doErr("namedPipe: mkfifo"); /* create the FIFO node */
30 if (mknod(Pipe, S_IFIFO+0600, 0)) /* directory is OK, so */
31 doErr("namedPipe: mknod"); /* create the FIFO node */
35 - fd = open(fname, O_RDONLY|O_NDELAY); /* and open it for reading */
38 + fd = open(fname, O_RDONLY|O_NONBLOCK); /* and open it for reading */
39 +#elif (defined(BSD) && BSD >= 199306)
40 fd = open(fname, O_RDONLY|O_NONBLOCK); /* and open it for reading */
42 + fd = open(fname, O_RDONLY|O_NDELAY); /* and open it for reading */
44 if (fd < 0) /* bail out on error */
45 doErr("namedPipe: open");
48 va_start(ap); /* start variable arg list */
49 fmt = va_arg(ap, char*); /* first string is format */
51 - bw = vsprintf(btmp, fmt, ap); /* pass the rest to vsprintf */
53 +#ifdef BROKEN_VSPRINTF
54 vsprintf(btmp, fmt, ap);
57 + bw = vsprintf(btmp, fmt, ap); /* pass the rest to vsprintf */
59 va_end(ap); /* end variable arg list */
60 if ((tot+bw) < (MSGLEN_BROWSER-1)) /* do we have space for new? */
62 allow_detached is set, then init's PID (i.e., 1) is also considered
63 a valid parent PID. */
65 -#if !defined(SUNOS41x) && !defined(SUNOS5x)
66 +#if !defined(SUNOS41x) && !defined(SUNOS5x) && !(defined(BSD) && BSD >= 199306)
67 int procPID(char *procname, int parentPID, int allow_detached)
73 infofp = popen("/bin/ps -aclxw", "r"); /* open proc info stream */
74 +#elif (defined(BSD) && BSD >= 199306)
75 + infofp = popen("/bin/ps -aclxw", "r"); /* open proc info stream */
77 infofp = popen("/bin/ps -el", "r"); /* open proc info stream */
79 @@ -1026,6 +1035,10 @@
80 if (sscanf(psLine, "%*s %*s %d %d %*s"
81 " %*s %*s %*s %*s %*s %*s %*s"
82 " %*s %s", &pid, &ppid, name))
83 +#elif (defined(BSD) && BSD >= 199306)
84 + if (sscanf(psLine, "%*s %d %d %*s"
85 + " %*s %*s %*s %*s %*s %*s %*s"
86 + " %*s %s", &pid, &ppid, name))
88 if (sscanf(psLine, "%*s %*s %*s %d %d"
89 " %*s %*s %*s %*s %*s %*s %*s"
90 @@ -1358,11 +1371,11 @@
93 fmt = va_arg(ap, char*);
95 - bw = vsprintf(buf, fmt, ap);
97 +#ifdef BROKEN_VSPRINTF
98 vsprintf(buf, fmt, ap);
101 + bw = vsprintf(buf, fmt, ap);
104 fl_addto_browser(fd_logInfo->costBrowser, buf);
105 @@ -1650,10 +1663,10 @@
108 while (swidth > hsize && len > 3) {
110 - memmove(&res[len-5], &res[len-3], 4);
113 bcopy(&res[len-3], &res[len-5], 4);
115 + memmove(&res[len-5], &res[len-3], 4);
118 swidth = fl_get_string_width(FL_NORMAL_STYLE, FL_NORMAL_SIZE,
119 @@ -2370,10 +2383,10 @@
120 if (dialWait) dialWait = 0; /* no more waiting */
122 else if (br < 0) { /* read failed */
124 - if (errno != EAGAIN) /* pipe output unavailable? */
126 + if (errno != EWOULDBLOCK) /* pipe output unavailable? */
128 - if (errno != EWOULDBLOCK)
129 + if (errno != EAGAIN)
131 doErr("doBUpdate: read"); /* no, abort with diagnostic */
132 fl_set_timer(btimer, BU_INTERVAL); /* yes, restart timer */
133 @@ -2430,10 +2443,10 @@
134 fl_set_timer(btimer, BU_INTERVAL); /* and restart timer */
136 else if (br < 0) { /* read failed */
138 - if (errno != EAGAIN) /* pipe output unavailable? */
140 + if (errno != EWOULDBLOCK) /* pipe output unavailable? */
142 - if (errno != EWOULDBLOCK)
143 + if (errno != EAGAIN)
145 doErr("doBUpdate: read"); /* no, abort with diagnostic */
146 fl_set_timer(btimer, BU_INTERVAL); /* yes, restart timer */
147 @@ -2476,10 +2489,10 @@
148 fl_set_timer(btimer, BU_INTERVAL); /* and restart timer */
150 else if (br < 0) { /* read failed */
152 - if (errno != EAGAIN) /* pipe output unavailable? */
154 + if (errno != EWOULDBLOCK) /* pipe output unavailable? */
156 - if (errno != EWOULDBLOCK)
157 + if (errno != EAGAIN)
159 doErr("doBUpdate: read"); /* no, abort with diagnostic */
160 fl_set_timer(btimer, BU_INTERVAL); /* yes, restart timer */
161 @@ -3590,10 +3603,10 @@
162 if (a->cur < global.numISPs) {
163 p_dest = &xispOptions[a->cur];
164 p_src = &xispOptions[(a->cur)+1];
166 - memmove(p_dest, p_src, (global.numISPs-(a->cur))*sizeof(xisprc_t));
169 bcopy(p_src, p_dest, (global.numISPs-(a->cur))*sizeof(xisprc_t));
171 + memmove(p_dest, p_src, (global.numISPs-(a->cur))*sizeof(xisprc_t));
175 @@ -5330,10 +5343,10 @@
176 if (sPTT < (global.numPTTs-1)) {
178 p_src = &ptt[sPTT+1];
180 - memmove(p_dest, p_src, (global.numPTTs-sPTT-1)*sizeof(ptt_t));
183 bcopy(p_src, p_dest, (global.numPTTs-sPTT-1)*sizeof(ptt_t));
185 + memmove(p_dest, p_src, (global.numPTTs-sPTT-1)*sizeof(ptt_t));
189 @@ -6710,10 +6723,10 @@
190 fontSelect(); /* select desired fonts */
191 (void) pppdVersion(); /* check pppd version */
194 - atexit(exitCleanup); /* register cleanup proc */
197 on_exit(exitCleanup, 0);
199 + atexit(exitCleanup); /* register cleanup proc */
201 recordPID(); /* check/write PID file */