Add some command line options.

- delimiter choice
- compatibility with fzf
This commit is contained in:
Érico Nogueira 2022-08-12 13:37:31 -03:00
parent cbb98853d1
commit 8f38a81690
1 changed files with 17 additions and 2 deletions

19
ef.c
View File

@ -35,11 +35,26 @@ static void signal_handler(int signum)
write(signal_pipe[1], &signum, sizeof signum);
}
int main()
int main(int argc, char **argv)
{
setlocale(LC_ALL, "");
const char delim = '\n';
char delim = '\n';
int opt;
while ((opt = getopt(argc, argv, "01")) != -1) {
switch (opt) {
case '0':
/* set delimiter to NUL char instead of newline */
delim = '\0';
break;
case '1':
/* ignored for compatibility with fzf */
break;
default:
exit(1);
}
}
if (pipe(signal_pipe)) {
perror("pipe");