Miscellanious todo

This commit is contained in:
Tomas Rivera
2026-04-18 14:22:07 +02:00
parent 34b5e67eff
commit 2c77e26b61
2 changed files with 5 additions and 11 deletions
+4 -7
View File
@@ -245,8 +245,6 @@ arg_next:
//---------------------------------------------------------------------------------------------
// flags and arguments overwrite the config
// (TODO LATER) maybe add a way to combine flags (such which rm -fr?)
// (TODO LATER) add a version flag
debug("Parsing the attribute flags.\n This flags might overwrite the options in the config file.");
// thoses bypasses are used if some specific flags are passed as args. This allows to bypass the TUI selectors
int bypassSelectionVault = 0;
@@ -310,7 +308,7 @@ for (int i = 1; i < argc; i++) {
return 0;
} else if (strcmp(arg, "--version") == 0) {
printf("No released version yet...\n");
printf("NoteWrapper version 1.0\n");
return 0;
} else {
@@ -499,7 +497,6 @@ note_selection:
}
filesCount = filesCount + journalCount;
// we sort them // (TODO LATER) THis doesn't seem to sort them
qsort(filesArray, filesCount, sizeof(const char *), compareString);
debug("Available notes and journals:");
if (shouldDebug) {
@@ -540,8 +537,8 @@ note_selection:
if (strcmp(noteSelected, "Create new note") != 0 && strcmp(noteSelected,"Back to vault selection") != 0 && strcmp(noteSelected, "Delete vault") != 0 && strcmp(noteSelected,"Quit (Ctrl+C)") != 0) {
open_note:
bypassSelectionNote = 0; // we must reset bypassSelectionNote to avoid getting into an infinite loop of bypassing the note selection
char *fullPath = malloc(PATH_MAX); // (TODO LATER) Find a more appropriate and descriptive name for the variable
sprintf(fullPath, "%s/%s/%s", notesDirectoryString, vaultSelected, noteSelected); // (TODO LATER) change all sprintf to snprintf which checks for buffer size
char *fullPath = malloc(PATH_MAX);
snprintf(fullPath, PATH_MAX, "%s/%s/%s", notesDirectoryString, vaultSelected, noteSelected);
// if it is a journal we must update it before
regex_t regex;
int regexReturn = regcomp(&regex, journalRegex, 0);
@@ -570,7 +567,7 @@ note_creation:
if (strcmp(answer, "Yes.") == 0) {
// delete the vault after confirmation by the user
char pathToRMRF[PATH_MAX];
sprintf(pathToRMRF, "%s/%s", notesDirectoryString, vaultSelected);
snprintf(pathToRMRF, PATH_MAX, "%s/%s", notesDirectoryString, vaultSelected);
debug("Removed the directory: %s", pathToRMRF);
rmrf(pathToRMRF, shouldDebug);
shouldChangeVault = 1;
-3
View File
@@ -129,8 +129,6 @@ char **getVaultsFromDirectory(char *dirString, int *count, int shouldDebug) {
}
char *updateJournal(char *path, char *journal, char *timeFormat, int shouldDebug) {
//(TODO LATER) Per journal format configuration
// (TODO LATER) with all the usage of PATH_MAX we should really calculate max inputed path or something like this
path[PATH_MAX] = '\0'; // it assures it is a string (Most cases this does nothing). But rewriting at least one bytes make the compile happy. He doesn't want to return an unchanged input.
debug("Handling the journal %s", path);
@@ -233,7 +231,6 @@ char *updateJournal(char *path, char *journal, char *timeFormat, int shouldDebug
strncpy(path, temp, PATH_MAX);
debug("Returning path to the selected entry: %s", path);
}
// (TODO LATER) free all unused entryArray[i]
} else {
error(1, "program", "%s is not a file and not a directory.", path);
}