1 /* Copyright 1986-1992 Emmet P. Gray.
2 * Copyright 1996,1997,2000-2002,2009 Alain Knaff.
3 * This file is part of mtools.
5 * Mtools is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * Mtools is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with Mtools. If not, see <http://www.gnu.org/licenses/>.
18 * mcd.c: Change MSDOS directories
21 #include "sysincludes.h"
27 static int mcd_callback(direntry_t *entry, MainParam_t *mp)
31 if (!(fp = open_mcwd("w"))){
32 fprintf(stderr,"mcd: Can't open mcwd .file for writing\n");
36 fprintPwd(fp, entry,0);
39 return GOT_ONE | STOP_NOW;
43 void mcd(int argc, char **argv, int type)
45 struct MainParam_t mp;
48 fprintf(stderr, "Mtools version %s, dated %s\n",
50 fprintf(stderr, "Usage: %s: [-V] msdosdirectory\n", argv[0]);
55 mp.lookupflags = ACCEPT_DIR | NO_DOTS;
56 mp.dirCallback = mcd_callback;
58 printf("%s\n", mp.mcwd);
61 exit(main_loop(&mp, argv + 1, 1));