Removed excessive comments

The functions are fairly self explanatory, no need to comment on every
function
stable
Justin Reichardt 2021-08-28 14:15:44 -05:00
parent 128b20d857
commit 98d1442a41
2 changed files with 1 additions and 17 deletions

View File

@ -22,7 +22,6 @@
#include "download.h" #include "download.h"
#endif #endif
// This will download entries from the config
int download_entries(struct entry **entries){ int download_entries(struct entry **entries){
int i = (*entries)[0].entrytype; int i = (*entries)[0].entrytype;
int rc = 0; int rc = 0;
@ -62,7 +61,6 @@ int download_entries(struct entry **entries){
remove(TMPDOWNLOADLOCATION); remove(TMPDOWNLOADLOCATION);
return 0; return 0;
} }
// Uses libcurl to download and add file to tmpf
int download_libcurl(char *e){ int download_libcurl(char *e){
CURL *curl; CURL *curl;
CURLcode res; CURLcode res;
@ -93,7 +91,6 @@ int download_libcurl(char *e){
return 0; return 0;
} }
// Parse what was downloaded
int parse_download(char *buff, size_t size, size_t nmemb){ int parse_download(char *buff, size_t size, size_t nmemb){
FILE *tmpf; FILE *tmpf;
int i=0; int i=0;
@ -108,8 +105,6 @@ int parse_download(char *buff, size_t size, size_t nmemb){
fclose(tmpf); fclose(tmpf);
return nmemb; return nmemb;
} }
// Checks the hosts file for a download section matching the url
// then copies it to the tmp file
int copy_old_download(char *url){ int copy_old_download(char *url){
FILE *hostsf; FILE *hostsf;
FILE *tmpf; FILE *tmpf;

View File

@ -23,7 +23,6 @@
#include "rhosts.h" #include "rhosts.h"
#endif #endif
int main(int argc, char *argv[]){ int main(int argc, char *argv[]){
struct entry *entries; struct entry *entries;
int rc =0; int rc =0;
@ -56,10 +55,6 @@ int main(int argc, char *argv[]){
} }
return 0; return 0;
} }
// Take the address of a struct entry pointer and returns it filled with
// entries from the config file
int parse_config(struct entry **entries){ int parse_config(struct entry **entries){
int rc=0; int rc=0;
@ -73,7 +68,7 @@ int parse_config(struct entry **entries){
int *j = NULL; // A shorter reference to how many entries int *j = NULL; // A shorter reference to how many entries
j = &(*entries)[0].entrytype; j = &(*entries)[0].entrytype;
char c='\0'; // Character Buffer char c='\0';
char buff[MAXSTRSIZE]; char buff[MAXSTRSIZE];
buff[0]='\0'; buff[0]='\0';
short int valtyp = CONTENTTYPE_BLANK; short int valtyp = CONTENTTYPE_BLANK;
@ -108,7 +103,6 @@ int parse_config(struct entry **entries){
buff[0] = '\0'; buff[0] = '\0';
valtyp = CONTENTTYPE_BLANK; valtyp = CONTENTTYPE_BLANK;
} }
// Remove Blank Lines
else if (c == '\n' || c == EOF){ else if (c == '\n' || c == EOF){
buff[0] = '\0'; buff[0] = '\0';
} }
@ -138,15 +132,12 @@ int openfile(FILE **file, char *mode, char *location){
} }
return 0; return 0;
} }
// Recieves a string and returns a content type
short int determine_config_entry_value(char *buff){ short int determine_config_entry_value(char *buff){
if (strncmp(buff,"#", 1) == 0){return CONTENTTYPE_COMMENT;} if (strncmp(buff,"#", 1) == 0){return CONTENTTYPE_COMMENT;}
else if (strcmp(buff,"site") == 0){return CONTENTTYPE_SITE;} else if (strcmp(buff,"site") == 0){return CONTENTTYPE_SITE;}
else if (strcmp(buff,"download") == 0){return CONTENTTYPE_DOWNLOAD;} else if (strcmp(buff,"download") == 0){return CONTENTTYPE_DOWNLOAD;}
else {return CONTENTTYPE_ERROR;} else {return CONTENTTYPE_ERROR;}
} }
// Copies the beginning of the hosts file to tmpfile
int preserve_static_entries(){ int preserve_static_entries(){
FILE *hostsf; FILE *hostsf;
FILE *tmpf; FILE *tmpf;
@ -190,7 +181,6 @@ int preserve_static_entries(){
fclose(tmpf); fclose(tmpf);
return 0; return 0;
} }
int add_site_entries(struct entry **entries){ int add_site_entries(struct entry **entries){
int i = (*entries)[0].entrytype; int i = (*entries)[0].entrytype;
int rc = 0; int rc = 0;
@ -226,7 +216,6 @@ int add_site_entries(struct entry **entries){
fclose(tmpf); fclose(tmpf);
return 0; return 0;
} }
// Copies the contents of the temp file to the hosts file
int copy_tmp_to_hosts(){ int copy_tmp_to_hosts(){
FILE *tmpf; FILE *tmpf;
tmpf = fopen(TMPLOCATION,"r"); tmpf = fopen(TMPLOCATION,"r");