multicall: expose argv0, use in applets
This commit is contained in:
parent
e0a7444640
commit
8714dab11d
4 changed files with 8 additions and 6 deletions
|
@ -252,13 +252,13 @@ ifquery_main(int argc, char *argv[])
|
|||
|
||||
if (!lif_state_read_path(&state, state_file))
|
||||
{
|
||||
fprintf(stderr, "ifquery: could not parse %s\n", state_file);
|
||||
fprintf(stderr, "%s: could not parse %s\n", argv0, state_file);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (!lif_interface_file_parse(&collection, interfaces_file))
|
||||
{
|
||||
fprintf(stderr, "ifquery: could not parse %s\n", interfaces_file);
|
||||
fprintf(stderr, "%s: could not parse %s\n", argv0, interfaces_file);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -295,7 +295,7 @@ ifquery_main(int argc, char *argv[])
|
|||
|
||||
if (iface == NULL)
|
||||
{
|
||||
fprintf(stderr, "ifquery: unknown interface %s\n", argv[idx]);
|
||||
fprintf(stderr, "%s: unknown interface %s\n", argv0, argv[idx]);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ struct match_options {
|
|||
char *include_pattern;
|
||||
};
|
||||
|
||||
static const char *argv0;
|
||||
static bool up;
|
||||
static struct lif_execute_opts exec_opts = {};
|
||||
|
||||
|
@ -109,7 +108,6 @@ change_auto_interfaces(struct lif_dict *collection, struct lif_dict *state, stru
|
|||
int
|
||||
ifupdown_main(int argc, char *argv[])
|
||||
{
|
||||
argv0 = basename(argv[0]);
|
||||
up = !is_ifdown();
|
||||
|
||||
struct lif_dict state = {};
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#include <string.h>
|
||||
#include "cmd/multicall.h"
|
||||
|
||||
char *argv0;
|
||||
|
||||
extern struct if_applet ifquery_applet;
|
||||
extern struct if_applet ifup_applet;
|
||||
extern struct if_applet ifdown_applet;
|
||||
|
@ -47,7 +49,7 @@ void multicall_usage(void);
|
|||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
char *argv0 = basename(argv[0]);
|
||||
argv0 = basename(argv[0]);
|
||||
struct if_applet **app;
|
||||
|
||||
app = bsearch(argv0, applet_table,
|
||||
|
|
|
@ -24,4 +24,6 @@ struct if_applet {
|
|||
void (*const usage)(void);
|
||||
};
|
||||
|
||||
extern char *argv0;
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue