MKSTR(1) UNIX Programmer's Manual MKSTR(1)
mkstr - create an error message file by massaging C source
S
\bSY
\bYN
\bNO
\bOP
\bPS
\bSI
\bIS
\bS
m
\bmk
\bks
\bst
\btr
\br [ -
\b- ] messagefile prefix file ...
D
\bDE
\bES
\bSC
\bCR
\bRI
\bIP
\bPT
\bTI
\bIO
\bON
\bN
_
\bM_
\bk_
\bs_
\bt_
\br is used to create files of error messages. Its use
can make programs with large numbers of error diagnostics
much smaller, and reduce system overhead in running the pro-
gram as the error messages do not have to be constantly
_
\bM_
\bk_
\bs_
\bt_
\br will process each of the specified _
\bf_
\bi_
\bl_
\be_
\bs, placing a
massaged version of the input file in a file whose name con-
sists of the specified _
\bp_
\br_
\be_
\bf_
\bi_
\bx and the original name. A typ-
ical usage of _
\bm_
\bk_
\bs_
\bt_
\br would be
This command would cause all the error messages from the C
source files in the current directory to be placed in the
file _
\bp_
\bi_
\bs_
\bt_
\br_
\bi_
\bn_
\bg_
\bs and processed copies of the source for these
files to be placed in files whose names are prefixed with
To process the error messages in the source to the message
file _
\bm_
\bk_
\bs_
\bt_
\br keys on the string `error("' in the input stream.
Each time it occurs, the C string starting at the `"' is
placed in the message file followed by a null character and
a new-line character; the null character terminates the mes-
sage so it can be easily used when retrieved, the new-line
character makes it possible to sensibly _
\bc_
\ba_
\bt the error mes-
sage file to see its contents. The massaged copy of the
input file then contains a _
\bl_
\bs_
\be_
\be_
\bk pointer into the file which
can be used to retrieve the message, i.e.:
c
\bch
\bha
\bar
\br efilname[] = "/usr/lib/pi_strings";
c
\bch
\bha
\bar
\br buf[256];
efil = open(efilname, 0);
Printed 7/9/88 May 7, 1986 1
MKSTR(1) UNIX Programmer's Manual MKSTR(1)
i
\bif
\bf (lseek(efil, (long) a1, 0) || read(efil, buf, 256) <= 0)
The optional -
\b- causes the error messages to be placed at the
end of the specified message file for recompiling part of a
large _
\bm_
\bk_
\bs_
\bt_
\bred program.
S
\bSE
\bEE
\bE A
\bAL
\bLS
\bSO
\bO
Printed 7/9/88 May 7, 1986 2