Compare commits

..

58 Commits

Author SHA1 Message Date
axel
d1ff6a323a Bump version number
darcs-hash:20060419124513-ac50b-f0c4bacee786ca9e147a86004aa90f5a09c04b34.gz
2006-04-19 22:45:13 +10:00
axel
112ea1759a Minor code cleanup
darcs-hash:20060419124315-ac50b-e7e9cafe6850e1fe805bad82278d15c2de327f5d.gz
2006-04-19 22:43:15 +10:00
axel
76bafbef2a Make the read builtin accept 0 parameters and drop the input instead of showing an error message
darcs-hash:20060419100830-ac50b-50f96925481bb29ad840fb12240ef9b9b86d18c4.gz
2006-04-19 20:08:30 +10:00
axel
1947ec88f1 Remove minor memory leak on init
darcs-hash:20060419095818-ac50b-d2146525feba5f00d224bce920ab40cc023e390d.gz
2006-04-19 19:58:18 +10:00
axel
d0956f1e43 Use libc implementations of wcslcpy and wcslcat if they exist. Move internal implementations to fallback.c.
darcs-hash:20060419095628-ac50b-0e94e4205306bb99bb9dea72eec43b442520bf1b.gz
2006-04-19 19:56:28 +10:00
axel
6996c7718e Always init history on startup, to avoid destorying history multiple times when reading interactively in a non-interactive script
darcs-hash:20060419095502-ac50b-abf2fe39cf9c027bdbc69d78fe858e946f7c81f2.gz
2006-04-19 19:55:02 +10:00
axel
45d56d8e05 Drop all calls to wcsncpy
darcs-hash:20060413121851-ac50b-1f479b96b3aa1050a30e9ee0ed27cc107ce2bc45.gz
2006-04-13 22:18:51 +10:00
axel
53295d38b7 Change var_entry_t struct to be ANSI C compliant (Wastes a few hundred bytes)
darcs-hash:20060410160109-ac50b-fa8b097722f06aee5fb09095e89f6b39ff90d44b.gz
2006-04-11 02:01:09 +10:00
axel
bd9c843fd1 Add warning when trying to change read-only variable
darcs-hash:20060410153626-ac50b-700ff7687647b8aab47ba79d759d1739cbe60425.gz
2006-04-11 01:36:26 +10:00
axel
f812b9b26c Fix bug in type command causing type -f to return true even when no file was found
darcs-hash:20060410143201-ac50b-4d8a70cd9721edcddaf11324f0b575d3f8cbace8.gz
2006-04-11 00:32:01 +10:00
axel
52851a3ba4 Quote Doxygen test in configure script to remove warning - thanks to Ray Hammond for the report and the fix
darcs-hash:20060410141909-ac50b-f310b7e326ce28ae8a3bbc1a3c1d247511f3d860.gz
2006-04-11 00:19:09 +10:00
axel
b1bf115fa2 Bump version number
darcs-hash:20060408143210-ac50b-0a143a45d0510e67a75024b802a1ca677480e4c0.gz
2006-04-09 00:32:10 +10:00
axel
0f25ef365d Tiny documentation edits
darcs-hash:20060408143134-ac50b-eae8cf585d3801b51bba415955ef2aacf98baeb2.gz
2006-04-09 00:31:34 +10:00
axel
55ea4b6fc0 Documentation additions
darcs-hash:20060405132928-ac50b-d551c31d04426c75c756d513e02e34b91bfc4ad6.gz
2006-04-05 23:29:28 +10:00
axel
5ef8cccf21 Mention in the license section that fish includes the glibc wcstok implementation as a fallback for libc implementations lacking wcstok
darcs-hash:20060405125956-ac50b-9e5b51d94676868365878387cd8c7e14a1684348.gz
2006-04-05 22:59:56 +10:00
axel
5613d96001 Do not call autoconf in Makefile, since configure will automatically reconfigure itself if configure.ac has changed
darcs-hash:20060405124918-ac50b-0f45ddc7759383d930e0473a281f092566570210.gz
2006-04-05 22:49:18 +10:00
axel
5d9ba8c1a2 Delete some commented code and tweak a few comments
darcs-hash:20060405124825-ac50b-8242b2a9c788cf147f864329797b2e24a7040f0b.gz
2006-04-05 22:48:25 +10:00
axel
0de232bf54 Do not return to the shell until all processes of a job have finished (Previous behaviour was to return once the last job had exited, and could cause e.g. the jobs builtin to print out the job responsible for repainting the titlebar). Also validate that jobs have not completed in various places where the job list is examined
darcs-hash:20060404112722-ac50b-4b6a55ce7c57d39213cdd0ed0f581795a72859b7.gz
2006-04-04 21:27:22 +10:00
axel
db5b887824 PPC fix by James Vega, fixing an issue with a variable named putc, which clashed with the putc macro
darcs-hash:20060403150422-ac50b-78d5db541cb1f41bfea55deac7578c0df73605bd.gz
2006-04-04 01:04:22 +10:00
axel
634bdb8b3b Release 1.21.3
darcs-hash:20060402111721-ac50b-f5df9a3a3154a9bb37f4fcc6db3d4f44d12830ce.gz
2006-04-02 21:17:21 +10:00
axel
9c579a37bb Swedish translation checkin
darcs-hash:20060402111659-ac50b-c23841e44c3de1cc4db9c2897fff59faf820c3d9.gz
2006-04-02 21:16:59 +10:00
axel
1502acd83e Add tar and dist Makefile targets
darcs-hash:20060402111622-ac50b-8ac169b0f05fd68c1c8a375ae60049422e3fad47.gz
2006-04-02 21:16:22 +10:00
axel
ef3430f669 Add Makefile rules for regenerating Makefile, configure script, etc. when needed
darcs-hash:20060402111525-ac50b-533e15f7ab5d63c2f8258b5a5ae8adc5bafd9221.gz
2006-04-02 21:15:25 +10:00
axel
01af64cf1f Add missing space in shellscript for building rpms
darcs-hash:20060331165626-ac50b-922778808ac54955cf6b1a43e4ae5e2264ac6ae1.gz
2006-04-01 02:56:26 +10:00
axel
349f52a1a5 Telnet completions from Sean Higgins
darcs-hash:20060331165554-ac50b-5b0300d89ac2b2fbc6bc4bfcf228572fdce2e284.gz
2006-04-01 02:55:54 +10:00
axel
850aa1963f Change rpm .spec file so it will work both on systems that install X headers in /usr/include and /usr/X11R6/include
darcs-hash:20060329213330-ac50b-b478b18ae9aeb070ade5176c9813ffb74ac7006e.gz
2006-03-30 07:33:30 +10:00
axel
185d0c3c1c Minor edits in configure.ac
darcs-hash:20060329213124-ac50b-8d25a34d621d698425b54e032238a2fe89d4a031.gz
2006-03-30 07:31:24 +10:00
axel
3656443b1f Update section about compilers in INSTALL file to reflect that fish is known to work with ICC
darcs-hash:20060329213031-ac50b-34ca7b4f2ba557faf7d1ad17bde194b1a1f0acce.gz
2006-03-30 07:30:31 +10:00
axel
6748b9699f Make parser_is_block public
darcs-hash:20060329212942-ac50b-ad8334532a719152766b4b530474616b78564f24.gz
2006-03-30 07:29:42 +10:00
axel
dc91d7aec4 Further improvements to build system wrt detection of compiler and libc features and prototypes, as discussed with James Antill on mailin list
darcs-hash:20060329002500-ac50b-e7618e476ea69802bd2cb0076244f49a0f178df7.gz
2006-03-29 10:25:00 +10:00
axel
13a51ba4c2 Fix warnings from ICC
darcs-hash:20060329001450-ac50b-9c3fe4f7ca14a077997c421616c07dde03b48c6d.gz
2006-03-29 10:14:50 +10:00
axel
749dad1309 Fix wildcarding bug where ? at end of wildcard could match 0 characters
darcs-hash:20060328180916-ac50b-6f77d936a1e46e411a12ca96fd9ad3bb844d321b.gz
2006-03-29 04:09:16 +10:00
axel
7a07d7c188 Add hint on how to fix missing rpm-build when trying make rpm
darcs-hash:20060326175237-ac50b-703940a231be96991d5d94c451b12f7c4e6f649f.gz
2006-03-27 03:52:37 +10:00
axel
53c95abfb2 Change how a few pointer are supplied to functions, removes warnings about breaking aliasing rules
darcs-hash:20060326112339-ac50b-eb135567f6a6183e5dbc310c093d2139ecc8fa4b.gz
2006-03-26 21:23:39 +10:00
axel
7fd2ae4ffd Third try on correct fallback headers - re-add the checks to only include prototypes for functions which are known to be missing, and also add any compiler directives which may help in adding additional prototypes in the system headers (separate patch)
darcs-hash:20060325162103-ac50b-18f5074838a1c304c3d013378b7fa4e66b544cd9.gz
2006-03-26 02:21:03 +10:00
axel
717ac3f7fe Remove gcc-specific cflags from makefile. Add them in the configure file, but only if the compiler is gcc.
darcs-hash:20060325161848-ac50b-23919c1d23bbc5eed81fd709b95802ea2d4e8f52.gz
2006-03-26 02:18:48 +10:00
axel
50fa7234ea Fix completion describtion bug causing filesizes below 1024 bytes to be reported as 0 bytes on big-endian systems
darcs-hash:20060322001712-ac50b-1a42b3dcb868161f13d45d80d16aeb119f6ec9cd.gz
2006-03-22 10:17:12 +10:00
axel
80b4055eab Add support for the -n switch to skip execution of any commands
darcs-hash:20060318010459-ac50b-9d9e5c489e0e4df2159d8c1d0ff952d42e2a2a82.gz
2006-03-18 11:04:59 +10:00
axel
94b7c8d5e6 Don't call the type function when defining the _ function, as this will cause a recursive dependency
darcs-hash:20060317132356-ac50b-4b3b0b6ec3f2e82649c74cc358f1505bf202bbd4.gz
2006-03-17 23:23:56 +10:00
axel
580ec26885 Minor code tweak in type function, and add a missing newline to an output string
darcs-hash:20060317132256-ac50b-87c066ec3aba2eded333ecbf2198de001c313570.gz
2006-03-17 23:22:56 +10:00
axel
6ba5d80a20 Cleanup after patch conflict
darcs-hash:20060314002216-ac50b-c5b2b0d677f45818d2496f00fb9cfc774460397e.gz
2006-03-14 10:22:16 +10:00
axel
d58b9de63b Use 'type -f' instead of 'which' to test for presense of command, since the latter does not set the exit status correctly on all platforms
darcs-hash:20060314002127-ac50b-6ed726bdcc9e3a7a9608a904c382973799dc73ef.gz
2006-03-14 10:21:27 +10:00
npilon
99a93b5add Fish PATH Fix
Moved PATH detection code to the start of share/fish.

darcs-hash:20060313190724-c90d9-8e2e80910041e91b48d68154e9d8180d04689463.gz
2006-03-14 05:07:24 +10:00
npilon
de50539c02 gettext detection fix
The current method of gettext detection is broken on (at least) OS X and Solaris, where which always returns successfully. This method seems to work on Linux, OS X, and Solaris.

darcs-hash:20060313014458-c90d9-8b169581a8632b6a47c61310ef3c976abd67d8e0.gz
2006-03-13 11:44:58 +10:00
npilon
04cf08b93b xargs completion fix
Added a missing -d to a couple of xargs completions.

darcs-hash:20060313014433-c90d9-b7c6e444ecea0ed2e75304bd9663d20ea55df0ff.gz
2006-03-13 11:44:33 +10:00
npilon
2c5b52eb6c OS X Compilation Fix
Tweak to fallback.h to make it compile under OS X. As shipped with fish 1.21.2, this causes a lot of warnings and then dies.

darcs-hash:20060313014333-c90d9-de59932f81dd6debbfb48225893983df485df12b.gz
2006-03-13 11:43:33 +10:00
axel
dd8150d98d Minor comment and documentation changes
darcs-hash:20060314000914-ac50b-63c49a59804f51c4dd19de574db41298b1ef67c5.gz
2006-03-14 10:09:14 +10:00
axel
99662d7711 Move typedef of tputs_arg_t from common.h to fallback.h
darcs-hash:20060314000801-ac50b-466d5b90d9a1bea0e55c8657748edf6663edd06f.gz
2006-03-14 10:08:01 +10:00
axel
5f3ad87a98 Make the type builtin not rely on the exit status of the which command
darcs-hash:20060314000641-ac50b-cc92a519b6c8981a50aea0f25f407dfe2b5f51dc.gz
2006-03-14 10:06:41 +10:00
axel
83d05f9170 Move to end of current token on completion
darcs-hash:20060311115612-ac50b-70f15c50b6cb8ad89d84ae6c8a3ffc4b7551223b.gz
2006-03-11 21:56:12 +10:00
axel
0d56818664 Fix bad return status in read builtin
darcs-hash:20060310195100-ac50b-2b7d94510661d901fd804074e6cf03e926dddc79.gz
2006-03-11 05:51:00 +10:00
axel
5b0cd5a911 Changes in quoting of backslashes lead to minor bug in awk script for munging command descriptions
darcs-hash:20060310142808-ac50b-75e4be2daa924e4a565b1a11f69068340022c367.gz
2006-03-11 00:28:08 +10:00
axel
102b99a17b Add further checks to unicode_start to see that the command exists
darcs-hash:20060310135129-ac50b-8345a137b73e91084ad82cba06413580e3ca87e7.gz
2006-03-10 23:51:29 +10:00
axel
6222d00ffc Add minor comment about error handling to configure.ac
darcs-hash:20060310135024-ac50b-dd496725134db7eb3b55e7358a37eec481043b3e.gz
2006-03-10 23:50:24 +10:00
axel
73370f5f39 Avoid extended regexps in grep, they are not portable
darcs-hash:20060310134350-ac50b-7138e53ed815986ccb78e909f50c9939382a1e89.gz
2006-03-10 23:43:50 +10:00
axel
883ce6e440 Adapt key_reader to changes in buildfiles
darcs-hash:20060310134317-ac50b-14691f97a817f52f663679797e69f60419ec5d03.gz
2006-03-10 23:43:17 +10:00
axel
f320f5f710 Move LANG init back to /etc where it belongs. IT was temporarily moved earlier to do some translations at init time, but that is no longer needed
darcs-hash:20060310134039-ac50b-e826176a9d574b26235013384963f2dd7e9e9457.gz
2006-03-10 23:40:39 +10:00
axel
32b531667a Fix bug that causing terminal corruption if a job is put under job control before running in interactive mode. This is fixed by doing more inits at startup (but only slightly more)
darcs-hash:20060310133809-ac50b-d31cd7bab1a3a58de2833f73735817a3d0b3ed7d.gz
2006-03-10 23:38:09 +10:00
42 changed files with 948 additions and 634 deletions

11
INSTALL
View File

@@ -2,11 +2,12 @@
Known issues
============
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.
Fish is developed using GCC, with the goal of using only C89 language
features. Fish does, however use the *wprintf family of functions,
which are new to the C99 standrard. It is not unlikely that any given
release contains a few GCC:isms, but ICC 9.0.030 has been found to
produce working binaries. GCC 2.95.* won't compile fish, but GCC 3.2.3
is known to work. Patches to fix any remaining GNU:isms are welcome.
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

View File

@@ -36,22 +36,7 @@
CC := @CC@
INSTALL:=@INSTALL@
#
# 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
CFLAGS:=@CFLAGS@
CPPFLAGS=@CPPFLAGS@
LDFLAGS:= @LIBS@ @LDFLAGS@
@@ -87,7 +72,7 @@ COMMON_OBJS_WITH_HEADER := builtin_help.o
# main.c exists, but main.h does not, etc.
COMMON_OBJS_WITH_CODE := builtin_set.o builtin_commandline.o \
builtin_ulimit.c builtin_complete.o
builtin_ulimit.o builtin_complete.o
# All objects that the system needs to build fish
FISH_OBJS := $(COMMON_OBJS) $(COMMON_OBJS_WITH_CODE) \
@@ -179,14 +164,16 @@ ETC_DIR_FILES :=etc/fish.in etc/fish_inputrc \
etc/fish_interactive.fish.in
# Files in ./share/
SHARE_DIR_FILES :=share/fish
SHARE_DIR_FILES :=share/fish.in
# 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
# Files in ./share/completions/
COMPLETIONS_DIR_FILES := $(wildcard share/completions/*.fish)
# Files in ./share/functions/
FUNCTIONS_DIR_FILES := $(wildcard share/functions/*.fish)
# Programs to build
@@ -210,8 +197,14 @@ all: $(PROGRAMS) user_doc
@echo Use \'make install\' to install fish.
.PHONY: all
configure: configure.ac
./config.status --recheck
Makefile: Makefile.in configure
./config.status
debug:
make fish CFLAGS="-O0 -Wno-unused -Werror -g -Wall -fno-optimize-sibling-calls"
make fish CFLAGS="@CFLAGS@ -O0 -Wno-unused -Werror -g"
.PHONY: debug
# User documentation, describing the features of the fish shell.
@@ -498,25 +491,26 @@ fish_tests: $(FISH_TESTS_OBJS)
$(CC) $(FISH_TESTS_OBJS) $(LDFLAGS) -o $@
mimedb: $(MIME_OBJS) doc_src/mimedb.c
$(CC) ${MIME_OBJS} doc_src/mimedb.c $(LDFLAGS) -o $@
mimedb: $(MIME_OBJS) doc_src/mimedb.o
$(CC) ${MIME_OBJS} doc_src/mimedb.o $(LDFLAGS) -o $@
set_color: set_color.o doc_src/set_color.c
$(CC) set_color.o doc_src/set_color.c $(LDFLAGS) -o $@
set_color: set_color.o doc_src/set_color.o
$(CC) set_color.o doc_src/set_color.o $(LDFLAGS) -o $@
# Test program for the tokenizer library
tokenizer_test: tokenizer.c tokenizer.h util.o wutil.o common.o
$(CC) ${CFLAGS} tokenizer.c util.o wutil.o common.o -D TOKENIZER_TEST $(LDFLAGS) -o $@
# Neat little program to show output from terminal
key_reader: key_reader.o input_common.o common.o env_universal.o env_universal_common.o util.o wutil.o
$(CC) key_reader.o input_common.o common.o env_universal.o env_universal_common.o util.o wutil.o $(LDFLAGS) -o $@
key_reader: key_reader.o input_common.o $(CORE_OBJS) env_universal.o env_universal_common.o wutil.o
$(CC) key_reader.o input_common.o $(CORE_OBJS) env_universal.o env_universal_common.o wutil.o $(LDFLAGS) -o $@
#
# Update dependencies
#
depend:
makedepend -fMakefile.in -Y *.c
./config.status
.PHONY: depend
# Copy all the source files into a new directory and use tar to create
@@ -546,15 +540,27 @@ fish-@PACKAGE_VERSION@.tar: $(DOC_SRC_DIR_FILES) $(MAIN_DIR_FILES) $(ETC_DIR_FIL
tar -c fish-@PACKAGE_VERSION@ >fish-@PACKAGE_VERSION@.tar
rm -rf fish-@PACKAGE_VERSION@
tar: fish-@PACKAGE_VERSION@.tar
.PHONY: tar
fish-@PACKAGE_VERSION@.tar.gz: fish-@PACKAGE_VERSION@.tar
gzip -f --best -c fish-@PACKAGE_VERSION@.tar >fish-@PACKAGE_VERSION@.tar.gz
fish-@PACKAGE_VERSION@.tar.bz2: fish-@PACKAGE_VERSION@.tar
bzip2 -f --best -k fish-@PACKAGE_VERSION@.tar
dist: fish-@PACKAGE_VERSION@.tar.bz2
.PHONY: dist
# Create .rpm file for the current systems architecture and an
# .src.rpm file.
rpm: fish-@PACKAGE_VERSION@.tar.bz2
@if ! which rpmbuild; then \
echo Could not find the rpmbuild command, needed to build an rpm; \
echo You may be able to install it using the following command:; \
echo \'yum install rpm-build\'; \
false; \
fi
cp fish.spec /usr/src/redhat/SPECS/
cp fish-@PACKAGE_VERSION@.tar.bz2 /usr/src/redhat/SOURCES/
rpmbuild -ba --clean /usr/src/redhat/SPECS/fish.spec
@@ -590,105 +596,112 @@ 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 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 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.o: config.h fallback.h common.h util.h wutil.h builtin.h function.h
builtin.o: complete.h proc.h io.h parser.h event.h reader.h env.h wgetopt.h
builtin.o: sanity.h tokenizer.h builtin_help.h wildcard.h input_common.h
builtin.o: input.h intern.h signal.h translate.h halloc.h halloc_util.h
builtin.o: parse_util.h expand.h
builtin_commandline.o: signal.h config.h fallback.h common.h util.h wutil.h
builtin_commandline.o: builtin.h wgetopt.h reader.h proc.h io.h parser.h
builtin_commandline.o: event.h 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_complete.o: signal.h config.h fallback.h common.h util.h wutil.h
builtin_complete.o: builtin.h complete.h wgetopt.h parser.h proc.h io.h
builtin_complete.o: event.h 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 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 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 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 event.h env_universal.h
builtin_set.o: signal.h config.h fallback.h common.h util.h wutil.h builtin.h
builtin_set.o: env.h expand.h wgetopt.h proc.h io.h parser.h event.h
builtin_set.o: translate.h
builtin_ulimit.o: config.h fallback.h common.h util.h builtin.h wgetopt.h
builtin_ulimit.o: translate.h
common.o: config.h fallback.h common.h util.h wutil.h expand.h proc.h io.h
common.o: wildcard.h parser.h event.h
complete.o: signal.h config.h fallback.h common.h util.h tokenizer.h
complete.o: wildcard.h proc.h io.h parser.h event.h function.h complete.h
complete.o: builtin.h env.h exec.h expand.h reader.h history.h intern.h
complete.o: translate.h parse_util.h halloc_util.h wutil.h
dragon.o: signal.h
env.o: config.h signal.h fallback.h common.h util.h wutil.h proc.h io.h env.h
env.o: sanity.h 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: config.h signal.h fallback.h common.h util.h wutil.h
env_universal.o: env_universal_common.h env_universal.h
env_universal_common.o: config.h signal.h util.h common.h wutil.h
env_universal_common.o: config.h signal.h fallback.h common.h util.h wutil.h
env_universal_common.o: env_universal_common.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: 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 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 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: 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 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 event.h env.h expand.h
event.o: signal.h config.h fallback.h common.h util.h wutil.h function.h
event.o: proc.h io.h parser.h event.h translate.h halloc_util.h
exec.o: signal.h config.h fallback.h common.h util.h wutil.h proc.h io.h
exec.o: exec.h parser.h event.h builtin.h function.h env.h wildcard.h
exec.o: sanity.h expand.h env_universal.h env_universal_common.h translate.h
exec.o: halloc.h halloc_util.h parse_util.h
expand.o: signal.h config.h fallback.h common.h util.h wutil.h env.h proc.h
expand.o: io.h parser.h event.h expand.h wildcard.h exec.h tokenizer.h
expand.o: complete.h translate.h parse_util.h halloc_util.h
fallback.o: config.h common.h util.h
fishd.o: config.h signal.h fallback.h common.h util.h wutil.h
fishd.o: env_universal_common.h
fish_pager.o: config.h signal.h fallback.h common.h util.h wutil.h complete.h
fish_pager.o: output.h input_common.h env_universal.h env_universal_common.h
fish_pager.o: halloc.h halloc_util.h
fish_tests.o: config.h signal.h fallback.h common.h util.h proc.h io.h
fish_tests.o: reader.h builtin.h function.h complete.h wutil.h env.h expand.h
fish_tests.o: parser.h event.h tokenizer.h output.h exec.h halloc_util.h
function.o: signal.h config.h wutil.h fallback.h common.h util.h function.h
function.o: proc.h io.h translate.h parser.h event.h intern.h reader.h
function.o: parse_util.h env.h expand.h
halloc.o: config.h fallback.h common.h util.h halloc.h
halloc_util.o: config.h fallback.h common.h util.h halloc.h
highlight.o: signal.h config.h fallback.h common.h util.h wutil.h highlight.h
highlight.o: tokenizer.h proc.h io.h parser.h event.h parse_util.h builtin.h
highlight.o: function.h env.h expand.h sanity.h complete.h output.h
history.o: config.h fallback.h common.h util.h wutil.h history.h reader.h
history.o: env.h sanity.h signal.h
input.o: config.h signal.h fallback.h common.h util.h wutil.h reader.h proc.h
input.o: io.h 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: config.h fallback.h common.h util.h wutil.h input_common.h
input_common.o: env_universal.h env_universal_common.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 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 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: 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: event.h tokenizer.h exec.h wildcard.h function.h builtin.h
intern.o: config.h fallback.h common.h util.h wutil.h intern.h
io.o: config.h fallback.h common.h util.h wutil.h exec.h proc.h io.h
io.o: translate.h halloc.h
key_reader.o: fallback.h common.h util.h input_common.h
kill.o: signal.h config.h fallback.h common.h util.h wutil.h kill.h proc.h
kill.o: io.h sanity.h env.h exec.h parser.h event.h
main.o: config.h signal.h fallback.h common.h util.h reader.h builtin.h
main.o: function.h complete.h wutil.h env.h sanity.h proc.h io.h parser.h
main.o: event.h expand.h intern.h exec.h output.h translate.h halloc_util.h
mimedb.o: config.h xdgmime.h fallback.h common.h util.h
output.o: config.h signal.h fallback.h common.h util.h wutil.h expand.h
output.o: output.h halloc_util.h highlight.h
parser.o: signal.h config.h fallback.h common.h util.h wutil.h proc.h io.h
parser.o: parser.h 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 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 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
parse_util.o: config.h fallback.h common.h util.h wutil.h tokenizer.h
parse_util.o: parse_util.h expand.h intern.h exec.h proc.h io.h env.h
parse_util.o: wildcard.h halloc_util.h
proc.o: config.h signal.h fallback.h common.h util.h wutil.h proc.h io.h
proc.o: reader.h sanity.h env.h parser.h event.h translate.h halloc.h
proc.o: halloc_util.h output.h
reader.o: config.h signal.h fallback.h common.h util.h wutil.h highlight.h
reader.o: reader.h proc.h io.h parser.h event.h complete.h history.h sanity.h
reader.o: env.h 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 translate.h
refcount.o: config.h fallback.h common.h util.h wutil.h refcount.h
sanity.o: signal.h config.h fallback.h common.h util.h sanity.h proc.h io.h
sanity.o: history.h 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 halloc_util.h
util.o: config.h util.h common.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
signal.o: config.h signal.h common.h util.h fallback.h wutil.h event.h
signal.o: reader.h proc.h io.h translate.h
tokenizer.o: config.h fallback.h common.h util.h wutil.h tokenizer.h
tokenizer.o: wildcard.h translate.h
translate.o: config.h common.h util.h fallback.h halloc_util.h
util.o: config.h fallback.h common.h util.h wutil.h
wgetopt.o: config.h wgetopt.h wutil.h fallback.h common.h util.h translate.h
wildcard.o: config.h fallback.h common.h util.h wutil.h complete.h wildcard.h
wildcard.o: reader.h expand.h translate.h
wutil.o: config.h fallback.h common.h util.h wutil.h
xdgmimealias.o: xdgmimealias.h xdgmime.h xdgmimeint.h
xdgmime.o: xdgmime.h xdgmimeint.h xdgmimeglob.h xdgmimemagic.h xdgmimealias.h
xdgmime.o: xdgmimeparent.h

View File

@@ -586,6 +586,7 @@ static int builtin_generic( wchar_t **argv )
}
/**
Output a definition of the specified function to the sb_out
stringbuffer. Used by the functions builtin.
*/
static void functions_def( wchar_t *name )
@@ -1347,7 +1348,8 @@ static int builtin_read( wchar_t **argv )
wchar_t *nxt;
wchar_t *prompt = DEFAULT_READ_PROMPT;
wchar_t *commandline = L"";
int exit_res=0;
woptind=0;
while( 1 )
@@ -1466,20 +1468,6 @@ static int builtin_read( wchar_t **argv )
return 1;
}
if( woptind == argc )
{
sb_printf( sb_err,
BUILTIN_ERR_MISSING,
argv[0] );
sb_append2( sb_err,
parser_current_line(),
L"\n",
(void *)0 );
builtin_print_help( argv[0], sb_err );
return 1;
}
/*
Verify all variable names
*/
@@ -1510,10 +1498,6 @@ static int builtin_read( wchar_t **argv )
*/
i=woptind;
ifs = env_get( L"IFS" );
if( ifs == 0 )
ifs = L"";
/*
Check if we should read interactively using \c reader_readline()
*/
@@ -1529,10 +1513,12 @@ static int builtin_read( wchar_t **argv )
else
{
string_buffer_t sb;
int eof=0;
sb_init( &sb );
while( 1 )
{
int eof=0;
int finished=0;
wchar_t res=0;
@@ -1573,30 +1559,46 @@ static int builtin_read( wchar_t **argv )
if( eof )
break;
if( res == L'\n' )
break;
sb_append_char( &sb, res );
}
if( sb.used < 2 && eof )
{
exit_res = 1;
}
buff = wcsdup( (wchar_t *)sb.buff );
sb_destroy( &sb );
}
wchar_t *state;
nxt = wcstok( buff, (i<argc-1)?ifs:L"", &state );
while( i<argc )
if( i != argc )
{
env_set( argv[i], nxt != 0 ? nxt: L"", place );
wchar_t *state;
i++;
if( nxt != 0 )
nxt = wcstok( 0, (i<argc-1)?ifs:L"", &state);
ifs = env_get( L"IFS" );
if( ifs == 0 )
ifs = L"";
nxt = wcstok( buff, (i<argc-1)?ifs:L"", &state );
while( i<argc )
{
env_set( argv[i], nxt != 0 ? nxt: L"", place );
i++;
if( nxt != 0 )
nxt = wcstok( 0, (i<argc-1)?ifs:L"", &state);
}
}
free( buff );
return 0;
return exit_res;
}
/**
@@ -2017,10 +2019,10 @@ static int builtin_source( wchar_t ** argv )
parser_push_block( SOURCE );
reader_push_current_filename( fn_intern );
current_block->param1.source_dest = fn_intern;
parse_util_set_argv( argv+2);
res = reader_read( fd );
parser_pop_block();
@@ -2029,8 +2031,7 @@ static int builtin_source( wchar_t ** argv )
sb_printf( sb_err,
_( L"%ls: Error while reading file '%ls'\n" ),
argv[0],
argv[1]
);
argv[1] );
}
/*
@@ -2493,7 +2494,7 @@ static int builtin_jobs( wchar_t **argv )
*/
for( j=first_job; j; j=j->next )
{
if( j->constructed )
if( j->constructed && !job_is_completed(j) )
{
builtin_jobs_print( j, mode, !found );
return 0;
@@ -2526,7 +2527,7 @@ static int builtin_jobs( wchar_t **argv )
j = job_get_from_pid( pid );
if( j )
if( j && !job_is_completed( j ) )
{
builtin_jobs_print( j, mode, !found );
}
@@ -2547,7 +2548,7 @@ static int builtin_jobs( wchar_t **argv )
/*
Ignore unconstructed jobs, i.e. ourself.
*/
if( j->constructed /*&& j->skip_notification*/ )
if( j->constructed && !job_is_completed(j) )
{
builtin_jobs_print( j, mode, !found );
found = 1;
@@ -3221,7 +3222,7 @@ static int internal_help( wchar_t *cmd )
int builtin_run( wchar_t **argv )
{
int (*cmd)(wchar_t **argv)=0;
cmd = hash_get( &builtin, argv[0] );
cmd = (int (*)(wchar_t **))hash_get( &builtin, argv[0] );
if( argv[1] != 0 && !internal_help(argv[0]) )
{

View File

@@ -26,6 +26,22 @@ Functions used for implementing the set builtin.
#include "parser.h"
#include "translate.h"
/**
Call env_set. On error, print a description of the problem to
stderr.
*/
static void my_env_set( const wchar_t *key, const wchar_t *val, int scope )
{
switch( env_set( key, val, scope | ENV_USER ) )
{
case ENV_PERM:
{
sb_printf( sb_err, _(L"%ls: Tried to change the read-only variable '%ls'\n"), L"set", key );
break;
}
}
}
/**
Extract the name from a destination argument of the form name[index1 index2...]
*/
@@ -114,7 +130,12 @@ static int parse_fill_indexes( array_list_t *indexes,
/**
Update a list by writing the specified values at the specified indexes
Update a list \c list by writing copies (using wcsdup) of the
values specified by \c values to the indexes specified by \c
indexes. The previous entries at the specidied position will be
free'd.
\return The number of elements in the list after the modifications have been made
*/
static int update_values( array_list_t *list,
array_list_t *indexes,
@@ -122,16 +143,12 @@ static int update_values( array_list_t *list,
{
int i;
//fwprintf(stderr, L"Scan complete\n");
/* Replace values where needed */
for( i = 0; i < al_get_count(indexes); i++ )
{
int ind = *(int *) al_get(indexes, i) - 1;
void *new = (void *) al_get(values, i);
if (al_get(list, ind) != 0)
{
free((void *) al_get(list, ind));
}
free((void *) al_get(list, ind));
al_set(list, ind, new != 0 ? wcsdup(new) : wcsdup(L""));
}
@@ -169,8 +186,6 @@ static int erase_values(array_list_t *list, array_list_t *indexes)
int i;
array_list_t result;
//fwprintf(stderr, L"Starting with %d\n", al_get_count(list));
al_init(&result);
for (i = 0; i < al_get_count(list); i++)
@@ -189,8 +204,6 @@ static int erase_values(array_list_t *list, array_list_t *indexes)
al_push_all( list, &result );
al_destroy(&result);
//fwprintf(stderr, L"Remaining: %d\n", al_get_count(&result));
return al_get_count(list);
}
@@ -207,8 +220,6 @@ static int fill_buffer_from_list(string_buffer_t *sb, array_list_t *list)
wchar_t *v = (wchar_t *) al_get(list, i);
if (v != 0)
{
// fwprintf(stderr, L".\n");
// fwprintf(stderr, L"Collecting %ls from %d\n", v, i);
sb_append(sb, v);
}
if (i < al_get_count(list) - 1)
@@ -260,6 +271,10 @@ static void print_variables(int include_values, int esc, int scope)
int builtin_set( wchar_t **argv )
{
/**
Variables used for parsing the argument list
*/
const static struct woption
long_options[] =
{
@@ -293,7 +308,7 @@ int builtin_set( wchar_t **argv )
}
;
wchar_t short_options[] = L"+xglenuUq";
const wchar_t *short_options = L"+xglenuUq";
int argc = builtin_count_args(argv);
@@ -363,6 +378,15 @@ int builtin_set( wchar_t **argv )
}
}
/*
Ok, all arguments have been parsed, let's validate them
*/
/*
If we are checking the existance of a variable (-q) we can not
also specify scope
*/
if( query && (erase || list || global || local || universal || export || unexport ) )
{
sb_printf(sb_err,
@@ -375,7 +399,7 @@ int builtin_set( wchar_t **argv )
}
/* Check operation and modifiers sanity */
/* We can't both list and erase varaibles */
if( erase && list )
{
sb_printf(sb_err,
@@ -387,6 +411,9 @@ int builtin_set( wchar_t **argv )
return 1;
}
/*
Variables can only have one scope
*/
if( local + global + universal > 1 )
{
sb_printf( sb_err,
@@ -397,6 +424,9 @@ int builtin_set( wchar_t **argv )
return 1;
}
/*
Variables can only have one export status
*/
if( export && unexport )
{
sb_printf( sb_err,
@@ -410,13 +440,16 @@ int builtin_set( wchar_t **argv )
if( query )
{
/*
Query mode. Return number of specified variables that do not exist.
Query mode. Return the number variables that do not exist
out of the specified variables.
*/
int i;
for( i=woptind; i<argc; i++ )
{
if( !env_exist( argv[i] ) )
{
retcode++;
}
}
return retcode;
@@ -427,8 +460,7 @@ int builtin_set( wchar_t **argv )
if( woptind < argc )
{
dest = wcsdup(argv[woptind++]);
//fwprintf(stderr, L"Dest: %ls\n", dest);
if( !wcslen( dest ) )
{
free( dest );
@@ -444,7 +476,6 @@ int builtin_set( wchar_t **argv )
while( woptind < argc )
{
al_push(&values, argv[woptind++]);
// fwprintf(stderr, L"Val: %ls\n", argv[woptind - 1]);
}
/* Extract variable name and indexes */
@@ -459,8 +490,7 @@ int builtin_set( wchar_t **argv )
if( !retcode )
{
name = (wchar_t *) name_sb.buff;
//fwprintf(stderr, L"Name is %ls\n", name);
al_init(&indexes);
retval = parse_fill_indexes(&indexes, dest);
if (retval < 0)
@@ -512,7 +542,7 @@ int builtin_set( wchar_t **argv )
!erase &&
!list )
{
env_set( name, 0, scope );
my_env_set( name, 0, scope );
finished = 1;
}
}
@@ -572,7 +602,7 @@ int builtin_set( wchar_t **argv )
else
{
fill_buffer_from_list(&result_sb, &val_l);
env_set(name, (wchar_t *) result_sb.buff, scope);
my_env_set(name, (wchar_t *) result_sb.buff, scope);
}
}
else
@@ -585,7 +615,7 @@ int builtin_set( wchar_t **argv )
fill_buffer_from_list( &result_sb,
&val_l );
env_set(name,
my_env_set(name,
(wchar_t *) result_sb.buff,
scope);
}
@@ -601,7 +631,7 @@ int builtin_set( wchar_t **argv )
}
/* Common cleanup */
//fwprintf(stderr, L"Cleanup\n");
free(dest);
sb_destroy(&name_sb);
al_destroy( &values );

View File

@@ -3,6 +3,8 @@
Functions used for implementing the ulimit builtin.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
@@ -12,8 +14,6 @@ Functions used for implementing the ulimit builtin.
#include <unistd.h>
#include <errno.h>
#include "config.h"
#include "fallback.h"
#include "util.h"

102
common.c
View File

@@ -400,108 +400,6 @@ wchar_t **strv2wcsv( const char **in )
}
/*$OpenBSD: strlcat.c,v 1.11 2003/06/17 21:56:24 millert Exp $*/
/*
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
size_t
wcslcat(wchar_t *dst, const wchar_t *src, size_t siz)
{
register wchar_t *d = dst;
register const wchar_t *s = src;
register size_t n = siz;
size_t dlen;
/* Find the end of dst and adjust bytes left but don't go past end */
while (n-- != 0 && *d != '\0')
d++;
dlen = d - dst;
n = siz - dlen;
if (n == 0)
return(dlen + wcslen(s));
while (*s != '\0')
{
if (n != 1)
{
*d++ = *s;
n--;
}
s++;
}
*d = '\0';
return(dlen + (s - src));
/* count does not include NUL */
}
/*$OpenBSD: strlcpy.c,v 1.8 2003/06/17 21:56:24 millert Exp $*/
/*
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
size_t
wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz)
{
register wchar_t *d = dst;
register const wchar_t *s = src;
register size_t n = siz;
/* Copy as many bytes as will fit */
if (n != 0 && --n != 0)
{
do
{
if ((*d++ = *s++) == 0)
break;
}
while (--n != 0);
}
/* Not enough room in dst, add NUL and traverse rest of src */
if (n == 0)
{
if (siz != 0)
*d = '\0';
/* NUL-terminate dst */
while (*s++)
;
}
return(s - src - 1);
/* count does not include NUL */
}
int wcsvarname( wchar_t *str )
{
while( *str )

View File

@@ -15,19 +15,6 @@
#include "util.h"
/**
Under curses, tputs expects an int (*func)(char) as its last
parameter, but in ncurses, tputs expects a int (*func)(int) as its
last parameter. tputs_arg_t is defined to always be what tputs
expects. Hopefully.
*/
#ifdef NCURSES_VERSION
typedef int tputs_arg_t;
#else
typedef char tputs_arg_t;
#endif
/**
Maximum number of bytes used by a single utf-8 character
*/
@@ -147,30 +134,6 @@ wchar_t *wcsdupcat( const wchar_t *a, const wchar_t *b );
*/
wchar_t *wcsdupcat2( const wchar_t *a, ... );
/**
Appends src to string dst of size siz (unlike wcsncat, siz is the
full size of dst, not space left). At most siz-1 characters will be
copied. Always NUL terminates (unless siz <= wcslen(dst)). Returns
wcslen(src) + MIN(siz, wcslen(initial dst)). If retval >= siz,
truncation occurred.
This is the OpenBSD strlcat function, modified for wide characters,
and renamed to reflect this change.
*/
size_t wcslcat( wchar_t *dst, const wchar_t *src, size_t siz );
/**
Copy src to string dst of size siz. At most siz-1 characters will
be copied. Always NUL terminates (unless siz == 0). Returns
wcslen(src); if retval >= siz, truncation occurred.
This is the OpenBSD strlcpy function, modified for wide characters,
and renamed to reflect this change.
*/
size_t wcslcpy( wchar_t *dst, const wchar_t *src, size_t siz );
/**
Test if the given string is a valid variable name
*/

View File

@@ -1,19 +1,21 @@
# Process this file with autoconf to produce a configure script.
AC_INIT(fish,1.21.2,fish-users@lists.sf.net)
AC_INIT(fish,1.21.5,fish-users@lists.sf.net)
# 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
# No need to provide any error messages if autoconf fails, the
# shell and autconf should take care of that themselves
AC_MSG_NOTICE([running autoconf])
if autoconf; then
./configure $@
./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.
This program needs to be run whenever the configure.ac file is modified.
Please install it and try again.])
fi
else
@@ -30,7 +32,7 @@ if test ! -f ./config.h.in -o config.h.in -ot configure.ac; then
autoheader
else
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.
This program needs to be run whenever the configure.ac file is modified.
Please install it and try again.])
fi
else
@@ -83,7 +85,7 @@ AC_PROG_INSTALL
# Check for doxygen, which is needed to build
AC_CHECK_PROG( has_doxygen, [doxygen], "true")
if ! test $has_doxygen = "true"; then
if ! test "$has_doxygen" = "true"; then
AC_MSG_ERROR( [cannot find the Doxygen program in your path.
This program is needed to build fish.
Please install it and try again.])
@@ -110,15 +112,109 @@ else
AC_SUBST( XSEL_MAN_PATH,[ ])
fi
#
# Test if the compiler accepts the -std=c99 flag. If so, using it
# increases the odds of correct compilation, since we want to use the
# *wprintf functions, which where defined in C99.
#
XCFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -std=c99"
AC_MSG_CHECKING(if -std=c99 works)
AC_CACHE_VAL(local_cv_has__std_c99,[
AC_TRY_RUN([
#include <stdlib.h>
#include <stdio.h>
int main() {
return 0;
}],
local_cv_has__std_c99=yes,
local_cv_has__std_c99=no,
)])
AC_MSG_RESULT($local_cv_has__std_c99)
case x$local_cv_has__std_c99 in
xno) CFLAGS="$XCFLAGS" ;;
esac
#
# If we are using gcc, set some flags that increase the odds of the
# compiler producing a working binary...
#
if test "$CC" = gcc; then
#
# -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.
#
CFLAGS="$CFLAGS -fno-optimize-sibling-calls"
#
# -Wall is there to keep me on my toes
#
CFLAGS="$CFLAGS -Wall"
fi
#
# If we are compiling against glibc, set some flags to work around
# some rather stupid attempts to hide prototypes for *wprintf
# functions, as well as prototypes of various gnu extensions.
#
AC_MSG_CHECKING([if we are compiling against glibc])
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([
#include <stdlib.h>
#ifdef __GLIBC__
#define STATUS 0
#else
#define STATUS 1
#endif],
[return STATUS;])],
[glibc=yes],
[glibc=no] )
if test "$glibc" = yes; then
AC_MSG_RESULT(yes)
#
# This gives us access to prototypes for gnu extensions and C99
# functions if we are compiling agains glibc. All GNU extensions
# that are used must have a fallback implementation available in
# fallback.h, in order to keep fish working on non-gnu platforms.
#
CFLAGS="$CFLAGS -D _GNU_SOURCE -D _ISOC99_SOURCE"
else
AC_MSG_RESULT(no)
fi
# Test cpu for special handling of ppc
#
# This is used to skip use of tputs on ppc systems, since it seemed to
# be broken, at least on older debin-based systems. This is obviously
# not the right way to to detect whether this workaround should be
# used, since it catches far to many systems, but I do not have the
# hardware available to narrow this problem down, and in practice, it
# seems that tputs is never really needed.
#
AC_CANONICAL_TARGET
if test $target_cpu = powerpc; then
AC_DEFINE([TPUTS_KLUDGE],[1],[Evil kludge to get Power based machines to work])
fi
AC_DEFINE_UNQUOTED([CPU],[L"$target_cpu"],[CPU type])
# 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
@@ -158,6 +254,12 @@ AC_SUBST( [LOCALEDIR], [$datadir/locale])
# information about running processes.
AC_CHECK_FILES([/proc/self/stat])
# This is ued to tell the wgetopt library to translate strings. This
# way wgetopt can be dropped into any project without requiring i18n.
AC_DEFINE([HAVE_TRANSLATE_H], [1],
[Define to 1 if the wgettext function should be used for translating strings.])
# 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.] )] )
@@ -174,7 +276,7 @@ AC_CHECK_HEADER([regex.h],
# 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 )
AC_CHECK_FUNCS( wcstol dcgettext wcslcat wcslcpy )
# Here follows a list of small programs used to test for various
# features that Autoconf doesn't tell us about
@@ -198,9 +300,10 @@ else
AC_MSG_RESULT(no)
fi
# If we have a fwprintf in libc, test that it actually works. As of
# March 2006, it is broken under Dragonfly BSD.
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([
@@ -271,9 +374,6 @@ else
AC_MSG_RESULT(no)
fi
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])
AC_TRY_LINK([#if HAVE_LIBINTL_H]
@@ -290,9 +390,8 @@ else
fi
# 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_CONFIG_FILES([Makefile fish.spec doc_src/fish.1 doc_src/Doxyfile etc/fish etc/fish_interactive.fish share/fish seq])
AC_OUTPUT
echo "fish is now configured."
echo "Now run 'make' and 'make install' to built and install fish."
echo "Good luck!"
echo "Use 'make' and 'make install' to built and install fish."

View File

@@ -33,8 +33,9 @@ the manual page for the echo command by writing:
<code>man echo</code>
\c man is a command for displaying a manual page on a given
topic. There are manual pages for almost every command on most
\c man is a command for displaying a manual page on a given topic. The
man command takes the name of the manual page to display as an
argument. There are manual pages for almost every command on most
computers. There are also manual pages for many other things, such as
system libraries and important files.
@@ -60,6 +61,17 @@ Commands and parameters are separated by the space character
the return key) or a semicolon (;). More than one command can be
written on the same line by separating them with semicolons.
A switch is a very common special type of argument. Switches almost
always start with one or more hyphens (-) and alter the way a command
operates. For example, the \c ls command usually lists all the files
and directories in the current working directory, but by using the \c
-l switch, the behaviour of ls is changed to not only display the
filename, but also the size, permissions, owner and modification time
of each file. Switches differ between commands and are documented in
the manual page for each command. Some switches are very common
though, for example '--help' will usually display a help text, '-i'
will often turn on interactive prompting before taking action, while
'-f' will turn it off.
\subsection quotes Quotes
@@ -200,7 +212,15 @@ When you start a job in \c fish, \c fish itself will pause, and give
control of the terminal to the program just started. Sometimes, you
want to continue using the commandline, and have the job run in the
background. To create a background job, append a \& (ampersand) to
your command. This will tell fish to run the job in the background.
your command. This will tell fish to run the job in the
background. Background jobs are very useful when running programs that
have a graphical user interface.
Example:
<code>emacs \&</code>
will start the emacs text editor in the background.
\subsection syntax-job-control Job control
@@ -211,16 +231,17 @@ programs and do anything you want. If you then want to go back to the
suspended command by using the <a href="builtins.html#fg">fg</a>
command.
If you instead want to put a suspended job into the foreground, use
the <a href="builtins.html#fg">fg</a> command.
If you instead want to put a suspended job into the background, use
the <a href="builtins.html#bg">bg</a> command.
To get a listing of all currently started jobs, use the <a
href="builtins.html#jobs">jobs</a> command.
\subsection syntax-function Shellscript functions
Functions are used to group together commands and arguments
using a single name. For example, the following is a function
Functions are used to group together commands and arguments using a
single name. It can also be used to start a specific command with
additional arguments. For example, the following is a function
definition that calls the command 'ls -l' to print a detailed listing
of the contents of the current directory:
@@ -237,14 +258,14 @@ $argv</code> should be called when ll is invoked. $argv is an array
variable, which always contains all arguments sent to the function. In
the example above, these are simply passed on to the ls command. For
more information on functions, see the documentation for the <a
href='builtin.html#function'>function builtin</a>.
href='builtin.html#function'>function</a> builtin.
Functions can be defined on the commandline or in a configuration
file, but they can also be automatically loaded. Fish automatically
searches through any directories in the array variable
\$fish_function_path, and any functions defined are automatically
loaded when needed. A function definition file must have a filename
consisting of the name of the function and the suffix '.fish'.
consisting of the name of the function plus the suffix '.fish'.
The default value for \$fish_function_path is ~/.fish.d/functions,
/etc/fish.d/functions /usr/share/fish/functions. The exact path to the
@@ -259,12 +280,13 @@ functions and the last one is for default fish functions.
This is a short explanation of some of the commonly used words in fish.
- argument, a parameter given to a command
- builtin, a command that is implemented in the shell
- command, a program
- function, a block of one or more fish commands that can be called as a single command. By using functions, it is possible to string together multiple smaller commands into one more advanced command.
- builtin, a command that is implemented in the shell. Builtins are commands that are so closely tied to the shell that it is impossible to implement them as external commands.
- command, a program that the shell can run.
- function, a block of commands and arguments that can be called as if they where a single command. By using functions, it is possible to string together multiple smaller commands into one more advanced command.
- job, a running pipeline or command
- pipeline, a set of commands stringed together so that the output of one command is the input of the next command
- redirection, a operation that changes one of the input/output streams associated with a job
- switch, a special flag sent as an argument to a command that will alter the behavious of the command. A switch almost always begins with one or two hyphens.
\section help Help
@@ -1045,9 +1067,14 @@ where \c prompt_pwd is a shellscript function that displays a condensed version
\subsection title Programmable title
When running in a virtual terminal, the user define the \c fish_title
function to print a custom titlebar message. The \c fish_title
function is executed and the output is used as a titlebar message.
When using most virtual terminals, it is possible to set the message
displayed in the titlebar of the terminal window. This can be done
automatically in fish by defining the \c fish_title function. The \c
fish_title function is executed before and after a new command is
executed or put into the foreground and the output is used as a
titlebar message. The $_ environment variable will always contain the
name of the job to be put into the foreground (Or 'fish' if control is
returning to the shell) when the fish_prompt function is called.
Example:
<p>
@@ -1173,6 +1200,7 @@ g++, javac, java, gcj, lpr, doxygen, whois, find)
- Syntax highlighting should mark cd to non-existing directories as an error
- wait shellscript
- Signal handler to save the history file before exiting from a signal
- Support for the screen clipboard
\subsection todo-possible Possible features
@@ -1191,16 +1219,16 @@ g++, javac, java, gcj, lpr, doxygen, whois, find)
- Do not actually load/parse .fish_history, only mmap it and use some clever string handling. Should save ~150 kB of memory permanently, but is very hard to implement.
- command specific wildcarding (use case * instead of case '*', etc.)
- show the whole list of commands on using tab on an empty commandline
- Automatically move cursor to the end of the current token before completing
- Map variables. (export only the values. When expanding with no key specified, expand to all values.)
- Descriptions for variables using 'set -d'.
- Parse errors should when possible honor IO redirections
- Support for writing strings like /u/l/b/foo and have them expand to /usr/local/bin/foo - perhaps through tab expansion
\subsection bugs Known bugs
- Completion for gcc -\#\#\# option doesn't work.
- Yanking weird characters from clipboard prints Unicode escapes
- Yanking weird characters from the clipboard prints Unicode escapes
- Suspending and then resuming pipelines containing a builtin is broken. How should this be handled?
If you think you have found a bug not described here, please send a
@@ -1378,8 +1406,8 @@ Examples:
/** \page license Licenses
Fish Copyright (C) 2005 Axel Liljencrantz. Fish is released under the
GNU General Public License. The license agreement is included
below.
GNU General Public License, version 2. The license agreement is
included below.
Fish contains code under the BSD license, namely versions of the
two functions strlcat and strlcpy, modified for use with wide
@@ -1388,11 +1416,16 @@ license agreement is included below.
The XSel command, written and copyrighted by Conrad Parker, is
distributed together with, and used by fish. It is released under the MIT
license. The license agreement is included below.
license. The license agreement is included below.
The xdgmime library, written and copyrighted by Red Hat, Inc, is used
by the mimedb command, which is a part of fish. It is released under
the LGPL license. The license agreement is included below.
the LGPL. The license agreement is included below.
Fish contains code from the glibc library, namely the wcstok
function. This code is licensed under the LGPL. The license agreement
is included below.
<HR>

26
env.c
View File

@@ -104,7 +104,7 @@ typedef struct env_node
typedef struct var_entry
{
int export; /**< Whether the variable should be exported */
wchar_t val[0]; /**< The value of the variable */
wchar_t val[1]; /**< The value of the variable */
}
var_entry_t;
@@ -608,9 +608,9 @@ static env_node_t *env_get_node( const wchar_t *key )
return 0;
}
void env_set( const wchar_t *key,
const wchar_t *val,
int var_mode )
int env_set( const wchar_t *key,
const wchar_t *val,
int var_mode )
{
int free_val = 0;
var_entry_t *entry;
@@ -626,7 +626,7 @@ void env_set( const wchar_t *key,
if( (var_mode & ENV_USER ) &&
hash_get( &env_read_only, key ) )
{
return;
return ENV_PERM;
}
if( wcscmp( key, L"umask" ) == 0)
@@ -650,7 +650,7 @@ void env_set( const wchar_t *key,
/*
Do not actually create a umask variable, on env_get, it will be calculated dynamically
*/
return;
return 0;
}
/*
@@ -749,7 +749,7 @@ void env_set( const wchar_t *key,
node = top;
while( node->next && !node->new_scope )
node = node->next;
}
}
}
@@ -809,7 +809,8 @@ void env_set( const wchar_t *key,
{
handle_locale();
}
return 0;
}
@@ -820,14 +821,19 @@ void env_set( const wchar_t *key,
static int try_remove( env_node_t *n,
const wchar_t *key )
{
const void *old_key_void, *old_val_void;
wchar_t *old_key, *old_val;
if( n == 0 )
return 0;
hash_remove( &n->env,
key,
(const void **)&old_key,
(const void **)&old_val );
&old_key_void,
&old_val_void );
old_key = (wchar_t *)old_key_void;
old_val = (wchar_t *)old_val_void;
if( old_key != 0 )
{
var_entry_t * v = (var_entry_t *)old_val;

13
env.h
View File

@@ -41,6 +41,11 @@
*/
#define ENV_UNIVERSAL 32
/**
Error code for trying to alter read-only variable
*/
#define ENV_PERM 1
/**
Initialize environment variable data
*/
@@ -61,9 +66,15 @@ void env_destroy();
\param val The value
\param mode The type of the variable. Can be any combination of ENV_GLOBAL, ENV_LOCAL, ENV_EXPORT and ENV_USER. If mode is zero, the current variable space is searched and the current mode is used. If no current variable with the same name is found, ENV_LOCAL is assumed.
\returns 0 on suicess or an error code on failiure.
The current error codes are:
* ENV_PERM, can only be returned when setting as a user, e.g. ENV_USER is set. This means that the user tried to change a read-only variable.
*/
void env_set( const wchar_t *key,
int env_set( const wchar_t *key,
const wchar_t *val,
int mode );

View File

@@ -4,7 +4,7 @@
# @configure_input@
#
# Set default search paths
# Set default search paths for completions and shellscript functions
#
set -g fish_function_path ~/.fish.d/functions @SYSCONFDIR@/fish.d/functions @DATADIR@/fish/functions
@@ -17,39 +17,40 @@ set -g fish_complete_path ~/.fish.d/completions @SYSCONFDIR@/fish.d/completions
set -g IFS \ \t\n
#
# Add a few common directories to path, if they exists. Note that pure
# console programs like makedep sometimes live in /usr/X11R6/bin, so we
# want this even for text-only terminals.
# Some things should only be done for login terminals
#
set -l path_list /bin /usr/bin /usr/X11R6/bin @PREFIX@/bin @optbindirs@
if status --is-login
# Root should also have the sbin directories in the path
if test "$USER" = root
set path_list $path_list /sbin /usr/sbin /usr/local/sbin
end
#
# Set some value for LANG if nothing was set before, and this is a
# login shell.
#
for i in $path_list
if not expr "$PATH" : .\*$i.\* >/dev/null
if test -d $i
set PATH $PATH $i
if not set -q LANG >/dev/null
set -gx LANG en_US.UTF-8
end
# Check for i18n information in
# /etc/sysconfig/i18n
if test -f /etc/sysconfig/i18n
eval (cat /etc/sysconfig/i18n |sed -ne 's/^\([a-zA-Z]*\)=\(.*\)$/set -gx \1 \2;/p')
end
#
# Put linux consoles in unicode mode.
#
if expr "$LANG" : ".*\.[Uu][Tt][Ff].*" >/dev/null
if test "$TERM" = linux
if which unicode_start >/dev/null
unicode_start
end
end
end
end
#
# Put linux console in unicode mode. Should this be done in any other
# situation as well?
#
if expr "$LANG" : ".*[Uu][Tt][Ff]" >/dev/null
if test linux = "$TERM"
unicode_start ^/dev/null
end
end
#
# There are variables that contain colons that are not arrays. This
# reverts them back to regular strings.

View File

@@ -42,7 +42,7 @@ end
#
# Set various color values
# Set various defaults using these throwaway functions
#
function set_default -d "Set an universal variable, unless it has already been set"
@@ -85,7 +85,10 @@ 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
@@ -96,7 +99,7 @@ set_default fish_color_history_current cyan
set_default CDPATH . ~
#
# Remove temporary functions
# Remove temporary functions for setting default variable values
#
functions -e set_exported_default

11
exec.c
View File

@@ -653,8 +653,6 @@ void exec( job_t *j )
pid_t pid;
int mypipe[2];
sigset_t chldset;
sigemptyset( &chldset );
sigaddset( &chldset, SIGCHLD );
int skip_fork;
io_data_t pipe_read, pipe_write;
@@ -667,6 +665,11 @@ void exec( job_t *j )
*/
int exec_error=0;
if( no_exec )
return;
sigemptyset( &chldset );
sigaddset( &chldset, SIGCHLD );
debug( 4, L"Exec job '%ls' with id %d", j->command, j->job_id );
@@ -1206,14 +1209,12 @@ void exec( job_t *j )
{
proc_last_bg_pid = j->pgid;
}
if( !exec_error )
{
job_continue (j, 0);
}
debug( 3, L"End of exec()" );
}
int exec_subshell( const wchar_t *cmd,

View File

@@ -429,7 +429,6 @@ static int find_process( const wchar_t *proc,
{
result = malloc(sizeof(wchar_t)*16 );
swprintf( result, 16, L"%d", j->pgid );
//fwprintf( stderr, L"pid %d %ls\n", j->pgid, result );
al_push( out, result );
found = 1;
}
@@ -441,12 +440,9 @@ static int find_process( const wchar_t *proc,
for( j=first_job; j != 0; j=j->next )
{
// fwprintf( stderr, L"..." );
if( j->command == 0 )
continue;
// fwprintf( stderr, L"match '%ls' '%ls'\n\n\n", j->command, proc );
if( match_pid( j->command, proc, flags ) )
{
if( flags & ACCEPT_INCOMPLETE )
@@ -455,8 +451,6 @@ static int find_process( const wchar_t *proc,
COMPLETE_SEP_STR,
COMPLETE_JOB_DESC,
(void *)0 );
// fwprintf( stderr, L"Woot %ls\n", res );
al_push( out, res );
}
else
@@ -482,12 +476,9 @@ static int find_process( const wchar_t *proc,
for( p=j->first_process; p; p=p->next )
{
// fwprintf( stderr, L"..." );
if( p->actual_cmd == 0 )
continue;
// fwprintf( stderr, L"match '%ls' '%ls'\n\n\n", j->command, proc );
if( match_pid( p->actual_cmd, proc, flags ) )
{
if( flags & ACCEPT_INCOMPLETE )
@@ -687,27 +678,22 @@ static int expand_pid( wchar_t *in,
}
}
// fwprintf( stderr, L"expand_pid() %ls\n", in );
int prev = al_get_count( out );
if( !find_process( in+1, flags, out ) )
return 0;
if( prev == al_get_count( out ) )
{
// fwprintf( stderr, L"no match\n" );
if( flags & ACCEPT_INCOMPLETE )
free( in );
else
{
*in = L'%';
// fwprintf( stderr, L"return %ls\n", in );
al_push( out, in );
}
}
else
{
// fwprintf( stderr, L"match\n" );
free( in );
}
@@ -967,7 +953,7 @@ static int expand_variables( wchar_t *in, array_list_t *out, int last_idx )
else
{
wcsncpy( new_in, in, start_pos-1 );
wcslcpy( new_in, in, start_pos );
if(start_pos>1 && new_in[start_pos-2]!=VARIABLE_EXPAND)
{
@@ -980,7 +966,6 @@ static int expand_variables( wchar_t *in, array_list_t *out, int last_idx )
wcscat( new_in, next );
wcscat( new_in, &in[stop_pos] );
// fwprintf( stderr, L"New value %ls\n", new_in );
is_ok &= expand_variables( new_in, out, i );
}
}
@@ -1059,9 +1044,6 @@ static int expand_brackets( wchar_t *in, int flags, array_list_t *out )
wchar_t *item_begin;
int len1, len2, tot_len;
// fwprintf( stderr, L"expand %ls\n", in );
for( pos=in;
(!bracket_end) && (*pos) && !syntax_error;
pos++ )
@@ -1153,8 +1135,8 @@ static int expand_brackets( wchar_t *in, int flags, array_list_t *out )
int item_len = pos-item_begin;
whole_item = malloc( sizeof(wchar_t)*(tot_len + item_len + 1) );
wcsncpy( whole_item, in, len1 );
wcsncpy( whole_item+len1, item_begin, item_len );
wcslcpy( whole_item, in, len1+1 );
wcslcpy( whole_item+len1, item_begin, item_len+1 );
wcscpy( whole_item+len1+item_len, bracket_end+1 );
expand_brackets( whole_item, flags, out );
@@ -1234,7 +1216,7 @@ static int expand_subshell( wchar_t *in, array_list_t *out )
return 0;
}
wcsncpy( subcmd, paran_begin+1, paran_end-paran_begin-1 );
wcslcpy( subcmd, paran_begin+1, paran_end-paran_begin );
subcmd[ paran_end-paran_begin-1]=0;
if( exec_subshell( subcmd, &sub_res)==-1 )
@@ -1310,7 +1292,6 @@ static wchar_t * expand_tilde_internal( wchar_t *in )
wchar_t *new_in=0;
wchar_t *old_in=0;
// fwprintf( stderr, L"Tilde expand ~%ls\n", (*ptr)+1 );
if( in[1] == '/' || in[1] == '\0' )
{
/* Current users home directory */
@@ -1439,7 +1420,6 @@ int expand_string( void *context,
// debug( 1, L"Expand %ls", str );
if( (!(flags & ACCEPT_INCOMPLETE)) && is_clean( str ) )
{
halloc_register( context, str );

View File

@@ -38,17 +38,17 @@
#include <ncurses/term.h>
#endif
#include "common.h"
#include "fallback.h"
#include "util.h"
#ifdef TPUTS_KLUDGE
int tputs(const char *str, int affcnt, int (*putc)(tputs_arg_t))
int tputs(const char *str, int affcnt, int (*fish_putc)(tputs_arg_t))
{
while( *str )
{
putc( *str++ );
fish_putc( *str++ );
}
}
@@ -818,8 +818,7 @@ wchar_t *wcsndup( const wchar_t *in, int c )
{
return 0;
}
wcsncpy( res, in, c+1 );
res[c] = L'\0';
wcslcpy( res, in, c+1 );
return res;
}
#endif
@@ -888,6 +887,113 @@ long wcstol(const wchar_t *nptr,
nptr++;
}
}
#endif
#ifndef HAVE_WCSLCAT
/*$OpenBSD: strlcat.c,v 1.11 2003/06/17 21:56:24 millert Exp $*/
/*
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
size_t
wcslcat(wchar_t *dst, const wchar_t *src, size_t siz)
{
register wchar_t *d = dst;
register const wchar_t *s = src;
register size_t n = siz;
size_t dlen;
/* Find the end of dst and adjust bytes left but don't go past end */
while (n-- != 0 && *d != '\0')
d++;
dlen = d - dst;
n = siz - dlen;
if (n == 0)
return(dlen + wcslen(s));
while (*s != '\0')
{
if (n != 1)
{
*d++ = *s;
n--;
}
s++;
}
*d = '\0';
return(dlen + (s - src));
/* count does not include NUL */
}
#endif
#ifndef HAVE_WCSLCPY
/*$OpenBSD: strlcpy.c,v 1.8 2003/06/17 21:56:24 millert Exp $*/
/*
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
size_t
wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz)
{
register wchar_t *d = dst;
register const wchar_t *s = src;
register size_t n = siz;
/* Copy as many bytes as will fit */
if (n != 0 && --n != 0)
{
do
{
if ((*d++ = *s++) == 0)
break;
}
while (--n != 0);
}
/* Not enough room in dst, add NUL and traverse rest of src */
if (n == 0)
{
if (siz != 0)
*d = '\0';
/* NUL-terminate dst */
while (*s++)
;
}
return(s - src - 1);
/* count does not include NUL */
}
#endif

View File

@@ -4,25 +4,34 @@
#include <stdio.h>
#include <stdarg.h>
#include <wctype.h>
#include <wchar.h>
#include "common.h"
/**
Under curses, tputs expects an int (*func)(char) as its last
parameter, but in ncurses, tputs expects a int (*func)(int) as its
last parameter. tputs_arg_t is defined to always be what tputs
expects. Hopefully.
*/
#ifdef NCURSES_VERSION
typedef int tputs_arg_t;
#else
typedef char tputs_arg_t;
#endif
#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));
int tputs(const char *str, int affcnt, int (*fish_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.
*/
#ifndef HAVE_FWPRINTF
/**
Print formated string. Some operating systems (Like NetBSD) do not
@@ -79,6 +88,9 @@ int vfwprintf( FILE *f, const wchar_t *filter, va_list va );
*/
int vswprintf( wchar_t *out, size_t n, const wchar_t *filter, va_list va );
#endif
#ifndef HAVE_FGETWC
/**
Fallback implementation of fgetwc
*/
@@ -89,6 +101,10 @@ wint_t fgetwc(FILE *stream);
*/
wint_t getwc(FILE *stream);
#endif
#ifndef HAVE_FPUTWC
/**
Fallback implementation of fputwc
*/
@@ -98,11 +114,18 @@ wint_t fputwc(wchar_t wc, FILE *stream);
*/
wint_t putwc(wchar_t wc, FILE *stream);
#endif
#ifndef HAVE_WCSTOK
/**
Fallback implementation of wcstok. Uses code borrowed from glibc.
*/
wchar_t *wcstok(wchar_t *wcs, const wchar_t *delim, wchar_t **ptr);
#endif
#ifndef HAVE_WCWIDTH
/**
Return the number of columns used by a character. This is a libc
@@ -117,14 +140,28 @@ wchar_t *wcstok(wchar_t *wcs, const wchar_t *delim, wchar_t **ptr);
*/
int wcwidth( wchar_t c );
#endif
#ifndef HAVE_WCSDUP
/**
Create a duplicate string. Wide string version of strdup. Will
automatically exit if out of memory.
*/
wchar_t *wcsdup(const wchar_t *in);
#endif
#ifndef HAVE_WCSLEN
/**
Fallback for wcsen. Returns the length of the specified string.
*/
size_t wcslen(const wchar_t *in);
#endif
#ifndef HAVE_WCSCASECMP
/**
Case insensitive string compare function. Wide string version of
strcasecmp.
@@ -138,6 +175,10 @@ size_t wcslen(const wchar_t *in);
*/
int wcscasecmp( const wchar_t *a, const wchar_t *b );
#endif
#ifndef HAVE_WCSNCASECMP
/**
Case insensitive string compare function. Wide string version of
strncasecmp.
@@ -157,14 +198,27 @@ int wcsncasecmp( const wchar_t *a, const wchar_t *b, int count );
always null terminated, and the null is not included in the string
length.
*/
#endif
#ifndef HAVE_WCSNDUP
/**
Fallback for wcsndup function. Returns a copy of \c in, truncated
to a maximum length of \c c.
*/
wchar_t *wcsndup( const wchar_t *in, int c );
#endif
/**
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 );
#ifndef HAVE_WCSTOL
/**
Fallback implementation. Convert a wide character string to a
number in the specified base. This functions is the wide character
@@ -177,6 +231,35 @@ long wcstol(const wchar_t *nptr,
wchar_t **endptr,
int base);
#endif
#ifndef HAVE_WCSLCAT
/**
Appends src to string dst of size siz (unlike wcsncat, siz is the
full size of dst, not space left). At most siz-1 characters will be
copied. Always NUL terminates (unless siz <= wcslen(dst)). Returns
wcslen(src) + MIN(siz, wcslen(initial dst)). If retval >= siz,
truncation occurred.
This is the OpenBSD strlcat function, modified for wide characters,
and renamed to reflect this change.
*/
size_t wcslcat( wchar_t *dst, const wchar_t *src, size_t siz );
#endif
#ifndef HAVE_WCSLCPY
/**
Copy src to string dst of size siz. At most siz-1 characters will
be copied. Always NUL terminates (unless siz == 0). Returns
wcslen(src); if retval >= siz, truncation occurred.
This is the OpenBSD strlcpy function, modified for wide characters,
and renamed to reflect this change.
*/
size_t wcslcpy( wchar_t *dst, const wchar_t *src, size_t siz );
#endif
#endif

View File

@@ -1,3 +1,5 @@
%define xinclude %( if test -d /usr/X11R6/include; then echo /usr/X11R6/include; else echo /usr/include; fi )
Summary: A friendly interactive shell
Name: @PACKAGE_NAME@
@@ -11,8 +13,9 @@ URL: http://roo.no-ip.org/fish/
Source0: http://roo.no-ip.org/%{name}/files/%{version}/%{name}-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: doxygen ncurses-devel xorg-x11-devel
BuildRequires: doxygen ncurses-devel
BuildRequires: %{xinclude}/X11/StringDefs.h, %{xinclude}/X11/Xlib.h
BuildRequires: %{xinclude}/X11/Intrinsic.h, %{xinclude}/X11/Xatom.h

View File

@@ -195,14 +195,17 @@ int function_exists( const wchar_t *cmd )
void function_remove( const wchar_t *name )
{
void *key;
const void *dv;
function_data_t *d;
event_t ev;
hash_remove( &function,
name,
(const void **) &key,
(const void **)&d );
&dv );
d=(function_data_t *)dv;
if( !key )
return;

View File

@@ -41,7 +41,7 @@ typedef struct halloc
static halloc_t *halloc_from_data( void *data )
{
return (halloc_t *)(data - sizeof( halloc_t ) );
return (halloc_t *)(((char *)data) - sizeof( halloc_t ) );
}
static void late_free( void *data)
@@ -83,7 +83,7 @@ void *halloc( void *context, size_t size )
{
res = parent->scratch;
parent->scratch_free -= size;
parent->scratch += size;
parent->scratch = ((char *)parent->scratch)+size;
}
else
{
@@ -98,7 +98,7 @@ void *halloc( void *context, size_t size )
alloc_spill += parent->scratch_free;
#endif
res = calloc( 1, size + HALLOC_BLOCK_SIZE );
parent->scratch = res + size;
parent->scratch = (char *)res + size;
parent->scratch_free = HALLOC_BLOCK_SIZE;
}
else
@@ -121,7 +121,7 @@ void *halloc( void *context, size_t size )
#ifdef HALLOC_DEBUG
parent_count++;
#endif
me->scratch = ((void *)me) + sizeof(halloc_t) + size;
me->scratch = ((char *)me) + sizeof(halloc_t) + size;
me->scratch_free = HALLOC_BLOCK_SIZE;
al_init( &me->children );

View File

@@ -291,7 +291,7 @@ static void history_save()
history_count=0;
past_end=1;
history_load( mode_name );
history_load();
if( real_pos != 0 )
{
/*

12
input.c
View File

@@ -228,6 +228,8 @@ static int inputrc_block_count=0;
*/
static int inputrc_error = 0;
static int is_init = 0;
wchar_t input_get_code( wchar_t *name )
{
@@ -1346,6 +1348,11 @@ int input_init()
{
wchar_t *fn;
if( is_init )
return 1;
is_init = 1;
input_common_init( &interrupt_handler );
if( setupterm( 0, STDOUT_FILENO, 0) == ERR )
@@ -1424,6 +1431,11 @@ static void destroy_mapping( const void *key, const void *val )
void input_destroy()
{
if( !is_init )
return;
is_init=0;
input_common_destroy();
hash_foreach( &all_mappings, &destroy_mapping );

View File

@@ -9,6 +9,7 @@ inputrc information for key bindings.
#define FISH_INPUT_H
#include <wchar.h>
#include "input_common.h"
/**
Key codes for inputrc-style keyboard functions that are passed on

View File

@@ -89,16 +89,9 @@ static wint_t readb()
case EINTR:
case EAGAIN:
{
// wperror( L"select" );
if( interrupt_handler )
{
int res = interrupt_handler();
/* debug( 0,
L"interrupt, %d is %ls",
res,
(res==R_NULL?L"good": L"Bad") );
*/
if( res )
return res;
}
@@ -143,6 +136,7 @@ static wint_t readb()
return arr[0];
}
wchar_t input_common_readch( int timed )
{
if( lookahead_count == 0 )

View File

@@ -13,6 +13,8 @@
#include <locale.h>
#include <termcap.h>
#include "fallback.h"
#include "input_common.h"
int writestr( char *str )

36
main.c
View File

@@ -62,6 +62,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "translate.h"
#include "halloc_util.h"
/**
Parse init files
*/
@@ -69,7 +70,7 @@ static int read_init()
{
char cwd[4096];
wchar_t *wcwd;
if( !getcwd( cwd, 4096 ) )
{
wperror( L"getcwd" );
@@ -77,11 +78,11 @@ static int read_init()
}
env_set( L"__fish_help_dir", DOCDIR, 0);
eval( L"builtin cd " DATADIR L"/fish 2>/dev/null; . fish 2>/dev/null", 0, TOP );
eval( L"builtin cd " SYSCONFDIR L" 2>/dev/null; . fish 2>/dev/null", 0, TOP );
eval( L"builtin cd 2>/dev/null;. .fish 2>/dev/null", 0, TOP );
if( chdir( cwd ) == -1 )
{
// fwprintf( stderr, L"Invalid directory: %s\n", cwd );
@@ -137,6 +138,10 @@ int main( int argc, char **argv )
"login", no_argument, 0, 'l'
}
,
{
"no-execute", no_argument, 0, 'n'
}
,
{
"profile", required_argument, 0, 'p'
}
@@ -159,14 +164,14 @@ int main( int argc, char **argv )
int opt = getopt_long( argc,
argv,
"hilvc:p:d:",
"hilnvc:p:d:",
long_options,
&opt_index );
#else
int opt = getopt( argc,
argv,
"hilvc:p:d:" );
"hilnvc:p:d:" );
#endif
if( opt == -1 )
break;
@@ -209,6 +214,10 @@ int main( int argc, char **argv )
is_login=1;
break;
case 'n':
no_exec=1;
break;
case 'p':
profile = optarg;
break;
@@ -235,6 +244,15 @@ int main( int argc, char **argv )
is_interactive_session &= isatty(STDIN_FILENO);
is_interactive_session |= force_interactive;
/*
No-exec is prohibited when in interactive mode
*/
if( is_interactive_session && no_exec)
{
debug( 1, _(L"Can not use the no-execute mode when running an interactive session") );
no_exec = 0;
}
common_init();
halloc_util_init();
@@ -248,7 +266,8 @@ int main( int argc, char **argv )
env_init();
complete_init();
reader_init();
history_init();
if( read_init() )
{
if( cmd != 0 )
@@ -279,10 +298,10 @@ int main( int argc, char **argv )
return 1;
}
sb_init( &sb );
if( *(argv+2))
{
sb_init( &sb );
for( i=1,ptr = argv+2; *ptr; i++, ptr++ )
{
if( i != 1 )
@@ -319,6 +338,7 @@ int main( int argc, char **argv )
proc_fire_event( L"PROCESS_EXIT", EVENT_EXIT, getpid(), res );
history_destroy();
complete_destroy();
proc_destroy();
env_destroy();

View File

@@ -463,11 +463,7 @@ int parser_is_subcommand( const wchar_t *cmd )
(void *)0 );
}
/**
Test if the specified string is command that opens a new block
*/
static int parser_is_block( const wchar_t *word)
int parser_is_block( const wchar_t *word)
{
return contains_str( word,
L"for",
@@ -2501,7 +2497,6 @@ int eval( const wchar_t *cmd, io_data_t *io, int block_type )
return code;
}
int parser_test( wchar_t * buff,
int babble )
{
@@ -2521,7 +2516,7 @@ int parser_test( wchar_t * buff,
current_tokenizer = &tok;
for( tok_init( &tok, buff, 0 );
tok_has_next( &tok ) && !err;
tok_has_next( &tok );
tok_next( &tok ) )
{
current_tokenizer_pos = tok_get_pos( &tok );

View File

@@ -259,6 +259,12 @@ int parser_is_subcommand( const wchar_t *cmd );
*/
int parser_is_reserved( const wchar_t *word );
/**
Test if the specified string is command that opens a new block
*/
int parser_is_block( const wchar_t *word);
/**
Returns a string describing the current parser pisition in the format 'FILENAME (line LINE_NUMBER): LINE'.
Example:

View File

@@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: fish 1.20.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2006-03-07 13:37+0100\n"
"PO-Revision-Date: 2006-03-07 03:20+0100\n"
"PO-Revision-Date: 2006-03-13 18:06+0100\n"
"Last-Translator: Axel Liljencrantz <liljencrantz@gmail.com>\n"
"Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n"
"MIME-Version: 1.0\n"
@@ -3079,16 +3079,16 @@ msgstr ""
#: share/completions/cdrecord.fish:14
msgid "Complete CD/DVD-Recorder recording process with the laser turned off"
msgstr ""
msgstr "Fullfölj CD/DVD-brännarens inspelningsprocess med lasern avstängd"
#: share/completions/cdrecord.fish:15
msgid "Tells cdrecord to handle images created by readcd -clone"
msgstr ""
msgstr "Ange att cdrecord ska hantera bilder skapade av readcd -clone"
#: share/completions/cdrecord.fish:17
msgid "Set SAO (Session At Once) mode, usually called Disk At Once mode"
msgstr ""
"<Välj SAO- (Session At Once) skrivläge, vanlightvis kallat Disk At Once-"
"Välj SAO- (Session At Once) skrivläge, vanligtvis kallat Disk At Once-"
"skrivläge"
#: share/completions/cdrecord.fish:18
@@ -3102,112 +3102,110 @@ msgstr "Välj RAW-skrivläge"
#: share/completions/cdrecord.fish:20
msgid "Select Set RAW writing, the preferred raw writing mode"
msgstr ""
msgstr "Välj det bättre RAW-skrivläget"
#: share/completions/cdrecord.fish:21
msgid "Select Set RAW writing, the less preferred raw writing mode"
msgstr ""
msgstr "Välj det mindre bra RAW-skrivläget"
#: share/completions/cdrecord.fish:22
msgid ""
"Select Set RAW writing, the preferred raw writing mode if raw96r is not "
"supported"
msgstr ""
msgstr "Välj det RAW-skrivläget som är bäst om stöd saknas för raw96r"
#: share/completions/cdrecord.fish:23
msgid "Allow multi session CDs to be made"
msgstr ""
msgstr "Tillåt skapandet av multisessions-CD"
#: share/completions/cdrecord.fish:24
msgid ""
"Retrieve multi session info in a form suitable for mkisofs-1.10 or later"
msgstr ""
msgstr "Hämta multisessionsinfo i ett format lämpligt för mkisofs-1.10 och senare"
#: share/completions/cdrecord.fish:25
msgid "Retrieve and print out the table of content or PMA of a CD"
msgstr ""
msgstr "Hämta och skriv ut innehållsförteckningen eller PMA för en CD"
#: share/completions/cdrecord.fish:26
msgid "Retrieve and print out the ATIP (absolute Time in Pre-groove) info"
msgstr ""
msgstr "Hämta och skriv ut ATIP (absolute Time in Pre-groove) info"
#: share/completions/cdrecord.fish:27
msgid "The disk will only be fixated"
msgstr ""
msgstr "Fixera endast skivan"
#: share/completions/cdrecord.fish:28
msgid "Do not fixate the disk after writing the tracks"
msgstr ""
msgstr "Fixera inte skivan efter stt spåren skrivits"
#: share/completions/cdrecord.fish:29
msgid ""
"Wait for input to become available on standard input before trying to open "
"the SCSI driver"
msgstr ""
msgstr "Vänta på att indata ska bli tillgängligt från standard in innan försök rill att öppna SCSI-enheten"
#: share/completions/cdrecord.fish:30
msgid "Load the media and exit"
msgstr ""
msgstr "Ladda mediet och avsluta"
#: share/completions/cdrecord.fish:31
msgid "Load the media, lock the door and exit"
msgstr ""
msgstr "Ladda mediet, lås luckan och avsluta"
#: share/completions/cdrecord.fish:32
msgid "Eject disk after doing the work"
msgstr ""
msgstr "Skicka ut skivan efter arbetets utförande"
#: share/completions/cdrecord.fish:33
msgid "Set the speed factor of the writing process to #"
msgstr ""
msgstr "Sätt hastighetsfaktorn för skrivprocessen"
#: share/completions/cdrecord.fish:34
msgid "Blank a CD-RW and exit or blank a CD-RW before writing"
msgstr ""
msgstr "Töm en CD-RW och avsluta eller töm en CD-RW för skrivning"
#: share/completions/cdrecord.fish:35
msgid "Format a CD-RW/DVD-RW/DVD+RW disc"
msgstr ""
msgstr "Formatera en CD-RW/DVD-RW/DVD+RW-skiva"
#: share/completions/cdrecord.fish:36
#, fuzzy
msgid "Set the FIFO (ring buffer) size to #"
msgstr "Välj minnesbuffertstorlek"
msgstr "Välj FIFO- (ringbuffert) storlek"
#: share/completions/cdrecord.fish:37
msgid "Set the maximum transfer size for a single SCSI command to #"
msgstr ""
msgstr "Välj maximal överföringshastighet för ett enkilt SCSI-kommando"
#: share/completions/cdrecord.fish:38
msgid "Sets the SCSI target for the CD/DVD-Recorder"
msgstr ""
msgstr "Välj SCSI-målet för CD/DVD-brännaren"
#: share/completions/cdrecord.fish:39
msgid "Set the grace time before starting to write to ># seconds"
msgstr ""
msgstr "Välj väntetiden i sekunder innan skrivning till skivan påbörjas"
#: share/completions/cdrecord.fish:40
msgid "Set the default SCSI command timeout value to # seconds"
msgstr ""
msgstr "Välj standard-SCSI-timeoutvärdet i sekunder"
#: share/completions/cdrecord.fish:41
msgid "Allows the user to manually select a driver for the device"
msgstr ""
msgstr "Låter användaren manuellt välja en drivrutin för enheten"
#: share/completions/cdrecord.fish:45
#, fuzzy
msgid "Set driver specific options"
msgstr "Välj konfigurationsinställningar"
msgstr "Välj drivrutinsspecifika inställningar"
#: share/completions/cdrecord.fish:46
msgid ""
"Set the driveropts specified by driveropts=option list, the speed of the "
"drive and the dummy flag and exit"
msgstr ""
msgstr "Välj drivrutinsinställningar angivna av listandriveropt=inställning, hastigheten på enheten och dunny-flaggan och avsluta"
#: share/completions/cdrecord.fish:47
msgid "Checks if a driver for the current drive is present and exit"
msgstr ""
msgstr "Kontrollerar om en drivrutin för den nuvarande enheten finns tillgänglig och avsluta"
#: share/completions/cdrecord.fish:48
msgid ""
@@ -3217,64 +3215,63 @@ msgstr ""
#: share/completions/cdrecord.fish:49
msgid "Do an inquiry for the drive, print the inquiry info and exit"
msgstr ""
msgstr "Utför en föffrågan på enheten, visa förfrågningsinformationen och avsluta"
#: share/completions/cdrecord.fish:50
msgid "Scan all SCSI devices on all SCSI busses and print the inquiry strings"
msgstr ""
msgstr "Genomsök alla SCSI-enheter på alla SCSI-bussar och skriv ut förfrågningssträngarna"
#: share/completions/cdrecord.fish:51
msgid "Try to reset the SCSI bus where the CD recorder is located"
msgstr ""
msgstr "Försök att återställa SCSI-bussen som CD-brännaren befinner sig på"
#: share/completions/cdrecord.fish:52
msgid "Try to send an abort sequence to the drive"
msgstr ""
msgstr "Försök skicka en avbrottssekvens till enheten"
#: share/completions/cdrecord.fish:53
msgid "Allow cdrecord to write more than the official size of a medium"
msgstr ""
msgstr "Tillåt cdrecord att skriva mer än den officiella storleken på ett medium"
#: share/completions/cdrecord.fish:54
msgid "Ignore the known size of the medium, use for debugging only"
msgstr ""
msgstr "Ignorera den kända storleken på ett medium, använd endast vid debuggning"
#: share/completions/cdrecord.fish:55
#, fuzzy
msgid "Use *.inf files to overwrite audio options"
msgstr "Svar till överskrivningsfrågor"
msgstr "Använd *.inf-filer för att skriva över ljudinställningar"
#: share/completions/cdrecord.fish:56
msgid "Set the default pre-gap size for all tracks except track nr 1"
msgstr ""
msgstr "Välj standard-pre-gap-storlek för alla spår utom spår 1"
#: share/completions/cdrecord.fish:57
msgid "Set Packet writing mode (experimental interface)"
msgstr ""
msgstr "Välj paketskrivningsläge (experimentellt gränssnitt)"
#: share/completions/cdrecord.fish:58
msgid "Set the packet size to #, forces fixed packet mode (experimental)"
msgstr ""
msgstr "Ange paketstorlek, tvingar fast paket-läge (experimentell)"
#: share/completions/cdrecord.fish:59
msgid ""
"Do not close the current track, only when in packet writing mode "
"(experimental)"
msgstr ""
msgstr "Avsluta inte det nuvarande spåret, bara i paketskrivningsläge (experimentell)"
#: share/completions/cdrecord.fish:60
msgid "Set the Media Catalog Number of the CD"
msgstr ""
msgstr "Välj Mediakatalog-nummer för CD:n"
#: share/completions/cdrecord.fish:61
msgid ""
"Write CD-Text info based on info taken from a file that contains ascii info "
"for the text strings"
msgstr ""
msgstr "Skriv CD-Text-infromation baserat på information tagen från fil i ascii-format"
#: share/completions/cdrecord.fish:62
msgid "Write CD-Text based on info found in the binary file filename"
msgstr ""
msgstr "Skriv CD-Text-infromation baserat på information tagen från fil i binärt format"
#: share/completions/cdrecord.fish:63
msgid "Take all recording related info from a CDRWIN compliant CUE sheet file"
@@ -4766,7 +4763,7 @@ msgstr "Skriv ut NUM rader av unifieradt sammanhang"
#: share/completions/diff.fish:16
msgid "Output 3 lines of unified context"
msgstr "Skriv ut 3 rader av unifieradt sammanhang"
msgstr "Skriv ut 3 rader av unifierat sammanhang"
#: share/completions/diff.fish:17
msgid "Output only whether the files differ"

43
proc.c
View File

@@ -90,6 +90,8 @@ int is_event=0;
int proc_had_barrier;
pid_t proc_last_bg_pid = 0;
int job_control_mode = JOB_CONTROL_INTERACTIVE;
int no_exec=0;
/**
The event variable used to send all process event
@@ -192,7 +194,7 @@ job_t *job_create()
res->job_control = (job_control_mode==JOB_CONTROL_ALL) ||
((job_control_mode == JOB_CONTROL_INTERACTIVE) && (is_interactive));
// if( res->job_id > 2 )
// fwprintf( stderr, L"Create job %d\n", res->job_id );
return res;
@@ -263,28 +265,12 @@ int job_is_completed( const job_t *j )
{
if (!p->completed)
{
// fwprintf( stderr, L"Process %ls not finished\n", p->argv[0] );
return 0;
}
}
return 1;
}
/**
Return true if all processes in the job have completed.
\param j the job to test
*/
static int job_last_is_completed( const job_t *j )
{
process_t *p;
for (p = j->first_process; p->next; p = p->next)
;
return p->completed;
}
/**
Store the status of the process pid that was returned by waitpid.
Return 0 if all went well, nonzero otherwise.
@@ -501,6 +487,11 @@ int job_reap( int interactive )
static int locked = 0;
locked++;
/*
job_read may fire an event handler, we do not want to call
ourselves recursively (to avoid infinite recursion).
*/
if( locked>1 )
return 0;
@@ -509,6 +500,11 @@ int job_reap( int interactive )
process_t *p;
jnext = j->next;
/*
If we are reaping only jobs who do not need status messages
sent to the console, do not consider reaping jobs that need
status messages
*/
if( (!j->skip_notification) && (!interactive) && (!j->fg))
{
continue;
@@ -813,8 +809,7 @@ static void read_try( job_t *j )
else
{
b_append( buff->param2.out_buffer, b, l );
}
}
}
}
}
@@ -829,14 +824,14 @@ void job_continue (job_t *j, int cont)
j->next = first_job;
first_job = j;
j->notified = 0;
debug( 4,
L"Continue on job %d (%ls), %ls, %ls",
L"Continue job %d (%ls), %ls, %ls",
j->job_id,
j->command,
job_is_completed( j )?L"COMPLETED":L"UNCOMPLETED",
is_interactive?L"INTERACTIVE":L"NON-INTERACTIVE" );
if( !job_is_completed( j ) )
{
if( j->terminal && j->fg )
@@ -914,7 +909,7 @@ void job_continue (job_t *j, int cont)
do
{
got_signal = 0;
quit = job_is_stopped( j ) || job_last_is_completed( j );
quit = job_is_stopped( j ) || job_is_completed( j );
}
while( got_signal && !quit );
if( !quit )
@@ -1038,7 +1033,7 @@ void proc_sanity_check()
/*
More than one foreground job?
*/
if( j->fg && !(job_is_stopped(j) || job_last_is_completed(j) ) )
if( j->fg && !(job_is_stopped(j) || job_is_completed(j) ) )
{
if( fg_job != 0 )
{

6
proc.h
View File

@@ -231,6 +231,12 @@ extern pid_t proc_last_bg_pid;
*/
extern int job_control_mode;
/**
If this flag is set, fish will never fork or run execve.
*/
extern int no_exec;
/**
Sets the status of the last process to exit
*/

117
reader.c
View File

@@ -269,12 +269,6 @@ static struct stat prev_buff_1, prev_buff_2, post_buff_1, post_buff_2;
*/
static array_list_t prompt_list;
/**
Stores the previous termios mode so we can reset the modes when
we execute programs and when the shell exits.
*/
static struct termios saved_modes;
/**
Store the pid of the parent process, so the exit function knows whether it should reset the terminal or not.
@@ -295,6 +289,12 @@ static struct termios old_modes;
Prototypes for a bunch of functions defined later on.
*/
/**
Stores the previous termios mode so we can reset the modes when
we execute programs and when the shell exits.
*/
static struct termios saved_modes;
static void reader_save_status();
static void reader_check_status();
static void reader_super_highlight_me_plenty( wchar_t * buff, int *color, int pos, array_list_t *error );
@@ -841,6 +841,16 @@ static void write_cmdline()
void reader_init()
{
tcgetattr(0,&shell_modes); /* get the current terminal modes */
memcpy( &saved_modes,
&shell_modes,
sizeof(saved_modes)); /* save a copy so we can reset the terminal later */
shell_modes.c_lflag &= ~ICANON; /* turn off canonical mode */
shell_modes.c_lflag &= ~ECHO; /* turn off echo mode */
shell_modes.c_cc[VMIN]=1;
shell_modes.c_cc[VTIME]=0;
al_init( &current_filename);
}
@@ -854,6 +864,8 @@ void reader_destroy()
free( readline_buffer );
readline_buffer=0;
}
tcsetattr(0, TCSANOW, &saved_modes);
}
@@ -1571,18 +1583,6 @@ static int handle_completions( array_list_t *comp )
}
}
/**
Reset the terminal. This function is placed in the list of
functions to call when exiting by using the atexit function. It
checks whether it is the original parent process that is exiting
and not a subshell, and if it is the parent, it restores the
terminal.
*/
static void exit_func()
{
if( getpid() == original_pid )
tcsetattr(0, TCSANOW, &saved_modes);
}
/**
Initialize data for interactive use
@@ -1631,20 +1631,9 @@ static void reader_interactive_init()
al_init( &prompt_list );
history_init();
common_handle_winch(0);
tcgetattr(0,&shell_modes); /* get the current terminal modes */
memcpy( &saved_modes,
&shell_modes,
sizeof(saved_modes)); /* save a copy so we can reset the terminal later */
shell_modes.c_lflag &= ~ICANON; /* turn off canonical mode */
shell_modes.c_lflag &= ~ECHO; /* turn off echo mode */
shell_modes.c_cc[VMIN]=1;
shell_modes.c_cc[VTIME]=0;
if( tcsetattr(0,TCSANOW,&shell_modes)) /* set the new modes */
{
wperror(L"tcsetattr");
@@ -1657,9 +1646,6 @@ static void reader_interactive_init()
*/
original_pid = getpid();
if( atexit( &exit_func ) )
debug( 1, _( L"Could not set exit function" ) );
env_set( L"_", L"fish", ENV_GLOBAL );
}
@@ -1671,7 +1657,6 @@ static void reader_interactive_destroy()
kill_destroy();
al_foreach( &prompt_list, (void (*)(const void *))&free );
al_destroy( &prompt_list );
history_destroy();
writestr( L"\n" );
set_color( FISH_COLOR_RESET, FISH_COLOR_RESET );
@@ -2278,7 +2263,19 @@ static int read_i()
if( data->end_loop)
{
if( !prev_end_loop && first_job != 0 )
job_t *j;
int has_job=0;
for( j=first_job; j; j=j->next )
{
if( !job_is_completed(j) )
{
has_job = 1;
break;
}
}
if( !prev_end_loop && has_job )
{
writestr(_( L"There are stopped jobs\n" ));
write_prompt();
@@ -2459,15 +2456,21 @@ wchar_t *reader_readline()
if( comp_empty )
{
const wchar_t *begin, *end;
const wchar_t *token_begin, *token_end;
wchar_t *buffcpy;
int len;
int cursor_steps;
parse_util_cmdsubst_extent( data->buff, data->buff_pos, &begin, &end );
int len = data->buff_pos - (data->buff - begin);
parse_util_token_extent( begin, data->buff_pos - (begin-data->buff), &token_begin, &token_end, 0, 0 );
cursor_steps = token_end - data->buff- data->buff_pos;
data->buff_pos += cursor_steps;
move_cursor( cursor_steps );
len = data->buff_pos - (data->buff - begin);
buffcpy = wcsndup( begin, len );
//fwprintf( stderr, L"String is %ls\n", buffcpy );
reader_save_status();
data->complete_func( buffcpy, &comp );
reader_check_status();
@@ -2476,6 +2479,7 @@ wchar_t *reader_readline()
remove_duplicates( &comp );
free( buffcpy );
}
if( (comp_empty =
handle_completions( &comp ) ) )
@@ -2496,7 +2500,6 @@ wchar_t *reader_readline()
repaint();
// wcscpy(data->search_buff,data->buff);
break;
}
@@ -2516,7 +2519,6 @@ wchar_t *reader_readline()
reader_super_highlight_me_plenty( data->buff, data->color, data->buff_pos, 0 );
repaint();
// wcscpy(data->search_buff,data->buff);
break;
}
@@ -2528,7 +2530,6 @@ wchar_t *reader_readline()
reader_super_highlight_me_plenty( data->buff, data->color, data->buff_pos, 0 );
repaint();
// wcscpy(data->search_buff,data->buff);
break;
}
@@ -2537,7 +2538,6 @@ wchar_t *reader_readline()
{ yank_str = kill_yank();
insert_str( yank_str );
yank = wcslen( yank_str );
// wcscpy(data->search_buff,data->buff);
break;
}
@@ -2700,6 +2700,7 @@ wchar_t *reader_readline()
/* Move left*/
case R_BACKWARD_CHAR:
{
if( data->buff_pos > 0 )
{
data->buff_pos--;
@@ -2714,8 +2715,9 @@ wchar_t *reader_readline()
}
}
break;
/* Move right*/
}
/* Move right*/
case R_FORWARD_CHAR:
{
if( data->buff_pos < data->buff_len )
@@ -2799,7 +2801,16 @@ wchar_t *reader_readline()
if( (!wchar_private(c)) && (c>31) && (c != 127) )
insert_char( c );
else
debug( 0, _( L"Unknown keybinding %d" ), c );
{
/*
Carriage returns happen - they are usually a
sign of an incorrectly set terminal, but there
really isn't very much we can do at this point,
so we ignore them.
*/
if( c != 13 )
debug( 0, _( L"Unknown keybinding %d" ), c );
}
break;
}
@@ -2873,7 +2884,7 @@ static int read_ni( int fd )
_( L"Error while reading commands" ) );
/*
Reset buffer. We won't evaluate incomplete files.
Reset buffer on error. We won't evaluate incomplete files.
*/
acc.used=0;
break;
@@ -2894,13 +2905,10 @@ static int read_ni( int fd )
res = 1;
}
// fwprintf( stderr, L"Woot is %d chars\n", wcslen( acc.buff ) );
if( str )
{
if( !parser_test( str, 1 ) )
{
//fwprintf( stderr, L"We parse it\n" );
eval( str, 0, TOP );
}
else
@@ -2943,19 +2951,20 @@ static int read_ni( int fd )
int reader_read( int fd )
{
int res;
/*
If reader_read is called recursively through the '.' builtin,
we need to preserve is_interactive, so we save the
original state. We also update the signal handlers.
If reader_read is called recursively through the '.' builtin, we
need to preserve is_interactive. This, and signal handler setup
is handled by proc_push_interactive/proc_pop_interactive.
*/
proc_push_interactive( ((fd == 0) && isatty(STDIN_FILENO)));
res= is_interactive?read_i():read_ni( fd );
/*
If the exit command was called in a script, only exit the
script, not the program
script, not the program.
*/
if( data )
data->end_loop = 0;

View File

@@ -1,6 +1,7 @@
complete -c fish -s c -l "command" -d (N_ "Run fish with this command")
complete -c fish -s h -l help -d (N_ "Display help and exit")
complete -c fish -s v -l version -d (N_ "Display version and exit")
complete -c fish -s n -l no-execute -d (N_ "Only parse input, do not execute")
complete -c fish -s i -l interactive -d (N_ "Run in interactive mode")
complete -c fish -s l -l login -d (N_ "Run in login mode")
complete -c fish -s p -l profile -d (N_ "Output profiling information to specified file") -f

View File

@@ -0,0 +1,25 @@
#
# Load common telnet options
#
# Written by: Sean C. Higgins
#
complete -x -c telnet -d Hostname -a "(__fish_print_hostnames)"
complete -c telnet -s 8 -d (_ "Specifies an 8-bit data path.")
complete -c telnet -s 7 -d (_ "Do not try to negotiate TELNET BINARY option.")
complete -c telnet -s E -d (_ "Stops any character from being recognized as an escape character.")
complete -c telnet -s F -d (_ "Use local Kerberos authentication, if possible.")
complete -c telnet -s K -d (_ "Specifies no automatic login to remote system.")
complete -c telnet -s L -d (_ "Specifies an 8-bit data path.")
complete -c telnet -s a -d (_ "Attempt automatic login.")
complete -c telnet -s c -d (_ "Disables reading user's .telnetrc")
complete -c telnet -s d -d (_ "Sets debug mode.")
complete -c telnet -s S -x -d (_ "Sets IP TOS.")
complete -c telnet -s X -x -d (_ "Disables atype type of authentication.")
complete -c telnet -s l -x -a "(__fish_complete_users)" -d (_ "User login.")
complete -c telnet -s n -x -d (_ "Log to tracefile.")
complete -c telnet -s x -d (_ "Turn on encryption.")
complete -c telnet -s r -d (_ "User interface similar to rlogin.")
complete -c telnet -s k -x -d (_ "Use Kerberos realm for authentication.")

View File

@@ -12,9 +12,9 @@ complete -c xargs -s l -l max-lines -d (N_ "Use at most max-lines nonblank input
complete -c xargs -s L -r -f -d (N_ "Use at most max-lines nonblank input lines per command line")
complete -c xargs -s n -l max-args -r -f -d (N_ "Use at most max-args arguments per command line")
complete -c xargs -s p -l interactive -d (N_ "Prompt the user about whether to run each command line and read a line from the terminal")
complete -c xargs -s r -l no-run-if-empty (N_ "If the standard input does not contain any nonblanks, do not run the command")
complete -c xargs -s r -l no-run-if-empty -d (N_ "If the standard input does not contain any nonblanks, do not run the command")
complete -c xargs -s s -l max-chars -r -f -d (N_ "Use at most max-chars characters per command line")
complete -c xargs -s t -l verbose -d (N_ "Print the command line on the standard error output before executing it")
complete -c xargs -l version -d (N_ "Display version and exit")
complete -c xargs -s x -l exit -d (N_ "Exit if the size is exceeded")
complete -c xargs -s P -l max-procs -r -f (N_ "Run up to max-procs processes at a time")
complete -c xargs -s P -l max-procs -r -f -d (N_ "Run up to max-procs processes at a time")

View File

@@ -4,27 +4,33 @@
# completions are located in the completions subdirectory.
#
#
# Add a few common directories to path, if they exists. Note that pure
# console programs like makedep sometimes live in /usr/X11R6/bin, so we
# want this even for text-only terminals.
#
set -l path_list /bin /usr/bin /usr/X11R6/bin @PREFIX@/bin @optbindirs@
# Root should also have the sbin directories in the path
if test "$USER" = root
set path_list $path_list /sbin /usr/sbin /usr/local/sbin
end
for i in $path_list
if not expr "$PATH" : .\*$i.\* >/dev/null
if test -d $i
set PATH $PATH $i
end
end
end
#
# Assign a temporary value here for performance reasons. The real value should be set in /etc/fish.
#
set -g fish_function_path $PWD/functions/
#
# 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
#
# Don't need completions in non-interactive mode
#
@@ -69,9 +75,8 @@ end
# Completions for the shell and it's builtin commands and functions
#
set -l __fish_help_desc (_ "Display help and exit")
for i in (builtin -n|grep -vE '(while|for|if|function|switch)' )
complete -c $i -s h -l help -d $__fish_help_desc
for i in (builtin -n|grep -v '\(while\|for\|if\|function\|switch\)' )
complete -c $i -s h -l help -d "Display help and exit"
end

View File

@@ -3,7 +3,8 @@
# Alias for gettext (or a fallback if gettext isn't installed)
#
if which gettext ^/dev/null >/dev/null
set -l path (which $i ^/dev/null)
if test -x (echo $path)
function _ -d "Alias for the gettext command"
gettext fish $argv
end

View File

@@ -6,8 +6,8 @@ function __fish_describe_command -d "Command used to find descriptions for comma
apropos $argv | awk -v FS=" +- +" '{
split($1, names, ", ");
for (name in names)
if (names[name] ~ /^'"$argv"'.* *\([18]\)/) {
sub("( |\t)*\\([18]\\)", "", names[name]);
if (names[name] ~ /^'"$argv"'.* *\([18]\)/ ) {
sub( "( |\t)*\\\([18]\\\)", "", names[name] );
print names[name] "\t" $2;
}
}'

View File

@@ -12,7 +12,7 @@ function __fish_print_packages
#Get the word 'Package' in the current language
set -l package (_ Package)
if which apt-cache >/dev/null ^/dev/null
if type -f apt-cache >/dev/null
# Apply the following filters to output of apt-cache:
# 1) Remove package names with parentesis in them, since these seem to not correspond to actual packages as reported by rpm
# 2) Remove package names that are .so files, since these seem to not correspond to actual packages as reported by rpm
@@ -25,7 +25,7 @@ function __fish_print_packages
# Rpm is too slow for this job, so we set it up to do completions
# as a background job and cache the results.
if which rpm >/dev/null ^/dev/null
if type -f rpm >/dev/null
# If the cache is less than five minutes old, we do not recalculate it
@@ -46,7 +46,7 @@ function __fish_print_packages
# This completes the package name from the portage tree.
# True for installing new packages. Function for printing
# installed on the system packages is in completions/emerge.fish
if which emerge >/dev/null ^/dev/null
if type -f emerge >/dev/null
emerge -s \^(commandline -tc) |grep "^*" |cut -d\ -f3 |cut -d/ -f2
return
end

View File

@@ -36,7 +36,7 @@ function help -d (N_ "Show help for the fish shell")
else
# Check for a text-based browser.
for i in $text_browsers
if which $i 2>/dev/null >/dev/null
if type -f $i >/dev/null
set fish_browser $i
break
end
@@ -46,7 +46,7 @@ function help -d (N_ "Show help for the fish shell")
# browser to use instead.
if test "$DISPLAY" -a \( "$XAUTHORITY" = "$HOME/.Xauthority" -o "$XAUTHORITY" = "" \)
for i in $graphical_browsers
if which $i 2>/dev/null >/dev/null
if type -f $i >/dev/null
set fish_browser $i
set fish_browser_bg 1
break
@@ -79,7 +79,7 @@ function help -d (N_ "Show help for the fish shell")
case $help_topics
set fish_help_page "index.html\#$fish_help_item"
case "*"
if which $fish_help_item >/dev/null ^/dev/null
if type -f $fish_help_item >/dev/null
man $fish_help_item
return
end

View File

@@ -2,7 +2,7 @@
function type -d (N_ "Print the type of a command")
# Initialize
set -l status 1
set -l res 1
set -l mode normal
set -l selection all
@@ -66,7 +66,7 @@ function type -d (N_ "Print the type of a command")
if test $selection != files
if contains -- $i (functions -na)
set status 0
set res 0
set found 1
switch $mode
case normal
@@ -86,7 +86,8 @@ function type -d (N_ "Print the type of a command")
end
if contains -- $i (builtin -n)
set status 0
set res 0
set found 1
switch $mode
case normal
@@ -105,18 +106,19 @@ function type -d (N_ "Print the type of a command")
end
if which $i ^/dev/null >/dev/null
set status 0
set -l path (which $i ^/dev/null)
if test -x (echo $path)
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is %s\n') $i (which $i)
printf (_ '%s is %s\n') $i $path
case type
printf (_ 'file\n')
case path
which $i
echo $path
end
if test $selection != multi
continue
@@ -124,11 +126,11 @@ function type -d (N_ "Print the type of a command")
end
if test $found = 0
printf (_ "%s: Could not find '%s'") type $i
printf (_ "%s: Could not find '%s'\n") type $i
end
end
return $status
return $res
end

View File

@@ -124,6 +124,14 @@ static int wildcard_match2( const wchar_t *str,
while( *(str++) != 0 );
return 0;
}
else if( *str == 0 )
{
/*
End of string, but not end of wildcard, and the next wildcard
element is not a '*', so this is not a match.
*/
return 0;
}
if( *wc == ANY_CHAR )
{
@@ -343,7 +351,7 @@ void get_desc( wchar_t *fn, string_buffer_t *sb, int is_cmd )
}
else if( sz < 1024 )
{
sb_printf( sb, L"%dB", sz );
sb_printf( sb, L"%lldB", sz );
}
else
{
@@ -597,7 +605,7 @@ int wildcard_expand( const wchar_t *wc,
/*
The maximum length of a file element
*/
size_t ln=MAX_FILE_LENGTH;
long ln=MAX_FILE_LENGTH;
char * narrow_dir_string = wcs2str( dir_string );
if( narrow_dir_string )