2 * CMD - Wine-compatible command line interface.
4 * Copyright (C) 1999 D A Pickles
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
29 #include <wine/unicode.h>
31 void WCMD_assoc (char *, BOOL
);
32 void WCMD_batch (char *, char *, int, char *, HANDLE
);
33 void WCMD_call (char *command
);
34 void WCMD_change_tty (void);
35 void WCMD_clear_screen (void);
36 void WCMD_color (void);
37 void WCMD_copy (void);
38 void WCMD_create_dir (void);
39 BOOL
WCMD_delete (char *, BOOL
);
40 void WCMD_directory (char *);
41 void WCMD_echo (const char *);
42 void WCMD_endlocal (void);
43 void WCMD_enter_paged_mode(const char *);
44 void WCMD_exit (void);
45 void WCMD_for (char *);
46 void WCMD_give_help (char *command
);
47 void WCMD_goto (void);
48 void WCMD_if (char *);
49 void WCMD_leave_paged_mode(void);
50 void WCMD_more (char *);
51 void WCMD_move (void);
52 void WCMD_output (const char *format
, ...);
53 void WCMD_output_asis (const char *message
);
54 void WCMD_parse (char *s
, char *q
, char *p1
, char *p2
);
55 void WCMD_pause (void);
56 void WCMD_pipe (char *command
);
57 void WCMD_popd (void);
58 void WCMD_print_error (void);
59 void WCMD_process_command (char *command
);
60 void WCMD_pushd (char *);
61 int WCMD_read_console (char *string
, int str_len
);
62 void WCMD_remove_dir (char *command
);
63 void WCMD_rename (void);
64 void WCMD_run_program (char *command
, int called
);
65 void WCMD_setlocal (const char *command
);
66 void WCMD_setshow_attrib (void);
67 void WCMD_setshow_date (void);
68 void WCMD_setshow_default (char *command
);
69 void WCMD_setshow_env (char *command
);
70 void WCMD_setshow_path (char *command
);
71 void WCMD_setshow_prompt (void);
72 void WCMD_setshow_time (void);
73 void WCMD_shift (char *command
);
74 void WCMD_show_prompt (void);
75 void WCMD_title (char *);
76 void WCMD_type (char *);
77 void WCMD_verify (char *command
);
78 void WCMD_version (void);
79 int WCMD_volume (int mode
, char *command
);
81 char *WCMD_fgets (char *s
, int n
, HANDLE stream
);
82 char *WCMD_parameter (char *s
, int n
, char **where
);
83 char *WCMD_strtrim_leading_spaces (char *string
);
84 void WCMD_strtrim_trailing_spaces (char *string
);
85 void WCMD_opt_s_strip_quotes(char *cmd
);
86 void WCMD_HandleTildaModifiers(char **start
, char *forVariable
);
87 BOOL
WCMD_ask_confirm (char *message
, BOOL showSureText
, BOOL
*optionAll
);
89 void WCMD_splitpath(const CHAR
* path
, CHAR
* drv
, CHAR
* dir
, CHAR
* name
, CHAR
* ext
);
90 char *WCMD_LoadMessage(UINT id
);
92 /* Data structure to hold context when executing batch files */
95 char *command
; /* The command which invoked the batch file */
96 HANDLE h
; /* Handle to the open batch file */
97 int shift_count
[10]; /* Offset in terms of shifts for %0 - %9 */
98 void *prev_context
; /* Pointer to the previous context block */
99 BOOL skip_rest
; /* Skip the rest of the batch program and exit */
102 /* Data structure to save setlocal and pushd information */
106 struct env_stack
*next
;
108 int stackdepth
; /* Only used for pushd and popd */
109 char cwd
; /* Only used for set/endlocal */
114 /* Data structure to handle building lists during recursive calls */
116 typedef struct _DIRECTORY_STACK
118 struct _DIRECTORY_STACK
*next
;
123 #endif /* !RC_INVOKED */
126 * Serial nos of builtin commands. These constants must be in step with
127 * the list of strings defined in WCMD.C, and WCMD_EXIT *must* always be
130 * Yes it *would* be nice to use an enumeration here, but the Resource
131 * Compiler won't accept resource IDs from enumerations :-(
134 #define WCMD_ATTRIB 0
145 #define WCMD_ERASE 11
150 #define WCMD_LABEL 16
152 #define WCMD_MKDIR 18
155 #define WCMD_PAUSE 21
156 #define WCMD_PROMPT 22
159 #define WCMD_RENAME 25
161 #define WCMD_RMDIR 27
163 #define WCMD_SHIFT 29
165 #define WCMD_TITLE 31
167 #define WCMD_VERIFY 33
171 #define WCMD_ENDLOCAL 36
172 #define WCMD_SETLOCAL 37
173 #define WCMD_PUSHD 38
175 #define WCMD_ASSOC 40
176 #define WCMD_COLOR 41
177 #define WCMD_FTYPE 42
180 /* Must be last in list */
183 /* Some standard messages */
184 extern const char newline
[];
185 extern const char version_string
[];
186 extern const char anykey
[];
188 /* Translated messages */
189 #define WCMD_CONFIRM 1001
190 #define WCMD_YES 1002
192 #define WCMD_NOASSOC 1004
193 #define WCMD_NOFTYPE 1005
194 #define WCMD_OVERWRITE 1006
195 #define WCMD_MORESTR 1007
196 #define WCMD_TRUNCATEDLINE 1008
197 #define WCMD_NYI 1009
198 #define WCMD_NOARG 1010
199 #define WCMD_SYNTAXERR 1011
200 #define WCMD_FILENOTFOUND 1012
201 #define WCMD_NOCMDHELP 1013
202 #define WCMD_NOTARGET 1014
203 #define WCMD_CURRENTDATE 1015
204 #define WCMD_CURRENTTIME 1016
205 #define WCMD_NEWDATE 1017
206 #define WCMD_NEWTIME 1018
207 #define WCMD_MISSINGENV 1019
208 #define WCMD_READFAIL 1020
209 #define WCMD_CALLINSCRIPT 1021
210 #define WCMD_ALL 1022
211 #define WCMD_DELPROMPT 1023
212 #define WCMD_ECHOPROMPT 1024
213 #define WCMD_VERIFYPROMPT 1025
214 #define WCMD_VERIFYERR 1026
215 #define WCMD_ARGERR 1027
216 #define WCMD_VOLUMEDETAIL 1028
217 #define WCMD_VOLUMEPROMPT 1029
219 /* msdn specified max for Win XP */
220 #define MAXSTRING 8192