Beispiel #1
0
// TRADE | NICK=clomps | MATCH=botname.*New Release (.*)
//   | SRCSITE=ASite1     | SRCDIR=/tv
//   | DSTSITE=glftpdsite | DSTDIR=/tv
//   | ACCEPT=*simpsons* | REJECT=*FINSUB*
void conf_trade(char **keys, char **values, int items,void *optarg)
{
    char *nick, *match, *srcsite, *srcdir, *dstsite, *dstdir, *accept, *reject;
    char *requeue, *subdir;

	nick    = parser_findkey(keys, values, items, "NICK");
	match   = parser_findkey(keys, values, items, "MATCH");
	srcsite = parser_findkey(keys, values, items, "SRCSITE");
	srcdir  = parser_findkey(keys, values, items, "SRCDIR");
	dstsite = parser_findkey(keys, values, items, "DSTSITE");
	dstdir  = parser_findkey(keys, values, items, "DSTDIR");
	accept  = parser_findkey(keys, values, items, "ACCEPT");
	reject  = parser_findkey(keys, values, items, "REJECT");

    if (!nick || !match || !srcsite || !srcdir || !dstsite || !dstdir ||
        !accept || !reject) {
		printf("TRADE Entry in conf without NICK, MATCH, SRCSITE, SRCDIR, DSTSITE, DSTDIR, ACCEPT or REJECT\n");
		return;
	}

    debugf("MATCH '%s'\n", match);

	requeue = parser_findkey(keys, values, items, "REQUEUE");
	subdir  = parser_findkey(keys, values, items, "SUBDIR");

    irc_add_trade(nick, match, srcsite, srcdir, dstsite, dstdir, accept, reject,
                  requeue ? 1 : 0,
                  subdir ? 1 : 0);

}
Beispiel #2
0
// << SESSIONNEW|SITEID=0|SID=1
void site_cmd_sessionnew(char **keys, char **values, int items,void *optarg)
{
	fxpone_t *the_engine = optarg;
	char *siteid, *sid;
	int i;

	sid    = parser_findkey(keys, values, items, "SID");
	siteid = parser_findkey(keys, values, items, "SITEID");

	if (!siteid) return;

	for (i = 0; i < num_sites; i++) {

		if (!sites[i]) continue;

		if (sites[i]->siteid == atoi(siteid)) {

			if (!sid) {
				printf("Site failed: %s\n", sites[i]->name);
				sites[i]->failed = 1;
				site_ready(the_engine->handle, sites[i]);
				return;
			}

			sites[i]->sid = atoi(sid);

		}

	}

}
Beispiel #3
0
//TIMESTAMP|NAME=foo|LAST_CHECK=123123123
void conf_timestamp(char **keys, char **values, int items,void *optarg)
{
	char *name, *last_check;
	site_t *site = NULL;
    int i;

	name       = parser_findkey(keys, values, items, "NAME");
	last_check = parser_findkey(keys, values, items, "LAST_CHECK");

	if (!name) {
		printf("TIMESTAMP Entry in conf without NAME= field\n");
		return;
	}

    for (i = 0; i < num_sites; i++) {
        if (sites[i] && !mystrccmp(name, sites[i]->name)) {
            site = sites[i];
            break;
        }
    }

    if (!site) {
        printf("Unable to find site '%s' used in TIMESTAMP\n", name);
        return;
    }

	if (last_check) {
		site->last_check = strtoul(last_check, NULL, 10);
		site->last_check -= default_age;
	} else {
		site->last_check = lion_global_time;
		site->last_check -= default_age;
	}

}
Beispiel #4
0
//CONTINUED|ACCEPT=p1/p2/...|REJECT=p1/p2/...
void conf_continued(char **keys, char **values, int items,void *optarg)
{
	char *accept, *reject;

	accept     = parser_findkey(keys, values, items, "ACCEPT");
	reject     = parser_findkey(keys, values, items, "REJECT");

	autoq_add(NULL, NULL, NULL, accept, reject, NULL, NULL);

}
Beispiel #5
0
// << CONNECT|SID=1
void site_cmd_connect(char **keys, char **values, int items,void *optarg)
{
	fxpone_t *the_engine = optarg;
	char *sid;
	int i;

	sid    = parser_findkey(keys, values, items, "SID");

	if (!sid) return;

	for (i = 0; i < num_sites; i++) {

		if (sites[i] && (sites[i]->sid == atoi(sid))) {

			printf("Site %s processing dir '%s'\n", sites[i]->name,
				   sites[i]->dirs[sites[i]->current_dir]);

			lion_printf(the_engine->handle, "CWD|SID=%u|PATH=%s\r\n",
						sites[i]->sid,
						sites[i]->dirs[sites[i]->current_dir]);

		}

	}

}
Beispiel #6
0
char *sites_find_extra(sites_t *site, char *key)
{
	char *value;

	if (!site || !site->items || !site->keys) return NULL;

	value = parser_findkey(site->keys, site->values, site->items, key);

	return value;
}
Beispiel #7
0
// << CWD|SID=2|REPLY=250|OK|MSG=250 CWD command successful.
void site_cmd_cwd(char **keys, char **values, int items,void *optarg)
{
	fxpone_t *the_engine = optarg;
	char *code, *sid, *msg;
	int i;
	unsigned int id;

	sid    = parser_findkey(keys, values, items, "SID");
	code   = parser_findkey(keys, values, items, "CODE");
	msg    = parser_findkey(keys, values, items, "MSG");

	if (!sid) return;

	id = atoi(sid);

	for (i = 0; i < num_sites; i++) {

		if (!sites[i]) continue;

		if (sites[i]->sid == id) {

			if (code && atoi(code) == 0) {
				lion_printf(the_engine->handle, "DIRLIST|SID=%u\r\n",
							sites[i]->sid);
			} else {

				printf("Site %s incorrect path '%s' : %s\n",
					   sites[i]->name,
					   sites[i]->dirs[ sites[i]->current_dir],
					   msg ? msg : "");

				sites[i]->failed = 1;
				lion_printf(the_engine->handle, "DISCONNECT|SID=%u\r\n",
							sites[i]->sid);
			}
		}

	}

}
Beispiel #8
0
void conf_irc(char **keys, char **values, int items,void *optarg)
{
	char *server, *nick, *user, *port, *pass, *ssl, *channel;
    ircserver_t *ircserver = NULL;

    // Mandatory
	server  = parser_findkey(keys, values, items, "SERVER");
	nick    = parser_findkey(keys, values, items, "NICK");
	user    = parser_findkey(keys, values, items, "USER");

	if (!server || !nick || !user) {
		printf("IRC Entry in conf without SERVER, NICK or USER fields.\n");
		return;
	}

	port    = parser_findkey(keys, values, items, "PORT");
	pass    = parser_findkey(keys, values, items, "PASS");
	ssl     = parser_findkey(keys, values, items, "SSL");

    // Pull out the channel defines.
    while((	channel  = parser_findkey_once(keys, values, items, "CHANNEL"))) {

        if (!ircserver) {
            ircserver = irc_addserver(server, port, pass, nick, user, ssl);
        }
        if (ircserver) {
            irc_addchannel(ircserver, channel);
        }

    }

}
Beispiel #9
0
// WELCOME|name=FXP.Oned|version=0.1|build=359|protocol=1.2|SSL=optional
void site_cmd_welcome(char **keys, char **values, int items,void *optarg)
{
	fxpone_t *the_engine = optarg;
	char *ssl;

	ssl = parser_findkey(keys, values, items, "SSL");

	if (ssl && !mystrccmp("disabled", ssl)) {
		send_auth(the_engine);
		return;
	}

	lion_printf(the_engine->handle, "SSL\r\n");
}
Beispiel #10
0
// SSL|CODE=0|OK|Msg=Attempting SSL negotiations.
void site_cmd_ssl(char **keys, char **values, int items,void *optarg)
{
	fxpone_t *the_engine = optarg;
	char *code;

	code = parser_findkey(keys, values, items, "CODE");

	if (!code || atoi(code) != 0) {
		printf("SSL support failed with FXP.One\n");
		do_exit = 1;
		return;
	}

	lion_ssl_set(the_engine->handle, LION_SSL_CLIENT);

}
Beispiel #11
0
// >> AUTH|OK|MSG=Successful
void site_cmd_auth(char **keys, char **values, int items,void *optarg)
{
	fxpone_t *the_engine = optarg;
	char *code;

	code = parser_findkey(keys, values, items, "CODE");

	// We didn't get code, or, code is non-zero
	if (!code || atoi(code)) {
		printf("Failed to authenticate with FXP.One\n");
		do_exit = 1;
		return;
	}

	debugf("Successfully connected to FXP.One\n");

	lion_printf(the_engine->handle, "SITELIST\r\n");
}
Beispiel #12
0
// FXPONE|HOST=127.0.0.1|PORT=8885|USER=admin|SSL=forced|TIMEFILE=name
void conf_fxpone(char **keys, char **values, int items,void *optarg)
{
	char *host, *port, *user, *pass, *ssl, *timefile;
	fxpone_t *fxpone;

	host     = parser_findkey(keys, values, items, "HOST");
	port     = parser_findkey(keys, values, items, "PORT");
	user     = parser_findkey(keys, values, items, "USER");
	pass     = parser_findkey(keys, values, items, "PASS");
	ssl      = parser_findkey(keys, values, items, "SSL");
	timefile = parser_findkey(keys, values, items, "TIMEFILE");

	if (!host) {
		printf("FXPONE Entry in conf without HOST= field\n");
		return;
	}

    // Don't need to save anymore
#if 0
	if (optarg) {
		// Saving
		lion_printf(optarg, "FXPONE|HOST=%s", host);
		if (port) lion_printf(optarg, "|PORT=%s", port);
		if (user) lion_printf(optarg, "|USER=%s", user);
		if (pass) lion_printf(optarg, "|PASS=%s", pass);
		if (ssl)  lion_printf(optarg, "|ssl=%s",  ssl);
		lion_printf(optarg, "\r\n");
		return;
	}
#endif

	// Create a new fxpone engine to connect to.
	fxpone = fxpone_newnode();
	if (!fxpone) return;


	SAFE_COPY(fxpone->host, host);
	SAFE_COPY(fxpone->user, user);
	SAFE_COPY(fxpone->pass, pass);
	if (port)
		fxpone->port = atoi(port);
	else
		fxpone->port = 8885;

	if (ssl)
		fxpone->ssl = atoi(ssl);

    SAFE_COPY(fxpone->timefile, timefile);
}
Beispiel #13
0
//AUTOQ|PASSNUM=x|FROM=site|TO=site|ACCEPT=p1/p2/...|REJECT=p1/p2/...
void conf_autoq(char **keys, char **values, int items,void *optarg)
{
	char *passnum, *from, *to, *accept, *reject, *incskip, *requeue;

	passnum    = parser_findkey(keys, values, items, "PASSNUM");
	from       = parser_findkey(keys, values, items, "FROM");
	to         = parser_findkey(keys, values, items, "TO");
	accept     = parser_findkey(keys, values, items, "ACCEPT");
	reject     = parser_findkey(keys, values, items, "REJECT");
	incskip    = parser_findkey(keys, values, items, "INCSKIP");
	requeue    = parser_findkey(keys, values, items, "REQUEUE");

	if (!passnum || !from || !to) {
		printf("AUTOQ Entry in conf without PASSNUM, FROM, TO fields.\n");
		return;
	}

	autoq_add(passnum, from, to, accept, reject, incskip, requeue);

}
Beispiel #14
0
//
// Add static IP pattern as registered/authenticated (PIN)
//
// CMD      : AUTH
// Required : pattern
// Optional :
//
void root_auth(char **keys, char **values,
               int items,void *optarg)
{
	char *pattern;

	// Requireds
	pattern  = parser_findkey(keys, values, items, "PATTERN");

	if (!pattern || !*pattern) {
		printf("      : [root] missing required field: PATTERN\n");
		//do_exit = 1;
		return;
	}

    if (root_registered_num >= ROOT_REGISTERED_MAX) {
        printf("Sorry, maximum AUTH lines have already been defined. \n");
        printf("This program was compiled with a maximum of %d AUTH defines.\n",
               ROOT_REGISTERED_MAX);
        return;
    }

    root_registered_patterns[ root_registered_num++ ] = strdup(pattern);

}
Beispiel #15
0
// << DISCONNECT|SID=1|MSG=Undefined error: 0
void site_cmd_disconnect(char **keys, char **values, int items,void *optarg)
{
	char *sid;
	int i;
	fxpone_t *the_engine = optarg;

	sid    = parser_findkey(keys, values, items, "SID");

	if (!sid) return;

	for (i = 0; i < num_sites; i++) {

		if (sites[i] && (sites[i]->sid == atoi(sid))) {

			printf("Site %s disconnected\n", sites[i]->name);

			sites[i]->failed = 1;
			site_ready(the_engine->handle, sites[i]);

		}

	}

}
Beispiel #16
0
void settings_conf(char **keys, char **values,
				   int items,void *optarg)
{
	char *value;

	if ((value = parser_findkey(keys, values, items, "VERSION"))) {

		// Lets just warn them, but carry on.
		if (strcasecmp(value, "1.0")) {
			printf("settings: Unknown version in settings file '%s'.\n",
				   value);
		}

	}


	// Parse in command settings
	if ((value = parser_findkey(keys, values, items, "command_port")))
		settings_values.command_port = atoi(value);

	if((value = parser_findkey(keys, values, items, "command_ssl_only")))
		settings_values.command_ssl_only = atoi(value);

	if ((value = parser_findkey(keys, values, items, "command_iface")))
		settings_values.command_iface = lion_addr(value);

	if ((value = parser_findkey(keys, values, items, "http_port")))
		settings_values.http_port = atoi(value);

	if((value = parser_findkey(keys, values, items, "http_ssl_only")))
		settings_values.http_ssl_only = atoi(value);

	if ((value = parser_findkey(keys, values, items, "http_iface")))
		settings_values.http_iface = lion_addr(value);

}
Beispiel #17
0
//SITE|NAME=foo|DIR=/tv/|USESKIP=1|INCTEST=%s-INCOMPLETE|LAST_CHECK=123123123
//NUKETEST=!NUKED-%s
void conf_site(char **keys, char **values, int items,void *optarg)
{
	char *name, *dir, *useskip, *inctest, *nuketest, *last_check, *hide;
	site_t *site, **tmp;
	char **dtmp;
    char *strtmp;
    int i;

	name       = parser_findkey(keys, values, items, "NAME");
	useskip    = parser_findkey(keys, values, items, "USESKIP");
	inctest    = parser_findkey(keys, values, items, "INCTEST");
	nuketest   = parser_findkey(keys, values, items, "NUKETEST");
	hide       = parser_findkey(keys, values, items, "HIDE");
	last_check = parser_findkey(keys, values, items, "LAST_CHECK");

	if (!name) {
		printf("SITE Entry in conf without NAME= field\n");
		return;
	}

    // Attempt to find a site already defined by name, if found, allow
    // HIDE to be concatenated.
    for (i = 0; i < num_sites; i++) {
        if (sites[i] && !mystrccmp(name, sites[i]->name)) {
            if (hide) {
                if (!sites[i]->hide) {
                    SAFE_COPY(sites[i]->hide, hide);
                } else {
                    strtmp = sites[i]->hide;
                    sites[i]->hide = misc_strjoin(strtmp?strtmp:"", hide);
                    SAFE_FREE(strtmp);
                }
            }
            return;
        }
    }

	site = calloc(1, sizeof(*site));
	if (!site) return;

	tmp = realloc(sites, sizeof(site_t *) * (num_sites + 1));
	if (!tmp) return;
	sites = tmp;

	sites[num_sites] = site;
	num_sites++;

	SAFE_COPY(site->name, name);

	while ((dir = parser_findkey_once(keys, values, items, "DIR"))) {
		dtmp = (char **) realloc(site->dirs,
								 sizeof(char *) * (site->num_dirs + 1));
		if (!dtmp) break;

		site->dirs = dtmp;

		site->dirs[ site->num_dirs ] = strdup(dir);
		site->num_dirs++;

	}

	SAFE_COPY(site->inctest, inctest);
	SAFE_COPY(site->nuketest, nuketest);
	SAFE_COPY(site->hide, hide);
	if (useskip)
		site->use_lists = atoi(useskip);
	if (last_check) {
		site->last_check = strtoul(last_check, NULL, 10);
		site->last_check -= default_age;
	} else {
		site->last_check = lion_global_time;
		site->last_check -= default_age;
	}


    site->num_files = 0;
}
Beispiel #18
0
// >> SITELIST|SITEID=1|NAME=localhost|HOST=127.0.0.1|PORT=21|USER=mp3|PASS=mp3|PASSIVE=1|FXP_PASSIVE=2|CONTROL_TLS=2|DATA_TLS=2|optional_variable=roger moore
void site_cmd_sitelist(char **keys, char **values, int items,void *optarg)
{
	fxpone_t *the_engine = optarg;
	char *name, *siteid, *end;
	char *dskiplist, *dpasslist, *fskiplist, *fpasslist, *fskipempty;
	int i;

	end    = parser_findkey(keys, values, items, "END");
	name   = parser_findkey(keys, values, items, "NAME");
	siteid = parser_findkey(keys, values, items, "SITEID");

	if (end) {

		// num_sitelist has how many sites we found and connected to
		// num_sites is how many we are waiting for before processing.
		num_sites = num_sitelist;
		return;

	}




	if (!name || !siteid) return;

	dskiplist = parser_findkey(keys, values, items, "DSKIPLIST");
	dpasslist = parser_findkey(keys, values, items, "DPASSLIST");
	fskiplist = parser_findkey(keys, values, items, "FSKIPLIST");
	fpasslist = parser_findkey(keys, values, items, "FPASSLIST");
	fskipempty = parser_findkey(keys, values, items, "FSKIPEMPTY");


	for (i = 0; i < num_sites; i++) {

		if (!sites[i]) continue;

		if (!mystrccmp(sites[i]->name, name)) {

			sites[i]->siteid = atoi(siteid);

			SAFE_COPY(sites[i]->dskiplist, dskiplist);
			SAFE_COPY(sites[i]->dpasslist, dpasslist);
			SAFE_COPY(sites[i]->fskiplist, fskiplist);
			SAFE_COPY(sites[i]->fpasslist, fpasslist);

			if (fskipempty && (atoi(fskipempty) == 0))
				sites[i]->fskipempty = 0;
			else
				sites[i]->fskipempty = 1;

			num_sitelist++;

            // IRC sets skip, so we dont do initial login
            if (!sites[i]->skip)
                lion_printf(the_engine->handle, "SESSIONNEW|SITEID=%u\r\n",
                            atoi(siteid));

		}

	}

}
Beispiel #19
0
//<< DIRLIST|SID=1|FID=0|NAME=giana_sounds|DATE=1057590000|SIZE=512|USER=nobody|GROUP=nobody|PERM=drwxrwxrwx|type=directory
void site_cmd_dirlist(char **keys, char **values, int items,void *optarg)
{
	fxpone_t *the_engine = optarg;
	char *sid, *name, *fid, *date, *size, *type, *end, *begin;
	int i;
	unsigned int id;
	site_t *site;
	file_t *file, **tmp;

	sid    = parser_findkey(keys, values, items, "SID");
	name   = parser_findkey(keys, values, items, "NAME");
	fid    = parser_findkey(keys, values, items, "FID");
	date   = parser_findkey(keys, values, items, "DATE");
	size   = parser_findkey(keys, values, items, "SIZE");
	type   = parser_findkey(keys, values, items, "FTYPE");
	begin  = parser_findkey(keys, values, items, "BEGIN");
	end    = parser_findkey(keys, values, items, "END");

	if (!sid) return;

	if (begin) return;

	id = atoi(sid);

	for (i = 0; i < num_sites; i++) {

		if (!sites[i]) continue;

		if (sites[i]->sid == id) {

			site = sites[i];

			if (end) {

				site->current_dir++;
				if (site->current_dir >= site->num_dirs) {
					site_ready(the_engine->handle, site);
					return;
				}

				printf("Site %s processing dir '%s'\n", sites[i]->name,
					   sites[i]->dirs[sites[i]->current_dir]);

				lion_printf(the_engine->handle, "CWD|SID=%u|PATH=%s\r\n",
							sites[i]->sid,
							sites[i]->dirs[sites[i]->current_dir]);

				return;

			}


            // Don't show entries in HIDE
            if (sites[i]->hide && file_listmatch(sites[i]->hide, name)) return;


			//			SAFE_COPY(sites[i]->name, name);
			file = file_new();
			if (!file) return;

			tmp = realloc(site->files, sizeof(file_t *)*(site->num_files + 1));
			if (!tmp) {
				file_free(file);
				return;
			}

			site->files = tmp;

			site->files[ site->num_files ] = file;
			site->num_files++;

			SAFE_COPY(file->name, name);
            if (date)
                file->date = strtoul(date, NULL, 10);
            if (size)
                file->size = strtoull(size, NULL, 10);
			if (type && !mystrccmp("directory", type))
				file->type = 1;

			// Remember the source path we came from
			file->current_dir = site->current_dir;

		}

	}

}
Beispiel #20
0
//
// function for conf reading. Called when conf file has command specified.
//
// CMD      : ROOT
// Required : path
// Optional : flags, http, proxy, subdir, dvdread
//
void root_cmd(char **keys, char **values,
			  int items,void *optarg)
{
	char *path, *flags, *http, *proxy, *subdir, *dvdread, *zfs, *url;
	root_t *tmp;

	// Requireds
	path     = parser_findkey(keys, values, items, "PATH");

	if (!path || !*path) {
		printf("      : [root] missing required field: PATH\n");
		//do_exit = 1;
		return;
	}

	// Optionals
	flags     = parser_findkey(keys, values, items, "FLAGS");
	http      = parser_findkey(keys, values, items, "HTTP");
	proxy     = parser_findkey(keys, values, items, "PROXY");
	subdir    = parser_findkey(keys, values, items, "SUBDIR");
	dvdread   = parser_findkey(keys, values, items, "DVDREAD");
	zfs       = parser_findkey(keys, values, items, "ZFS");
	url       = parser_findkey(keys, values, items, "URL");

	if (zfs && *zfs) {
        char buffer[1024];
        lion_t *spawn;
        // Spawn zfs list to find any file-systems with set attribute.
        // In future, it would perhaps be nicer to use libzfs.
        debugf("      : looking for ZFS filesystems\n");
        snprintf(buffer, sizeof(buffer), "%s list -H -o mountpoint,%s",
                 path, zfs);
        spawn = lion_system(buffer, 0, LION_FLAG_FULFILL, zfs);
        if (spawn) lion_set_handler(spawn, root_zfs_handler);
        return; // Don't allocate new buffers.
    }

	tmp = (root_t *) realloc(root_array,
								   sizeof(root_t) *
								   (root_count + 1));

	if (!tmp) {
		debugf("      : out of memory allocating ROOT\n");
		return;
	}


	// Increase our counter
	root_count++;

	// Assign us in.
	root_array = tmp;

	// The new area
	tmp = &root_array[ root_count - 1 ]; // Nobody likes -1

	// Make it be cleared
	memset(tmp, 0, sizeof(*tmp));

#ifdef WIN32
	// Change \ to / cos its prettier and works in browsers.
	// If its c:/ make it "c:\"
	// remove / if it ends with a slash
	{
		char *r;
		while ((r = strchr(path, '\\')))
			*r = '/';
		// Just c:/ ?
		if (path[0] && (path[1] == ':') && (path[2] == '/') && !path[3])
			path[2] = '\\';
		misc_stripslash(path);
	}
#endif



	tmp->path = strdup(path);  // Do we need to strdup?


#if HAVE_PWD_H
    debugf("[root] '%s'\n", path);

    // Attempt to expand ~username, we only let the first character be ~, since
    // it does not make any sense to specify a path before it.
    if (path[0] == '~') {
        // Fetch out the username,if any. (~username/) or (~/) are valid.
        char *ar, *username;
        struct passwd *pw;

        ar = path;
        username = misc_digtoken(&ar, "/\r\n");

        // Skip all leading "~"s
        while(username && *username == '~') username++;

        if (!username || !*username) {
            // Look up current user then.
            pw = getpwuid(getuid());
        } else {
            // Look up by username
            pw = getpwnam(username);
        }

        // Lookup successful?
        if (pw) {
            SAFE_FREE(tmp->path);
            tmp->path = misc_strjoin(pw->pw_dir, ar);
            debugf("[root] expanded to '%s'\n",
                   tmp->path);
        } // pw
    }
#endif



	if (flags && *flags)
		tmp->flags = dirlist_a2f(flags);
	else
		tmp->flags = 0;

	// We no longer use the FLAGS part of ROOT. See skin_sort_*
	// Use 0 sorting for speed.
	tmp->flags = 0;
	// Things that are not allowed to be set.
	tmp->flags &= ~( DIRLIST_SHORT | DIRLIST_XML | DIRLIST_FILE
					 | DIRLIST_SHOW_DOT); // Used to hide parential dirs

	// Essential flags.
	tmp->flags |= DIRLIST_LONG | DIRLIST_PIPE;

	if (http && *http) {

		// root.http
		if (!strncasecmp("http://", http, 7)) {
			char *ar, *host, *port = "80";

			ar = &http[7];
			host = misc_digtoken(&ar, "/:\r\n");
			if (host) {
				// Optional port?
				if (misc_digtoken_optchar == ':')
					port = misc_digtoken(&ar, "/\r\n");
				if (!port || !*port)
					port = "80";

				tmp->http_host = strdup(host);
				tmp->http_port = atoi(port);
				tmp->http_file = strdup(ar);

			}

		}

	}

	if (url && *url) {
		if (!strncasecmp("http://", url, 7)) {
            tmp->url = strdup(url);
        }
    }


	if (proxy)
		tmp->proxy = 1;

	if (subdir)
		tmp->subdir = strdup(subdir);

	if (dvdread)
		tmp->dvdread = 1;



	debugf("      : [root] recognising '%s'\n",
		   tmp->path);

}