From e74aa1e960acc9b2af11d10a9aab7023925d6b90 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Sat, 29 Oct 2005 20:46:35 +1000 Subject: [BUILTIN] Removed standalone/csh support from printf The support for standalone/csh printf only serves to complicate maintainence. --- src/bltin/printf.c | 59 +----------------------------------------------------- 1 file changed, 1 insertion(+), 58 deletions(-) (limited to 'src') diff --git a/src/bltin/printf.c b/src/bltin/printf.c index b394dbe..fc73dfb 100644 --- a/src/bltin/printf.c +++ b/src/bltin/printf.c @@ -32,15 +32,10 @@ #include #include -#include #include #include #include -#include #include -#ifndef SHELL -#include -#endif #include #include #include @@ -58,19 +53,10 @@ static void check_conversion(const char *, const char *); static int rval; static char **gargv; -#ifdef BUILTIN /* csh builtin */ -#define main progprintf -#endif - #define isodigit(c) ((c) >= '0' && (c) <= '7') #define octtobin(c) ((c) - '0') -#ifdef SHELL /* sh (aka ash) builtin */ -#define main printfcmd #include "bltin.h" -#else -#define nullstr "" -#endif /* SHELL */ #include "system.h" #define PF(f, func) { \ @@ -87,8 +73,7 @@ static char **gargv; } \ } -int main(int, char **); -int main(int argc, char *argv[]) +int printfcmd(int argc, char *argv[]) { char *fmt; char *format; @@ -96,13 +81,7 @@ int main(int argc, char *argv[]) rval = 0; -#if !defined(SHELL) && !defined(BUILTIN) - (void)setlocale (LC_ALL, ""); -#endif - -#ifdef SHELL nextopt(nullstr); -#endif argv = argptr; format = *argv; @@ -229,12 +208,7 @@ pc: } while (gargv != argv && *gargv); out: -#ifdef SHELL return (rval & ~0x100); -#else - fflush(stdout); - return (rval & ~0x100 ?: ferror(stdout)); -#endif err: return 1; } @@ -248,22 +222,10 @@ static char * conv_escape_str(char *str) { int ch; -#ifndef SHELL - static char *conv_str; -#endif char *cp; /* convert string into a temporary buffer... */ -#ifdef SHELL STARTSTACKSTR(cp); -#else - if (conv_str) - free(conv_str); - conv_str = malloc(strlen(str) + 4); - if (!conv_str) - return ""; - cp = conv_str; -#endif do { int c; @@ -303,15 +265,9 @@ conv_escape_str(char *str) /* Finally test for sequences valid in the format string */ str = conv_escape(str - 1, &c); ch = c; -#ifdef SHELL } while (STPUTC(ch, cp), ch); return stackblock(); -#else - } while ((*cp++ = ch)); - - return conv_str; -#endif } /* @@ -360,23 +316,12 @@ out: static char * mklong(const char *str, const char *ch) { -#ifdef SHELL char *copy; -#else - static char copy[64]; -#endif size_t len; len = ch - str + 3; -#ifdef SHELL STARTSTACKSTR(copy); copy = makestrspace(len, copy); -#else - if (len > sizeof copy) { - warnx("format %s too complex\n", str); - len = 4; - } -#endif memcpy(copy, str, len - 3); copy[len - 3] = 'j'; copy[len - 2] = *ch; @@ -483,7 +428,6 @@ check_conversion(const char *s, const char *ep) } } -#ifdef SHELL int echocmd(int argc, char **argv) { @@ -524,4 +468,3 @@ print: } while (*argv); return 0; } -#endif -- cgit 1.4.1 ] as Operator in C lexerJune McEnroe 2021-01-13Fix C lexer to require a digit in a float literalJune McEnroe 2021-01-13Support long double in c.shJune McEnroe 2021-01-13Update Terminal.app coloursJune McEnroe 2021-01-13Increase dark white brightness slightlyJune McEnroe 2021-01-13Add hilex example to htagml manualJune McEnroe 2021-01-12Style causal.agency like bin HTMLJune McEnroe 2021-01-12Avoid matching tag text inside HTML elementsJune McEnroe 2021-01-12Use hilex for up -hJune McEnroe 2021-01-12Use hilex for bin HTMLJune McEnroe 2021-01-12Don't output a pre in hilex by defaultJune McEnroe 2021-01-12Move hilex out of hilex directoryJune McEnroe 2021-01-12Consolidate hilex formatters into hilex.cJune McEnroe 2021-01-12Remove hacky tagging from hilexJune McEnroe 2021-01-12Add htagml -iJune McEnroe 2021-01-12Render tag index in HTMLJune McEnroe 2021-01-12Add htagml -xJune McEnroe 2021-01-12Prevent matching the same tag twiceJune McEnroe 2021-01-12Process htagml file line by lineJune McEnroe 2021-01-12Split fields by tab onlyJune McEnroe 2021-01-12List both Makefile and html.sh under README.7June McEnroe 2021-01-12Add htagml exampleJune McEnroe 2021-01-12Use mandoc and htagml for bin htmlJune McEnroe 2021-01-12Add htagmlJune McEnroe 2021-01-12Replace causal.agency with a simple mdoc pageJune McEnroe 2021-01-11Publish "Using vi"June McEnroe 2021-01-11Enable diff.colorMovedJune McEnroe 2021-01-10Set less search case-insensitiveJune McEnroe 2021-01-10Set EXINITJune McEnroe 2021-01-09Add c -t flag to print expression typeJune McEnroe 2021-01-05Update taglineJune McEnroe