mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 04:13:08 +00:00
Merge branch 'master' into iwyu
This commit is contained in:
commit
3929e9de0e
113 changed files with 734 additions and 762 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -39,4 +39,5 @@ messages.pot
|
||||||
lexicon.txt
|
lexicon.txt
|
||||||
lexicon_filter
|
lexicon_filter
|
||||||
lexicon.log
|
lexicon.log
|
||||||
|
DerivedData/
|
||||||
|
|
||||||
|
|
418
Makefile.in
418
Makefile.in
|
@ -54,7 +54,7 @@ localedir = @localedir@
|
||||||
#
|
#
|
||||||
|
|
||||||
MACROS = -DLOCALEDIR=\"$(localedir)\" -DPREFIX=L\"$(prefix)\" -DDATADIR=L\"$(datadir)\" -DSYSCONFDIR=L\"$(sysconfdir)\" -DBINDIR=L\"$(bindir)\" -DDOCDIR=L\"$(docdir)\"
|
MACROS = -DLOCALEDIR=\"$(localedir)\" -DPREFIX=L\"$(prefix)\" -DDATADIR=L\"$(datadir)\" -DSYSCONFDIR=L\"$(sysconfdir)\" -DBINDIR=L\"$(bindir)\" -DDOCDIR=L\"$(docdir)\"
|
||||||
CXXFLAGS = @CXXFLAGS@ $(MACROS) $(EXTRA_CXXFLAGS)
|
CXXFLAGS = @CXXFLAGS@ -iquote. -iquote./src/ $(MACROS) $(EXTRA_CXXFLAGS)
|
||||||
CPPFLAGS = @CPPFLAGS@
|
CPPFLAGS = @CPPFLAGS@
|
||||||
LDFLAGS = @LDFLAGS@
|
LDFLAGS = @LDFLAGS@
|
||||||
LIBS = @LIBS@
|
LIBS = @LIBS@
|
||||||
|
@ -72,43 +72,46 @@ HAVE_GETTEXT=@HAVE_GETTEXT@
|
||||||
|
|
||||||
HAVE_DOXYGEN=@HAVE_DOXYGEN@
|
HAVE_DOXYGEN=@HAVE_DOXYGEN@
|
||||||
|
|
||||||
#
|
|
||||||
#Additional .cpp files used by common.o. These also have a corresponding
|
|
||||||
#.h file.
|
|
||||||
#
|
|
||||||
|
|
||||||
COMMON_FILES := util.cpp fallback.cpp
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# All objects that the system needs to build fish, except fish.o
|
# All objects that the system needs to build fish, except fish.o
|
||||||
#
|
#
|
||||||
|
|
||||||
FISH_OBJS := function.o builtin.o complete.o env.o exec.o expand.o \
|
FISH_OBJS := obj/function.o obj/builtin.o obj/complete.o obj/env.o obj/exec.o \
|
||||||
highlight.o history.o kill.o parser.o proc.o reader.o sanity.o \
|
obj/expand.o obj/highlight.o obj/history.o obj/kill.o obj/parser.o \
|
||||||
tokenizer.o wildcard.o wgetopt.o wutil.o input.o output.o intern.o \
|
obj/proc.o obj/reader.o obj/sanity.o obj/tokenizer.o obj/wildcard.o \
|
||||||
env_universal_common.o input_common.o event.o \
|
obj/wgetopt.o obj/wutil.o obj/input.o obj/output.o obj/intern.o \
|
||||||
signal.o io.o parse_util.o common.o screen.o path.o autoload.o \
|
obj/env_universal_common.o obj/input_common.o obj/event.o obj/signal.o \
|
||||||
parser_keywords.o iothread.o color.o postfork.o \
|
obj/io.o obj/parse_util.o obj/common.o obj/screen.o obj/path.o \
|
||||||
builtin_test.o parse_tree.o parse_productions.o parse_execution.o \
|
obj/autoload.o obj/parser_keywords.o obj/iothread.o obj/color.o \
|
||||||
pager.o utf8.o fish_version.o wcstringutil.o
|
obj/postfork.o obj/builtin_test.o obj/parse_tree.o obj/parse_productions.o \
|
||||||
|
obj/parse_execution.o obj/pager.o obj/utf8.o obj/fish_version.o \
|
||||||
|
obj/wcstringutil.o
|
||||||
|
|
||||||
FISH_INDENT_OBJS := fish_indent.o print_help.o $(FISH_OBJS)
|
FISH_INDENT_OBJS := obj/fish_indent.o obj/print_help.o $(FISH_OBJS)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Additional files used by builtin.o
|
# Additional files used by builtin.o
|
||||||
#
|
#
|
||||||
|
|
||||||
BUILTIN_FILES := builtin_set.cpp builtin_commandline.cpp \
|
BUILTIN_FILES := src/builtin_set.cpp src/builtin_commandline.cpp \
|
||||||
builtin_ulimit.cpp builtin_complete.cpp builtin_jobs.cpp \
|
src/builtin_ulimit.cpp src/builtin_complete.cpp \
|
||||||
builtin_set_color.cpp builtin_printf.cpp
|
src/builtin_jobs.cpp src/builtin_set_color.cpp \
|
||||||
|
src/builtin_printf.cpp
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# All objects that the system needs to build fish_tests
|
# All objects that the system needs to build fish_tests
|
||||||
#
|
#
|
||||||
|
|
||||||
FISH_TESTS_OBJS := $(FISH_OBJS) fish_tests.o
|
FISH_TESTS_OBJS := $(FISH_OBJS) obj/fish_tests.o
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# All of the sources that produce object files
|
||||||
|
# (that is, are not themselves #included in other source files)
|
||||||
|
#
|
||||||
|
FISH_ALL_OBJS := $(sort $(FISH_OBJS) $(FISH_INDENT_OBJS) $(FISH_TESTS_OBJS) \
|
||||||
|
obj/fish.o obj/key_reader.o)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -218,7 +221,7 @@ all: $(PROGRAMS) $(user_doc) $(share_man) $(TRANSLATIONS) fish.pc
|
||||||
FISH-BUILD-VERSION-FILE: FORCE
|
FISH-BUILD-VERSION-FILE: FORCE
|
||||||
@./build_tools/git_version_gen.sh
|
@./build_tools/git_version_gen.sh
|
||||||
-include FISH-BUILD-VERSION-FILE
|
-include FISH-BUILD-VERSION-FILE
|
||||||
CPPFLAGS += -DFISH_BUILD_VERSION=\"$(FISH_BUILD_VERSION)\"
|
CXXFLAGS += -DFISH_BUILD_VERSION=\"$(FISH_BUILD_VERSION)\"
|
||||||
.PHONY: FORCE
|
.PHONY: FORCE
|
||||||
fish_version.o: FISH-BUILD-VERSION-FILE
|
fish_version.o: FISH-BUILD-VERSION-FILE
|
||||||
|
|
||||||
|
@ -263,7 +266,7 @@ user_doc: $(HDR_FILES_SRC) Doxyfile.user $(HTML_SRC) $(HELP_SRC) doc.h $(HDR_FIL
|
||||||
# Source code documentation. Also includes user documentation.
|
# Source code documentation. Also includes user documentation.
|
||||||
#
|
#
|
||||||
|
|
||||||
doc: *.h *.cpp doc.h Doxyfile lexicon_filter
|
doc: src/*.h src/*.cpp doc.h Doxyfile lexicon_filter
|
||||||
(cat Doxyfile; echo INPUT_FILTER=./lexicon_filter; echo PROJECT_NUMBER=$(FISH_BUILD_VERSION)) | doxygen - ;
|
(cat Doxyfile; echo INPUT_FILTER=./lexicon_filter; echo PROJECT_NUMBER=$(FISH_BUILD_VERSION)) | doxygen - ;
|
||||||
|
|
||||||
|
|
||||||
|
@ -465,14 +468,12 @@ doc.h: $(HDR_FILES)
|
||||||
# Create a template translation object
|
# Create a template translation object
|
||||||
#
|
#
|
||||||
|
|
||||||
messages.pot: *.cpp *.h share/completions/*.fish share/functions/*.fish
|
messages.pot: src/*.cpp src/*.h share/completions/*.fish share/functions/*.fish
|
||||||
xgettext -k_ -kN_ *.cpp *.h -o messages.pot
|
xgettext -k_ -kN_ src/*.cpp src/*.h -o messages.pot
|
||||||
xgettext -j -k_ -kN_ -k--description -LShell --from-code=UTF-8 share/completions/*.fish share/functions/*.fish -o messages.pot
|
xgettext -j -k_ -kN_ -k--description -LShell --from-code=UTF-8 share/completions/*.fish share/functions/*.fish -o messages.pot
|
||||||
|
|
||||||
builtin.o: $(BUILTIN_FILES)
|
builtin.o: $(BUILTIN_FILES)
|
||||||
|
|
||||||
common.o: $(COMMON_FILES)
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Generate the internal help functions by making doxygen create
|
# Generate the internal help functions by making doxygen create
|
||||||
|
@ -761,12 +762,24 @@ uninstall-translations:
|
||||||
# The build rules for all the commands
|
# The build rules for all the commands
|
||||||
#
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# How basic files get compiled
|
||||||
|
#
|
||||||
|
obj/%.o: src/%.cpp | obj
|
||||||
|
$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
#
|
||||||
|
# obj directory
|
||||||
|
#
|
||||||
|
obj:
|
||||||
|
mkdir obj
|
||||||
|
|
||||||
#
|
#
|
||||||
# Build the fish program.
|
# Build the fish program.
|
||||||
#
|
#
|
||||||
|
|
||||||
fish: $(FISH_OBJS) fish.o
|
fish: $(FISH_OBJS) obj/fish.o
|
||||||
$(CXX) $(CXXFLAGS) $(LDFLAGS_FISH) $(FISH_OBJS) fish.o $(LIBS) -o $@
|
$(CXX) $(CXXFLAGS) $(LDFLAGS_FISH) $(FISH_OBJS) obj/fish.o $(LIBS) -o $@
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -795,12 +808,27 @@ key_reader: $(FISH_OBJS) key_reader.o
|
||||||
|
|
||||||
#
|
#
|
||||||
# Update dependencies
|
# Update dependencies
|
||||||
|
# Unfortunately makedepend cannot handle source files in one directory
|
||||||
|
# and object files in another. So we have to cons up a fake directory
|
||||||
|
# tree and run it there. Note that some .cpp files do not result in
|
||||||
|
# objects because they are #include'd directly. In that case we need to
|
||||||
|
# leave them in the 'header' directory, so they get picked up by the
|
||||||
|
# dependencies. So we put everything in the header directory and move out
|
||||||
|
# exactly the files that result in objects, leaving the #include'd files
|
||||||
|
# behind.
|
||||||
#
|
#
|
||||||
depend:
|
depend:
|
||||||
makedepend -fMakefile.in -Y *.cpp
|
mkdir -p /tmp/fish_make_depend/src
|
||||||
|
cp src/*.cpp src/*.h /tmp/fish_make_depend/src
|
||||||
|
cp config.h /tmp/fish_make_depend/
|
||||||
|
mv $(subst obj/,/tmp/fish_make_depend/src/,$(FISH_ALL_OBJS:.o=.cpp)) /tmp/fish_make_depend/
|
||||||
|
cd /tmp/fish_make_depend && \
|
||||||
|
makedepend -f$(CURDIR)/Makefile.in -pobj/ -Y -Isrc *.cpp
|
||||||
|
rm -Rf /tmp/fish_make_depend
|
||||||
./config.status
|
./config.status
|
||||||
.PHONY: depend
|
.PHONY: depend
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Cleanup targets
|
# Cleanup targets
|
||||||
#
|
#
|
||||||
|
@ -824,7 +852,7 @@ distclean: clean
|
||||||
# deleted we won't be able to regenerate them
|
# deleted we won't be able to regenerate them
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o doc.h doc.tmp doc_src/*.doxygen doc_src/*.cpp doc_src/*.o doc_src/commands.hdr
|
rm -f obj/*.o *.o doc.h doc.tmp doc_src/*.doxygen doc_src/*.cpp doc_src/*.o doc_src/commands.hdr
|
||||||
rm -f tests/tmp.err tests/tmp.out tests/tmp.status tests/foo.txt
|
rm -f tests/tmp.err tests/tmp.out tests/tmp.status tests/foo.txt
|
||||||
rm -f $(PROGRAMS) fish_tests key_reader
|
rm -f $(PROGRAMS) fish_tests key_reader
|
||||||
rm -f command_list.txt command_list_toc.txt toc.txt
|
rm -f command_list.txt command_list_toc.txt toc.txt
|
||||||
|
@ -835,151 +863,191 @@ clean:
|
||||||
rm -rf doc user_doc share/man; \
|
rm -rf doc user_doc share/man; \
|
||||||
fi
|
fi
|
||||||
rm -f po/*.gmo
|
rm -f po/*.gmo
|
||||||
|
rm -rf obj
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|
||||||
|
|
||||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||||
|
|
||||||
autoload.o: config.h autoload.h common.h fallback.h lru.h wutil.h signal.h
|
obj/autoload.o: config.h src/autoload.h src/common.h src/fallback.h
|
||||||
autoload.o: env.h exec.h
|
obj/autoload.o: src/signal.h src/lru.h src/wutil.h src/env.h src/exec.h
|
||||||
builtin.o: config.h signal.h fallback.h wutil.h common.h builtin.h io.h
|
obj/builtin.o: config.h src/signal.h src/fallback.h src/wutil.h src/common.h
|
||||||
builtin.o: function.h event.h env.h complete.h proc.h parse_tree.h
|
obj/builtin.o: src/builtin.h src/io.h src/function.h src/event.h src/env.h
|
||||||
builtin.o: tokenizer.h parse_constants.h parser.h reader.h highlight.h
|
obj/builtin.o: src/complete.h src/proc.h src/parse_tree.h src/tokenizer.h
|
||||||
builtin.o: color.h wgetopt.h input.h input_common.h intern.h exec.h
|
obj/builtin.o: src/parse_constants.h src/parser.h src/reader.h
|
||||||
builtin.o: parse_util.h parser_keywords.h expand.h path.h history.h
|
obj/builtin.o: src/highlight.h src/color.h src/wgetopt.h src/input.h
|
||||||
builtin.o: wcstringutil.h builtin_set.cpp util.h builtin_commandline.cpp
|
obj/builtin.o: src/input_common.h src/intern.h src/exec.h src/parse_util.h
|
||||||
builtin.o: builtin_complete.cpp builtin_ulimit.cpp builtin_jobs.cpp
|
obj/builtin.o: src/parser_keywords.h src/expand.h src/path.h src/history.h
|
||||||
builtin.o: builtin_set_color.cpp output.h builtin_printf.cpp
|
obj/builtin.o: src/wcstringutil.h src/builtin_set.cpp src/util.h
|
||||||
builtin_commandline.o: config.h signal.h fallback.h util.h wutil.h common.h
|
obj/builtin.o: src/builtin_commandline.cpp src/builtin_complete.cpp
|
||||||
builtin_commandline.o: builtin.h io.h wgetopt.h reader.h complete.h
|
obj/builtin.o: src/builtin_ulimit.cpp src/builtin_jobs.cpp
|
||||||
builtin_commandline.o: highlight.h env.h color.h parse_constants.h proc.h
|
obj/builtin.o: src/builtin_set_color.cpp src/output.h src/builtin_printf.cpp
|
||||||
builtin_commandline.o: parse_tree.h tokenizer.h parser.h event.h
|
obj/builtin_test.o: config.h src/common.h src/fallback.h src/signal.h
|
||||||
builtin_commandline.o: input_common.h input.h parse_util.h
|
obj/builtin_test.o: src/builtin.h src/io.h src/wutil.h src/proc.h
|
||||||
builtin_complete.o: config.h signal.h fallback.h util.h wutil.h common.h
|
obj/builtin_test.o: src/parse_tree.h src/tokenizer.h src/parse_constants.h
|
||||||
builtin_complete.o: builtin.h io.h complete.h wgetopt.h parser.h proc.h
|
obj/color.o: src/color.h src/common.h config.h src/fallback.h src/signal.h
|
||||||
builtin_complete.o: parse_tree.h tokenizer.h parse_constants.h event.h
|
obj/common.o: config.h src/signal.h src/fallback.h src/wutil.h src/common.h
|
||||||
builtin_complete.o: reader.h highlight.h env.h color.h
|
obj/common.o: src/expand.h src/parse_constants.h src/wildcard.h
|
||||||
builtin_jobs.o: config.h fallback.h util.h wutil.h common.h builtin.h io.h
|
obj/common.o: src/complete.h src/util.cpp src/util.h src/fallback.cpp
|
||||||
builtin_jobs.o: proc.h signal.h parse_tree.h tokenizer.h parse_constants.h
|
obj/complete.o: config.h src/fallback.h src/signal.h src/util.h
|
||||||
builtin_jobs.o: parser.h event.h wgetopt.h
|
obj/complete.o: src/wildcard.h src/common.h src/expand.h
|
||||||
builtin_printf.o: common.h config.h fallback.h
|
obj/complete.o: src/parse_constants.h src/complete.h src/proc.h src/io.h
|
||||||
builtin_set.o: config.h signal.h fallback.h util.h wutil.h common.h builtin.h
|
obj/complete.o: src/parse_tree.h src/tokenizer.h src/parser.h src/event.h
|
||||||
builtin_set.o: io.h env.h expand.h parse_constants.h wgetopt.h proc.h
|
obj/complete.o: src/function.h src/env.h src/builtin.h src/exec.h
|
||||||
builtin_set.o: parse_tree.h tokenizer.h parser.h event.h
|
obj/complete.o: src/parse_util.h src/wutil.h src/path.h src/iothread.h
|
||||||
builtin_set_color.o: config.h builtin.h io.h common.h fallback.h color.h
|
obj/complete.o: src/autoload.h src/lru.h
|
||||||
builtin_set_color.o: output.h
|
obj/env.o: config.h src/fallback.h src/signal.h src/wutil.h src/common.h
|
||||||
builtin_test.o: config.h common.h fallback.h builtin.h io.h wutil.h proc.h
|
obj/env.o: src/proc.h src/io.h src/parse_tree.h src/tokenizer.h
|
||||||
builtin_test.o: signal.h parse_tree.h tokenizer.h parse_constants.h
|
obj/env.o: src/parse_constants.h src/env.h src/sanity.h src/expand.h
|
||||||
builtin_ulimit.o: config.h fallback.h util.h builtin.h io.h common.h
|
obj/env.o: src/history.h src/reader.h src/complete.h src/highlight.h
|
||||||
builtin_ulimit.o: wgetopt.h
|
obj/env.o: src/color.h src/env_universal_common.h src/input.h
|
||||||
color.o: color.h common.h config.h fallback.h
|
obj/env.o: src/input_common.h src/event.h src/path.h src/fish_version.h
|
||||||
common.o: config.h signal.h fallback.h wutil.h common.h expand.h
|
obj/env_universal_common.o: config.h src/env_universal_common.h src/common.h
|
||||||
common.o: parse_constants.h wildcard.h complete.h util.cpp util.h
|
obj/env_universal_common.o: src/fallback.h src/signal.h src/wutil.h src/env.h
|
||||||
common.o: fallback.cpp
|
obj/env_universal_common.o: src/util.h src/utf8.h
|
||||||
complete.o: config.h fallback.h util.h wildcard.h common.h expand.h
|
obj/event.o: config.h src/signal.h src/fallback.h src/wutil.h src/common.h
|
||||||
complete.o: parse_constants.h complete.h proc.h signal.h io.h parse_tree.h
|
obj/event.o: src/input_common.h src/proc.h src/io.h src/parse_tree.h
|
||||||
complete.o: tokenizer.h parser.h event.h function.h env.h builtin.h exec.h
|
obj/event.o: src/tokenizer.h src/parse_constants.h src/parser.h src/event.h
|
||||||
complete.o: parse_util.h wutil.h path.h iothread.h autoload.h lru.h
|
obj/exec.o: config.h src/signal.h src/fallback.h src/postfork.h src/io.h
|
||||||
env.o: config.h fallback.h wutil.h common.h proc.h signal.h io.h parse_tree.h
|
obj/exec.o: src/common.h src/wutil.h src/proc.h src/parse_tree.h
|
||||||
env.o: tokenizer.h parse_constants.h env.h sanity.h expand.h history.h
|
obj/exec.o: src/tokenizer.h src/parse_constants.h src/exec.h src/parser.h
|
||||||
env.o: reader.h complete.h highlight.h color.h env_universal_common.h input.h
|
obj/exec.o: src/event.h src/builtin.h src/function.h src/env.h
|
||||||
env.o: input_common.h event.h path.h fish_version.h
|
obj/exec.o: src/parse_util.h
|
||||||
env_universal_common.o: config.h env_universal_common.h common.h fallback.h
|
obj/expand.o: config.h src/fallback.h src/signal.h src/util.h src/common.h
|
||||||
env_universal_common.o: wutil.h env.h util.h utf8.h
|
obj/expand.o: src/wutil.h src/env.h src/proc.h src/io.h src/parse_tree.h
|
||||||
event.o: config.h signal.h fallback.h wutil.h common.h input_common.h proc.h
|
obj/expand.o: src/tokenizer.h src/parse_constants.h src/parser.h src/event.h
|
||||||
event.o: io.h parse_tree.h tokenizer.h parse_constants.h parser.h event.h
|
obj/expand.o: src/expand.h src/wildcard.h src/complete.h src/exec.h
|
||||||
exec.o: config.h signal.h fallback.h postfork.h io.h common.h wutil.h proc.h
|
obj/expand.o: src/iothread.h src/parse_util.h
|
||||||
exec.o: parse_tree.h tokenizer.h parse_constants.h exec.h parser.h event.h
|
obj/fish.o: config.h src/fallback.h src/signal.h src/common.h src/reader.h
|
||||||
exec.o: builtin.h function.h env.h parse_util.h
|
obj/fish.o: src/io.h src/complete.h src/highlight.h src/env.h src/color.h
|
||||||
expand.o: config.h fallback.h util.h common.h wutil.h env.h proc.h signal.h
|
obj/fish.o: src/parse_constants.h src/builtin.h src/function.h src/event.h
|
||||||
expand.o: io.h parse_tree.h tokenizer.h parse_constants.h parser.h event.h
|
obj/fish.o: src/wutil.h src/proc.h src/parse_tree.h src/tokenizer.h
|
||||||
expand.o: expand.h wildcard.h complete.h exec.h iothread.h parse_util.h
|
obj/fish.o: src/parser.h src/expand.h src/intern.h src/history.h src/path.h
|
||||||
fallback.o: config.h fallback.h util.h
|
obj/fish.o: src/input.h src/input_common.h src/fish_version.h
|
||||||
fish.o: config.h fallback.h common.h reader.h io.h complete.h highlight.h
|
obj/fish_indent.o: config.h src/color.h src/common.h src/fallback.h
|
||||||
fish.o: env.h color.h parse_constants.h builtin.h function.h event.h wutil.h
|
obj/fish_indent.o: src/signal.h src/highlight.h src/env.h
|
||||||
fish.o: proc.h signal.h parse_tree.h tokenizer.h parser.h expand.h intern.h
|
obj/fish_indent.o: src/parse_constants.h src/wutil.h src/output.h src/input.h
|
||||||
fish.o: history.h path.h input.h input_common.h fish_version.h
|
obj/fish_indent.o: src/input_common.h src/parse_tree.h src/tokenizer.h
|
||||||
fish_indent.o: config.h color.h common.h fallback.h highlight.h env.h
|
obj/fish_indent.o: src/print_help.h src/fish_version.h
|
||||||
fish_indent.o: parse_constants.h wutil.h output.h input.h input_common.h
|
obj/fish_tests.o: config.h src/signal.h src/fallback.h src/util.h
|
||||||
fish_indent.o: parse_tree.h tokenizer.h print_help.h fish_version.h
|
obj/fish_tests.o: src/common.h src/proc.h src/io.h src/parse_tree.h
|
||||||
fish_tests.o: config.h signal.h fallback.h util.h common.h proc.h io.h
|
obj/fish_tests.o: src/tokenizer.h src/parse_constants.h src/reader.h
|
||||||
fish_tests.o: parse_tree.h tokenizer.h parse_constants.h reader.h complete.h
|
obj/fish_tests.o: src/complete.h src/highlight.h src/env.h src/color.h
|
||||||
fish_tests.o: highlight.h env.h color.h builtin.h function.h event.h
|
obj/fish_tests.o: src/builtin.h src/function.h src/event.h src/autoload.h
|
||||||
fish_tests.o: autoload.h lru.h wutil.h expand.h parser.h output.h exec.h
|
obj/fish_tests.o: src/lru.h src/wutil.h src/expand.h src/parser.h
|
||||||
fish_tests.o: path.h history.h iothread.h postfork.h parse_util.h pager.h
|
obj/fish_tests.o: src/output.h src/exec.h src/path.h src/history.h
|
||||||
fish_tests.o: screen.h input.h input_common.h utf8.h env_universal_common.h
|
obj/fish_tests.o: src/iothread.h src/postfork.h src/parse_util.h src/pager.h
|
||||||
fish_tests.o: wcstringutil.h
|
obj/fish_tests.o: src/screen.h src/input.h src/input_common.h src/utf8.h
|
||||||
fish_version.o: fish_version.h
|
obj/fish_tests.o: src/env_universal_common.h src/wcstringutil.h
|
||||||
function.o: config.h wutil.h common.h fallback.h autoload.h lru.h function.h
|
obj/fish_version.o: src/fish_version.h
|
||||||
function.o: event.h env.h intern.h reader.h io.h complete.h highlight.h
|
obj/function.o: config.h src/wutil.h src/common.h src/fallback.h src/signal.h
|
||||||
function.o: color.h parse_constants.h parser_keywords.h
|
obj/function.o: src/autoload.h src/lru.h src/function.h src/event.h src/env.h
|
||||||
highlight.o: config.h fallback.h wutil.h common.h highlight.h env.h color.h
|
obj/function.o: src/intern.h src/reader.h src/io.h src/complete.h
|
||||||
highlight.o: tokenizer.h parse_util.h parse_constants.h builtin.h io.h
|
obj/function.o: src/highlight.h src/color.h src/parse_constants.h
|
||||||
highlight.o: function.h event.h expand.h output.h wildcard.h complete.h
|
obj/function.o: src/parser_keywords.h
|
||||||
highlight.o: path.h history.h parse_tree.h
|
obj/highlight.o: config.h src/fallback.h src/signal.h src/wutil.h
|
||||||
history.o: config.h fallback.h sanity.h reader.h io.h common.h complete.h
|
obj/highlight.o: src/common.h src/highlight.h src/env.h src/color.h
|
||||||
history.o: highlight.h env.h color.h parse_constants.h parse_tree.h
|
obj/highlight.o: src/tokenizer.h src/parse_util.h src/parse_constants.h
|
||||||
history.o: tokenizer.h wutil.h history.h path.h signal.h iothread.h lru.h
|
obj/highlight.o: src/builtin.h src/io.h src/function.h src/event.h
|
||||||
input.o: config.h fallback.h wutil.h common.h reader.h io.h complete.h
|
obj/highlight.o: src/expand.h src/output.h src/wildcard.h src/complete.h
|
||||||
input.o: highlight.h env.h color.h parse_constants.h proc.h signal.h
|
obj/highlight.o: src/path.h src/history.h src/parse_tree.h
|
||||||
input.o: parse_tree.h tokenizer.h input_common.h input.h parser.h event.h
|
obj/history.o: config.h src/fallback.h src/signal.h src/sanity.h src/reader.h
|
||||||
input.o: output.h
|
obj/history.o: src/io.h src/common.h src/complete.h src/highlight.h src/env.h
|
||||||
input_common.o: config.h fallback.h util.h common.h input_common.h
|
obj/history.o: src/color.h src/parse_constants.h src/parse_tree.h
|
||||||
input_common.o: env_universal_common.h wutil.h env.h iothread.h
|
obj/history.o: src/tokenizer.h src/wutil.h src/history.h src/path.h
|
||||||
intern.o: config.h fallback.h common.h intern.h
|
obj/history.o: src/iothread.h src/lru.h
|
||||||
io.o: config.h fallback.h wutil.h common.h exec.h io.h
|
obj/input.o: config.h src/fallback.h src/signal.h src/wutil.h src/common.h
|
||||||
iothread.o: config.h iothread.h common.h fallback.h signal.h
|
obj/input.o: src/reader.h src/io.h src/complete.h src/highlight.h src/env.h
|
||||||
key_reader.o: config.h common.h fallback.h input_common.h
|
obj/input.o: src/color.h src/parse_constants.h src/proc.h src/parse_tree.h
|
||||||
kill.o: config.h fallback.h kill.h common.h env.h exec.h path.h
|
obj/input.o: src/tokenizer.h src/input_common.h src/input.h src/parser.h
|
||||||
output.o: config.h fallback.h wutil.h common.h output.h color.h
|
obj/input.o: src/event.h src/output.h
|
||||||
pager.o: config.h util.h wutil.h common.h fallback.h pager.h complete.h
|
obj/input_common.o: config.h src/fallback.h src/signal.h src/util.h
|
||||||
pager.o: screen.h highlight.h env.h color.h reader.h io.h parse_constants.h
|
obj/input_common.o: src/common.h src/input_common.h
|
||||||
parse_execution.o: parse_execution.h common.h config.h fallback.h io.h
|
obj/input_common.o: src/env_universal_common.h src/wutil.h src/env.h
|
||||||
parse_execution.o: parse_constants.h parse_tree.h tokenizer.h proc.h signal.h
|
obj/input_common.o: src/iothread.h
|
||||||
parse_execution.o: env.h event.h util.h parse_util.h complete.h wildcard.h
|
obj/intern.o: config.h src/fallback.h src/signal.h src/common.h src/intern.h
|
||||||
parse_execution.o: expand.h parser.h reader.h highlight.h color.h wutil.h
|
obj/io.o: config.h src/fallback.h src/signal.h src/wutil.h src/common.h
|
||||||
parse_execution.o: path.h function.h builtin.h exec.h
|
obj/io.o: src/exec.h src/io.h
|
||||||
parse_productions.o: parse_productions.h common.h config.h fallback.h
|
obj/iothread.o: config.h src/iothread.h src/common.h src/fallback.h
|
||||||
parse_productions.o: parse_constants.h parse_tree.h tokenizer.h
|
obj/iothread.o: src/signal.h
|
||||||
parse_tree.o: common.h config.h fallback.h parse_constants.h
|
obj/key_reader.o: config.h src/common.h src/fallback.h src/signal.h
|
||||||
parse_tree.o: parse_productions.h parse_tree.h tokenizer.h wutil.h proc.h
|
obj/key_reader.o: src/input_common.h
|
||||||
parse_tree.o: signal.h io.h
|
obj/kill.o: config.h src/fallback.h src/signal.h src/kill.h src/common.h
|
||||||
parse_util.o: config.h fallback.h util.h wutil.h common.h tokenizer.h
|
obj/kill.o: src/env.h src/exec.h src/path.h
|
||||||
parse_util.o: parse_util.h parse_constants.h expand.h env.h wildcard.h
|
obj/output.o: config.h src/fallback.h src/signal.h src/wutil.h src/common.h
|
||||||
parse_util.o: complete.h parse_tree.h builtin.h io.h
|
obj/output.o: src/output.h src/color.h
|
||||||
parser.o: config.h fallback.h common.h wutil.h proc.h signal.h io.h
|
obj/pager.o: config.h src/util.h src/wutil.h src/common.h src/fallback.h
|
||||||
parser.o: parse_tree.h tokenizer.h parse_constants.h parser.h event.h
|
obj/pager.o: src/signal.h src/pager.h src/complete.h src/screen.h
|
||||||
parser.o: function.h env.h expand.h reader.h complete.h highlight.h color.h
|
obj/pager.o: src/highlight.h src/env.h src/color.h src/reader.h src/io.h
|
||||||
parser.o: sanity.h intern.h parse_util.h parse_execution.h
|
obj/pager.o: src/parse_constants.h
|
||||||
parser_keywords.o: config.h fallback.h common.h parser_keywords.h
|
obj/parse_execution.o: src/parse_execution.h src/common.h config.h
|
||||||
path.o: config.h fallback.h common.h env.h wutil.h path.h expand.h
|
obj/parse_execution.o: src/fallback.h src/signal.h src/io.h
|
||||||
path.o: parse_constants.h
|
obj/parse_execution.o: src/parse_constants.h src/parse_tree.h src/tokenizer.h
|
||||||
postfork.o: signal.h common.h config.h fallback.h proc.h io.h parse_tree.h
|
obj/parse_execution.o: src/proc.h src/env.h src/event.h src/util.h
|
||||||
postfork.o: tokenizer.h parse_constants.h wutil.h postfork.h iothread.h
|
obj/parse_execution.o: src/parse_util.h src/complete.h src/wildcard.h
|
||||||
postfork.o: exec.h
|
obj/parse_execution.o: src/expand.h src/parser.h src/reader.h src/highlight.h
|
||||||
print_help.o: print_help.h
|
obj/parse_execution.o: src/color.h src/wutil.h src/path.h src/function.h
|
||||||
proc.o: config.h signal.h fallback.h util.h wutil.h common.h proc.h io.h
|
obj/parse_execution.o: src/builtin.h src/exec.h
|
||||||
proc.o: parse_tree.h tokenizer.h parse_constants.h reader.h complete.h
|
obj/parse_productions.o: src/parse_productions.h src/common.h config.h
|
||||||
proc.o: highlight.h env.h color.h sanity.h parser.h event.h output.h
|
obj/parse_productions.o: src/fallback.h src/signal.h src/parse_constants.h
|
||||||
reader.o: config.h signal.h fallback.h util.h wutil.h common.h highlight.h
|
obj/parse_productions.o: src/parse_tree.h src/tokenizer.h
|
||||||
reader.o: env.h color.h reader.h io.h complete.h parse_constants.h proc.h
|
obj/parse_tree.o: src/common.h config.h src/fallback.h src/signal.h
|
||||||
reader.o: parse_tree.h tokenizer.h parser.h event.h history.h sanity.h exec.h
|
obj/parse_tree.o: src/parse_constants.h src/parse_productions.h
|
||||||
reader.o: expand.h kill.h input_common.h input.h function.h output.h screen.h
|
obj/parse_tree.o: src/parse_tree.h src/tokenizer.h src/wutil.h src/proc.h
|
||||||
reader.o: iothread.h intern.h parse_util.h pager.h
|
obj/parse_tree.o: src/io.h
|
||||||
sanity.o: config.h fallback.h common.h sanity.h proc.h signal.h io.h
|
obj/parse_util.o: config.h src/fallback.h src/signal.h src/util.h src/wutil.h
|
||||||
sanity.o: parse_tree.h tokenizer.h parse_constants.h history.h wutil.h
|
obj/parse_util.o: src/common.h src/tokenizer.h src/parse_util.h
|
||||||
sanity.o: reader.h complete.h highlight.h env.h color.h kill.h
|
obj/parse_util.o: src/parse_constants.h src/expand.h src/env.h src/wildcard.h
|
||||||
screen.o: config.h fallback.h common.h util.h output.h color.h highlight.h
|
obj/parse_util.o: src/complete.h src/parse_tree.h src/builtin.h src/io.h
|
||||||
screen.o: env.h screen.h pager.h complete.h reader.h io.h parse_constants.h
|
obj/parser.o: config.h src/fallback.h src/signal.h src/common.h src/wutil.h
|
||||||
signal.o: config.h signal.h common.h fallback.h wutil.h event.h reader.h io.h
|
obj/parser.o: src/proc.h src/io.h src/parse_tree.h src/tokenizer.h
|
||||||
signal.o: complete.h highlight.h env.h color.h parse_constants.h proc.h
|
obj/parser.o: src/parse_constants.h src/parser.h src/event.h src/function.h
|
||||||
signal.o: parse_tree.h tokenizer.h
|
obj/parser.o: src/env.h src/expand.h src/reader.h src/complete.h
|
||||||
tokenizer.o: config.h fallback.h common.h wutil.h tokenizer.h
|
obj/parser.o: src/highlight.h src/color.h src/sanity.h src/intern.h
|
||||||
utf8.o: utf8.h
|
obj/parser.o: src/parse_util.h src/parse_execution.h
|
||||||
util.o: config.h fallback.h util.h common.h wutil.h
|
obj/parser_keywords.o: config.h src/fallback.h src/signal.h src/common.h
|
||||||
wcstringutil.o: config.h wcstringutil.h common.h fallback.h
|
obj/parser_keywords.o: src/parser_keywords.h
|
||||||
wgetopt.o: config.h common.h fallback.h wgetopt.h wutil.h
|
obj/path.o: config.h src/fallback.h src/signal.h src/common.h src/env.h
|
||||||
wildcard.o: config.h fallback.h wutil.h common.h wildcard.h expand.h
|
obj/path.o: src/wutil.h src/path.h src/expand.h src/parse_constants.h
|
||||||
wildcard.o: parse_constants.h complete.h reader.h io.h highlight.h env.h
|
obj/postfork.o: src/signal.h src/common.h config.h src/fallback.h src/proc.h
|
||||||
wildcard.o: color.h
|
obj/postfork.o: src/io.h src/parse_tree.h src/tokenizer.h
|
||||||
wutil.o: config.h fallback.h common.h wutil.h
|
obj/postfork.o: src/parse_constants.h src/wutil.h src/postfork.h
|
||||||
|
obj/postfork.o: src/iothread.h src/exec.h
|
||||||
|
obj/print_help.o: src/print_help.h
|
||||||
|
obj/proc.o: config.h src/signal.h src/fallback.h src/util.h src/wutil.h
|
||||||
|
obj/proc.o: src/common.h src/proc.h src/io.h src/parse_tree.h src/tokenizer.h
|
||||||
|
obj/proc.o: src/parse_constants.h src/reader.h src/complete.h src/highlight.h
|
||||||
|
obj/proc.o: src/env.h src/color.h src/sanity.h src/parser.h src/event.h
|
||||||
|
obj/proc.o: src/output.h
|
||||||
|
obj/reader.o: config.h src/signal.h src/fallback.h src/util.h src/wutil.h
|
||||||
|
obj/reader.o: src/common.h src/highlight.h src/env.h src/color.h src/reader.h
|
||||||
|
obj/reader.o: src/io.h src/complete.h src/parse_constants.h src/proc.h
|
||||||
|
obj/reader.o: src/parse_tree.h src/tokenizer.h src/parser.h src/event.h
|
||||||
|
obj/reader.o: src/history.h src/sanity.h src/exec.h src/expand.h src/kill.h
|
||||||
|
obj/reader.o: src/input_common.h src/input.h src/function.h src/output.h
|
||||||
|
obj/reader.o: src/screen.h src/iothread.h src/intern.h src/parse_util.h
|
||||||
|
obj/reader.o: src/pager.h
|
||||||
|
obj/sanity.o: config.h src/fallback.h src/signal.h src/common.h src/sanity.h
|
||||||
|
obj/sanity.o: src/proc.h src/io.h src/parse_tree.h src/tokenizer.h
|
||||||
|
obj/sanity.o: src/parse_constants.h src/history.h src/wutil.h src/reader.h
|
||||||
|
obj/sanity.o: src/complete.h src/highlight.h src/env.h src/color.h src/kill.h
|
||||||
|
obj/screen.o: config.h src/fallback.h src/signal.h src/common.h src/util.h
|
||||||
|
obj/screen.o: src/output.h src/color.h src/highlight.h src/env.h src/screen.h
|
||||||
|
obj/screen.o: src/pager.h src/complete.h src/reader.h src/io.h
|
||||||
|
obj/screen.o: src/parse_constants.h
|
||||||
|
obj/signal.o: config.h src/signal.h src/common.h src/fallback.h src/wutil.h
|
||||||
|
obj/signal.o: src/event.h src/reader.h src/io.h src/complete.h
|
||||||
|
obj/signal.o: src/highlight.h src/env.h src/color.h src/parse_constants.h
|
||||||
|
obj/signal.o: src/proc.h src/parse_tree.h src/tokenizer.h
|
||||||
|
obj/tokenizer.o: config.h src/fallback.h src/signal.h src/common.h
|
||||||
|
obj/tokenizer.o: src/wutil.h src/tokenizer.h
|
||||||
|
obj/utf8.o: src/utf8.h
|
||||||
|
obj/wcstringutil.o: config.h src/wcstringutil.h src/common.h src/fallback.h
|
||||||
|
obj/wcstringutil.o: src/signal.h
|
||||||
|
obj/wgetopt.o: config.h src/common.h src/fallback.h src/signal.h
|
||||||
|
obj/wgetopt.o: src/wgetopt.h src/wutil.h
|
||||||
|
obj/wildcard.o: config.h src/fallback.h src/signal.h src/wutil.h src/common.h
|
||||||
|
obj/wildcard.o: src/wildcard.h src/expand.h src/parse_constants.h
|
||||||
|
obj/wildcard.o: src/complete.h src/reader.h src/io.h src/highlight.h
|
||||||
|
obj/wildcard.o: src/env.h src/color.h
|
||||||
|
obj/wutil.o: config.h src/fallback.h src/signal.h src/common.h src/wutil.h
|
||||||
|
|
3
build_tools/cppcheck.sh
Executable file
3
build_tools/cppcheck.sh
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/usr/local/bin/fish
|
||||||
|
|
||||||
|
cppcheck --enable=all --std=posix --quiet .
|
|
@ -361,7 +361,7 @@
|
||||||
/* End PBXCopyFilesBuildPhase section */
|
/* End PBXCopyFilesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
4E142D731B56B5D7008783C8 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = config.h; path = osx/config.h; sourceTree = "<group>"; };
|
4E142D731B56B5D7008783C8 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = config.h; path = ../osx/config.h; sourceTree = "<group>"; };
|
||||||
D00769421990137800CA4627 /* fish_tests */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = fish_tests; sourceTree = BUILT_PRODUCTS_DIR; };
|
D00769421990137800CA4627 /* fish_tests */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = fish_tests; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
D00F63F019137E9D00FCCDEC /* fish_version.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = fish_version.cpp; sourceTree = "<group>"; };
|
D00F63F019137E9D00FCCDEC /* fish_version.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = fish_version.cpp; sourceTree = "<group>"; };
|
||||||
D01A2D23169B730A00767098 /* man1 */ = {isa = PBXFileReference; lastKnownFileType = text; name = man1; path = pages_for_manpath/man1; sourceTree = BUILT_PRODUCTS_DIR; };
|
D01A2D23169B730A00767098 /* man1 */ = {isa = PBXFileReference; lastKnownFileType = text; name = man1; path = pages_for_manpath/man1; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
@ -675,6 +675,7 @@
|
||||||
D0A0856113B3ACEE0099B651 /* wutil.cpp */,
|
D0A0856113B3ACEE0099B651 /* wutil.cpp */,
|
||||||
);
|
);
|
||||||
name = Sources;
|
name = Sources;
|
||||||
|
path = src;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
D0D02AAB15985C14008E62BD /* Resources */ = {
|
D0D02AAB15985C14008E62BD /* Resources */ = {
|
||||||
|
@ -809,7 +810,7 @@
|
||||||
D0A084F213B3AC130099B651 /* Project object */ = {
|
D0A084F213B3AC130099B651 /* Project object */ = {
|
||||||
isa = PBXProject;
|
isa = PBXProject;
|
||||||
attributes = {
|
attributes = {
|
||||||
LastUpgradeCheck = 0630;
|
LastUpgradeCheck = 0640;
|
||||||
};
|
};
|
||||||
buildConfigurationList = D0A084F513B3AC130099B651 /* Build configuration list for PBXProject "fish" */;
|
buildConfigurationList = D0A084F513B3AC130099B651 /* Build configuration list for PBXProject "fish" */;
|
||||||
compatibilityVersion = "Xcode 3.2";
|
compatibilityVersion = "Xcode 3.2";
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "0630"
|
LastUpgradeVersion = "0640"
|
||||||
version = "1.3">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "0630"
|
LastUpgradeVersion = "0640"
|
||||||
version = "1.3">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "0630"
|
LastUpgradeVersion = "0640"
|
||||||
version = "1.3">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "0630"
|
LastUpgradeVersion = "0640"
|
||||||
version = "1.3">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "0630"
|
LastUpgradeVersion = "0640"
|
||||||
version = "1.3">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
|
|
|
@ -47,4 +47,3 @@ complete -c grep -s x -l line-regexp --description "Only whole matching lines"
|
||||||
complete -c grep -s y --description "Obsolete synonym for -i"
|
complete -c grep -s y --description "Obsolete synonym for -i"
|
||||||
complete -c grep -s z -l null-data --description 'treat input as a set of lines each terminated by a zero byte'
|
complete -c grep -s z -l null-data --description 'treat input as a set of lines each terminated by a zero byte'
|
||||||
complete -c grep -s Z -l null --description "Output a zero byte after filename"
|
complete -c grep -s Z -l null --description "Output a zero byte after filename"
|
||||||
end
|
|
||||||
|
|
|
@ -633,7 +633,7 @@ static int builtin_bind_erase(wchar_t **seq, int all, const wchar_t *mode, int u
|
||||||
*/
|
*/
|
||||||
static int builtin_bind(parser_t &parser, wchar_t **argv)
|
static int builtin_bind(parser_t &parser, wchar_t **argv)
|
||||||
{
|
{
|
||||||
|
wgetopter_t w;
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
BIND_INSERT,
|
BIND_INSERT,
|
||||||
|
@ -654,7 +654,7 @@ static int builtin_bind(parser_t &parser, wchar_t **argv)
|
||||||
|
|
||||||
int use_terminfo = 0;
|
int use_terminfo = 0;
|
||||||
|
|
||||||
woptind=0;
|
w.woptind=0;
|
||||||
|
|
||||||
static const struct woption long_options[] =
|
static const struct woption long_options[] =
|
||||||
{
|
{
|
||||||
|
@ -672,7 +672,7 @@ static int builtin_bind(parser_t &parser, wchar_t **argv)
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
int opt_index = 0;
|
int opt_index = 0;
|
||||||
int opt = wgetopt_long(argc,
|
int opt = w.wgetopt_long(argc,
|
||||||
argv,
|
argv,
|
||||||
L"aehkKfM:m:",
|
L"aehkKfM:m:",
|
||||||
long_options,
|
long_options,
|
||||||
|
@ -719,17 +719,17 @@ static int builtin_bind(parser_t &parser, wchar_t **argv)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'M':
|
case 'M':
|
||||||
bind_mode = woptarg;
|
bind_mode = w.woptarg;
|
||||||
bind_mode_given = true;
|
bind_mode_given = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'm':
|
case 'm':
|
||||||
sets_bind_mode = woptarg;
|
sets_bind_mode = w.woptarg;
|
||||||
sets_bind_mode_given = true;
|
sets_bind_mode_given = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
builtin_unknown_option(parser, argv[0], argv[woptind-1]);
|
builtin_unknown_option(parser, argv[0], argv[w.woptind-1]);
|
||||||
return STATUS_BUILTIN_ERROR;
|
return STATUS_BUILTIN_ERROR;
|
||||||
|
|
||||||
|
|
||||||
|
@ -749,7 +749,7 @@ static int builtin_bind(parser_t &parser, wchar_t **argv)
|
||||||
|
|
||||||
case BIND_ERASE:
|
case BIND_ERASE:
|
||||||
{
|
{
|
||||||
if (builtin_bind_erase(&argv[woptind], all, bind_mode_given ? bind_mode : NULL, use_terminfo))
|
if (builtin_bind_erase(&argv[w.woptind], all, bind_mode_given ? bind_mode : NULL, use_terminfo))
|
||||||
{
|
{
|
||||||
res = STATUS_BUILTIN_ERROR;
|
res = STATUS_BUILTIN_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -758,7 +758,7 @@ static int builtin_bind(parser_t &parser, wchar_t **argv)
|
||||||
|
|
||||||
case BIND_INSERT:
|
case BIND_INSERT:
|
||||||
{
|
{
|
||||||
switch (argc-woptind)
|
switch (argc-w.woptind)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
|
@ -771,7 +771,7 @@ static int builtin_bind(parser_t &parser, wchar_t **argv)
|
||||||
wcstring seq;
|
wcstring seq;
|
||||||
if (use_terminfo)
|
if (use_terminfo)
|
||||||
{
|
{
|
||||||
if (!get_terminfo_sequence(argv[woptind], &seq))
|
if (!get_terminfo_sequence(argv[w.woptind], &seq))
|
||||||
{
|
{
|
||||||
res = STATUS_BUILTIN_ERROR;
|
res = STATUS_BUILTIN_ERROR;
|
||||||
// get_terminfo_sequence already printed the error
|
// get_terminfo_sequence already printed the error
|
||||||
|
@ -780,12 +780,12 @@ static int builtin_bind(parser_t &parser, wchar_t **argv)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
seq = argv[woptind];
|
seq = argv[w.woptind];
|
||||||
}
|
}
|
||||||
if (!builtin_bind_list_one(seq, bind_mode))
|
if (!builtin_bind_list_one(seq, bind_mode))
|
||||||
{
|
{
|
||||||
res = STATUS_BUILTIN_ERROR;
|
res = STATUS_BUILTIN_ERROR;
|
||||||
wcstring eseq = escape_string(argv[woptind], 0);
|
wcstring eseq = escape_string(argv[w.woptind], 0);
|
||||||
if (use_terminfo)
|
if (use_terminfo)
|
||||||
{
|
{
|
||||||
append_format(stderr_buffer, _(L"%ls: No binding found for key '%ls'\n"), argv[0], eseq.c_str());
|
append_format(stderr_buffer, _(L"%ls: No binding found for key '%ls'\n"), argv[0], eseq.c_str());
|
||||||
|
@ -800,7 +800,7 @@ static int builtin_bind(parser_t &parser, wchar_t **argv)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
if (builtin_bind_add(argv[woptind], (const wchar_t **)argv + (woptind + 1), argc - (woptind + 1), bind_mode, sets_bind_mode, use_terminfo))
|
if (builtin_bind_add(argv[w.woptind], (const wchar_t **)argv + (w.woptind + 1), argc - (w.woptind + 1), bind_mode, sets_bind_mode, use_terminfo))
|
||||||
{
|
{
|
||||||
res = STATUS_BUILTIN_ERROR;
|
res = STATUS_BUILTIN_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -842,6 +842,7 @@ static int builtin_bind(parser_t &parser, wchar_t **argv)
|
||||||
*/
|
*/
|
||||||
static int builtin_block(parser_t &parser, wchar_t **argv)
|
static int builtin_block(parser_t &parser, wchar_t **argv)
|
||||||
{
|
{
|
||||||
|
wgetopter_t w;
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
UNSET,
|
UNSET,
|
||||||
|
@ -854,7 +855,7 @@ static int builtin_block(parser_t &parser, wchar_t **argv)
|
||||||
int erase = 0;
|
int erase = 0;
|
||||||
int argc=builtin_count_args(argv);
|
int argc=builtin_count_args(argv);
|
||||||
|
|
||||||
woptind=0;
|
w.woptind=0;
|
||||||
|
|
||||||
static const struct woption
|
static const struct woption
|
||||||
long_options[] =
|
long_options[] =
|
||||||
|
@ -885,7 +886,7 @@ static int builtin_block(parser_t &parser, wchar_t **argv)
|
||||||
{
|
{
|
||||||
int opt_index = 0;
|
int opt_index = 0;
|
||||||
|
|
||||||
int opt = wgetopt_long(argc,
|
int opt = w.wgetopt_long(argc,
|
||||||
argv,
|
argv,
|
||||||
L"elgh",
|
L"elgh",
|
||||||
long_options,
|
long_options,
|
||||||
|
@ -922,7 +923,7 @@ static int builtin_block(parser_t &parser, wchar_t **argv)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
builtin_unknown_option(parser, argv[0], argv[woptind-1]);
|
builtin_unknown_option(parser, argv[0], argv[w.woptind-1]);
|
||||||
return STATUS_BUILTIN_ERROR;
|
return STATUS_BUILTIN_ERROR;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1000,8 +1001,7 @@ static int builtin_builtin(parser_t &parser, wchar_t **argv)
|
||||||
{
|
{
|
||||||
int argc=builtin_count_args(argv);
|
int argc=builtin_count_args(argv);
|
||||||
int list=0;
|
int list=0;
|
||||||
|
wgetopter_t w;
|
||||||
woptind=0;
|
|
||||||
|
|
||||||
static const struct woption
|
static const struct woption
|
||||||
long_options[] =
|
long_options[] =
|
||||||
|
@ -1024,7 +1024,7 @@ static int builtin_builtin(parser_t &parser, wchar_t **argv)
|
||||||
{
|
{
|
||||||
int opt_index = 0;
|
int opt_index = 0;
|
||||||
|
|
||||||
int opt = wgetopt_long(argc,
|
int opt = w.wgetopt_long(argc,
|
||||||
argv,
|
argv,
|
||||||
L"nh",
|
L"nh",
|
||||||
long_options,
|
long_options,
|
||||||
|
@ -1054,7 +1054,7 @@ static int builtin_builtin(parser_t &parser, wchar_t **argv)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
builtin_unknown_option(parser, argv[0], argv[woptind-1]);
|
builtin_unknown_option(parser, argv[0], argv[w.woptind-1]);
|
||||||
return STATUS_BUILTIN_ERROR;
|
return STATUS_BUILTIN_ERROR;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1082,10 +1082,9 @@ static int builtin_builtin(parser_t &parser, wchar_t **argv)
|
||||||
*/
|
*/
|
||||||
static int builtin_emit(parser_t &parser, wchar_t **argv)
|
static int builtin_emit(parser_t &parser, wchar_t **argv)
|
||||||
{
|
{
|
||||||
|
wgetopter_t w;
|
||||||
int argc=builtin_count_args(argv);
|
int argc=builtin_count_args(argv);
|
||||||
|
|
||||||
woptind=0;
|
|
||||||
|
|
||||||
static const struct woption
|
static const struct woption
|
||||||
long_options[] =
|
long_options[] =
|
||||||
{
|
{
|
||||||
|
@ -1103,7 +1102,7 @@ static int builtin_emit(parser_t &parser, wchar_t **argv)
|
||||||
{
|
{
|
||||||
int opt_index = 0;
|
int opt_index = 0;
|
||||||
|
|
||||||
int opt = wgetopt_long(argc,
|
int opt = w.wgetopt_long(argc,
|
||||||
argv,
|
argv,
|
||||||
L"h",
|
L"h",
|
||||||
long_options,
|
long_options,
|
||||||
|
@ -1128,20 +1127,20 @@ static int builtin_emit(parser_t &parser, wchar_t **argv)
|
||||||
return STATUS_BUILTIN_OK;
|
return STATUS_BUILTIN_OK;
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
builtin_unknown_option(parser, argv[0], argv[woptind-1]);
|
builtin_unknown_option(parser, argv[0], argv[w.woptind-1]);
|
||||||
return STATUS_BUILTIN_ERROR;
|
return STATUS_BUILTIN_ERROR;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!argv[woptind])
|
if (!argv[w.woptind])
|
||||||
{
|
{
|
||||||
append_format(stderr_buffer, L"%ls: expected event name\n", argv[0]);
|
append_format(stderr_buffer, L"%ls: expected event name\n", argv[0]);
|
||||||
return STATUS_BUILTIN_ERROR;
|
return STATUS_BUILTIN_ERROR;
|
||||||
}
|
}
|
||||||
const wchar_t *eventname = argv[woptind];
|
const wchar_t *eventname = argv[w.woptind];
|
||||||
wcstring_list_t args(argv + woptind + 1, argv + argc);
|
wcstring_list_t args(argv + w.woptind + 1, argv + argc);
|
||||||
event_fire_generic(eventname, &args);
|
event_fire_generic(eventname, &args);
|
||||||
|
|
||||||
return STATUS_BUILTIN_OK;
|
return STATUS_BUILTIN_OK;
|
||||||
|
@ -1154,10 +1153,11 @@ static int builtin_emit(parser_t &parser, wchar_t **argv)
|
||||||
*/
|
*/
|
||||||
static int builtin_command(parser_t &parser, wchar_t **argv)
|
static int builtin_command(parser_t &parser, wchar_t **argv)
|
||||||
{
|
{
|
||||||
|
wgetopter_t w;
|
||||||
int argc=builtin_count_args(argv);
|
int argc=builtin_count_args(argv);
|
||||||
int print_path=0;
|
int print_path=0;
|
||||||
|
|
||||||
woptind=0;
|
w.woptind=0;
|
||||||
|
|
||||||
static const struct woption
|
static const struct woption
|
||||||
long_options[] =
|
long_options[] =
|
||||||
|
@ -1171,7 +1171,7 @@ static int builtin_command(parser_t &parser, wchar_t **argv)
|
||||||
{
|
{
|
||||||
int opt_index = 0;
|
int opt_index = 0;
|
||||||
|
|
||||||
int opt = wgetopt_long(argc,
|
int opt = w.wgetopt_long(argc,
|
||||||
argv,
|
argv,
|
||||||
L"svh",
|
L"svh",
|
||||||
long_options,
|
long_options,
|
||||||
|
@ -1201,7 +1201,7 @@ static int builtin_command(parser_t &parser, wchar_t **argv)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
builtin_unknown_option(parser, argv[0], argv[woptind-1]);
|
builtin_unknown_option(parser, argv[0], argv[w.woptind-1]);
|
||||||
return STATUS_BUILTIN_ERROR;
|
return STATUS_BUILTIN_ERROR;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1216,7 +1216,7 @@ static int builtin_command(parser_t &parser, wchar_t **argv)
|
||||||
|
|
||||||
int found=0;
|
int found=0;
|
||||||
|
|
||||||
for (int idx = woptind; argv[idx]; ++idx)
|
for (int idx = w.woptind; argv[idx]; ++idx)
|
||||||
{
|
{
|
||||||
const wchar_t *command_name = argv[idx];
|
const wchar_t *command_name = argv[idx];
|
||||||
wcstring path;
|
wcstring path;
|
||||||
|
@ -1236,6 +1236,7 @@ static int builtin_command(parser_t &parser, wchar_t **argv)
|
||||||
*/
|
*/
|
||||||
static int builtin_generic(parser_t &parser, wchar_t **argv)
|
static int builtin_generic(parser_t &parser, wchar_t **argv)
|
||||||
{
|
{
|
||||||
|
wgetopter_t w;
|
||||||
int argc=builtin_count_args(argv);
|
int argc=builtin_count_args(argv);
|
||||||
|
|
||||||
/* Hackish - if we have no arguments other than the command, we are a "naked invocation" and we just print help */
|
/* Hackish - if we have no arguments other than the command, we are a "naked invocation" and we just print help */
|
||||||
|
@ -1245,8 +1246,6 @@ static int builtin_generic(parser_t &parser, wchar_t **argv)
|
||||||
return STATUS_BUILTIN_ERROR;
|
return STATUS_BUILTIN_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
woptind=0;
|
|
||||||
|
|
||||||
static const struct woption
|
static const struct woption
|
||||||
long_options[] =
|
long_options[] =
|
||||||
{
|
{
|
||||||
|
@ -1258,7 +1257,7 @@ static int builtin_generic(parser_t &parser, wchar_t **argv)
|
||||||
{
|
{
|
||||||
int opt_index = 0;
|
int opt_index = 0;
|
||||||
|
|
||||||
int opt = wgetopt_long(argc,
|
int opt = w.wgetopt_long(argc,
|
||||||
argv,
|
argv,
|
||||||
L"h",
|
L"h",
|
||||||
long_options,
|
long_options,
|
||||||
|
@ -1283,7 +1282,7 @@ static int builtin_generic(parser_t &parser, wchar_t **argv)
|
||||||
return STATUS_BUILTIN_OK;
|
return STATUS_BUILTIN_OK;
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
builtin_unknown_option(parser, argv[0], argv[woptind-1]);
|
builtin_unknown_option(parser, argv[0], argv[w.woptind-1]);
|
||||||
return STATUS_BUILTIN_ERROR;
|
return STATUS_BUILTIN_ERROR;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1432,6 +1431,7 @@ static void functions_def(const wcstring &name, wcstring &out)
|
||||||
*/
|
*/
|
||||||
static int builtin_functions(parser_t &parser, wchar_t **argv)
|
static int builtin_functions(parser_t &parser, wchar_t **argv)
|
||||||
{
|
{
|
||||||
|
wgetopter_t w;
|
||||||
int i;
|
int i;
|
||||||
int erase=0;
|
int erase=0;
|
||||||
wchar_t *desc=0;
|
wchar_t *desc=0;
|
||||||
|
@ -1443,8 +1443,6 @@ static int builtin_functions(parser_t &parser, wchar_t **argv)
|
||||||
int query = 0;
|
int query = 0;
|
||||||
int copy = 0;
|
int copy = 0;
|
||||||
|
|
||||||
woptind=0;
|
|
||||||
|
|
||||||
static const struct woption
|
static const struct woption
|
||||||
long_options[] =
|
long_options[] =
|
||||||
{
|
{
|
||||||
|
@ -1486,7 +1484,7 @@ static int builtin_functions(parser_t &parser, wchar_t **argv)
|
||||||
{
|
{
|
||||||
int opt_index = 0;
|
int opt_index = 0;
|
||||||
|
|
||||||
int opt = wgetopt_long(argc,
|
int opt = w.wgetopt_long(argc,
|
||||||
argv,
|
argv,
|
||||||
L"ed:nahqc",
|
L"ed:nahqc",
|
||||||
long_options,
|
long_options,
|
||||||
|
@ -1513,7 +1511,7 @@ static int builtin_functions(parser_t &parser, wchar_t **argv)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'd':
|
case 'd':
|
||||||
desc=woptarg;
|
desc=w.woptarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'n':
|
case 'n':
|
||||||
|
@ -1537,7 +1535,7 @@ static int builtin_functions(parser_t &parser, wchar_t **argv)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
builtin_unknown_option(parser, argv[0], argv[woptind-1]);
|
builtin_unknown_option(parser, argv[0], argv[w.woptind-1]);
|
||||||
return STATUS_BUILTIN_ERROR;
|
return STATUS_BUILTIN_ERROR;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1561,7 +1559,7 @@ static int builtin_functions(parser_t &parser, wchar_t **argv)
|
||||||
if (erase)
|
if (erase)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i=woptind; i<argc; i++)
|
for (i=w.woptind; i<argc; i++)
|
||||||
function_remove(argv[i]);
|
function_remove(argv[i]);
|
||||||
return STATUS_BUILTIN_OK;
|
return STATUS_BUILTIN_OK;
|
||||||
}
|
}
|
||||||
|
@ -1569,7 +1567,7 @@ static int builtin_functions(parser_t &parser, wchar_t **argv)
|
||||||
{
|
{
|
||||||
wchar_t *func;
|
wchar_t *func;
|
||||||
|
|
||||||
if (argc-woptind != 1)
|
if (argc-w.woptind != 1)
|
||||||
{
|
{
|
||||||
append_format(stderr_buffer,
|
append_format(stderr_buffer,
|
||||||
_(L"%ls: Expected exactly one function name\n"),
|
_(L"%ls: Expected exactly one function name\n"),
|
||||||
|
@ -1578,7 +1576,7 @@ static int builtin_functions(parser_t &parser, wchar_t **argv)
|
||||||
|
|
||||||
return STATUS_BUILTIN_ERROR;
|
return STATUS_BUILTIN_ERROR;
|
||||||
}
|
}
|
||||||
func = argv[woptind];
|
func = argv[w.woptind];
|
||||||
if (!function_exists(func))
|
if (!function_exists(func))
|
||||||
{
|
{
|
||||||
append_format(stderr_buffer,
|
append_format(stderr_buffer,
|
||||||
|
@ -1595,7 +1593,7 @@ static int builtin_functions(parser_t &parser, wchar_t **argv)
|
||||||
|
|
||||||
return STATUS_BUILTIN_OK;
|
return STATUS_BUILTIN_OK;
|
||||||
}
|
}
|
||||||
else if (list || (argc==woptind))
|
else if (list || (argc==w.woptind))
|
||||||
{
|
{
|
||||||
int is_screen = !builtin_out_redirect && isatty(1);
|
int is_screen = !builtin_out_redirect && isatty(1);
|
||||||
size_t i;
|
size_t i;
|
||||||
|
@ -1629,7 +1627,7 @@ static int builtin_functions(parser_t &parser, wchar_t **argv)
|
||||||
wcstring current_func;
|
wcstring current_func;
|
||||||
wcstring new_func;
|
wcstring new_func;
|
||||||
|
|
||||||
if (argc-woptind != 2)
|
if (argc-w.woptind != 2)
|
||||||
{
|
{
|
||||||
append_format(stderr_buffer,
|
append_format(stderr_buffer,
|
||||||
_(L"%ls: Expected exactly two names (current function name, and new function name)\n"),
|
_(L"%ls: Expected exactly two names (current function name, and new function name)\n"),
|
||||||
|
@ -1638,8 +1636,8 @@ static int builtin_functions(parser_t &parser, wchar_t **argv)
|
||||||
|
|
||||||
return STATUS_BUILTIN_ERROR;
|
return STATUS_BUILTIN_ERROR;
|
||||||
}
|
}
|
||||||
current_func = argv[woptind];
|
current_func = argv[w.woptind];
|
||||||
new_func = argv[woptind+1];
|
new_func = argv[w.woptind+1];
|
||||||
|
|
||||||
if (!function_exists(current_func))
|
if (!function_exists(current_func))
|
||||||
{
|
{
|
||||||
|
@ -1680,7 +1678,7 @@ static int builtin_functions(parser_t &parser, wchar_t **argv)
|
||||||
return STATUS_BUILTIN_ERROR;
|
return STATUS_BUILTIN_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=woptind; i<argc; i++)
|
for (i=w.woptind; i<argc; i++)
|
||||||
{
|
{
|
||||||
if (!function_exists(argv[i]))
|
if (!function_exists(argv[i]))
|
||||||
res++;
|
res++;
|
||||||
|
@ -1688,7 +1686,7 @@ static int builtin_functions(parser_t &parser, wchar_t **argv)
|
||||||
{
|
{
|
||||||
if (!query)
|
if (!query)
|
||||||
{
|
{
|
||||||
if (i != woptind)
|
if (i != w.woptind)
|
||||||
stdout_buffer.append(L"\n");
|
stdout_buffer.append(L"\n");
|
||||||
|
|
||||||
functions_def(argv[i], stdout_buffer);
|
functions_def(argv[i], stdout_buffer);
|
||||||
|
@ -1984,6 +1982,7 @@ static int builtin_pwd(parser_t &parser, wchar_t **argv)
|
||||||
/** Adds a function to the function set. It calls into function.cpp to perform any heavy lifting. */
|
/** Adds a function to the function set. It calls into function.cpp to perform any heavy lifting. */
|
||||||
int define_function(parser_t &parser, const wcstring_list_t &c_args, const wcstring &contents, int definition_line_offset, wcstring *out_err)
|
int define_function(parser_t &parser, const wcstring_list_t &c_args, const wcstring &contents, int definition_line_offset, wcstring *out_err)
|
||||||
{
|
{
|
||||||
|
wgetopter_t w;
|
||||||
assert(out_err != NULL);
|
assert(out_err != NULL);
|
||||||
|
|
||||||
/* wgetopt expects 'function' as the first argument. Make a new wcstring_list with that property. */
|
/* wgetopt expects 'function' as the first argument. Make a new wcstring_list with that property. */
|
||||||
|
@ -2006,8 +2005,6 @@ int define_function(parser_t &parser, const wcstring_list_t &c_args, const wcstr
|
||||||
|
|
||||||
bool shadows = true;
|
bool shadows = true;
|
||||||
|
|
||||||
woptind=0;
|
|
||||||
|
|
||||||
wcstring_list_t wrap_targets;
|
wcstring_list_t wrap_targets;
|
||||||
|
|
||||||
/* If -a/--argument-names is specified before the function name,
|
/* If -a/--argument-names is specified before the function name,
|
||||||
|
@ -2038,7 +2035,7 @@ int define_function(parser_t &parser, const wcstring_list_t &c_args, const wcstr
|
||||||
int opt_index = 0;
|
int opt_index = 0;
|
||||||
|
|
||||||
// The leading - here specifies RETURN_IN_ORDER
|
// The leading - here specifies RETURN_IN_ORDER
|
||||||
int opt = wgetopt_long(argc,
|
int opt = w.wgetopt_long(argc,
|
||||||
argv,
|
argv,
|
||||||
L"-d:s:j:p:v:e:haSV:",
|
L"-d:s:j:p:v:e:haSV:",
|
||||||
long_options,
|
long_options,
|
||||||
|
@ -2063,19 +2060,19 @@ int define_function(parser_t &parser, const wcstring_list_t &c_args, const wcstr
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'd':
|
case 'd':
|
||||||
desc=woptarg;
|
desc=w.woptarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
{
|
{
|
||||||
int sig = wcs2sig(woptarg);
|
int sig = wcs2sig(w.woptarg);
|
||||||
|
|
||||||
if (sig < 0)
|
if (sig < 0)
|
||||||
{
|
{
|
||||||
append_format(*out_err,
|
append_format(*out_err,
|
||||||
_(L"%ls: Unknown signal '%ls'\n"),
|
_(L"%ls: Unknown signal '%ls'\n"),
|
||||||
argv[0],
|
argv[0],
|
||||||
woptarg);
|
w.woptarg);
|
||||||
res=1;
|
res=1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2085,24 +2082,24 @@ int define_function(parser_t &parser, const wcstring_list_t &c_args, const wcstr
|
||||||
|
|
||||||
case 'v':
|
case 'v':
|
||||||
{
|
{
|
||||||
if (wcsvarname(woptarg))
|
if (wcsvarname(w.woptarg))
|
||||||
{
|
{
|
||||||
append_format(*out_err,
|
append_format(*out_err,
|
||||||
_(L"%ls: Invalid variable name '%ls'\n"),
|
_(L"%ls: Invalid variable name '%ls'\n"),
|
||||||
argv[0],
|
argv[0],
|
||||||
woptarg);
|
w.woptarg);
|
||||||
res=STATUS_BUILTIN_ERROR;
|
res=STATUS_BUILTIN_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
events.push_back(event_t::variable_event(woptarg));
|
events.push_back(event_t::variable_event(w.woptarg));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
case 'e':
|
case 'e':
|
||||||
{
|
{
|
||||||
events.push_back(event_t::generic_event(woptarg));
|
events.push_back(event_t::generic_event(w.woptarg));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2114,7 +2111,7 @@ int define_function(parser_t &parser, const wcstring_list_t &c_args, const wcstr
|
||||||
event_t e(EVENT_ANY);
|
event_t e(EVENT_ANY);
|
||||||
|
|
||||||
if ((opt == 'j') &&
|
if ((opt == 'j') &&
|
||||||
(wcscasecmp(woptarg, L"caller") == 0))
|
(wcscasecmp(w.woptarg, L"caller") == 0))
|
||||||
{
|
{
|
||||||
int job_id = -1;
|
int job_id = -1;
|
||||||
|
|
||||||
|
@ -2155,13 +2152,13 @@ int define_function(parser_t &parser, const wcstring_list_t &c_args, const wcstr
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
errno = 0;
|
errno = 0;
|
||||||
pid = fish_wcstoi(woptarg, &end, 10);
|
pid = fish_wcstoi(w.woptarg, &end, 10);
|
||||||
if (errno || !end || *end)
|
if (errno || !end || *end)
|
||||||
{
|
{
|
||||||
append_format(*out_err,
|
append_format(*out_err,
|
||||||
_(L"%ls: Invalid process id %ls\n"),
|
_(L"%ls: Invalid process id %ls\n"),
|
||||||
argv[0],
|
argv[0],
|
||||||
woptarg);
|
w.woptarg);
|
||||||
res=1;
|
res=1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2192,19 +2189,19 @@ int define_function(parser_t &parser, const wcstring_list_t &c_args, const wcstr
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'w':
|
case 'w':
|
||||||
wrap_targets.push_back(woptarg);
|
wrap_targets.push_back(w.woptarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'V':
|
case 'V':
|
||||||
{
|
{
|
||||||
if (wcsvarname(woptarg))
|
if (wcsvarname(w.woptarg))
|
||||||
{
|
{
|
||||||
append_format(*out_err, _(L"%ls: Invalid variable name '%ls'\n"), argv[0], woptarg);
|
append_format(*out_err, _(L"%ls: Invalid variable name '%ls'\n"), argv[0], w.woptarg);
|
||||||
res = STATUS_BUILTIN_ERROR;
|
res = STATUS_BUILTIN_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
inherit_vars.push_back(woptarg);
|
inherit_vars.push_back(w.woptarg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2213,12 +2210,12 @@ int define_function(parser_t &parser, const wcstring_list_t &c_args, const wcstr
|
||||||
return STATUS_BUILTIN_OK;
|
return STATUS_BUILTIN_OK;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
assert(woptarg != NULL);
|
assert(w.woptarg != NULL);
|
||||||
positionals.push_back(woptarg);
|
positionals.push_back(w.woptarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
builtin_unknown_option(parser, argv[0], argv[woptind-1]);
|
builtin_unknown_option(parser, argv[0], argv[w.woptind-1]);
|
||||||
res = 1;
|
res = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2347,7 +2344,7 @@ static int builtin_random(parser_t &parser, wchar_t **argv)
|
||||||
|
|
||||||
int argc = builtin_count_args(argv);
|
int argc = builtin_count_args(argv);
|
||||||
|
|
||||||
woptind=0;
|
wgetopter_t w;
|
||||||
|
|
||||||
static const struct woption
|
static const struct woption
|
||||||
long_options[] =
|
long_options[] =
|
||||||
|
@ -2366,7 +2363,7 @@ static int builtin_random(parser_t &parser, wchar_t **argv)
|
||||||
{
|
{
|
||||||
int opt_index = 0;
|
int opt_index = 0;
|
||||||
|
|
||||||
int opt = wgetopt_long(argc,
|
int opt = w.wgetopt_long(argc,
|
||||||
argv,
|
argv,
|
||||||
L"h",
|
L"h",
|
||||||
long_options,
|
long_options,
|
||||||
|
@ -2392,14 +2389,14 @@ static int builtin_random(parser_t &parser, wchar_t **argv)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
builtin_unknown_option(parser, argv[0], argv[woptind-1]);
|
builtin_unknown_option(parser, argv[0], argv[w.woptind-1]);
|
||||||
return STATUS_BUILTIN_ERROR;
|
return STATUS_BUILTIN_ERROR;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (argc-woptind)
|
switch (argc-w.woptind)
|
||||||
{
|
{
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -2423,13 +2420,13 @@ static int builtin_random(parser_t &parser, wchar_t **argv)
|
||||||
wchar_t *end=0;
|
wchar_t *end=0;
|
||||||
|
|
||||||
errno=0;
|
errno=0;
|
||||||
foo = wcstol(argv[woptind], &end, 10);
|
foo = wcstol(argv[w.woptind], &end, 10);
|
||||||
if (errno || *end)
|
if (errno || *end)
|
||||||
{
|
{
|
||||||
append_format(stderr_buffer,
|
append_format(stderr_buffer,
|
||||||
_(L"%ls: Seed value '%ls' is not a valid number\n"),
|
_(L"%ls: Seed value '%ls' is not a valid number\n"),
|
||||||
argv[0],
|
argv[0],
|
||||||
argv[woptind]);
|
argv[w.woptind]);
|
||||||
|
|
||||||
return STATUS_BUILTIN_ERROR;
|
return STATUS_BUILTIN_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -2443,7 +2440,7 @@ static int builtin_random(parser_t &parser, wchar_t **argv)
|
||||||
append_format(stderr_buffer,
|
append_format(stderr_buffer,
|
||||||
_(L"%ls: Expected zero or one argument, got %d\n"),
|
_(L"%ls: Expected zero or one argument, got %d\n"),
|
||||||
argv[0],
|
argv[0],
|
||||||
argc-woptind);
|
argc-w.woptind);
|
||||||
builtin_print_help(parser, argv[0], stderr_buffer);
|
builtin_print_help(parser, argv[0], stderr_buffer);
|
||||||
return STATUS_BUILTIN_ERROR;
|
return STATUS_BUILTIN_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -2457,6 +2454,7 @@ static int builtin_random(parser_t &parser, wchar_t **argv)
|
||||||
*/
|
*/
|
||||||
static int builtin_read(parser_t &parser, wchar_t **argv)
|
static int builtin_read(parser_t &parser, wchar_t **argv)
|
||||||
{
|
{
|
||||||
|
wgetopter_t w;
|
||||||
wcstring buff;
|
wcstring buff;
|
||||||
int i, argc = builtin_count_args(argv);
|
int i, argc = builtin_count_args(argv);
|
||||||
int place = ENV_USER;
|
int place = ENV_USER;
|
||||||
|
@ -2471,8 +2469,6 @@ static int builtin_read(parser_t &parser, wchar_t **argv)
|
||||||
int array = 0;
|
int array = 0;
|
||||||
bool split_null = false;
|
bool split_null = false;
|
||||||
|
|
||||||
woptind=0;
|
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
static const struct woption
|
static const struct woption
|
||||||
|
@ -2542,7 +2538,7 @@ static int builtin_read(parser_t &parser, wchar_t **argv)
|
||||||
|
|
||||||
int opt_index = 0;
|
int opt_index = 0;
|
||||||
|
|
||||||
int opt = wgetopt_long(argc,
|
int opt = w.wgetopt_long(argc,
|
||||||
argv,
|
argv,
|
||||||
L"xglUup:R:c:hm:n:saz",
|
L"xglUup:R:c:hm:n:saz",
|
||||||
long_options,
|
long_options,
|
||||||
|
@ -2584,24 +2580,24 @@ static int builtin_read(parser_t &parser, wchar_t **argv)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case L'p':
|
case L'p':
|
||||||
prompt = woptarg;
|
prompt = w.woptarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case L'R':
|
case L'R':
|
||||||
right_prompt = woptarg;
|
right_prompt = w.woptarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case L'c':
|
case L'c':
|
||||||
commandline = woptarg;
|
commandline = w.woptarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case L'm':
|
case L'm':
|
||||||
mode_name = woptarg;
|
mode_name = w.woptarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case L'n':
|
case L'n':
|
||||||
errno = 0;
|
errno = 0;
|
||||||
nchars = fish_wcstoi(woptarg, &end, 10);
|
nchars = fish_wcstoi(w.woptarg, &end, 10);
|
||||||
if (errno || *end != 0)
|
if (errno || *end != 0)
|
||||||
{
|
{
|
||||||
switch (errno)
|
switch (errno)
|
||||||
|
@ -2610,7 +2606,7 @@ static int builtin_read(parser_t &parser, wchar_t **argv)
|
||||||
append_format(stderr_buffer,
|
append_format(stderr_buffer,
|
||||||
_(L"%ls: Argument '%ls' is out of range\n"),
|
_(L"%ls: Argument '%ls' is out of range\n"),
|
||||||
argv[0],
|
argv[0],
|
||||||
woptarg);
|
w.woptarg);
|
||||||
builtin_print_help(parser, argv[0], stderr_buffer);
|
builtin_print_help(parser, argv[0], stderr_buffer);
|
||||||
return STATUS_BUILTIN_ERROR;
|
return STATUS_BUILTIN_ERROR;
|
||||||
|
|
||||||
|
@ -2618,7 +2614,7 @@ static int builtin_read(parser_t &parser, wchar_t **argv)
|
||||||
append_format(stderr_buffer,
|
append_format(stderr_buffer,
|
||||||
_(L"%ls: Argument '%ls' must be an integer\n"),
|
_(L"%ls: Argument '%ls' must be an integer\n"),
|
||||||
argv[0],
|
argv[0],
|
||||||
woptarg);
|
w.woptarg);
|
||||||
builtin_print_help(parser, argv[0], stderr_buffer);
|
builtin_print_help(parser, argv[0], stderr_buffer);
|
||||||
return STATUS_BUILTIN_ERROR;
|
return STATUS_BUILTIN_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -2642,7 +2638,7 @@ static int builtin_read(parser_t &parser, wchar_t **argv)
|
||||||
return STATUS_BUILTIN_OK;
|
return STATUS_BUILTIN_OK;
|
||||||
|
|
||||||
case L'?':
|
case L'?':
|
||||||
builtin_unknown_option(parser, argv[0], argv[woptind-1]);
|
builtin_unknown_option(parser, argv[0], argv[w.woptind-1]);
|
||||||
return STATUS_BUILTIN_ERROR;
|
return STATUS_BUILTIN_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2669,7 +2665,7 @@ static int builtin_read(parser_t &parser, wchar_t **argv)
|
||||||
return STATUS_BUILTIN_ERROR;
|
return STATUS_BUILTIN_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array && woptind+1 != argc)
|
if (array && w.woptind+1 != argc)
|
||||||
{
|
{
|
||||||
append_format(stderr_buffer, _(L"%ls: --array option requires a single variable name.\n"), argv[0]);
|
append_format(stderr_buffer, _(L"%ls: --array option requires a single variable name.\n"), argv[0]);
|
||||||
builtin_print_help(parser, argv[0], stderr_buffer);
|
builtin_print_help(parser, argv[0], stderr_buffer);
|
||||||
|
@ -2680,7 +2676,7 @@ static int builtin_read(parser_t &parser, wchar_t **argv)
|
||||||
/*
|
/*
|
||||||
Verify all variable names
|
Verify all variable names
|
||||||
*/
|
*/
|
||||||
for (i=woptind; i<argc; i++)
|
for (i=w.woptind; i<argc; i++)
|
||||||
{
|
{
|
||||||
wchar_t *src;
|
wchar_t *src;
|
||||||
|
|
||||||
|
@ -2705,7 +2701,7 @@ static int builtin_read(parser_t &parser, wchar_t **argv)
|
||||||
/*
|
/*
|
||||||
The call to reader_readline may change woptind, so we save it away here
|
The call to reader_readline may change woptind, so we save it away here
|
||||||
*/
|
*/
|
||||||
i=woptind;
|
i=w.woptind;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Check if we should read interactively using \c reader_readline()
|
Check if we should read interactively using \c reader_readline()
|
||||||
|
@ -2901,7 +2897,7 @@ static int builtin_read(parser_t &parser, wchar_t **argv)
|
||||||
*/
|
*/
|
||||||
static int builtin_status(parser_t &parser, wchar_t **argv)
|
static int builtin_status(parser_t &parser, wchar_t **argv)
|
||||||
{
|
{
|
||||||
|
wgetopter_t w;
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
NORMAL,
|
NORMAL,
|
||||||
|
@ -2924,8 +2920,6 @@ static int builtin_status(parser_t &parser, wchar_t **argv)
|
||||||
int argc = builtin_count_args(argv);
|
int argc = builtin_count_args(argv);
|
||||||
int res=STATUS_BUILTIN_OK;
|
int res=STATUS_BUILTIN_OK;
|
||||||
|
|
||||||
woptind=0;
|
|
||||||
|
|
||||||
|
|
||||||
const struct woption
|
const struct woption
|
||||||
long_options[] =
|
long_options[] =
|
||||||
|
@ -2988,7 +2982,7 @@ static int builtin_status(parser_t &parser, wchar_t **argv)
|
||||||
{
|
{
|
||||||
int opt_index = 0;
|
int opt_index = 0;
|
||||||
|
|
||||||
int opt = wgetopt_long(argc,
|
int opt = w.wgetopt_long(argc,
|
||||||
argv,
|
argv,
|
||||||
L":cbilfnhj:t",
|
L":cbilfnhj:t",
|
||||||
long_options,
|
long_options,
|
||||||
|
@ -3037,17 +3031,17 @@ static int builtin_status(parser_t &parser, wchar_t **argv)
|
||||||
return STATUS_BUILTIN_OK;
|
return STATUS_BUILTIN_OK;
|
||||||
|
|
||||||
case 'j':
|
case 'j':
|
||||||
if (wcscmp(woptarg, L"full") == 0)
|
if (wcscmp(w.woptarg, L"full") == 0)
|
||||||
job_control_mode = JOB_CONTROL_ALL;
|
job_control_mode = JOB_CONTROL_ALL;
|
||||||
else if (wcscmp(woptarg, L"interactive") == 0)
|
else if (wcscmp(w.woptarg, L"interactive") == 0)
|
||||||
job_control_mode = JOB_CONTROL_INTERACTIVE;
|
job_control_mode = JOB_CONTROL_INTERACTIVE;
|
||||||
else if (wcscmp(woptarg, L"none") == 0)
|
else if (wcscmp(w.woptarg, L"none") == 0)
|
||||||
job_control_mode = JOB_CONTROL_NONE;
|
job_control_mode = JOB_CONTROL_NONE;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
append_format(stderr_buffer,
|
append_format(stderr_buffer,
|
||||||
L"%ls: Invalid job control mode '%ls'\n",
|
L"%ls: Invalid job control mode '%ls'\n",
|
||||||
L"status", woptarg);
|
L"status", w.woptarg);
|
||||||
res = 1;
|
res = 1;
|
||||||
}
|
}
|
||||||
mode = DONE;
|
mode = DONE;
|
||||||
|
@ -3059,11 +3053,11 @@ static int builtin_status(parser_t &parser, wchar_t **argv)
|
||||||
|
|
||||||
|
|
||||||
case ':':
|
case ':':
|
||||||
builtin_missing_argument(parser, argv[0], argv[woptind-1]);
|
builtin_missing_argument(parser, argv[0], argv[w.woptind-1]);
|
||||||
return STATUS_BUILTIN_ERROR;
|
return STATUS_BUILTIN_ERROR;
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
builtin_unknown_option(parser, argv[0], argv[woptind-1]);
|
builtin_unknown_option(parser, argv[0], argv[w.woptind-1]);
|
||||||
return STATUS_BUILTIN_ERROR;
|
return STATUS_BUILTIN_ERROR;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3320,13 +3314,12 @@ static int builtin_count(parser_t &parser, wchar_t ** argv)
|
||||||
*/
|
*/
|
||||||
static int builtin_contains(parser_t &parser, wchar_t ** argv)
|
static int builtin_contains(parser_t &parser, wchar_t ** argv)
|
||||||
{
|
{
|
||||||
|
wgetopter_t w;
|
||||||
int argc;
|
int argc;
|
||||||
argc = builtin_count_args(argv);
|
argc = builtin_count_args(argv);
|
||||||
wchar_t *needle;
|
wchar_t *needle;
|
||||||
bool should_output_index = false;
|
bool should_output_index = false;
|
||||||
|
|
||||||
woptind=0;
|
|
||||||
|
|
||||||
const struct woption long_options[] =
|
const struct woption long_options[] =
|
||||||
{
|
{
|
||||||
{ L"help", no_argument, 0, 'h' } ,
|
{ L"help", no_argument, 0, 'h' } ,
|
||||||
|
@ -3338,7 +3331,7 @@ static int builtin_contains(parser_t &parser, wchar_t ** argv)
|
||||||
{
|
{
|
||||||
int opt_index = 0;
|
int opt_index = 0;
|
||||||
|
|
||||||
int opt = wgetopt_long(argc,
|
int opt = w.wgetopt_long(argc,
|
||||||
argv,
|
argv,
|
||||||
L"+hi",
|
L"+hi",
|
||||||
long_options,
|
long_options,
|
||||||
|
@ -3366,11 +3359,11 @@ static int builtin_contains(parser_t &parser, wchar_t ** argv)
|
||||||
|
|
||||||
|
|
||||||
case ':':
|
case ':':
|
||||||
builtin_missing_argument(parser, argv[0], argv[woptind-1]);
|
builtin_missing_argument(parser, argv[0], argv[w.woptind-1]);
|
||||||
return STATUS_BUILTIN_ERROR;
|
return STATUS_BUILTIN_ERROR;
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
builtin_unknown_option(parser, argv[0], argv[woptind-1]);
|
builtin_unknown_option(parser, argv[0], argv[w.woptind-1]);
|
||||||
return STATUS_BUILTIN_ERROR;
|
return STATUS_BUILTIN_ERROR;
|
||||||
|
|
||||||
case 'i':
|
case 'i':
|
||||||
|
@ -3380,19 +3373,19 @@ static int builtin_contains(parser_t &parser, wchar_t ** argv)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
needle = argv[woptind];
|
needle = argv[w.woptind];
|
||||||
if (!needle)
|
if (!needle)
|
||||||
{
|
{
|
||||||
append_format(stderr_buffer, _(L"%ls: Key not specified\n"), argv[0]);
|
append_format(stderr_buffer, _(L"%ls: Key not specified\n"), argv[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (int i=woptind+1; i<argc; i++)
|
for (int i=w.woptind+1; i<argc; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!wcscmp(needle, argv[i]))
|
if (!wcscmp(needle, argv[i]))
|
||||||
{
|
{
|
||||||
if (should_output_index) append_format(stdout_buffer, L"%d\n", i-woptind);
|
if (should_output_index) append_format(stdout_buffer, L"%d\n", i-w.woptind);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3905,14 +3898,15 @@ static int builtin_history(parser_t &parser, wchar_t **argv)
|
||||||
|
|
||||||
int opt = 0;
|
int opt = 0;
|
||||||
int opt_index = 0;
|
int opt_index = 0;
|
||||||
woptind = 0;
|
|
||||||
|
wgetopter_t w;
|
||||||
history_t *history = reader_get_history();
|
history_t *history = reader_get_history();
|
||||||
|
|
||||||
/* Use the default history if we have none (which happens if invoked non-interactively, e.g. from webconfig.py */
|
/* Use the default history if we have none (which happens if invoked non-interactively, e.g. from webconfig.py */
|
||||||
if (! history)
|
if (! history)
|
||||||
history = &history_t::history_with_name(L"fish");
|
history = &history_t::history_with_name(L"fish");
|
||||||
|
|
||||||
while ((opt = wgetopt_long_only(argc, argv, L"pdscvl", long_options, &opt_index)) != EOF)
|
while ((opt = w.wgetopt_long_only(argc, argv, L"pdscvl", long_options, &opt_index)) != EOF)
|
||||||
{
|
{
|
||||||
switch (opt)
|
switch (opt)
|
||||||
{
|
{
|
||||||
|
@ -3941,17 +3935,17 @@ static int builtin_history(parser_t &parser, wchar_t **argv)
|
||||||
return STATUS_BUILTIN_OK;
|
return STATUS_BUILTIN_OK;
|
||||||
break;
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
append_format(stderr_buffer, BUILTIN_ERR_UNKNOWN, argv[0], argv[woptind-1]);
|
append_format(stderr_buffer, BUILTIN_ERR_UNKNOWN, argv[0], argv[w.woptind-1]);
|
||||||
return STATUS_BUILTIN_ERROR;
|
return STATUS_BUILTIN_ERROR;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
append_format(stderr_buffer, BUILTIN_ERR_UNKNOWN, argv[0], argv[woptind-1]);
|
append_format(stderr_buffer, BUILTIN_ERR_UNKNOWN, argv[0], argv[w.woptind-1]);
|
||||||
return STATUS_BUILTIN_ERROR;
|
return STATUS_BUILTIN_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Everything after is an argument */
|
/* Everything after is an argument */
|
||||||
const wcstring_list_t args(argv + woptind, argv + argc);
|
const wcstring_list_t args(argv + w.woptind, argv + argc);
|
||||||
|
|
||||||
if (argc == 1)
|
if (argc == 1)
|
||||||
{
|
{
|
||||||
|
@ -4154,8 +4148,6 @@ static const builtin_data_t *builtin_lookup(const wcstring &name)
|
||||||
|
|
||||||
void builtin_init()
|
void builtin_init()
|
||||||
{
|
{
|
||||||
|
|
||||||
wopterr = 0;
|
|
||||||
for (size_t i=0; i < BUILTIN_COUNT; i++)
|
for (size_t i=0; i < BUILTIN_COUNT; i++)
|
||||||
{
|
{
|
||||||
intern_static(builtin_datas[i].name);
|
intern_static(builtin_datas[i].name);
|
|
@ -247,7 +247,7 @@ static void write_part(const wchar_t *begin,
|
||||||
*/
|
*/
|
||||||
static int builtin_commandline(parser_t &parser, wchar_t **argv)
|
static int builtin_commandline(parser_t &parser, wchar_t **argv)
|
||||||
{
|
{
|
||||||
|
wgetopter_t w;
|
||||||
int buffer_part=0;
|
int buffer_part=0;
|
||||||
int cut_at_cursor=0;
|
int cut_at_cursor=0;
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ static int builtin_commandline(parser_t &parser, wchar_t **argv)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
woptind=0;
|
w.woptind=0;
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
@ -327,7 +327,7 @@ static int builtin_commandline(parser_t &parser, wchar_t **argv)
|
||||||
|
|
||||||
int opt_index = 0;
|
int opt_index = 0;
|
||||||
|
|
||||||
int opt = wgetopt_long(argc,
|
int opt = w.wgetopt_long(argc,
|
||||||
argv,
|
argv,
|
||||||
L"abijpctwforhI:CLSsP",
|
L"abijpctwforhI:CLSsP",
|
||||||
long_options,
|
long_options,
|
||||||
|
@ -390,8 +390,8 @@ static int builtin_commandline(parser_t &parser, wchar_t **argv)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'I':
|
case 'I':
|
||||||
current_buffer = woptarg;
|
current_buffer = w.woptarg;
|
||||||
current_cursor_pos = wcslen(woptarg);
|
current_cursor_pos = wcslen(w.woptarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
|
@ -419,7 +419,7 @@ static int builtin_commandline(parser_t &parser, wchar_t **argv)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case L'?':
|
case L'?':
|
||||||
builtin_unknown_option(parser, argv[0], argv[woptind-1]);
|
builtin_unknown_option(parser, argv[0], argv[w.woptind-1]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -442,7 +442,7 @@ static int builtin_commandline(parser_t &parser, wchar_t **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (argc == woptind)
|
if (argc == w.woptind)
|
||||||
{
|
{
|
||||||
append_format(stderr_buffer,
|
append_format(stderr_buffer,
|
||||||
BUILTIN_ERR_MISSING,
|
BUILTIN_ERR_MISSING,
|
||||||
|
@ -451,7 +451,7 @@ static int builtin_commandline(parser_t &parser, wchar_t **argv)
|
||||||
builtin_print_help(parser, argv[0], stderr_buffer);
|
builtin_print_help(parser, argv[0], stderr_buffer);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
for (i=woptind; i<argc; i++)
|
for (i=w.woptind; i<argc; i++)
|
||||||
{
|
{
|
||||||
wchar_t c = input_function_get_code(argv[i]);
|
wchar_t c = input_function_get_code(argv[i]);
|
||||||
if (c != (wchar_t)(-1))
|
if (c != (wchar_t)(-1))
|
||||||
|
@ -491,7 +491,7 @@ static int builtin_commandline(parser_t &parser, wchar_t **argv)
|
||||||
/*
|
/*
|
||||||
Check for invalid switch combinations
|
Check for invalid switch combinations
|
||||||
*/
|
*/
|
||||||
if ((search_mode || line_mode || cursor_mode || paging_mode) && (argc-woptind > 1))
|
if ((search_mode || line_mode || cursor_mode || paging_mode) && (argc-w.woptind > 1))
|
||||||
{
|
{
|
||||||
|
|
||||||
append_format(stderr_buffer,
|
append_format(stderr_buffer,
|
||||||
|
@ -513,7 +513,7 @@ static int builtin_commandline(parser_t &parser, wchar_t **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((tokenize || cut_at_cursor) && (argc-woptind))
|
if ((tokenize || cut_at_cursor) && (argc-w.woptind))
|
||||||
{
|
{
|
||||||
append_format(stderr_buffer,
|
append_format(stderr_buffer,
|
||||||
BUILTIN_ERR_COMBO2,
|
BUILTIN_ERR_COMBO2,
|
||||||
|
@ -525,7 +525,7 @@ static int builtin_commandline(parser_t &parser, wchar_t **argv)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (append_mode && !(argc-woptind))
|
if (append_mode && !(argc-w.woptind))
|
||||||
{
|
{
|
||||||
append_format(stderr_buffer,
|
append_format(stderr_buffer,
|
||||||
BUILTIN_ERR_COMBO2,
|
BUILTIN_ERR_COMBO2,
|
||||||
|
@ -551,19 +551,19 @@ static int builtin_commandline(parser_t &parser, wchar_t **argv)
|
||||||
|
|
||||||
if (cursor_mode)
|
if (cursor_mode)
|
||||||
{
|
{
|
||||||
if (argc-woptind)
|
if (argc-w.woptind)
|
||||||
{
|
{
|
||||||
wchar_t *endptr;
|
wchar_t *endptr;
|
||||||
long new_pos;
|
long new_pos;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
|
||||||
new_pos = wcstol(argv[woptind], &endptr, 10);
|
new_pos = wcstol(argv[w.woptind], &endptr, 10);
|
||||||
if (*endptr || errno)
|
if (*endptr || errno)
|
||||||
{
|
{
|
||||||
append_format(stderr_buffer,
|
append_format(stderr_buffer,
|
||||||
BUILTIN_ERR_NOT_NUMBER,
|
BUILTIN_ERR_NOT_NUMBER,
|
||||||
argv[0],
|
argv[0],
|
||||||
argv[woptind]);
|
argv[w.woptind]);
|
||||||
builtin_print_help(parser, argv[0], stderr_buffer);
|
builtin_print_help(parser, argv[0], stderr_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -639,7 +639,7 @@ static int builtin_commandline(parser_t &parser, wchar_t **argv)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (argc-woptind)
|
switch (argc-w.woptind)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
|
@ -649,16 +649,16 @@ static int builtin_commandline(parser_t &parser, wchar_t **argv)
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
replace_part(begin, end, argv[woptind], append_mode);
|
replace_part(begin, end, argv[w.woptind], append_mode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
wcstring sb = argv[woptind];
|
wcstring sb = argv[w.woptind];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=woptind+1; i<argc; i++)
|
for (i=w.woptind+1; i<argc; i++)
|
||||||
{
|
{
|
||||||
sb.push_back(L'\n');
|
sb.push_back(L'\n');
|
||||||
sb.append(argv[i]);
|
sb.append(argv[i]);
|
|
@ -287,6 +287,7 @@ static void builtin_complete_remove(const wcstring_list_t &cmd,
|
||||||
static int builtin_complete(parser_t &parser, wchar_t **argv)
|
static int builtin_complete(parser_t &parser, wchar_t **argv)
|
||||||
{
|
{
|
||||||
ASSERT_IS_MAIN_THREAD();
|
ASSERT_IS_MAIN_THREAD();
|
||||||
|
wgetopter_t w;
|
||||||
bool res=false;
|
bool res=false;
|
||||||
int argc=0;
|
int argc=0;
|
||||||
int result_mode=SHARED;
|
int result_mode=SHARED;
|
||||||
|
@ -308,7 +309,7 @@ static int builtin_complete(parser_t &parser, wchar_t **argv)
|
||||||
|
|
||||||
argc = builtin_count_args(argv);
|
argc = builtin_count_args(argv);
|
||||||
|
|
||||||
woptind=0;
|
w.woptind=0;
|
||||||
|
|
||||||
while (! res)
|
while (! res)
|
||||||
{
|
{
|
||||||
|
@ -337,7 +338,7 @@ static int builtin_complete(parser_t &parser, wchar_t **argv)
|
||||||
|
|
||||||
int opt_index = 0;
|
int opt_index = 0;
|
||||||
|
|
||||||
int opt = wgetopt_long(argc,
|
int opt = w.wgetopt_long(argc,
|
||||||
argv,
|
argv,
|
||||||
L"a:c:p:s:l:o:d:frxeuAn:C::w:h",
|
L"a:c:p:s:l:o:d:frxeuAn:C::w:h",
|
||||||
long_options,
|
long_options,
|
||||||
|
@ -376,7 +377,7 @@ static int builtin_complete(parser_t &parser, wchar_t **argv)
|
||||||
case 'c':
|
case 'c':
|
||||||
{
|
{
|
||||||
wcstring tmp;
|
wcstring tmp;
|
||||||
if (unescape_string(woptarg, &tmp, UNESCAPE_SPECIAL))
|
if (unescape_string(w.woptarg, &tmp, UNESCAPE_SPECIAL))
|
||||||
{
|
{
|
||||||
if (opt=='p')
|
if (opt=='p')
|
||||||
path.push_back(tmp);
|
path.push_back(tmp);
|
||||||
|
@ -385,14 +386,14 @@ static int builtin_complete(parser_t &parser, wchar_t **argv)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
append_format(stderr_buffer, L"%ls: Invalid token '%ls'\n", argv[0], woptarg);
|
append_format(stderr_buffer, L"%ls: Invalid token '%ls'\n", argv[0], w.woptarg);
|
||||||
res = true;
|
res = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'd':
|
case 'd':
|
||||||
desc = woptarg;
|
desc = w.woptarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'u':
|
case 'u':
|
||||||
|
@ -404,19 +405,19 @@ static int builtin_complete(parser_t &parser, wchar_t **argv)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
short_opt.append(woptarg);
|
short_opt.append(w.woptarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'l':
|
case 'l':
|
||||||
gnu_opt.push_back(woptarg);
|
gnu_opt.push_back(w.woptarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'o':
|
case 'o':
|
||||||
old_opt.push_back(woptarg);
|
old_opt.push_back(w.woptarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'a':
|
case 'a':
|
||||||
comp = woptarg;
|
comp = w.woptarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'e':
|
case 'e':
|
||||||
|
@ -424,16 +425,16 @@ static int builtin_complete(parser_t &parser, wchar_t **argv)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'n':
|
case 'n':
|
||||||
condition = woptarg;
|
condition = w.woptarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'w':
|
case 'w':
|
||||||
wrap_targets.push_back(woptarg);
|
wrap_targets.push_back(w.woptarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
do_complete = true;
|
do_complete = true;
|
||||||
do_complete_param = woptarg ? woptarg : reader_get_buffer();
|
do_complete_param = w.woptarg ? w.woptarg : reader_get_buffer();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
|
@ -441,7 +442,7 @@ static int builtin_complete(parser_t &parser, wchar_t **argv)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
builtin_unknown_option(parser, argv[0], argv[woptind-1]);
|
builtin_unknown_option(parser, argv[0], argv[w.woptind-1]);
|
||||||
res = true;
|
res = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -545,7 +546,7 @@ static int builtin_complete(parser_t &parser, wchar_t **argv)
|
||||||
recursion_level--;
|
recursion_level--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (woptind != argc)
|
else if (w.woptind != argc)
|
||||||
{
|
{
|
||||||
append_format(stderr_buffer,
|
append_format(stderr_buffer,
|
||||||
_(L"%ls: Too many arguments\n"),
|
_(L"%ls: Too many arguments\n"),
|
|
@ -160,13 +160,14 @@ static void builtin_jobs_print(const job_t *j, int mode, int header)
|
||||||
*/
|
*/
|
||||||
static int builtin_jobs(parser_t &parser, wchar_t **argv)
|
static int builtin_jobs(parser_t &parser, wchar_t **argv)
|
||||||
{
|
{
|
||||||
|
wgetopter_t w;
|
||||||
int argc=0;
|
int argc=0;
|
||||||
int found=0;
|
int found=0;
|
||||||
int mode=JOBS_DEFAULT;
|
int mode=JOBS_DEFAULT;
|
||||||
int print_last = 0;
|
int print_last = 0;
|
||||||
|
|
||||||
argc = builtin_count_args(argv);
|
argc = builtin_count_args(argv);
|
||||||
woptind=0;
|
w.woptind=0;
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
@ -201,7 +202,7 @@ static int builtin_jobs(parser_t &parser, wchar_t **argv)
|
||||||
|
|
||||||
int opt_index = 0;
|
int opt_index = 0;
|
||||||
|
|
||||||
int opt = wgetopt_long(argc,
|
int opt = w.wgetopt_long(argc,
|
||||||
argv,
|
argv,
|
||||||
L"pclgh",
|
L"pclgh",
|
||||||
long_options,
|
long_options,
|
||||||
|
@ -248,7 +249,7 @@ static int builtin_jobs(parser_t &parser, wchar_t **argv)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
builtin_unknown_option(parser, argv[0], argv[woptind-1]);
|
builtin_unknown_option(parser, argv[0], argv[w.woptind-1]);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -283,13 +284,13 @@ static int builtin_jobs(parser_t &parser, wchar_t **argv)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (woptind < argc)
|
if (w.woptind < argc)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
found = 1;
|
found = 1;
|
||||||
|
|
||||||
for (i=woptind; i<argc; i++)
|
for (i=w.woptind; i<argc; i++)
|
||||||
{
|
{
|
||||||
int pid;
|
int pid;
|
||||||
wchar_t *end;
|
wchar_t *end;
|
|
@ -396,6 +396,7 @@ static void print_variables(int include_values, int esc, bool shorten_ok, int sc
|
||||||
*/
|
*/
|
||||||
static int builtin_set(parser_t &parser, wchar_t **argv)
|
static int builtin_set(parser_t &parser, wchar_t **argv)
|
||||||
{
|
{
|
||||||
|
wgetopter_t w;
|
||||||
/** Variables used for parsing the argument list */
|
/** Variables used for parsing the argument list */
|
||||||
const struct woption long_options[] =
|
const struct woption long_options[] =
|
||||||
{
|
{
|
||||||
|
@ -439,10 +440,10 @@ static int builtin_set(parser_t &parser, wchar_t **argv)
|
||||||
|
|
||||||
|
|
||||||
/* Parse options to obtain the requested operation and the modifiers */
|
/* Parse options to obtain the requested operation and the modifiers */
|
||||||
woptind = 0;
|
w.woptind = 0;
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
int c = wgetopt_long(argc, argv, short_options, long_options, 0);
|
int c = w.wgetopt_long(argc, argv, short_options, long_options, 0);
|
||||||
|
|
||||||
if (c == -1)
|
if (c == -1)
|
||||||
{
|
{
|
||||||
|
@ -498,7 +499,7 @@ static int builtin_set(parser_t &parser, wchar_t **argv)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
builtin_unknown_option(parser, argv[0], argv[woptind-1]);
|
builtin_unknown_option(parser, argv[0], argv[w.woptind-1]);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -573,7 +574,7 @@ static int builtin_set(parser_t &parser, wchar_t **argv)
|
||||||
out of the specified variables.
|
out of the specified variables.
|
||||||
*/
|
*/
|
||||||
int i;
|
int i;
|
||||||
for (i=woptind; i<argc; i++)
|
for (i=w.woptind; i<argc; i++)
|
||||||
{
|
{
|
||||||
wchar_t *arg = argv[i];
|
wchar_t *arg = argv[i];
|
||||||
int slice=0;
|
int slice=0;
|
||||||
|
@ -635,7 +636,7 @@ static int builtin_set(parser_t &parser, wchar_t **argv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (woptind == argc)
|
if (w.woptind == argc)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Print values of variables
|
Print values of variables
|
||||||
|
@ -658,7 +659,7 @@ static int builtin_set(parser_t &parser, wchar_t **argv)
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(dest = wcsdup(argv[woptind])))
|
if (!(dest = wcsdup(argv[w.woptind])))
|
||||||
{
|
{
|
||||||
DIE_MEM();
|
DIE_MEM();
|
||||||
}
|
}
|
||||||
|
@ -711,9 +712,9 @@ static int builtin_set(parser_t &parser, wchar_t **argv)
|
||||||
|
|
||||||
if (!retcode)
|
if (!retcode)
|
||||||
{
|
{
|
||||||
for (; woptind<argc; woptind++)
|
for (; w.woptind<argc; w.woptind++)
|
||||||
{
|
{
|
||||||
if (!parse_index(indexes, argv[woptind], dest, result.size()))
|
if (!parse_index(indexes, argv[w.woptind], dest, result.size()))
|
||||||
{
|
{
|
||||||
builtin_print_help(parser, argv[0], stderr_buffer);
|
builtin_print_help(parser, argv[0], stderr_buffer);
|
||||||
retcode = 1;
|
retcode = 1;
|
||||||
|
@ -721,7 +722,7 @@ static int builtin_set(parser_t &parser, wchar_t **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t idx_count = indexes.size();
|
size_t idx_count = indexes.size();
|
||||||
size_t val_count = argc-woptind-1;
|
size_t val_count = argc-w.woptind-1;
|
||||||
|
|
||||||
if (!erase)
|
if (!erase)
|
||||||
{
|
{
|
||||||
|
@ -734,7 +735,7 @@ static int builtin_set(parser_t &parser, wchar_t **argv)
|
||||||
}
|
}
|
||||||
if (val_count == idx_count)
|
if (val_count == idx_count)
|
||||||
{
|
{
|
||||||
woptind++;
|
w.woptind++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -756,9 +757,9 @@ static int builtin_set(parser_t &parser, wchar_t **argv)
|
||||||
{
|
{
|
||||||
wcstring_list_t value;
|
wcstring_list_t value;
|
||||||
|
|
||||||
while (woptind < argc)
|
while (w.woptind < argc)
|
||||||
{
|
{
|
||||||
value.push_back(argv[woptind++]);
|
value.push_back(argv[w.woptind++]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (update_values(result,
|
if (update_values(result,
|
||||||
|
@ -778,14 +779,14 @@ static int builtin_set(parser_t &parser, wchar_t **argv)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
woptind++;
|
w.woptind++;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
No slicing
|
No slicing
|
||||||
*/
|
*/
|
||||||
if (erase)
|
if (erase)
|
||||||
{
|
{
|
||||||
if (woptind != argc)
|
if (w.woptind != argc)
|
||||||
{
|
{
|
||||||
append_format(stderr_buffer,
|
append_format(stderr_buffer,
|
||||||
_(L"%ls: Values cannot be specfied with erase\n"),
|
_(L"%ls: Values cannot be specfied with erase\n"),
|
||||||
|
@ -801,7 +802,7 @@ static int builtin_set(parser_t &parser, wchar_t **argv)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wcstring_list_t val;
|
wcstring_list_t val;
|
||||||
for (i=woptind; i<argc; i++)
|
for (i=w.woptind; i<argc; i++)
|
||||||
val.push_back(argv[i]);
|
val.push_back(argv[i]);
|
||||||
retcode = my_env_set(dest, val, scope);
|
retcode = my_env_set(dest, val, scope);
|
||||||
}
|
}
|
|
@ -67,6 +67,7 @@ static int set_color_builtin_outputter(char c)
|
||||||
*/
|
*/
|
||||||
static int builtin_set_color(parser_t &parser, wchar_t **argv)
|
static int builtin_set_color(parser_t &parser, wchar_t **argv)
|
||||||
{
|
{
|
||||||
|
wgetopter_t w;
|
||||||
/** Variables used for parsing the argument list */
|
/** Variables used for parsing the argument list */
|
||||||
const struct woption long_options[] =
|
const struct woption long_options[] =
|
||||||
{
|
{
|
||||||
|
@ -94,10 +95,10 @@ static int builtin_set_color(parser_t &parser, wchar_t **argv)
|
||||||
int errret;
|
int errret;
|
||||||
|
|
||||||
/* Parse options to obtain the requested operation and the modifiers */
|
/* Parse options to obtain the requested operation and the modifiers */
|
||||||
woptind = 0;
|
w.woptind = 0;
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
int c = wgetopt_long(argc, argv, short_options, long_options, 0);
|
int c = w.wgetopt_long(argc, argv, short_options, long_options, 0);
|
||||||
|
|
||||||
if (c == -1)
|
if (c == -1)
|
||||||
{
|
{
|
||||||
|
@ -110,7 +111,7 @@ static int builtin_set_color(parser_t &parser, wchar_t **argv)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'b':
|
case 'b':
|
||||||
bgcolor = woptarg;
|
bgcolor = w.woptarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
|
@ -136,12 +137,12 @@ static int builtin_set_color(parser_t &parser, wchar_t **argv)
|
||||||
|
|
||||||
/* Remaining arguments are foreground color */
|
/* Remaining arguments are foreground color */
|
||||||
std::vector<rgb_color_t> fgcolors;
|
std::vector<rgb_color_t> fgcolors;
|
||||||
for (; woptind < argc; woptind++)
|
for (; w.woptind < argc; w.woptind++)
|
||||||
{
|
{
|
||||||
rgb_color_t fg = rgb_color_t(argv[woptind]);
|
rgb_color_t fg = rgb_color_t(argv[w.woptind]);
|
||||||
if (fg.is_none() || fg.is_ignore())
|
if (fg.is_none() || fg.is_ignore())
|
||||||
{
|
{
|
||||||
append_format(stderr_buffer, _(L"%ls: Unknown color '%ls'\n"), argv[0], argv[woptind]);
|
append_format(stderr_buffer, _(L"%ls: Unknown color '%ls'\n"), argv[0], argv[w.woptind]);
|
||||||
return STATUS_BUILTIN_ERROR;
|
return STATUS_BUILTIN_ERROR;
|
||||||
}
|
}
|
||||||
fgcolors.push_back(fg);
|
fgcolors.push_back(fg);
|
|
@ -254,6 +254,7 @@ static int set(int resource, int hard, int soft, rlim_t value)
|
||||||
*/
|
*/
|
||||||
static int builtin_ulimit(parser_t &parser, wchar_t ** argv)
|
static int builtin_ulimit(parser_t &parser, wchar_t ** argv)
|
||||||
{
|
{
|
||||||
|
wgetopter_t w;
|
||||||
int hard=0;
|
int hard=0;
|
||||||
int soft=0;
|
int soft=0;
|
||||||
|
|
||||||
|
@ -262,7 +263,7 @@ static int builtin_ulimit(parser_t &parser, wchar_t ** argv)
|
||||||
|
|
||||||
int argc = builtin_count_args(argv);
|
int argc = builtin_count_args(argv);
|
||||||
|
|
||||||
woptind=0;
|
w.woptind=0;
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
@ -334,7 +335,7 @@ static int builtin_ulimit(parser_t &parser, wchar_t ** argv)
|
||||||
|
|
||||||
int opt_index = 0;
|
int opt_index = 0;
|
||||||
|
|
||||||
int opt = wgetopt_long(argc,
|
int opt = w.wgetopt_long(argc,
|
||||||
argv,
|
argv,
|
||||||
L"aHScdflmnstuvh",
|
L"aHScdflmnstuvh",
|
||||||
long_options,
|
long_options,
|
||||||
|
@ -419,14 +420,14 @@ static int builtin_ulimit(parser_t &parser, wchar_t ** argv)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case L'?':
|
case L'?':
|
||||||
builtin_unknown_option(parser, argv[0], argv[woptind-1]);
|
builtin_unknown_option(parser, argv[0], argv[w.woptind-1]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (report_all)
|
if (report_all)
|
||||||
{
|
{
|
||||||
if (argc - woptind == 0)
|
if (argc - w.woptind == 0)
|
||||||
{
|
{
|
||||||
print_all(hard);
|
print_all(hard);
|
||||||
}
|
}
|
||||||
|
@ -441,7 +442,7 @@ static int builtin_ulimit(parser_t &parser, wchar_t ** argv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (argc - woptind)
|
switch (argc - w.woptind)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
|
@ -468,28 +469,28 @@ static int builtin_ulimit(parser_t &parser, wchar_t ** argv)
|
||||||
hard=soft=1;
|
hard=soft=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wcscasecmp(argv[woptind], L"unlimited")==0)
|
if (wcscasecmp(argv[w.woptind], L"unlimited")==0)
|
||||||
{
|
{
|
||||||
new_limit = RLIM_INFINITY;
|
new_limit = RLIM_INFINITY;
|
||||||
}
|
}
|
||||||
else if (wcscasecmp(argv[woptind], L"hard")==0)
|
else if (wcscasecmp(argv[w.woptind], L"hard")==0)
|
||||||
{
|
{
|
||||||
new_limit = get(what, 1);
|
new_limit = get(what, 1);
|
||||||
}
|
}
|
||||||
else if (wcscasecmp(argv[woptind], L"soft")==0)
|
else if (wcscasecmp(argv[w.woptind], L"soft")==0)
|
||||||
{
|
{
|
||||||
new_limit = get(what, soft);
|
new_limit = get(what, soft);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
errno=0;
|
errno=0;
|
||||||
new_limit = wcstol(argv[woptind], &end, 10);
|
new_limit = wcstol(argv[w.woptind], &end, 10);
|
||||||
if (errno || *end)
|
if (errno || *end)
|
||||||
{
|
{
|
||||||
append_format(stderr_buffer,
|
append_format(stderr_buffer,
|
||||||
L"%ls: Invalid limit '%ls'\n",
|
L"%ls: Invalid limit '%ls'\n",
|
||||||
argv[0],
|
argv[0],
|
||||||
argv[woptind]);
|
argv[w.woptind]);
|
||||||
builtin_print_help(parser, argv[0], stderr_buffer);
|
builtin_print_help(parser, argv[0], stderr_buffer);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
|
@ -861,21 +861,21 @@ static int wcsncasecmp_fallback(const wchar_t *a, const wchar_t *b, size_t count
|
||||||
/* Note parens avoid the macro expansion */
|
/* Note parens avoid the macro expansion */
|
||||||
wchar_t *wcsdup_use_weak(const wchar_t *a)
|
wchar_t *wcsdup_use_weak(const wchar_t *a)
|
||||||
{
|
{
|
||||||
if (wcsdup != NULL)
|
if (&wcsdup != NULL)
|
||||||
return (wcsdup)(a);
|
return (wcsdup)(a);
|
||||||
return wcsdup_fallback(a);
|
return wcsdup_fallback(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wcscasecmp_use_weak(const wchar_t *a, const wchar_t *b)
|
int wcscasecmp_use_weak(const wchar_t *a, const wchar_t *b)
|
||||||
{
|
{
|
||||||
if (wcscasecmp != NULL)
|
if (&wcscasecmp != NULL)
|
||||||
return (wcscasecmp)(a, b);
|
return (wcscasecmp)(a, b);
|
||||||
return wcscasecmp_fallback(a, b);
|
return wcscasecmp_fallback(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wcsncasecmp_use_weak(const wchar_t *s1, const wchar_t *s2, size_t n)
|
int wcsncasecmp_use_weak(const wchar_t *s1, const wchar_t *s2, size_t n)
|
||||||
{
|
{
|
||||||
if (wcsncasecmp != NULL)
|
if (&wcsncasecmp != NULL)
|
||||||
return (wcsncasecmp)(s1, s2, n);
|
return (wcsncasecmp)(s1, s2, n);
|
||||||
return wcsncasecmp_fallback(s1, s2, n);
|
return wcsncasecmp_fallback(s1, s2, n);
|
||||||
}
|
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue