diff options
author | Andrea Adami <andrea.adami@gmail.com> | 2010-05-31 22:56:16 +0200 |
---|---|---|
committer | Andrea Adami <andrea.adami@gmail.com> | 2010-05-31 23:10:02 +0200 |
commit | 89c8847b89a370422926a461583538a34ef77c8d (patch) | |
tree | e16c179847ecc220f632a40b8fb6e96e9e3111dc /recipes/klibc/files/dash_readopt.patch | |
parent | b477024589c2a7cae769783a8dccadd47baf3674 (diff) |
klibc: major clean out of intermediate recipes.
* keep klibc_1.5 (first prototype)
* keep up-to-date klibc_1.5.18 patched to compile with 2.6.2x and 2.6.3x
* runtime tested on armv5te
Diffstat (limited to 'recipes/klibc/files/dash_readopt.patch')
-rw-r--r-- | recipes/klibc/files/dash_readopt.patch | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/recipes/klibc/files/dash_readopt.patch b/recipes/klibc/files/dash_readopt.patch deleted file mode 100644 index 49bc087edd..0000000000 --- a/recipes/klibc/files/dash_readopt.patch +++ /dev/null @@ -1,105 +0,0 @@ -Index: klibc-1.5/usr/dash/miscbltin.c -=================================================================== ---- klibc-1.5.orig/usr/dash/miscbltin.c 2008-03-27 20:38:09.354564817 +0100 -+++ klibc-1.5/usr/dash/miscbltin.c 2008-04-04 18:05:32.063364195 +0200 -@@ -46,6 +46,7 @@ - #include <ctype.h> - #include <stdint.h> - #include <time.h> /* strtotimeval() */ -+#include <termios.h> - - #include "shell.h" - #include "options.h" -@@ -83,6 +84,11 @@ - int timeout; - int i; - fd_set set; -+ int n_flag = 0; -+ unsigned int nchars = 0; -+ int silent = 0; -+ struct termios tty, old_tty; -+ - struct timeval ts, t0, t1, to; - - ts.tv_sec = ts.tv_usec = 0; -@@ -90,11 +96,18 @@ - rflag = 0; - timeout = 0; - prompt = NULL; -- while ((i = nextopt("p:rt:")) != '\0') { -+ while ((i = nextopt("p:rt:n:s")) != '\0') { - switch(i) { - case 'p': - prompt = optionarg; - break; -+ case 'n': -+ nchars = strtoul(optionarg, NULL, 10); -+ n_flag = nchars; /* just a flag "nchars is nonzero" */ -+ break; -+ case 's': -+ silent = 1; -+ break; - case 't': - p = strtotimeval(optionarg, &ts); - if (*p || (!ts.tv_sec && !ts.tv_usec)) -@@ -118,6 +131,23 @@ - sh_error("arg count"); - if ((ifs = bltinlookup("IFS")) == NULL) - ifs = defifs; -+ if (n_flag || silent) { -+ if (tcgetattr(0, &tty) != 0) { -+ /* Not a tty */ -+ n_flag = 0; -+ silent = 0; -+ } else { -+ old_tty = tty; -+ if (n_flag) { -+ tty.c_lflag &= ~ICANON; -+ tty.c_cc[VMIN] = nchars < 256 ? nchars : 255; -+ } -+ if (silent) { -+ tty.c_lflag &= ~(ECHO | ECHOK | ECHONL); -+ } -+ tcsetattr(0, TCSANOW, &tty); -+ } -+ } - status = 0; - startword = 1; - backslash = 0; -@@ -133,13 +163,15 @@ - ts.tv_sec += t0.tv_sec; - } - STARTSTACKSTR(p); -- for (;;) { -+ do { - if (timeout) { - gettimeofday(&t1, NULL); - if (t1.tv_sec > ts.tv_sec || - (t1.tv_sec == ts.tv_sec && - t1.tv_usec >= ts.tv_usec)) { - status = 1; -+ if (n_flag) -+ tcsetattr(0, TCSANOW, &old_tty); - break; /* Timeout! */ - } - -@@ -156,6 +188,8 @@ - FD_SET(0, &set); - if (select(1, &set, NULL, NULL, &to) != 1) { - status = 1; -+ if (n_flag) -+ tcsetattr(0, TCSANOW, &old_tty); - break; /* Timeout! */ - } - } -@@ -191,7 +225,9 @@ - put: - STPUTC(c, p); - } -- } -+ } while (!n_flag || --nchars); -+ if (n_flag || silent) -+ tcsetattr(0, TCSANOW, &old_tty); - STACKSTRNUL(p); - /* Remove trailing blanks */ - while ((char *)stackblock() <= --p && strchr(ifs, *p) != NULL) |