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 (WCHAR
*, BOOL
);
32 void WCMD_batch (WCHAR
*, WCHAR
*, int, WCHAR
*, HANDLE
);
33 void WCMD_call (WCHAR
*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 (WCHAR
*, BOOL
);
40 void WCMD_directory (WCHAR
*);
41 void WCMD_echo (const WCHAR
*);
42 void WCMD_endlocal (void);
43 void WCMD_enter_paged_mode(const WCHAR
*);
44 void WCMD_exit (void);
45 void WCMD_for (WCHAR
*);
46 void WCMD_give_help (WCHAR
*command
);
47 void WCMD_goto (void);
48 void WCMD_if (WCHAR
*);
49 void WCMD_leave_paged_mode(void);
50 void WCMD_more (WCHAR
*);
51 void WCMD_move (void);
52 void WCMD_output (const WCHAR
*format
, ...);
53 void WCMD_output_asis (const WCHAR
*message
);
54 void WCMD_parse (WCHAR
*s
, WCHAR
*q
, WCHAR
*p1
, WCHAR
*p2
);
55 void WCMD_pause (void);
56 void WCMD_pipe (WCHAR
*command
);
57 void WCMD_popd (void);
58 void WCMD_print_error (void);
59 void WCMD_process_command (WCHAR
*command
);
60 void WCMD_pushd (WCHAR
*);
61 int WCMD_read_console (WCHAR
*string
, int str_len
);
62 void WCMD_remove_dir (WCHAR
*command
);
63 void WCMD_rename (void);
64 void WCMD_run_program (WCHAR
*command
, int called
);
65 void WCMD_setlocal (const WCHAR
*command
);
66 void WCMD_setshow_attrib (void);
67 void WCMD_setshow_date (void);
68 void WCMD_setshow_default (WCHAR
*command
);
69 void WCMD_setshow_env (WCHAR
*command
);
70 void WCMD_setshow_path (WCHAR
*command
);
71 void WCMD_setshow_prompt (void);
72 void WCMD_setshow_time (void);
73 void WCMD_shift (WCHAR
*command
);
74 void WCMD_show_prompt (void);
75 void WCMD_title (WCHAR
*);
76 void WCMD_type (WCHAR
*);
77 void WCMD_verify (WCHAR
*command
);
78 void WCMD_version (void);
79 int WCMD_volume (int mode
, WCHAR
*command
);
81 WCHAR
*WCMD_fgets (WCHAR
*s
, int n
, HANDLE stream
);
82 WCHAR
*WCMD_parameter (WCHAR
*s
, int n
, WCHAR
**where
);
83 WCHAR
*WCMD_strtrim_leading_spaces (WCHAR
*string
);
84 void WCMD_strtrim_trailing_spaces (WCHAR
*string
);
85 void WCMD_opt_s_strip_quotes(WCHAR
*cmd
);
86 void WCMD_HandleTildaModifiers(WCHAR
**start
, WCHAR
*forVariable
);
87 BOOL
WCMD_ask_confirm (WCHAR
*message
, BOOL showSureText
, BOOL
*optionAll
);
89 void WCMD_splitpath(const WCHAR
* path
, WCHAR
* drv
, WCHAR
* dir
, WCHAR
* name
, WCHAR
* ext
);
90 WCHAR
*WCMD_LoadMessage(UINT id
);
91 WCHAR
*WCMD_strdupW(WCHAR
*input
);
92 BOOL
WCMD_ReadFile(const HANDLE hIn
, WCHAR
*intoBuf
, const DWORD maxChars
,
93 LPDWORD charsRead
, const LPOVERLAPPED unused
);
95 /* Data structure to hold context when executing batch files */
98 WCHAR
*command
; /* The command which invoked the batch file */
99 HANDLE h
; /* Handle to the open batch file */
100 int shift_count
[10]; /* Offset in terms of shifts for %0 - %9 */
101 void *prev_context
; /* Pointer to the previous context block */
102 BOOL skip_rest
; /* Skip the rest of the batch program and exit */
105 /* Data structure to save setlocal and pushd information */
109 struct env_stack
*next
;
111 int stackdepth
; /* Only used for pushd and popd */
112 WCHAR cwd
; /* Only used for set/endlocal */
117 /* Data structure to handle building lists during recursive calls */
119 typedef struct _DIRECTORY_STACK
121 struct _DIRECTORY_STACK
*next
;
126 #endif /* !RC_INVOKED */
129 * Serial nos of builtin commands. These constants must be in step with
130 * the list of strings defined in WCMD.C, and WCMD_EXIT *must* always be
133 * Yes it *would* be nice to use an enumeration here, but the Resource
134 * Compiler won't accept resource IDs from enumerations :-(
137 #define WCMD_ATTRIB 0
148 #define WCMD_ERASE 11
153 #define WCMD_LABEL 16
155 #define WCMD_MKDIR 18
158 #define WCMD_PAUSE 21
159 #define WCMD_PROMPT 22
162 #define WCMD_RENAME 25
164 #define WCMD_RMDIR 27
166 #define WCMD_SHIFT 29
168 #define WCMD_TITLE 31
170 #define WCMD_VERIFY 33
174 #define WCMD_ENDLOCAL 36
175 #define WCMD_SETLOCAL 37
176 #define WCMD_PUSHD 38
178 #define WCMD_ASSOC 40
179 #define WCMD_COLOR 41
180 #define WCMD_FTYPE 42
183 /* Must be last in list */
186 /* Some standard messages */
187 extern const WCHAR newline
[];
188 extern WCHAR anykey
[];
189 extern WCHAR version_string
[];
191 /* Translated messages */
192 #define WCMD_ALLHELP 1000
193 #define WCMD_CONFIRM 1001
194 #define WCMD_YES 1002
196 #define WCMD_NOASSOC 1004
197 #define WCMD_NOFTYPE 1005
198 #define WCMD_OVERWRITE 1006
199 #define WCMD_MORESTR 1007
200 #define WCMD_TRUNCATEDLINE 1008
201 #define WCMD_NYI 1009
202 #define WCMD_NOARG 1010
203 #define WCMD_SYNTAXERR 1011
204 #define WCMD_FILENOTFOUND 1012
205 #define WCMD_NOCMDHELP 1013
206 #define WCMD_NOTARGET 1014
207 #define WCMD_CURRENTDATE 1015
208 #define WCMD_CURRENTTIME 1016
209 #define WCMD_NEWDATE 1017
210 #define WCMD_NEWTIME 1018
211 #define WCMD_MISSINGENV 1019
212 #define WCMD_READFAIL 1020
213 #define WCMD_CALLINSCRIPT 1021
214 #define WCMD_ALL 1022
215 #define WCMD_DELPROMPT 1023
216 #define WCMD_ECHOPROMPT 1024
217 #define WCMD_VERIFYPROMPT 1025
218 #define WCMD_VERIFYERR 1026
219 #define WCMD_ARGERR 1027
220 #define WCMD_VOLUMEDETAIL 1028
221 #define WCMD_VOLUMEPROMPT 1029
222 #define WCMD_NOPATH 1030
223 #define WCMD_ANYKEY 1031
224 #define WCMD_CONSTITLE 1032
225 #define WCMD_VERSION 1033
228 /* msdn specified max for Win XP */
229 #define MAXSTRING 8192