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.
diff --git a/archival/ar.c b/archival/ar.c
index e10bf7c..06a879b 100644
--- a/archival/ar.c
+++ b/archival/ar.c
@@ -41,7 +41,7 @@
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 @@
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;
diff --git a/archival/bunzip2.c b/archival/bunzip2.c
index 9d62366..faf997b 100644
--- a/archival/bunzip2.c
+++ b/archival/bunzip2.c
@@ -16,10 +16,10 @@
{
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];
diff --git a/archival/cpio.c b/archival/cpio.c
index 48b688e..d0d3288 100644
--- a/archival/cpio.c
+++ b/archival/cpio.c
@@ -30,7 +30,7 @@
{
archive_handle_t *archive_handle;
char *cpio_filename = NULL;
- unsigned long opt;
+ unsigned opt;
/* Initialise */
archive_handle = init_handle();
@@ -38,7 +38,7 @@
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) {
diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c
index ce65e21..80a5f32 100644
--- a/archival/dpkg_deb.c
+++ b/archival/dpkg_deb.c
@@ -18,7 +18,7 @@
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 @@
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;
diff --git a/archival/gunzip.c b/archival/gunzip.c
index 1b49686..1cde08b 100644
--- a/archival/gunzip.c
+++ b/archival/gunzip.c
@@ -40,9 +40,9 @@
{
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;
diff --git a/archival/gzip.c b/archival/gzip.c
index 2fc9f76..ef3724c 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -1134,14 +1134,14 @@
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 @@
//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);
}
diff --git a/archival/tar.c b/archival/tar.c
index bfee638..3775598 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -688,7 +688,7 @@
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 @@
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
diff --git a/archival/uncompress.c b/archival/uncompress.c
index 91568e4..d1b0d2c 100644
--- a/archival/uncompress.c
+++ b/archival/uncompress.c
@@ -16,7 +16,7 @@
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++];
diff --git a/archival/unlzma.c b/archival/unlzma.c
index b87a3fe..20891e3 100644
--- a/archival/unlzma.c
+++ b/archival/unlzma.c
@@ -19,10 +19,10 @@
{
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];