Remove unneeded functions and options from cwrapper

* libltdl/config/ltmain.m4sh (func_emit_cwrapperexe_src)
[lt_opt_process_env_set]: Remove.
[lt_opt_process_env_prepend]: Remove.
[lt_opt_process_env_append]: Remove.
[lt_split_name_value]: Remove.
[file scope]: Don't declare removed functions. Remove
constants and defines related to eliminated commandline
options.
[main]: Remove code related to eliminated commandline
options --lt-env-set, --lt-env-prepend, --lt-env-append.
This commit is contained in:
Charles Wilson 2009-06-21 20:07:13 -04:00
parent 82f62c98de
commit 75765d58c3
2 changed files with 14 additions and 144 deletions

View File

@ -1,3 +1,17 @@
2009-06-21 Charles Wilson <libtool@cwilson.fastmail.fm>
Remove unneeded functions and options from cwrapper
* libltdl/config/ltmain.m4sh (func_emit_cwrapperexe_src)
[lt_opt_process_env_set]: Remove.
[lt_opt_process_env_prepend]: Remove.
[lt_opt_process_env_append]: Remove.
[lt_split_name_value]: Remove.
[file scope]: Don't declare removed functions. Remove
constants and defines related to eliminated commandline
options.
[main]: Remove code related to eliminated commandline
options --lt-env-set, --lt-env-prepend, --lt-env-append.
2009-06-19 Yaakov Selkowitz <yselkowitz@users.sourceforge.net> (tiny change)
Charles Wilson <libtool@cwilson.fastmail.fm>

View File

@ -2877,10 +2877,6 @@ char *strendzap (char *str, const char *pat);
void lt_fatal (const char *message, ...);
void lt_setenv (const char *name, const char *value);
char *lt_extend_str (const char *orig_value, const char *add, int to_end);
void lt_opt_process_env_set (const char *arg);
void lt_opt_process_env_prepend (const char *arg);
void lt_opt_process_env_append (const char *arg);
int lt_split_name_value (const char *arg, char** name, char** value);
void lt_update_exe_path (const char *name, const char *value);
void lt_update_lib_path (const char *name, const char *value);
char **prepare_spawn (char **argv);
@ -2937,18 +2933,6 @@ static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
static const size_t env_set_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
static const char *env_set_opt = LTWRAPPER_OPTION_PREFIX "env-set";
/* argument is putenv-style "foo=bar", value of foo is set to bar */
static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
static const char *env_prepend_opt = LTWRAPPER_OPTION_PREFIX "env-prepend";
/* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
static const size_t env_append_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
static const char *env_append_opt = LTWRAPPER_OPTION_PREFIX "env-append";
/* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
int
main (int argc, char *argv[])
{
@ -3073,51 +3057,6 @@ EOF
newargc=0;
for (i = 1; i < argc; i++)
{
if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
{
if (argv[i][env_set_opt_len] == '=')
{
const char *p = argv[i] + env_set_opt_len + 1;
lt_opt_process_env_set (p);
}
else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
{
lt_opt_process_env_set (argv[++i]); /* don't copy */
}
else
lt_fatal ("%s missing required argument", env_set_opt);
continue;
}
if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
{
if (argv[i][env_prepend_opt_len] == '=')
{
const char *p = argv[i] + env_prepend_opt_len + 1;
lt_opt_process_env_prepend (p);
}
else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
{
lt_opt_process_env_prepend (argv[++i]); /* don't copy */
}
else
lt_fatal ("%s missing required argument", env_prepend_opt);
continue;
}
if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
{
if (argv[i][env_append_opt_len] == '=')
{
const char *p = argv[i] + env_append_opt_len + 1;
lt_opt_process_env_append (p);
}
else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
{
lt_opt_process_env_append (argv[++i]); /* don't copy */
}
else
lt_fatal ("%s missing required argument", env_append_opt);
continue;
}
if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
{
/* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
@ -3494,89 +3433,6 @@ lt_extend_str (const char *orig_value, const char *add, int to_end)
return new_value;
}
int
lt_split_name_value (const char *arg, char** name, char** value)
{
const char *p;
int len;
if (!arg || !*arg)
return 1;
p = strchr (arg, (int)'=');
if (!p)
return 1;
*value = xstrdup (++p);
len = strlen (arg) - strlen (*value);
*name = XMALLOC (char, len);
strncpy (*name, arg, len-1);
(*name)[len - 1] = '\0';
return 0;
}
void
lt_opt_process_env_set (const char *arg)
{
char *name = NULL;
char *value = NULL;
if (lt_split_name_value (arg, &name, &value) != 0)
{
XFREE (name);
XFREE (value);
lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
}
lt_setenv (name, value);
XFREE (name);
XFREE (value);
}
void
lt_opt_process_env_prepend (const char *arg)
{
char *name = NULL;
char *value = NULL;
char *new_value = NULL;
if (lt_split_name_value (arg, &name, &value) != 0)
{
XFREE (name);
XFREE (value);
lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
}
new_value = lt_extend_str (getenv (name), value, 0);
lt_setenv (name, new_value);
XFREE (new_value);
XFREE (name);
XFREE (value);
}
void
lt_opt_process_env_append (const char *arg)
{
char *name = NULL;
char *value = NULL;
char *new_value = NULL;
if (lt_split_name_value (arg, &name, &value) != 0)
{
XFREE (name);
XFREE (value);
lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
}
new_value = lt_extend_str (getenv (name), value, 1);
lt_setenv (name, new_value);
XFREE (new_value);
XFREE (name);
XFREE (value);
}
void
lt_update_exe_path (const char *name, const char *value)
{