about summary refs log tree commit diff stats
path: root/src/LYReadCFG.c
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2008-02-11 01:05:04 -0500
committerThomas E. Dickey <dickey@invisible-island.net>2008-02-11 01:05:04 -0500
commita054e1c90b5f1e36eb889a118393c8ec79e57d02 (patch)
treed0958fb5aa99b70ba9a082c98280a5cec17a565e /src/LYReadCFG.c
parentacdfec8f90ac4aa21cfc20b6b7ad3ecb7e56ea90 (diff)
downloadlynx-snapshots-a054e1c90b5f1e36eb889a118393c8ec79e57d02.tar.gz
snapshot of project "lynx", label v2-8-7dev_7d
Diffstat (limited to 'src/LYReadCFG.c')
-rw-r--r--src/LYReadCFG.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c
index f489d88f..af3358db 100644
--- a/src/LYReadCFG.c
+++ b/src/LYReadCFG.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYReadCFG.c,v 1.126 2008/02/10 22:05:02 tom Exp $ */
+/* $LynxId: LYReadCFG.c,v 1.127 2008/02/11 00:54:34 Paul.B.Mahol Exp $ */
 #ifndef NO_RULES
 #include <HTRules.h>
 #else
@@ -111,16 +111,42 @@ static void free_all_item_lists(void)
 }
 
 /*
- * Process string buffer fields for DOWNLOADER or UPLOADER menus.
+ * Process string buffer fields for DOWNLOADER or UPLOADER
+ *                               or PRINTERS   or EXTERNALS menus
  */
 static void add_item_to_list(char *buffer,
 			     lynx_list_item_type **list_ptr,
 			     int special)
 {
-    char *colon, *next_colon;
+    char *colon, *next_colon, *last_colon;
     lynx_list_item_type *cur_item, *prev_item;
 
     /*
+     * Check if the XWINDOWS or NON_XWINDOWS keyword is present in the last
+     * field, and act properly when found depending if external environment
+     * $DISPLAY variable is set.
+     */
+    if ((last_colon = strrchr(buffer, ':')) != NULL && *(last_colon - 1) != '\\') {
+	*last_colon++ = '\0';
+	/*
+	 * If last_colon equals XWINDOWS then only continue
+	 * if there is a $DISPLAY variable
+	 */
+	if (!strcasecomp(last_colon, "XWINDOWS")) {
+	    if (LYgetXDisplay() == NULL)
+		return;
+	}
+	/*
+	 * If last_colon equals NON_XWINDOWS then only continue
+	 * if there is no $DISPLAY variable
+	 */
+	else if (!strcasecomp(last_colon, "NON_XWINDOWS")) {
+	    if (LYgetXDisplay() != NULL)
+		return;
+	}
+    }
+
+    /*
      * Make a linked list
      */
     if (*list_ptr == NULL) {