#include <stdio.h>
#include <io.h>
#include <dir.h>

char * dirlist[] = {
		"bin",
		"usr",
		"usr\\include",
		"usr\\include\\sys",
		"usr\\include\\towns",
		"usr\\lib",
		"tmp",
		"binuty",
		"gas",
		"libc",
		"xm" ,
		"math",
		"math\\int",
		"math\\emu"  
		 };

char *topdir = "GNU";

char * cmdlist[] = {
		"", "cd  %c:gcc&",
		"", "lharc x -r %c:bins",
		"", "lharc x -r %c:bine",
		"", "lharc x -r %c:usr",
		"", "copy  %c:makeru*.*",
		"", "lharc x -r %c:src\\binuty",
		"", "lharc x -r %c:src\\gas",
		"", "rem if you don't want source code, delete the latter",
		"", "lharc x -r %c:lib\\libc",
		"math", "lharc x -r %c:lib\\math",
		"..", "cd  %c:\\xm",
		"xm", "lharc x -r %c:xm",
		"\\", "cd %c:\\"
		};


main(int argc, char **argv)
{
	char *s, drv[4],frm[4],b[128];
	int  i,j;

	drv[1] = 0;
	if (argc > 1) {
		s = argv[1];
		if ('C' <= toupper(*s) && toupper(*s) <= 'Q') {
				drv[0] = s[0];
				}
		else  drv[0] = 'C';
		}
	else  drv[0] = 'C';

	frm[0] = getdisk() + 'A'; frm[1] = 0;


	printf("%c:\n",drv[0]);
	printf("mkdir \\%s \n",topdir);
	printf("cd \\%s\n",topdir);

	for (i=0; i < sizeof(dirlist)/sizeof(dirlist[0]); i++) {
		sprintf(b, "%s",dirlist[i]);
		printf("mkdir %s\n",b);
		}
	
	for (i=0; i < sizeof(cmdlist)/sizeof(cmdlist[0]); i+=2) {
		if (strlen(cmdlist[i]) > 0) {
		  sprintf(b, "%s", cmdlist[i]);
		  printf("cd %s \n",b);
		  }
		sprintf(b, cmdlist[i+1], frm[0]);
		printf("%s \n",b);
		}
}