diff --git a/urjtag/include/jtag.h b/urjtag/include/jtag.h index 050119ae..cba41e1d 100644 --- a/urjtag/include/jtag.h +++ b/urjtag/include/jtag.h @@ -43,6 +43,10 @@ extern urj_bus_t *urj_bus; extern int urj_big_endian; extern int urj_debug_mode; +/** Register the application name with cmd_jtag. + * @param argv0 is remembered as a pointer, it is not strdup()'ed. + */ +void urj_cmd_jtag_set_argv0(const char *argv0); const char *urj_cmd_jtag_get_data_dir (void); int urj_cmd_jtag_parse_file (urj_chain_t *chain, const char *filename); diff --git a/urjtag/src/cmd/cmd_jtag_data_dir.c b/urjtag/src/cmd/cmd_jtag_data_dir.c index 6bbaad9f..332eb702 100644 --- a/urjtag/src/cmd/cmd_jtag_data_dir.c +++ b/urjtag/src/cmd/cmd_jtag_data_dir.c @@ -8,6 +8,14 @@ #include #include "jtag.h" +static const char *jtag_argv0; + +void +urj_cmd_jtag_set_argv0(const char *argv0) +{ + jtag_argv0 = argv0; +} + #ifdef JTAG_RELOCATABLE #include @@ -17,7 +25,6 @@ extern char *make_relative_prefix (const char *progname, const char *bin_prefix, const char *prefix); -extern const char *jtag_argv0; static char *jtag_data_dir = NULL; const char * diff --git a/urjtag/src/jtag.c b/urjtag/src/jtag.c index 55f2d287..ccf5cc90 100644 --- a/urjtag/src/jtag.c +++ b/urjtag/src/jtag.c @@ -322,7 +322,6 @@ cleanup (urj_chain_t *chain) chain = NULL; } -const char *jtag_argv0; int main (int argc, char *const argv[]) { @@ -335,7 +334,7 @@ main (int argc, char *const argv[]) int quiet = 0; urj_chain_t *chain = NULL; - jtag_argv0 = argv[0]; + urj_cmd_jtag_set_argv0(argv[0]); if (geteuid () == 0 && getuid () != 0) {