Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / programs / dtpdmd / nlmsg.c
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: nlmsg.c /main/1 1996/10/30 19:10:20 cde-hp $ */
24 /*
25  * dtpdmd/nlmsg.c
26  */
27 /*
28  * (c) Copyright 1996 Digital Equipment Corporation.
29  * (c) Copyright 1996 Hewlett-Packard Company.
30  * (c) Copyright 1996 International Business Machines Corp.
31  * (c) Copyright 1996 Sun Microsystems, Inc.
32  * (c) Copyright 1996 Novell, Inc. 
33  * (c) Copyright 1996 FUJITSU LIMITED.
34  * (c) Copyright 1996 Hitachi.
35  */
36
37 #ifdef I18N_MSG
38
39 #include <nl_types.h>
40
41 #if !defined(NL_CAT_LOCALE)
42 #define NL_CAT_LOCALE 0
43 #endif 
44
45 #define DTPDMD_CAT_NAME "dtpdmd"
46
47 #endif /* I18N_MSG */
48
49 /*
50  * ------------------------------------------------------------------------
51  * Default message values
52  */
53
54 /*** dtpdmd.c ***/
55 const char DtPdmdMsg_0001[]  = "\
56 usage: %1$s [options]\n\
57 \n\
58 where [options] includes:\n\
59    -d <display>        host:display[.screen] of X Print Server\n\
60    -a <alt selection>  an alternate selection name (\"%2$s\" default)\n\
61    -p <default pdm>    a default pdm to launch (\"%3$s\" default)\n\
62    -P <the pdm>        the pdm to launch, overrides all others\n\
63    -s                  turn on security protocol\n\
64    -f <auth file>      an initial set of authorization cookies\n\
65    -l <log file>       a file for the logging of errors, etc";
66
67 const char DtPdmdMsg_0002[]  = "%1$s: error, cannot open display %2$s\n";
68 const char DtPdmdMsg_0003[]  = "%1$s: error, cannot acquire selection %2$s\n";
69 const char DtPdmdMsg_0004[]  = "%s: error, cannot create Xt Signal Pipe\n";
70
71 /*** manager.c ***/
72
73 const char DtPdmdMsg_0005[]  = "%s: error, unable to get SelectionRequest property\n";
74 const char DtPdmdMsg_0006[]  = "%s: error, invalid format for SelectionRequest property\n";
75 const char DtPdmdMsg_0007[]  = "%s: error, XmbTextPropertyToTestList failed on SelectionRequest property\n";
76 const char DtPdmdMsg_0008[]  = "%s: error, unable to create message pipe\n";
77 const char DtPdmdMsg_0009[]  = "%s: error, unable to fork\n";
78 const char DtPdmdMsg_0010[] = "%1$s: error, cannot execute \"%2$s\" \n";
79
80 const char DtPdmdMsg_0011[] = "\
81 %1$s: exec message logged at %2$s\n\
82    exec error message = \"%3$s\"\n\
83    exec error code    = %4$s\n\
84    pdm                = \"%5$s\"\n\
85    -display           = \"%6$s\"\n\
86    -vdisplay          = \"%7$s\" \n";
87
88 const char DtPdmdMsg_0012[] = "\
89 %1$s: error, unable to send the final %2$s\n\
90 message to the requesting client on behalf of\n\
91 the PDM because of a generated X error\n";
92
93 const char DtPdmdMsg_0013[] = "\
94 %1$s: error, unable to send the final %2$s\n\
95 message to the requesting client on behalf of\n\
96 the PDM because of an XIO error\n";
97
98 const char DtPdmdMsg_0014[] = "\
99 %1$s: pdm message logged at %2$s\n\
100    pdm       = \"%3$s\"\n\
101    -display  = \"%4$s\"\n\
102    -vdisplay = \"%5$s\"\n\
103    exit code = \"%6$d\"\n\
104    stderr    = \"%7$s\" \n";
105
106 const char DtPdmdMsg_0015[] = "\
107    attached pdmd error= \n\"%s\" \n";
108
109 const char DtPdmdMsg_0016[] = "%1$s: error, cannot open log file \"%2$s\". Turning off stderr message logging\n";
110
111 #ifdef I18N_MSG
112
113 /*
114  * ------------------------------------------------------------------------
115  * Name: DtPdmdGetMessage
116  *
117  * Parameters:
118  *
119  *   int        set -           The message catalog set number.
120  *
121  *   int        n -             The message number.
122  *
123  *   char       *s -            The default message if the message is not
124  *                              retrieved from a message catalog.
125  *
126  * Returns: the string for set 'set' and number 'n'.
127  */
128 const char *
129 DtPdmdGetMessage(
130                 int set,
131                 int n,
132                 char * s)
133 {
134     char *msg;
135     nl_catd catopen();
136     char *catgets();
137     static int first = 1;
138     static nl_catd nlmsg_fd;
139     
140     if(set == -1 || n == -1)
141         return s;
142     
143     if(first) 
144     {
145         first = 0;
146         nlmsg_fd = catopen(DTPDMD_CAT_NAME, NL_CAT_LOCALE);
147     }
148     msg=catgets(nlmsg_fd,set,n,s);
149     return (msg);
150 }
151 #endif /* I18N_MSG */