Explain what xstr can and cannot do, and why it is not useful these days.

This commit is contained in:
christos 2004-06-06 06:15:45 +00:00
parent 2fe9365746
commit 6f0701b22e

View File

@ -1,4 +1,4 @@
.\" $NetBSD: xstr.1,v 1.11 2003/08/07 11:17:51 agc Exp $
.\" $NetBSD: xstr.1,v 1.12 2004/06/06 06:15:45 christos Exp $
.\"
.\" Copyright (c) 1980, 1993
.\" The Regents of the University of California. All rights reserved.
@ -160,3 +160,43 @@ but the shorter string is seen first by
.Nm
both strings will be placed in the data base, when just
placing the longer one there will do.
.Pp
.Nm
does not parse the file properly so it does not know not to process:
.Bd -literal
char var[] = "const";
.Ed
into:
.Bd -literal
char var[] = (&xstr[N]);
.Ed
.Pp
These must be changed manually into an appropriate initialization for
the string, or use the following ugly hack.
.Pp
Also,
.Nm
cannot initialize structures and unions that contain strings. Those can
be fixed by changing from:
.Bd -literal
struct foo {
int i;
char buf[10];
} = {
1, "foo"
};
.Ed
to:
.Bd -literal
struct foo {
int i;
char buf[10];
} = {
1, { 'f', 'o', 'o', '\e0' }
};
.Ed
.Pp
Finally,
.Nm
is not very useful these days because most of the string merging is done
automatically by the compiler and the linker.