./configure: cleanup '--enable-background' option description
[midnight-commander.git] / src / util.c
blob0056557d180d6dc6c04d6d9d5bac48001a002c8c
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 gboolean
52 check_for_default (const vfs_path_t * default_file_vpath, const vfs_path_t * file_vpath)
54 char *file;
56 file = vfs_path_to_str (file_vpath);
58 if (!exist_file (file))
60 char *default_file;
61 FileOpContext *ctx;
62 FileOpTotalContext *tctx;
64 default_file = vfs_path_to_str (default_file_vpath);
65 if (!exist_file (default_file))
67 g_free (file);
68 g_free (default_file);
69 return FALSE;
72 ctx = file_op_context_new (OP_COPY);
73 tctx = file_op_total_context_new ();
74 file_op_context_create_ui (ctx, 0, FALSE);
75 copy_file_file (tctx, ctx, default_file, file);
76 file_op_total_context_destroy (tctx);
77 file_op_context_destroy (ctx);
78 g_free (default_file);
81 g_free (file);
83 return TRUE;
86 /* --------------------------------------------------------------------------------------------- */