/************************************************************************ * * * Copyright Digital Equipment Corporation 1998. All rights reserved. * * * * Restricted Rights: Use, duplication, or disclosure by the U.S. * * Government is subject to restrictions as set forth in subparagraph * * (c) (1) (ii) of DFARS 252.227-7013, or in FAR 52.227-19, or in FAR * * 52.227-14 Alt. III, as applicable. * * * * This software is proprietary to and embodies the confidential * * technology of Digital Equipment Corporation. Possession, use, or * * copying of this software and media is authorized only pursuant to a * * valid written license from Digital or an authorized sublicensor. * * * ************************************************************************/ #include #include #include #include #include #include /* This test makes use of all the message catalog routines. catopen() */ /* opens the catalog ready for reading, then each of the three messages */ /* in the catalog are extracted in turn using catgets() and printed out. */ /* catclose() closes the catalog after use. */ /* The catalog source file used to create the catalog is as follows: */ /* $ this is a message file * $ * $quote " * $ another comment line * $set 1 * 1 "First set, first message" * 2 "second message -- This long message uses a backslash \ * for continuation." * $set 2 * 1 "Second set, first message" */ char *default_msg = "this is the first message."; main() { nl_catd catalog; int msg1, msg2, retval; char *cat = "sys$disk:[]catgets_example.cat"; /* Force local catalog */ char *msgtxt; char string[128]; /* Create the message test catalog */ system("gencat catgets_example.msgx catgets_example.cat") ; if ((catalog = catopen(cat, 0)) == (nl_catd) - 1) { perror("catopen"); exit(EXIT_FAILURE); } msgtxt = catgets(catalog, 1, 1, default_msg); printf("%s\n", msgtxt); msgtxt = catgets(catalog, 1, 2, default_msg); printf("%s\n", msgtxt); msgtxt = catgets(catalog, 2, 1, default_msg); printf("%s\n", msgtxt); if ((retval = catclose(catalog)) == -1) { perror("catclose"); exit(EXIT_FAILURE); } delete("catgets_example.cat;") ; /* Remove the test catalog */ }