about summary refs log tree commit diff stats
path: root/src/bindings/libregexp.nim
diff options
context:
space:
mode:
Diffstat (limited to 'src/bindings/libregexp.nim')
0 files changed, 0 insertions, 0 deletions
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
















                                                                        






                         
                    





























































                                                                                
/*
 External application support.
 This feature allows lynx to pass a given URL to an external program.
 It was written for three reasons.
 1) To overcome the deficiency	of Lynx_386 not supporting ftp and news.
    External programs can be used instead by passing the URL.

 2) To allow for background transfers in multitasking systems.
    I use wget for http and ftp transfers via the external command.

 3) To allow for new URLs to be used through lynx.
    URLs can be made up such as mymail: to spawn desired applications
    via the external command.

 See lynx.cfg for other info.
*/

#include "tcp.h"
#include "LYGlobalDefs.h"
#include "LYUtils.h"
#include "LYExtern.h"

#include "LYLeaks.h"

#ifdef USE_EXTERNALS
#define FREE(x) if (x) {free(x); x = NULL;}

void run_external(char * c)
{
	char command[1024];
	lynx_html_item_type *externals2=0;

	if (externals == NULL) return;

	for(externals2=externals; externals2 != NULL;
		 externals2=externals2->next)
	{

#ifdef _WINDOWS
	 if (!strnicmp(externals2->name,c,strlen(externals2->name)))
#else
	 if (!strncasecomp(externals2->name,c,strlen(externals2->name)))
#endif
	 {
	     char *cp;

		if(no_externals && !externals2->always_enabled)
		{
		  statusline(EXTERNALS_DISABLED);
		  sleep(MessageSecs);
		  return;
		}

		/*  Too dangerous to leave any URL that may come along unquoted.
		 *  They often contain '&', ';', and '?' chars, and who knows
		 *  what else may occur.
		 *  Prevent spoofing of the shell.
		 *  Dunno how this needs to be modified for VMS or DOS. - kw
		 */
#if defined(VMS) || defined(DOSPATH)
		sprintf(command, externals2->command, c);
#else /* Unix or DOS/Win: */
		cp = quote_pathname(c);
		sprintf(command, externals2->command, cp);
		FREE(cp);
#endif /* VMS */

		if (*command != '\0')
		{

		 statusline(command);
		 sleep(MessageSecs);

		 stop_curses();
		 fflush(stdout);
		 system(command);
		 fflush(stdout);
		 start_curses();
		}

		return;
	 }
	}

	return;
}
#endif /* USE_EXTERNALS */