summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hofmann <scm@uninformativ.de>2014-06-14 13:20:19 +0200
committerPeter Hofmann <scm@uninformativ.de>2014-06-14 13:20:19 +0200
commit6be63840495d8921b58b90248594d06ca74ff578 (patch)
tree07afa905188a43e163b8d5b5ab34618c67378d35
parent61013e58b980b940e0434250318faa6ed084892b (diff)
downloadlariza-6be63840495d8921b58b90248594d06ca74ff578.tar.gz
Embed the xterm for wget as well
-rw-r--r--sn.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/sn.c b/sn.c
index 86288c6..5f5ca45 100644
--- a/sn.c
+++ b/sn.c
@@ -57,6 +57,8 @@ gboolean
sn_do_download(WebKitWebView *web_view, WebKitDownload *download, gpointer data)
{
const gchar *uri;
+ char id[16] = "";
+ int ret;
(void)web_view;
(void)data;
@@ -65,7 +67,20 @@ sn_do_download(WebKitWebView *web_view, WebKitDownload *download, gpointer data)
if (fork() == 0)
{
chdir(DOWNLOAD_DIR);
- if (execlp("xterm", "xterm", "-hold", "-e", "wget", uri, NULL) == -1)
+ if (embed == 0)
+ ret = execlp("xterm", "xterm", "-hold", "-e", "wget", uri, NULL);
+ else
+ {
+ if (snprintf(id, 16, "%ld", embed) >= 16)
+ {
+ fprintf(stderr, "sn: id for xterm embed truncated!\n");
+ exit(EXIT_FAILURE);
+ }
+ ret = execlp("xterm", "xterm", "-hold", "-into", id, "-e", "wget",
+ uri, NULL);
+ }
+
+ if (ret == -1)
{
fprintf(stderr, "sn: exec'ing xterm for download");
perror(" failed");