cmd: Add @drive@ keyword, replaced by drive letter.

This commit is contained in:
Frédéric Delanoy 2011-08-26 01:19:25 +02:00 committed by Alexandre Julliard
parent 8129b1847a
commit 1e89625b11
1 changed files with 17 additions and 0 deletions

View File

@ -24,6 +24,8 @@
static char workdir[MAX_PATH];
static DWORD workdir_len;
static char drive[2];
static const DWORD drive_len = sizeof(drive)/sizeof(drive[0]);
/* Convert to DOS line endings, and substitute escaped whitespace chars with real ones */
static const char* convert_input_data(const char *data, DWORD size, DWORD *new_size)
@ -154,6 +156,7 @@ static const char *compare_line(const char *out_line, const char *out_end, const
const char *err = NULL;
static const char pwd_cmd[] = {'@','p','w','d','@'};
static const char drive_cmd[] = {'@','d','r','i','v','e','@'};
static const char space_cmd[] = {'@','s','p','a','c','e','@'};
static const char tab_cmd[] = {'@','t','a','b','@'};
static const char or_broken_cmd[] = {'@','o','r','_','b','r','o','k','e','n','@'};
@ -171,6 +174,18 @@ static const char *compare_line(const char *out_line, const char *out_end, const
out_ptr += workdir_len;
continue;
}
} else if(exp_ptr+sizeof(drive_cmd) <= exp_end
&& !memcmp(exp_ptr, drive_cmd, sizeof(drive_cmd))) {
exp_ptr += sizeof(drive_cmd);
if(out_end-out_ptr < drive_len
|| (CompareStringA(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE,
out_ptr, drive_len,
drive, drive_len) != CSTR_EQUAL)) {
err = out_ptr;
}else {
out_ptr += drive_len;
continue;
}
}else if(exp_ptr+sizeof(space_cmd) <= exp_end
&& !memcmp(exp_ptr, space_cmd, sizeof(space_cmd))) {
exp_ptr += sizeof(space_cmd);
@ -391,6 +406,8 @@ START_TEST(batch)
}
workdir_len = GetCurrentDirectoryA(sizeof(workdir), workdir);
drive[0] = workdir[0];
drive[1] = workdir[1]; /* Should be ':' */
argc = winetest_get_mainargs(&argv);
if(argc > 2)