Sweden-Number/programs/cmd/wcmd.h

198 lines
5.7 KiB
C
Raw Normal View History

1999-06-06 17:24:04 +02:00
/*
2006-09-04 06:13:08 +02:00
* CMD - Wine-compatible command line interface.
1999-06-06 17:24:04 +02: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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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>
2007-03-13 01:06:58 +01:00
void WCMD_assoc (char *, BOOL);
void WCMD_batch (char *, char *, int, char *, HANDLE);
void WCMD_call (char *command);
1999-06-06 17:24:04 +02:00
void WCMD_change_tty (void);
void WCMD_clear_screen (void);
2007-03-08 01:37:44 +01:00
void WCMD_color (void);
1999-06-06 17:24:04 +02:00
void WCMD_copy (void);
void WCMD_create_dir (void);
2007-04-24 00:24:38 +02:00
BOOL WCMD_delete (char *, BOOL);
void WCMD_directory (char *);
void WCMD_echo (const char *);
2004-03-22 23:56:58 +01:00
void WCMD_endlocal (void);
void WCMD_enter_paged_mode(const char *);
2007-02-20 18:49:08 +01:00
void WCMD_exit (void);
void WCMD_for (char *);
1999-06-06 17:24:04 +02:00
void WCMD_give_help (char *command);
void WCMD_goto (void);
void WCMD_if (char *);
void WCMD_leave_paged_mode(void);
void WCMD_more (char *);
1999-06-06 17:24:04 +02:00
void WCMD_move (void);
void WCMD_output (const char *format, ...);
void WCMD_output_asis (const 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);
void WCMD_pipe (char *command);
2007-02-23 23:17:28 +01:00
void WCMD_popd (void);
1999-06-06 17:24:04 +02:00
void WCMD_print_error (void);
void WCMD_process_command (char *command);
2007-03-08 01:44:09 +01:00
void WCMD_pushd (char *);
int WCMD_read_console (char *string, int str_len);
2007-03-04 23:33:27 +01:00
void WCMD_remove_dir (char *command);
1999-06-06 17:24:04 +02:00
void WCMD_rename (void);
void WCMD_run_program (char *command, int called);
2004-03-22 23:56:58 +01:00
void WCMD_setlocal (const char *command);
1999-06-06 17:24:04 +02:00
void WCMD_setshow_attrib (void);
void WCMD_setshow_date (void);
void WCMD_setshow_default (char *command);
1999-06-06 17:24:04 +02:00
void WCMD_setshow_env (char *command);
void WCMD_setshow_path (char *command);
1999-06-06 17:24:04 +02:00
void WCMD_setshow_prompt (void);
void WCMD_setshow_time (void);
2007-03-08 01:50:37 +01:00
void WCMD_shift (char *command);
1999-06-06 17:24:04 +02:00
void WCMD_show_prompt (void);
2002-05-04 20:29:31 +02:00
void WCMD_title (char *);
void WCMD_type (char *);
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);
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);
void WCMD_opt_s_strip_quotes(char *cmd);
2007-02-23 23:21:27 +01:00
void WCMD_HandleTildaModifiers(char **start, char *forVariable);
2007-02-28 00:20:05 +01:00
BOOL WCMD_ask_confirm (char *message, BOOL showSureText);
2007-02-23 23:21:27 +01:00
void WCMD_splitpath(const CHAR* path, CHAR* drv, CHAR* dir, CHAR* name, CHAR* ext);
/* 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 */
2007-03-08 01:50:37 +01:00
int shift_count[10]; /* Offset in terms of shifts for %0 - %9 */
void *prev_context; /* Pointer to the previous context block */
2007-02-20 18:49:08 +01:00
BOOL skip_rest; /* Skip the rest of the batch program and exit */
} BATCH_CONTEXT;
/* Data structure to save setlocal and pushd information */
struct env_stack
{
struct env_stack *next;
union {
int stackdepth; /* Only used for pushd and popd */
char cwd; /* Only used for set/endlocal */
} u;
WCHAR *strings;
};
2007-04-24 00:24:38 +02:00
/* Data structure to handle building lists during recursive calls */
typedef struct _DIRECTORY_STACK
{
struct _DIRECTORY_STACK *next;
char *dirName;
char *fileName;
} DIRECTORY_STACK;
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
2004-03-22 23:56:58 +01:00
#define WCMD_ENDLOCAL 36
#define WCMD_SETLOCAL 37
2007-02-23 23:17:28 +01:00
#define WCMD_PUSHD 38
#define WCMD_POPD 39
2007-03-04 23:34:45 +01:00
#define WCMD_ASSOC 40
2007-03-08 01:37:44 +01:00
#define WCMD_COLOR 41
2007-03-13 01:06:58 +01:00
#define WCMD_FTYPE 42
#define WCMD_MORE 43
2004-03-22 23:56:58 +01:00
2002-05-04 20:29:31 +02:00
/* Must be last in list */
#define WCMD_EXIT 44
/* Some standard messages */
extern const char nyi[];
extern const char newline[];
extern const char version_string[];
extern const char anykey[];
2007-02-23 23:21:27 +01:00
2007-02-28 00:18:57 +01:00
/* Translated messages */
#define WCMD_CONFIRM 1001
#define WCMD_YES 1002
#define WCMD_NO 1003
2007-03-04 23:34:45 +01:00
#define WCMD_NOASSOC 1004
2007-03-13 01:06:58 +01:00
#define WCMD_NOFTYPE 1005
#define WCMD_OVERWRITE 1006
#define WCMD_MORESTR 1007
2007-02-28 00:18:57 +01:00
2007-02-23 23:21:27 +01:00
/* msdn specified max for Win XP */
#define MAXSTRING 8192