Changed interface of functions mc_getlocalcopy() and mc_ungetlocalcopy()
[midnight-commander.git] / src / util.c
blob928b967bb27a748087353a5ced898d897ba1e3cb
1 /*
2 Various non-library utilities
4 Copyright (C) 2003, 2004, 2005, 2006, 2007, 2011
5 The Free Software Foundation, Inc.
7 Written by:
8 Adam Byrtek, 2003
10 This file is part of the Midnight Commander.
12 The Midnight Commander is free software: you can redistribute it
13 and/or modify it under the terms of the GNU General Public License as
14 published by the Free Software Foundation, either version 3 of the License,
15 or (at your option) any later version.
17 The Midnight Commander is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program. If not, see <http://www.gnu.org/licenses/>.
26 #include <config.h>
28 #include "lib/global.h"
29 #include "lib/util.h"
31 #include "src/filemanager/file.h"
32 #include "src/filemanager/filegui.h"
34 #include "util.h"
36 /*** global variables ****************************************************************************/
38 /*** file scope macro definitions ****************************************************************/
40 /*** file scope type declarations ****************************************************************/
42 /*** file scope variables ************************************************************************/
44 /*** file scope functions ************************************************************************/
45 /* --------------------------------------------------------------------------------------------- */
47 /* --------------------------------------------------------------------------------------------- */
48 /*** public functions ****************************************************************************/
49 /* --------------------------------------------------------------------------------------------- */
51 int
52 check_for_default (const char *default_file, const char *file)
54 if (!exist_file (file))
56 FileOpContext *ctx;
57 FileOpTotalContext *tctx;
59 if (!exist_file (default_file))
60 return -1;
62 ctx = file_op_context_new (OP_COPY);
63 tctx = file_op_total_context_new ();
64 file_op_context_create_ui (ctx, 0, FALSE);
65 copy_file_file (tctx, ctx, default_file, file);
66 file_op_total_context_destroy (tctx);
67 file_op_context_destroy (ctx);
70 return 0;
73 /* --------------------------------------------------------------------------------------------- */