Example #1
0
int
LibAliasRefreshModules(void)
{
	char buf[256], conf[] = "/etc/libalias.conf";
	FILE *fd;
	int i, len;

	fd = fopen(conf, "r");
	if (fd == NULL)
		err(1, "fopen(%s)", conf);

	LibAliasUnLoadAllModule();

	for (;;) {
		fgets(buf, 256, fd);
		if (feof(fd)) 
		        break;
		len = strlen(buf);
		if (len > 1) {
			for (i = 0; i < len; i++)
				if (!isspace(buf[i]))
					break;
			if (buf[i] == '#')
				continue;
			buf[len - 1] = '\0';
			LibAliasLoadModule(buf);
		}
	}
	fclose(fd);
	return (0);
}
Example #2
0
int
LibAliasRefreshModules(void)
{
    /* @todo (r - vasily) here should be module loading */
#ifndef VBOX
    char buf[256], conf[] = "/etc/libalias.conf";
    FILE *fd;
    int i, len;

    fd = fopen(conf, "r");
    if (fd == NULL)
        err(1, "fopen(%s)", conf);

    LibAliasUnLoadAllModule();

    for (;;) {
        fgets(buf, 256, fd);
        if feof(fd)
                break;
        len = strlen(buf);
        if (len > 1) {
            for (i = 0; i < len; i++)
                if (!isspace(buf[i]))
                    break;
            if (buf[i] == '#')
                continue;
            buf[len - 1] = '\0';
            printf("Loading %s\n", buf);
            LibAliasLoadModule(buf);
        }
    }
#endif /* !VBOX */
    return (0);
}