09.06.2013 Views

Intel XENIX 286 Programmers Guide (86) - Tenox.tc

Intel XENIX 286 Programmers Guide (86) - Tenox.tc

Intel XENIX 286 Programmers Guide (86) - Tenox.tc

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Programming Commands <strong>XENIX</strong> Programming<br />

m kstr - Creates an error message file from C source.<br />

Syntax<br />

mkstr [-] messagefile prefix file ...<br />

Description<br />

mkstr is used to create files of error messages. Its use can decrease the size of<br />

programs with large numbers of error diagnostics. It can also reduce system overhead in<br />

running the program as error messages do not have to be constantly swapped in and out.<br />

mkstr will process each specified file, placing a massaged version of the input file in a<br />

file whose name consists of the specified prefix and the original name. The optional<br />

dash (-) causes the error messages to be replaced at the end of the specified message<br />

file for recompiling part of a mkstred program.<br />

A typical mkstr command line is<br />

mkstr pistrings xx *.c<br />

This command would cause all the error messages from the C source files in the current<br />

directory to be placed in the file pistrings and processed copies of the source for these<br />

files to be placed in files whose names are prefixed with xx.<br />

To process the error messages in the· source to the message file, mkstr keys on the<br />

string error(" in the input stream. Each time it occurs, the C string starting at the " is<br />

placed in the message file and followed by a null character and a newline character; the<br />

null character terminates the message so it can be easily used when retrieved, and the<br />

newline character makes it possible to sensibly cat the error message file to see its<br />

contents. The massaged copy of the input file then contains an lseek pointer into the<br />

file. This pointer can be used to retrieve the message, as the following example<br />

demonstrates. The command changes<br />

into<br />

error("Error on reading", a2, a3, a4);<br />

error(m, a2, a3, a4);<br />

where m is the seek position of the string in the resulting error message file. The<br />

programmer must create a routine error that opens the message file, reads the string,<br />

and prints it out. The "Example" section, which follows, illustrates such a routine.<br />

B-92

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!