mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-11 19:31:15 -03:00
Compare commits
222 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c47dae77a4 | ||
|
|
53160d134e | ||
|
|
619defd748 | ||
|
|
40db2b3c2a | ||
|
|
b05ccee0f0 | ||
|
|
d722fa59ca | ||
|
|
60065614bd | ||
|
|
05b39a9bdb | ||
|
|
91ab644173 | ||
|
|
083fcd6491 | ||
|
|
7e9e7d77d1 | ||
|
|
66ee644130 | ||
|
|
c20b8982bc | ||
|
|
15bb8f712d | ||
|
|
d48e9ef8b1 | ||
|
|
acd28b5dc4 | ||
|
|
1fe4863039 | ||
|
|
d347da963b | ||
|
|
930bb9c6d1 | ||
|
|
676c3ed505 | ||
|
|
2d3588fa51 | ||
|
|
4835945c09 | ||
|
|
82bff9f407 | ||
|
|
3b6d8756ea | ||
|
|
d1bb30afae | ||
|
|
7a1d64637d | ||
|
|
5f85d27671 | ||
|
|
5d828b5fcf | ||
|
|
c2f6c6c1d2 | ||
|
|
7726cffdab | ||
|
|
3570013496 | ||
|
|
2401a163fe | ||
|
|
e8d802c5e1 | ||
|
|
dca4167de6 | ||
|
|
6d0b6e5de5 | ||
|
|
fd6bf06f15 | ||
|
|
d2e11ea61d | ||
|
|
dad2b93d1e | ||
|
|
1075ca69b0 | ||
|
|
e29f5c5474 | ||
|
|
22bfa6638a | ||
|
|
1a48941f6b | ||
|
|
68e0c94dbb | ||
|
|
ca04fc745d | ||
|
|
3afead1827 | ||
|
|
0ea69dab7b | ||
|
|
a4a025b786 | ||
|
|
328c3a39a1 | ||
|
|
5aa019a0b5 | ||
|
|
92aa99104a | ||
|
|
6b544bc3c2 | ||
|
|
ea0005e16d | ||
|
|
6901ad361d | ||
|
|
b21cccf5f0 | ||
|
|
7740035d14 | ||
|
|
7dc3934997 | ||
|
|
845e15876c | ||
|
|
c4e7a7992f | ||
|
|
43ab84397b | ||
|
|
0840c9248f | ||
|
|
dd79d75504 | ||
|
|
7073f0b58b | ||
|
|
15916bfbdc | ||
|
|
228fdbef5a | ||
|
|
7f7f8fb156 | ||
|
|
2ae9735858 | ||
|
|
8ac1688c89 | ||
|
|
9cd2dbc9e7 | ||
|
|
a74055bc33 | ||
|
|
e1d0b9370e | ||
|
|
5dfa28059e | ||
|
|
7ead45d899 | ||
|
|
5c9ac72c19 | ||
|
|
343cafef34 | ||
|
|
95a01f3c8f | ||
|
|
cfa367f14c | ||
|
|
94cae410f3 | ||
|
|
cc69afc4fe | ||
|
|
777a559e12 | ||
|
|
0427ccbb55 | ||
|
|
f9a4699147 | ||
|
|
e6e287ae1f | ||
|
|
143602e5f6 | ||
|
|
1c2d3583e7 | ||
|
|
e58110da2c | ||
|
|
0d1683edc8 | ||
|
|
c94b9e504d | ||
|
|
8be3bf3e5d | ||
|
|
3e165297ce | ||
|
|
7ac922def6 | ||
|
|
f12127c775 | ||
|
|
73d84fe136 | ||
|
|
c595448f9c | ||
|
|
5a2aeb1511 | ||
|
|
5fb9d9aa38 | ||
|
|
8258961c29 | ||
|
|
0dab94a54c | ||
|
|
3097f71abd | ||
|
|
ea5e1b70db | ||
|
|
6b393d35a9 | ||
|
|
a5dde6021c | ||
|
|
a015472739 | ||
|
|
6affa4452b | ||
|
|
7ebfa380dd | ||
|
|
370336e7c7 | ||
|
|
bad4269dc9 | ||
|
|
effe6f47a3 | ||
|
|
7eb3a5a17d | ||
|
|
b6cd723eb7 | ||
|
|
a2cd8c8a8d | ||
|
|
3b03bd6a10 | ||
|
|
6caff2d85d | ||
|
|
eeaa241be8 | ||
|
|
8fdb4d2a17 | ||
|
|
7c7f744b4c | ||
|
|
5718ea41df | ||
|
|
20c83ba605 | ||
|
|
e9e32f980b | ||
|
|
4b2cc49aaa | ||
|
|
28f65c07b0 | ||
|
|
18279c3867 | ||
|
|
d1c9bca2e9 | ||
|
|
49973b85da | ||
|
|
47373c4f68 | ||
|
|
cbf1dbaa2e | ||
|
|
fdaa79416a | ||
|
|
7c3700c190 | ||
|
|
a0e1f9113e | ||
|
|
133b682793 | ||
|
|
824f4ee566 | ||
|
|
1cb9b65744 | ||
|
|
35dde5de15 | ||
|
|
4d9bb19467 | ||
|
|
2555353161 | ||
|
|
73a9c8bcb8 | ||
|
|
47b652c76e | ||
|
|
0b044b785a | ||
|
|
ddff3561e3 | ||
|
|
c4dfdfa849 | ||
|
|
08251dcc98 | ||
|
|
57d53c70e3 | ||
|
|
4e77ee4516 | ||
|
|
6291be256b | ||
|
|
e756f7d619 | ||
|
|
cf3d30d4e4 | ||
|
|
585191310b | ||
|
|
530bbfc9ac | ||
|
|
a521fa4165 | ||
|
|
0f76f77173 | ||
|
|
c743ebf211 | ||
|
|
04ce9ecf16 | ||
|
|
bde5921258 | ||
|
|
89ae02976f | ||
|
|
d8382acc74 | ||
|
|
749c44fe27 | ||
|
|
88ec924323 | ||
|
|
7ff069a2e1 | ||
|
|
8e05c8bee8 | ||
|
|
0fa3c15114 | ||
|
|
58667673d9 | ||
|
|
a53a9aa293 | ||
|
|
09402223e8 | ||
|
|
4f947015d2 | ||
|
|
9f3a7543aa | ||
|
|
7ae6805698 | ||
|
|
1401c44a79 | ||
|
|
40ea5987b2 | ||
|
|
6920f039eb | ||
|
|
ff00354305 | ||
|
|
f9c63a142b | ||
|
|
3733fe3997 | ||
|
|
7e3128f097 | ||
|
|
727472d5bd | ||
|
|
3616a23bdd | ||
|
|
f13262d87e | ||
|
|
f71cd494de | ||
|
|
264c065006 | ||
|
|
07c89c71d8 | ||
|
|
19c67db731 | ||
|
|
294da72d11 | ||
|
|
847b6daa34 | ||
|
|
807a0b8dbd | ||
|
|
c3a1473419 | ||
|
|
29707e66e6 | ||
|
|
a97b652046 | ||
|
|
91b46b305d | ||
|
|
fbe66f54aa | ||
|
|
ff03fe7e41 | ||
|
|
06fd1aa9f8 | ||
|
|
5942a6d6c1 | ||
|
|
a781736fb7 | ||
|
|
feabc032f6 | ||
|
|
9f9f7bf95a | ||
|
|
02f638ad2b | ||
|
|
e95effb043 | ||
|
|
7a1a5a6f01 | ||
|
|
bfefe7f262 | ||
|
|
44e8dcd331 | ||
|
|
3580811f8e | ||
|
|
35cf20640f | ||
|
|
eff36003db | ||
|
|
0eab394c24 | ||
|
|
028e1f36a1 | ||
|
|
f59e9baab9 | ||
|
|
1c6f685522 | ||
|
|
c8a36c9889 | ||
|
|
521d09b6d0 | ||
|
|
3efb0bf5cf | ||
|
|
003c4d776f | ||
|
|
00dea8a082 | ||
|
|
7f195b2f23 | ||
|
|
ecc2fbca98 | ||
|
|
631acd529d | ||
|
|
369f1709be | ||
|
|
1505cc3d81 | ||
|
|
78ae6d3bea | ||
|
|
ea81321ccb | ||
|
|
1977d3beb3 | ||
|
|
285984196d | ||
|
|
5f8e6c85e4 | ||
|
|
e01ccb14af | ||
|
|
86b7ae6d21 |
33
INSTALL
33
INSTALL
@@ -2,39 +2,38 @@
|
||||
Known issues
|
||||
============
|
||||
|
||||
Older versions of Doxygen has bugs in the man-page generation which
|
||||
cause the builtin help to render incorrectly. Version 1.2.14 is known
|
||||
to have this problem.
|
||||
Fish currently requires a semi-modern GCC version to
|
||||
compile. Specifically, GCC 2.95.* won't compile fish, but GCC 3.2.3 is
|
||||
known to work. Fish has not been coded with an C99- or GNU-specific
|
||||
features in mind, so it is hoped that it should be possible to make
|
||||
fish work with other compilers. Patches are welcome.
|
||||
|
||||
In version 1.9.2, the installation prefix for fish rpms and debs has
|
||||
changed from /usr/local to /usr. The package should automatically
|
||||
change any instances of /usr/local/bin/fish in /etc/passwd to
|
||||
/usr/bin/fish, but some programs, like screen, may need to be
|
||||
restarted to notice the changes. You may also run into problems when
|
||||
switching between using a package and personal builds.
|
||||
Older versions of Doxygen has bugs in the man-page generation which
|
||||
cause the builtin help to render incorrectly. Doxygen 1.2.14 is known
|
||||
to have this problem.
|
||||
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
Fish requires the following packages to build:
|
||||
Fish requires the following programs and libraries to build:
|
||||
|
||||
- Doxygen
|
||||
- Curses or Ncurses
|
||||
- GNU make
|
||||
- GCC
|
||||
|
||||
fish also relies on standard unix tools such as cat, cut, grep, sed,
|
||||
whoami and echo. Fish does not support cross-compilation, separate
|
||||
build directories or any other fancy configure options. Use a recent
|
||||
version of Doxygen, since older versions have bugs that make the
|
||||
builtin help pages render incorrectly. Version 1.2.14 is known to be
|
||||
broken.
|
||||
whoami, bc and echo. Fish does not yet support cross-compilation,
|
||||
separate build directories or any other fancy configure options.
|
||||
|
||||
|
||||
Simple install procedure
|
||||
========================
|
||||
|
||||
If you have downloaded the darcs repository of fish, you need to run
|
||||
autoconf.
|
||||
the autoconf command first. Then use the following commands to compile
|
||||
fish:
|
||||
|
||||
% ./configure
|
||||
% make # Compile fish
|
||||
@@ -53,7 +52,7 @@ Local install procedure
|
||||
=======================
|
||||
|
||||
If you have downloaded the darcs repository of fish, you need to run
|
||||
autoconf first.
|
||||
autoconf to generate the configure script.
|
||||
|
||||
To install fish in your own home directory (typically as non-root),
|
||||
type:
|
||||
|
||||
305
Makefile.in
305
Makefile.in
@@ -16,6 +16,10 @@
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
|
||||
#
|
||||
# @configure_input@
|
||||
#
|
||||
|
||||
#
|
||||
# Makefile for the fish shell. Can build fish and associated
|
||||
# applications, install them, recalculate dependencies and also create
|
||||
@@ -32,10 +36,24 @@
|
||||
CC := @CC@
|
||||
INSTALL:=@INSTALL@
|
||||
|
||||
# Compiler flags
|
||||
CFLAGS := @CFLAGS@ @INCLUDEDIR@ -Wall -std=gnu99 -fno-strict-aliasing
|
||||
#
|
||||
# Compiler flags:
|
||||
#
|
||||
#
|
||||
# -fno-optimize-sibling-calls seems to work around a bug where sending
|
||||
# a SIGWINCH to fish on NetBSD causes fish to exit when compiled with
|
||||
# GCC 3.3.3. This is probably either a compiler bug or a libc bug, but
|
||||
# adding this flag seems to fix things for now. Long term, the real
|
||||
# problem should be tracked down and truly fixed, at which point we
|
||||
# can remove this silly flag. This bug has been verified to not exist
|
||||
# on Linux using GCC 3.3.3.
|
||||
#
|
||||
# -Wall is there to keep me on my toes
|
||||
#
|
||||
|
||||
CFLAGS:=@CFLAGS@ -Wall -fno-optimize-sibling-calls
|
||||
CPPFLAGS=@CPPFLAGS@
|
||||
LDFLAGS:= -l@CURSESLIB@ @LIBS@ @LDFLAGS@ @LIBDIR@
|
||||
LDFLAGS:= @LIBS@ @LDFLAGS@
|
||||
|
||||
# Installation directories
|
||||
prefix = @prefix@
|
||||
@@ -44,24 +62,25 @@ datadir = @datadir@
|
||||
bindir = @bindir@
|
||||
mandir = @mandir@
|
||||
sysconfdir = @sysconfdir@
|
||||
fishdir = @fishdir@
|
||||
fishfile = @fishfile@
|
||||
fishinputfile = @fishinputfile@
|
||||
docdir = @docdir@
|
||||
|
||||
#Init files to install
|
||||
INIT_DIR_INSTALL = init/fish_interactive.fish init/fish_function.fish init/fish_complete.fish
|
||||
#etc files to install
|
||||
ETC_DIR_INSTALL = etc/fish_interactive.fish
|
||||
|
||||
# Set to 1 if we have gettext
|
||||
HAVE_GETTEXT=@HAVE_GETTEXT@
|
||||
|
||||
CORE_OBJS := util.o common.o halloc.o halloc_util.o fallback.o
|
||||
|
||||
# All objects used by fish, that are compiled from an ordinary .c file
|
||||
# using an ordinary .h file.
|
||||
COMMON_OBJS := function.o builtin.o common.o complete.o env.o exec.o \
|
||||
COMMON_OBJS := function.o builtin.o complete.o env.o exec.o \
|
||||
expand.o highlight.o history.o kill.o parser.o proc.o reader.o \
|
||||
sanity.o tokenizer.o util.o wildcard.o wgetopt.o wutil.o input.o \
|
||||
sanity.o tokenizer.o wildcard.o wgetopt.o wutil.o input.o \
|
||||
output.o intern.o env_universal.o env_universal_common.o \
|
||||
input_common.o event.o signal.o io.o translate.o
|
||||
input_common.o event.o signal.o io.o translate.o parse_util.o \
|
||||
$(CORE_OBJS)
|
||||
|
||||
# builtin_help.h exists, but builtin_help.c is autogenerated
|
||||
COMMON_OBJS_WITH_HEADER := builtin_help.o
|
||||
@@ -75,21 +94,21 @@ FISH_OBJS := $(COMMON_OBJS) $(COMMON_OBJS_WITH_CODE) \
|
||||
$(COMMON_OBJS_WITH_HEADER) main.o
|
||||
|
||||
# All objects that the system needs to build fish_pager
|
||||
FISH_PAGER_OBJS := fish_pager.o common.o output.o util.o wutil.o \
|
||||
FISH_PAGER_OBJS := fish_pager.o output.o wutil.o \
|
||||
tokenizer.o input_common.o env_universal.o env_universal_common.o \
|
||||
translate.o
|
||||
translate.o $(CORE_OBJS)
|
||||
|
||||
# All objects that the system needs to build fish_tests
|
||||
FISH_TESTS_OBJS := $(COMMON_OBJS) $(COMMON_OBJS_WITH_CODE) \
|
||||
$(COMMON_OBJS_WITH_HEADER) fish_tests.o
|
||||
|
||||
# All objects that the system needs to build fishd
|
||||
FISHD_OBJS := fishd.o env_universal_common.o common.o util.o wutil.o \
|
||||
doc_src/fishd.o
|
||||
FISHD_OBJS := fishd.o env_universal_common.o wutil.o \
|
||||
doc_src/fishd.o $(CORE_OBJS)
|
||||
|
||||
# All objects needed to build mimedb
|
||||
MIME_OBJS := mimedb.o xdgmimealias.o xdgmime.o xdgmimeglob.o \
|
||||
xdgmimeint.o xdgmimemagic.o xdgmimeparent.o wutil.o
|
||||
MIME_OBJS := mimedb.o xdgmimealias.o xdgmime.o xdgmimeglob.o \
|
||||
xdgmimeint.o xdgmimemagic.o xdgmimeparent.o wutil.o $(CORE_OBJS)
|
||||
|
||||
#
|
||||
# Files containing documentation for builtins. Should be listed
|
||||
@@ -119,12 +138,13 @@ BUILTIN_DOC_HDR := $(BUILTIN_DOC_SRC:.txt=.doxygen)
|
||||
# alphabetically, since this is the order in which they will be written
|
||||
# in the help file.
|
||||
#
|
||||
CMD_DOC_SRC := doc_src/count.txt doc_src/dirh.txt doc_src/dirs.txt \
|
||||
doc_src/fish_pager.txt doc_src/fishd.txt doc_src/help.txt \
|
||||
doc_src/mimedb.txt doc_src/nextd.txt doc_src/open.txt \
|
||||
doc_src/popd.txt doc_src/prevd.txt doc_src/psub.txt \
|
||||
doc_src/pushd.txt doc_src/set_color.txt doc_src/trap.txt \
|
||||
doc_src/type.txt doc_src/umask.txt doc_src/vared.txt
|
||||
CMD_DOC_SRC := doc_src/contains.txt doc_src/count.txt doc_src/dirh.txt \
|
||||
doc_src/dirs.txt doc_src/fish_pager.txt doc_src/fishd.txt \
|
||||
doc_src/help.txt doc_src/mimedb.txt doc_src/nextd.txt \
|
||||
doc_src/open.txt doc_src/popd.txt doc_src/prevd.txt \
|
||||
doc_src/psub.txt doc_src/pushd.txt doc_src/set_color.txt \
|
||||
doc_src/trap.txt doc_src/type.txt doc_src/umask.txt \
|
||||
doc_src/vared.txt
|
||||
|
||||
#
|
||||
# Files generated by running doxygen on the files in $(CMD_DOC_SRC)
|
||||
@@ -154,16 +174,20 @@ MAIN_DIR_FILES := Doxyfile Doxyfile.user Makefile.in configure \
|
||||
user_doc.head.html xsel-0.9.6.tar ChangeLog config.sub \
|
||||
config.guess fish_tests.c main.c fish_pager.c fishd.c seq.in
|
||||
|
||||
# Files in ./init/
|
||||
INIT_DIR_FILES :=init/fish.in init/fish_complete.fish.in \
|
||||
init/fish_function.fish init/fish_inputrc \
|
||||
init/fish_interactive.fish.in
|
||||
# Files in ./etc/
|
||||
ETC_DIR_FILES :=etc/fish.in etc/fish_inputrc \
|
||||
etc/fish_interactive.fish.in
|
||||
|
||||
# Files in ./share/
|
||||
SHARE_DIR_FILES :=share/fish
|
||||
|
||||
# Files in ./tests/
|
||||
TESTS_DIR_FILES := $(TEST_IN) $(TEST_IN:.in=.out) $(TEST_IN:.in=.err) \
|
||||
$(TEST_IN:.in=.status) tests/test.fish tests/gen_output.fish
|
||||
|
||||
COMPLETIONS_DIR_FILES := $(wildcard init/completions/*.fish)
|
||||
COMPLETIONS_DIR_FILES := $(wildcard share/completions/*.fish)
|
||||
|
||||
FUNCTIONS_DIR_FILES := $(wildcard share/functions/*.fish)
|
||||
|
||||
# Programs to build
|
||||
PROGRAMS:=fish set_color @XSEL@ @SEQ_FALLBACK@ mimedb count fish_pager fishd
|
||||
@@ -187,7 +211,7 @@ all: $(PROGRAMS) user_doc
|
||||
.PHONY: all
|
||||
|
||||
debug:
|
||||
make fish CFLAGS="-O0 -Wno-unused -Werror -g @INCLUDEDIR@ -Wall -std=gnu99 -fno-strict-aliasing"
|
||||
make fish CFLAGS="-O0 -Wno-unused -Werror -g -Wall -fno-optimize-sibling-calls"
|
||||
.PHONY: debug
|
||||
|
||||
# User documentation, describing the features of the fish shell.
|
||||
@@ -256,10 +280,10 @@ doc.h:$(BUILTIN_DOC_SRC) $(CMD_DOC_SRC) doc_src/doc.hdr
|
||||
fi
|
||||
|
||||
# Create a template translation object
|
||||
messages.pot: *.c *.h init/*.in init/*.fish init/completions/*.fish seq
|
||||
messages.pot: *.c *.h etc/*.in share/fish share/completions/*.fish share/functions/*.fish seq
|
||||
if test $(HAVE_GETTEXT) = 1;then \
|
||||
xgettext -k_ -kN_ -kcomplete_desc *.c *.h -o messages.pot; \
|
||||
if ! xgettext -j -k_ -LShell init/*.in init/*.fish init/completions/*.fish seq -o messages.pot; then \
|
||||
xgettext -k_ -kN_ *.c *.h -o messages.pot; \
|
||||
if ! xgettext -j -k_ -kN_ -LShell etc/*.in share/fish share/completions/*.fish share/functions/*.fish seq -o messages.pot; then \
|
||||
echo "Your xgettext version is too old to build the messages.pot file"\
|
||||
rm messages.pot\
|
||||
false;\
|
||||
@@ -330,24 +354,54 @@ builtin_help.c: $(BUILTIN_DOC_HDR) doc_src/count.doxygen gen_hdr2 gen_hdr.sh bui
|
||||
#man -- doc_src/builtin_doc/man/man1/`basename $@ .c`.1 | cat -s | ./gen_hdr2 >>$@
|
||||
|
||||
#
|
||||
# The build rules for installing/uninstalling
|
||||
# The build rules for installing/uninstalling fish
|
||||
#
|
||||
|
||||
install: all install-translations
|
||||
# Check for an incompatible installed fish version, and fail with an
|
||||
# error if found
|
||||
|
||||
check-uninstall:
|
||||
if test -f $(DESTDIR)$(sysconfdir)/fish.d/fish_function.fish -o -f $(DESTDIR)$(sysconfdir)/fish.d/fish_complete.fish; then \
|
||||
echo;\
|
||||
echo ERROR;\
|
||||
echo;\
|
||||
echo An older fish installation using an incompatible filesystem hierarchy was detected;\
|
||||
echo You must uninstall this fish version before installing proceeding;\
|
||||
echo type \'make uninstall-legacy\' to uninstall these files,;\
|
||||
echo or type \'make force-install\' to force installation.;\
|
||||
echo The latter may result in a broken installation.;\
|
||||
echo;\
|
||||
false;\
|
||||
fi;
|
||||
.PHONY: check-uninstall
|
||||
|
||||
# Try to install after checking for incompatible installed versions
|
||||
install: all check-uninstall install-force
|
||||
.PHONY: install
|
||||
|
||||
# Force installation, even in presense of incompatible previous
|
||||
# version
|
||||
install-force: all install-translations
|
||||
$(INSTALL) -m 755 -d $(DESTDIR)$(bindir)
|
||||
for i in $(PROGRAMS); do\
|
||||
$(INSTALL) -m 755 $$i $(DESTDIR)$(bindir) ; \
|
||||
done;
|
||||
$(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)$(fishdir)
|
||||
$(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)$(fishdir)/completions
|
||||
$(INSTALL) -m 644 init/fish $(DESTDIR)$(sysconfdir)$(fishfile)
|
||||
for i in $(INIT_DIR_INSTALL); do \
|
||||
$(INSTALL) -m 644 $$i $(DESTDIR)$(sysconfdir)$(fishdir); \
|
||||
$(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)/fish.d
|
||||
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish
|
||||
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/completions
|
||||
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/functions
|
||||
$(INSTALL) -m 644 etc/fish $(DESTDIR)$(sysconfdir)/fish
|
||||
$(INSTALL) -m 644 share/fish $(DESTDIR)$(datadir)/fish
|
||||
for i in $(ETC_DIR_INSTALL); do \
|
||||
$(INSTALL) -m 644 $$i $(DESTDIR)$(sysconfdir)/fish.d; \
|
||||
done;
|
||||
for i in $(COMPLETIONS_DIR_FILES); do \
|
||||
$(INSTALL) -m 644 $$i $(DESTDIR)$(sysconfdir)$(fishdir)/completions/; \
|
||||
$(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/completions/; \
|
||||
done;
|
||||
$(INSTALL) -m 644 init/fish_inputrc $(DESTDIR)$(sysconfdir)$(fishinputfile);
|
||||
for i in $(FUNCTIONS_DIR_FILES); do \
|
||||
$(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/functions/; \
|
||||
done;
|
||||
$(INSTALL) -m 644 etc/fish_inputrc $(DESTDIR)$(sysconfdir)/fish_inputrc;
|
||||
$(INSTALL) -m 755 -d $(DESTDIR)$(docdir)
|
||||
for i in user_doc/html/* ChangeLog; do \
|
||||
if test -f $$i; then \
|
||||
@@ -366,22 +420,49 @@ install: all install-translations
|
||||
@echo \* use the command \'chsh -s $(DESTDIR)$(bindir)/fish\'.
|
||||
@echo
|
||||
@echo Have fun!
|
||||
.PHONY: install
|
||||
.PHONY: force-install
|
||||
|
||||
|
||||
# Uninstall this fish version
|
||||
|
||||
uninstall: uninstall-translations
|
||||
for i in $(PROGRAMS); do \
|
||||
rm -f $(DESTDIR)$(bindir)/$$i; \
|
||||
done;
|
||||
rm -f $(DESTDIR)$(bindir)/xsel
|
||||
rm -f $(DESTDIR)$(sysconfdir)$(fishfile)
|
||||
rm -f $(DESTDIR)$(sysconfdir)$(fishinputfile)
|
||||
rm -r $(DESTDIR)$(sysconfdir)$(fishdir)
|
||||
rm -r $(DESTDIR)$(docdir)
|
||||
for i in fish.1* @XSEL_MAN@ mimedb.1* fishd.1* set_color.1* count.1*; do \
|
||||
rm $(DESTDIR)$(mandir)/man1/$$i; \
|
||||
rm -f $(DESTDIR)$(sysconfdir)/fish
|
||||
rm -f $(DESTDIR)$(sysconfdir)/fish_inputrc
|
||||
if test -d $(DESTDIR)$(datadir)/fish; then \
|
||||
rm -r $(DESTDIR)$(datadir)/fish; \
|
||||
fi
|
||||
if test -d $(DESTDIR)$(docdir); then \
|
||||
rm -r $(DESTDIR)$(docdir);\
|
||||
fi
|
||||
for i in fish.1 @XSEL_MAN@ mimedb.1 fishd.1 set_color.1 count.1; do \
|
||||
rm -f $(DESTDIR)$(mandir)/man1/$$i*; \
|
||||
done;
|
||||
.PHONY: uninstall
|
||||
|
||||
# Uninstall older fish release. This is not the default uninstall
|
||||
# since there is a slight chance that it removes a file put in place by
|
||||
# the sysadmin.
|
||||
|
||||
uninstall-legacy: uninstall
|
||||
rm -f $(DESTDIR)$(sysconfdir)/fish.d/fish_interactive.fish
|
||||
rm -f $(DESTDIR)$(sysconfdir)/fish.d/fish_complete.fish
|
||||
rm -f $(DESTDIR)$(sysconfdir)/fish.d/fish_function.fish
|
||||
if test -d $(DESTDIR)$(sysconfdir)/fish.d/completions; then \
|
||||
for i in $(COMPLETIONS_DIR_FILES); do \
|
||||
basename=`basename $$i`; \
|
||||
if test -f $(DESTDIR)$(sysconfdir)/fish.d/completions/$$basename; then \
|
||||
rm $(DESTDIR)$(sysconfdir)/fish.d/completions/$$basename; \
|
||||
fi; \
|
||||
done; \
|
||||
fi;
|
||||
rmdir $(DESTDIR)$(sysconfdir)/fish.d/completions; true
|
||||
rmdir $(DESTDIR)$(sysconfdir)/fish.d; true
|
||||
@echo The previous fish installation has been removed.
|
||||
|
||||
install-translations: $(TRANSLATIONS)
|
||||
if test $(HAVE_GETTEXT) = 1; then \
|
||||
for i in $(TRANSLATIONS); do \
|
||||
@@ -389,13 +470,13 @@ install-translations: $(TRANSLATIONS)
|
||||
$(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/locale/`basename $$i .gmo`/LC_MESSAGES/fish.mo; \
|
||||
echo $(DESTDIR)$(datadir)/locale/`basename $$i .gmo`/LC_MESSAGES/fish.mo;\
|
||||
done; \
|
||||
fi
|
||||
fi;
|
||||
.PHONY: install-translations
|
||||
|
||||
uninstall-translations:
|
||||
if test $(HAVE_GETTEXT) = 1; then \
|
||||
for i in $(TRANSLATIONS_SRC); do \
|
||||
rm -f $(DESTDIR)$(datadir)/locale/`basename $$i .po`/LC_MESSAGES/fish.mo; \
|
||||
rm -f $(DESTDIR)$(datadir)/locale/*/LC_MESSAGES/fish.mo; \
|
||||
done; \
|
||||
fi
|
||||
.PHONY: uninstall-translations
|
||||
@@ -417,8 +498,8 @@ fish_tests: $(FISH_TESTS_OBJS)
|
||||
$(CC) $(FISH_TESTS_OBJS) $(LDFLAGS) -o $@
|
||||
|
||||
|
||||
mimedb: $(MIME_OBJS) util.o common.o doc_src/mimedb.c
|
||||
$(CC) ${MIME_OBJS} util.o common.o doc_src/mimedb.c $(LDFLAGS) -o $@
|
||||
mimedb: $(MIME_OBJS) doc_src/mimedb.c
|
||||
$(CC) ${MIME_OBJS} doc_src/mimedb.c $(LDFLAGS) -o $@
|
||||
|
||||
set_color: set_color.o doc_src/set_color.c
|
||||
$(CC) set_color.o doc_src/set_color.c $(LDFLAGS) -o $@
|
||||
@@ -444,18 +525,22 @@ depend:
|
||||
#
|
||||
# Uses install instead of mkdir so build won't fail if the directory
|
||||
# exists
|
||||
fish-@PACKAGE_VERSION@.tar: $(DOC_SRC_DIR_FILES) $(MAIN_DIR_FILES) $(INIT_DIR_FILES) $(TEST_DIR_FILES) $(COMPLETIONS_DIR_FILES) ChangeLog
|
||||
fish-@PACKAGE_VERSION@.tar: $(DOC_SRC_DIR_FILES) $(MAIN_DIR_FILES) $(ETC_DIR_FILES) $(TEST_DIR_FILES) $(SHARE_DIR_FILES) $(FUNCTIONS_DIR_FILES) $(COMPLETIONS_DIR_FILES) ChangeLog
|
||||
rm -rf fish-@PACKAGE_VERSION@
|
||||
$(INSTALL) -d fish-@PACKAGE_VERSION@
|
||||
$(INSTALL) -d fish-@PACKAGE_VERSION@/doc_src
|
||||
$(INSTALL) -d fish-@PACKAGE_VERSION@/init
|
||||
$(INSTALL) -d fish-@PACKAGE_VERSION@/init/completions
|
||||
$(INSTALL) -d fish-@PACKAGE_VERSION@/etc
|
||||
$(INSTALL) -d fish-@PACKAGE_VERSION@/share
|
||||
$(INSTALL) -d fish-@PACKAGE_VERSION@/share/completions
|
||||
$(INSTALL) -d fish-@PACKAGE_VERSION@/share/functions
|
||||
$(INSTALL) -d fish-@PACKAGE_VERSION@/tests
|
||||
$(INSTALL) -d fish-@PACKAGE_VERSION@/po
|
||||
cp -f $(DOC_SRC_DIR_FILES) fish-@PACKAGE_VERSION@/doc_src
|
||||
cp -f $(MAIN_DIR_FILES) fish-@PACKAGE_VERSION@/
|
||||
cp -f $(INIT_DIR_FILES) fish-@PACKAGE_VERSION@/init/
|
||||
cp -f $(COMPLETIONS_DIR_FILES) fish-@PACKAGE_VERSION@/init/completions/
|
||||
cp -f $(ETC_DIR_FILES) fish-@PACKAGE_VERSION@/etc/
|
||||
cp -f $(SHARE_DIR_FILES) fish-@PACKAGE_VERSION@/share/
|
||||
cp -f $(COMPLETIONS_DIR_FILES) fish-@PACKAGE_VERSION@/share/completions/
|
||||
cp -f $(FUNCTIONS_DIR_FILES) fish-@PACKAGE_VERSION@/share/functions/
|
||||
cp -f $(TESTS_DIR_FILES) fish-@PACKAGE_VERSION@/tests/
|
||||
cp -f $(TRANSLATIONS_SRC) fish-@PACKAGE_VERSION@/po/
|
||||
tar -c fish-@PACKAGE_VERSION@ >fish-@PACKAGE_VERSION@.tar
|
||||
@@ -483,7 +568,7 @@ rpm: fish-@PACKAGE_VERSION@.tar.bz2
|
||||
|
||||
distclean: clean
|
||||
rm -f fish.spec doc_src/fish.1 doc_src/Doxyfile
|
||||
rm -f init/fish init/fish_interactive.fish init/fish_complete.fish
|
||||
rm -f etc/fish etc/fish_interactive.fish seq
|
||||
rm -f config.status config.log config.h Makefile
|
||||
.PHONY: distclean
|
||||
|
||||
@@ -491,7 +576,7 @@ clean:
|
||||
rm -f *.o doc.h doc_src/*.doxygen doc_src/*.c builtin_help.c
|
||||
rm -f tests/tmp.err tests/tmp.out tests/tmp.status tests/foo.txt
|
||||
rm -f tokenizer_test fish key_reader set_color gen_hdr2 mimedb
|
||||
rm -f fishd fish_pager count
|
||||
rm -f fishd fish_pager count fish_tests
|
||||
rm -f fish-@PACKAGE_VERSION@.tar
|
||||
rm -f fish-@PACKAGE_VERSION@.tar.gz
|
||||
rm -f fish-@PACKAGE_VERSION@.tar.bz2
|
||||
@@ -506,83 +591,101 @@ clean:
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
builtin.o: config.h util.h wutil.h builtin.h function.h complete.h proc.h
|
||||
builtin.o: io.h parser.h reader.h env.h expand.h common.h wgetopt.h sanity.h
|
||||
builtin.o: io.h parser.h event.h reader.h env.h common.h wgetopt.h sanity.h
|
||||
builtin.o: tokenizer.h builtin_help.h wildcard.h input_common.h input.h
|
||||
builtin.o: intern.h event.h signal.h translate.h
|
||||
builtin_commandline.o: signal.h config.h util.h builtin.h common.h wgetopt.h
|
||||
builtin_commandline.o: reader.h proc.h io.h parser.h tokenizer.h
|
||||
builtin_commandline.o: input_common.h input.h translate.h
|
||||
builtin.o: intern.h signal.h translate.h halloc.h halloc_util.h parse_util.h
|
||||
builtin.o: expand.h
|
||||
builtin_commandline.o: signal.h config.h util.h wutil.h builtin.h common.h
|
||||
builtin_commandline.o: wgetopt.h reader.h proc.h io.h parser.h event.h
|
||||
builtin_commandline.o: tokenizer.h input_common.h input.h translate.h
|
||||
builtin_commandline.o: parse_util.h
|
||||
builtin_complete.o: signal.h config.h util.h wutil.h builtin.h common.h
|
||||
builtin_complete.o: complete.h wgetopt.h parser.h proc.h io.h event.h
|
||||
builtin_complete.o: reader.h translate.h
|
||||
builtin_help.o: config.h util.h common.h builtin_help.h
|
||||
builtin_set.o: signal.h config.h util.h builtin.h env.h expand.h common.h
|
||||
builtin_set.o: wgetopt.h proc.h io.h parser.h translate.h
|
||||
builtin_set.o: signal.h config.h util.h wutil.h builtin.h env.h expand.h
|
||||
builtin_set.o: common.h wgetopt.h proc.h io.h parser.h event.h translate.h
|
||||
builtin_ulimit.o: config.h util.h builtin.h common.h wgetopt.h translate.h
|
||||
common.o: config.h signal.h util.h wutil.h common.h expand.h proc.h io.h
|
||||
common.o: wildcard.h parser.h
|
||||
common.o: config.h util.h wutil.h common.h expand.h proc.h io.h wildcard.h
|
||||
common.o: parser.h event.h
|
||||
complete.o: signal.h config.h util.h tokenizer.h wildcard.h proc.h io.h
|
||||
complete.o: parser.h function.h complete.h builtin.h env.h exec.h expand.h
|
||||
complete.o: common.h reader.h history.h intern.h translate.h wutil.h
|
||||
complete.o: parser.h event.h function.h complete.h builtin.h env.h exec.h
|
||||
complete.o: expand.h common.h reader.h history.h intern.h translate.h
|
||||
complete.o: parse_util.h halloc_util.h wutil.h
|
||||
env.o: config.h signal.h util.h wutil.h proc.h io.h common.h env.h sanity.h
|
||||
env.o: expand.h history.h reader.h parser.h env_universal.h
|
||||
env.o: env_universal_common.h input_common.h event.h translate.h
|
||||
env.o: expand.h history.h reader.h parser.h event.h env_universal.h
|
||||
env.o: env_universal_common.h input_common.h translate.h complete.h
|
||||
env_universal.o: config.h signal.h util.h common.h wutil.h
|
||||
env_universal.o: env_universal_common.h env_universal.h
|
||||
env_universal_common.o: signal.h util.h common.h wutil.h
|
||||
env_universal_common.o: config.h signal.h util.h common.h wutil.h
|
||||
env_universal_common.o: env_universal_common.h
|
||||
event.o: signal.h config.h util.h function.h proc.h io.h parser.h common.h
|
||||
event.o: event.h translate.h
|
||||
event.o: signal.h config.h util.h wutil.h function.h proc.h io.h parser.h
|
||||
event.o: event.h common.h translate.h halloc_util.h
|
||||
exec.o: signal.h config.h util.h common.h wutil.h proc.h io.h exec.h parser.h
|
||||
exec.o: builtin.h function.h env.h wildcard.h sanity.h expand.h
|
||||
exec.o: env_universal.h env_universal_common.h translate.h
|
||||
exec.o: event.h builtin.h function.h env.h wildcard.h sanity.h expand.h
|
||||
exec.o: env_universal.h env_universal_common.h translate.h halloc.h
|
||||
exec.o: halloc_util.h parse_util.h
|
||||
expand.o: signal.h config.h util.h common.h wutil.h env.h proc.h io.h
|
||||
expand.o: parser.h expand.h wildcard.h exec.h tokenizer.h complete.h
|
||||
fishd.o: signal.h util.h common.h wutil.h env_universal_common.h
|
||||
expand.o: parser.h event.h expand.h wildcard.h exec.h tokenizer.h complete.h
|
||||
expand.o: translate.h parse_util.h halloc_util.h
|
||||
fishd.o: config.h signal.h util.h common.h wutil.h env_universal_common.h
|
||||
fish_pager.o: config.h signal.h util.h wutil.h common.h complete.h output.h
|
||||
fish_pager.o: input_common.h env_universal.h env_universal_common.h
|
||||
fish_pager.o: input_common.h env_universal.h env_universal_common.h halloc.h
|
||||
fish_pager.o: halloc_util.h
|
||||
fish_tests.o: config.h signal.h util.h common.h proc.h io.h reader.h
|
||||
fish_tests.o: builtin.h function.h complete.h wutil.h env.h expand.h parser.h
|
||||
fish_tests.o: tokenizer.h output.h exec.h event.h
|
||||
function.o: signal.h config.h util.h function.h proc.h io.h parser.h common.h
|
||||
function.o: intern.h event.h
|
||||
fish_tests.o: event.h tokenizer.h output.h exec.h halloc_util.h
|
||||
function.o: signal.h config.h wutil.h util.h function.h proc.h io.h parser.h
|
||||
function.o: event.h common.h intern.h reader.h parse_util.h env.h expand.h
|
||||
halloc.o: config.h util.h common.h halloc.h
|
||||
halloc_util.o: config.h util.h common.h halloc.h
|
||||
highlight.o: signal.h config.h util.h wutil.h highlight.h tokenizer.h proc.h
|
||||
highlight.o: io.h parser.h builtin.h function.h env.h expand.h sanity.h
|
||||
highlight.o: common.h complete.h output.h
|
||||
highlight.o: io.h parser.h event.h parse_util.h builtin.h function.h env.h
|
||||
highlight.o: expand.h sanity.h common.h complete.h output.h
|
||||
history.o: config.h util.h wutil.h history.h common.h reader.h env.h sanity.h
|
||||
history.o: signal.h
|
||||
input.o: config.h signal.h util.h wutil.h reader.h proc.h io.h common.h
|
||||
input.o: sanity.h input_common.h input.h parser.h env.h expand.h event.h
|
||||
input.o: translate.h
|
||||
input.o: sanity.h input_common.h input.h parser.h event.h env.h expand.h
|
||||
input.o: translate.h output.h
|
||||
input_common.o: config.h util.h common.h wutil.h input_common.h
|
||||
input_common.o: env_universal.h env_universal_common.h
|
||||
intern.o: config.h util.h common.h intern.h
|
||||
intern.o: config.h util.h wutil.h common.h intern.h
|
||||
io.o: config.h util.h wutil.h exec.h proc.h io.h common.h translate.h
|
||||
io.o: halloc.h
|
||||
key_reader.o: input_common.h
|
||||
kill.o: signal.h config.h util.h wutil.h kill.h proc.h io.h sanity.h common.h
|
||||
kill.o: env.h expand.h exec.h parser.h
|
||||
kill.o: env.h exec.h parser.h event.h
|
||||
main.o: config.h signal.h util.h common.h reader.h builtin.h function.h
|
||||
main.o: complete.h wutil.h env.h sanity.h proc.h io.h parser.h expand.h
|
||||
main.o: intern.h exec.h event.h output.h translate.h
|
||||
main.o: complete.h wutil.h env.h sanity.h proc.h io.h parser.h event.h
|
||||
main.o: expand.h intern.h exec.h output.h translate.h halloc_util.h
|
||||
mimedb.o: config.h xdgmime.h util.h
|
||||
output.o: config.h signal.h util.h wutil.h expand.h common.h output.h
|
||||
output.o: highlight.h
|
||||
output.o: halloc_util.h highlight.h
|
||||
parser.o: signal.h config.h util.h common.h wutil.h proc.h io.h parser.h
|
||||
parser.o: tokenizer.h exec.h wildcard.h function.h builtin.h builtin_help.h
|
||||
parser.o: env.h expand.h reader.h sanity.h env_universal.h
|
||||
parser.o: env_universal_common.h event.h translate.h
|
||||
parser.o: event.h tokenizer.h exec.h wildcard.h function.h builtin.h
|
||||
parser.o: builtin_help.h env.h expand.h reader.h sanity.h env_universal.h
|
||||
parser.o: env_universal_common.h translate.h intern.h parse_util.h halloc.h
|
||||
parser.o: halloc_util.h
|
||||
parse_util.o: config.h util.h wutil.h common.h tokenizer.h parse_util.h
|
||||
parse_util.o: expand.h intern.h exec.h proc.h io.h env.h halloc_util.h
|
||||
proc.o: config.h signal.h util.h wutil.h proc.h io.h common.h reader.h
|
||||
proc.o: sanity.h env.h parser.h event.h translate.h
|
||||
proc.o: sanity.h env.h parser.h event.h translate.h halloc.h halloc_util.h
|
||||
proc.o: output.h
|
||||
reader.o: config.h signal.h util.h wutil.h highlight.h reader.h proc.h io.h
|
||||
reader.o: parser.h complete.h history.h common.h sanity.h env.h exec.h
|
||||
reader.o: expand.h tokenizer.h kill.h input_common.h input.h function.h
|
||||
reader.o: output.h translate.h
|
||||
reader.o: parser.h event.h complete.h history.h common.h sanity.h env.h
|
||||
reader.o: exec.h expand.h tokenizer.h kill.h input_common.h input.h
|
||||
reader.o: function.h output.h translate.h parse_util.h
|
||||
refcount.o: config.h util.h wutil.h common.h refcount.h
|
||||
sanity.o: signal.h config.h util.h common.h sanity.h proc.h io.h history.h
|
||||
sanity.o: reader.h kill.h wutil.h
|
||||
sanity.o: reader.h kill.h wutil.h translate.h
|
||||
set_color.o: config.h
|
||||
signal.o: config.h signal.h common.h util.h wutil.h event.h reader.h proc.h
|
||||
signal.o: io.h translate.h
|
||||
tokenizer.o: config.h util.h wutil.h tokenizer.h common.h wildcard.h
|
||||
tokenizer.o: translate.h
|
||||
translate.o: config.h common.h util.h
|
||||
translate.o: config.h common.h util.h halloc_util.h
|
||||
util.o: config.h util.h common.h wutil.h
|
||||
wgetopt.o: config.h wgetopt.h wutil.h
|
||||
wgetopt.o: config.h wgetopt.h wutil.h translate.h
|
||||
wildcard.o: config.h util.h wutil.h complete.h common.h wildcard.h reader.h
|
||||
wildcard.o: expand.h translate.h
|
||||
wutil.o: config.h util.h common.h wutil.h
|
||||
|
||||
@@ -159,6 +159,8 @@ int builtin_ulimit(wchar_t **argv);
|
||||
*/
|
||||
int builtin_complete(wchar_t **argv);
|
||||
|
||||
const wchar_t *builtin_complete_get_temporary_buffer();
|
||||
|
||||
/**
|
||||
This function works like wperror, but it prints its result into
|
||||
the sb_err string_buffer_t instead of to stderr. Used by the builtin
|
||||
|
||||
@@ -12,7 +12,10 @@ Functions used for implementing the commandline builtin.
|
||||
#include <signal.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "fallback.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "wutil.h"
|
||||
#include "builtin.h"
|
||||
#include "common.h"
|
||||
@@ -24,6 +27,7 @@ Functions used for implementing the commandline builtin.
|
||||
#include "input_common.h"
|
||||
#include "input.h"
|
||||
#include "translate.h"
|
||||
#include "parse_util.h"
|
||||
|
||||
/**
|
||||
Which part of the comandbuffer are we operating on
|
||||
@@ -48,6 +52,26 @@ enum
|
||||
}
|
||||
;
|
||||
|
||||
/**
|
||||
Returns the current commandline buffer.
|
||||
*/
|
||||
static const wchar_t *get_buffer()
|
||||
{
|
||||
const wchar_t *buff = builtin_complete_get_temporary_buffer();
|
||||
if( !buff )
|
||||
buff = reader_get_buffer();
|
||||
return buff;
|
||||
}
|
||||
|
||||
static int get_cursor_pos()
|
||||
{
|
||||
const wchar_t *buff = builtin_complete_get_temporary_buffer();
|
||||
if( buff )
|
||||
return wcslen( buff );
|
||||
else
|
||||
return reader_get_cursor_pos();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Replace/append/insert the selection with/at/after the specified string.
|
||||
@@ -57,14 +81,14 @@ enum
|
||||
\param insert the string to insert
|
||||
\param append_mode can be one of REPLACE_MODE, INSERT_MODE or APPEND_MODE, affects the way the test update is performed
|
||||
*/
|
||||
static void replace_part( wchar_t *begin,
|
||||
wchar_t *end,
|
||||
static void replace_part( const wchar_t *begin,
|
||||
const wchar_t *end,
|
||||
wchar_t *insert,
|
||||
int append_mode )
|
||||
{
|
||||
wchar_t *buff = reader_get_buffer();
|
||||
const wchar_t *buff = get_buffer();
|
||||
string_buffer_t out;
|
||||
int out_pos=reader_get_cursor_pos();
|
||||
int out_pos=get_cursor_pos();
|
||||
|
||||
sb_init( &out );
|
||||
|
||||
@@ -88,7 +112,7 @@ static void replace_part( wchar_t *begin,
|
||||
}
|
||||
case INSERT_MODE:
|
||||
{
|
||||
int cursor = reader_get_cursor_pos() -(begin-buff);
|
||||
int cursor = get_cursor_pos() -(begin-buff);
|
||||
sb_append_substring( &out, begin, cursor );
|
||||
sb_append( &out, insert );
|
||||
sb_append_substring( &out, begin+cursor, end-begin-cursor );
|
||||
@@ -109,8 +133,8 @@ static void replace_part( wchar_t *begin,
|
||||
\param cut_at_cursor whether printing should stop at the surrent cursor position
|
||||
\param tokenize whether the string should be tokenized, printing one string token on every line and skipping non-string tokens
|
||||
*/
|
||||
static void write_part( wchar_t *begin,
|
||||
wchar_t *end,
|
||||
static void write_part( const wchar_t *begin,
|
||||
const wchar_t *end,
|
||||
int cut_at_cursor,
|
||||
int tokenize )
|
||||
{
|
||||
@@ -119,7 +143,7 @@ static void write_part( wchar_t *begin,
|
||||
wchar_t *buff;
|
||||
int pos;
|
||||
|
||||
pos = reader_get_cursor_pos()-(begin-reader_get_buffer());
|
||||
pos = get_cursor_pos()-(begin-get_buffer());
|
||||
|
||||
if( tokenize )
|
||||
{
|
||||
@@ -184,7 +208,7 @@ int builtin_commandline( wchar_t **argv )
|
||||
|
||||
int tokenize = 0;
|
||||
|
||||
if( !reader_get_buffer() )
|
||||
if( !get_buffer() )
|
||||
{
|
||||
sb_append2( sb_err,
|
||||
argv[0],
|
||||
@@ -429,32 +453,42 @@ int builtin_commandline( wchar_t **argv )
|
||||
buffer_part = STRING_MODE;
|
||||
}
|
||||
|
||||
wchar_t *begin, *end;
|
||||
const wchar_t *begin, *end;
|
||||
|
||||
switch( buffer_part )
|
||||
{
|
||||
case STRING_MODE:
|
||||
{
|
||||
begin = reader_get_buffer();
|
||||
begin = get_buffer();
|
||||
end = begin+wcslen(begin);
|
||||
break;
|
||||
}
|
||||
|
||||
case PROCESS_MODE:
|
||||
{
|
||||
reader_current_process_extent( &begin, &end );
|
||||
parse_util_process_extent( get_buffer(),
|
||||
get_cursor_pos(),
|
||||
&begin,
|
||||
&end );
|
||||
break;
|
||||
}
|
||||
|
||||
case JOB_MODE:
|
||||
{
|
||||
reader_current_job_extent( &begin, &end );
|
||||
parse_util_job_extent( get_buffer(),
|
||||
get_cursor_pos(),
|
||||
&begin,
|
||||
&end );
|
||||
break;
|
||||
}
|
||||
|
||||
case TOKEN_MODE:
|
||||
{
|
||||
reader_current_token_extent( &begin, &end, 0, 0 );
|
||||
parse_util_token_extent( get_buffer(),
|
||||
get_cursor_pos(),
|
||||
&begin,
|
||||
&end,
|
||||
0, 0 );
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,19 +12,25 @@ Functions used for implementing the complete builtin.
|
||||
#include <signal.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "fallback.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "wutil.h"
|
||||
#include "builtin.h"
|
||||
#include "common.h"
|
||||
#include "complete.h"
|
||||
#include "wgetopt.h"
|
||||
#include "parser.h"
|
||||
#include "reader.h"
|
||||
#include "translate.h"
|
||||
|
||||
const static wchar_t *temporary_buffer;
|
||||
|
||||
/*
|
||||
builtin_complete_* are a set of rather silly looping functions that
|
||||
make sure that all the proper combinations of complete_add or
|
||||
complete_remove get called.
|
||||
complete_remove get called.
|
||||
*/
|
||||
|
||||
static void builtin_complete_add2( const wchar_t *cmd,
|
||||
@@ -235,6 +241,11 @@ static void builtin_complete_remove( array_list_t *cmd,
|
||||
}
|
||||
|
||||
|
||||
const wchar_t *builtin_complete_get_temporary_buffer()
|
||||
{
|
||||
return temporary_buffer;
|
||||
}
|
||||
|
||||
int builtin_complete( wchar_t **argv )
|
||||
{
|
||||
int res=0;
|
||||
@@ -245,11 +256,20 @@ int builtin_complete( wchar_t **argv )
|
||||
|
||||
string_buffer_t short_opt;
|
||||
array_list_t gnu_opt, old_opt;
|
||||
wchar_t *comp=L"", *desc=L"", *condition=L"", *load=0;
|
||||
wchar_t *comp=L"", *desc=L"", *condition=L"";
|
||||
|
||||
wchar_t *do_complete = 0;
|
||||
|
||||
array_list_t cmd;
|
||||
array_list_t path;
|
||||
|
||||
static int recursion_level=0;
|
||||
|
||||
if( !is_interactive_session )
|
||||
{
|
||||
debug( 1, _(L"%ls: Command only available in interactive sessions"), argv[0] );
|
||||
}
|
||||
|
||||
al_init( &cmd );
|
||||
al_init( &path );
|
||||
sb_init( &short_opt );
|
||||
@@ -290,7 +310,8 @@ int builtin_complete( wchar_t **argv )
|
||||
}
|
||||
,
|
||||
{
|
||||
L"long-option", required_argument, 0, 'l' }
|
||||
L"long-option", required_argument, 0, 'l'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"old-option", required_argument, 0, 'o'
|
||||
@@ -317,7 +338,7 @@ int builtin_complete( wchar_t **argv )
|
||||
}
|
||||
,
|
||||
{
|
||||
L"load", required_argument, 0, 'y'
|
||||
L"do-complete", required_argument, 0, 'C'
|
||||
}
|
||||
,
|
||||
{
|
||||
@@ -330,7 +351,7 @@ int builtin_complete( wchar_t **argv )
|
||||
|
||||
int opt = wgetopt_long( argc,
|
||||
argv,
|
||||
L"a:c:p:s:l:o:d:frxeun:y:",
|
||||
L"a:c:p:s:l:o:d:frxeun:C:",
|
||||
long_options,
|
||||
&opt_index );
|
||||
if( opt == -1 )
|
||||
@@ -347,6 +368,7 @@ int builtin_complete( wchar_t **argv )
|
||||
long_options[opt_index].name );
|
||||
sb_append( sb_err,
|
||||
parser_current_line() );
|
||||
|
||||
// builtin_print_help( argv[0], sb_err );
|
||||
|
||||
|
||||
@@ -397,22 +419,21 @@ int builtin_complete( wchar_t **argv )
|
||||
comp = woptarg;
|
||||
break;
|
||||
|
||||
|
||||
case 'e':
|
||||
remove = 1;
|
||||
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
condition = woptarg;
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
load = woptarg;
|
||||
case 'C':
|
||||
do_complete = woptarg?woptarg:reader_get_buffer();
|
||||
break;
|
||||
|
||||
|
||||
case '?':
|
||||
sb_append( sb_err,
|
||||
parser_current_line() );
|
||||
// builtin_print_help( argv[0], sb_err );
|
||||
|
||||
res = 1;
|
||||
@@ -422,56 +443,85 @@ int builtin_complete( wchar_t **argv )
|
||||
|
||||
}
|
||||
|
||||
if( res != 0 )
|
||||
if( !res )
|
||||
{
|
||||
}
|
||||
else if( woptind != argc )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
_( L"%ls: Too many arguments\n" ),
|
||||
argv[0] );
|
||||
sb_append( sb_err,
|
||||
parser_current_line() );
|
||||
// builtin_print_help( argv[0], sb_err );
|
||||
|
||||
res = 1;
|
||||
}
|
||||
else if( load )
|
||||
{
|
||||
complete_load( load, 1 );
|
||||
}
|
||||
else if( (al_get_count( &cmd) == 0 ) && (al_get_count( &path) == 0 ) )
|
||||
{
|
||||
/* No arguments specified, meaning we print the definitions of
|
||||
* all specified completions to stdout.*/
|
||||
complete_print( sb_out );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( remove )
|
||||
if( do_complete )
|
||||
{
|
||||
builtin_complete_remove( &cmd,
|
||||
&path,
|
||||
(wchar_t *)short_opt.buff,
|
||||
&gnu_opt,
|
||||
&old_opt );
|
||||
array_list_t comp;
|
||||
int i;
|
||||
|
||||
const wchar_t *prev_temporary_buffer = temporary_buffer;
|
||||
temporary_buffer = do_complete;
|
||||
|
||||
if( recursion_level < 1 )
|
||||
{
|
||||
recursion_level++;
|
||||
|
||||
al_init( &comp );
|
||||
|
||||
complete( do_complete, &comp );
|
||||
|
||||
for( i=0; i<al_get_count( &comp ); i++ )
|
||||
{
|
||||
wchar_t *next = (wchar_t *)al_get( &comp, i );
|
||||
wchar_t *sep = wcschr( next, COMPLETE_SEP );
|
||||
if( sep )
|
||||
*sep = L'\t';
|
||||
sb_printf( sb_out, L"%ls\n", next );
|
||||
}
|
||||
|
||||
al_foreach( &comp, (void (*)(const void *))&free );
|
||||
al_destroy( &comp );
|
||||
recursion_level--;
|
||||
}
|
||||
|
||||
temporary_buffer = prev_temporary_buffer;
|
||||
|
||||
}
|
||||
else if( woptind != argc )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
_( L"%ls: Too many arguments\n" ),
|
||||
argv[0] );
|
||||
sb_append( sb_err,
|
||||
parser_current_line() );
|
||||
// builtin_print_help( argv[0], sb_err );
|
||||
|
||||
res = 1;
|
||||
}
|
||||
else if( (al_get_count( &cmd) == 0 ) && (al_get_count( &path) == 0 ) )
|
||||
{
|
||||
/* No arguments specified, meaning we print the definitions of
|
||||
* all specified completions to stdout.*/
|
||||
complete_print( sb_out );
|
||||
}
|
||||
else
|
||||
{
|
||||
builtin_complete_add( &cmd,
|
||||
&path,
|
||||
(wchar_t *)short_opt.buff,
|
||||
&gnu_opt,
|
||||
&old_opt,
|
||||
result_mode,
|
||||
authorative,
|
||||
condition,
|
||||
comp,
|
||||
desc );
|
||||
}
|
||||
|
||||
}
|
||||
if( remove )
|
||||
{
|
||||
builtin_complete_remove( &cmd,
|
||||
&path,
|
||||
(wchar_t *)short_opt.buff,
|
||||
&gnu_opt,
|
||||
&old_opt );
|
||||
}
|
||||
else
|
||||
{
|
||||
builtin_complete_add( &cmd,
|
||||
&path,
|
||||
(wchar_t *)short_opt.buff,
|
||||
&gnu_opt,
|
||||
&old_opt,
|
||||
result_mode,
|
||||
authorative,
|
||||
condition,
|
||||
comp,
|
||||
desc );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
al_foreach( &cmd, (void (*)(const void *))&free );
|
||||
al_foreach( &path, (void (*)(const void *))&free );
|
||||
|
||||
|
||||
@@ -12,7 +12,10 @@ Functions used for implementing the set builtin.
|
||||
#include <signal.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "fallback.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "wutil.h"
|
||||
#include "builtin.h"
|
||||
#include "env.h"
|
||||
@@ -509,9 +512,6 @@ int builtin_set( wchar_t **argv )
|
||||
!erase &&
|
||||
!list )
|
||||
{
|
||||
/*
|
||||
Only update the variable scope
|
||||
*/
|
||||
env_set( name, 0, scope );
|
||||
finished = 1;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,10 @@ Functions used for implementing the ulimit builtin.
|
||||
#include <errno.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "fallback.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "builtin.h"
|
||||
#include "common.h"
|
||||
#include "wgetopt.h"
|
||||
|
||||
332
common.c
332
common.c
@@ -6,6 +6,7 @@ parts of fish.
|
||||
|
||||
#include "config.h"
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <termios.h>
|
||||
#include <wchar.h>
|
||||
@@ -20,7 +21,6 @@ parts of fish.
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
#include <signal.h>
|
||||
#include <locale.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
@@ -51,7 +51,9 @@ parts of fish.
|
||||
#include <ncurses/term.h>
|
||||
#endif
|
||||
|
||||
#include "fallback.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "wutil.h"
|
||||
#include "common.h"
|
||||
#include "expand.h"
|
||||
@@ -59,11 +61,6 @@ parts of fish.
|
||||
#include "wildcard.h"
|
||||
#include "parser.h"
|
||||
|
||||
/**
|
||||
Error message to show on string convertion error
|
||||
*/
|
||||
#define STR2WCS_MSG "fish: Invalid multibyte sequence \'"
|
||||
|
||||
/**
|
||||
The maximum number of minor errors to report. Further errors will be omitted.
|
||||
*/
|
||||
@@ -77,13 +74,6 @@ parts of fish.
|
||||
|
||||
struct termios shell_modes;
|
||||
|
||||
/**
|
||||
Number of error encountered. This is reset after each command, and
|
||||
used to limit the number of error messages on commands with many
|
||||
string convertion problems.
|
||||
*/
|
||||
static int error_count=0;
|
||||
|
||||
int error_max=1;
|
||||
|
||||
wchar_t ellipsis_char;
|
||||
@@ -99,20 +89,14 @@ int debug_level=1;
|
||||
*/
|
||||
static struct winsize termsize;
|
||||
|
||||
|
||||
/**
|
||||
Number of nested calls to the block function. Unblock when this reaches 0.
|
||||
*/
|
||||
static int block_count=0;
|
||||
|
||||
/**
|
||||
String buffer used by the wsetlocale function
|
||||
*/
|
||||
static string_buffer_t *setlocale_buff=0;
|
||||
|
||||
|
||||
void common_destroy()
|
||||
{
|
||||
|
||||
if( setlocale_buff )
|
||||
{
|
||||
sb_destroy( setlocale_buff );
|
||||
@@ -120,7 +104,9 @@ void common_destroy()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void common_init()
|
||||
{
|
||||
}
|
||||
|
||||
wchar_t **list_to_char_arr( array_list_t *l )
|
||||
{
|
||||
@@ -131,38 +117,13 @@ wchar_t **list_to_char_arr( array_list_t *l )
|
||||
die_mem();
|
||||
}
|
||||
for( i=0; i<al_get_count( l ); i++ )
|
||||
{
|
||||
res[i] = (wchar_t *)al_get(l,i);
|
||||
}
|
||||
res[i]='\0';
|
||||
return res;
|
||||
}
|
||||
|
||||
void block()
|
||||
{
|
||||
block_count++;
|
||||
if( block_count == 1 )
|
||||
{
|
||||
sigset_t chldset;
|
||||
sigemptyset( &chldset );
|
||||
sigaddset( &chldset, SIGCHLD );
|
||||
sigprocmask(SIG_BLOCK, &chldset, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void unblock()
|
||||
{
|
||||
block_count--;
|
||||
if( block_count == 0 )
|
||||
{
|
||||
sigset_t chldset;
|
||||
sigemptyset( &chldset );
|
||||
sigaddset( &chldset, SIGCHLD );
|
||||
sigprocmask(SIG_UNBLOCK, &chldset, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int fgetws2( wchar_t **b, int *len, FILE *f )
|
||||
{
|
||||
int i=0;
|
||||
@@ -176,8 +137,6 @@ int fgetws2( wchar_t **b, int *len, FILE *f )
|
||||
watching for EINTR errors, bytes are lost.
|
||||
*/
|
||||
|
||||
block();
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
/* Reallocate the buffer if necessary */
|
||||
@@ -216,8 +175,6 @@ int fgetws2( wchar_t **b, int *len, FILE *f )
|
||||
case L'\n':
|
||||
case L'\0':
|
||||
buff[i]=L'\0';
|
||||
unblock();
|
||||
|
||||
return i;
|
||||
/* Ignore carriage returns */
|
||||
case L'\r':
|
||||
@@ -230,7 +187,6 @@ int fgetws2( wchar_t **b, int *len, FILE *f )
|
||||
|
||||
|
||||
}
|
||||
unblock();
|
||||
|
||||
}
|
||||
|
||||
@@ -255,61 +211,110 @@ void sort_list( array_list_t *comp )
|
||||
|
||||
wchar_t *str2wcs( const char *in )
|
||||
{
|
||||
wchar_t *res;
|
||||
wchar_t *out;
|
||||
size_t len = strlen(in);
|
||||
|
||||
res = malloc( sizeof(wchar_t)*(strlen(in)+1) );
|
||||
|
||||
if( !res )
|
||||
out = malloc( sizeof(wchar_t)*(len+1) );
|
||||
|
||||
if( !out )
|
||||
{
|
||||
die_mem();
|
||||
}
|
||||
|
||||
if( (size_t)-1 == mbstowcs( res, in, sizeof(wchar_t)*(strlen(in)) +1) )
|
||||
{
|
||||
error_count++;
|
||||
if( error_count <=error_max )
|
||||
{
|
||||
fflush( stderr );
|
||||
write( 2,
|
||||
STR2WCS_MSG,
|
||||
strlen(STR2WCS_MSG) );
|
||||
write( 2,
|
||||
in,
|
||||
strlen(in ));
|
||||
write( 2,
|
||||
"\'\n",
|
||||
2 );
|
||||
}
|
||||
|
||||
free(res);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
|
||||
return str2wcs_internal( in, out );
|
||||
}
|
||||
|
||||
void error_reset()
|
||||
wchar_t *str2wcs_internal( const char *in, wchar_t *out )
|
||||
{
|
||||
error_count=0;
|
||||
size_t res=0;
|
||||
int in_pos=0;
|
||||
int out_pos = 0;
|
||||
mbstate_t state;
|
||||
size_t len = strlen(in);
|
||||
|
||||
memset( &state, 0, sizeof(state) );
|
||||
|
||||
while( in[in_pos] )
|
||||
{
|
||||
res = mbrtowc( &out[out_pos], &in[in_pos], len-in_pos, &state );
|
||||
|
||||
switch( res )
|
||||
{
|
||||
case (size_t)(-2):
|
||||
case (size_t)(-1):
|
||||
{
|
||||
out[out_pos] = ENCODE_DIRECT_BASE + (unsigned char)in[in_pos];
|
||||
in_pos++;
|
||||
memset( &state, 0, sizeof(state) );
|
||||
break;
|
||||
}
|
||||
|
||||
case 0:
|
||||
{
|
||||
return out;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
in_pos += res;
|
||||
break;
|
||||
}
|
||||
}
|
||||
out_pos++;
|
||||
}
|
||||
out[out_pos] = 0;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
char *wcs2str( const wchar_t *in )
|
||||
{
|
||||
char *res = malloc( MAX_UTF8_BYTES*wcslen(in)+1 );
|
||||
char *out;
|
||||
|
||||
out = malloc( MAX_UTF8_BYTES*wcslen(in)+1 );
|
||||
|
||||
if( res == 0 )
|
||||
if( !out )
|
||||
{
|
||||
die_mem();
|
||||
}
|
||||
|
||||
wcstombs( res,
|
||||
in,
|
||||
MAX_UTF8_BYTES*wcslen(in)+1 );
|
||||
return wcs2str_internal( in, out );
|
||||
}
|
||||
|
||||
res = realloc( res, strlen( res )+1 );
|
||||
|
||||
return res;
|
||||
char *wcs2str_internal( const wchar_t *in, char *out )
|
||||
{
|
||||
size_t res=0;
|
||||
int in_pos=0;
|
||||
int out_pos = 0;
|
||||
mbstate_t state;
|
||||
memset( &state, 0, sizeof(state) );
|
||||
|
||||
while( in[in_pos] )
|
||||
{
|
||||
if( ( in[in_pos] >= ENCODE_DIRECT_BASE) &&
|
||||
( in[in_pos] < ENCODE_DIRECT_BASE+256) )
|
||||
{
|
||||
out[out_pos++] = in[in_pos]- ENCODE_DIRECT_BASE;
|
||||
}
|
||||
else
|
||||
{
|
||||
res = wcrtomb( &out[out_pos], in[in_pos], &state );
|
||||
|
||||
if( res == (size_t)(-1) )
|
||||
{
|
||||
debug( 1, L"Wide character has no narrow representation" );
|
||||
memset( &state, 0, sizeof(state) );
|
||||
}
|
||||
else
|
||||
{
|
||||
out_pos += res;
|
||||
}
|
||||
}
|
||||
in_pos++;
|
||||
}
|
||||
out[out_pos] = 0;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
char **wcsv2strv( const wchar_t **in )
|
||||
@@ -508,8 +513,6 @@ int wcsvarname( wchar_t *str )
|
||||
str++;
|
||||
}
|
||||
return 1;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -532,30 +535,34 @@ int my_wcswidth( const wchar_t *c )
|
||||
return res;
|
||||
}
|
||||
|
||||
wchar_t *quote_end( const wchar_t *in )
|
||||
const wchar_t *quote_end( const wchar_t *pos )
|
||||
{
|
||||
switch( *in )
|
||||
wchar_t c = *pos;
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
case '"':
|
||||
pos++;
|
||||
|
||||
if( !*pos )
|
||||
return 0;
|
||||
|
||||
if( *pos == L'\\')
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
in = wcschr( in+1, L'"' );
|
||||
if( !in )
|
||||
return 0;
|
||||
if( *(in-1) != L'\\' )
|
||||
return (wchar_t *)in;
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
case '\'':
|
||||
else
|
||||
{
|
||||
return wcschr( in+1, L'\'' );
|
||||
if( *pos == c )
|
||||
{
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
const wchar_t *wsetlocale(int category, const wchar_t *locale)
|
||||
{
|
||||
|
||||
@@ -618,12 +625,6 @@ int read_blocked(int fd, void *buf, size_t count)
|
||||
return res;
|
||||
}
|
||||
|
||||
int writeb( tputs_arg_t b )
|
||||
{
|
||||
write( 1, &b, 1 );
|
||||
// putc( b, stdout );
|
||||
return 0;
|
||||
}
|
||||
|
||||
void die_mem()
|
||||
{
|
||||
@@ -752,6 +753,26 @@ wchar_t *escape( const wchar_t *in,
|
||||
|
||||
while( *in != 0 )
|
||||
{
|
||||
|
||||
if( ( *in >= ENCODE_DIRECT_BASE) &&
|
||||
( *in < ENCODE_DIRECT_BASE+256) )
|
||||
{
|
||||
int val = *in - ENCODE_DIRECT_BASE;
|
||||
int tmp;
|
||||
|
||||
*(pos++) = L'\\';
|
||||
*(pos++) = L'X';
|
||||
|
||||
tmp = val/16;
|
||||
*pos++ = tmp > 9? L'a'+(tmp-10):L'0'+tmp;
|
||||
|
||||
tmp = val%16;
|
||||
*pos++ = tmp > 9? L'a'+(tmp-10):L'0'+tmp;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
switch( *in )
|
||||
{
|
||||
case L'\t':
|
||||
@@ -820,6 +841,8 @@ wchar_t *escape( const wchar_t *in,
|
||||
*pos++ = *in;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
in++;
|
||||
}
|
||||
*pos = 0;
|
||||
@@ -895,60 +918,84 @@ wchar_t *unescape( const wchar_t * orig, int unescape_special )
|
||||
case L'u':
|
||||
case L'U':
|
||||
case L'x':
|
||||
case L'o':
|
||||
case L'X':
|
||||
case L'0':
|
||||
case L'1':
|
||||
case L'2':
|
||||
case L'3':
|
||||
case L'4':
|
||||
case L'5':
|
||||
case L'6':
|
||||
case L'7':
|
||||
{
|
||||
int i;
|
||||
wchar_t res=0;
|
||||
long long res=0;
|
||||
int chars=2;
|
||||
int base=16;
|
||||
|
||||
|
||||
int byte = 0;
|
||||
int max_val = 127;
|
||||
|
||||
switch( in[in_pos] )
|
||||
{
|
||||
case L'u':
|
||||
{
|
||||
base=16;
|
||||
chars=4;
|
||||
max_val = 35535;
|
||||
break;
|
||||
}
|
||||
|
||||
case L'U':
|
||||
{
|
||||
base=16;
|
||||
chars=8;
|
||||
max_val = WCHAR_MAX;
|
||||
break;
|
||||
}
|
||||
|
||||
case L'x':
|
||||
{
|
||||
base=16;
|
||||
chars=2;
|
||||
break;
|
||||
}
|
||||
|
||||
case L'o':
|
||||
case L'X':
|
||||
{
|
||||
byte=1;
|
||||
max_val = 255;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
base=8;
|
||||
chars=3;
|
||||
in_pos--;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
for( i=0; i<chars; i++ )
|
||||
{
|
||||
int d = convert_digit( in[++in_pos],base);
|
||||
|
||||
if( d < 0 )
|
||||
{
|
||||
in_pos--;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
res=(res*base)|d;
|
||||
|
||||
}
|
||||
|
||||
in[out_pos] = res;
|
||||
|
||||
|
||||
if( (res > 0) && (res <= max_val) )
|
||||
{
|
||||
in[out_pos] = (byte?ENCODE_DIRECT_BASE:0)+res;
|
||||
}
|
||||
else
|
||||
{
|
||||
free(in);
|
||||
return 0;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1103,6 +1150,31 @@ wchar_t *unescape( const wchar_t * orig, int unescape_special )
|
||||
*/
|
||||
case 1:
|
||||
{
|
||||
if( c == L'\\' )
|
||||
{
|
||||
switch( in[++in_pos] )
|
||||
{
|
||||
case '\\':
|
||||
case L'\'':
|
||||
{
|
||||
in[out_pos]=in[in_pos];
|
||||
break;
|
||||
}
|
||||
|
||||
case 0:
|
||||
{
|
||||
free(in);
|
||||
return 0;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
in[out_pos++] = L'\\';
|
||||
in[out_pos]= in[in_pos];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if( c == L'\'' )
|
||||
{
|
||||
in[out_pos] = INTERNAL_SEPARATOR;
|
||||
@@ -1140,12 +1212,14 @@ wchar_t *unescape( const wchar_t * orig, int unescape_special )
|
||||
return 0;
|
||||
}
|
||||
|
||||
case '\\':
|
||||
case L'$':
|
||||
case '"':
|
||||
{
|
||||
in[out_pos]=in[in_pos];
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
{
|
||||
in[out_pos++] = L'\\';
|
||||
|
||||
48
common.h
48
common.h
@@ -8,6 +8,8 @@
|
||||
*/
|
||||
#define FISH_COMMON_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <wchar.h>
|
||||
#include <termios.h>
|
||||
|
||||
@@ -42,6 +44,11 @@ typedef char tputs_arg_t;
|
||||
*/
|
||||
#define FISH_COLOR_RESET -2
|
||||
|
||||
/**
|
||||
This is in the unicode private use area.
|
||||
*/
|
||||
#define ENCODE_DIRECT_BASE 0xf100
|
||||
|
||||
/**
|
||||
Save the shell mode on startup so we can restore them on exit
|
||||
*/
|
||||
@@ -76,7 +83,10 @@ extern wchar_t *program_name;
|
||||
|
||||
/**
|
||||
Take an array_list_t containing wide strings and converts them to a
|
||||
single null-terminated wchar_t **.
|
||||
single null-terminated wchar_t **. The array is allocated using
|
||||
halloc, and uses the \c context parameter as context. If \c context
|
||||
is not noll, all elements of the \c array_list_t are also
|
||||
registered to \c context using \c halloc_register().
|
||||
*/
|
||||
wchar_t **list_to_char_arr( array_list_t *l );
|
||||
|
||||
@@ -104,6 +114,7 @@ void sort_list( array_list_t *comp );
|
||||
specified multibyte character string
|
||||
*/
|
||||
wchar_t *str2wcs( const char *in );
|
||||
wchar_t *str2wcs_internal( const char *in, wchar_t *out );
|
||||
|
||||
/**
|
||||
Returns a newly allocated multibyte character string equivalent of
|
||||
@@ -111,6 +122,8 @@ wchar_t *str2wcs( const char *in );
|
||||
*/
|
||||
char *wcs2str( const wchar_t *in );
|
||||
|
||||
char *wcs2str_internal( const wchar_t *in, char *out );
|
||||
|
||||
/**
|
||||
Returns a newly allocated wide character string array equivalent of
|
||||
the specified multibyte character string array
|
||||
@@ -172,12 +185,12 @@ int my_wcswidth( const wchar_t *c );
|
||||
|
||||
/**
|
||||
This functions returns the end of the quoted substring beginning at
|
||||
\c in. It can handle both single and double quotes. Returns 0 on
|
||||
error.
|
||||
\c in. The type of quoting character is detemrined by examining \c
|
||||
in. Returns 0 on error.
|
||||
|
||||
\param in the position of the opening quote
|
||||
*/
|
||||
wchar_t *quote_end( const wchar_t *in );
|
||||
const wchar_t *quote_end( const wchar_t *in );
|
||||
|
||||
/**
|
||||
A call to this function will reset the error counter. Some
|
||||
@@ -210,20 +223,18 @@ int contains_str( const wchar_t *needle, ... );
|
||||
*/
|
||||
int read_blocked(int fd, void *buf, size_t count);
|
||||
|
||||
/**
|
||||
This is for writing process notification messages. Has to write to
|
||||
stdout, so clr_eol and such functions will work correctly. Not an
|
||||
issue since this function is only used in interactive mode anyway.
|
||||
*/
|
||||
int writeb( tputs_arg_t b );
|
||||
|
||||
/**
|
||||
Exit program at once, leaving an error message about running out of memory
|
||||
*/
|
||||
void die_mem();
|
||||
|
||||
/**
|
||||
Clean up
|
||||
Create global_context using halloc
|
||||
*/
|
||||
void common_init();
|
||||
|
||||
/**
|
||||
Free global_context using halloc_free
|
||||
*/
|
||||
void common_destroy();
|
||||
|
||||
@@ -252,8 +263,7 @@ void debug( int level, const wchar_t *msg, ... );
|
||||
\return The escaped string, or 0 if there is not enough memory
|
||||
*/
|
||||
|
||||
wchar_t *escape( const wchar_t *in,
|
||||
int escape_all );
|
||||
wchar_t *escape( const wchar_t *in, int escape_all );
|
||||
|
||||
/**
|
||||
Expand backslashed escapes and substitute them with their unescaped
|
||||
@@ -269,16 +279,6 @@ wchar_t *escape( const wchar_t *in,
|
||||
wchar_t *unescape( const wchar_t * in,
|
||||
int escape_special );
|
||||
|
||||
/**
|
||||
Block SIGCHLD. Calls to block/unblock may be nested, and only once the nest count reaches zero wiull the block be removed.
|
||||
*/
|
||||
void block();
|
||||
|
||||
/**
|
||||
undo call to block().
|
||||
*/
|
||||
void unblock();
|
||||
|
||||
/**
|
||||
Attempt to acquire a lock based on a lockfile, waiting LOCKPOLLINTERVAL
|
||||
milliseconds between polls and timing out after timeout seconds,
|
||||
|
||||
846
complete.c
846
complete.c
File diff suppressed because it is too large
Load Diff
@@ -33,6 +33,8 @@
|
||||
/** Separateor between completion and description*/
|
||||
#define COMPLETE_SEP_STR L"\004"
|
||||
|
||||
#define COMPLETE_ITEM_SEP L'\uf500'
|
||||
|
||||
/**
|
||||
Character that separates the completion and description on programmable completions
|
||||
*/
|
||||
@@ -162,6 +164,6 @@ int complete_is_valid_argument( const wchar_t *str,
|
||||
\param cmd the command for which to load command-specific completions
|
||||
\param reload should the commands completions be reloaded, even if they where previously loaded. (This is set to true on actual completions, so that changed completion are updated in running shells)
|
||||
*/
|
||||
void complete_load( wchar_t *cmd, int reload );
|
||||
void complete_load( const wchar_t *cmd, int reload );
|
||||
|
||||
#endif
|
||||
|
||||
665
config.guess
vendored
665
config.guess
vendored
File diff suppressed because it is too large
Load Diff
219
config.sub
vendored
219
config.sub
vendored
@@ -1,9 +1,10 @@
|
||||
#! /bin/sh
|
||||
# Configuration validation subroutine script.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
|
||||
# Inc.
|
||||
|
||||
timestamp='2003-06-18'
|
||||
timestamp='2006-02-27'
|
||||
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
@@ -21,14 +22,15 @@ timestamp='2003-06-18'
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
|
||||
# Please send patches to <config-patches@gnu.org>. Submit a context
|
||||
# diff and a properly formatted ChangeLog entry.
|
||||
#
|
||||
@@ -70,7 +72,7 @@ Report bugs and patches to <config-patches@gnu.org>."
|
||||
version="\
|
||||
GNU config.sub ($timestamp)
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
@@ -83,11 +85,11 @@ Try \`$me --help' for more information."
|
||||
while test $# -gt 0 ; do
|
||||
case $1 in
|
||||
--time-stamp | --time* | -t )
|
||||
echo "$timestamp" ; exit 0 ;;
|
||||
echo "$timestamp" ; exit ;;
|
||||
--version | -v )
|
||||
echo "$version" ; exit 0 ;;
|
||||
echo "$version" ; exit ;;
|
||||
--help | --h* | -h )
|
||||
echo "$usage"; exit 0 ;;
|
||||
echo "$usage"; exit ;;
|
||||
-- ) # Stop option processing
|
||||
shift; break ;;
|
||||
- ) # Use stdin as input.
|
||||
@@ -99,7 +101,7 @@ while test $# -gt 0 ; do
|
||||
*local*)
|
||||
# First pass through any local machine types.
|
||||
echo $1
|
||||
exit 0;;
|
||||
exit ;;
|
||||
|
||||
* )
|
||||
break ;;
|
||||
@@ -118,7 +120,9 @@ esac
|
||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||
case $maybe_os in
|
||||
nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
|
||||
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
|
||||
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
|
||||
storm-chaos* | os2-emx* | rtmk-nova*)
|
||||
os=-$maybe_os
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||
;;
|
||||
@@ -144,7 +148,7 @@ case $os in
|
||||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||
-apple | -axis)
|
||||
-apple | -axis | -knuth | -cray)
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
@@ -169,6 +173,10 @@ case $os in
|
||||
-hiux*)
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
-sco6)
|
||||
os=-sco5v6
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco5)
|
||||
os=-sco3.2v5
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
@@ -185,6 +193,10 @@ case $os in
|
||||
# Don't forget version if it is 3.2v4 or newer.
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco5v6*)
|
||||
# Don't forget version if it is 3.2v4 or newer.
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco*)
|
||||
os=-sco3.2v2
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
@@ -228,14 +240,16 @@ case $basic_machine in
|
||||
| a29k \
|
||||
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
|
||||
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
|
||||
| am33_2.0 \
|
||||
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
|
||||
| bfin \
|
||||
| c4x | clipper \
|
||||
| d10v | d30v | dlx | dsp16xx \
|
||||
| fr30 | frv \
|
||||
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||
| i370 | i860 | i960 | ia64 \
|
||||
| ip2k \
|
||||
| m32r | m68000 | m68k | m88k | mcore \
|
||||
| ip2k | iq2000 \
|
||||
| m32r | m32rle | m68000 | m68k | m88k | maxq | mb | microblaze | mcore \
|
||||
| mips | mipsbe | mipseb | mipsel | mipsle \
|
||||
| mips16 \
|
||||
| mips64 | mips64el \
|
||||
@@ -244,31 +258,38 @@ case $basic_machine in
|
||||
| mips64vr4100 | mips64vr4100el \
|
||||
| mips64vr4300 | mips64vr4300el \
|
||||
| mips64vr5000 | mips64vr5000el \
|
||||
| mips64vr5900 | mips64vr5900el \
|
||||
| mipsisa32 | mipsisa32el \
|
||||
| mipsisa32r2 | mipsisa32r2el \
|
||||
| mipsisa64 | mipsisa64el \
|
||||
| mipsisa64r2 | mipsisa64r2el \
|
||||
| mipsisa64sb1 | mipsisa64sb1el \
|
||||
| mipsisa64sr71k | mipsisa64sr71kel \
|
||||
| mipstx39 | mipstx39el \
|
||||
| mn10200 | mn10300 \
|
||||
| mt \
|
||||
| msp430 \
|
||||
| nios | nios2 \
|
||||
| ns16k | ns32k \
|
||||
| openrisc | or32 \
|
||||
| or32 \
|
||||
| pdp10 | pdp11 | pj | pjl \
|
||||
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
|
||||
| pyramid \
|
||||
| s390 | s390x \
|
||||
| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
|
||||
| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
|
||||
| sh64 | sh64le \
|
||||
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
|
||||
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
|
||||
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
|
||||
| strongarm \
|
||||
| tahoe | thumb | tic4x | tic80 | tron \
|
||||
| v850 | v850e \
|
||||
| we32k \
|
||||
| x86 | xscale | xstormy16 | xtensa \
|
||||
| x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
|
||||
| z8k)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
m32c)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
m6811 | m68hc11 | m6812 | m68hc12)
|
||||
# Motorola 68HC11/12.
|
||||
basic_machine=$basic_machine-unknown
|
||||
@@ -276,6 +297,9 @@ case $basic_machine in
|
||||
;;
|
||||
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
|
||||
;;
|
||||
ms1)
|
||||
basic_machine=mt-unknown
|
||||
;;
|
||||
|
||||
# We use `pc' rather than `unknown'
|
||||
# because (1) that's what they normally are, and
|
||||
@@ -296,19 +320,19 @@ case $basic_machine in
|
||||
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
|
||||
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
||||
| avr-* \
|
||||
| bs2000-* \
|
||||
| bfin-* | bs2000-* \
|
||||
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
|
||||
| clipper-* | cydra-* \
|
||||
| clipper-* | craynv-* | cydra-* \
|
||||
| d10v-* | d30v-* | dlx-* \
|
||||
| elxsi-* \
|
||||
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
|
||||
| h8300-* | h8500-* \
|
||||
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
||||
| i*86-* | i860-* | i960-* | ia64-* \
|
||||
| ip2k-* \
|
||||
| m32r-* \
|
||||
| ip2k-* | iq2000-* \
|
||||
| m32r-* | m32rle-* \
|
||||
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
||||
| m88110-* | m88k-* | mcore-* \
|
||||
| m88110-* | m88k-* | maxq-* | mcore-* \
|
||||
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
||||
| mips16-* \
|
||||
| mips64-* | mips64el-* \
|
||||
@@ -317,34 +341,41 @@ case $basic_machine in
|
||||
| mips64vr4100-* | mips64vr4100el-* \
|
||||
| mips64vr4300-* | mips64vr4300el-* \
|
||||
| mips64vr5000-* | mips64vr5000el-* \
|
||||
| mips64vr5900-* | mips64vr5900el-* \
|
||||
| mipsisa32-* | mipsisa32el-* \
|
||||
| mipsisa32r2-* | mipsisa32r2el-* \
|
||||
| mipsisa64-* | mipsisa64el-* \
|
||||
| mipsisa64r2-* | mipsisa64r2el-* \
|
||||
| mipsisa64sb1-* | mipsisa64sb1el-* \
|
||||
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
|
||||
| mipstx39-* | mipstx39el-* \
|
||||
| mmix-* \
|
||||
| mt-* \
|
||||
| msp430-* \
|
||||
| none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
|
||||
| nios-* | nios2-* \
|
||||
| none-* | np1-* | ns16k-* | ns32k-* \
|
||||
| orion-* \
|
||||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
||||
| pyramid-* \
|
||||
| romp-* | rs6000-* \
|
||||
| s390-* | s390x-* \
|
||||
| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
|
||||
| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
|
||||
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
||||
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
|
||||
| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
|
||||
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
|
||||
| sparclite-* \
|
||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
|
||||
| tahoe-* | thumb-* \
|
||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
||||
| tron-* \
|
||||
| v850-* | v850e-* | vax-* \
|
||||
| we32k-* \
|
||||
| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
|
||||
| xtensa-* \
|
||||
| x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
|
||||
| xstormy16-* | xtensa-* \
|
||||
| ymp-* \
|
||||
| z8k-*)
|
||||
;;
|
||||
m32c-*)
|
||||
;;
|
||||
# Recognize the various machine names and aliases which stand
|
||||
# for a CPU type and a company and sometimes even an OS.
|
||||
386bsd)
|
||||
@@ -361,6 +392,9 @@ case $basic_machine in
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
;;
|
||||
abacus)
|
||||
basic_machine=abacus-unknown
|
||||
;;
|
||||
adobe68k)
|
||||
basic_machine=m68010-adobe
|
||||
os=-scout
|
||||
@@ -378,6 +412,9 @@ case $basic_machine in
|
||||
amd64)
|
||||
basic_machine=x86_64-pc
|
||||
;;
|
||||
amd64-*)
|
||||
basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
amdahl)
|
||||
basic_machine=580-amdahl
|
||||
os=-sysv
|
||||
@@ -437,12 +474,27 @@ case $basic_machine in
|
||||
basic_machine=j90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
craynv)
|
||||
basic_machine=craynv-cray
|
||||
os=-unicosmp
|
||||
;;
|
||||
cr16c)
|
||||
basic_machine=cr16c-unknown
|
||||
os=-elf
|
||||
;;
|
||||
crds | unos)
|
||||
basic_machine=m68k-crds
|
||||
;;
|
||||
crisv32 | crisv32-* | etraxfs*)
|
||||
basic_machine=crisv32-axis
|
||||
;;
|
||||
cris | cris-* | etrax*)
|
||||
basic_machine=cris-axis
|
||||
;;
|
||||
crx)
|
||||
basic_machine=crx-unknown
|
||||
os=-elf
|
||||
;;
|
||||
da30 | da30-*)
|
||||
basic_machine=m68k-da30
|
||||
;;
|
||||
@@ -465,6 +517,10 @@ case $basic_machine in
|
||||
basic_machine=m88k-motorola
|
||||
os=-sysv3
|
||||
;;
|
||||
djgpp)
|
||||
basic_machine=i586-pc
|
||||
os=-msdosdjgpp
|
||||
;;
|
||||
dpx20 | dpx20-*)
|
||||
basic_machine=rs6000-bull
|
||||
os=-bosx
|
||||
@@ -643,10 +699,6 @@ case $basic_machine in
|
||||
mips3*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
|
||||
;;
|
||||
mmix*)
|
||||
basic_machine=mmix-knuth
|
||||
os=-mmixware
|
||||
;;
|
||||
monitor)
|
||||
basic_machine=m68k-rom68k
|
||||
os=-coff
|
||||
@@ -659,6 +711,9 @@ case $basic_machine in
|
||||
basic_machine=i386-pc
|
||||
os=-msdos
|
||||
;;
|
||||
ms1-*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
|
||||
;;
|
||||
mvs)
|
||||
basic_machine=i370-ibm
|
||||
os=-mvs
|
||||
@@ -727,10 +782,6 @@ case $basic_machine in
|
||||
np1)
|
||||
basic_machine=np1-gould
|
||||
;;
|
||||
nv1)
|
||||
basic_machine=nv1-cray
|
||||
os=-unicosmp
|
||||
;;
|
||||
nsr-tandem)
|
||||
basic_machine=nsr-tandem
|
||||
;;
|
||||
@@ -738,9 +789,12 @@ case $basic_machine in
|
||||
basic_machine=hppa1.1-oki
|
||||
os=-proelf
|
||||
;;
|
||||
or32 | or32-*)
|
||||
openrisc | openrisc-*)
|
||||
basic_machine=or32-unknown
|
||||
os=-coff
|
||||
;;
|
||||
os400)
|
||||
basic_machine=powerpc-ibm
|
||||
os=-os400
|
||||
;;
|
||||
OSE68000 | ose68000)
|
||||
basic_machine=m68000-ericsson
|
||||
@@ -767,6 +821,12 @@ case $basic_machine in
|
||||
pc532 | pc532-*)
|
||||
basic_machine=ns32k-pc532
|
||||
;;
|
||||
pc98)
|
||||
basic_machine=i386-pc
|
||||
;;
|
||||
pc98-*)
|
||||
basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentium | p5 | k5 | k6 | nexgen | viac3)
|
||||
basic_machine=i586-pc
|
||||
;;
|
||||
@@ -823,6 +883,10 @@ case $basic_machine in
|
||||
basic_machine=i586-unknown
|
||||
os=-pw32
|
||||
;;
|
||||
rdos)
|
||||
basic_machine=i386-pc
|
||||
os=-rdos
|
||||
;;
|
||||
rom68k)
|
||||
basic_machine=m68k-rom68k
|
||||
os=-coff
|
||||
@@ -833,6 +897,12 @@ case $basic_machine in
|
||||
rtpc | rtpc-*)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
s390 | s390-*)
|
||||
basic_machine=s390-ibm
|
||||
;;
|
||||
s390x | s390x-*)
|
||||
basic_machine=s390x-ibm
|
||||
;;
|
||||
sa29200)
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
@@ -956,6 +1026,10 @@ case $basic_machine in
|
||||
tower | tower-32)
|
||||
basic_machine=m68k-ncr
|
||||
;;
|
||||
tpf)
|
||||
basic_machine=s390x-ibm
|
||||
os=-tpf
|
||||
;;
|
||||
udi29k)
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
@@ -999,6 +1073,10 @@ case $basic_machine in
|
||||
basic_machine=hppa1.1-winbond
|
||||
os=-proelf
|
||||
;;
|
||||
xbox)
|
||||
basic_machine=i686-pc
|
||||
os=-mingw32
|
||||
;;
|
||||
xps | xps100)
|
||||
basic_machine=xps100-honeywell
|
||||
;;
|
||||
@@ -1029,6 +1107,9 @@ case $basic_machine in
|
||||
romp)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
mmix)
|
||||
basic_machine=mmix-knuth
|
||||
;;
|
||||
rs6000)
|
||||
basic_machine=rs6000-ibm
|
||||
;;
|
||||
@@ -1045,13 +1126,10 @@ case $basic_machine in
|
||||
we32k)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
|
||||
sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
|
||||
basic_machine=sh-unknown
|
||||
;;
|
||||
sh64)
|
||||
basic_machine=sh64-unknown
|
||||
;;
|
||||
sparc | sparcv9 | sparcv9b)
|
||||
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
cydra)
|
||||
@@ -1124,19 +1202,23 @@ case $os in
|
||||
| -aos* \
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
|
||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
|
||||
| -openbsd* | -solidbsd* \
|
||||
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
|
||||
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -chorusos* | -chorusrdb* \
|
||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
|
||||
| -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
||||
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
|
||||
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei*)
|
||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
|
||||
| -skyos* | -haiku* | -rdos*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-qnx*)
|
||||
@@ -1154,12 +1236,15 @@ case $os in
|
||||
os=`echo $os | sed -e 's|nto|nto-qnx|'`
|
||||
;;
|
||||
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
|
||||
| -windows* | -osx | -abug | -netware* | -os9* | -beos* \
|
||||
| -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
|
||||
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
|
||||
;;
|
||||
-mac*)
|
||||
os=`echo $os | sed -e 's|mac|macos|'`
|
||||
;;
|
||||
-linux-dietlibc)
|
||||
os=-linux-dietlibc
|
||||
;;
|
||||
-linux*)
|
||||
os=`echo $os | sed -e 's|linux|linux-gnu|'`
|
||||
;;
|
||||
@@ -1172,6 +1257,9 @@ case $os in
|
||||
-opened*)
|
||||
os=-openedition
|
||||
;;
|
||||
-os400*)
|
||||
os=-os400
|
||||
;;
|
||||
-wince*)
|
||||
os=-wince
|
||||
;;
|
||||
@@ -1193,6 +1281,9 @@ case $os in
|
||||
-atheos*)
|
||||
os=-atheos
|
||||
;;
|
||||
-syllable*)
|
||||
os=-syllable
|
||||
;;
|
||||
-386bsd)
|
||||
os=-bsd
|
||||
;;
|
||||
@@ -1215,6 +1306,9 @@ case $os in
|
||||
-sinix*)
|
||||
os=-sysv4
|
||||
;;
|
||||
-tpf*)
|
||||
os=-tpf
|
||||
;;
|
||||
-triton*)
|
||||
os=-sysv3
|
||||
;;
|
||||
@@ -1251,6 +1345,9 @@ case $os in
|
||||
-kaos*)
|
||||
os=-kaos
|
||||
;;
|
||||
-zvmoe)
|
||||
os=-zvmoe
|
||||
;;
|
||||
-none)
|
||||
;;
|
||||
*)
|
||||
@@ -1282,9 +1379,9 @@ case $basic_machine in
|
||||
arm*-semi)
|
||||
os=-aout
|
||||
;;
|
||||
c4x-* | tic4x-*)
|
||||
os=-coff
|
||||
;;
|
||||
c4x-* | tic4x-*)
|
||||
os=-coff
|
||||
;;
|
||||
# This must come before the *-dec entry.
|
||||
pdp10-*)
|
||||
os=-tops20
|
||||
@@ -1328,9 +1425,15 @@ case $basic_machine in
|
||||
*-be)
|
||||
os=-beos
|
||||
;;
|
||||
*-haiku)
|
||||
os=-haiku
|
||||
;;
|
||||
*-ibm)
|
||||
os=-aix
|
||||
;;
|
||||
*-knuth)
|
||||
os=-mmixware
|
||||
;;
|
||||
*-wec)
|
||||
os=-proelf
|
||||
;;
|
||||
@@ -1463,9 +1566,15 @@ case $basic_machine in
|
||||
-mvs* | -opened*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-os400*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-ptx*)
|
||||
vendor=sequent
|
||||
;;
|
||||
-tpf*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-vxsim* | -vxworks* | -windiss*)
|
||||
vendor=wrs
|
||||
;;
|
||||
@@ -1490,7 +1599,7 @@ case $basic_machine in
|
||||
esac
|
||||
|
||||
echo $basic_machine$os
|
||||
exit 0
|
||||
exit
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
|
||||
238
configure.ac
238
configure.ac
@@ -1,19 +1,77 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(fish,1.20.0,fish-users@lists.sf.net)
|
||||
AC_INIT(fish,1.21.2,fish-users@lists.sf.net)
|
||||
|
||||
# If needed, run autoheader automatically
|
||||
# If needed, run autoconf to regenerate the configure file
|
||||
AC_MSG_CHECKING([if autoconf needs to be run])
|
||||
if test configure -ot configure.ac; then
|
||||
AC_MSG_RESULT([yes])
|
||||
if which autoconf >/dev/null; then
|
||||
AC_MSG_NOTICE([running autoconf])
|
||||
if autoconf; then
|
||||
./configure $@
|
||||
fi
|
||||
exit
|
||||
else
|
||||
AC_MSG_ERROR( [cannot find the autoconf program in your path.
|
||||
This program is needs to be run whenever the configure.ac file is modified.
|
||||
Please install it and try again.])
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
|
||||
# If needed, run autoheader to regenerate config.h.in
|
||||
AC_MSG_CHECKING([if autoheader needs to be run])
|
||||
if test ! -f ./config.h.in -o config.h.in -ot configure.ac; then
|
||||
AC_MSG_RESULT([yes])
|
||||
if which autoheader >/dev/null; then
|
||||
echo running autoheader...
|
||||
AC_MSG_NOTICE([running autoheader])
|
||||
autoheader
|
||||
else
|
||||
echo Could not find the autoheader program in your path.
|
||||
echo This program is needed because the configure.ac file has been modified.
|
||||
echo Please install it and try again.
|
||||
exit 1
|
||||
AC_MSG_ERROR( [cannot find the autoheader program in your path.
|
||||
This program is needs to be run whenever the configure.ac file is modified.
|
||||
Please install it and try again.])
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
|
||||
# Detect directories which may contain additional headers, libraries
|
||||
# and commands. This needs to be done early - before Autoconf starts
|
||||
# to mess with CFLAGS and all the other environemnt variables.
|
||||
for i in /usr/pkg /sw /opt /opt/local; do
|
||||
|
||||
AC_MSG_CHECKING([for $i/include include directory])
|
||||
if test -d $i/include; then
|
||||
AC_MSG_RESULT(yes)
|
||||
CPPFLAGS="$CPPFLAGS -I$i/include/"
|
||||
CFLAGS="$CFLAGS -I$i/include/"
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for $i/lib library directory])
|
||||
if test -d $i/lib; then
|
||||
AC_MSG_RESULT(yes)
|
||||
LDFLAGS="$LDFLAGS -L$i/lib/ -R$i/lib/"
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for $i/bin command directory])
|
||||
if test -d $i/bin; then
|
||||
AC_MSG_RESULT(yes)
|
||||
optbindirs="$optbindirs $i/bin"
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
AC_SUBST( optbindirs, $optbindirs )
|
||||
|
||||
# Tell autoconf to create config.h header
|
||||
AC_CONFIG_HEADERS(config.h)
|
||||
|
||||
@@ -26,16 +84,16 @@ AC_PROG_INSTALL
|
||||
AC_CHECK_PROG( has_doxygen, [doxygen], "true")
|
||||
|
||||
if ! test $has_doxygen = "true"; then
|
||||
echo Could not find the Doxygen program in your path.
|
||||
echo This program is needed to build fish.
|
||||
echo Please install it and try again.
|
||||
exit 1
|
||||
AC_MSG_ERROR( [cannot find the Doxygen program in your path.
|
||||
This program is needed to build fish.
|
||||
Please install it and try again.])
|
||||
fi
|
||||
|
||||
# Check for seq program. If missing, install fallback shellscript implementation
|
||||
# Check for seq command. If missing, make sure fallback shellscript
|
||||
# implementation is installed
|
||||
AC_CHECK_PROG( SEQ_FALLBACK, seq, [ ], [seq])
|
||||
|
||||
# Optionally drop xsel
|
||||
# Optionally drop xsel command
|
||||
AC_ARG_WITH( xsel,
|
||||
AC_HELP_STRING([--without-xsel],
|
||||
[do not build the xsel program needed for X clipboard integration]),
|
||||
@@ -62,7 +120,10 @@ fi
|
||||
AC_DEFINE_UNQUOTED([CPU],[L"$target_cpu"],[CPU type])
|
||||
|
||||
|
||||
# Set up installation directories
|
||||
# Set up PREFIX and related preprocessor symbols. Fish needs to know
|
||||
# where it will be installed. One of the reasons for this is so that
|
||||
# it can make sure the fish installation directory is in the path
|
||||
# during startup.
|
||||
if [[ "$prefix" = NONE ]]; then
|
||||
AC_DEFINE_UNQUOTED( [PREFIX], L"/usr/local", [Installation directory])
|
||||
AC_SUBST( PREFIX, /usr/local)
|
||||
@@ -71,11 +132,14 @@ else
|
||||
AC_DEFINE_UNQUOTED( [PREFIX], L"$prefix", [Installation directory])
|
||||
AC_SUBST( PREFIX, [$prefix])
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED( SYSCONFDIR, [L"$(eval echo $sysconfdir)"], [System configuration directory] )
|
||||
AC_DEFINE_UNQUOTED( DATADIR, [L"$(eval echo $datadir)"], [System configuration directory] )
|
||||
AC_SUBST( SYSCONFDIR, ["$(eval echo $sysconfdir)"] )
|
||||
AC_SUBST( DATADIR, ["$(eval echo $datadir)"] )
|
||||
|
||||
AC_SUBST(fishdir,[/fish.d])
|
||||
AC_SUBST(fishfile,[/fish])
|
||||
AC_SUBST(fishinputfile,[/fish_inputrc])
|
||||
|
||||
# Set up the directory where the documentation files should be
|
||||
# installed
|
||||
AC_ARG_VAR( [docdir], [Documentation direcotry] )
|
||||
|
||||
if test -z $docdir; then
|
||||
@@ -83,19 +147,93 @@ if test -z $docdir; then
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED( DOCDIR, [L"$(eval echo $docdir)"], [Documentation directory] )
|
||||
AC_DEFINE_UNQUOTED( SYSCONFDIR, [L"$(eval echo $sysconfdir)"], [System configuration directory] )
|
||||
AC_SUBST( SYSCONFDIR, ["$(eval echo $sysconfdir)"] )
|
||||
|
||||
# Set up locale directory
|
||||
|
||||
# Set up locale directory. This is where the .po files will be
|
||||
# installed.
|
||||
AC_DEFINE_UNQUOTED( [LOCALEDIR], "$(eval echo $datadir)/locale", [Locale directory])
|
||||
AC_SUBST( [LOCALEDIR], [$datadir/locale])
|
||||
|
||||
# See if Linux procfs is present
|
||||
# See if Linux procfs is present. This is used to get extra
|
||||
# information about running processes.
|
||||
AC_CHECK_FILES([/proc/self/stat])
|
||||
|
||||
# See if NetBSD pkgsrc is installed
|
||||
AC_CHECK_FILE([/usr/pkg/lib],[AC_SUBST(LIBDIR,[-L/usr/pkg/lib\ -R/usr/pkg/lib])])
|
||||
AC_CHECK_FILE([/usr/pkg/include],[AC_SUBST(INCLUDEDIR,[-I/usr/pkg/include])])
|
||||
# Check for presense of various libraries
|
||||
AC_SEARCH_LIBS( gettext, intl, AC_SUBST( HAVE_GETTEXT, [1] ), AC_SUBST( HAVE_GETTEXT, [0] ) )
|
||||
AC_SEARCH_LIBS( connect, socket, , [AC_MSG_ERROR([Cannot find the socket library, needed to build this package.] )] )
|
||||
AC_SEARCH_LIBS( nanosleep, rt, , [AC_MSG_ERROR([Cannot find the rt library, needed to build this package.] )] )
|
||||
AC_SEARCH_LIBS( setupterm, [ncurses curses], , [AC_MSG_ERROR([Could not find a curses implementation, needed to build fish])] )
|
||||
|
||||
# Check for presense of various header files
|
||||
AC_CHECK_HEADERS([getopt.h termio.h sys/resource.h term.h ncurses/term.h libintl.h ncurses.h curses.h])
|
||||
|
||||
AC_CHECK_HEADER([regex.h],
|
||||
[AC_DEFINE([HAVE_REGEX_H], [1], [Define to 1 if you have the <regex.h> header file.])],
|
||||
[AC_MSG_ERROR([Could not find the header regex.h, needed to build fish])])
|
||||
|
||||
# Check for presense of various functions
|
||||
AC_CHECK_FUNCS( wcsdup wcsndup wcslen wcscasecmp wcsncasecmp gettext fwprintf )
|
||||
AC_CHECK_FUNCS( futimes wcwidth wcswidth getopt_long wcstok fputwc fgetwc )
|
||||
AC_CHECK_FUNCS( wcstol dcgettext )
|
||||
|
||||
# Here follows a list of small programs used to test for various
|
||||
# features that Autoconf doesn't tell us about
|
||||
|
||||
# Check if realpath accepts null for its second argument
|
||||
AC_MSG_CHECKING([if realpath accepts null for its second argument])
|
||||
AC_RUN_IFELSE(
|
||||
[AC_LANG_PROGRAM([
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>],
|
||||
[int status; char *res; res = realpath( "somefile", 0 ); status = !(res != 0 || errno == ENOENT); exit( status );])],
|
||||
[have_realpath_null=yes],
|
||||
[have_realpath_null=no] )
|
||||
|
||||
if test "$have_realpath_null" = yes; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_REALPATH_NULL], [1],
|
||||
[Define to 1 if realpath accepts null for its second argument.])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
if test "$ac_cv_func_fwprintf" = yes; then
|
||||
|
||||
# Check if fwprintf is broken
|
||||
AC_MSG_CHECKING([if fwprintf is broken])
|
||||
AC_RUN_IFELSE(
|
||||
[AC_LANG_PROGRAM([
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <locale.h>
|
||||
#include <wchar.h>
|
||||
],
|
||||
[
|
||||
setlocale( LC_ALL, "" );
|
||||
fwprintf( stderr, L"%ls%ls", L"", L"fish:" );
|
||||
])],
|
||||
[
|
||||
AC_MSG_RESULT(no)
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE([HAVE_BROKEN_FWPRINTF], [1], [Define to 1 one if the implemented fwprintf is broken])
|
||||
] )
|
||||
|
||||
fi
|
||||
|
||||
# Check for RLIMIT_NPROC in sys/resource.h.
|
||||
AC_MSG_CHECKING([for RLIMIT_NPROC in sys/resource.h])
|
||||
AC_TRY_COMPILE([#include <sys/resource.h>],
|
||||
[int tmp; tmp=RLIMIT_NPROC;], have_rlimit_as=yes, have_rlimit_as=no)
|
||||
if test "$have_rlimit_as" = yes; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_RLIMIT_NPROC], [1],
|
||||
[Define to 1 if HAVE_RLIMIT_NPROC is defined in <sys/resource.h>.])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
# Check for RLIMIT_AS in sys/resource.h.
|
||||
AC_MSG_CHECKING([for RLIMIT_AS in sys/resource.h])
|
||||
@@ -133,40 +271,8 @@ else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
|
||||
# Check for RLIMIT_NPROC in sys/resource.h.
|
||||
AC_MSG_CHECKING([for RLIMIT_NPROC in sys/resource.h])
|
||||
AC_TRY_COMPILE([#include <sys/resource.h>],
|
||||
[int tmp; tmp=RLIMIT_NPROC;], have_rlimit_as=yes, have_rlimit_as=no)
|
||||
if test "$have_rlimit_as" = yes; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_RLIMIT_NPROC], [1],
|
||||
[Define to 1 if HAVE_RLIMIT_NPROC is defined in <sys/resource.h>.])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
|
||||
# Check for libraries
|
||||
AC_CHECK_LIB(socket, connect)
|
||||
AC_CHECK_LIB(rt, nanosleep)
|
||||
AC_CHECK_LIB(intl, gettext)
|
||||
|
||||
# Check for various header files
|
||||
AC_CHECK_HEADERS([getopt.h termio.h sys/resource.h term.h ncurses/term.h libintl.h])
|
||||
|
||||
AC_CHECK_HEADER([regex.h],
|
||||
[AC_DEFINE([HAVE_REGEX_H], [1], [Define to 1 if you have the <regex.h> header file.])],
|
||||
[AC_MSG_ERROR([Could not find the header regex.h, needed to build fish])])
|
||||
|
||||
|
||||
# Check for various functions, and insert results into config.h
|
||||
AC_CHECK_FUNCS( wcsdup wcsndup wcslen wcscasecmp wcsncasecmp gettext fwprintf )
|
||||
AC_CHECK_FUNCS( futimes wcwidth wcswidth getopt_long wcstok fputwc fgetwc )
|
||||
AC_CHECK_FUNCS( wcstol dcgettext )
|
||||
|
||||
# Check again for gettext library, and insert results into the Makefile
|
||||
AC_CHECK_FUNC(gettext, AC_SUBST(HAVE_GETTEXT,1), AC_SUBST(HAVE_GETTEXT,0) )
|
||||
AC_DEFINE([HAVE_TRANSLATE_H], [1],
|
||||
[Define to 1 if the wgettext function should be used for translating strings.])
|
||||
|
||||
# Check for _nl_msg_cat_cntr symbol
|
||||
AC_MSG_CHECKING([for _nl_msg_cat_cntr symbol])
|
||||
@@ -174,25 +280,19 @@ AC_TRY_LINK([#if HAVE_LIBINTL_H]
|
||||
[#include <libintl.h>]
|
||||
[#endif],
|
||||
[extern int _nl_msg_cat_cntr;]
|
||||
[int tmp = _nl_msg_cat_cntr;], have__nl_msg_cat_cntr=yes, have__nl_msg_cat_cntr=no)
|
||||
[int tmp = _nl_msg_cat_cntr; exit(tmp);], have__nl_msg_cat_cntr=yes, have__nl_msg_cat_cntr=no)
|
||||
if test "$have__nl_msg_cat_cntr" = yes; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE__NL_MSG_CAT_CNTR], [1],
|
||||
[Define to 1 if the _nl_msg_cat_cntr symbol is exported.])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
# Check if we have ncurses, and use it rather than curses if possible.
|
||||
AC_CHECK_HEADERS([ncurses.h],[AC_SUBST(CURSESLIB,[ncurses]) AC_DEFINE(HAVE_NCURSES_H)],[AC_SUBST(CURSESLIB,[curses])])
|
||||
|
||||
# Force use of ncurses if it is avialable via NetBSD pkgsrc. This is an
|
||||
# ugly kludge to force NetBSD to use ncurses, since NetBSDs own version
|
||||
# does not properly support terminfo.
|
||||
AC_CHECK_FILE([/usr/pkg/include/ncurses.h],[AC_SUBST(CURSESLIB,[ncurses]) AC_DEFINE(HAVE_NCURSES_H)])
|
||||
|
||||
AC_CONFIG_FILES([Makefile fish.spec doc_src/fish.1 doc_src/Doxyfile init/fish init/fish_interactive.fish init/fish_complete.fish seq])
|
||||
# Tell the world what we know
|
||||
AC_CONFIG_FILES([Makefile fish.spec doc_src/fish.1 doc_src/Doxyfile etc/fish etc/fish_interactive.fish seq])
|
||||
AC_OUTPUT
|
||||
|
||||
echo "fish is now configured."
|
||||
echo "Now run 'make' and 'make install' to built and install fish."
|
||||
echo "Good luck!"
|
||||
|
||||
@@ -3,10 +3,9 @@
|
||||
\subsection cd-synopsis Synopsis
|
||||
<tt>cd [DIRECTORY]</tt>
|
||||
|
||||
\subsection cd-description Description
|
||||
Changes the current directory. If <tt>DIRECTORY</tt> is supplied it
|
||||
will become the new directory. If \c DIRECTORY is a relative path, the
|
||||
CDPATH environment variable will be separated using the : as
|
||||
separator, and the resulting list will be searched for a suitable new
|
||||
current directory. If CDPATH is not set, it is assumed to be '.'. If
|
||||
\c DIRECTORY is not specified, \$HOME will be the new directory.
|
||||
\subsection cd-description Description Changes the current
|
||||
directory. If <tt>DIRECTORY</tt> is supplied it will become the new
|
||||
directory. If \c DIRECTORY is a relative path, the paths found in the
|
||||
CDPATH environment variable array will be tried as prefixes for the
|
||||
specified path. If CDPATH is not set, it is assumed to be '.'. If \c
|
||||
DIRECTORY is not specified, \$HOME will be the new directory.
|
||||
|
||||
@@ -43,6 +43,10 @@ Other switches
|
||||
that they will be returned to the reader before any additional
|
||||
actual keypresses are read.
|
||||
|
||||
If commandline is called during a call to complete a given string
|
||||
using <code>complete -C STRING</code>, commandline will consider the
|
||||
specified string to be the current contents of the commandline.
|
||||
|
||||
\subsection commandline-example Example
|
||||
|
||||
<tt>commandline -j $history[3]</tt>
|
||||
|
||||
@@ -14,6 +14,7 @@ the fish manual.
|
||||
- <tt>LONG_OPTION</tt> is a multi character option for the command
|
||||
- <tt>OPTION_ARGUMENTS</tt> is parameter containing a space-separated list of possible option-arguments, which may contain subshells
|
||||
- <tt>DESCRIPTION</tt> is a description of what the option and/or option arguments do
|
||||
- <tt>-C STRING</tt> or <tt>--do-complete=STRING</tt> makes complete try to find all possible completions for the specified string
|
||||
- <tt>-e</tt> or <tt>--erase</tt> implies that the specified completion should be deleted
|
||||
- <tt>-f</tt> or <tt>--no-files</tt> specifies that the option specified by this completion may not be followed by a filename
|
||||
- <tt>-n</tt> or <tt>--condition</tt> specifies a shell command that must return 0 if the completion is to be used. This makes it possible to specify completions that should only be used in some cases.
|
||||
@@ -31,8 +32,8 @@ options, the same styles as the GNU version of the getopt
|
||||
library. These styles are:
|
||||
|
||||
- Short options, like '-a'. Short options are a single character long, are preceded by a single hyphen and may be grouped together (like '-la', which is equivalent to '-l -a'). Option arguments may be specified in the following parameter ('-w 32') or by appending the option with the value ('-w32').
|
||||
- Old style long options, like '-Wall'. Old style long options are more than one character long, are preceded by a single hyphen and may not be grouped together. Option arguments are specified in the following parameter ('-ao null').
|
||||
- GNU style long options, like '--colors'. GNU style long options are more than one character long, are preceded by two hyphens, and may not be grouped together. Option arguments may be specified in the following parameter ('--quoting-style shell') or by appending the option with a '=' and the value ('--quoting-style=shell'). GNU style long options may be abbreviated so long as the abbreviation is unique ('--h' is equivalent to '--help' if help is the only long option beginning with an 'h').
|
||||
- Old style long options, like '-Wall'. Old style long options can be more than one character long, are preceded by a single hyphen and may not be grouped together. Option arguments are specified in the following parameter ('-ao null').
|
||||
- GNU style long options, like '--colors'. GNU style long options can be more than one character long, are preceded by two hyphens, and may not be grouped together. Option arguments may be specified in the following parameter ('--quoting-style shell') or by appending the option with a '=' and the value ('--quoting-style=shell'). GNU style long options may be abbreviated so long as the abbreviation is unique ('--h' is equivalent to '--help' if help is the only long option beginning with an 'h').
|
||||
|
||||
The options for specifying command name, command path, or command
|
||||
switches may all be used multiple times to specify multiple commands
|
||||
|
||||
24
doc_src/contains.txt
Normal file
24
doc_src/contains.txt
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
\section contains contains - Test if a word is present in a list
|
||||
|
||||
\subsection contains-synopsis Synopsis
|
||||
<code>contains [OPTIONS] KEY [VALUES...]</code>
|
||||
|
||||
\subsection contains-description Description
|
||||
|
||||
- \c -h or \c --help display this message
|
||||
|
||||
Test if the set VALUES contains the string KEY. Return status is 0 if
|
||||
yes, 1 otherwise
|
||||
|
||||
|
||||
\subsection contains-example Example
|
||||
<pre>
|
||||
for i in ~/bin /usr/local/bin
|
||||
if not contains \$i \$PATH
|
||||
set PATH \$PATH i
|
||||
end
|
||||
end
|
||||
</pre>
|
||||
|
||||
The above code tests if ~/bin and /usr/local/bin are in the path and if they are not, they are added.
|
||||
1239
doc_src/doc.hdr
1239
doc_src/doc.hdr
File diff suppressed because it is too large
Load Diff
9
doc_src/fish_pager.txt
Normal file
9
doc_src/fish_pager.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
\section fish_pager fish_pager - Internal command used by fish
|
||||
|
||||
\subsection fish_pager-description Description
|
||||
|
||||
This command is used internally by fish to display a list of
|
||||
completions. It should not be used by other commands, as it's
|
||||
interface is liable to change in the future.
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
\section nextd nextd
|
||||
|
||||
\subsection nextd-synopsis Synopsis
|
||||
<tt>nextd [-l] [pos]</tt>
|
||||
<tt>nextd [-l | --list] [pos]</tt>
|
||||
|
||||
\subsection nextd-description Description
|
||||
<tt>nextd</tt> moves forwards <tt>pos</tt> positions in the history of visited directories;
|
||||
if the end of the history has been hit, a warning is printed. If the <tt>-l></tt> flag is
|
||||
specified, the current history is also displayed.
|
||||
\subsection nextd-description Description <tt>nextd</tt> moves
|
||||
forwards <tt>pos</tt> positions in the history of visited directories;
|
||||
if the end of the history has been hit, a warning is printed. If the
|
||||
<code>-l></code> or <code>--list</code> flag is specified, the current
|
||||
history is also displayed.
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
\section prevd prevd
|
||||
|
||||
\subsection prevd-synopsis Synopsis
|
||||
<tt>prevd [-l] [pos]</tt>
|
||||
<tt>prevd [-l | --list] [pos]</tt>
|
||||
|
||||
\subsection prevd-description Description
|
||||
<tt>prevd</tt> moves backwards <tt>pos</tt> positions in the history of visited directories;
|
||||
if the beginning of the history has been hit, a warning is printed. If the <tt>-l</tt> flag
|
||||
is specified, the current history is also displayed.
|
||||
\subsection prevd-description Description <tt>prevd</tt> moves
|
||||
backwards <tt>pos</tt> positions in the history of visited
|
||||
directories; if the beginning of the history has been hit, a warning
|
||||
is printed. If the <code>-l</code> or <code>--list</code> flag is
|
||||
specified, the current history is also displayed.
|
||||
|
||||
@@ -27,8 +27,14 @@ If a variable is set to more than one value, the variable will be an
|
||||
array with the specified elements. If a variable is set to zero
|
||||
elements, it will become an array with zero elements.
|
||||
|
||||
If the variable name is one or more array elements, such as <code>PATH[1
|
||||
3 7]</code>, only those array elements specified will be changed.
|
||||
If the variable name is one or more array elements, such as
|
||||
<code>PATH[1 3 7]</code>, only those array elements specified will be
|
||||
changed.
|
||||
|
||||
The set command requires all switch arguments to come before any
|
||||
non-switch arguments. For example, <code>set flags -l</code> will have
|
||||
the effect of setting the value of the variable <code>flags</code> to
|
||||
'-l', not making the variable local.
|
||||
|
||||
\subsection set-example Example
|
||||
|
||||
|
||||
10
env.c
10
env.c
@@ -33,7 +33,10 @@
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
#include "fallback.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "wutil.h"
|
||||
#include "proc.h"
|
||||
#include "common.h"
|
||||
@@ -386,7 +389,7 @@ static void setup_path()
|
||||
path = env_get( L"PATH" );
|
||||
if( !path )
|
||||
{
|
||||
env_set( L"PATH", 0, ENV_EXPORT | ENV_GLOBAL | ENV_USER );
|
||||
env_set( L"PATH", 0, ENV_EXPORT | ENV_GLOBAL );
|
||||
path=0;
|
||||
}
|
||||
|
||||
@@ -889,7 +892,10 @@ wchar_t *env_get( const wchar_t *key )
|
||||
wchar_t *next = history_get( i-add_current );
|
||||
if( !next )
|
||||
{
|
||||
debug( 1, _( L"No history item at index %d\n" ), i );
|
||||
/*
|
||||
This is not an error - it simply means the user has
|
||||
a short history
|
||||
*/
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "config.h"
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <wchar.h>
|
||||
@@ -26,7 +27,9 @@
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#include "fallback.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "wutil.h"
|
||||
#include "env_universal_common.h"
|
||||
@@ -214,7 +217,7 @@ void env_universal_init( wchar_t * p,
|
||||
void (*sf)(),
|
||||
void (*cb)( int type, const wchar_t *name, const wchar_t *val ))
|
||||
{
|
||||
debug( 2, L"env_universal_init()" );
|
||||
debug( 3, L"env_universal_init()" );
|
||||
path=p;
|
||||
user=u;
|
||||
start_fishd=sf;
|
||||
@@ -233,7 +236,7 @@ void env_universal_init( wchar_t * p,
|
||||
{
|
||||
env_universal_barrier();
|
||||
}
|
||||
debug( 2, L"end env_universal_init()" );
|
||||
debug( 3, L"end env_universal_init()" );
|
||||
}
|
||||
|
||||
void env_universal_destroy()
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
client library and by the daemon.
|
||||
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <wchar.h>
|
||||
@@ -25,7 +28,9 @@
|
||||
#include <signal.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "fallback.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "wutil.h"
|
||||
#include "env_universal_common.h"
|
||||
@@ -103,7 +108,7 @@ static int get_names_show_unexported;
|
||||
|
||||
void env_universal_common_init( void (*cb)(int type, const wchar_t *key, const wchar_t *val ) )
|
||||
{
|
||||
debug( 2, L"Init env_universal_common" );
|
||||
debug( 3, L"Init env_universal_common" );
|
||||
callback = cb;
|
||||
hash_init( &env_universal_var, &hash_wcs_func, &hash_wcs_cmp );
|
||||
}
|
||||
@@ -186,7 +191,7 @@ void read_message( connection_t *src )
|
||||
}
|
||||
else
|
||||
{
|
||||
sb_printf( &src->input, L"%lc", res );
|
||||
sb_append_char( &src->input, res );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -227,7 +232,7 @@ static int match( const wchar_t *msg, const wchar_t *cmd )
|
||||
static void parse_message( wchar_t *msg,
|
||||
connection_t *src )
|
||||
{
|
||||
debug( 2, L"parse_message( %ls );", msg );
|
||||
debug( 3, L"parse_message( %ls );", msg );
|
||||
|
||||
if( msg[0] == L'#' )
|
||||
return;
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
#
|
||||
# Init file for fish
|
||||
#
|
||||
# @configure_input@
|
||||
|
||||
#
|
||||
# Set default search paths
|
||||
#
|
||||
|
||||
set -g fish_function_path ~/.fish.d/functions @SYSCONFDIR@/fish.d/functions @DATADIR@/fish/functions
|
||||
set -g fish_complete_path ~/.fish.d/completions @SYSCONFDIR@/fish.d/completions @DATADIR@/fish/completions
|
||||
|
||||
#
|
||||
# Set default field separators
|
||||
@@ -15,11 +22,10 @@ set -g IFS \ \t\n
|
||||
# want this even for text-only terminals.
|
||||
#
|
||||
|
||||
set -l path_list /bin /usr/bin /usr/X11R6/bin @PREFIX@/bin
|
||||
set -l path_list /bin /usr/bin /usr/X11R6/bin @PREFIX@/bin @optbindirs@
|
||||
|
||||
# Root should also have the sbin directories in the path
|
||||
set -l uid (id -u 2>/dev/null)
|
||||
if test "$uid" = 0
|
||||
if test "$USER" = root
|
||||
set path_list $path_list /sbin /usr/sbin /usr/local/sbin
|
||||
end
|
||||
|
||||
@@ -32,28 +38,12 @@ for i in $path_list
|
||||
end
|
||||
|
||||
|
||||
#
|
||||
# Set some value for LANG if nothing was set before, and this is a
|
||||
# login shell. Also check for i18n information in /etc/sysconfig/i18n
|
||||
#
|
||||
|
||||
if status --is-login
|
||||
if not set -q LANG >/dev/null
|
||||
set -gx LANG en_US.UTF-8
|
||||
end
|
||||
|
||||
if test -f /etc/sysconfig/i18n
|
||||
eval (cat /etc/sysconfig/i18n |sed -ne 's/^\([a-zA-Z]*\)=\(.*\)$/set -gx \1 \2;/p')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
#
|
||||
# Put linux console in unicode mode. Should this be done in any other
|
||||
# situation as well?
|
||||
#
|
||||
|
||||
if expr "$LANG" : ".*UTF" >/dev/null
|
||||
if expr "$LANG" : ".*[Uu][Tt][Ff]" >/dev/null
|
||||
if test linux = "$TERM"
|
||||
unicode_start ^/dev/null
|
||||
end
|
||||
@@ -71,22 +61,6 @@ for i in DISPLAY
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
# Alias for gettext (or a fallback if gettext isn't installed) This
|
||||
# needs to be defined here and not in fish_function.fish, since it is
|
||||
# used by other init files.
|
||||
#
|
||||
|
||||
if test 1 = "@HAVE_GETTEXT@"; and which gettext >/dev/null ^/dev/null
|
||||
function _ -d "Alias for the gettext command"
|
||||
gettext fish $argv
|
||||
end
|
||||
else
|
||||
function _ -d "Alias for the gettext command"
|
||||
printf "%s" $argv
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
# Load additional initialization files
|
||||
#
|
||||
103
etc/fish_interactive.fish.in
Normal file
103
etc/fish_interactive.fish.in
Normal file
@@ -0,0 +1,103 @@
|
||||
#
|
||||
# Initializations that should only be performed when in interactive mode
|
||||
#
|
||||
# @configure_input@
|
||||
|
||||
if not status --is-interactive
|
||||
exit
|
||||
end
|
||||
|
||||
#
|
||||
# Print a greeting
|
||||
#
|
||||
|
||||
printf (_ 'Welcome to fish, the friendly interactive shell\n')
|
||||
printf (_ 'Type %shelp%s for instructions on how to use fish\n') (set_color green) (set_color normal)
|
||||
|
||||
#
|
||||
# Set exit message
|
||||
#
|
||||
|
||||
function fish_on_exit -d (_ "Commands to execute when fish exits") --on-process %self
|
||||
printf (_ "Good bye\n")
|
||||
end
|
||||
|
||||
#
|
||||
# Set INPUTRC to something nice
|
||||
#
|
||||
# We override INPUTRC if already set, since it may be set by a shell
|
||||
# other than fish, which may use a different file. The new value should
|
||||
# be exported, since the fish inputrc file plays nice with other files
|
||||
# by including them when found.
|
||||
# Give priority to the default file installed with fish in
|
||||
# @SYSCONFDIR@/fish_inputrc.
|
||||
#
|
||||
|
||||
for i in ~/.fish_inputrc @SYSCONFDIR@/fish_inputrc ~/.inputrc /etc/inputrc
|
||||
if test -f $i
|
||||
set -xg INPUTRC $i
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
#
|
||||
# Set various color values
|
||||
#
|
||||
|
||||
function set_default -d "Set an universal variable, unless it has already been set"
|
||||
if not set -q $argv[1]
|
||||
set -U -- $argv
|
||||
end
|
||||
if not set -q $argv[1]
|
||||
set -g -- $argv
|
||||
end
|
||||
end
|
||||
|
||||
function set_exported_default -d "Set an exported universal variable, unless it has already been set"
|
||||
if not set -q $argv[1]
|
||||
set -Ux -- $argv
|
||||
end
|
||||
if not set -q $argv[1]
|
||||
set -gx -- $argv
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# Regular syntax highlighting colors
|
||||
set_default fish_color_normal normal
|
||||
set_default fish_color_command green
|
||||
set_default fish_color_redirection normal
|
||||
set_default fish_color_comment brown
|
||||
set_default fish_color_error red
|
||||
|
||||
set_default fish_color_cwd green
|
||||
|
||||
# Background color for matching quotes and parenthesis
|
||||
set_default fish_color_match cyan
|
||||
|
||||
# Background color for search matches
|
||||
set_default fish_color_search_match purple
|
||||
|
||||
# Pager colors
|
||||
set_default fish_pager_color_prefix cyan
|
||||
set_default fish_pager_color_completion normal
|
||||
set_default fish_pager_color_description normal
|
||||
set_default fish_pager_color_progress cyan
|
||||
|
||||
# Directory history colors
|
||||
set_default fish_color_history_current cyan
|
||||
|
||||
|
||||
#
|
||||
# Setup the CDPATH variable
|
||||
#
|
||||
|
||||
set_default CDPATH . ~
|
||||
|
||||
#
|
||||
# Remove temporary functions
|
||||
#
|
||||
|
||||
functions -e set_exported_default
|
||||
functions -e set_default
|
||||
86
event.c
86
event.c
@@ -12,7 +12,10 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "fallback.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "wutil.h"
|
||||
#include "function.h"
|
||||
#include "proc.h"
|
||||
@@ -21,6 +24,7 @@
|
||||
#include "event.h"
|
||||
#include "signal.h"
|
||||
#include "translate.h"
|
||||
#include "halloc_util.h"
|
||||
|
||||
/**
|
||||
Number of signals that can be queued before an overflow occurs
|
||||
@@ -74,11 +78,15 @@ static array_list_t *killme;
|
||||
*/
|
||||
static array_list_t *blocked;
|
||||
|
||||
/**
|
||||
String buffer used for formating event descriptions in event_get_desc()
|
||||
*/
|
||||
static string_buffer_t *get_desc_buff=0;
|
||||
|
||||
/**
|
||||
Tests if one event instance matches the definition of a event
|
||||
class. If the class defines a function name, that will also be a
|
||||
match criterion.
|
||||
class. If both the class and the instance name a function,
|
||||
they must name the same function.
|
||||
|
||||
*/
|
||||
static int event_match( event_t *class, event_t *instance )
|
||||
@@ -186,6 +194,60 @@ static int event_is_blocked( event_t *e )
|
||||
return 0;
|
||||
}
|
||||
|
||||
const wchar_t *event_get_desc( event_t *e )
|
||||
{
|
||||
if( !get_desc_buff )
|
||||
{
|
||||
get_desc_buff=sb_halloc( global_context );
|
||||
}
|
||||
else
|
||||
{
|
||||
sb_clear( get_desc_buff );
|
||||
}
|
||||
|
||||
switch( e->type )
|
||||
{
|
||||
|
||||
case EVENT_SIGNAL:
|
||||
sb_printf( get_desc_buff, _(L"signal handler for %ls (%ls)"), sig2wcs(e->param1.signal ), signal_get_desc( e->param1.signal ) );
|
||||
break;
|
||||
|
||||
case EVENT_VARIABLE:
|
||||
sb_printf( get_desc_buff, _(L"handler for variable '%ls'"), e->param1.variable );
|
||||
break;
|
||||
|
||||
case EVENT_EXIT:
|
||||
if( e->param1.pid > 0 )
|
||||
{
|
||||
sb_printf( get_desc_buff, _(L"exit handler for process %d"), e->param1.pid );
|
||||
}
|
||||
else
|
||||
{
|
||||
job_t *j = job_get_from_pid( -e->param1.pid );
|
||||
if( j )
|
||||
sb_printf( get_desc_buff, _(L"exit handler for job %d, '%ls'"), j->job_id, j->command );
|
||||
else
|
||||
sb_printf( get_desc_buff, _(L"exit handler for job with process group %d"), -e->param1.pid );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case EVENT_JOB_ID:
|
||||
{
|
||||
job_t *j = job_get( e->param1.job_id );
|
||||
if( j )
|
||||
sb_printf( get_desc_buff, _(L"exit handler for job %d, '%ls'"), j->job_id, j->command );
|
||||
else
|
||||
sb_printf( get_desc_buff, _(L"exit handler for job with job id %d"), j->job_id );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return (const wchar_t *)get_desc_buff->buff;
|
||||
}
|
||||
|
||||
|
||||
void event_add_handler( event_t *event )
|
||||
{
|
||||
@@ -194,7 +256,7 @@ void event_add_handler( event_t *event )
|
||||
e = event_copy( event, 0 );
|
||||
|
||||
if( !events )
|
||||
events = al_new();
|
||||
events = al_new();
|
||||
|
||||
if( e->type == EVENT_SIGNAL )
|
||||
{
|
||||
@@ -326,8 +388,6 @@ static void event_fire_internal( event_t *event )
|
||||
int i, j;
|
||||
string_buffer_t *b=0;
|
||||
array_list_t *fire=0;
|
||||
|
||||
int was_subshell = is_subshell;
|
||||
|
||||
/*
|
||||
First we free all events that have been removed
|
||||
@@ -391,7 +451,7 @@ static void event_fire_internal( event_t *event )
|
||||
|
||||
for( j=0; j<al_get_count(&event->arguments); j++ )
|
||||
{
|
||||
wchar_t *arg_esc = escape( (wchar_t *)al_get( &event->arguments, j), 0 );
|
||||
wchar_t *arg_esc = escape( (wchar_t *)al_get( &event->arguments, j), 1 );
|
||||
sb_append( b, L" " );
|
||||
sb_append( b, arg_esc );
|
||||
free( arg_esc );
|
||||
@@ -403,16 +463,14 @@ static void event_fire_internal( event_t *event )
|
||||
Event handlers are not part of the main flow of code, so
|
||||
they are marked as non-interactive and as a subshell
|
||||
*/
|
||||
is_subshell=1;
|
||||
proc_push_interactive(0);
|
||||
parser_push_block( EVENT );
|
||||
current_block->param1.event = event;
|
||||
eval( (wchar_t *)b->buff, 0, TOP );
|
||||
|
||||
parser_pop_block();
|
||||
proc_pop_interactive();
|
||||
}
|
||||
|
||||
/*
|
||||
Restore interactivity flags
|
||||
*/
|
||||
is_subshell = was_subshell;
|
||||
|
||||
if( b )
|
||||
{
|
||||
sb_destroy( b );
|
||||
@@ -564,6 +622,7 @@ void event_init()
|
||||
|
||||
void event_destroy()
|
||||
{
|
||||
|
||||
if( events )
|
||||
{
|
||||
al_foreach( events, (void (*)(const void *))&event_free );
|
||||
@@ -571,6 +630,7 @@ void event_destroy()
|
||||
free( events );
|
||||
events=0;
|
||||
}
|
||||
|
||||
if( killme )
|
||||
{
|
||||
al_foreach( killme, (void (*)(const void *))&event_free );
|
||||
|
||||
6
event.h
6
event.h
@@ -130,4 +130,10 @@ void event_destroy();
|
||||
*/
|
||||
void event_free( event_t *e );
|
||||
|
||||
/**
|
||||
Returns a string describing the specified event. The string should
|
||||
not be freed.
|
||||
*/
|
||||
const wchar_t *event_get_desc( event_t *e );
|
||||
|
||||
#endif
|
||||
|
||||
223
exec.c
223
exec.c
@@ -22,7 +22,10 @@
|
||||
#include <dirent.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "fallback.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "wutil.h"
|
||||
#include "proc.h"
|
||||
@@ -37,6 +40,9 @@
|
||||
#include "signal.h"
|
||||
#include "env_universal.h"
|
||||
#include "translate.h"
|
||||
#include "halloc.h"
|
||||
#include "halloc_util.h"
|
||||
#include "parse_util.h"
|
||||
|
||||
/**
|
||||
Prototype for the getpgid library function. The prototype for this
|
||||
@@ -67,6 +73,8 @@ pid_t getpgid( pid_t pid );
|
||||
*/
|
||||
static array_list_t *open_fds=0;
|
||||
|
||||
static int set_child_group( job_t *j, process_t *p, int print_errors );
|
||||
|
||||
|
||||
void exec_close( int fd )
|
||||
{
|
||||
@@ -238,7 +246,7 @@ void free_fd( io_data_t *io, int fd )
|
||||
\param io the list of IO redirections for the child
|
||||
\param exit_on_error whether to call exit() on errors
|
||||
|
||||
\return 1 on sucess, 0 on failiure
|
||||
\return 0 on sucess, -1 on failiure
|
||||
*/
|
||||
static int handle_child_io( io_data_t *io, int exit_on_error )
|
||||
{
|
||||
@@ -257,7 +265,7 @@ static int handle_child_io( io_data_t *io, int exit_on_error )
|
||||
if( io->fd > 2 )
|
||||
{
|
||||
/*
|
||||
Make sure the fd used by this redirection is not used by i.e. a pipe.
|
||||
Make sure the fd used by this redirection is not used by e.g. a pipe.
|
||||
*/
|
||||
free_fd( io, io->fd );
|
||||
}
|
||||
@@ -283,7 +291,7 @@ static int handle_child_io( io_data_t *io, int exit_on_error )
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if( tmp != io->fd)
|
||||
@@ -302,7 +310,7 @@ static int handle_child_io( io_data_t *io, int exit_on_error )
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
exec_close( tmp );
|
||||
@@ -326,7 +334,7 @@ static int handle_child_io( io_data_t *io, int exit_on_error )
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -349,7 +357,7 @@ static int handle_child_io( io_data_t *io, int exit_on_error )
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -373,7 +381,7 @@ static int handle_child_io( io_data_t *io, int exit_on_error )
|
||||
if( env_universal_server.fd >= 0 )
|
||||
exec_close( env_universal_server.fd );
|
||||
|
||||
return 1;
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
@@ -387,41 +395,24 @@ static int handle_child_io( io_data_t *io, int exit_on_error )
|
||||
\param j the job to set up the IO for
|
||||
\param p the child process to set up
|
||||
|
||||
\return 1 on sucess, 0 on failiure
|
||||
\return 0 on sucess, -1 on failiure
|
||||
*/
|
||||
static int setup_child_process( job_t *j, process_t *p )
|
||||
{
|
||||
int res;
|
||||
|
||||
if( j->terminal )
|
||||
{
|
||||
pid_t pid;
|
||||
/*
|
||||
Put the process into the process group and give the process
|
||||
group the terminal, if appropriate. This has to be done
|
||||
both by the shell and in the individual child processes
|
||||
because of potential race conditions.
|
||||
*/
|
||||
pid = getpid ();
|
||||
if (j->pgid == 0)
|
||||
j->pgid = pid;
|
||||
|
||||
/* Wait till shell puts os in our own group */
|
||||
while( getpgrp() != j->pgid )
|
||||
sleep(0);
|
||||
|
||||
/* Wait till shell gives us stdin */
|
||||
if ( j->fg )
|
||||
{
|
||||
while( tcgetpgrp( 0 ) != j->pgid )
|
||||
sleep(0);
|
||||
}
|
||||
int res=0;
|
||||
|
||||
if( p )
|
||||
{
|
||||
res = set_child_group( j, p, 1 );
|
||||
}
|
||||
|
||||
if( !res )
|
||||
{
|
||||
res = handle_child_io( j->io, (p!=0) );
|
||||
}
|
||||
|
||||
res = handle_child_io( j->io, (p==0) );
|
||||
|
||||
/* Set the handling for job control signals back to the default. */
|
||||
if( res )
|
||||
if( !res )
|
||||
{
|
||||
signal_reset_handlers();
|
||||
}
|
||||
@@ -595,14 +586,22 @@ static void internal_exec_helper( const wchar_t *def,
|
||||
}
|
||||
|
||||
/**
|
||||
This function should be called by the parent process right after
|
||||
fork() has been called. If job control is enabled, the child is put
|
||||
in the jobs group.
|
||||
This function should be called by both the parent process and the
|
||||
child right after fork() has been called. If job control is
|
||||
enabled, the child is put in the jobs group, and if the child is
|
||||
also in the foreground, it is also given control of the
|
||||
terminal. When called in the parent process, this function may
|
||||
fail, since the child might have already finished and called
|
||||
exit. The parent process may safely ignore the exit status of this
|
||||
call.
|
||||
|
||||
Returns 0 on sucess, -1 on failiure.
|
||||
*/
|
||||
static int handle_new_child( job_t *j, process_t *p )
|
||||
static int set_child_group( job_t *j, process_t *p, int print_errors )
|
||||
{
|
||||
int res = 0;
|
||||
|
||||
if( j->terminal )
|
||||
if( j->job_control )
|
||||
{
|
||||
int new_pgid=0;
|
||||
|
||||
@@ -614,7 +613,7 @@ static int handle_new_child( job_t *j, process_t *p )
|
||||
|
||||
if( setpgid (p->pid, j->pgid) )
|
||||
{
|
||||
if( getpgid( p->pid) != j->pgid )
|
||||
if( getpgid( p->pid) != j->pgid && print_errors )
|
||||
{
|
||||
debug( 1,
|
||||
_( L"Could not send process %d from group %d to group %d" ),
|
||||
@@ -622,38 +621,28 @@ static int handle_new_child( job_t *j, process_t *p )
|
||||
getpgid( p->pid),
|
||||
j->pgid );
|
||||
wperror( L"setpgid" );
|
||||
res = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if( j->fg )
|
||||
{
|
||||
if( tcsetpgrp (0, j->pgid) )
|
||||
{
|
||||
debug( 1, _( L"Could not send job %d ('%ls') to foreground" ),
|
||||
j->job_id,
|
||||
j->command );
|
||||
wperror( L"tcsetpgrp" );
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if( j->fg && new_pgid)
|
||||
{
|
||||
if( tcsetpgrp (0, j->pgid) )
|
||||
{
|
||||
debug( 1, _( L"Could not send job %d ('%ls') to foreground" ),
|
||||
j->job_id,
|
||||
j->command );
|
||||
wperror( L"tcsetpgrp" );
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
j->pgid = getpid();
|
||||
}
|
||||
return 0;
|
||||
|
||||
if( j->terminal && j->fg )
|
||||
{
|
||||
if( tcsetpgrp (0, j->pgid) && print_errors )
|
||||
{
|
||||
debug( 1, _( L"Could not send job %d ('%ls') to foreground" ),
|
||||
j->job_id,
|
||||
j->command );
|
||||
wperror( L"tcsetpgrp" );
|
||||
res = -1;
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -689,9 +678,10 @@ void exec( job_t *j )
|
||||
signal_block();
|
||||
|
||||
/*
|
||||
setup_child_process make sure signals are propelry set up
|
||||
setup_child_process make sure signals are properly set
|
||||
up. It will also call signal_unblock
|
||||
*/
|
||||
if( setup_child_process( j, 0 ) )
|
||||
if( !setup_child_process( j, 0 ) )
|
||||
{
|
||||
/*
|
||||
launch_process never returns
|
||||
@@ -722,9 +712,9 @@ void exec( job_t *j )
|
||||
if( block_io )
|
||||
{
|
||||
if( j->io )
|
||||
j->io = io_add( io_duplicate(block_io), j->io );
|
||||
j->io = io_add( io_duplicate( j, block_io), j->io );
|
||||
else
|
||||
j->io=io_duplicate(block_io);
|
||||
j->io=io_duplicate( j, block_io);
|
||||
}
|
||||
|
||||
j->io = io_add( j->io, &pipe_write );
|
||||
@@ -803,53 +793,22 @@ void exec( job_t *j )
|
||||
{
|
||||
case INTERNAL_FUNCTION:
|
||||
{
|
||||
wchar_t **arg;
|
||||
int i;
|
||||
string_buffer_t sb;
|
||||
|
||||
const wchar_t * def = function_get_definition( p->argv[0] );
|
||||
// fwprintf( stderr, L"run function %ls\n", argv[0] );
|
||||
wchar_t * def = halloc_register( j, wcsdup( function_get_definition( p->argv[0] )));
|
||||
//fwprintf( stderr, L"run function %ls\n", argv[0] );
|
||||
if( def == 0 )
|
||||
{
|
||||
debug( 0, _( L"Unknown function '%ls'" ), p->argv[0] );
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
These two lines must be called before the new block is pushed
|
||||
*/
|
||||
int lineno = parser_get_lineno();
|
||||
wchar_t *file = parser_current_filename()?wcsdup(parser_current_filename()):0;
|
||||
|
||||
parser_push_block( FUNCTION_CALL );
|
||||
|
||||
al_init( ¤t_block->param2.function_vars );
|
||||
current_block->param1.function_name = wcsdup( p->argv[0] );
|
||||
current_block->param3.function_lineno = lineno;
|
||||
current_block->param4.function_filename = file;
|
||||
|
||||
if( builtin_count_args(p->argv)>1 )
|
||||
{
|
||||
sb_init( &sb );
|
||||
|
||||
for( i=1, arg=p->argv+1; *arg; i++, arg++ )
|
||||
{
|
||||
al_push( ¤t_block->param2.function_vars,
|
||||
escape(*arg, 1) );
|
||||
|
||||
if( i != 1 )
|
||||
sb_append( &sb, ARRAY_SEP_STR );
|
||||
sb_append( &sb, *arg );
|
||||
}
|
||||
|
||||
env_set( L"argv", (wchar_t *)sb.buff, ENV_LOCAL );
|
||||
sb_destroy( &sb );
|
||||
}
|
||||
else
|
||||
{
|
||||
env_set( L"argv", 0, ENV_LOCAL );
|
||||
}
|
||||
|
||||
current_block->param2.function_call_process = p;
|
||||
current_block->param1.function_name = halloc_register( current_block, wcsdup( p->argv[0] ) );
|
||||
|
||||
parse_util_set_argv( p->argv+1 );
|
||||
|
||||
parser_forbid_function( p->argv[0] );
|
||||
|
||||
if( p->next )
|
||||
@@ -1016,7 +975,7 @@ void exec( job_t *j )
|
||||
if( !io_buffer )
|
||||
{
|
||||
/*
|
||||
No buffer, se we exit directly. This means we
|
||||
No buffer, so we exit directly. This means we
|
||||
have to manually set the exit status.
|
||||
*/
|
||||
if( p->next == 0 )
|
||||
@@ -1062,12 +1021,19 @@ void exec( job_t *j )
|
||||
it control over the terminal.
|
||||
*/
|
||||
p->pid = pid;
|
||||
if( handle_new_child( j, p ) )
|
||||
exit(1);
|
||||
|
||||
set_child_group( j, p, 0 );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if( p->next == 0 )
|
||||
{
|
||||
proc_set_last_status( j->negate?(status?0:1):status);
|
||||
}
|
||||
p->completed = 1;
|
||||
}
|
||||
|
||||
io_buffer_destroy( io_buffer );
|
||||
|
||||
@@ -1154,9 +1120,8 @@ void exec( job_t *j )
|
||||
*/
|
||||
p->pid = pid;
|
||||
|
||||
if( handle_new_child( j, p ) )
|
||||
exit( 1 );
|
||||
|
||||
set_child_group( j, p, 0 );
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -1194,20 +1159,16 @@ void exec( job_t *j )
|
||||
*/
|
||||
p->pid = pid;
|
||||
|
||||
if( handle_new_child( j, p ) )
|
||||
exit( 1 );
|
||||
|
||||
|
||||
set_child_group( j, p, 0 );
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if( p->type == INTERNAL_BUILTIN )
|
||||
builtin_pop_io();
|
||||
|
||||
builtin_pop_io();
|
||||
|
||||
/*
|
||||
Close the pipe the current process uses to read from the previous process_t
|
||||
@@ -1302,24 +1263,30 @@ int exec_subshell( const wchar_t *cmd,
|
||||
{
|
||||
wchar_t *el = str2wcs( begin );
|
||||
if( el )
|
||||
{
|
||||
al_push( l, el );
|
||||
}
|
||||
else
|
||||
{
|
||||
debug( 2, L"Got null string on line %d of file %s", __LINE__, __FILE__ );
|
||||
}
|
||||
}
|
||||
io_buffer_destroy( io_buffer );
|
||||
|
||||
|
||||
return status;
|
||||
|
||||
case '\n':
|
||||
{
|
||||
wchar_t *el;
|
||||
*end=0;
|
||||
el = str2wcs( begin );
|
||||
if( !el )
|
||||
el = str2wcs( begin );
|
||||
if( el )
|
||||
{
|
||||
debug( 0, _( L"Subshell '%ls' returned illegal string, discarded one entry" ), cmd );
|
||||
al_push( l, el );
|
||||
}
|
||||
else
|
||||
{
|
||||
al_push( l, el );
|
||||
debug( 2, L"Got null string on line %d of file %s", __LINE__, __FILE__ );
|
||||
}
|
||||
begin = end+1;
|
||||
break;
|
||||
|
||||
44
expand.h
44
expand.h
@@ -130,7 +130,7 @@ enum
|
||||
\param out The list to which the result will be appended.
|
||||
\return One of EXPAND_OK, EXPAND_ERROR, EXPAND_WILDCARD_MATCH and EXPAND_WILDCARD_NO_MATCH
|
||||
*/
|
||||
int expand_string( wchar_t *in, array_list_t *out, int flag );
|
||||
int expand_string( void *context, wchar_t *in, array_list_t *out, int flag );
|
||||
|
||||
/**
|
||||
expand_one is identical to expand_string, except it will fail if in
|
||||
@@ -141,39 +141,13 @@ int expand_string( wchar_t *in, array_list_t *out, int flag );
|
||||
\param flag Specifies if any expansion pass should be skipped. Legal values are any combination of EXPAND_SKIP_SUBSHELL EXPAND_SKIP_VARIABLES and EXPAND_SKIP_WILDCARDS
|
||||
\return The expanded parameter, or 0 on failiure
|
||||
*/
|
||||
wchar_t *expand_one( wchar_t *in, int flag );
|
||||
|
||||
/**
|
||||
Expand backslashed escapes and substitute them with their unescaped
|
||||
counterparts. Also optionally change the wildcards, the tilde
|
||||
character and a few more into constants which are defined in a
|
||||
private use area of Unicode. This assumes wchar_t is a unicode
|
||||
character. character set.
|
||||
|
||||
The result must be free()d. The original string is not modified. If
|
||||
an invalid sequence is specified, 0 is returned.
|
||||
|
||||
*/
|
||||
wchar_t *expand_unescape( const wchar_t * in, int escape_special );
|
||||
|
||||
/**
|
||||
Replace special characters with escape sequences. Newline is
|
||||
replaced with \n, etc.
|
||||
|
||||
The result must be free()d. The original string is not modified.
|
||||
|
||||
\param in The string to be escaped
|
||||
\param escape_all Whether all characters wich hold special meaning in fish (Pipe, semicolon, etc,) should be escaped, or only unprintable characters
|
||||
\return The escaped string
|
||||
*/
|
||||
wchar_t *expand_escape( const wchar_t *in, int escape_all );
|
||||
wchar_t *expand_one( void *context, wchar_t *in, int flag );
|
||||
|
||||
/**
|
||||
Convert the variable value to a human readable form, i.e. escape things, handle arrays, etc. Suitable for pretty-printing.
|
||||
*/
|
||||
wchar_t *expand_escape_variable( const wchar_t *in );
|
||||
|
||||
|
||||
/**
|
||||
Perform tilde expansion and nothing else on the specified string.
|
||||
|
||||
@@ -182,20 +156,6 @@ wchar_t *expand_escape_variable( const wchar_t *in );
|
||||
*/
|
||||
wchar_t *expand_tilde(wchar_t *in);
|
||||
|
||||
/**
|
||||
Locate the first subshell in the specified string.
|
||||
|
||||
\param in the string to search for subshells
|
||||
\param begin the starting paranthesis of the subshell
|
||||
\param end the ending paranthesis of the subshell
|
||||
\param flags set this variable to ACCEPT_INCOMPLETE if in tab_completion mode
|
||||
\return -1 on syntax error, 0 if no subshells exist and 1 on sucess
|
||||
*/
|
||||
int expand_locate_subshell( wchar_t *in,
|
||||
wchar_t **begin,
|
||||
wchar_t **end,
|
||||
int flags );
|
||||
|
||||
|
||||
/**
|
||||
Tokenize the specified string into the specified array_list_t.
|
||||
|
||||
893
fallback.c
Normal file
893
fallback.c
Normal file
@@ -0,0 +1,893 @@
|
||||
/**
|
||||
This file only contains fallback implementations of functions which
|
||||
have been found to be missing or broken by the configuration
|
||||
scripts.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <wchar.h>
|
||||
#include <wctype.h>
|
||||
#include <string.h>
|
||||
#include <dirent.h>
|
||||
#include <stdarg.h>
|
||||
#include <limits.h>
|
||||
|
||||
#if HAVE_NCURSES_H
|
||||
#include <ncurses.h>
|
||||
#else
|
||||
#include <curses.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_TERMIO_H
|
||||
#include <termio.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_TERM_H
|
||||
#include <term.h>
|
||||
#elif HAVE_NCURSES_TERM_H
|
||||
#include <ncurses/term.h>
|
||||
#endif
|
||||
|
||||
#include "common.h"
|
||||
#include "util.h"
|
||||
|
||||
|
||||
#ifdef TPUTS_KLUDGE
|
||||
|
||||
int tputs(const char *str, int affcnt, int (*putc)(tputs_arg_t))
|
||||
{
|
||||
while( *str )
|
||||
{
|
||||
putc( *str++ );
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef HAVE_FWPRINTF
|
||||
#define INTERNAL_FWPRINTF 1
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BROKEN_FWPRINTF
|
||||
#define INTERNAL_FWPRINTF 1
|
||||
#endif
|
||||
|
||||
#ifdef INTERNAL_FWPRINTF
|
||||
|
||||
void pad( void (*writer)(wchar_t), int count)
|
||||
{
|
||||
|
||||
int i;
|
||||
if( count < 0 )
|
||||
return;
|
||||
|
||||
for( i=0; i<count; i++ )
|
||||
{
|
||||
writer( L' ' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Generic formatting function. All other string formatting functions
|
||||
are secretly a wrapper around this function. vgprintf does not
|
||||
implement all the filters supported by printf, only those that are
|
||||
currently used by fish. vgprintf internally uses snprintf to
|
||||
implement the number outputs, such as %f and %x.
|
||||
|
||||
Currently supported functionality:
|
||||
|
||||
- precision specification, both through .* and .N
|
||||
- Padding through * and N
|
||||
- Right padding using the - prefix
|
||||
- long versions of all filters thorugh l and ll prefix
|
||||
- Character output using %c
|
||||
- String output through %s
|
||||
- Floating point number output through %f
|
||||
- Integer output through %d, %i, %u, %o, %x and %X
|
||||
|
||||
For a full description on the usage of *printf, see use 'man 3 printf'.
|
||||
*/
|
||||
static int vgwprintf( void (*writer)(wchar_t),
|
||||
const wchar_t *filter,
|
||||
va_list va )
|
||||
{
|
||||
const wchar_t *filter_org=filter;
|
||||
int count=0;
|
||||
|
||||
for( ;*filter; filter++)
|
||||
{
|
||||
if(*filter == L'%')
|
||||
{
|
||||
int is_long=0;
|
||||
int width = -1;
|
||||
filter++;
|
||||
int loop=1;
|
||||
int precision=-1;
|
||||
int pad_left = 1;
|
||||
|
||||
if( iswdigit( *filter ) )
|
||||
{
|
||||
width=0;
|
||||
while( (*filter >= L'0') && (*filter <= L'9'))
|
||||
{
|
||||
width=10*width+(*filter++ - L'0');
|
||||
}
|
||||
}
|
||||
|
||||
while( loop )
|
||||
{
|
||||
|
||||
switch(*filter)
|
||||
{
|
||||
case L'l':
|
||||
/* Long variable */
|
||||
is_long++;
|
||||
filter++;
|
||||
break;
|
||||
|
||||
case L'*':
|
||||
/* Set minimum field width */
|
||||
width = va_arg( va, int );
|
||||
filter++;
|
||||
break;
|
||||
|
||||
case L'-':
|
||||
filter++;
|
||||
pad_left=0;
|
||||
break;
|
||||
|
||||
case L'.':
|
||||
/*
|
||||
Set precision.
|
||||
*/
|
||||
filter++;
|
||||
if( *filter == L'*' )
|
||||
{
|
||||
precision = va_arg( va, int );
|
||||
}
|
||||
else
|
||||
{
|
||||
precision=0;
|
||||
while( (*filter >= L'0') && (*filter <= L'9'))
|
||||
{
|
||||
precision=10*precision+(*filter++ - L'0');
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
loop=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch( *filter )
|
||||
{
|
||||
case L'c':
|
||||
{
|
||||
wchar_t c;
|
||||
|
||||
if( (width >= 0) && pad_left )
|
||||
{
|
||||
pad( writer, width-1 );
|
||||
count += maxi( width-1, 0 );
|
||||
}
|
||||
|
||||
c = is_long?va_arg(va, wint_t):btowc(va_arg(va, int));
|
||||
if( precision != 0 )
|
||||
writer( c );
|
||||
|
||||
|
||||
if( (width >= 0) && !pad_left )
|
||||
{
|
||||
pad( writer, width-1 );
|
||||
count += maxi( width-1, 0 );
|
||||
}
|
||||
|
||||
count++;
|
||||
|
||||
break;
|
||||
}
|
||||
case L's':
|
||||
{
|
||||
|
||||
wchar_t *ss=0;
|
||||
if( is_long )
|
||||
{
|
||||
ss = va_arg(va, wchar_t *);
|
||||
}
|
||||
else
|
||||
{
|
||||
char *ns = va_arg(va, char*);
|
||||
|
||||
if( ns )
|
||||
{
|
||||
ss = str2wcs( ns );
|
||||
}
|
||||
}
|
||||
|
||||
if( !ss )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if( (width >= 0) && pad_left )
|
||||
{
|
||||
pad( writer, width-wcslen(ss) );
|
||||
count += maxi(width-wcslen(ss), 0);
|
||||
}
|
||||
|
||||
wchar_t *s=ss;
|
||||
int precount = count;
|
||||
|
||||
while( *s )
|
||||
{
|
||||
if( (precision > 0) && (precision <= (count-precount) ) )
|
||||
break;
|
||||
|
||||
writer( *(s++) );
|
||||
count++;
|
||||
}
|
||||
|
||||
if( (width >= 0) && !pad_left )
|
||||
{
|
||||
pad( writer, width-wcslen(ss) );
|
||||
count += maxi( width-wcslen(ss), 0 );
|
||||
}
|
||||
|
||||
if( !is_long )
|
||||
free( ss );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case L'd':
|
||||
case L'i':
|
||||
case L'o':
|
||||
case L'u':
|
||||
case L'x':
|
||||
case L'X':
|
||||
{
|
||||
char str[33];
|
||||
char *pos;
|
||||
char format[16];
|
||||
int len;
|
||||
|
||||
format[0]=0;
|
||||
strcat( format, "%");
|
||||
if( precision >= 0 )
|
||||
strcat( format, ".*" );
|
||||
switch( is_long )
|
||||
{
|
||||
case 2:
|
||||
strcat( format, "ll" );
|
||||
break;
|
||||
case 1:
|
||||
strcat( format, "l" );
|
||||
break;
|
||||
}
|
||||
|
||||
len = strlen(format);
|
||||
format[len++]=(char)*filter;
|
||||
format[len]=0;
|
||||
|
||||
switch( *filter )
|
||||
{
|
||||
case L'd':
|
||||
case L'i':
|
||||
{
|
||||
|
||||
switch( is_long )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
int d = va_arg( va, int );
|
||||
if( precision >= 0 )
|
||||
snprintf( str, 32, format, precision, d );
|
||||
else
|
||||
snprintf( str, 32, format, d );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 1:
|
||||
{
|
||||
long d = va_arg( va, long );
|
||||
if( precision >= 0 )
|
||||
snprintf( str, 32, format, precision, d );
|
||||
else
|
||||
snprintf( str, 32, format, d );
|
||||
break;
|
||||
}
|
||||
|
||||
case 2:
|
||||
{
|
||||
long long d = va_arg( va, long long );
|
||||
if( precision >= 0 )
|
||||
snprintf( str, 32, format, precision, d );
|
||||
else
|
||||
snprintf( str, 32, format, d );
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
debug( 0, L"Invalid length modifier in string %ls\n", filter_org );
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
case L'u':
|
||||
case L'o':
|
||||
case L'x':
|
||||
case L'X':
|
||||
{
|
||||
|
||||
switch( is_long )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
unsigned d = va_arg( va, unsigned );
|
||||
if( precision >= 0 )
|
||||
snprintf( str, 32, format, precision, d );
|
||||
else
|
||||
snprintf( str, 32, format, d );
|
||||
break;
|
||||
}
|
||||
|
||||
case 1:
|
||||
{
|
||||
unsigned long d = va_arg( va, unsigned long );
|
||||
if( precision >= 0 )
|
||||
snprintf( str, 32, format, precision, d );
|
||||
else
|
||||
snprintf( str, 32, format, d );
|
||||
break;
|
||||
}
|
||||
|
||||
case 2:
|
||||
{
|
||||
unsigned long long d = va_arg( va, unsigned long long );
|
||||
if( precision >= 0 )
|
||||
snprintf( str, 32, format, precision, d );
|
||||
else
|
||||
snprintf( str, 32, format, d );
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
debug( 0, L"Invalid length modifier in string %ls\n", filter_org );
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
default:
|
||||
debug( 0, L"Invalid filter %ls in string %ls\n", *filter, filter_org );
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
||||
if( (width >= 0) && pad_left )
|
||||
{
|
||||
int l = maxi(width-strlen(str), 0 );
|
||||
pad( writer, l );
|
||||
count += l;
|
||||
}
|
||||
|
||||
pos = str;
|
||||
|
||||
while( *pos )
|
||||
{
|
||||
writer( *(pos++) );
|
||||
count++;
|
||||
}
|
||||
|
||||
if( (width >= 0) && !pad_left )
|
||||
{
|
||||
int l = maxi(width-strlen(str), 0 );
|
||||
pad( writer, l );
|
||||
count += l;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case L'f':
|
||||
{
|
||||
char str[32];
|
||||
char *pos;
|
||||
double val = va_arg( va, double );
|
||||
|
||||
if( precision>= 0 )
|
||||
{
|
||||
if( width>= 0 )
|
||||
{
|
||||
snprintf( str, 32, "%*.*f", width, precision, val );
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf( str, 32, "%.*f", precision, val );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( width>= 0 )
|
||||
{
|
||||
snprintf( str, 32, "%*f", width, val );
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf( str, 32, "%f", val );
|
||||
}
|
||||
}
|
||||
|
||||
pos = str;
|
||||
|
||||
while( *pos )
|
||||
{
|
||||
writer( *(pos++) );
|
||||
count++;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case L'n':
|
||||
{
|
||||
int *n = va_arg( va, int *);
|
||||
|
||||
*n = count;
|
||||
break;
|
||||
}
|
||||
case L'%':
|
||||
{
|
||||
writer('%');
|
||||
count++;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
debug( 0, L"Unknown switch %lc in string %ls\n", *filter, filter_org );
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
writer( *filter );
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
Holds data for swprintf writer
|
||||
*/
|
||||
static struct
|
||||
{
|
||||
int count;
|
||||
int max;
|
||||
wchar_t *pos;
|
||||
}
|
||||
sw_data;
|
||||
|
||||
/**
|
||||
Writers for string output
|
||||
*/
|
||||
static void sw_writer( wchar_t c )
|
||||
{
|
||||
if( sw_data.count < sw_data.max )
|
||||
*(sw_data.pos++)=c;
|
||||
sw_data.count++;
|
||||
}
|
||||
|
||||
int vswprintf( wchar_t *out, size_t n, const wchar_t *filter, va_list va )
|
||||
{
|
||||
int written;
|
||||
|
||||
sw_data.pos=out;
|
||||
sw_data.max=n;
|
||||
sw_data.count=0;
|
||||
written=vgwprintf( &sw_writer,
|
||||
filter,
|
||||
va );
|
||||
if( written < n )
|
||||
{
|
||||
*sw_data.pos = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
written=-1;
|
||||
}
|
||||
|
||||
return written;
|
||||
}
|
||||
|
||||
int swprintf( wchar_t *out, size_t n, const wchar_t *filter, ... )
|
||||
{
|
||||
va_list va;
|
||||
int written;
|
||||
|
||||
va_start( va, filter );
|
||||
written = vswprintf( out, n, filter, va );
|
||||
va_end( va );
|
||||
return written;
|
||||
}
|
||||
|
||||
/**
|
||||
Holds auxiliary data for fwprintf and wprintf writer
|
||||
*/
|
||||
static FILE *fw_data;
|
||||
|
||||
static void fw_writer( wchar_t c )
|
||||
{
|
||||
putwc( c, fw_data );
|
||||
}
|
||||
|
||||
/*
|
||||
Writers for file output
|
||||
*/
|
||||
int vfwprintf( FILE *f, const wchar_t *filter, va_list va )
|
||||
{
|
||||
fw_data = f;
|
||||
return vgwprintf( &fw_writer, filter, va );
|
||||
}
|
||||
|
||||
int fwprintf( FILE *f, const wchar_t *filter, ... )
|
||||
{
|
||||
va_list va;
|
||||
int written;
|
||||
|
||||
va_start( va, filter );
|
||||
written = vfwprintf( f, filter, va );
|
||||
va_end( va );
|
||||
return written;
|
||||
}
|
||||
|
||||
int vwprintf( const wchar_t *filter, va_list va )
|
||||
{
|
||||
return vfwprintf( stdout, filter, va );
|
||||
}
|
||||
|
||||
int wprintf( const wchar_t *filter, ... )
|
||||
{
|
||||
va_list va;
|
||||
int written;
|
||||
|
||||
va_start( va, filter );
|
||||
written=vwprintf( filter, va );
|
||||
va_end( va );
|
||||
return written;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_FGETWC
|
||||
|
||||
wint_t fgetwc(FILE *stream)
|
||||
{
|
||||
wchar_t res=0;
|
||||
mbstate_t state;
|
||||
memset (&state, '\0', sizeof (state));
|
||||
|
||||
while(1)
|
||||
{
|
||||
int b = fgetc( stream );
|
||||
char bb;
|
||||
|
||||
int sz;
|
||||
|
||||
if( b == EOF )
|
||||
return WEOF;
|
||||
|
||||
bb=b;
|
||||
|
||||
sz = mbrtowc( &res, &bb, 1, &state );
|
||||
|
||||
switch( sz )
|
||||
{
|
||||
case -1:
|
||||
memset (&state, '\0', sizeof (state));
|
||||
return WEOF;
|
||||
|
||||
case -2:
|
||||
break;
|
||||
case 0:
|
||||
return 0;
|
||||
default:
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
wint_t getwc(FILE *stream)
|
||||
{
|
||||
return fgetwc( stream );
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_FPUTWC
|
||||
|
||||
wint_t fputwc(wchar_t wc, FILE *stream)
|
||||
{
|
||||
int res;
|
||||
char s[MB_CUR_MAX+1];
|
||||
memset( s, 0, MB_CUR_MAX+1 );
|
||||
wctomb( s, wc );
|
||||
res = fputs( s, stream );
|
||||
return res==EOF?WEOF:wc;
|
||||
}
|
||||
|
||||
wint_t putwc(wchar_t wc, FILE *stream)
|
||||
{
|
||||
return fputwc( wc, stream );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_WCSTOK
|
||||
|
||||
/*
|
||||
Used by fallback wcstok. Borrowed from glibc
|
||||
*/
|
||||
static size_t fish_wcsspn (const wchar_t *wcs,
|
||||
const wchar_t *accept )
|
||||
{
|
||||
register const wchar_t *p;
|
||||
register const wchar_t *a;
|
||||
register size_t count = 0;
|
||||
|
||||
for (p = wcs; *p != L'\0'; ++p)
|
||||
{
|
||||
for (a = accept; *a != L'\0'; ++a)
|
||||
if (*p == *a)
|
||||
break;
|
||||
|
||||
if (*a == L'\0')
|
||||
return count;
|
||||
else
|
||||
++count;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/*
|
||||
Used by fallback wcstok. Borrowed from glibc
|
||||
*/
|
||||
static wchar_t *fish_wcspbrk (const wchar_t *wcs, const wchar_t *accept)
|
||||
{
|
||||
while (*wcs != L'\0')
|
||||
if (wcschr (accept, *wcs) == NULL)
|
||||
++wcs;
|
||||
else
|
||||
return (wchar_t *) wcs;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
Fallback wcstok implementation. Borrowed from glibc.
|
||||
*/
|
||||
wchar_t *wcstok(wchar_t *wcs, const wchar_t *delim, wchar_t **save_ptr)
|
||||
{
|
||||
wchar_t *result;
|
||||
|
||||
if (wcs == NULL)
|
||||
{
|
||||
if (*save_ptr == NULL)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
wcs = *save_ptr;
|
||||
}
|
||||
|
||||
/* Scan leading delimiters. */
|
||||
wcs += fish_wcsspn (wcs, delim);
|
||||
|
||||
if (*wcs == L'\0')
|
||||
{
|
||||
*save_ptr = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Find the end of the token. */
|
||||
result = wcs;
|
||||
|
||||
wcs = fish_wcspbrk (result, delim);
|
||||
|
||||
if (wcs == NULL)
|
||||
{
|
||||
/* This token finishes the string. */
|
||||
*save_ptr = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Terminate the token and make *SAVE_PTR point past it. */
|
||||
*wcs = L'\0';
|
||||
*save_ptr = wcs + 1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_WCSDUP
|
||||
wchar_t *wcsdup( const wchar_t *in )
|
||||
{
|
||||
size_t len=wcslen(in);
|
||||
wchar_t *out = malloc( sizeof( wchar_t)*(len+1));
|
||||
if( out == 0 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
memcpy( out, in, sizeof( wchar_t)*(len+1));
|
||||
return out;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_WCSLEN
|
||||
size_t wcslen(const wchar_t *in)
|
||||
{
|
||||
const wchar_t *end=in;
|
||||
while( *end )
|
||||
end++;
|
||||
return end-in;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef HAVE_WCSCASECMP
|
||||
int wcscasecmp( const wchar_t *a, const wchar_t *b )
|
||||
{
|
||||
if( *a == 0 )
|
||||
{
|
||||
return (*b==0)?0:-1;
|
||||
}
|
||||
else if( *b == 0 )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
int diff = towlower(*a)-towlower(*b);
|
||||
if( diff != 0 )
|
||||
return diff;
|
||||
else
|
||||
return wcscasecmp( a+1,b+1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef HAVE_WCSNCASECMP
|
||||
int wcsncasecmp( const wchar_t *a, const wchar_t *b, int count )
|
||||
{
|
||||
if( count == 0 )
|
||||
return 0;
|
||||
|
||||
if( *a == 0 )
|
||||
{
|
||||
return (*b==0)?0:-1;
|
||||
}
|
||||
else if( *b == 0 )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
int diff = towlower(*a)-towlower(*b);
|
||||
if( diff != 0 )
|
||||
return diff;
|
||||
else
|
||||
return wcsncasecmp( a+1,b+1, count-1);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_WCWIDTH
|
||||
int wcwidth( wchar_t c )
|
||||
{
|
||||
if( c < 32 )
|
||||
return 0;
|
||||
if ( c == 127 )
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_WCSNDUP
|
||||
wchar_t *wcsndup( const wchar_t *in, int c )
|
||||
{
|
||||
wchar_t *res = malloc( sizeof(wchar_t)*(c+1) );
|
||||
if( res == 0 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
wcsncpy( res, in, c+1 );
|
||||
res[c] = L'\0';
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
|
||||
long convert_digit( wchar_t d, int base )
|
||||
{
|
||||
long res=-1;
|
||||
if( (d <= L'9') && (d >= L'0') )
|
||||
{
|
||||
res = d - L'0';
|
||||
}
|
||||
else if( (d <= L'z') && (d >= L'a') )
|
||||
{
|
||||
res = d + 10 - L'a';
|
||||
}
|
||||
else if( (d <= L'Z') && (d >= L'A') )
|
||||
{
|
||||
res = d + 10 - L'A';
|
||||
}
|
||||
if( res >= base )
|
||||
{
|
||||
res = -1;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
#ifndef HAVE_WCSTOL
|
||||
long wcstol(const wchar_t *nptr,
|
||||
wchar_t **endptr,
|
||||
int base)
|
||||
{
|
||||
long long res=0;
|
||||
int is_set=0;
|
||||
if( base > 36 )
|
||||
{
|
||||
errno = EINVAL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
long nxt = convert_digit( *nptr, base );
|
||||
if( endptr != 0 )
|
||||
*endptr = (wchar_t *)nptr;
|
||||
if( nxt < 0 )
|
||||
{
|
||||
if( !is_set )
|
||||
{
|
||||
errno = EINVAL;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
res = (res*base)+nxt;
|
||||
is_set = 1;
|
||||
if( res > LONG_MAX )
|
||||
{
|
||||
errno = ERANGE;
|
||||
return LONG_MAX;
|
||||
}
|
||||
if( res < LONG_MIN )
|
||||
{
|
||||
errno = ERANGE;
|
||||
return LONG_MIN;
|
||||
}
|
||||
nptr++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
182
fallback.h
Normal file
182
fallback.h
Normal file
@@ -0,0 +1,182 @@
|
||||
|
||||
#ifndef FISH_FALLBACK_H
|
||||
#define FISH_FALLBACK_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef TPUTS_KLUDGE
|
||||
|
||||
|
||||
/**
|
||||
Linux on PPC seems to have a tputs implementation that sometimes
|
||||
behaves strangely. This fallback seems to fix things.
|
||||
*/
|
||||
int tputs(const char *str, int affcnt, int (*putc)(tputs_arg_t));
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
Here follows the prototypes for fallback implementations of various
|
||||
standarcs libc functions relating to wide character support. Some of
|
||||
these prototypes are always defined, since some libc versions
|
||||
include the code, but you have to use special magical #defines for
|
||||
the prototype to appear.
|
||||
*/
|
||||
|
||||
/**
|
||||
Print formated string. Some operating systems (Like NetBSD) do not
|
||||
have wide string formating functions. Therefore we implement our
|
||||
own. Not at all complete. Supports wide and narrow characters,
|
||||
strings and decimal numbers, position (%n), field width and
|
||||
precision.
|
||||
*/
|
||||
int fwprintf( FILE *f, const wchar_t *format, ... );
|
||||
|
||||
|
||||
/**
|
||||
Print formated string. Some operating systems (Like NetBSD) do not
|
||||
have wide string formating functions. Therefore we define our
|
||||
own. Not at all complete. Supports wide and narrow characters,
|
||||
strings and decimal numbers, position (%n), field width and
|
||||
precision.
|
||||
*/
|
||||
int swprintf( wchar_t *str, size_t l, const wchar_t *format, ... );
|
||||
|
||||
/**
|
||||
Print formated string. Some operating systems (Like NetBSD) do not
|
||||
have wide string formating functions. Therefore we define our
|
||||
own. Not at all complete. Supports wide and narrow characters,
|
||||
strings and decimal numbers, position (%n), field width and
|
||||
precision.
|
||||
*/
|
||||
int wprintf( const wchar_t *format, ... );
|
||||
|
||||
/**
|
||||
Print formated string. Some operating systems (Like NetBSD) do not
|
||||
have wide string formating functions. Therefore we define our
|
||||
own. Not at all complete. Supports wide and narrow characters,
|
||||
strings and decimal numbers, position (%n), field width and
|
||||
precision.
|
||||
*/
|
||||
int vwprintf( const wchar_t *filter, va_list va );
|
||||
|
||||
/**
|
||||
Print formated string. Some operating systems (Like NetBSD) do not
|
||||
have wide string formating functions. Therefore we define our
|
||||
own. Not at all complete. Supports wide and narrow characters,
|
||||
strings and decimal numbers, position (%n), field width and
|
||||
precision.
|
||||
*/
|
||||
int vfwprintf( FILE *f, const wchar_t *filter, va_list va );
|
||||
|
||||
/**
|
||||
Print formated string. Some operating systems (Like NetBSD) do not
|
||||
have wide string formating functions. Therefore we define our
|
||||
own. Not at all complete. Supports wide and narrow characters,
|
||||
strings and decimal numbers, position (%n), field width and
|
||||
precision.
|
||||
*/
|
||||
int vswprintf( wchar_t *out, size_t n, const wchar_t *filter, va_list va );
|
||||
|
||||
/**
|
||||
Fallback implementation of fgetwc
|
||||
*/
|
||||
wint_t fgetwc(FILE *stream);
|
||||
|
||||
/**
|
||||
Fallback implementation of getwc
|
||||
*/
|
||||
wint_t getwc(FILE *stream);
|
||||
|
||||
/**
|
||||
Fallback implementation of fputwc
|
||||
*/
|
||||
wint_t fputwc(wchar_t wc, FILE *stream);
|
||||
/**
|
||||
Fallback implementation of putwc
|
||||
*/
|
||||
wint_t putwc(wchar_t wc, FILE *stream);
|
||||
|
||||
/**
|
||||
Fallback implementation of wcstok. Uses code borrowed from glibc.
|
||||
*/
|
||||
wchar_t *wcstok(wchar_t *wcs, const wchar_t *delim, wchar_t **ptr);
|
||||
|
||||
|
||||
/**
|
||||
Return the number of columns used by a character. This is a libc
|
||||
function, but the prototype for this function is missing in some libc
|
||||
implementations.
|
||||
|
||||
Fish has a fallback implementation in case the implementation is
|
||||
missing altogether. In locales without a native wcwidth, Unicode
|
||||
is probably so broken that it isn't worth trying to implement a
|
||||
real wcwidth. Therefore, the fallback wcwidth assumes any printing
|
||||
character takes up one column and anything else uses 0 columns.
|
||||
*/
|
||||
int wcwidth( wchar_t c );
|
||||
|
||||
/**
|
||||
Create a duplicate string. Wide string version of strdup. Will
|
||||
automatically exit if out of memory.
|
||||
*/
|
||||
wchar_t *wcsdup(const wchar_t *in);
|
||||
|
||||
size_t wcslen(const wchar_t *in);
|
||||
|
||||
/**
|
||||
Case insensitive string compare function. Wide string version of
|
||||
strcasecmp.
|
||||
|
||||
This implementation of wcscasecmp does not take into account
|
||||
esoteric locales where uppercase and lowercase do not cleanly
|
||||
transform between each other. Hopefully this should be fine since
|
||||
fish only uses this function with one of the strings supplied by
|
||||
fish and guaranteed to be a sane, english word. Using wcscasecmp on
|
||||
a user-supplied string should be considered a bug.
|
||||
*/
|
||||
int wcscasecmp( const wchar_t *a, const wchar_t *b );
|
||||
|
||||
/**
|
||||
Case insensitive string compare function. Wide string version of
|
||||
strncasecmp.
|
||||
|
||||
This implementation of wcsncasecmp does not take into account
|
||||
esoteric locales where uppercase and lowercase do not cleanly
|
||||
transform between each other. Hopefully this should be fine since
|
||||
fish only uses this function with one of the strings supplied by
|
||||
fish and guaranteed to be a sane, english word. Using wcsncasecmp on
|
||||
a user-supplied string should be considered a bug.
|
||||
*/
|
||||
int wcsncasecmp( const wchar_t *a, const wchar_t *b, int count );
|
||||
|
||||
/**
|
||||
Returns a newly allocated wide character string wich is a copy of
|
||||
the string in, but of length c or shorter. The returned string is
|
||||
always null terminated, and the null is not included in the string
|
||||
length.
|
||||
*/
|
||||
wchar_t *wcsndup( const wchar_t *in, int c );
|
||||
|
||||
/**
|
||||
Converts from wide char to digit in the specified base. If d is not
|
||||
a valid digit in the specified base, return -1.
|
||||
*/
|
||||
long convert_digit( wchar_t d, int base );
|
||||
|
||||
/**
|
||||
Fallback implementation. Convert a wide character string to a
|
||||
number in the specified base. This functions is the wide character
|
||||
string equivalent of strtol. For bases of 10 or lower, 0..9 are
|
||||
used to represent numbers. For bases below 36, a-z and A-Z are used
|
||||
to represent numbers higher than 9. Higher bases than 36 are not
|
||||
supported.
|
||||
*/
|
||||
long wcstol(const wchar_t *nptr,
|
||||
wchar_t **endptr,
|
||||
int base);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
44
fish.spec.in
44
fish.spec.in
@@ -13,40 +13,65 @@ Source0: http://roo.no-ip.org/%{name}/files/%{version}/%{name}-%{
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildRequires: doxygen ncurses-devel xorg-x11-devel
|
||||
|
||||
|
||||
|
||||
|
||||
%description
|
||||
fish is a shell geared towards interactive use. It's features are
|
||||
focused on user friendlieness and discoverability. The language syntax
|
||||
is simple but incompatible with other shell languages.
|
||||
|
||||
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
|
||||
|
||||
|
||||
%build
|
||||
%configure docdir=%_datadir/doc/%{name}-%{version}
|
||||
make %{?_smp_mflags}
|
||||
|
||||
|
||||
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
make install DESTDIR="$RPM_BUILD_ROOT"
|
||||
|
||||
|
||||
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
|
||||
|
||||
|
||||
%post
|
||||
if ! grep %_bindir/fish %_sysconfdir/shells >/dev/null; then
|
||||
echo %_bindir/fish >>%_sysconfdir/shells
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
%postun
|
||||
if [ "$1" = 0 ]; then
|
||||
grep -v %_bindir/fish %_sysconfdir/shells >%_sysconfdir/fish.tmp
|
||||
mv %_sysconfdir/fish.tmp %_sysconfdir/shells
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
|
||||
%doc %_datadir/doc/%{name}-%{version}
|
||||
|
||||
%_mandir/man1/fish.1*
|
||||
%_mandir/man1/xsel.1x*
|
||||
%_mandir/man1/mimedb.1*
|
||||
@@ -54,6 +79,7 @@ fi
|
||||
%_mandir/man1/count.1*
|
||||
%_mandir/man1/fishd.1*
|
||||
%_mandir/man1/fish_pager.1*
|
||||
|
||||
%attr(0755,root,root) %_bindir/fish
|
||||
%attr(0755,root,root) %_bindir/fishd
|
||||
%attr(0755,root,root) %_bindir/fish_pager
|
||||
@@ -61,14 +87,26 @@ fi
|
||||
%attr(0755,root,root) %_bindir/set_color
|
||||
%attr(0755,root,root) %_bindir/mimedb
|
||||
%attr(0755,root,root) %_bindir/count
|
||||
|
||||
%config %_sysconfdir/fish
|
||||
%config %_sysconfdir/fish_inputrc
|
||||
%dir %_sysconfdir/fish.d
|
||||
%config %_sysconfdir/fish.d/fish_*.fish
|
||||
%dir %_sysconfdir/fish.d/completions
|
||||
%config %_sysconfdir/fish.d/completions/*.fish
|
||||
|
||||
%dir %_datadir/fish
|
||||
%_datadir/fish/fish
|
||||
|
||||
%dir %_datadir/fish/completions
|
||||
%_datadir/fish/completions/*.fish
|
||||
|
||||
%dir %_datadir/fish/functions
|
||||
%_datadir/fish/functions/*.fish
|
||||
|
||||
%_datadir/locale/*/LC_MESSAGES/fish.mo
|
||||
|
||||
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue Nov 29 2005 Axel Liljencrantz <axel@liljencrantz.se> 1.17.0-0
|
||||
- 1.17.0
|
||||
|
||||
635
fish_pager.c
635
fish_pager.c
@@ -35,13 +35,18 @@
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
|
||||
#include "fallback.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "wutil.h"
|
||||
#include "common.h"
|
||||
#include "complete.h"
|
||||
#include "output.h"
|
||||
#include "input_common.h"
|
||||
#include "env_universal.h"
|
||||
#include "halloc.h"
|
||||
#include "halloc_util.h"
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -74,6 +79,7 @@ static struct termios pager_modes;
|
||||
|
||||
static int is_ca_mode = 0;
|
||||
|
||||
static buffer_t *pager_buffer;
|
||||
|
||||
/**
|
||||
The environment variables used to specify the color of different
|
||||
@@ -91,8 +97,18 @@ static wchar_t *hightlight_var[] =
|
||||
static string_buffer_t out_buff;
|
||||
static FILE *out_file;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
array_list_t *comp;
|
||||
wchar_t *desc;
|
||||
int comp_width;
|
||||
int desc_width;
|
||||
int pref_width;
|
||||
int min_width;
|
||||
}
|
||||
comp_t;
|
||||
|
||||
int get_color( int highlight )
|
||||
static int get_color( int highlight )
|
||||
{
|
||||
if( highlight < 0 )
|
||||
return FISH_COLOR_NORMAL;
|
||||
@@ -101,9 +117,6 @@ int get_color( int highlight )
|
||||
|
||||
wchar_t *val = env_universal_get( hightlight_var[highlight]);
|
||||
|
||||
if( val == 0 )
|
||||
return FISH_COLOR_NORMAL;
|
||||
|
||||
if( val == 0 )
|
||||
{
|
||||
return FISH_COLOR_NORMAL;
|
||||
@@ -112,7 +125,20 @@ int get_color( int highlight )
|
||||
return output_color_code( val );
|
||||
}
|
||||
|
||||
int try_sequence( char *seq )
|
||||
static void recalc_width( array_list_t *l, const wchar_t *prefix )
|
||||
{
|
||||
int i;
|
||||
for( i=0; i<al_get_count( l ); i++ )
|
||||
{
|
||||
comp_t *c = (comp_t *)al_get( l, i );
|
||||
|
||||
c->min_width = mini( c->desc_width, maxi(0,termsize.ws_col/3 - 2)) +
|
||||
mini( c->desc_width, maxi(0,termsize.ws_col/5 - 4)) +4;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static int try_sequence( char *seq )
|
||||
{
|
||||
int j, k;
|
||||
wint_t c=0;
|
||||
@@ -195,6 +221,110 @@ static wint_t readch()
|
||||
}
|
||||
|
||||
|
||||
static int pager_buffered_writer( char c)
|
||||
{
|
||||
b_append( pager_buffer, &c, 1 );
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void pager_flush()
|
||||
{
|
||||
write( 1, pager_buffer->buff, pager_buffer->used );
|
||||
pager_buffer->used = 0;
|
||||
}
|
||||
|
||||
|
||||
static int print_max( const wchar_t *str, int max, int has_more )
|
||||
{
|
||||
int i;
|
||||
int written = 0;
|
||||
for( i=0; str[i]; i++ )
|
||||
{
|
||||
if( written + wcwidth(str[i]) > max )
|
||||
break;
|
||||
if( ( written + wcwidth(str[i]) == max) && (has_more || str[i+1]) )
|
||||
{
|
||||
writech( ellipsis_char );
|
||||
written += wcwidth(ellipsis_char );
|
||||
break;
|
||||
}
|
||||
|
||||
writech( str[i] );
|
||||
written+= wcwidth( str[i] );
|
||||
}
|
||||
return written;
|
||||
}
|
||||
|
||||
static void completion_print_item( const wchar_t *prefix, comp_t *c, int width )
|
||||
{
|
||||
int comp_width=0, desc_width=0;
|
||||
int i;
|
||||
int written=0;
|
||||
|
||||
if( c->pref_width <= width )
|
||||
{
|
||||
/*
|
||||
The entry fits, we give it as much space as it wants
|
||||
*/
|
||||
comp_width = c->comp_width;
|
||||
desc_width = c->desc_width;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
The completion and description won't fit on the
|
||||
allocated space. Give a maximum of 2/3 of the
|
||||
space to the completion, and whatever is left to
|
||||
the description.
|
||||
*/
|
||||
int desc_all = c->desc_width?c->desc_width+4:0;
|
||||
|
||||
comp_width = maxi( mini( c->comp_width,
|
||||
2*(width-4)/3 ),
|
||||
width - desc_all );
|
||||
if( c->desc_width )
|
||||
desc_width = width-comp_width-4;
|
||||
else
|
||||
c->desc_width=0;
|
||||
|
||||
}
|
||||
|
||||
for( i=0; i<al_get_count( c->comp ); i++ )
|
||||
{
|
||||
const wchar_t *comp = (const wchar_t *)al_get( c->comp, i );
|
||||
if( i != 0 )
|
||||
written += print_max( L" ", comp_width - written, 2 );
|
||||
set_color( get_color(HIGHLIGHT_PAGER_PREFIX),FISH_COLOR_NORMAL );
|
||||
written += print_max( prefix, comp_width - written, comp[0]?1:0 );
|
||||
set_color( get_color(HIGHLIGHT_PAGER_COMPLETION),FISH_COLOR_IGNORE );
|
||||
written += print_max( comp, comp_width - written, i!=(al_get_count(c->comp)-1) );
|
||||
}
|
||||
|
||||
|
||||
if( desc_width )
|
||||
{
|
||||
while( written < (width-desc_width-2))
|
||||
{
|
||||
written++;
|
||||
writech( L' ');
|
||||
}
|
||||
written += print_max( L"(", 1, 0 );
|
||||
set_color( get_color( HIGHLIGHT_PAGER_DESCRIPTION ),
|
||||
FISH_COLOR_IGNORE );
|
||||
written += print_max( c->desc, desc_width, 0 );
|
||||
written += print_max( L")", 1, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
while( written < width )
|
||||
{
|
||||
written++;
|
||||
writech( L' ');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Print the specified part of the completion list, using the
|
||||
specified column offsets and quoting style.
|
||||
@@ -219,277 +349,29 @@ static void completion_print( int cols,
|
||||
|
||||
int rows = (al_get_count( l )-1)/cols+1;
|
||||
int i, j;
|
||||
int prefix_width= my_wcswidth(prefix);
|
||||
|
||||
for( i = row_start; i<row_stop; i++ )
|
||||
{
|
||||
for( j = 0; j < cols; j++ )
|
||||
{
|
||||
wchar_t *el, *el_end;
|
||||
comp_t *el;
|
||||
|
||||
int is_last = (j==(cols-1));
|
||||
|
||||
if( al_get_count( l ) <= j*rows + i )
|
||||
continue;
|
||||
|
||||
el = (wchar_t *)al_get( l, j*rows + i );
|
||||
el_end= wcschr( el, COMPLETE_SEP );
|
||||
|
||||
set_color( get_color(HIGHLIGHT_PAGER_PREFIX),FISH_COLOR_NORMAL );
|
||||
|
||||
writestr( prefix );
|
||||
|
||||
set_color( get_color(HIGHLIGHT_PAGER_COMPLETION),FISH_COLOR_IGNORE );
|
||||
|
||||
if( el_end == 0 )
|
||||
{
|
||||
/* We do not have a description for this completion */
|
||||
int written = 0;
|
||||
int max_written = width[j] - prefix_width - (j==cols-1?0:2);
|
||||
|
||||
if( is_quoted )
|
||||
{
|
||||
for( i=0; i<max_written; i++ )
|
||||
{
|
||||
if( !el[i] )
|
||||
break;
|
||||
writech( el[i] );
|
||||
written+= wcwidth( el[i] );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
written = write_escaped_str( el, max_written );
|
||||
}
|
||||
|
||||
set_color( get_color( HIGHLIGHT_PAGER_DESCRIPTION ),
|
||||
FISH_COLOR_IGNORE );
|
||||
|
||||
writespace( width[j]-
|
||||
written-
|
||||
prefix_width );
|
||||
}
|
||||
else
|
||||
{
|
||||
int whole_desc_width = my_wcswidth(el_end+1);
|
||||
int whole_comp_width;
|
||||
|
||||
/*
|
||||
Temporarily drop the description so that wcswidth et
|
||||
al only calculate the width of the completion.
|
||||
*/
|
||||
*el_end = L'\0';
|
||||
|
||||
/*
|
||||
Calculate preferred completion width
|
||||
*/
|
||||
if( is_quoted )
|
||||
{
|
||||
whole_comp_width = my_wcswidth(el);
|
||||
}
|
||||
else
|
||||
{
|
||||
wchar_t *tmp = escape( el, 1 );
|
||||
whole_comp_width = my_wcswidth( tmp );
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
/*
|
||||
Calculate how wide this entry 'wants' to be
|
||||
*/
|
||||
int pref_width = whole_desc_width + 4 + prefix_width + 2 -
|
||||
(j==cols-1?2:0) + whole_comp_width;
|
||||
|
||||
int comp_width, desc_width;
|
||||
|
||||
if( pref_width <= width[j] )
|
||||
{
|
||||
/*
|
||||
The entry fits, we give it as much space as it wants
|
||||
*/
|
||||
comp_width = whole_comp_width;
|
||||
desc_width = whole_desc_width;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
The completion and description won't fit on the
|
||||
allocated space. Give a maximum of 2/3 of the
|
||||
space to the completion, and whatever is left to
|
||||
the description.
|
||||
*/
|
||||
int sum = width[j] - prefix_width - 4 - 2 + (j==cols-1?2:0);
|
||||
|
||||
comp_width = maxi( mini( whole_comp_width,
|
||||
2*sum/3 ),
|
||||
sum - whole_desc_width );
|
||||
desc_width = sum-comp_width;
|
||||
}
|
||||
|
||||
/* First we must print the completion. */
|
||||
if( is_quoted )
|
||||
{
|
||||
writestr_ellipsis( el, comp_width);
|
||||
}
|
||||
else
|
||||
{
|
||||
write_escaped_str( el, comp_width );
|
||||
}
|
||||
|
||||
/* Put the description back */
|
||||
*el_end = COMPLETE_SEP;
|
||||
|
||||
/* And print it */
|
||||
set_color( get_color(HIGHLIGHT_PAGER_DESCRIPTION),
|
||||
FISH_COLOR_IGNORE );
|
||||
writespace( maxi( 2,
|
||||
width[j]
|
||||
- comp_width
|
||||
- desc_width
|
||||
- 4
|
||||
- prefix_width
|
||||
+ (j==cols-1?2:0) ) );
|
||||
/* Print description */
|
||||
writestr(L"(");
|
||||
writestr_ellipsis( el_end+1, desc_width);
|
||||
writestr(L")");
|
||||
|
||||
if( j != cols-1)
|
||||
writestr( L" " );
|
||||
|
||||
}
|
||||
el = (comp_t *)al_get( l, j*rows + i );
|
||||
|
||||
completion_print_item( prefix, el, width[j] - (is_last?0:2) );
|
||||
|
||||
if( !is_last)
|
||||
writestr( L" " );
|
||||
}
|
||||
writech( L'\n' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Calculates how long the specified string would be when printed on the command line.
|
||||
|
||||
\param str The string to be printed.
|
||||
\param is_quoted Whether the string would be printed quoted or unquoted
|
||||
\param pref_width the preferred width for this item
|
||||
\param min_width the minimum width for this item
|
||||
*/
|
||||
static void printed_length( wchar_t *str,
|
||||
int is_quoted,
|
||||
int *pref_width,
|
||||
int *min_width )
|
||||
{
|
||||
if( is_quoted )
|
||||
{
|
||||
wchar_t *sep = wcschr(str,COMPLETE_SEP);
|
||||
if( sep )
|
||||
{
|
||||
*sep=0;
|
||||
int cw = my_wcswidth( str );
|
||||
int dw = my_wcswidth(sep+1);
|
||||
|
||||
if( termsize.ws_col > 80 )
|
||||
dw = mini( dw, termsize.ws_col/3 );
|
||||
|
||||
|
||||
*pref_width = cw+dw+4;
|
||||
|
||||
if( dw > termsize.ws_col/3 )
|
||||
{
|
||||
dw = termsize.ws_col/3;
|
||||
}
|
||||
|
||||
*min_width=cw+dw+4;
|
||||
|
||||
*sep= COMPLETE_SEP;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
*pref_width=*min_width= my_wcswidth( str );
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
int comp_len=0, desc_len=0;
|
||||
int has_description = 0;
|
||||
while( *str != 0 )
|
||||
{
|
||||
switch( *str )
|
||||
{
|
||||
case L'\n':
|
||||
case L'\b':
|
||||
case L'\r':
|
||||
case L'\e':
|
||||
case L'\t':
|
||||
case L'\\':
|
||||
case L'&':
|
||||
case L'$':
|
||||
case L' ':
|
||||
case L'#':
|
||||
case L'^':
|
||||
case L'<':
|
||||
case L'>':
|
||||
case L'(':
|
||||
case L')':
|
||||
case L'[':
|
||||
case L']':
|
||||
case L'{':
|
||||
case L'}':
|
||||
case L'?':
|
||||
case L'*':
|
||||
case L'|':
|
||||
case L';':
|
||||
case L':':
|
||||
case L'\'':
|
||||
case L'"':
|
||||
case L'%':
|
||||
case L'~':
|
||||
|
||||
if( has_description )
|
||||
desc_len++;
|
||||
else
|
||||
comp_len+=2;
|
||||
break;
|
||||
|
||||
case COMPLETE_SEP:
|
||||
has_description = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
if( has_description )
|
||||
desc_len+= wcwidth(*str);
|
||||
else
|
||||
comp_len+= wcwidth(*str);
|
||||
break;
|
||||
}
|
||||
str++;
|
||||
}
|
||||
if( has_description )
|
||||
{
|
||||
/*
|
||||
Mangle long descriptions to make formating look nicer
|
||||
*/
|
||||
debug( 3, L"Desc, width = %d %d\n", comp_len, desc_len );
|
||||
// if( termsize.ws_col > 80 )
|
||||
// desc_len = mini( desc_len, termsize.ws_col/3 );
|
||||
|
||||
*pref_width = comp_len+ desc_len+4;;
|
||||
|
||||
comp_len = mini( comp_len, maxi(0,termsize.ws_col/3 - 2));
|
||||
desc_len = mini( desc_len, maxi(0,termsize.ws_col/5 - 4));
|
||||
|
||||
*min_width = comp_len+ desc_len+4;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
debug( 3, L"No desc, width = %d\n", comp_len );
|
||||
|
||||
*pref_width=*min_width= comp_len;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Try to print the list of completions l with the prefix prefix using
|
||||
@@ -537,8 +419,6 @@ static int completion_try_print( int cols,
|
||||
|
||||
int pref_tot_width=0;
|
||||
int min_tot_width = 0;
|
||||
int prefix_width = my_wcswidth( prefix );
|
||||
|
||||
int res=0;
|
||||
/*
|
||||
Skip completions on tiny terminals
|
||||
@@ -546,25 +426,24 @@ static int completion_try_print( int cols,
|
||||
|
||||
if( termsize.ws_col < 16 )
|
||||
return 1;
|
||||
|
||||
|
||||
memset( pref_width, 0, sizeof(pref_width) );
|
||||
memset( min_width, 0, sizeof(min_width) );
|
||||
|
||||
/* Calculated how wide the list would be */
|
||||
|
||||
/* Calculate how wide the list would be */
|
||||
for( j = 0; j < cols; j++ )
|
||||
{
|
||||
for( i = 0; i<rows; i++ )
|
||||
{
|
||||
int pref,min;
|
||||
wchar_t *el;
|
||||
comp_t *c;
|
||||
if( al_get_count( l ) <= j*rows + i )
|
||||
continue;
|
||||
|
||||
el = (wchar_t *)al_get( l, j*rows + i );
|
||||
printed_length( el, is_quoted, &pref, &min );
|
||||
|
||||
pref += prefix_width;
|
||||
min += prefix_width;
|
||||
c = (comp_t *)al_get( l, j*rows + i );
|
||||
pref = c->pref_width;
|
||||
min = c->min_width;
|
||||
|
||||
if( j != cols-1 )
|
||||
{
|
||||
pref += 2;
|
||||
@@ -646,6 +525,7 @@ static int completion_try_print( int cols,
|
||||
}
|
||||
|
||||
completion_print( cols, width, 0, rows, prefix, is_quoted, l);
|
||||
pager_flush();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -678,6 +558,7 @@ static int completion_try_print( int cols,
|
||||
percent );
|
||||
writestr(msg);
|
||||
set_color( FISH_COLOR_NORMAL, FISH_COLOR_NORMAL );
|
||||
pager_flush();
|
||||
int c = readch();
|
||||
|
||||
switch( c )
|
||||
@@ -739,7 +620,8 @@ static int completion_try_print( int cols,
|
||||
}
|
||||
else
|
||||
{
|
||||
writembs( flash_screen );
|
||||
if( flash_screen )
|
||||
writembs( flash_screen );
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -763,7 +645,8 @@ static int completion_try_print( int cols,
|
||||
}
|
||||
else
|
||||
{
|
||||
writembs( flash_screen );
|
||||
if( flash_screen )
|
||||
writembs( flash_screen );
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -791,7 +674,9 @@ static int completion_try_print( int cols,
|
||||
}
|
||||
|
||||
/**
|
||||
Substitute any series of tabs, newlines, etc. with a single space character in completion description
|
||||
Substitute any series of whitespace with a single space character
|
||||
inside completion descriptions. Remove all whitespace from
|
||||
beginning/end of completion descriptions.
|
||||
*/
|
||||
static void mangle_descriptions( array_list_t *l )
|
||||
{
|
||||
@@ -800,7 +685,7 @@ static void mangle_descriptions( array_list_t *l )
|
||||
{
|
||||
wchar_t *next = (wchar_t *)al_get(l, i);
|
||||
wchar_t *in, *out;
|
||||
skip=0;
|
||||
skip=1;
|
||||
|
||||
while( *next != COMPLETE_SEP && *next )
|
||||
next++;
|
||||
@@ -829,6 +714,125 @@ static void mangle_descriptions( array_list_t *l )
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Merge multiple completions with the same description to the same line
|
||||
*/
|
||||
static void join_completions( array_list_t *l )
|
||||
{
|
||||
int i, in, out;
|
||||
hash_table_t desc_table;
|
||||
|
||||
hash_init( &desc_table, &hash_wcs_func, &hash_wcs_cmp );
|
||||
|
||||
for( i=0; i<al_get_count(l); i++ )
|
||||
{
|
||||
wchar_t *item = (wchar_t *)al_get( l, i );
|
||||
wchar_t *desc = wcschr( item, COMPLETE_SEP );
|
||||
long prev_idx;
|
||||
|
||||
if( !desc )
|
||||
continue;
|
||||
desc++;
|
||||
prev_idx = ((long)hash_get( &desc_table, desc) )-1;
|
||||
if( prev_idx == -1 )
|
||||
{
|
||||
hash_put( &desc_table, halloc_wcsdup( global_context, desc), (void *)(i+1));
|
||||
}
|
||||
else
|
||||
{
|
||||
string_buffer_t foo;
|
||||
wchar_t *old = (wchar_t *)al_get( l, prev_idx );
|
||||
wchar_t *old_end = wcschr( old, COMPLETE_SEP );
|
||||
|
||||
if( old_end )
|
||||
{
|
||||
*old_end = 0;
|
||||
|
||||
sb_init( &foo );
|
||||
sb_append( &foo, old );
|
||||
sb_append_char( &foo, COMPLETE_ITEM_SEP );
|
||||
sb_append( &foo, item );
|
||||
|
||||
free( (void *)al_get( l, prev_idx ) );
|
||||
al_set( l, prev_idx, foo.buff );
|
||||
|
||||
free( (void *)al_get( l, i ) );
|
||||
al_set( l, i, 0 );
|
||||
}
|
||||
|
||||
// debug( 1, L"WOOT WOOT %ls är släkt med %ls", item, al_get( l, prev_idx ) );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
hash_destroy( &desc_table );
|
||||
|
||||
out=0;
|
||||
for( in=0; in < al_get_count(l); in++ )
|
||||
{
|
||||
const void * d = al_get( l, in );
|
||||
|
||||
if( d )
|
||||
{
|
||||
al_set( l, out++, d );
|
||||
}
|
||||
}
|
||||
al_truncate( l, out );
|
||||
}
|
||||
|
||||
/**
|
||||
Replace completion strings with a comp_t structure
|
||||
*/
|
||||
static void mangle_completions( array_list_t *l, const wchar_t *prefix )
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i=0; i<al_get_count( l ); i++ )
|
||||
{
|
||||
wchar_t *next = (wchar_t *)al_get( l, i );
|
||||
wchar_t *start, *end;
|
||||
comp_t *comp = halloc( global_context, sizeof( comp_t ) );
|
||||
comp->comp = al_halloc( global_context );
|
||||
|
||||
for( start=end=next; 1; end++ )
|
||||
{
|
||||
wchar_t c = *end;
|
||||
|
||||
if( (c == COMPLETE_ITEM_SEP) || (c==COMPLETE_SEP) || !c)
|
||||
{
|
||||
*end = 0;
|
||||
wchar_t * str = escape( start, 1 );
|
||||
comp->comp_width += my_wcswidth( str );
|
||||
halloc_register( global_context, str );
|
||||
al_push( comp->comp, str );
|
||||
start = end+1;
|
||||
}
|
||||
|
||||
if( c == COMPLETE_SEP )
|
||||
{
|
||||
comp->desc = halloc_wcsdup( global_context, start );
|
||||
break;
|
||||
}
|
||||
|
||||
if( !c )
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
comp->comp_width += my_wcswidth(prefix)*al_get_count(comp->comp) + 2*(al_get_count(comp->comp)-1);
|
||||
comp->desc_width = comp->desc?my_wcswidth( comp->desc ):0;
|
||||
|
||||
comp->pref_width = comp->comp_width + comp->desc_width + (comp->desc_width?4:0);
|
||||
|
||||
free( next );
|
||||
al_set( l, i, comp );
|
||||
}
|
||||
|
||||
recalc_width( l, prefix );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Respond to a winch signal by checking the terminal size
|
||||
*/
|
||||
@@ -851,7 +855,11 @@ static void init()
|
||||
struct sigaction act;
|
||||
program_name = L"fish_pager";
|
||||
wsetlocale( LC_ALL, L"" );
|
||||
|
||||
|
||||
/*
|
||||
Make fd 1 output to screen, and use some other fd for writing
|
||||
the resulting output back to the caller
|
||||
*/
|
||||
int out = dup( 1 );
|
||||
close(1);
|
||||
if( open( ttyname(0), O_WRONLY ) != 1 )
|
||||
@@ -863,11 +871,18 @@ static void init()
|
||||
}
|
||||
}
|
||||
out_file = fdopen( out, "w" );
|
||||
|
||||
/**
|
||||
Init the stringbuffer used to keep any output in
|
||||
*/
|
||||
sb_init( &out_buff );
|
||||
|
||||
output_init();
|
||||
halloc_util_init();
|
||||
env_universal_init( 0, 0, 0, 0);
|
||||
input_common_init( &interrupt_handler );
|
||||
output_set_writer( &pager_buffered_writer );
|
||||
pager_buffer = halloc( global_context, sizeof( buffer_t ) );
|
||||
halloc_register_function( global_context, (void (*)(void *))&b_destroy, pager_buffer );
|
||||
|
||||
sigemptyset( & act.sa_mask );
|
||||
act.sa_flags=0;
|
||||
@@ -880,33 +895,6 @@ static void init()
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Loop until we are in the foreground. */
|
||||
while (tcgetpgrp( 0 ) != getpid())
|
||||
{
|
||||
kill (- getpid(), SIGTTIN);
|
||||
}
|
||||
|
||||
/* Put ourselves in our own process group. */
|
||||
if( getpgrp() != getpid() )
|
||||
{
|
||||
if (setpgid (getpid(), getpid()) < 0)
|
||||
{
|
||||
debug( 1,
|
||||
L"Couldn't put the shell in its own process group");
|
||||
wperror( L"setpgid" );
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Grab control of the terminal. */
|
||||
if( tcsetpgrp (STDIN_FILENO, getpid()) )
|
||||
{
|
||||
debug( 1,
|
||||
L"Couldn't grab control of terminal" );
|
||||
wperror( L"tcsetpgrp" );
|
||||
exit(1);
|
||||
}
|
||||
|
||||
handle_winch( 0 ); /* Set handler for window change events */
|
||||
|
||||
tcgetattr(0,&pager_modes); /* get the current terminal modes */
|
||||
@@ -919,6 +907,9 @@ static void init()
|
||||
pager_modes.c_cc[VMIN]=1;
|
||||
pager_modes.c_cc[VTIME]=0;
|
||||
|
||||
/*
|
||||
|
||||
*/
|
||||
if( tcsetattr(0,TCSANOW,&pager_modes)) /* set the new modes */
|
||||
{
|
||||
wperror(L"tcsetattr");
|
||||
@@ -937,45 +928,51 @@ void destroy()
|
||||
{
|
||||
env_universal_destroy();
|
||||
input_common_destroy();
|
||||
output_destroy();
|
||||
halloc_util_destroy();
|
||||
del_curterm( cur_term );
|
||||
sb_destroy( &out_buff );
|
||||
fclose( out_file );
|
||||
|
||||
}
|
||||
|
||||
int main( int argc, char **argv )
|
||||
{
|
||||
int i;
|
||||
int is_quoted=0;
|
||||
array_list_t comp;
|
||||
array_list_t *comp;
|
||||
wchar_t *prefix;
|
||||
|
||||
|
||||
init();
|
||||
|
||||
if( argc < 3 )
|
||||
{
|
||||
debug( 0, L"Insufficient arguments" );
|
||||
}
|
||||
else
|
||||
{
|
||||
comp = al_halloc( global_context );
|
||||
prefix = str2wcs( argv[2] );
|
||||
is_quoted = strcmp( "1", argv[1] )==0;
|
||||
|
||||
is_quoted = 0;
|
||||
|
||||
debug( 3, L"prefix is '%ls'", prefix );
|
||||
|
||||
al_init( &comp );
|
||||
|
||||
|
||||
for( i=3; i<argc; i++ )
|
||||
{
|
||||
al_push( &comp, str2wcs( argv[i] ) );
|
||||
wchar_t *wcs = str2wcs( argv[i] );
|
||||
if( wcs )
|
||||
{
|
||||
al_push( comp, wcs );
|
||||
}
|
||||
}
|
||||
|
||||
mangle_descriptions( comp );
|
||||
if( wcscmp( prefix, L"-" ) == 0 )
|
||||
join_completions( comp );
|
||||
mangle_completions( comp, prefix );
|
||||
|
||||
mangle_descriptions( &comp );
|
||||
|
||||
for( i = 6; i>0; i-- )
|
||||
{
|
||||
switch( completion_try_print( i, prefix, is_quoted, &comp ) )
|
||||
switch( completion_try_print( i, prefix, is_quoted, comp ) )
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
@@ -989,8 +986,6 @@ int main( int argc, char **argv )
|
||||
|
||||
}
|
||||
|
||||
al_foreach( &comp, (void(*)(const void *))&free );
|
||||
al_destroy( &comp );
|
||||
free(prefix );
|
||||
|
||||
fwprintf( out_file, L"%ls", (wchar_t *)out_buff.buff );
|
||||
|
||||
27
fish_tests.c
27
fish_tests.c
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <wchar.h>
|
||||
@@ -26,7 +27,9 @@
|
||||
#include <locale.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include "fallback.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "proc.h"
|
||||
#include "reader.h"
|
||||
@@ -41,6 +44,7 @@
|
||||
#include "output.h"
|
||||
#include "exec.h"
|
||||
#include "event.h"
|
||||
#include "halloc_util.h"
|
||||
|
||||
/**
|
||||
Number of laps to run performance testing loop
|
||||
@@ -327,7 +331,7 @@ static void sb_test()
|
||||
|
||||
sb_init( &b );
|
||||
|
||||
if( res=sb_printf( &b, L"%ls%s", L"Testing ", "string_buffer_t " ) == -1 )
|
||||
if( (res=sb_printf( &b, L"%ls%s", L"Testing ", "string_buffer_t " )) == -1 )
|
||||
{
|
||||
err( L"Error %d while testing stringbuffers", res );
|
||||
}
|
||||
@@ -336,7 +340,22 @@ static void sb_test()
|
||||
{
|
||||
err( L"Error %d while testing stringbuffers", res );
|
||||
}
|
||||
|
||||
say( (wchar_t *)b.buff );
|
||||
|
||||
sb_clear( &b );
|
||||
|
||||
#define NUM_ANS L"-7 99999999 1234567 deadbeef DEADBEEFDEADBEEF"
|
||||
|
||||
sb_printf( &b, L"%d %u %o %x %llX", -7, 99999999, 01234567, 0xdeadbeef, 0xdeadbeefdeadbeefll );
|
||||
if( wcscmp( (wchar_t *)b.buff, NUM_ANS) != 0 )
|
||||
{
|
||||
err( L"numerical formating is broken, '%ls' != '%ls'", (wchar_t *)b.buff, NUM_ANS );
|
||||
}
|
||||
else
|
||||
say( L"numerical formating works" );
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -533,7 +552,7 @@ static int expand_test( const wchar_t *in, int flags, ... )
|
||||
wchar_t *arg;
|
||||
|
||||
al_init( &out );
|
||||
expand_string( wcsdup(in), &out, flags);
|
||||
expand_string( 0, wcsdup(in), &out, flags);
|
||||
|
||||
va_start( va, flags );
|
||||
|
||||
@@ -669,7 +688,7 @@ int main( int argc, char **argv )
|
||||
say( L"Lines beginning with '(ignore):' are not errors, they are warning messages\ngenerated by the fish parser library when given broken input, and can be\nignored. All actual errors begin with 'Error:'." );
|
||||
|
||||
proc_init();
|
||||
output_init();
|
||||
halloc_util_init();
|
||||
event_init();
|
||||
exec_init();
|
||||
parser_init();
|
||||
@@ -701,7 +720,7 @@ int main( int argc, char **argv )
|
||||
wutil_destroy();
|
||||
exec_destroy();
|
||||
event_destroy();
|
||||
output_destroy();
|
||||
proc_destroy();
|
||||
halloc_util_destroy();
|
||||
|
||||
}
|
||||
|
||||
3
fishd.c
3
fishd.c
@@ -41,6 +41,7 @@ time the original barrier request was sent have been received.
|
||||
|
||||
#include "config.h"
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
@@ -61,7 +62,9 @@ time the original barrier request was sent have been received.
|
||||
#include <locale.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "fallback.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "wutil.h"
|
||||
#include "env_universal_common.h"
|
||||
|
||||
154
function.c
154
function.c
@@ -9,15 +9,22 @@
|
||||
#include <signal.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "wutil.h"
|
||||
#include "fallback.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "function.h"
|
||||
#include "proc.h"
|
||||
#include "translate.h"
|
||||
#include "parser.h"
|
||||
#include "common.h"
|
||||
#include "intern.h"
|
||||
#include "event.h"
|
||||
#include "reader.h"
|
||||
#include "parse_util.h"
|
||||
#include "env.h"
|
||||
#include "expand.h"
|
||||
|
||||
|
||||
/**
|
||||
@@ -32,6 +39,7 @@ typedef struct
|
||||
const wchar_t *definition_file;
|
||||
int definition_offset;
|
||||
int is_binding;
|
||||
int is_autoload;
|
||||
}
|
||||
function_data_t;
|
||||
|
||||
@@ -39,6 +47,79 @@ typedef struct
|
||||
Table containing all functions
|
||||
*/
|
||||
static hash_table_t function;
|
||||
static int is_autoload = 0;
|
||||
|
||||
/**
|
||||
Make sure that if the specified function is a dynamically loaded
|
||||
function, it has been fully loaded.
|
||||
*/
|
||||
static int load( const wchar_t *name )
|
||||
{
|
||||
int was_autoload = is_autoload;
|
||||
int res;
|
||||
function_data_t *data;
|
||||
data = (function_data_t *)hash_get( &function, name );
|
||||
if( data && !data->is_autoload )
|
||||
return 0;
|
||||
|
||||
is_autoload = 1;
|
||||
res = parse_util_load( name,
|
||||
L"fish_function_path",
|
||||
&function_remove,
|
||||
1 );
|
||||
is_autoload = was_autoload;
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
Insert a list of all dynamically loaded functions into the
|
||||
specified list.
|
||||
*/
|
||||
static void autoload_names( array_list_t *out, int get_hidden )
|
||||
{
|
||||
int i;
|
||||
|
||||
array_list_t path_list;
|
||||
const wchar_t *path_var = env_get( L"fish_function_path" );
|
||||
|
||||
if( ! path_var )
|
||||
return;
|
||||
|
||||
al_init( &path_list );
|
||||
|
||||
expand_variable_array( path_var, &path_list );
|
||||
for( i=0; i<al_get_count( &path_list ); i++ )
|
||||
{
|
||||
wchar_t *ndir = (wchar_t *)al_get( &path_list, i );
|
||||
DIR *dir = wopendir( ndir );
|
||||
if( !dir )
|
||||
continue;
|
||||
|
||||
struct wdirent *next;
|
||||
while( (next=wreaddir(dir))!=0 )
|
||||
{
|
||||
wchar_t *fn = next->d_name;
|
||||
wchar_t *suffix;
|
||||
if( !get_hidden && fn[0] == L'_' )
|
||||
continue;
|
||||
|
||||
suffix = wcsrchr( fn, L'.' );
|
||||
if( suffix && (wcscmp( suffix, L".fish" ) == 0 ) )
|
||||
{
|
||||
const wchar_t *dup;
|
||||
*suffix = 0;
|
||||
dup = intern( fn );
|
||||
if( !dup )
|
||||
die_mem();
|
||||
al_push( out, dup );
|
||||
}
|
||||
}
|
||||
closedir(dir);
|
||||
}
|
||||
al_foreach( &path_list, (void (*)(const void *))&free );
|
||||
al_destroy( &path_list );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Free all contents of an entry to the function hash table
|
||||
@@ -65,18 +146,6 @@ void function_destroy()
|
||||
hash_destroy( &function );
|
||||
}
|
||||
|
||||
static int count_lineno( const wchar_t *str, int len )
|
||||
{
|
||||
int res = 0;
|
||||
int i;
|
||||
for( i=0; i<len; i++ )
|
||||
{
|
||||
if( str[i] == L'\n' )
|
||||
res++;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
void function_add( const wchar_t *name,
|
||||
const wchar_t *val,
|
||||
@@ -86,16 +155,14 @@ void function_add( const wchar_t *name,
|
||||
{
|
||||
int i;
|
||||
wchar_t *cmd_end;
|
||||
function_data_t *d;
|
||||
|
||||
|
||||
if( function_exists( name ) )
|
||||
function_remove( name );
|
||||
function_remove( name );
|
||||
|
||||
|
||||
|
||||
function_data_t *d = malloc( sizeof( function_data_t ) );
|
||||
d->definition_offset = count_lineno( parser_get_buffer(), current_block->tok_pos );
|
||||
d = malloc( sizeof( function_data_t ) );
|
||||
d->definition_offset = parse_util_lineno( parser_get_buffer(), current_block->tok_pos );
|
||||
d->cmd = wcsdup( val );
|
||||
|
||||
cmd_end = d->cmd + wcslen(d->cmd)-1;
|
||||
while( (cmd_end>d->cmd) && wcschr( L"\n\r\t ", *cmd_end ) )
|
||||
{
|
||||
@@ -104,7 +171,9 @@ void function_add( const wchar_t *name,
|
||||
|
||||
d->desc = desc?wcsdup( desc ):0;
|
||||
d->is_binding = is_binding;
|
||||
d->definition_file = reader_current_filename()?intern(reader_current_filename()):0;
|
||||
d->definition_file = intern(reader_current_filename());
|
||||
d->is_autoload = is_autoload;
|
||||
|
||||
hash_put( &function, intern(name), d );
|
||||
|
||||
for( i=0; i<al_get_count( events ); i++ )
|
||||
@@ -116,6 +185,10 @@ void function_add( const wchar_t *name,
|
||||
|
||||
int function_exists( const wchar_t *cmd )
|
||||
{
|
||||
if( parser_is_reserved(cmd) )
|
||||
return 0;
|
||||
|
||||
load( cmd );
|
||||
return (hash_get(&function, cmd) != 0 );
|
||||
}
|
||||
|
||||
@@ -123,27 +196,28 @@ void function_remove( const wchar_t *name )
|
||||
{
|
||||
void *key;
|
||||
function_data_t *d;
|
||||
|
||||
event_t ev;
|
||||
ev.type=EVENT_ANY;
|
||||
ev.function_name=name;
|
||||
event_remove( &ev );
|
||||
|
||||
hash_remove( &function,
|
||||
name,
|
||||
(const void **) &key,
|
||||
(const void **)&d );
|
||||
|
||||
if( !d )
|
||||
if( !key )
|
||||
return;
|
||||
|
||||
ev.type=EVENT_ANY;
|
||||
ev.function_name=name;
|
||||
event_remove( &ev );
|
||||
|
||||
clear_function_entry( key, d );
|
||||
}
|
||||
|
||||
const wchar_t *function_get_definition( const wchar_t *argv )
|
||||
{
|
||||
function_data_t *data =
|
||||
(function_data_t *)hash_get( &function, argv );
|
||||
function_data_t *data;
|
||||
load( argv );
|
||||
data = (function_data_t *)hash_get( &function, argv );
|
||||
if( data == 0 )
|
||||
return 0;
|
||||
return data->cmd;
|
||||
@@ -151,18 +225,20 @@ const wchar_t *function_get_definition( const wchar_t *argv )
|
||||
|
||||
const wchar_t *function_get_desc( const wchar_t *argv )
|
||||
{
|
||||
function_data_t *data =
|
||||
(function_data_t *)hash_get( &function, argv );
|
||||
function_data_t *data;
|
||||
load( argv );
|
||||
data = (function_data_t *)hash_get( &function, argv );
|
||||
if( data == 0 )
|
||||
return 0;
|
||||
|
||||
return data->desc;
|
||||
return _(data->desc);
|
||||
}
|
||||
|
||||
void function_set_desc( const wchar_t *name, const wchar_t *desc )
|
||||
{
|
||||
function_data_t *data =
|
||||
(function_data_t *)hash_get( &function, name );
|
||||
function_data_t *data;
|
||||
load( name );
|
||||
data = (function_data_t *)hash_get( &function, name );
|
||||
if( data == 0 )
|
||||
return;
|
||||
|
||||
@@ -185,6 +261,8 @@ static void get_names_internal( const void *key,
|
||||
|
||||
void function_get_names( array_list_t *list, int get_hidden )
|
||||
{
|
||||
autoload_names( list, get_hidden );
|
||||
|
||||
if( get_hidden )
|
||||
hash_get_keys( &function, list );
|
||||
else
|
||||
@@ -194,8 +272,9 @@ void function_get_names( array_list_t *list, int get_hidden )
|
||||
|
||||
const wchar_t *function_get_definition_file( const wchar_t *argv )
|
||||
{
|
||||
function_data_t *data =
|
||||
(function_data_t *)hash_get( &function, argv );
|
||||
function_data_t *data;
|
||||
load( argv );
|
||||
data = (function_data_t *)hash_get( &function, argv );
|
||||
if( data == 0 )
|
||||
return 0;
|
||||
|
||||
@@ -205,13 +284,12 @@ const wchar_t *function_get_definition_file( const wchar_t *argv )
|
||||
|
||||
int function_get_definition_offset( const wchar_t *argv )
|
||||
{
|
||||
function_data_t *data =
|
||||
(function_data_t *)hash_get( &function, argv );
|
||||
function_data_t *data;
|
||||
load( argv );
|
||||
data = (function_data_t *)hash_get( &function, argv );
|
||||
if( data == 0 )
|
||||
return -1;
|
||||
|
||||
return data->definition_offset;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -69,8 +69,15 @@ int function_exists( const wchar_t *name );
|
||||
void function_get_names( array_list_t *list,
|
||||
int get_hidden );
|
||||
|
||||
/**
|
||||
Returns tha absolute path of the file where the specified function
|
||||
was defined. Returns 0 if the file was defined on the commandline.
|
||||
*/
|
||||
const wchar_t *function_get_definition_file( const wchar_t *name );
|
||||
|
||||
/**
|
||||
Returns the linenumber where the definition of the specified function started
|
||||
*/
|
||||
int function_get_definition_offset( const wchar_t *name );
|
||||
|
||||
#endif
|
||||
|
||||
173
halloc.c
Normal file
173
halloc.c
Normal file
@@ -0,0 +1,173 @@
|
||||
/** \file halloc.c
|
||||
|
||||
A hierarchical memory allocation system. Works just like talloc
|
||||
used in Samba, except that an arbitrary block allocated with
|
||||
malloc() can be registered to be freed by halloc_free.
|
||||
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "fallback.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "halloc.h"
|
||||
|
||||
#define HALLOC_BLOCK_SIZE 128
|
||||
#define HALLOC_SCRAP_SIZE 16
|
||||
|
||||
#ifdef HALLOC_DEBUG
|
||||
static int child_count=0;
|
||||
static int child_size=0;
|
||||
static int alloc_count =0;
|
||||
static int alloc_spill = 0;
|
||||
static pid_t pid=0;
|
||||
static int parent_count=0;
|
||||
#endif
|
||||
|
||||
typedef struct halloc
|
||||
{
|
||||
array_list_t children;
|
||||
void *scratch;
|
||||
size_t scratch_free;
|
||||
long long data[0];
|
||||
}
|
||||
halloc_t;
|
||||
|
||||
static halloc_t *halloc_from_data( void *data )
|
||||
{
|
||||
return (halloc_t *)(data - sizeof( halloc_t ) );
|
||||
}
|
||||
|
||||
static void late_free( void *data)
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef HALLOC_DEBUG
|
||||
static void woot()
|
||||
{
|
||||
if( getpid() == pid )
|
||||
{
|
||||
debug( 1, L"%d parents, %d children with average child size of %.2f bytes caused %d allocs, average spill of %.2f bytes",
|
||||
parent_count, child_count, (double)child_size/child_count,
|
||||
parent_count+alloc_count, (double)alloc_spill/(parent_count+alloc_count) );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void *halloc( void *context, size_t size )
|
||||
{
|
||||
halloc_t *me, *parent;
|
||||
if( context )
|
||||
{
|
||||
void *res;
|
||||
|
||||
#ifdef HALLOC_DEBUG
|
||||
|
||||
if( !child_count )
|
||||
{
|
||||
pid = getpid();
|
||||
atexit( woot );
|
||||
}
|
||||
|
||||
child_count++;
|
||||
child_size += size;
|
||||
#endif
|
||||
parent = halloc_from_data( context );
|
||||
if( size <= parent->scratch_free )
|
||||
{
|
||||
res = parent->scratch;
|
||||
parent->scratch_free -= size;
|
||||
parent->scratch += size;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
#ifdef HALLOC_DEBUG
|
||||
alloc_count++;
|
||||
#endif
|
||||
|
||||
if( parent->scratch_free < HALLOC_SCRAP_SIZE )
|
||||
{
|
||||
#ifdef HALLOC_DEBUG
|
||||
alloc_spill += parent->scratch_free;
|
||||
#endif
|
||||
res = calloc( 1, size + HALLOC_BLOCK_SIZE );
|
||||
parent->scratch = res + size;
|
||||
parent->scratch_free = HALLOC_BLOCK_SIZE;
|
||||
}
|
||||
else
|
||||
{
|
||||
res = calloc( 1, size );
|
||||
}
|
||||
al_push( &parent->children, &late_free );
|
||||
al_push( &parent->children, res );
|
||||
|
||||
}
|
||||
return res;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
me = (halloc_t *)calloc( 1, sizeof(halloc_t) + size + HALLOC_BLOCK_SIZE );
|
||||
|
||||
if( !me )
|
||||
return 0;
|
||||
#ifdef HALLOC_DEBUG
|
||||
parent_count++;
|
||||
#endif
|
||||
me->scratch = ((void *)me) + sizeof(halloc_t) + size;
|
||||
me->scratch_free = HALLOC_BLOCK_SIZE;
|
||||
|
||||
al_init( &me->children );
|
||||
return &me->data;
|
||||
}
|
||||
}
|
||||
|
||||
void halloc_register_function( void *context, void (*func)(void *), void *data )
|
||||
{
|
||||
halloc_t *me;
|
||||
if( !context )
|
||||
return;
|
||||
|
||||
me = halloc_from_data( context );
|
||||
al_push( &me->children, func );
|
||||
al_push( &me->children, data );
|
||||
}
|
||||
|
||||
void halloc_free( void *context )
|
||||
{
|
||||
halloc_t *me;
|
||||
int i;
|
||||
|
||||
if( !context )
|
||||
return;
|
||||
|
||||
|
||||
me = halloc_from_data( context );
|
||||
|
||||
#ifdef HALLOC_DEBUG
|
||||
alloc_spill += me->scratch_free;
|
||||
#endif
|
||||
for( i=0; i<al_get_count(&me->children); i+=2 )
|
||||
{
|
||||
void (*func)(void *) = (void (*)(void *))al_get( &me->children, i );
|
||||
void * data = (void *)al_get( &me->children, i+1 );
|
||||
if( func != &late_free )
|
||||
func( data );
|
||||
}
|
||||
for( i=0; i<al_get_count(&me->children); i+=2 )
|
||||
{
|
||||
void (*func)(void *) = (void (*)(void *))al_get( &me->children, i );
|
||||
void * data = (void *)al_get( &me->children, i+1 );
|
||||
if( func == &late_free )
|
||||
free( data );
|
||||
}
|
||||
al_destroy( &me->children );
|
||||
free(me);
|
||||
}
|
||||
48
halloc.h
Normal file
48
halloc.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/** \file halloc.h
|
||||
|
||||
A hierarchical memory allocation system. Works mostly like talloc
|
||||
used in Samba, except that an arbitrary block allocated with
|
||||
malloc() can be registered to be freed by halloc_free.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef FISH_HALLOC_H
|
||||
#define FISH_HALLOC_H
|
||||
|
||||
/**
|
||||
Allocate new memory using specified parent memory context. Context
|
||||
_must_ be either 0 or the result of a previous call to halloc.
|
||||
|
||||
If \c context is null, the resulting block is a root block, and
|
||||
must be freed with a call to halloc_free().
|
||||
|
||||
If \c context is not null, context must be a halloc root block. the
|
||||
resulting memory block is a child context, and must never be
|
||||
explicitly freed, it will be automatically freed whenever the
|
||||
parent context is freed. Child blocks can also never be used as the
|
||||
context in calls to halloc_register_function, halloc_free, etc.
|
||||
*/
|
||||
void *halloc( void *context, size_t size );
|
||||
|
||||
/**
|
||||
Make the specified function run whenever context is free'd, using data as argument.
|
||||
|
||||
\c context a halloc root block
|
||||
*/
|
||||
void halloc_register_function( void *context, void (*func)(void *), void *data );
|
||||
|
||||
/**
|
||||
Free memory context and all children contexts. Only root contexts
|
||||
may be freed explicitly.
|
||||
|
||||
All functions registered with halloc_register_function are run in
|
||||
the order they where added. Afterwards, all memory allocated using
|
||||
halloc itself is free'd.
|
||||
|
||||
\c context a halloc root block
|
||||
*/
|
||||
void halloc_free( void *context );
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
97
halloc_util.c
Normal file
97
halloc_util.c
Normal file
@@ -0,0 +1,97 @@
|
||||
/** \file halloc.c
|
||||
|
||||
A hierarchical memory allocation system. Works just like talloc
|
||||
used in Samba, except that an arbitrary block allocated with
|
||||
malloc() can be registered to be freed by halloc_free.
|
||||
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "fallback.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "halloc.h"
|
||||
|
||||
void *global_context=0;
|
||||
|
||||
void halloc_util_init()
|
||||
{
|
||||
global_context = halloc( 0, 0 );
|
||||
}
|
||||
|
||||
void halloc_util_destroy()
|
||||
{
|
||||
halloc_free( global_context );
|
||||
}
|
||||
|
||||
array_list_t *al_halloc( void *context )
|
||||
{
|
||||
array_list_t *res = halloc( context, sizeof( array_list_t ) );
|
||||
if( !res )
|
||||
die_mem();
|
||||
al_init( res );
|
||||
halloc_register_function( context, (void (*)(void *)) &al_destroy, res );
|
||||
return res;
|
||||
}
|
||||
|
||||
string_buffer_t *sb_halloc( void *context )
|
||||
{
|
||||
string_buffer_t *res = halloc( context, sizeof( string_buffer_t ) );
|
||||
if( !res )
|
||||
die_mem();
|
||||
sb_init( res );
|
||||
halloc_register_function( context, (void (*)(void *)) &sb_destroy, res );
|
||||
return res;
|
||||
}
|
||||
|
||||
static void halloc_passthrough( void *f )
|
||||
{
|
||||
void (*func)() = (void (*)() )f;
|
||||
func();
|
||||
}
|
||||
|
||||
void halloc_register_function_void( void *context, void (*func)() )
|
||||
{
|
||||
halloc_register_function( context, &halloc_passthrough, (void *)func );
|
||||
}
|
||||
|
||||
void *halloc_register( void *context, void *data )
|
||||
{
|
||||
if( !data )
|
||||
return 0;
|
||||
|
||||
halloc_register_function( context, &free, data );
|
||||
return data;
|
||||
}
|
||||
|
||||
wchar_t *halloc_wcsdup( void *context, wchar_t *in )
|
||||
{
|
||||
size_t len=wcslen(in);
|
||||
wchar_t *out = halloc( context, sizeof( wchar_t)*(len+1));
|
||||
|
||||
if( out == 0 )
|
||||
{
|
||||
die_mem();
|
||||
}
|
||||
memcpy( out, in, sizeof( wchar_t)*(len+1));
|
||||
return out;
|
||||
}
|
||||
|
||||
wchar_t *halloc_wcsndup( void * context, const wchar_t *in, int c )
|
||||
{
|
||||
wchar_t *res = halloc( context, sizeof(wchar_t)*(c+1) );
|
||||
if( res == 0 )
|
||||
{
|
||||
die_mem();
|
||||
}
|
||||
wcslcpy( res, in, c+1 );
|
||||
res[c] = L'\0';
|
||||
return res;
|
||||
}
|
||||
66
halloc_util.h
Normal file
66
halloc_util.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
\file halloc_util.h
|
||||
|
||||
Various halloc-related utility functions.
|
||||
*/
|
||||
|
||||
#ifndef FISH_HALLOC_UTIL_H
|
||||
#define FISH_HALLOC_UTIL_H
|
||||
|
||||
/**
|
||||
This pointer is a valid halloc context that will be freed right
|
||||
before program shutdown. It may be used to allocate memory that
|
||||
should be freed when the program shuts down.
|
||||
*/
|
||||
extern void *global_context;
|
||||
|
||||
/**
|
||||
Create the global_context halloc object
|
||||
*/
|
||||
void halloc_util_init();
|
||||
|
||||
/**
|
||||
Free the global_context halloc object
|
||||
*/
|
||||
void halloc_util_destroy();
|
||||
|
||||
/**
|
||||
Allocate a array_list_t that will be automatically disposed of when
|
||||
the specified context is free'd
|
||||
*/
|
||||
array_list_t *al_halloc( void *context );
|
||||
|
||||
/**
|
||||
Allocate a string_buffer_t that will be automatically disposed of
|
||||
when the specified context is free'd
|
||||
*/
|
||||
string_buffer_t *sb_halloc( void *context );
|
||||
|
||||
/**
|
||||
Register the specified function to run when the specified context
|
||||
is free'd. This function is related to halloc_register_function,
|
||||
but the specified function dowes not take an argument.
|
||||
*/
|
||||
void halloc_register_function_void( void *context, void (*func)() );
|
||||
|
||||
/**
|
||||
Free the memory pointed to by \c data when the memory pointed to by
|
||||
\c context is free:d. Note that this will _not_ turn the specified
|
||||
memory area into a valid halloc context. Only memory areas created
|
||||
using a call to halloc( 0, size ) can be used as a context.
|
||||
*/
|
||||
void *halloc_register( void *context, void *data );
|
||||
|
||||
/**
|
||||
Make a copy of the specified string using memory allocated using
|
||||
halloc and the specified context
|
||||
*/
|
||||
wchar_t *halloc_wcsdup( void *context, wchar_t *str );
|
||||
|
||||
/**
|
||||
Make a copy of the specified substring using memory allocated using
|
||||
halloc and the specified context
|
||||
*/
|
||||
wchar_t *halloc_wcsndup( void * context, const wchar_t *in, int c );
|
||||
|
||||
#endif
|
||||
25
highlight.c
25
highlight.c
@@ -12,12 +12,16 @@
|
||||
#include <signal.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "fallback.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "wutil.h"
|
||||
#include "highlight.h"
|
||||
#include "tokenizer.h"
|
||||
#include "proc.h"
|
||||
#include "parser.h"
|
||||
#include "parse_util.h"
|
||||
#include "builtin.h"
|
||||
#include "function.h"
|
||||
#include "env.h"
|
||||
@@ -129,10 +133,10 @@ void highlight_shell( wchar_t * buff,
|
||||
/*
|
||||
Command. First check that the command actually exists.
|
||||
*/
|
||||
wchar_t *cmd =
|
||||
(last_type == TOK_STRING) ?
|
||||
expand_one(wcsdup(tok_last( &tok )),EXPAND_SKIP_SUBSHELL | EXPAND_SKIP_VARIABLES) :
|
||||
wcsdup(tok_last( &tok ));
|
||||
wchar_t *cmd = expand_one( 0,
|
||||
wcsdup(tok_last( &tok )),
|
||||
EXPAND_SKIP_SUBSHELL | EXPAND_SKIP_VARIABLES);
|
||||
|
||||
if( cmd == 0 )
|
||||
{
|
||||
color[ tok_get_pos( &tok ) ] = HIGHLIGHT_ERROR;
|
||||
@@ -144,7 +148,6 @@ void highlight_shell( wchar_t * buff,
|
||||
int is_subcommand = 0;
|
||||
int mark = tok_get_pos( &tok );
|
||||
color[ tok_get_pos( &tok ) ] = HIGHLIGHT_COMMAND;
|
||||
|
||||
|
||||
if( parser_is_subcommand( cmd ) )
|
||||
{
|
||||
@@ -247,7 +250,7 @@ void highlight_shell( wchar_t * buff,
|
||||
{
|
||||
case TOK_STRING:
|
||||
{
|
||||
target = expand_one( wcsdup( tok_last( &tok ) ), EXPAND_SKIP_SUBSHELL);
|
||||
target = expand_one( 0, wcsdup( tok_last( &tok ) ), EXPAND_SKIP_SUBSHELL);
|
||||
/*
|
||||
Redirect filename may contain a subshell.
|
||||
If so, it will be ignored/not flagged.
|
||||
@@ -365,11 +368,11 @@ void highlight_shell( wchar_t * buff,
|
||||
while( 1 )
|
||||
{
|
||||
wchar_t *begin, *end;
|
||||
|
||||
if( expand_locate_subshell( subpos,
|
||||
&begin,
|
||||
&end,
|
||||
1) <= 0)
|
||||
|
||||
if( parse_util_locate_cmdsubst( subpos,
|
||||
(const wchar_t **)&begin,
|
||||
(const wchar_t **)&end,
|
||||
1) <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
61
history.c
61
history.c
@@ -12,13 +12,17 @@
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "fallback.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "wutil.h"
|
||||
#include "history.h"
|
||||
#include "common.h"
|
||||
#include "reader.h"
|
||||
#include "env.h"
|
||||
#include "sanity.h"
|
||||
#include "signal.h"
|
||||
|
||||
/*
|
||||
The history is implemented using a linked list. Searches are done
|
||||
@@ -45,6 +49,8 @@ typedef struct
|
||||
The last item loaded from file
|
||||
*/
|
||||
ll_node_t *last_loaded;
|
||||
|
||||
int is_loaded;
|
||||
}
|
||||
history_data;
|
||||
|
||||
@@ -82,25 +88,31 @@ static wchar_t *mode_name;
|
||||
*/
|
||||
static hash_table_t history_table;
|
||||
|
||||
/**
|
||||
Flag, set to 1 once the history file has been loaded
|
||||
*/
|
||||
static int is_loaded;
|
||||
|
||||
/**
|
||||
Load history from ~/.fish_history
|
||||
Load history from file
|
||||
*/
|
||||
static void history_load( wchar_t *name )
|
||||
static void history_load()
|
||||
{
|
||||
wchar_t *fn;
|
||||
wchar_t *buff=0;
|
||||
int buff_len=0;
|
||||
FILE *in_stream;
|
||||
hash_table_t used;
|
||||
|
||||
block();
|
||||
|
||||
is_loaded = 1;
|
||||
|
||||
signal_block();
|
||||
hash_init2( &used,
|
||||
&hash_wcs_func,
|
||||
&hash_wcs_cmp,
|
||||
4096 );
|
||||
|
||||
fn = wcsdupcat2( env_get(L"HOME"), L"/.", name, L"_history", 0 );
|
||||
fn = wcsdupcat2( env_get(L"HOME"), L"/.", mode_name, L"_history", 0 );
|
||||
|
||||
in_stream = wfopen( fn, "r" );
|
||||
|
||||
@@ -111,12 +123,12 @@ static void history_load( wchar_t *name )
|
||||
int buff_read = fgetws2( &buff, &buff_len, in_stream );
|
||||
if( buff_read == -1 )
|
||||
{
|
||||
debug( 1, L"The following non-fatal error occurred while reading command history from \'%ls\':", name );
|
||||
debug( 1, L"The following non-fatal error occurred while reading command history from \'%ls\':", mode_name );
|
||||
wperror( L"fgetws2" );
|
||||
fclose( in_stream );
|
||||
free( fn );
|
||||
free( buff );
|
||||
unblock();
|
||||
signal_unblock();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -161,7 +173,7 @@ static void history_load( wchar_t *name )
|
||||
{
|
||||
if( errno != ENOENT )
|
||||
{
|
||||
debug( 1, L"The following non-fatal error occurred while reading command history from \'%ls\':", name );
|
||||
debug( 1, L"The following non-fatal error occurred while reading command history from \'%ls\':", mode_name );
|
||||
wperror( L"fopen" );
|
||||
}
|
||||
|
||||
@@ -173,7 +185,7 @@ static void history_load( wchar_t *name )
|
||||
free( buff );
|
||||
free( fn );
|
||||
last_loaded = history_last;
|
||||
unblock();
|
||||
signal_unblock();
|
||||
}
|
||||
|
||||
void history_init()
|
||||
@@ -198,6 +210,7 @@ static void history_to_hash()
|
||||
d->last=history_last;
|
||||
d->last_loaded=last_loaded;
|
||||
d->count=history_count;
|
||||
d->is_loaded = is_loaded;
|
||||
|
||||
hash_put( &history_table,
|
||||
mode_name,
|
||||
@@ -223,13 +236,14 @@ void history_set_mode( wchar_t *name )
|
||||
history_current = history_last = curr->last;
|
||||
last_loaded = curr->last_loaded;
|
||||
history_count = curr->count;
|
||||
is_loaded = curr->is_loaded;
|
||||
}
|
||||
else
|
||||
{
|
||||
history_count=0;
|
||||
history_last = history_current = last_loaded=0;
|
||||
mode_name = wcsdup( name );
|
||||
history_load( name );
|
||||
is_loaded = 0;
|
||||
}
|
||||
|
||||
past_end=1;
|
||||
@@ -259,6 +273,9 @@ static void history_save()
|
||||
/* First we save this sessions history in local variables */
|
||||
ll_node_t *real_pos = history_last, *real_first = last_loaded;
|
||||
|
||||
if( !is_loaded )
|
||||
return;
|
||||
|
||||
if( !real_first )
|
||||
{
|
||||
real_first = history_current;
|
||||
@@ -390,6 +407,9 @@ void history_destroy()
|
||||
*/
|
||||
static ll_node_t *history_find( ll_node_t *n, const wchar_t *s )
|
||||
{
|
||||
if( !is_loaded )
|
||||
history_load();
|
||||
|
||||
if( n == 0 )
|
||||
return 0;
|
||||
|
||||
@@ -406,6 +426,9 @@ void history_add( const wchar_t *str )
|
||||
{
|
||||
ll_node_t *old_node;
|
||||
|
||||
if( !is_loaded )
|
||||
history_load();
|
||||
|
||||
if( wcslen( str ) == 0 )
|
||||
return;
|
||||
|
||||
@@ -460,6 +483,9 @@ static int history_test( const wchar_t *needle, const wchar_t *haystack )
|
||||
|
||||
const wchar_t *history_prev_match( const wchar_t *str )
|
||||
{
|
||||
if( !is_loaded )
|
||||
history_load();
|
||||
|
||||
if( history_current == 0 )
|
||||
return str;
|
||||
|
||||
@@ -481,6 +507,9 @@ const wchar_t *history_prev_match( const wchar_t *str )
|
||||
|
||||
const wchar_t *history_next_match( const wchar_t *str)
|
||||
{
|
||||
if( !is_loaded )
|
||||
history_load();
|
||||
|
||||
if( history_current == 0 )
|
||||
return str;
|
||||
|
||||
@@ -507,15 +536,21 @@ void history_reset()
|
||||
*/
|
||||
void history_first()
|
||||
{
|
||||
while( history_current->prev )
|
||||
history_current = history_current->prev;
|
||||
if( is_loaded )
|
||||
while( history_current->prev )
|
||||
history_current = history_current->prev;
|
||||
|
||||
}
|
||||
|
||||
wchar_t *history_get( int idx )
|
||||
{
|
||||
ll_node_t *n=history_last;
|
||||
ll_node_t *n;
|
||||
int i;
|
||||
if( !is_loaded )
|
||||
history_load();
|
||||
|
||||
n = history_last;
|
||||
|
||||
if( idx<0)
|
||||
{
|
||||
debug( 1, L"Tried to access negative history index %d", idx );
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
#include <wchar.h>
|
||||
|
||||
/**
|
||||
Load history from file.
|
||||
Init history library. The history file won't actually be loaded
|
||||
until the first time a history search is performed.
|
||||
*/
|
||||
void history_init();
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#apm
|
||||
complete -f -c apm -s V -l version -d (_ "Display version and exit")
|
||||
complete -f -c apm -s v -l verbose -d (_ "Print APM info")
|
||||
complete -f -c apm -s m -l minutes -d (_ "Print time remaining")
|
||||
complete -f -c apm -s M -l monitor -d (_ "Monitor status info")
|
||||
complete -f -c apm -s S -l standby -d (_ "Request APM standby mode")
|
||||
complete -f -c apm -s s -l suspend -d (_ "Request APM suspend mode")
|
||||
complete -f -c apm -s d -l debug -d (_ "APM status debugging info")
|
||||
@@ -1,21 +0,0 @@
|
||||
|
||||
function __fish_complete_apropos
|
||||
if test (commandline -ct)
|
||||
set str (commandline -ct)
|
||||
apropos $str|sed -e "s/^\(.*$str\([^ ]*\).*\)$/$str\2\t\1/"
|
||||
end
|
||||
end
|
||||
|
||||
complete -xc apropos -a '(__fish_complete_apropos)' -d (_ "whatis entry")
|
||||
|
||||
complete -c apropos -s h -l help -d (_ "Display help and exit")
|
||||
complete -f -c apropos -s d -l debug -d (_ "Print debugging info")
|
||||
complete -f -c apropos -s v -l verbose -d (_ "Verbose mode")
|
||||
complete -f -c apropos -s r -l regex -d (_ "Keyword as regex")
|
||||
complete -f -c apropos -s w -l wildcard -d (_ "Keyword as wildwards")
|
||||
complete -f -c apropos -s e -l exact -d (_ "Keyword as exactly match")
|
||||
complete -x -c apropos -s m -l system -d (_ "Search for other system")
|
||||
complete -x -c apropos -s M -l manpath -a '(echo $MANPATH)' -d (_ "Specify man path")
|
||||
complete -x -c apropos -s C -l config-file -d (_ "Specify a configuration file")
|
||||
complete -f -c apropos -s V -l version -d (_ "Display version and exit")
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
|
||||
#apt-build
|
||||
complete -c apt-build -l help -d (_ "Display help and exit")
|
||||
complete -f -c apt-build -a update -d (_ "Update list of packages")
|
||||
complete -f -c apt-build -a upgrade -d (_ "Upgrade packages")
|
||||
complete -f -c apt-bulid -a world -d (_ "Rebuild your system")
|
||||
complete -x -c apt-build -a install -d (_ "Build and install a new package")
|
||||
complete -x -c apt-build -a source -d (_ "Download and extract a source")
|
||||
complete -x -c apt-build -a info -d (_ "Info on a package")
|
||||
complete -x -c apt-build -a remove -d (_ "Remove packages")
|
||||
complete -x -c apt-build -a clean-build -d (_ "Erase built packages")
|
||||
complete -x -c apt-build -a build-source -d (_ "Build source without install")
|
||||
complete -x -c apt-build -a clean-sources -d (_ "Clean source directories")
|
||||
complete -x -c apt-build -a update-source -d (_ "Update source and rebuild")
|
||||
complete -x -c apt-build -a update-repository -d (_ "Update the repository")
|
||||
complete -f -c apt-build -l nowrapper -d (_ "Do not use gcc wrapper")
|
||||
complete -f -c apt-build -l remove-builddep -d (_ "Remove build-dep")
|
||||
complete -f -c apt-build -l no-source -d (_ "Do not download source")
|
||||
complete -f -c apt-build -l build-dir -d (_ "Specify build-dir")
|
||||
complete -f -c apt-build -l rebuild -d (_ "Rebuild a package")
|
||||
complete -f -c apt-build -l reinstall -d (_ "Rebuild and install an installed package")
|
||||
complete -r -f -c apt-build -l build-command -d (_ "Use <command> to build")
|
||||
complete -r -c apt-build -l patch -d (_ "Apply <file> patch")
|
||||
complete -c apt-build -s p -l patch-strip -d (_ "Prefix to strip on patch")
|
||||
complete -c apt-build -s y -l yes -d (_ "Assume yes to all questions")
|
||||
complete -c apt-build -l purge -d (_ "Use purge instead of remove")
|
||||
complete -c apt-build -l noupdate -d (_ "Do not run update")
|
||||
complete -r -c apt-build -l source-list -d (_ "Specify sources.list file")
|
||||
complete -f -c apt-build -s v -l version -d (_ "Display version and exit")
|
||||
@@ -1,31 +0,0 @@
|
||||
#apt-cache
|
||||
complete -c apt-cache -s h -l help -d (_ "Display help and exit")
|
||||
complete -f -c apt-cache -a gencaches -d (_ "Build apt cache")
|
||||
complete -x -c apt-cache -a showpkg -d (_ "Show package info")
|
||||
complete -f -c apt-cache -a stats -d (_ "Show cache statistics")
|
||||
complete -x -c apt-cache -a showsrc -d (_ "Show source package")
|
||||
complete -f -c apt-cache -a dump -d (_ "Show packages in cache")
|
||||
complete -f -c apt-cache -a dumpavail -d (_ "Print available list")
|
||||
complete -f -c apt-cache -a unmet -d (_ "List unmet dependencies in cache")
|
||||
complete -x -c apt-cache -a show -d (_ "Display package record")
|
||||
complete -x -c apt-cache -a search -d (_ "Search packagename by REGEX")
|
||||
complete -c apt-cache -l full -a search -d (_ "Search full package name")
|
||||
complete -x -c apt-cache -l names-only -a search -d (_ "Search packagename only")
|
||||
complete -x -c apt-cache -a depends -d (_ "List dependencies for the package")
|
||||
complete -x -c apt-cache -a rdepends -d (_ "List reverse dependencies for the package")
|
||||
complete -x -c apt-cache -a pkgnames -d (_ "Print package name by prefix")
|
||||
complete -x -c apt-cache -a dotty -d (_ "Generate dotty output for packages")
|
||||
complete -x -c apt-cache -a policy -d (_ "Debug preferences file")
|
||||
complete -r -c apt-cache -s p -l pkg-cache -d (_ "Select file to store package cache")
|
||||
complete -r -c apt-cache -s s -l src-cache -d (_ "Select file to store source cache")
|
||||
complete -f -c apt-cache -s q -l quiet -d (_ "Quiet mode")
|
||||
complete -f -c apt-cache -s i -l important -d (_ "Print important dependencies")
|
||||
complete -f -c apt-cache -s a -l all-versions -d (_ "Print full records")
|
||||
complete -f -c apt-cache -s g -l generate -d (_ "Auto-gen package cache")
|
||||
complete -f -c apt-cache -l all-names -d (_ "Print all names")
|
||||
complete -f -c apt-cache -l recurse -d (_ "Dep and rdep recursive")
|
||||
complete -f -c apt-cache -l installed -d (_ "Limit to installed")
|
||||
complete -f -c apt-cache -s v -l version -d (_ "Display version and exit")
|
||||
complete -r -c apt-cache -s c -l config-file -d (_ "Specify config file")
|
||||
complete -x -c apt-cache -s o -l option -d (_ "Specify options")
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#apt-cdrom
|
||||
complete -c apt-cdrom -s h -l help -d (_ "Display help and exit")
|
||||
complete -r -c apt-cdrom -a add -d (_ "Add new disc to source list")
|
||||
complete -x -c apt-cdrom -a ident -d (_ "Report identity of disc")
|
||||
complete -r -c apt-cdrom -s d -l cdrom -d (_ "Mount point")
|
||||
complete -f -c apt-cdrom -s r -l rename -d (_ "Rename a disc")
|
||||
complete -f -c apt-cdrom -s m -l no-mount -d (_ "No mounting")
|
||||
complete -f -c apt-cdrom -s f -l fast -d (_ "Fast copy")
|
||||
complete -f -c apt-cdrom -s a -l thorough -d (_ "Thorough package scan")
|
||||
complete -f -c apt-cdrom -s n -l no-act -d (_ "No changes")
|
||||
complete -f -c apt-cdrom -s v -l version -d (_ "Display version and exit")
|
||||
complete -r -c apt-cdrom -s c -l config-file -d (_ "Specify config file")
|
||||
complete -x -c apt-cdrom -s o -l option -d (_ "Specify options")
|
||||
@@ -1,7 +0,0 @@
|
||||
#apt-config
|
||||
complete -c apt-config -s h -l help -d (_ "Display help and exit")
|
||||
complete -c apt-config -a shell -d (_ "Access config file from shell")
|
||||
complete -f -c apt-config -a dump -d (_ "Dump contents of config file")
|
||||
complete -f -c apt-config -s v -l version -d (_ "Display version and exit")
|
||||
complete -r -c apt-config -s c -l config-file -d (_ "Specify config file")
|
||||
complete -x -c apt-config -s o -l option -d (_ "Specify options")
|
||||
@@ -1,7 +0,0 @@
|
||||
|
||||
#apt-extracttemplates
|
||||
complete -c apt-extracttemplates -s h -l help -d (_ "Display help and exit")
|
||||
complete -r -c apt-extracttemplates -s t -d (_ "Set temp dir")
|
||||
complete -r -c apt-extracttemplates -s c -d (_ "Specifiy config file")
|
||||
complete -r -c apt-extracttemplates -s o -d (_ "Specify options")
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
#apt-file
|
||||
complete -c apt-file -s h -l help -d (_ "Display help and exit")
|
||||
complete -x -c apt-file -a update -d (_ "Resync package contents from source")
|
||||
complete -r -c apt-file -a search -d (_ "Search package containing pattern")
|
||||
complete -r -c apt-file -a list -d (_ "List contents of a package matching pattern")
|
||||
complete -x -c apt-file -a purge -d (_ "Remove all gz files from cache")
|
||||
complete -r -c apt-file -s c -l cache -d (_ "Set cache dir")
|
||||
complete -f -c apt-file -s v -l verbose -d (_ "Verbose mode")
|
||||
complete -c apt-file -s d -l cdrom-mount -d (_ "Use cdrom-mount-point")
|
||||
complete -f -c apt-file -s i -l ignore-case -d (_ "Do not expand pattern")
|
||||
complete -f -c apt-file -s x -l regexp -d (_ "Pattern is regexp")
|
||||
complete -f -c apt-file -s V -l version -d (_ "Display version and exit")
|
||||
complete -f -c apt-file -s a -l architecture -d (_ "Set arch")
|
||||
complete -r -c apt-file -s s -l sources-list -a "(ls /etc/apt)" -d (_ "Set sources.list file")
|
||||
complete -f -c apt-file -s l -l package-only -d (_ "Only display package name")
|
||||
complete -f -c apt-file -s F -l fixed-string -d (_ "Do not expand pattern")
|
||||
complete -f -c apt-file -s y -l dummy -d (_ "Run in dummy mode")
|
||||
@@ -1,17 +0,0 @@
|
||||
#apt-ftparchive
|
||||
complete -c apt-ftparchive -s h -l help -d (_ "Display help and exit")
|
||||
complete -f -c apt-ftparchive -a packages -d (_ "Generate package from source")
|
||||
complete -f -c apt-ftparchive -a sources -d (_ "Generate source index file")
|
||||
complete -f -c apt-ftparchive -a contents -d (_ "Generate contents file")
|
||||
complete -f -c apt-ftparchive -a release -d (_ "Generate release file")
|
||||
complete -f -c apt-ftparchive -a clean -d (_ "Remove records")
|
||||
complete -f -c apt-ftparchive -l md5 -d (_ "Generate MD5 sums")
|
||||
complete -f -c apt-ftparchive -s d -l db -d (_ "Use a binary db")
|
||||
complete -f -c apt-ftparchive -s q -l quiet -d (_ "Quiet mode")
|
||||
complete -f -c apt-ftparchive -l delink -d (_ "Perform delinking")
|
||||
complete -f -c apt-ftparchive -l contents -d (_ "Perform contents generation")
|
||||
complete -c apt-ftparchive -s s -l source-override -d (_ "Use source override")
|
||||
complete -f -c apt-ftparchive -l readonly -d (_ "Make caching db readonly")
|
||||
complete -f -c apt-ftparchive -s v -l version -d (_ "Display version and exit")
|
||||
complete -r -c apt-ftparchive -s c -l config-file -d (_ "Use config file")
|
||||
complete -r -c apt-ftparchive -s o -l option -d (_ "Set config options")
|
||||
@@ -1,64 +0,0 @@
|
||||
#completion for apt-get
|
||||
|
||||
function __fish_apt_no_subcommand -d (_ 'Test if apt has yet to be given the subcommand')
|
||||
for i in (commandline -opc)
|
||||
if contains -- $i update upgrade dselect-upgrade dist-upgrade install remove source build-dep check clean autoclean
|
||||
return 1
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
function __fish_apt_use_package -d (_ 'Test if apt command should have packages as potential completion')
|
||||
for i in (commandline -opc)
|
||||
if contains -- $i contains install remove build-dep
|
||||
return 0
|
||||
end
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
complete -c apt-get -n '__fish_apt_use_package' -a '(__fish_print_packages)' -d (_ 'Package')
|
||||
|
||||
complete -c apt-get -s h -l help -d (_ 'Display help and exit')
|
||||
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'update' -d (_ 'Update sources')
|
||||
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'upgrade' -d (_ 'Upgrade or install newest packages')
|
||||
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'dselect-upgrade' -d (_ 'Use with dselect front-end')
|
||||
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'dist-upgrade' -d (_ 'Distro upgrade')
|
||||
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'install' -d (_ 'Install one or more packages')
|
||||
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'remove' -d (_ 'Remove one or more packages')
|
||||
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'source' -d (_ 'Fetch source packages')
|
||||
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'build-dep' -d (_ 'Install/remove packages for dependencies')
|
||||
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'check' -d (_ 'Update cache and check dependencies')
|
||||
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'clean' -d (_ 'Clean local caches and packages')
|
||||
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'autoclean' -d (_ 'Clean packages no longer be downloaded')
|
||||
complete -c apt-get -s d -l download-only -d (_ 'Download Only')
|
||||
complete -c apt-get -s f -l fix-broken -d (_ 'Correct broken dependencies')
|
||||
complete -c apt-get -s m -l fix-missing -d (_ 'Ignore missing packages')
|
||||
complete -c apt-get -l no-download -d (_ 'Disable downloading packages')
|
||||
complete -c apt-get -s q -l quiet -d (_ 'Quiet mode')
|
||||
complete -c apt-get -s s -l simulate -d (_ 'Perform a simulation')
|
||||
complete -c apt-get -s y -l assume-yes -d (_ 'Automatic yes to prompts')
|
||||
complete -c apt-get -s u -l show-upgraded -d (_ 'Show upgraded packages')
|
||||
complete -c apt-get -s V -l verbose-versions -d (_ 'Show full versions for packages')
|
||||
complete -c apt-get -s b -l compile -d (_ 'Compile source packages')
|
||||
complete -c apt-get -s b -l build -d (_ 'Compile source packages')
|
||||
complete -c apt-get -l ignore-hold -d (_ 'Ignore package Holds')
|
||||
complete -c apt-get -l no-upgrade -d (_ "Do not upgrade packages")
|
||||
complete -c apt-get -l force-yes -d (_ 'Force yes')
|
||||
complete -c apt-get -l print-uris -d (_ 'Print the URIs')
|
||||
complete -c apt-get -l purge -d (_ 'Use purge instead of remove')
|
||||
complete -c apt-get -l reinstall -d (_ 'Reinstall packages')
|
||||
complete -c apt-get -l list-cleanup -d (_ 'Erase obsolete files')
|
||||
complete -c apt-get -s t -l target-release -d (_ 'Control default input to the policy engine')
|
||||
complete -c apt-get -l trivial-only -d (_ 'Only perform operations that are trivial')
|
||||
complete -c apt-get -l no-remove -d (_ 'Abort if any packages are to be removed')
|
||||
complete -c apt-get -l only-source -d (_ 'Only accept source packages')
|
||||
complete -c apt-get -l diff-only -d (_ 'Download only diff file')
|
||||
complete -c apt-get -l tar-only -d (_ 'Download only tar file')
|
||||
complete -c apt-get -l arch-only -d (_ 'Only process arch-dependant build-dependencies')
|
||||
complete -c apt-get -l allow-unauthenticated -d (_ 'Ignore non-authenticated packages')
|
||||
complete -c apt-get -s v -l version -d (_ 'Display version and exit')
|
||||
complete -r -c apt-get -s c -l config-file -d (_ 'Specify a config file')
|
||||
complete -r -c apt-get -s o -l option -d (_ 'Set a config option')
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
#apt-key
|
||||
complete -r -c apt-key -a add -d (_ "Add a new key")
|
||||
complete -f -c apt-key -a del -d (_ "Remove a key")
|
||||
complete -f -c apt-key -a list -d (_ "List trusted keys")
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
#apt-listbugs
|
||||
complete -c apt-listbugs -s h -l help -d (_ "Display help and exit")
|
||||
complete -f -c apt-listbugs -s s -l severity -a "critical grave" -d (_ "Set severity")
|
||||
complete -f -c apt-listbugs -s T -l tag -d (_ "Tags you want to see")
|
||||
complete -f -c apt-listbugs -s S -l stats -a "outstanding 'pending upload' resolved done open" -d (_ "Bug-status you want to see")
|
||||
complete -f -c apt-listbugs -s l -l showless -d (_ "Ignore bugs in your system")
|
||||
complete -f -c apt-listbugs -s g -l showgreater -d (_ "Ignore newer bugs than upgrade packages")
|
||||
complete -f -c apt-listbugs -s D -l show-downgrade -d (_ "Bugs for downgrade packages")
|
||||
complete -f -c apt-listbugs -s H -l hostname -a "osdn.debian.or.jp" -d (_ "Bug Tracking system")
|
||||
complete -f -c apt-listbugs -s p -l port -d (_ "Specify port for web interface")
|
||||
complete -f -c apt-listbugs -s R -l release-critical -d (_ "Use daily bug report")
|
||||
complete -f -c apt-listbugs -s I -l index -d (_ "Use the raw index.db")
|
||||
complete -f -c apt-listbugs -s X -l indexdir -d (_ "Specify index dir")
|
||||
complete -f -c apt-listbugs -s P -l pin-priority -d (_ "Specify Pin-Priority value")
|
||||
complete -f -c apt-listbugs -l title -d (_ "Specify the title of rss")
|
||||
complete -f -c apt-listbugs -s f -l force-download -d (_ "Retrieve fresh bugs")
|
||||
complete -f -c apt-listbugs -s q -l quiet -d (_ "Do not display progress bar")
|
||||
complete -f -c apt-listbugs -s c -l cache-dir -a "/var/cache/apt-listbugs/" -d (_ "Specify local cache dir")
|
||||
complete -f -c apt-listbugs -s t -l timer -d (_ "Specify the expire cache timer")
|
||||
complete -c apt-listbugs -s C -l aptconf -d (_ "Specify apt config file")
|
||||
complete -f -c apt-listbugs -s y -l force-yes -d (_ "Assume yes to all questions")
|
||||
complete -f -c apt-listbugs -s n -l force-no -d (_ "Assume no to all questions")
|
||||
complete -c apt-listbugs -a list -d (_ "List bugs from packages")
|
||||
complete -c apt-listbugs -a rss -d (_ "List bugs in rss format")
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#apt-listchanges
|
||||
complete -c apt-listchanges -l help -d (_ "Display help and exit")
|
||||
complete -c apt-listchanges -l apt -d (_ "Read filenames from pipe")
|
||||
complete -f -c apt-listchanges -s v -l verbose -d (_ "Verbose mode")
|
||||
complete -f -c apt-listchanges -s f -l frontend -a "pager browser xterm-pager xterm-browser text mail none" -d (_ "Select fronend interface")
|
||||
complete -r -f -c apt-listchanges -l email-address -d (_ "Specify email address")
|
||||
complete -f -c apt-listchanges -s c -l confirm -d (_ "Ask confirmation")
|
||||
complete -f -c apt-listchanges -s a -l all -d (_ "Display all changelogs")
|
||||
complete -r -c apt-listchanges -l save_seen -d (_ "Avoid changelogs from db in named file")
|
||||
complete -r -f -c apt-listchanges -l which -a "news changelogs both" -d (_ "Select display")
|
||||
complete -f -c apt-listchanges -s h -l headers -d (_ "Insert header")
|
||||
complete -f -c apt-listchanges -l debug -d (_ "Display debug info")
|
||||
complete -r -c apt-listchanges -l profile -d (_ "Select an option profile")
|
||||
@@ -1,22 +0,0 @@
|
||||
#apt-move
|
||||
complete -c apt-move -a get -d (_ "Generate master file")
|
||||
complete -c apt-move -a getlocal -d (_ "Alias for 'get'")
|
||||
complete -f -c apt-move -a move -d (_ "Move packages to local tree")
|
||||
complete -f -c apt-move -a delete -d (_ "Delete obsolete package files")
|
||||
complete -f -c apt-move -a packages -d (_ "Build new local files")
|
||||
complete -f -c apt-move -a fsck -d (_ "Rebuild index files")
|
||||
complete -f -c apt-move -a update -d (_ "Move packages from cache to local mirror")
|
||||
complete -f -c apt-move -a local -d (_ "Alias for 'move delete packages'")
|
||||
complete -f -c apt-move -a localupdate -d (_ "Alias for 'update'")
|
||||
complete -f -c apt-move -a mirror -d (_ "Download package missing from mirror")
|
||||
complete -f -c apt-move -a sync -d (_ "Sync packages installed")
|
||||
complete -f -c apt-move -a exclude -d 'test $LOCALDIR/.exclude file'
|
||||
complete -c apt-move -a movefile -d (_ "Move file specified on commandline")
|
||||
complete -f -c apt-move -a listbin -d (_ "List packags that may serve as input to mirrorbin or mirrorsource" )
|
||||
complete -f -c apt-move -a mirrorbin -d (_ "Fetch package from STDIN")
|
||||
complete -f -c apt-move -a mirrorsrc -d (_ "Fetch source package from STDIN")
|
||||
complete -f -c apt-move -s a -d (_ "Process all packages")
|
||||
complete -c apt-move -s c -d (_ "Use specific conffile")
|
||||
complete -f -c apt-move -s f -d (_ "Force deletion")
|
||||
complete -f -c apt-move -s q -d (_ "Suppresses normal output")
|
||||
complete -f -c apt-move -s t -d (_ "Test run")
|
||||
@@ -1,10 +0,0 @@
|
||||
#apt-proxy-import
|
||||
complete -c apt-proxy-import -s h -l help -d (_ 'Display help and exit')
|
||||
complete -f -c apt-proxy-import -s V -l version -d (_ 'Display version and exit')
|
||||
complete -f -c apt-proxy-import -s v -l verbose -d (_ 'Verbose mode')
|
||||
complete -f -c apt-proxy-import -s q -l quiet -d (_ 'No message to STDOUT')
|
||||
complete -f -c apt-proxy-import -s r -l recursive -d (_ 'Recurse into subdir')
|
||||
complete -r -c apt-proxy-import -s i -l import-dir -a '(ls -Fp|grep /$)' -d (_ 'Dir to import')
|
||||
complete -r -c apt-proxy-import -s u -l user -a '(__fish_complete_users)' -d (_ 'Change to user')
|
||||
complete -r -c apt-proxy-import -s d -l debug -d (_ 'Debug level[default 0]')
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#apt-rdepends
|
||||
complete -c apt-rdepends -l help -d (_ "Display help and exit")
|
||||
complete -f -c apt-rdepends -s b -l build-depends -d (_ "Show bulid dependencies")
|
||||
complete -f -c apt-rdepends -s d -l dotty -d (_ "Generate a dotty graph")
|
||||
complete -f -c apt-rdepends -s p -l print-state -d (_ "Show state of dependencies")
|
||||
complete -f -c apt-rdepends -s r -l reverse -d (_ "List packages depending on")
|
||||
complete -r -f -c apt-rdepends -s f -l follow -d (_ "Comma-separated list of dependancy types to follow recursively")
|
||||
complete -r -f -c apt-rdepends -s s -l show -d (_ "Comma-separated list of dependancy types to show")
|
||||
complete -r -f -c apt-rdepends -l state-follow -d (_ "Comma-separated list of package installation states to follow recursively")
|
||||
complete -r -f -c apt-rdepends -l state-show -d (_ "Comma-separated list of package installation states to show")
|
||||
complete -f -c apt-rdepends -l man -d (_ "Display man page")
|
||||
complete -f -c apt-rdepends -l version -d (_ "Display version and exit")
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
#apt-setup
|
||||
complete -c apt-setup -a probe -d (_ "Probe a CD")
|
||||
complete -c apt-setup -s N -d (_ "Run in noninteractive mode")
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
#apt-show-source
|
||||
complete -c apt-show-source -s h -l help -d (_ 'Display help and exit')
|
||||
complete -r -c apt-show-source -l status-file -d (_ 'Read package from file') -f
|
||||
complete -r -c apt-show-source -o stf -d (_ 'Read package from file') -f
|
||||
complete -r -c apt-show-source -l list-dir -a '(ls -Fp .|grep /$) /var/lib/apt/lists' -d (_ 'Specify APT list dir')
|
||||
complete -r -c apt-show-source -o ld -a '(ls -Fp .|grep /$) /var/lib/apt/lists' -d (_ 'Specify APT list dir')
|
||||
complete -r -c apt-show-source -s p -l package -a '(apt-cache pkgnames)' -d (_ 'List PKG info')
|
||||
complete -f -c apt-show-source -l version-only -d (_ 'Display version and exit')
|
||||
complete -f -c apt-show-source -s a -l all -d (_ 'Print all source packages with version')
|
||||
complete -f -c apt-show-source -s v -l verbose -d (_ 'Verbose mode')
|
||||
@@ -1,14 +0,0 @@
|
||||
#apt-show-versions
|
||||
complete -c apt-show-source -s h -l help -d (_ 'Display help and exit')
|
||||
complete -r -c apt-show-versions -s p -l packages -a '(apt-cache pkgnames)' -d (_ 'Print PKG versions')
|
||||
complete -f -c apt-show-versions -s r -l regex -d (_ 'Using regex')
|
||||
complete -f -c apt-show-versions -s u -l upgradeable -d (_ 'Print only upgradeable packages')
|
||||
complete -f -c apt-show-versions -s a -l allversions -d (_ 'Print all versions')
|
||||
complete -f -c apt-show-versions -s b -l brief -d (_ 'Print package name/distro')
|
||||
complete -f -c apt-show-versions -s v -l verbose -d (_ 'Print verbose info')
|
||||
complete -f -c apt-show-versions -s i -l initialize -d (_ 'Init or update cache only')
|
||||
complete -r -c apt-show-versions -l status-file -d (_ 'Read package from file')
|
||||
complete -r -c apt-show-versions -o stf -d (_ 'Read package from file')
|
||||
complete -r -c apt-show-versions -l list-dir -a '(ls -Fp .|grep /$) /var/lib/apt/lists /var/state/apt/lists' -d (_ 'Specify APT list dir')
|
||||
complete -r -c apt-show-versions -o ld -a '(ls -Fp .|grep /$) /var/lib/apt/lists /var/state/apt/lists' -d (_ 'Specify APT list dir')
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
#apt-sortpkgs
|
||||
complete -c apt-sortpkgs -s h -l help -d (_ "Display help and exit")
|
||||
complete -f -c apt-sortpkgs -s s -l source -d (_ "Use source index field")
|
||||
complete -f -c apt-sortpkgs -s v -l version -d (_ "Display version and exit")
|
||||
complete -r -c apt-sortpkgs -s c -l conf-file -d (_ "Specify conffile")
|
||||
complete -r -f -c apt-sortpkgs -s o -l option -d (_ "Set config options")
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
#apt-spy
|
||||
complete -c apt-spy -s h -d (_ "Display help and exit")
|
||||
complete -f -c apt-spy -s d -a "stable testing unstable" -d (_ "Debian distribtion")
|
||||
complete -f -c apt-spy -s a -a "Africa Asia Europe North-America Oceania South-America" -d (_ "Servers in the areas")
|
||||
complete -c apt-spy -s c -d (_ "Conf file")
|
||||
complete -f -c apt-spy -s e -d (_ "Finish after number of servers")
|
||||
complete -c apt-spy -s f -d (_ "File to grab servers")
|
||||
complete -c apt-spy -s i -d (_ "File as input")
|
||||
complete -c apt-spy -s m -d (_ "Mirror-list file")
|
||||
complete -c apt-spy -s o -d (_ "Output sources.list file")
|
||||
complete -f -c apt-spy -s p -d (_ "Use proxy server")
|
||||
complete -f -c apt-spy -s s -d (_ "Comma separated country list")
|
||||
complete -f -c apt-spy -s t -d (_ "How long in sec to download")
|
||||
complete -f -c apt-spy -s u -d (_ "Custom URL to get mirror list")
|
||||
complete -c apt-spy -s w -d (_ "Write top servers to file")
|
||||
complete -f -c apt-spy -s n -d (_ "Number of top servers")
|
||||
complete -f -c apt-spy -a "update" -d (_ "Update mirror list")
|
||||
complete -f -c apt-spy -s v -d (_ "Version number")
|
||||
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
#apt-src
|
||||
complete -c apt-src -s h -l help -d (_ "Display help and exit")
|
||||
complete -f -c apt-src -a "update" -d (_ "Update list of source packages")
|
||||
complete -f -c apt-src -a "install" -d (_ "Install source packages")
|
||||
complete -f -c apt-src -a "upgrade" -d (_ "Upgrade source packages")
|
||||
complete -f -c apt-src -a "remove" -d (_ "Remove source packages")
|
||||
complete -f -c apt-src -a "build" -d (_ "Build source packages")
|
||||
complete -f -c apt-src -a "clean" -d (_ "Clean source packages")
|
||||
complete -f -c apt-src -a "import" -d (_ "Detect known source tree")
|
||||
complete -f -c apt-src -a "list" -d (_ "List installed source package\(s\)")
|
||||
complete -f -c apt-src -a "location" -d (_ "Root source tree")
|
||||
complete -f -c apt-src -a "version" -d (_ "Version of source package")
|
||||
complete -f -c apt-src -a "name" -d (_ "Name of the source package")
|
||||
complete -f -c apt-src -s b -l build -d (_ "Build source packages")
|
||||
complete -f -c apt-src -s i -l installdebs -d (_ "Install after build")
|
||||
complete -f -c apt-src -s p -l patch -d (_ "Patch local changes")
|
||||
complete -r -c apt-src -s l -l location -d (_ "Specify a dir")
|
||||
complete -c apt-src -s c -l here -d (_ "Run on current dir")
|
||||
complete -f -c apt-src -l upstream-version -d (_ "Omit debian version")
|
||||
complete -f -c apt-src -s k -l keep-built -d (_ "Do not del built files")
|
||||
complete -f -c apt-src -s n -l no-delete-source -d (_ "Do not del source files")
|
||||
complete -f -c apt-src -l version -d (_ "Source tree version")
|
||||
complete -f -c apt-src -s q -l quiet -d (_ "Output to /dev/null")
|
||||
complete -f -c apt-src -s t -l trace -d (_ "Output trace")
|
||||
@@ -1,10 +0,0 @@
|
||||
#apt-zip-inst
|
||||
complete -c apt-zip-inst -s h -l help -d (_ "Display help and exit")
|
||||
complete -f -c apt-zip-inst -s V -l version -d (_ "Display version and exit")
|
||||
complete -c apt-zip-inst -s m -l medium -d (_ "Removable medium")
|
||||
complete -f -c apt-zip-inst -s a -l aptgetaction -a "dselect-upgrade upgrade dist-upgrade" -d (_ "Select an action")
|
||||
complete -c apt-zip-inst -s p -l packages -d (_ "List of packages to install")
|
||||
complete -f -c apt-zip-inst -s f -l fix-broken -d (_ "Fix broken option")
|
||||
complete -c apt-zip-inst -l skip-mount -d (_ "Specify a non-mountpoint dir")
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#apt-zip-list
|
||||
complete -c apt-zip-list -s h -l help -d (_ "Display help and exit")
|
||||
complete -f -c apt-zip-list -s V -l version -d (_ "Display version and exit")
|
||||
complete -c apt-zip-list -s m -l medium -d (_ "Removable medium")
|
||||
complete -f -c apt-zip-list -s a -l aptgetaction -a "dselect-upgrade upgrade dist-upgrade" -d (_ "Select an action")
|
||||
complete -c apt-zip-list -s p -l packages -d (_ "List of packages to install")
|
||||
complete -f -c apt-zip-list -s f -l fix-broken -d (_ "Fix broken option")
|
||||
complete -c apt-zip-list -l skip-mount -d (_ "Specify a non-mountpoint dir")
|
||||
complete -c apt-zip-list -s M -l method -d (_ "Select a method")
|
||||
complete -c apt-zip-list -s o -l options -a "tar restart" -d (_ "Specify options")
|
||||
complete -c apt-zip-list -s A -l accept -a "http ftp" -d (_ "Accept protocols")
|
||||
complete -c apt-zip-list -s R -l reject -a "http ftp" -d (_ "Reject protocols")
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
#completion for arp
|
||||
complete -c arp -s v -l verbose -d (_ "Verbose mode")
|
||||
complete -c arp -s n -l numeric -d (_ "Numerical address")
|
||||
complete -x -c arp -s H -l tw-type -a "ether arcnet pronet ax25 netrom" -d (_ "Class of hw type")
|
||||
complete -c arp -s a -l display -x -a "(__fish_print_hostnames)" -d (_ "Show arp entries")
|
||||
complete -x -c arp -s d -l delete -a "(__fish_print_hostnames)" -d (_ "Remove an entry for hostname")
|
||||
complete -c arp -s D -l use-device -d (_ "Use hardware address")
|
||||
complete -x -c arp -s i -l device -a "(__fish_print_interfaces)" -d (_ "Select interface")
|
||||
complete -x -c arp -s s -l set -d (_ "Manually create ARP address") -a "(__fish_print_hostnames)"
|
||||
complete -f -c arp -s f -l file -d (_ "Take addr from filename, default /etc/ethers")
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
#at
|
||||
complete -f -c at -s V -d (_ "Display version and exit")
|
||||
complete -f -c at -s q -d (_ "Use specified queue")
|
||||
complete -f -c at -s m -d (_ "Send mail to user")
|
||||
complete -c at -s f -x -a "(__fish_complete_suffix (commandline -ct) '' 'At job')" -d (_ "Read job from file")
|
||||
complete -f -c at -s l -d (_ "Alias for atq")
|
||||
complete -f -c at -s d -d (_ "Alias for atrm")
|
||||
complete -f -c at -s v -d (_ "Show the time")
|
||||
complete -f -c at -s c -d (_ "Print the jobs listed")
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#atd
|
||||
complete -f -c atd -s l -d (_ "Limiting load factor")
|
||||
complete -f -c atd -s b -d (_ "Minimum interval in seconds")
|
||||
complete -f -c atd -s d -d (_ "Debug mode")
|
||||
complete -f -c atd -s s -d (_ "Process at queue only once")
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
#atq
|
||||
complete -f -c atq -s V -d (_ "Display version and exit")
|
||||
complete -f -c atq -s q -d (_ "Use specified queue")
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
#atrm
|
||||
complete -f -c atrm -s V -d (_ "Display version and exit")
|
||||
@@ -1,9 +0,0 @@
|
||||
# Completions for the binary calculator
|
||||
|
||||
complete -c bc -s i -l interactive -d (_ "Force interactive mode")
|
||||
complete -c bc -s l -l math-lib -d (_ "Define math library")
|
||||
complete -c bc -s w -l warn -d (_ "Give warnings for extensions to POSIX bc")
|
||||
complete -c bc -s s -l standard -d (_ "Process exactly POSIX bc")
|
||||
complete -c bc -s q -l quiet -d (_ "Do not print the GNU welcome")
|
||||
complete -c bc -s v -l version -d (_ "Display version and exit")
|
||||
complete -c bc -s h -l help -d (_ "Display help and exit")
|
||||
@@ -1,2 +0,0 @@
|
||||
|
||||
complete -y btdownloadheadless.py
|
||||
@@ -1,33 +0,0 @@
|
||||
# Bittorrent commands
|
||||
|
||||
for i in btdownloadcurses.py btdownloadheadless.py;
|
||||
complete -c $i -l max_uploads -x -d (_ "Maximum uploads at once")
|
||||
complete -c $i -l keepalive_interval -x -d (_ "Number of seconds between keepalives")
|
||||
complete -c $i -l download_slice_size -x -d (_ "Bytes per request")
|
||||
complete -c $i -l request_backlog -x -d (_ "Requests per pipe")
|
||||
complete -c $i -l max_message_length -x -d (_ "Maximum length prefix encoding")
|
||||
complete -c $i -l ip -d (_ "IP to report to the tracker") -x -a "(__fish_print_addresses)"
|
||||
complete -c $i -l minport -d (_ "Minimum port to listen to")
|
||||
complete -c $i -l maxport -d (_ "Maximum port to listen to")
|
||||
complete -c $i -l responsefile -r -d (_ "File for server response")
|
||||
complete -c $i -l url -x -d (_ "URL to get file from")
|
||||
complete -c $i -l saveas -r -d (_ "Local file target")
|
||||
complete -c $i -l timeout -x -d (_ "Time to close inactive socket")
|
||||
complete -c $i -l timeout_check_interval -x -d (_ "Time between checking timeouts")
|
||||
complete -c $i -l max_slice_length -x -d (_ "Maximum outgoing slice length")
|
||||
complete -c $i -l max_rate_period -x -d (_ "Maximum time to guess rate")
|
||||
complete -c $i -l bind -x -d (_ "IP to bind to locally") -a "(__fish_print_addresses)"
|
||||
complete -c $i -l display_interval -x -d (_ "Time between screen updates")
|
||||
complete -c $i -l rerequest_interval -x -d (_ "Time to wait between requesting more peers")
|
||||
complete -c $i -l min_peers -x -d (_ "Minimum number of peers to not do requesting")
|
||||
complete -c $i -l http_timeout -x -d (_ "Number of seconds before assuming http timeout")
|
||||
complete -c $i -l max_initiate -x -d (_ "Number of peers at which to stop initiating new connections")
|
||||
complete -c $i -l max_allow_in -x -d (_ "Maximum number of connections to allow")
|
||||
complete -c $i -l check_hashes -x -d (_ "Whether to check hashes on disk")
|
||||
complete -c $i -l max_upload_rate -x -d (_ "Maximum kB/s to upload at")
|
||||
complete -c $i -l snub_time -x -d (_ "Seconds to wait for data to come in before assuming choking")
|
||||
complete -c $i -l spew -x -d (_ "Whether to display diagnostic info")
|
||||
complete -c $i -l rarest_first_cutoff -x -d (_ "Number of downloads at which to switch from random to rarest first")
|
||||
complete -c $i -l min_uploads -x -d (_ "Number of uploads to fill out to with optimistic unchokes")
|
||||
complete -c $i -l report_hash_failiures -x -d (_ "Whether to inform the user that hash failures occur")
|
||||
end;
|
||||
@@ -1,15 +0,0 @@
|
||||
complete -c bunzip2 -x -a "(
|
||||
__fish_complete_suffix (commandline -ct) .bz 'Compressed file'
|
||||
__fish_complete_suffix (commandline -ct) .bz2 'Compressed file'
|
||||
__fish_complete_suffix (commandline -ct) .tbz 'Compressed archive'
|
||||
__fish_complete_suffix (commandline -ct) .tbz2 'Compressed archive'
|
||||
)
|
||||
"
|
||||
|
||||
complete -c bunzip2 -s c -l stdout -d (_ "Decompress to stdout")
|
||||
complete -c bunzip2 -s f -l force -d (_ "Overwrite")
|
||||
complete -c bunzip2 -s k -l keep -d (_ "Do not overwrite")
|
||||
complete -c bunzip2 -s s -l small -d (_ "Reduce memory usage")
|
||||
complete -c bunzip2 -s v -l verbose -d (_ "Print compression ratios")
|
||||
complete -c bunzip2 -s L -l license -d (_ "Print license")
|
||||
complete -c bunzip2 -s V -l version -d (_ "Display version and exit")
|
||||
@@ -1,19 +0,0 @@
|
||||
complete -c bzip2 -s c -l stdout -d (_ "Compress to stdout")
|
||||
complete -c bzip2 -s d -l decompress -x -a "(
|
||||
__fish_complete_suffix (commandline -ct) .bz 'Compressed file'
|
||||
__fish_complete_suffix (commandline -ct) .bz2 'Compressed file'
|
||||
__fish_complete_suffix (commandline -ct) .tbz 'Compressed archive'
|
||||
__fish_complete_suffix (commandline -ct) .tbz2 'Compressed archive'
|
||||
)
|
||||
"
|
||||
complete -c bzip2 -s z -l compress -d (_ "Compress file")
|
||||
complete -c bzip2 -s t -l test -d (_ "Check integrity")
|
||||
complete -c bzip2 -s f -l force -d (_ "Overwrite")
|
||||
complete -c bzip2 -s k -l keep -d (_ "Do not overwrite")
|
||||
complete -c bzip2 -s s -l small -d (_ "Reduce memory usage")
|
||||
complete -c bzip2 -s q -l quiet -d (_ "Supress errors")
|
||||
complete -c bzip2 -s v -l verbose -d (_ "Print compression ratios")
|
||||
complete -c bzip2 -s L -l license -d (_ "Print license")
|
||||
complete -c bzip2 -s V -l version -d (_ "Display version and exit")
|
||||
complete -c bzip2 -s 1 -l fast -d (_ "Small block size")
|
||||
complete -c bzip2 -s 9 -l best -d (_ "Large block size")
|
||||
@@ -1,12 +0,0 @@
|
||||
complete -c cat -s A -l show-all -d (_ "Escape all non-printing characters")
|
||||
complete -c cat -s b -l number-nonblank -d (_ "Number nonblank lines")
|
||||
complete -c cat -s e -d (_ "Escape non-printing characters except tab")
|
||||
complete -c cat -s E -l show-ends -d (_ "Display \$ at end of line")
|
||||
complete -c cat -s n -l number -d (_ "Number all lines")
|
||||
complete -c cat -s s -l squeeze-blank -d (_ "Never more than single blank line")
|
||||
complete -c cat -s t -d (_ "Escape non-printing characters except newline")
|
||||
complete -c cat -s T -l show-tabs -d (_ "Escape tab")
|
||||
complete -c cat -s v -d (_ "Escape non-printing except newline and tab")
|
||||
complete -c cat -l help -d (_ "Display help and exit")
|
||||
complete -c cat -l version -d (_ "Display version and exit")
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
|
||||
complete -c chgrp -s c -l changes -d (_ "Output diagnostic for changed files")
|
||||
complete -c chgrp -l dereference -d (_ "Dereferense symbolic links")
|
||||
complete -c chgrp -s h -l no-dereference -d (_ "Do not dereference symbolic links")
|
||||
complete -c chgrp -l from -d (_ "Change from owner/group")
|
||||
complete -c chgrp -s f -l silent -d (_ "Supress errors")
|
||||
complete -c chgrp -l reference -d (_ "Use same owner/group as file") -r
|
||||
complete -c chgrp -s R -l recursive -d (_ "Operate recursively")
|
||||
complete -c chgrp -s v -l verbose -d (_ "Output diagnostic for every file")
|
||||
complete -c chgrp -s h -l help -d (_ "Display help and exit")
|
||||
complete -c chgrp -l version -d (_ "Display version and exit")
|
||||
complete -c chgrp -d Group -a "(__fish_complete_groups)"
|
||||
@@ -1,12 +0,0 @@
|
||||
complete -c chown -s c -l changes -d (_ "Output diagnostic for changed files")
|
||||
complete -c chown -l dereference -d (_ "Dereferense symbolic links")
|
||||
complete -c chown -s h -l no-dereference -d (_ "Do not dereference symbolic links")
|
||||
complete -c chown -l from -d (_ "Change from owner/group")
|
||||
complete -c chown -s f -l silent -d (_ "Supress errors")
|
||||
complete -c chown -l reference -d (_ "Use same owner/group as file") -r
|
||||
complete -c chown -s R -l recursive -d (_ "Operate recursively")
|
||||
complete -c chown -s v -l verbose -d (_ "Output diagnostic for every file")
|
||||
complete -c chown -s h -l help -d (_ "Display help and exit")
|
||||
complete -c chown -l version -d (_ "Display version and exit")
|
||||
complete -c chown -d (_ "Username") -a "(__fish_print_users):"
|
||||
complete -c chown -d (_ "Username") -a "(echo (commandline -ct)|grep -o '.*:')(cat /etc/group |cut -d : -f 1)"
|
||||
@@ -1,12 +0,0 @@
|
||||
complete -c commandline -s a -l append -d (_ "Add text to the end of the selected area")
|
||||
complete -c commandline -s i -l insert -d (_ "Add text at cursor")
|
||||
complete -c commandline -s r -l replace -d (_ "Replace selected part")
|
||||
|
||||
complete -c commandline -s j -l current-job -d (_ "Select job under cursor")
|
||||
complete -c commandline -s p -l current-process -d (_ "Select process under cursor")
|
||||
complete -c commandline -s t -l current-token -d (_ "Select token under cursor")
|
||||
complete -c commandline -s b -l current-buffer -d (_ "Select entire command line (default)")
|
||||
|
||||
complete -c commandline -s c -l cut-at-cursor -d (_ "Only return that part of the command line before the cursor")
|
||||
complete -c commandline -s f -l function -d (_ "Inject readline functions to reader")
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
complete -c complete -s c -l command -d (_ "Command to add completion to") -r
|
||||
complete -c complete -s p -l path -d (_ "Path to add completion to")
|
||||
complete -c complete -s s -l short-option -d (_ "Posix-style option to complete")
|
||||
complete -c complete -s l -l long-option -d (_ "GNU-style option to complete")
|
||||
complete -c complete -s o -l old-option -d (_ "Old style long option to complete")
|
||||
complete -c complete -s f -l no-files -d (_ "Do not use file completion")
|
||||
complete -c complete -s r -l require-parameter -d (_ "Require parameter")
|
||||
complete -c complete -s x -l exclusive -d (_ "Require parameter and do not use file completion")
|
||||
complete -c complete -s a -l arguments -d (_ "A list of possible arguments")
|
||||
complete -c complete -s d -l description -d (_ "Description of this completions")
|
||||
complete -c complete -s u -l unauthorative -d (_ "Option list is not complete")
|
||||
complete -c complete -s e -l erase -d (_ "Remove completion")
|
||||
complete -c complete -s h -l help -d (_ "Display help and exit")
|
||||
@@ -1,12 +0,0 @@
|
||||
complete -c configure -s h -l help -x -a "short recursive" -d (_ "Display help and exit")
|
||||
complete -c configure -s V -l version -d (_ "Display version and exit")
|
||||
complete -c configure -s q -l quiet -d (_ "Quiet mode")
|
||||
complete -c configure -l cache-file -f -d (_ "Cache test results in specified file")
|
||||
complete -c configure -s C -l config-cache -d (_ "Cache test results in file config.cache")
|
||||
complete -c configure -s n -l no-create -d (_ "Do not create output files")
|
||||
complete -c configure -l srcdir -d (_ "Set source directory") -a "__fish_complete_directory (commandline -ct)" -x
|
||||
complete -c configure -l prefix -d (_ "Architecture-independent install directory") -a "__fish_complete_directory (commandline -ct)" -x
|
||||
complete -c configure -l exec-prefix -d (_ "Architecture-dependent install directory") -a "__fish_complete_directory (commandline -ct)" -x
|
||||
complete -c configure -l build -d (_ "Configure for building on BUILD") -x
|
||||
complete -c configure -l host -d (_ "Cross-compile to build programs to run on HOST") -x
|
||||
complete -c configure -l target -d (_ "Configure for building compilers for TARGET") -x -u
|
||||
@@ -1,10 +0,0 @@
|
||||
complete -c cut -s b -l bytes -x -d (_ "Ouput byte range")
|
||||
complete -c cut -s c -l characters -x -d (_ "Output character range")
|
||||
complete -c cut -s d -l delimiter -x -d (_ "Select field delimiter")
|
||||
complete -c cut -s d -l fields -x -d (_ "Select fields")
|
||||
complete -c cut -s n -d (_ "Dont split mutibyte characters")
|
||||
complete -c cut -s s -l only-delimited -d (_ "Do not print lines without delimiter")
|
||||
complete -c cut -l output-delimiter -d (_ "Select output delimiter")
|
||||
complete -c cut -l help -d (_ "Display help and exit")
|
||||
complete -c cut -l version -d (_ "Display version and exit")
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
#
|
||||
# I don't use CVS, so these completions are probably not all that good.
|
||||
#
|
||||
|
||||
complete -c cvs -x -a 'add' -d (_ "Add a new file/directory to the repository")
|
||||
complete -c cvs -x -a 'admin' -d (_ "Administration front end for rcs")
|
||||
complete -c cvs -x -a 'annotate' -d (_ "Show last revision where each line was modified")
|
||||
complete -c cvs -x -a 'checkout' -d (_ "Checkout sources for editing")
|
||||
complete -c cvs -x -a 'commit' -d (_ "Check files into the repository")
|
||||
complete -c cvs -x -a 'diff' -d (_ "Show differences between revisions")
|
||||
complete -c cvs -x -a 'edit' -d (_ "Get ready to edit a watched file")
|
||||
complete -c cvs -x -a 'editors' -d (_ "See who is editing a watched file")
|
||||
complete -c cvs -x -a 'export' -d (_ "Export sources from CVS, similar to checkout")
|
||||
complete -c cvs -x -a 'history' -d (_ "Show repository access history")
|
||||
complete -c cvs -x -a 'import' -d (_ "Import sources into CVS, using vendor branches")
|
||||
complete -c cvs -x -a 'init' -d (_ "Create a CVS repository if it doesnt exist")
|
||||
complete -c cvs -x -a 'kserver' -d (_ "Kerberos server mode")
|
||||
complete -c cvs -x -a 'log' -d (_ "Print out history information for files")
|
||||
complete -c cvs -x -a 'login' -d (_ "Prompt for password for authenticating server")
|
||||
complete -c cvs -x -a 'logout' -d (_ "Removes entry in .cvspass for remote repository")
|
||||
complete -c cvs -x -a 'pserver' -d (_ "Password server mode")
|
||||
complete -c cvs -x -a 'rannotate' -d (_ "Show last revision where each line of module was modified")
|
||||
complete -c cvs -x -a 'rdiff' -d (_ "Create "patch" format diffs between releases")
|
||||
complete -c cvs -x -a 'release' -d (_ "Indicate that a Module is no longer in use")
|
||||
complete -c cvs -x -a 'remove' -d (_ "Remove an entry from the repository")
|
||||
complete -c cvs -x -a 'rlog' -d (_ "Print out history information for a module")
|
||||
complete -c cvs -x -a 'rtag' -d (_ "Add a symbolic tag to a module")
|
||||
complete -c cvs -x -a 'server' -d (_ "Server mode")
|
||||
complete -c cvs -x -a 'status' -d (_ "Display status information on checked out files")
|
||||
complete -c cvs -x -a 'tag' -d (_ "Add a symbolic tag to checked out version of files")
|
||||
complete -c cvs -x -a 'unedit' -d (_ "Undo an edit command")
|
||||
complete -c cvs -x -a 'update' -d (_ "Bring work tree in sync with repository")
|
||||
complete -c cvs -x -a 'version' -d (_ "Display version and exit")
|
||||
complete -c cvs -x -a 'watch' -d (_ "Set watches")
|
||||
complete -c cvs -x -a 'watchers' -d (_ "See who is watching a file")
|
||||
|
||||
complete -c cvs -x -s H -d (_ "Displays usage information for command")
|
||||
complete -c cvs -x -s Q -d (_ "Cause CVS to be really quiet")
|
||||
complete -c cvs -x -s q -d (_ "Cause CVS to be somewhat quiet")
|
||||
complete -c cvs -x -s r -d (_ "Make checked-out files read-only")
|
||||
complete -c cvs -x -s w -d (_ "Make checked-out files read-write (default)")
|
||||
complete -c cvs -x -s n -d (_ "Do not execute anything that will change the disk")
|
||||
complete -c cvs -x -s t -d (_ "Show trace of program execution -- try with -n")
|
||||
complete -c cvs -x -s v -d (_ "Display version and exit")
|
||||
complete -c cvs -x -s T -r -d (_ "Use "tmpdir" for temporary files")
|
||||
complete -c cvs -x -s e -r -d (_ "Use "editor" for editing log information")
|
||||
complete -c cvs -x -s d -r -d (_ "Overrides $CVSROOT as the root of the CVS tree")
|
||||
complete -c cvs -x -s f -d (_ "Do not use the ~/.cvsrc file")
|
||||
complete -c cvs -x -s z -d (_ "Compression level for net traffic") -x -a '1 2 3 4 5 6 7 8 9'
|
||||
complete -c cvs -x -s x -d (_ "Encrypt all net traffic")
|
||||
complete -c cvs -x -s a -d (_ "Authenticate all net traffic")
|
||||
complete -c cvs -x -s s -d (_ "Set CVS user variable") -x
|
||||
|
||||
@@ -1,236 +0,0 @@
|
||||
#
|
||||
# Completions for the darcs VCS command
|
||||
#
|
||||
# Incomplete, the number of switches for darcs is _huge_
|
||||
#
|
||||
|
||||
#
|
||||
# Test if a non-switch argument has been given
|
||||
#
|
||||
|
||||
function __fish_use_subcommand
|
||||
set -l -- cmd (commandline -poc)
|
||||
set -e cmd[1]
|
||||
for i in $cmd
|
||||
switch $i
|
||||
case '-*'
|
||||
continue
|
||||
end
|
||||
return 1
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
#
|
||||
# If no subcommand has been specified, complete using all available subcommands
|
||||
#
|
||||
|
||||
complete -c darcs -n '__fish_use_subcommand' -xa 'initialize\t"'(_ "Create new project")'"'
|
||||
complete -c darcs -n '__fish_use_subcommand' -xa 'get\t"'(_ "Create a local copy of another repository")'"'
|
||||
complete -c darcs -n '__fish_use_subcommand' -xa 'add\t"'(_ "Add one or more new files or directories")'"'
|
||||
complete -c darcs -n '__fish_use_subcommand' -xa 'remove\t"'(_ "Remove one or more files or directories from the repository")'"'
|
||||
complete -c darcs -n '__fish_use_subcommand' -xa 'mv\t"'(_ "Move/rename one or more files or directories")'"'
|
||||
complete -c darcs -n '__fish_use_subcommand' -xa 'replace\t"'(_ "Replace a token with a new value for that token")'"'
|
||||
complete -c darcs -n '__fish_use_subcommand' -xa 'record\t"'(_ "Save changes in the working copy to the repository as a patch")'"'
|
||||
complete -c darcs -n '__fish_use_subcommand' -xa 'pull\t"'(_ "Copy and apply patches from another repository to this one")'"'
|
||||
complete -c darcs -n '__fish_use_subcommand' -xa 'send\t"'(_ "Send by email a bundle of one or more patches")'"'
|
||||
complete -c darcs -n '__fish_use_subcommand' -xa 'apply\t"'(_ "Apply patches (from an email bundle) to the repository")'"'
|
||||
complete -c darcs -n '__fish_use_subcommand' -xa 'push\t"'(_ "Copy and apply patches from this repository to another one")'"'
|
||||
complete -c darcs -n '__fish_use_subcommand' -xa 'whatsnew\t"'(_ "Display unrecorded changes in the working copy")'"'
|
||||
complete -c darcs -n '__fish_use_subcommand' -xa 'changes\t"'(_ "Gives a changelog style summary of the repo history")'"'
|
||||
complete -c darcs -n '__fish_use_subcommand' -xa 'unrecord\t"'(_ "Remove recorded patches without changing the working copy")'"'
|
||||
complete -c darcs -n '__fish_use_subcommand' -xa 'amend-record\t"'(_ "Replace a recorded patch with a better version")'"'
|
||||
complete -c darcs -n '__fish_use_subcommand' -xa 'revert\t"'(_ "Revert to the recorded version (safe the first time only)" )'"'
|
||||
complete -c darcs -n '__fish_use_subcommand' -xa 'unrevert\t"'(_ "Undo the last revert (may fail if changes after the revert)")'"'
|
||||
complete -c darcs -n '__fish_use_subcommand' -xa 'unpull\t"'(_ "Opposite of pull; unsafe if the patch is not in remote repo")'"'
|
||||
complete -c darcs -n '__fish_use_subcommand' -xa 'rollback\t"'(_ "Record an inverse patch without changing the working copy" )'"'
|
||||
complete -c darcs -n '__fish_use_subcommand' -xa 'tag\t"'(_ "Tag the contents of the repository with a version name")'"'
|
||||
complete -c darcs -n '__fish_use_subcommand' -xa 'setpref\t"'(_ "Set a value for a preference (test, predist, ...)")'"'
|
||||
complete -c darcs -n '__fish_use_subcommand' -xa 'diff\t"'(_ "Create a diff between two versions of the repository")'"'
|
||||
complete -c darcs -n '__fish_use_subcommand' -xa 'annotate\t"'(_ "Display which patch last modified something")'"'
|
||||
complete -c darcs -n '__fish_use_subcommand' -xa 'optimize\t"'(_ "Optimize the repository")'"'
|
||||
complete -c darcs -n '__fish_use_subcommand' -xa 'check\t"'(_ "Check the repository for consistency")'"'
|
||||
complete -c darcs -n '__fish_use_subcommand' -xa 'resolve\t"'(_ "Mark any conflicts to the working copy for manual resolution")'"'
|
||||
complete -c darcs -n '__fish_use_subcommand' -xa 'dist\t"'(_ "Create a distribution tarball")'"'
|
||||
complete -c darcs -n '__fish_use_subcommand' -xa 'trackdown\t"'(_ "Locate the most recent version lacking an error")'"'
|
||||
complete -c darcs -n '__fish_use_subcommand' -xa 'repair\t"'(_ "Repair the corrupted repository")'"'
|
||||
|
||||
#
|
||||
# These switches are universal
|
||||
#
|
||||
complete -c darcs -s h -l help -d (_ "Shows brief description of command and its arguments")
|
||||
complete -c darcs -l disable -d (_ "Disable this command")
|
||||
complete -c darcs -l repodir -d (_ "Specify the repository directory in which to run") -x -a '(__fish_complete_directory (commandline -ct))'
|
||||
complete -c darcs -s v -l verbose -d (_ "Verbose mode")
|
||||
complete -c darcs -l standard-verbosity -d (_ "Neither verbose nor quiet output")
|
||||
|
||||
#
|
||||
# Here follows a huge list of subcommand-specific completions. These are incomplete.
|
||||
#
|
||||
|
||||
set -l record_opt -c darcs -n 'contains record (commandline -poc)'
|
||||
complete $record_opt -s m -l patch-name -d (_ "Name of patch") -x
|
||||
complete $record_opt -s A -l author -d (_ "Specify author id") -x
|
||||
complete $record_opt -l logfile -d (_ "Give patch name and comment in file") -r
|
||||
complete $record_opt -s a -l all -d (_ "Answer yes to all patches")
|
||||
complete $record_opt -s l -l look-for-adds -d (_ "In addition to modifications, look for files that are not boring, and thus are potentially pending addition")
|
||||
complete $record_opt -l delete-logfile -d (_ "Delete the logfile when done")
|
||||
complete $record_opt -l no-test -d (_ "Don't run the test script")
|
||||
complete $record_opt -l test -d (_ "Run the test script")
|
||||
complete $record_opt -l leave-test-directory -d (_ "Don't remove the test directory")
|
||||
complete $record_opt -l remove-test-directory -d (_ "Remove the test directory")
|
||||
complete $record_opt -l compress -d (_ "Create compressed patches")
|
||||
complete $record_opt -l dont-compress -d (_ "Don't create compressed patches")
|
||||
complete $record_opt -l pipe -d (_ "Expect to receive input from a pipe")
|
||||
complete $record_opt -l interactive -d (_ "Prompt user interactively")
|
||||
complete $record_opt -l ask-deps -d (_ "Ask for extra dependencies")
|
||||
complete $record_opt -l no-ask-deps -d (_ "Don't ask for extra dependencies")
|
||||
complete $record_opt -l edit-long-comment -d (_ "Edit the long comment by default")
|
||||
complete $record_opt -l skip-long-comment -d (_ "Don't give a long comment")
|
||||
complete $record_opt -l prompt-long-comment -d (_ "Prompt for whether to edit the long comment")
|
||||
complete $record_opt -l ignore-times -d (_ "Don't trust the file modification times")
|
||||
complete $record_opt -l dont-look-for-adds -d (_ "Don't look for any files or directories that could be added, and don't add them automatically")
|
||||
|
||||
|
||||
set -l pull_opt -c darcs -n 'contains pull (commandline -poc)'
|
||||
complete $pull_opt -s p -l patches -d (_ "Select patches matching REGEXP") -x
|
||||
complete $pull_opt -s t -l tags -d (_ "Select tags matching REGEXP") -x
|
||||
complete $pull_opt -s a -l all -d (_ "Answer yes to all patches")
|
||||
complete $pull_opt -s s -l summary -d (_ "Summarize changes")
|
||||
complete $pull_opt -s q -l quiet -d (_ "Suppress informational output")
|
||||
complete $pull_opt -l matches -d (_ "Select patches matching PATTERN") -x
|
||||
complete $pull_opt -l external-merge -d (_ "Use external tool to merge conflicts") -x
|
||||
complete $pull_opt -l interactive -d (_ "Prompt user interactively")
|
||||
complete $pull_opt -l compress -d (_ "Create compressed patches")
|
||||
complete $pull_opt -l dont-compress -d (_ "Don't create compressed patches")
|
||||
complete $pull_opt -l test -d (_ "Run the test script")
|
||||
complete $pull_opt -l no-test -d (_ "Don't run the test script")
|
||||
complete $pull_opt -l dry-run -d (_ "Don't actually take the action")
|
||||
complete $pull_opt -l no-summary -d (_ "Don't summarize changes")
|
||||
complete $pull_opt -l ignore-times -d (_ "Don't trust the file modification times")
|
||||
complete $pull_opt -l no-deps -d (_ "Don't automatically fulfill dependencies")
|
||||
complete $pull_opt -l set-default -d (_ "Set default repository [DEFAULT]")
|
||||
complete $pull_opt -l no-set-default -d (_ "Don't set default repository")
|
||||
complete $pull_opt -l set-scripts-executable -d (_ "Make scripts executable")
|
||||
complete $pull_opt -l dont-set-scripts-executable -d (_ "Don't make scripts executable")
|
||||
|
||||
|
||||
set -l apply_opt -c darcs -n 'contains apply (commandline -poc)'
|
||||
complete $apply_opt -s a -l all -d (_ "Answer yes to all patches")
|
||||
complete $apply_opt -l verify -d (_ "Verify that the patch was signed by a key in PUBRING") -r
|
||||
complete $apply_opt -l verify-ssl -d (_ "Verify using openSSL with authorized keys from specified file") -r
|
||||
complete $apply_opt -l sendmail-command -d (_ "Specify sendmail command") -r
|
||||
complete $apply_opt -l reply -d (_ "Reply to email-based patch using FROM address") -x
|
||||
complete $apply_opt -l cc -d (_ "Mail results to additional EMAIL(s). Requires --reply") -x
|
||||
complete $apply_opt -l external-merge -d (_ "Use external tool to merge conflicts") -r
|
||||
complete $apply_opt -l no-verify -d (_ "Don't verify patch signature")
|
||||
complete $apply_opt -l ignore-times -d (_ "Don't trust the file modification times")
|
||||
complete $apply_opt -l compress -d (_ "Create compressed patches")
|
||||
complete $apply_opt -l dont-compress -d (_ "Don't create compressed patches")
|
||||
complete $apply_opt -l interactive -d (_ "Prompt user interactively")
|
||||
complete $apply_opt -l mark-conflicts -d (_ "Mark conflicts")
|
||||
complete $apply_opt -l allow-conflicts -d (_ "Allow conflicts, but don't mark them")
|
||||
complete $apply_opt -l dont-allow-conflicts -d (_ "Fail on patches that create conflicts [DEFAULT]")
|
||||
complete $apply_opt -l no-test -d (_ "Don't run the test script")
|
||||
complete $apply_opt -l test -d (_ "Run the test script")
|
||||
complete $apply_opt -l happy-forwarding -d (_ "Forward unsigned messages without extra header")
|
||||
complete $apply_opt -l leave-test-directory -d (_ "Don't remove the test directory")
|
||||
complete $apply_opt -l remove-test-directory -d (_ "Remove the test directory")
|
||||
complete $apply_opt -l set-scripts-executable -d (_ "Make scripts executable")
|
||||
complete $apply_opt -l dont-set-scripts-executable -d (_ "Don't make scripts executable")
|
||||
|
||||
|
||||
set -l check_opt -c darcs -n 'contains check (commandline -poc)'
|
||||
complete $check_opt -s v -l verbose -d (_ "Verbose mode")
|
||||
complete $check_opt -s q -l quiet -d (_ "Suppress informational output")
|
||||
complete $check_opt -l complete -d (_ "Check the entire repository")
|
||||
complete $check_opt -l partial -d (_ "Check patches since latest checkpoint")
|
||||
complete $check_opt -l no-test -d (_ "Don't run the test script")
|
||||
complete $check_opt -l test -d (_ "Run the test script")
|
||||
complete $check_opt -l leave-test-directory -d (_ "Don't remove the test directory")
|
||||
complete $check_opt -l remove-test-directory -d (_ "Remove the test directory")
|
||||
|
||||
|
||||
set -l mv_opt -c darcs -n 'contains mv (commandline -poc)'
|
||||
complete $mv_opt -s v -l verbose -d (_ "Verbose mode")
|
||||
complete $mv_opt -l case-ok -d (_ "Don't refuse to add files differing only in case")
|
||||
|
||||
|
||||
set -l send_opt -c darcs -n 'contains send (commandline -poc)'
|
||||
complete $send_opt -s v -l verbose -d (_ "Verbose mode")
|
||||
complete $send_opt -s q -l quiet -d (_ "Suppress informational output")
|
||||
complete $send_opt -xs p -l patches -d (_ "Select patches matching REGEXP")
|
||||
complete $send_opt -xs t -l tags -d (_ "Select tags matching REGEXP")
|
||||
complete $send_opt -s a -l all -d (_ "Answer yes to all patches")
|
||||
complete $send_opt -xs A -l author -d (_ "Specify author id")
|
||||
complete $send_opt -rs o -l output -d (_ "Specify output filename")
|
||||
complete $send_opt -s u -l unified -d (_ "Output patch in a darcs-specific format similar to diff -u")
|
||||
complete $send_opt -s s -l summary -d (_ "Summarize changes")
|
||||
complete $send_opt -xl matches -d (_ "Select patches matching PATTERN")
|
||||
complete $send_opt -l interactive -d (_ "Prompt user interactively")
|
||||
complete $send_opt -xl from -d (_ "Specify email address")
|
||||
complete $send_opt -xl to -d (_ "Specify destination email")
|
||||
complete $send_opt -xl cc -d (_ "Mail results to additional EMAIL(s). Requires --reply")
|
||||
complete $send_opt -l sign -d (_ "Sign the patch with your gpg key")
|
||||
complete $send_opt -xl sign-as -d (_ "Sign the patch with a given keyid")
|
||||
complete $send_opt -rl sign-ssl -d (_ "Sign the patch using openssl with a given private key")
|
||||
complete $send_opt -l dont-sign -d (_ "Do not sign the patch")
|
||||
complete $send_opt -l dry-run -d (_ "Don't actually take the action")
|
||||
complete $send_opt -l no-summary -d (_ "Don't summarize changes")
|
||||
complete $send_opt -rl context -d (_ "Send to context stored in FILENAME")
|
||||
complete $send_opt -l edit-description -d (_ "Edit the patch bundle description")
|
||||
complete $send_opt -l set-default -d (_ "Set default repository [DEFAULT]")
|
||||
complete $send_opt -l no-set-default -d (_ "Don't set default repository")
|
||||
complete $send_opt -rl sendmail-command -d (_ "Specify sendmail command")
|
||||
|
||||
|
||||
set -l init_opt -c darcs -n 'contains initialize (commandline -poc)'
|
||||
complete $init_opt -l plain-pristine-tree -d (_ "Use a plain pristine tree [DEFAULT]")
|
||||
complete $init_opt -l no-pristine-tree -d (_ "Use no pristine tree")
|
||||
|
||||
|
||||
set -l annotate_opt -c darcs -n 'contains annotate (commandline -poc)'
|
||||
complete $annotate_opt -s s -l summary -d (_ "Summarize changes")
|
||||
complete $annotate_opt -l no-summary -d (_ "Don't summarize changes")
|
||||
complete $annotate_opt -s u -l unified -d (_ "Output patch in a darcs-specific format similar to diff -u")
|
||||
complete $annotate_opt -l human-readable -d (_ "Give human readable output")
|
||||
complete $annotate_opt -l xml-output -d (_ "Generate XML formatted output")
|
||||
complete $annotate_opt -l match -x -d (_ "Select patch matching PATTERN")
|
||||
complete $annotate_opt -s p -l patch -x -d (_ "Select patch matching REGEXP")
|
||||
complete $annotate_opt -s t -l tag -x -d (_ "Select tag matching REGEXP")
|
||||
complete $annotate_opt -l creator-hash -x -d (_ "Specify hash of creator patch (see docs)")
|
||||
|
||||
|
||||
set -l changes_opt -c darcs -n 'contains changes (commandline -poc)'
|
||||
complete $changes_opt -l to-match -x -d (_ "Select changes up to a patch matching PATTERN")
|
||||
complete $changes_opt -l to-patch -x -d (_ "Select changes up to a patch matching REGEXP")
|
||||
complete $changes_opt -l to-tag -x -d (_ "Select changes up to a tag matching REGEXP")
|
||||
complete $changes_opt -l from-match -x -d (_ "Select changes starting with a patch matching PATTERN")
|
||||
complete $changes_opt -l from-patch -x -d (_ "Select changes starting with a patch matching REGEXP")
|
||||
complete $changes_opt -l from-tag -x -d (_ "Select changes starting with a tag matching REGEXP")
|
||||
complete $changes_opt -l last -x -d (_ "Select the last NUMBER patches")
|
||||
complete $changes_opt -l matches -x -d (_ "Select patches matching PATTERN")
|
||||
complete $changes_opt -s p -l patches -x -d (_ "Select patches matching REGEXP")
|
||||
complete $changes_opt -s t -l tags -x -d (_ "Select tags matching REGEXP")
|
||||
complete $changes_opt -l context -d (_ "Give output suitable for get --context")
|
||||
complete $changes_opt -l xml-output -d (_ "Generate XML formatted output")
|
||||
complete $changes_opt -l human-readable -d (_ "Give human-readable output")
|
||||
complete $changes_opt -s s -l summary -d (_ "Summarize changes")
|
||||
complete $changes_opt -l no-summary -d (_ "Don't summarize changes")
|
||||
complete $changes_opt -s q -l quiet -d (_ "Suppress informational output")
|
||||
complete $changes_opt -l reverse -d (_ "Show changes in reverse order")
|
||||
complete $changes_opt -l repo -x -d (_ "Specify the repository URL")
|
||||
|
||||
|
||||
set -l add_opt -c darcs -n 'contains add (commandline -poc)'
|
||||
complete $add_opt -l boring -d (_ "Don't skip boring files")
|
||||
complete $add_opt -l case-ok -d (_ "Don't refuse to add files differing only in case")
|
||||
complete $add_opt -s r -l recursive -d (_ "Add contents of subdirectories")
|
||||
complete $add_opt -l not-recursive -d (_ "Don't add contents of subdirectories")
|
||||
complete $add_opt -l date-trick -d (_ "Add files with date appended to avoid conflict. [EXPERIMENTAL]")
|
||||
complete $add_opt -l no-date-trick -d (_ "Don't use experimental date appending trick. [DEFAULT]")
|
||||
complete $add_opt -s q -l quiet -d (_ "Suppress informational output")
|
||||
complete $add_opt -l dry-run -d (_ "Don't actually take the action")
|
||||
complete $add_opt -s q -l quiet -d (_ "Suppress informational output")
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
complete -c date -s d -l date -d (_ "Display date described by string") -x
|
||||
complete -c date -s f -l file -d (_ "Display date for each line in file") -r
|
||||
complete -c date -s I -l iso-8601 -d (_ "Output in ISO 8601 format") -x -a "date hours minutes seconds"
|
||||
complete -c date -s s -l set -d (_ "Set time") -x
|
||||
complete -c date -s R -l rfc-2822 -d (_ "Output RFC-2822 compliant date string")
|
||||
complete -c date -s r -l reference -d (_ "Display the last modification time of file") -r
|
||||
complete -c date -s u -l utc -d (_ "Print or set Coordinated Universal Time")
|
||||
complete -c date -l universal -d (_ "Print or set Coordinated Universal Time")
|
||||
complete -c date -s h -l help -d (_ "Display help and exit")
|
||||
complete -c date -s v -l version -d (_ "Display version and exit")
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
#
|
||||
# Completions for df
|
||||
#
|
||||
|
||||
#
|
||||
# Completions for mount define the $__fish_filesystems variable
|
||||
#
|
||||
complete -y mount
|
||||
|
||||
#
|
||||
# Test if we are using GNU sed
|
||||
#
|
||||
|
||||
set -l is_gnu
|
||||
df --version >/dev/null ^/dev/null; and set is_gnu --is-gnu
|
||||
|
||||
__fish_gnu_complete -c df -s h -l human-readable -d (_ "Human readable sizes") $is_gnu
|
||||
__fish_gnu_complete -c df -s i -l inodes -d (_ "List inode information") $is_gnu
|
||||
__fish_gnu_complete -c df -s k -d (_ "Use 1kB block size") $is_gnu
|
||||
__fish_gnu_complete -c df -s l -l local -d (_ "List only local filesystems") $is_gnu
|
||||
__fish_gnu_complete -c df -s P -l portability -d (_ "Use Posix format") $is_gnu
|
||||
__fish_gnu_complete -c df -s t -l type -r -d (_ "Show filesystems of specified type") $is_gnu -x -a $__fish_filesystems
|
||||
|
||||
if test -n "$is_gnu"
|
||||
|
||||
complete -c df -s a -l all -d (_ "Include empty filesystems")
|
||||
complete -c df -s B -l block-size -r -d (_ "Block size")
|
||||
complete -c df -s H -l si -d (_ "Human readable sizes, powers of 1000")
|
||||
complete -c df -l no-sync -d (_ "Do not sync before getting usage info")
|
||||
complete -c df -l sync -d (_ "Sync before getting usage info")
|
||||
complete -c df -s T -l print-type -d (_ "Print filesystem type")
|
||||
complete -c df -s x -l exclude-type -d (_ "Excluded filesystem type") -r -x -a $__fish_filesystems
|
||||
complete -c df -l help -d (_ "Display help and exit")
|
||||
complete -c df -l version -d (_ "Display version and exit")
|
||||
|
||||
else
|
||||
|
||||
complete -c df -s a -d (_ "Show all filesystems")
|
||||
complete -c df -s g -d (_ "Show sizes in gigabytes")
|
||||
complete -c df -s m -d (_ "Show sizes in megabytes")
|
||||
complete -c df -s n -d (_ "Print out the previously obtained statistics from the file systems")
|
||||
|
||||
end
|
||||
@@ -1,26 +0,0 @@
|
||||
# Completions for diff
|
||||
complete -c diff -s i -l ignore-case -d (_ "Ignore case differences")
|
||||
complete -c diff -l ignore-file-name-case -d (_ "Ignore case when comparing file names")
|
||||
complete -c diff -l no-ignore-file-name-case -d (_ "Consider case when comparing file names")
|
||||
complete -c diff -s E -l ignore-tab-expansion -d (_ "Ignore changes due to tab expansion")
|
||||
complete -c diff -s b -l ignore-space-change -d (_ "Ignore changes in the amount of white space")
|
||||
complete -c diff -s w -l ignore-all-space -d (_ "Ignore all white space")
|
||||
complete -c diff -s B -l ignore-blank-lines -d (_ "Ignore changes whose lines are all blank")
|
||||
complete -c diff -s I -l ignore-matching-lines -x -d (_ "Ignore changes whose lines match the REGEX")
|
||||
complete -c diff -s a -l text -d (_ "Treat all files as text")
|
||||
complete -c diff -s r -l recursive -d (_ "Recursively compare subdirectories")
|
||||
complete -c diff -s N -l new-file -d (_ "Treat absent files as empty")
|
||||
complete -c diff -s C -l context -x -d (_ "Output NUM lines of copied context")
|
||||
complete -c diff -s c -d (_ "Output 3 lines of copied context")
|
||||
complete -c diff -s U -l unified -x -d (_ "Output NUM lines of unified context")
|
||||
complete -c diff -s u -d (_ "Output 3 lines of unified context")
|
||||
complete -c diff -s q -l brief -d (_ "Output only whether the files differ")
|
||||
complete -c diff -l normal -d (_ "Output a normal diff")
|
||||
complete -c diff -s y -l side-by-side -d (_ "Output in two columns")
|
||||
complete -c diff -s W -l width -x -d (_ "Output at most NUM print columns")
|
||||
complete -c diff -s d -l minimal -d (_ "Try to find a smaller set of changes")
|
||||
complete -c diff -l from-file -r -d (_ "Compare FILE1 to all operands")
|
||||
complete -c diff -l to-file -r -d (_ "Compare FILE2 to all operands")
|
||||
complete -c diff -s l -l paginate -d (_ "Pass the output through 'pr'")
|
||||
complete -c diff -s v -l version -d (_ "Display version and exit")
|
||||
complete -c diff -l help -d (_ "Display help and exit")
|
||||
@@ -1,20 +0,0 @@
|
||||
complete -c du -s a -l all -d (_ "Write size for all files")
|
||||
complete -c du -l apparent-size -d (_ "Print file size, not disk usage")
|
||||
complete -c du -s B -l block-size -d (_ "Block size")
|
||||
complete -c du -s b -l bytes -d (_ "Use 1B block size")
|
||||
complete -c du -s c -l total -d (_ "Produce grand total")
|
||||
complete -c du -s D -l dereference-args -d (_ "Dereference file symlinks")
|
||||
complete -c du -s h -l human-readable -d (_ "Human readable sizes")
|
||||
complete -c du -s H -l si -d (_ "Human readable sizes, powers of 1000")
|
||||
complete -c du -s k -d (_ "Use 1kB block size")
|
||||
complete -c du -s l -l count-links -d (_ "Count hard links multiple times")
|
||||
complete -c du -s L -l dereference -d (_ "Dereference all symlinks")
|
||||
complete -c du -s S -l separate-dirs -d (_ "Do not include subdirectory size")
|
||||
complete -c du -s s -l summarize -d (_ "Display only a total for each argument")
|
||||
complete -c du -s x -l one-file-system -d (_ "Skip other filesystems")
|
||||
complete -c du -s X -l exclude-from -r -d (_ "Exclude files thet match pattern in file")
|
||||
complete -c du -l exclude -r -d (_ "Exclude files that match pattern")
|
||||
complete -c du -l max-depth -r -d (_ "Recursion limit")
|
||||
complete -c du -l help -d (_ "Display help and exit")
|
||||
complete -c du -l version -d (_ "Display version and exit")
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
complete -c echo -s n -d (_ "No newline")
|
||||
complete -c echo -s e -d (_ "Use backslash escaped characters")
|
||||
complete -c echo -s E -d (_ "Do not use backslash escaped characters")
|
||||
complete -c echo -l help -d (_ "Display help and exit")
|
||||
complete -c echo -l version -d (_ "Display version and exit")
|
||||
@@ -1 +0,0 @@
|
||||
complete -y tex
|
||||
@@ -1,10 +0,0 @@
|
||||
#
|
||||
# These completions are uncomplete
|
||||
#
|
||||
complete -c emacs -s q -d (_ "Do not load init files")
|
||||
complete -c emacs -s u -d (_ "Load users init file") -xa "(__fish_complete_users)"
|
||||
complete -c emacs -s t -d (_ "Use file as terminal") -r
|
||||
complete -c emacs -s f -d (_ "Execute Lisp function") -x
|
||||
complete -c emacs -s l -d (_ "Load Lisp code from file") -r
|
||||
complete -c emacs -o nw -d (_ "Do not use X interface")
|
||||
complete -uc emacs -s d -o display -d (_ "Create window on the specified display") -x
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user