X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=printf.c;h=d579a9b4e49069fd5e915588058e7db36cf62ec6;hb=8a9b2c6448e32f16e4b65dbd4927d9108c007acc;hp=41ab2e4426e6c4ad88f157843ecc6ea138ed6465;hpb=e49d5ecbbe51718fa925b6890a735e5937cc2aa2;p=oweals%2Fbusybox.git diff --git a/printf.c b/printf.c index 41ab2e442..d579a9b4e 100644 --- a/printf.c +++ b/printf.c @@ -47,22 +47,19 @@ // 19990508 Busy Boxed! Dave Cinege -#include "internal.h" #include #include #include -#include -#include #include #include #include #include #include -#include +#include "busybox.h" #ifndef S_IFMT -# define S_IFMT 0170000 +static const int S_IFMT = 0170000; #endif #if !defined(S_ISBLK) && defined(S_IFBLK) # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) @@ -95,28 +92,9 @@ #define IN_CTYPE_DOMAIN(c) 1 -#ifdef isblank -# define ISBLANK(c) (IN_CTYPE_DOMAIN (c) && isblank (c)) -#else -# define ISBLANK(c) ((c) == ' ' || (c) == '\t') -#endif -#ifdef isgraph -# define ISGRAPH(c) (IN_CTYPE_DOMAIN (c) && isgraph (c)) -#else -# define ISGRAPH(c) (IN_CTYPE_DOMAIN (c) && isprint (c) && !isspace (c)) -#endif - -#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c)) -#define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum (c)) -#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c)) -#define ISCNTRL(c) (IN_CTYPE_DOMAIN (c) && iscntrl (c)) -#define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (c)) -#define ISPUNCT(c) (IN_CTYPE_DOMAIN (c) && ispunct (c)) -#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c)) -#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c)) #define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (c)) #define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c)) -#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9) +#define ISDIGIT(c) (((unsigned char) (c)) - '0' <= 9) #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') @@ -139,8 +117,6 @@ static void verify __P((char *s, char *end)); /* The value to return to the calling program. */ static int exit_status; -static const char printf_usage[] = "printf format [argument...]\n"; - int printf_main(int argc, char **argv) { char *format; @@ -148,7 +124,7 @@ int printf_main(int argc, char **argv) exit_status = 0; if (argc <= 1 || **(argv + 1) == '-') { - usage(printf_usage); + show_usage(); } format = argv[1]; @@ -167,7 +143,7 @@ int printf_main(int argc, char **argv) fprintf(stderr, "excess args ignored"); */ - exit(exit_status); + return(exit_status); } /* Print the text in FORMAT, using ARGV (with ARGC elements) for