File: Allow-dumping-URLs-to-stdout.patch

package info (click to toggle)
urlview 0.9-23.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 476 kB
  • sloc: ansic: 4,132; sh: 514; makefile: 18
file content (34 lines) | stat: -rw-r--r-- 1,076 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From: Emanuele Rocca <ema@debian.org>
Date: Sat, 20 Aug 2022 22:31:58 +0200
Subject: Allow dumping URLs to stdout by setting URLVIEW_DEBUG
---
diff --git a/urlview.c b/urlview.c
index b0861bd..98ba958 100644
--- a/urlview.c
+++ b/urlview.c
@@ -416,6 +416,11 @@ into a line of its own in your \n\
     current = urlcount - 1;
   
   /*** present the URLs to the user ***/
+  if (getenv("URLVIEW_DEBUG")) {
+    for (i = 0; i < urlcount; i++)
+      printf ("%s\n", url[i]);
+    exit(0);
+  }
 
 #ifdef USE_SLANG
   if (reopen_tty) {
diff --git a/urlview.man b/urlview.man
index c41230b..23bc8f9 100644
--- a/urlview.man
+++ b/urlview.man
@@ -93,6 +93,9 @@ command, the url is appended to the command.
 The BROWSER environment variable is honored only if the rc-file doesn't
 contain the COMMAND option.
 The rc-file provided by the Debian package contains a COMMAND option.
+.PP
+If the environment variable URLVIEW_DEBUG is set, then all extracted URLs will
+be printed to standard output instead of being displayed using the ncurses TUI.
 .SH SEE ALSO
 .PP
 .BR printf (3),