1 /* Copyright 1997,2000-2002,2009 Alain Knaff.
2 * This file is part of mtools.
4 * Mtools is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Mtools is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Mtools. If not, see <http://www.gnu.org/licenses/>.
18 * Copy an MSDOS files to and from Unix
25 #include "sysincludes.h"
31 #include "nameclash.h"
37 typedef struct Arg_t {
44 static int dos_showfat(direntry_t *entry, MainParam_t *mp)
46 Stream_t *File=mp->File;
48 fprintPwd(stdout, entry,0);
55 static int unix_showfat(MainParam_t *mp)
57 fprintf(stderr,"File does not reside on a Dos fs\n");
62 static void usage(int ret) NORETURN;
63 static void usage(int ret)
66 "Mtools version %s, dated %s\n", mversion, mdate);
68 "Usage: %s files\n", progname);
72 void mshowfat(int argc, char **argv, int mtype)
77 /* get command line options */
79 init_clash_handling(& arg.ch);
81 /* get command line options */
82 if(helpFlag(argc, argv))
84 while ((c = getopt(argc, argv, "i:h")) != EOF) {
87 set_cmd_line_image(optarg, 0);
97 if (argc - optind < 1)
100 /* only 1 file to copy... */
102 arg.mp.arg = (void *) &arg;
104 arg.mp.callback = dos_showfat;
105 arg.mp.unixcallback = unix_showfat;
107 arg.mp.lookupflags = ACCEPT_PLAIN | ACCEPT_DIR | DO_OPEN;
108 ret=main_loop(&arg.mp, argv + optind, argc - optind);