Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ mkstr(1) — bsd — Apollo Domain/OS SR10.4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

lseek(2)

xstr(1)

MKSTR(1)                             BSD                              MKSTR(1)



NAME
     mkstr - create an error message file by massaging C source

SYNOPSIS
     mkstr [ - ] messagefile prefix file ...

DESCRIPTION
     mkstr is used to create files of error messages.  It can make programs
     with many error diagnostics much smaller, and can reduce system overhead
     in running the program because error messages do not have to be
     constantly swapped in and out.

     mkstr processes each specified file, placing a massaged version of the
     file in a file whose name consists of the specified prefix added to the
     original name.

     To process the error messages in the source to the message file, mkstr
     keys on the string `error("' in the input stream.  mkstr puts each C
     string, starting at the quotation mark, in the message file, followed by
     a null character and a newline character.  The null character terminates
     the message so you can use it easily when you retrieve it.  The newline
     character allows you to sensibly cat the error message file to see its
     contents.  The massaged copy of the input file then contains an lseek
     pointer into the file, that you can use to retrieve the message, for
     example,


          char efilname[] =  "/usr/lib/pi_strings";
          int  efil = -1;

          error(a1, a2, a3, a4)
          {
               char buf[256];

               if (efil < 0) {
                    efil = open(efilname, 0);
                    if (efil < 0) {
          oops:
                         perror(efilname);
                         exit(1);
                    }
               }
               if (lseek(efil, (long) a1, 0) || read(efil, buf, 256) <= 0)
                    goto oops;
               printf(buf, a2, a3, a4);
          }

     If you specify the dash (-), mkstr puts error messages at the end of the
     specified message file for recompiling part of a large mkstr program.

EXAMPLE
     Specify the following command if you want to put all the error messages
     from the C source files in the current directory into the file pistrings,
     and put processed copies of the source for these files in files whose
     names are prefixed with xx,:

          mkstr pistrings xx *.c

SEE ALSO
     lseek(2), xstr(1)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026