[BACK]Return to mkstr.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / mkstr

Annotation of src/usr.bin/mkstr/mkstr.1, Revision 1.8

1.8     ! jmc         1: .\"    $OpenBSD: mkstr.1,v 1.7 2002/02/13 08:33:47 mpech Exp $
1.1       deraadt     2: .\"    $NetBSD: mkstr.1,v 1.3 1995/09/28 06:22:19 tls Exp $
                      3: .\"
                      4: .\" Copyright (c) 1980, 1990, 1993
                      5: .\"    The Regents of the University of California.  All rights reserved.
                      6: .\"
                      7: .\" Redistribution and use in source and binary forms, with or without
                      8: .\" modification, are permitted provided that the following conditions
                      9: .\" are met:
                     10: .\" 1. Redistributions of source code must retain the above copyright
                     11: .\"    notice, this list of conditions and the following disclaimer.
                     12: .\" 2. Redistributions in binary form must reproduce the above copyright
                     13: .\"    notice, this list of conditions and the following disclaimer in the
                     14: .\"    documentation and/or other materials provided with the distribution.
                     15: .\" 3. All advertising materials mentioning features or use of this software
                     16: .\"    must display the following acknowledgement:
                     17: .\"    This product includes software developed by the University of
                     18: .\"    California, Berkeley and its contributors.
                     19: .\" 4. Neither the name of the University nor the names of its contributors
                     20: .\"    may be used to endorse or promote products derived from this software
                     21: .\"    without specific prior written permission.
                     22: .\"
                     23: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     24: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     25: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     26: .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     27: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     28: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     29: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     30: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     31: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     32: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     33: .\" SUCH DAMAGE.
                     34: .\"
                     35: .\"     @(#)mkstr.1    8.1 (Berkeley) 6/6/93
                     36: .\"
                     37: .Dd June 6, 1993
                     38: .Dt MKSTR 1
                     39: .Os
                     40: .Sh NAME
                     41: .Nm mkstr
                     42: .Nd create an error message file by massaging C source
                     43: .Sh SYNOPSIS
                     44: .Nm mkstr
                     45: .Op Fl
                     46: .Ar messagefile
1.3       aaron      47: .Ar prefix file Op Ar ...
1.1       deraadt    48: .Sh DESCRIPTION
1.3       aaron      49: .Nm mkstr
1.1       deraadt    50: creates files containing error messages extracted from C source,
                     51: and restructures the same C source, to utilize the created error message
                     52: file.
                     53: The intent of
                     54: .Nm mkstr
                     55: was to reduce the size of large programs and
                     56: reduce swapping (see
                     57: .Sx BUGS
                     58: section below).
                     59: .Pp
1.3       aaron      60: .Nm mkstr
1.1       deraadt    61: processes each of the specified
                     62: .Ar files ,
                     63: placing a restructured version of the input in a file whose name
                     64: consists of the specified
                     65: .Ar prefix
                     66: and the original name.
                     67: A typical usage of
                     68: .Nm mkstr
                     69: is
                     70: .Bd -literal -offset indent
1.7       mpech      71: $ mkstr pistrings xx *.c
1.1       deraadt    72: .Ed
                     73: .Pp
                     74: This command causes all the error messages from the C source
                     75: files in the current directory to be placed in the file
1.3       aaron      76: .Dq pistrings
1.1       deraadt    77: and restructured copies of the sources to be placed in
                     78: files whose names are prefixed with
1.3       aaron      79: .Dq \&xx .
1.1       deraadt    80: .Pp
1.4       aaron      81: The options are as follows:
1.6       aaron      82: .Bl -tag -width Ds
1.1       deraadt    83: .It Fl
                     84: Error messages are placed at the end of the specified
1.3       aaron      85: .Ar messagefile
                     86: for recompiling part of a large
                     87: .Nm mkstr Ns ed
1.1       deraadt    88: program.
                     89: .El
                     90: .Pp
                     91: .Nm mkstr
                     92: finds error messages in the source by
                     93: searching for the string
                     94: .Li \&`error("'
                     95: in the input stream.
                     96: Each time it occurs, the C string starting at the
                     97: .Sq \&"\&
                     98: is stored
1.3       aaron      99: in the message file followed by a null character and a newline character.
1.1       deraadt   100: The new source is restructured with
                    101: .Xr lseek 2
                    102: pointers into the error message file for retrieval.
                    103: .Bd -literal -offset indent
                    104: char efilname = "/usr/lib/pi_strings";
                    105: int efil = -1;
                    106:
                    107: error(a1, a2, a3, a4)
                    108: \&{
                    109:        char buf[256];
                    110:
                    111:        if (efil < 0) {
                    112:                efil = open(efilname, 0);
                    113:                if (efil < 0) {
                    114: oops:
                    115:                        perror(efilname);
                    116:                        exit 1 ;
                    117:                }
                    118:        }
                    119:        if (lseek(efil, (long) a1, 0) \ read(efil, buf, 256) <= 0)
                    120:                goto oops;
                    121:        printf(buf, a2, a3, a4);
                    122: }
                    123: .Ed
                    124: .Sh SEE ALSO
1.3       aaron     125: .Xr xstr 1 ,
                    126: .Xr lseek 2
1.1       deraadt   127: .Sh HISTORY
1.3       aaron     128: .Nm mkstr
1.1       deraadt   129: appeared in
                    130: .Bx 3.0 .
                    131: .Sh BUGS
                    132: .Nm mkstr
                    133: was intended for the limited architecture of the PDP 11 family.
1.5       aaron     134: Very few programs actually use it.
                    135: The pascal interpreter,
1.8     ! jmc       136: .Xr pi ,
1.1       deraadt   137: and the editor,
1.8     ! jmc       138: .Xr ex 1 ,
1.1       deraadt   139: are two programs that are built this way.
1.5       aaron     140: It is not an efficient method; the error messages
1.1       deraadt   141: should be stored in the program text.