hirc

IRC client
Log | Files | Refs

commit d7ca250a7b4296e750a070aa96949c6953a3219c
parent 07a539d5d1a308b329311a8fa0f2f088e936c374
Author: hhvn <dev@hhvn.uk>
Date:   Sat, 12 Mar 2022 18:47:54 +0000

Escapable options via command_getopt

Diffstat:
Mhirc.1.footer | 3+++
Msrc/commands.c | 5++++-
2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/hirc.1.footer b/hirc.1.footer @@ -1,4 +1,7 @@ .\" vim: set syntax=nroff : +.Pp +Note: to escape options, place a backstroke ("\\") before the dash ("-"). +All options following will also be escaped. .Sh EXAMPLES .Ss Commands .Dl /set def.nick hhvn diff --git a/src/commands.c b/src/commands.c @@ -1814,8 +1814,11 @@ int command_getopt(char **str, struct CommandOpts *opts) { char *opt; - if (!str || !*str || **str != '-') + if (!str || !*str || **str != '-') { + if (**str == '\\' && *((*str)+1) == '-') + (*str)++; return opt_done; + } opt = struntil((*str)+1, ' ');