X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Futils.c;h=cbab1838523882e6ac0de324498599b4066530be;hb=a3630de20e34796f434a728bfd9cf1a961380c82;hp=7c42ce6290ec3590cd3cd3a73ac0c18581eee235;hpb=d734c01949a1b0bb3096fc71a4923ad59c58a86e;p=ppp.git diff --git a/pppd/utils.c b/pppd/utils.c index 7c42ce6..cbab183 100644 --- a/pppd/utils.c +++ b/pppd/utils.c @@ -16,9 +16,8 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ -#ifndef lint -static char rcsid[] = "$Id: utils.c,v 1.2 1999/04/16 11:34:27 paulus Exp $"; -#endif + +#define RCSID "$Id: utils.c,v 1.8 1999/08/13 06:46:22 paulus Exp $" #include #include @@ -40,9 +39,18 @@ static char rcsid[] = "$Id: utils.c,v 1.2 1999/04/16 11:34:27 paulus Exp $"; #include #include #include +#ifdef SVR4 +#include +#endif #include "pppd.h" +static const char rcsid[] = RCSID; + +#if defined(SUNOS4) +extern char *strerror(); +#endif + static void pr_log __P((void *, char *, ...)); static void logit __P((int, char *, va_list)); static void vslp_printer __P((void *, char *, ...)); @@ -164,7 +172,8 @@ vslprintf(buf, buflen, fmt, args) if (*fmt == 0) break; c = *++fmt; - width = prec = 0; + width = 0; + prec = -1; fillch = ' '; if (c == '0') { fillch = '0'; @@ -185,6 +194,7 @@ vslprintf(buf, buflen, fmt, args) prec = va_arg(args, int); c = *++fmt; } else { + prec = 0; while (isdigit(c)) { prec = prec * 10 + c - '0'; c = *++fmt; @@ -258,11 +268,11 @@ vslprintf(buf, buflen, fmt, args) case 'q': /* quoted string */ quoted = c == 'q'; p = va_arg(args, unsigned char *); - if (fillch == '0' && prec > 0) { + if (fillch == '0' && prec >= 0) { n = prec; } else { n = strlen((char *)p); - if (prec > 0 && prec < n) + if (prec >= 0 && n > prec) n = prec; } while (n > 0 && buflen > 0) { @@ -347,7 +357,7 @@ vslprintf(buf, buflen, fmt, args) len = num + sizeof(num) - 1 - str; } else { len = strlen(str); - if (prec > 0 && len > prec) + if (prec >= 0 && len > prec) len = prec; } if (width > 0) { @@ -698,7 +708,8 @@ static char lock_file[MAXPATHLEN]; * lock - create a lock file for the named device */ int -lock(char *dev) +lock(dev) + char *dev; { #ifdef LOCKLIB int result; @@ -815,7 +826,8 @@ lock(char *dev) * between when the parent died and the child rewrote the lockfile). */ int -relock(int pid) +relock(pid) + int pid; { #ifdef LOCKLIB /* XXX is there a way to do this? */