From 1f398be82ffdfce90b6dbbfa4ecfb87894b8064b Mon Sep 17 00:00:00 2001 From: Daniel Jones Date: Fri, 15 Mar 2019 10:46:35 +1030 Subject: added some more domains, debug prints when NOFORK --- urlopen.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/urlopen.c b/urlopen.c index 7b76428..411011b 100644 --- a/urlopen.c +++ b/urlopen.c @@ -53,7 +53,12 @@ char *forceddomains[][2] = {"youtu.be", "2"}, {"streamable.com", "2"}, {"www.streamable.com", "2"}, - {"files.slack.com", "4"} + {"files.slack.com", "4"}, + {"reddit.com", "4"}, + {"www.reddit.com", "4"}, + {"mod.reddit.com", "4"}, + {"redd.it", "4"} + }; int @@ -161,7 +166,8 @@ checkforceddomains(char *url, int ext) strncpy(buff, forceddomains[i][0], BUFF_SIZE-1); if (strcmp(buff, buff2) == 0) { - //printf("domain should be forced as %s\n", buff); + if (NOFORK) + printf("domain should be forced as %s\n", buff); ret = atoi(forceddomains[i][1]); goto exitdomaincheck; } @@ -187,13 +193,15 @@ main(int argc, char *argv[]) * fork, execute */ link = islink(argv[i]); - //printf("%s is probably %s link\n", argv[i], (link == 1) ? "a" : "not a"); + if (NOFORK) + printf("%s is probably %s link\n", argv[i], (link == 1) ? "a" : "not a"); if (link == 1) { ext = getext(argv[i]); // check if the domain should be forced to a program ext = checkforceddomains(argv[i], ext); - //printf("program to run is: \"%s %s\"\n", programs[ext][1], argv[i]); + if (NOFORK) + printf("program to run is: \"%s %s\"\n", programs[ext][1], argv[i]); if (NOFORK == 0) { pid_t pid = fork(); -- cgit v1.2.3