Initial import of xisp-2.5p4, a user-friendly X11 interface to pppd/chat.
[pkgsrc.git] / comms / xisp / patches / patch-af
1 $NetBSD$
2
3 --- xisp.c.orig Mon Oct 26 05:35:01 1998
4 +++ xisp.c      Tue Dec  1 04:02:05 1998
5 @@ -299,13 +299,13 @@
6  {
7         char emsg[MSGLEN_ERR+1];
8  
9 -#ifndef SUNOS5x
10 +#ifdef HAVE_STRERROR
11 +       sprintf(emsg, "xISP: %s: %s\n", msg, strerror(errno));
12 +#else
13         if (errno < sys_nerr)
14                 sprintf(emsg, "xISP: %s: %s\n", msg, sys_errlist[errno]);
15         else
16                 sprintf(emsg, "xISP: %s: error #%d\n", msg, errno);
17 -#else
18 -       sprintf(emsg, "xISP: %s: %s\n", msg, strerror(errno));
19  #endif
20         fputs(emsg, stderr);
21         exit(1);
22 @@ -497,13 +497,20 @@
23                                         global.pipePath, global.pipePath);
24                         exit(1);
25                 }
26 +#if (defined(BSD) && BSD >= 199306)
27 +               if (mkfifo(Pipe, 0600))                         /* directory is OK, so */
28 +                       doErr("namedPipe: mkfifo");                     /* create the FIFO node */
29 +#else
30                 if (mknod(Pipe, S_IFIFO+0600, 0))               /* directory is OK, so */
31                         doErr("namedPipe: mknod");                      /* create the FIFO node */
32 +#endif
33         }
34 -#ifndef SUNOS5x
35 -       fd = open(fname, O_RDONLY|O_NDELAY);            /* and open it for reading */
36 -#else
37 +#ifdef SUNOS5x
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 */
41 +#else
42 +       fd = open(fname, O_RDONLY|O_NDELAY);            /* and open it for reading */
43  #endif
44         if (fd < 0)                                                                     /* bail out on error */
45                 doErr("namedPipe: open");
46 @@ -568,11 +575,11 @@
47  
48         va_start(ap);                                                           /* start variable arg list */
49         fmt = va_arg(ap, char*);                                        /* first string is format */
50 -#ifndef SUNOS41x
51 -       bw = vsprintf(btmp, fmt, ap);                           /* pass the rest to vsprintf */
52 -#else
53 +#ifdef BROKEN_VSPRINTF
54         vsprintf(btmp, fmt, ap);
55         bw = strlen(btmp);
56 +#else
57 +       bw = vsprintf(btmp, fmt, ap);                           /* pass the rest to vsprintf */
58  #endif
59         va_end(ap);                                                                     /* end variable arg list */
60         if ((tot+bw) < (MSGLEN_BROWSER-1))                      /* do we have space for new? */
61 @@ -959,7 +966,7 @@
62     allow_detached is set, then init's PID (i.e., 1) is also considered
63     a valid parent PID. */
64  
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)
68  {
69         DIR *procd;
70 @@ -1015,6 +1022,8 @@
71  
72  #ifdef SUNOS41x
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 */
76  #else
77         infofp = popen("/bin/ps -el", "r");                     /* open proc info stream */
78  #endif
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))
87  #else
88                 if (sscanf(psLine, "%*s %*s %*s %d %d"
89                                 " %*s %*s %*s %*s %*s %*s %*s"
90 @@ -1358,11 +1371,11 @@
91  
92         va_start(ap);
93         fmt = va_arg(ap, char*);
94 -#ifndef SUNOS41x
95 -       bw = vsprintf(buf, fmt, ap);
96 -#else
97 +#ifdef BROKEN_VSPRINTF
98         vsprintf(buf, fmt, ap);
99         bw = strlen(buf);
100 +#else
101 +       bw = vsprintf(buf, fmt, ap);
102  #endif
103         va_end(ap);
104         fl_addto_browser(fd_logInfo->costBrowser, buf);
105 @@ -1650,10 +1663,10 @@
106         strcat(res, "...");
107         len += 3;
108         while (swidth > hsize && len > 3) {
109 -#ifndef SUNOS41x
110 -               memmove(&res[len-5], &res[len-3], 4);
111 -#else
112 +#ifdef SUNOS41x
113                 bcopy(&res[len-3], &res[len-5], 4);
114 +#else
115 +               memmove(&res[len-5], &res[len-3], 4);
116  #endif
117                 len = strlen(res);
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 */
121                 }
122                 else if (br < 0) {                                              /* read failed */
123 -#ifndef SUNOS41x
124 -                       if (errno != EAGAIN)                            /* pipe output unavailable? */
125 +#ifdef SUNOS41x
126 +                       if (errno != EWOULDBLOCK)                       /* pipe output unavailable? */
127  #else
128 -                       if (errno != EWOULDBLOCK)
129 +                       if (errno != EAGAIN)
130  #endif
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 */
135                 }
136                 else if (br < 0) {                                              /* read failed */
137 -#ifndef SUNOS41x
138 -                       if (errno != EAGAIN)                            /* pipe output unavailable? */
139 +#ifdef SUNOS41x
140 +                       if (errno != EWOULDBLOCK)                       /* pipe output unavailable? */
141  #else
142 -                       if (errno != EWOULDBLOCK)
143 +                       if (errno != EAGAIN)
144  #endif
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 */
149                 }
150                 else if (br < 0) {                                              /* read failed */
151 -#ifndef SUNOS41x
152 -                       if (errno != EAGAIN)                            /* pipe output unavailable? */
153 +#ifdef SUNOS41x
154 +                       if (errno != EWOULDBLOCK)                       /* pipe output unavailable? */
155  #else
156 -                       if (errno != EWOULDBLOCK)
157 +                       if (errno != EAGAIN)
158  #endif
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];
165 -#ifndef SUNOS41x
166 -               memmove(p_dest, p_src, (global.numISPs-(a->cur))*sizeof(xisprc_t));
167 -#else
168 +#ifdef SUNOS41x
169                 bcopy(p_src, p_dest, (global.numISPs-(a->cur))*sizeof(xisprc_t));
170 +#else
171 +               memmove(p_dest, p_src, (global.numISPs-(a->cur))*sizeof(xisprc_t));
172  #endif
173         }
174         else
175 @@ -5330,10 +5343,10 @@
176         if (sPTT < (global.numPTTs-1)) {
177                 p_dest = &ptt[sPTT];
178                 p_src = &ptt[sPTT+1];
179 -#ifndef SUNOS41x
180 -               memmove(p_dest, p_src, (global.numPTTs-sPTT-1)*sizeof(ptt_t));
181 -#else
182 +#ifdef SUNOS41x
183                 bcopy(p_src, p_dest, (global.numPTTs-sPTT-1)*sizeof(ptt_t));
184 +#else
185 +               memmove(p_dest, p_src, (global.numPTTs-sPTT-1)*sizeof(ptt_t));
186  #endif
187         }
188         else {
189 @@ -6710,10 +6723,10 @@
190         fontSelect();                                                                   /* select desired fonts */
191         (void) pppdVersion();                                                   /* check pppd version */
192  
193 -#ifndef SUNOS41x
194 -       atexit(exitCleanup);                                                    /* register cleanup proc */
195 -#else
196 +#ifdef SUNOS41x
197         on_exit(exitCleanup, 0);
198 +#else
199 +       atexit(exitCleanup);                                                    /* register cleanup proc */
200  #endif
201         recordPID();                                                                    /* check/write PID file */
202