util-warning-cleanup-20011005
[openafs.git] / src / util / ktime.c
index 3404782..663a383 100644 (file)
@@ -1,11 +1,17 @@
-/* Copyright (C) 1990 Transarc Corporation - All rights reserved */
 /*
- * (C) COPYRIGHT IBM CORPORATION 1987, 1988
- * LICENSED MATERIALS - PROPERTY OF IBM
+ * Copyright 2000, International Business Machines Corporation and others.
+ * All Rights Reserved.
+ * 
+ * This software has been released under the terms of the IBM Public
+ * License.  For details, see the LICENSE file in the top-level source
+ * directory or online at http://www.openafs.org/dl/license10.html
  */
 
-
+#include <afsconfig.h>
 #include <afs/param.h>
+
+RCSID("$Header$");
+
 #include <sys/types.h>
 #include <stdio.h>
 #include <time.h>
 #ifdef AFS_NT40_ENV
 #include <malloc.h>
 #endif
-#if defined(AFS_SUN5_ENV) || defined(AFS_NT40_ENV)
+#ifdef HAVE_STRING_H
 #include <string.h>
 #else
+#ifdef HAVE_STRINGS_H
 #include <strings.h>
 #endif
+#endif
+#include <stdlib.h>
 #include "afsutil.h"
 
 #include "ktime.h"
@@ -44,6 +53,7 @@ static char *day[] = {
 };
 
 /* free token list returned by parseLine */
+#ifdef undef
 static LocalFreeTokens(alist)
     register struct token *alist; {
     register struct token *nlist;
@@ -54,6 +64,7 @@ static LocalFreeTokens(alist)
     }
     return 0;
 }
+#endif
 
 static space(x)
 int x; {
@@ -65,7 +76,7 @@ static LocalParseLine(aline, alist)
     char *aline;
     struct token **alist; {
     char tbuffer[256];
-    register char *tptr;
+    register char *tptr = NULL;
     int inToken;
     struct token *first, *last;
     register struct token *ttok;
@@ -115,26 +126,26 @@ static struct ptemp {
     char *key;
     afs_int32 value;
 } ptkeys [] = {
-    "sun", 0x10000,
-    "mon", 0x10001,
-    "tue", 0x10002,
-    "wed", 0x10003,
-    "thu", 0x10004,
-    "fri", 0x10005,
-    "sat", 0x10006,
-    "sunday", 0x10000,
-    "monday", 0x10001,
-    "tuesday", 0x10002,
-    "wednesday", 0x10003,
-    "thursday", 0x10004,
-    "thur", 0x10004,
-    "friday", 0x10005,
-    "saturday", 0x10006,
-    "am", 0x20000,
-    "pm", 0x20001,
-    "a.m.", 0x20000,
-    "p.m.", 0x20001,
-    0, 0,
+    { "sun", 0x10000, },
+    { "mon", 0x10001, },
+    { "tue", 0x10002, },
+    { "wed", 0x10003, },
+    { "thu", 0x10004, },
+    { "fri", 0x10005, },
+    { "sat", 0x10006, },
+    { "sunday", 0x10000, },
+    { "monday", 0x10001, },
+    { "tuesday", 0x10002, },
+    { "wednesday", 0x10003, },
+    { "thursday", 0x10004, },
+    { "thur", 0x10004, },
+    { "friday", 0x10005, },
+    { "saturday", 0x10006, },
+    { "am", 0x20000, },
+    { "pm", 0x20001, },
+    { "a.m.", 0x20000, },
+    { "p.m.", 0x20001, },
+    { 0, 0, }
 };
 
 /* ktime_DateOf
@@ -163,7 +174,7 @@ register char *astr;
 {
 struct ktime tk;
 
-bzero(&tk, sizeof(tk));
+memset(&tk, 0, sizeof(tk));
 if ( ParseTime(&tk, astr) )
   return (-1);    /* syntax error */
 
@@ -237,7 +248,7 @@ char *adate; {
     register afs_int32 code;
     struct ptemp *tp;
     
-    bzero(ak, sizeof(*ak));
+    memset(ak, 0, sizeof(*ak));
     code = LocalParseLine(adate, &tt);
     if (code) return -1;
     for(;tt;tt=tt->next) {
@@ -389,6 +400,7 @@ struct ktime *aktime; {
 
 
 /* compare date in both formats, and return as in strcmp */
+#ifdef undef
 static KTimeCmp(aktime, atm)
 register struct ktime *aktime;
 register struct tm *atm; {
@@ -412,6 +424,7 @@ register struct tm *atm; {
     }
     return 0;
 }
+#endif
 
 /* compare date in both formats, and return as in strcmp */
 static KDateCmp(akdate, atm)