2 Util for external clipboard.
4 Copyright (C) 2009 The Free Software Foundation, Inc.
7 Ilia Maslakon <il.smind@gmail.com>, 2010.
9 This file is part of the Midnight Commander.
11 The Midnight Commander is free software; you can redistribute it
12 and/or modify it under the terms of the GNU General Public License as
13 published by the Free Software Foundation; either version 2 of the
14 License, or (at your option) any later version.
16 The Midnight Commander is distributed in the hope that it will be
17 useful, but WITHOUT ANY WARRANTY; without even the implied warranty
18 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
32 #include "lib/global.h"
33 #include "lib/fileloc.h"
36 #include "src/execute.h"
38 #include "clipboard.h"
41 copy_file_to_ext_clip (void)
45 const char *d
= getenv ("DISPLAY");
47 if (d
== NULL
|| clipboard_store_path
== NULL
|| clipboard_store_path
[0] =='\0')
50 tmp
= concat_dir_and_file (home_dir
, EDIT_CLIP_FILE
);
51 cmd
= g_strconcat (clipboard_store_path
, " ", tmp
, " 2>/dev/null", (char *) NULL
);
54 res
= my_system (EXECUTE_AS_SHELL
, shell
, cmd
);
62 paste_to_file_from_ext_clip (void)
66 const char *d
= getenv ("DISPLAY");
68 if (d
== NULL
|| clipboard_paste_path
== NULL
|| clipboard_paste_path
[0] == '\0')
71 tmp
= concat_dir_and_file (home_dir
, EDIT_CLIP_FILE
);
72 cmd
= g_strconcat (clipboard_paste_path
, " > ", tmp
, " 2>/dev/null", (char *) NULL
);
75 res
= my_system (EXECUTE_AS_SHELL
, shell
, cmd
);