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/bltin/printf.c') 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 it/ui.c?h=somasis/tokipona&id=f3db938ded8210956d492d7c42df1793893e5cbe&follow=1'>Replace "view" with "window"June McEnroe I think originally I didn't want to use the same word as curses WINDOW but it's really much clearer for the user if they're just called windows. UI code probably needs yet another rewrite though. Still feels messy. 2019-02-21Remove ROT13June McEnroe It's just not convenient when it can only do the whole line... 2019-02-21Clean up man pageJune McEnroe 2019-01-26Draw UI before connectingJune McEnroe Otherwise the "Traveling" message isn't visible while connecting. 2019-01-25Avoid unused variable warnings with getyxJune McEnroe 2019-01-25Add GNU/Linux build instructionsJune McEnroe