int expand(char* name, int flag)
{
char* s;
- WIN32_FIND_DATA fd;
+ WIN32_FIND_DATAA fd;
HANDLE hFile;
BOOLEAN first = TRUE;
char buffer[256];
s = strpbrk(name, "*?");
if (s && flag) {
- hFile = FindFirstFile(name, &fd);
+ hFile = FindFirstFileA(name, &fd);
if (hFile != INVALID_HANDLE_VALUE) {
while(s != name && *s != '/' && *s != '\\')
s--;
first = FALSE;
}
}
- while(FindNextFile(hFile, &fd));
+ while(FindNextFileA(hFile, &fd));
FindClose(hFile);
}
}
return 0;
}
+/*
+ * @unimplemented
+ */
int __getmainargs(int* argc, char*** argv, char*** env, int flag)
{
- int i, afterlastspace;
+ int i, afterlastspace, ignorespace, len;
/* missing threading init */
i = 0;
afterlastspace = 0;
+ ignorespace = 0;
+ len = strlen(_acmdln);
while (_acmdln[i]) {
- if (_acmdln[i] == ' ') {
+ if (_acmdln[i] == '"') {
+ if (_acmdln[i + 1] == '"') {
+ memmove(_acmdln + i, _acmdln + i + 1, len - i);
+ len--;
+ } else {
+ if(ignorespace) {
+ ignorespace = 0;
+ } else {
+ ignorespace = 1;
+ }
+ memmove(_acmdln + i, _acmdln + i + 1, len - i);
+ len--;
+ continue;
+ }
+ }
+
+ if (_acmdln[i] == ' ' && !ignorespace) {
expand(strndup(_acmdln + afterlastspace, i - afterlastspace), flag);
i++;
while (_acmdln[i]==' ')
return 0;
}
+/*
+ * @implemented
+ */
int* __p___argc(void)
{
return &__argc;
}
+/*
+ * @implemented
+ */
char*** __p___argv(void)
{
return &__argv;