Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor e-command argument code #44

Open
wants to merge 42 commits into
base: master
Choose a base branch
from

Conversation

tcunha
Copy link
Contributor

@tcunha tcunha commented Jun 6, 2013

No description provided.

Tiago Cunha added 30 commits February 21, 2013 12:35
Just use / in this specific case which might already happen if the
user's home directory is blank in the passwd(5) file.
More to come. Namely, error context which changes throughout the program
(ie output to either stderr or to the command/status window) and
consolidating the debug code, as well.
Specific "modules" should include what they really need and not rely on
some other header including files.

Obviously, now, headers need to be explicitly included.
Might be better, in the future, to append -Wformat=2 to CFLAGS and also
use the printf format attribute.
Which, in my opinion, is a good thing because, as a consequence, there's
less pre-processor goo in the tree.
From now on, there's no need to specify the relative path of local
header files.
It might generate a SIGSEGV exception if it's accessed.
Caught by the new wrapper function.
Now, with error contexts, the execute function can, also, be called when
parsing the configuration file, without having to worry about where to
output its messages.

That is, when parsing the configuration file, the messages are printed to
standard error and, afterwards, they get painted to the command/status
window.
The fparseln(3) function already returns NULL on EOF. Check it and move
the ferror(3) call outside the loop.
It already gets printed by the error functions.
Tiago Cunha added 12 commits June 1, 2013 18:54
Not used, yet. However, it will allow to get rid of the e-command parse
function. All e-commands (when applicable), will then use the generic
parse function and the to be added arguments functions to check options
and retrieve values.

Idea taken from tmux.
This uses the red-black tree implementation from OpenBSD. Other data
structures should probably be converted in the future, accordingly,
instead of rolling our own and sticking only to arrays.

Not working for other operating systems, yet.
From now on, when implementing a new e-command, there's no need to
duplicate code (ie call getopt, set flags and values). It's just a
matter of calling the arguments functions.
On other operating systems, the local tree.h file is included. Not
tested, though. The compat code probably needs some rework.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant