]> The Tcpdump Group git mirrors - tcpdump/blobdiff - smbutil.c
Clean up comments.
[tcpdump] / smbutil.c
index c34fbacf256b75f360484b285b5461c6f6c4d38c..4f8c7b591dcfcb5f61fb397e4fbd3c1ed67f9fc3 100644 (file)
--- a/smbutil.c
+++ b/smbutil.c
 
 #ifndef lint
 static const char rcsid[] =
-     "@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.18 2002-01-17 04:38:29 guy Exp $";
+     "@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.22 2002-08-01 08:53:35 risso Exp $";
 #endif
 
-#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+#include <tcpdump-stdinc.h>
 
-#include <netinet/in.h>
-
-#include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#ifdef TIME_WITH_SYS_TIME
 #include <time.h>
+#endif
 
 #include "interface.h"
 #include "extract.h"
@@ -336,7 +332,7 @@ write_bits(unsigned int val, char *fmt)
 
 /* convert a UCS2 string into iso-8859-1 string */
 static const char *
-unistr(const char *s, int *len)
+unistr(const u_char *s, int *len)
 {
     static char buf[1000];
     int l=0;
@@ -352,8 +348,8 @@ unistr(const char *s, int *len)
 
     /* maybe it isn't unicode - a cheap trick */
     if (!use_unicode || (s[0] && s[1])) {
-       *len = strlen(s) + 1;
-       return s;
+       *len = strlen((const char *)s) + 1;
+       return (const char *)s;
     }
 
     *len = 0;
@@ -398,8 +394,11 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
        case '{':
          {
            char bitfmt[128];
-           char *p = strchr(++fmt, '}');
-           int l = PTR_DIFF(p, fmt);
+           char *p;
+           int l;
+
+           p = strchr(++fmt, '}');
+           l = PTR_DIFF(p, fmt);
            strncpy(bitfmt, fmt, l);
            bitfmt[l] = 0;
            fmt = p + 1;
@@ -413,7 +412,7 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
            int l = atoi(fmt + 1);
            buf += l;
            fmt++;
-           while (isdigit(*fmt))
+           while (isdigit((unsigned char)*fmt))
                fmt++;
            break;
          }
@@ -527,7 +526,7 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
            printf("%-*.*s", l, l, buf);
            buf += l;
            fmt++;
-           while (isdigit(*fmt))
+           while (isdigit((unsigned char)*fmt))
                fmt++;
            break;
          }
@@ -537,7 +536,7 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
            while (l--)
                printf("%02x", *buf++);
            fmt++;
-           while (isdigit(*fmt))
+           while (isdigit((unsigned char)*fmt))
                fmt++;
            break;
          }
@@ -569,7 +568,7 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
                break;
            }
            fmt++;
-           while (isdigit(*fmt))
+           while (isdigit((unsigned char)*fmt))
                fmt++;
            break;
          }
@@ -601,7 +600,7 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
            }
            printf("%s", t ? asctime(localtime(&t)) : "NULL\n");
            fmt++;
-           while (isdigit(*fmt))
+           while (isdigit((unsigned char)*fmt))
                fmt++;
            break;
          }