NetBSD Problem Report #584
From gnats Wed Nov 23 04:24:30 1994
Received: from pain.lcs.mit.edu (pain.lcs.mit.edu [128.52.46.239]) by sun-lamp.cs.berkeley.edu (8.6.9/8.6.9) with ESMTP id EAA17378 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Wed, 23 Nov 1994 04:24:29 -0800
Message-Id: <199411231226.EAA16445@helix.CS.ORST.EDU>
Date: Wed, 23 Nov 1994 04:26:41 -0800
From: "Jason R. Thorpe" <thorpej@mail.CS.ORST.EDU>
Reply-To: thorpej@mail.CS.ORST.EDU
To: gnats-bugs@NetBSD.ORG
Subject: xstr(1) missing `-l' option.
X-Send-Pr-Version: 3.2
>Number: 584
>Category: bin
>Synopsis: xstr(1) missing `-l' option.
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: gnats-admin
>State: closed
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Wed Nov 23 04:35:03 +0000 1994
>Closed-Date: Sat Nov 26 01:26:04 +0000 1994
>Last-Modified:
>Originator:
>Release: 1.0
>Organization:
--------------------------------------------------------------------------
Jason R. Thorpe thorpej@cs.orst.edu 758-2003
OJGSE NERO Project CSWest Room 5 737-5567
Shared Computing Environemnt Group http://www.cs.orst.edu/~thorpej
>Environment:
System: NetBSD helix 1.0 NetBSD 1.0 (HELIX) #44: Tue Nov 15 23:26:30 PST 1994 thorpej@helix:/usr/src/sys/arch/hp300/compile/HELIX hp300
>Description:
The SunOS xstr(1) command has a `-l' option that allows one
to change the name of the array from `xstr' to something else.
NetBSD's xstr(1) doesn't. This makes it difficult to compile
something like XView.
>How-To-Repeat:
Try to compile XView.
>Fix:
Below are patches to xstr.c and xstr.1 that implement `-l'
and document it.
*** xstr.c.orig Wed Nov 23 02:37:59 1994
--- xstr.c Wed Nov 23 04:17:23 1994
***************
*** 69,74 ****
--- 69,76 ----
off_t mesgpt;
char *strings = "strings";
+ char *array = 0;
+
int cflg;
int vflg;
int readstd;
***************
*** 97,106 ****
vflg++;
continue;
default:
! fprintf(stderr, "usage: xstr [ -v ] [ -c ] [ - ] [ name ... ]\n");
} while (*cp);
}
if (signal(SIGINT, SIG_IGN) == SIG_DFL)
signal(SIGINT, onintr);
if (cflg || argc == 0 && !readstd)
--- 99,121 ----
vflg++;
continue;
+ case 'l':
+ if (argc-- == 0)
+ goto bad;
+ cp = &(*argv++)[0];
+ array = strdup(cp);
+ goto next;
+
default:
! bad:
! fprintf(stderr, "usage: xstr [ -v ] [ -c ] [ -l array ] [ - ] [ name ... ]\n");
} while (*cp);
+ next:
}
+
+ if (array == 0)
+ array = strdup("xstr");
+
if (signal(SIGINT, SIG_IGN) == SIG_DFL)
signal(SIGINT, onintr);
if (cflg || argc == 0 && !readstd)
***************
*** 136,142 ****
register int incomm = 0;
int ret;
! printf("extern char\txstr[];\n");
for (;;) {
if (fgets(linebuf, sizeof linebuf, stdin) == NULL) {
if (ferror(stdin)) {
--- 151,157 ----
register int incomm = 0;
int ret;
! printf("extern char\t%s[];\n", array);
for (;;) {
if (fgets(linebuf, sizeof linebuf, stdin) == NULL) {
if (ferror(stdin)) {
***************
*** 159,165 ****
goto def;
if ((ret = (int) yankstr(&cp)) == -1)
goto out;
! printf("(&xstr[%d])", ret);
break;
case '\'':
--- 174,180 ----
goto def;
if ((ret = (int) yankstr(&cp)) == -1)
goto out;
! printf("(&%s[%d])", array, ret);
break;
case '\'':
***************
*** 416,422 ****
xdotcf = fopen("xs.c", "w");
if (xdotcf == NULL)
perror("xs.c"), exit(6);
! fprintf(xdotcf, "char\txstr[] = {\n");
for (;;) {
register int i, c;
--- 431,437 ----
xdotcf = fopen("xs.c", "w");
if (xdotcf == NULL)
perror("xs.c"), exit(6);
! fprintf(xdotcf, "char\t%s[] = {\n", array);
for (;;) {
register int i, c;
*** xstr.1.orig Wed Nov 23 03:07:06 1994
--- xstr.1 Wed Nov 23 03:05:00 1994
***************
*** 41,46 ****
--- 41,47 ----
.Sh SYNOPSIS
.Nm xstr
.Op Fl c
+ .Op Fl l Ar array
.Op Fl
.Op Ar file
.Sh DESCRIPTION
***************
*** 77,82 ****
--- 78,86 ----
data base if they are not there already.
Repeated strings and strings which are suffices of existing strings
do not cause changes to the data base.
+ .It Fl l Ar array
+ Specify the named array in program references to abstracted
+ strings. The default array name is xstr.
.El
.Pp
After all components of a large program have been compiled a file
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: jtc
State-Changed-When: Sat Nov 26 01:26:04 1994
State-Changed-Why:
Applied slightly modified version of this patch.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.