* src/octhexdigits.h: isodigit, hextobin, octtobin macros.
* src/stat.c, src/printf.c: Use octhexdigits.h.
* src/local.mk: Corresponding adjustments.
src/iopoll.h \
src/longlong.h \
src/ls.h \
+ src/octhexdigits.h \
src/operand2sig.h \
src/prog-fprintf.h \
src/remove.h \
--- /dev/null
+#define isodigit(c) ('0' <= (c) && (c) <= '7')
+#define octtobin(c) ((c) - '0')
+/* FIXME-maybe: macros names may be misleading: "bin" may be interpreted as
+ "having a value of (char)'0' or (char)'1'". Rename? `hextonative`?
+ `hextoint`? */
+#define hextobin(c) ('a' <= (c) && (c) <= 'f' ? (c) - 'a' + 10 : \
+ 'A' <= (c) && (c) <= 'F' ? (c) - 'A' + 10 : (c) - '0')
#include "system.h"
#include "c-ctype.h"
#include "cl-strtod.h"
+#include "octhexdigits.h"
#include "quote.h"
#include "unicodeio.h"
#include "xprintf.h"
#define AUTHORS proper_name ("David MacKenzie")
-#define isodigit(c) ((c) >= '0' && (c) <= '7')
-#define hextobin(c) ((c) >= 'a' && (c) <= 'f' ? (c) - 'a' + 10 : \
- (c) >= 'A' && (c) <= 'F' ? (c) - 'A' + 10 : (c) - '0')
-#define octtobin(c) ((c) - '0')
-
/* The value to return to the calling program. */
static int exit_status;
#include "filemode.h"
#include "fs.h"
#include "mountlist.h"
+#include "octhexdigits.h"
#include "quote.h"
#include "stat-size.h"
#include "stat-time.h"
# include <sys/nvpair.h>
#endif
-/* FIXME: these are used by printf.c, too */
-#define isodigit(c) ('0' <= (c) && (c) <= '7')
-#define octtobin(c) ((c) - '0')
-#define hextobin(c) ((c) >= 'a' && (c) <= 'f' ? (c) - 'a' + 10 : \
- (c) >= 'A' && (c) <= 'F' ? (c) - 'A' + 10 : (c) - '0')
-
static char const digits[] = "0123456789";
/* Flags that are portable for use in printf, for at least one