From: Theodore Tso Date: Sat, 23 Sep 1995 01:38:54 +0000 (+0000) Subject: Makefile.in: PC needs sscanf.c X-Git-Tag: krb5-1.0-beta6~1036 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8ee4512f69b07a139c2112443e6d8cfc234a8086;p=krb5.git Makefile.in: PC needs sscanf.c sscanf.c: cleanup to compile cleanly on the PC, mostly fixing signed/unsigned mismatches. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6828 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/posix/ChangeLog b/src/lib/krb5/posix/ChangeLog index 750000f35..60995b387 100644 --- a/src/lib/krb5/posix/ChangeLog +++ b/src/lib/krb5/posix/ChangeLog @@ -1,3 +1,9 @@ +Wed Sep 13 11:02:21 1995 Keith Vetter (keithv@fusion.com) + + * Makefile.in: PC needs sscanf.c. + * sscanf.c: cleanup to compile cleanly on the PC, mostly fixing + signed/unsigned mismatches. + Mon Sep 11 20:20:39 1995 Theodore Y. Ts'o * sscanf.c (sscanf): Initial version of a sscanf() replacement, diff --git a/src/lib/krb5/posix/Makefile.in b/src/lib/krb5/posix/Makefile.in index 65ba48e28..0e8d84ede 100644 --- a/src/lib/krb5/posix/Makefile.in +++ b/src/lib/krb5/posix/Makefile.in @@ -14,7 +14,7 @@ all:: all-$(WHAT) all-unix:: shared $(OBJS) all-mac: $(OBJS) -all-windows:: syslog.obj +all-windows:: syslog.obj sscanf.obj shared: mkdir shared diff --git a/src/lib/krb5/posix/sscanf.c b/src/lib/krb5/posix/sscanf.c index b7f338c4c..3dbc415e6 100644 --- a/src/lib/krb5/posix/sscanf.c +++ b/src/lib/krb5/posix/sscanf.c @@ -47,6 +47,7 @@ #include #include #include +#include #if 0 #if __STDC__ @@ -98,11 +99,12 @@ #define u_char unsigned char #define u_long unsigned long -static u_char *__sccl(); +static u_char *__sccl(char *tab, u_char *fmt); /* * sscanf */ +int sscanf(char *str, char const *fmt0, ...) { va_list ap; @@ -334,7 +336,7 @@ literal: if (flags & SUPPRESS) { size_t sum = 0; for (;;) { - if ((n = chars_left) < width) { + if ((size_t) (n = chars_left) < width) { sum += n; width -= n; char_ptr += n; @@ -354,7 +356,7 @@ literal: dest = (char *)va_arg(ap, char *); r = width; - if (r > chars_left) + if (r > (size_t) chars_left) r = chars_left; strncpy(dest, char_ptr, width); @@ -368,7 +370,7 @@ literal: case CT_CCL: /* scan a (nonempty) character class (sets NOSKIP) */ if (width == 0) - width = ~0; /* `infinity' */ + width = (size_t) ~0; /* `infinity' */ /* take only those things in the class */ if (flags & SUPPRESS) { n = 0; @@ -409,7 +411,7 @@ literal: case CT_STRING: /* like CCL, but zero-length string OK, & no NOSKIP */ if (width == 0) - width = ~0; + width = (size_t) ~0; if (flags & SUPPRESS) { n = 0; while (!isspace(*char_ptr)) { @@ -567,11 +569,11 @@ literal: if (flags & POINTER) *va_arg(ap, void **) = (void *)res; else if (flags & SHORT) - *va_arg(ap, short *) = res; + *va_arg(ap, short *) = (short) res; else if (flags & LONG) *va_arg(ap, long *) = res; else - *va_arg(ap, int *) = res; + *va_arg(ap, int *) = (int) res; nassigned++; } nread += p - buf;