From owner-freebsd-hackers Sat Jun 30 12:55:28 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from mail-out1.apple.com (mail-out1.apple.com [17.254.0.52]) by hub.freebsd.org (Postfix) with ESMTP id D538237B403 for ; Sat, 30 Jun 2001 12:55:22 -0700 (PDT) (envelope-from rbraun@apple.com) Received: from apple.com (A17-129-100-225.apple.com [17.129.100.225]) by mail-out1.apple.com (8.9.3/8.9.3) with ESMTP id MAA07455 for ; Sat, 30 Jun 2001 12:55:22 -0700 (PDT) Received: from scv2.apple.com (scv2.apple.com) by apple.com (Content Technologies SMTPRS 4.2.1) with ESMTP id for ; Sat, 30 Jun 2001 12:55:21 -0700 Received: from brauro.apple.com (brauro.apple.com [17.202.41.60]) by scv2.apple.com (8.11.3/8.11.3) with ESMTP id f5UJtLw21656 for ; Sat, 30 Jun 2001 12:55:21 -0700 (PDT) Date: Sat, 30 Jun 2001 12:55:21 -0700 Content-Type: text/plain; format=flowed; charset=us-ascii Subject: xinstall args to strip X-Mailer: Apple Mail (2.402) Mime-Version: 1.0 (Apple Message framework v402) From: Rob Braun To: freebsd-hackers@freebsd.org Content-Transfer-Encoding: 7bit Message-Id: Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG FreeBSD's xinstall [install(1)] lacks a way to pass arguments to strip. In non-ELF systems this can be important. Below is a patch to FreeBSD's xinstall TOT that adds a -Z flag that takes an argument that can be passed to strip(1) when it is exec'd. It also lets the user specify an alternate strip program with the STRIP environment variable. This functionality is based on NetBSD's xinstall -S flag. Unfortunately, -S is already used by FreeBSD's xinstall as a "safe copy". Rob Index: install.1 =================================================================== RCS file: /cvs/Darwin/Commands/BSD/file_cmds/install/install.1,v retrieving revision 1.1.1.3 diff -u -d -r1.1.1.3 install.1 --- install.1 2001/06/28 00:35:04 1.1.1.3 +++ install.1 2001/06/30 19:45:52 @@ -46,6 +46,7 @@ .Op Fl g Ar group .Op Fl m Ar mode .Op Fl o Ar owner +.Op Fl Z Ar stripflags .Ar file1 file2 .Nm .Op Fl bCcMpSsv @@ -54,6 +55,7 @@ .Op Fl g Ar group .Op Fl m Ar mode .Op Fl o Ar owner +.Op Fl Z Ar stripflag .Ar file1 ... fileN directory .Nm .Fl d @@ -61,6 +63,7 @@ .Op Fl g Ar group .Op Fl m Ar mode .Op Fl o Ar owner +.Op Fl Z Ar stripflag .Ar directory ... .Sh DESCRIPTION The file(s) are copied @@ -155,6 +158,23 @@ .Nm can be portable over a large number of systems and binary types. +.It Fl Z Ar stripflags +.Nm +pases +.Ar stripflags +as option arguments to +.Xr strip 1 . +When -Z is used, +.Xr strip 1 +is invoked via the +.Xr sh 1 +shell, allowing a single -Z argument to be specified to +.Nm +which the shell can then tokenize. Normally, +.Nm +invokes +.Xr strip 1 +directly. This flag implies -s .It Fl v Causes .Nm Index: xinstall.c =================================================================== RCS file: /cvs/Darwin/Commands/BSD/file_cmds/install/xinstall.c,v retrieving revision 1.2 diff -u -d -r1.2 xinstall.c --- xinstall.c 2001/06/28 00:38:03 1.2 +++ xinstall.c 2001/06/30 19:45:52 @@ -84,6 +84,7 @@ int dobackup, docompare, dodir, dopreserve, dostrip, nommap, safecopy, verbose; mode_t mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; char *suffix = BACKUP_SUFFIX; +char *stripArgs=NULL; #ifdef __APPLE__ u_long string_to_flags __P((char **, u_long *, u_long *)); @@ -165,6 +166,12 @@ case 'v': verbose = 1; break; + case 'Z': + stripArgs = (char*)malloc(sizeof(char)*(strlen(optarg)+1 +)); + strcpy(stripArgs,optarg); + dostrip = 1; + break; case '?': default: usage(); @@ -704,6 +711,7 @@ char *to_name; { int serrno, status; + char *stripprog; switch (fork()) { case -1: @@ -712,8 +720,19 @@ errno = serrno; err(EX_TEMPFAIL, "fork"); case 0: - execlp("strip", "strip", to_name, NULL); - err(EX_OSERR, "exec(strip)"); + stripprog = getenv("STRIP"); + if (stripprog == NULL) + stripprog = _PATH_STRIP; + if (stripArgs) { + char *cmd = (char*)malloc(sizeof(char)* + (3+strlen(stripprog)+ + strlen(stripArgs)+ + strlen(to_name))); + sprintf(cmd, "%s %s %s", stripprog, stripArgs, to_name); + execl(_PATH_BSHELL, "sh", "-c", cmd, NULL); + } else + execlp(stripprog, "strip", to_name, NULL); + err(EX_OSERR, "exec(%s)", stripprog); default: if (wait(&status) == -1 || status) { (void)unlink(to_name); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message