1999-06-06 17:24:04 +02:00
|
|
|
/*
|
2002-06-01 01:06:46 +02:00
|
|
|
* WCMD - Wine-compatible command line interface.
|
1999-06-06 17:24:04 +02:00
|
|
|
*
|
2002-03-10 00:29:33 +01:00
|
|
|
* Copyright (C) 1999 D A Pickles
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
1999-06-06 17:24:04 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define IDI_ICON1 1
|
|
|
|
#include <windows.h>
|
|
|
|
#ifndef RC_INVOKED
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
|
|
|
|
#ifdef WINELIB
|
|
|
|
#include <winbase.h>
|
|
|
|
#include <wincon.h>
|
|
|
|
#endif /* !WINELIB */
|
|
|
|
|
1999-06-26 12:24:08 +02:00
|
|
|
void WCMD_batch (char *, char *, int);
|
1999-06-06 17:24:04 +02:00
|
|
|
void WCMD_change_tty (void);
|
|
|
|
void WCMD_clear_screen (void);
|
|
|
|
void WCMD_copy (void);
|
|
|
|
void WCMD_create_dir (void);
|
|
|
|
void WCMD_delete (int recurse);
|
|
|
|
void WCMD_directory (void);
|
|
|
|
void WCMD_echo (char *);
|
2003-02-25 04:58:42 +01:00
|
|
|
void WCMD_enter_paged_mode(void);
|
1999-06-26 12:24:08 +02:00
|
|
|
void WCMD_for (char *);
|
1999-06-06 17:24:04 +02:00
|
|
|
void WCMD_give_help (char *command);
|
1999-06-26 12:24:08 +02:00
|
|
|
void WCMD_goto (void);
|
1999-07-10 13:36:45 +02:00
|
|
|
void WCMD_if (char *);
|
2003-02-25 04:58:42 +01:00
|
|
|
void WCMD_leave_paged_mode(void);
|
1999-06-06 17:24:04 +02:00
|
|
|
void WCMD_move (void);
|
|
|
|
void WCMD_output (char *format, ...);
|
2002-06-01 01:06:46 +02:00
|
|
|
void WCMD_output_asis (char *message);
|
1999-06-06 17:24:04 +02:00
|
|
|
void WCMD_parse (char *s, char *q, char *p1, char *p2);
|
|
|
|
void WCMD_pause (void);
|
2001-06-04 04:55:38 +02:00
|
|
|
void WCMD_pipe (char *command);
|
1999-06-06 17:24:04 +02:00
|
|
|
void WCMD_print_error (void);
|
|
|
|
void WCMD_process_command (char *command);
|
2003-02-25 04:58:42 +01:00
|
|
|
int WCMD_read_console (char *string, int str_len);
|
1999-06-06 17:24:04 +02:00
|
|
|
void WCMD_remove_dir (void);
|
|
|
|
void WCMD_rename (void);
|
|
|
|
void WCMD_run_program (char *command);
|
|
|
|
void WCMD_setshow_attrib (void);
|
|
|
|
void WCMD_setshow_date (void);
|
|
|
|
void WCMD_setshow_default (void);
|
|
|
|
void WCMD_setshow_env (char *command);
|
2003-02-11 23:01:11 +01:00
|
|
|
void WCMD_setshow_path (char *command);
|
1999-06-06 17:24:04 +02:00
|
|
|
void WCMD_setshow_prompt (void);
|
|
|
|
void WCMD_setshow_time (void);
|
|
|
|
void WCMD_shift (void);
|
|
|
|
void WCMD_show_prompt (void);
|
2002-05-04 20:29:31 +02:00
|
|
|
void WCMD_title (char *);
|
1999-06-06 17:24:04 +02:00
|
|
|
void WCMD_type (void);
|
1999-06-26 12:24:08 +02:00
|
|
|
void WCMD_verify (char *command);
|
1999-06-06 17:24:04 +02:00
|
|
|
void WCMD_version (void);
|
|
|
|
int WCMD_volume (int mode, char *command);
|
|
|
|
|
|
|
|
char *WCMD_fgets (char *s, int n, HANDLE stream);
|
1999-07-10 13:36:45 +02:00
|
|
|
char *WCMD_parameter (char *s, int n, char **where);
|
1999-06-06 17:24:04 +02:00
|
|
|
char *WCMD_strtrim_leading_spaces (char *string);
|
|
|
|
void WCMD_strtrim_trailing_spaces (char *string);
|
1999-06-26 12:24:08 +02:00
|
|
|
|
|
|
|
/* Data structure to hold context when executing batch files */
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
char *command; /* The command which invoked the batch file */
|
|
|
|
HANDLE h; /* Handle to the open batch file */
|
|
|
|
int shift_count; /* Number of SHIFT commands executed */
|
|
|
|
void *prev_context; /* Pointer to the previous context block */
|
|
|
|
} BATCH_CONTEXT;
|
|
|
|
|
1999-06-06 17:24:04 +02:00
|
|
|
#endif /* !RC_INVOKED */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Serial nos of builtin commands. These constants must be in step with
|
|
|
|
* the list of strings defined in WCMD.C, and WCMD_EXIT *must* always be
|
|
|
|
* the last one.
|
|
|
|
*
|
|
|
|
* Yes it *would* be nice to use an enumeration here, but the Resource
|
|
|
|
* Compiler won't accept resource IDs from enumerations :-(
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define WCMD_ATTRIB 0
|
|
|
|
#define WCMD_CALL 1
|
|
|
|
#define WCMD_CD 2
|
|
|
|
#define WCMD_CHDIR 3
|
|
|
|
#define WCMD_CLS 4
|
|
|
|
#define WCMD_COPY 5
|
|
|
|
#define WCMD_CTTY 6
|
|
|
|
#define WCMD_DATE 7
|
|
|
|
#define WCMD_DEL 8
|
|
|
|
#define WCMD_DIR 9
|
|
|
|
#define WCMD_ECHO 10
|
|
|
|
#define WCMD_ERASE 11
|
|
|
|
#define WCMD_FOR 12
|
|
|
|
#define WCMD_GOTO 13
|
|
|
|
#define WCMD_HELP 14
|
|
|
|
#define WCMD_IF 15
|
|
|
|
#define WCMD_LABEL 16
|
|
|
|
#define WCMD_MD 17
|
|
|
|
#define WCMD_MKDIR 18
|
|
|
|
#define WCMD_MOVE 19
|
|
|
|
#define WCMD_PATH 20
|
|
|
|
#define WCMD_PAUSE 21
|
|
|
|
#define WCMD_PROMPT 22
|
|
|
|
#define WCMD_REM 23
|
|
|
|
#define WCMD_REN 24
|
|
|
|
#define WCMD_RENAME 25
|
|
|
|
#define WCMD_RD 26
|
|
|
|
#define WCMD_RMDIR 27
|
|
|
|
#define WCMD_SET 28
|
|
|
|
#define WCMD_SHIFT 29
|
|
|
|
#define WCMD_TIME 30
|
2002-05-04 20:29:31 +02:00
|
|
|
#define WCMD_TITLE 31
|
|
|
|
#define WCMD_TYPE 32
|
|
|
|
#define WCMD_VERIFY 33
|
|
|
|
#define WCMD_VER 34
|
|
|
|
#define WCMD_VOL 35
|
|
|
|
|
|
|
|
/* Must be last in list */
|
|
|
|
#define WCMD_EXIT 36
|