*: remove some uses of argc
function old new delta whoami_main 34 37 +3 logname_main 60 63 +3 hostid_main 35 38 +3 ttysize_main 136 135 -1 nmeter_main 673 672 -1 logger_main 387 386 -1 uuencode_main 330 328 -2 ifupdown_main 2125 2123 -2 mesg_main 158 155 -3 free_main 333 330 -3 cal_main 902 899 -3 acpid_main 443 440 -3 ar_main 196 189 -7 find_main 476 467 -9 ifconfig_main 1235 1221 -14 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/12 up/down: 9/-49) Total: -40 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
a355da0775
commit
2ec91aead5
@ -38,7 +38,7 @@ static void FAST_FUNC header_verbose_list_ar(const file_header_t *file_header)
|
||||
#define AR_OPT_INSERT 0x40
|
||||
|
||||
int ar_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int ar_main(int argc, char **argv)
|
||||
int ar_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
static const char msg_unsupported_err[] ALIGN1 =
|
||||
"archive %s is not supported";
|
||||
@ -51,6 +51,7 @@ int ar_main(int argc, char **argv)
|
||||
/* Prepend '-' to the first argument if required */
|
||||
opt_complementary = "--:p:t:x:-1:p--tx:t--px:x--pt";
|
||||
opt = getopt32(argv, "ptxovcr");
|
||||
argv += optind;
|
||||
|
||||
if (opt & AR_CTX_PRINT) {
|
||||
archive_handle->action_data = data_extract_to_stdout;
|
||||
@ -76,9 +77,9 @@ int ar_main(int argc, char **argv)
|
||||
|
||||
archive_handle->src_fd = xopen(argv[optind++], O_RDONLY);
|
||||
|
||||
while (optind < argc) {
|
||||
while (*argv) {
|
||||
archive_handle->filter = filter_accept_list;
|
||||
llist_add_to(&(archive_handle->accept), argv[optind++]);
|
||||
llist_add_to(&archive_handle->accept, *argv++);
|
||||
}
|
||||
|
||||
unpack_ar_archive(archive_handle);
|
||||
|
@ -116,7 +116,9 @@ int rpm_main(int argc, char **argv)
|
||||
}
|
||||
argv += optind;
|
||||
//argc -= optind;
|
||||
if (!argv[0]) bb_show_usage();
|
||||
if (!argv[0]) {
|
||||
bb_show_usage();
|
||||
}
|
||||
|
||||
while (*argv) {
|
||||
rpm_fd = xopen(*argv++, O_RDONLY);
|
||||
|
@ -77,7 +77,7 @@ static char *build_row(char *p, unsigned *dp);
|
||||
#define HEAD_SEP 2 /* spaces between day headings */
|
||||
|
||||
int cal_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int cal_main(int argc, char **argv)
|
||||
int cal_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
struct tm *local_time;
|
||||
struct tm zero_tm;
|
||||
@ -92,13 +92,8 @@ int cal_main(int argc, char **argv)
|
||||
option_mask32 &= 1;
|
||||
month = 0;
|
||||
argv += optind;
|
||||
argc -= optind;
|
||||
|
||||
if (argc > 2) {
|
||||
bb_show_usage();
|
||||
}
|
||||
|
||||
if (!argc) {
|
||||
if (!argv[0]) {
|
||||
time(&now);
|
||||
local_time = localtime(&now);
|
||||
year = local_time->tm_year + 1900;
|
||||
@ -106,7 +101,10 @@ int cal_main(int argc, char **argv)
|
||||
month = local_time->tm_mon + 1;
|
||||
}
|
||||
} else {
|
||||
if (argc == 2) {
|
||||
if (argv[1]) {
|
||||
if (argv[2]) {
|
||||
bb_show_usage();
|
||||
}
|
||||
month = xatou_range(*argv++, 1, 12);
|
||||
}
|
||||
year = xatou_range(*argv, 1, 9999);
|
||||
|
@ -14,9 +14,9 @@
|
||||
/* This is a NOFORK applet. Be very careful! */
|
||||
|
||||
int hostid_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int hostid_main(int argc, char **argv UNUSED_PARAM)
|
||||
int hostid_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
|
||||
{
|
||||
if (argc > 1) {
|
||||
if (argv[1]) {
|
||||
bb_show_usage();
|
||||
}
|
||||
|
||||
|
@ -25,11 +25,11 @@
|
||||
/* This is a NOFORK applet. Be very careful! */
|
||||
|
||||
int logname_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int logname_main(int argc, char **argv UNUSED_PARAM)
|
||||
int logname_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
|
||||
{
|
||||
char buf[64];
|
||||
|
||||
if (argc > 1) {
|
||||
if (argv[1]) {
|
||||
bb_show_usage();
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,9 @@ int nohup_main(int argc UNUSED_PARAM, char **argv)
|
||||
|
||||
xfunc_error_retval = 127;
|
||||
|
||||
if (!argv[1]) bb_show_usage();
|
||||
if (!argv[1]) {
|
||||
bb_show_usage();
|
||||
}
|
||||
|
||||
/* If stdin is a tty, detach from it. */
|
||||
if (isatty(STDIN_FILENO)) {
|
||||
|
@ -16,7 +16,7 @@ enum {
|
||||
};
|
||||
|
||||
int uuencode_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int uuencode_main(int argc, char **argv)
|
||||
int uuencode_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
struct stat stat_buf;
|
||||
int src_fd = STDIN_FILENO;
|
||||
@ -32,7 +32,7 @@ int uuencode_main(int argc, char **argv)
|
||||
tbl = bb_uuenc_tbl_base64;
|
||||
}
|
||||
argv += optind;
|
||||
if (argc == optind + 2) {
|
||||
if (argv[1]) {
|
||||
src_fd = xopen(*argv, O_RDONLY);
|
||||
fstat(src_fd, &stat_buf);
|
||||
mode = stat_buf.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
|
@ -14,9 +14,9 @@
|
||||
/* This is a NOFORK applet. Be very careful! */
|
||||
|
||||
int whoami_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int whoami_main(int argc, char **argv UNUSED_PARAM)
|
||||
int whoami_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
|
||||
{
|
||||
if (argc > 1)
|
||||
if (argv[1])
|
||||
bb_show_usage();
|
||||
|
||||
/* Will complain and die if username not found */
|
||||
|
@ -835,7 +835,7 @@ static action*** parse_params(char **argv)
|
||||
|
||||
|
||||
int find_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int find_main(int argc, char **argv)
|
||||
int find_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
static const char options[] ALIGN1 =
|
||||
"-follow\0"
|
||||
@ -859,7 +859,7 @@ IF_FEATURE_FIND_MAXDEPTH(OPT_MINDEPTH,)
|
||||
|
||||
INIT_G();
|
||||
|
||||
for (firstopt = 1; firstopt < argc; firstopt++) {
|
||||
for (firstopt = 1; argv[firstopt]; firstopt++) {
|
||||
if (argv[firstopt][0] == '-')
|
||||
break;
|
||||
if (ENABLE_FEATURE_FIND_NOT && LONE_CHAR(argv[firstopt], '!'))
|
||||
|
@ -519,7 +519,7 @@ static int grep_dir(const char *dir)
|
||||
}
|
||||
|
||||
int grep_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int grep_main(int argc, char **argv)
|
||||
int grep_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
FILE *file;
|
||||
int matched;
|
||||
@ -606,7 +606,6 @@ int grep_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
argv += optind;
|
||||
argc -= optind;
|
||||
|
||||
/* if we didn't get a pattern from -e and no command file was specified,
|
||||
* first parameter should be the pattern. no pattern, no worky */
|
||||
@ -616,12 +615,11 @@ int grep_main(int argc, char **argv)
|
||||
bb_show_usage();
|
||||
pattern = new_grep_list_data(*argv++, 0);
|
||||
llist_add_to(&pattern_head, pattern);
|
||||
argc--;
|
||||
}
|
||||
|
||||
/* argv[0..(argc-1)] should be names of file to grep through. If
|
||||
* there is more than one file to grep, we will print the filenames. */
|
||||
if (argc > 1)
|
||||
if (argv[0] && argv[1])
|
||||
print_filename = 1;
|
||||
/* -H / -h of course override */
|
||||
if (option_mask32 & OPT_H)
|
||||
@ -633,7 +631,7 @@ int grep_main(int argc, char **argv)
|
||||
* stdin. Otherwise, we grep through all the files specified. */
|
||||
matched = 0;
|
||||
do {
|
||||
cur_file = *argv++;
|
||||
cur_file = *argv;
|
||||
file = stdin;
|
||||
if (!cur_file || LONE_DASH(cur_file)) {
|
||||
cur_file = "(standard input)";
|
||||
@ -659,7 +657,7 @@ int grep_main(int argc, char **argv)
|
||||
matched += grep_file(file);
|
||||
fclose_if_not_stdin(file);
|
||||
grep_done: ;
|
||||
} while (--argc > 0);
|
||||
} while (*argv && *++argv);
|
||||
|
||||
/* destroy all the elments in the pattern list */
|
||||
if (ENABLE_FEATURE_CLEAN_UP) {
|
||||
|
10
init/mesg.c
10
init/mesg.c
@ -16,21 +16,23 @@
|
||||
#endif
|
||||
|
||||
int mesg_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int mesg_main(int argc, char **argv)
|
||||
int mesg_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
struct stat sb;
|
||||
const char *tty;
|
||||
char c = 0;
|
||||
|
||||
if (--argc == 0
|
||||
|| (argc == 1 && ((c = **++argv) == 'y' || c == 'n'))
|
||||
argv++;
|
||||
|
||||
if (!argv[0]
|
||||
|| (!argv[1] && ((c = argv[0][0]) == 'y' || c == 'n'))
|
||||
) {
|
||||
tty = xmalloc_ttyname(STDERR_FILENO);
|
||||
if (tty == NULL) {
|
||||
tty = "ttyname";
|
||||
} else if (stat(tty, &sb) == 0) {
|
||||
mode_t m;
|
||||
if (argc == 0) {
|
||||
if (c == 0) {
|
||||
puts((sb.st_mode & (S_IWGRP|S_IWOTH)) ? "is y" : "is n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@
|
||||
#endif
|
||||
|
||||
int last_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int last_main(int argc, char **argv UNUSED_PARAM)
|
||||
int last_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
|
||||
{
|
||||
struct utmp ut;
|
||||
int n, file = STDIN_FILENO;
|
||||
@ -56,7 +56,7 @@ int last_main(int argc, char **argv UNUSED_PARAM)
|
||||
TYPE_OLD_TIME /* OLD_TIME, 4 */
|
||||
};
|
||||
|
||||
if (argc > 1) {
|
||||
if (argv[1]) {
|
||||
bb_show_usage();
|
||||
}
|
||||
file = xopen(bb_path_wtmp_file, O_RDONLY);
|
||||
|
@ -13,11 +13,13 @@
|
||||
#include "libbb.h"
|
||||
|
||||
int readahead_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int readahead_main(int argc, char **argv)
|
||||
int readahead_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
int retval = EXIT_SUCCESS;
|
||||
|
||||
if (argc == 1) bb_show_usage();
|
||||
if (!argv[1]) {
|
||||
bb_show_usage();
|
||||
}
|
||||
|
||||
while (*++argv) {
|
||||
int fd = open_or_warn(*argv, O_RDONLY);
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "libbb.h"
|
||||
|
||||
int ttysize_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int ttysize_main(int argc, char **argv)
|
||||
int ttysize_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
unsigned w, h;
|
||||
struct winsize wsz;
|
||||
@ -24,7 +24,7 @@ int ttysize_main(int argc, char **argv)
|
||||
h = wsz.ws_row;
|
||||
}
|
||||
|
||||
if (argc == 1) {
|
||||
if (!argv[1]) {
|
||||
printf("%u %u", w, h);
|
||||
} else {
|
||||
const char *fmt, *arg;
|
||||
|
@ -260,7 +260,7 @@ static int in_ether(const char *bufp, struct sockaddr *sap);
|
||||
* Our main function.
|
||||
*/
|
||||
int ifconfig_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int ifconfig_main(int argc, char **argv)
|
||||
int ifconfig_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
struct ifreq ifr;
|
||||
struct sockaddr_in sai;
|
||||
@ -291,19 +291,17 @@ int ifconfig_main(int argc, char **argv)
|
||||
|
||||
/* skip argv[0] */
|
||||
++argv;
|
||||
--argc;
|
||||
|
||||
#if ENABLE_FEATURE_IFCONFIG_STATUS
|
||||
if (argc > 0 && (argv[0][0] == '-' && argv[0][1] == 'a' && !argv[0][2])) {
|
||||
if (argv[0] && (argv[0][0] == '-' && argv[0][1] == 'a' && !argv[0][2])) {
|
||||
interface_opt_a = 1;
|
||||
--argc;
|
||||
++argv;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (argc <= 1) {
|
||||
if (!argv[0] || !argv[1]) { /* one or no args */
|
||||
#if ENABLE_FEATURE_IFCONFIG_STATUS
|
||||
return display_interfaces(argc ? *argv : NULL);
|
||||
return display_interfaces(argv[0] /* can be NULL */);
|
||||
#else
|
||||
bb_error_msg_and_die("no support for status display");
|
||||
#endif
|
||||
|
@ -1142,7 +1142,7 @@ static llist_t *read_iface_state(void)
|
||||
|
||||
|
||||
int ifupdown_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int ifupdown_main(int argc, char **argv)
|
||||
int ifupdown_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
int (*cmds)(struct interface_defn_t *);
|
||||
struct interfaces_file_t *defn;
|
||||
@ -1161,7 +1161,8 @@ int ifupdown_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
getopt32(argv, OPTION_STR, &interfaces);
|
||||
if (argc - optind > 0) {
|
||||
argv += optind;
|
||||
if (argv[0]) {
|
||||
if (DO_ALL) bb_show_usage();
|
||||
} else {
|
||||
if (!DO_ALL) bb_show_usage();
|
||||
@ -1175,7 +1176,7 @@ int ifupdown_main(int argc, char **argv)
|
||||
if (DO_ALL) {
|
||||
target_list = defn->autointerfaces;
|
||||
} else {
|
||||
llist_add_to_end(&target_list, argv[optind]);
|
||||
llist_add_to_end(&target_list, argv[0]);
|
||||
}
|
||||
|
||||
/* Update the interfaces */
|
||||
|
@ -673,7 +673,7 @@ Debug("wrote %d to net, errno %d", rr, errno);
|
||||
|
||||
/* main: now we pull it all together... */
|
||||
int nc_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int nc_main(int argc, char **argv)
|
||||
int nc_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
char *str_p, *str_s;
|
||||
IF_NC_EXTRA(char *str_i, *str_o;)
|
||||
@ -702,7 +702,6 @@ int nc_main(int argc, char **argv)
|
||||
while (*++proggie) {
|
||||
if (strcmp(*proggie, "-e") == 0) {
|
||||
*proggie = NULL;
|
||||
argc = proggie - argv;
|
||||
proggie++;
|
||||
goto e_found;
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ static ALWAYS_INLINE unsigned random_delay_ms(unsigned secs)
|
||||
* main program
|
||||
*/
|
||||
int zcip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int zcip_main(int argc, char **argv)
|
||||
int zcip_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
int state;
|
||||
char *r_opt;
|
||||
@ -241,7 +241,6 @@ int zcip_main(int argc, char **argv)
|
||||
bb_error_msg_and_die("invalid link address");
|
||||
}
|
||||
}
|
||||
argc -= optind;
|
||||
argv += optind - 1;
|
||||
|
||||
/* Now: argv[0]:junk argv[1]:intf argv[2]:script argv[3]:NULL */
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "libbb.h"
|
||||
|
||||
int free_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int free_main(int argc, char **argv)
|
||||
int free_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
struct sysinfo info;
|
||||
sysinfo(&info);
|
||||
@ -46,7 +46,7 @@ int free_main(int argc, char **argv)
|
||||
info.bufferram*=info.mem_unit;
|
||||
}
|
||||
|
||||
if (argc > 1 && *argv[1] == '-')
|
||||
if (argv[1] && argv[1][0] == '-')
|
||||
bb_show_usage();
|
||||
|
||||
printf("%6s%13s%13s%13s%13s%13s\n", "", "total", "used", "free",
|
||||
|
@ -785,7 +785,7 @@ static init_func *const init_functions[] = {
|
||||
};
|
||||
|
||||
int nmeter_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int nmeter_main(int argc, char **argv)
|
||||
int nmeter_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
char buf[32];
|
||||
s_stat *first = NULL;
|
||||
@ -797,7 +797,7 @@ int nmeter_main(int argc, char **argv)
|
||||
|
||||
xchdir("/proc");
|
||||
|
||||
if (argc != 2)
|
||||
if (!argv[1])
|
||||
bb_show_usage();
|
||||
|
||||
if (open_read_close("version", buf, sizeof(buf)-1) > 0) {
|
||||
|
@ -7,11 +7,11 @@
|
||||
#include "libbb.h"
|
||||
|
||||
int load_policy_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int load_policy_main(int argc, char **argv UNUSED_PARAM)
|
||||
int load_policy_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (argc != 1) {
|
||||
if (argv[1]) {
|
||||
bb_show_usage();
|
||||
}
|
||||
|
||||
|
@ -21,11 +21,11 @@ static const char *const setenforce_cmd[] = {
|
||||
};
|
||||
|
||||
int setenforce_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int setenforce_main(int argc, char **argv)
|
||||
int setenforce_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
int i, rc;
|
||||
|
||||
if (argc != 2)
|
||||
if (!argv[1] || argv[2])
|
||||
bb_show_usage();
|
||||
|
||||
selinux_or_die();
|
||||
|
@ -490,7 +490,7 @@ static int process_one(char *name)
|
||||
}
|
||||
|
||||
int setfiles_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int setfiles_main(int argc, char **argv)
|
||||
int setfiles_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
struct stat sb;
|
||||
int rc, i = 0;
|
||||
@ -549,6 +549,7 @@ int setfiles_main(int argc, char **argv)
|
||||
IF_FEATURE_SETFILES_CHECK_OPTION(&policyfile,)
|
||||
&verbose);
|
||||
}
|
||||
argv += optind;
|
||||
|
||||
#if ENABLE_FEATURE_SETFILES_CHECK_OPTION
|
||||
if ((applet_name[0] == 's') && (flags & OPT_c)) {
|
||||
@ -595,24 +596,20 @@ int setfiles_main(int argc, char **argv)
|
||||
we can support either checking against the active policy or
|
||||
checking against a binary policy file. */
|
||||
set_matchpathcon_canoncon(&canoncon);
|
||||
if (argc == 1)
|
||||
if (!argv[0])
|
||||
bb_show_usage();
|
||||
if (stat(argv[optind], &sb) < 0) {
|
||||
bb_simple_perror_msg_and_die(argv[optind]);
|
||||
}
|
||||
xstat(argv[0], &sb);
|
||||
if (!S_ISREG(sb.st_mode)) {
|
||||
bb_error_msg_and_die("spec file %s is not a regular file", argv[optind]);
|
||||
bb_error_msg_and_die("spec file %s is not a regular file", argv[0]);
|
||||
}
|
||||
/* Load the file contexts configuration and check it. */
|
||||
rc = matchpathcon_init(argv[optind]);
|
||||
rc = matchpathcon_init(argv[0]);
|
||||
if (rc < 0) {
|
||||
bb_simple_perror_msg_and_die(argv[optind]);
|
||||
bb_simple_perror_msg_and_die(argv[0]);
|
||||
}
|
||||
|
||||
optind++;
|
||||
|
||||
if (nerr)
|
||||
exit(EXIT_FAILURE);
|
||||
argv++;
|
||||
}
|
||||
|
||||
if (input_filename) {
|
||||
@ -628,9 +625,9 @@ int setfiles_main(int argc, char **argv)
|
||||
if (ENABLE_FEATURE_CLEAN_UP)
|
||||
fclose_if_not_stdin(f);
|
||||
} else {
|
||||
if (optind >= argc)
|
||||
if (!argv[0])
|
||||
bb_show_usage();
|
||||
for (i = optind; i < argc; i++) {
|
||||
for (i = 0; argv[i]; i++) {
|
||||
errors |= process_one(argv[i]);
|
||||
}
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ static void handle(char *command)
|
||||
}
|
||||
|
||||
int bbsh_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int bbsh_main(int argc, char **argv)
|
||||
int bbsh_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
char *command=NULL;
|
||||
FILE *f;
|
||||
|
@ -69,7 +69,7 @@ static int pencode(char *s)
|
||||
#define strbuf bb_common_bufsiz1
|
||||
|
||||
int logger_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int logger_main(int argc, char **argv)
|
||||
int logger_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
char *str_p, *str_t;
|
||||
int opt;
|
||||
@ -89,9 +89,8 @@ int logger_main(int argc, char **argv)
|
||||
if (opt & 0x1) /* -p */
|
||||
i = pencode(str_p);
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
if (!argc) {
|
||||
if (!argv[0]) {
|
||||
while (fgets(strbuf, COMMON_BUFSIZE, stdin)) {
|
||||
if (strbuf[0]
|
||||
&& NOT_LONE_CHAR(strbuf, '\n')
|
||||
|
@ -74,6 +74,7 @@ int acpid_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
argv += optind;
|
||||
argc -= optind;
|
||||
|
||||
// goto configuration directory
|
||||
xchdir(opt_conf);
|
||||
@ -102,7 +103,7 @@ int acpid_main(int argc, char **argv)
|
||||
// evdev files given, use evdev interface
|
||||
|
||||
// open event devices
|
||||
pfd = xzalloc(sizeof(*pfd) * (argc - optind));
|
||||
pfd = xzalloc(sizeof(*pfd) * argc);
|
||||
nfd = 0;
|
||||
while (*argv) {
|
||||
pfd[nfd].fd = open_or_warn(*argv++, O_RDONLY | O_NONBLOCK);
|
||||
|
Loading…
Reference in New Issue
Block a user