1#ifndef MTOOLS_NAMECLASH_H 2#define MTOOLS_NAMECLASH_H 3 4/* Copyright 1996-1998,2000-2002,2008,2009 Alain Knaff. 5 * This file is part of mtools. 6 * 7 * Mtools is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * Mtools is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with Mtools. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 21#include "stream.h" 22 23typedef enum clash_action { 24 NAMEMATCH_NONE, 25 NAMEMATCH_AUTORENAME, 26 NAMEMATCH_QUIT, 27 NAMEMATCH_SKIP, 28 NAMEMATCH_RENAME, 29 NAMEMATCH_PRENAME, /* renaming of primary name */ 30 NAMEMATCH_OVERWRITE, 31 NAMEMATCH_ERROR, 32 NAMEMATCH_SUCCESS, 33 NAMEMATCH_GREW 34} clash_action; 35 36/* clash handling structure */ 37typedef struct ClashHandling_t { 38 clash_action action[2]; 39 clash_action namematch_default[2]; 40 41 int nowarn; /* Don't ask, just do default action if name collision*/ 42 int got_slots; 43 int mod_time; 44 /* unsigned int dot; */ 45 char *myname; 46 unsigned char *dosname; 47 int single; 48 49 int use_longname; 50 int ignore_entry; 51 int source; /* to prevent the source from overwriting itself */ 52 int source_entry; /* to account for the space freed up by the original 53 * name */ 54 void (*name_converter)(doscp_t *cp, 55 const char *filename, int verbose, 56 int *mangled, dos_name_t *ans); 57} ClashHandling_t; 58 59/* write callback */ 60typedef int (write_data_callback)(dos_name_t *,char *, void *, struct direntry_t *); 61 62int mwrite_one(Stream_t *Dir, 63 const char *argname, 64 const char *shortname, 65 write_data_callback *cb, 66 void *arg, 67 ClashHandling_t *ch); 68 69int handle_clash_options(ClashHandling_t *ch, char c); 70void init_clash_handling(ClashHandling_t *ch); 71Stream_t *createDir(Stream_t *Dir, const char *filename, ClashHandling_t *ch, 72 unsigned char attr, time_t mtime); 73 74 75#endif 76