21static char *month[12] = {
22 "january",
"february",
"march",
23 "april",
"may",
"june",
"july",
24 "august",
"september",
"october",
25 "november",
"december"};
34convert_date_time(dt, ct0)
38 register char *ptr, *ct;
58 for (i = 0; i < 12; i++)
59 if (strncmp(ptr, month[i], l) == 0)
73 while (*ct ==
' ' && *ct)
75 if (sscanf(ct,
"%ld:%ld", &(dt->hrs), &(dt->mins)) != 2)
95 char *month, *day, *t, *ptr;
99 while ((mt =
tmalloc((
unsigned)30 *
sizeof(*mt))) == NULL)
100 puts(
"allocation failure in mtime()");
103 *(ct + strlen(ct) - 1) = 0;
106 ct = strchr(ct,
' ');
111 ct = strchr(ct,
' ');
116 ct = strchr(ct,
' ');
119 ptr = strrchr(t,
':');
122 sprintf(mt,
"%s %s %s %s", day, month, ct + 2, t);
139 char *month, *day, *t;
143 while ((mt =
tmalloc((
unsigned)30 *
sizeof(*mt))) == NULL)
144 puts(
"allocation failure in mtime()");
147 *(ct + strlen(ct) - 1) = 0;
150 ct = strchr(ct,
' ');
155 ct = strchr(ct,
' ');
160 ct = strchr(ct,
' ');
164 sprintf(mt,
"%s %s %s %s", day, month, ct + 2, t);
void * tmalloc(uint64_t size_of_block)
Allocates a memory block of the specified size with zero initialization.
char * cp_str(char **s, char *t)
Copies a string, allocating memory for storage.
int get_long(long *iptr, char *s)
Parses a long integer value from the given string.
char * get_token(char *s)
Extracts the next token from the input string.
char * mtimes(void)
Generates a detailed formatted time string.
char * mtime(void)
Generates a formatted time string.