diff options
author | Elliott Hughes <enh@google.com> | 2021-04-26 09:05:38 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2021-04-26 09:10:02 -0700 |
commit | b7cb33d2d49e30d2e2b6051b22df69023a5c94bc (patch) | |
tree | 930c099bd2c1b11596b8d11bdc88076fe77883d8 /android | |
parent | 2d03a5e677e528459785a1d8273a63f0fe00837c (diff) | |
parent | 88ebd0d8150ff983e6a7520dc77cd8b69cf52a25 (diff) | |
download | toybox-b7cb33d2d49e30d2e2b6051b22df69023a5c94bc.tar.gz |
Merge remote-tracking branch 'toybox/master' into HEAD
Change-Id: I753dc7af3a4f370c9894ac0302648b82fa3e4631
Diffstat (limited to 'android')
-rw-r--r-- | android/device/generated/flags.h | 4 | ||||
-rw-r--r-- | android/device/generated/globals.h | 36 | ||||
-rw-r--r-- | android/device/generated/help.h | 4 | ||||
-rw-r--r-- | android/device/generated/newtoys.h | 2 | ||||
-rw-r--r-- | android/linux/generated/flags.h | 4 | ||||
-rw-r--r-- | android/linux/generated/globals.h | 36 | ||||
-rw-r--r-- | android/linux/generated/help.h | 4 | ||||
-rw-r--r-- | android/linux/generated/newtoys.h | 2 | ||||
-rw-r--r-- | android/mac/generated/flags.h | 4 | ||||
-rw-r--r-- | android/mac/generated/globals.h | 36 | ||||
-rw-r--r-- | android/mac/generated/help.h | 4 | ||||
-rw-r--r-- | android/mac/generated/newtoys.h | 2 |
12 files changed, 57 insertions, 81 deletions
diff --git a/android/device/generated/flags.h b/android/device/generated/flags.h index 9c544272..459170a3 100644 --- a/android/device/generated/flags.h +++ b/android/device/generated/flags.h @@ -3338,9 +3338,9 @@ #undef FOR_unlink #endif -// unset fvn +// unset fvn[!fv] #undef OPTSTR_unset -#define OPTSTR_unset "fvn" +#define OPTSTR_unset "fvn[!fv]" #ifdef CLEANUP_unset #undef CLEANUP_unset #undef FOR_unset diff --git a/android/device/generated/globals.h b/android/device/generated/globals.h index 006c3377..61744c4c 100644 --- a/android/device/generated/globals.h +++ b/android/device/generated/globals.h @@ -859,11 +859,7 @@ struct sh_data { unsigned options, jobcnt, LINENO; int hfd, pid, bangpid, varslen, cdcount, srclvl, recursion; -// FUNCTION transplant pipelines from place to place? -// function keyword can have pointer to function struct? Still refcnt? -// is function body like HERE document? Lifetime rules - - // Callable functions + // Callable function array struct sh_function { char *name; struct sh_pipeline { // pipeline segments: linked list of arg w/metadata @@ -874,7 +870,9 @@ struct sh_data { int c; } arg[1]; } *pipeline; - } *functions; + unsigned long refcount; + } **functions; + long funcslen; // runtime function call stack struct sh_fcall { @@ -885,14 +883,13 @@ struct sh_data { long flags; char *str; } *vars; + long varslen, shift; -// struct sh_function *func; + struct sh_function *func; // TODO wire this up struct sh_pipeline *pl; char *ifs; - int varslen; struct sh_arg arg; struct arg_list *delete; - long shift; // Runtime stack of nested if/else/fi and for/do/done contexts. struct sh_blockstack { @@ -971,20 +968,15 @@ struct tcpsvd_data { // toys/pending/telnet.c struct telnet_data { - int port; - int sfd; - char buff[128]; - int pbuff; - char iac[256]; - int piac; - char *ttype; - struct termios def_term; + int sock; + char buf[2048]; // Half sizeof(toybuf) allows a buffer full of IACs. + char iac[128]; + int iac_len; + struct termios old_term; struct termios raw_term; - uint8_t term_ok; - uint8_t term_mode; - uint8_t flags; - unsigned win_width; - unsigned win_height; + uint8_t mode; + int echo, sga; + int state, request; }; // toys/pending/telnetd.c diff --git a/android/device/generated/help.h b/android/device/generated/help.h index 0e3af90d..4286e01d 100644 --- a/android/device/generated/help.h +++ b/android/device/generated/help.h @@ -348,7 +348,7 @@ #define HELP_telnetd "Handle incoming telnet connections\n\n-l LOGIN Exec LOGIN on connect\n-f ISSUE_FILE Display ISSUE_FILE instead of /etc/issue\n-K Close connection as soon as login exits\n-p PORT Port to listen on\n-b ADDR[:PORT] Address to bind to\n-F Run in foreground\n-i Inetd mode\n-w SEC Inetd 'wait' mode, linger time SEC\n-S Log to syslog (implied by -i or without -F and -w)" -#define HELP_telnet "usage: telnet HOST [PORT]\n\nConnect to telnet server" +#define HELP_telnet "usage: telnet HOST [PORT]\n\nConnect to telnet server." #define HELP_tcpsvd "usage: tcpsvd [-hEv] [-c N] [-C N[:MSG]] [-b N] [-u User] [-l Name] IP Port Prog\nusage: udpsvd [-hEv] [-c N] [-u User] [-l Name] IP Port Prog\n\nCreate TCP/UDP socket, bind to IP:PORT and listen for incoming connection.\nRun PROG for each connection.\n\nIP IP to listen on, 0 = all\nPORT Port to listen on\nPROG ARGS Program to run\n-l NAME Local hostname (else looks up local hostname in DNS)\n-u USER[:GRP] Change to user/group after bind\n-c N Handle up to N (> 0) connections simultaneously\n-b N (TCP Only) Allow a backlog of approximately N TCP SYNs\n-C N[:MSG] (TCP Only) Allow only up to N (> 0) connections from the same IP\n New connections from this IP address are closed\n immediately. MSG is written to the peer before close\n-h Look up peer's hostname\n-E Don't set up environment variables\n-v Verbose" @@ -374,7 +374,7 @@ #define HELP_unset "usage: unset [-fvn] NAME...\n\n-f NAME is a function\n-v NAME is a variable\n-n dereference NAME and unset that" -#define HELP_set "usage: set [+a] [+o OPTION] [VAR...]\n\nSet variables and shell attributes. Use + to disable and - to enable.\nNAME=VALUE arguments assign to the variable, any leftovers set $1, $2...\nWith no arguments, prints current variables.\n\n-f NAME is a function\n-v NAME is a variable\n-n dereference NAME and unset that\n\nOPTIONs:\n history - enable command history" +#define HELP_set "usage: set [+a] [+o OPTION] [VAR...]\n\nSet variables and shell attributes. Use + to disable and - to enable.\nNAME=VALUE arguments assign to the variable, any leftovers set $1, $2...\nWith no arguments, prints current variables.\n\n-f NAME is a function\n-v NAME is a variable\n-n don't follow name reference\n\nOPTIONs:\n history - enable command history" #define HELP_exit "usage: exit [status]\n\nExit shell. If no return value supplied on command line, use value\nof most recent command, or 0 if none." diff --git a/android/device/generated/newtoys.h b/android/device/generated/newtoys.h index 6a39d804..e97ac2f5 100644 --- a/android/device/generated/newtoys.h +++ b/android/device/generated/newtoys.h @@ -292,7 +292,7 @@ USE_UNICODE(NEWTOY(unicode, "<1", TOYFLAG_USR|TOYFLAG_BIN)) USE_UNIQ(NEWTOY(uniq, "f#s#w#zicdu", TOYFLAG_USR|TOYFLAG_BIN)) USE_UNIX2DOS(NEWTOY(unix2dos, 0, TOYFLAG_BIN)) USE_UNLINK(NEWTOY(unlink, "<1>1", TOYFLAG_USR|TOYFLAG_BIN)) -USE_SH(NEWTOY(unset, "fvn", TOYFLAG_NOFORK)) +USE_SH(NEWTOY(unset, "fvn[!fv]", TOYFLAG_NOFORK)) USE_UNSHARE(NEWTOY(unshare, "<1^f(fork);r(map-root-user);i:(ipc);m:(mount);n:(net);p:(pid);u:(uts);U:(user);", TOYFLAG_USR|TOYFLAG_BIN)) USE_UPTIME(NEWTOY(uptime, ">0ps", TOYFLAG_USR|TOYFLAG_BIN)) USE_USERADD(NEWTOY(useradd, "<1>2u#<0G:s:g:h:SDH", TOYFLAG_NEEDROOT|TOYFLAG_UMASK|TOYFLAG_SBIN)) diff --git a/android/linux/generated/flags.h b/android/linux/generated/flags.h index 6dbebfee..fadedb31 100644 --- a/android/linux/generated/flags.h +++ b/android/linux/generated/flags.h @@ -3338,9 +3338,9 @@ #undef FOR_unlink #endif -// unset fvn +// unset fvn[!fv] #undef OPTSTR_unset -#define OPTSTR_unset "fvn" +#define OPTSTR_unset "fvn[!fv]" #ifdef CLEANUP_unset #undef CLEANUP_unset #undef FOR_unset diff --git a/android/linux/generated/globals.h b/android/linux/generated/globals.h index 006c3377..61744c4c 100644 --- a/android/linux/generated/globals.h +++ b/android/linux/generated/globals.h @@ -859,11 +859,7 @@ struct sh_data { unsigned options, jobcnt, LINENO; int hfd, pid, bangpid, varslen, cdcount, srclvl, recursion; -// FUNCTION transplant pipelines from place to place? -// function keyword can have pointer to function struct? Still refcnt? -// is function body like HERE document? Lifetime rules - - // Callable functions + // Callable function array struct sh_function { char *name; struct sh_pipeline { // pipeline segments: linked list of arg w/metadata @@ -874,7 +870,9 @@ struct sh_data { int c; } arg[1]; } *pipeline; - } *functions; + unsigned long refcount; + } **functions; + long funcslen; // runtime function call stack struct sh_fcall { @@ -885,14 +883,13 @@ struct sh_data { long flags; char *str; } *vars; + long varslen, shift; -// struct sh_function *func; + struct sh_function *func; // TODO wire this up struct sh_pipeline *pl; char *ifs; - int varslen; struct sh_arg arg; struct arg_list *delete; - long shift; // Runtime stack of nested if/else/fi and for/do/done contexts. struct sh_blockstack { @@ -971,20 +968,15 @@ struct tcpsvd_data { // toys/pending/telnet.c struct telnet_data { - int port; - int sfd; - char buff[128]; - int pbuff; - char iac[256]; - int piac; - char *ttype; - struct termios def_term; + int sock; + char buf[2048]; // Half sizeof(toybuf) allows a buffer full of IACs. + char iac[128]; + int iac_len; + struct termios old_term; struct termios raw_term; - uint8_t term_ok; - uint8_t term_mode; - uint8_t flags; - unsigned win_width; - unsigned win_height; + uint8_t mode; + int echo, sga; + int state, request; }; // toys/pending/telnetd.c diff --git a/android/linux/generated/help.h b/android/linux/generated/help.h index a0c75204..c99ddf1d 100644 --- a/android/linux/generated/help.h +++ b/android/linux/generated/help.h @@ -350,7 +350,7 @@ #define HELP_telnetd "Handle incoming telnet connections\n\n-l LOGIN Exec LOGIN on connect\n-f ISSUE_FILE Display ISSUE_FILE instead of /etc/issue\n-K Close connection as soon as login exits\n-p PORT Port to listen on\n-b ADDR[:PORT] Address to bind to\n-F Run in foreground\n-i Inetd mode\n-w SEC Inetd 'wait' mode, linger time SEC\n-S Log to syslog (implied by -i or without -F and -w)" -#define HELP_telnet "usage: telnet HOST [PORT]\n\nConnect to telnet server" +#define HELP_telnet "usage: telnet HOST [PORT]\n\nConnect to telnet server." #define HELP_tcpsvd "usage: tcpsvd [-hEv] [-c N] [-C N[:MSG]] [-b N] [-u User] [-l Name] IP Port Prog\nusage: udpsvd [-hEv] [-c N] [-u User] [-l Name] IP Port Prog\n\nCreate TCP/UDP socket, bind to IP:PORT and listen for incoming connection.\nRun PROG for each connection.\n\nIP IP to listen on, 0 = all\nPORT Port to listen on\nPROG ARGS Program to run\n-l NAME Local hostname (else looks up local hostname in DNS)\n-u USER[:GRP] Change to user/group after bind\n-c N Handle up to N (> 0) connections simultaneously\n-b N (TCP Only) Allow a backlog of approximately N TCP SYNs\n-C N[:MSG] (TCP Only) Allow only up to N (> 0) connections from the same IP\n New connections from this IP address are closed\n immediately. MSG is written to the peer before close\n-h Look up peer's hostname\n-E Don't set up environment variables\n-v Verbose" @@ -376,7 +376,7 @@ #define HELP_unset "usage: unset [-fvn] NAME...\n\n-f NAME is a function\n-v NAME is a variable\n-n dereference NAME and unset that" -#define HELP_set "usage: set [+a] [+o OPTION] [VAR...]\n\nSet variables and shell attributes. Use + to disable and - to enable.\nNAME=VALUE arguments assign to the variable, any leftovers set $1, $2...\nWith no arguments, prints current variables.\n\n-f NAME is a function\n-v NAME is a variable\n-n dereference NAME and unset that\n\nOPTIONs:\n history - enable command history" +#define HELP_set "usage: set [+a] [+o OPTION] [VAR...]\n\nSet variables and shell attributes. Use + to disable and - to enable.\nNAME=VALUE arguments assign to the variable, any leftovers set $1, $2...\nWith no arguments, prints current variables.\n\n-f NAME is a function\n-v NAME is a variable\n-n don't follow name reference\n\nOPTIONs:\n history - enable command history" #define HELP_exit "usage: exit [status]\n\nExit shell. If no return value supplied on command line, use value\nof most recent command, or 0 if none." diff --git a/android/linux/generated/newtoys.h b/android/linux/generated/newtoys.h index 6a39d804..e97ac2f5 100644 --- a/android/linux/generated/newtoys.h +++ b/android/linux/generated/newtoys.h @@ -292,7 +292,7 @@ USE_UNICODE(NEWTOY(unicode, "<1", TOYFLAG_USR|TOYFLAG_BIN)) USE_UNIQ(NEWTOY(uniq, "f#s#w#zicdu", TOYFLAG_USR|TOYFLAG_BIN)) USE_UNIX2DOS(NEWTOY(unix2dos, 0, TOYFLAG_BIN)) USE_UNLINK(NEWTOY(unlink, "<1>1", TOYFLAG_USR|TOYFLAG_BIN)) -USE_SH(NEWTOY(unset, "fvn", TOYFLAG_NOFORK)) +USE_SH(NEWTOY(unset, "fvn[!fv]", TOYFLAG_NOFORK)) USE_UNSHARE(NEWTOY(unshare, "<1^f(fork);r(map-root-user);i:(ipc);m:(mount);n:(net);p:(pid);u:(uts);U:(user);", TOYFLAG_USR|TOYFLAG_BIN)) USE_UPTIME(NEWTOY(uptime, ">0ps", TOYFLAG_USR|TOYFLAG_BIN)) USE_USERADD(NEWTOY(useradd, "<1>2u#<0G:s:g:h:SDH", TOYFLAG_NEEDROOT|TOYFLAG_UMASK|TOYFLAG_SBIN)) diff --git a/android/mac/generated/flags.h b/android/mac/generated/flags.h index 741e1413..b9d6485b 100644 --- a/android/mac/generated/flags.h +++ b/android/mac/generated/flags.h @@ -3338,9 +3338,9 @@ #undef FOR_unlink #endif -// unset fvn +// unset fvn[!fv] #undef OPTSTR_unset -#define OPTSTR_unset "fvn" +#define OPTSTR_unset "fvn[!fv]" #ifdef CLEANUP_unset #undef CLEANUP_unset #undef FOR_unset diff --git a/android/mac/generated/globals.h b/android/mac/generated/globals.h index 006c3377..61744c4c 100644 --- a/android/mac/generated/globals.h +++ b/android/mac/generated/globals.h @@ -859,11 +859,7 @@ struct sh_data { unsigned options, jobcnt, LINENO; int hfd, pid, bangpid, varslen, cdcount, srclvl, recursion; -// FUNCTION transplant pipelines from place to place? -// function keyword can have pointer to function struct? Still refcnt? -// is function body like HERE document? Lifetime rules - - // Callable functions + // Callable function array struct sh_function { char *name; struct sh_pipeline { // pipeline segments: linked list of arg w/metadata @@ -874,7 +870,9 @@ struct sh_data { int c; } arg[1]; } *pipeline; - } *functions; + unsigned long refcount; + } **functions; + long funcslen; // runtime function call stack struct sh_fcall { @@ -885,14 +883,13 @@ struct sh_data { long flags; char *str; } *vars; + long varslen, shift; -// struct sh_function *func; + struct sh_function *func; // TODO wire this up struct sh_pipeline *pl; char *ifs; - int varslen; struct sh_arg arg; struct arg_list *delete; - long shift; // Runtime stack of nested if/else/fi and for/do/done contexts. struct sh_blockstack { @@ -971,20 +968,15 @@ struct tcpsvd_data { // toys/pending/telnet.c struct telnet_data { - int port; - int sfd; - char buff[128]; - int pbuff; - char iac[256]; - int piac; - char *ttype; - struct termios def_term; + int sock; + char buf[2048]; // Half sizeof(toybuf) allows a buffer full of IACs. + char iac[128]; + int iac_len; + struct termios old_term; struct termios raw_term; - uint8_t term_ok; - uint8_t term_mode; - uint8_t flags; - unsigned win_width; - unsigned win_height; + uint8_t mode; + int echo, sga; + int state, request; }; // toys/pending/telnetd.c diff --git a/android/mac/generated/help.h b/android/mac/generated/help.h index a0c75204..c99ddf1d 100644 --- a/android/mac/generated/help.h +++ b/android/mac/generated/help.h @@ -350,7 +350,7 @@ #define HELP_telnetd "Handle incoming telnet connections\n\n-l LOGIN Exec LOGIN on connect\n-f ISSUE_FILE Display ISSUE_FILE instead of /etc/issue\n-K Close connection as soon as login exits\n-p PORT Port to listen on\n-b ADDR[:PORT] Address to bind to\n-F Run in foreground\n-i Inetd mode\n-w SEC Inetd 'wait' mode, linger time SEC\n-S Log to syslog (implied by -i or without -F and -w)" -#define HELP_telnet "usage: telnet HOST [PORT]\n\nConnect to telnet server" +#define HELP_telnet "usage: telnet HOST [PORT]\n\nConnect to telnet server." #define HELP_tcpsvd "usage: tcpsvd [-hEv] [-c N] [-C N[:MSG]] [-b N] [-u User] [-l Name] IP Port Prog\nusage: udpsvd [-hEv] [-c N] [-u User] [-l Name] IP Port Prog\n\nCreate TCP/UDP socket, bind to IP:PORT and listen for incoming connection.\nRun PROG for each connection.\n\nIP IP to listen on, 0 = all\nPORT Port to listen on\nPROG ARGS Program to run\n-l NAME Local hostname (else looks up local hostname in DNS)\n-u USER[:GRP] Change to user/group after bind\n-c N Handle up to N (> 0) connections simultaneously\n-b N (TCP Only) Allow a backlog of approximately N TCP SYNs\n-C N[:MSG] (TCP Only) Allow only up to N (> 0) connections from the same IP\n New connections from this IP address are closed\n immediately. MSG is written to the peer before close\n-h Look up peer's hostname\n-E Don't set up environment variables\n-v Verbose" @@ -376,7 +376,7 @@ #define HELP_unset "usage: unset [-fvn] NAME...\n\n-f NAME is a function\n-v NAME is a variable\n-n dereference NAME and unset that" -#define HELP_set "usage: set [+a] [+o OPTION] [VAR...]\n\nSet variables and shell attributes. Use + to disable and - to enable.\nNAME=VALUE arguments assign to the variable, any leftovers set $1, $2...\nWith no arguments, prints current variables.\n\n-f NAME is a function\n-v NAME is a variable\n-n dereference NAME and unset that\n\nOPTIONs:\n history - enable command history" +#define HELP_set "usage: set [+a] [+o OPTION] [VAR...]\n\nSet variables and shell attributes. Use + to disable and - to enable.\nNAME=VALUE arguments assign to the variable, any leftovers set $1, $2...\nWith no arguments, prints current variables.\n\n-f NAME is a function\n-v NAME is a variable\n-n don't follow name reference\n\nOPTIONs:\n history - enable command history" #define HELP_exit "usage: exit [status]\n\nExit shell. If no return value supplied on command line, use value\nof most recent command, or 0 if none." diff --git a/android/mac/generated/newtoys.h b/android/mac/generated/newtoys.h index 6a39d804..e97ac2f5 100644 --- a/android/mac/generated/newtoys.h +++ b/android/mac/generated/newtoys.h @@ -292,7 +292,7 @@ USE_UNICODE(NEWTOY(unicode, "<1", TOYFLAG_USR|TOYFLAG_BIN)) USE_UNIQ(NEWTOY(uniq, "f#s#w#zicdu", TOYFLAG_USR|TOYFLAG_BIN)) USE_UNIX2DOS(NEWTOY(unix2dos, 0, TOYFLAG_BIN)) USE_UNLINK(NEWTOY(unlink, "<1>1", TOYFLAG_USR|TOYFLAG_BIN)) -USE_SH(NEWTOY(unset, "fvn", TOYFLAG_NOFORK)) +USE_SH(NEWTOY(unset, "fvn[!fv]", TOYFLAG_NOFORK)) USE_UNSHARE(NEWTOY(unshare, "<1^f(fork);r(map-root-user);i:(ipc);m:(mount);n:(net);p:(pid);u:(uts);U:(user);", TOYFLAG_USR|TOYFLAG_BIN)) USE_UPTIME(NEWTOY(uptime, ">0ps", TOYFLAG_USR|TOYFLAG_BIN)) USE_USERADD(NEWTOY(useradd, "<1>2u#<0G:s:g:h:SDH", TOYFLAG_NEEDROOT|TOYFLAG_UMASK|TOYFLAG_SBIN)) |