Age | Commit message (Collapse) | Author |
|
|
|
|
|
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.
|
|
Possible buffer overflow with sprintf and fullpath.
|
|
: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.
|
|
The conf syntax was updated a while back but the sample config wasn't
(oops).
|
|
Was segfaulting when note directory didn't exist. Now we just see a nice
error message.
|
|
Added a few new Pending items as well as a couple to completed.
|
|
|
|
|
|
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.
|
|
Signed-off-by: Aaron Ball <nullspoon@oper.io>
|
|
They were all over the place. Unified the copyright years as well as the
owner name and email address.
|
|
Signed-off-by: Aaron Ball <nullspoon@oper.io>
|
|
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++).
|
|
|
|
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
|
|
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.
|
|
Was segfaulting because the argument count check (>1) was occuring much later
than it should have.
|
|
Nothing to see here. Move along... move along...
|
|
|
|
The note name was just an empty array. This causes the name to be set on
instantiation.
|
|
Was returning the path preceeding the basename (the basedir) rather than the
actual base name.
|
|
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
|
|
This was replaced by the note_cat function.
Also added some more comments.
|
|
This isn't completely implemented yet in the c refactor.
|
|
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.
|
|
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).
|
|
Now we can create new notes. Notifies user if note already exists and exists
with failure status code.
|
|
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.
|
|
Removed commented out c++. Added more comments to note_cat function for better
documentation.
|
|
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).
|
|
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.
|
|
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.
|
|
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
|
|
Wrote get_current_date_time function
Wrote get_extension function
Wrote basename function
|
|
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.
|
|
This function converts an integer to its char array equivelant.
|
|
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.
|
|
|
|
|
|
This version currently supports the ls,list command.
Commented out the c++ code that hasn't been refactored yet in note_list.
|
|
|
|
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.
|
|
Add warnings, c standard variable (set to 99), and updated library source
paths. Also made compiler a variable for later autodetection.
|
|
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.
|
|
Was returning 0 when failing to find note or command. Definitely note a success
scenario and not good for programatically interfacing via scripts.
|
|
Can delete notes now by name.
Updated help text and README
|
|
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.
|
|
|