Home | History | Annotate | Line # | Download | only in lib
load_url.c revision 1.2
      1  1.2   darrenr /*	$NetBSD: load_url.c,v 1.2 2012/07/22 14:27:36 darrenr Exp $	*/
      2  1.1  christos 
      3  1.1  christos /*
      4  1.2   darrenr  * Copyright (C) 2012 by Darren Reed.
      5  1.1  christos  *
      6  1.1  christos  * See the IPFILTER.LICENCE file for details on licencing.
      7  1.1  christos  *
      8  1.2   darrenr  * Id: load_url.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $
      9  1.1  christos  */
     10  1.1  christos 
     11  1.1  christos #include "ipf.h"
     12  1.1  christos 
     13  1.1  christos alist_t *
     14  1.1  christos load_url(char *url)
     15  1.1  christos {
     16  1.1  christos 	alist_t *hosts = NULL;
     17  1.1  christos 
     18  1.1  christos 	if (strncmp(url, "file://", 7) == 0) {
     19  1.1  christos 		/*
     20  1.1  christos 		 * file:///etc/passwd
     21  1.1  christos 		 *        ^------------s
     22  1.1  christos 		 */
     23  1.1  christos 		hosts = load_file(url);
     24  1.1  christos 
     25  1.1  christos 	} else if (*url == '/' || *url == '.') {
     26  1.1  christos 		hosts = load_file(url);
     27  1.1  christos 
     28  1.1  christos 	} else if (strncmp(url, "http://", 7) == 0) {
     29  1.1  christos 		hosts = load_http(url);
     30  1.1  christos 	}
     31  1.1  christos 
     32  1.1  christos 	return hosts;
     33  1.1  christos }
     34