|
|
1.1 root 1: .\" Copyright (c) 1980, 1990 The Regents of the University of California.
2: .\" All rights reserved.
3: .\"
4: .\" Redistribution and use in source and binary forms are permitted provided
5: .\" that: (1) source distributions retain this entire copyright notice and
6: .\" comment, and (2) distributions including binaries display the following
7: .\" acknowledgement: ``This product includes software developed by the
8: .\" University of California, Berkeley and its contributors'' in the
9: .\" documentation or other materials provided with the distribution and in
10: .\" all advertising materials mentioning features or use of this software.
11: .\" Neither the name of the University nor the names of its contributors may
12: .\" be used to endorse or promote products derived from this software without
13: .\" specific prior written permission.
14: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
15: .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
16: .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17: .\"
18: .\" @(#)mkstr.1 6.4 (Berkeley) 7/24/90
19: .\"
20: .Dd July 24, 1990
21: .Dt MKSTR 1
22: .Sh NAME
23: .Nm mkstr
24: .Nd create an error message file by massaging C source
25: .Sh SYNOPSIS
26: .Nm mkstr
27: .Op Fl
28: .Ar messagefile
29: .Ar prefix file ...
30: .Sh DESCRIPTION
31: .Nm Mkstr
32: creates files containing error messages extracted from C source,
33: and restructures the same C source, to utilize the created error message
34: file.
35: The intent of
36: .Nm mkstr
37: was to reduce the size of large programs and
38: reduce swapping (see BUGS section below).
39: .Pp
40: .Nm Mkstr
41: processes each of the specified
42: .Ar files ,
43: placing a restructured version of the input in a file whose name
44: consists of the specified
45: .Ar prefix
46: and the original name.
47: A typical usage of
48: .Nm mkstr
49: is
50: .Pp
51: .Dl mkstr pistrings xx *.c
52: .Pp
53: This command causes all the error messages from the C source
54: files in the current directory to be placed in the file
55: .Ar pistrings
56: and restructured copies of the sources to be placed in
57: files whose names are prefixed with
58: .Ar xx .
59: .Pp
60: Options:
61: .Tw Ds
62: .Tp Fl
63: Error messages are placed at the end of the specified
64: message file for recompiling part of a large
65: .Nm mkstr
66: ed
67: program.
68: .Tp
69: .Pp
70: .Nm mkstr
71: finds error messages in the source by
72: searching for the string
73: .Li \&`error("'
74: in the input stream.
75: Each time it occurs, the C string starting at the
76: .Sq \&"\&
77: is stored
78: in the message file followed by a null character and a new-line character;
79: The new source is restructured with
80: .Xr lseek 2
81: pointers into the error message file for retrieval.
82: .Ds I
83: char efilname = "/usr/lib/pi_strings";
84: int efil = -1;
85:
86: error(a1, a2, a3, a4)
87: \&{
88: char buf[256];
89:
90: if (efil < 0) {
91: efil = open(efilname, 0);
92: if (efil < 0) {
93: oops:
94: perror(efilname);
95: exit 1 ;
96: }
97: }
98: if (lseek(efil, (long) a1, 0) \ read(efil, buf, 256) <= 0)
99: goto oops;
100: printf(buf, a2, a3, a4);
101: }
102: .De
103: .Sh SEE ALSO
104: .Xr lseek 2 ,
105: .Xr xstr 1
106: .Sh HISTORY
107: .Nm Mkstr
108: appeared in 3 BSD.
109: .Sh BUGS
110: .Nm mkstr
111: was intended for the limited architecture of the PDP 11 family.
112: Very few programs in 4.4 BSD actually use it. The pascal interpreter,
113: .Xr pi 1
114: and the editor,
115: .Xr ex 1
116: are two programs that are built this way.
117: It is not an efficient method, the error messages
118: should be stored in the program text.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.