source: trunk/minix/commands/i386/mtools-3.9.7/mcd.c@ 10

Last change on this file since 10 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 836 bytes
Line 
1/*
2 * mcd.c: Change MSDOS directories
3 */
4
5#include "sysincludes.h"
6#include "msdos.h"
7#include "mainloop.h"
8#include "mtools.h"
9
10
11static int mcd_callback(direntry_t *entry, MainParam_t *mp)
12{
13 FILE *fp;
14
15 if (!(fp = open_mcwd("w"))){
16 fprintf(stderr,"mcd: Can't open mcwd .file for writing\n");
17 return ERROR_ONE;
18 }
19
20 fprintPwd(fp, entry,0);
21 fprintf(fp, "\n");
22 fclose(fp);
23 return GOT_ONE | STOP_NOW;
24}
25
26
27void mcd(int argc, char **argv, int type)
28{
29 struct MainParam_t mp;
30
31 if (argc > 2) {
32 fprintf(stderr, "Mtools version %s, dated %s\n",
33 mversion, mdate);
34 fprintf(stderr, "Usage: %s: msdosdirectory\n", argv[0]);
35 exit(1);
36 }
37
38 init_mp(&mp);
39 mp.lookupflags = ACCEPT_DIR | NO_DOTS;
40 mp.dirCallback = mcd_callback;
41 if (argc == 1) {
42 printf("%s\n", mp.mcwd);
43 exit(0);
44 } else
45 exit(main_loop(&mp, argv + 1, 1));
46}
Note: See TracBrowser for help on using the repository browser.