Makefile.in: PC needs sscanf.c
authorTheodore Tso <tytso@mit.edu>
Sat, 23 Sep 1995 01:38:54 +0000 (01:38 +0000)
committerTheodore Tso <tytso@mit.edu>
Sat, 23 Sep 1995 01:38:54 +0000 (01:38 +0000)
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

src/lib/krb5/posix/ChangeLog
src/lib/krb5/posix/Makefile.in
src/lib/krb5/posix/sscanf.c

index 750000f3530dfd0f2661f0bc5c15cabba7217da8..60995b38757b5bac8f96ae70c5c8fbcab5ab4f24 100644 (file)
@@ -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  <tytso@dcl>
 
        * sscanf.c (sscanf): Initial version of a sscanf() replacement,
index 65ba48e28ba3880590f7df5c2c39470a275ba8a2..0e8d84ede62592470502adb339246eb66e0a13ae 100644 (file)
@@ -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
index b7f338c4c0f01c3ebf1f72e78a929268527c1151..3dbc415e6a3452a7f393fd279891f4530c00dd61 100644 (file)
@@ -47,6 +47,7 @@
 #include <stdlib.h>
 #include <ctype.h>
 #include <stdarg.h>
+#include <string.h>
 
 #if 0
 #if __STDC__
 #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;