#include #include #include #include #include "global.h" #include "manhat-lib/shared_util.h" #include "manhat-lib/shared_cs_util.h" #include "manhat-lib/shared_news_util.h" #include "manhat-lib/shared_translate_url.h" char inbox_path[MAX_PATH + 1]; /* full path to inbox.dat */ static void read_parameters (char *course, char *key, long *offset, char *url, int *from_gather) { char off_set[MAX_FILENAME + 1]; /* for holding the long value */ char tmp_url[MAX_URL*3 + 1]; cs_get_required_parameter ("crs", course, MAX_FILENAME); cs_get_required_parameter ("id", key, MAX_KEY); cs_get_required_parameter ("loc", off_set, MAX_FILENAME); *offset = atol (off_set); cs_get_required_parameter ("url", tmp_url, MAX_URL *3); translate_url_substitutes (url, tmp_url, MAX_URL*3,1); /* shared_translate_url.c */ /* If this program is called from news_gather, an additional 'gather' parameter ** will be sent. The gather parameter,if non-zero, is the named anchor to call the ** news_gather program on return **/ cs_get_optional_parameter("gather", tmp_url, 10); *from_gather = atoi(tmp_url); } int check_url_has_protocol(char *url) { char protocols[5][40] = {"ftp://", "mailto:", "https://", "telnet://", "http://"}; int i, j, len; char aChar; int match_count =0; for(i = 0; i<5; i++) { match_count =0; len = strlen(protocols[i]); if(strstr(url, protocols[i])) return 1; for(j = 0; j