1mkstr(1B) SunOS/BSD Compatibility Package Commands mkstr(1B)
2
3
4
6 mkstr - create an error message file by massaging C source files
7
9 /usr/ucb/mkstr [-] messagefile prefix filename...
10
11
13 The mkstr utility creates files of error messages. You can use mkstr to
14 make programs with large numbers of error diagnostics much smaller, and
15 to reduce system overhead in running the program — as the error mes‐
16 sages do not have to be constantly swapped in and out.
17
18
19 mkstr processes each of the specified filenames, placing a massaged
20 version of the input file in a file with a name consisting of the spec‐
21 ified prefix and the original source file name. A typical example of
22 using mkstr would be:
23
24 mkstr pistrings processed *.c
25
26
27
28
29 This command would cause all the error messages from the C source files
30 in the current directory to be placed in the file pistrings and pro‐
31 cessed copies of the source for these files to be placed in files whose
32 names are prefixed with processed.
33
34
35 To process the error messages in the source to the message file, mkstr
36 keys on the string `error("' in the input stream. Each time it occurs,
37 the C string starting at the `"' is placed in the message file followed
38 by a null character and a NEWLINE character; the null character termi‐
39 nates the message so it can be easily used when retrieved, the NEWLINE
40 character makes it possible to sensibly cat the error message file to
41 see its contents. The massaged copy of the input file then contains a
42 lseek pointer into the file which can be used to retrieve the message,
43 that is:
44
45 char efilname[] = "/usr/lib/pi_strings";
46 int efil = −1;
47
48 error(a1, a2, a3, a4)
49 {
50
51 char
52 buf[256];
53 if (efil < 0) {
54
55 efil = open(efilname, 0);
56 if (efil < 0) {
57 oops:
58 perror (efilname);
59 exit (1);
60 }
61 }
62 if (lseek(efil, (long) a1, 0) || read(efil, buf, 256) <= 0)
63 goto oops;
64 printf(buf, a2, a3, a4);
65 }
66
67
69 − Place error messages at the end of the specified message file
70 for recompiling part of a large mkstred program.
71
72
74 See attributes(5) for descriptions of the following attributes:
75
76
77
78
79 ┌─────────────────────────────┬─────────────────────────────┐
80 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
81 ├─────────────────────────────┼─────────────────────────────┤
82 │Availability │SUNWscpu │
83 └─────────────────────────────┴─────────────────────────────┘
84
86 xstr(1), attributes(5)
87
88
89
90SunOS 5.11 14 Sep 1992 mkstr(1B)