Remove a global variable jtag_argv0: replace by a static var and a setter call

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1534 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Rutger Hofman 16 years ago
parent 4055a8bbc4
commit adc9b7815c

@ -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);

@ -8,6 +8,14 @@
#include <config.h>
#include "jtag.h"
static const char *jtag_argv0;
void
urj_cmd_jtag_set_argv0(const char *argv0)
{
jtag_argv0 = argv0;
}
#ifdef JTAG_RELOCATABLE
#include <stdlib.h>
@ -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 *

@ -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)
{

Loading…
Cancel
Save