Working on edit functionality, also reading to a host.

This commit is contained in:
Jacob Windle 2019-04-17 15:01:04 -04:00
parent 8935ad2e54
commit 7a440dedff

10
main.c
View File

@ -71,11 +71,11 @@ void readToHost(char *host, FILE *hostsFile)
while ((fgets(buf, 256, hostsFile)) != NULL)
{
ptr = strcasestr(host, buf);
if (ptr != NULL)
if (ptr != NULL) {
break;
printf("FOUND IT\n");
}
}
// FILE should be read to the host itself.
}
/**
@ -97,6 +97,10 @@ int main(int argc, char **argv)
hostsFile = fopenHostsFile(1);
blockHost(hostsFile, argv[i+1]);
}
else if (strcmp(argv[i], "edit") == 0)
{
readToHost(argv[i+1], hostsFile);
}
else if (strcmp(argv[i], "delete") == 0)
{
fprintf(stdout, "Soon to be implemented!\n");