diff options
author | bptato <nincsnevem662@gmail.com> | 2024-05-22 16:43:58 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-05-22 16:43:58 +0200 |
commit | 3ec6c18c81853b52ff9dbc9ecccc890a9534322c (patch) | |
tree | 64c52f27094f34a066a91d951042648e86ae62fd /adapter/protocol/man.nim | |
parent | a42a60c2647b4193661986f89b6405199802ab32 (diff) | |
download | chawan-3ec6c18c81853b52ff9dbc9ecccc890a9534322c.tar.gz |
man: quote keyword & section
Diffstat (limited to 'adapter/protocol/man.nim')
-rw-r--r-- | adapter/protocol/man.nim | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/adapter/protocol/man.nim b/adapter/protocol/man.nim index 6a6acf04..a5b7dab9 100644 --- a/adapter/protocol/man.nim +++ b/adapter/protocol/man.nim @@ -275,9 +275,9 @@ proc myOpen(cmd: string): tuple[ofile, efile: File] = return (ofile, efile) proc doMan(man, keyword, section: string) = - let sectionOpt = if section == "": "" else: ' ' & section + let sectionOpt = if section == "": "" else: ' ' & quoteShellPosix(section) let cmd = "MANCOLOR=1 GROFF_NO_SGR=1 MAN_KEEP_FORMATTING=1 " & - man & sectionOpt & ' ' & keyword + man & sectionOpt & ' ' & quoteShellPosix(keyword) let (ofile, efile) = myOpen(cmd) if ofile == nil: stdout.write("Cha-Control: ConnectionError 1 failed to run " & cmd) @@ -294,7 +294,7 @@ proc doLocal(man, path: string) = # Note: we intentionally do not use -l, because it is not supported on # various systems (at the very least FreeBSD, NetBSD). let cmd = "MANCOLOR=1 GROFF_NO_SGR=1 MAN_KEEP_FORMATTING=1 " & - man & ' ' & path + man & ' ' & quoteShellPosix(path) let (ofile, efile) = myOpen(cmd) if ofile == nil: stdout.write("Cha-Control: ConnectionError 1 failed to run " & cmd) @@ -305,8 +305,8 @@ proc doLocal(man, path: string) = <pre>""", keyword = path.afterLast('/').until('.')) proc doKeyword(man, keyword, section: string) = - let sectionOpt = if section == "": "" else: " -s " & section - let cmd = man & sectionOpt & " -k " & keyword + let sectionOpt = if section == "": "" else: " -s " & quoteShellPosix(section) + let cmd = man & sectionOpt & " -k " & quoteShellPosix(keyword) let (ofile, efile) = myOpen(cmd) if ofile == nil: stdout.write("Cha-Control: ConnectionError 1 failed to run " & cmd) |