1MKSTR(1)                    General Commands Manual                   MKSTR(1)
2
3
4

NAME

6       mkstr - create an error message file by massaging C source
7

SYNOPSIS

9       mkstr [ - ] messagefile prefix file ...
10

DESCRIPTION

12       Mkstr is used to create files of error messages.  Its use can make pro‐
13       grams with large numbers of error diagnostics much smaller, and  reduce
14       system  overhead  in  running  the program as the error messages do not
15       have to be constantly swapped in and out.
16
17       Mkstr will process each of the specified files, placing a massaged ver‐
18       sion  of  the input file in a file whose name consists of the specified
19       prefix and the original name.  A typical usage of mkstr would be
20
21            mkstr pistrings xx *.c
22
23       This command would cause all the error messages from the C source files
24       in  the  current  directory to be placed in the file pistrings and pro‐
25       cessed copies of the source for these files to be placed in files whose
26       names are prefixed with xx.
27
28       To  process  the error messages in the source to the message file mkstr
29       keys on the string `error("' in the input stream.  Each time it occurs,
30       the C string starting at the `"' is placed in the message file followed
31       by a null character and a new-line character; the null character termi‐
32       nates the message so it can be easily used when retrieved, the new-line
33       character makes it possible to sensibly cat the error message  file  to
34       see  its contents.  The massaged copy of the input file then contains a
35       lseek pointer into the file which can be used to retrieve the  message,
36       i.e.:
37
38              char efilname[] =  "/usr/share/pascal/pi_strings";
39              int  efil = -1;
40
41              error(a1, a2, a3, a4)
42              {
43                   char buf[256];
44
45                   if (efil < 0) {
46                        efil = open(efilname, 0);
47                        if (efil < 0) {
48              oops:
49                             perror(efilname);
50                             exit(1);
51                        }
52                   }
53                   if (lseek(efil, (long) a1, 0) || read(efil, buf, 256) <= 0)
54                        goto oops;
55                   printf(buf, a2, a3, a4);
56              }
57
58       The optional - causes the error messages to be placed at the end of the
59       specified message file for recompiling part of a large mkstred program.
60

SEE ALSO

62       lseek(2), xstr(1)
63
64
65
663rd Berkeley Distribution      October 22, 1996                       MKSTR(1)
Impressum