7 info_time = localtime(&raw_time);
8 int time_len = strlen(asctime(info_time));
9 strncpy(curr_time, asctime(info_time), time_len);
10 curr_time[(time_len - 1)] =
'\0';
24 while ((read = getline(&line, &len, fp)) != -1) {
25 if (strcmp(line,
"\n") != 0) {
41 int exist = stat(dir_path, &s);
45 if (mkdir(dir_path, 0755) == 0) {
50 fprintf(log_fp,
"Created dir: %s\n", dir_path);
54 fprintf(stderr,
"Cannot access %s\n", dir_path);
57 fprintf(log_fp,
"Cannot access %s\n", dir_path);
61 else if (!S_ISDIR(s.st_mode)) {
62 fprintf(stderr,
"Error: %s is not a directory\n", dir_path);
65 fprintf(log_fp,
"Error: %s is not a directory\n", dir_path);
int get_num_lines(FILE *fp)
void get_login_time(char *curr_time)
int check_or_creat_dir(const char *dir_path, FILE *log_fp)