C is a bit tough because there is no standard cross-platform way to handle directories.
You will want to write functions
int isDir(char *path); // returns 1 if path is a directory
char **vmFiles(char *path); // returns malloc()ed array of malloc()ed strings, array ends with NULL
These links will give you help writing those functions.
Windows
Test if path is a directory
https://msdn.microsoft.com/en-us/library/windows/desktop/bb773621(v=vs.85).aspx
Listing files in a directory
https://msdn.microsoft.com/en-us/library/windows/desktop/aa365200(v=vs.85).aspxLinux/Mac
Test if path is a directory
https://stackoverflow.com/questions/3828192/checking-if-a-directory-exists-in-unix-system-call
Listing files in a directory
https://stackoverflow.com/questions/4204666/how-to-list-files-in-a-directory-in-a-c-programYour main() will do something like
if (!isDir(argv[1])) {
outName = changeExtension(argv[1], ".asm");
outFile = fopen(...
translate(argv[1], outFile);
fclose(outFile);
} else {
(write C code for these)
(outName = last component of argv[1] )
(outName = argv[1] + '/' + outName // '/' works on windows an unix
vmName = vmFiles(argv[1]);
outFile = fopen(...
writeBootstrap(outFile);
while (**vmNames) {
( vmName = argv[1] + '/' + *vmNames )
translate(vmName, outFile);
free(*vmNames); // prevent memory leak
++vmNames;
}
free(vmNames); // prevent memory leak
fclose(outFile);
--Mark