Subject: bin/584: xstr(1) missing `-l' option.
To: None <gnats-admin@sun-lamp.cs.berkeley.edu>
From: Jason R. Thorpe <thorpej@mail.CS.ORST.EDU>
List: netbsd-bugs
Date: 11/23/1994 04:35:04
>Number: 584
>Category: bin
>Synopsis: xstr(1) missing `-l' option.
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: gnats-admin (Utility Bug People)
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Wed Nov 23 04:35:03 1994
>Originator:
>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
>Release: 1.0
>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
>Audit-Trail:
>Unformatted: