-
Notifications
You must be signed in to change notification settings - Fork 629
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
main: quote output file name before passing it to system(3) function
Following command line doesn't work: $ ctags -o 'a b' ... because a shell lauched from system(3) deals a whitespace between 'a' and 'b' as a separator. The output file name is passed to system(3) to run external sort command. This commit adds code to put double and single quoets around the output file name before passing it to system(3). The issue is reported by Lorenz Hipp <[email protected]> in a private mail. Signed-off-by: Masatake YAMATO <[email protected]>
- Loading branch information
Showing
5 changed files
with
102 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
int x; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Copyright: 2016 Masatake YAMATO | ||
# License: GPL-2 | ||
|
||
CTAGS=$1 | ||
|
||
rm -f ./"'" | ||
rm -f ./'"' | ||
rm -f ./'$(ls)' | ||
rm -f ./'a b' | ||
|
||
${CTAGS} --quiet --options=NONE -o ./"'" --extra=-pF input.c | ||
${CTAGS} --quiet --options=NONE -o ./'"' --extra=-pF input.c | ||
${CTAGS} --quiet --options=NONE -o ./'$(ls)' --extra=-pF input.c | ||
${CTAGS} --quiet --options=NONE -o ./'a b' --extra=-pF input.c | ||
|
||
echo '#' SINGLE QUOTE | ||
if [ -e "'" ]; then | ||
cat "'" | ||
fi | ||
|
||
echo '#' DOUBLE QUOTES | ||
if [ -e '"' ]; then | ||
cat '"' | ||
fi | ||
|
||
echo '#' PROCESS SUBSTITUTION | ||
if [ -e '$(ls)' ]; then | ||
cat '$(ls)' | ||
fi | ||
|
||
echo '#' SPACE | ||
if [ -e 'a b' ]; then | ||
cat 'a b' | ||
fi | ||
|
||
rm -f ./"'" | ||
rm -f ./'"' | ||
rm -f ./'$(ls)' | ||
rm -f ./'a b' |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# SINGLE QUOTE | ||
x input.c /^int x;$/;" v typeref:typename:int | ||
# DOUBLE QUOTES | ||
x input.c /^int x;$/;" v typeref:typename:int | ||
# PROCESS SUBSTITUTION | ||
x input.c /^int x;$/;" v typeref:typename:int | ||
# SPACE | ||
x input.c /^int x;$/;" v typeref:typename:int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters