diff options
author | Elliott Hughes <enh@google.com> | 2019-12-03 13:20:13 -0800 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2019-12-03 13:23:52 -0800 |
commit | 1152553ab4cbc95067c6fbec9f6906379d142d3e (patch) | |
tree | 5a6764c96239fe67b2921887d2616b1374857bf9 /android | |
parent | c252865f699ef4ece026622846391a3d0a687d4f (diff) | |
parent | a66d839167ae90575bf35f66327e3c138404dbb8 (diff) | |
download | toybox-1152553ab4cbc95067c6fbec9f6906379d142d3e.tar.gz |
Merge remote-tracking branch 'toybox/master' into HEAD
Change-Id: Ibebacbe2c22abeff4a97aa24cbd8d4aa7d34b326
Diffstat (limited to 'android')
-rw-r--r-- | android/device/generated/config.h | 2 | ||||
-rw-r--r-- | android/device/generated/flags.h | 28 | ||||
-rw-r--r-- | android/device/generated/globals.h | 8 | ||||
-rw-r--r-- | android/device/generated/help.h | 4 | ||||
-rw-r--r-- | android/device/generated/newtoys.h | 1 | ||||
-rw-r--r-- | android/linux/generated/config.h | 2 | ||||
-rw-r--r-- | android/linux/generated/flags.h | 28 | ||||
-rw-r--r-- | android/linux/generated/globals.h | 8 | ||||
-rw-r--r-- | android/linux/generated/help.h | 4 | ||||
-rw-r--r-- | android/linux/generated/newtoys.h | 1 | ||||
-rw-r--r-- | android/mac/generated/config.h | 2 | ||||
-rw-r--r-- | android/mac/generated/flags.h | 28 | ||||
-rw-r--r-- | android/mac/generated/globals.h | 8 | ||||
-rw-r--r-- | android/mac/generated/help.h | 4 | ||||
-rw-r--r-- | android/mac/generated/newtoys.h | 1 |
15 files changed, 126 insertions, 3 deletions
diff --git a/android/device/generated/config.h b/android/device/generated/config.h index 83985d76..2c0412b2 100644 --- a/android/device/generated/config.h +++ b/android/device/generated/config.h @@ -232,6 +232,8 @@ #define USE_GETENFORCE(...) __VA_ARGS__ #define CFG_GETFATTR 1 #define USE_GETFATTR(...) __VA_ARGS__ +#define CFG_GETOPT 0 +#define USE_GETOPT(...) #define CFG_GETTY 0 #define USE_GETTY(...) #define CFG_GREP 1 diff --git a/android/device/generated/flags.h b/android/device/generated/flags.h index 84d0c60e..c9ac1dee 100644 --- a/android/device/generated/flags.h +++ b/android/device/generated/flags.h @@ -1016,6 +1016,21 @@ #undef FLAG_only_values #endif +// getopt ^(alternative)a(name)n:(options)o:(long)(longoptions)l*Tu +#undef OPTSTR_getopt +#define OPTSTR_getopt "^(alternative)a(name)n:(options)o:(long)(longoptions)l*Tu" +#ifdef CLEANUP_getopt +#undef CLEANUP_getopt +#undef FOR_getopt +#undef FLAG_u +#undef FLAG_T +#undef FLAG_l +#undef FLAG_o +#undef FLAG_n +#undef FLAG_a +#undef FLAG_alternative +#endif + // getty <2t#<0H:I:l:f:iwnmLh #undef OPTSTR_getty #define OPTSTR_getty "<2t#<0H:I:l:f:iwnmLh" @@ -4221,6 +4236,19 @@ #define FLAG_only_values (1<<3) #endif +#ifdef FOR_getopt +#ifndef TT +#define TT this.getopt +#endif +#define FLAG_u (FORCED_FLAG<<0) +#define FLAG_T (FORCED_FLAG<<1) +#define FLAG_l (FORCED_FLAG<<2) +#define FLAG_o (FORCED_FLAG<<3) +#define FLAG_n (FORCED_FLAG<<4) +#define FLAG_a (FORCED_FLAG<<5) +#define FLAG_alternative (FORCED_FLAG<<6) +#endif + #ifdef FOR_getty #ifndef TT #define TT this.getty diff --git a/android/device/generated/globals.h b/android/device/generated/globals.h index 1077449b..2af11058 100644 --- a/android/device/generated/globals.h +++ b/android/device/generated/globals.h @@ -634,6 +634,13 @@ struct getfattr_data { char *n; }; +// toys/pending/getopt.c + +struct getopt_data { + struct arg_list *l; + char *o, *n; +}; + // toys/pending/getty.c struct getty_data { @@ -1499,6 +1506,7 @@ extern union global_union { struct fold_data fold; struct fsck_data fsck; struct getfattr_data getfattr; + struct getopt_data getopt; struct getty_data getty; struct groupadd_data groupadd; struct host_data host; diff --git a/android/device/generated/help.h b/android/device/generated/help.h index a3b3d5d3..435ceeb8 100644 --- a/android/device/generated/help.h +++ b/android/device/generated/help.h @@ -400,6 +400,8 @@ #define HELP_getty "usage: getty [OPTIONS] BAUD_RATE[,BAUD_RATE]... TTY [TERMTYPE]\n\n-h Enable hardware RTS/CTS flow control\n-L Set CLOCAL (ignore Carrier Detect state)\n-m Get baud rate from modem's CONNECT status message\n-n Don't prompt for login name\n-w Wait for CR or LF before sending /etc/issue\n-i Don't display /etc/issue\n-f ISSUE_FILE Display ISSUE_FILE instead of /etc/issue\n-l LOGIN Invoke LOGIN instead of /bin/login\n-t SEC Terminate after SEC if no login name is read\n-I INITSTR Send INITSTR before anything else\n-H HOST Log HOST into the utmp file as the hostname" +#define HELP_getopt "usage: getopt [OPTIONS] [--] ARG...\n\nParse command-line options for use in shell scripts.\n\n-a Allow long options starting with a single -.\n-l OPTS Specify long options.\n-n NAME Command name for error messages.\n-o OPTS Specify short options.\n-T Test whether this is a modern getopt.\n-u Output options unquoted." + #define HELP_getfattr "usage: getfattr [-d] [-h] [-n NAME] FILE...\n\nRead POSIX extended attributes.\n\n-d Show values as well as names\n-h Do not dereference symbolic links\n-n Show only attributes with the given name\n--only-values Don't show names" #define HELP_fsck "usage: fsck [-ANPRTV] [-C FD] [-t FSTYPE] [FS_OPTS] [BLOCKDEV]...\n\nCheck and repair filesystems\n\n-A Walk /etc/fstab and check all filesystems\n-N Don't execute, just show what would be done\n-P With -A, check filesystems in parallel\n-R With -A, skip the root filesystem\n-T Don't show title on startup\n-V Verbose\n-C n Write status information to specified file descriptor\n-t TYPE List of filesystem types to check" @@ -540,7 +542,7 @@ #define HELP_id "usage: id [-GZgnru] [USER...]\n\nPrint user and group ID.\n-G Show all group IDs\n-Z Show only security context\n-g Show only the effective group ID\n-n Print names instead of numeric IDs (to be used with -Ggu)\n-r Show real ID instead of effective ID\n-u Show only the effective user ID" -#define HELP_iconv "usage: iconv [-f FROM] [-t TO] [FILE...]\n\nConvert character encoding of files.\n\n-c Omit invalid chars\n-f Convert from (default utf8)\n-t Convert to (default utf8)" +#define HELP_iconv "usage: iconv [-f FROM] [-t TO] [FILE...]\n\nConvert character encoding of files.\n\n-c Omit invalid chars\n-f Convert from (default UTF-8)\n-t Convert to (default UTF-8)" #define HELP_head "usage: head [-n number] [file...]\n\nCopy first lines from files to stdout. If no files listed, copy from\nstdin. Filename \"-\" is a synonym for stdin.\n\n-n Number of lines to copy\n-c Number of bytes to copy\n-q Never print headers\n-v Always print headers" diff --git a/android/device/generated/newtoys.h b/android/device/generated/newtoys.h index a504d757..fc36a4d1 100644 --- a/android/device/generated/newtoys.h +++ b/android/device/generated/newtoys.h @@ -93,6 +93,7 @@ USE_FTPPUT(OLDTOY(ftpput, ftpget, TOYFLAG_USR|TOYFLAG_BIN)) USE_GETCONF(NEWTOY(getconf, ">2al", TOYFLAG_USR|TOYFLAG_BIN)) USE_GETENFORCE(NEWTOY(getenforce, ">0", TOYFLAG_USR|TOYFLAG_SBIN)) USE_GETFATTR(NEWTOY(getfattr, "(only-values)dhn:", TOYFLAG_USR|TOYFLAG_BIN)) +USE_GETOPT(NEWTOY(getopt, "^(alternative)a(name)n:(options)o:(long)(longoptions)l*Tu", TOYFLAG_USR|TOYFLAG_BIN)) USE_GETTY(NEWTOY(getty, "<2t#<0H:I:l:f:iwnmLh",TOYFLAG_SBIN)) USE_GREP(NEWTOY(grep, "(line-buffered)(color):;(exclude-dir)*S(exclude)*M(include)*ZzEFHIab(byte-offset)h(no-filename)ino(only-matching)rRsvwcl(files-with-matches)q(quiet)(silent)e*f*C#B#A#m#x[!wx][!EFw]", TOYFLAG_BIN|TOYFLAG_ARGFAIL(2))) USE_GROUPADD(NEWTOY(groupadd, "<1>2g#<0S", TOYFLAG_NEEDROOT|TOYFLAG_SBIN)) diff --git a/android/linux/generated/config.h b/android/linux/generated/config.h index 6639a64a..513ddfb7 100644 --- a/android/linux/generated/config.h +++ b/android/linux/generated/config.h @@ -228,6 +228,8 @@ #define USE_GETENFORCE(...) #define CFG_GETFATTR 0 #define USE_GETFATTR(...) +#define CFG_GETOPT 0 +#define USE_GETOPT(...) #define CFG_GETTY 0 #define USE_GETTY(...) #define CFG_GREP 1 diff --git a/android/linux/generated/flags.h b/android/linux/generated/flags.h index b17718d0..b69e6541 100644 --- a/android/linux/generated/flags.h +++ b/android/linux/generated/flags.h @@ -1016,6 +1016,21 @@ #undef FLAG_only_values #endif +// getopt ^(alternative)a(name)n:(options)o:(long)(longoptions)l*Tu +#undef OPTSTR_getopt +#define OPTSTR_getopt "^(alternative)a(name)n:(options)o:(long)(longoptions)l*Tu" +#ifdef CLEANUP_getopt +#undef CLEANUP_getopt +#undef FOR_getopt +#undef FLAG_u +#undef FLAG_T +#undef FLAG_l +#undef FLAG_o +#undef FLAG_n +#undef FLAG_a +#undef FLAG_alternative +#endif + // getty <2t#<0H:I:l:f:iwnmLh #undef OPTSTR_getty #define OPTSTR_getty "<2t#<0H:I:l:f:iwnmLh" @@ -4221,6 +4236,19 @@ #define FLAG_only_values (FORCED_FLAG<<3) #endif +#ifdef FOR_getopt +#ifndef TT +#define TT this.getopt +#endif +#define FLAG_u (FORCED_FLAG<<0) +#define FLAG_T (FORCED_FLAG<<1) +#define FLAG_l (FORCED_FLAG<<2) +#define FLAG_o (FORCED_FLAG<<3) +#define FLAG_n (FORCED_FLAG<<4) +#define FLAG_a (FORCED_FLAG<<5) +#define FLAG_alternative (FORCED_FLAG<<6) +#endif + #ifdef FOR_getty #ifndef TT #define TT this.getty diff --git a/android/linux/generated/globals.h b/android/linux/generated/globals.h index 1077449b..2af11058 100644 --- a/android/linux/generated/globals.h +++ b/android/linux/generated/globals.h @@ -634,6 +634,13 @@ struct getfattr_data { char *n; }; +// toys/pending/getopt.c + +struct getopt_data { + struct arg_list *l; + char *o, *n; +}; + // toys/pending/getty.c struct getty_data { @@ -1499,6 +1506,7 @@ extern union global_union { struct fold_data fold; struct fsck_data fsck; struct getfattr_data getfattr; + struct getopt_data getopt; struct getty_data getty; struct groupadd_data groupadd; struct host_data host; diff --git a/android/linux/generated/help.h b/android/linux/generated/help.h index ce4abfee..cae178ed 100644 --- a/android/linux/generated/help.h +++ b/android/linux/generated/help.h @@ -404,6 +404,8 @@ #define HELP_getty "usage: getty [OPTIONS] BAUD_RATE[,BAUD_RATE]... TTY [TERMTYPE]\n\n-h Enable hardware RTS/CTS flow control\n-L Set CLOCAL (ignore Carrier Detect state)\n-m Get baud rate from modem's CONNECT status message\n-n Don't prompt for login name\n-w Wait for CR or LF before sending /etc/issue\n-i Don't display /etc/issue\n-f ISSUE_FILE Display ISSUE_FILE instead of /etc/issue\n-l LOGIN Invoke LOGIN instead of /bin/login\n-t SEC Terminate after SEC if no login name is read\n-I INITSTR Send INITSTR before anything else\n-H HOST Log HOST into the utmp file as the hostname" +#define HELP_getopt "usage: getopt [OPTIONS] [--] ARG...\n\nParse command-line options for use in shell scripts.\n\n-a Allow long options starting with a single -.\n-l OPTS Specify long options.\n-n NAME Command name for error messages.\n-o OPTS Specify short options.\n-T Test whether this is a modern getopt.\n-u Output options unquoted." + #define HELP_getfattr "usage: getfattr [-d] [-h] [-n NAME] FILE...\n\nRead POSIX extended attributes.\n\n-d Show values as well as names\n-h Do not dereference symbolic links\n-n Show only attributes with the given name\n--only-values Don't show names" #define HELP_fsck "usage: fsck [-ANPRTV] [-C FD] [-t FSTYPE] [FS_OPTS] [BLOCKDEV]...\n\nCheck and repair filesystems\n\n-A Walk /etc/fstab and check all filesystems\n-N Don't execute, just show what would be done\n-P With -A, check filesystems in parallel\n-R With -A, skip the root filesystem\n-T Don't show title on startup\n-V Verbose\n-C n Write status information to specified file descriptor\n-t TYPE List of filesystem types to check" @@ -548,7 +550,7 @@ #define HELP_id "usage: id [-nGgru] [USER...]\n\nPrint user and group ID.\n\n-G Show all group IDs\n-g Show only the effective group ID\n-n Print names instead of numeric IDs (to be used with -Ggu)\n-r Show real ID instead of effective ID\n-u Show only the effective user ID" -#define HELP_iconv "usage: iconv [-f FROM] [-t TO] [FILE...]\n\nConvert character encoding of files.\n\n-c Omit invalid chars\n-f Convert from (default utf8)\n-t Convert to (default utf8)" +#define HELP_iconv "usage: iconv [-f FROM] [-t TO] [FILE...]\n\nConvert character encoding of files.\n\n-c Omit invalid chars\n-f Convert from (default UTF-8)\n-t Convert to (default UTF-8)" #define HELP_head "usage: head [-n number] [file...]\n\nCopy first lines from files to stdout. If no files listed, copy from\nstdin. Filename \"-\" is a synonym for stdin.\n\n-n Number of lines to copy\n-c Number of bytes to copy\n-q Never print headers\n-v Always print headers" diff --git a/android/linux/generated/newtoys.h b/android/linux/generated/newtoys.h index a504d757..fc36a4d1 100644 --- a/android/linux/generated/newtoys.h +++ b/android/linux/generated/newtoys.h @@ -93,6 +93,7 @@ USE_FTPPUT(OLDTOY(ftpput, ftpget, TOYFLAG_USR|TOYFLAG_BIN)) USE_GETCONF(NEWTOY(getconf, ">2al", TOYFLAG_USR|TOYFLAG_BIN)) USE_GETENFORCE(NEWTOY(getenforce, ">0", TOYFLAG_USR|TOYFLAG_SBIN)) USE_GETFATTR(NEWTOY(getfattr, "(only-values)dhn:", TOYFLAG_USR|TOYFLAG_BIN)) +USE_GETOPT(NEWTOY(getopt, "^(alternative)a(name)n:(options)o:(long)(longoptions)l*Tu", TOYFLAG_USR|TOYFLAG_BIN)) USE_GETTY(NEWTOY(getty, "<2t#<0H:I:l:f:iwnmLh",TOYFLAG_SBIN)) USE_GREP(NEWTOY(grep, "(line-buffered)(color):;(exclude-dir)*S(exclude)*M(include)*ZzEFHIab(byte-offset)h(no-filename)ino(only-matching)rRsvwcl(files-with-matches)q(quiet)(silent)e*f*C#B#A#m#x[!wx][!EFw]", TOYFLAG_BIN|TOYFLAG_ARGFAIL(2))) USE_GROUPADD(NEWTOY(groupadd, "<1>2g#<0S", TOYFLAG_NEEDROOT|TOYFLAG_SBIN)) diff --git a/android/mac/generated/config.h b/android/mac/generated/config.h index f488707b..4af10fbf 100644 --- a/android/mac/generated/config.h +++ b/android/mac/generated/config.h @@ -228,6 +228,8 @@ #define USE_GETENFORCE(...) #define CFG_GETFATTR 0 #define USE_GETFATTR(...) +#define CFG_GETOPT 0 +#define USE_GETOPT(...) #define CFG_GETTY 0 #define USE_GETTY(...) #define CFG_GREP 1 diff --git a/android/mac/generated/flags.h b/android/mac/generated/flags.h index e89d101f..225667b4 100644 --- a/android/mac/generated/flags.h +++ b/android/mac/generated/flags.h @@ -1016,6 +1016,21 @@ #undef FLAG_only_values #endif +// getopt ^(alternative)a(name)n:(options)o:(long)(longoptions)l*Tu +#undef OPTSTR_getopt +#define OPTSTR_getopt "^(alternative)a(name)n:(options)o:(long)(longoptions)l*Tu" +#ifdef CLEANUP_getopt +#undef CLEANUP_getopt +#undef FOR_getopt +#undef FLAG_u +#undef FLAG_T +#undef FLAG_l +#undef FLAG_o +#undef FLAG_n +#undef FLAG_a +#undef FLAG_alternative +#endif + // getty <2t#<0H:I:l:f:iwnmLh #undef OPTSTR_getty #define OPTSTR_getty "<2t#<0H:I:l:f:iwnmLh" @@ -4221,6 +4236,19 @@ #define FLAG_only_values (FORCED_FLAG<<3) #endif +#ifdef FOR_getopt +#ifndef TT +#define TT this.getopt +#endif +#define FLAG_u (FORCED_FLAG<<0) +#define FLAG_T (FORCED_FLAG<<1) +#define FLAG_l (FORCED_FLAG<<2) +#define FLAG_o (FORCED_FLAG<<3) +#define FLAG_n (FORCED_FLAG<<4) +#define FLAG_a (FORCED_FLAG<<5) +#define FLAG_alternative (FORCED_FLAG<<6) +#endif + #ifdef FOR_getty #ifndef TT #define TT this.getty diff --git a/android/mac/generated/globals.h b/android/mac/generated/globals.h index 1077449b..2af11058 100644 --- a/android/mac/generated/globals.h +++ b/android/mac/generated/globals.h @@ -634,6 +634,13 @@ struct getfattr_data { char *n; }; +// toys/pending/getopt.c + +struct getopt_data { + struct arg_list *l; + char *o, *n; +}; + // toys/pending/getty.c struct getty_data { @@ -1499,6 +1506,7 @@ extern union global_union { struct fold_data fold; struct fsck_data fsck; struct getfattr_data getfattr; + struct getopt_data getopt; struct getty_data getty; struct groupadd_data groupadd; struct host_data host; diff --git a/android/mac/generated/help.h b/android/mac/generated/help.h index ce4abfee..cae178ed 100644 --- a/android/mac/generated/help.h +++ b/android/mac/generated/help.h @@ -404,6 +404,8 @@ #define HELP_getty "usage: getty [OPTIONS] BAUD_RATE[,BAUD_RATE]... TTY [TERMTYPE]\n\n-h Enable hardware RTS/CTS flow control\n-L Set CLOCAL (ignore Carrier Detect state)\n-m Get baud rate from modem's CONNECT status message\n-n Don't prompt for login name\n-w Wait for CR or LF before sending /etc/issue\n-i Don't display /etc/issue\n-f ISSUE_FILE Display ISSUE_FILE instead of /etc/issue\n-l LOGIN Invoke LOGIN instead of /bin/login\n-t SEC Terminate after SEC if no login name is read\n-I INITSTR Send INITSTR before anything else\n-H HOST Log HOST into the utmp file as the hostname" +#define HELP_getopt "usage: getopt [OPTIONS] [--] ARG...\n\nParse command-line options for use in shell scripts.\n\n-a Allow long options starting with a single -.\n-l OPTS Specify long options.\n-n NAME Command name for error messages.\n-o OPTS Specify short options.\n-T Test whether this is a modern getopt.\n-u Output options unquoted." + #define HELP_getfattr "usage: getfattr [-d] [-h] [-n NAME] FILE...\n\nRead POSIX extended attributes.\n\n-d Show values as well as names\n-h Do not dereference symbolic links\n-n Show only attributes with the given name\n--only-values Don't show names" #define HELP_fsck "usage: fsck [-ANPRTV] [-C FD] [-t FSTYPE] [FS_OPTS] [BLOCKDEV]...\n\nCheck and repair filesystems\n\n-A Walk /etc/fstab and check all filesystems\n-N Don't execute, just show what would be done\n-P With -A, check filesystems in parallel\n-R With -A, skip the root filesystem\n-T Don't show title on startup\n-V Verbose\n-C n Write status information to specified file descriptor\n-t TYPE List of filesystem types to check" @@ -548,7 +550,7 @@ #define HELP_id "usage: id [-nGgru] [USER...]\n\nPrint user and group ID.\n\n-G Show all group IDs\n-g Show only the effective group ID\n-n Print names instead of numeric IDs (to be used with -Ggu)\n-r Show real ID instead of effective ID\n-u Show only the effective user ID" -#define HELP_iconv "usage: iconv [-f FROM] [-t TO] [FILE...]\n\nConvert character encoding of files.\n\n-c Omit invalid chars\n-f Convert from (default utf8)\n-t Convert to (default utf8)" +#define HELP_iconv "usage: iconv [-f FROM] [-t TO] [FILE...]\n\nConvert character encoding of files.\n\n-c Omit invalid chars\n-f Convert from (default UTF-8)\n-t Convert to (default UTF-8)" #define HELP_head "usage: head [-n number] [file...]\n\nCopy first lines from files to stdout. If no files listed, copy from\nstdin. Filename \"-\" is a synonym for stdin.\n\n-n Number of lines to copy\n-c Number of bytes to copy\n-q Never print headers\n-v Always print headers" diff --git a/android/mac/generated/newtoys.h b/android/mac/generated/newtoys.h index a504d757..fc36a4d1 100644 --- a/android/mac/generated/newtoys.h +++ b/android/mac/generated/newtoys.h @@ -93,6 +93,7 @@ USE_FTPPUT(OLDTOY(ftpput, ftpget, TOYFLAG_USR|TOYFLAG_BIN)) USE_GETCONF(NEWTOY(getconf, ">2al", TOYFLAG_USR|TOYFLAG_BIN)) USE_GETENFORCE(NEWTOY(getenforce, ">0", TOYFLAG_USR|TOYFLAG_SBIN)) USE_GETFATTR(NEWTOY(getfattr, "(only-values)dhn:", TOYFLAG_USR|TOYFLAG_BIN)) +USE_GETOPT(NEWTOY(getopt, "^(alternative)a(name)n:(options)o:(long)(longoptions)l*Tu", TOYFLAG_USR|TOYFLAG_BIN)) USE_GETTY(NEWTOY(getty, "<2t#<0H:I:l:f:iwnmLh",TOYFLAG_SBIN)) USE_GREP(NEWTOY(grep, "(line-buffered)(color):;(exclude-dir)*S(exclude)*M(include)*ZzEFHIab(byte-offset)h(no-filename)ino(only-matching)rRsvwcl(files-with-matches)q(quiet)(silent)e*f*C#B#A#m#x[!wx][!EFw]", TOYFLAG_BIN|TOYFLAG_ARGFAIL(2))) USE_GROUPADD(NEWTOY(groupadd, "<1>2g#<0S", TOYFLAG_NEEDROOT|TOYFLAG_SBIN)) |