$NetBSD: patch-ag,v 1.1.1.1 1998/12/03 15:08:53 frueauf Exp $ --- xispdial.c.orig Mon Oct 26 05:35:01 1998 +++ xispdial.c Tue Dec 1 03:01:28 1998 @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -93,13 +94,13 @@ { char emsg[MSGLEN_ERR]; -#ifndef SUNOS5x +#ifdef HAVE_STRERROR + sprintf(emsg, "xispdial: %s: %s\n", msg, strerror(errno)); +#else if (errno < sys_nerr) sprintf(emsg, "xispdial: %s: %s\n", msg, sys_errlist[errno]); else sprintf(emsg, "xispdial: %s: error #%d\n", msg, errno); -#else - sprintf(emsg, "xispdial: %s: %s\n", msg, strerror(errno)); #endif fputs(emsg, stderr); if (pipeFD) close(pipeFD); @@ -121,10 +122,12 @@ if (!S_ISFIFO(st.st_mode)) /* is it a FIFO? */ doErr("namedPipe: stat"); /* nope, still not right! */ } -#ifndef SUNOS5x - fd = open(fname, O_WRONLY|O_NDELAY); /* yes, open it for writing */ -#else +#ifdef SUNOS5x fd = open(fname, O_WRONLY|O_NONBLOCK); /* yes, open it for writing */ +#elif (defined(BSD) && BSD >= 199306) + fd = open(fname, O_WRONLY|O_NONBLOCK); /* yes, open it for writing */ +#else + fd = open(fname, O_WRONLY|O_NDELAY); /* yes, open it for writing */ #endif if (fd < 0) /* error means no process has */ doErr("namedPipe: open"); /* opened it for reading */ @@ -145,11 +148,11 @@ va_start(ap); /* start variable arg list */ fmt = va_arg(ap, char*); /* first string is format */ -#ifndef SUNOS41x - iw = vsprintf(msg, fmt, ap); /* pass rest to vsprintf() */ -#else +#ifdef BROKEN_VSPRINTF vsprintf(msg, fmt, ap); iw = strlen(msg); +#else + iw = vsprintf(msg, fmt, ap); /* pass rest to vsprintf() */ #endif va_end(ap); /* end variable arg list */ bw = write(pipeFD, msg, strlen(msg)); /* write buffer to pipe */ @@ -255,19 +258,19 @@ for (p=param; *p;) { /* scan the line */ if (*p == '\\') { /* if a '\\' is found */ if (escape) { /* if auto escaping selected */ -#ifndef SUNOS41x - memmove(p+1, p, zlen); /* increase string len by 1 */ +#ifdef SUNOS41x + bcopy(p, p+1, zlen) /* increase string len by 1 */; #else /* by duplicating the string */ - bcopy(p, p+1, zlen); /* contents starting from */ + memmove(p+1, p, zlen); /* contents starting from */ #endif /* next character position */ *p = '\\'; /* insert an extra '\\' */ p += 2; /* skip the next '\\' */ } else { /* deletion of '\\'s desired */ -#ifndef SUNOS41x - memmove(p, p+1, zlen); /* decrease string len by 1 */ +#ifdef SUNOS41x + bcopy(p+1, p, zlen); /* decrease string len by 1 */ #else - bcopy(p+1, p, zlen); + memmove(p, p+1, zlen); #endif } }