summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-08-18Merge branch 'refactor-config-common'HEADmasterAaron Ball
2021-08-18Update copyright datesAaron Ball
2021-08-18Refactor common note searchingAaron Ball
This replaces the custom "str contains str [insensitive|sensitive]" functions with the standard `strstr` and `strcasestr` (removing over 100 lines of code). This also replaces the custom basename function in common with the standard basename in libgen.h.
2021-08-18note_list: fix compilation warningsAaron Ball
Possible buffer overflow with sprintf and fullpath.
2021-08-18Completely rewrite config.c and config.hAaron Ball
:facepalm: :facepalm: :facepalm: This replaces the old scalable vector config methodology with a simple struct, since a vector was wildly overpowered and complex for something that needs to track three possible config values. Now there is a struct config, which contains three char arrays: notepath, editor, and extension. The config code has been completely rewritten to be more stable and handle config reading better. To support this, this also adds a trim function to common.c/h to clean up config values read in. Finally, this also completely removes the itoc and get_current_date_time common functions, as they were not used at all and contributed over 100 lines of code to do something that should be done in 10 lines or less.
2017-01-05sample.conf:Updated syntax to match what's loadedAaron Ball
The conf syntax was updated a while back but the sample config wasn't (oops).
2017-01-05Added detection for non-existent note directoryAaron Ball
Was segfaulting when note directory didn't exist. Now we just see a nice error message.
2017-01-03TODO: Updated and changed from markdown to asciidocAaron Ball
Added a few new Pending items as well as a couple to completed.
2017-01-03Converted README file from markdown to asciidocAaron Ball
2017-01-02Merge branch 'ls-date'Aaron Ball
2017-01-02Implementation of last-modified date sortAaron Ball
Added note_cpy, and note_date_cmp to facilitate this new functionality. the main list_notes function now uses qsort and the new note_date_cmp to sort based on last modified time.
2016-12-29Merge branch 'header_updates'Aaron Ball
Signed-off-by: Aaron Ball <nullspoon@oper.io>
2016-12-29Fixed license headersAaron Ball
They were all over the place. Unified the copyright years as well as the owner name and email address.
2016-12-29Merge branch 'list_refactor'Aaron Ball
Signed-off-by: Aaron Ball <nullspoon@oper.io>
2016-12-29Refactored note_list process and all related codeAaron Ball
The old note_list process used inefficient code design. It required all of the metadata for each note in the note list to be allocated and determined before any actions were taken. This was slow, inefficient, and could potentially have required an enormous amount of memory if enough notes were available. The new process uses the file descriptor stream concept from the glibc readdir function. This enables easy traversal of the note list without having to store the entire list in memory (we only need to store the current note metadata). Also removed all occurences of "Schlemiel the painter algorithm" by replacing all occurences of strcpy/strcat/strcat/... in the note_list process with sprintf. Renamed the note_list_t type to note_list, note_t to note, and config_t to config. Moved note_edit function into common.h and renamed to file_edit, as this is a common function not specific to notes. Cleaned up old commented out code, including legacy c++ code (I can't believe this thing used to be written in c++).
2015-04-25More cleanup of the note_list structAaron Ball
2015-04-25Rewrote the innards of the config structAaron Ball
Previously, a nasty hybrid of stack variables in main() and heap variables in the config struct, chained together with a series of "if isset" statements, was being used to gather the config environment. This change allows everything to be stored in the config object in heap, using a simple set function which handles all of the "isset" logic in the config struct. Updated the main function to work with the new config method Cleaned up much commented out code Removed a few config-related errors Fixed the config free, as it was causing segfaults trying to free memory allocated in the stack
2015-03-31Implemented extension removal from list operationsAaron Ball
Was printing extensions, which are not required when interracting with the given note. This was a bit confusing, despite fuzzy name matching. This strips the extension from the file/note names when listening notes.
2015-03-22Fixed scenario where no commands specifiedAaron Ball
Was segfaulting because the argument count check (>1) was occuring much later than it should have.
2015-02-28Just removed additional newline on note searchAaron Ball
Nothing to see here. Move along... move along...
2015-02-26Trivial makefile cleanupAaron Ball
2015-02-26Added name set in note_new constructorAaron Ball
The note name was just an empty array. This causes the name to be set on instantiation.
2015-02-26Fixed basename functionAaron Ball
Was returning the path preceeding the basename (the basedir) rather than the actual base name.
2015-02-26Initial rewrite of find functionalityAaron Ball
This current version can perform case sensitive and case insensitive searches. On match, it outputs note friendly name, line number of match, and the line itself. Updated README with the new find command Updated main helptext output to include the find command again Cleaned up replaced c++ code Moved line matching code out of note files and into common since a line match is a generic operation
2015-02-25Removed main cat_noteAaron Ball
This was replaced by the note_cat function. Also added some more comments.
2015-02-25Removed find command from READMEAaron Ball
This isn't completely implemented yet in the c refactor.
2015-02-25Implemented noteless rm commandAaron Ball
Now we can remove notes. Outputs proper status messages when file could not be deleted, when it doesn't exist for deletion, and when the deletion was successful.
2015-02-25Fixed various valgrind complaintsAaron Ball
Fixed a few buffer overflow problems where enough space for the trailing \0 in a char array wasn't accounted for in the malloc statement. Also fixed some initialization problems with variable length arrays. Created the config_line_len global variable for this one so it can remain "variable" while being static (we don't have to hunt down 10 different instances of the value when we want to change it).
2015-02-25Reimplemented create/new note functionalityAaron Ball
Now we can create new notes. Notifies user if note already exists and exists with failure status code.
2015-02-25Changed note_list note names to include extensionsAaron Ball
Was storing the filename sans extension and period. That was however making path construction for accessing actual note files fairly complex (strlen(path) + strlen(note name) + strlen(extension) + path_delim_space);). This way, rather than needing to always append the extension, we will just strip the extension off when needed - a situation that occures much less frequently.
2015-02-25Cleanup from previous commit (note_cat)Aaron Ball
Removed commented out c++. Added more comments to note_cat function for better documentation.
2015-02-25Finished porting most of the cat functionalityAaron Ball
Now we can cat notes. Still needs a little work on error messages when a note doesn't exist (currently just exits with an error code).
2015-02-24Added support for "cmd not found searching notes"Aaron Ball
When a command is given to noteless and it doesn't match any commands, a fuzzy search through the note names is now performed. If one of the note names matches the "unknown command" argument, the note is opened for editing. This is effectively the default behavior (edit) if a command is not specified.
2015-02-24Fixed bug in edit name matchAaron Ball
Was using argument for note name once a match had been found, rather than calling the returned id on the note name fuzzy search. That was causing it to open notes that didn't exist for editing rather than performing a partial match on the name and opening the intended note.
2015-02-24Refactor of "edit" functionalityAaron Ball
This one begins the refactoring of the note struct and related functions Updated note_list functions to work with the new note struct Refactored note edit, note_list get note id function More c++ cleanup work done Updated function comments for afforementioned functions
2015-02-23Wrote lots of common functionsAaron Ball
Wrote get_current_date_time function Wrote get_extension function Wrote basename function
2015-02-23Increased efficacy of itoc int to char conversionAaron Ball
Was using a series of if statements. This changes the operation so it just adds 48 to the integer's given mod to get the ascii index of its corresponding char.
2015-02-23Wrote itoc common functionAaron Ball
This function converts an integer to its char array equivelant.
2015-02-21Config change keys and values calloc to mallocAaron Ball
Malloc should use less compute power than calloc, plus calloc is unecessary in this case since we don't require the memory segement to be empty.
2015-02-21Changed get_help function to void returnAaron Ball
2015-02-21Enabled help commandAaron Ball
2015-02-21Initial refactor of note_list to cAaron Ball
This version currently supports the ls,list command. Commented out the c++ code that hasn't been refactored yet in note_list.
2015-02-20Just c++ cleanup from previous commitAaron Ball
2015-02-20Implemented config parsingAaron Ball
Created config struct and complimentary functions. Can check if a config variable is set and can get values along with a variable count. Also successfully handles blank (or empty) lines as well as lines that are commented out and lines that have inline comments. Updated main calls to old c++ config class to work with the new c struct and related functions. Moved get_user_editor function into common.c and created appropriate header file.
2015-02-16Rewrite of MakefileAaron Ball
Add warnings, c standard variable (set to 99), and updated library source paths. Also made compiler a variable for later autodetection.
2015-02-16Initial renaming commit for refactor from c++ to cAaron Ball
This is the first commit in a long line, for converting from c++ to c. This particular change will fail compiling as all of the code is still c++. This is just a rename.
2014-10-07Added unknown command or note name return 1Nullspoon
Was returning 0 when failing to find note or command. Definitely note a success scenario and not good for programatically interfacing via scripts.
2014-09-30Implemented rm commandNullspoon
Can delete notes now by name. Updated help text and README
2014-09-25Fixed out of bound exception on no argumentsNullspoon
When checking for the first argument being init, we assumed that there was a first argument. Now checks for argument count being greater than 0 and prints the help text if it is not.
2014-09-11Updated the TODO fileNullspoon

Generated by cgit