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