Module Name: src Committed By: christos Date: Tue Nov 22 22:30:22 UTC 2011
Modified Files: src/external/historical/nawk/dist: run.c Log Message: - make decimal conversions use the maximum width integers available on the architecture. - make signed and unsigned code consistent. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/external/historical/nawk/dist/run.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/historical/nawk/dist/run.c diff -u src/external/historical/nawk/dist/run.c:1.3 src/external/historical/nawk/dist/run.c:1.4 --- src/external/historical/nawk/dist/run.c:1.3 Mon Apr 18 11:23:28 2011 +++ src/external/historical/nawk/dist/run.c Tue Nov 22 17:30:22 2011 @@ -37,6 +37,7 @@ THIS SOFTWARE. #include <string.h> #include <stdlib.h> #include <time.h> +#include <stdint.h> #include "awk.h" #include "awkgram.h" @@ -882,12 +883,15 @@ int format(char **pbuf, int *pbufsize, c case 'd': case 'i': flag = 'd'; if(*(s-1) == 'l') break; - *(t-1) = 'l'; + *(t-1) = 'j'; *t = 'd'; *++t = '\0'; break; case 'o': case 'x': case 'X': case 'u': flag = *(s-1) == 'l' ? 'd' : 'u'; + *(t-1) = 'j'; + *t = *s; + *++t = '\0'; break; case 's': flag = 's'; @@ -920,8 +924,8 @@ int format(char **pbuf, int *pbufsize, c snprintf(p, BUFSZ(p), "%s", t); break; case 'f': snprintf(p, BUFSZ(p), fmt, getfval(x)); break; - case 'd': snprintf(p, BUFSZ(p), fmt, (long) getfval(x)); break; - case 'u': snprintf(p, BUFSZ(p), fmt, (int) getfval(x)); break; + case 'd': snprintf(p, BUFSZ(p), fmt, (intmax_t) getfval(x)); break; + case 'u': snprintf(p, BUFSZ(p), fmt, (uintmax_t) getfval(x)); break; case 's': t = getsval(x); n = strlen(t);