Import from 1.9a8 tarball
[mozilla-nss.git] / security / nss / cmd / modutil / error.h
blob7b478223a4e7cb2a71fcf0db517defb5d2611009
1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
12 * License.
14 * The Original Code is the Netscape security libraries.
16 * The Initial Developer of the Original Code is
17 * Netscape Communications Corporation.
18 * Portions created by the Initial Developer are Copyright (C) 1994-2000
19 * the Initial Developer. All Rights Reserved.
21 * Contributor(s):
23 * Alternatively, the contents of this file may be used under the terms of
24 * either the GNU General Public License Version 2 or later (the "GPL"), or
25 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26 * in which case the provisions of the GPL or the LGPL are applicable instead
27 * of those above. If you wish to allow use of your version of this file only
28 * under the terms of either the GPL or the LGPL, and not to allow others to
29 * use your version of this file under the terms of the MPL, indicate your
30 * decision by deleting the provisions above and replace them with the notice
31 * and other provisions required by the GPL or the LGPL. If you do not delete
32 * the provisions above, a recipient may use your version of this file under
33 * the terms of any one of the MPL, the GPL or the LGPL.
35 * ***** END LICENSE BLOCK ***** */
37 #ifndef MODUTIL_ERROR_H
38 #define MODUTIL_ERROR_H
40 typedef enum {
41 NO_ERR=0,
42 INVALID_USAGE_ERR,
43 UNEXPECTED_ARG_ERR,
44 UNKNOWN_OPTION_ERR,
45 MULTIPLE_COMMAND_ERR,
46 OPTION_NEEDS_ARG_ERR,
47 DUPLICATE_OPTION_ERR,
48 MISSING_PARAM_ERR,
49 INVALID_FIPS_ARG,
50 NO_COMMAND_ERR,
51 NO_DBDIR_ERR,
52 FIPS_SWITCH_FAILED_ERR,
53 FIPS_ALREADY_ON_ERR,
54 FIPS_ALREADY_OFF_ERR,
55 FILE_ALREADY_EXISTS_ERR,
56 FILE_DOESNT_EXIST_ERR,
57 FILE_NOT_READABLE_ERR,
58 FILE_NOT_WRITEABLE_ERR,
59 DIR_DOESNT_EXIST_ERR,
60 DIR_NOT_READABLE_ERR,
61 DIR_NOT_WRITEABLE_ERR,
62 INVALID_CONSTANT_ERR,
63 ADD_MODULE_FAILED_ERR,
64 ADD_MODULE_FAILED_STATUS_ERR,
65 OUT_OF_MEM_ERR,
66 DELETE_INTERNAL_ERR,
67 DELETE_FAILED_ERR,
68 NO_LIST_LOCK_ERR,
69 NO_MODULE_LIST_ERR,
70 NO_SUCH_MODULE_ERR,
71 MOD_INFO_ERR,
72 SLOT_INFO_ERR,
73 TOKEN_INFO_ERR,
74 NO_SUCH_TOKEN_ERR,
75 CHANGEPW_FAILED_ERR,
76 BAD_PW_ERR,
77 DB_ACCESS_ERR,
78 AUTHENTICATION_FAILED_ERR,
79 NO_SUCH_SLOT_ERR,
80 ENABLE_FAILED_ERR,
81 UPDATE_MOD_FAILED_ERR,
82 DEFAULT_FAILED_ERR,
83 UNDEFAULT_FAILED_ERR,
84 STDIN_READ_ERR,
85 UNSPECIFIED_ERR,
86 NOCERTDB_MISUSE_ERR,
87 NSS_INITIALIZE_FAILED_ERR,
89 LAST_ERR /* must be last */
90 } Error;
91 #define SUCCESS NO_ERR
93 /* !!! Should move this into its own .c and un-static it. */
94 static char *errStrings[] = {
95 "Operation completed successfully.\n",
96 "ERROR: Invalid command line.\n",
97 "ERROR: Not expecting argument \"%s\".\n",
98 "ERROR: Unknown option: %s.\n",
99 "ERROR: %s: multiple commands are not allowed on the command line.\n",
100 "ERROR: %s: option needs an argument.\n",
101 "ERROR: %s: option cannot be given more than once.\n",
102 "ERROR: Command \"%s\" requires parameter \"%s\".\n",
103 "ERROR: Argument to -fips must be \"true\" or \"false\".\n",
104 "ERROR: No command was specified.\n",
105 "ERROR: Cannot determine database directory: use the -dbdir option.\n",
106 "ERROR: Unable to switch FIPS modes.\n",
107 "FIPS mode already enabled.\n",
108 "FIPS mode already disabled.\n",
109 "ERROR: File \"%s\" already exists.\n",
110 "ERROR: File \"%s\" does not exist.\n",
111 "ERROR: File \"%s\" is not readable.\n",
112 "ERROR: File \"%s\" is not writeable.\n",
113 "ERROR: Directory \"%s\" does not exist.\n",
114 "ERROR: Directory \"%s\" is not readable.\n",
115 "ERROR: Directory \"%s\" is not writeable.\n",
116 "\"%s\" is not a recognized value.\n",
117 "ERROR: Failed to add module \"%s\".\n",
118 "ERROR: Failed to add module \"%s\". Probable cause : \"%s\".\n",
119 "ERROR: Out of memory.\n",
120 "ERROR: Cannot delete internal module.\n",
121 "ERROR: Failed to delete module \"%s\".\n",
122 "ERROR: Unable to obtain lock on module list.\n",
123 "ERROR: Unable to obtain module list.\n",
124 "ERROR: Module \"%s\" not found in database.\n",
125 "ERROR: Unable to get information about module \"%s\".\n",
126 "ERROR: Unable to get information about slot \"%s\".\n",
127 "ERROR: Unable to get information about token \"%s\".\n",
128 "ERROR: Token \"%s\" not found.\n",
129 "ERROR: Unable to change password on token \"%s\".\n",
130 "ERROR: Incorrect password.\n",
131 "ERROR: Unable to access database \"%s\".\n",
132 "ERROR: Unable to authenticate to token \"%s\".\n",
133 "ERROR: Slot \"%s\" not found.\n",
134 "ERROR: Failed to %s slot \"%s\".\n",
135 "ERROR: Failed to update module \"%s\".\n",
136 "ERROR: Failed to change defaults.\n",
137 "ERROR: Failed to change default.\n",
138 "ERROR: Unable to read from standard input.\n",
139 "ERROR: Unknown error occurred.\n",
140 "ERROR: -nocertdb option can only be used with the -jar command.\n"
141 "ERROR: NSS_Initialize() failed.\n"
144 typedef enum {
145 FIPS_ENABLED_MSG=0,
146 FIPS_DISABLED_MSG,
147 USING_DBDIR_MSG,
148 CREATING_DB_MSG,
149 ADD_MODULE_SUCCESS_MSG,
150 DELETE_SUCCESS_MSG,
151 CHANGEPW_SUCCESS_MSG,
152 BAD_PW_MSG,
153 PW_MATCH_MSG,
154 DONE_MSG,
155 ENABLE_SUCCESS_MSG,
156 DEFAULT_SUCCESS_MSG,
157 UNDEFAULT_SUCCESS_MSG,
158 BROWSER_RUNNING_MSG,
159 ABORTING_MSG,
161 LAST_MSG /* must be last */
162 } Message;
164 static char *msgStrings[] = {
165 "FIPS mode enabled.\n",
166 "FIPS mode disabled.\n",
167 "Using database directory %s...\n",
168 "Creating \"%s\"...",
169 "Module \"%s\" added to database.\n",
170 "Module \"%s\" deleted from database.\n",
171 "Token \"%s\" password changed successfully.\n",
172 "Incorrect password, try again...\n",
173 "Passwords do not match, try again...\n",
174 "done.\n",
175 "Slot \"%s\" %s.\n",
176 "Successfully changed defaults.\n",
177 "Successfully changed defaults.\n",
178 "\nWARNING: Performing this operation while the browser is running could cause"
179 "\ncorruption of your security databases. If the browser is currently running,"
180 "\nyou should exit browser before continuing this operation. Type "
181 "\n'q <enter>' to abort, or <enter> to continue: ",
182 "\nAborting...\n"
185 #endif /* MODUTIL_ERROR_H */