summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKamil Dudka <kdudka@redhat.com>2008-09-05 13:12:06 +0200
committerJim Meyering <meyering@redhat.com>2008-09-06 13:38:20 +0200
commit54281e9c6058b13841828d7994a596665d2e628a (patch)
tree75a031cc65f9fd868dca50bf015abeef49af30f4 /src
parentea2887bbe4c04e3ff5bae2d532a1e19d3198dfce (diff)
downloadcoreutils-54281e9c6058b13841828d7994a596665d2e628a.tar.xz
install: new option: --strip-program,
...to specify the program used to strip binaries * src/install.c (main): Handle new option --strip-program. (strip): Use strip program from global variable strip_program. (usage): Mention new option --strip-program in --help. * tests/tests/strip-program: Test case for new option --strip-program. * tests/Makefile.am: Add new test case to test set. * doc/coreutils.texi: Mention new option --strip-program. * NEWS: Mention the change. * TODO: Remove completed task.
Diffstat (limited to 'src')
-rw-r--r--src/install.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/install.c b/src/install.c
index 0d3927df4..a7c3b3d88 100644
--- a/src/install.c
+++ b/src/install.c
@@ -131,11 +131,15 @@ static bool strip_files;
/* If true, install a directory instead of a regular file. */
static bool dir_arg;
+/* Program used to strip binaries, "strip" is default */
+static char *strip_program = "strip";
+
/* For long options that have no equivalent short option, use a
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
enum
{
- PRESERVE_CONTEXT_OPTION = CHAR_MAX + 1
+ PRESERVE_CONTEXT_OPTION = CHAR_MAX + 1,
+ STRIP_PROGRAM_OPTION
};
static struct option const long_options[] =
@@ -154,6 +158,7 @@ static struct option const long_options[] =
a year or two later. */
{"preserve_context", no_argument, NULL, PRESERVE_CONTEXT_OPTION},
{"strip", no_argument, NULL, 's'},
+ {"strip-program", required_argument, NULL, STRIP_PROGRAM_OPTION},
{"suffix", required_argument, NULL, 'S'},
{"target-directory", required_argument, NULL, 't'},
{"verbose", no_argument, NULL, 'v'},
@@ -330,6 +335,7 @@ main (int argc, char **argv)
bool no_target_directory = false;
int n_files;
char **file;
+ bool strip_program_specified = false;
security_context_t scontext = NULL;
/* set iff kernel has extra selinux system calls */
selinux_enabled = (0 < is_selinux_enabled ());
@@ -373,6 +379,10 @@ main (int argc, char **argv)
signal (SIGCHLD, SIG_DFL);
#endif
break;
+ case STRIP_PROGRAM_OPTION:
+ strip_program = xstrdup (optarg);
+ strip_program_specified = true;
+ break;
case 'd':
dir_arg = true;
break;
@@ -514,6 +524,10 @@ main (int argc, char **argv)
free (change);
}
+ if (strip_program_specified && !strip_files)
+ error (0, 0, _("WARNING: ignoring --strip-program option as -s option was "
+ "not specified"));
+
get_ids ();
if (dir_arg)
@@ -708,8 +722,8 @@ strip (char const *name)
error (EXIT_FAILURE, errno, _("fork system call failed"));
break;
case 0: /* Child. */
- execlp ("strip", "strip", name, NULL);
- error (EXIT_FAILURE, errno, _("cannot run strip"));
+ execlp (strip_program, strip_program, name, NULL);
+ error (EXIT_FAILURE, errno, _("cannot run %s"), strip_program);
break;
default: /* Parent. */
if (waitpid (pid, &status, 0) < 0)
@@ -828,6 +842,7 @@ Mandatory arguments to long options are mandatory for short options too.\n\
-p, --preserve-timestamps apply access/modification times of SOURCE files\n\
to corresponding destination files\n\
-s, --strip strip symbol tables\n\
+ --strip-program=PROGRAM program used to strip binaries\n\
-S, --suffix=SUFFIX override the usual backup suffix\n\
-t, --target-directory=DIRECTORY copy all SOURCE arguments into DIRECTORY\n\
-T, --no-target-directory treat DEST as a normal file\n\