diary

Text-based journaling program
git clone https://git.in0rdr.ch/diary.git
Log | Files | Refs | README | LICENSE

commit 3759eaa943fb36276b2463e945161d532760fb1f
parent 5a08084095e83538b916f3bb1ebde274e117b822
Author: Andreas Gruhler <agruhl@gmx.ch>
Date:   Wed,  2 Feb 2022 22:34:12 +0100

#6 hide msg from stdout

Diffstat:
Msrc/caldav.c | 20++++++++++----------
Msrc/utils.c | 4++--
2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/caldav.c b/src/caldav.c @@ -101,7 +101,7 @@ char* read_tokenfile() { token_buf[token_bytes] = '\0'; char* new_access_token = extract_json_value(token_buf, "access_token", true); - fprintf(stderr, "Info - New access token: %s\n", new_access_token); + //fprintf(stderr, "Info - New access token: %s\n", new_access_token); if (new_access_token != NULL) { strncpy(access_token, new_access_token, 200); free(new_access_token); @@ -516,7 +516,7 @@ void put_event(struct tm* date, const char* dir, size_t dir_size, char* calendar fpath(dir, dir_size, date, &ppath, sizeof path); if (ppath == NULL) { - fprintf(stderr, "Error while retrieving file path for diary reading"); + fprintf(stderr, "Error retrieving file path for diary reading"); return; } @@ -628,7 +628,7 @@ int caldav_sync(struct tm* date, char* user_principal = caldav_req(date, GOOGLE_CALDAV_URI, "PROPFIND", principal_postfields, 0); if (user_principal == NULL) { - fprintf(stderr, "Info - Unable to fetch principal, refreshing API token.\n"); + //fprintf(stderr, "Info - Unable to fetch principal, refreshing API token.\n"); // The principal could not be fetched, // get new acess token with refresh token get_access_token(NULL, NULL, true); @@ -740,17 +740,17 @@ int caldav_sync(struct tm* date, remote_date = mktime(remote_datetime); - fprintf(stderr, "Info - remote last mod: %s\n", ctime(&remote_date)); - fprintf(stderr, "Info - local last mod: %s\n", ctime(&localfile_date)); + //fprintf(stderr, "Info - remote last mod: %s\n", ctime(&remote_date)); + //fprintf(stderr, "Info - local last mod: %s\n", ctime(&localfile_date)); double timediff = difftime(localfile_date, remote_date); - fprintf(stderr, "Info - Time diff between local and remote mod time:%e\n", timediff); + //fprintf(stderr, "Info - Time diff between local and remote mod time:%e\n", timediff); char* rmt_desc; char dstr[16]; int conf_ch = 0; if (timediff == 0) { - fprintf(stderr, "Warning - local and remote files have equal timestamp or don't exist, giving up.\n"); + //fprintf(stderr, "Warning - local and remote files have equal timestamp or don't exist, giving up.\n"); pthread_cancel(progress_tid); wclear(header); // free memory allocated to store curl response @@ -759,13 +759,13 @@ int caldav_sync(struct tm* date, free(home_set); return 0; } else if (timediff > 0) { - fputs("Info - Local file is newer. Uploading to remote.\n", stderr); + //fputs("Info - Local file is newer. Uploading to remote.\n", stderr); if (remote_uid) { // purge any existing daily calendar entries on the remote side char event_uri[300]; sprintf(event_uri, "%s%s%s.ics", GOOGLE_API_URI, calendar_href, remote_uid); - fprintf(stderr, "Info - DELETE Url: %s\n", event_uri); + //fprintf(stderr, "Info - DELETE Url: %s\n", event_uri); char* response = caldav_req(date, event_uri, "DELETE", NULL, 0); free(response); } @@ -803,7 +803,7 @@ int caldav_sync(struct tm* date, conf_ch = wgetch(header); if (conf_ch == 'y' || conf_ch == 'Y' || conf_ch == 'a' || conf_ch == '\n' || !confirm) { - fprintf(stderr, "Info - Remote file is newer. Extracting description from remote.\n"); + //fprintf(stderr, "Info - Remote file is newer. Extracting description from remote.\n"); // persist downloaded buffer to local file FILE* cursordate_file = fopen(path, "wb"); diff --git a/src/utils.c b/src/utils.c @@ -20,7 +20,7 @@ bool date_has_entry(const char* dir, size_t dir_size, const struct tm* i) { fpath(dir, dir_size, i, &pepath, sizeof epath); if (pepath == NULL) { - fprintf(stderr, "Error while retrieving file path for checking entry existence"); + fprintf(stderr, "Error retrieving file path for entry"); return false; } @@ -168,7 +168,7 @@ char* unfold(const char* str) { char* res = strtok(strcp, "\n"); if (res == NULL) { - fprintf(stderr, "No more lines in multiline string, stop unfolding.\n"); + //fprintf(stderr, "No more lines in multiline string, stop unfolding.\n"); free(strcp); return NULL; }