Conversation
README.md
Outdated
| Usage | ||
| ----- | ||
| $ xcape [-d] [-f] [-t <timeout ms>] [-e <map-expression>] | ||
| $ xcape [file ...] [-d] [-f] [-t <timeout ms>] [-e <map-expression>] |
There was a problem hiding this comment.
I would prefer if we used an option prefix. Since -f is taken I suggest using -F. And an additional -F for every extra file.
There was a problem hiding this comment.
Another idea is to use -c for "config"
xcape.c
Outdated
| { | ||
| size_t cap = 1024; | ||
| size_t nlen = 0; | ||
| char *line = realloc (NULL, cap*sizeof(char)); |
There was a problem hiding this comment.
Woops! I'll fix that right away.
xcape.c
Outdated
| { | ||
| break; | ||
| } | ||
| current = &(*current)->next; |
There was a problem hiding this comment.
isn't this the same as current = current->next; ?
There was a problem hiding this comment.
Not quite, since current is a double pointer, and -> only works on one level of indirection.
There was a problem hiding this comment.
I see. Could you please add some parenthesis to make it clearer.
|
This is great, not sure about reading from stdin though. I really don't see why anyone would want do that. It just adds confusion IMHO. "Do I use the -e option or stdin?" |
|
The idea with that was to allow people to pipe in keymaps. I don't personally see it as confusing, but if I compare it to something like |
|
Awesome! Thanks for you contribution :) |
|
I have updated all the necessary components and revised the man file and README. How does it look? |
|
Very nice mod. I'm looking forward to use it. Reading the code I might have found some problems:
|
|
The |
|
You've got to be brave to process text (files) in C. At the end it's up to you or alols to decide which char(s) will be used for comments (suspects: I'd use a single char because parsing is easier and editing is faster. Line 648 lacks |
|
I've added the |
|
The C standard does say that |
|
Even if that is true, it speaks to what the memory is being used for. I'll consider removing it if it's deemed more confusing. Thanks for letting me know, though. |
|
I think |
|
Reading other's code is interesting because I learn a lot this way (methods, libs,...). By making some test futher issues were found:
|
|
Just want to make sure: is this library C89 compliant? If so, should we add it to the makefile? |
|
The idea for handling \r was to allow \r\n files. I'll remove it and fix the empty line issue. |
This pull request references issue #74, adding configuration file support.
Configuration Files
Configuration files follow the same syntax as regular map expressions, except instead of using
;to indicate the end of an expression we use newlines, restricting it to one expression per line. Blank lines and lines starting with#are ignored. One catch to the parsing used is that the line must start with a#or whitespace to be recognized as a comment, and the#syntax cannot be used later in a line. This is an area of possible improvement moving forwards.Argument Parsing Changes
A new argument
[file ...]has been added, and has the following semantics:-used for standard input