4.4BSD/usr/share/man/cat1/xstr.0

Compare this file to the similar file:
Show the results in this format:

XSTR(1)                      BSD Reference Manual                      XSTR(1)

NNAAMMEE
     xxssttrr - extract strings from C programs to implement shared strings

SSYYNNOOPPSSIISS
     xxssttrr [--cc] [--] [_f_i_l_e]

DDEESSCCRRIIPPTTIIOONN
     XXssttrr maintains a file _s_t_r_i_n_g_s into which strings in component parts of a
     large program are hashed.  These strings are replaced with references to
     this common area.  This serves to implement shared constant strings, most
     useful if they are also read-only.

     Available options:

     --       XXssttrr reads from the standard input.

     --cc      XXssttrr will extract the strings from the C source _f_i_l_e or the stan-
             dard input (--), replacing string references by expressions of the
             form (&xstr[number]) for some number.  An appropriate declaration
             of xxssttrr is prepended to the file.  The resulting C text is placed
             in the file _x_._c, to then be compiled.  The strings from this file
             are placed in the _s_t_r_i_n_g_s data base if they are not there al-
             ready.  Repeated strings and strings which are suffices of exist-
             ing strings do not cause changes to the data base.

     After all components of a large program have been compiled a file _x_s_._c
     declaring the common xxssttrr space can be created by a command of the form

           xstr

     The file _x_s_._c should then be compiled and loaded with the rest of the
     program.  If possible, the array can be made read-only (shared) saving
     space and swap overhead.

     XXssttrr can also be used on a single file.  A command

           xstr name

     creates files _x_._c and _x_s_._c as before, without using or affecting any
     _s_t_r_i_n_g_s file in the same directory.

     It may be useful to run xxssttrr after the C preprocessor if any macro defi-
     nitions yield strings or if there is conditional code which contains
     strings which may not, in fact, be needed.  An appropriate command se-
     quence for running xxssttrr after the C preprocessor is:

           cc -E name.c | xstr -c -
           cc -c x.c
           mv x.o name.o

     XXssttrr does not touch the file _s_t_r_i_n_g_s unless new items are added, thus
     make(1) can avoid remaking _x_s_._o unless truly necessary.

FFIILLEESS
     strings     Data base of strings
     x.c         Massaged C source
     xs.c        C source for definition of array `xstr'
     /tmp/xs*    Temp file when `xstr name' doesn't touch _s_t_r_i_n_g_s

SSEEEE AALLSSOO
     mkstr(1)

BBUUGGSS
     If a string is a suffix of another string in the data base, but the
     shorter string is seen first by xxssttrr both strings will be placed in the
     data base, when just placing the longer one there will do.

HHIISSTTOORRYY
     The xxssttrr command appeared in 3.0BSD.

3rd Berkeley Distribution        June 9, 1993                                2