#include <stdlib.h>
#include <ctype.h>
#include <string.h>

int _argc;
char **_argv_arr;
char *_cmdline;

#pragma startup argset 19

static void argset(void)
{
	char buf[200];
	char *bufp[100];
	int inquote = 0;
	_argc = 1;
	bufp[0] = "LADsoft";
	while (*_cmdline) {
		while (isspace(*_cmdline)) _cmdline++;
		if (*_cmdline) {
			int i = 0;
			while ((inquote || !isspace(*_cmdline)) && *_cmdline)  {
				if (*_cmdline == '"') {
					inquote = !inquote ;
					_cmdline++ ;
					continue ;
				}
				buf[i++] = *_cmdline++;
			}
			buf[i++] = 0;
			bufp[_argc] = strdup(buf);
		}
	}
  /* This appends a null pointer to the end of the list */
	_argv_arr = calloc(_argc +1,sizeof(char *));
	memcpy(_argv_arr,bufp,_argc*sizeof(char *));
}