Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xstr Explain what xstr can and cannot do, and why it...



details:   https://anonhg.NetBSD.org/src/rev/a012efd48794
branches:  trunk
changeset: 567247:a012efd48794
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Jun 06 06:15:45 2004 +0000

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

diffstat:

 usr.bin/xstr/xstr.1 |  42 +++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 41 insertions(+), 1 deletions(-)

diffs (53 lines):

diff -r e47df14a6730 -r a012efd48794 usr.bin/xstr/xstr.1
--- a/usr.bin/xstr/xstr.1       Sun Jun 06 06:06:59 2004 +0000
+++ b/usr.bin/xstr/xstr.1       Sun Jun 06 06:15:45 2004 +0000
@@ -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 @@
 .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.



Home | Main Index | Thread Index | Old Index