removed uncommented code, updated readme
This commit is contained in:
parent
8e4c37fe88
commit
3bf6fea43d
@ -49,6 +49,5 @@ This will run ctags on every commit.
|
|||||||
|
|
||||||
#### TODO
|
#### TODO
|
||||||
|
|
||||||
- real and automated unit testing
|
- improve and automate unit testing
|
||||||
- fix stack smashing bug (test file: failed_cal.ics)
|
|
||||||
- add cli argument that will not show ongoing events, only upcoming events
|
- add cli argument that will not show ongoing events, only upcoming events
|
||||||
|
@ -27,6 +27,7 @@ void get_date (char buffer[]) {
|
|||||||
// 20241209 -> 2024-12-09
|
// 20241209 -> 2024-12-09
|
||||||
// caller has to free() the returned char array
|
// caller has to free() the returned char array
|
||||||
char* pretty_date_time (char date_time[]) {
|
char* pretty_date_time (char date_time[]) {
|
||||||
|
// need one more char in the char pointer for null-termination
|
||||||
int pdt_len = 20;
|
int pdt_len = 20;
|
||||||
if (!strchr (date_time, 'T')) {
|
if (!strchr (date_time, 'T')) {
|
||||||
pdt_len = 11;
|
pdt_len = 11;
|
||||||
@ -64,37 +65,12 @@ char* pretty_date_time (char date_time[]) {
|
|||||||
return pretty_dt;
|
return pretty_dt;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 20230823T194138 -> 2023-08-23 19:41:38
|
|
||||||
void pretty_print_date_time (char date_time[]) {
|
void pretty_print_date_time (char date_time[]) {
|
||||||
char* pdt = pretty_date_time(date_time);
|
char* pdt = pretty_date_time(date_time);
|
||||||
|
|
||||||
printf("%s", pdt);
|
printf("%s", pdt);
|
||||||
|
|
||||||
free(pdt);
|
free(pdt);
|
||||||
/*
|
|
||||||
// copy date_time because strtok will destroy it
|
|
||||||
char date_time_copy[15] = "";
|
|
||||||
strcpy (date_time_copy, date_time);
|
|
||||||
|
|
||||||
char* date = strtok (date_time, "T");
|
|
||||||
char* time = strtok (NULL, "T");
|
|
||||||
if (date == NULL) {
|
|
||||||
printf ("\nError: date points to NULL!\n");
|
|
||||||
exit (1);
|
|
||||||
}
|
|
||||||
printf ("%c%c%c%c-", date[0], date[1], date[2], date[3]);
|
|
||||||
printf ("%c%c-", date[4], date[5]);
|
|
||||||
printf ("%c%c", date[6], date[7]);
|
|
||||||
|
|
||||||
if (time != NULL) {
|
|
||||||
printf (" %c%c:", time[0], time[1]);
|
|
||||||
printf ("%c%c:", time[2], time[3]);
|
|
||||||
printf ("%c%c", time[4], time[5]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// put variable date_time back together
|
|
||||||
strcpy (date_time, date_time_copy);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void marshall_date_time (char date_time[]) {
|
void marshall_date_time (char date_time[]) {
|
||||||
|
Reference in New Issue
Block a user