change function names from camelCase to underscore_style
This commit is contained in:
parent
6d3cb6b3bd
commit
1dd3b7a810
18
main.c
18
main.c
|
@ -37,7 +37,7 @@ char* concat(const char *s1, const char *s2) {
|
|||
return result;
|
||||
}
|
||||
|
||||
struct tm getTime() {
|
||||
struct tm get_time() {
|
||||
time_t buf;
|
||||
struct tm b;
|
||||
buf = time(NULL);
|
||||
|
@ -45,13 +45,13 @@ struct tm getTime() {
|
|||
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",
|
||||
session.date.month, session.date.day, session.date.year,
|
||||
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;
|
||||
session.date.year = time.tm_year + 1900;
|
||||
session.date.month = time.tm_mon;
|
||||
|
@ -61,7 +61,7 @@ struct session dataToSession(struct tm time, int offset, char *name) {
|
|||
return session;
|
||||
}
|
||||
|
||||
struct session lineToSession(char *line) {
|
||||
struct session line_to_session(char *line) {
|
||||
struct session session;
|
||||
char *buf = line;
|
||||
char *parameters = strtok(buf, " ");
|
||||
|
@ -92,18 +92,18 @@ int main(int argc, char **argv) {
|
|||
struct session buffer;
|
||||
|
||||
while(fgets(line, sizeof(line), f)) {
|
||||
buffer = lineToSession(&line);
|
||||
writeSession(f, buffer);
|
||||
buffer = line_to_session(&line);
|
||||
write_session(f, buffer);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
bt = getTime();
|
||||
bt = get_time();
|
||||
signal(SIGINT, sighnd);
|
||||
flgwt();
|
||||
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");
|
||||
writeSession(f, data);
|
||||
write_session(f, data);
|
||||
fclose(f);
|
||||
return 0;
|
||||
}
|
||||
|
|
Reference in New Issue