windows-pt_util-20090526
[openafs.git] / src / ptserver / pt_util.c
index 36bfa89..c69ba06 100644 (file)
  */
 
 #include <sys/types.h>
+#ifndef _WIN32
 #include <sys/time.h>
+#include <sys/file.h>
+#else
+#include <fcntl.h>
+#include <io.h>
+#define L_SET SEEK_SET
+#endif
 #include <stdio.h>
 #include <ctype.h>
 #include <string.h>
 #include <errno.h>
-#include <sys/file.h>
 
 #include <afsconfig.h>
 #include <afs/param.h>
+#include <afs/com_err.h>
 
 RCSID
     ("$Header$");
@@ -29,7 +36,9 @@ RCSID
 #include <afs/afsutil.h>
 #include <errno.h>
 #include <lock.h>
+#ifndef _WIN32
 #include <netinet/in.h>
+#endif
 #define UBIK_INTERNALS
 #include <ubik.h>
 #include <rx/xdr.h>
@@ -38,6 +47,7 @@ RCSID
 #include "ptint.h"
 #include "ptserver.h"
 #include "pterror.h"
+#include "ptprototypes.h"
 
 #define IDHash(x) (abs(x) % HASHSIZE)
 #define print_id(x) ( ((flags&DO_SYS)==0 && (x<-32767 || x>97536)) || \
@@ -47,15 +57,16 @@ extern char *optarg;
 extern int optind;
 
 int restricted = 0;
-int display_entry();
-void add_group();
-void display_groups();
-void display_group();
-void fix_pre();
-char *checkin();
-char *check_core();
-char *id_to_name();
-int CommandProc(struct cmd_syndesc *, void *);
+
+static int display_entry(int);
+static void add_group(long);
+static void display_groups(void);
+static void display_group(int);
+static void fix_pre(struct prentry *);
+static char *id_to_name(int);
+static char *checkin(struct prentry *);
+static char *check_core(int);
+static int CommandProc(struct cmd_syndesc *, void *);
 
 struct hash_entry {
     char h_name[PR_MAXNAMELEN];
@@ -129,12 +140,12 @@ main(int argc, char **argv)
 
 }
 
-int
+static int
 CommandProc(register struct cmd_syndesc *a_as, void *arock)
 {
     register int i;
     long code = 0;
-    long cc, upos;
+    long upos;
     long gpos = 0;
     struct prentry uentry, gentry;
     struct ubik_hdr *uh;
@@ -366,11 +377,9 @@ CommandProc(register struct cmd_syndesc *a_as, void *arock)
     exit(0);
 }
 
-int
+static int
 display_entry(int offset)
 {
-    register int i;
-
     lseek(dbase_fd, offset + HDRSIZE, L_SET);
     read(dbase_fd, &pre, sizeof(struct prentry));
 
@@ -390,7 +399,7 @@ display_entry(int offset)
     return (nflag ? pre.nextName : pre.nextID);
 }
 
-void
+static void
 add_group(long id)
 {
     struct grp_list *g;
@@ -406,8 +415,8 @@ add_group(long id)
     g->groups[i] = id;
 }
 
-void
-display_groups()
+static void
+display_groups(void)
 {
     register int i, id;
     struct grp_list *g;
@@ -425,7 +434,7 @@ display_groups()
     }
 }
 
-void
+static void
 display_group(int id)
 {
     register int i, offset;
@@ -496,7 +505,7 @@ display_group(int id)
     }
 }
 
-void
+static void
 fix_pre(struct prentry *pre)
 {
     register int i;
@@ -523,7 +532,7 @@ fix_pre(struct prentry *pre)
     }
 }
 
-char *
+static char *
 id_to_name(int id)
 {
     register int offset;
@@ -550,7 +559,7 @@ id_to_name(int id)
     return 0;
 }
 
-char *
+static char *
 checkin(struct prentry *pre)
 {
     struct hash_entry *he, *last;
@@ -580,7 +589,7 @@ checkin(struct prentry *pre)
     return (he->h_name);
 }
 
-char *
+static char *
 check_core(register int id)
 {
     struct hash_entry *he;