Replace bits of libutil with libroken
authorSimon Wilkinson <sxw@your-file-system.com>
Sat, 30 Oct 2010 23:52:06 +0000 (00:52 +0100)
committerDerrick Brashear <shadow@dementia.org>
Fri, 19 Nov 2010 12:52:30 +0000 (04:52 -0800)
Replace all of the bits of libutil that were originally culled
from libroken with libroken originals.

Change-Id: I361d7a8d134a361caa2da16963408c74c55a1d4e
Reviewed-on: http://gerrit.openafs.org/3211
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

34 files changed:
Makefile.in
src/afs/UKERNEL/sysincludes.h
src/afsd/Makefile.in
src/afsd/afsd_kernel.c
src/budb/struct_ops.c
src/libafsauthent/Makefile.in
src/libafsrpc/Makefile.in
src/libuafs/Makefile.common.in
src/shlibafsauthent/Makefile.in
src/shlibafsrpc/Makefile.in
src/tsalvaged/salvsync-debug.c
src/tubik/Makefile.in
src/tviced/serialize_state.c
src/tviced/state_analyzer.c
src/uss/Makefile.in
src/util/Makefile.in
src/util/NTMakefile
src/util/afsutil.h
src/util/afsutil_prototypes.h
src/util/daemon.c [deleted file]
src/util/snprintf.c
src/util/strlcat.c [deleted file]
src/util/strlcpy.c [deleted file]
src/util/strnlen.c [deleted file]
src/util/volparse.c
src/venus/Makefile.in
src/venus/fs.c
src/venus/up.c
src/vol/daemon_com.c
src/vol/fssync-debug.c
src/vol/namei_ops.c
src/vol/salvaged.c
src/vol/salvsync-client.c
src/vol/volume.c

index 7722436..20e8324 100644 (file)
@@ -154,7 +154,7 @@ util: $(DIR_roken) procmgmt des lwp_depinstall rx_depinstall
 audit: util rx rxkad fsint
        +${COMPILE_PART1} audit ${COMPILE_PART2} #TODO
 
-comerr: util
+comerr: util $(DIR_roken)
        +${COMPILE_PART1} comerr ${COMPILE_PART2}
 
 cmd: comerr
@@ -213,7 +213,7 @@ sys: cmd comerr afs des rx rxstat fsint auth sys_depinstall
 rxkad: cmd comerr des rx rxkad_depinstall
        +${COMPILE_PART1} rxkad ${COMPILE_PART2}
 
-auth: cmd comerr comerr des lwp rx rxkad audit sys_depinstall auth_depinstall
+auth: cmd comerr des lwp rx rxkad audit sys_depinstall auth_depinstall
        +${COMPILE_PART1} auth ${COMPILE_PART2}
 
 ubik: cmd comerr auth ubik_depinstall sys
@@ -267,7 +267,7 @@ sgiefs:
                echo No efs stuff for ${SYS_NAME};; \
        esac
 
-vol: cmd comerr dir afs sgiefs
+vol: cmd comerr dir afs sgiefs $(DIR_roken)
        +${COMPILE_PART1} vol ${COMPILE_PART2}
 
 tsalvaged: vol libafsrpc libafsauthent cmd util
index 864c674..6375c02 100644 (file)
@@ -235,6 +235,7 @@ typedef unsigned int fsblkcnt_t;
 #define ifaddr                  usr_ifaddr
 #define ifnet                   usr_ifnet
 #define in_ifaddr              usr_in_ifaddr
+#undef socket
 #define socket                 usr_socket
 #define crget                  usr_crget
 #define crcopy                 usr_crcopy
index f0b244d..1d22402 100644 (file)
@@ -32,7 +32,7 @@ FUSE_LIBS=@FUSE_LIBS@
 LDFLAGS_afsd = $(AFSD_LDFLAGS)
 afsd: afsd.o afsd_kernel.o $(AFSLIBS) $(AFSD_LIBS)
        ${AFS_LDRULE} afsd.o afsd_kernel.o $(NON_SHARED) \
-               $(AFSLIBS) $(LIB_roken) ${XLIBS} ${AFSD_LIBS}
+               $(AFSLIBS) ${AFSD_LIBS} $(LIB_roken) $(XLIBS)
 
 LDFLAGS_afsd.fuse = $(AFSD_LDFLAGS)
 afsd.fuse: afsd_fuse.o $(UAFSLIBS) $(AFSD_LIBS)
index 5f769e6..76e28b5 100644 (file)
@@ -10,6 +10,8 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
+#include <roken.h>
+
 #define VFS 1
 
 #include <afs/cmd.h>
index 3ec27ce..1d67f78 100644 (file)
@@ -20,6 +20,7 @@
 #include <sys/file.h>
 #endif
 #include <sys/types.h>
+
 #include <afs/stds.h>
 #include <afs/bubasics.h>
 #include <afs/afsutil.h>
index 9acec36..7a048a9 100644 (file)
@@ -64,8 +64,6 @@ UTILOBJS = \
        dirpath.o \
        serverLog.o \
        snprintf.o \
-       strlcat.o \
-       strlcpy.o \
        fileutil.o
 
 RXKADOBJS = \
@@ -206,12 +204,6 @@ serverLog.o: ${UTIL}/serverLog.c
 snprintf.o: ${UTIL}/snprintf.c
        ${AFS_CCRULE} ${UTIL}/snprintf.c
 
-strlcat.o: ${UTIL}/strlcat.c
-       ${AFS_CCRULE} ${UTIL}/strlcat.c
-
-strlcpy.o: ${UTIL}/strlcpy.c
-       ${AFS_CCRULE} ${UTIL}/strlcpy.c
-
 fileutil.o: ${UTIL}/fileutil.c
        ${AFS_CCRULE} ${UTIL}/fileutil.c
 
index 637a12c..1e1a108 100644 (file)
@@ -39,9 +39,7 @@ SYSOBJS =\
 UTILOBJS =\
        assert.o \
        casestrcpy.o \
-       base64.o \
-       strlcat.o \
-       strlcpy.o
+       base64.o
 
 COMERROBJS =\
        error_msg.o \
@@ -374,12 +372,6 @@ assert.o: ${UTIL}/assert.c
 base64.o: ${UTIL}/base64.c
        $(AFS_CCRULE) $(UTIL)/base64.c
 
-strlcat.o: ${UTIL}/strlcat.c
-       $(AFS_CCRULE) $(UTIL)/strlcat.c
-
-strlcpy.o: ${UTIL}/strlcpy.c
-       $(AFS_CCRULE) $(UTIL)/strlcpy.c
-
 fasttime.o: ${LWP}/fasttime.c
        $(AFS_CCRULE) $(LWP)/fasttime.c
 
index 1013245..3e48f58 100644 (file)
@@ -82,7 +82,6 @@ linktest: UAFS/$(LIBUAFS) ${TOP_OBJDIR}/lib/libdes.a
                ${TOP_LIBDIR}/libdes.a ${TOP_LIBDIR}/libafsutil.a \
                $(LIB_roken) $(TEST_LIBS) $(XLIBS)
 
-
 CRULE1=        $(CC) $(COMMON_INCLUDE) $(OPTF) -DKERNEL $(LIBJUAFS_FLAGS) $(CFLAGS) -c $?
 CRULE2=        $(CC) $(COMMON_INCLUDE) $(OPTF) $(WEBOPTS) -DKERNEL $(LIBJUAFS_FLAGS) $(CFLAGS) -c $?
 
index 4d4e1ff..3edd7c8 100644 (file)
@@ -71,8 +71,6 @@ UTILOBJS = \
        dirpath.o \
        serverLog.o \
        snprintf.o \
-       strlcat.o \
-       strlcpy.o \
        fileutil.o
 
 RXKADOBJS = \
@@ -135,7 +133,10 @@ dest: ${LIBAFSAUTHENT} libafsauthent_pic.a
 ${LIBAFSAUTHENT}: ${LIBOBJS} libafsauthent.map
        ../config/shlib-build -d $(srcdir) -l libafsauthent \
                -M ${LIBAFSAUTHENTMAJOR} -m ${LIBAFSAUTHENTMINOR} -- \
-               -L${TOP_LIBDIR} -lafsrpc ${LIB_crypt} ${LIBOBJS} ${LIB_AFSDB} ${MT_LIBS}
+               -L${TOP_LIBDIR} $(LDFLAGS_roken) \
+               $(LIBOBJS) \
+               -lafsrpc $(LIB_roken) $(LIB_crypt) $(LIB_AFSDB) \
+               ${MT_LIBS}
 
 libafsauthent_pic.a: ${LIBOBJS}
        $(RM) -f $@
@@ -226,7 +227,6 @@ ubik_int.cs.o: ../ubik/ubik_int.cs.c
 ubik_int.xdr.o: ../ubik/ubik_int.xdr.c
        ${AFS_CCRULE} ../ubik/ubik_int.xdr.c
 
-
 get_krbrlm.o: ${UTIL}/get_krbrlm.c
        ${AFS_CCRULE} ${UTIL}/get_krbrlm.c
 
@@ -239,12 +239,6 @@ serverLog.o: ${UTIL}/serverLog.c
 snprintf.o: ${UTIL}/snprintf.c
        ${AFS_CCRULE} ${UTIL}/snprintf.c
 
-strlcat.o: ${UTIL}/strlcat.c
-       ${AFS_CCRULE} ${UTIL}/strlcat.c
-
-strlcpy.o: ${UTIL}/strlcpy.c
-       ${AFS_CCRULE} ${UTIL}/strlcpy.c
-
 fileutil.o: ${UTIL}/fileutil.c
        ${AFS_CCRULE} ${UTIL}/fileutil.c
 
index 9251831..5f67a1d 100644 (file)
@@ -44,8 +44,6 @@ UTILOBJS =\
        assert.o \
        casestrcpy.o \
        base64.o \
-       strlcat.o \
-       strlcpy.o
 
 COMERROBJS =\
        error_msg.o \
@@ -166,7 +164,7 @@ dest: ${LIBAFSRPC} libafsrpc_pic.a
 ${LIBAFSRPC}: ${LIBOBJS} libafsrpc.map
        ../config/shlib-build -d $(srcdir) -l libafsrpc \
                -M ${LIBAFSRPCMAJOR} -m ${LIBAFSRPCMINOR} -- \
-               ${LIBOBJS} ${MT_LIBS}
+               $(LDFLAGS_roken) ${LIBOBJS} ${MT_LIBS} $(LIB_roken)
 
 libafsrpc_pic.a: ${LIBOBJS}
        $(RM) -f $@
@@ -390,12 +388,6 @@ assert.o: ${UTIL}/assert.c
 base64.o: ${UTIL}/base64.c
        $(AFS_CCRULE) $(UTIL)/base64.c
 
-strlcat.o: ${UTIL}/strlcat.c
-       $(AFS_CCRULE) $(UTIL)/strlcat.c
-
-strlcpy.o: ${UTIL}/strlcpy.c
-       $(AFS_CCRULE) $(UTIL)/strlcpy.c
-
 fasttime.o: ${LWP}/fasttime.c
        $(AFS_CCRULE) $(LWP)/fasttime.c
 
index b7bea96..b1c62ee 100644 (file)
@@ -18,7 +18,6 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -36,6 +35,9 @@
 #include <sys/time.h>
 #endif /* ITIMER_REAL */
 #endif
+
+#include <roken.h>
+
 #include <rx/xdr.h>
 #include <afs/afsint.h>
 #include <afs/afs_assert.h>
index 597eddb..d5f6996 100644 (file)
@@ -31,7 +31,7 @@ RXOBJS = rx_pthread.o
 
 UTILOBJS=assert.o uuid.o serverLog.o fileutil.o netutils.o dirpath.o \
        volparse.o flipbase64.o softsig.o hostparse.o snprintf.o \
-       pthread_glock.o strlcat.o strlcpy.o strnlen.o
+       pthread_glock.o
 
 LIBS=${RXOBJS} ${UTILOBJS} ${TOP_LIBDIR}/libafsrpc.a ${TOP_LIBDIR}/liblwp.a \
      ${TOP_LIBDIR}/libcom_err.a ${TOP_LIBDIR}/libcmd.a \
@@ -73,15 +73,6 @@ fileutil.o: ${UTIL}/fileutil.c
 volparse.o: ${UTIL}/volparse.c
        $(AFS_CCRULE) $(UTIL)/volparse.c
 
-strlcat.o: ${UTIL}/strlcat.c
-       $(AFS_CCRULE) $(UTIL)/strlcat.c
-
-strlcpy.o: ${UTIL}/strlcpy.c
-       $(AFS_CCRULE) $(UTIL)/strlcpy.c
-
-strnlen.o: ${UTIL}/strnlen.c
-       $(AFS_CCRULE) $(UTIL)/strnlen.c
-
 flipbase64.o: ${UTIL}/flipbase64.c
        $(AFS_CCRULE) $(UTIL)/flipbase64.c
 
index bc10746..6b2dbff 100644 (file)
 #include <sys/time.h>
 #include <sys/file.h>
 #endif
-#include <afs/afs_assert.h>
 #include <sys/stat.h>
 
 #include <afs/stds.h>
+#include <afs/afs_assert.h>
 
 #include <rx/xdr.h>
 #include <lwp.h>
index 5e80394..05dcb31 100644 (file)
@@ -17,7 +17,6 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-
 #include <stdio.h>
 #include <errno.h>
 #include <sys/file.h>
@@ -26,6 +25,8 @@
 #include <time.h>
 #include <string.h>
 
+#include <roken.h>
+
 #include <afs/stds.h>
 #include <rx/xdr.h>
 #include <afs/afs_assert.h>
index caf5630..44ffaa4 100644 (file)
@@ -33,8 +33,7 @@ LIBS=${TOP_LIBDIR}/libvolser.a \
        ${TOP_LIBDIR}/liblwp.a \
        ${TOP_LIBDIR}/libcmd.a \
        ${TOP_LIBDIR}/libcom_err.a\
-       ${TOP_LIBDIR}/util.a \
-       ${XLIBS}
+       ${TOP_LIBDIR}/util.a
 
 OBJS =  uss_procs.o \
        uss_common.o \
@@ -47,7 +46,7 @@ OBJS =  uss_procs.o \
        y.tab.o 
 
 uss: uss.o ${OBJS} 
-       $(AFS_LDRULE) uss.o ${OBJS} ${LIBS} $(LIB_roken)
+       $(AFS_LDRULE) uss.o ${OBJS} ${LIBS} $(LIB_roken) $(XLIBS)
 
 uss.o:  uss.c AFS_component_version_number.c
 
index 8f2da1f..8588eab 100644 (file)
@@ -20,8 +20,8 @@ objects = assert.o base64.o casestrcpy.o config_file.o ktime.o volparse.o \
         hostparse.o exec.o \
         hputil.o kreltime.o isathing.o get_krbrlm.o uuid.o serverLog.o \
         dirpath.o fileutil.o netutils.o flipbase64.o fstab.o \
-        afs_atomlist.o afs_lhash.o snprintf.o strlcat.o strlcpy.o strnlen.o \
-        pthread_glock.o daemon.o ${REGEX_OBJ}
+        afs_atomlist.o afs_lhash.o snprintf.o pthread_glock.o \
+        ${REGEX_OBJ}
 
 includes = \
        ${TOP_INCDIR}/afs/dirpath.h \
index 2bd40ae..9855c61 100644 (file)
@@ -57,14 +57,11 @@ LIBOBJS = \
        $(OUT)\readdir_nt.obj \
        $(OUT)\serverLog.obj \
        $(OUT)\snprintf.obj \
-       $(OUT)\strlcat.obj \
        $(OUT)\uuid.obj \
        $(OUT)\volparse.obj \
        $(OUT)\winsock_nt.obj \
        $(OUT)\errmap_nt.obj \
        $(OUT)\dirpath.obj \
-       $(OUT)\strnlen.obj \
-       $(OUT)\strlcpy.obj \
        $(OUT)\fileutil.obj \
        $(OUT)\secutil_nt.obj
 
@@ -83,14 +80,11 @@ MT_LIBOBJS = \
        $(OUT)\readdir_nt.obj \
        $(OUT)\serverLog_mt.obj \
        $(OUT)\snprintf.obj \
-       $(OUT)\strlcat.obj \
        $(OUT)\uuid.obj \
        $(OUT)\volparse.obj \
        $(OUT)\winsock_nt.obj \
        $(OUT)\errmap_nt.obj \
        $(OUT)\dirpath_mt.obj \
-       $(OUT)\strnlen.obj \
-       $(OUT)\strlcpy.obj \
        $(OUT)\fileutil.obj \
        $(OUT)\secutil_nt.obj
 
index e3fd362..b56015e 100644 (file)
@@ -151,14 +151,6 @@ extern int re_exec(const char *p1);
 /* b64_string_t is 8 bytes, in stds.h */
      typedef char lb64_string_t[12];
 
-#ifndef HAVE_STRLCAT
-extern size_t strlcat(char *dst, const char *src, size_t siz);
-#endif
-
-#ifndef HAVE_STRLCPY
-extern size_t strlcpy(char *dst, const char *src, size_t siz);
-#endif
-
 #include <afs/ktime.h>
 #include "afsutil_prototypes.h"
 
index d4da7cc..7554c79 100644 (file)
@@ -44,11 +44,6 @@ extern const char* fs_config_get_string(const afs_config_section *, ...);
 extern int afs_config_get_bool(const afs_config_section *, ...);
 extern int afs_config_get_int(const afs_config_section *c, ...);
 
-/* daemon.c */
-#ifndef HAVE_DAEMON
-int daemon(int nochdir, int noclose);
-#endif
-
 /* dirpath.c */
 extern unsigned int initAFSDirPath(void);
 extern const char *getDirPath(afsdir_id_t string_id);
@@ -176,18 +171,6 @@ extern void LogCommandLine(int argc, char **argv, const char *progname,
 /* snprintf.c */
 
 
-/* strl */
-#ifndef HAVE_STRLCPY
-extern size_t strlcpy(char *dst, const char *src, size_t siz);
-#endif
-#ifndef HAVE_STRLCAT
-extern size_t strlcat(char *dst, const char *src, size_t siz);
-#endif
-
-/* strn */
-extern size_t afs_strnlen(char * buf, size_t len);
-
-
 /* sys.c */
 
 
diff --git a/src/util/daemon.c b/src/util/daemon.c
deleted file mode 100644 (file)
index e08845c..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-#include <afsconfig.h>
-#include <afs/param.h>
-
-#ifndef HAVE_DAEMON
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <sys/types.h>
-
-int daemon(int nochdir, int noclose)
-{
-       int err = -1;
-       pid_t pid;
-
-       pid = fork();
-       if (pid == -1) {
-               goto out;
-       } else if (pid) {
-               exit(0);
-       }
-
-       err = setsid();
-       if (err == -1) {
-               goto out;
-       }
-
-       if (!nochdir) {
-               err = chdir("/");
-               if (err == -1) {
-                       goto out;
-               }
-       }
-
-       err = -1;
-       if (!noclose) {
-               if (!freopen("/dev/null", "r", stdin)) {
-                       goto out;
-               }
-
-               if (!freopen("/dev/null", "w", stdout)) {
-                       goto out;
-               }
-
-               if (!freopen("/dev/null", "w", stderr)) {
-                       goto out;
-               }
-       }
-
-       err = 0;
-
-out:
-       return(err);
-}
-#endif
index d0c61f2..69507e9 100644 (file)
@@ -913,23 +913,6 @@ afs_asnprintf (char **ret, size_t max_sz, const char *format, ...)
     return val;
 }
 
-#if defined(AFS_OSF20_ENV) && !defined(AFS_DUX50_ENV) || defined(AFS_AIX32_ENV) || (defined(AFS_SUN55_ENV) && !defined(AFS_SUN56_ENV)) || !defined(HAVE_VSNPRINTF) || defined(TEST_SNPRINTF)
-
-#if defined(AFS_AIX51_ENV) || defined(AFS_NT40_ENV)
-int
-vsnprintf(char *p, size_t avail, const char *fmt, va_list ap)
-#else
-void
-vsnprintf(char *p, unsigned int avail, char *fmt, va_list ap)
-#endif
-{
-    int result;
-    result = afs_vsnprintf(p, avail, fmt, ap);
-#if defined(AFS_AIX51_ENV) || defined(AFS_NT40_ENV)
-    return result;
-#endif
-}
-#endif /* AFS_OSF20_ENV || AFS_AIX32_ENV */
 
 #ifndef AFS_NT40_ENV
 #ifndef HAVE_VSYSLOG
@@ -941,26 +924,4 @@ vsyslog(int priority, const char *format, va_list args)
   syslog(priority, "%s", buf);
 }
 #endif
-
-#if defined(AFS_OSF20_ENV) && !defined(AFS_DUX50_ENV) || defined(AFS_AIX32_ENV) || (defined(AFS_SUN55_ENV) && !defined(AFS_SUN56_ENV)) || !defined(HAVE_SNPRINTF)
-
-#ifdef AFS_AIX51_ENV
-int
-snprintf(char *p, size_t avail, const char *fmt, ...)
-#else
-void
-snprintf(char *p, unsigned int avail, char *fmt, ...)
-#endif
-{
-    va_list ap;
-    int result;
-
-    va_start(ap, fmt);
-    result = afs_vsnprintf(p, avail, fmt, ap);
-    va_end(ap);
-#ifdef AFS_AIX51_ENV
-    return result;
 #endif
-}
-#endif /* AFS_OSF20_ENV || AFS_AIX32_ENV */
-#endif /* AFS_NT40_ENV */
diff --git a/src/util/strlcat.c b/src/util/strlcat.c
deleted file mode 100644 (file)
index 877c967..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <afsconfig.h>
-#include <afs/param.h>
-
-
-#ifndef HAVE_STRLCAT
-
-#include <sys/types.h>
-#include <string.h>
-
-/*
- * Appends src to string dst of size siz (unlike strncat, siz is the
- * full size of dst, not space left).  At most siz-1 characters
- * will be copied.  Always NUL terminates (unless siz <= strlen(dst)).
- * Returns strlen(src) + MIN(siz, strlen(initial dst)).
- * If retval >= siz, truncation occurred.
- */
-size_t
-strlcat(char *dst, const char *src, size_t siz)
-{
-    char *d = dst;
-    const char *s = src;
-    size_t n = siz;
-    size_t dlen;
-
-    /* Find the end of dst and adjust bytes left but don't go past end */
-    while (n-- != 0 && *d != '\0')
-       d++;
-    dlen = d - dst;
-    n = siz - dlen;
-
-    if (n == 0)
-       return (dlen + strlen(s));
-    while (*s != '\0') {
-       if (n != 1) {
-           *d++ = *s;
-           n--;
-       }
-       s++;
-    }
-    *d = '\0';
-
-    return (dlen + (s - src)); /* count does not include NUL */
-}
-#endif
diff --git a/src/util/strlcpy.c b/src/util/strlcpy.c
deleted file mode 100644 (file)
index ebd5a12..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <afsconfig.h>
-#include <afs/param.h>
-
-
-#ifndef HAVE_STRLCPY
-
-#include <sys/types.h>
-
-/*
- * Copy src to string dst of size siz.  At most siz-1 characters
- * will be copied.  Always NUL terminates (unless siz == 0).
- * Returns strlen(src); if retval >= siz, truncation occurred.
- */
-size_t
-strlcpy(char *dst, const char *src, size_t siz)
-{
-    char *d = dst;
-    const char *s = src;
-    size_t n = siz;
-
-    /* Copy as many bytes as will fit */
-    if (n != 0 && --n != 0) {
-       do {
-           if ((*d++ = *s++) == 0)
-               break;
-       } while (--n != 0);
-    }
-
-    /* Not enough room in dst, add NUL and traverse rest of src */
-    if (n == 0) {
-       if (siz != 0)
-           *d = '\0';          /* NUL-terminate dst */
-       while (*s++);
-    }
-
-    return (s - src - 1);      /* count does not include NUL */
-}
-#endif
diff --git a/src/util/strnlen.c b/src/util/strnlen.c
deleted file mode 100644 (file)
index af600ff..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2006, Sine Nomine Associates 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
- */
-
-/* strnlen.c - fixed length string length */
-
-#include <afsconfig.h>
-#include <afs/param.h>
-
-
-#include <sys/types.h>
-#include <stdarg.h>
-#include <ctype.h>
-
-
-size_t
-afs_strnlen(char * buf, size_t len)
-{
-    size_t i;
-
-    for (i = 0; i < len; i++) {
-       if (buf[i] == '\0')
-           break;
-    }
-
-    return i;
-}
-
index db022c9..1e161f7 100644 (file)
@@ -16,6 +16,8 @@
 #include <stdlib.h>
 #endif
 
+#include <roken.h>
+
 #include "afsutil.h"
 
 /* maximum number of partitions - must match vol/voldefs.h */
index f85121b..d1acc8e 100644 (file)
@@ -113,7 +113,7 @@ fstrace: fstrace.o
                * ) \
                        $(AFS_LDRULE) fstrace.o ${TOP_LIBDIR}/libsys.a \
                                ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/util.a \
-                               ${XLIBS} ;; \
+                               ${XLIBS} $(LIB_roken);; \
        esac
 
 cmdebug.o: cmdebug.c ${INCLS} AFS_component_version_number.c
@@ -126,8 +126,6 @@ dedebug.o: dedebug.c ${INCLS} AFS_component_version_number.c
 dedebug: dedebug.o ${CMLIBS}
        $(AFS_LDRULE) dedebug.o ${CMLIBS} $(LIB_roken) ${XLIBS}
 
-
-
 #
 # Kernel info dumper - these are done with submakes so that
 # the build process does not attempt to rebuild them every time it runs.
index a8c1712..adf5a0b 100644 (file)
@@ -10,6 +10,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
+#include <roken.h>
 
 #include <afs/afs_consts.h>
 #include <afs/afs_args.h>
index eee1648..f8ceb6a 100644 (file)
@@ -10,8 +10,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-
-/* missing type from C language */
+#include <roken.h>
 
 #include <errno.h>
 #ifdef AFS_AIX32_ENV
index 923306f..afcc057 100644 (file)
@@ -631,7 +631,7 @@ SYNC_verifyProtocolString(char * buf, size_t len)
 {
     size_t s_len;
 
-    s_len = afs_strnlen(buf, len);
+    s_len = strnlen(buf, len);
 
     return (s_len == len) ? 1 : 0;
 }
index d1ae920..7a6d576 100644 (file)
@@ -18,6 +18,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
+#include <roken.h>
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -938,7 +939,7 @@ VolOpQuery(struct cmd_syndesc * as, void * rock)
 
        printf("\tvop = {\n");
        printf("\t\tvolume         = %u\n", vop.vop.volume);
-       if (afs_strnlen(vop.vop.partName, sizeof(vop.vop.partName)) <
+       if (strnlen(vop.vop.partName, sizeof(vop.vop.partName)) <
            sizeof(vop.vop.partName)) {
            printf("\t\tpartName       = '%s'\n", vop.vop.partName);
        } else {
index edbf8fb..e62a986 100644 (file)
@@ -12,9 +12,9 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
+#include <roken.h>
 
 #ifdef AFS_NAMEI_ENV
-#include <roken.h>
 #include <stdio.h>
 #include <stdlib.h>
 #ifndef AFS_NT40_ENV
index 0873258..080727d 100644 (file)
@@ -18,6 +18,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
+#include <roken.h>
 
 #include <stdlib.h>
 #include <stdio.h>
index 84d65ed..691d82a 100644 (file)
@@ -17,6 +17,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
+#include <roken.h>
 
 #include <sys/types.h>
 #include <stdio.h>
index 4703e11..c85b685 100644 (file)
@@ -5734,7 +5734,7 @@ static int
 VScheduleSalvage_r(Volume * vp)
 {
     int ret=0;
-    int code;
+    int code = 0;
     VolState state_save;
     VThreadOptions_t * thread_opts;
     char partName[16];