change function names from camelCase to underscore_style

This commit is contained in:
randomuser 2020-11-01 21:08:10 -06:00
parent 6d3cb6b3bd
commit 1dd3b7a810

18
main.c
View File

@ -37,7 +37,7 @@ char* concat(const char *s1, const char *s2) {
return result; return result;
} }
struct tm getTime() { struct tm get_time() {
time_t buf; time_t buf;
struct tm b; struct tm b;
buf = time(NULL); buf = time(NULL);
@ -45,13 +45,13 @@ struct tm getTime() {
return b; return b;
} }
void writeSession(FILE *fd, struct session session) { void write_session(FILE *fd, struct session session) {
fprintf(fd, "P%02d%02d%04d%d %s\n", fprintf(fd, "P%02d%02d%04d%d %s\n",
session.date.month, session.date.day, session.date.year, session.date.month, session.date.day, session.date.year,
session.offset, session.name); session.offset, session.name);
} }
struct session dataToSession(struct tm time, int offset, char *name) { struct session data_to_session(struct tm time, int offset, char *name) {
struct session session; struct session session;
session.date.year = time.tm_year + 1900; session.date.year = time.tm_year + 1900;
session.date.month = time.tm_mon; session.date.month = time.tm_mon;
@ -61,7 +61,7 @@ struct session dataToSession(struct tm time, int offset, char *name) {
return session; return session;
} }
struct session lineToSession(char *line) { struct session line_to_session(char *line) {
struct session session; struct session session;
char *buf = line; char *buf = line;
char *parameters = strtok(buf, " "); char *parameters = strtok(buf, " ");
@ -92,18 +92,18 @@ int main(int argc, char **argv) {
struct session buffer; struct session buffer;
while(fgets(line, sizeof(line), f)) { while(fgets(line, sizeof(line), f)) {
buffer = lineToSession(&line); buffer = line_to_session(&line);
writeSession(f, buffer); write_session(f, buffer);
} }
return 1; return 1;
} }
bt = getTime(); bt = get_time();
signal(SIGINT, sighnd); signal(SIGINT, sighnd);
flgwt(); flgwt();
int t = timediff(getTime(), bt); int t = timediff(getTime(), bt);
struct session data = dataToSession(bt, t, argv[1]); struct session data = data_to_session(bt, t, argv[1]);
FILE *f = fopen(DATFILE, "a"); FILE *f = fopen(DATFILE, "a");
writeSession(f, data); write_session(f, data);
fclose(f); fclose(f);
return 0; return 0;
} }