#include <afsconfig.h>
#include <afs/param.h>
-#include <roken.h>
-
#include <afs/stds.h>
+#include <roken.h>
+
#include <windows.h>
#include <winsock2.h>
#include <nb30.h>
#include <afsconfig.h>
#include <afs/param.h>
-#include <roken.h>
-
#include <afs/stds.h>
+#include <roken.h>
+
#include <windows.h>
#include <winsock2.h>
#include <nb30.h>
* directory or online at http://www.openafs.org/dl/license10.html
*/
+#include <afsconfig.h>
#include <afs/param.h>
#include <afs/stds.h>
+#include <roken.h>
+
#include <windows.h>
#include <shlobj.h>
#include <stdio.h>
#include <afsconfig.h>
#include <afs/param.h>
+#include <roken.h>
+
#include<windows.h>
#include<netidmgr.h>
#include<dynimport.h>
#include <ctype.h>
-#include <afs/stds.h>
#include <afs/ktc.h>
#include <afs/token.h>
} else {
len = strlen(username)+strlen(realmUsed)+2;
*authuser = malloc(len);
- afs_snprintf(*authuser, len, "%s@%s", username, realmUsed);
+ snprintf(*authuser, len, "%s@%s", username, realmUsed);
*foreign = 1;
}
*/
#include <afsconfig.h>
+#include <afs/param.h>
+
+#include <roken.h>
/* only build on platforms that have SysV IPC support; i.e., when we
* have sys/ipc.h */
#ifdef HAVE_SYS_IPC_H
-#include <afs/param.h>
#include <string.h>
#include <stdio.h>
#include <afsconfig.h>
#include <afs/param.h>
-
#include <afs/procmgmt.h>
#include <roken.h>
va_list ap;
va_start(ap, fmt);
- afs_vsnprintf(tmp, sizeof(tmp), fmt, ap);
+ vsnprintf(tmp, sizeof(tmp), fmt, ap);
va_end(ap);
TapeLogStr(debug, task, error1, error2, tmp);
va_list ap;
va_start(ap, fmt);
- afs_vsnprintf(tmp, sizeof(tmp), fmt, ap);
+ vsnprintf(tmp, sizeof(tmp), fmt, ap);
va_end(ap);
/* Sends message to TapeLog and stdout */
va_list ap;
va_start(ap, fmt);
- afs_vsnprintf(tmp, sizeof(tmp), fmt, ap);
+ vsnprintf(tmp, sizeof(tmp), fmt, ap);
va_end(ap);
ErrorLogStr(debug, task, error1, error2, tmp);
va_list ap;
va_start(ap, fmt);
- afs_vsnprintf(tmp, sizeof(tmp), fmt, ap);
+ vsnprintf(tmp, sizeof(tmp), fmt, ap);
va_end(ap);
/* Sends message to ErrorLog, TapeLog and stdout */
get_krbrlm.o \
dirpath.o \
serverLog.o \
- snprintf.o \
fileutil.o
RXKADOBJS = \
serverLog.o: ${UTIL}/serverLog.c
${AFS_CCRULE} ${UTIL}/serverLog.c
-snprintf.o: ${UTIL}/snprintf.c
- ${AFS_CCRULE} ${UTIL}/snprintf.c
-
fileutil.o: ${UTIL}/fileutil.c
${AFS_CCRULE} ${UTIL}/fileutil.c
}
if (pfile == NULL) {
- afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB0", pbase);
+ snprintf(pbuffer, sizeof(pbuffer), "%s.DB0", pbase);
pfile = pbuffer;
}
if ((dbase_fd = open(pfile, (wflag ? O_RDWR : O_RDONLY) | O_CREAT, 0600))
get_krbrlm.o \
dirpath.o \
serverLog.o \
- snprintf.o \
fileutil.o
RXKADOBJS = \
serverLog.o: ${UTIL}/serverLog.c
${AFS_CCRULE} ${UTIL}/serverLog.c
-snprintf.o: ${UTIL}/snprintf.c
- ${AFS_CCRULE} ${UTIL}/snprintf.c
-
fileutil.o: ${UTIL}/fileutil.c
${AFS_CCRULE} ${UTIL}/fileutil.c
pr_SNameToId;
afs_get_pag_from_groups;
setpag;
- afs_snprintf;
LogThreadNum;
local:
RXOBJS= rx_pthread.o rxkad_errs.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
+ volparse.o flipbase64.o softsig.o hostparse.o pthread_glock.o
INCLS=\
hostparse.o: ${UTIL}/hostparse.c
$(AFS_CCRULE) $(UTIL)/hostparse.c
-snprintf.o: ${UTIL}/snprintf.c
- $(AFS_CCRULE) $(UTIL)/snprintf.c
-
pthread_glock.o: ${UTIL}/pthread_glock.c
$(AFS_CCRULE) $(UTIL)/pthread_glock.c
RXOBJS= rx_pthread.o rxkad_errs.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
+ volparse.o flipbase64.o softsig.o hostparse.o pthread_glock.o
INCLS=${TOP_INCDIR}/ubik.h \
${TOP_INCDIR}/lock.h \
hostparse.o: ${UTIL}/hostparse.c
$(AFS_CCRULE) $(UTIL)/hostparse.c
-snprintf.o: ${UTIL}/snprintf.c
- $(AFS_CCRULE) $(UTIL)/snprintf.c
-
pthread_glock.o: ${UTIL}/pthread_glock.c
$(AFS_CCRULE) $(UTIL)/pthread_glock.c
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
+ volparse.o flipbase64.o softsig.o hostparse.o pthread_glock.o
LIBS=${RXOBJS} ${UTILOBJS} ${TOP_LIBDIR}/libafsauthent.a ${TOP_LIBDIR}/libafsrpc.a \
${TOP_LIBDIR}/libcom_err.a ${TOP_LIBDIR}/libcmd.a \
hostparse.o: ${UTIL}/hostparse.c
$(AFS_CCRULE) $(UTIL)/hostparse.c
-snprintf.o: ${UTIL}/snprintf.c
- $(AFS_CCRULE) $(UTIL)/snprintf.c
-
pthread_glock.o: ${UTIL}/pthread_glock.c
$(AFS_CCRULE) $(UTIL)/pthread_glock.c
char savedump[MAXPATHLEN];
struct afs_stat status;
- afs_snprintf(savedump, sizeof(savedump), "%s.old", state->fn);
+ snprintf(savedump, sizeof(savedump), "%s.old", state->fn);
if (afs_stat(state->fn, &status) == 0) {
renamefile(state->fn, savedump);
RXOBJS= rx_pthread.o rxkad_errs.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 get_krbrlm.o
+ volparse.o flipbase64.o softsig.o hostparse.o pthread_glock.o \
+ get_krbrlm.o
INCLS=${TOP_INCDIR}/ubik.h \
${TOP_INCDIR}/lwp.h \
hostparse.o: ${UTIL}/hostparse.c
$(AFS_CCRULE) $(UTIL)/hostparse.c
-snprintf.o: ${UTIL}/snprintf.c
- $(AFS_CCRULE) $(UTIL)/snprintf.c
-
pthread_glock.o: ${UTIL}/pthread_glock.c
$(AFS_CCRULE) $(UTIL)/pthread_glock.c
}
/* not found, open it and try to enter in cache */
- afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d", adbase->pathName,
- (afid<0)?"SYS":"", (afid<0)?-afid:afid);
+ snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d", adbase->pathName,
+ (afid<0)?"SYS":"", (afid<0)?-afid:afid);
fd = open(pbuffer, O_CREAT | O_RDWR, 0600);
if (fd < 0) {
/* try opening read-only */
ubik_dprint("setlabel io error=%d\n", code);
goto FetchEndCall;
}
- afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.TMP", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
+ snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.TMP",
+ ubik_dbase->pathName, (file<0)?"SYS":"",
+ (file<0)?-file:file);
fd = open(pbuffer, O_CREAT | O_RDWR | O_TRUNC, 0600);
if (fd < 0) {
code = errno;
urecovery_state |= UBIK_RECHAVEDB;
memcpy(&ubik_dbase->version, &tversion,
sizeof(struct ubik_version));
- afs_snprintf(tbuffer, sizeof(tbuffer), "%s.DB%s%d", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
+ snprintf(tbuffer, sizeof(tbuffer), "%s.DB%s%d",
+ ubik_dbase->pathName, (file<0)?"SYS":"",
+ (file<0)?-file:file);
#ifdef AFS_NT40_ENV
- afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.OLD", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
+ snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.OLD",
+ ubik_dbase->pathName, (file<0)?"SYS":"",
+ (file<0)?-file:file);
code = unlink(pbuffer);
if (!code)
code = rename(tbuffer, pbuffer);
- afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.TMP", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
+ snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.TMP",
+ ubik_dbase->pathName, (file<0)?"SYS":"",
+ (file<0)?-file:file);
#endif
if (!code)
code = rename(pbuffer, tbuffer);
&ubik_dbase->version);
}
#ifdef AFS_NT40_ENV
- afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.OLD", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
+ snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.OLD",
+ ubik_dbase->pathName, (file<0)?"SYS":"",
+ (file<0)?-file:file);
unlink(pbuffer);
#endif
}
offset = 0;
epoch = tversion.epoch = 0; /* start off by labelling in-transit db as invalid */
(*dbase->setlabel) (dbase, file, &tversion); /* setlabel does sync */
- afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.TMP", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
+ snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.TMP",
+ ubik_dbase->pathName, (file<0)?"SYS":"",
+ (file<0)?-file:file);
fd = open(pbuffer, O_CREAT | O_RDWR | O_TRUNC, 0600);
if (fd < 0) {
code = errno;
/* sync data first, then write label and resync (resync done by setlabel call).
* This way, good label is only on good database. */
- afs_snprintf(tbuffer, sizeof(tbuffer), "%s.DB%s%d", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
+ snprintf(tbuffer, sizeof(tbuffer), "%s.DB%s%d",
+ ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
#ifdef AFS_NT40_ENV
- afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.OLD", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
+ snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.OLD",
+ ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
code = unlink(pbuffer);
if (!code)
code = rename(tbuffer, pbuffer);
- afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.TMP", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
+ snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.TMP",
+ ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
#endif
if (!code)
code = rename(pbuffer, tbuffer);
code = (*ubik_dbase->setlabel) (dbase, file, avers);
}
#ifdef AFS_NT40_ENV
- afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.OLD", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
+ snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.OLD",
+ ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
unlink(pbuffer);
#endif
memcpy(&ubik_dbase->version, avers, sizeof(struct ubik_version));
hostparse.o exec.o \
hputil.o kreltime.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 pthread_glock.o \
- tabular_output.o ${REGEX_OBJ}
+ afs_atomlist.o afs_lhash.o pthread_glock.o tabular_output.o \
+ ${REGEX_OBJ}
objects_pic = \
assert_pic.o \
fstab_pic.o \
afs_atomlist_pic.o \
afs_lhash_pic.o \
- snprintf_pic.o \
pthread_glock_pic.o \
tabular_output_pic.o \
${REGEX_OBJ_PIC}
afs_lhash_pic.o: ${srcdir}/afs_lhash.c ${includes}
$(SHD_CCRULE) ${srcdir}/afs_lhash.c
-snprintf_pic.o: ${srcdir}/snprintf.c ${includes}
- $(SHD_CCRULE) ${srcdir}/snprintf.c
-
pthread_glock_pic.o: ${srcdir}/pthread_glock.c ${includes}
$(SHD_CCRULE) ${srcdir}/pthread_glock.c
assert.c base64.c casestrcpy.c ktime.c volparse.c hostparse.c \
hputil.c kreltime.c get_krbrlm.c uuid.c serverLog.c \
dirpath.c fileutil.c netutils.c flipbase64.c \
- afs_atomlist.c afs_lhash.c snprintf.c fstab.c
+ afs_atomlist.c afs_lhash.c fstab.c
$(OUT)\regex.obj \
$(OUT)\readdir_nt.obj \
$(OUT)\serverLog.obj \
- $(OUT)\snprintf.obj \
$(OUT)\uuid.obj \
$(OUT)\volparse.obj \
$(OUT)\winsock_nt.obj \
$(OUT)\regex.obj \
$(OUT)\readdir_nt.obj \
$(OUT)\serverLog_mt.obj \
- $(OUT)\snprintf.obj \
$(OUT)\uuid.obj \
$(OUT)\volparse.obj \
$(OUT)\winsock_nt.obj \
extern int ReOpenLog(const char *fileName);
extern void SetupLogSignals(void);
-extern int
-afs_vsnprintf( /*@out@ */ char *p, size_t avail, const char *fmt,
- va_list ap)
- AFS_ATTRIBUTE_FORMAT(__printf__, 3, 0)
- /*@requires maxSet(p) >= (avail-1)@ */
- /*@modifies p@ */ ;
-
-extern /*@printflike@ */ int
-afs_snprintf( /*@out@ */ char *p, size_t avail, const char *fmt, ...)
- AFS_ATTRIBUTE_FORMAT(__printf__, 3, 4)
- /*@requires maxSet(p) >= (avail-1)@ */
- /*@modifies p@ */ ;
-
-extern int
-afs_vasnprintf (char **ret, size_t max_sz, const char *format, va_list args)
- AFS_ATTRIBUTE_FORMAT(__printf__, 3, 0);
-
-extern int
-afs_vasprintf (char **ret, const char *format, va_list args)
- AFS_ATTRIBUTE_FORMAT(__printf__, 2, 0);
-
-extern int
-afs_asprintf (char **ret, const char *format, ...)
- AFS_ATTRIBUTE_FORMAT(__printf__, 2, 3);
-
-extern int
-afs_asnprintf (char **ret, size_t max_sz, const char *format, ...)
- AFS_ATTRIBUTE_FORMAT(__printf__, 3, 4);
-
/* special version of ctime that clobbers a *different static variable, so
* that ViceLog can call ctime and not cause buffer confusion.
*/
if (mrafsStyleLogs || threadIdLogs) {
num = (*threadNumProgram) ();
if (num > -1) {
- (void)afs_snprintf(info, (sizeof tbuffer) - strlen(tbuffer), "[%d] ",
- num);
- info += strlen(info);
- }
+ snprintf(info, (sizeof tbuffer) - strlen(tbuffer), "[%d] ",
+ num);
+ info += strlen(info);
+ }
}
- (void)afs_vsnprintf(info, (sizeof tbuffer) - strlen(tbuffer), format,
- args);
+ vsnprintf(info, (sizeof tbuffer) - strlen(tbuffer), format, args);
len = strlen(tbuffer);
LOCK_SERVERLOG();
strcpy((char *)&ourName, (char *)fileName);
}
makefilename:
- afs_snprintf(FileName, MAXPATHLEN, "%s.%d%02d%02d%02d%02d%02d",
- ourName, TimeFields->tm_year + 1900,
- TimeFields->tm_mon + 1, TimeFields->tm_mday,
- TimeFields->tm_hour, TimeFields->tm_min,
- TimeFields->tm_sec);
+ snprintf(FileName, MAXPATHLEN, "%s.%d%02d%02d%02d%02d%02d",
+ ourName, TimeFields->tm_year + 1900,
+ TimeFields->tm_mon + 1, TimeFields->tm_mday,
+ TimeFields->tm_hour, TimeFields->tm_min,
+ TimeFields->tm_sec);
if(lstat(FileName, &buf) == 0) {
/* avoid clobbering a log */
TimeFields->tm_sec++;
+++ /dev/null
-/*
- * Copyright (c) 1997 - 2004 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* snprintf.c - Formatted, length-limited print to a string */
-
-#include <afsconfig.h>
-#include <afs/param.h>
-
-#include <roken.h>
-#include <ctype.h>
-
-/* This is an enhanced version of the *printf functionality shipped
- * with Heimdal. In addition to the standard Unix formatting types
- * this version also supports Microsoft's I32 and I64 type modifiers
- * and the OpenAFS I type which is used to generate output from
- * network byte order IPv4 addresses (either dotted notation or
- * hostname lookups. Implementation details follow:
- *
- * - Actually obeys the length limit, which (unfortunately) many
- * implementations of snprintf do not.
- *
- * - Supports all the standard format specifiers for integers
- * (d, i, o, u, x, X), floating-point values (f, e, E, g, G),
- * and strings and characters (c, s, %), plus a few unusual
- * but useful ones described below.
- *
- * - The Microsoft integral size modifiers I32 and I64 are
- * supported. I32 is equivalent to 'l'.
- * I64 is equivalent to 'll'.
- *
- * - Supports all the standard flags (-, 0, +, space, #). These
- * flags are ignored if used when they are not appropriate.
- *
- * - Supports the standard size modifiers for short (h), long (h),
- * and double (L) arguments. These modifiers are ignored if used
- * when they are not appropriate.
- *
- * - Supports minimum field width and precision, where appropriate,
- * including the use of '*' to specify a value given as an argument
- * instead of in the format string. There is a maximum precision
- * of 100 digits.
- *
- * - The 'p' specifier for printing pointers is implemented using
- * intptr_t (C99-standard).
- *
- * - Floating-point specifier (%e, %f, %g) are implemented by
- * calling the standard sprintf, and thus may be unsafe.
- *
- * - The '%...$' notation is used primarily when the format string
- * is specified by the user, who knows but cannot change the order
- * of the arguments. Such usage is inherently dangerous and
- * insecure; thus, it is not supported.
- *
- * - Passing in a format and an NULL buffer is supported. This
- * will compute the size of the buffer required by the format
- * and the provided input parameters.
- *
- * The custom format specifier '%I' is supported. This specifier
- * takes as its argument an unsigned long integer containing an
- * IPv4 address in network byte order. The address is rendered
- * either as a hostname or as a dotted quad, as follows:
- *
- * - If precision is nonzero or unspecified, a hostname lookup
- * is attempted; if it is successful, the hostname is printed.
- * If the hostname lookup fails, the address is printed in
- * dotted-quad notation.
- *
- * - If precision is explicitly specified as 0, then the hostname
- * lookup is skipped, and dotted-quad notation is always used.
- *
- * - If a hostname is to be printed:
- * + The precision controls the maximum number of characters
- * printed, as with %s.
- * + If the '#' flag is specified, any letters in the hostname
- * will be forced to lower case before printing.
- * + If the '+' flag is specified, any letters in the hostname
- * will be forced to upper case before printing. If both
- * '#' and '+' are given, the '+' flag will be ignored.
- * + The '0' and ' ' flags have no effect.
- *
- * - If a dotted quad is to be printed:
- * + The precision has no effect; dotted quads are always
- * 7 to 12 characters in length, depending on the value
- * to be printed and the format flags used.
- * + If the '0' flag is given, each field (byte) of the address
- * will be padded with '0' on the left to three digits.
- * + If the ' ' flag is given, each field (byte) of the address
- * will be padded with spaces on the left to three digits. If
- * both '0' and ' ' are given, the ' ' flag will be ignored.
- * + The '#' and '+' flags have no effect.
- *
- * A test program exists in src/util/tests/snprintf_tests.c.
- */
-
-#define MAXPREC 100
-
-enum format_flags {
- minus_flag = 1,
- plus_flag = 2,
- space_flag = 4,
- alternate_flag = 8,
- zero_flag = 16
-};
-
-/*
- * Common state
- */
-
-struct snprintf_state {
- unsigned char *str;
- unsigned char *s;
- unsigned char *theend;
- size_t sz;
- size_t max_sz;
- void (*append_char)(struct snprintf_state *, unsigned char);
- /* XXX - methods */
-};
-
-static int
-afs_sn_reserve (struct snprintf_state *state, size_t n)
-{
- return state->s + n > state->theend;
-}
-
-static void
-afs_sn_append_char (struct snprintf_state *state, unsigned char c)
-{
- if (!afs_sn_reserve (state, 1))
- *state->s++ = c;
-}
-
-static int
-as_reserve (struct snprintf_state *state, size_t n)
-{
- if (state->s + n > state->theend) {
- size_t off = state->s - state->str;
- unsigned char *tmp;
-
- if (state->max_sz && state->sz >= state->max_sz)
- return 1;
-
- state->sz = max(state->sz * 2, state->sz + n);
- if (state->max_sz)
- state->sz = min(state->sz, state->max_sz);
- tmp = (unsigned char *)realloc (state->str, state->sz);
- if (tmp == NULL)
- return 1;
- state->str = tmp;
- state->s = state->str + off;
- state->theend = state->str + state->sz - 1;
- }
- return 0;
-}
-
-static void
-as_append_char (struct snprintf_state *state, unsigned char c)
-{
- if(!as_reserve (state, 1))
- *state->s++ = c;
-}
-
-static int
-pad(struct snprintf_state *state, int width, char c)
-{
- int len = 0;
- while(width-- > 0){
- (*state->append_char)(state, c);
- ++len;
- }
- return len;
-}
-
-/* return true if we should use alternatve hex form */
-static int
-use_alternative (int flags, afs_uint64 num, unsigned base)
-{
- return (flags & alternate_flag) && base == 16 && num != 0;
-}
-
-static int
-append_number(struct snprintf_state *state,
- afs_uint64 num, unsigned base, const char *rep,
- int width, int prec, int flags, int minusp)
-{
- int len = 0;
- afs_uint64 n = num;
- char nstr[MAXPREC]; /* enough for <192 bit octal integers */
- int nstart, nlen;
- char signchar;
-
- /* given precision, ignore zero flag */
- if(prec != -1)
- flags &= ~zero_flag;
- else
- prec = 1;
-
- /* format number as string */
- nstart = sizeof(nstr);
- nlen = 0;
- nstr[--nstart] = '\0';
-
- do {
- nstr[--nstart] = rep[n % base];
- ++nlen;
- n /= base;
- } while(n);
-
- /* zero value with zero precision should produce no digits */
- if(prec == 0 && num == 0) {
- nlen--;
- nstart++;
- }
-
- /* figure out what char to use for sign */
- if(minusp)
- signchar = '-';
- else if((flags & plus_flag))
- signchar = '+';
- else if((flags & space_flag))
- signchar = ' ';
- else
- signchar = '\0';
-
- if((flags & alternate_flag) && base == 8) {
- /* if necessary, increase the precision to
- make first digit a zero */
-
- /* XXX C99 claims (regarding # and %o) that "if the value and
- precision are both 0, a single 0 is printed", but there is
- no such wording for %x. This would mean that %#.o would
- output "0", but %#.x "". This does not make sense, and is
- also not what other printf implementations are doing. */
-
- if(prec <= nlen && nstr[nstart] != '0' && nstr[nstart] != '\0')
- prec = nlen + 1;
- }
-
- /* possible formats:
- pad | sign | alt | zero | digits
- sign | alt | zero | digits | pad minus_flag
- sign | alt | zero | digits zero_flag */
-
- /* if not right justifying or padding with zeros, we need to
- compute the length of the rest of the string, and then pad with
- spaces */
- if(!(flags & (minus_flag | zero_flag))) {
- if(prec > nlen)
- width -= prec;
- else
- width -= nlen;
-
- if(use_alternative(flags, num, base))
- width -= 2;
-
- if(signchar != '\0')
- width--;
-
- /* pad to width */
- len += pad(state, width, ' ');
- }
- if(signchar != '\0') {
- (*state->append_char)(state, signchar);
- ++len;
- }
- if(use_alternative(flags, num, base)) {
- (*state->append_char)(state, '0');
- (*state->append_char)(state, rep[10] + 23); /* XXX */
- len += 2;
- }
- if(flags & zero_flag) {
- /* pad to width with zeros */
- if(prec - nlen > width - len - nlen)
- len += pad(state, prec - nlen, '0');
- else
- len += pad(state, width - len - nlen, '0');
- } else
- /* pad to prec with zeros */
- len += pad(state, prec - nlen, '0');
-
- while(nstr[nstart] != '\0') {
- (*state->append_char)(state, nstr[nstart++]);
- ++len;
- }
-
- if(flags & minus_flag)
- len += pad(state, width - len, ' ');
-
- return len;
-}
-
-/*
- * return length
- */
-
-static int
-append_string (struct snprintf_state *state,
- const unsigned char *arg,
- int width,
- int prec,
- int flags)
-{
- int len = 0;
-
- if(arg == NULL)
- arg = (const unsigned char*)"(null)";
-
- if(prec != -1)
- width -= prec;
- else
- width -= (int)strlen((const char *)arg);
- if(!(flags & minus_flag))
- len += pad(state, width, ' ');
-
- if (prec != -1) {
- while (*arg && prec--) {
- (*state->append_char) (state, *arg++);
- ++len;
- }
- } else {
- while (*arg) {
- (*state->append_char) (state, *arg++);
- ++len;
- }
- }
- if(flags & minus_flag)
- len += pad(state, width, ' ');
- return len;
-}
-
-static int
-append_char(struct snprintf_state *state,
- unsigned char arg,
- int width,
- int flags)
-{
- int len = 0;
-
- while(!(flags & minus_flag) && --width > 0) {
- (*state->append_char) (state, ' ') ;
- ++len;
- }
- (*state->append_char) (state, arg);
- ++len;
- while((flags & minus_flag) && --width > 0) {
- (*state->append_char) (state, ' ');
- ++len;
- }
- return 0;
-}
-
-#define MAXPREC 100
-static int
-append_float(struct snprintf_state *state,
- char type,
- double arg,
- int width,
- int prec,
- int flags)
-{
- int len = 0;
- char fbuf[20], xbuf[MAXPREC + 21];
-
- sprintf(fbuf, "%%%s%s.*L%c",
- (flags & plus_flag) ? "+" : ((flags & space_flag) ? " " : ((flags & minus_flag) ? "-" : "")),
- (flags & alternate_flag) ? "#" : "", type);
- if (prec == -1)
- prec = 6;
- if (prec > MAXPREC)
- prec = MAXPREC;
- sprintf(xbuf, fbuf, prec, arg);
-
- len = append_string(state, (unsigned char *)xbuf, width, -1, 0);
- return len;
-}
-
-static int
-append_address(struct snprintf_state *state,
- afs_uint32 arg,
- int width,
- int prec,
- int flags)
-{
- int len = 0;
- struct hostent * he;
- struct in_addr ia;
- char * x, *y;
-
- /* IP address:
- * value is provided as a network-order unsigned long integer
- * precision specifies max hostname length, as for %s
- * if precision is explicitly 0, no hostname lookup is done
- * if 0fill specified, IPaddr fields are 0-filled to 3 digits
- * if spsign specified, IPaddr fields are space-filled to 3 digits
- */
- ia.s_addr = arg;
- if (prec == 0)
- he = 0;
- else
- he = gethostbyaddr((char *)&ia, 4, AF_INET);
- if (he) {
- x = he->h_name;
- len = (int)strlen(x);
- if (prec != -1 && prec < len)
- width = prec;
- else
- width = len;
- if (flags & alternate_flag) {
- for (y = x; *y; y++)
- if (isupper(*y))
- *y = tolower(*y);
- } else if (flags & plus_flag) {
- for (y = x; *y; y++)
- if (islower(*y))
- *y = toupper(*y);
- }
- len = append_string(state, (unsigned char *)x, width, prec, 0);
- } else {
- char xbuf[16];
- arg = ntohl(arg);
- if (flags & zero_flag) {
- x = "%03u.%03u.%03u.%03u";
- } else if (flags & space_flag) {
- x = "%3u.%3u.%3u.%3u";
- } else {
- x = "%u.%u.%u.%u";
- }
- /* typecast to whatever '%u' is! */
- sprintf(xbuf, x, (unsigned int)((arg & 0xff000000) >> 24),
- (unsigned int)((arg & 0x00ff0000) >> 16),
- (unsigned int)((arg & 0x0000ff00) >> 8),
- (unsigned int)(arg & 0x000000ff));
- len = append_string(state, (unsigned char *)xbuf, 0, -1, 0);
- }
-
- return len;
-}
-
-/*
- * This can't be made into a function...
- */
-
-#if defined(AFS_NT40_ENV)
-
-#define PARSE_INT_FORMAT(res, arg, unsig) \
-if (long_long_flag) \
- res = (unsig __int64)va_arg(arg, unsig __int64); \
-else if (long_flag || addr_flag) \
- res = (unsig long)va_arg(arg, unsig long); \
-else if (size_t_flag) \
- res = (size_t)va_arg(arg, size_t); \
-else if (short_flag) \
- res = (unsig short)va_arg(arg, unsig int); \
-else \
- res = (unsig int)va_arg(arg, unsig int)
-
-#else /* AFS_NT40_ENV */
-
-#define PARSE_INT_FORMAT(res, arg, unsig) \
-if (long_long_flag) \
- res = (unsig long long)va_arg(arg, unsig long long); \
-else if (long_flag || addr_flag) \
- res = (unsig long)va_arg(arg, unsig long); \
-else if (size_t_flag) \
- res = (size_t)va_arg(arg, size_t); \
-else if (short_flag) \
- res = (unsig short)va_arg(arg, unsig int); \
-else \
- res = (unsig int)va_arg(arg, unsig int)
-#endif
-
-
-/*
- * zyxprintf - return length, as snprintf
- */
-
-static int
-xyzprintf (struct snprintf_state *state, const char *char_format, va_list ap)
-{
- const unsigned char *format = (const unsigned char *)char_format;
- unsigned char c;
- int len = 0;
-
- while((c = *format++)) {
- if (c == '%') {
- int flags = 0;
- int width = 0;
- int prec = -1;
- int size_t_flag = 0;
- int long_long_flag = 0;
- int long_flag = 0;
- int short_flag = 0;
- int addr_flag = 0;
-
- /* flags */
- while((c = *format++)){
- if(c == '-')
- flags |= minus_flag;
- else if(c == '+')
- flags |= plus_flag;
- else if(c == ' ')
- flags |= space_flag;
- else if(c == '#')
- flags |= alternate_flag;
- else if(c == '0')
- flags |= zero_flag;
- else if(c == '\'')
- ; /* just ignore */
- else
- break;
- }
-
- if((flags & space_flag) && (flags & plus_flag))
- flags ^= space_flag;
-
- if((flags & minus_flag) && (flags & zero_flag))
- flags ^= zero_flag;
-
- /* width */
- if (isdigit(c))
- do {
- width = width * 10 + c - '0';
- c = *format++;
- } while(isdigit(c));
- else if(c == '*') {
- width = va_arg(ap, int);
- c = *format++;
- }
-
- /* precision */
- if (c == '.') {
- prec = 0;
- c = *format++;
- if (isdigit(c))
- do {
- prec = prec * 10 + c - '0';
- c = *format++;
- } while(isdigit(c));
- else if (c == '*') {
- prec = va_arg(ap, int);
- c = *format++;
- }
- }
-
- /* size */
-
- if (c == 'h') {
- short_flag = 1;
- c = *format++;
- } else if (c == 'z') {
- size_t_flag = 1;
- c = *format++;
- } else if (c == 'l') {
- long_flag = 1;
- c = *format++;
- if (c == 'l') {
- long_long_flag = 1;
- c = *format++;
- }
- } else if (c == 'I') {
- /* This could be either Microsoft I{32,64} notation */
- c = *format++;
- if (c == '3') {
- long_flag = 1;
- c = *format++;
- if (c == '2') {
- c = *format++;
- }
- } else if (c == '6') {
- long_flag = 1;
- c = *format++;
- if (c == '4') {
- long_long_flag = 1;
- c = *format++;
- }
- } else {
- /* Or the OpenAFS special %I meaning network address */
- addr_flag = 1;
- --format;
- c = 'I';
- }
- } else if (c == 'p') {
- flags |= zero_flag;
- if (prec == -1)
- prec = 2 * sizeof(void *);
- if (sizeof(void *) == sizeof(afs_uint64))
- long_long_flag = 1;
- else if (sizeof(void *) == sizeof(afs_uint32))
- long_flag = 1;
- else
- long_flag = 1;
- }
-
- if(c != 'd' && c != 'i' && c != 'I')
- flags &= ~(plus_flag | space_flag);
-
- switch (c) {
- case 'c' :
- append_char(state, va_arg(ap, int), width, flags);
- ++len;
- break;
- case 's' :
- len += append_string(state,
- va_arg(ap, unsigned char*),
- width,
- prec,
- flags);
- break;
- case 'd' :
- case 'i' : {
- afs_int64 arg;
- afs_uint64 num;
- int minusp = 0;
-
- PARSE_INT_FORMAT(arg, ap, signed);
-
- if (arg < 0) {
- minusp = 1;
- num = -arg;
- } else
- num = arg;
-
- len += append_number (state, num, 10, "0123456789",
- width, prec, flags, minusp);
- break;
- }
- case 'u' : {
- afs_uint64 arg;
-
- PARSE_INT_FORMAT(arg, ap, unsigned);
-
- len += append_number (state, arg, 10, "0123456789",
- width, prec, flags, 0);
- break;
- }
- case 'o' : {
- afs_uint64 arg;
-
- PARSE_INT_FORMAT(arg, ap, unsigned);
-
- len += append_number (state, arg, 010, "01234567",
- width, prec, flags, 0);
- break;
- }
- case 'x' : {
- afs_uint64 arg;
-
- PARSE_INT_FORMAT(arg, ap, unsigned);
-
- len += append_number (state, arg, 0x10, "0123456789abcdef",
- width, prec, flags, 0);
- break;
- }
- case 'X' :{
- afs_uint64 arg;
-
- PARSE_INT_FORMAT(arg, ap, unsigned);
-
- len += append_number (state, arg, 0x10, "0123456789ABCDEF",
- width, prec, flags, 0);
- break;
- }
- case 'p' : {
- afs_uint64 arg = (intptr_t)va_arg(ap, void*);
- len += append_number (state, arg, 0x10, "0123456789ABCDEF",
- width, prec, flags, 0);
- break;
- }
- case 'n' : {
- int *arg = va_arg(ap, int*);
- *arg = (int)(state->s - state->str);
- break;
- }
- case 'I' : {
- afs_uint64 arg;
-
- PARSE_INT_FORMAT(arg, ap, unsigned);
-
- len += append_address (state, (unsigned long)arg, width, prec, flags);
- break;
- }
- case 'e':
- case 'E':
- case 'f':
- case 'g':
- case 'G': {
- double arg = (double)va_arg(ap, double);
-
- len += append_float (state, c, arg, width, prec, flags);
- break;
- }
- case '\0' :
- --format;
- /* FALLTHROUGH */
- case '%' :
- (*state->append_char)(state, c);
- ++len;
- break;
- default :
- (*state->append_char)(state, '%');
- (*state->append_char)(state, c);
- len += 2;
- break;
- }
- } else {
- (*state->append_char) (state, c);
- ++len;
- }
- }
- return len;
-}
-
-
-int
-afs_vsnprintf (char *str, size_t sz, const char *format, va_list args)
-{
- struct snprintf_state state;
- int ret;
- unsigned char *ustr = (unsigned char *)str;
-
- state.max_sz = 0;
- state.sz = sz;
- state.str = ustr;
- state.s = ustr;
- state.theend = ustr + sz - (sz > 0);
- state.append_char = afs_sn_append_char;
-
- ret = xyzprintf (&state, format, args);
- if (state.s != NULL && sz != 0)
- *state.s = '\0';
- return ret;
-}
-
-int
-afs_snprintf (char *str, size_t sz, const char *format, ...)
-{
- va_list args;
- int ret;
-
- va_start(args, format);
- ret = afs_vsnprintf (str, sz, format, args);
- va_end(args);
-
-#ifdef PARANOIA
- {
- int ret2;
- unsigned char *tmp;
-
- tmp = (unsigned char *)malloc (sz);
- if (tmp == NULL)
- abort ();
-
- va_start(args, format);
- ret2 = afs_vsprintf (tmp, format, args);
- va_end(args);
- if (ret != ret2 || strcmp(str, tmp))
- abort ();
- free (tmp);
- }
-#endif
-
- return ret;
-}
-
-int
-afs_vasnprintf (char **ret, size_t max_sz, const char *format, va_list args)
-{
- int st;
- struct snprintf_state state;
-
- state.max_sz = max_sz;
- state.sz = 1;
- state.str = (unsigned char *)malloc(state.sz);
- if (state.str == NULL) {
- *ret = NULL;
- return -1;
- }
- state.s = state.str;
- state.theend = state.s + state.sz - 1;
- state.append_char = as_append_char;
-
- st = xyzprintf (&state, format, args);
- if (st > state.sz) {
- free (state.str);
- *ret = NULL;
- return -1;
- } else {
- char *tmp;
-
- *state.s = '\0';
- tmp = (char *)realloc (state.str, st+1);
- if (tmp == NULL) {
- free (state.str);
- *ret = NULL;
- return -1;
- }
- *ret = tmp;
- return st;
- }
-}
-
-int
-afs_vasprintf (char **ret, const char *format, va_list args)
-{
- return afs_vasnprintf (ret, 0, format, args);
-}
-
-int
-afs_asprintf (char **ret, const char *format, ...)
-{
- va_list args;
- int val;
-
- va_start(args, format);
- val = afs_vasprintf (ret, format, args);
- va_end(args);
-
-#ifdef PARANOIA
- {
- int ret2;
- unsigned char *tmp;
- tmp = (unsigned char *)malloc (val + 1);
- if (tmp == NULL)
- abort ();
-
- va_start(args, format);
- ret2 = afs_vsprintf (tmp, format, args);
- va_end(args);
- if (val != ret2 || strcmp(*ret, tmp))
- abort ();
- free (tmp);
- }
-#endif
-
- return val;
-}
-
-int
-afs_asnprintf (char **ret, size_t max_sz, const char *format, ...)
-{
- va_list args;
- int val;
-
- va_start(args, format);
- val = afs_vasnprintf (ret, max_sz, format, args);
-
-#ifdef PARANOIA
- {
- int ret2;
- unsigned char *tmp;
- tmp = (unsigned char *)malloc (val + 1);
- if (tmp == NULL)
- abort ();
-
- ret2 = afs_vsprintf (tmp, format, args);
- if (val != ret2 || strcmp(*ret, tmp))
- abort ();
- free (tmp);
- }
-#endif
-
- va_end(args);
- return val;
-}
-
-
-#ifndef AFS_NT40_ENV
-#ifndef HAVE_VSYSLOG
-void
-vsyslog(int priority, const char *format, va_list args)
-{
- char buf[1024];
- afs_vsnprintf(buf, sizeof(buf), format, args);
- syslog(priority, "%s", buf);
-}
-#endif
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2000 - 2001 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of KTH nor the names of its contributors may be
- * used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY KTH AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KTH OR ITS CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
-
-#include <afs/stds.h>
-#include <afs/afsutil.h>
-#include <limits.h>
-
-static int
-try (const char *format, ...)
-{
- int ret;
- va_list ap;
- char buf1[256], buf2[256];
-
- va_start (ap, format);
- ret = afs_vsnprintf (buf1, sizeof(buf1), format, ap);
- if (ret >= sizeof(buf1)) {
- fprintf(stderr, "increase buf and try again\n");
- exit(1);
- }
- va_end (ap);
- va_start (ap, format);
- vsprintf (buf2, format, ap);
- ret = strcmp (buf1, buf2);
- if (ret)
- printf ("failed: format = \"%s\", \"%s\" != \"%s\"\n",
- format, buf1, buf2);
- va_end (ap);
- return ret;
-}
-
-static int
-cmp_with_sprintf_int (void)
-{
- int tot = 0;
- int int_values[] = {INT_MIN, -17, -1, 0, 1, 17, 4711, 65535, INT_MAX};
- int i;
-
- for (i = 0; i < sizeof(int_values) / sizeof(int_values[0]); ++i) {
- tot += try ("%d", int_values[i]);
- tot += try ("%x", int_values[i]);
- tot += try ("%X", int_values[i]);
- tot += try ("%o", int_values[i]);
- tot += try ("%#x", int_values[i]);
- tot += try ("%#X", int_values[i]);
- tot += try ("%#o", int_values[i]);
- tot += try ("%10d", int_values[i]);
- tot += try ("%10x", int_values[i]);
- tot += try ("%10X", int_values[i]);
- tot += try ("%10o", int_values[i]);
- tot += try ("%#10x", int_values[i]);
- tot += try ("%#10X", int_values[i]);
- tot += try ("%#10o", int_values[i]);
- tot += try ("%-10d", int_values[i]);
- tot += try ("%-10x", int_values[i]);
- tot += try ("%-10X", int_values[i]);
- tot += try ("%-10o", int_values[i]);
- tot += try ("%-#10x", int_values[i]);
- tot += try ("%-#10X", int_values[i]);
- tot += try ("%-#10o", int_values[i]);
- }
- return tot;
-}
-
-static int
-cmp_with_sprintf_long (void)
-{
- int tot = 0;
- long long_values[] = {LONG_MIN, -17, -1, 0, 1, 17, 4711, 65535, LONG_MAX};
- int i;
-
- for (i = 0; i < sizeof(long_values) / sizeof(long_values[0]); ++i) {
- tot += try ("%ld", long_values[i]);
- tot += try ("%lx", long_values[i]);
- tot += try ("%lX", long_values[i]);
- tot += try ("%lo", long_values[i]);
- tot += try ("%#lx", long_values[i]);
- tot += try ("%#lX", long_values[i]);
- tot += try ("%#lo", long_values[i]);
- tot += try ("%10ld", long_values[i]);
- tot += try ("%10lx", long_values[i]);
- tot += try ("%10lX", long_values[i]);
- tot += try ("%10lo", long_values[i]);
- tot += try ("%#10lx", long_values[i]);
- tot += try ("%#10lX", long_values[i]);
- tot += try ("%#10lo", long_values[i]);
- tot += try ("%-10ld", long_values[i]);
- tot += try ("%-10lx", long_values[i]);
- tot += try ("%-10lX", long_values[i]);
- tot += try ("%-10lo", long_values[i]);
- tot += try ("%-#10lx", long_values[i]);
- tot += try ("%-#10lX", long_values[i]);
- tot += try ("%-#10lo", long_values[i]);
- }
- return tot;
-}
-
-#ifdef HAVE_LONG_LONG
-
-/* XXX doesn't work as expected on lp64 platforms with sizeof(long
- * long) == sizeof(long) */
-
-static int
-cmp_with_sprintf_long_long (void)
-{
- int tot = 0;
- long long long_long_values[] = {
- ((long long)LONG_MIN) -1, LONG_MIN, -17, -1,
- 0,
- 1, 17, 4711, 65535, LONG_MAX, ((long long)LONG_MAX) + 1};
- int i;
-
- for (i = 0; i < sizeof(long_long_values) / sizeof(long_long_values[0]); ++i) {
- tot += try ("%lld", long_long_values[i]);
- tot += try ("%llx", long_long_values[i]);
- tot += try ("%llX", long_long_values[i]);
- tot += try ("%llo", long_long_values[i]);
- tot += try ("%#llx", long_long_values[i]);
- tot += try ("%#llX", long_long_values[i]);
- tot += try ("%#llo", long_long_values[i]);
- tot += try ("%10lld", long_long_values[i]);
- tot += try ("%10llx", long_long_values[i]);
- tot += try ("%10llX", long_long_values[i]);
- tot += try ("%10llo", long_long_values[i]);
- tot += try ("%#10llx", long_long_values[i]);
- tot += try ("%#10llX", long_long_values[i]);
- tot += try ("%#10llo", long_long_values[i]);
- tot += try ("%-10lld", long_long_values[i]);
- tot += try ("%-10llx", long_long_values[i]);
- tot += try ("%-10llX", long_long_values[i]);
- tot += try ("%-10llo", long_long_values[i]);
- tot += try ("%-#10llx", long_long_values[i]);
- tot += try ("%-#10llX", long_long_values[i]);
- tot += try ("%-#10llo", long_long_values[i]);
- }
- return tot;
-}
-
-#endif
-
-#if defined(AFS_NT40_ENV)
-
-static int
-cmp_with_sprintf_I64 (void)
-{
- int tot = 0;
- __int64 int64_values[] = {
- ((__int64)LONG_MIN) -1, LONG_MIN, -17, -1,
- 0,
- 1, 17, 4711, 65535, LONG_MAX, ((__int64)LONG_MAX) + 1};
- int i;
-
- for (i = 0; i < sizeof(int64_values) / sizeof(int64_values[0]); ++i) {
- tot += try ("%I64d", int64_values[i]);
- tot += try ("%I64x", int64_values[i]);
- tot += try ("%I64X", int64_values[i]);
- tot += try ("%I64o", int64_values[i]);
- tot += try ("%#I64x", int64_values[i]);
- tot += try ("%#I64X", int64_values[i]);
- tot += try ("%#I64o", int64_values[i]);
- tot += try ("%10I64d", int64_values[i]);
- tot += try ("%10I64x", int64_values[i]);
- tot += try ("%10I64X", int64_values[i]);
- tot += try ("%10I64o", int64_values[i]);
- tot += try ("%#10I64x", int64_values[i]);
- tot += try ("%#10I64X", int64_values[i]);
- tot += try ("%#10I64o", int64_values[i]);
- tot += try ("%-10I64d", int64_values[i]);
- tot += try ("%-10I64x", int64_values[i]);
- tot += try ("%-10I64X", int64_values[i]);
- tot += try ("%-10I64o", int64_values[i]);
- tot += try ("%-#10I64x", int64_values[i]);
- tot += try ("%-#10I64X", int64_values[i]);
- tot += try ("%-#10I64o", int64_values[i]);
- }
- return tot;
-}
-
-#endif
-
-static int
-cmp_with_sprintf_float (void)
-{
- int tot = 0;
- double double_values[] = {-99999, -999, -17.4, -4.3, -3.0, -1.5, -1,
- 0, 0.1, 0.2342374852, 0.2340007,
- 3.1415926, 14.7845, 34.24758, 9999, 9999999};
- int i;
-
- for (i = 0; i < sizeof(double_values) / sizeof(double_values[0]); ++i) {
- tot += try ("%f", double_values[i]);
- tot += try ("%10f", double_values[i]);
- tot += try ("%.2f", double_values[i]);
- tot += try ("%7.0f", double_values[i]);
- tot += try ("%5.2f", double_values[i]);
- tot += try ("%0f", double_values[i]);
- tot += try ("%#f", double_values[i]);
- tot += try ("%e", double_values[i]);
- tot += try ("%10e", double_values[i]);
- tot += try ("%.2e", double_values[i]);
- tot += try ("%7.0e", double_values[i]);
- tot += try ("%5.2e", double_values[i]);
- tot += try ("%0e", double_values[i]);
- tot += try ("%#e", double_values[i]);
- tot += try ("%E", double_values[i]);
- tot += try ("%10E", double_values[i]);
- tot += try ("%.2E", double_values[i]);
- tot += try ("%7.0E", double_values[i]);
- tot += try ("%5.2E", double_values[i]);
- tot += try ("%0E", double_values[i]);
- tot += try ("%#E", double_values[i]);
- tot += try ("%g", double_values[i]);
- tot += try ("%10g", double_values[i]);
- tot += try ("%.2g", double_values[i]);
- tot += try ("%7.0g", double_values[i]);
- tot += try ("%5.2g", double_values[i]);
- tot += try ("%0g", double_values[i]);
- tot += try ("%#g", double_values[i]);
- tot += try ("%G", double_values[i]);
- tot += try ("%10G", double_values[i]);
- tot += try ("%.2G", double_values[i]);
- tot += try ("%7.0G", double_values[i]);
- tot += try ("%5.2G", double_values[i]);
- tot += try ("%0G", double_values[i]);
- tot += try ("%#G", double_values[i]);
- }
- return tot;
-}
-
-static int
-test_null (void)
-{
- return afs_snprintf (NULL, 0, "foo") != 3;
-}
-
-static int
-test_sizet (void)
-{
- int tot = 0;
- size_t sizet_values[] = { 0, 1, 2, 200, 4294967295u
-#ifdef _WIN64
- ,0xffffffffffffffffui64
-#endif
- }; /* SIZE_MAX */
- char *result[] = { "0", "1", "2", "200", "4294967295"
-#ifdef _WIN64
- ,"18446744073709551615"
-#endif
- };
- int i;
-
- for (i = 0; i < sizeof(sizet_values) / sizeof(sizet_values[0]); ++i) {
-#if 0
- tot += try("%zu", sizet_values[i]);
- tot += try("%zx", sizet_values[i]);
- tot += try("%zX", sizet_values[i]);
-#else
- char buf[256];
- afs_snprintf(buf, sizeof(buf), "%zu", sizet_values[i]);
- if (strcmp(buf, result[i]) != 0) {
- printf("%s != %s", buf, result[i]);
- tot++;
- }
-#endif
- }
- return tot;
-}
-
-static int
-test_ptr (void)
-{
- int tot = 0;
- void * ptr;
-
- if (sizeof(ptr) == 4) {
- ptr = (void *)0x12345678;
- tot += try ("%p", ptr);
- tot += try ("%#p", ptr);
- tot += try ("%4p", ptr);
- tot += try ("%#4p", ptr);
- tot += try ("%-4p", ptr);
- tot += try ("%-#4p", ptr);
- } else if (sizeof(ptr) == 8) {
- ptr = (void *)0x0102030405060708;
- tot += try ("%p", ptr);
- tot += try ("%#p", ptr);
- tot += try ("%8p", ptr);
- tot += try ("%#8p", ptr);
- tot += try ("%-8p", ptr);
- tot += try ("%-#8p", ptr);
- }
-
-
- return tot;
-}
-
-static int
-test_ipaddr (void)
-{
- int tot = 0;
- struct hostent * he = gethostbyname("www.openafs.org");
- char buf[256];
- unsigned long addr;
-
- if (!he) {
- fprintf(stderr, "gethostbyname failure\n");
- tot = 1;
- }
- addr = *((unsigned long *)he->h_addr);
- afs_snprintf(buf, sizeof(buf), "%I", addr);
- if (strcmp(buf, "OPENAFS.ORG")) {
- fprintf(stderr, "%s != %s\n", buf, "OPENAFS.ORG");
- tot++;
- }
- afs_snprintf(buf, sizeof(buf), "%+I", addr);
- if (strcmp(buf, "OPENAFS.ORG")) {
- fprintf(stderr, "%s != %s\n", buf, "OPENAFS.ORG");
- tot++;
- }
- afs_snprintf(buf, sizeof(buf), "%#I", addr);
- if (strcmp(buf, "openafs.org")) {
- fprintf(stderr, "%s != %s\n", buf, "openafs.org");
- tot++;
- }
- afs_snprintf(buf, sizeof(buf), "%.7I", addr);
- if (strcmp(buf, "OPENAFS")) {
- fprintf(stderr, "%s != %s\n", buf, "OPENAFS");
- tot++;
- }
- afs_snprintf(buf, sizeof(buf), "%.0I", addr);
- if (strcmp(buf, "128.2.200.90")) {
- fprintf(stderr, "%s != %s\n", buf, "128.2.200.90");
- tot++;
- }
- afs_snprintf(buf, sizeof(buf), "%0.0I", addr);
- if (strcmp(buf, "128.002.200.090")) {
- fprintf(stderr, "%s != %s\n", buf, "128.002.200.090");
- tot++;
- }
- afs_snprintf(buf, sizeof(buf), "% .0I", addr);
- if (strcmp(buf, "128. 2.200. 90")) {
- fprintf(stderr, "%s != %s\n", buf, "128. 2.200. 90");
- tot++;
- }
-
- return tot;
-}
-
-
-int
-main (int argc, char **argv)
-{
- int ret = 0;
-
-#ifdef AFS_NT40_ENV
- afs_winsockInit();
-#endif
-
- ret += cmp_with_sprintf_int ();
- ret += cmp_with_sprintf_long ();
-#ifdef HAVE_LONG_LONG
- ret += cmp_with_sprintf_long_long ();
-#endif
-#if defined(AFS_NT40_ENV)
- ret += cmp_with_sprintf_I64 ();
-#endif
- ret += cmp_with_sprintf_float ();
- ret += test_null ();
- ret += test_sizet ();
- ret += test_ptr ();
- ret += test_ipaddr ();
-
-#ifdef AFS_NT40_ENV
- afs_winsockCleanup();
-#endif
-
- return ret;
-}
#include <afsconfig.h>
#include <afs/param.h>
+#include <roken.h>
#include <stdio.h>
#include <sys/types.h>
* install this special message catalog in with internationalization
* catalogs.
*/
- afs_snprintf(nls_filename, sizeof(nls_filename), "%s/C/%s.cat",
- AFSDIR_CLIENT_DATA_DIRPATH, filename_prefix);
+ snprintf(nls_filename, sizeof(nls_filename), "%s/C/%s.cat",
+ AFSDIR_CLIENT_DATA_DIRPATH, filename_prefix);
catd = catopen(nls_filename, 0);
if (catd == (nl_catd) -1) {
if (alen != vlen) {
afs_int64 alen64 = alen, vlen64 = vlen;
ViceLog(0, ("Fid %lu.%lu.%lu has inconsistent length (index "
- "%" AFS_INT64_FMT ", inode %" AFS_INT64_FMT "); volume "
- "must be salvaged\n",
+ "%lld inode %lld ); volume must be salvaged\n",
afs_printable_uint32_lu(vp->hashid),
afs_printable_uint32_lu(Vn_id(vnp)),
afs_printable_uint32_lu(vnp->disk.uniquifier),
AdjustDiskUsage(volptr, BlocksPreallocatedForVnode,
BlocksPreallocatedForVnode))) {
ViceLog(25,
- ("Insufficient space to allocate %" AFS_INT64_FMT " blocks\n",
+ ("Insufficient space to allocate %lld blocks\n",
(afs_intmax_t) BlocksPreallocatedForVnode));
return (errorCode);
}
H_UNLOCK;
return flags;
}
- (void)afs_snprintf(tmpStr, sizeof tmpStr,
- "Host %s:%d down = %d, LastCall %s",
- afs_inet_ntoa_r(host->host, hoststr),
- ntohs(host->port), (host->hostFlags & VENUSDOWN),
- afs_ctime(&LastCall, tbuffer,
- sizeof(tbuffer)));
+ snprintf(tmpStr, sizeof tmpStr, "Host %s:%d down = %d, LastCall %s",
+ afs_inet_ntoa_r(host->host, hoststr),
+ ntohs(host->port), (host->hostFlags & VENUSDOWN),
+ afs_ctime(&LastCall, tbuffer, sizeof(tbuffer)));
(void)STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
for (client = host->FirstClient; client; client = client->next) {
if (!client->deleted) {
- expTime = client->expTime;
- (void)afs_snprintf(tmpStr, sizeof tmpStr,
- " user id=%d, name=%s, sl=%s till %s",
- client->ViceId, h_UserName(client),
- client->
- authClass ? "Authenticated" :
- "Not authenticated",
- client->
- authClass ? afs_ctime(&expTime, tbuffer,
- sizeof(tbuffer))
- : "No Limit\n");
- (void)STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
- (void)afs_snprintf(tmpStr, sizeof tmpStr, " CPS-%d is [",
- client->CPS.prlist_len);
+ expTime = client->expTime;
+ snprintf(tmpStr, sizeof tmpStr,
+ " user id=%d, name=%s, sl=%s till %s",
+ client->ViceId, h_UserName(client),
+ client->authClass ? "Authenticated"
+ : "Not authenticated",
+ client->authClass ? afs_ctime(&expTime, tbuffer,
+ sizeof(tbuffer))
+ : "No Limit\n");
+ (void)STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
+ snprintf(tmpStr, sizeof tmpStr, " CPS-%d is [",
+ client->CPS.prlist_len);
(void)STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
if (client->CPS.prlist_val) {
for (i = 0; i < client->CPS.prlist_len; i++) {
- (void)afs_snprintf(tmpStr, sizeof tmpStr, " %d",
- client->CPS.prlist_val[i]);
+ snprintf(tmpStr, sizeof tmpStr, " %d",
+ client->CPS.prlist_val[i]);
(void)STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
}
}
return;
}
now = FT_ApproxTime();
- (void)afs_snprintf(tmpStr, sizeof tmpStr, "List of active users at %s\n",
- afs_ctime(&now, tbuffer, sizeof(tbuffer)));
+ snprintf(tmpStr, sizeof tmpStr, "List of active users at %s\n",
+ afs_ctime(&now, tbuffer, sizeof(tbuffer)));
(void)STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
h_Enumerate(h_PrintClient, (char *)file);
STREAM_REALLYCLOSE(file);
char hoststr[16];
H_LOCK;
- (void)afs_snprintf(tmpStr, sizeof tmpStr,
- "ip:%s port:%d hidx:%d cbid:%d lock:%x last:%u active:%u down:%d del:%d cons:%d cldel:%d\n\t hpfailed:%d hcpsCall:%u hcps [",
- afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port), host->index,
- host->cblist, CheckLock(&host->lock), host->LastCall,
- host->ActiveCall, (host->hostFlags & VENUSDOWN),
- host->hostFlags & HOSTDELETED, host->Console,
- host->hostFlags & CLIENTDELETED, host->hcpsfailed,
- host->cpsCall);
+ snprintf(tmpStr, sizeof tmpStr,
+ "ip:%s port:%d hidx:%d cbid:%d lock:%x last:%u active:%u "
+ "down:%d del:%d cons:%d cldel:%d\n\t hpfailed:%d hcpsCall:%u "
+ "hcps [",
+ afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port),
+ host->index, host->cblist, CheckLock(&host->lock),
+ host->LastCall, host->ActiveCall, (host->hostFlags & VENUSDOWN),
+ host->hostFlags & HOSTDELETED, host->Console,
+ host->hostFlags & CLIENTDELETED, host->hcpsfailed,
+ host->cpsCall);
(void)STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
if (host->hcps.prlist_val)
for (i = 0; i < host->hcps.prlist_len; i++) {
- (void)afs_snprintf(tmpStr, sizeof tmpStr, " %d",
- host->hcps.prlist_val[i]);
+ snprintf(tmpStr, sizeof tmpStr, " %d", host->hcps.prlist_val[i]);
(void)STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
}
sprintf(tmpStr, "] [");
return;
}
now = FT_ApproxTime();
- (void)afs_snprintf(tmpStr, sizeof tmpStr, "List of active hosts at %s\n",
- afs_ctime(&now, tbuffer, sizeof(tbuffer)));
+ snprintf(tmpStr, sizeof tmpStr, "List of active hosts at %s\n",
+ afs_ctime(&now, tbuffer, sizeof(tbuffer)));
(void)STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
h_Enumerate(h_DumpHost, (char *)file);
STREAM_REALLYCLOSE(file);
int fd;
/* Create the inode directory if we're starting for the first time */
- (void)afs_snprintf(filename, sizeof filename, "%s" OS_DIRSEP "%s", partition,
- INODEDIR);
+ snprintf(filename, sizeof filename, "%s" OS_DIRSEP "%s", partition,
+ INODEDIR);
mkdir(filename, 0700);
- (void)afs_snprintf(filename, sizeof filename, "%s" OS_DIRSEP "%s" OS_DIRSEP "README",
- partition, INODEDIR);
+ snprintf(filename, sizeof filename,
+ "%s" OS_DIRSEP "%s" OS_DIRSEP "README",
+ partition, INODEDIR);
fd = OS_OPEN(filename, O_WRONLY | O_CREAT | O_TRUNC, 0444);
if (fd != INVALID_FD) {
(void)OS_WRITE(fd, VICE_README, strlen(VICE_README));
int i;
*created = 0;
- afs_snprintf(tmp, 256, "%s" OS_DIRSEP "%s", name->n_drive, name->n_voldir);
+ snprintf(tmp, 256, "%s" OS_DIRSEP "%s", name->n_drive, name->n_voldir);
if (mkdir(tmp) < 0) {
if (errno != EEXIST)
char tmp[256];
int i;
- afs_snprintf(tmp, 256, "%s" OS_DIRSEP "%s", name->n_drive, name->n_voldir);
+ snprintf(tmp, 256, "%s" OS_DIRSEP "%s", name->n_drive, name->n_voldir);
path = tmp;
path += strlen(path);
} else {
IHandle_t *th;
IH_INIT(th, ih->ih_dev, ih->ih_vid, ino);
- Log("Warning: Lost ref on ihandle dev %d vid %d ino %" AFS_INT64_FMT "\n",
+ Log("Warning: Lost ref on ihandle dev %d vid %d ino %lld\n",
th->ih_dev, th->ih_vid, (afs_int64)th->ih_ino);
IH_RELEASE(th);
fdP = IH_OPEN(h);
if (!fdP)
return EIO;
- afs_snprintf(path, sizeof(path), "%s-tmp", name.n_path);
+ snprintf(path, sizeof(path), "%s-tmp", name.n_path);
fd = OS_OPEN(path, O_CREAT | O_EXCL | O_TRUNC | O_RDWR, 0);
if (fd == INVALID_FD) {
FDH_CLOSE(fdP);
#else
if (*dp1->d_name == '.')
continue;
- afs_snprintf(path2, sizeof(path2), "%s" OS_DIRSEP "%s", name.n_path,
- dp1->d_name);
+ snprintf(path2, sizeof(path2), "%s" OS_DIRSEP "%s", name.n_path,
+ dp1->d_name);
dirp2 = opendir(path2);
if (dirp2) {
while ((dp2 = readdir(dirp2))) {
} else {
char path2[512];
/* Open this handle */
- (void)afs_snprintf(path2, sizeof(path2),
- "%s" OS_DIRSEP "%s", path1, dname);
+ snprintf(path2, sizeof(path2),
+ "%s" OS_DIRSEP "%s", path1, dname);
linkHandle->fd_fd = OS_OPEN(path2, Testing ? O_RDONLY : O_RDWR, 0666);
info.linkCount =
namei_GetLinkCount(linkHandle, (Inode) 0, 1, 1, Testing);
#ifndef AFS_NT40_ENV /* This level missing on Windows */
/* Now we've got a next level subdir. */
- afs_snprintf(path2, sizeof(path2), "%s" OS_DIRSEP "%s", path1, dp1->d_name);
+ snprintf(path2, sizeof(path2), "%s" OS_DIRSEP "%s",
+ path1, dp1->d_name);
dirp2 = opendir(path2);
if (dirp2) {
while ((dp2 = readdir(dirp2))) {
continue;
/* Now we've got to the actual data */
- afs_snprintf(path3, sizeof(path3), "%s" OS_DIRSEP "%s", path2,
- dp2->d_name);
+ snprintf(path3, sizeof(path3), "%s" OS_DIRSEP "%s",
+ path2, dp2->d_name);
#else
/* Now we've got to the actual data */
- afs_snprintf(path3, sizeof(path3), "%s" OS_DIRSEP "%s", path1,
- dp1->d_name);
+ snprintf(path3, sizeof(path3), "%s" OS_DIRSEP "%s",
+ path1, dp1->d_name);
#endif
dirp3 = opendir(path3);
if (dirp3) {
FdHandle_t linkHandle;
char dirl;
- afs_snprintf(fpath, sizeof(fpath), "%s" OS_DIRSEP "%s", dpath, name);
+ snprintf(fpath, sizeof(fpath), "%s" OS_DIRSEP "%s", dpath, name);
dirH = FindFirstFileEx(fpath, FindExInfoStandard, &data,
FindExSearchNameMatch, NULL,
int parm, tag;
lb64_string_t check;
- afs_snprintf(fpath, sizeof(fpath), "%s" OS_DIRSEP "%s", dpath, name);
+ snprintf(fpath, sizeof(fpath), "%s" OS_DIRSEP "%s", dpath, name);
if (afs_stat(fpath, &status) < 0) {
return -1;
t_ih.ih_dev = ih->ih_dev;
t_ih.ih_vid = ih->ih_vid;
- (void)afs_snprintf(oldpath, sizeof oldpath, "%s" OS_DIRSEP "%s", dir_name,
- infoName);
+ snprintf(oldpath, sizeof oldpath, "%s" OS_DIRSEP "%s", dir_name,
+ infoName);
fd = OS_OPEN(oldpath, O_RDWR, 0);
if (fd == INVALID_FD) {
Log("1 namei_ConvertROtoRWvolume: could not open RO info file: %s\n",
t_ih.ih_ino = namei_MakeSpecIno(ih->ih_vid, VI_SMALLINDEX);
namei_HandleToName(&n, &t_ih);
- (void)afs_snprintf(newpath, sizeof newpath, "%s" OS_DIRSEP "%s", dir_name,
- smallName);
+ snprintf(newpath, sizeof newpath, "%s" OS_DIRSEP "%s", dir_name,
+ smallName);
fd = OS_OPEN(newpath, O_RDWR, 0);
if (fd == INVALID_FD) {
Log("1 namei_ConvertROtoRWvolume: could not open SmallIndex file: %s\n", newpath);
t_ih.ih_ino = namei_MakeSpecIno(ih->ih_vid, VI_LARGEINDEX);
namei_HandleToName(&n, &t_ih);
- (void)afs_snprintf(newpath, sizeof newpath, "%s" OS_DIRSEP "%s", dir_name,
- largeName);
+ snprintf(newpath, sizeof newpath, "%s" OS_DIRSEP "%s", dir_name,
+ largeName);
fd = OS_OPEN(newpath, O_RDWR, 0);
if (fd == INVALID_FD) {
Log("1 namei_ConvertROtoRWvolume: could not open LargeIndex file: %s\n", newpath);
if (!s)
s = result;
- (void)afs_snprintf(s, sizeof(afs_ino_str_t), "%" AFS_UINT64_FMT, (afs_uintmax_t) ino);
+ snprintf(s, sizeof(afs_ino_str_t), "%llu", (afs_uintmax_t) ino);
return s;
}
dp->vol_list.busy = 0;
{
char lockpath[MAXPATHLEN+1];
- afs_snprintf(lockpath, MAXPATHLEN, "%s/" AFS_PARTLOCK_FILE, dp->name);
+ snprintf(lockpath, MAXPATHLEN, "%s/" AFS_PARTLOCK_FILE, dp->name);
lockpath[MAXPATHLEN] = '\0';
VLockFileInit(&dp->headerLockFile, lockpath);
- afs_snprintf(lockpath, MAXPATHLEN, "%s/" AFS_VOLUMELOCK_FILE, dp->name);
+ snprintf(lockpath, MAXPATHLEN, "%s/" AFS_VOLUMELOCK_FILE, dp->name);
lockpath[MAXPATHLEN] = '\0';
VLockFileInit(&dp->volLockFile, lockpath);
}
struct DiskPartition64 *dp;
for (dp = DiskPartitionList; dp; dp = dp->next) {
if (dp->free < 0) {
- Log("Partition %s: %"AFS_INT64_FMT
- " available 1K blocks (minfree=%"AFS_INT64_FMT"), "
- "overallocated by %"AFS_INT64_FMT" blocks\n", dp->name,
+ Log("Partition %s: %lld "
+ " available 1K blocks (minfree=%lld), "
+ "overallocated by %lld blocks\n", dp->name,
dp->totalUsable, dp->minFree, -dp->free);
} else {
- Log("Partition %s: %"AFS_INT64_FMT
- " available 1K blocks (minfree=%"AFS_INT64_FMT"), "
- "%"AFS_INT64_FMT" free blocks\n", dp->name,
+ Log("Partition %s: %lld"
+ " available 1K blocks (minfree=%lld), "
+ "%lld free blocks\n", dp->name,
dp->totalUsable, dp->minFree, dp->free);
}
}
* another thread may have held the lock on the FILE
* structure when fork was called! */
- afs_snprintf(childLog, sizeof(childLog), "%s.%d",
- AFSDIR_SERVER_SLVGLOG_FILEPATH, getpid());
+ snprintf(childLog, sizeof(childLog), "%s.%d",
+ AFSDIR_SERVER_SLVGLOG_FILEPATH, getpid());
logFile = afs_fopen(childLog, "a");
if (!logFile) { /* still nothing, use stdout */
char fn[AFSDIR_PATH_MAX];
static char buf[LOG_XFER_BUF_SIZE];
- afs_snprintf(fn, sizeof(fn), "%s.%d",
- AFSDIR_SERVER_SLVGLOG_FILEPATH, pid);
+ snprintf(fn, sizeof(fn), "%s.%d",
+ AFSDIR_SERVER_SLVGLOG_FILEPATH, pid);
pidlog = open(fn, O_RDONLY);
char prefix[AFSDIR_PATH_MAX];
size_t prefix_len;
- afs_snprintf(prefix, sizeof(prefix), "%s.", AFSDIR_SLVGLOG_FILE);
+ snprintf(prefix, sizeof(prefix), "%s.", AFSDIR_SLVGLOG_FILE);
prefix_len = strlen(prefix);
dp = opendir(AFSDIR_LOGS_DIR);
char buf[32];
(void)strftime(buf, 32, "%Y/%m/%d.%H:%M:%S", tm); /* NT does not have %T */
- (void)afs_snprintf(results[next = (next + 1) & 7], MAX_DATE_RESULT,
- "%lu (%s)", (unsigned long)date, buf);
+ snprintf(results[next = (next + 1) & 7], MAX_DATE_RESULT,
+ "%lu (%s)", (unsigned long)date, buf);
return results[next];
}
exit(1);
}
}
- (void)afs_snprintf(name1, sizeof name1, VFORMAT,
- afs_printable_uint32_lu(volumeId));
+ snprintf(name1, sizeof name1, VFORMAT,
+ afs_printable_uint32_lu(volumeId));
if (dsizeOnly && !saveinodes)
printf
("Volume-Id\t Volsize Auxsize Inodesize AVolsize SizeDiff (VolName)\n");
} else {
afs_sfsize_t n;
- (void)afs_snprintf(headerName, sizeof headerName, "%s" OS_DIRSEP "%s",
- VPartitionPath(dp), name);
+ snprintf(headerName, sizeof headerName, "%s" OS_DIRSEP "%s",
+ VPartitionPath(dp), name);
if ((fd = OS_OPEN(headerName, O_RDONLY, 0666)) == INVALID_FD
|| OS_SIZE(fd) < 0) {
printf("Volinfo: Cannot read volume header %s\n", name);
PrintInode(NULL, ino), errno);
continue;
}
- (void)afs_snprintf(nfile, sizeof nfile, "TmpInode.%s",
- PrintInode(NULL, ino));
+ snprintf(nfile, sizeof nfile, "TmpInode.%s",
+ PrintInode(NULL, ino));
ofd = afs_open(nfile, O_CREAT | O_RDWR | O_TRUNC, 0600);
if (ofd < 0) {
printf("Can't create file %s; error %d (ignored)\n",
} else
#endif
{
- (void)afs_snprintf(logFileName, sizeof logFileName,
- "%s.%d",
- AFSDIR_SERVER_SLVGLOG_FILEPATH,
- jobs[startjob]->jobnumb);
+ snprintf(logFileName, sizeof logFileName, "%s.%d",
+ AFSDIR_SERVER_SLVGLOG_FILEPATH,
+ jobs[startjob]->jobnumb);
logFile = afs_fopen(logFileName, "w");
}
if (!logFile)
#endif
if (!partP) {
for (i = 0; i < jobcount; i++) {
- (void)afs_snprintf(logFileName, sizeof logFileName, "%s.%d",
- AFSDIR_SERVER_SLVGLOG_FILEPATH, i);
+ snprintf(logFileName, sizeof logFileName, "%s.%d",
+ AFSDIR_SERVER_SLVGLOG_FILEPATH, i);
if ((passLog = afs_fopen(logFileName, "r"))) {
while (fgets(buf, sizeof(buf), passLog)) {
fputs(buf, logFile);
(void)_putenv("TMP="); /* If "TMP" is set, then that overrides tdir. */
(void)strcpy(summaryFileName, _tempnam(tdir, "salvage.temp."));
#else
- (void)afs_snprintf(summaryFileName, sizeof summaryFileName,
- "%s" OS_DIRSEP "salvage.temp.%d", tdir, getpid());
+ snprintf(summaryFileName, sizeof summaryFileName,
+ "%s" OS_DIRSEP "salvage.temp.%d", tdir, getpid());
#endif
summaryFile = OS_OPEN(summaryFileName, O_RDWR|O_APPEND|O_CREAT, 0666);
if (summaryFile == INVALID_FD) {
base = name;
}
- (void)afs_snprintf(nameShouldBe, sizeof nameShouldBe,
- VFORMAT, afs_printable_uint32_lu(summary.header.id));
+ snprintf(nameShouldBe, sizeof nameShouldBe,
+ VFORMAT, afs_printable_uint32_lu(summary.header.id));
if (strcmp(nameShouldBe, base)) {
if (isp->volSummary == NULL) {
char path[64];
char headerName[64];
- (void)afs_snprintf(headerName, sizeof headerName, VFORMAT, afs_printable_uint32_lu(isp->volumeId));
- (void)afs_snprintf(path, sizeof path, "%s" OS_DIRSEP "%s", salvinfo->fileSysPath, headerName);
+ snprintf(headerName, sizeof headerName, VFORMAT,
+ afs_printable_uint32_lu(isp->volumeId));
+ snprintf(path, sizeof path, "%s" OS_DIRSEP "%s",
+ salvinfo->fileSysPath, headerName);
if (check) {
Log("No header file for volume %u\n", isp->volumeId);
return -1;
if (isp->volSummary->fileName) {
strcpy(headerName, isp->volSummary->fileName);
} else {
- (void)afs_snprintf(headerName, sizeof headerName, VFORMAT, afs_printable_uint32_lu(isp->volumeId));
+ snprintf(headerName, sizeof headerName, VFORMAT,
+ afs_printable_uint32_lu(isp->volumeId));
isp->volSummary->fileName = ToString(headerName);
}
- (void)afs_snprintf(path, sizeof path, "%s" OS_DIRSEP "%s", salvinfo->fileSysPath, headerName);
+ snprintf(path, sizeof path, "%s" OS_DIRSEP "%s",
+ salvinfo->fileSysPath, headerName);
Log("Header file %s is damaged or no longer valid%s\n", path,
(check ? "" : "; repairing"));
pa.Vnode = ThisVnode;
pa.Unique = ThisUnique;
- (void)afs_snprintf(npath, sizeof npath, "%s.%u.%u",
- ((class ==
- vLarge) ? "__ORPHANDIR__" :
- "__ORPHANFILE__"), ThisVnode,
- ThisUnique);
+ snprintf(npath, sizeof npath, "%s.%u.%u",
+ ((class == vLarge) ? "__ORPHANDIR__"
+ : "__ORPHANFILE__"),
+ ThisVnode, ThisUnique);
CopyOnWrite(salvinfo, &rootdir);
code = Create(&rootdir.dirHandle, npath, &pa);
now = time(0);
lt = localtime(&now);
- (void)afs_snprintf(stampSlvgLog, sizeof stampSlvgLog,
- "%s.%04d-%02d-%02d.%02d:%02d:%02d",
- log_path, lt->tm_year + 1900,
- lt->tm_mon + 1, lt->tm_mday, lt->tm_hour, lt->tm_min,
- lt->tm_sec);
+ snprintf(stampSlvgLog, sizeof stampSlvgLog,
+ "%s.%04d-%02d-%02d.%02d:%02d:%02d", log_path,
+ lt->tm_year + 1900, lt->tm_mon + 1, lt->tm_mday, lt->tm_hour,
+ lt->tm_min, lt->tm_sec);
/* try to link the logfile to a timestamped filename */
/* if it fails, oh well, nothing we can do */
va_list args;
va_start(args, format);
- (void)afs_vsnprintf(tmp, sizeof tmp, format, args);
+ vsnprintf(tmp, sizeof tmp, format, args);
va_end(args);
#ifndef AFS_NT40_ENV
if (useSyslog) {
char tmp[1024];
va_start(args, format);
- (void)afs_vsnprintf(tmp, sizeof tmp, format, args);
+ vsnprintf(tmp, sizeof tmp, format, args);
va_end(args);
#ifndef AFS_NT40_ENV
if (useSyslog) {
*ec = 0;
name[0] = OS_DIRSEPC;
- (void)afs_snprintf(&name[1], (sizeof name) - 1, VFORMAT, afs_printable_uint32_lu(volumeId));
+ snprintf(&name[1], (sizeof name) - 1, VFORMAT,
+ afs_printable_uint32_lu(volumeId));
for (dp = DiskPartitionList; dp; dp = dp->next) {
struct afs_stat_st status;
strcpy(path, VPartitionPath(dp));
VolumeExternalName(VolumeId volumeId)
{
static char name[VMAXPATHLEN];
- (void)afs_snprintf(name, sizeof name, VFORMAT, afs_printable_uint32_lu(volumeId));
+ snprintf(name, sizeof name, VFORMAT, afs_printable_uint32_lu(volumeId));
return name;
}
int
VolumeExternalName_r(VolumeId volumeId, char * name, size_t len)
{
- return afs_snprintf(name, len, VFORMAT, afs_printable_uint32_lu(volumeId));
+ return snprintf(name, len, VFORMAT, afs_printable_uint32_lu(volumeId));
}
vol.stamp.magic = VOLUMEINFOMAGIC;
vol.stamp.version = VOLUMEINFOVERSION;
vol.destroyMe = DESTROY_ME;
- (void)afs_snprintf(headerName, sizeof headerName, VFORMAT, afs_printable_uint32_lu(vol.id));
- (void)afs_snprintf(volumePath, sizeof volumePath, "%s" OS_DIRSEP "%s",
- VPartitionPath(partition), headerName);
+ snprintf(headerName, sizeof headerName, VFORMAT,
+ afs_printable_uint32_lu(vol.id));
+ snprintf(volumePath, sizeof volumePath, "%s" OS_DIRSEP "%s",
+ VPartitionPath(partition), headerName);
rc = stat(volumePath, &st);
if (rc == 0 || errno != ENOENT) {
if (rc == 0) {
int fd;
char path[MAXPATHLEN];
- (void)afs_snprintf(path, sizeof(path),
- "%s" OS_DIRSEP VFORMAT,
- VPartitionPath(dp), afs_printable_uint32_lu(volid));
+ snprintf(path, sizeof(path), "%s" OS_DIRSEP VFORMAT,
+ VPartitionPath(dp), afs_printable_uint32_lu(volid));
fd = open(path, O_RDONLY);
if (fd < 0) {
Log("VReadVolumeDiskHeader: Couldn't open header for volume %lu (errno %d).\n",
flags |= O_RDWR;
- (void)afs_snprintf(path, sizeof(path),
- "%s" OS_DIRSEP VFORMAT,
- VPartitionPath(dp), afs_printable_uint32_lu(hdr->id));
+ snprintf(path, sizeof(path), "%s" OS_DIRSEP VFORMAT,
+ VPartitionPath(dp), afs_printable_uint32_lu(hdr->id));
fd = open(path, flags, 0644);
if (fd < 0) {
code = errno;
SYNC_response res;
#endif /* AFS_DEMAND_ATTACH_FS */
- (void)afs_snprintf(path, sizeof(path),
- "%s" OS_DIRSEP VFORMAT,
- VPartitionPath(dp), afs_printable_uint32_lu(volid));
+ snprintf(path, sizeof(path), "%s" OS_DIRSEP VFORMAT,
+ VPartitionPath(dp), afs_printable_uint32_lu(volid));
code = unlink(path);
if (code) {
Log("VDestroyVolumeDiskHeader: Couldn't unlink disk header, error = %d\n", errno);
#include <afsconfig.h>
#include <afs/param.h>
+#include <roken.h>
#include <afs/afsint.h>
#include <afs/nfs.h>
if (vnode == 1)
strncpy(parentdir, rootdir, sizeof parentdir);
else {
- afs_snprintf(parentdir, sizeof parentdir, "%s" OS_DIRSEP "%s%d", rootdir,
- ADIR, vnode);
+ snprintf(parentdir, sizeof parentdir,
+ "%s" OS_DIRSEP "%s%d", rootdir, ADIR, vnode);
len = readlink(parentdir, linkname, MAXNAMELEN);
if (len < 0) {
/* parentdir does not exist. So create an orphan dir.
* and then link the parentdir to the orphaned dir.
*/
- afs_snprintf(linkname, sizeof linkname, "%s" OS_DIRSEP "%s%d",
- rootdir, ODIR, vnode);
+ snprintf(linkname, sizeof linkname, "%s" OS_DIRSEP "%s%d",
+ rootdir, ODIR, vnode);
code = mkdir(linkname, 0777);
if ((code < 0) && (errno != EEXIST)) {
fprintf(stderr,
}
/* Link the parentdir to it - now parentdir exists */
- afs_snprintf(linkname, sizeof linkname, "%s%d/", ODIR,
- vnode);
+ snprintf(linkname, sizeof linkname, "%s%d/", ODIR,
+ vnode);
code = symlink(linkname, parentdir);
if (code) {
fprintf(stderr,
/* dirname is the directory to create.
* vflink is what will link to it.
*/
- afs_snprintf(dirname, sizeof dirname, "%s" OS_DIRSEP "%s",
- parentdir, this_name);
- afs_snprintf(vflink, sizeof vflink, "%s" OS_DIRSEP "%s%d",
- rootdir, ADIR, this_vn);
+ snprintf(dirname, sizeof dirname,
+ "%s" OS_DIRSEP "%s",
+ parentdir, this_name);
+ snprintf(vflink, sizeof vflink,
+ "%s" OS_DIRSEP "%s%d",
+ rootdir, ADIR, this_vn);
/* The link and directory may already exist */
len = readlink(vflink, linkname, MAXNAMELEN);
* It was created originally as orphaned.
*/
linkname[len - 1] = '\0'; /* remove '/' at end */
- afs_snprintf(lname, sizeof lname, "%s" OS_DIRSEP "%s",
- rootdir, linkname);
+ snprintf(lname, sizeof lname,
+ "%s" OS_DIRSEP "%s",
+ rootdir, linkname);
code = rename(lname, dirname);
if (code) {
fprintf(stderr,
/* Now create/update the link to the new/moved directory */
if (vn.vnode == 1)
- afs_snprintf(dirname, sizeof dirname, "%s/",
- this_name);
+ snprintf(dirname, sizeof dirname, "%s/",
+ this_name);
else
- afs_snprintf(dirname, sizeof dirname,
- "%s%d/%s/", ADIR, vn.vnode,
- this_name);
+ snprintf(dirname, sizeof dirname, "%s%d/%s/",
+ ADIR, vn.vnode, this_name);
unlink(vflink);
code = symlink(dirname, vflink);
if (code) {
* by creating a link within the directory. Restoring
* the file will later remove the link.
*/
- else {
- /*AFILEENTRY*/ afs_snprintf(vflink,
- sizeof vflink,
- "%s" OS_DIRSEP "%s%d", parentdir,
- AFILE, this_vn);
+ else {
+ /*AFILEENTRY*/
+ snprintf(vflink, sizeof vflink,
+ "%s" OS_DIRSEP "%s%d", parentdir,
+ AFILE, this_vn);
code = symlink(this_name, vflink);
if ((code < 0) && (errno != EEXIST)) {
* then the file will be an orphaned file.
*/
lfile = 1;
- afs_snprintf(filename, sizeof filename, "%s" OS_DIRSEP "%s%d", parentdir,
- AFILE, vn.vnode);
+ snprintf(filename, sizeof filename, "%s" OS_DIRSEP "%s%d",
+ parentdir, AFILE, vn.vnode);
len = readlink(filename, fname, MAXNAMELEN);
if (len < 0) {
- afs_snprintf(filename, sizeof filename, "%s" OS_DIRSEP "%s%d",
- rootdir, OFILE, vn.vnode);
+ snprintf(filename, sizeof filename, "%s" OS_DIRSEP "%s%d",
+ rootdir, OFILE, vn.vnode);
lfile = 0; /* no longer a linked file; a direct path */
}
errno);
else {
char tmp[100];
- (void)afs_snprintf(tmp, sizeof tmp,
- "Read %llu bytes out of %llu",
- (afs_uintmax_t) (vn.dataSize -
- size),
- (afs_uintmax_t) vn.dataSize);
+ snprintf(tmp, sizeof tmp,
+ "Read %llu bytes out of %llu",
+ (afs_uintmax_t) (vn.dataSize - size),
+ (afs_uintmax_t) vn.dataSize);
fprintf(stderr, "%s\n", tmp);
}
break;
* of the symbolic link. If it doesn't exist,
* then the link will be an orphaned link.
*/
- afs_snprintf(linkname, sizeof linkname, "%s" OS_DIRSEP "%s%d", parentdir,
- AFILE, vn.vnode);
+ snprintf(linkname, sizeof linkname, "%s" OS_DIRSEP "%s%d",
+ parentdir, AFILE, vn.vnode);
len = readlink(linkname, fname, MAXNAMELEN);
if (len < 0) {
- afs_snprintf(filename, sizeof filename, "%s" OS_DIRSEP "%s%d",
- rootdir, OFILE, vn.vnode);
+ snprintf(filename, sizeof filename, "%s" OS_DIRSEP "%s%d",
+ rootdir, OFILE, vn.vnode);
} else {
fname[len] = '\0';
- afs_snprintf(filename, sizeof filename, "%s" OS_DIRSEP "%s",
- parentdir, fname);
+ snprintf(filename, sizeof filename, "%s" OS_DIRSEP "%s",
+ parentdir, fname);
}
/* Read the link in, delete it, and then create it */
dirP = opendir(rootdir);
while (dirP && (dirE = readdir(dirP))) {
if (strncmp(dirE->d_name, ADIR, strlen(ADIR)) == 0) {
- afs_snprintf(name, sizeof name, "%s" OS_DIRSEP "%s", rootdir,
- dirE->d_name);
+ snprintf(name, sizeof name, "%s" OS_DIRSEP "%s", rootdir,
+ dirE->d_name);
dirQ = opendir(name);
while (dirQ && (dirF = readdir(dirQ))) {
if (strncmp(dirF->d_name, AFILE, strlen(AFILE)) == 0) {
- afs_snprintf(name, sizeof name, "%s" OS_DIRSEP "%s/%s", rootdir,
- dirE->d_name, dirF->d_name);
+ snprintf(name, sizeof name, "%s" OS_DIRSEP "%s/%s",
+ rootdir, dirE->d_name, dirF->d_name);
unlink(name);
}
}
closedir(dirQ);
} else if (strncmp(dirE->d_name, AFILE, strlen(AFILE)) == 0) {
- afs_snprintf(name, sizeof name, "%s" OS_DIRSEP "%s", rootdir,
- dirE->d_name);
+ snprintf(name, sizeof name, "%s" OS_DIRSEP "%s", rootdir,
+ dirE->d_name);
unlink(name);
}
}
dirP = opendir(rootdir);
while (dirP && (dirE = readdir(dirP))) {
if (strncmp(dirE->d_name, ADIR, strlen(ADIR)) == 0) {
- afs_snprintf(name, sizeof name, "%s" OS_DIRSEP "%s", rootdir, dirE->d_name);
+ snprintf(name, sizeof name, "%s" OS_DIRSEP "%s", rootdir,
+ dirE->d_name);
unlink(name);
}
}
# pragma GCC diagnostic warning "-Wformat"
#endif
+#include <roken.h>
+
#include <ctype.h>
#include <errno.h>
#include <sys/stat.h>
exit(1);
}
- (void)afs_snprintf(name1, sizeof name1, VFORMAT, (unsigned long)volumeId);
+ snprintf(name1, sizeof name1, VFORMAT, (unsigned long)volumeId);
HandleVolume(partP, name1, fileName, fromtime);
return 0;
}
afs_int32 n;
- (void)afs_snprintf(headerName, sizeof headerName, "%s" OS_DIRSEP "%s",
- VPartitionPath(dp), name);
+ snprintf(headerName, sizeof headerName, "%s" OS_DIRSEP "%s",
+ VPartitionPath(dp), name);
if ((fd = afs_open(headerName, O_RDONLY)) == -1
|| afs_fstat(fd, &status) == -1) {
fprintf(stderr, "Cannot read volume header %s\n", name);
afs_uint64 size;
offset = (e->vN + 1 - class) << (vcp->logSize -1);
if (FDH_PREAD(fdP, vnode, vcp->diskSize, offset) != vcp->diskSize) {
- Log("Couldn't read in %s Index of volume %u at offset %"
- AFS_UINT64_FMT "\n", class ? "small":"large",
- V_id(vol), offset);
+ Log("Couldn't read in %s Index of volume %u at offset %llu\n",
+ class ? "small":"large", V_id(vol), offset);
code = EIO;
goto Bad_Copy;
}
VNDISK_SET_INO(vnode, newino);
vnode->cloned = 0;
if (FDH_PWRITE(fdP, vnode, vcp->diskSize, offset) != vcp->diskSize) {
- Log("Couldn't write in %s Index of volume %u at offset %"
- AFS_UINT64_FMT "\n", class ? "small":"large",
- V_id(vol), offset);
+ Log("Couldn't write in %s Index of volume %u at offset %llu\n",
+ class ? "small":"large", V_id(vol), offset);
code = EIO;
goto Bad_Copy;
}
vnode->parent = 1; /* in new root-directory */
vnode->cloned = 0;
if (FDH_PWRITE(newfdP, vnode, vcp->diskSize, offset) != vcp->diskSize) {
- Log("Couldn't write in %s Index of volume %u to offset %"
- AFS_UINT64_FMT "\n", class ? "small":"large",
- V_id(newvol), offset);
+ Log("Couldn't write in %s Index of volume %u to offset %llu\n",
+ class ? "small":"large", V_id(newvol), offset);
code = EIO;
goto Bad_Copy;
}
}
offset = (where + 1 - class) << (vcp->logSize -1);
if (FDH_PREAD(fdP, vnode, vcp->diskSize, offset) != vcp->diskSize) {
- Log("Couldn't read in large Index of old volume %u at offset %"
- AFS_UINT64_FMT "\n", V_id(vol), offset);
+ Log("Couldn't read in large Index of old volume %u at offset %llu\n",
+ V_id(vol), offset);
code = EIO;
goto Bad_Copy;
}
if (e->flag & NEEDED) {
offset = (e->vN + 1 - class) << (vcp->logSize -1);
if (FDH_PREAD(fdP, vnode, vcp->diskSize, offset) != vcp->diskSize) {
- Log("Couldn't read in %s Index of volume %u at offset %"
- AFS_UINT64_FMT "\n", class ? "small":"large", V_id(vol),
- offset);
+ Log("Couldn't read in %s Index of volume %u at offset %llu\n",
+ class ? "small":"large", V_id(vol), offset);
code = EIO;
goto Bad_Delete;
}
memset(vnode, 0, vcp->diskSize);
vnode->type = vNull;
if (FDH_PWRITE(fdP, vnode, vcp->diskSize, offset) != vcp->diskSize) {
- Log("Couldn't write in %s Index of volume %u to offset %"
- AFS_UINT64_FMT "\n", class ? "small":"large",
- V_id(vol), offset);
+ Log("Couldn't write in %s Index of volume %u to offset %llu\n",
+ class ? "small":"large", V_id(vol), offset);
}
}
}
if (asize < 18)
return -1;
/* It's better using the Generic VFORMAT since otherwise we have to make changes to too many places... The 14 char limitation in names hits us again in AIX; print in field of 9 digits (still 10 for the rest), right justified with 0 padding */
- (void)afs_snprintf(aname, asize, VFORMAT, (unsigned long)avol);
+ snprintf(aname, asize, VFORMAT, (unsigned long)avol);
return 0;
}