~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/programs/cmd/wcmd.h

Version: ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~ [ wine-1.0-rc5 ] ~ [ wine-1.0-rc4 ] ~ [ wine-1.0-rc3 ] ~ [ wine-1.0-rc2 ] ~ [ wine-1.0-rc1 ] ~ [ wine-0.9.61 ] ~ [ wine-0.9.60 ] ~ [ wine-0.9.59 ] ~ [ wine-0.9.58 ] ~ [ wine-0.9.57 ] ~ [ wine-0.9.56 ] ~ [ wine-0.9.55 ] ~ [ wine-0.9.54 ] ~ [ wine-0.9.53 ] ~ [ wine-0.9.52 ] ~ [ wine-0.9.51 ] ~ [ wine-0.9.50 ] ~ [ wine-0.9.49 ] ~ [ wine-0.9.48 ] ~ [ wine-0.9.47 ] ~ [ wine-0.9.46 ] ~ [ wine-0.9.45 ] ~ [ wine-0.9.44 ] ~ [ wine-0.9.43 ] ~ [ wine-0.9.42 ] ~ [ wine-0.9.41 ] ~ [ wine-0.9.40 ] ~ [ wine-0.9.39 ] ~ [ wine-0.9.38 ] ~ [ wine-0.9.37 ] ~ [ wine-0.9.36 ] ~ [ wine-0.9.35 ] ~ [ wine-0.9.34 ] ~ [ wine-0.9.33 ] ~ [ wine-0.9.32 ] ~ [ wine-0.9.31 ] ~ [ wine-0.9.30 ] ~ [ wine-0.9.29 ] ~ [ wine-0.9.28 ] ~ [ wine-0.9.27 ] ~ [ wine-0.9.26 ] ~ [ wine-0.9.25 ] ~ [ wine-0.9.24 ] ~ [ wine-0.9.23 ] ~ [ wine-0.9.22 ] ~ [ wine-0.9.21 ] ~ [ wine-0.9.20 ] ~ [ wine-0.9.19 ] ~ [ wine-0.9.18 ] ~ [ wine-0.9.17 ] ~ [ wine-0.9.16 ] ~ [ wine-0.9.15 ] ~ [ wine-0.9.14 ] ~ [ wine-0.9.13 ] ~ [ wine-0.9.12 ] ~ [ wine-0.9.11 ] ~ [ wine-0.9.10 ] ~ [ wine-0.9.9 ] ~ [ wine-0.9.8 ] ~ [ wine-0.9.7 ] ~ [ wine-0.9.6 ] ~ [ wine-0.9.5 ] ~ [ wine-0.9.4 ] ~ [ wine-0.9.3 ] ~ [ wine-0.9.2 ] ~ [ wine-0.9.1 ] ~ [ wine-0.9 ] ~ [ wine20050930 ] ~ [ wine20050830 ] ~ [ wine20050725 ] ~ [ wine20050628 ] ~ [ wine20050524 ] ~ [ wine20050419 ] ~ [ wine20050310 ] ~ [ wine20050211 ] ~ [ wine20050111 ] ~ [ wine20041201 ] ~ [ wine20041019 ] ~ [ wine20040914 ] ~ [ wine20040813 ] ~ [ wine20040716 ] ~ [ wine20040615 ] ~ [ wine20040505 ] ~ [ wine20040408 ] ~ [ wine20040309 ] ~ [ wine20040213 ] ~ [ wine20040121 ] ~ [ wine20031212 ] ~ [ wine20031118 ] ~ [ wine20031016 ] ~ [ wine20030911 ] ~ [ wine20030813 ] ~ [ wine20030709 ] ~ [ wine20030618 ] ~ [ wine20030508 ] ~ [ wine20030408 ] ~ [ wine20030318 ] ~ [ wine20030219 ] ~ [ wine20030115 ] ~ [ wine20021219 ] ~ [ wine20021125 ] ~ [ wine20021031 ] ~ [ wine20021007 ] ~ [ wine20020904 ] ~ [ wine20020804 ] ~ [ wine20020710 ] ~ [ wine20020605 ] ~ [ wine20020509 ] ~ [ wine20020411 ] ~ [ wine20020310 ] ~ [ wine20020228 ] ~ [ wine20011226 ] ~ [ wine20011108 ] ~ [ wine20011004 ] ~ [ wine20010824 ] ~ [ wine20010731 ] ~ [ wine20010629 ] ~ [ wine20010510 ] ~ [ wine20010418 ] ~ [ wine20010326 ] ~ [ wine20010305 ] ~ [ wine20010216 ] ~ [ wine20010112 ] ~ [ wine20001222 ] ~ [ wine20001202 ] ~ [ wine20001026 ] ~ [ wine20001002 ] ~ [ wine20000909 ] ~ [ wine20000821 ] ~ [ wine20000801 ] ~ [ wine20000716 ] ~ [ wine20000326 ] ~ [ wine20000227 ] ~ [ wine20000130 ] ~ [ wine20000109 ] ~

  1 /*
  2  * CMD - Wine-compatible command line interface.
  3  *
  4  * Copyright (C) 1999 D A Pickles
  5  * Copyright (C) 2007 J Edmeades
  6  *
  7  * This library is free software; you can redistribute it and/or
  8  * modify it under the terms of the GNU Lesser General Public
  9  * License as published by the Free Software Foundation; either
 10  * version 2.1 of the License, or (at your option) any later version.
 11  *
 12  * This library is distributed in the hope that it will be useful,
 13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 15  * Lesser General Public License for more details.
 16  *
 17  * You should have received a copy of the GNU Lesser General Public
 18  * License along with this library; if not, write to the Free Software
 19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 20  */
 21 
 22 #define IDI_ICON1       1
 23 #include <windows.h>
 24 #ifndef RC_INVOKED
 25 #include <string.h>
 26 #include <stdlib.h>
 27 #include <stdarg.h>
 28 #include <stdio.h>
 29 #include <ctype.h>
 30 #include <wine/unicode.h>
 31 
 32 /*      Data structure to hold commands to be processed */
 33 
 34 typedef enum _CMDdelimiters {
 35   CMD_NONE,        /* End of line or single & */
 36   CMD_ONFAILURE,   /* ||                      */
 37   CMD_ONSUCCESS,   /* &&                      */
 38   CMD_PIPE         /* Single                  */
 39 } CMD_DELIMITERS;
 40 
 41 typedef struct _CMD_LIST {
 42   WCHAR              *command;     /* Command string to execute                */
 43   WCHAR              *redirects;   /* Redirects in place                       */
 44   struct _CMD_LIST   *nextcommand; /* Next command string to execute           */
 45   CMD_DELIMITERS      prevDelim;   /* Previous delimiter                       */
 46   int                 bracketDepth;/* How deep bracketing have we got to       */
 47   WCHAR               pipeFile[MAX_PATH]; /* Where to get input from for pipes */
 48 } CMD_LIST;
 49 
 50 void WCMD_assoc (WCHAR *, BOOL);
 51 void WCMD_batch (WCHAR *, WCHAR *, int, WCHAR *, HANDLE);
 52 void WCMD_call (WCHAR *command);
 53 void WCMD_change_tty (void);
 54 void WCMD_clear_screen (void);
 55 void WCMD_color (void);
 56 void WCMD_copy (void);
 57 void WCMD_create_dir (void);
 58 BOOL WCMD_delete (WCHAR *, BOOL);
 59 void WCMD_directory (WCHAR *);
 60 void WCMD_echo (const WCHAR *);
 61 void WCMD_endlocal (void);
 62 void WCMD_enter_paged_mode(const WCHAR *);
 63 void WCMD_exit (CMD_LIST **cmdList);
 64 void WCMD_for (WCHAR *, CMD_LIST **cmdList);
 65 void WCMD_give_help (WCHAR *command);
 66 void WCMD_goto (CMD_LIST **cmdList);
 67 void WCMD_if (WCHAR *, CMD_LIST **cmdList);
 68 void WCMD_leave_paged_mode(void);
 69 void WCMD_more (WCHAR *);
 70 void WCMD_move (void);
 71 void WCMD_output (const WCHAR *format, ...);
 72 void WCMD_output_asis (const WCHAR *message);
 73 void WCMD_parse (WCHAR *s, WCHAR *q, WCHAR *p1, WCHAR *p2);
 74 void WCMD_pause (void);
 75 void WCMD_popd (void);
 76 void WCMD_print_error (void);
 77 void WCMD_pushd (WCHAR *);
 78 int  WCMD_read_console (WCHAR *string, int str_len);
 79 void WCMD_remove_dir (WCHAR *command);
 80 void WCMD_rename (void);
 81 void WCMD_run_program (WCHAR *command, int called);
 82 void WCMD_setlocal (const WCHAR *command);
 83 void WCMD_setshow_attrib (void);
 84 void WCMD_setshow_date (void);
 85 void WCMD_setshow_default (WCHAR *command);
 86 void WCMD_setshow_env (WCHAR *command);
 87 void WCMD_setshow_path (WCHAR *command);
 88 void WCMD_setshow_prompt (void);
 89 void WCMD_setshow_time (void);
 90 void WCMD_shift (WCHAR *command);
 91 void WCMD_show_prompt (void);
 92 void WCMD_title (WCHAR *);
 93 void WCMD_type (WCHAR *);
 94 void WCMD_verify (WCHAR *command);
 95 void WCMD_version (void);
 96 int  WCMD_volume (int mode, WCHAR *command);
 97 
 98 WCHAR *WCMD_fgets (WCHAR *s, int n, HANDLE stream);
 99 WCHAR *WCMD_parameter (WCHAR *s, int n, WCHAR **where);
100 WCHAR *WCMD_strtrim_leading_spaces (WCHAR *string);
101 void WCMD_strtrim_trailing_spaces (WCHAR *string);
102 void WCMD_opt_s_strip_quotes(WCHAR *cmd);
103 void WCMD_HandleTildaModifiers(WCHAR **start, WCHAR *forVariable, WCHAR *forValue, BOOL justFors);
104 BOOL WCMD_ask_confirm (WCHAR *message, BOOL showSureText, BOOL *optionAll);
105 
106 void WCMD_splitpath(const WCHAR* path, WCHAR* drv, WCHAR* dir, WCHAR* name, WCHAR* ext);
107 WCHAR *WCMD_LoadMessage(UINT id);
108 WCHAR *WCMD_strdupW(WCHAR *input);
109 BOOL WCMD_ReadFile(const HANDLE hIn, WCHAR *intoBuf, const DWORD maxChars,
110                    LPDWORD charsRead, const LPOVERLAPPED unused);
111 
112 WCHAR    *WCMD_ReadAndParseLine(WCHAR *initialcmd, CMD_LIST **output, HANDLE readFrom);
113 CMD_LIST *WCMD_process_commands(CMD_LIST *thisCmd, BOOL oneBracket, WCHAR *var, WCHAR *val);
114 void      WCMD_free_commands(CMD_LIST *cmds);
115 void      WCMD_execute (WCHAR *orig_command, WCHAR *redirects, WCHAR *parameter,
116                         WCHAR *substitution, CMD_LIST **cmdList);
117 
118 /*      Data structure to hold context when executing batch files */
119 
120 typedef struct {
121   WCHAR *command;       /* The command which invoked the batch file */
122   HANDLE h;             /* Handle to the open batch file */
123   int shift_count[10];  /* Offset in terms of shifts for %0 - %9 */
124   void *prev_context;   /* Pointer to the previous context block */
125   BOOL  skip_rest;      /* Skip the rest of the batch program and exit */
126   CMD_LIST *toExecute;  /* Commands left to be executed */
127 } BATCH_CONTEXT;
128 
129 /* Data structure to save setlocal and pushd information */
130 
131 struct env_stack
132 {
133   struct env_stack *next;
134   union {
135     int    stackdepth;       /* Only used for pushd and popd */
136     WCHAR   cwd;              /* Only used for set/endlocal   */
137   } u;
138   WCHAR *strings;
139 };
140 
141 /* Data structure to handle building lists during recursive calls */
142 
143 typedef struct _DIRECTORY_STACK
144 {
145   struct _DIRECTORY_STACK *next;
146   WCHAR  *dirName;
147   WCHAR  *fileName;
148 } DIRECTORY_STACK;
149 
150 #endif /* !RC_INVOKED */
151 
152 /*
153  *      Serial nos of builtin commands. These constants must be in step with
154  *      the list of strings defined in WCMD.C, and WCMD_EXIT *must* always be
155  *      the last one.
156  *
157  *      Yes it *would* be nice to use an enumeration here, but the Resource
158  *      Compiler won't accept resource IDs from enumerations :-(
159  */
160 
161 #define WCMD_ATTRIB  0
162 #define WCMD_CALL    1
163 #define WCMD_CD      2
164 #define WCMD_CHDIR   3
165 #define WCMD_CLS     4
166 #define WCMD_COPY    5
167 #define WCMD_CTTY    6
168 #define WCMD_DATE    7
169 #define WCMD_DEL     8
170 #define WCMD_DIR     9
171 #define WCMD_ECHO   10
172 #define WCMD_ERASE  11
173 #define WCMD_FOR    12
174 #define WCMD_GOTO   13
175 #define WCMD_HELP   14
176 #define WCMD_IF     15
177 #define WCMD_LABEL  16
178 #define WCMD_MD     17
179 #define WCMD_MKDIR  18
180 #define WCMD_MOVE   19
181 #define WCMD_PATH   20
182 #define WCMD_PAUSE  21
183 #define WCMD_PROMPT 22
184 #define WCMD_REM    23
185 #define WCMD_REN    24
186 #define WCMD_RENAME 25
187 #define WCMD_RD     26
188 #define WCMD_RMDIR  27
189 #define WCMD_SET    28
190 #define WCMD_SHIFT  29
191 #define WCMD_TIME   30
192 #define WCMD_TITLE  31
193 #define WCMD_TYPE   32
194 #define WCMD_VERIFY 33
195 #define WCMD_VER    34
196 #define WCMD_VOL    35
197 
198 #define WCMD_ENDLOCAL 36
199 #define WCMD_SETLOCAL 37
200 #define WCMD_PUSHD  38
201 #define WCMD_POPD   39
202 #define WCMD_ASSOC  40
203 #define WCMD_COLOR  41
204 #define WCMD_FTYPE  42
205 #define WCMD_MORE   43
206 
207 /* Must be last in list */
208 #define WCMD_EXIT   44
209 
210 /* Some standard messages */
211 extern const WCHAR newline[];
212 extern WCHAR anykey[];
213 extern WCHAR version_string[];
214 
215 /* Translated messages */
216 #define WCMD_ALLHELP          1000
217 #define WCMD_CONFIRM          1001
218 #define WCMD_YES              1002
219 #define WCMD_NO               1003
220 #define WCMD_NOASSOC          1004
221 #define WCMD_NOFTYPE          1005
222 #define WCMD_OVERWRITE        1006
223 #define WCMD_MORESTR          1007
224 #define WCMD_TRUNCATEDLINE    1008
225 #define WCMD_NYI              1009
226 #define WCMD_NOARG            1010
227 #define WCMD_SYNTAXERR        1011
228 #define WCMD_FILENOTFOUND     1012
229 #define WCMD_NOCMDHELP        1013
230 #define WCMD_NOTARGET         1014
231 #define WCMD_CURRENTDATE      1015
232 #define WCMD_CURRENTTIME      1016
233 #define WCMD_NEWDATE          1017
234 #define WCMD_NEWTIME          1018
235 #define WCMD_MISSINGENV       1019
236 #define WCMD_READFAIL         1020
237 #define WCMD_CALLINSCRIPT     1021
238 #define WCMD_ALL              1022
239 #define WCMD_DELPROMPT        1023
240 #define WCMD_ECHOPROMPT       1024
241 #define WCMD_VERIFYPROMPT     1025
242 #define WCMD_VERIFYERR        1026
243 #define WCMD_ARGERR           1027
244 #define WCMD_VOLUMEDETAIL     1028
245 #define WCMD_VOLUMEPROMPT     1029
246 #define WCMD_NOPATH           1030
247 #define WCMD_ANYKEY           1031
248 #define WCMD_CONSTITLE        1032
249 #define WCMD_VERSION          1033
250 #define WCMD_MOREPROMPT       1034
251 
252 /* msdn specified max for Win XP */
253 #define MAXSTRING 8192
254 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.