Initial import of xisp-2.5p4, a user-friendly X11 interface to pppd/chat.
[pkgsrc.git] / comms / xisp / patches / patch-ag
1 $NetBSD$
2
3 --- xispdial.c.orig     Mon Oct 26 05:35:01 1998
4 +++ xispdial.c  Tue Dec  1 03:01:28 1998
5 @@ -21,6 +21,7 @@
6  #include <stdio.h>
7  #include <stdlib.h>
8  #include <varargs.h>
9 +#include <sys/param.h>
10  #include <unistd.h>
11  #include <fcntl.h>
12  #include <sys/types.h>
13 @@ -93,13 +94,13 @@
14  {
15         char emsg[MSGLEN_ERR];
16  
17 -#ifndef SUNOS5x
18 +#ifdef HAVE_STRERROR
19 +       sprintf(emsg, "xispdial: %s: %s\n", msg, strerror(errno));
20 +#else
21         if (errno < sys_nerr)
22                 sprintf(emsg, "xispdial: %s: %s\n", msg, sys_errlist[errno]);
23         else
24                 sprintf(emsg, "xispdial: %s: error #%d\n", msg, errno);
25 -#else
26 -       sprintf(emsg, "xispdial: %s: %s\n", msg, strerror(errno));
27  #endif
28         fputs(emsg, stderr);
29         if (pipeFD) close(pipeFD);
30 @@ -121,10 +122,12 @@
31                 if (!S_ISFIFO(st.st_mode))                              /* is it a FIFO? */
32                         doErr("namedPipe: stat");                       /* nope, still not right! */
33         }
34 -#ifndef SUNOS5x
35 -       fd = open(fname, O_WRONLY|O_NDELAY);            /* yes, open it for writing */
36 -#else
37 +#ifdef SUNOS5x
38         fd = open(fname, O_WRONLY|O_NONBLOCK);          /* yes, open it for writing */
39 +#elif (defined(BSD) && BSD >= 199306)
40 +       fd = open(fname, O_WRONLY|O_NONBLOCK);          /* yes, open it for writing */
41 +#else
42 +       fd = open(fname, O_WRONLY|O_NDELAY);            /* yes, open it for writing */
43  #endif
44         if (fd < 0)                                                                     /* error means no process has */
45                 doErr("namedPipe: open");                               /* opened it for reading */
46 @@ -145,11 +148,11 @@
47  
48         va_start(ap);                                                           /* start variable arg list */
49         fmt = va_arg(ap, char*);                                        /* first string is format */
50 -#ifndef SUNOS41x
51 -       iw = vsprintf(msg, fmt, ap);                            /* pass rest to vsprintf() */
52 -#else
53 +#ifdef BROKEN_VSPRINTF
54         vsprintf(msg, fmt, ap);
55         iw = strlen(msg);
56 +#else
57 +       iw = vsprintf(msg, fmt, ap);                            /* pass rest to vsprintf() */
58  #endif
59         va_end(ap);                                                                     /* end variable arg list */
60         bw = write(pipeFD, msg, strlen(msg));           /* write buffer to pipe */
61 @@ -255,19 +258,19 @@
62         for (p=param; *p;) {                                            /* scan the line */
63                 if (*p == '\\') {                                               /* if a '\\' is found */
64                         if (escape) {                                           /* if auto escaping selected */
65 -#ifndef SUNOS41x
66 -                               memmove(p+1, p, zlen);                  /* increase string len by 1 */
67 +#ifdef SUNOS41x
68 +                               bcopy(p, p+1, zlen)                     /* increase string len by 1 */;
69  #else                                                                                  /* by duplicating the string */
70 -                               bcopy(p, p+1, zlen);                    /* contents starting from */
71 +                               memmove(p+1, p, zlen);                  /* contents starting from */
72  #endif                                                                                 /* next character position */
73                                 *p = '\\';                                              /* insert an extra '\\' */
74                                 p += 2;                                                 /* skip the next '\\' */
75                         }
76                         else {                                                          /* deletion of '\\'s desired */
77 -#ifndef SUNOS41x
78 -                               memmove(p, p+1, zlen);                  /* decrease string len by 1 */
79 +#ifdef SUNOS41x
80 +                               bcopy(p+1, p, zlen);                    /* decrease string len by 1 */
81  #else
82 -                               bcopy(p+1, p, zlen);
83 +                               memmove(p, p+1, zlen);
84  #endif
85                         }
86                 }