2
* Copyright (c) 1997 by Werner Koch (dd9jn)
4
* This file is part of G10.
6
* G10 is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* G10 is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
35
* Check wether FNAME exists and ask if it's okay to overwrite an
37
* Returns: -1 : Do not overwrite
38
* 0 : it's okay to overwrite or the file does not exist
42
overwrite_filep( const char *fname )
44
if( !access( fname, F_OK ) ) {
51
else if( opt.answer_no || opt.batch )
59
tty_printf("File '%s' exists. ", fname);
62
p = tty_get("Overwrite (y/N)? ");
64
if( (*p == 'y' || *p == 'Y') && !p[1] )
66
else if( !*p || ((*p == 'n' || *p == 'N') && !p[1]) )
74
/* fixme: add some backup stuff */