jim 97/01/19 15:46:27
Modified: src util_snprintf.c Log: portabilities fixes Revision Changes Path 1.3 +16 -23 apache/src/util_snprintf.c Index: util_snprintf.c =================================================================== RCS file: /export/home/cvs/apache/src/util_snprintf.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C3 -r1.2 -r1.3 *** util_snprintf.c 1997/01/18 21:28:15 1.2 --- util_snprintf.c 1997/01/19 23:46:25 1.3 *************** *** 63,68 **** --- 63,71 ---- #include <ctype.h> #include <sys/types.h> #include <stdarg.h> + #include <string.h> + #include <stdlib.h> + #include <math.h> #ifdef HAVE_CVT *************** *** 77,85 **** * from GNU libc-4.6.27 */ - #include <stdlib.h> - #include <math.h> - /* * ap_ecvt converts to decimal * the number of digits is specified by ndigit --- 80,85 ---- *************** *** 252,260 **** #define INT_NULL ((int *)0) #define WIDE_INT long ! typedef WIDE_INT wide_int; ! typedef unsigned WIDE_INT u_wide_int; ! typedef int bool_int; #define S_NULL "(null)" #define S_NULL_LEN 6 --- 252,260 ---- #define INT_NULL ((int *)0) #define WIDE_INT long ! typedef WIDE_INT wide_int; ! typedef unsigned WIDE_INT u_wide_int; ! typedef int bool_int; #define S_NULL "(null)" #define S_NULL_LEN 6 *************** *** 273,284 **** /* * Descriptor for buffer area */ ! struct __buf_area { char *buf_end; char *nextb; /* pointer to next byte to read/write */ }; ! typedef struct __buf_area __buffy; /* * The INS_CHAR macro inserts a character in the buffer and writes --- 273,284 ---- /* * Descriptor for buffer area */ ! struct buf_area { char *buf_end; char *nextb; /* pointer to next byte to read/write */ }; ! typedef struct buf_area buffy; /* * The INS_CHAR macro inserts a character in the buffer and writes *************** *** 327,337 **** * Macro that does padding. The padding is done by printing * the character ch. */ ! #define PAD( width, len, ch ) do \ ! { \ INS_CHAR( ch, sp, bep, cc ) ; \ ! width-- ; \ ! } \ while ( width > len ) /* --- 327,337 ---- * Macro that does padding. The padding is done by printing * the character ch. */ ! #define PAD( width, len, ch ) do \ ! { \ INS_CHAR( ch, sp, bep, cc ) ; \ ! width-- ; \ ! } \ while ( width > len ) /* *************** *** 416,423 **** register char *s = buf; register char *p; int decimal_point; - extern char *ap_ecvt(), *ap_fcvt(); - char *strcpy(char *, const char *); if (format == 'f') p = ap_fcvt(num, precision, &decimal_point, is_negative); --- 416,421 ---- *************** *** 528,534 **** /* * Do format conversion placing the output in buffer */ ! static int __format_converter(register __buffy * odp, const char *fmt, va_list ap) { register char *sp; --- 526,532 ---- /* * Do format conversion placing the output in buffer */ ! static int format_converter(register buffy * odp, const char *fmt, va_list ap) { register char *sp; *************** *** 566,576 **** boolean_e adjust_width; bool_int is_negative; - extern char *ap_gcvt(); - char *strchr(const char *, int); - int isascii(int); - - sp = odp->nextb; bep = odp->buf_end; --- 564,569 ---- *************** *** 847,853 **** * We print %<char> to help the user identify what * option is not understood. * This is also useful in case the user wants to pass ! * the output of __format_converter to another function * that understands some other %<char> (like syslog). * Note that we can't point s inside fmt because the * unknown <char> could be preceded by width etc. --- 840,846 ---- * We print %<char> to help the user identify what * option is not understood. * This is also useful in case the user wants to pass ! * the output of format_converter to another function * that understands some other %<char> (like syslog). * Note that we can't point s inside fmt because the * unknown <char> could be preceded by width etc. *************** *** 900,906 **** static void strx_printv(int *ccp, char *buf, size_t len, const char *format, va_list ap) { ! __buffy od; int cc; /* --- 893,899 ---- static void strx_printv(int *ccp, char *buf, size_t len, const char *format, va_list ap) { ! buffy od; int cc; /* *************** *** 914,920 **** /* * Do the conversion */ ! cc = __format_converter(&od, format, ap); if (len == 0 || od.nextb <= od.buf_end) *(od.nextb) = '\0'; if (ccp) --- 907,913 ---- /* * Do the conversion */ ! cc = format_converter(&od, format, ap); if (len == 0 || od.nextb <= od.buf_end) *(od.nextb) = '\0'; if (ccp)