dirname has two main problems:
1. It could change in place the string that is passed to it.
2. It uses a static string for its return value, so one should copy it
somewhere else as soon as possible to avoid subsequent calls to
dirname to corrupt his data (see #48).
We avoid 1. passing a copy of `path` to dirname and 2. copying it's
return value into `dname`.
My compiler barks about this unitialized variable:
CC src/gmnlm.o
src/gmnlm.c:629:7: error: variable 'result' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
if (res != GEMINI_OK) {
^~~~~~~~~~~~~~~~
src/gmnlm.c:673:9: note: uninitialized use occurs here
return result;
^~~~~~
src/gmnlm.c:629:3: note: remove the 'if' if its condition is always false
if (res != GEMINI_OK) {
^~~~~~~~~~~~~~~~~~~~~~~
src/gmnlm.c:482:2: note: variable 'result' is declared here
enum prompt_result result;
^
1 error generated.
make: *** [src/gmnlm.o] Error 1
This reverts commit 963700d8d6e31aecfc14e12184637f4c3360f6ed.
Let's make the p command consistent with the others and tell users who
want to navigate to a relative URL unambiguosly to use ./page
The rest of gmni's stuff will remain in ~/.local/share/gmni, but in
order to establish a common location and format for the TOFU file
between Gemini implementations, a more general path is required.
The return value of set_url() was not checked, meaning that when it
failed, gmnlm continued anyway, causing an assertion to fail and
subsequentially resulting in a segfault.
This adds a command, 'H', to view all the URLs in the page history. It
first prints backward URLs, then the current URL (marked with an
asterisk), followed by forward URLs.