home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
CMDS
/
mtools_3.6.src.lzh
/
MTOOLS_3.6
/
mcd.c
< prev
next >
Wrap
Text File
|
1997-11-12
|
831b
|
45 lines
/*
* mcd.c: Change MSDOS directories
*/
#include "sysincludes.h"
#include "msdos.h"
#include "mainloop.h"
#include "mtools.h"
void mcd(int argc, char **argv, int type)
{
Stream_t *Dir;
FILE *fp;
char pathname[MAX_PATH];
struct MainParam_t mp;
if (argc > 2) {
fprintf(stderr, "Mtools version %s, dated %s\n", mversion, mdate);
fprintf(stderr, "Usage: %s: [-V] msdosdirectory\n", argv[0]);
exit(1);
}
init_mp(&mp);
if (argc == 1) {
printf("%s\n", mp.mcwd);
exit(0);
}
mp.pathname = pathname;
Dir = open_subdir(&mp, argv[1], O_RDONLY, 1, 0);
if(!Dir){
fprintf(stderr,"No such directory\n");
exit(1);
}
FREE(&Dir);
if (!(fp = open_mcwd("w"))){
fprintf(stderr,"%s: Can't open mcwd file for write\n",argv[0]);
exit(1);
}
fprintf(fp, "%c:%s\n", mp.drivename, pathname);
fclose(fp);
exit(0);
}