getopt_ulflags -> getopt32.
It is impossible to formulate sane ABI based on size of ulong because it can be 32-bit or 64-bit. Basically it means that you cannot portably use more that 32 option chars in one call anyway... Make it explicit.
This commit is contained in:
parent
40920825d5
commit
67b23e6043
120 changed files with 322 additions and 327 deletions
|
@ -41,7 +41,7 @@ static void header_verbose_list_ar(const file_header_t *file_header)
|
|||
int ar_main(int argc, char **argv)
|
||||
{
|
||||
archive_handle_t *archive_handle;
|
||||
unsigned long opt;
|
||||
unsigned opt;
|
||||
static const char msg_unsupported_err[] =
|
||||
"Archive %s not supported. Install binutils 'ar'.";
|
||||
char magic[8];
|
||||
|
@ -49,8 +49,8 @@ int ar_main(int argc, char **argv)
|
|||
archive_handle = init_handle();
|
||||
|
||||
/* Prepend '-' to the first argument if required */
|
||||
bb_opt_complementally = "--:p:t:x:-1:?:p--tx:t--px:x--pt";
|
||||
opt = bb_getopt_ulflags(argc, argv, "ptxovcr");
|
||||
opt_complementary = "--:p:t:x:-1:?:p--tx:t--px:x--pt";
|
||||
opt = getopt32(argc, argv, "ptxovcr");
|
||||
|
||||
if (opt & AR_CTX_PRINT) {
|
||||
archive_handle->action_data = data_extract_to_stdout;
|
||||
|
|
|
@ -16,10 +16,10 @@ int bunzip2_main(int argc, char **argv)
|
|||
{
|
||||
USE_DESKTOP(long long) int status;
|
||||
char *filename;
|
||||
unsigned long opt;
|
||||
unsigned opt;
|
||||
int src_fd, dst_fd;
|
||||
|
||||
opt = bb_getopt_ulflags(argc, argv, "cf");
|
||||
opt = getopt32(argc, argv, "cf");
|
||||
|
||||
/* Set input filename and number */
|
||||
filename = argv[optind];
|
||||
|
|
|
@ -30,7 +30,7 @@ int cpio_main(int argc, char **argv)
|
|||
{
|
||||
archive_handle_t *archive_handle;
|
||||
char *cpio_filename = NULL;
|
||||
unsigned long opt;
|
||||
unsigned opt;
|
||||
|
||||
/* Initialise */
|
||||
archive_handle = init_handle();
|
||||
|
@ -38,7 +38,7 @@ int cpio_main(int argc, char **argv)
|
|||
archive_handle->seek = seek_by_char;
|
||||
archive_handle->flags = ARCHIVE_EXTRACT_NEWER | ARCHIVE_PRESERVE_DATE;
|
||||
|
||||
opt = bb_getopt_ulflags(argc, argv, "ituvF:dm", &cpio_filename);
|
||||
opt = getopt32(argc, argv, "ituvF:dm", &cpio_filename);
|
||||
|
||||
/* One of either extract or test options must be given */
|
||||
if ((opt & (CPIO_OPT_TEST | CPIO_OPT_EXTRACT)) == 0) {
|
||||
|
|
|
@ -18,7 +18,7 @@ int dpkg_deb_main(int argc, char **argv)
|
|||
archive_handle_t *ar_archive;
|
||||
archive_handle_t *tar_archive;
|
||||
llist_t *control_tar_llist = NULL;
|
||||
unsigned long opt;
|
||||
unsigned opt;
|
||||
char *extract_dir = NULL;
|
||||
short argcount = 1;
|
||||
|
||||
|
@ -40,8 +40,8 @@ int dpkg_deb_main(int argc, char **argv)
|
|||
llist_add_to(&control_tar_llist, "control.tar.bz2");
|
||||
#endif
|
||||
|
||||
bb_opt_complementally = "?c--efXx:e--cfXx:f--ceXx:X--cefx:x--cefX";
|
||||
opt = bb_getopt_ulflags(argc, argv, "cefXx");
|
||||
opt_complementary = "?c--efXx:e--cfXx:f--ceXx:X--cefx:x--cefX";
|
||||
opt = getopt32(argc, argv, "cefXx");
|
||||
|
||||
if (opt & DPKG_DEB_OPT_CONTENTS) {
|
||||
tar_archive->action_header = header_verbose_list;
|
||||
|
|
|
@ -40,9 +40,9 @@ int gunzip_main(int argc, char **argv)
|
|||
{
|
||||
USE_DESKTOP(long long) int status;
|
||||
int exitcode = 0;
|
||||
unsigned long opt;
|
||||
unsigned opt;
|
||||
|
||||
opt = bb_getopt_ulflags(argc, argv, "cftdv");
|
||||
opt = getopt32(argc, argv, "cftdv");
|
||||
/* if called as zcat */
|
||||
if (strcmp(bb_applet_name, "zcat") == 0) {
|
||||
opt |= GUNZIP_OPT_STDOUT;
|
||||
|
|
|
@ -1134,14 +1134,14 @@ int gzip_main(int argc, char **argv)
|
|||
OPT_force = 0x2,
|
||||
};
|
||||
|
||||
unsigned long opt;
|
||||
unsigned opt;
|
||||
int result;
|
||||
int inFileNum;
|
||||
int outFileNum;
|
||||
struct stat statBuf;
|
||||
char *delFileName;
|
||||
|
||||
opt = bb_getopt_ulflags(argc, argv, "cf123456789qv" USE_GUNZIP("d"));
|
||||
opt = getopt32(argc, argv, "cf123456789qv" USE_GUNZIP("d"));
|
||||
//if (opt & 0x1) // -c
|
||||
//if (opt & 0x2) // -f
|
||||
/* Ignore 1-9 (compression level) options */
|
||||
|
@ -1157,7 +1157,7 @@ int gzip_main(int argc, char **argv)
|
|||
//if (opt & 0x800) // -q
|
||||
//if (opt & 0x1000) // -v
|
||||
if (ENABLE_GUNZIP && (opt & 0x2000)) { // -d
|
||||
/* FIXME: bb_getopt_ulflags should not depend on optind */
|
||||
/* FIXME: getopt32 should not depend on optind */
|
||||
optind = 1;
|
||||
return gunzip_main(argc, argv);
|
||||
}
|
||||
|
|
|
@ -688,7 +688,7 @@ int tar_main(int argc, char **argv)
|
|||
archive_handle_t *tar_handle;
|
||||
char *base_dir = NULL;
|
||||
const char *tar_filename = "-";
|
||||
unsigned long opt;
|
||||
unsigned opt;
|
||||
llist_t *excludes = NULL;
|
||||
|
||||
/* Initialise default values */
|
||||
|
@ -696,12 +696,12 @@ int tar_main(int argc, char **argv)
|
|||
tar_handle->flags = ARCHIVE_CREATE_LEADING_DIRS | ARCHIVE_PRESERVE_DATE | ARCHIVE_EXTRACT_UNCONDITIONAL;
|
||||
|
||||
/* Prepend '-' to the first argument if required */
|
||||
bb_opt_complementally = ENABLE_FEATURE_TAR_CREATE ?
|
||||
opt_complementary = ENABLE_FEATURE_TAR_CREATE ?
|
||||
"--:X::T::\n::c:t:x:?:c--tx:t--cx:x--ct" :
|
||||
"--:X::T::\n::t:x:?:t--x:x--t";
|
||||
if (ENABLE_FEATURE_TAR_LONG_OPTIONS)
|
||||
bb_applet_long_options = tar_long_options;
|
||||
opt = bb_getopt_ulflags(argc, argv, tar_options,
|
||||
applet_long_options = tar_long_options;
|
||||
opt = getopt32(argc, argv, tar_options,
|
||||
&base_dir, /* Change to dir <optarg> */
|
||||
&tar_filename /* archive filename */
|
||||
#ifdef CONFIG_FEATURE_TAR_FROM
|
||||
|
|
|
@ -16,7 +16,7 @@ int uncompress_main(int argc, char **argv)
|
|||
int status = EXIT_SUCCESS;
|
||||
unsigned long flags;
|
||||
|
||||
flags = bb_getopt_ulflags(argc, argv, "cf");
|
||||
flags = getopt32(argc, argv, "cf");
|
||||
|
||||
while (optind < argc) {
|
||||
char *compressed_file = argv[optind++];
|
||||
|
|
|
@ -19,10 +19,10 @@ int unlzma_main(int argc, char **argv)
|
|||
{
|
||||
USE_DESKTOP(long long) int status;
|
||||
char *filename;
|
||||
unsigned long opt;
|
||||
unsigned opt;
|
||||
int src_fd, dst_fd;
|
||||
|
||||
opt = bb_getopt_ulflags(argc, argv, "c");
|
||||
opt = getopt32(argc, argv, "c");
|
||||
|
||||
/* Set input filename and number */
|
||||
filename = argv[optind];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue