dthelp: Change to ANSI function definitions
[oweals/cde.git] / cde / programs / dtfile / SharedMsgs.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 libraries 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: SharedMsgs.c /main/4 1995/11/02 14:43:46 rswiston $ */
24 /************************************<+>*************************************
25  ****************************************************************************
26  *
27  *   FILE:           SharedMsgs.c
28  *
29  *   COMPONENT_NAME: Desktop File Manager (dtfile)
30  *
31  *   Description:    This file contains the set of functions for accessing
32  *                   the set of shared message strings.
33  *
34  *   FUNCTIONS: GetSharedMessage
35  *
36  *   (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company
37  *   (c) Copyright 1993, 1994, 1995 International Business Machines Corp.
38  *   (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.
39  *   (c) Copyright 1993, 1994, 1995 Novell, Inc.
40  *
41  ****************************************************************************
42  ************************************<+>*************************************/
43
44
45 #include <sys/types.h>
46 #include <sys/stat.h>
47 #include <sys/param.h>
48 #include <stdio.h>
49 #include <stdlib.h>
50 #include <limits.h>
51 #include <signal.h>
52 #include <errno.h>
53 #include <pwd.h>
54 #include <time.h>
55 #ifndef sun /* don't need the nl_types.h file */
56 #include <nl_types.h>
57 #endif /* ! sun */
58
59 #include <Xm/XmP.h>
60
61 #include "Encaps.h"
62
63 #include "FileMgr.h"
64 #include "Desktop.h"
65 #include "Main.h"
66 #include "SharedMsgs.h"
67
68
69 static char unknownmessage[] = "***Unknown shared message***";
70
71 /************************************************************************
72  *
73  *   This function takes the id passed in, and returns a pointer to the
74  *   associated error message string.  THIS IS NOT A COPY OF THE STRING,
75  *   BUT IS A POINTER TO THE REAL THING.  IF THE CALLER NEEDS A COPY, 
76  *   THEN IT SHOULD MAKE ONE!  THE RETURNED STRING MUST NOT BE FREED.
77  *
78  ************************************************************************/
79
80 char *
81 GetSharedMessage(
82         int id )
83
84 {
85    switch (id)
86    {
87       case CANNOT_READ_DIRECTORY_ERROR:
88          return((GETMESSAGE(30,1, "Cannot read from %s")));
89       case DIRECTORY_DATE_FORMAT:
90          return ((GETMESSAGE(30,2, "%b %d %H:%M:%S %Y")));
91       case FILE_RENAME_ERROR_TITLE:
92          return (GETMESSAGE(10, 1, "File Rename Error"));
93       case FILE_MANIPULATION_ERROR_TITLE:
94          return (GETMESSAGE(11, 6, "File Manipulation Error"));
95       case CANNOT_CONNECT_ERROR_1:
96          return((GETMESSAGE(30,3, "Cannot move or copy file %s from host %s.\nHost %s may not be properly mounted to your file system.")));
97       case CANNOT_CONNECT_ERROR_2:
98          return((GETMESSAGE(30,4, "Cannot move or copy file %1$s from host %2$s.\nHost %3$s may not be properly mounted to your file system.")));
99       case CANT_READ_ERROR:
100          return ((GETMESSAGE(30,5, "Cannot read %s")));
101       case CANT_WRITE_ERROR:
102          return ((GETMESSAGE(30,6, "Cannot write in folder %s")));
103       case CANT_CREATE_ERROR:
104          return ((GETMESSAGE(30,25, "Cannot create '%s'\n\nThe most common cause is that you do not have\nthe correct permissions for the involved\nfiles or folders.\n\nTo view permissions, select the object and\nthen select 'Change Permissions...' from the\nSelected or popup menu.")));
105       case CANT_DELETE_ERROR:
106          return ((GETMESSAGE(30,8, "Cannot delete %s")));
107       case CANT_OVERWRITE_ERROR:
108          return ((GETMESSAGE(30,9, "A folder or file with the name\n%s\nalready exists and cannot be overwritten.\nEnter a different name.")));
109       case ACTION_FT_HELP_TITLE:
110          return ((GETMESSAGE(30,10, "Description Of Filetype/Action")));
111       case FILES_FOUND_LABEL:
112          return (GETMESSAGE(15, 40, "Files Found (by Name):"));
113       case LOCAL_RENAME_ONLY_ERROR:
114          return ((GETMESSAGE(30,11, "You cannot specify a path as part of the filename.")));
115       case NO_DIR_ACCESS_ERROR:
116          return ((GETMESSAGE(30,12, "Invalid Find Information.\n\nThe following folder does not exist, or is not accessible:\n\n     %s\n")));
117       case NO_FILES_FOUND_ERROR:
118         return (GETMESSAGE(15, 27, "No files were found that match the search data."));
119       case FIND_ERROR_TITLE:
120          return (GETMESSAGE(15,43, "Find Error"));
121       case FILE_COPY_ERROR_TITLE:
122          return (GETMESSAGE(10, 2, "File Copy Error"));
123       case NO_SPACES_ALLOWED_ERROR:
124          return (GETMESSAGE(10, 3, "Spaces are not allowed in a file or folder name."));
125       case MENU_OVERVIEW_LABEL:
126          return ((GETMESSAGE(30,13, "%s Overview")));
127       case MENU_TUTORIAL_LABEL:
128          return ((GETMESSAGE(30,14, "%s Tutorial")));
129       case MENU_ABOUT_LABEL:
130          return ((GETMESSAGE(30,15, "About %s")));
131       case FILE_MGR_MENU_NAME:
132          return ((GETMESSAGE(30,16, "File Manager")));
133       case CHANGE_DIR_ERROR_TITLE:
134          return (GETMESSAGE(2, 13, "Go To Error"));
135       case TRASH_ERROR_TITLE:
136          return (GETMESSAGE(27, 3, "Trash Can Error"));
137       case FILTER_EDIT_ID_STRING:
138          return ("filter_edit");
139       case FILTER_ACTIVE_ID_STRING:
140          return ("filter_active");
141       case UP_ONE_LEVEL_LABEL:
142          return ((GETMESSAGE(30,18, "(go up)")));
143       case ITEM_HELP_ERROR_TITLE: 
144          return ((GETMESSAGE(30,19, "Help On Item Error")));
145       case ITEM_HELP_ERROR:
146          return ((GETMESSAGE(30,24, "You must select an object within the File Manager.\n'On Item' help only works within the application where\nyou launched it.")));
147       case AMITEM_HELP_ERROR:
148          return ((GETMESSAGE(30,26, "You must select an object within the Application Manager.\n'On Item' help only works within the application where\nyou launched it.")));
149       case FILE_MOVE_ERROR_TITLE:
150          return GETMESSAGE(30,21, "File Move Error");
151       case FILE_LINK_ERROR_TITLE:
152          return GETMESSAGE(30,22, "File Link Error");
153       default:
154          fprintf(stderr, "GetSharedMessage: unknown message %d\n", id);
155          return unknownmessage;
156    }
157 }