Updated: 2022/Sep/29

Please read Privacy Policy. It's for your privacy.

GENCAT(1)                   General Commands Manual                  GENCAT(1)

     gencat - generates a Native Language Support (NLS) message catalog file

     gencat catfile [msgfile|- ...]

     The gencat utility generates a formatted message catalog catfile from
     stdin or one or more message source text files msgfile.  The file catfile
     is created if it does not already exist.  If catfile does exist, its
     messages are included in the new catfile.  The new message text defined
     in msgfile replaces the old message text currently in catfile when the
     set and message numbers match.

     The generated message catalog contains message strings that will be
     retrieved using the catgets(3) library call.  These messages are
     dynamically loaded by the Native Language Support (NLS) library at run
     time.  Error messages are grouped into sets, and a program can load a
     particular set depending on which type, or language, of messages is

   Message Text Source File Format
     The message text source files are text files in the format described
     below.  Note that the fields of a message text source line are separated
     by space or tab characters.

     $set n comment
          Determines the set identifier to be used for all subsequent messages
          until the next $set or end-of-file.  The n is the set identifier
          which is defined as a number in the range [1, NL_SETMAX].  Set
          identifiers within a single source file need not be contiguous.  Any
          string following the set identifier is treated as a comment.  If no
          $set directive is specified in a message text source file, all
          messages will be located in the default message set NL_SETD.

     $delset n comment
          Removes message set n from the catalog.  The n is a set identifier
          in the range [1, NL_SETMAX].  If a message set was created earlier
          in the current file, or in a file previously read by the gencat
          command, this directive will remove it.  Any string following the
          set identifier is treated as a comment.

     $ comment
          A line beginning with $ followed by a space or tab character is
          treated as a comment.

     m message-text
          A message line consists of a message identifier m in the range [1,
          NL_MSGMAX] and the message-text.  The message-text is read until the
          end of the line or a quote character (if one is specified).  The
          message-text is stored in the message catalog with the set
          identifier specified by the last $set directive, and the message
          identifier m.  If the message-text is empty and there is a space or
          tab character following the message identifier, an empty string is
          stored in the message catalog.  If no message-text is provided, and
          if there is no space or tab character following the message
          identifier, the message with the message identifier m in the current
          set is removed from the catalog.  Message identifiers need not be
          contiguous within a single set.  The length of message-text must be
          in the range [0, NL_TEXTMAX].

     $quote c
          Sets an optional quote character to be used around the message-text.
          The quote character c may be any character other than white space.
          If this is specified, then messages must begin and end with the
          quote character.  This is useful when messages must contain leading
          white space.  By default no quote character is used.  If an empty
          $quote directive is specified, then the current quote character is

     Empty lines and leading blanks in a message text source file are ignored.
     Any line beginning with any character other than those described above is
     ignored as a syntax error.

     Text message strings may contain any characters and the following special
     characters and escape sequences.

           Description            Symbol        Sequence
           newline                NL(LF)        \n
           horizontal tab         HT            \t
           vertical tab           VT            \v
           backspace              BS            \b
           carriage return        CR            \r
           form feed              FF            \f
           backslash              \             \\
           bit pattern            ddd           \ddd

     A bit pattern, \ddd, consists of a backslash followed by one, two, or
     three octal digits representing the value of the character.  The current
     quote character, if defined, may be escaped with a backslash to generate
     the quote character.  Any character following the backslash ('\') other
     than those specified is ignored.

     A backslash at the end of the line continues the message onto the next
     line.  The following two lines are an example of such a message:

           1 This message continues \
           on the next line

     Producing the following message:

           1 This message continues on the next line

     The gencat utility exits 0 on success, and >0 if an error occurs.

     catclose(3), catgets(3), catopen(3), nls(7)

     The Native Language Support (NLS) message catalog facility was
     contributed by J.T. Conklin <jtc@NetBSD.org>.  This page was originally
     written by Kee Hinckley <nazgul@somewhere.com>.

NetBSD 10.99                   December 29, 2011                  NetBSD 10.99