Compare commits

..

275 Commits

Author SHA1 Message Date
axel
bc42309dd8 Minor build fix
darcs-hash:20060126163002-ac50b-7766f42b8b3807a17577ed78819ab947ceb66e44.gz
2006-01-27 02:30:02 +10:00
axel
877b602d6b Fix bug in debian specific kill completions
darcs-hash:20060126160119-ac50b-1d1b5c248753f4c0ac77a838ea36eeb87473dbe9.gz
2006-01-27 02:01:19 +10:00
axel
37eb6c340d Make it possible to create zero length environment variable arrays without using the ENV_USER flag
darcs-hash:20060126154823-ac50b-21d0bdbd367289723cdda355cf6465264df565cf.gz
2006-01-27 01:48:23 +10:00
axel
7cd98a670b Fix glitches in stack trace
darcs-hash:20060126154722-ac50b-0d44e98b6d98e3b42f60f66f5bfa2c5f97ea2bd8.gz
2006-01-27 01:47:22 +10:00
axel
db0eccdc86 Checkin of swedish translations and some smaller changes to the emerge completion descriptions
darcs-hash:20060126151717-ac50b-7c8758dadf971f3cc25facb69176f6b6a7d683a4.gz
2006-01-27 01:17:17 +10:00
axel
0f10a3a277 Small output string tweaks
darcs-hash:20060126151659-ac50b-a6a7fbe764f0a8adb06f62efd233ef377178d521.gz
2006-01-27 01:16:59 +10:00
axel
312c7ab7b2 Add function stack trace to error output
darcs-hash:20060126144810-ac50b-3426191f596674504ce49dd61fcfa3c2c0c0f2bb.gz
2006-01-27 00:48:10 +10:00
axel
2e35e1ea60 util.h should include unistd.h
darcs-hash:20060126122134-ac50b-8701e01f5fac64df23b3d3437aea00d0223a05c7.gz
2006-01-26 22:21:34 +10:00
axel
b9c88f4c83 Spelling fixes, from Hermann J. Beckers
darcs-hash:20060126121659-ac50b-8c6a788e9750826c623d028410360da7353de9ea.gz
2006-01-26 22:16:59 +10:00
axel
5054492c6a Fixes to make fish work on Cygwin. Firstly a bunch of minor fixes fo the wcs* fallback functions, secondly MSG_DONTWAIT (a socket flag) is set to zero if it isn't already defined
darcs-hash:20060126095706-ac50b-766c1e2c0408dc51fc7379af38005352f7603b1e.gz
2006-01-26 19:57:06 +10:00
axel
5893154823 Add completions for emerge command
darcs-hash:20060124233229-ac50b-401bc6944f5f7bbe4836361061c0ecfe0f982656.gz
2006-01-25 09:32:29 +10:00
axel
4a4e1788e5 Swedish translation checkin
darcs-hash:20060124230850-ac50b-4db62238ef87351c28c164acd32bdd82d04ac11d.gz
2006-01-25 09:08:50 +10:00
axel
3d56d7ee32 Add completions for sshfs, fusermount and sudo
darcs-hash:20060124230133-ac50b-b6b8685b2c3771ec1699661de88ba45fe47df82d.gz
2006-01-25 09:01:33 +10:00
axel
18d06cf10f Smaller edits
darcs-hash:20060124181410-ac50b-4ec9e2990852a678de7d47a565ed41780b5279fc.gz
2006-01-25 04:14:10 +10:00
axel
452558624c Installation should not rely on making the .po files
darcs-hash:20060124181245-ac50b-27104b2918c53230377afcd8b684335aafb7ed76.gz
2006-01-25 04:12:45 +10:00
axel
b7ef6852c7 Add autoconf test for regex.h
darcs-hash:20060124181205-ac50b-3bd50ce2b55f58994633556af790c06c4205798b.gz
2006-01-25 04:12:05 +10:00
axel
fef420d648 Make the prompt_pwd behave better with strange sed implementations (I'm looking at you, OS X)
darcs-hash:20060124180944-ac50b-63f45e0ef950fca45b1c5eaa48e960895d418631.gz
2006-01-25 04:09:44 +10:00
axel
f2c4becde7 Add better test for whether the gettext command should be used
darcs-hash:20060124180850-ac50b-63529a14009c08f8985254565426b996bb16ef92.gz
2006-01-25 04:08:50 +10:00
axel
e0d6b5c438 Add manual page for fish_pager command
darcs-hash:20060124180729-ac50b-ee2811e3a96d7f29f372ea5a5b1d08ff9045545a.gz
2006-01-25 04:07:29 +10:00
James Vega
265d016721 doc_src/fishd.txt, fishd.c: Move the API description of fishd to the source file. Update the fishd help to indicate the new help and version options as well as a warning about fiddling with ~/.fishd.HOSTNAME.
darcs-hash:20060124172031-35ec8-6dbd2bdd1cca3528011f7a088630533a4fea25ab.gz
2006-01-25 03:20:31 +10:00
James Vega
495460066c Fixed various spelling mistakes.
darcs-hash:20060123231706-35ec8-2a30db603eee503d944b06d101cc88ce59340309.gz
2006-01-24 09:17:06 +10:00
axel
8df21a1cb1 Minor edits, mostly tweaks of the API documentation
darcs-hash:20060123233347-ac50b-44ebb96ba202c062739ba3d183519e28a95511b2.gz
2006-01-24 09:33:47 +10:00
axel
ba177b48d5 Do not show function body as description in output of the functions builtin
darcs-hash:20060123233213-ac50b-6887d4a2a9536e0697ab5ed0b1277dc645018cb9.gz
2006-01-24 09:32:13 +10:00
axel
29c488c6dc Fixes to api documentation, added .PHONY to makefile actions, made a few private functions static
darcs-hash:20060123204014-ac50b-b9d2a10c7f00945b5d9d244cb3b8c1489fe280de.gz
2006-01-24 06:40:14 +10:00
axel
14ae10daf7 Hopefully the last attempt at fixing the build rules for making .po and .gmo files
darcs-hash:20060123174742-ac50b-194561d756a9f3d78e1aeffe16e6c4d7c81593fe.gz
2006-01-24 03:47:42 +10:00
axel
ecdc5bdbc7 Add notice to set_text documentation about the use of --bold to brighten colors on some terminals
darcs-hash:20060123173811-ac50b-0ff42512a62fcebf1224b0aac9a47f04ed92c1c9.gz
2006-01-24 03:38:11 +10:00
axel
64fee9865e Add gettext i18n support for the set_color command
darcs-hash:20060123173720-ac50b-3e7621d28d041042c3bf7424a8210013d7c72b29.gz
2006-01-24 03:37:20 +10:00
axel
89eb80f3a4 Add option parsing and support for -h and -v switches to fishd
darcs-hash:20060123162534-ac50b-e993c28ee80cf83dc1f83a64f2cf7bac5dc1c55d.gz
2006-01-24 02:25:34 +10:00
axel
9853286bf9 the 'unknown' filetype description shouldn't be tranlated, since it is never used
darcs-hash:20060123154923-ac50b-bd7f826f77d33d26070b231ba630459e45ae6937.gz
2006-01-24 01:49:23 +10:00
axel
7d645ccc53 Use gettext to translate mimedb command. Also try to respect users locale setting when choosing language on file descriptions.
darcs-hash:20060123154500-ac50b-2a2eb9c24f41d2bbe05fc4c40dca31aaaca71979.gz
2006-01-24 01:45:00 +10:00
axel
820da6e7f7 Minor touchups of the complete.c file
darcs-hash:20060123114229-ac50b-b1f0ced50e81afd28807b6c8db3ab59f3e550130.gz
2006-01-23 21:42:29 +10:00
axel
3466f55ea0 Add completions for the time command, and improve completions for the type builtin and the su command
darcs-hash:20060123113936-ac50b-ba6f2516a8ce47734afd8da50fadf8995362da65.gz
2006-01-23 21:39:36 +10:00
axel
b969a175d4 Cleanup Makefile.in and make sure gen_hdr.sh is executable before using it
darcs-hash:20060123113807-ac50b-3959a084721ea2aebd7e5751788c82f633c2984a.gz
2006-01-23 21:38:07 +10:00
axel
bb079f5446 The seq fallback implementation is a shellscript, not a function
darcs-hash:20060123113648-ac50b-d6be198177d3b822b4e5270a70064f764ecf3cf7.gz
2006-01-23 21:36:48 +10:00
axel
250d20bfa8 Swedish translation for the seq command
darcs-hash:20060122234112-ac50b-35bd9ebd3867fdf72c388c3c0f1a8745b60f471d.gz
2006-01-23 09:41:12 +10:00
axel
58761f82e7 Avoid memory leaks in the complete builtin on errors
darcs-hash:20060122234003-ac50b-6b1b63d1b8fc9b8cfc7aa64b49db386618718d78.gz
2006-01-23 09:40:03 +10:00
axel
0ccc657aa6 Fix bug from the modified completion builtin where a completion that specified no switches would be ignored
darcs-hash:20060122233000-ac50b-779c3bbb08d1bdaaa6c6eae6192413d6b71aff21.gz
2006-01-23 09:30:00 +10:00
axel
7f01570caf .po should not depend on the messages.pot file, since it will cause that file to be autogenerated on build. Also, add a few comments to the Makefile.
darcs-hash:20060122213548-ac50b-e3d6c30bdfa401c03248fb88f96a0c6457fe9773.gz
2006-01-23 07:35:48 +10:00
axel
0dadd83fdd Move the complete builtin to it's own file, and make it accept multiple -c, -p, -s, -o and -l switches
darcs-hash:20060122211055-ac50b-6ef8cff7fb02e974d6a8096bf83bcbed429d7322.gz
2006-01-23 07:10:55 +10:00
axel
3e3541a05a Add simple fallback implementation of seq command, installed automatically on systems which lack the regular seq command
darcs-hash:20060122210756-ac50b-f09a50f61137acef18f0d2be16e2556b2cdea921.gz
2006-01-23 07:07:56 +10:00
axel
a824646d61 Add input checks to string_buffer_t functions
darcs-hash:20060121211629-ac50b-ce18cd1f58cf962d21e553fa292576ea7b3382ed.gz
2006-01-22 07:16:29 +10:00
axel
74fb5bd5e5 Minor tweaks of init files
darcs-hash:20060121211239-ac50b-02fc95b123698b972063c2cd1cd8e85d548e1f8b.gz
2006-01-22 07:12:39 +10:00
axel
f2d6ae3220 Swedish translation fixes (tiny)
darcs-hash:20060121204514-ac50b-53ce3806d118e3d5d6ae51ae3822d8424479c192.gz
2006-01-22 06:45:14 +10:00
axel
487c275926 Bugfix for command completion descriptions, potential crash on strange output from apropos
darcs-hash:20060121204423-ac50b-b4583611b49f9ec54de7b8529b2652ce93d03980.gz
2006-01-22 06:44:23 +10:00
axel
2f143303b7 Fix broken PATH check
darcs-hash:20060121204217-ac50b-70b29fcb9eb17ca739f595b589d196186a5b4860.gz
2006-01-22 06:42:17 +10:00
axel
78296d4fac Add autoconf test for presense of _nl_msg_cat_cntr
darcs-hash:20060121160234-ac50b-e41abc6688846ab207b9b6c3143cd694f8452154.gz
2006-01-22 02:02:34 +10:00
axel
fea22833cd Use backticks for command substitutions in Makefile to make it work on older sh implementations
darcs-hash:20060121160117-ac50b-80b950ee724d149a0cdf8373c9a2a8dcc21bed04.gz
2006-01-22 02:01:17 +10:00
axel
b9b09babbe Swedish translation updates, including switch of quoting character
darcs-hash:20060121123932-ac50b-3017ec3eb550a60cb970f2410a067ee20cdeee75.gz
2006-01-21 22:39:32 +10:00
axel
ba261cbb55 Description tweak
darcs-hash:20060121123912-ac50b-7bbd6af7efc08adb5162daedfb7bd129caa76836.gz
2006-01-21 22:39:12 +10:00
axel
4eb3370edf Error message update
darcs-hash:20060121123828-ac50b-bb81b8cf34a09c750a02c15d92bcdae11f4b9bad.gz
2006-01-21 22:38:28 +10:00
axel
f7a5ca5f1f Fix minor spelling detail
darcs-hash:20060121025307-ac50b-8bfe0dba8292f53fe44655afb6a7a9cdf813d7e8.gz
2006-01-21 12:53:07 +10:00
axel
f3c93c1690 Fix two bugs which together caused descriptions to be interpreted as a part of the completion in some rare cases
darcs-hash:20060121025206-ac50b-2bda82d8a9acdcdc9298e9986fbd38696514249f.gz
2006-01-21 12:52:06 +10:00
axel
e55bd063eb Minor edits to the todo part of the fish documentation
darcs-hash:20060120171603-ac50b-d63052e2e6ddd82946946c8b88c3f8eebe1c5013.gz
2006-01-21 03:16:03 +10:00
axel
bdf4214b1f Add a few Doxygen function descriptions
darcs-hash:20060120163404-ac50b-db110c6aa590b9c717a9755071f74dabdb370c3c.gz
2006-01-21 02:34:04 +10:00
axel
9fd20e63cf Make sure _nl_msg_cat_cntr exists even if libintl doesn't, and use printf command if the gettext command isn't installed. Both of these are needed on systems without gettext support.
darcs-hash:20060120163156-ac50b-4b98e605f297bb435596fc2a66c413f0be5a5751.gz
2006-01-21 02:31:56 +10:00
axel
a47065f648 Add fallback implementations of wcstok, putwc and getwc. Move all fallbacks from common.c to wutil.c.
darcs-hash:20060120142721-ac50b-4b9850d889e2210e1d545339e29dcc038a3f2b04.gz
2006-01-21 00:27:21 +10:00
axel
70351b0e4f Add missing completion for the -b switch for function builtin
darcs-hash:20060119150041-ac50b-a8d27c60747a47c63f3d89e6bb94b70b9f976ee1.gz
2006-01-20 01:00:41 +10:00
axel
12a0f6d72b Swedish tranlations checkin
darcs-hash:20060119134518-ac50b-4a70b43bd613a5a6e9d08b280eb2814778f0e6ee.gz
2006-01-19 23:45:18 +10:00
axel
d2c12e760c Fix crash bugs in fg and bg builtins, and make sure bg doesn't consider background jobs when run without an argument
darcs-hash:20060119131515-ac50b-d080ffde013419e2a461cf860b4858b88404ff33.gz
2006-01-19 23:15:15 +10:00
axel
e0c2ce24fb Add missing includes in input_common.c
darcs-hash:20060119122322-ac50b-8d0c2bc21ec137d6cd5bf845156d0fc68b005440.gz
2006-01-19 22:23:22 +10:00
axel
1e7dd4f928 Check location of term.h header (updated)
darcs-hash:20060119122207-ac50b-c573f54cbe13a1592a20342ee331159be0306913.gz
2006-01-19 22:22:07 +10:00
axel
3259da8f4a Define a few additional signals
darcs-hash:20060118184046-ac50b-d5a4275af398d5a8bb8a82eca90e1b189b99a4c6.gz
2006-01-19 04:40:46 +10:00
axel
619f076958 Don't include intl headers in translate.h if we're not going to use gettext
darcs-hash:20060118183758-ac50b-ae3aef1154a9be6e39e154ad420d0881e7f86c85.gz
2006-01-19 04:37:58 +10:00
axel
588bc1103a Make it possible to manually rebuild an existing messages.pot using 'make messages'. Don't use the --no-wrap switch for xgettext, since it's not universally supported. Print an explanation if xgettext fails.
darcs-hash:20060118165917-ac50b-2bea9293231907ea373216dbd6097a359886a062.gz
2006-01-19 02:59:17 +10:00
axel
13e94c0617 Don't print error message in fg if the command didn't fail
darcs-hash:20060118164750-ac50b-af59573292b32b87d0257c501eb7989062503653.gz
2006-01-19 02:47:50 +10:00
axel
efd01ae6c6 Don't automatically rebuild messages.pot every time the source changes
darcs-hash:20060118155929-ac50b-8134050a43269c35d582fb4410449d64dbbebb52.gz
2006-01-19 01:59:29 +10:00
axel
9017df15a8 Add completions for a fex more darcs subcommands
darcs-hash:20060118143022-ac50b-01db2f5ef449a4667bef351b10543c3a6b6e8a22.gz
2006-01-19 00:30:22 +10:00
axel
5340d2a18a Corrections for the swedish translation
darcs-hash:20060118131236-ac50b-e3a02d965a44c68b5ad13a50f07cde62c02f4b40.gz
2006-01-18 23:12:36 +10:00
axel
e5298a99f8 Add friendly messages to Makefile commands
darcs-hash:20060118131143-ac50b-8141e527e8047d4551548b629e01c18eef5d411e.gz
2006-01-18 23:11:43 +10:00
axel
05736978bb Change the foregrounf/background code a bit, fixes bug where mulktiple jobs want foreground status. Is this fix enough or are there still corner cases?
darcs-hash:20060118124248-ac50b-cbbddb8c6dad1f44826050395cda647fa9348f0f.gz
2006-01-18 22:42:48 +10:00
axel
e15c7fd7e0 Optionally add intl library, needed by gettext on NetBSD. Also clean up configure.ac a bit.
darcs-hash:20060118124113-ac50b-ef767f474de5bc27edc986be7526bdeb814f855a.gz
2006-01-18 22:41:13 +10:00
axel
509b3598f7 Make manual and completions reflect the facty that any combination od set_color params are valid values for $fish_color_* variables
darcs-hash:20060117193450-ac50b-636c59494399d88151174ee28096d93c0bcdd16d.gz
2006-01-18 05:34:50 +10:00
axel
aa783fc657 Remove some GNU preprocessor magic from wgetopt.c, it only applies to regular getopt
darcs-hash:20060117172412-ac50b-a2dabf19abe158674674f98b3ce10464a6826b36.gz
2006-01-18 03:24:12 +10:00
axel
84bbbe4252 Remove accidental newline in error message
darcs-hash:20060117172312-ac50b-5c77d13f879e7da44a97f158d0372e7e536c2c81.gz
2006-01-18 03:23:12 +10:00
axel
90fbe5eb0b color ls support under FreeBSD and OS X
darcs-hash:20060117172005-ac50b-6fddf68de744cfe42cab7237325025ab27fc17ad.gz
2006-01-18 03:20:05 +10:00
axel
d5f4df15d4 Fix broken 'type' function, and clean up the ugly 'help' function. By Philip Ganchev.
darcs-hash:20060117165613-ac50b-b68c1b17708f01d9550dab242778f19590a3711d.gz
2006-01-18 02:56:13 +10:00
axel
fd78f67d35 Fix buggy error messages in expand.h and add missing translation commands
darcs-hash:20060117124830-ac50b-0981a49f5746ec951ddfb1a3097c5009c1eb0385.gz
2006-01-17 22:48:30 +10:00
axel
28c29f569b Set version to 1.20.0
darcs-hash:20060116165451-ac50b-63e3cc280cb7deedadcfd69b542d9e54a7bc99c7.gz
2006-01-17 02:54:51 +10:00
axel
064581c7f8 Events should not be marked as non-interactive
darcs-hash:20060116165421-ac50b-503a15877d19055be9fc640baf9430fe0c606083.gz
2006-01-17 02:54:21 +10:00
axel
94b1c4c076 Swedish translation tweaks
darcs-hash:20060116165340-ac50b-16fef40c7f6f40195a8d0d1dbb8a237ebbe3639e.gz
2006-01-17 02:53:40 +10:00
axel
85c87fe267 Make string formating functions correctly handle %%. Thanks to Hiroshi Sakurai
darcs-hash:20060116150424-ac50b-0025006d1821da25ad131cca61e879d724694934.gz
2006-01-17 01:04:24 +10:00
axel
5bd66ee2ce Add a __fish_complete_command function for completing using a command name. Change name of the __fish_set_is_first to __fish_is_first_token and move it to the common completion util file
darcs-hash:20060116150110-ac50b-d864b516887c8fae941a745186dc308d50113c23.gz
2006-01-17 01:01:10 +10:00
axel
e593f9be53 Remove a few warnings
darcs-hash:20060116134244-ac50b-123a615eb94803f721213d81b676893bc4159104.gz
2006-01-16 23:42:44 +10:00
axel
25e363e729 Add debug target to make, which halts on warnings
darcs-hash:20060116134150-ac50b-4edaa946177ff0368669ed6314d25bf5c8663023.gz
2006-01-16 23:41:50 +10:00
axel
5db192347c Make sure all foreground jobs are reaped after evaluating a job to avoid things like 'sleep 10m; fg' don't try to restart sleep
darcs-hash:20060116001912-ac50b-30944d879d48b8b2714b24fa9a1e7f906ed3e1fb.gz
2006-01-16 10:19:12 +10:00
axel
18bbb5ad01 Put jobs in functions and block into their own process group in interactive mode, but do not put the 'fake jobs' associated with functions in a group
darcs-hash:20060116001556-ac50b-b91d6e45fe136874237ad31538de02b5e63a8bac.gz
2006-01-16 10:15:56 +10:00
axel
24ca6ceb47 Correctly handle and recover from IO redirections failures in the exec builtin
darcs-hash:20060115224148-ac50b-793c6a71a2ea04239a3d4bc293ca217a7ed40e84.gz
2006-01-16 08:41:48 +10:00
axel
3607c555be Corrections to the INSTALL file
darcs-hash:20060115212639-ac50b-3149b296718a8980a91903f61a54983696da575b.gz
2006-01-16 07:26:39 +10:00
axel
cad14db27b Cleanup configure.ac and make it automatically run autoheader
darcs-hash:20060115211929-ac50b-de7dcb86bf7143fef8e035991062bfd31c115f44.gz
2006-01-16 07:19:29 +10:00
axel
2fb5632212 Checkin of various swedish translation improvements
darcs-hash:20060115202034-ac50b-c4961911e5314ebaf9c596cc622882d80fc5a622.gz
2006-01-16 06:20:34 +10:00
axel
56ad85d8a8 Minor tweaks for the gpg command completions
darcs-hash:20060115200520-ac50b-08d98c4f223d71ee12ba7f35ec0197ee4517e72d.gz
2006-01-16 06:05:20 +10:00
axel
ee66520863 Give subshell command in error message for output conversion of data from subshell
darcs-hash:20060115200442-ac50b-4b3add7f99cf460186a6e0922966365dedcc2759.gz
2006-01-16 06:04:42 +10:00
axel
83629e28c8 Add completions for the set builtin to handle completions of locale variables and locale names
darcs-hash:20060115200303-ac50b-c195155551b0b77ddf8b6ab5c3d3f9c6506a82b7.gz
2006-01-16 06:03:03 +10:00
axel
645af56d77 Minor completion tweaks
darcs-hash:20060115115908-ac50b-26c75056ab12b369457b4842dc2fb744f82760c6.gz
2006-01-15 21:59:08 +10:00
axel
9501dc83e6 Make the functions builtin display function listing on -n to a terminal in a human-friendly format
darcs-hash:20060115115805-ac50b-fc5b468c0e68904e5cf934f43066ecfdf23e2a3b.gz
2006-01-15 21:58:05 +10:00
axel
9942e2f19f Make the completions for the ls, sed and df commands have the correct switches on BSD systems
darcs-hash:20060114131607-ac50b-479f7ff34019f5487125321443027cc0a77eec93.gz
2006-01-14 23:16:07 +10:00
axel
6d6644b907 Minor polish to the gpg completions
darcs-hash:20060114020051-ac50b-5afc6793fd2597654b896b81690e5295a773e68f.gz
2006-01-14 12:00:51 +10:00
axel
11273a7be0 Various corrections for advanced tab completions. Should make the --export
darcs-hash:20060114015937-ac50b-c085db7526eae4aa4138ca86304e725d7faebec4.gz
2006-01-14 11:59:37 +10:00
axel
1562b8148d Make sure functions as printed by the fyunctions builtin don't have any stray empty lines
darcs-hash:20060114015801-ac50b-135fb66cf74a9cd51f6d52e2eff12c55042e4183.gz
2006-01-14 11:58:01 +10:00
axel
d7b659d8e8 Add completions for gpg command
darcs-hash:20060113144133-ac50b-e7c457b7fa7aade56111d8d731ab468550006ef3.gz
2006-01-14 00:41:33 +10:00
axel
6050850081 Add completions for chsh command (updated)
darcs-hash:20060113140536-ac50b-447727e0ca2ed727d2801601e06ff6cbe1984e60.gz
2006-01-14 00:05:36 +10:00
axel
95d68e48f2 Fix the __fish_append shellscript function, as well as some completion bugs in gpg and mount
darcs-hash:20060113010245-ac50b-9780d63c65c73f2d61247cce484549ad3561fb74.gz
2006-01-13 11:02:45 +10:00
axel
2b7781d3cb Correctly handle locale changes through scope expiry, as well as locale changes in completion code
darcs-hash:20060113010012-ac50b-81cde216bd6b92f7b1374e5f6452695618185f95.gz
2006-01-13 11:00:12 +10:00
axel
f0b2d7532a Minor completion description corrections - unescaped dollar-signs in quotes and such
darcs-hash:20060112164559-ac50b-f16063597ca81d4eeef23f124cd62a15f0287df6.gz
2006-01-13 02:45:59 +10:00
axel
6b91433881 Alt-backspace is now a synonym for Control-w in emacs mode keybindings. Atl least on terminals with a simple Alt-backspace
darcs-hash:20060112145346-ac50b-3ec5f9517614a9b1cdf4e8e0ba7222b83347f436.gz
2006-01-13 00:53:46 +10:00
axel
16cb9dfa05 Improve description handling - handle symbolic link loops, handle description functions returning strings without a separator, and handle testing of un-stat:able files
darcs-hash:20060112144903-ac50b-9766abfa212b2eaf61509a65499df0018562b5d9.gz
2006-01-13 00:49:03 +10:00
axel
10fec8abb6 Make parser_current_line use dynamic memory to avoid overflow on long lines
darcs-hash:20060112125457-ac50b-1eff13f647793701e620a675ff661bc7d823a843.gz
2006-01-12 22:54:57 +10:00
axel
da058aa141 Add one missing translation string in exec.c
darcs-hash:20060111144616-ac50b-b0520a639e2d06b75629e0ab171111c529993d32.gz
2006-01-12 00:46:16 +10:00
axel
67333a23f1 Recover instead of quiting when a redirection error occurs for a shellscript function
darcs-hash:20060111144020-ac50b-a5c7449276730c21949324abd8ba49b91b186e8c.gz
2006-01-12 00:40:20 +10:00
axel
72bb5ae06f Use /etc/sysconfig/i18n file if it exists to set up correct locale
darcs-hash:20060111142340-ac50b-b0483ffd46eb6eb31defbd69b821fc088ff30004.gz
2006-01-12 00:23:40 +10:00
axel
d4034fc253 Yet another batch of description tweaks, as well as the last major checkin of translations to swedish (updated patch)
darcs-hash:20060111141735-ac50b-b6a9ac5d5d9eb8eac28dd39968cd28f99044e8f5.gz
2006-01-12 00:17:35 +10:00
axel
be9208412a Add missing include for sanity.c
darcs-hash:20060111141015-ac50b-679d480b29b35332881c45ef123dcff322cc81f2.gz
2006-01-12 00:10:15 +10:00
axel
f66689d415 Remove the tokenize command from the rpm spec file
darcs-hash:20060111140941-ac50b-eb5561af92787bc0e892120c0c7c6741cb4d63b9.gz
2006-01-12 00:09:41 +10:00
axel
aca0511762 Documentation corrections
darcs-hash:20060111132944-ac50b-43146f4df54b8a533fb92693f1292d6cb74cdef8.gz
2006-01-11 23:29:44 +10:00
Jan Fader jan.fader@web.de
68df730980 some little corrections
darcs-hash:20060110174907-f93c5-d9ef6df3a8f8401ea161085a1e512d6a1d445260.gz
2006-01-11 03:49:07 +10:00
axel
032a736840 Make the read builtin able to create universal variables
darcs-hash:20060111122640-ac50b-4b411b9822a44ae105b71ca51ee47d0aa13a1a62.gz
2006-01-11 22:26:40 +10:00
axel
d9663a4ec4 Remove the external tokenize command. One can use tr instead
darcs-hash:20060110163603-ac50b-204bef8d8d8e3f2ebc593c3de7d5a2eb4b1f0312.gz
2006-01-11 02:36:03 +10:00
axel
5392533f33 More minor completion description corrections, and another translation checkin for Swedish
darcs-hash:20060109192815-ac50b-cf229b3dbd2e11ed6136650bc781794fe008d5eb.gz
2006-01-10 05:28:15 +10:00
axel
bf0957d8dd Reload completions on locale language change. This will mean that most translatable messages will be retranslated.
darcs-hash:20060109174032-ac50b-4eba42b58f3a55298168469573315df917d23b10.gz
2006-01-10 03:40:32 +10:00
axel
630abb56f6 Make command descriptions work when entering full path to a command
darcs-hash:20060109171725-ac50b-0ef6085530d15bb6d08911cdffbe7f7f63fe07f2.gz
2006-01-10 03:17:25 +10:00
axel
c45e457492 Makecompletion functions work with completion descriptions regardless of if they contain a separator character or not
darcs-hash:20060109171359-ac50b-d3fc75cb3263d1f20296e5e81a9f48caf345cd01.gz
2006-01-10 03:13:59 +10:00
axel
fef1e1db32 Do not free allocated data when clearing a string_buffer_t
darcs-hash:20060109171302-ac50b-eda104ad21a80c99cc5f31e71973bbc835635b90.gz
2006-01-10 03:13:02 +10:00
axel
8ed80deb6b More robust parsing of keybindings, allow sequences like \C-\ew and \C-?
darcs-hash:20060109152506-ac50b-0b040ba0aed86bf7f0b4a935f7842eccf1b45181.gz
2006-01-10 01:25:06 +10:00
axel
b7c551a348 Correct incorrect arguments to futimes
darcs-hash:20060109151740-ac50b-db7a3ccbcd4f2cc13855f13285ec2536bebcac95.gz
2006-01-10 01:17:40 +10:00
axel
810d9104fc Improve detection of futimes function, and make it fail without giving an error message, since it is not critical anyways
darcs-hash:20060109151047-ac50b-ebbda6a65853dc03aa12c1e28cd293d7e5557bb1.gz
2006-01-10 01:10:47 +10:00
axel
54c502c3cf Documentation tweaks
darcs-hash:20060109144813-ac50b-cc5d04de564c177f8a0f529e6d536b6f7064f1b1.gz
2006-01-10 00:48:13 +10:00
axel
faa23a33ec Minor completion description tweaks, try to use the same description for the same situation in multiple commands, to decrease number of strings to translate
darcs-hash:20060109144730-ac50b-02c888d17745b5406e099040e12130fb2a419276.gz
2006-01-10 00:47:30 +10:00
axel
ae511451fe Fix two issues on OS X, a non-compatible use of the expr command and a bad init of a socket for the universal variable daemon
darcs-hash:20060109144418-ac50b-c6232eae5b964f66d0638289291340aa66cd5983.gz
2006-01-10 00:44:18 +10:00
axel
ce689e69d5 Make description messages more uniform
darcs-hash:20060108231306-ac50b-6476976dcdb9db47ac61052f0096e1f7eb27fc32.gz
2006-01-09 09:13:06 +10:00
axel
906495d713 Improve locale implementation (should now behave identically to bash) and document locale variables behaviour
darcs-hash:20060108230049-ac50b-403f1d00c8483fc4fecc275b62e40b1c3d51bfc1.gz
2006-01-09 09:00:49 +10:00
axel
690648e1b0 Huge upade containing several bugfixes related to i18n, and a huge number of new translatable strings, including almost all description messages for command specific completions
darcs-hash:20060108025656-ac50b-e2309829a0afa6b3270d13814e9600d0fd372407.gz
2006-01-08 12:56:56 +10:00
axel
b33d3f78b1 Move definition of the _ gettext alias out of fish_interactive, since it is needed in non-interactive, and in earlier functions as well
darcs-hash:20060105170915-ac50b-4a31a54f30d8bfcfecdd8fb60b9639087b27925a.gz
2006-01-06 03:09:15 +10:00
axel
343c280dbf Add more helpful error messages when trying to use Posix short circut operators (|| and &&)
darcs-hash:20060105160228-ac50b-d3addc00f8fb7934402788ff2da7301a638063dc.gz
2006-01-06 02:02:28 +10:00
axel
f6b2b9f9a5 Change syntax of 'and' and 'or' to infix order
darcs-hash:20060105153753-ac50b-4413a5d2652232bb38c97f5c673251193fc848ec.gz
2006-01-06 01:37:53 +10:00
axel
6a0460f51e Do not use \r sequence in translatable messages
darcs-hash:20060105135411-ac50b-f19d697f1b3f32cd695ee52282fc4281248e213f.gz
2006-01-05 23:54:11 +10:00
axel
e12902fe3c Translate most shellscript output, translate internal completion descriptions, and several translation bugfixes
darcs-hash:20060105134159-ac50b-0a7805971e079dd1a511c6bca227db4504902ef0.gz
2006-01-05 23:41:59 +10:00
axel
48030576e4 Improved description for the commandline builtin
darcs-hash:20060104141541-ac50b-b5e427b8d9767f016ea62a898ebd06c5cf48066c.gz
2006-01-05 00:15:41 +10:00
axel
33177e75a6 Output a message when changing LANG in interactive mode
darcs-hash:20060104140735-ac50b-4147ebc215d62d00fe6add39e62369dd3c07e7d9.gz
2006-01-05 00:07:35 +10:00
axel
c1304a05d9 Further i18n tweaks
darcs-hash:20060104135230-ac50b-c9fe3b1d24a28f18cefee72aaec17515b552b157.gz
2006-01-04 23:52:30 +10:00
axel
038d7e725e Added a few notes to INSTALL file
darcs-hash:20060104130154-ac50b-17fe045cd521d42600a2ea01a72b53337545b090.gz
2006-01-04 23:01:54 +10:00
axel
6408486336 Minor fixes to i18n
darcs-hash:20060104130124-ac50b-3a629986f1a2ddf168d2f13184a6c222ccbc4889.gz
2006-01-04 23:01:24 +10:00
axel
ec43c635cc Add i18n through gettext, as well as a Swedish translation
darcs-hash:20060104125102-ac50b-5bf026578a69bd94f7a7a3c8dee0ebccd95e5c24.gz
2006-01-04 22:51:02 +10:00
axel
26de6ba26b Minor text formating tweaks
darcs-hash:20051230162919-ac50b-498d690fdec0aaf37c212eedf6b4c584c64f9a5f.gz
2005-12-31 02:29:19 +10:00
axel
8f121dce9c Add completions for nice and renice commands
darcs-hash:20051230162835-ac50b-28220c8ef0c4f22dd1c8825c7a1151fe92ba421c.gz
2005-12-31 02:28:35 +10:00
axel
7eec1a6625 Pressing the enter key on an empty line scrolls a line
darcs-hash:20051230125705-ac50b-b8064453d6b3a7ac041a3c8d0b23a3189ca3f162.gz
2005-12-30 22:57:05 +10:00
axel
02a3288db7 1.19.0
darcs-hash:20051225220442-ac50b-79b8685cf6939c74a171f6cba227b703a1c02d60.gz
2005-12-26 08:04:42 +10:00
axel
b069489792 Only use internal wcsndup implementation of no external one exists
darcs-hash:20051225220329-ac50b-8ab5165f227112bb28406168d6c88e45a74fc7bc.gz
2005-12-26 08:03:29 +10:00
axel
b37eeb92ef Fisx crash buh when completing string ending in backslash
darcs-hash:20051225220044-ac50b-b880ffe649d04ed1e5ec6786d0b59eed8068d182.gz
2005-12-26 08:00:44 +10:00
axel
b6630b5087 Check for presense of doxygen using autoconf
darcs-hash:20051225115940-ac50b-a8bc63a835c041f6648381934396392fc277cc49.gz
2005-12-25 21:59:40 +10:00
axel
3a69fc997c Check Xautority before trying to use X-based browser in help shellscript
darcs-hash:20051221135353-ac50b-9b8b37d7465d64a209e34ed047bd6e055a4fc179.gz
2005-12-21 23:53:53 +10:00
axel
c216e36a72 Add notice about bug when suspending builtins
darcs-hash:20051221135157-ac50b-a85102e103d27b5eccf51806871b3a49befa6a10.gz
2005-12-21 23:51:57 +10:00
axel
00778832f1 Add sbin directories to PATH when root
darcs-hash:20051220090155-ac50b-2a0a54dda98086cae3329dc31a71f28774bddf46.gz
2005-12-20 19:01:55 +10:00
axel
cdbd233e62 Do not use GNU -r switch for sed
darcs-hash:20051220085820-ac50b-c46216c3eff88eab9776e5505de1f25e0e046cfc.gz
2005-12-20 18:58:20 +10:00
axel
9ce93164bb Add missing include in builtin_help.hdr
darcs-hash:20051220085746-ac50b-fb788faca5ee99e85074343ba30ee6de7fb13857.gz
2005-12-20 18:57:46 +10:00
axel
20b269130c Yet another attempt to avoid gnuisms in sed/grep for ssh completions
darcs-hash:20051218225150-ac50b-d2ec7c6b5c715a68dcc4f2d9d67636c70868da7d.gz
2005-12-19 08:51:50 +10:00
axel
891c2fc379 Use sed instead of grep, since grep -o isn't supported on OS X
darcs-hash:20051217221513-ac50b-1166a7d4814ee9e2cd960308fae4999431ebc3c1.gz
2005-12-18 08:15:13 +10:00
axel
00be44a69a Add completions for trap and jobs
darcs-hash:20051217215926-ac50b-3078bbc64adfe19d17579a886a9e2ae7b0c594dd.gz
2005-12-18 07:59:26 +10:00
axel
b8ea709c1e Add autoconf checks for wide character string functions
darcs-hash:20051217213205-ac50b-df9ea4cbc1a7e4235578bd4fc542ddb7788d41cc.gz
2005-12-18 07:32:05 +10:00
axel
7bdcfacee4 Add trap shellscript function
darcs-hash:20051217213052-ac50b-fdab838ea9595fac7572068ea3a1f12b8bb0ea68.gz
2005-12-18 07:30:52 +10:00
axel
61706b4490 Adjust fish init files to new set syntax
darcs-hash:20051217122710-ac50b-718f131091f262514686b73a1f827086fc678a08.gz
2005-12-17 22:27:10 +10:00
axel
443ddb509e make the functions builtin output descriptions and event handlers for functions
darcs-hash:20051217122546-ac50b-2bf9b1118fcbf9079398e113fb201ddde813e40a.gz
2005-12-17 22:25:46 +10:00
axel
e6774cc944 Make the set builtin only parse switches given after non-switches
darcs-hash:20051217012130-ac50b-201dd8301496b800e0382ac238ee7e164b9345e3.gz
2005-12-17 11:21:30 +10:00
axel
78cd8fa089 Tweak a few error messages for builtin commands
darcs-hash:20051216155116-ac50b-d31da6fc28ef9140f24fb0d95397daaffb3ff6ab.gz
2005-12-17 01:51:16 +10:00
axel
9229041385 Make non-interactive reading more robust.
darcs-hash:20051216155010-ac50b-8237935c6e95c296fd67280b1879267f9e7a949b.gz
2005-12-17 01:50:10 +10:00
axel
e6bd3dbc40 Make the source builtin bail out at once if stat fails. Makes sure no illegal memory acces takes place
darcs-hash:20051216125437-ac50b-150f5404037186c5380884416b696d5869704a60.gz
2005-12-16 22:54:37 +10:00
James Vega
a91bf6d88a builtin.c: builtin_source now checks that its argument is a file.
Without this check, it would be possible to attempt to source a directory and get stuck in an infinite loop.

darcs-hash:20051215172122-35ec8-b3ce05d8d7ee9534edf92b74ca842d034b894e8a.gz
2005-12-16 03:21:22 +10:00
axel
fa75fc3901 Code cleanup
darcs-hash:20051215135902-ac50b-e9fc18bca34459ddb56e970a16c05e9b3cc54848.gz
2005-12-15 23:59:02 +10:00
axel
e4a95cb989 Add missing -r/--replace switch to commandline builtin
darcs-hash:20051215101901-ac50b-721c6a3afc426b110506b5101a25c54205767dc5.gz
2005-12-15 20:19:01 +10:00
axel
9cf4a2a0b3 Add extra step in instructions on creating a builtin
darcs-hash:20051214234808-ac50b-14d032091b843c4692f4548c9763b65c46b2fc92.gz
2005-12-15 09:48:08 +10:00
axel
0ff374a4a0 Add missing newline at end of yum completion file
darcs-hash:20051214234650-ac50b-0002f137022144e2fc55b233df1f32157e8b77f8.gz
2005-12-15 09:46:50 +10:00
axel
0817962300 Add missing documentation file
darcs-hash:20051214180744-ac50b-9394e5a12ca3eb98a9333a666748d16277cc2d7b.gz
2005-12-15 04:07:44 +10:00
axel
8b69c5416d Minor documentation edits
darcs-hash:20051214164116-ac50b-c95a5dcb71d39c29b69010e879c96fc66ff1271e.gz
2005-12-15 02:41:16 +10:00
axel
1071fedaee Fix Alt-p shortcut
darcs-hash:20051214140906-ac50b-73f73a4dd9f2d77f5cb70a742aa0331cbedc11ba.gz
2005-12-15 00:09:06 +10:00
axel
ab207b64a3 Add separator characters to make quoted variable expantion works properly
darcs-hash:20051214135336-ac50b-ebd834e2bc52324ae4926efc270508648d8cb280.gz
2005-12-14 23:53:36 +10:00
axel
418e26c0ac Fix crash bug from calling eval builtin with no arguments
darcs-hash:20051214134644-ac50b-5872ff628bf4f5d4f22f912d7ce7e9ed25d48b58.gz
2005-12-14 23:46:44 +10:00
axel
de3a28874e Code tweaks
darcs-hash:20051214033939-ac50b-321171b5a7a59ca6856ce1b1a09126614154544a.gz
2005-12-14 13:39:39 +10:00
axel
9dd842ea96 Code tweaks
darcs-hash:20051214010712-ac50b-4053d2c3b97a1ea6168f113e91d3e4915915ea9a.gz
2005-12-14 11:07:12 +10:00
axel
5d069de71d Use different abbrevation for prompt_pwd
darcs-hash:20051214003427-ac50b-1227b7a0795e2fe3adf4f37c2594033f673b7a5e.gz
2005-12-14 10:34:27 +10:00
axel
16333b0c69 Simplify pwd function
darcs-hash:20051214003313-ac50b-697691ebc5cedddde35307bee465b3083b91c00e.gz
2005-12-14 10:33:13 +10:00
axel
e4fa0e1000 Simplify greeting code
darcs-hash:20051214000613-ac50b-18e45081adfe96ecbf4439f39e6df3784941952e.gz
2005-12-14 10:06:13 +10:00
axel
3e52bd0132 More tweaks
darcs-hash:20051213201121-ac50b-cdb07b1535b7a7f521d5a4360d09a449315a65a3.gz
2005-12-14 06:11:21 +10:00
axel
211663a549 Use . as CDPATH if CDPATH is zero length
darcs-hash:20051213201036-ac50b-7567b40f37b409a1bc0ec7b1dc83724057e7e5d2.gz
2005-12-14 06:10:36 +10:00
axel
659b99ed1a Lots of fixed typos. Thanks, Harshad!
darcs-hash:20051213183257-ac50b-65c01704388f0fa94a7fbc62ba4d22ec1e6397d2.gz
2005-12-14 04:32:57 +10:00
axel
86d7e8bb8e Minor tweaks
darcs-hash:20051213182803-ac50b-859b5bd4274e24dfd462cdf4585f0a05b751f737.gz
2005-12-14 04:28:03 +10:00
axel
8bf0a14bd5 Autodetect common escape codes in fish_prompt output
darcs-hash:20051213101859-ac50b-0ff01bb168d894d401d3d93cc11740789bac0d62.gz
2005-12-13 20:18:59 +10:00
axel
9c32709fe1 Fix infinite loop in token search
darcs-hash:20051212183055-ac50b-a40c21f801978094e4ae5b3f6f5d84276eb956e7.gz
2005-12-13 04:30:55 +10:00
axel
00bdd2cb48 Fix bug causing inconsistent state and shutdown when the begin command was used in a function definition
darcs-hash:20051212155104-ac50b-bb942f22d1eaef8cdc07ddf04fb9230bbfb165f6.gz
2005-12-13 01:51:04 +10:00
axel
0a8284c981 Further tweaks to jobs builtin
darcs-hash:20051212155001-ac50b-bb6d180d8e0ca5150173a3dc3aa6cd7e021fa770.gz
2005-12-13 01:50:01 +10:00
axel
ddbb50acd7 Minor edits
darcs-hash:20051211233939-ac50b-e01a4024f70355f2b7f1b5377c6e0853997d9860.gz
2005-12-12 09:39:39 +10:00
axel
5262f3ce99 Revamp the jobs builtin
darcs-hash:20051211233001-ac50b-24547ca41d4db05f87d59dd3e396c3190a66ef89.gz
2005-12-12 09:30:01 +10:00
axel
28dd48a76a Use char instead of unsigned char in xdgmime files. Avoids a few warnings.
darcs-hash:20051211222833-ac50b-3fd68bb7000660172027c8991c68448ddb36e27d.gz
2005-12-12 08:28:33 +10:00
axel
b1c61bcf1f Do not call fcntl before fully reading block.Escalates bug severity without any practical benefit.
darcs-hash:20051211222730-ac50b-bdb2e1dc612ba6a9dd425f514baa2423f8b0d4e5.gz
2005-12-12 08:27:30 +10:00
axel
bb591a69c9 Make type fuction handle hidden functions
darcs-hash:20051211222603-ac50b-e846b05b27d2e2c072c760baa1e067f9484636e3.gz
2005-12-12 08:26:03 +10:00
axel
1d69e70b7a Initial blocking implementation
darcs-hash:20051211222101-ac50b-6e11220bd608187fbb32a0313b5b73dbdc8354fc.gz
2005-12-12 08:21:01 +10:00
axel
2cac04850b Fix crash bug in token search
darcs-hash:20051211043017-ac50b-137695bd9bb9c523d5b5288a5d4263e4c4242edf.gz
2005-12-11 14:30:17 +10:00
axel
2619f1752d Remove compiler warning
darcs-hash:20051210003607-ac50b-3c9aab83ec7c5f184c1cd01f6cdd11c711725584.gz
2005-12-10 10:36:07 +10:00
axel
33e2c81748 Make sure tokenizer never changes input string
darcs-hash:20051210003335-ac50b-2d1b9125186b1d3f68138c2c49559d077fa5d326.gz
2005-12-10 10:33:35 +10:00
axel
f05da41159 Escape the ~ character
darcs-hash:20051209121954-ac50b-347571c227de795661694f31ff4ab9eafdda0e39.gz
2005-12-09 22:19:54 +10:00
axel
780ecc46fc 1.18.1
darcs-hash:20051209040512-ac50b-9c39e3e1b1345caa1167a8d09e79c569d3600a7a.gz
2005-12-09 14:05:12 +10:00
axel
9b98df8310 Add history search information to documentation
darcs-hash:20051209040443-ac50b-ac75d7308947d00867950f6df74cc68907045a3b.gz
2005-12-09 14:04:43 +10:00
axel
5a8205ac2b Shorten ${foo} error message a bit
darcs-hash:20051209035042-ac50b-b71d3e2b326cf18c4520c86d6587d432230d7ac9.gz
2005-12-09 13:50:42 +10:00
axel
2490da31ce Fix missing escapes for the [] characters
darcs-hash:20051209033225-ac50b-713c8d82887fb6de4de84c980f23a19039df0cb7.gz
2005-12-09 13:32:25 +10:00
axel
092bb90569 Add minor missing completion for fish itself
darcs-hash:20051209025651-ac50b-7fce573294ed888c59c7fc6ce2bd6e4d2f822e0f.gz
2005-12-09 12:56:51 +10:00
axel
39ca027706 Do not fail make install on missing ChangeLog
darcs-hash:20051209024923-ac50b-9a998c9e221c1a2d5613498e78614fafc5c6a347.gz
2005-12-09 12:49:23 +10:00
axel
22433f2717 Completion prefix was missing one character
darcs-hash:20051209024718-ac50b-91cd117f5950726ecbf5451b415cf2f8041f689a.gz
2005-12-09 12:47:18 +10:00
axel
f6e194447d Do not stop evaluation on wildcard error
darcs-hash:20051209024116-ac50b-4053af9c2800565b752476a6cdb31d3a5c43b113.gz
2005-12-09 12:41:16 +10:00
axel
e2ed5d0977 Fix buffer inconsistency un ^U
darcs-hash:20051209024034-ac50b-a06c78f8f238f61c99ddcd4bee02f8b41af26c6c.gz
2005-12-09 12:40:34 +10:00
axel
fe5bf8f80e Set version to 1.18.0
darcs-hash:20051207163122-ac50b-9844fb2917028886a5a1f6ce54edf7641abbc231.gz
2005-12-08 02:31:22 +10:00
axel
0a713a7939 Correct set help page. The handling of setting a variable to no value has changed.
darcs-hash:20051207162924-ac50b-3e3c579b8b932b9a5a11546fb4a042d5e2aa85c5.gz
2005-12-08 02:29:24 +10:00
axel
4ba2709452 Improved error messages
darcs-hash:20051207160647-ac50b-4061540829a108381c20a1a6f3c8fd2d004a9800.gz
2005-12-08 02:06:47 +10:00
axel
0c877183b9 Spelling
darcs-hash:20051207155717-ac50b-6146b02bd8aff0fd27816acd5e31b38093d8575d.gz
2005-12-08 01:57:17 +10:00
axel
a46be4cadb Handle setting zero length variable name
darcs-hash:20051207144849-ac50b-d919481d54ef80c68d5f4cc847d5c2370e94ddcc.gz
2005-12-08 00:48:49 +10:00
axel
8b4637e900 Insert boundary token at quotes, makes things like $foo"bar" work right
darcs-hash:20051207144307-ac50b-a708fa43b196f435efdcb1bfac17ce592cdb4533.gz
2005-12-08 00:43:07 +10:00
axel
ab13c4caad Give intelligent warning messages on zero-length variable names.
darcs-hash:20051207130330-ac50b-cc9d78ba63f592925b6076049e2c59aaaa930eec.gz
2005-12-07 23:03:30 +10:00
axel
479696a8ec Set status to 1 on parse errors
darcs-hash:20051207130209-ac50b-f1431d395bf741bb4c8f99ed64ed8ccc53a960a3.gz
2005-12-07 23:02:09 +10:00
netocrat
acde745e34 Add a distclean target to Makefile.in
darcs-hash:20051103170348-344c5-9e8f20f2363ac031c8eeb991d01c58fde86fd33b.gz
2005-11-04 03:03:48 +10:00
netocrat
064d49215a Add missing files to remove for make clean
darcs-hash:20051103151026-344c5-c79770e8273cc18f0515c4bbbed730fec89af060.gz
2005-11-04 01:10:26 +10:00
netocrat
78d3b37e11 Modify fish init scripts to take account of @SYSCONFDIR@
darcs-hash:20051103143535-344c5-203a64cc8bdb14cc018254f6eb74852a1db4843f.gz
2005-11-04 00:35:35 +10:00
axel
12aa33fad4 Even more documentation updates. Variable expantion and design document sections.
darcs-hash:20051204132259-ac50b-d63356923e41c85a8d4aae1a4db3c815867fe5e2.gz
2005-12-04 23:22:59 +10:00
axel
e4ade8f41b Remove silly warnings in help script
darcs-hash:20051204132218-ac50b-e9e74283b7fe3f12a9af90f2b6d93b189e80a684.gz
2005-12-04 23:22:18 +10:00
axel
9d7723b330 More documentation corrections and updates
darcs-hash:20051204124043-ac50b-11a283ee48103cb24efdaf18f6de62f503d6e028.gz
2005-12-04 22:40:43 +10:00
axel
2bc2e0b9ec More documentation tweaks
darcs-hash:20051204023353-ac50b-196f21f186237d5e7074667fc86f2172a7ac40e2.gz
2005-12-04 12:33:53 +10:00
axel
02083a1bd7 Updated some obsolete documentation sections, and added some general polish
darcs-hash:20051204022740-ac50b-d3258d6b6f6caaf1b728c3c5074e1318135d6752.gz
2005-12-04 12:27:40 +10:00
axel
e534a952b7 Fix display bug causing the wrong completion string prefix to be shown in some situations
darcs-hash:20051204015613-ac50b-3c9feaf11d9657a30272303f9605f8139a0c5923.gz
2005-12-04 11:56:13 +10:00
axel
754d8d3712 Fix bug breaking filename completions, introduced by csh wildcard syntax
darcs-hash:20051204015402-ac50b-911c6188f6c8213a733f4e967fc903f5290f1772.gz
2005-12-04 11:54:02 +10:00
axel
86230813de Remove more deprecated event hooks
darcs-hash:20051203195135-ac50b-bcdfc71f1e634ee9e2745683a8b23243e03a0412.gz
2005-12-04 05:51:35 +10:00
axel
2faba57e5a Update todo list to reflect recent changes
darcs-hash:20051203195003-ac50b-3c0bcaebf8a6d81fa0e0940ab6b215781cb26d52.gz
2005-12-04 05:50:03 +10:00
axel
3789127d28 No longer track changes to the ChangeLog file, since it is autogenerated
darcs-hash:20051203194801-ac50b-215457a371538276fd71f9aa368e13f1b8bfff73.gz
2005-12-04 05:48:01 +10:00
axel
32e833f331 Remove old event hooks, add more event handler documentation
darcs-hash:20051203194618-ac50b-e90683cb69b19da789152164a89a34bf187fd4e4.gz
2005-12-04 05:46:18 +10:00
axel
9b4c34aa4c Use csh-style error rules with wildcards, i.e. if no matches are found, the command is not executed
darcs-hash:20051203164356-ac50b-1b1818db2698eab9ae765a5af1e259bce3ab37e7.gz
2005-12-04 02:43:56 +10:00
axel
e2ebc0e443 Set version to 1.17.0, disable fishd optimization patch.
darcs-hash:20051201154544-ac50b-9b0f5502659d9f1facc04e4fd6a0b7287b197f2d.gz
2005-12-02 01:45:44 +10:00
axel
8ff66e718c Fix broken recursive wildcard patch
darcs-hash:20051130153303-ac50b-3d0973badb50a98fe8038135a031a8ee14e4f894.gz
2005-12-01 01:33:03 +10:00
axel
2789da6a1a Only insert fishd barrier after non-builtin commands to increase performance
darcs-hash:20051129195132-ac50b-7fcf7b2458b162c9c668fe823f17dc070604b00d.gz
2005-11-30 05:51:32 +10:00
axel
51c345311a Make the not builtin work with shellscript functions
darcs-hash:20051129195030-ac50b-7ada30d327f2dcc8ad23f56b0a36c975cb90c481.gz
2005-11-30 05:50:30 +10:00
axel
4a68a34c50 Change stupid call signature for tilde expand function
darcs-hash:20051129165202-ac50b-f442d0d75864317cc70059fffe5e8eb956ad54a6.gz
2005-11-30 02:52:02 +10:00
axel
9993ff07f2 Fix problem with recursive wildcards not working properly when postfixed with a regular string
darcs-hash:20051129143352-ac50b-6fec789be36250f29d35458b15dbae423eed195c.gz
2005-11-30 00:33:52 +10:00
axel
fc8b56da0d Remove accidentally included test code for recursive wildcard feature
darcs-hash:20051129101414-ac50b-929f0b9928bbed8a485699c66e1b4e3e8cedcfdc.gz
2005-11-29 20:14:14 +10:00
axel
02981a1750 Minor cleanups
darcs-hash:20051129101303-ac50b-11843dc32a9d05037b907fe1ac5df6a90cb7dd36.gz
2005-11-29 20:13:03 +10:00
axel
c2e6b07b35 Try to report IO redirection errors resulting from redirection stderr
darcs-hash:20051129101206-ac50b-970569a8b710d74b6e16a3c09b8848618cec4a7e.gz
2005-11-29 20:12:06 +10:00
James Vega
8fcacdd5df common.c: Include the header file for ioctl()
darcs-hash:20051128144202-35ec8-5148e095c81538cb26c232e93dbe94a93e75e253.gz
2005-11-29 00:42:02 +10:00
axel
6bf58e44f4 Make sure fishd saves before exiting from signal
darcs-hash:20051127232409-ac50b-d316781e373c078fecf857a199594a00184361a9.gz
2005-11-28 09:24:09 +10:00
axel
bda7948719 Make sure fishd synchronization happens only when needed
darcs-hash:20051127232208-ac50b-927157fb9b5d3e44981f9ec029735531ae59fd61.gz
2005-11-28 09:22:08 +10:00
axel
e800fca499 Use better test for presense of getopt_long function
darcs-hash:20051127150603-ac50b-566999b0cb32bc150dc6ef43220452ab42f1ad64.gz
2005-11-28 01:06:03 +10:00
axel
eed4b75389 Remove config.h.in from repo, it is autogenerated by autoheader
darcs-hash:20051125162839-ac50b-bbd4dc02684028a45c19de50cdfa52e020368491.gz
2005-11-26 02:28:39 +10:00
axel
5974dd68b0 Use iswspace instead of the GNU extention iswblank
darcs-hash:20051125144434-ac50b-088a2a8066537f19f287f9dad1611a172addd053.gz
2005-11-26 00:44:34 +10:00
axel
680c0aff05 Use short style switch on set_color, since long style getopt not always available
darcs-hash:20051125144406-ac50b-ca222e2fb3f2396489fb5eca64f2eff32b654404.gz
2005-11-26 00:44:06 +10:00
axel
4a2bdeebef Fire pending events when interrupted while reading from keyboard
darcs-hash:20051125141826-ac50b-12e763c0a7f1b4e9136e38de7a8921ff2d1a74e7.gz
2005-11-26 00:18:26 +10:00
axel
dfa251a1ab Remove ifdefs from function code
darcs-hash:20051125141657-ac50b-4dabc1dea3c90accafdcab78f683412858d77541.gz
2005-11-26 00:16:57 +10:00
Claes Nästén
82cb97d3e3 builtin ulimit checks
Adds checks for RLIMIT_NPROC, RLIMIT_RSS and RLIMIT_MEMLOCK not available
on all platforms.

darcs-hash:20051124111321-cac88-606a61ca0f3baa69115be658a056f42a5a9318ad.gz
2005-11-24 21:13:21 +10:00
axel
7d334914f7 Minor code tweaks
darcs-hash:20051123185743-ac50b-dc35b7f64e5416f3f2749edebd5235abb5bdff98.gz
2005-11-24 04:57:43 +10:00
axel
27a60f465d Change name of fishd log file
darcs-hash:20051123185710-ac50b-bd3e5d1664a4832bfee579a027bbce9ac6661b2d.gz
2005-11-24 04:57:10 +10:00
horeah
279159384e Added support for recursive wildcards
darcs-hash:20051123153503-b56f0-6d837388e8bbfdebba9a399f8374b3e8433e5a32.gz
2005-11-24 01:35:03 +10:00
axel
d748e05cb9 Make sure installation path is in PATH
darcs-hash:20051103162625-ac50b-e70d6bff6a83130cd905008e65da34984bf64a7b.gz
2005-11-04 02:26:25 +10:00
axel
d50c051eec Change quoting rules to POSIX style
darcs-hash:20051102164913-ac50b-d4b696394e13a2d4c787f8ee1a2b209317dddb51.gz
2005-11-03 02:49:13 +10:00
axel
8d58e58d7b Minor performance tweaks
darcs-hash:20051102154159-ac50b-9a32fb6cc654c593048840ebd9f6abb97c2e0bb8.gz
2005-11-03 01:41:59 +10:00
axel
c8c3715aac Bump to 1.16.2
darcs-hash:20051102145930-ac50b-94dc822e0f57c2774ce93023415742f5655ec5c7.gz
2005-11-03 00:59:30 +10:00
axel
7ffcebb9f8 No special casing for installing to $HOME
darcs-hash:20051102145252-ac50b-ebb3471f18c53f2ae0d1ec78e0c6ca60b46ff07e.gz
2005-11-03 00:52:52 +10:00
jan.fader
831d95b600 Bugfixing for the last patch
darcs-hash:20051101215628-9ad71-5ca66671c1707ac16f280504ae2eebbe6e07b6e8.gz
2005-11-02 07:56:28 +10:00
jan.fader
0ffeb41c28 Patch for the stupid defaults of autoconf
darcs-hash:20051101205215-9ad71-a954e2626d13c91435ca3cddc6f6af6b61f75f72.gz
2005-11-02 06:52:15 +10:00
axel
e8d02159da Fix minor bug in completions for make, which caused it to fail completing targets beginning with 't'
darcs-hash:20051027152332-ac50b-cb3741f7ea0c74a6885e31f78f2aa79323ae48a1.gz
2005-10-28 01:23:32 +10:00
axel
b78fba810c Fix crash bug when pasting long text
darcs-hash:20051027152148-ac50b-b47b96bc8acae760ce53a2e42d23dc2d07bf2302.gz
2005-10-28 01:21:48 +10:00
James Vega
43213ee458 fish_tests.c: Include header files for missing function definitions.
darcs-hash:20051027122003-35ec8-439007fc422a260e1912c9ac06f6a64ce67d79b6.gz
2005-10-27 22:20:03 +10:00
axel
da316dd588 Do not override users sysconfdir setting
darcs-hash:20051027144510-ac50b-fc670196f1ec55c9703a8c44d1411a9380a8a0cf.gz
2005-10-28 00:45:10 +10:00
axel
c8bc79005c Minor performance tweak: Do not allocate any heap memory for hash_table_t until an element is inserted. That way, hash tables that never contain any data will not cause a call to malloc()
darcs-hash:20051026144823-ac50b-570dfe169a2ce693458c493e8f103884de3c5078.gz
2005-10-27 00:48:23 +10:00
axel
5ba0affdd7 Minor performance tweaks
darcs-hash:20051026105102-ac50b-ffa35c43fd9e1aad47229260e5d7da4249cacdcf.gz
2005-10-26 20:51:02 +10:00
axel
721f616964 Add documentation for the vared shellscript function
darcs-hash:20051025143355-ac50b-d7aaecf4b2de062fb2c56928bd6a6919ad6d223c.gz
2005-10-26 00:33:55 +10:00
axel
ef4345968e vared function used older uppercase names for fish colors
darcs-hash:20051025134851-ac50b-f21b7c3e876f98b39f1d2382e2919d77c38bfdb4.gz
2005-10-25 23:48:51 +10:00
axel
319956c26b Predecalre variables in psub
darcs-hash:20051025134043-ac50b-225c021c00211918b8c6957a10018497891cf456.gz
2005-10-25 23:40:43 +10:00
axel
a9bf64465c Use select instead of poll to avoid MacOS X bugs
darcs-hash:20051025112247-ac50b-b6c98618716401f39308bdc665401bd34819ce9d.gz
2005-10-25 21:22:47 +10:00
axel
ddcb84aa07 Fix problem bug breaking completion in commands with multiple subshells
darcs-hash:20051025110352-ac50b-fff319ddcbafb722b9bc3c61aa1b250b290716a5.gz
2005-10-25 21:03:52 +10:00
axel
d332293245 Make sure PATH contains vital directories during init
darcs-hash:20051025093945-ac50b-8939b844e472caf43a206e2a0dbfa0d48ffdd45c.gz
2005-10-25 19:39:45 +10:00
axel
48afe8062e Make sure fish color settings are valid colors
darcs-hash:20051024175108-ac50b-3abfbd8b5974c7a3a53bc70d425d41dd1295da02.gz
2005-10-25 03:51:08 +10:00
axel
277f9b7e60 Huge API documentation cleanup
darcs-hash:20051024152625-ac50b-41503feb4ea8d428c5b30c159aaae0c8f7ae46a2.gz
2005-10-25 01:26:25 +10:00
axel
f8de9de13d Code cleanups and API documentation updates
darcs-hash:20051023121429-ac50b-6ff72171b5a90b6e398bd84e748388c1dba831d9.gz
2005-10-23 22:14:29 +10:00
axel
ba6ad5025e Make sure USER variable is correct. Needed when using the su command.
darcs-hash:20051023102232-ac50b-4ed7c9de75ece8a1d9ba7ec5c086bde146436db9.gz
2005-10-23 20:22:32 +10:00
228 changed files with 20895 additions and 7053 deletions

1015
ChangeLog

File diff suppressed because it is too large Load Diff

18
INSTALL
View File

@@ -33,10 +33,13 @@ broken.
Simple install procedure
========================
If you have downloaded the darcs repository of fish, you need to run
autoconf.
% ./configure
% make #Compile fish
% make install #Install fish
% echo /usr/local/bin/fish >>/etc/shells #Add fish to list of shells
% make # Compile fish
% make install # Install fish
% echo /usr/local/bin/fish >>/etc/shells # Add fish to list of shells
If you wish to use fish as your default shell, use the following
command:
@@ -49,6 +52,9 @@ chsh will prompt you for your password, and change your default shell.
Local install procedure
=======================
If you have downloaded the darcs repository of fish, you need to run
autoconf first.
To install fish in your own home directory (typically as non-root),
type:
@@ -57,6 +63,6 @@ type:
% make install # Install fish
You will not be able to use fish as the default shell unless you also
add the corresponding line to /etc/shells, which kind of defeats the
point of a local install. But you can at least build and run fish.
add the corresponding line to /etc/shells, which mostly defeats the
point of a local install. As a workaround, you can add fish as the
last command of the init files for your regular shell.

View File

@@ -28,16 +28,19 @@
# hallucinations.
#
# Compiler flags
# Programs
CC := @CC@
INSTALL:=@INSTALL@
# Compiler flags
CFLAGS := @CFLAGS@ @INCLUDEDIR@ -Wall -std=gnu99 -fno-strict-aliasing
CPPFLAGS=@CPPFLAGS@
LDFLAGS:= -l@CURSESLIB@ @LIBS@ @LDFLAGS@ @LIBDIR@
INSTALL:=@INSTALL@
# Installation directories
prefix = @prefix@
exec_prefix = @exec_prefix@
datadir = @datadir@
bindir = @bindir@
mandir = @mandir@
sysconfdir = @sysconfdir@
@@ -46,28 +49,45 @@ fishfile = @fishfile@
fishinputfile = @fishinputfile@
docdir = @docdir@
#Init files to install
INIT_DIR_INSTALL = init/fish_interactive.fish init/fish_function.fish init/fish_complete.fish
# Set to 1 if we have gettext
HAVE_GETTEXT=@HAVE_GETTEXT@
# All objects used by fish, that are compiled from an ordinary .c file
# using an ordinary .h file.
COMMON_OBJS := function.o builtin.o common.o complete.o env.o exec.o \
expand.o highlight.o history.o kill.o parser.o proc.o reader.o \
sanity.o tokenizer.o util.o wildcard.o wgetopt.o wutil.o input.o \
output.o intern.o env_universal.o env_universal_common.o \
input_common.o event.o signal.o io.o
input_common.o event.o signal.o io.o translate.o
# builtin_help.h exists, but builtin_help.c is autogenerated
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
COMMON_OBJS_WITH_CODE := builtin_set.o builtin_commandline.o \
builtin_ulimit.c builtin_complete.o
# All objects that the system needs to build fish
FISH_OBJS := $(COMMON_OBJS) $(COMMON_OBJS_WITH_CODE) $(COMMON_OBJS_WITH_HEADER) main.o
FISH_PAGER_OBJS := fish_pager.o common.o output.o util.o wutil.o tokenizer.o input_common.o env_universal.o env_universal_common.o
FISH_TESTS_OBJS := $(COMMON_OBJS) $(COMMON_OBJS_WITH_CODE) $(COMMON_OBJS_WITH_HEADER) fish_tests.o
FISH_OBJS := $(COMMON_OBJS) $(COMMON_OBJS_WITH_CODE) \
$(COMMON_OBJS_WITH_HEADER) main.o
# All objects that the system needs to build fish_pager
FISH_PAGER_OBJS := fish_pager.o common.o output.o util.o wutil.o \
tokenizer.o input_common.o env_universal.o env_universal_common.o \
translate.o
# All objects that the system needs to build fish_tests
FISH_TESTS_OBJS := $(COMMON_OBJS) $(COMMON_OBJS_WITH_CODE) \
$(COMMON_OBJS_WITH_HEADER) fish_tests.o
# All objects that the system needs to build fishd
FISHD_OBJS := fishd.o env_universal_common.o common.o util.o wutil.o \
doc_src/fishd.o
#All objects that the system needs to build mimedb
# All objects needed to build mimedb
MIME_OBJS := mimedb.o xdgmimealias.o xdgmime.o xdgmimeglob.o \
xdgmimeint.o xdgmimemagic.o xdgmimeparent.o wutil.o
@@ -76,16 +96,15 @@ MIME_OBJS := mimedb.o xdgmimealias.o xdgmime.o xdgmimeglob.o \
# alphabetically, since this is the order in which they will be written
# in the help file.
#
BUILTIN_DOC_SRC := doc_src/source.txt doc_src/and.txt \
doc_src/begin.txt doc_src/bg.txt doc_src/bind.txt \
doc_src/break.txt doc_src/builtin.txt doc_src/case.txt \
doc_src/cd.txt doc_src/command.txt doc_src/commandline.txt \
doc_src/complete.txt doc_src/continue.txt doc_src/else.txt \
doc_src/end.txt doc_src/eval.txt doc_src/exec.txt doc_src/exit.txt \
doc_src/fg.txt doc_src/for.txt doc_src/function.txt \
doc_src/functions.txt doc_src/if.txt doc_src/jobs.txt \
doc_src/not.txt doc_src/or.txt doc_src/random.txt \
doc_src/block.txt doc_src/break.txt doc_src/builtin.txt \
doc_src/case.txt doc_src/cd.txt doc_src/command.txt \
doc_src/commandline.txt doc_src/complete.txt doc_src/continue.txt \
doc_src/else.txt doc_src/end.txt doc_src/eval.txt doc_src/exec.txt \
doc_src/exit.txt doc_src/fg.txt doc_src/for.txt \
doc_src/function.txt doc_src/functions.txt doc_src/if.txt \
doc_src/jobs.txt doc_src/not.txt doc_src/or.txt doc_src/random.txt \
doc_src/return.txt doc_src/read.txt doc_src/set.txt \
doc_src/status.txt doc_src/switch.txt doc_src/ulimit.txt \
doc_src/while.txt
@@ -100,19 +119,21 @@ BUILTIN_DOC_HDR := $(BUILTIN_DOC_SRC:.txt=.doxygen)
# alphabetically, since this is the order in which they will be written
# in the help file.
#
CMD_DOC_SRC := doc_src/count.txt doc_src/dirh.txt doc_src/dirs.txt \
doc_src/fishd.txt doc_src/help.txt doc_src/mimedb.txt \
doc_src/nextd.txt doc_src/open.txt doc_src/popd.txt \
doc_src/prevd.txt doc_src/psub.txt doc_src/pushd.txt \
doc_src/set_color.txt doc_src/tokenize.txt doc_src/type.txt \
doc_src/umask.txt
doc_src/fish_pager.txt doc_src/fishd.txt doc_src/help.txt \
doc_src/mimedb.txt doc_src/nextd.txt doc_src/open.txt \
doc_src/popd.txt doc_src/prevd.txt doc_src/psub.txt \
doc_src/pushd.txt doc_src/set_color.txt doc_src/trap.txt \
doc_src/type.txt doc_src/umask.txt doc_src/vared.txt
#
# Files generated by running doxygen on the files in $(CMD_DOC_SRC)
#
CMD_DOC_HDR := $(CMD_DOC_SRC:.txt=.doxygen)
#
# Files in the test directory
#
TEST_IN := $(wildcard tests/test*.in)
#
@@ -126,17 +147,17 @@ DOC_SRC_DIR_FILES := doc_src/Doxyfile.in doc_src/doc.hdr \
# Files in ./
MAIN_DIR_FILES := Doxyfile Doxyfile.user Makefile.in configure \
configure.ac config.h.in install-sh set_color.c count.c \
key_reader.c tokenize.c gen_hdr.sh gen_hdr2.c $(MIME_OBJS:.o=.h) \
key_reader.c gen_hdr.sh gen_hdr2.c $(MIME_OBJS:.o=.h) \
$(MIME_OBJS:.o=.c) $(COMMON_OBJS_WITH_HEADER:.o=.h) \
$(COMMON_OBJS:.o=.h) $(COMMON_OBJS_WITH_CODE:.o=.c) \
$(COMMON_OBJS:.o=.c) builtin_help.hdr fish.spec.in INSTALL README \
user_doc.head.html xsel-0.9.6.tar ChangeLog config.sub \
config.guess fish_tests.c main.c fish_pager.c fishd.c
config.guess fish_tests.c main.c fish_pager.c fishd.c seq.in
# Files in ./init/
INIT_DIR_FILES :=init/fish.in init/fish_complete.fish \
INIT_DIR_FILES :=init/fish.in init/fish_complete.fish.in \
init/fish_function.fish init/fish_inputrc \
init/fish_interactive.fish
init/fish_interactive.fish.in
# Files in ./tests/
TESTS_DIR_FILES := $(TEST_IN) $(TEST_IN:.in=.out) $(TEST_IN:.in=.err) \
@@ -145,23 +166,35 @@ TESTS_DIR_FILES := $(TEST_IN) $(TEST_IN:.in=.out) $(TEST_IN:.in=.err) \
COMPLETIONS_DIR_FILES := $(wildcard init/completions/*.fish)
# Programs to build
PROGRAMS:=fish set_color tokenize @XSEL@ mimedb count fish_pager fishd
PROGRAMS:=fish set_color @XSEL@ @SEQ_FALLBACK@ mimedb count fish_pager fishd
# Manuals to install
MANUALS:=doc_src/fish.1 @XSEL_MAN_PATH@ \
doc_src/builtin_doc/man/man1/mimedb.1 \
doc_src/builtin_doc/man/man1/set_color.1 \
doc_src/builtin_doc/man/man1/tokenize.1 \
doc_src/builtin_doc/man/man1/count.1
doc_src/builtin_doc/man/man1/count.1 \
doc_src/builtin_doc/man/man1/fishd.1 \
doc_src/builtin_doc/man/man1/fish_pager.1
#All translation message catalogs
TRANSLATIONS_SRC := $(wildcard po/*.po)
TRANSLATIONS := $(TRANSLATIONS_SRC:.po=.gmo)
#Make everything needed for installing fish
all: $(PROGRAMS) user_doc
all: $(PROGRAMS) user_doc
@echo fish has now been built.
@echo Use \'make install\' to install fish.
.PHONY: all
debug:
make fish CFLAGS="-O0 -Wno-unused -Werror -g @INCLUDEDIR@ -Wall -std=gnu99 -fno-strict-aliasing"
.PHONY: debug
# User documentation, describing the features of the fish shell.
user_doc: doc.h Doxyfile.user user_doc.head.html
doxygen Doxyfile.user
#Source code documentation. Also includes user documentation.
# Source code documentation. Also includes user documentation.
doc: *.h *.c doc.h Doxyfile builtin_help.c
doxygen;
@@ -175,6 +208,7 @@ doc/refman.pdf: doc
test: $(PROGRAMS) fish_tests
./fish_tests; cd tests; ../fish <test.fish;
.PHONY: test
xsel-0.9.6:
tar -xf xsel-0.9.6.tar
@@ -205,6 +239,33 @@ doc.h:$(BUILTIN_DOC_SRC) $(CMD_DOC_SRC) doc_src/doc.hdr
cat $*.txt >>$@;
echo "*/" >>$@
# Compile translation file
%.gmo:
if test $(HAVE_GETTEXT) = 1; then \
msgfmt $*.po -o $*.gmo; \
fi
# Update existing po file or copy messages.pot
%.po:messages.pot
if test $(HAVE_GETTEXT) = 1;then \
if test -f $*.po; then \
msgmerge -U --backup=existing $*.po messages.pot;\
else \
cp messages.pot $*.po;\
fi; \
fi
# Create a template translation object
messages.pot: *.c *.h init/*.in init/*.fish init/completions/*.fish seq
if test $(HAVE_GETTEXT) = 1;then \
xgettext -k_ -kN_ -kcomplete_desc *.c *.h -o messages.pot; \
if ! xgettext -j -k_ -LShell init/*.in init/*.fish init/completions/*.fish seq -o messages.pot; then \
echo "Your xgettext version is too old to build the messages.pot file"\
rm messages.pot\
false;\
fi; \
fi
# Generate the internal help functions by making doxygen create
# man-pages which are then converted into C code. The convertion path
# looks like this:
@@ -240,6 +301,7 @@ doc.h:$(BUILTIN_DOC_SRC) $(CMD_DOC_SRC) doc_src/doc.hdr
builtin_help.c: $(BUILTIN_DOC_HDR) doc_src/count.doxygen gen_hdr2 gen_hdr.sh builtin_help.hdr $(CMD_DOC_HDR)
cd doc_src; doxygen; cd ..;
cp builtin_help.hdr builtin_help.c;
chmod 755 gen_hdr.sh
for i in $(BUILTIN_DOC_HDR) doc_src/count.doxygen ; do \
echo ' hash_put( &tbl, L"'`basename $$i .doxygen`'",' >>$@; \
./gen_hdr.sh $$i >>$@; \
@@ -261,12 +323,17 @@ builtin_help.c: $(BUILTIN_DOC_HDR) doc_src/count.doxygen gen_hdr2 gen_hdr.sh bui
echo "void print_help()" >>$@
echo "{" >>$@
echo ' printf( "%s",' >>$@
chmod 755 gen_hdr.sh
./gen_hdr.sh $*.doxygen >>$@
echo ");" >>$@
echo "}" >>$@
#man -- doc_src/builtin_doc/man/man1/`basename $@ .c`.1 | cat -s | ./gen_hdr2 >>$@
install: all
#
# The build rules for installing/uninstalling
#
install: all install-translations
$(INSTALL) -m 755 -d $(DESTDIR)$(bindir)
for i in $(PROGRAMS); do\
$(INSTALL) -m 755 $$i $(DESTDIR)$(bindir) ; \
@@ -274,7 +341,7 @@ install: all
$(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)$(fishdir)
$(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)$(fishdir)/completions
$(INSTALL) -m 644 init/fish $(DESTDIR)$(sysconfdir)$(fishfile)
for i in init/fish_interactive.fish init/fish_function.fish init/fish_complete.fish ; do \
for i in $(INIT_DIR_INSTALL); do \
$(INSTALL) -m 644 $$i $(DESTDIR)$(sysconfdir)$(fishdir); \
done;
for i in $(COMPLETIONS_DIR_FILES); do \
@@ -283,16 +350,25 @@ install: all
$(INSTALL) -m 644 init/fish_inputrc $(DESTDIR)$(sysconfdir)$(fishinputfile);
$(INSTALL) -m 755 -d $(DESTDIR)$(docdir)
for i in user_doc/html/* ChangeLog; do \
$(INSTALL) -m 644 $$i $(DESTDIR)$(docdir); \
if test -f $$i; then \
$(INSTALL) -m 644 $$i $(DESTDIR)$(docdir); \
fi; \
done;
$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1
for i in $(MANUALS); do \
$(INSTALL) -m 644 $$i $(DESTDIR)$(mandir)/man1/; \
done;
@echo If you want to use fish as the default shell, remember to first
@echo add the line \'$(DESTDIR)$(bindir)/fish\' to the file \'/etc/shells\'.
@echo fish is now installed on your system.
@echo To run fish, type \'fish\' in your terminal.
@echo
@echo To use fish as your login shell:
@echo \* add the line \'$(DESTDIR)$(bindir)/fish\' to the file \'/etc/shells\'.
@echo \* use the command \'chsh -s $(DESTDIR)$(bindir)/fish\'.
@echo
@echo Have fun!
.PHONY: install
uninstall:
uninstall: uninstall-translations
for i in $(PROGRAMS); do \
rm -f $(DESTDIR)$(bindir)/$$i; \
done;
@@ -301,18 +377,40 @@ uninstall:
rm -f $(DESTDIR)$(sysconfdir)$(fishinputfile)
rm -r $(DESTDIR)$(sysconfdir)$(fishdir)
rm -r $(DESTDIR)$(docdir)
for i in fish.1* @XSEL_MAN@ mimedb.1* set_color.1* tokenize.1* count.1*; do \
for i in fish.1* @XSEL_MAN@ mimedb.1* fishd.1* set_color.1* count.1*; do \
rm $(DESTDIR)$(mandir)/man1/$$i; \
done;
.PHONY: uninstall
install-translations: $(TRANSLATIONS)
if test $(HAVE_GETTEXT) = 1; then \
for i in $(TRANSLATIONS); do \
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/locale/`basename $$i .gmo`/LC_MESSAGES; \
$(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/locale/`basename $$i .gmo`/LC_MESSAGES/fish.mo; \
echo $(DESTDIR)$(datadir)/locale/`basename $$i .gmo`/LC_MESSAGES/fish.mo;\
done; \
fi
.PHONY: install-translations
uninstall-translations:
if test $(HAVE_GETTEXT) = 1; then \
for i in $(TRANSLATIONS_SRC); do \
rm -f $(DESTDIR)$(datadir)/locale/`basename $$i .po`/LC_MESSAGES/fish.mo; \
done; \
fi
.PHONY: uninstall-translations
#
# The build rules for all the commands
#
# The fish shell
fish: $(FISH_OBJS)
$(CC) $(FISH_OBJS) $(LDFLAGS) -o $@
fish_pager: $(FISH_PAGER_OBJS)
$(CC) $(FISH_PAGER_OBJS) $(LDFLAGS) -o $@
fishd: $(FISHD_OBJS)
fishd: $(FISHD_OBJS)
$(CC) $(FISHD_OBJS) $(LDFLAGS) -o $@
fish_tests: $(FISH_TESTS_OBJS)
@@ -325,18 +423,20 @@ mimedb: $(MIME_OBJS) util.o common.o doc_src/mimedb.c
set_color: set_color.o doc_src/set_color.c
$(CC) set_color.o doc_src/set_color.c $(LDFLAGS) -o $@
tokenize: tokenize.o doc_src/tokenize.c
$(CC) tokenize.o doc_src/tokenize.c $(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 $@
#
# Update dependencies
#
depend:
makedepend -fMakefile.in -Y *.c
.PHONY: depend
# Copy all the source files into a new directory and use tar to create
# an archive from it. Simplest way I could think of to make an archive
@@ -344,18 +444,20 @@ depend:
#
# Uses install instead of mkdir so build won't fail if the directory
# exists
fish-@PACKAGE_VERSION@.tar: $(DOC_SRC_DIR_FILES) $(MAIN_DIR_FILES) $(INIT_DIR_FILES) $(TEST_DIR_FILES) $(COMPLETIONS_DIR_FILES) ChangeLog
fish-@PACKAGE_VERSION@.tar: $(DOC_SRC_DIR_FILES) $(MAIN_DIR_FILES) $(INIT_DIR_FILES) $(TEST_DIR_FILES) $(COMPLETIONS_DIR_FILES) ChangeLog
rm -rf fish-@PACKAGE_VERSION@
$(INSTALL) -d fish-@PACKAGE_VERSION@
$(INSTALL) -d fish-@PACKAGE_VERSION@/doc_src
$(INSTALL) -d fish-@PACKAGE_VERSION@/init
$(INSTALL) -d fish-@PACKAGE_VERSION@/init/completions
$(INSTALL) -d fish-@PACKAGE_VERSION@/tests
$(INSTALL) -d fish-@PACKAGE_VERSION@/po
cp -f $(DOC_SRC_DIR_FILES) fish-@PACKAGE_VERSION@/doc_src
cp -f $(MAIN_DIR_FILES) fish-@PACKAGE_VERSION@/
cp -f $(INIT_DIR_FILES) fish-@PACKAGE_VERSION@/init/
cp -f $(COMPLETIONS_DIR_FILES) fish-@PACKAGE_VERSION@/init/completions/
cp -f $(TESTS_DIR_FILES) fish-@PACKAGE_VERSION@/tests/
cp -f $(TRANSLATIONS_SRC) fish-@PACKAGE_VERSION@/po/
tar -c fish-@PACKAGE_VERSION@ >fish-@PACKAGE_VERSION@.tar
rm -rf fish-@PACKAGE_VERSION@
@@ -373,11 +475,23 @@ rpm: fish-@PACKAGE_VERSION@.tar.bz2
rpmbuild -ba --clean /usr/src/redhat/SPECS/fish.spec
mv /usr/src/redhat/RPMS/*/fish*@PACKAGE_VERSION@*.rpm .
mv /usr/src/redhat/SRPMS/fish*@PACKAGE_VERSION@*.src.rpm .
.PHONY: rpm
#
# Cleanup targets
#
distclean: clean
rm -f fish.spec doc_src/fish.1 doc_src/Doxyfile
rm -f init/fish init/fish_interactive.fish init/fish_complete.fish
rm -f config.status config.log config.h Makefile
.PHONY: distclean
clean:
rm -f *.o doc.h doc_src/*.doxygen doc_src/*.c builtin_help.c
rm -f config.status config.log config.h Makefile
rm -f tokenizer_test fish key_reader set_color tokenize gen_hdr2 mimedb
rm -f tests/tmp.err tests/tmp.out tests/tmp.status tests/foo.txt
rm -f tokenizer_test fish key_reader set_color gen_hdr2 mimedb
rm -f fishd fish_pager count
rm -f fish-@PACKAGE_VERSION@.tar
rm -f fish-@PACKAGE_VERSION@.tar.gz
rm -f fish-@PACKAGE_VERSION@.tar.bz2
@@ -386,70 +500,91 @@ clean:
rm -rf doc_src/builtin_doc
rm -rf fish-@PACKAGE_VERSION@
rm -rf xsel-0.9.6/
rm -f $(TRANSLATIONS)
.PHONY: 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: parser.h reader.h env.h expand.h common.h wgetopt.h sanity.h
builtin.o: io.h parser.h reader.h env.h expand.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
builtin_commandline.o: config.h util.h builtin.h common.h wgetopt.h reader.h
builtin_commandline.o: proc.h parser.h tokenizer.h input_common.h input.h
builtin.o: intern.h event.h signal.h translate.h
builtin_commandline.o: signal.h config.h util.h builtin.h common.h wgetopt.h
builtin_commandline.o: reader.h proc.h io.h parser.h tokenizer.h
builtin_commandline.o: input_common.h input.h translate.h
builtin_help.o: config.h util.h common.h builtin_help.h
builtin_set.o: config.h util.h builtin.h env.h expand.h common.h wgetopt.h
builtin_set.o: proc.h parser.h
common.o: config.h util.h wutil.h common.h expand.h proc.h wildcard.h
common.o: parser.h
complete.o: config.h util.h tokenizer.h wildcard.h proc.h parser.h function.h
complete.o: complete.h builtin.h env.h exec.h expand.h common.h reader.h
complete.o: history.h intern.h wutil.h
env.o: config.h util.h wutil.h proc.h common.h env.h sanity.h expand.h
env.o: history.h reader.h parser.h env_universal.h env_universal_common.h
env_universal.o: util.h common.h wutil.h env_universal_common.h
env_universal.o: env_universal.h
env_universal_common.o: util.h common.h wutil.h env_universal_common.h
exec.o: config.h util.h common.h wutil.h proc.h exec.h parser.h builtin.h
exec.o: function.h env.h wildcard.h sanity.h expand.h env_universal.h
exec.o: env_universal_common.h
expand.o: config.h util.h common.h wutil.h env.h proc.h parser.h expand.h
expand.o: wildcard.h exec.h tokenizer.h complete.h
fishd.o: util.h common.h wutil.h env_universal_common.h
fish_pager.o: config.h util.h wutil.h common.h complete.h output.h
builtin_set.o: signal.h config.h util.h builtin.h env.h expand.h common.h
builtin_set.o: wgetopt.h proc.h io.h parser.h translate.h
builtin_ulimit.o: config.h util.h builtin.h common.h wgetopt.h translate.h
common.o: config.h signal.h util.h wutil.h common.h expand.h proc.h io.h
common.o: wildcard.h parser.h
complete.o: signal.h config.h util.h tokenizer.h wildcard.h proc.h io.h
complete.o: parser.h function.h complete.h builtin.h env.h exec.h expand.h
complete.o: common.h reader.h history.h intern.h translate.h wutil.h
env.o: config.h signal.h util.h wutil.h proc.h io.h common.h env.h sanity.h
env.o: expand.h history.h reader.h parser.h env_universal.h
env.o: env_universal_common.h input_common.h event.h translate.h
env_universal.o: config.h signal.h util.h common.h wutil.h
env_universal.o: env_universal_common.h env_universal.h
env_universal_common.o: signal.h util.h common.h wutil.h
env_universal_common.o: env_universal_common.h
event.o: signal.h config.h util.h function.h proc.h io.h parser.h common.h
event.o: event.h translate.h
exec.o: signal.h config.h util.h common.h wutil.h proc.h io.h exec.h parser.h
exec.o: builtin.h function.h env.h wildcard.h sanity.h expand.h
exec.o: env_universal.h env_universal_common.h translate.h
expand.o: signal.h config.h util.h common.h wutil.h env.h proc.h io.h
expand.o: parser.h expand.h wildcard.h exec.h tokenizer.h complete.h
fishd.o: signal.h util.h common.h wutil.h env_universal_common.h
fish_pager.o: config.h signal.h util.h wutil.h common.h complete.h output.h
fish_pager.o: input_common.h env_universal.h env_universal_common.h
fish_tests.o: config.h util.h common.h proc.h reader.h builtin.h function.h
fish_tests.o: complete.h wutil.h env.h expand.h parser.h tokenizer.h
function.o: config.h util.h function.h proc.h parser.h common.h intern.h
highlight.o: config.h util.h wutil.h highlight.h tokenizer.h proc.h parser.h
highlight.o: builtin.h function.h env.h expand.h sanity.h common.h complete.h
highlight.o: output.h
fish_tests.o: config.h signal.h util.h common.h proc.h io.h reader.h
fish_tests.o: builtin.h function.h complete.h wutil.h env.h expand.h parser.h
fish_tests.o: tokenizer.h output.h exec.h event.h
function.o: signal.h config.h util.h function.h proc.h io.h parser.h common.h
function.o: intern.h event.h
highlight.o: signal.h config.h util.h wutil.h highlight.h tokenizer.h proc.h
highlight.o: io.h parser.h builtin.h function.h env.h expand.h sanity.h
highlight.o: common.h complete.h output.h
history.o: config.h util.h wutil.h history.h common.h reader.h env.h sanity.h
input.o: config.h util.h wutil.h reader.h proc.h common.h sanity.h
input.o: input_common.h input.h parser.h env.h expand.h
input.o: config.h signal.h util.h wutil.h reader.h proc.h io.h common.h
input.o: sanity.h input_common.h input.h parser.h env.h expand.h event.h
input.o: translate.h
input_common.o: config.h util.h common.h wutil.h input_common.h
input_common.o: env_universal.h env_universal_common.h
intern.o: config.h util.h common.h intern.h
kill.o: config.h util.h wutil.h kill.h proc.h sanity.h common.h env.h
kill.o: expand.h exec.h parser.h
main.o: config.h util.h common.h reader.h builtin.h function.h complete.h
main.o: wutil.h env.h sanity.h proc.h parser.h expand.h intern.h
io.o: config.h util.h wutil.h exec.h proc.h io.h common.h translate.h
key_reader.o: input_common.h
kill.o: signal.h config.h util.h wutil.h kill.h proc.h io.h sanity.h common.h
kill.o: env.h expand.h exec.h parser.h
main.o: config.h signal.h util.h common.h reader.h builtin.h function.h
main.o: complete.h wutil.h env.h sanity.h proc.h io.h parser.h expand.h
main.o: intern.h exec.h event.h output.h translate.h
mimedb.o: config.h xdgmime.h util.h
output.o: config.h util.h wutil.h expand.h common.h output.h highlight.h
parser.o: config.h util.h common.h wutil.h proc.h parser.h tokenizer.h exec.h
parser.o: wildcard.h function.h builtin.h builtin_help.h env.h expand.h
parser.o: reader.h sanity.h env_universal.h env_universal_common.h
proc.o: config.h util.h wutil.h proc.h common.h reader.h sanity.h env.h
reader.o: config.h util.h wutil.h highlight.h reader.h proc.h parser.h
reader.o: complete.h history.h common.h sanity.h env.h exec.h expand.h
reader.o: tokenizer.h kill.h input_common.h input.h function.h output.h
sanity.o: config.h util.h common.h sanity.h proc.h history.h reader.h kill.h
sanity.o: wutil.h
output.o: config.h signal.h util.h wutil.h expand.h common.h output.h
output.o: highlight.h
parser.o: signal.h config.h util.h common.h wutil.h proc.h io.h parser.h
parser.o: tokenizer.h exec.h wildcard.h function.h builtin.h builtin_help.h
parser.o: env.h expand.h reader.h sanity.h env_universal.h
parser.o: env_universal_common.h event.h translate.h
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
reader.o: config.h signal.h util.h wutil.h highlight.h reader.h proc.h io.h
reader.o: parser.h complete.h history.h common.h sanity.h env.h exec.h
reader.o: expand.h tokenizer.h kill.h input_common.h input.h function.h
reader.o: output.h translate.h
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
set_color.o: config.h
tokenize.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
util.o: config.h util.h common.h wutil.h
wgetopt.o: config.h wgetopt.h wutil.h
wildcard.o: config.h util.h wutil.h complete.h common.h wildcard.h reader.h
wildcard.o: expand.h
wildcard.o: expand.h translate.h
wutil.o: config.h util.h common.h wutil.h
xdgmimealias.o: xdgmimealias.h xdgmime.h xdgmimeint.h
xdgmime.o: xdgmime.h xdgmimeint.h xdgmimeglob.h xdgmimemagic.h xdgmimealias.h

1552
builtin.c

File diff suppressed because it is too large Load Diff

View File

@@ -17,11 +17,45 @@ enum
}
;
#define BUILTIN_ERR_MISSING L": Expected argument"
#define BUILTIN_ERR_COMBO L": Invalid combination of options"
#define BUILTIN_ERR_GLOCAL L": Variable can only be one of universal, global and local"
#define BUILTIN_ERR_EXPUNEXP L": Variable can't be both exported and unexported"
#define BUILTIN_ERR_UNKNOWN L": Unknown option"
/**
Error message on missing argument
*/
#define BUILTIN_ERR_MISSING _( L"%ls: Expected argument\n" )
/**
Error message on invalid combination of options
*/
#define BUILTIN_ERR_COMBO _( L"%ls: Invalid combination of options\n" )
/**
Error message on invalid combination of options
*/
#define BUILTIN_ERR_COMBO2 _( L"%ls: Invalid combination of options,\n%ls\n" )
/**
Error message on multiple scope levels for variables
*/
#define BUILTIN_ERR_GLOCAL _( L"%ls: Variable scope can only be one of universal, global and local\n%ls\n" )
/**
Error message for specifying both export and unexport to set/read
*/
#define BUILTIN_ERR_EXPUNEXP _( L"%ls: Variable can't be both exported and unexported\n%ls\n" )
/**
Error message for unknown switch
*/
#define BUILTIN_ERR_UNKNOWN _( L"%ls: Unknown option '%ls'\n" )
/**
Error message for invalid character in variable name
*/
#define BUILTIN_ERR_VARCHAR _( L"%ls: Invalid character '%lc' in variable name. Only alphanumerical characters and underscores are valid in a variable name.\n" )
/**
Error message for invalid (empty) variable name
*/
#define BUILTIN_ERR_VARNAME_ZERO _( L"%ls: Variable name can not be the empty string\n" )
/**
Stringbuffer used to represent standard output
@@ -103,10 +137,28 @@ int builtin_count_args( wchar_t **argv );
void builtin_print_help( wchar_t *cmd, string_buffer_t *b );
/**
The set builtin, used for setting variables. Defined in builtin_set.c.
*/
int builtin_set(wchar_t **argv);
/**
The commandline builtin, used for setting and getting the contents of the commandline. Defined in builtin_commandline.c.
*/
int builtin_commandline(wchar_t **argv);
/**
The ulimit builtin, used for setting resource limits. Defined in builtin_ulimit.c.
*/
int builtin_ulimit(wchar_t **argv);
/**
The complete builtin. Used for specifying programmable
tab-completions. Calls the functions in complete.c for any heavy
lifting.
*/
int builtin_complete(wchar_t **argv);
/**
This function works like wperror, but it prints its result into
the sb_err string_buffer_t instead of to stderr. Used by the builtin

View File

@@ -13,6 +13,7 @@ Functions used for implementing the commandline builtin.
#include "config.h"
#include "util.h"
#include "wutil.h"
#include "builtin.h"
#include "common.h"
#include "wgetopt.h"
@@ -22,16 +23,17 @@ Functions used for implementing the commandline builtin.
#include "tokenizer.h"
#include "input_common.h"
#include "input.h"
#include "translate.h"
/**
Which part of the comandbuffer are we operating on
*/
enum
{
STRING_MODE=1, // Operate on entire buffer
JOB_MODE, // Operate on job under cursor
PROCESS_MODE, // Operate on process under cursor
TOKEN_MODE // Operate on token under cursor
STRING_MODE=1, /**< Operate on entire buffer */
JOB_MODE, /**< Operate on job under cursor */
PROCESS_MODE, /**< Operate on process under cursor */
TOKEN_MODE /**< Operate on token under cursor */
}
;
@@ -40,13 +42,21 @@ enum
*/
enum
{
REPLACE_MODE=1, // Replace current text
INSERT_MODE, // Insert at cursor position
APPEND_MODE // Insert at end of current token/command/buffer
REPLACE_MODE=1, /**< Replace current text */
INSERT_MODE, /**< Insert at cursor position */
APPEND_MODE /**< Insert at end of current token/command/buffer */
}
;
/**
Replace/append/insert the selection with/at/after the specified string.
\param begin beginning of selection
\param end end of selection
\param insert the string to insert
\param append_mode can be one of REPLACE_MODE, INSERT_MODE or APPEND_MODE, affects the way the test update is performed
*/
static void replace_part( wchar_t *begin,
wchar_t *end,
wchar_t *insert,
@@ -58,10 +68,6 @@ static void replace_part( wchar_t *begin,
sb_init( &out );
// wchar_t *tmp = wcsndup( begin, end-begin );
// fwprintf( stderr, L"Commandline '%ls', current command '%ls'\n", reader_get_buffer(), tmp );
sb_append_substring( &out, buff, begin-buff );
switch( append_mode)
@@ -95,10 +101,18 @@ static void replace_part( wchar_t *begin,
sb_destroy( &out );
}
void write_part( wchar_t *begin,
wchar_t *end,
int cut_at_cursor,
int tokenize )
/**
Output the specified selection.
\param begin start of selection
\param end end of selection
\param cut_at_cursor whether printing should stop at the surrent cursor position
\param tokenize whether the string should be tokenized, printing one string token on every line and skipping non-string tokens
*/
static void write_part( wchar_t *begin,
wchar_t *end,
int cut_at_cursor,
int tokenize )
{
tokenizer tok;
string_buffer_t out;
@@ -237,7 +251,7 @@ int builtin_commandline( wchar_t **argv )
int opt = wgetopt_long( argc,
argv,
L"aijpctwfo",
L"aijpctwfor",
long_options,
&opt_index );
if( opt == -1 )
@@ -248,13 +262,10 @@ int builtin_commandline( wchar_t **argv )
case 0:
if(long_options[opt_index].flag != 0)
break;
sb_append2( sb_err,
argv[0],
BUILTIN_ERR_UNKNOWN,
L" ",
long_options[opt_index].name,
L"\n",
(void *)0 );
sb_printf( sb_err,
BUILTIN_ERR_UNKNOWN,
argv[0],
long_options[opt_index].name );
builtin_print_help( argv[0], sb_err );
return 1;
@@ -266,7 +277,11 @@ int builtin_commandline( wchar_t **argv )
case L'i':
append_mode = INSERT_MODE;
break;
case L'r':
append_mode = REPLACE_MODE;
break;
case 'c':
cut_at_cursor=1;
break;
@@ -306,10 +321,11 @@ int builtin_commandline( wchar_t **argv )
*/
if( buffer_part || cut_at_cursor || append_mode || tokenize )
{
sb_printf(sb_err,
BUILTIN_ERR_COMBO,
argv[0] );
sb_append2(sb_err,
argv[0],
BUILTIN_ERR_COMBO,
L"\n",
parser_current_line(),
L"\n",
(void *)0);
@@ -319,10 +335,11 @@ int builtin_commandline( wchar_t **argv )
if( argc == woptind )
{
sb_printf( sb_err,
BUILTIN_ERR_MISSING,
argv[0] );
sb_append2( sb_err,
argv[0],
BUILTIN_ERR_MISSING,
L"\n",
parser_current_line(),
L"\n",
(void *)0 );
@@ -378,22 +395,23 @@ int builtin_commandline( wchar_t **argv )
if( (tokenize || cut_at_cursor) && (argc-woptind) )
{
sb_append2( sb_err,
argv[0],
BUILTIN_ERR_COMBO,
L",\n --cut-at-cursor and --tokenize can not be used when setting the commandline",
(void *)0 );
sb_printf( sb_err,
BUILTIN_ERR_COMBO2,
argv[0],
L"--cut-at-cursor and --tokenize can not be used when setting the commandline" );
builtin_print_help( argv[0], sb_err );
return 1;
}
if( append_mode && !(argc-woptind) )
{
sb_append2( sb_err,
sb_printf( sb_err,
BUILTIN_ERR_COMBO2,
argv[0],
BUILTIN_ERR_COMBO,
L",\n insertion mode switches can not be used when not in insertion mode",
(void *)0 );
L"insertion mode switches can not be used when not in insertion mode" );
builtin_print_help( argv[0], sb_err );
return 1;
}

485
builtin_complete.c Normal file
View File

@@ -0,0 +1,485 @@
/** \file builtin_complete.c Functions defining the complete builtin
Functions used for implementing the complete builtin.
*/
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
#include <wctype.h>
#include <sys/types.h>
#include <termios.h>
#include <signal.h>
#include "config.h"
#include "util.h"
#include "wutil.h"
#include "builtin.h"
#include "common.h"
#include "complete.h"
#include "wgetopt.h"
#include "parser.h"
#include "translate.h"
/*
builtin_complete_* are a set of rather silly looping functions that
make sure that all the proper combinations of complete_add or
complete_remove get called.
*/
static void builtin_complete_add2( const wchar_t *cmd,
int cmd_type,
const wchar_t *short_opt,
array_list_t *gnu_opt,
array_list_t *old_opt,
int result_mode,
int authorative,
const wchar_t *condition,
const wchar_t *comp,
const wchar_t *desc )
{
int i;
const wchar_t *s;
for( s=short_opt; *s; s++ )
{
complete_add( cmd,
cmd_type,
*s,
0,
0,
result_mode,
authorative,
condition,
comp,
desc );
}
for( i=0; i<al_get_count( gnu_opt ); i++ )
{
complete_add( cmd,
cmd_type,
0,
(wchar_t *)al_get(gnu_opt, i ),
0,
result_mode,
authorative,
condition,
comp,
desc );
}
for( i=0; i<al_get_count( old_opt ); i++ )
{
complete_add( cmd,
cmd_type,
0,
(wchar_t *)al_get(old_opt, i ),
1,
result_mode,
authorative,
condition,
comp,
desc );
}
if( al_get_count( old_opt )+al_get_count( gnu_opt )+wcslen(short_opt) == 0 )
{
complete_add( cmd,
cmd_type,
0,
0,
0,
result_mode,
authorative,
condition,
comp,
desc );
}
}
static void builtin_complete_add( array_list_t *cmd,
array_list_t *path,
const wchar_t *short_opt,
array_list_t *gnu_opt,
array_list_t *old_opt,
int result_mode,
int authorative,
const wchar_t *condition,
const wchar_t *comp,
const wchar_t *desc )
{
int i;
for( i=0; i<al_get_count( cmd ); i++ )
{
builtin_complete_add2( al_get( cmd, i ),
COMMAND,
short_opt,
gnu_opt,
old_opt,
result_mode,
authorative,
condition,
comp,
desc );
}
for( i=0; i<al_get_count( path ); i++ )
{
builtin_complete_add2( al_get( path, i ),
PATH,
short_opt,
gnu_opt,
old_opt,
result_mode,
authorative,
condition,
comp,
desc );
}
}
static void builtin_complete_remove3( wchar_t *cmd,
int cmd_type,
wchar_t short_opt,
array_list_t *long_opt )
{
int i;
for( i=0; i<al_get_count( long_opt ); i++ )
{
complete_remove( cmd,
cmd_type,
short_opt,
(wchar_t *)al_get( long_opt, i ) );
}
}
static void builtin_complete_remove2( wchar_t *cmd,
int cmd_type,
const wchar_t *short_opt,
array_list_t *gnu_opt,
array_list_t *old_opt )
{
const wchar_t *s = (wchar_t *)short_opt;
if( *s )
{
for( ; *s; s++ )
{
if( al_get_count( old_opt) + al_get_count( gnu_opt ) == 0 )
{
complete_remove(cmd,
cmd_type,
*s,
0 );
}
else
{
builtin_complete_remove3( cmd,
cmd_type,
*s,
gnu_opt );
builtin_complete_remove3( cmd,
cmd_type,
*s,
old_opt );
}
}
}
else
{
builtin_complete_remove3( cmd,
cmd_type,
0,
gnu_opt );
builtin_complete_remove3( cmd,
cmd_type,
0,
old_opt );
}
}
static void builtin_complete_remove( array_list_t *cmd,
array_list_t *path,
const wchar_t *short_opt,
array_list_t *gnu_opt,
array_list_t *old_opt )
{
int i;
for( i=0; i<al_get_count( cmd ); i++ )
{
builtin_complete_remove2( (wchar_t *)al_get( cmd, i ),
COMMAND,
short_opt,
gnu_opt,
old_opt );
}
for( i=0; i<al_get_count( path ); i++ )
{
builtin_complete_remove2( (wchar_t *)al_get( path, i ),
PATH,
short_opt,
gnu_opt,
old_opt );
}
}
int builtin_complete( wchar_t **argv )
{
int res=0;
int argc=0;
int result_mode=SHARED;
int remove = 0;
int authorative = 1;
string_buffer_t short_opt;
array_list_t gnu_opt, old_opt;
wchar_t *comp=L"", *desc=L"", *condition=L"", *load=0;
array_list_t cmd;
array_list_t path;
al_init( &cmd );
al_init( &path );
sb_init( &short_opt );
al_init( &gnu_opt );
al_init( &old_opt );
argc = builtin_count_args( argv );
woptind=0;
while( res == 0 )
{
const static struct woption
long_options[] =
{
{
L"exclusive", no_argument, 0, 'x'
}
,
{
L"no-files", no_argument, 0, 'f'
}
,
{
L"require-parameter", no_argument, 0, 'r'
}
,
{
L"path", required_argument, 0, 'p'
}
,
{
L"command", required_argument, 0, 'c'
}
,
{
L"short-option", required_argument, 0, 's'
}
,
{
L"long-option", required_argument, 0, 'l' }
,
{
L"old-option", required_argument, 0, 'o'
}
,
{
L"description", required_argument, 0, 'd'
}
,
{
L"arguments", required_argument, 0, 'a'
}
,
{
L"erase", no_argument, 0, 'e'
}
,
{
L"unauthorative", no_argument, 0, 'u'
}
,
{
L"condition", required_argument, 0, 'n'
}
,
{
L"load", required_argument, 0, 'y'
}
,
{
0, 0, 0, 0
}
}
;
int opt_index = 0;
int opt = wgetopt_long( argc,
argv,
L"a:c:p:s:l:o:d:frxeun:y:",
long_options,
&opt_index );
if( opt == -1 )
break;
switch( opt )
{
case 0:
if(long_options[opt_index].flag != 0)
break;
sb_printf( sb_err,
BUILTIN_ERR_UNKNOWN,
argv[0],
long_options[opt_index].name );
sb_append( sb_err,
parser_current_line() );
// builtin_print_help( argv[0], sb_err );
res = 1;
break;
case 'x':
result_mode |= EXCLUSIVE;
break;
case 'f':
result_mode |= NO_FILES;
break;
case 'r':
result_mode |= NO_COMMON;
break;
case 'p':
al_push( &cmd, unescape( woptarg, 1));
break;
case 'c':
al_push( &cmd, unescape( woptarg, 1) );
break;
case 'd':
desc = woptarg;
break;
case 'u':
authorative=0;
break;
case 's':
sb_append( &short_opt, woptarg );
break;
case 'l':
al_push( &gnu_opt, woptarg );
break;
case 'o':
al_push( &old_opt, woptarg );
break;
case 'a':
comp = woptarg;
break;
case 'e':
remove = 1;
break;
case 'n':
condition = woptarg;
break;
case 'y':
load = woptarg;
break;
case '?':
// builtin_print_help( argv[0], sb_err );
res = 1;
break;
}
}
if( res != 0 )
{
}
else if( woptind != argc )
{
sb_printf( sb_err,
_( L"%ls: Too many arguments\n" ),
argv[0] );
sb_append( sb_err,
parser_current_line() );
// builtin_print_help( argv[0], sb_err );
res = 1;
}
else if( load )
{
complete_load( load, 1 );
}
else if( (al_get_count( &cmd) == 0 ) && (al_get_count( &path) == 0 ) )
{
/* No arguments specified, meaning we print the definitions of
* all specified completions to stdout.*/
complete_print( sb_out );
}
else
{
if( remove )
{
builtin_complete_remove( &cmd,
&path,
(wchar_t *)short_opt.buff,
&gnu_opt,
&old_opt );
}
else
{
builtin_complete_add( &cmd,
&path,
(wchar_t *)short_opt.buff,
&gnu_opt,
&old_opt,
result_mode,
authorative,
condition,
comp,
desc );
}
}
al_foreach( &cmd, (void (*)(const void *))&free );
al_foreach( &path, (void (*)(const void *))&free );
al_destroy( &cmd );
al_destroy( &path );
sb_destroy( &short_opt );
al_destroy( &gnu_opt );
al_destroy( &old_opt );
return res;
}

View File

@@ -9,6 +9,7 @@
#include <stdio.h>
#include <strings.h>
#include <wchar.h>
#include <sys/types.h>
#include "config.h"
#include "util.h"

View File

@@ -13,6 +13,7 @@ Functions used for implementing the set builtin.
#include "config.h"
#include "util.h"
#include "wutil.h"
#include "builtin.h"
#include "env.h"
#include "expand.h"
@@ -20,6 +21,7 @@ Functions used for implementing the set builtin.
#include "wgetopt.h"
#include "proc.h"
#include "parser.h"
#include "translate.h"
/**
Extract the name from a destination argument of the form name[index1 index2...]
@@ -40,10 +42,8 @@ static int parse_fill_name( string_buffer_t *name,
if (*src != L'[' && *src != L'\0')
{
sb_append(sb_err, L"set: Invalid character in variable name: ");
sb_append_char(sb_err, *src);
sb_append2(sb_err, L"\n", parser_current_line(), L"\n", (void *)0 );
sb_printf( sb_err, BUILTIN_ERR_VARCHAR, L"set", *src );
sb_append2(sb_err, parser_current_line(), L"\n", (void *)0 );
// builtin_print_help( L"set", sb_err );
return -1;
@@ -83,7 +83,7 @@ static int parse_fill_indexes( array_list_t *indexes,
return -1;
}
while (iswblank(*src))
while (iswspace(*src))
{
src++;
}
@@ -94,9 +94,7 @@ static int parse_fill_indexes( array_list_t *indexes,
long l_ind = wcstol(src, &end, 10);
if (end == src)
{
wchar_t sbuf[256];
swprintf(sbuf, 255, L"Invalid index starting at %ls\n", src);
sb_append(sb_err, sbuf);
sb_printf(sb_err, _(L"%ls: Invalid index starting at '%ls'\n"), L"set", src);
return -1;
}
@@ -105,7 +103,7 @@ static int parse_fill_indexes( array_list_t *indexes,
al_push(indexes, ind);
src = end;
count++;
while (iswblank(*src)) src++;
while (iswspace(*src)) src++;
}
return count;
@@ -292,7 +290,7 @@ int builtin_set( wchar_t **argv )
}
;
wchar_t short_options[] = L"xglenuUq";
wchar_t short_options[] = L"+xglenuUq";
int argc = builtin_count_args(argv);
@@ -364,13 +362,11 @@ int builtin_set( wchar_t **argv )
if( query && (erase || list || global || local || universal || export || unexport ) )
{
sb_append2(sb_err,
sb_printf(sb_err,
BUILTIN_ERR_COMBO2,
argv[0],
BUILTIN_ERR_COMBO,
L"\n",
parser_current_line(),
L"\n",
(void *)0);
parser_current_line() );
builtin_print_help( argv[0], sb_err );
return 1;
}
@@ -379,13 +375,11 @@ int builtin_set( wchar_t **argv )
/* Check operation and modifiers sanity */
if( erase && list )
{
sb_append2(sb_err,
sb_printf(sb_err,
BUILTIN_ERR_COMBO2,
argv[0],
BUILTIN_ERR_COMBO,
L"\n",
parser_current_line(),
L"\n",
(void *)0);
parser_current_line() );
builtin_print_help( argv[0], sb_err );
return 1;
}
@@ -393,9 +387,8 @@ int builtin_set( wchar_t **argv )
if( local + global + universal > 1 )
{
sb_printf( sb_err,
L"%ls%ls\n%ls\n",
argv[0],
BUILTIN_ERR_GLOCAL,
argv[0],
parser_current_line() );
builtin_print_help( argv[0], sb_err );
return 1;
@@ -403,13 +396,10 @@ int builtin_set( wchar_t **argv )
if( export && unexport )
{
sb_append2(sb_err,
argv[0],
sb_printf( sb_err,
BUILTIN_ERR_EXPUNEXP,
L"\n",
parser_current_line(),
L"\n",
(void *)0);
argv[0],
parser_current_line() );
builtin_print_help( argv[0], sb_err );
return 1;
}
@@ -435,6 +425,13 @@ int builtin_set( wchar_t **argv )
{
dest = wcsdup(argv[woptind++]);
//fwprintf(stderr, L"Dest: %ls\n", dest);
if( !wcslen( dest ) )
{
free( dest );
sb_printf( sb_err, BUILTIN_ERR_VARNAME_ZERO, argv[0] );
return 1;
}
}
/* Parse values */
@@ -488,12 +485,11 @@ int builtin_set( wchar_t **argv )
/* No arguments -- display name & value for all variables in scope */
if( erase )
{
sb_append2( sb_err,
argv[0],
L": Erase needs a variable name\n",
parser_current_line(),
L"\n",
(void *)0 );
sb_printf( sb_err,
_(L"%ls: Erase needs a variable name\n%ls\n"),
argv[0],
parser_current_line() );
builtin_print_help( argv[0], sb_err );
retcode = 1;
}
@@ -526,12 +522,11 @@ int builtin_set( wchar_t **argv )
/* There are some arguments, we have at least a variable name */
if( erase && al_get_count(&values) != 0 )
{
sb_append2( sb_err,
argv[0],
L": Values cannot be specfied with erase\n",
parser_current_line(),
L"\n",
(void *)0 );
sb_printf( sb_err,
_(L"%ls: Values cannot be specfied with erase\n%ls\n"),
argv[0],
parser_current_line() );
builtin_print_help( argv[0], sb_err );
retcode = 1;
}

View File

@@ -1,6 +1,6 @@
/** \file builtin_commandline.c Functions defining the commandline builtin
/** \file builtin_ulimit.c Functions defining the ulimit builtin
Functions used for implementing the commandline builtin.
Functions used for implementing the ulimit builtin.
*/
#include <stdlib.h>
@@ -17,77 +17,111 @@ Functions used for implementing the commandline builtin.
#include "builtin.h"
#include "common.h"
#include "wgetopt.h"
#include "translate.h"
/**
Struct describing a resource limit
*/
struct resource_t
{
/**
Resource id
*/
int resource;
/**
Description of resource
*/
const wchar_t *desc;
/**
Switch used on commandline to specify resource
*/
wchar_t switch_char;
/**
The implicit multiplier used when setting getting values
*/
int multiplier;
}
;
/**
Array of resource_t structs, describing all known resource types.
*/
const static struct resource_t resource_arr[] =
{
{
RLIMIT_CORE, L"Maximum size of core files created", L'c'
RLIMIT_CORE, L"Maximum size of core files created", L'c', 1024
}
,
{
RLIMIT_DATA, L"Maximum size of a processs data segment", L'd'
RLIMIT_DATA, L"Maximum size of a processs data segment", L'd', 1024
}
,
{
RLIMIT_FSIZE, L"Maximum size of files created by the shell", L'f'
RLIMIT_FSIZE, L"Maximum size of files created by the shell", L'f', 1024
}
,
#if HAVE_RLIMIT_MEMLOCK
{
RLIMIT_MEMLOCK, L"Maximum size that may be locked into memory", L'l', 1024
}
,
#endif
#if HAVE_RLIMIT_RSS
{
RLIMIT_RSS, L"Maximum resident set size", L'm', 1024
}
,
#endif
{
RLIMIT_NOFILE, L"Maximum number of open file descriptors", L'n', 1
}
,
{
RLIMIT_MEMLOCK, L"Maximum size that may be locked into memory", L'l'
RLIMIT_STACK, L"Maximum stack size", L's', 1024
}
,
{
RLIMIT_RSS, L"Maximum resident set size", L'm'
RLIMIT_CPU, L"Maximum amount of cpu time in seconds", L't', 1
}
,
#if HAVE_RLIMIT_NPROC
{
RLIMIT_NOFILE, L"Maximum number of open file descriptors", L'n'
}
,
{
RLIMIT_STACK, L"Maximum stack size", L's'
}
,
{
RLIMIT_CPU, L"Maximum amount of cpu time in seconds", L't'
}
,
{
RLIMIT_NPROC, L"Maximum number of processes available to a single user", L'u'
RLIMIT_NPROC, L"Maximum number of processes available to a single user", L'u', 1
}
,
#endif
#if HAVE_RLIMIT_AS
{
RLIMIT_AS, L"Maximum amount of virtual memory available to the shell", L'v'
RLIMIT_AS, L"Maximum amount of virtual memory available to the shell", L'v', 1024
}
,
#endif
{
0, 0
0, 0, 0, 0
}
}
;
/**
Get the implicit multiplication factor for the specified resource limit
*/
static int get_multiplier( int what )
{
if( ( what == RLIMIT_NPROC ) ||
( what == RLIMIT_NOFILE ) ||
( what == RLIMIT_CPU ) )
int i;
for( i=0; resource_arr[i].desc; i++ )
{
return 1;
if( resource_arr[i].resource == what )
{
return resource_arr[i].multiplier;
}
}
return 1024;
return -1;
}
/**
Return the value for the specified resource limit
*/
static rlim_t get( int resource, int hard )
{
struct rlimit ls;
@@ -97,6 +131,9 @@ static rlim_t get( int resource, int hard )
return hard ? ls.rlim_max:ls.rlim_cur;
}
/**
Print the value of the specified resource limit
*/
static void print( int resource, int hard )
{
rlim_t l = get( resource, hard );
@@ -108,7 +145,9 @@ static void print( int resource, int hard )
}
/**
Print values of all resource limits
*/
static void print_all( int hard )
{
int i;
@@ -142,6 +181,9 @@ static void print_all( int hard )
}
}
/**
Returns the description for the specified resource limit
*/
static const wchar_t *get_desc( int what )
{
int i;
@@ -156,7 +198,9 @@ static const wchar_t *get_desc( int what )
return L"Not a resource";
}
/**
Set the new value of the specified resource limit
*/
static int set( int resource, int hard, int soft, rlim_t value )
{
struct rlimit ls;
@@ -194,6 +238,9 @@ static int set( int resource, int hard, int soft, rlim_t value )
return 0;
}
/**
Set all resource limits
*/
static int set_all( int hard, int soft, rlim_t value )
{
int i;
@@ -298,13 +345,10 @@ int builtin_ulimit( wchar_t ** argv )
case 0:
if(long_options[opt_index].flag != 0)
break;
sb_append2( sb_err,
argv[0],
BUILTIN_ERR_UNKNOWN,
L" ",
long_options[opt_index].name,
L"\n",
(void *)0 );
sb_printf( sb_err,
BUILTIN_ERR_UNKNOWN,
argv[0],
long_options[opt_index].name );
builtin_print_help( argv[0], sb_err );
return 1;
@@ -332,14 +376,17 @@ int builtin_ulimit( wchar_t ** argv )
case L'f':
what=RLIMIT_FSIZE;
break;
#if HAVE_RLIMIT_MEMLOCK
case L'l':
what=RLIMIT_MEMLOCK;
break;
#endif
#if HAVE_RLIMIT_RSS
case L'm':
what=RLIMIT_RSS;
break;
#endif
case L'n':
what=RLIMIT_NOFILE;
@@ -352,10 +399,12 @@ int builtin_ulimit( wchar_t ** argv )
case L't':
what=RLIMIT_CPU;
break;
#if HAVE_RLIMIT_NPROC
case L'u':
what=RLIMIT_NPROC;
break;
#endif
#if HAVE_RLIMIT_AS
case L'v':

848
common.c

File diff suppressed because it is too large Load Diff

162
common.h
View File

@@ -3,6 +3,9 @@
*/
#ifndef FISH_COMMON_H
/**
Header guard
*/
#define FISH_COMMON_H
#include <wchar.h>
@@ -11,7 +14,10 @@
#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.
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
@@ -21,7 +27,7 @@ typedef char tputs_arg_t;
#endif
/**
Maximum number of bytes in a utf-8 character
Maximum number of bytes used by a single utf-8 character
*/
#define MAX_UTF8_BYTES 6
@@ -36,11 +42,14 @@ typedef char tputs_arg_t;
*/
#define FISH_COLOR_RESET -2
/** Save the shell mode on startup so we can restore them on exit */
/**
Save the shell mode on startup so we can restore them on exit
*/
extern struct termios shell_modes;
/**
The character to use where the text has been truncated. Is an ellipsis on unicode system and a $ on other systems.
The character to use where the text has been truncated. Is an
ellipsis on unicode system and a $ on other systems.
*/
extern wchar_t ellipsis_char;
@@ -64,8 +73,10 @@ extern char *profile;
debug function.
*/
extern wchar_t *program_name;
/**
Take an array_list_t containing wide strings and converts them to a wchar_t **.
Take an array_list_t containing wide strings and converts them to a
single null-terminated wchar_t **.
*/
wchar_t **list_to_char_arr( array_list_t *l );
@@ -83,22 +94,26 @@ wchar_t **list_to_char_arr( array_list_t *l );
int fgetws2( wchar_t **buff, int *len, FILE *f );
/**
Sorts a list of wide strings according to the wcsfilecmp-function from the util library
Sorts a list of wide strings according to the wcsfilecmp-function
from the util library
*/
void sort_list( array_list_t *comp );
/**
Returns a newly allocated wide character string equivalent of the specified multibyte character string
Returns a newly allocated wide character string equivalent of the
specified multibyte character string
*/
wchar_t *str2wcs( const char *in );
/**
Returns a newly allocated multibyte character string equivalent of the specified wide character string
Returns a newly allocated multibyte character string equivalent of
the specified wide character string
*/
char *wcs2str( const wchar_t *in );
/**
Returns a newly allocated wide character string array equivalent of the specified multibyte character string array
Returns a newly allocated wide character string array equivalent of
the specified multibyte character string array
*/
char **wcsv2strv( const wchar_t **in );
@@ -108,61 +123,40 @@ char **wcsv2strv( const wchar_t **in );
wchar_t **strv2wcsv( const char **in );
/**
Returns a newly allocated concatenation of the specified wide character strings
Returns a newly allocated concatenation of the specified wide
character strings
*/
wchar_t *wcsdupcat( const wchar_t *a, const wchar_t *b );
/**
Returns a newly allocated concatenation of the specified wide character strings. The last argument must be a null pointer.
Returns a newly allocated concatenation of the specified wide
character strings. The last argument must be a null pointer.
*/
wchar_t *wcsdupcat2( const wchar_t *a, ... );
/**
Returns a newly allocated wide character string wich is a copy of the string in, but of length c or shorter. The returned string is always null terminated, and the null is not included in the string length.
*/
wchar_t *wcsndup( const wchar_t *in, int c );
/**
Converts from wide char to digit in the specified base. If d is not
a valid digit in the specified base, return -1.
*/
long convert_digit( wchar_t d, int base );
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 );
/**
Convert a wide character string to a number in the specified
base. This functions is the wide character string equivalent of
strtol. For bases of 10 or lower, 0..9 are used to represent
numbers. For bases below 36, a-z and A-Z are used to represent
numbers higher than 9. Higher bases than 36 are not supported.
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.
*/
long wcstol(const wchar_t *nptr,
wchar_t **endptr,
int base);
size_t
wcslcat(wchar_t *dst, const wchar_t *src, size_t siz);
size_t
wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz);
/**
Create a dublicate string. Wide string version of strdup.
*/
wchar_t *wcsdup(const wchar_t *in);
/**
Case insensitive string compare function. Wide string version of
strcasecmp.
This implementation of wcscasecmp does not take into account
esoteric locales where uppercase and lowercase do not cleanly
transform between each other. Hopefully this should be fine since
fish only uses this function with one of the strings supplied by
fish and guaranteed to be a sane, english word.
*/
int wcscasecmp( const wchar_t *a, const wchar_t *b );
int wcsncasecmp( const wchar_t *a, const wchar_t *b, int count );
size_t wcslcpy( wchar_t *dst, const wchar_t *src, size_t siz );
/**
Test if the given string is a valid variable name
@@ -170,13 +164,6 @@ int wcsncasecmp( const wchar_t *a, const wchar_t *b, int count );
int wcsvarname( wchar_t *str );
/**
The prototype for this function is missing in some libc
implementations. Fish has a fallback implementation in case the
implementation is missing altogether.
*/
int wcwidth( wchar_t c );
/**
A wcswidth workalike. Fish uses this since the regular wcswidth seems flaky.
@@ -184,7 +171,11 @@ int wcwidth( wchar_t c );
int my_wcswidth( const wchar_t *c );
/**
This functions returns the end of a quoted substring. It can handle nested single and double quotes.
This functions returns the end of the quoted substring beginning at
\c in. It can handle both single and double quotes. Returns 0 on
error.
\param in the position of the opening quote
*/
wchar_t *quote_end( const wchar_t *in );
@@ -199,9 +190,12 @@ wchar_t *quote_end( const wchar_t *in );
void error_reset();
/**
Set the locale, also change the ellipsis character
This function behaves exactly like a wide character equivalent of
the C function setlocale, except that it will also try to detect if
the user is using a Unicode character set, and if so, use the
unicode ellipsis character as ellipsis, instead of '$'.
*/
void fish_setlocale(int category, const wchar_t *locale);
const wchar_t *wsetlocale( int category, const wchar_t *locale );
/**
Checks if \c needle is included in the list of strings specified
@@ -223,6 +217,9 @@ int read_blocked(int fd, void *buf, size_t count);
*/
int writeb( tputs_arg_t b );
/**
Exit program at once, leaving an error message about running out of memory
*/
void die_mem();
/**
@@ -236,7 +233,7 @@ void common_destroy();
program_name, followed by a colon and a whitespace.
\param level the priority of the message. Lower number means higher priority. Messages with a priority_number higher than \c debug_level will be ignored..
\param the message format string.
\param msg the message format string.
Example:
@@ -244,7 +241,7 @@ void common_destroy();
will print the string 'fish: Pi = 3.141', given that debug_level is 1 or higher, and that program_name is 'fish'.
*/
void debug( int level, wchar_t *msg, ... );
void debug( int level, const wchar_t *msg, ... );
/**
Replace special characters with backslash escape sequences. Newline is
@@ -258,11 +255,39 @@ void debug( int level, wchar_t *msg, ... );
wchar_t *escape( const wchar_t *in,
int escape_all );
wchar_t *unescape( const wchar_t * in, int escape_special );
/**
Expand backslashed escapes and substitute them with their unescaped
counterparts. Also optionally change the wildcards, the tilde
character and a few more into constants which are defined in a
private use area of Unicode. This assumes wchar_t is a unicode
character set.
The result must be free()d. The original string is not modified. If
an invalid sequence is specified, 0 is returned.
*/
wchar_t *unescape( const wchar_t * in,
int escape_special );
/**
Block SIGCHLD. Calls to block/unblock may be nested, and only once the nest count reaches zero wiull the block be removed.
*/
void block();
/**
undo call to block().
*/
void unblock();
/**
Attempt to acquire a lock based on a lockfile, waiting LOCKPOLLINTERVAL
milliseconds between polls and timing out after timeout seconds,
thereafter forcibly attempting to obtain the lock if force is non-zero.
Returns 1 on success, 0 on failure.
To release the lock the lockfile must be unlinked.
A unique temporary file named by appending characters to the lockfile name
is used; any pre-existing file of the same name is subject to deletion.
*/
int acquire_lock_file( const char *lockfile, const int timeout, int force );
/**
@@ -282,12 +307,19 @@ int common_get_width();
*/
int common_get_height();
/*
/**
Handle a window change event by looking up the new window size and
saving it in an internal variable used by common_get_wisth and
common_get_height().
*/
void common_handle_winch( int signal );
/**
Write paragraph of output to screen. Ignore newlines in message and
perform internal line-breaking.
*/
void write_screen( const wchar_t *msg );
#endif

View File

@@ -35,6 +35,7 @@
#include "reader.h"
#include "history.h"
#include "intern.h"
#include "translate.h"
#include "wutil.h"
@@ -48,63 +49,67 @@
/**
Description for ~USER completion
*/
#define COMPLETE_USER_DESC COMPLETE_SEP_STR L"User home"
#define COMPLETE_USER_DESC _( L"User home" )
/**
Description for short variables. The value is concatenated to this description
*/
#define COMPLETE_VAR_DESC_VAL COMPLETE_SEP_STR L"Variable: "
#define COMPLETE_VAR_DESC_VAL _( L"Variable: " )
/**
Description for generic executable
*/
#define COMPLETE_EXEC_DESC COMPLETE_SEP_STR L"Executable"
#define COMPLETE_EXEC_DESC _( L"Executable" )
/**
Description for link to executable
*/
#define COMPLETE_EXEC_LINK_DESC COMPLETE_SEP_STR L"Executable link"
#define COMPLETE_EXEC_LINK_DESC _( L"Executable link" )
/**
Description for regular file
*/
#define COMPLETE_FILE_DESC COMPLETE_SEP_STR L"File"
#define COMPLETE_FILE_DESC _( L"File" )
/**
Description for character device
*/
#define COMPLETE_CHAR_DESC COMPLETE_SEP_STR L"Character device"
#define COMPLETE_CHAR_DESC _( L"Character device" )
/**
Description for block device
*/
#define COMPLETE_BLOCK_DESC COMPLETE_SEP_STR L"Block device"
#define COMPLETE_BLOCK_DESC _( L"Block device" )
/**
Description for fifo buffer
*/
#define COMPLETE_FIFO_DESC COMPLETE_SEP_STR L"Fifo"
#define COMPLETE_FIFO_DESC _( L"Fifo" )
/**
Description for symlink
*/
#define COMPLETE_SYMLINK_DESC COMPLETE_SEP_STR L"Symbolic link"
#define COMPLETE_SYMLINK_DESC _( L"Symbolic link" )
/**
Description for Rotten symlink
*/
#define COMPLETE_ROTTEN_SYMLINK_DESC COMPLETE_SEP_STR L"Rotten symbolic link"
#define COMPLETE_ROTTEN_SYMLINK_DESC _( L"Rotten symbolic link" )
/**
Description for symlink loop
*/
#define COMPLETE_LOOP_SYMLINK_DESC _( L"Symbolic link loop" )
/**
Description for socket
*/
#define COMPLETE_SOCKET_DESC COMPLETE_SEP_STR L"Socket"
#define COMPLETE_SOCKET_DESC _( L"Socket" )
/**
Description for directory
*/
#define COMPLETE_DIRECTORY_DESC COMPLETE_SEP_STR L"Directory"
#define COMPLETE_DIRECTORY_DESC _( L"Directory" )
/**
Description for function
*/
#define COMPLETE_FUNCTION_DESC COMPLETE_SEP_STR L"Function"
#define COMPLETE_FUNCTION_DESC _( L"Function" )
/**
Description for builtin command
*/
#define COMPLETE_BUILTIN_DESC COMPLETE_SEP_STR L"Builtin"
#define COMPLETE_BUILTIN_DESC _( L"Builtin" )
/**
The command to run to get a description from a file suffix
@@ -204,6 +209,12 @@ static hash_table_t *condition_cache=0;
*/
static hash_table_t *loaded_completions=0;
/**
String buffer used by complete_get_desc
*/
static string_buffer_t *get_desc_buff=0;
void complete_init()
{
}
@@ -309,7 +320,9 @@ static void clear_hash_entry( const void *key, const void *data )
free( (void *)data );
}
/**
Free hash value, but not hash key
*/
static void clear_hash_value( const void *key, const void *data )
{
free( (void *)data );
@@ -319,18 +332,21 @@ static void clear_hash_value( const void *key, const void *data )
void complete_destroy()
{
complete_entry *i=first_entry, *prev;
while( i )
{
prev = i;
i=i->next;
complete_free_entry( prev );
}
first_entry = 0;
if( suffix_hash )
{
hash_foreach( suffix_hash, &clear_hash_entry );
hash_destroy( suffix_hash );
free( suffix_hash );
suffix_hash=0;
}
if( loaded_completions )
@@ -339,8 +355,16 @@ void complete_destroy()
&clear_hash_value );
hash_destroy( loaded_completions );
free( loaded_completions );
loaded_completions = 0;
}
if( get_desc_buff )
{
sb_destroy( get_desc_buff );
free( get_desc_buff );
get_desc_buff = 0;
}
}
/**
@@ -374,8 +398,6 @@ void complete_add( const wchar_t *cmd,
complete_entry *c =
complete_find_exact_entry( cmd, cmd_type );
complete_entry_opt *opt;
wchar_t *tmp;
if( c == 0 )
{
@@ -416,15 +438,13 @@ void complete_add( const wchar_t *cmd,
opt->result_mode = result_mode;
opt->old_mode=old_mode;
opt->comp = intern(comp);
opt->condition = intern(condition);
opt->long_opt = intern( long_opt );
opt->comp = intern(comp?comp:L"");
opt->condition = intern(condition?condition:L"");
opt->long_opt = intern( long_opt?long_opt:L"" );
if( desc && wcslen( desc ) )
{
tmp = wcsdupcat( COMPLETE_SEP_STR, desc );
opt->desc = intern( tmp );
free( tmp );
opt->desc = intern( desc );
}
else
opt->desc = L"";
@@ -744,7 +764,7 @@ int complete_is_valid_option( const wchar_t *str,
str[0] = opt[j];
str[1]=0;
al_push( errors,
wcsdupcat2(L"Unknown option \'", str, L"\'", 0) );
wcsdupcat2(_( L"Unknown option: " ), L"'", str, L"'", 0) );
}
opt_found = 0;
@@ -763,12 +783,12 @@ int complete_is_valid_option( const wchar_t *str,
if( hash_get_count( &gnu_match_hash )==0)
{
al_push( errors,
wcsdupcat2(L"Unknown option \'", opt, L"\'", 0) );
wcsdupcat2( _(L"Unknown option: "), L"'", opt, L"\'", 0) );
}
else
{
al_push( errors,
wcsdupcat2(L"Multiple matches for option \'", opt, L"\'", 0) );
wcsdupcat2( _(L"Multiple matches for option: "), L"'", opt, L"\'", 0) );
}
}
}
@@ -845,13 +865,13 @@ static const wchar_t *complete_get_desc_suffix( const wchar_t *suff_orig )
wchar_t *ln = (wchar_t *)al_get(&l, 0 );
if( wcscmp( ln, L"unknown" ) != 0 )
{
desc = wcsdupcat( COMPLETE_SEP_STR, ln);
desc = wcsdup( ln);
/*
I have decided I prefer to have the description
begin in uppercase and the whole universe will just
have to accept it. Hah!
*/
desc[1]=towupper(desc[1]);
desc[0]=towupper(desc[0]);
}
}
@@ -878,87 +898,101 @@ static const wchar_t *complete_get_desc_suffix( const wchar_t *suff_orig )
const wchar_t *complete_get_desc( const wchar_t *filename )
{
struct stat buf;
const wchar_t *desc = COMPLETE_FILE_DESC;
if( !get_desc_buff )
{
get_desc_buff = malloc(sizeof(string_buffer_t) );
sb_init( get_desc_buff );
}
else
{
sb_clear( get_desc_buff );
}
if( lwstat( filename, &buf )==0)
{
if( waccess( filename, X_OK ) == 0 )
{
desc = COMPLETE_EXEC_DESC;
}
{
if( S_ISCHR(buf.st_mode) )
desc= COMPLETE_CHAR_DESC;
{
sb_printf( get_desc_buff, L"%lc%ls", COMPLETE_SEP, COMPLETE_CHAR_DESC );
}
else if( S_ISBLK(buf.st_mode) )
desc = COMPLETE_BLOCK_DESC;
sb_printf( get_desc_buff, L"%lc%ls", COMPLETE_SEP, COMPLETE_BLOCK_DESC );
else if( S_ISFIFO(buf.st_mode) )
desc = COMPLETE_FIFO_DESC;
sb_printf( get_desc_buff, L"%lc%ls", COMPLETE_SEP, COMPLETE_FIFO_DESC );
else if( S_ISLNK(buf.st_mode))
{
struct stat buf2;
desc = COMPLETE_SYMLINK_DESC;
if( waccess( filename, X_OK ) == 0 )
desc = COMPLETE_EXEC_LINK_DESC;
if( wstat( filename, &buf2 ) == 0 )
{
if( S_ISDIR(buf2.st_mode) )
{
desc = L"/" COMPLETE_SYMLINK_DESC;
sb_printf( get_desc_buff, L"/%lc%ls", COMPLETE_SEP, COMPLETE_SYMLINK_DESC );
}
else if( waccess( filename, X_OK ) == 0 )
sb_printf( get_desc_buff, L"%lc%ls", COMPLETE_SEP, COMPLETE_EXEC_LINK_DESC );
else
sb_printf( get_desc_buff, L"%lc%ls", COMPLETE_SEP, COMPLETE_SYMLINK_DESC );
}
else
{
switch( errno )
{
case ENOENT:
desc = COMPLETE_ROTTEN_SYMLINK_DESC;
sb_printf( get_desc_buff, L"%lc%ls", COMPLETE_SEP, COMPLETE_ROTTEN_SYMLINK_DESC );
break;
case EACCES:
break;
default:
wperror( L"stat" );
if( errno == ELOOP )
{
sb_printf( get_desc_buff, L"%lc%ls", COMPLETE_SEP, COMPLETE_LOOP_SYMLINK_DESC );
}
/*
Some kind of broken symlink. We ignore it
here, and it will get a 'file' description,
or one based on suffix.
*/
break;
}
}
}
else if( S_ISSOCK(buf.st_mode))
desc= COMPLETE_SOCKET_DESC;
sb_printf( get_desc_buff, L"%lc%ls", COMPLETE_SEP, COMPLETE_SOCKET_DESC );
else if( S_ISDIR(buf.st_mode) )
desc= L"/" COMPLETE_DIRECTORY_DESC;
sb_printf( get_desc_buff, L"/%lc%ls", COMPLETE_SEP, COMPLETE_DIRECTORY_DESC );
else if( waccess( filename, X_OK ) == 0 )
{
sb_printf( get_desc_buff, L"%lc%ls", COMPLETE_SEP, COMPLETE_EXEC_DESC );
}
}
/* else
{
switch( errno )
{
case EACCES:
break;
default:
fprintf( stderr, L"The following error happened on file %ls\n", filename );
wperror( L"lstat" );
break;
}
}
*/
if( desc == COMPLETE_FILE_DESC )
if( wcslen((wchar_t *)get_desc_buff->buff) == 0 )
{
wchar_t *suffix = wcsrchr( filename, L'.' );
if( suffix != 0 )
if( suffix != 0 && !wcsrchr( suffix, L'/' ) )
{
if( !wcsrchr( suffix, L'/' ) )
{
desc = complete_get_desc_suffix( suffix );
}
sb_printf( get_desc_buff,
L"%lc%ls",
COMPLETE_SEP,
complete_get_desc_suffix( suffix ) );
}
else
{
sb_printf( get_desc_buff,
L"%lc%ls",
COMPLETE_SEP,
COMPLETE_FILE_DESC );
}
}
return desc;
return (wchar_t *)get_desc_buff->buff;
}
/**
@@ -974,7 +1008,7 @@ const wchar_t *complete_get_desc( const wchar_t *filename )
\param comp_out the destination list
\param wc_escaped the prefix, possibly containing wildcards. The wildcard should not have been unescaped, i.e. '*' should be used for any string, not the ANY_STRING character.
\param desc the default description, used for completions with no embedded description
\param desc the default description, used for completions with no embedded description. The description _may_ contain a COMPLETE_SEP character, if not, one will be prefixed to it
\param desc_func the function that generates a description for those completions witout an embedded description
\param possible_comp the list of possible completions to iterate over
*/
@@ -1004,6 +1038,7 @@ static void copy_strings_with_prefix( array_list_t *comp_out,
wildcard_complete( next_str, wc, desc, desc_func, comp_out );
}
free( wc );
}
@@ -1026,8 +1061,11 @@ static void complete_cmd_desc( const wchar_t *cmd, array_list_t *comp )
if( !cmd )
return;
cmd_start=wcschr(cmd, L'/');
if( !cmd_start )
cmd_start=wcsrchr(cmd, L'/');
if( cmd_start )
cmd_start++;
else
cmd_start = cmd;
cmd_len = wcslen(cmd_start);
@@ -1047,131 +1085,127 @@ static void complete_cmd_desc( const wchar_t *cmd, array_list_t *comp )
esc = expand_escape( cmd_start, 1 );
if( esc )
if( whatis_path )
{
apropos_cmd =wcsdupcat2( L"grep ^/dev/null -F <", whatis_path, L" ", esc, 0 );
}
else
{
apropos_cmd = wcsdupcat( L"apropos ^/dev/null ", esc );
}
free(esc);
if( whatis_path )
al_init( &list );
hash_init( &lookup, &hash_wcs_func, &hash_wcs_cmp );
/*
First locate a list of possible descriptions using a single
call to apropos or a direct search if we know the location
of the whatis database. This can take some time on slower
systems with a large set of manuals, but it should be ok
since apropos is only called once.
*/
exec_subshell( apropos_cmd, &list );
/*
Then discard anything that is not a possible completion and put
the result into a hashtable with the completion as key and the
description as value.
Should be reasonably fast, since no memory allocations are needed.
*/
for( i=0; i<al_get_count( &list); i++ )
{
wchar_t *el = (wchar_t *)al_get( &list, i );
wchar_t *key, *key_end, *val_begin;
if( !el )
continue;
//fwprintf( stderr, L"%ls\n", el );
if( wcsncmp( el, cmd_start, cmd_len ) != 0 )
continue;
//fwprintf( stderr, L"%ls\n", el );
key = el + cmd_len;
key_end = wcschr( el, L' ' );
if( !key_end )
{
apropos_cmd =wcsdupcat2( L"grep ^/dev/null -F <", whatis_path, L" ", esc, 0 );
key_end = wcschr( el, L'\t' );
if( !key_end )
{
continue;
}
}
*key_end = 0;
val_begin=key_end+1;
//fwprintf( stderr, L"Key %ls\n", el );
while( *val_begin != L'-' && *val_begin)
{
val_begin++;
}
if( !*val_begin )
{
continue;
}
val_begin++;
while( *val_begin == L' ' || *val_begin == L'\t' )
{
val_begin++;
}
if( !*val_begin )
{
continue;
}
/*
And once again I make sure the first character is uppercased
because I like it that way, and I get to decide these
things.
*/
val_begin[0]=towupper(val_begin[0]);
hash_put( &lookup, key, val_begin );
}
/*
Then do a lookup on every completion and if a match is found,
change to the new description.
This needs to do a reallocation for every description added, but
there shouldn't be that many completions, so it should be ok.
*/
for( i=0; i<al_get_count(comp); i++ )
{
wchar_t *el = (wchar_t *)al_get( comp, i );
wchar_t *cmd_end = wcschr( el,
COMPLETE_SEP );
wchar_t *new_desc;
if( cmd_end )
*cmd_end = 0;
new_desc = (wchar_t *)hash_get( &lookup,
el );
if( new_desc )
{
wchar_t *new_el = wcsdupcat2( el,
COMPLETE_SEP_STR,
new_desc,
0 );
al_set( comp, i, new_el );
free( el );
}
else
{
apropos_cmd = wcsdupcat( L"apropos ^/dev/null ", esc );
}
free(esc);
al_init( &list );
hash_init( &lookup, &hash_wcs_func, &hash_wcs_cmp );
/*
First locate a list of possible descriptions using a single
call to apropos or a direct search if we know the location
of the whatis database. This can take some time on slower
systems with a large set of manuals, but it should be ok
since apropos is only called once.
*/
exec_subshell( apropos_cmd, &list );
/*
Then discard anything that is not a possible completion and put
the result into a hashtable with the completion as key and the
description as value.
Should be reasonably fast, since no memory allocations are needed.
*/
for( i=0; i<al_get_count( &list); i++ )
{
wchar_t *el = (wchar_t *)al_get( &list, i );
wchar_t *key, *key_end, *val_begin;
if( !el )
continue;
//fwprintf( stderr, L"%ls\n", el );
if( wcsncmp( el, cmd_start, cmd_len ) != 0 )
continue;
//fwprintf( stderr, L"%ls\n", el );
key = el + cmd_len;
key_end = wcschr( el, L' ' );
if( !key_end )
{
key_end = wcschr( el, L'\t' );
if( !key_end )
{
continue;
}
}
*key_end = 0;
val_begin=key_end+1;
//fwprintf( stderr, L"Key %ls\n", el );
while( *val_begin != L'-' && *val_begin)
{
val_begin++;
}
if( !val_begin )
{
continue;
}
val_begin++;
while( *val_begin == L' ' || *val_begin == L'\t' )
{
val_begin++;
}
if( !*val_begin )
{
continue;
}
/*
And once again I make sure the first character is uppercased
because I like it that way, and I get to decide these
things.
*/
val_begin[0]=towupper(val_begin[0]);
hash_put( &lookup, key, val_begin );
}
/*
Then do a lookup on every completion and if a match is found,
change to the new description.
This needs to do a reallocation for every description added, but
there shouldn't be that many completions, so it should be ok.
*/
for( i=0; i<al_get_count(comp); i++ )
{
wchar_t *el = (wchar_t *)al_get( comp, i );
wchar_t *cmd_end = wcschr( el,
COMPLETE_SEP );
wchar_t *new_desc;
if( cmd_end )
*cmd_end = 0;
new_desc = (wchar_t *)hash_get( &lookup,
el );
if( new_desc )
{
wchar_t *new_el = wcsdupcat2( el,
COMPLETE_SEP_STR,
new_desc,
0 );
al_set( comp, i, new_el );
free( el );
}
else
{
if( cmd_end )
*cmd_end = COMPLETE_SEP;
}
*cmd_end = COMPLETE_SEP;
}
}
@@ -1182,6 +1216,17 @@ static void complete_cmd_desc( const wchar_t *cmd, array_list_t *comp )
free( apropos_cmd );
}
static const wchar_t *complete_function_desc( const wchar_t *fn )
{
const wchar_t *res = function_get_desc( fn );
if( !res )
res = function_get_definition( fn );
return res;
}
/**
Complete the specified command name. Search for executables in the
path, executables defined using an absolute path, functions,
@@ -1189,7 +1234,7 @@ static void complete_cmd_desc( const wchar_t *cmd, array_list_t *comp )
\param cmd the command string to find completions for
B\param comp the list to add all completions to
\param comp the list to add all completions to
*/
static void complete_cmd( const wchar_t *cmd,
array_list_t *comp )
@@ -1211,10 +1256,12 @@ static void complete_cmd( const wchar_t *cmd,
array_list_t tmp;
al_init( &tmp );
expand_string( wcsdup(cmd),
comp,
ACCEPT_INCOMPLETE | EXECUTABLES_ONLY );
complete_cmd_desc( cmd, comp );
if( expand_string( wcsdup(cmd),
comp,
ACCEPT_INCOMPLETE | EXECUTABLES_ONLY ) != EXPAND_ERROR )
{
complete_cmd_desc( cmd, comp );
}
al_destroy( &tmp );
}
else
@@ -1235,14 +1282,15 @@ static void complete_cmd( const wchar_t *cmd,
al_init( &tmp );
expand_string( nxt_completion,
if( expand_string( nxt_completion,
&tmp,
ACCEPT_INCOMPLETE |
EXECUTABLES_ONLY );
for( i=0; i<al_get_count(&tmp); i++ )
EXECUTABLES_ONLY ) != EXPAND_ERROR )
{
al_push( comp, al_get( &tmp, i ) );
for( i=0; i<al_get_count(&tmp); i++ )
{
al_push( comp, al_get( &tmp, i ) );
}
}
al_destroy( &tmp );
@@ -1258,7 +1306,7 @@ static void complete_cmd( const wchar_t *cmd,
al_init( &possible_comp );
function_get_names( &possible_comp, cmd[0] == L'_' );
copy_strings_with_prefix( comp, cmd, COMPLETE_FUNCTION_DESC, &function_get_desc, &possible_comp );
copy_strings_with_prefix( comp, cmd, COMPLETE_FUNCTION_DESC, &complete_function_desc, &possible_comp );
al_truncate( &possible_comp, 0 );
builtin_get_names( &possible_comp );
@@ -1288,24 +1336,29 @@ static void complete_cmd( const wchar_t *cmd,
al_init( &tmp );
expand_string( nxt_completion,
if( expand_string( nxt_completion,
&tmp,
ACCEPT_INCOMPLETE | DIRECTORIES_ONLY );
for( i=0; i<al_get_count(&tmp); i++ )
ACCEPT_INCOMPLETE | DIRECTORIES_ONLY ) != EXPAND_ERROR )
{
wchar_t *nxt = (wchar_t *)al_get( &tmp, i );
wchar_t *desc = wcsrchr( nxt, COMPLETE_SEP );
int is_valid = (desc && (wcscmp(desc,
COMPLETE_DIRECTORY_DESC)==0));
if( is_valid )
for( i=0; i<al_get_count(&tmp); i++ )
{
al_push( comp, nxt );
}
else
{
free(nxt);
wchar_t *nxt = (wchar_t *)al_get( &tmp, i );
wchar_t *desc = wcsrchr( nxt, COMPLETE_SEP );
if( desc )
{
int is_valid = desc && (wcscmp(desc+1,
COMPLETE_DIRECTORY_DESC)==0);
if( is_valid )
{
al_push( comp, nxt );
}
else
{
free(nxt);
}
}
}
}
@@ -1318,10 +1371,10 @@ static void complete_cmd( const wchar_t *cmd,
/**
Evaluate the argument list (as supplied by complete -a) and insert
any return matching completions. Matching is done using\c
any return matching completions. Matching is done using \c
copy_strings_with_prefix, meaning the completion may contain
wildcards. Logically, this is not always the right thing to do, but
I have yet to come up with a case where one would not want this.
I have yet to come up with a case where this matters.
\param str The string to complete.
\param args The list of option arguments to be evaluated.
@@ -1333,12 +1386,24 @@ static void complete_from_args( const wchar_t *str,
const wchar_t *desc,
array_list_t *comp_out )
{
int was_interactive = is_interactive;
array_list_t possible_comp;
int i;
al_init( &possible_comp );
is_interactive=0;
eval_args( args, &possible_comp );
debug( 3, L"desc is '%ls', %d long\n", desc, wcslen(desc) );
is_interactive=was_interactive;
/* We need to unescape these strings before matching them */
for( i=0; i< al_get_count( &possible_comp ); i++ )
{
wchar_t *next = (wchar_t *)al_get( &possible_comp, i );
al_set( &possible_comp , i, unescape( next, 0 ) );
free( next );
}
copy_strings_with_prefix( comp_out, str, desc, 0, &possible_comp );
@@ -1482,7 +1547,6 @@ void complete_load( wchar_t *cmd,
expand_variable_array( path_var, &path_list );
/*
Iterate over path searching for suitable completion files
*/
@@ -1500,13 +1564,6 @@ void complete_load( wchar_t *cmd,
wchar_t *esc = expand_escape( (wchar_t *)path.buff, 1 );
wchar_t *src_cmd = wcsdupcat( L". ", esc );
/* if( tm )
debug( 0, L"Reload %ls completions, old time was %d, new time is %d",
cmd,
tm?*tm:-1,
buf.st_mtime);
*/
if( !tm )
{
tm = malloc(sizeof(time_t));
@@ -1519,7 +1576,6 @@ void complete_load( wchar_t *cmd,
intern( cmd ),
tm );
free( esc );
complete_remove( cmd, COMMAND, 0, 0 );
@@ -1542,8 +1598,6 @@ void complete_load( wchar_t *cmd,
*/
if( !tm )
{
// debug( 0, L"Insert null timestamp for command %ls", cmd );
tm = malloc(sizeof(time_t));
if( !tm )
die_mem();
@@ -1596,7 +1650,7 @@ static int complete_param( wchar_t *cmd_orig,
if( str[0] == L'-' )
{
/* Check if we are entering a combined option and argument
* (like --color=auto or -I/usr/include) */
(like --color=auto or -I/usr/include) */
for( o = i->first_option; o; o=o->next )
{
wchar_t *arg;
@@ -1614,7 +1668,7 @@ static int complete_param( wchar_t *cmd_orig,
else if( popt[0] == L'-' )
{
/* Check if the previous option has any specified
* arguments to match against */
arguments to match against */
int found_old = 0;
/*
@@ -1693,12 +1747,13 @@ static int complete_param( wchar_t *cmd_orig,
short_ok( str, o->short_opt, i->short_opt_str ) )
{
wchar_t *next_opt =
malloc( sizeof(wchar_t)*(2 + wcslen(o->desc)));
malloc( sizeof(wchar_t)*(3 + wcslen(o->desc)));
if( !next_opt )
die_mem();
next_opt[0]=o->short_opt;
next_opt[1]=L'\0';
next_opt[1]=COMPLETE_SEP;
next_opt[2]=L'\0';
wcscat( next_opt, o->desc );
al_push( comp_out, next_opt );
}
@@ -1725,14 +1780,14 @@ static int complete_param( wchar_t *cmd_orig,
if( o->old_mode || !(o->result_mode & NO_COMMON ) )
{
al_push( comp_out,
wcsdupcat(&((wchar_t *)whole_opt.buff)[wcslen(str)], o->desc) );
wcsdupcat2(&((wchar_t *)whole_opt.buff)[wcslen(str)], COMPLETE_SEP_STR, o->desc, (void *)0) );
// fwprintf( stderr, L"Add without param %ls\n", o->long_opt );
}
if( !o->old_mode && ( wcslen(o->comp) || (o->result_mode & NO_COMMON ) ) )
{
al_push( comp_out,
wcsdupcat2(&((wchar_t *)whole_opt.buff)[wcslen(str)], L"=", o->desc, 0) );
wcsdupcat2(&((wchar_t *)whole_opt.buff)[wcslen(str)], L"=", COMPLETE_SEP_STR, o->desc, (void *)0) );
// fwprintf( stderr, L"Add with param %ls\n", o->long_opt );
}
@@ -1763,10 +1818,13 @@ static void complete_param_expand( wchar_t *str,
}
else
comp_str = str;
// fwprintf( stderr, L"expand_string( \"%ls\", [list], ACCEPT_INCOMPLETE | %ls )\n", comp_str, do_file?L"0":L"EXPAND_SKIP_WILDCARDS" );
expand_string( wcsdup(comp_str), comp_out, ACCEPT_INCOMPLETE | (do_file?0:EXPAND_SKIP_WILDCARDS) );
debug( 2,
L"expand_string( \"%ls\", comp_out, EXPAND_SKIP_SUBSHELL | ACCEPT_INCOMPLETE | %ls );",
comp_str,
do_file?L"0":L"EXPAND_SKIP_WILDCARDS" );
expand_string( wcsdup(comp_str), comp_out, EXPAND_SKIP_SUBSHELL | ACCEPT_INCOMPLETE | (do_file?0:EXPAND_SKIP_WILDCARDS) );
}
/**
@@ -1799,7 +1857,7 @@ static int complete_variable( const wchar_t *var,
/*
Variable description is 'Variable: VALUE
*/
blarg = wcsdupcat2( &name[varlen], COMPLETE_VAR_DESC_VAL, value, 0 );
blarg = wcsdupcat2( &name[varlen], COMPLETE_SEP_STR, COMPLETE_VAR_DESC_VAL, value, 0 );
if( blarg )
{
@@ -1926,6 +1984,7 @@ static int try_complete_user( const wchar_t *cmd,
{
wchar_t *blarg = wcsdupcat2( &pw_name[name_len],
L"/",
COMPLETE_SEP_STR,
COMPLETE_USER_DESC,
0 );
if( blarg != 0 )
@@ -1961,7 +2020,7 @@ void complete( const wchar_t *cmd,
error_max=0;
/**
If we are completing a variable name or a tilde expantion user
If we are completing a variable name or a tilde expansion user
name, we do that and return. No need for any other competions.
*/
@@ -2007,7 +2066,7 @@ void complete( const wchar_t *cmd,
tok_init( &tok, buff, TOK_ACCEPT_UNFINISHED );
while( !end_loop )
while( tok_has_next( &tok) && !end_loop )
{
switch( tok_last_type( &tok ) )
{
@@ -2053,7 +2112,8 @@ void complete( const wchar_t *cmd,
reader_current_token_extent( &begin, &end, &prev_begin, &prev_end );
current_token = wcsndup( begin, reader_get_cursor_pos()-(begin-reader_get_buffer()) );
prev_token = wcsndup( prev_begin, prev_end - prev_begin );
prev_token = prev_begin ? wcsndup( prev_begin, prev_end - prev_begin ): wcsdup(L"");
// fwprintf( stderr, L"on_command: %d, %ls %ls\n", on_command, current_compmand, current_token );
@@ -2094,6 +2154,11 @@ void complete( const wchar_t *cmd,
}
/**
Print the GNU longopt style switch \c opt, and the argument \c
argument to the specified stringbuffer, but only if arguemnt is
non-null and longer than 0 characters.
*/
static void append_switch( string_buffer_t *out,
const wchar_t *opt,
const wchar_t *argument )

View File

@@ -5,6 +5,9 @@
*/
#ifndef FISH_COMPLETE_H
/**
Header guard
*/
#define FISH_COMPLETE_H
#include <wchar.h>

View File

@@ -1,97 +0,0 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* CPU type */
#undef CPU
/* Documentation directory */
#undef DOCDIR
/* Define to 1 if you have the `futimes' function. */
#undef HAVE_FUTIMES
/* Define to 1 if you have the <getopt.h> header file. */
#undef HAVE_GETOPT_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `rt' library (-lrt). */
#undef HAVE_LIBRT
/* Define to 1 if you have the `socket' library (-lsocket). */
#undef HAVE_LIBSOCKET
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <ncurses.h> header file. */
#undef HAVE_NCURSES_H
/* Define to 1 if HAVE_RLIMIT_AS is defined in <sys/resource.h>. */
#undef HAVE_RLIMIT_AS
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/resource.h> header file. */
#undef HAVE_SYS_RESOURCE_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <termio.h> header file. */
#undef HAVE_TERMIO_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the `wcswidth' function. */
#undef HAVE_WCSWIDTH
/* Define to 1 if you have the `wcwidth' function. */
#undef HAVE_WCWIDTH
/* Define to 1 if you have the `wprintf' function. */
#undef HAVE_WPRINTF
/* Define to 1 if you have the file `AC_File'. */
#undef HAVE__PROC_SELF_STAT
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Installation directory */
#undef PREFIX
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* System configuration directory */
#undef SYSCONFDIR
/* Evil kludge to get Power based machines to work */
#undef TPUTS_KLUDGE

View File

@@ -1,22 +1,39 @@
# Process this file with autoconf to produce a configure script.
AC_INIT(fish,1.16.0,axel@liljencrantz.se)
AC_INIT(fish,1.20.0,fish-users@lists.sf.net)
AC_CANONICAL_TARGET
if test $target_cpu = powerpc; then
AC_DEFINE([TPUTS_KLUDGE],[1],[Evil kludge to get Power based machines to work])
# If needed, run autoheader automatically
if test ! -f ./config.h.in -o config.h.in -ot configure.ac; then
if which autoheader >/dev/null; then
echo running autoheader...
autoheader
else
echo Could not find the autoheader program in your path.
echo This program is needed because the configure.ac file has been modified.
echo Please install it and try again.
exit 1
fi
fi
AC_DEFINE_UNQUOTED([CPU],[L"$target_cpu"],[CPU type])
# Tell autoconf to create config.h header
AC_CONFIG_HEADERS(config.h)
# Checks for programs.
# Set up various programs needed for install
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
#AC_ISC_POSIX
#AC_PROG_MAKE_SET
# Check for doxygen, which is needed to build
AC_CHECK_PROG( has_doxygen, [doxygen], "true")
if ! test $has_doxygen = "true"; then
echo Could not find the Doxygen program in your path.
echo This program is needed to build fish.
echo Please install it and try again.
exit 1
fi
# Check for seq program. If missing, install fallback shellscript implementation
AC_CHECK_PROG( SEQ_FALLBACK, seq, [ ], [seq])
# Optionally drop xsel
AC_ARG_WITH( xsel,
@@ -35,21 +52,26 @@ else
AC_SUBST( XSEL_MAN_PATH,[ ])
fi
# Test cpu for special handling of ppc
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 installation directories
if [[ "$prefix" = NONE ]]; then
AC_DEFINE_UNQUOTED( [PREFIX], L"/usr/local", [Installation directory])
AC_DEFINE_UNQUOTED( [PREFIX], L"/usr/local", [Installation directory])
AC_SUBST( PREFIX, /usr/local)
AC_SUBST(sysconfdir,[/etc])
export prefix=/usr/local
else
AC_DEFINE_UNQUOTED( [PREFIX], L"$prefix", [Installation directory])
AC_SUBST( PREFIX, [$prefix])
AC_SUBST(sysconfdir,[/etc])
fi
if echo $prefix | grep \^$HOME >/dev/null; then
AC_SUBST(sysconfdir,[$HOME/etc])
AC_MSG_NOTICE(["Install in $HOME"])
fi
AC_SUBST(fishdir,[/fish.d])
AC_SUBST(fishfile,[/fish])
AC_SUBST(fishinputfile,[/fish_inputrc])
@@ -61,7 +83,12 @@ if test -z $docdir; then
fi
AC_DEFINE_UNQUOTED( DOCDIR, [L"$(eval echo $docdir)"], [Documentation directory] )
AC_DEFINE_UNQUOTED( SYSCONFDIR, [L"$sysconfdir"], [System configuration directory] )
AC_DEFINE_UNQUOTED( SYSCONFDIR, [L"$(eval echo $sysconfdir)"], [System configuration directory] )
AC_SUBST( SYSCONFDIR, ["$(eval echo $sysconfdir)"] )
# Set up locale directory
AC_DEFINE_UNQUOTED( [LOCALEDIR], "$(eval echo $datadir)/locale", [Locale directory])
AC_SUBST( [LOCALEDIR], [$datadir/locale])
# See if Linux procfs is present
AC_CHECK_FILES([/proc/self/stat])
@@ -70,9 +97,6 @@ AC_CHECK_FILES([/proc/self/stat])
AC_CHECK_FILE([/usr/pkg/lib],[AC_SUBST(LIBDIR,[-L/usr/pkg/lib\ -R/usr/pkg/lib])])
AC_CHECK_FILE([/usr/pkg/include],[AC_SUBST(INCLUDEDIR,[-I/usr/pkg/include])])
AC_CHECK_FUNCS( [wprintf futimes wcwidth wcswidth] )
AC_CHECK_HEADERS([getopt.h termio.h sys/resource.h])
# Check for RLIMIT_AS in sys/resource.h.
AC_MSG_CHECKING([for RLIMIT_AS in sys/resource.h])
AC_TRY_COMPILE([#include <sys/resource.h>],
@@ -85,16 +109,90 @@ else
AC_MSG_RESULT(no)
fi
# Check for RLIMIT_MEMLOCK in sys/resource.h.
AC_MSG_CHECKING([for RLIMIT_MEMLOCK in sys/resource.h])
AC_TRY_COMPILE([#include <sys/resource.h>],
[int tmp; tmp=RLIMIT_MEMLOCK;], have_rlimit_as=yes, have_rlimit_as=no)
if test "$have_rlimit_as" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_RLIMIT_MEMLOCK], [1],
[Define to 1 if HAVE_RLIMIT_MEMLOCK is defined in <sys/resource.h>.])
else
AC_MSG_RESULT(no)
fi
# Check for RLIMIT_RSS in sys/resource.h.
AC_MSG_CHECKING([for RLIMIT_RSS in sys/resource.h])
AC_TRY_COMPILE([#include <sys/resource.h>],
[int tmp; tmp=RLIMIT_RSS;], have_rlimit_as=yes, have_rlimit_as=no)
if test "$have_rlimit_as" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_RLIMIT_RSS], [1],
[Define to 1 if HAVE_RLIMIT_RSS is defined in <sys/resource.h>.])
else
AC_MSG_RESULT(no)
fi
# Check for RLIMIT_NPROC in sys/resource.h.
AC_MSG_CHECKING([for RLIMIT_NPROC in sys/resource.h])
AC_TRY_COMPILE([#include <sys/resource.h>],
[int tmp; tmp=RLIMIT_NPROC;], have_rlimit_as=yes, have_rlimit_as=no)
if test "$have_rlimit_as" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_RLIMIT_NPROC], [1],
[Define to 1 if HAVE_RLIMIT_NPROC is defined in <sys/resource.h>.])
else
AC_MSG_RESULT(no)
fi
# Check for libraries
AC_CHECK_LIB(socket, connect)
AC_CHECK_LIB(rt, nanosleep)
AC_CHECK_LIB(intl, gettext)
# Check for various header files
AC_CHECK_HEADERS([getopt.h termio.h sys/resource.h term.h ncurses/term.h libintl.h])
AC_CHECK_HEADER([regex.h],
[AC_DEFINE([HAVE_REGEX_H], [1], [Define to 1 if you have the <regex.h> header file.])],
[AC_MSG_ERROR([Could not find the header regex.h, needed to build fish])])
# Check for various functions, and insert results into config.h
AC_CHECK_FUNCS( wcsdup wcsndup wcslen wcscasecmp wcsncasecmp gettext fwprintf )
AC_CHECK_FUNCS( futimes wcwidth wcswidth getopt_long wcstok fputwc fgetwc )
AC_CHECK_FUNCS( wcstol dcgettext )
# Check again for gettext library, and insert results into the Makefile
AC_CHECK_FUNC(gettext, AC_SUBST(HAVE_GETTEXT,1), AC_SUBST(HAVE_GETTEXT,0) )
# Check for _nl_msg_cat_cntr symbol
AC_MSG_CHECKING([for _nl_msg_cat_cntr symbol])
AC_TRY_LINK([#if HAVE_LIBINTL_H]
[#include <libintl.h>]
[#endif],
[extern int _nl_msg_cat_cntr;]
[int tmp = _nl_msg_cat_cntr;], have__nl_msg_cat_cntr=yes, have__nl_msg_cat_cntr=no)
if test "$have__nl_msg_cat_cntr" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE__NL_MSG_CAT_CNTR], [1],
[Define to 1 if the _nl_msg_cat_cntr symbol is exported.])
else
AC_MSG_RESULT(no)
fi
# Check if we have ncurses, and use it rather than curses if possible.
AC_CHECK_HEADERS([ncurses.h],[AC_SUBST(CURSESLIB,[ncurses]) AC_DEFINE(HAVE_NCURSES_H)],[AC_SUBST(CURSESLIB,[curses])])
#Force use of ncurses if it is avialable via NetBSD pkgsrc. This is an
#ugly kludge to force NetBSD to use ncurses, since NetBSDs own version
#does not properly support terminfo.
# Force use of ncurses if it is avialable via NetBSD pkgsrc. This is an
# ugly kludge to force NetBSD to use ncurses, since NetBSDs own version
# does not properly support terminfo.
AC_CHECK_FILE([/usr/pkg/include/ncurses.h],[AC_SUBST(CURSESLIB,[ncurses]) AC_DEFINE(HAVE_NCURSES_H)])
AC_CONFIG_FILES([Makefile fish.spec doc_src/fish.1 doc_src/Doxyfile init/fish])
AC_CONFIG_FILES([Makefile fish.spec doc_src/fish.1 doc_src/Doxyfile init/fish init/fish_interactive.fish init/fish_complete.fish seq])
AC_OUTPUT
echo "Now run 'make' and 'make install' to built and install fish."
echo "Good luck!"

View File

@@ -2,22 +2,16 @@
\section and and - Conditionally execute a command
\subsection and-synopsis Synopsis
<tt>and COMMAND1; COMMAND2</tt>
<tt>COMMAND1; and COMMAND2</tt>
\subsection and-description Description
The \c and builtin is used to execute one command, and if it returns
zero status, also execute a second command.
The \c and builtin is used to execute a command if the current exit status (as set by the last previous command) is zero
\subsection and-example Example
The following code runs the \c make command to build a program, and if it suceeds, it runs <tt>make install</tt>, which installs the program.
The following code runs the \c make command to build a program, and if it succeeds, it runs <tt>make install</tt>, which installs the program.
<pre>
and make; make install
make; and make install
</pre>
\c or and \c and can be nested, as in this example, that attempts to build and install a program, and removed the files created by the build process on failiure
<pre>
or and make; make install; make clean
</pre>

View File

@@ -7,10 +7,10 @@
\subsection begin-description Description
The \c begin builtin is used to create a new block of code. The block
is unconditionally erxecuted. Begin is equivalent to <tt>if
is unconditionally executed. Begin is equivalent to <tt>if
true</tt>. The begin command is used to group any number of commands
into a block. The reason for this is usually either to introduce a new
variable scope or to redirect the input ot output of this set of
variable scope or to redirect the input to output of this set of
commands as a group.
\subsection begin-example Example

19
doc_src/block.txt Normal file
View File

@@ -0,0 +1,19 @@
\section block block - Temporarily block delivery of events
\subsection block-synopsis Synopsis
<tt>block [OPTIONS...]</tt>
\subsection block-description Description
- <tt>-l</tt> or <tt>--local</tt> Release the block at the end of the currently innermost block scope
- <tt>-g</tt> or <tt>--global</tt> Never automatically release the lock
- <tt>-e</tt> or <tt>--erase</tt> Release global block
\subsection block-example Example
<pre>block -g
\#Do something that should not be interrupted
block -e
</pre>

View File

@@ -8,7 +8,7 @@
The \c break builtin is used to halt a currently running loop, such as a <a href="#for">for</a> loop or a <a href="#while">while</a> loop. It is usually added inside of a conditional block such as an <a href="#if">if</a> statement or a <a href="#switch">switch</a> statement.
\subsection break-example Example
The following code searches all .c files for smurfs, and halts at the first occurance.
The following code searches all .c files for smurfs, and halts at the first occurrence.
<p>
<tt>for i in *.c;
<br>&nbsp;&nbsp;&nbsp;&nbsp;if grep smurf $i;

View File

@@ -23,7 +23,7 @@ switch $animal
echo evil
case wolf dog human moose dolphin whale
echo mammal
case duck goose albatros
case duck goose albatross
echo bird
case shark trout stingray
echo fish

View File

@@ -25,14 +25,14 @@ or updated
- \c -b or \c --current-buffer select the entire buffer (default)
- \c -j or \c --current-job select the current job
- \c -p or \c --current-process select the current process
- \c -t or \c --current_token select the current token.
- \c -t or \c --current_token select the current token.
The following switch changes the way \c commandline prints the current
commandline
- \c -c or \c --cut-at-cursor only print selection up until the
current cursor position
- \c o or \c --tokenize tokenize the selection and print one string-type token per line
- \c -o or \c --tokenize tokenize the selection and print one string-type token per line
Other switches

View File

@@ -1,9 +1,14 @@
\section complete complete - edit command specific tab-completions.
\section complete complete - edit command specific tab-completions.
\subsection complete-synopsis Synopsis
<tt>complete (-c|--command|-p|--path) COMMAND [(-s|--short-option) SHORT_OPTION] [(-l|--long-option|-o|--old-option) LONG_OPTION [(-a||--arguments) OPTION_ARGUMENTS] [(-d|--description) DESCRIPTION] </tt>
\subsection complete-description Description
For an introduction to how to specify completions, see the section <a
href='index.html#completions-own'>Writing your own completions</a> of
the fish manual.
- <tt>COMMAND</tt> is the name of the command for which to add a completion
- <tt>SHORT_OPTION</tt> is a one character option for the command
- <tt>LONG_OPTION</tt> is a multi character option for the command
@@ -11,8 +16,8 @@
- <tt>DESCRIPTION</tt> is a description of what the option and/or option arguments do
- <tt>-e</tt> or <tt>--erase</tt> implies that the specified completion should be deleted
- <tt>-f</tt> or <tt>--no-files</tt> specifies that the option specified by this completion may not be followed by a filename
- <tt>-n</tt> or <tt>--condition</tt> specides a shell command that must return 0 if the completion is to be used. This makes it possible to specify completions that should only be used in some cases.
- <tt>-o</tt> or <tt>--old-option</tt> implies that the command uses old long style options with only one dash
- <tt>-n</tt> or <tt>--condition</tt> specifies a shell command that must return 0 if the completion is to be used. This makes it possible to specify completions that should only be used in some cases.
- <tt>-o</tt> or <tt>--old-option</tt> implies that the command uses old long style options with only one dash
- <tt>-p</tt> or <tt>--path</tt> implies that the string COMMAND is the full path of the command
- <tt>-r</tt> or <tt>--require-parameter</tt> specifies that the option specified by this completion always must have an option argument, i.e. may not be followed by another option
- <tt>-u</tt> or <tt>--unauthorative</tt> implies that there may be more options than the ones specified, and that fish should not assume that options not listed are spelling errors
@@ -25,13 +30,14 @@ that do not begin with a hyphen. Fish recognizes three styles of
options, the same styles as the GNU version of the getopt
library. These styles are:
- Short options, like '-a'. Short options are a single character long, are preceeded by a single hyphen and may ge grouped together (like '-la', which is equivalent to '-l -a'). Option arguments may be specified in the following parameter ('-w 32') or by appending the option with the value ('-w32').
- Old style long options, like '-Wall'. Old style long options are more than one character long, are preceeded by a single hyphen and may not be grouped together. Option arguments are specified in the following parameter ('-ao null').
- GNU style long options, like '--colors'. GNU style long options are more than one character long, are preceeded by two hyphens, and may not be grouped together. Option arguments may be specified in the following parameter ('--quoting-style shell') or by appending the option with a '=' and the value ('--quoting-style=shell'). GNU style long options may be abbrevated so long as the abbrevation is unique ('--h' is equivalent to '--help' if help is the only long option beginning with an 'h').
- Short options, like '-a'. Short options are a single character long, are preceded by a single hyphen and may be grouped together (like '-la', which is equivalent to '-l -a'). Option arguments may be specified in the following parameter ('-w 32') or by appending the option with the value ('-w32').
- Old style long options, like '-Wall'. Old style long options are more than one character long, are preceded by a single hyphen and may not be grouped together. Option arguments are specified in the following parameter ('-ao null').
- GNU style long options, like '--colors'. GNU style long options are more than one character long, are preceded by two hyphens, and may not be grouped together. Option arguments may be specified in the following parameter ('--quoting-style shell') or by appending the option with a '=' and the value ('--quoting-style=shell'). GNU style long options may be abbreviated so long as the abbreviation is unique ('--h' is equivalent to '--help' if help is the only long option beginning with an 'h').
\c complete only allows one of old style long options and GNU style
long options to be used on a specific command, but short options can
always be specified.
The options for specifying command name, command path, or command
switches may all be used multiple times to specify multiple commands
which have the same completion or multiple switches accepted by a
command.
When erasing completions, it is possible to either erase all
completions for a specific command by specifying <tt>complete -e -c
@@ -61,7 +67,9 @@ are valid, like the \c nodeps switch.
This can be written as:
<tt>complete -c rpm -n "__fish_contains_opt -s e erase" -l nodeps -d 'Dont check dependencies'</tt>
<tt>complete -c rpm -n "__fish_contains_opt -s e erase" -l nodeps -d
"Don't check dependencies"</tt>
where \c __fish_contains_opt is a function that checks the commandline buffer for the presense of a specified set of options.
where \c __fish_contains_opt is a function that checks the commandline
buffer for the presence of a specified set of options.

View File

@@ -16,7 +16,7 @@ the user does not have to worry about an array containing elements
such as dashes. \c fish performs a special check when invoking the
count program, and if the user uses a help option, this help page is
displayed, but if a help option is contained inside of a variable or
is the result of expantion, it will be passed on to the count program.
is the result of expansion, it will be passed on to the count program.
\subsection count-example Example

View File

@@ -1,15 +1,20 @@
/** \mainpage fish
/** \mainpage Fish user documentation
\c fish is a user friendly shell intended mostly for interactive use.
A shell is a program which allows you to execute other programs by
typing their names. For updates on \c fish, go to the <a
\section introduction The friendly interactive shell
This is the documentation for \c fish, the friendly interactive
shell. \c fish is a user friendly commandline shell intended
mostly for interactive use. A shell is a program used to execute other
programs. For the latest information on \c fish, please visit the <a
href="http://roo.no-ip.org/fish/"><tt>fish</tt> homepage</a>.
\section syntax Syntax overview
Shells like \c fish are used by giving them commands. Every \c fish command follows the same simple syntax.
Shells like fish are used by giving them commands. Every \c fish
command follows the same simple syntax.
A command is executed by writing the name of the command followed by any arguments.
A command is executed by writing the name of the command followed by
any arguments.
Example:
@@ -18,7 +23,7 @@ Example:
calls the \c echo command. \c echo is a command which will write its
arguments to the screen. In the example above, the output will be
'hello world'. Everything in fish is done with commands. There are
commonds for performing a set of command multiple times, commands for
commands for performing a set of commands multiple times, commands for
assigning variables, commands for treating a group of commands as a
single command, etc.. And every single command follows the same simple
syntax.
@@ -33,7 +38,7 @@ topic. 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.
Every program on a computer can be used as a command in \c fish. If
Every program on your computer can be used as a command in \c fish. If
the program file is located in one of the directories in the <a
href="#variables-special">PATH</a>, it is sufficient to type the name
of the program to use it. Otherwise the whole filename, including the
@@ -61,17 +66,23 @@ written on the same line by separating them with semicolons.
Sometimes features such as <a href="#globbing">parameter expansion</a>
and <a href="#escapes">character escapes</a> get in the way. When that
happens, the user can write a parameter within quotes, either '
(single quote) or " (double quote). There is no difference between
single quoted and double quoted strings. A quoted parameter will not
be parameter expanded, may contain spaces, and the only escape
sequences allowed is the corresponding quote character. Single and
double quotes may be nested.
(single quote) or " (double quote). There is one important difference
between single quoted and double quoted strings: When using double
quoted string, <a href='#expand-variable'>variable expansion</a> still
takes place. Other than that, a quoted parameter will not be
parameter expanded, may contain spaces, and escape sequences are
ignored. Single quotes have no special meaning withing double quotes
and vice versa.
Example:
<tt>rm "cumbersome filename.txt"</tt>
Will remove the file 'cumbersome filename.txt'.
Will remove the file 'cumbersome filename.txt', while
<tt>rm cumbersome filename.txt</tt>
would remove the two files 'cumbersome' and 'filenmae.txt'.
\subsection escapes Escaping characters
@@ -113,11 +124,11 @@ a number called a file descriptor (FD). These are:
- Standard output, FD 1, for writing, defaults to writing to the screen.
- Standard error, FD 2, for writing errors and warnings, defaults to writing to the screen.
The reason for providing for two methods of output is so errors and
The reason for providing for two methods of output is that errors and
warnings can be separated from regular program output.
Any file descriptor can be directed to a different output than it's
default through a simple mechanism called a redirecton.
default through a simple mechanism called a redirection.
An example of a file redirection is <tt> echo hello \>output.txt</tt>,
which directs the output of the echo command to the file error.txt.
@@ -131,8 +142,8 @@ which directs the output of the echo command to the file error.txt.
<tt>DESTINATION</tt> can be one of the following:
- A filename. The output will be written to the specified file.
- An ampersand (\&) followed by the number of a file descriptor. The file descriptor will be a duplicate of the specified file descriptor.
- A minus sign (-). The FD will be closed.
- An ampersand (\&) followed by the number of another file descriptor. The file descriptor will be a duplicate of the specified file descriptor.
- A minus sign (-). The file descriptor will be closed.
Example:
@@ -210,7 +221,7 @@ 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 as part of the shell
- command, a program
- function, a command that is implemented as a set of fish commands
- 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.
- 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
@@ -232,15 +243,16 @@ type <tt>fg -h</tt> or <tt>help fg</tt>.
Tab completion is one of the most time saving features of any modern
shell. By tapping the tab key, the user asks \c fish to guess the rest
of the command or parameter that the user is currently typing. If
there is only one possible completion, \c fish will write it out. If
there is more than one completion, \c fish will write out the longest
common prefix that all completions have in common. If all completions
differ on the first character, a list of all possible completions is
printed. The list features descriptions of the completions and if the
list doesn't fit the screen, it is scrollable by using the arrow keys,
the page up/page down keys or the space bar. Press any other key will
exit the list and insert the presssed key into the command line.
of the command or parameter that the user is currently typing. If \c
fish can only find one possible completion, \c fish will write it
out. If there is more than one completion, \c fish will write out the
longest common prefix that all completions have in common. If all
completions differ on the first character, a list of all possible
completions is printed. The list features descriptions of the
completions and if the list doesn't fit the screen, it is scrollable
by using the arrow keys, the page up/page down keys or the space
bar. Press any other key will exit the list and insert the pressed key
into the command line.
These are the general purpose tab completions that \c fish provides:
@@ -254,44 +266,72 @@ These are the general purpose tab completions that \c fish provides:
of these completions are simple options like the \c -l option for \c
ls, but some are more advanced. The latter include:
- The programs 'man' and 'whatis' complete using all installed
manual pages.
- The 'make' program complete using all targets in the Makefile in
the current directory.
- The 'mount' command complete using all mount points specified in fstab.
- The 'ssh' command complete using all hosts in that are stored
in the known_hosts file. (see the ssh documentation for more information)
- The 'su' command complete using all users on the system
- The \c apt-get, \c rpm and \c tym commands complete using all installed packages.
- The programs 'man' and 'whatis' show all installed
manual pages as completions.
- The 'make' program uses all targets in the Makefile in
the current directory as completions.
- The 'mount' command uses all mount points specified in fstab as completions.
- The 'ssh' command uses all hosts in that are stored
in the known_hosts file as completions. (see the ssh documentation for more information)
- The 'su' command uses all users on the system as completions.
- The \c apt-get, \c rpm and \c yum commands use all installed packages as completions.
Specifying your own completions is easy. If the command 'myprog' has
an option '-o' which can also be written as '--output', which requires
an additional value of either 'yes' or 'no' and decides if the program
should write anything, this can be specified by writing:
\subsection completion-own Writing your own completions
<tt>complete -c myprog -s o -l output -r -a "yes no" -d "Write output"</tt>
Specifying your own completions is not complicated. To specify a
completion, use the \c complete command. \c complete takes
as a parameter the name of the command to specify a completion
for. For example, to add a completion for the program \c myprog, one
would start the completion command with <tt>complete -c myprog
...</tt>. To provide a list of possible completions for myprog, use
the \c -a switch. If \c myprog accepts the arguments start and stop,
this can be specified as <tt>complete -c myprog -a 'start
stop'</tt>. The argument to the \c -a switch is always a single
string. At completion time, it will be tokenized on spaces and tabs,
and variable expansion, command substitution and other forms of
parameter expansion will take place.
For a more complete description of how to specify your own
completions, go <a href="builtins.html#complete">here</a> or write 'complete --help' in the \c fish shell.
Fish has a special syntax to support specifying switches accepted by a
command. The switches \c -s, \c -l and \c -o are used to specify a
short switch (single character, such as -l), a gnu style long switch (such as
--color) and an old-style long switch (like -shuffle),
respectively. If the command 'myprog' has an option '-o' which can
also be written as '--output', and which can take an additional value
of either 'yes' or 'no', this can be specified by writing:
<tt>complete -c myprog -s o -l output -a "yes no"</tt>
There are also special switches for specifying that a switch requires
an argument, to disable filename completion, to create completions
that are only available in some combinations, etc.. For a complete
description of the various switches accepted by the \c complete
command, see the documentation for the <a
href="builtins.html#complete">complete</a> builtin, or write 'complete
--help' inside the \c fish shell.
For examples of how to write your own complex completions, study the
completions in /etc/fish.d/completions (or ~/etc/fish.d/completions if
you installed fish in your home directory).
If you wish to use a completion, you should consider adding it to your
startup files. When completion has been requested for a command \c
COMMAND, fish will automatically look for the file
~/.fish.d/completions/COMMAND.fish. If it exists, it will be
automatically loaded. For examples of how to write your own complex
completions, study the completions in /etc/fish.d/completions (or ~/etc/fish.d/completions if you installed fish in your home directory).
automatically loaded. If you have written new completions for a common
Unix command, please consider sharing your work by sending it to <a
href='mailto: fish-users@lists.sf.net'>the fish mailinglist</a>.
\section expand Parameter expansion (Globbing)
When an argument for a program is given on the commandline, it
undergoes the process of parameter expantion before it is sent on to
undergoes the process of parameter expansion before it is sent on to
the command. There are many ways in which the user can specify a
parameter to be expanded. These include:
\subsection expand-wildcards Wildcards
\subsection expand-wildcard Wildcards
If a star (*) or a question mark (?) is present in the parameter, \c
fish attempts to mach the given parameter to any files in such a
fish attempts to match the given parameter to any files in such a
way that '?' can match any character except '/' and '*' can match any
string of characters not containing '/'.
@@ -300,17 +340,24 @@ Example:
<code>???</code> matches any file in the current directory whose name is exactly three characters long.
If no matches are found for a specific wildcard, it will expand into
zero arguments, i.e. to nothing. If none of the wildcarded arguments
sent to a command result in any matches, the command will not be
executed. If this happens when using the shell interactively, a
warning will also be printed.
\subsection expand-command-substitution Command substitution
If a parameter contains a set of parenthesis, the text enclosed by the
parentesis will be interpreted as a list of commands. Om expantion,
parenthesis will be interpreted as a list of commands. Om expansion,
this list is executed, and substituted by the output. If the output is
more than one line long, each line will be expanded to a new
parameter.
Example:
The command <code>echo (basename image.jpg .jpg).png</code> will output 'image.png'.
The command <code>echo (basename image.jpg .jpg).png</code> will
output 'image.png'.
The command <tt>for i in *.jpg; convert $i (basename $i .jpg).png;
end</tt> will convert all Jpeg files in the current directory to the
@@ -319,7 +366,7 @@ PNG format.
\subsection expand-brace Brace expansion
A comma separated list of characters enclosed en curly braces will be
A comma separated list of characters enclosed in curly braces will be
expanded so each element of the list becomes a new parameter.
Example:
@@ -339,11 +386,45 @@ href="#variables"> Environment variables</a> section.
Example:
<tt> echo \$HOME</tt> prints the home directory of the current
user. If you wish to combine environment variables with text, you can
user.
If you wish to combine environment variables with text, you can
encase the variables within braces to embed a variable inside running
text like <tt>echo Konnichiwa {$USER}san</tt>, which will print a
personalized Japanese greeting.
The {$USER}san syntax might need a bit of an elaboration. Posix
shells allow you to specify a variable name using '$VARNAME' or
'${VARNAME}'. Fish only supports the former, but has no support
whatsoever for the latter or anything remotely like it. So what is
'{$VARNAME}' then? Well, '{WHATEVER}' is <a href='#brace'>brace
expansion</a>, the same as supported by Posix shells, i.e. 'a{b,c}d'
-> 'abd acd' works both in bash and on fish. So '{$VARNAME}' is a
bracket-expansion with only a single element, i.e. it becomes
expanded to '$VARNAME', which will be variable expanded to the value
of the variable 'VARNAME'. So you might think that the brackets don't
actually do anything, and that is nearly the truth. The snag is that
there once along the way was a '}' in there somewhere, and } is not a
valid character in a variable name. So anything after the otherwise
pointless bracket expansion becomes NOT a part of the variable name,
even if it happens to be a legal variable name character. That's why
'{$USER}san' looks for the variable '$USER' and not for the variable
'$USERsan'. It's a case of one syntax lending itself nicely to
solving an unrelated problem in it's spare time.
Variable expansion is the only type of expansion performed on double
quoted strings. There is, however, an important difference in how
variables are expanded when quoted and when unquoted. An unquoted
variable expansion will result in a variable number of arguments. For
example, if the variable $foo has zero elements or is undefined, the
argument $foo will expand to zero elements. If the variable $foo is an
array of five elements, the argument $foo will expand to five
elements. When quoted, like "$foo", a variable expansion will always
result in exactly one argument. Undefined variables will expand to the
empty string, and array variables will be concatenated using the space
character.
\subsection expand-home Home directory expansion
The ~ (tilde) character at the beginning of a parameter, followed by a
@@ -354,7 +435,7 @@ directory of the process owner.
\subsection expand-process Process expansion
The \% (percent) character at the beginning of a parameter followed by
a string is expanded into a process id. The following expantions are
a string is expanded into a process id. The following expansions are
performed:
- If the string is the entire word \c self, the shells pid is the result
@@ -394,7 +475,9 @@ will output 'abar1 abar2 abar3 afoo1 afoo2 afoo3'.
The concept of environment variables are central to any
shell. Environment variables are variables, whose values can be set
and used by the user.
and used by the user. For information on how to use the current value
of a variable, see the section on <a href='#expand-variable'>variable
expansion</a>.
To set a variable value, use the <a href="builtins.html#set"> \c set
command</a>.
@@ -409,25 +492,25 @@ the shell through <a href="expand-variable">variable expansion</a>.
Example:
To use the value of a the variable \c smurf, use the command <tt>echo
Smurfs are $smurf</tt>, which would print the result 'Smurfs are
blue'.
To use the value of a the variable \c smurf, write $ (dollar symbol)
followed by the name of the variable, like <tt>echo Smurfs are
$smurf</tt>, which would print the result 'Smurfs are blue'.
\subsection variables-scope Variable scope
There are three kinds of variables in fish, universal, global and
local variables. Universal variables are shared between all fish
sessions a user is running on one computer. Global variables are
specific to the current fish session, and will never be erased unless
the user explicitly requests it using <tt>set -e</tt>. Local variables
are specific to the current fish session, and associated with a
specific block of commands, and is automatically erased when a
specific block goes out of scope. A block of commands is a series of
commands that begins with one of the commands \c 'for, \c 'while' , \c
'if', \c 'function', \c 'begin' or \c 'switch', and ends with the
command \c 'end'. The user can specify that a variable should have
either global or local scope using the \c -g/--global or \c -l/--local
switches.
specific to the current fish session, but are not associated with any
specific block scope, and will never be erased unless the user
explicitly requests it using <tt>set -e</tt>. Local variables are
specific to the current fish session, and associated with a specific
block of commands, and is automatically erased when a specific block
goes out of scope. A block of commands is a series of commands that
begins with one of the commands \c 'for, \c 'while' , \c 'if', \c
'function', \c 'begin' or \c 'switch', and ends with the command \c
'end'. The user can specify that a variable should have either global
or local scope using the \c -g/--global or \c -l/--local switches.
Variables can be explicitly set to be universal with the \c -U or \c
--universal switch, global with the \c -g or \c --global switch, or
@@ -436,21 +519,24 @@ creating or updating a variable are:
-# If a variable is explicitly set to either universal, global or local, that setting will be honored
-# If a variable is not explicitly set to be either universal, global or local, but has been previously defined, the variable scope is not changed
-# If a variable is not explicitly set to be either universal, global or local and has never befor been defined, the variable will be local to the current scope
-# If a variable is not explicitly set to be either universal, global or local and has never before been defined, the variable will be local to the currently executing functions. If no function is executing, the variable will be global.
There may be many variables with the same name, but different scopes.
When using a variable, the variable scope will be searched from the
inside out, i.e. a local variable will be used rather than a global
variable with the same name, a global variable will be used rather
than a universal variable with the same name.
For example, the following code will not output anything:
Example:
The following code will not output anything:
<pre>
if true
begin
# This is a nice local scope where all variables will die
set pirate 'There be treasure in them thar hills'
set -l pirate 'There be treasure in them thar hills'
end
# This will not output anything, since the pirate is dead
# This will not output anything, since the pirate was local
echo $pirate
</pre>
@@ -472,9 +558,9 @@ prompt will instantly change to blue on both terminals.
\subsection variables-functions Variable scope for functions
When calling a function, all non-global variables temporarily
dissapear. This shadowing of the local scope is needed since the
disappear. This shadowing of the local scope is needed since the
variable namespace would become cluttered, making it very easy to
accidentaly overwrite variables from another function.
accidentally overwrite variables from another function.
For example, the following code will output 'Avast, mateys':
@@ -503,14 +589,14 @@ inherited by any commands started by fish. It is convention that
exported variables are in uppercase and unexported variables are in
lowercase.
Variables can be explicitly set to be exportes with the \c -x or \c
Variables can be explicitly set to be exported with the \c -x or \c
--export switch, or not exported with the \c -u or \c --unexport
switch. The exporting rules when creating or updating a variable are
identical to the scoping rules for variables:
-# If a variable is explicitly set to either be exported or not exported, that setting will be honored
-# If a variable is not explicitly set to be exported or not exported, but has been previously defined, the previous exporting rule for the variable is kept
-# If a variable is not explicitly set to be either global or local and has never befor been defined, the variable will not be exported
-# If a variable is not explicitly set to be either global or local and has never before been defined, the variable will not be exported
\subsection variables-arrays Arrays
@@ -557,24 +643,48 @@ echo $smurf
\subsection variables-special Special variables
The user can change the settings of \c fish by changing the values of
certain environment variables.These are:
certain environment variables.
- \c BROWSER, which is the users preferred web browser. If this variable is set, fish will use the specified browser instead of the system default browser to display the fish documentation.
- \c CDPATH, which is an array of directories in which to search for the new directory for the \c cd builtin.
- \c fish_color_normal, \c fish_color_command, \c fish_color_substitution, \c fish_color_redirection, \c fish_color_end, \c fish_color_error, \c fish_color_param, \c fish_color_comment, \c fish_color_match, \c fish_color_search_match, \c fish_color_cwd, \c fish_pager_color_prefix, \c fish_pager_color_completion, \c fish_pager_color_description and \c fish_pager_color_progress are used to change the color of various elements in \c fish. These variables are universal, i.e. when changing them, their new value will be used by all running fish sessions. The new value will also be retained when restarting fish.
- \c PATH, which is an array of directories in which to search for commands
- \c umask, which is the current file creation mask. The preferred way to change the umask variable is through the <a href="commands.html#umask">umask shellscript function</a>. An attempt to set umask to an invalid value will always fail.
\c fish also sends additional information to the user through the
values of certain environment variables. The user can not change the values of these variables. They are:
values of certain environment variables. The user can not change the
values of these variables. They are:
- \c _, which is the name of the currently running command.
- \c history, which is an array containing the last commands that where entered
- \c HOME, which is the users home directory. This variable can be changed by the root user.
- \c PWD, which is the current working directory.
- \c history, which is an array containing the last commands that where entered.
- \c HOME, which is the users home directory. This variable can only be changed by the root user.
- \c PWD, which is the current working directory.
- \c status, which is the exit status of the last foreground job to exit. If a job contains pipelines, the status of the last command in the pipeline is the status for the job.
- \c USER, which is the username. This variable can only be changed by the root user.
- \c LANG, \c LC_ALL, \c LC_COLLATE, \c LC_CTYPE, \c LC_MESSAGES, \c LC_MONETARY, \c LC_NUMERIC and \c LC_TIME set the language option for the shell and subprograms. See the section <a href='#variables-locale'>Locale variables</a> for more information.
\c fish also uses several variables internally. Such variables are
prefixed with the string __FISH or __fish. These should be ignored by the user.
Variables whose name are in uppercase are exported to the commands
started by fish. This rule is not enforced by fish, but it is good
coding practice to use casing to distinguish between exported and
unexported variables. \c fish also uses several variables
internally. Such variables are prefixed with the string __FISH or
__fish. These should be ignored by the user.
\subsection variables-locale Locale variables
The most common way to set the locale to use a command like 'set -x
LANG en_GB.utf8', which sets the current locale to be the english
language, as used in Great Britain, using the UTF-8 character set. For
a list of available locales, use 'locale -a'.
\c LANG, \c LC_ALL, \c LC_COLLATE, \c LC_CTYPE, \c LC_MESSAGES, \c
LC_MONETARY, \c LC_NUMERIC and LC_TIME set the language option for the
shell and subprograms. These variables work as follows: \c LC_ALL
forces all the aspects of the locale to the specified value. If LC_ALL
is set, all other locale variables will be ignored. The other LC_
variables set the specified aspect of the locale information. LANG
is a fallback value, it will be used if none of the LC_ variables are
specified.
\section builtin-overview Builtins
@@ -591,10 +701,12 @@ The following commands are distributed with fish. Many of them are
builtins or shellscript functions, and can only be used inside fish.
- <a href="builtins.html#source">.</a>, read and execute the commands in a file
- <a href="builtins.html#and">and</a>, execute command if previous command suceeded
- <a href="builtins.html#bg">bg</a>, set a command to the background
- <a href="builtins.html#begin">begin</a>, execute a block of commands
- <a href="builtins.html#bind">bind</a>, change keyboard bindings
- <a href="builtins.html#break">break</a>, stop the execution of a loop
- <a href="builtins.html#block">block</a>, Temporarily block delivery of events
- <a href="builtins.html#builtin">builtin</a>, execute a builtin command
- <a href="builtins.html#case">case</a>, conditionally execute a block of commands
- <a href="builtins.html#cd">cd</a>, change the current directory
@@ -621,6 +733,7 @@ builtins or shellscript functions, and can only be used inside fish.
- <a href="commands.html#mimedb">mimedb</a>, view mimedata about a file
- <a href="commands.html#nextd">nextd</a>, move forward in the directory history
- <a href="builtins.html#not">not</a>, negates the exit status of any command
- <a href="builtins.html#or">or</a>, execute a command if previous command failed
- <a href="commands.html#popd">popd</a>, move to the topmost directory on the directory stack
- <a href="commands.html#prevd">prevd</a>, move backwards in the direcotry stack
- <a href="commands.html#pushd">pushd</a>, push the surrent directory onto the directory stack
@@ -632,6 +745,7 @@ builtins or shellscript functions, and can only be used inside fish.
- <a href="builtins.html#switch">switch</a>, conditionally execute a block of commands
- <a href="commands.html#tokenize">tokenize</a>, split a string up into multiple tokens
- <a href="builtins.html#ulimit">ulimit</a>, set or get the shells resurce usage limits
- <a href="commands.html#umask">umask</a>, set or get the file creation mask
- <a href="builtins.html#while">while</a>, perform a block of commands while a condition is met
For more information about these commands, use the <tt>--help</tt>
@@ -649,24 +763,26 @@ Here are some of the commands available in the editor:
- End or Ctrl-e moves to the end of line
- Left and right moves one character left or right
- Alt-left and Alt-right moves one word left or right, or moves forward/backward in the directory history if the commandline is empty
- Up and down search the command history for the previous/next command containing the string that was specified on the commandline before the search was started. If the commandline was empty when the search started, all commands match. See the <a href='#history'>history </a>section for more information on history searching.
- Alt-up and Alt-down search the command history for the previous/next token containing the token under the cursor before the search was started. If the commandline was not on a token when the search started, all tokens match. See the <a href='#history'>history </a>section for more information on history searching.
- Delete and backspace removes one character forwards or backwards
- Ctrl-c delete entire line
- Ctrl-d delete one character to the right of the cursor, unless the buffer is empty, in which case the shell will exit
- Ctrl-k move contents from cursor to end of line to <a href="#killring">killring</a>
- Ctrl-u move contents from beginning of line to cursor <a href="#killring">killring</a>
- Ctrl-k move contents from the cursor to the end of line to the <a href="#killring">killring</a>
- Ctrl-u move contents from the beginning of line to the cursor to the <a href="#killring">killring</a>
- Ctrl-l clear and repaint screen
- Ctrl-w move previous word to <a href="#killring">killring</a>
- Alt-d move next word to <a href="#killring">killring</a>
- Ctrl-w move previous word to the <a href="#killring">killring</a>
- Alt-d move next word to the <a href="#killring">killring</a>
- Alt-w prints a short description of the command under the cursor
- Alt-l lists the contents of the current directory, unless the cursor is over a directory argument, in which case the contents of that directory will be listed
- Alt-k prints a list of all key bindings
- Alt-p adds the string '| less;' to the end of the job under the cursor. The result is that the output of the command will be paged.
You can change these key bindings by making an inputrc file. To do
this, copy the file /etc/fish_inputrc to your home directory and
rename it to '.fish_inputrc'. Now you can edit the file .fish_inputrc,
to change your key bindings. The fileformat of this file is described
in the manual page for readline. Use the command <tt>man readline</tt>
to read up on this syntax. Please note thet the list of key binding
to read up on this syntax. Please note that the list of key binding
functions in fish is different to that offered by readline. Currently,
the following functions are available:
@@ -695,7 +811,11 @@ the following functions are available:
- \c yank, insert the latest entry of the killring into the buffer
- \c yank-pop, rotate to the previous entry of the killring
You can also bind a pice of shellscript to a key using the same
syntax. For example, the Alt-p functionality described above is
implemented using the following keybinding.
<pre>"\M-p": if commandline -j|grep -v 'less *$' &gt;/dev/null; commandline -aj "|less;"; end</pre>
\subsection killring Copy and paste (Kill Ring)
@@ -716,24 +836,34 @@ After a command has been entered, it is inserted at the end of a
history list. Any duplicate history items are automatically
removed. By pressing the up and down keys, the user can search
forwards and backwards in the history. If the current command line is
not empty when starting a history search, only the commands starting
with the string entered into the command line are searched.
not empty when starting a history search, only the commands containing
the string entered into the command line are shown.
By pressing Alt-up and Alt-down, a history search is also performed,
but instead of searching for a complete commandline, each commandline
is tokenized into separate elements just like it would be before
execution, and each such token is matched agains the token under the
cursor when the search began.
History searches can be aborted by pressing the escape key.
The history is stored in the file '.fish_history'. It is automatically
read on startup and merged on program exit.
Example:
To search for previous entries starting with the letter 'l', type 'l'
To search for previous entries containing the word 'make', type 'make'
in the console and press the up key.
\section job-control Running multiple programs
Normally when \c fish starts a program, this program will be put
in the foreground, meaning it will take control of the terminal and
\c fish will be stopped until the program finishes. Sometimes
this is not desirable. In such cases, there are several ways in which
the user can change <tt>fish</tt>'s behaviour.
Normally when \c fish starts a program, this program will be put in
the foreground, meaning it will take control of the terminal and \c
fish will be stopped until the program finishes. Sometimes this is not
desirable. For example, you may wish to start an application with a
graphical user interface from the terminal, and then be able to
continue using the shell. In such cases, there are several ways in
which the user can change <tt>fish</tt>'s behaviour.
-# By ending a command with the \& (ampersand) symbol, the user tells \c fish to put the specified command into the background. A background process will be run simultaneous with \c fish. \c fish will retain control of the terminal, so the program will not be able to read from the keyboard.
-# By pressing ^Z, the user stops a currently running foreground program and returns control to \c fish. Some programs do not support this feature, or remap it to another key. Gnu emacs uses ^X z to stop running.
@@ -741,14 +871,29 @@ the user can change <tt>fish</tt>'s behaviour.
\section initialization Initialization files
On startup, \c fish evaluates the file /etc/fish (Or ~/etc/fish if you installed fish in your home directory) and ~/.fish, in that
order. If you want to run a command only on starting an interactive
shell, use the output of the 'status --is-interactive' command. If
you want to run a command only on starting a login shell, use 'status --is-login' instead.
On startup, \c fish evaluates the file /etc/fish (Or ~/etc/fish if you
installed fish in your home directory) and ~/.fish, in that order. If
you want to run a command only on starting an interactive shell, use
the exit status of the command 'status --is-interactive' to determine
if the shell is interactive. If you want to run a command only on
starting a login shell, use 'status --is-login' instead.
If you want to run a set of commands when \c fish exits, redefine the
<a href="#hooks">function hook</a> \c fish_on_exit. If the \c
fish_on_exit is defined, it will be execute before the shell exits.
Example:
If you want to add the directory ~/linux/bin to your PATH variable
when loging in, add the following to your ~/.fish file:
<pre>if status --is-login
set PATH $PATH ~/linux/bin
end</pre>
If you want to run a set of commands when \c fish exits, use an <a
href='#event'>event handler</a> that is triggered by the exit of the
shell:
<pre>function on_exit --on-process %self
echo fish is now exiting
end</pre>
<a href="#variables-universal">Universal variables</a> are stored in
the file .fishd.HOSTNAME, where HOSTNAME is the name of your
@@ -767,7 +912,7 @@ marked red.
Detected errors include:
- Non existing commands.
- Reading or appending from non existing files.
- Reading from or appending to a non existing file.
- Incorrect use of output redirects
- Mismatched parenthesis
@@ -780,11 +925,15 @@ fish_color_substitution, \c fish_color_redirection, \c fish_color_end,
\c fish_color_error, \c fish_color_param, \c fish_color_comment, \c
fish_color_match, \c fish_color_search_match, \c fish_color_cwd, \c
fish_pager_color_prefix, \c fish_pager_color_completion, \c
fish_pager_color_description and \c fish_pager_color_progress. Valid
values are \c black, \c red, \c green, \c brown, \c yellow, \c blue,
\c magenta, \c purple, \c cyan, \c white or \c normal. Setting one of
the above variables to normal will mean that the text color will be
set to the default color for the terminal.
fish_pager_color_description and \c
fish_pager_color_progress. Usually, the value of these variables will
be one of \c black, \c red, \c green, \c brown, \c yellow, \c blue, \c
magenta, \c purple, \c cyan, \c white or \c normal, but they can be an
array containing any color options for the set_color command.
Issuing <code>set fish_color_error black --background=red
--bold</code> will make all commandline errors be written in a black,
bold font, with a red background.
\subsection prompt Programmable prompt
@@ -799,17 +948,14 @@ The default \c fish prompt is
<p>
<pre>
function fish_prompt -d "Write out the prompt"
printf '\%s\@\%s\%s\\n\%s\%s\\n> ' (whoami) (hostname|cut -d . -f 1) (set_color \$fish_color_cwd) (prompt_pwd) (set_color normal)
printf '\%s\@\%s\%s\%s\%s> ' (whoami) (hostname|cut -d . -f 1) (set_color \$fish_color_cwd) (prompt_pwd) (set_color normal)
end
</pre>
where \c prompt_pwd is a shellscript function that displays a condensed version of the current working direcotry.
</p>
If you are using \c set_color or other commands that output escape
codes to change the font settings of the terminal, you must always and
every such sequence with a newline. This is needed since fish needs to
know that exact length of the prompt in order to tetect when the
cursor reaches the end of the line. Any newlines in the output of the
\c fish_prompt command are ignored.
\subsection title Programmable title
@@ -830,15 +976,28 @@ end
</pre>
</p>
\subsection hooks Event hooks
\subsection event Event handlers
There are several special function names in fish. If a function is
given this name, it will be automatically called when a specific event
has occured. These functions are:
When defining a new function in fish, it is possible to make it into an
event handler, i.e. a function that is automatically run when a
specific event takes place. Events that can trigger a handler currently are:
- \c fish_on_exit, which is called before the shell exits
- \c fish_on_exec, which is called before interactively executing a command
- \c fish_on_return, which is called when control returns to the shell after interactively executing a command
* When a signal is delivered
* When a process or job exits
* When the value of a variable is updated
Example:
To specify a signal handler for the WINCH signal, write:
<pre>function --on-signal WINCH my_signal_handler
echo Got WINCH signal!
end
</pre>
For more information on how to define new event handlers, see the
documentation for the <a href='builtins.html#function'>function</a>
command.
\section issues Common issues with fish
@@ -848,28 +1007,87 @@ it's initalization files to function properly. To solve this
problem, either copy the initialization files to each fish users home
directory, or install them in /etc.
\section i18n Translating fish to other languages
Fish uses the GNU gettext library to implement translation to multiple
languages. If fish is not available in your language, please consider
making a translation. Currently, only the shell itself can be
translated, a future version of fish should also include translated
manuals.
To make a translation of fish, you will first need the sourcecode,
available from the <a href='http://roo.no-ip.org/fish'>fish
homepage</a>. Download the latest version, and then extract it using a
command like <code>tar -zxf fish-VERSION.tar.gz</code>.
Next, cd into the newly created fish directory using <code>cd
fish-VERSION</code>.
You will now need to configure the sourcecode using the command
<code>./configure</code>. This step might take a while.
Before you continue, you will need to know the ISO 639 language code
of the language you are translating to. These codes can be found <a
href='http://www.w3.org/WAI/ER/IG/ert/iso639.htm'>here</a>. For
example, the language code for Uighur is ug.
Now you have the sourcecode and it is properly configured. Lets start
translating. To do this, first create an empty translation table for
the language you wish to translate to by writing <code>make
po/[LANGUAGE CODE].po</code> in the fish terminal. For example, if you
are translating to Uighur, you should write <code>make
po/ug.po</code>. This should create the file po/ug.po, a template
translation table containing all the strings that need to be
translated.
Now you are all set up to translate fish to a new language. Open the
newly created .po file in your editor of choice, and start
translating. The .po file format is rather simple. It contains pairs
of string in a format like:
<pre>
msgid "%ls: No suitable job\n"
msgstr ""
</pre>
The first line is the english string to translate, the second line
should contain your translation. For example, in swedish the above
might become:
<pre>
msgid "%ls: No suitable job\n"
msgstr "%ls: Inget jobb matchar\n"
</pre>
\%s, \%ls, %\d and other tokens beginning with a '\%' are
placeholders. These will be replaced by a value by fish at
runtime. You must always take care to use exactly the same
placeholders in the same order in your translation. (Actually, there
are ways to avoid this, but they are to complicated for this short
introduction. See the full manual for the printf C function for more
information.)
Once you have provided a translation for fish, please send it to <a
href='fish-users@lists.sf.net'>fish-users@lists.sf.net</a>.
\section todo Missing features and bugs
\subsection todo-features Missing features
- Complete vi-mode key bindings
- '**' wildcard for recursive wildcard matching
- next-history-complete
- umask shellscript function
- builtin wait command
- More completions (for example xterm, vim,
konsole, gnome-terminal, dcop, cdrecord, cron, xargs
rlogin, telnet, rsync, arch, finger, nice, locate,
bibtex, patch, aspell, xpdf,
zip, compress, wine, xmms, dig, wine, batch, cron,
compress, wine, xmms, dig, wine, batch, cron,
g++, javac, java, gcj, lpr, doxygen, whois, find)
- Undo support
- Multiple input characters should be inserted in one batch whenever possible, to avoid flickering
- Check keybinding commands for output - if non has happened, don't repaint to reduce flicker
- the jobs builtin should be able to give information on a specific job, such as the pids of the processes in the job
- Check keybinding commands for output - if nothing has happened, don't repaint to reduce flicker
- The jobs builtin should be able to give information on a specific job, such as the pids of the processes in the job
- 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
\subsection todo-possible Possible features
@@ -882,7 +1100,6 @@ g++, javac, java, gcj, lpr, doxygen, whois, find)
- mouse support like zsh has with http://stchaz.free.fr/mouse.zsh
installed would be awesome
- suggest a completion on unique matches by writing it out in an understated color
- Maybe some functions should only be available from key-bindings. That way one could implement a large part of all the key-binding functions as regular fish functions without worrying about cluttering up the function name space.
- With a bit of tweakage, quite a few of the readline key-binding functions could be implemented in shellscript.
- Highlight beginning/end of block when moving over a block command
- Inclusion guards for the init files to make them evaluate only once, even if the user has installed fish both in /etc and in $HOME
@@ -892,20 +1109,22 @@ g++, javac, java, gcj, lpr, doxygen, whois, find)
- 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
\subsection bugs Known bugs
- Completion for gcc -\#\#\# option doesn't work.
- Many completions are made specifically for the GNU
version of a POSIX command
- Yanking weird characters from clipboard prints Unicode escapes
- Prefix string in completion display is sometimes incorrect
- 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
report to <a href="mailto:axel@liljencrantz.se"> axel@liljencrantz.se
</a>.
\subsection Known issues
\subsection issues Known issues
Older versions of Doxygen has bugs in the man-page generation which
cause the builtin help to render incorrectly. Version 1.2.14 is known
@@ -919,6 +1138,7 @@ changes when upgrading from pre1.9.2 to 1.9.2 or later. You may also
run into such problems when switching between using a package and
personal builds.
*/
/** \page design Design document
@@ -937,6 +1157,10 @@ Most tradeoffs between power and ease of use can be avoided with careful design.
-# Whenever possible without breaking the above goals, fish should
follow the Posix syntax.
To achive these high-level goals, the fish design relies on a number
of more specific design principles. These are presented below,
together with a rationale and a few examples for each.
\subsection ortho The law of orthogonality
The shell language should have a small set of orthogonal features. Any
@@ -953,7 +1177,10 @@ program harder to maintain and update.
Examples:
- Here documents are too similar to using echo inside of a pipeline.
- The different quoting styles are silly. ("", '' and \$'')
- Subshells, command substitution and process substitution are strongly related. \c fish only supports command substitution, the others can be achived either using a block or the psub shellscript function.
- Having both aliases and functions is confusing, especially since both of them have limitations and problems. \c fish sunctions have none of the drawbacks of either syntax.
- The many Posix quoting styles are silly, especially \$''.
\subsection sep The law of minimalism
@@ -985,9 +1212,8 @@ and many other funtions can easily be done in external programs. They
should not be supported internally by the shell.
The law of minimalism does not imply that a large feature set is
bad. So long as a feature is not part of the language itself, but a
separate command or at least a shellscript function, bloat is much
more acceptable.
bad. So long as a feature is not part of the shell itself, but a
separate command or at least a shellscript function, bloat is fine.
\subsection conf Configurability is the root of all evil
@@ -1010,7 +1236,7 @@ enough approximation of it.
Examples:
- Fish allows the user to set various syntax highlighting colors. This is needed because fish does not know what colors the terminal uses by default, which might make some things unreadable. The proper solution would be for text color preferences to be defined centrally by the user for all programs, and for the terminal emulator to send these color properties to fish.
- Fish does not allow you to set the history filename, the number of history entries, different language substyles or any number of other common cshell configuration options
- Fish does not allow you to set the history filename, the number of history entries, different language substyles or any number of other common shell configuration options.
A special note on the evils of configurability is the long list of
very useful features found in some shells, that are not turned on by
@@ -1028,13 +1254,18 @@ considered once a user interface has been designed.
Rationale:
If too much attention is given to what is easy to implement the law of
orthogonality and the law of minimalism will by necessity be disobeyed.
This design rule is different than the others, since it describes how
one should go about designing new features, not what the features
should be. The problem with focusing on what can be done, and what is
easy to do, is that to much of the implementation is exposed. This
means that the user must know a great deal about the underlying system
to be able to guess how the shell works, it also means that the
language will often be rather low-level.
Examples:
- There should only be one type of input to the shell, lists of commands. Loops, conditionals and variable assignments are all performed through regular commands.
- The differences between builtin commands, shellscript functions and builtin commands should be made as small as possible. Builtins and shellscript functions should have exactly the same types of argument expantion as other commands, should be possible to use in any position in a pipeline, and should support any io redirection.
- The differences between builtin commands, shellscript functions and builtin commands should be made as small as possible. Builtins and shellscript functions should have exactly the same types of argument expansion as other commands, should be possible to use in any position in a pipeline, and should support any io redirection.
- Instead of forking when performing command substitution to provide a fake variable scope, all fish commands are performed from the same process, and fish instead supports true scoping
- All blocks end with the \c end builtin
@@ -1069,7 +1300,6 @@ Examples:
/** \page about About fish
\section about-program About the program
\c fish is meant to be used for interactive shell tasks on a modern
@@ -1250,17 +1480,6 @@ builtin. The are very few builtins, \c fish relies on normal commands
like <tt>echo</tt>, <tt>kill</tt>, <tt>printf</tt> and <tt>time</tt>
instead of reimplementing them as builtins.
The globbing in fish is significantly simplified. Since I can never
remember all the subtle differences between single and double quotes,
which kind of tick is used for command substitution and all the other
strange quirks of of the Posix shell language, that aspect of shells
has been significantly simplified. This makes \c fish unsuitable for
strange shell scripting, but much more suited to interactive needs
than regular shells.
There is no difference between double and single quotes. They both
turn of all globbing and escape sequences. They can be nested.
Token separation is performed before variable expansion. This means
that even if a variable contains spaces, it will never be separated
into multiple arguments. If you want to tokenize a string, you can use

View File

@@ -7,8 +7,8 @@
\subsection exec-description Description
The \c exec builtin is used to replace the currently running shells
process image with a new command. On sucessfull completion, exec never
returns. exec can not be used inside a pipeline.
process image with a new command. On successful completion, exec never
returns. exec can not be used inside a pipeline.
\subsection exec-example Example

View File

@@ -2,50 +2,24 @@
\section fishd fishd - Universal variable daemon
\subsection fishd-synopsis Synopsis
<tt>fishd [SECTION]</tt>
<tt>fishd [(-h|--help|-v|--version)]</tt>
\subsection fishd-description Description
The \c fishd daemon is used to load, save and distribute universal
variable information. fish automtically connects to fishd via a socket
variable information. fish automatically connects to fishd via a socket
on startup. If no instance of fishd is running, fish spawns a new
fishd instance. fishd will create a socket in /tmp, and wait for
incoming connections from universal variable clents, such as fish,
incoming connections from universal variable clients, such as fish,
When no clients are connected, fishd will automatically shut down.
\subsection fishd-commands Commands
Fishd works by sending and recieving sommands. Each command is ended
with a newline. These are the commands supported by fishd:
<pre>set KEY:VALUE
set_export KEY:VALUE
</pre>
These commands update the value of a variable. The only difference
between the two is that <tt>set_export</tt>-variables should be
exported to children of the process using them. The variable value may
be escaped using C-style backslash escapes. In fact, this is required
for newline characters, which would otherwise be interpreted as end of
command.
<pre>erase KEY
</pre>
Erase the variable with the specified name.
<pre>barrier
barrier_reply
</pre>
A \c barrier command will result in a barrier_reply beeing added to
the end of the senders queue of unsent messages. These commands are
used to synchronize clients, since once the reply for a barrier
message returns, the sender can know that any updates available at the
time the original barrier request was sent have been recieved.
- <tt>-h</tt> or <tt>--help</tt> displays this help message and then exits
- <tt>-v</tt> or <tt>--version</tt> displays the current fish version and then exits
\subsection fishd-files Files
~/.fishd.HOSTNAME permenent storage location for universal variale
~/.fishd.HOSTNAME permanent storage location for universal variable
data. The data is stored as a set of \c set and \c set_export commands
such as would be parsed by fishd.
such as would be parsed by fishd. If an instance of fishd is running
(which is generally the case), manual modifications to ~/.fishd.HOSTNAME
will be lost.

View File

@@ -5,22 +5,22 @@
\subsection function-description Description
- \c -b or \c --key-binding specifies that the function is a key biding. Key binding functions work exactly like regular functions except that they can not be tab-completed, and may contain the '-' character.
- \c -b or \c --key-binding specifies that the function is a key biding. Key binding functions work exactly like regular functions except that they can not be tab-completed, and may contain the '-' character.
- <tt>-d DESCRIPTION</tt> or \c --description=DESCRIPTION is a description of what the function does, suitable as a completion description
- <tt>-j PID</tt> or <tt> --on-job-exit PID</tt> tells fish to run this function when the job with group id PID exits
- <tt>-p PID</tt> or <tt> --on-process-exit PID</tt> tells fish to run this function when the fish child process with process id PID exits
- <tt>-s</tt> or <tt>--on-signal SIGSPEC</tt> tells fish to run this function when the signal SIGSPEC is delivered. SIGSPEC can be a singal number, or the signal name, such as SIGHUP (or just HUP)
- <tt>-s</tt> or <tt>--on-signal SIGSPEC</tt> tells fish to run this function when the signal SIGSPEC is delivered. SIGSPEC can be a signal number, or the signal name, such as SIGHUP (or just HUP)
- <tt>-v</tt> or <tt>--on-variable VARIABLE_NAME</tt> tells fish to run this function when the variable VARIABLE_NAME changes value
This builtin command is used to create a new function. A Function is a
list of commands that will be executed when the name of the function
is entered. The function
is entered. The function
<pre>
function hi
echo hello
end
</pre>
</pre>
will write <tt>hello</tt> whenever the user enters \c hi.
@@ -29,7 +29,7 @@ are inserted into the environment variable <a href="index.html#variables-arrays"
\subsection function-example Example
<pre>function ll
<pre>function ll
ls -l $argv
end
</pre>
@@ -39,18 +39,18 @@ will run the \c ls command, using the \c -l option, while passing on any additio
<pre>
function mkdir -d "Create a directory and set CWD"
mkdir $argv
if test $status = 0
if test $status = 0
switch $argv[(count $argv)]
case '-*'
case '*'
cd $argv[(count $argv)]
return
end
end
end
</pre>
</pre>
will run the mkdir command, and if it is succesfull, change the
will run the mkdir command, and if it is successful, change the
current working directory to the one just created.

View File

@@ -1,5 +1,5 @@
\section help help - Display fish documantation
\section help help - Display fish documentation
\subsection help-synopsis Synopsis
<tt>help [SECTION]</tt>

View File

@@ -1,13 +1,20 @@
\section jobs jobs - print currently running jobs
\subsection jobs-synopsis
<tt>jobs</tt>
<tt>jobs [OPTIONS] [PID]</tt>
\subsection jobs-description Description
The <tt>jobs</tt> builtin causes fish to print a list of the currently
running jobs and their status.
running jobs and their status.
On systems that supports this feature, jobs will also print the CPU
usage of each job since the last command was executed. The CPU usage
is expressed as a percentage of full CPU activity. Note that on
jobs accepts the following switches:
- <tt>-c</tt> or <tt>--command</tt> print the command name for each process in jobs
- <tt>-g</tt> or <tt>--group</tt> only print the group id of each job
- <tt>-l</tt> or <tt>--last</tt> only the last job to be started is printed
- <tt>-p</tt> or <tt>--process</tt> print the process id for each process in all jobs
On systems that supports this feature, jobs will print the CPU usage
of each job since the last command was executed. The CPU usage is
expressed as a percentage of full CPU activity. Note that on
multiprocessor systems, the total activity may be more than 100\%.

View File

@@ -2,22 +2,16 @@
\section or or - Conditionally execute a command
\subsection or-synopsis Synopsis
<tt>or COMMAND1; COMMAND2</tt>
<tt>COMMAND1; or COMMAND2</tt>
\subsection or-description Description
The \c or builtin is used to execute one command, and if it returns
non-zero status, also execute a second command.
The \c or builtin is used to execute a command if the current exit status (as set by the last previous command) is non-zero
\subsection or-example Example
The following code runs the \c make command to build a program, or if it fails, it runs <tt>make clean</tt>, which removes the files created by the build process
<pre>
or make; make clean
make; or make clean
</pre>
\c or and \c and can be nested, as in this example, that attempts to build and install a program, and removed the files created by the build process on failiure
<pre>
or and make; make install; make clean
</pre>

View File

@@ -1,41 +1,41 @@
\section set set - Handle environment variables.
\subsection set-synopsis Synopsis
<tt>set [OPTIONS] VARIABLE_NAME [VALUES...]</tt>
<code>set [OPTIONS] [VARIABLE_NAME [VALUES...]]</code>
The <tt>set</tt> builtin causes fish to assign the variable <tt>VARIABLE_NAME</tt> the values <tt>VALUES...</tt>.
The <code>set</code> builtin causes fish to assign the variable <code>VARIABLE_NAME</code> the values <code>VALUES...</code>.
\subsection set-description Description
- <tt>-e</tt> or <tt>--erase</tt> causes the specified environment variable to be erased
- <tt>-g</tt> or <tt>--global</tt> causes the specified environment variable to be made global. If this option is not supplied, the specified variable will dissapear when the current block ends
- <tt>-l</tt> or <tt>--local</tt> forces the specified environment variable to be made local to the current block, even if the variable already exists and is non-local
- <tt>-n</tt> or <tt>--names</tt> List only the names of all defined variables
- <tt>-q</tt> or <tt>--query</tt> test if the specified variable names are defined. Does not output anything, but the builtins exit status is the number of variables specified that were not defined.
- <tt>-u</tt> or <tt>--unexport</tt> causes the specified environment not to be exported to child processes
- <tt>-U</tt> or <tt>--universal</tt> causes the specified environment variable to be made universal. If this option is supplied, the variable will be shared between all the current users fish instances on the current computer, and will be preserved across restarts of the shell.
- <tt>-x</tt> or <tt>--export</tt> causes the specified environment variable to be exported to child processes
- <code>-e</code> or <code>--erase</code> causes the specified environment variable to be erased
- <code>-g</code> or <code>--global</code> causes the specified environment variable to be made global. If this option is not supplied, the specified variable will disappear when the current block ends
- <code>-l</code> or <code>--local</code> forces the specified environment variable to be made local to the current block, even if the variable already exists and is non-local
- <code>-n</code> or <code>--names</code> List only the names of all defined variables
- <code>-q</code> or <code>--query</code> test if the specified variable names are defined. Does not output anything, but the builtins exit status is the number of variables specified that were not defined.
- <code>-u</code> or <code>--unexport</code> causes the specified environment not to be exported to child processes
- <code>-U</code> or <code>--universal</code> causes the specified environment variable to be made universal. If this option is supplied, the variable will be shared between all the current users fish instances on the current computer, and will be preserved across restarts of the shell.
- <code>-x</code> or <code>--export</code> causes the specified environment variable to be exported to child processes
If set is called with no arguments, the names and values of all
environment variables are printed.
If set is called with only one argument, the scope of the variable
with the given name will be changed as specified, but it's value will
remain the same. If the variable did not previously exist, it's value
will be an empty string.
environment variables are printed. If some of the scope or export
flags have been given, only the variables matching the specified scope
are printed.
If the \c -e or \c --erase option is specified, the variable
specified by the following arguments will be erased
If a variable is set to more than one value, the variable will be an
array with the specified elements.
array with the specified elements. If a variable is set to zero
elements, it will become an array with zero elements.
If the variable name is one or more array elements, such as <tt>PATH[1
3 7]</tt>, only those array elements specified will be changed.
If the variable name is one or more array elements, such as <code>PATH[1
3 7]</code>, only those array elements specified will be changed.
\subsection set-example Example
<tt>set foo hi</tt> sets the value of the variable foo to be hi.
<code>set -xg</code> will print all global, exported variables.
<tt>set -e smurf</tt> removes the variable \c smurf.
<code>set foo hi</code> sets the value of the variable foo to be hi.
<tt>set PATH[4] ~/bin</tt> changes the fourth element of the \c PATH array to \c ~/bin
<code>set -e smurf</code> removes the variable \c smurf.
<code>set PATH[4] ~/bin</code> changes the fourth element of the \c PATH array to \c ~/bin

View File

@@ -10,11 +10,18 @@ Change the foreground and/or background color of the terminal.
COLOR is one of black, red, green, brown, yellow, blue, magenta,
purple, cyan, white and normal.
- \c -c, \c --print-colors Prints a list of all valid color names
- \c -b, \c --background Set the background color
- \c -o, \c --bold Set bold or extra bright mode
- \c -h, \c --help Display help message and exit
- \c -v, \c --version Display version and exit
Calling <tt>set_color normal</tt> will set the terminal color to
whatever is the default color of the terminal.
Some terminals use the --bold escape sequence to switch to a brighter
color set. On such terminals, <code>set_color white</code> will result
in a grey font color, while <code>set_color --bold white</code> will
result in a white font color.

View File

@@ -5,7 +5,7 @@
<tt>status [OPTION]</tt>
\subsection status-description Description
- <tt>-c</tt> or <tt>--is-command-substitution</tt> returns 0 if fish is currently executing a command usbstitution
- <tt>-c</tt> or <tt>--is-command-substitution</tt> returns 0 if fish is currently executing a command substitution
- <tt>-b</tt> or <tt>--is-block</tt> returns 0 if fish is currently executing a block of code
- <tt>-i</tt> or <tt>--is-interactive</tt> returns 0 if fish is interactive, i.e.connected to a keyboard
- <tt>-l</tt> or <tt>--is-login</tt> returns 0 if fish is a login shell, i.e. if fish should perform login tasks such as setting up the PATH.
- <tt>-l</tt> or <tt>--is-login</tt> returns 0 if fish is a login shell, i.e. if fish should perform login tasks such as setting up the PATH.

View File

@@ -12,7 +12,7 @@ wildcarded values.
\subsection switch-example Example
If the variable \$animal contins the name of an animal, the
If the variable \$animal contains the name of an animal, the
following code would attempt to classify it:
<p>
@@ -22,7 +22,7 @@ switch $animal
echo evil
case wolf dog human moose dolphin whale
echo mammal
case duck goose albatros
case duck goose albatross
echo bird
case shark trout stingray
echo fish
@@ -32,6 +32,6 @@ end
<p>
If the above code was run with \$animal set to \c whale, the output
would be \c mammal.
would be \c mammal.
</p>

View File

@@ -1,14 +0,0 @@
\section tokenize tokenize - tokenize a string
\subsection tokenize-synopsis Synopsis
<tt>tokenize [STRING...]</tt>
\subsection tokenize-description Description
- STRING is the string or list of strings to tokenize. Each token will be printed on a line by itself
- \c -e, \c --with-empty allow empty tokens
- \c -n, \c --no-empty ignore empty tokens (Default)
- <tt>-d DELIMITER</tt>, <tt>--delimiter=DELIMITER</tt> is the list of characters that will be used as delimiters. If unspecified, the IFS environment variable will be used as the delimiter string,
- \c -h, \c --help Display help message and exit
- \c -v, \c --version Display version and exit

37
doc_src/trap.txt Normal file
View File

@@ -0,0 +1,37 @@
\section trap trap - perform an action when the shell receives a signal
\subsection trap-synopsis Synopsis
<tt>trap [OPTIONS] [[ARG] SIGSPEC ... ]</tt>
\subsection trap-description Description
Trap is a shellscript wrapper around the fish event delivery
framework. IT is defined for backwards compatibility reasons. For
other uses, it is recommended to define a <a
href='index.html#event'>event handler</a>.
- ARG is the command to be executed on signal delivery
- SIGSPEC is the name of the signal to trap
- \c -h or \c --help Display help and exit
- \c -l or \c --list-signals print a list of signal names
- \c -p or \c --print print all defined signal handlers
If ARG and SIGSPEC are both specified, ARG is the command to be
executed when the signal specified by SIGSPEC is delivered.
If ARG is absent (and there is a single SIGSPEC) or -, each specified
signal is reset to its original disposition (the value it had upon
entrance to the shell). If ARG is the null string the signal
specified by each SIGSPEC is ignored by the shell and by the commands
it invokes.
If ARG is not present and -p has been supplied, then the trap commands
associated with each SIGSPEC are displayed. If no arguments are
supplied or if only -p is given, trap prints the list of commands
associated with each signal.
Signal names are case insensitive and the SIG prefix is optional.
The return status is 1 if any SIGSPEC is invalid; otherwise trap
returns 0.

View File

@@ -6,11 +6,11 @@
\subsection type-description Description
With no options, indicate how each name would be interpreted if used as a command name.
With no options, indicate how each name would be interpreted if used as a command name.
- \c -h or \c --help print this message
- \c -a or \c --all print all of possible definitions of the specified names
- \c -f or \c --no-functions supresses function and builtin lookup
- \c -f or \c --no-functions suppresses function and builtin lookup
- \c -t or \c --type print a string which is one of alias, keyword, function, builtin, or file if name is an alias, shell reserved word, function, builtin, or disk file, respectively
- \c -p or \c --path either return the name of the disk file that would be executed if name were specified as a command name, or nothing if 'type -t name' would not return 'file'
- \c -P or \c --force-path either return the name of the disk file that would be executed if name were specified as a command name, or nothing no file with the specified name could be found in the PATH

View File

@@ -1,5 +1,5 @@
\section ulimit ulimit - Set or get the shells resurce usage limits
\section ulimit ulimit - Set or get the shells resource usage limits
\subsection ulimit-synopsis Synopsis
<tt>ulimit [OPTIONS] [LIMIT]</tt>
@@ -38,7 +38,7 @@ except for -t, which is in seconds and -n and -u, which are unscaled
values. The return status is 0 unless an invalid option or argument is
supplied, or an error occurs while setting a new limit.
The fish implementation of ulimit should behave identically to the implementation in bash, except for these differences:
The fish implementation of ulimit should behave identically to the implementation in bash, except for these differences:
- Fish ulimit supports GNU-style long options for all switches
- Fish ulimit does not support the -p option for getting the pipe size. The bash implementation consists of a compile-time check that empirically guesses this number by writing to a pipe and waiting for SIGPIPE.

View File

@@ -1,5 +1,5 @@
\section umask umask - Set or get the shells resurce usage limits
\section umask umask - Set or get the shells resource usage limits
\subsection umask-synopsis Synopsis
<code>umask [OPTIONS] [MASK]</code>
@@ -10,9 +10,30 @@ With no argument, the current file-creation mask is printed, if an
argument is specified, it is the new file creation mask. The mask may
be specified as an octal number, in which case it is interpreted as
the rights that should be masked away, i.e. it is the inverse of the
file permissions any new files will have. If a synbolic mask is
specified, the actual file permission bits, and not the inverse, are
specified.
file permissions any new files will have.
If a symbolic mask is specified, the actual file permission bits, and
not the inverse, should be specified. A symbolic mask is a comma
separated list of rights. Each right consists of three parts:
- The first part specifies to whom this set of right applies, and can
be one of \c u, \c g, \c o or \c a, where \c u specifies the user who
owns the file, \c g specifies the group owner of the file, \c o
specific other users rights and \c a specifies all three should be
changed.
- The second part of a right specifies the mode, and can be one of \c
=, \c + or \c -, where \c = specifies that the rights should be set to
the new value, \c + specifies that the specified right should be added
to those previously specified and \c - specifies that the specified
rights should be removed from those previously specified.
- The third part of a right specifies what rights should be changed
and can be any combination of \c r, \c w and \c x, representing
read, write and execute rights.
If the first and second parts are skipped, they are assumed to be \c a
and \c =, respectively. As an example, <code>r,u+w</code> means all
users should have read access and the file owner should also have
write access.
- <code>-h</code> or <code>--help</code> print this message
- <code>-S</code> or <code>--symbolic</code> prints the file-creation mask in symbolic form instead of octal form. Use <code>man chmod</code> for more information.

15
doc_src/vared.txt Normal file
View File

@@ -0,0 +1,15 @@
\section vared vared - Interactively edit the value of an environment variable
\subsection vared-synopsis Synopsis
<tt>vared VARIABLE_NAME</tt>
\subsection vared-description Description
vared is used to interactively edit the value of an environment
variable. Array variables as a whole can not be edited using vared,
but individual array elements can.
\subsection vared-example Example
<code>vared PATH[3]</code> edits the third element of the PATH array

427
env.c
View File

@@ -25,7 +25,12 @@
#include <termio.h>
#endif
#if HAVE_TERM_H
#include <term.h>
#elif HAVE_NCURSES_TERM_H
#include <ncurses/term.h>
#endif
#include <errno.h>
#include "util.h"
@@ -41,12 +46,17 @@
#include "env_universal.h"
#include "input_common.h"
#include "event.h"
#include "translate.h"
#include "complete.h"
/**
Command used to start fishd
*/
#define FISHD_CMD L"if which fishd >/dev/null; fishd ^/tmp/fish.%s.log; end"
#define FISHD_CMD L"if which fishd >/dev/null; fishd ^/tmp/fishd.%s.log; end"
/**
Value denoting a null string
*/
#define ENV_NULL L"\x1d"
/**
@@ -116,6 +126,11 @@ static hash_table_t *global;
*/
static hash_table_t env_read_only;
/**
Table of variables whose value is dynamically calculated, such as umask, status, etc
*/
static hash_table_t env_electric;
/**
Exported variable array used by execv
*/
@@ -133,19 +148,6 @@ static buffer_t export_buffer;
*/
static int has_changed = 1;
/**
Free hash key and hash value
*/
static void clear_hash_entry( const void *key, const void *data )
{
var_entry_t *entry = (var_entry_t *)data;
if( entry->export )
has_changed = 1;
free( (void *)key );
free( (void *)data );
}
/**
This stringbuffer is used to store the value of dynamically
generated variables, such as history.
@@ -163,6 +165,36 @@ static int get_names_show_exported;
*/
static int get_names_show_unexported;
/**
List of all locale variable names
*/
static const wchar_t *locale_variable[] =
{
L"LANG",
L"LC_ALL",
L"LC_COLLATE",
L"LC_CTYPE",
L"LC_MESSAGES",
L"LC_MONETARY",
L"LC_NUMERIC",
L"LC_TIME",
(void *)0
}
;
/**
Free hash key and hash value
*/
static void clear_hash_entry( const void *key, const void *data )
{
var_entry_t *entry = (var_entry_t *)data;
if( entry->export )
has_changed = 1;
free( (void *)key );
free( (void *)data );
}
/**
When fishd isn't started, this function is provided to
env_universal as a callback, it tries to start up fishd. It's
@@ -174,7 +206,7 @@ static void start_fishd()
{
string_buffer_t cmd;
struct passwd *pw;
sb_init( &cmd );
pw = getpwuid(getuid());
@@ -182,7 +214,7 @@ static void start_fishd()
if( !pw )
{
debug( 0, L"Could not get user information" );
debug( 0, _( L"Could not get user information" ) );
return;
}
@@ -194,12 +226,114 @@ static void start_fishd()
sb_destroy( &cmd );
}
/**
Return the current umask value.
*/
static mode_t get_umask()
{
mode_t res;
res = umask( 0 );
umask( res );
return res;
}
/**
Checks if the specified variable is a locale variable
*/
static int is_locale( const wchar_t *key )
{
int i;
for( i=0; locale_variable[i]; i++ )
if( wcscmp(locale_variable[i], key ) == 0 )
return 1;
return 0;
}
/**
Properly sets all locale information
*/
static void handle_locale()
{
const wchar_t *lc_all = env_get( L"LC_ALL" );
const wchar_t *lang;
int i;
wchar_t *old = wcsdup(wsetlocale( LC_MESSAGES, (void *)0 ));
/*
Array of locale constants corresponding to the local variable names defined in locale_variable
*/
static const int cat[] =
{
0,
LC_ALL,
LC_COLLATE,
LC_CTYPE,
LC_MESSAGES,
LC_MONETARY,
LC_NUMERIC,
LC_TIME
}
;
if( lc_all )
{
wsetlocale( LC_ALL, lc_all );
}
else
{
lang = env_get( L"LANG" );
if( lang )
{
wsetlocale( LC_ALL, lang );
}
for( i=2; locale_variable[i]; i++ )
{
const wchar_t *val = env_get( locale_variable[i] );
if( val )
wsetlocale( cat[i], val );
}
}
if( wcscmp( wsetlocale( LC_MESSAGES, (void *)0 ), old ) != 0 )
{
/* Try to make change known to gettext. */
#ifdef HAVE__NL_MSG_CAT_CNTR
{
extern int _nl_msg_cat_cntr;
++_nl_msg_cat_cntr;
}
#elif HAVE_DCGETTEXT
dcgettext("fish","Changing language to English",LC_MESSAGES);
#endif
if( is_interactive )
{
complete_destroy();
complete_init();
debug( 0, _(L"Changing language to English") );
}
}
free( old );
}
/**
Universal variable callback function. This function makes sure the
proper events are triggered when an event occurs.
*/
static void universal_callback( int type,
const wchar_t *name,
const wchar_t *val )
{
wchar_t *str=0;
if( is_locale( name ) )
handle_locale();
switch( type )
{
case SET:
@@ -213,7 +347,6 @@ static void universal_callback( int type,
if( str )
{
array_list_t arg;
event_t ev;
has_changed=1;
@@ -222,29 +355,108 @@ static void universal_callback( int type,
ev.param1.variable=name;
ev.function_name=0;
al_init( &arg );
al_push( &arg, L"VARIABLE" );
al_push( &arg, str );
al_push( &arg, name );
event_fire( &ev, &arg );
al_destroy( &arg );
al_init( &ev.arguments );
al_push( &ev.arguments, L"VARIABLE" );
al_push( &ev.arguments, str );
al_push( &ev.arguments, name );
event_fire( &ev );
al_destroy( &ev.arguments );
}
}
/**
Make sure the PATH variable contains the essaential directories
*/
static void setup_path()
{
wchar_t *path;
int i, j;
array_list_t l;
const wchar_t *path_el[] =
{
L"/bin",
L"/usr/bin",
PREFIX L"/bin",
0
}
;
path = env_get( L"PATH" );
if( !path )
{
env_set( L"PATH", 0, ENV_EXPORT | ENV_GLOBAL | ENV_USER );
path=0;
}
al_init( &l );
if( path )
expand_variable_array( path, &l );
for( j=0; path_el[j]; j++ )
{
int has_el=0;
for( i=0; i<al_get_count( &l); i++ )
{
wchar_t * el = (wchar_t *)al_get( &l, i );
size_t len = wcslen( el );
while( (len > 0) && (el[len-1]==L'/') )
len--;
if( (wcslen( path_el[j] ) == len) && (wcsncmp( el, path_el[j], len)==0) )
{
has_el = 1;
}
}
if( !has_el )
{
string_buffer_t b;
debug( 3, L"directory %ls was missing", path_el[j] );
sb_init( &b );
if( path )
{
sb_append( &b, path );
}
sb_append2( &b,
ARRAY_SEP_STR,
path_el[j],
(void *)0 );
env_set( L"PATH", (wchar_t *)b.buff, ENV_GLOBAL | ENV_EXPORT );
sb_destroy( &b );
al_foreach( &l, (void (*)(const void *))&free );
path = env_get( L"PATH" );
al_truncate( &l, 0 );
expand_variable_array( path, &l );
}
}
al_foreach( &l, (void (*)(const void *))&free );
al_destroy( &l );
}
void env_init()
{
char **p;
struct passwd *pw;
wchar_t *uname;
sb_init( &dyn_var );
b_init( &export_buffer );
/*
These variables can not be altered directly by the user
*/
hash_init( &env_read_only, &hash_wcs_func, &hash_wcs_cmp );
hash_put( &env_read_only, L"status", L"" );
hash_put( &env_read_only, L"history", L"" );
hash_put( &env_read_only, L"_", L"" );
@@ -253,11 +465,22 @@ void env_init()
hash_put( &env_read_only, L"PWD", L"" );
/*
HOME should be writeable by root, since this is often a
Names of all dynamically calculated variables
*/
hash_init( &env_electric, &hash_wcs_func, &hash_wcs_cmp );
hash_put( &env_electric, L"history", L"" );
hash_put( &env_electric, L"status", L"" );
hash_put( &env_electric, L"umask", L"" );
/*
HOME and USER should be writeable by root, since this can be a
convenient way to install software.
*/
if( getuid() != 0 )
{
hash_put( &env_read_only, L"HOME", L"" );
hash_put( &env_read_only, L"USER", L"" );
}
top = malloc( sizeof(env_node_t) );
top->next = 0;
@@ -267,6 +490,11 @@ void env_init()
global_env = top;
global = &top->env;
/*
Now the environemnt variable handling is set up, the next step
is to insert valid data
*/
/*
Import environment variables
*/
@@ -276,12 +504,13 @@ void env_init()
wchar_t *pos;
key = str2wcs(*p);
if( !key )
continue;
val = wcschr( key, L'=' );
if( val == 0 )
env_set( key, L"", ENV_EXPORT );
else
@@ -296,13 +525,29 @@ void env_init()
*pos = ARRAY_SEP;
pos++;
}
env_set( key, val, ENV_EXPORT | ENV_GLOBAL );
}
free(key);
}
}
env_universal_init( env_get( L"FISHD_SOKET_DIR"),
/*
Set up the PATH variable
*/
setup_path();
/*
Set up the USER variable
*/
pw = getpwuid( getuid() );
if( pw )
{
uname = str2wcs( pw->pw_name );
env_set( L"USER", uname, ENV_GLOBAL | ENV_EXPORT );
free( uname );
}
env_universal_init( env_get( L"FISHD_SOCKET_DIR"),
env_get( L"USER" ),
&start_fishd,
&universal_callback );
@@ -321,6 +566,8 @@ void env_destroy()
env_pop();
hash_destroy( &env_read_only );
hash_destroy( &env_electric );
hash_foreach( global, &clear_hash_entry );
hash_destroy( global );
@@ -357,7 +604,7 @@ 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 )
@@ -371,42 +618,42 @@ void env_set( const wchar_t *key,
int done=0;
event_t ev;
array_list_t ev_list;
int is_universal = 0;
if( (var_mode & ENV_USER ) &&
hash_get( &env_read_only, key ) )
{
return;
}
if( wcscmp(key, L"LANG" )==0 )
{
fish_setlocale(LC_ALL,val);
}
if( wcscmp( key, L"umask" ) == 0)
{
wchar_t *end;
int mask;
/*
Set the new umask
*/
if( val && wcslen(val) )
{
errno=0;
mask = wcstol( val, &end, 8 );
if( !errno && !*end )
if( !errno && (!*end) && (mask <= 0777) && (mask >= 0) )
{
umask( mask );
}
}
/*
Do not actually create a umask variable, on env_get, it will be calculated dynamically
*/
return;
}
/*
Zero element arrays are internaly not coded as null but as this placeholder string
*/
if( !val && ( var_mode & ENV_USER ) )
if( !val )
{
val = ENV_NULL;
}
@@ -467,8 +714,11 @@ void env_set( const wchar_t *key,
else
{
if( !proc_had_barrier)
{
proc_had_barrier=1;
env_universal_barrier();
}
if( env_universal_get( key ) )
{
int export = 0;
@@ -490,7 +740,8 @@ void env_set( const wchar_t *key,
else
{
/*
New variable with unspecified scope. The default scope is the innermost scope that is shadowing
New variable with unspecified scope. The default
scope is the innermost scope that is shadowing
*/
node = top;
while( node->next && !node->new_scope )
@@ -541,18 +792,24 @@ void env_set( const wchar_t *key,
ev.param1.variable = key;
ev.function_name = 0;
al_init( &ev_list );
al_push( &ev_list, L"VARIABLE" );
al_push( &ev_list, key );
al_init( &ev.arguments );
al_push( &ev.arguments, L"VARIABLE" );
al_push( &ev.arguments, key );
// debug( 1, L"env_set: fire events on variable %ls", key );
event_fire( &ev, &ev_list );
event_fire( &ev );
// debug( 1, L"env_set: return from event firing" );
al_destroy( &ev_list );
al_destroy( &ev.arguments );
}
if( is_locale( key ) )
{
handle_locale();
}
}
/**
Attempt to remove/free the specified key/value pair from the
specified hash table.
@@ -600,6 +857,10 @@ void env_remove( const wchar_t *key, int var_mode )
{
env_universal_remove( key );
}
if( is_locale( key ) )
handle_locale();
}
@@ -628,7 +889,7 @@ wchar_t *env_get( const wchar_t *key )
wchar_t *next = history_get( i-add_current );
if( !next )
{
debug( 1, L"No history at idx %d\n", i );
debug( 1, _( L"No history item at index %d\n" ), i );
break;
}
@@ -656,6 +917,12 @@ wchar_t *env_get( const wchar_t *key )
sb_printf( &dyn_var, L"%d", proc_get_last_status() );
return (wchar_t *)dyn_var.buff;
}
else if( wcscmp( key, L"umask" )==0 )
{
sb_clear( &dyn_var );
sb_printf( &dyn_var, L"0%0.3o", get_umask() );
return (wchar_t *)dyn_var.buff;
}
while( env != 0 )
{
@@ -677,7 +944,11 @@ wchar_t *env_get( const wchar_t *key )
env = env->next;
}
if( !proc_had_barrier)
{
proc_had_barrier=1;
env_universal_barrier();
}
item = env_universal_get( key );
if( !item || (wcscmp( item, ENV_NULL )==0))
@@ -694,7 +965,7 @@ int env_exist( const wchar_t *key )
env_node_t *env = top;
wchar_t *item;
if( hash_get( &env_read_only, key ) )
if( hash_get( &env_read_only, key ) || hash_get( &env_electric, key ) )
{
return 1;
}
@@ -714,12 +985,19 @@ int env_exist( const wchar_t *key )
env = env->next;
}
if( !proc_had_barrier)
{
proc_had_barrier=1;
env_universal_barrier();
}
item = env_universal_get( key );
return item != 0;
}
/**
Returns true if the specified scope or any non-shadowed non-global subscopes contain an exported variable.
*/
static int local_scope_exports( env_node_t *n )
{
@@ -755,8 +1033,20 @@ void env_pop()
{
if( &top->env != global )
{
int i;
int locale_changed = 0;
env_node_t *killme = top;
for( i=0; locale_variable[i]; i++ )
{
if( hash_get( &killme->env, locale_variable[i] ) )
{
locale_changed = 1;
break;
}
}
if( killme->new_scope )
{
has_changed |= killme->export || local_scope_exports( killme->next );
@@ -766,12 +1056,15 @@ void env_pop()
hash_foreach( &killme->env, &clear_hash_entry );
hash_destroy( &killme->env );
free( killme );
if( locale_changed )
handle_locale();
}
else
{
debug( 0,
L"Tried to pop empty environment stack." );
_( L"Tried to pop empty environment stack." ) );
sanity_lose();
}
}
@@ -788,9 +1081,14 @@ static void add_key_to_hash( const void *key,
var_entry_t *e = (var_entry_t *)data;
if( ( e->export && get_names_show_exported) ||
( !e->export && get_names_show_unexported) )
{
hash_put( (hash_table_t *)aux, key, 0 );
}
}
/**
Add key to hashtable
*/
static void add_to_hash( const void *k, void *aux )
{
hash_put( (hash_table_t *)aux,
@@ -798,6 +1096,16 @@ static void add_to_hash( const void *k, void *aux )
0 );
}
/**
Add key to list
*/
static void add_key_to_list( const void * key,
const void * val,
void *aux )
{
al_push( (array_list_t *)aux, key );
}
void env_get_names( array_list_t *l, int flags )
{
@@ -844,11 +1152,9 @@ void env_get_names( array_list_t *l, int flags )
hash_foreach2( &global_env->env,
add_key_to_hash,
&names );
if( get_names_show_unexported )
{
al_push( l, L"history" );
al_push( l, L"status" );
}
hash_foreach2( &env_electric, &add_key_to_list, l );
if( get_names_show_exported )
{
@@ -934,8 +1240,11 @@ static void export_func2( const void *k, const void *v, void *aux )
char **env_export_arr( int recalc)
{
if( recalc && !proc_had_barrier)
{
proc_had_barrier=1;
env_universal_barrier();
}
if( has_changed )
{
array_list_t uni;

View File

@@ -11,12 +11,19 @@
#include <pwd.h>
#include <errno.h>
#include <fcntl.h>
#if HAVE_NCURSES_H
#include <ncurses.h>
#else
#include <curses.h>
#endif
#if HAVE_TERM_H
#include <term.h>
#elif HAVE_NCURSES_TERM_H
#include <ncurses/term.h>
#endif
#include <signal.h>
#include "util.h"
@@ -112,24 +119,21 @@ static int get_socket( int fork_ok )
local.sun_family = AF_UNIX;
strcpy(local.sun_path, name );
free( name );
len = strlen(local.sun_path) + sizeof(local.sun_family);
len = sizeof(local);
if( connect( s, (struct sockaddr *)&local, len) == -1 )
{
close( s );
if( fork_ok )
if( fork_ok && start_fishd )
{
debug( 2, L"Could not connect to socket %d, starting fishd", s );
if( start_fishd )
{
start_fishd();
}
start_fishd();
return get_socket( 0 );
}
debug( 3, L"Could not connect to socket %d, already tried forking, giving up", s );
debug( 2, L"Could not connect to socket %d, already tried manual restart (or no command supplied), giving up", s );
return -1;
}
@@ -174,7 +178,7 @@ static void check_connection()
if( env_universal_server.killme )
{
debug( 2, L"Lost connection to universal variable server." );
debug( 3, L"Lost connection to universal variable server." );
close( env_universal_server.fd );
env_universal_server.fd = -1;
env_universal_server.killme=0;
@@ -193,7 +197,7 @@ static void reconnect()
if( get_socket_count >= RECONNECT_COUNT )
return;
debug( 2, L"Get new fishd connection" );
debug( 3, L"Get new fishd connection" );
init = 0;
env_universal_server.fd = get_socket(1);
@@ -262,6 +266,8 @@ int env_universal_read_all()
if( !init)
return 0;
debug( 3, L"env_universal_read_all()" );
if( env_universal_server.fd == -1 )
{
reconnect();
@@ -290,11 +296,13 @@ wchar_t *env_universal_get( const wchar_t *name )
if( !name )
return 0;
debug( 3, L"env_universal_get( \"%ls\" )", name );
return env_universal_common_get( name );
}
int env_universal_get_export( const wchar_t *name )
{
debug( 3, L"env_universal_get_export()" );
return env_universal_common_get_export( name );
}
@@ -305,7 +313,7 @@ void env_universal_barrier()
if( !init || ( env_universal_server.fd == -1 ))
return;
barrier_reply = 0;
/*
@@ -330,6 +338,7 @@ void env_universal_barrier()
if( env_universal_server.fd == -1 )
{
reconnect();
debug( 2, L"barrier interrupted, exiting" );
return;
}
@@ -347,6 +356,7 @@ void env_universal_barrier()
if( env_universal_server.fd == -1 )
{
reconnect();
debug( 2, L"barrier interrupted, exiting (2)" );
return;
}
FD_ZERO( &fds );
@@ -365,7 +375,7 @@ void env_universal_set( const wchar_t *name, const wchar_t *value, int export )
if( !init )
return;
debug( 3, L"env_universal_set( %ls, %ls )", name, value );
debug( 3, L"env_universal_set( \"%ls\", \"%ls\" )", name, value );
msg = create_message( export?SET_EXPORT:SET,
name,
@@ -388,8 +398,8 @@ void env_universal_remove( const wchar_t *name )
if( !init )
return;
debug( 2,
L"env_universal_remove( %ls )",
debug( 3,
L"env_universal_remove( \"%ls\" )",
name );
msg= create_message( ERASE, name, 0);

View File

@@ -1,4 +1,4 @@
/** \file env_universl.h
/** \file env_universal.h
Universal variable client library
*/
@@ -18,7 +18,7 @@ extern connection_t env_universal_server;
Initialize the envuni library
*/
void env_universal_init();
/*
/**
Free memory used by envuni
*/
void env_universal_destroy();

View File

@@ -65,12 +65,12 @@
should be exported. Obviously, it needs to be allocated large
enough to fit the value string.
*/
typedef struct var_entry
typedef struct var_uni_entry
{
int export; /**< Whether the variable should be exported */
wchar_t val[0]; /**< The value of the variable */
}
var_entry_t;
var_uni_entry_t;
static void parse_message( wchar_t *msg,
@@ -81,6 +81,9 @@ static void parse_message( wchar_t *msg,
*/
hash_table_t env_universal_var;
/**
Callback function, should be called on all events
*/
void (*callback)( int type,
const wchar_t *key,
const wchar_t *val );
@@ -105,6 +108,9 @@ void env_universal_common_init( void (*cb)(int type, const wchar_t *key, const w
hash_init( &env_universal_var, &hash_wcs_func, &hash_wcs_cmp );
}
/**
Free both key and data
*/
static void erase( const void *key,
const void *data )
{
@@ -186,6 +192,9 @@ void read_message( connection_t *src )
}
}
/**
Remove variable with specified name
*/
static void remove_entry( wchar_t *name )
{
void *k, *v;
@@ -197,6 +206,9 @@ static void remove_entry( wchar_t *name )
free( v );
}
/**
Test if the message msg contains the command cmd
*/
static int match( const wchar_t *msg, const wchar_t *cmd )
{
size_t len = wcslen( cmd );
@@ -209,7 +221,9 @@ static int match( const wchar_t *msg, const wchar_t *cmd )
return 1;
}
/**
Parse message msg
*/
static void parse_message( wchar_t *msg,
connection_t *src )
{
@@ -239,8 +253,8 @@ static void parse_message( wchar_t *msg,
val = unescape( val, 0 );
var_entry_t *entry =
malloc( sizeof(var_entry_t) + sizeof(wchar_t)*(wcslen(val)+1) );
var_uni_entry_t *entry =
malloc( sizeof(var_uni_entry_t) + sizeof(wchar_t)*(wcslen(val)+1) );
if( !entry )
die_mem();
entry->export=export;
@@ -307,8 +321,13 @@ static void parse_message( wchar_t *msg,
}
}
int try_send( message_t *msg,
int fd )
/**
Attempt to send the specified message to the specified file descriptor
\return 1 on sucess, 0 if the message could not be sent without blocking and -1 on error
*/
static int try_send( message_t *msg,
int fd )
{
debug( 3,
@@ -478,7 +497,7 @@ static void add_key_to_hash( const void *key,
const void *data,
void *aux )
{
var_entry_t *e = (var_entry_t *)data;
var_uni_entry_t *e = (var_uni_entry_t *)data;
if( ( e->export && get_names_show_exported) ||
( !e->export && get_names_show_unexported) )
al_push( (array_list_t *)aux, key );
@@ -498,7 +517,7 @@ void env_universal_common_get_names( array_list_t *l,
wchar_t *env_universal_common_get( const wchar_t *name )
{
var_entry_t *e = (var_entry_t *)hash_get( &env_universal_var, name );
var_uni_entry_t *e = (var_uni_entry_t *)hash_get( &env_universal_var, name );
if( e )
return e->val;
return 0;
@@ -506,18 +525,28 @@ wchar_t *env_universal_common_get( const wchar_t *name )
int env_universal_common_get_export( const wchar_t *name )
{
var_entry_t *e = (var_entry_t *)hash_get( &env_universal_var, name );
var_uni_entry_t *e = (var_uni_entry_t *)hash_get( &env_universal_var, name );
if( e )
return e->export;
return 0;
}
/**
Adds a variable creation message about the specified variable to
the specified queue. The function signature is non-obvious since
this function is used together with hash_foreach2, which requires
the specified function signature.
\param k the variable name
\param v the variable value
\param q the queue to add the message to
*/
static void enqueue( const void *k,
const void *v,
void *q)
{
const wchar_t *key = (const wchar_t *)k;
const var_entry_t *val = (const var_entry_t *)v;
const var_uni_entry_t *val = (const var_uni_entry_t *)v;
dyn_queue_t *queue = (dyn_queue_t *)q;
message_t *msg = create_message( val->export?SET_EXPORT:SET, key, val->val );

View File

@@ -88,7 +88,13 @@ typedef struct connection
*/
typedef struct
{
/**
Number of queues that contain this message. Once this reaches zero, the message should be deleted
*/
int count;
/**
Message body. The message must be allocated using enough memory to actually contain the message.
*/
char body[0];
}
message_t;
@@ -136,6 +142,9 @@ wchar_t *env_universal_common_get( const wchar_t *name );
*/
int env_universal_common_get_export( const wchar_t *name );
/**
Add messages about all existing variables to the specified connection
*/
void enqueue_all( connection_t *c );

173
event.c
View File

@@ -1,6 +1,6 @@
/** \file function.c
/** \file event.c
Functions for storing and retrieving function information.
Functions for handling event triggers
*/
#include <stdlib.h>
@@ -13,12 +13,14 @@
#include "config.h"
#include "util.h"
#include "wutil.h"
#include "function.h"
#include "proc.h"
#include "parser.h"
#include "common.h"
#include "event.h"
#include "signal.h"
#include "translate.h"
/**
Number of signals that can be queued before an overflow occurs
@@ -31,13 +33,22 @@
*/
typedef struct
{
/**
Number of delivered signals
*/
int count;
/**
Whether signals have been skipped
*/
int overflow;
/**
Array of signal events
*/
int signal[SIG_UNHANDLED_MAX];
}
signal_list_t;
/*
/**
The signal event list. Actually two separate lists. One which is
active, which is the one that new events is written to. The inactive
one contains the events that are currently beeing performed.
@@ -58,6 +69,12 @@ static array_list_t *events;
*/
static array_list_t *killme;
/**
List of events that have been sent but have not yet been delivered because they are blocked.
*/
static array_list_t *blocked;
/**
Tests if one event instance matches the definition of a event
class. If the class defines a function name, that will also be a
@@ -111,7 +128,7 @@ static int event_match( event_t *class, event_t *instance )
Create an identical copy of an event. Use deep copying, i.e. make
duplicates of any strings used as well.
*/
static event_t *event_copy( event_t *event )
static event_t *event_copy( event_t *event, int copy_arguments )
{
event_t *e = malloc( sizeof( event_t ) );
if( !e )
@@ -124,12 +141,57 @@ static event_t *event_copy( event_t *event )
if( e->type == EVENT_VARIABLE )
e->param1.variable = wcsdup( e->param1.variable );
al_init( &e->arguments );
if( copy_arguments )
{
int i;
for( i=0; i<al_get_count( &event->arguments ); i++ )
{
al_push( &e->arguments, wcsdup( (wchar_t *)al_get( &event->arguments, i ) ) );
}
}
return e;
}
/**
Test if specified event is blocked
*/
static int event_is_blocked( event_t *e )
{
block_t *block;
event_block_t *eb;
for( block = current_block; block; block = block->outer )
{
for( eb = block->first_event_block; eb; eb=eb->next )
{
if( eb->type & (1<<EVENT_ANY ) )
return 1;
if( eb->type & (1<<e->type) )
return 1;
}
}
for( eb = global_event_block; eb; eb=eb->next )
{
if( eb->type & (1<<EVENT_ANY ) )
return 1;
if( eb->type & (1<<e->type) )
return 1;
return 1;
}
return 0;
}
void event_add_handler( event_t *event )
{
event_t *e = event_copy( event );
event_t *e;
e = event_copy( event, 0 );
if( !events )
events = al_new();
@@ -259,11 +321,13 @@ static int event_is_killed( event_t *e )
matches' path. This means that nothing is allocated/initialized
unless that is needed.
*/
static void event_fire_internal( event_t *event, array_list_t *arguments )
static void event_fire_internal( event_t *event )
{
int i, j;
string_buffer_t *b=0;
array_list_t *fire=0;
int was_subshell = is_subshell;
/*
First we free all events that have been removed
@@ -325,9 +389,9 @@ static void event_fire_internal( event_t *event, array_list_t *arguments )
sb_append( b, criterion->function_name );
for( j=0; j<al_get_count(arguments); j++ )
for( j=0; j<al_get_count(&event->arguments); j++ )
{
wchar_t *arg_esc = escape( (wchar_t *)al_get( arguments, j), 0 );
wchar_t *arg_esc = escape( (wchar_t *)al_get( &event->arguments, j), 0 );
sb_append( b, L" " );
sb_append( b, arg_esc );
free( arg_esc );
@@ -335,15 +399,20 @@ static void event_fire_internal( event_t *event, array_list_t *arguments )
// debug( 1, L"Event handler fires command '%ls'", (wchar_t *)b->buff );
/*
Event handlers are not part of the main flow of code, so
they are marked as non-interactive and as a subshell
*/
is_subshell=1;
is_interactive=1;
eval( (wchar_t *)b->buff, 0, TOP );
is_subshell=0;
is_interactive=1;
}
/*
Restore interactivity flags
*/
is_subshell = was_subshell;
if( b )
{
sb_destroy( b );
@@ -366,15 +435,40 @@ static void event_fire_internal( event_t *event, array_list_t *arguments )
/**
Handle all pending signal events
*/
static void event_fire_signal_events()
static void event_fire_delayed()
{
int i;
if( blocked && is_event==1)
{
array_list_t *new_blocked = 0;
for( i=0; i<al_get_count( blocked ); i++ )
{
event_t *e = (event_t *)al_get( blocked, i );
if( event_is_blocked( e ) )
{
if( !new_blocked )
new_blocked = al_new();
al_push( new_blocked, e );
}
else
{
event_fire_internal( e );
event_free( e );
}
}
al_destroy( blocked );
free( blocked );
blocked = new_blocked;
}
while( sig_list[active_list].count > 0 )
{
int i;
signal_list_t *lst;
event_t e;
array_list_t a;
al_init( &a );
al_init( &e.arguments );
/*
Switch signal lists
@@ -393,7 +487,7 @@ static void event_fire_signal_events()
if( lst->overflow )
{
debug( 0, L"Signal list overflow. Signals have been ignored" );
debug( 0, _( L"Signal list overflow. Signals have been ignored." ) );
}
/*
@@ -402,19 +496,27 @@ static void event_fire_signal_events()
for( i=0; i<lst->count; i++ )
{
e.param1.signal = lst->signal[i];
al_set( &a, 0, sig2wcs( e.param1.signal ) );
event_fire_internal( &e, &a );
al_set( &e.arguments, 0, sig2wcs( e.param1.signal ) );
if( event_is_blocked( &e ) )
{
if( !blocked )
blocked = al_new();
al_push( blocked, event_copy(&e, 1) );
}
else
{
event_fire_internal( &e );
}
}
al_destroy( &a );
al_destroy( &e.arguments );
}
}
void event_fire( event_t *event, array_list_t *arguments )
void event_fire( event_t *event )
{
//int is_event_old = is_event;
is_event++;
if( event && (event->type == EVENT_SIGNAL) )
@@ -429,17 +531,29 @@ void event_fire( event_t *event, array_list_t *arguments )
sig_list[active_list].signal[sig_list[active_list].count++]=event->param1.signal;
else
sig_list[active_list].overflow=1;
}
else
{
event_fire_signal_events();
event_fire_delayed();
if( event )
event_fire_internal( event, arguments );
{
if( event_is_blocked( event ) )
{
if( !blocked )
blocked = al_new();
al_push( blocked, event_copy(event, 1) );
}
else
{
event_fire_internal( event );
}
}
}
is_event--;// = is_event_old;
is_event--;
}
@@ -468,9 +582,14 @@ void event_destroy()
void event_free( event_t *e )
{
/*
When apropriate, we clear the argument vector
*/
al_foreach( &e->arguments, (void (*)(const void *))&free );
al_destroy( &e->arguments );
free( (void *)e->function_name );
if( e->type == EVENT_VARIABLE )
free( (void *)e->param1.variable );
free( e );
}

30
event.h
View File

@@ -1,6 +1,6 @@
/** \file event.h
Event handling library
Functions for handling event triggers
*/
#ifndef FISH_EVENT_H
@@ -17,6 +17,9 @@ Event handling library
*/
#define EVENT_ANY_PID 0
/**
Enumeration of event types
*/
enum
{
EVENT_ANY, /**< Matches any event type (Not always any event, as the function name may limit the choice as well */
@@ -40,18 +43,24 @@ typedef struct
Type of event
*/
int type;
/**
The type-specific parameter
*/
union
{
/**
Signal number for signal-type events.Use EVENT_ANY_SIGNAL to match any signal
Signal number for signal-type events.Use EVENT_ANY_SIGNAL
to match any signal
*/
int signal;
/**
Variable name for variable-type events.
Variable name for variable-type events.
*/
const wchar_t *variable;
/**
Process id for process-type events. Use EVENT_ANY_PID to match any pid.
Process id for process-type events. Use EVENT_ANY_PID to
match any pid.
*/
pid_t pid;
/**
@@ -61,7 +70,17 @@ typedef struct
} param1;
/**
The name of the event handler function
*/
const wchar_t *function_name;
/**
The argument list. Only used when sending a new event using
event_fire. In all other situations, the value of this variable
is ignored.
*/
array_list_t arguments;
}
event_t;
@@ -93,9 +112,8 @@ int event_get( event_t *criterion, array_list_t *out );
dispatched.
\param event the specific event whose handlers should fire
\param arguments the argument string to send to the event handler function
*/
void event_fire( event_t *event, array_list_t *arguments );
void event_fire( event_t *event );
/**
Initialize the event-handling library

384
exec.c
View File

@@ -36,11 +36,12 @@
#include "expand.h"
#include "signal.h"
#include "env_universal.h"
#include "translate.h"
/**
Prototype for the getpgid library function. The prototype for this
function seems to be missing in glibc, at least I've not found any
combination of #includes, macros and compiler switches that will
combination of includes, macros and compiler switches that will
include it.
*/
pid_t getpgid( pid_t pid );
@@ -48,15 +49,15 @@ pid_t getpgid( pid_t pid );
/**
file descriptor redirection error message
*/
#define FD_ERROR L"An error occurred while redirecting file descriptor %d"
#define FD_ERROR _( L"An error occurred while redirecting file descriptor %d" )
/**
file redirection error message
*/
#define FILE_ERROR L"An error occurred while redirecting file '%ls'"
#define FILE_ERROR _( L"An error occurred while redirecting file '%ls'" )
/**
fork error message
*/
#define FORK_ERROR L"Could not create child process - exiting"
#define FORK_ERROR _( L"Could not create child process - exiting" )
/**
@@ -103,7 +104,7 @@ void exec_close( int fd )
int exec_pipe( int fd[2])
{
int res;
while( ( res=pipe( fd ) ) )
{
if( errno != EINTR )
@@ -111,23 +112,18 @@ int exec_pipe( int fd[2])
wperror(L"pipe");
return res;
}
}
}
debug( 4, L"Created pipe using fds %d and %d", fd[0], fd[1]);
if( open_fds == 0 )
{
open_fds = malloc( sizeof( array_list_t ) );
if(!open_fds )
die_mem();
al_init( open_fds );
open_fds = al_new();
}
if( res != -1 )
{
debug( 4, L"Created pipe using fds %d and %d", fd[0], fd[1]);
al_push( open_fds, (void *)(long)fd[0] );
al_push( open_fds, (void *)(long)fd[1] );
}
al_push( open_fds, (void *)(long)fd[0] );
al_push( open_fds, (void *)(long)fd[1] );
return res;
}
@@ -183,7 +179,6 @@ static void close_unused_internal_pipes( io_data_t *io )
void exec_init()
{
}
void exec_destroy()
@@ -241,14 +236,14 @@ void free_fd( io_data_t *io, int fd )
redirections described by \c io.
\param io the list of IO redirections for the child
\param exit_on_error whether to call exit() on errors
\return 1 on sucess, 0 on failiure
*/
static void handle_child_io( io_data_t *io )
static int handle_child_io( io_data_t *io, int exit_on_error )
{
close_unused_internal_pipes( io );
if( env_universal_server.fd >= 0 )
exec_close( env_universal_server.fd );
for( ; io; io=io->next )
{
@@ -267,17 +262,13 @@ static void handle_child_io( io_data_t *io )
free_fd( io, io->fd );
}
/*
We don't mind if this fails, it is just a speculative close
to make sure no unexpected untracked fd causes us to fail
*/
close(io->fd);
switch( io->io_mode )
{
case IO_CLOSE:
close(io->fd);
break;
case IO_FILE:
{
if( (tmp=wopen( io->param1.filename,
io->param2.flags, 0777 ) )==-1 )
{
@@ -286,55 +277,81 @@ static void handle_child_io( io_data_t *io )
io->param1.filename );
wperror( L"open" );
exit(1);
if( exit_on_error )
{
exit(1);
}
else
{
return 0;
}
}
else if( tmp != io->fd)
{
close(io->fd);
if(dup2( tmp, io->fd ) == -1 )
{
debug( 1,
FD_ERROR,
io->fd );
wperror( L"dup2" );
exit(1);
if( exit_on_error )
{
exit(1);
}
else
{
return 0;
}
}
exec_close( tmp );
}
break;
}
case IO_FD:
/* debug( 3, L"Redirect fd %d in process %ls (%d) from fd %d",
io->fd,
p->actual_cmd,
p->pid,
io->old_fd );
*/
{
close(io->fd);
if( dup2( io->param1.old_fd, io->fd ) == -1 )
{
debug( 1,
FD_ERROR,
io->fd );
wperror( L"dup2" );
exit(1);
if( exit_on_error )
{
exit(1);
}
else
{
return 0;
}
}
break;
}
case IO_BUFFER:
case IO_PIPE:
{
/* debug( 3, L"Pipe fd %d in process %ls (%d) (Through fd %d)",
io->fd,
p->actual_cmd,
p->pid,
io->pipe_fd[io->fd] );
*/
int fd_to_dup = io->fd;
close(io->fd);
if( dup2( io->param1.pipe_fd[fd_to_dup?1:0], io->fd ) == -1 )
{
debug( 1, PIPE_ERROR );
wperror( L"dup2" );
exit(1);
if( exit_on_error )
{
exit(1);
}
else
{
return 0;
}
}
if( fd_to_dup != 0 )
@@ -343,28 +360,21 @@ static void handle_child_io( io_data_t *io )
exec_close( io->param1.pipe_fd[1]);
}
else
{
exec_close( io->param1.pipe_fd[0] );
}
/*
if( close( io[i].pipe_fd[ io->fd ] ) == -1 )
{
wperror( L"close" );
exit(1);
}
*/
/* if( close( io[i].pipe_fd[1] ) == -1 )
{
wperror( L"close" );
exit(1);
}
*/
/* fprintf( stderr, "fd %d points to fd %d\n", i, io[i].fd[i>0?1:0] );*/
break;
}
}
}
if( env_universal_server.fd >= 0 )
exec_close( env_universal_server.fd );
return 1;
}
/**
@@ -373,10 +383,17 @@ static void handle_child_io( io_data_t *io )
process is put in the jobs group, all signal handlers are reset,
SIGCHLD is unblocked (the exec call blocks blocks SIGCHLD), and all
IO redirections and other file descriptor actions are performed.
\param j the job to set up the IO for
\param p the child process to set up
\return 1 on sucess, 0 on failiure
*/
static void setup_child_process( job_t *j )
static int setup_child_process( job_t *j, process_t *p )
{
if( is_interactive && !is_subshell && !is_block)
int res;
if( j->terminal )
{
pid_t pid;
/*
@@ -401,14 +418,19 @@ static void setup_child_process( job_t *j )
}
}
res = handle_child_io( j->io, (p==0) );
/* Set the handling for job control signals back to the default. */
signal_reset_handlers();
handle_child_io( j->io );
if( res )
{
signal_reset_handlers();
}
/* Remove all signal blocks */
signal_unblock();
return res;
}
@@ -420,10 +442,11 @@ static void setup_child_process( job_t *j )
*/
static void launch_process( process_t *p )
{
// debug( 1, L"exec '%ls'", p->argv[0] );
execve (wcs2str(p->actual_cmd), wcsv2strv( (const wchar_t **) p->argv), env_export_arr( 0 ) );
debug( 0,
L"Failed to execute process %ls",
_( L"Failed to execute process '%ls'" ),
p->actual_cmd );
wperror( L"execve" );
exit(1);
@@ -440,11 +463,33 @@ static int has_fd( io_data_t *d, int fd )
}
/**
Free a transmogrified io chain. Only the chain itself and resources
used by a transmogrified IO_FILE redirection are freed, since the
original chain may still be needed.
*/
static void io_untransmogrify( io_data_t * in, io_data_t *out )
{
if( !out )
return;
io_untransmogrify( in->next, out->next );
switch( in->io_mode )
{
case IO_FILE:
exec_close( out->param1.old_fd );
break;
}
free(out);
}
/**
Make a copy of the specified io redirection chain, but change file
redirection into fd redirection. This makes the redirection chain
suitable for use as block-level io, since the file won't be
repeatedly reopened for every command in the block.
\return the transmogrified chain on sucess, or 0 on failiure
*/
static io_data_t *io_transmogrify( io_data_t * in )
{
@@ -460,7 +505,8 @@ static io_data_t *io_transmogrify( io_data_t * in )
out->fd = in->fd;
out->io_mode = IO_FD;
out->param2.close_old = 1;
out->next=0;
switch( in->io_mode )
{
/*
@@ -489,7 +535,8 @@ static io_data_t *io_transmogrify( io_data_t * in )
in->param1.filename );
wperror( L"open" );
exit(1);
free( out );
return 0;
}
out->param1.old_fd = fd;
@@ -497,31 +544,19 @@ static io_data_t *io_transmogrify( io_data_t * in )
}
}
out->next = io_transmogrify( in->next );
if( in->next)
{
out->next = io_transmogrify( in->next );
if( !out->next )
{
io_untransmogrify( in, out );
return 0;
}
}
return out;
}
/**
Free a transmogrified io chain. Only the chain itself and resources
used by a transmogrified IO_FILE redirection are freed, since the
original chain may still be needed.
*/
static void io_untransmogrify( io_data_t * in, io_data_t *out )
{
if( !in )
return;
io_untransmogrify( in->next, out->next );
switch( in->io_mode )
{
case IO_FILE:
exec_close( out->param1.old_fd );
break;
}
free(out);
}
/**
Morph an io redirection chain into redirections suitable for
passing to eval, call eval, and clean up morphed redirections.
@@ -531,32 +566,32 @@ static void io_untransmogrify( io_data_t * in, io_data_t *out )
\param io the io redirections to be performed on this block
*/
static int internal_exec_helper( const wchar_t *def,
static void internal_exec_helper( const wchar_t *def,
int block_type,
io_data_t *io )
{
int res=0;
io_data_t *io_internal = io_transmogrify( io );
int is_block_old=is_block;
is_block=1;
signal_unblock();
/*
Did the transmogrification fail - if so, set error status and return
*/
if( io && !io_internal )
{
proc_set_last_status( 1 );
return;
}
signal_unblock();
eval( def, io_internal, block_type );
signal_block();
/*
io_data_t *buff = io_get( io, 1 );
if( buff && buff->io_mode == IO_BUFFER )
fwprintf( stderr, L"block %ls produced %d bytes of output\n",
def,
buff->out_buffer->used );
*/
io_untransmogrify( io, io_internal );
job_reap( 0 );
is_block=is_block_old;
return res;
}
/**
@@ -567,7 +602,7 @@ static int internal_exec_helper( const wchar_t *def,
static int handle_new_child( job_t *j, process_t *p )
{
if(is_interactive && !is_subshell && !is_block)
if( j->terminal )
{
int new_pgid=0;
@@ -582,7 +617,7 @@ static int handle_new_child( job_t *j, process_t *p )
if( getpgid( p->pid) != j->pgid )
{
debug( 1,
L"Could not send process %d from group %d to group %d",
_( L"Could not send process %d from group %d to group %d" ),
p->pid,
getpgid( p->pid),
j->pgid );
@@ -594,7 +629,7 @@ static int handle_new_child( job_t *j, process_t *p )
{
if( tcsetpgrp (0, j->pgid) )
{
debug( 1, L"Could not send job %d ('%ls')to foreground",
debug( 1, _( L"Could not send job %d ('%ls') to foreground" ),
j->job_id,
j->command );
wperror( L"tcsetpgrp" );
@@ -606,7 +641,7 @@ static int handle_new_child( job_t *j, process_t *p )
{
if( tcsetpgrp (0, j->pgid) )
{
debug( 1, L"Could not send job %d ('%ls')to foreground",
debug( 1, _( L"Could not send job %d ('%ls') to foreground" ),
j->job_id,
j->command );
wperror( L"tcsetpgrp" );
@@ -644,7 +679,7 @@ void exec( job_t *j )
int exec_error=0;
debug( 4, L"Exec job %ls with id %d", j->command, j->job_id );
debug( 4, L"Exec job '%ls' with id %d", j->command, j->job_id );
if( j->first_process->type==INTERNAL_EXEC )
{
@@ -656,13 +691,21 @@ void exec( job_t *j )
/*
setup_child_process make sure signals are propelry set up
*/
setup_child_process( j );
launch_process( j->first_process );
/*
launch_process _never_ returns...
*/
}
if( setup_child_process( j, 0 ) )
{
/*
launch_process never returns
*/
launch_process( j->first_process );
}
else
{
j->constructed=1;
j->first_process->completed=1;
return;
}
}
pipe_read.fd=0;
pipe_write.fd=1;
@@ -672,7 +715,7 @@ void exec( job_t *j )
pipe_write.io_mode=IO_PIPE;
pipe_read.next=0;
pipe_write.next=0;
pipe_write.param1.pipe_fd[0]=pipe_write.param1.pipe_fd[1]=0;
pipe_write.param1.pipe_fd[0]=pipe_write.param1.pipe_fd[1]=-1;
//fwprintf( stderr, L"Run command %ls\n", j->command );
@@ -696,7 +739,7 @@ void exec( job_t *j )
The loop also has to handle pipelining between the jobs.
*/
for (p = j->first_process; p; p = p->next)
for( p=j->first_process; p; p = p->next )
{
mypipe[1]=-1;
skip_fork=0;
@@ -722,9 +765,11 @@ void exec( job_t *j )
j->io = io_add( j->io, &pipe_read );
}
if (p->next)
if( p->next )
{
if (exec_pipe( mypipe ) == -1)
// debug( 1, L"%ls|%ls" , p->argv[0], p->next->argv[0]);
if( exec_pipe( mypipe ) == -1 )
{
debug( 1, PIPE_ERROR );
wperror (L"pipe");
@@ -761,22 +806,37 @@ void exec( job_t *j )
wchar_t **arg;
int i;
string_buffer_t sb;
const wchar_t * def = function_get_definition( p->argv[0] );
// fwprintf( stderr, L"run function %ls\n", argv[0] );
if( def == 0 )
{
debug( 0, L"Unknown function %ls", p->argv[0] );
debug( 0, _( L"Unknown function '%ls'" ), p->argv[0] );
break;
}
/*
These two lines must be called before the new block is pushed
*/
int lineno = parser_get_lineno();
wchar_t *file = parser_current_filename()?wcsdup(parser_current_filename()):0;
parser_push_block( FUNCTION_CALL );
al_init( &current_block->param2.function_vars );
current_block->param1.function_name = wcsdup( p->argv[0] );
current_block->param3.function_lineno = lineno;
current_block->param4.function_filename = file;
if( builtin_count_args(p->argv)>1 )
{
sb_init( &sb );
for( i=1,arg = p->argv+1; *arg; i++, arg++ )
for( i=1, arg=p->argv+1; *arg; i++, arg++ )
{
al_push( &current_block->param2.function_vars,
escape(*arg, 1) );
if( i != 1 )
sb_append( &sb, ARRAY_SEP_STR );
sb_append( &sb, *arg );
@@ -785,6 +845,11 @@ void exec( job_t *j )
env_set( L"argv", (wchar_t *)sb.buff, ENV_LOCAL );
sb_destroy( &sb );
}
else
{
env_set( L"argv", 0, ENV_LOCAL );
}
parser_forbid_function( p->argv[0] );
if( p->next )
@@ -874,7 +939,7 @@ void exec( job_t *j )
{
builtin_stdin=-1;
debug( 1,
L"Unknown input redirection type %d",
_( L"Unknown input redirection type %d" ),
in->io_mode);
break;
}
@@ -941,15 +1006,23 @@ void exec( job_t *j )
case INTERNAL_FUNCTION:
{
int status = proc_get_last_status();
/*
Handle output from a block or function. This usually
means do nothing, but in the case of pipes, we have
to buffer such io, since otherwisethe internal pipe
to buffer such io, since otherwise the internal pipe
buffer might overflow.
*/
if( !io_buffer)
if( !io_buffer )
{
/*
No buffer, se we exit directly. This means we
have to manually set the exit status.
*/
if( p->next == 0 )
{
proc_set_last_status( j->negate?(status?0:1):status);
}
p->completed = 1;
break;
}
@@ -960,22 +1033,21 @@ void exec( job_t *j )
if( io_buffer->param2.out_buffer->used != 0 )
{
pid = fork ();
if (pid == 0)
pid = fork();
if( pid == 0 )
{
/*
This is the child process. Write out the contents of the pipeline.
*/
p->pid = getpid();
setup_child_process( j );
setup_child_process( j, p );
write( io_buffer->fd,
io_buffer->param2.out_buffer->buff,
io_buffer->param2.out_buffer->used );
exit( status );
}
else if (pid < 0)
else if( pid < 0 )
{
/* The fork failed. */
debug( 0, FORK_ERROR );
@@ -1024,7 +1096,7 @@ void exec( job_t *j )
io_data_t *io = io_get( j->io, 1 );
int buffer_stdout = io && io->io_mode == IO_BUFFER;
if( ( !sb_err->used ) &&
( !p->next ) &&
( sb_out->used ) &&
@@ -1044,22 +1116,20 @@ void exec( job_t *j )
{
debug( 3, L"Set status of %ls to %d using short circut", j->command, p->status );
proc_set_last_status( p->status );
proc_set_last_status( j->negate?(p->status?0:1):p->status );
}
break;
}
pid = fork ();
if (pid == 0)
pid = fork();
if( pid == 0 )
{
/*
This is the child process.
*/
p->pid = getpid();
setup_child_process( j );
setup_child_process( j, p );
if( sb_out->used )
fwprintf( stdout, L"%ls", sb_out->buff );
if( sb_err->used )
@@ -1068,7 +1138,7 @@ void exec( job_t *j )
exit( p->status );
}
else if (pid < 0)
else if( pid < 0 )
{
/* The fork failed. */
debug( 0, FORK_ERROR );
@@ -1094,29 +1164,26 @@ void exec( job_t *j )
case EXTERNAL:
{
// fwprintf( stderr,
// L"fork on %ls\n", j->command );
pid = fork ();
if (pid == 0)
pid = fork();
if( pid == 0 )
{
/*
This is the child process.
*/
p->pid = getpid();
setup_child_process( j );
setup_child_process( j, p );
launch_process( p );
/*
launch_process _never_ returns...
*/
}
else if (pid < 0)
else if( pid < 0 )
{
/* The fork failed. */
debug( 0, FORK_ERROR );
wperror (L"fork");
exit (1);
wperror( L"fork" );
exit( 1 );
}
else
{
@@ -1138,11 +1205,10 @@ void exec( job_t *j )
}
if(p->type == INTERNAL_BUILTIN)
if( p->type == INTERNAL_BUILTIN )
builtin_pop_io();
/*
Close the pipe the current process uses to read from the previous process_t
*/
@@ -1201,7 +1267,7 @@ int exec_subshell( const wchar_t *cmd,
if( !cmd )
{
debug( 1,
L"Sent null command to subshell. This is a fish bug. If it can be reproduced, please send a bug report to %ls",
_( L"Sent null command to subshell. This is a fish bug. If it can be reproduced, please send a bug report to %s." ),
PACKAGE_BUGREPORT );
return 0;
}
@@ -1223,7 +1289,7 @@ int exec_subshell( const wchar_t *cmd,
b_append( io_buffer->param2.out_buffer, &z, 1 );
begin=end=io_buffer->param2.out_buffer->buff;
if( l )
{
while( 1 )
@@ -1247,7 +1313,14 @@ int exec_subshell( const wchar_t *cmd,
wchar_t *el;
*end=0;
el = str2wcs( begin );
al_push( l, el );
if( !el )
{
debug( 0, _( L"Subshell '%ls' returned illegal string, discarded one entry" ), cmd );
}
else
{
al_push( l, el );
}
begin = end+1;
break;
}
@@ -1257,5 +1330,6 @@ int exec_subshell( const wchar_t *cmd,
}
io_buffer_destroy( io_buffer );
return status;
}

7
exec.h
View File

@@ -3,6 +3,9 @@
*/
#ifndef FISH_EXEC_H
/**
Header guard
*/
#define FISH_EXEC_H
#include <wchar.h>
@@ -13,14 +16,14 @@
/**
pipe redirection error message
*/
#define PIPE_ERROR L"An error occurred while setting up pipe"
#define PIPE_ERROR _(L"An error occurred while setting up pipe")
/**
Initialize the exec library
*/
void exec_init();
/*
/**
Destroy dynamically allocated data and other resources used by the
exec library
*/

538
expand.c
View File

@@ -20,6 +20,8 @@ parameter expansion.
#include <unistd.h>
#include <signal.h>
#include <assert.h>
#ifdef SunOS
#include <procfs.h>
#endif
@@ -36,36 +38,58 @@ parameter expansion.
#include "exec.h"
#include "tokenizer.h"
#include "complete.h"
#include "translate.h"
/**
Description for child process
*/
#define COMPLETE_CHILD_PROCESS_DESC COMPLETE_SEP_STR L"Child process"
#define COMPLETE_CHILD_PROCESS_DESC _( L"Child process")
/**
Description for non-child process
*/
#define COMPLETE_PROCESS_DESC COMPLETE_SEP_STR L"Process"
#define COMPLETE_PROCESS_DESC _( L"Process")
/**
Description for long job
*/
#define COMPLETE_JOB_DESC COMPLETE_SEP_STR L"Job"
#define COMPLETE_JOB_DESC _( L"Job")
/**
Description for short job. The job command is concatenated
*/
#define COMPLETE_JOB_DESC_VAL COMPLETE_SEP_STR, L"Job: "
#define COMPLETE_JOB_DESC_VAL _( L"Job: ")
/**
Description for the shells own pid
*/
#define COMPLETE_SELF_DESC COMPLETE_SEP_STR L"Shell process"
#define COMPLETE_SELF_DESC _( L"Shell process")
/**
Description for the shells own pid
*/
#define COMPLETE_LAST_DESC COMPLETE_SEP_STR L"Last background job"
#define COMPLETE_LAST_DESC _( L"Last background job")
/**
Error issued on invalid variable name
*/
#define COMPLETE_VAR_DESC _( L"The '$' character begins a variable name. The character '%lc', which directly followed a '$', is not allowed as a part of a variable name, and variable names may not be zero characters long. To learn more about variable expansion in fish, type 'help expand-variable'.")
/**
Error issued on invalid variable name
*/
#define COMPLETE_VAR_NULL_DESC _( L"The '$' begins a variable name. It was given at the end of an argument. Variable names may not be zero characters long. To learn more about variable expansion in fish, type 'help expand-variable'.")
/**
Error issued on invalid variable name
*/
#define COMPLETE_VAR_BRACKET_DESC _( L"Did you mean {$VARIABLE}? The '$' character begins a variable name. A bracket, which directly followed a '$', is not allowed as a part of a variable name, and variable names may not be zero characters long. To learn more about variable expansion in fish, type 'help expand-variable'." )
/**
Error issued on invalid variable name
*/
#define COMPLETE_VAR_PARAN_DESC _( L"Did you mean (COMMAND)? In fish, the '$' character is only used for accessing variables. To learn more about command substitution in fish, type 'help expand-command-substitution'.")
/**
String in process expansion denoting ourself
@@ -78,13 +102,55 @@ parameter expansion.
#define LAST_STR L"last"
/**
Return the environment variable value for the string starting at in
Characters which make a string unclean if they are the first
character of the string. See \c is_clean().
*/
#define UNCLEAN_FIRST L"~%"
/**
Unclean characters. See \c is_clean().
*/
#define UNCLEAN L"$*?\\\"'({})"
/**
Test if the specified argument is clean, i.e. it does not contain
any tokens which need to be expanded or otherwise altered. Clean
strings can be passed through expand_string and expand_one without
changing them. About 90% of all strings are clean, so skipping
expansion on them actually does save a small amount of time, since
it avoids multiple memory allocations during the expansion process.
*/
static int is_clean( const wchar_t *in )
{
const wchar_t * str = in;
/*
Test characters that have a special meaning in the first character position
*/
if( wcschr( UNCLEAN_FIRST, *str ) )
return 0;
/*
Test characters that have a special meaning in any character position
*/
while( *str )
{
if( wcschr( UNCLEAN, *str ) )
return 0;
str++;
}
return 1;
}
/**
Return the environment variable value for the string starting at \c in.
*/
static wchar_t *expand_var( wchar_t *in )
{
if( !in )
return 0;
return (in[0] == VARIABLE_EXPAND )? env_get( expand_var(in+1) ) : env_get( in );
return env_get( in );
}
void expand_variable_array( const wchar_t *val, array_list_t *out )
@@ -97,7 +163,6 @@ void expand_variable_array( const wchar_t *val, array_list_t *out )
if( !cpy )
{
die_mem();
}
for( start=pos=cpy; *pos; pos++ )
@@ -110,7 +175,7 @@ void expand_variable_array( const wchar_t *val, array_list_t *out )
}
}
al_push( out, wcsdup(start) );
free(cpy);
}
}
@@ -160,7 +225,7 @@ wchar_t *expand_escape_variable( const wchar_t *in )
switch( al_get_count( &l) )
{
case 0:
sb_append( &buff, L"\'\'");
sb_append( &buff, L"''");
break;
case 1:
@@ -170,9 +235,9 @@ wchar_t *expand_escape_variable( const wchar_t *in )
if( wcschr( el, L' ' ) && is_quotable( el ) )
{
sb_append2( &buff,
L"\'",
L"'",
el,
L"\'",
L"'",
(void *)0 );
}
else
@@ -196,9 +261,9 @@ wchar_t *expand_escape_variable( const wchar_t *in )
if( is_quotable( el ) )
{
sb_append2( &buff,
L"\'",
L"'",
el,
L"\'",
L"'",
(void *)0 );
}
else
@@ -299,7 +364,8 @@ static int match_pid( const wchar_t *cmd,
Searches for a job with the specified job id, or a job or process
which has the string \c proc as a prefix of its commandline.
If accept_incomplete is true, the remaining string for any matches are inserted.
If accept_incomplete is true, the remaining string for any matches
are inserted.
If accept_incomplete is false, any job matching the specified
string is matched, and the job pgid is returned. If no job
@@ -322,8 +388,6 @@ static int find_process( const wchar_t *proc,
wchar_t *result;
job_t *j;
if( iswnumeric(proc) || (wcslen(proc)==0) )
{
@@ -348,8 +412,10 @@ static int find_process( const wchar_t *proc,
{
al_push( out,
wcsdupcat2( jid+wcslen(proc),
COMPLETE_JOB_DESC_VAL, j->command,
0 ) );
COMPLETE_SEP_STR,
COMPLETE_JOB_DESC_VAL,
j->command,
(void *)0 ) );
}
@@ -390,8 +456,10 @@ static int find_process( const wchar_t *proc,
{
if( flags & ACCEPT_INCOMPLETE )
{
wchar_t *res = wcsdupcat( j->command + wcslen(proc),
COMPLETE_JOB_DESC );
wchar_t *res = wcsdupcat2( j->command + wcslen(proc),
COMPLETE_SEP_STR,
COMPLETE_JOB_DESC,
(void *)0 );
// fwprintf( stderr, L"Woot %ls\n", res );
al_push( out, res );
@@ -429,8 +497,10 @@ static int find_process( const wchar_t *proc,
{
if( flags & ACCEPT_INCOMPLETE )
{
wchar_t *res = wcsdupcat( p->actual_cmd + wcslen(proc),
COMPLETE_CHILD_PROCESS_DESC );
wchar_t *res = wcsdupcat2( p->actual_cmd + wcslen(proc),
COMPLETE_SEP_STR,
COMPLETE_CHILD_PROCESS_DESC,
(void *)0);
al_push( out, res );
}
else
@@ -539,8 +609,10 @@ static int find_process( const wchar_t *proc,
{
if( flags & ACCEPT_INCOMPLETE )
{
wchar_t *res = wcsdupcat( cmd + wcslen(proc),
COMPLETE_PROCESS_DESC );
wchar_t *res = wcsdupcat2( cmd + wcslen(proc),
COMPLETE_SEP_STR,
COMPLETE_PROCESS_DESC,
(void *)0);
if( res )
al_push( out, res );
}
@@ -582,12 +654,12 @@ static int expand_pid( wchar_t *in,
{
if( wcsncmp( in+1, SELF_STR, wcslen(in+1) )==0 )
{
wchar_t *res = wcsdupcat( SELF_STR+wcslen(in+1), COMPLETE_SELF_DESC );
wchar_t *res = wcsdupcat2( SELF_STR+wcslen(in+1), COMPLETE_SEP_STR, COMPLETE_SELF_DESC, (void *)0 );
al_push( out, res );
}
else if( wcsncmp( in+1, LAST_STR, wcslen(in+1) )==0 )
{
wchar_t *res = wcsdupcat( LAST_STR+wcslen(in+1), COMPLETE_LAST_DESC );
wchar_t *res = wcsdupcat2( LAST_STR+wcslen(in+1), COMPLETE_SEP_STR, COMPLETE_LAST_DESC, (void *)0 );
al_push( out, res );
}
}
@@ -657,11 +729,10 @@ static int expand_variables( wchar_t *in, array_list_t *out )
int is_ok= 1;
int empty=0;
for( i=wcslen(in)-1; (i>=0) && is_ok && !empty; i-- )
{
c = in[i];
if( c == VARIABLE_EXPAND )
if( ( c == VARIABLE_EXPAND ) || (c == VARIABLE_EXPAND_SINGLE ) )
{
int start_pos = i+1;
int stop_pos;
@@ -670,15 +741,8 @@ static int expand_variables( wchar_t *in, array_list_t *out )
wchar_t * var_val;
wchar_t * new_in;
array_list_t l;
int is_single = (c==VARIABLE_EXPAND_SINGLE);
// fwprintf( stderr, L"Expand %ls\n", in );
// while (in[stop_pos]==VARIABLE_EXPAND)
// stop_pos++;
stop_pos = start_pos;
while( 1 )
@@ -695,106 +759,181 @@ static int expand_variables( wchar_t *in, array_list_t *out )
/* printf( "Stop for '%c'\n", in[stop_pos]);*/
var_len = stop_pos - start_pos;
if( var_len == 0 )
{
switch( in[stop_pos] )
{
case BRACKET_BEGIN:
{
error( SYNTAX_ERROR,
-1,
COMPLETE_VAR_BRACKET_DESC );
break;
}
case INTERNAL_SEPARATOR:
{
error( SYNTAX_ERROR,
-1,
COMPLETE_VAR_PARAN_DESC );
break;
}
case 0:
{
error( SYNTAX_ERROR,
-1,
COMPLETE_VAR_NULL_DESC,
in[stop_pos] );
break;
}
default:
{
error( SYNTAX_ERROR,
-1,
COMPLETE_VAR_DESC,
in[stop_pos] );
break;
}
}
is_ok = 0;
break;
}
if( !(var_name = malloc( sizeof(wchar_t)*(var_len+1) )))
{
die_mem();
}
else
{
wcsncpy( var_name, &in[start_pos], var_len );
var_name[var_len]='\0';
wcsncpy( var_name, &in[start_pos], var_len );
var_name[var_len]='\0';
/* printf( "Variable name is %s, len is %d\n", var_name, var_len );*/
wchar_t *var_val_orig = expand_var( var_name );
wchar_t *var_val_orig = expand_var( var_name );
if( var_val_orig && (var_val = wcsdup( var_val_orig) ) )
{
int all_vars=1;
array_list_t idx;
al_init( &idx );
al_init( &l );
if( var_val_orig && (var_val = wcsdup( var_val_orig) ) )
{
int all_vars=1;
array_list_t idx;
al_init( &idx );
al_init( &l );
if( in[stop_pos] == L'[' )
{
wchar_t *end;
if( in[stop_pos] == L'[' )
{
wchar_t *end;
all_vars = 0;
all_vars = 0;
stop_pos++;
while( 1 )
stop_pos++;
while( 1 )
{
int tmp;
while( iswspace(in[stop_pos]) || (in[stop_pos]==INTERNAL_SEPARATOR))
stop_pos++;
if( in[stop_pos] == L']' )
{
int tmp;
while( iswspace(in[stop_pos]) || (in[stop_pos]==INTERNAL_SEPARATOR))
stop_pos++;
if( in[stop_pos] == L']' )
{
stop_pos++;
break;
}
stop_pos++;
break;
}
errno=0;
tmp = wcstol( &in[stop_pos], &end, 10 );
if( ( errno ) || ( end == &in[stop_pos] ) )
errno=0;
tmp = wcstol( &in[stop_pos], &end, 10 );
if( ( errno ) || ( end == &in[stop_pos] ) )
{
error( SYNTAX_ERROR,
-1,
L"Expected integer or \']\'" );
is_ok = 0;
break;
}
al_push( &idx, (void *)tmp );
stop_pos = end-in;
}
}
if( is_ok )
{
expand_variable_array( var_val, &l );
if( !all_vars )
{
int j;
for( j=0; j<al_get_count( &idx ); j++)
{
int tmp = (int)al_get( &idx, j );
if( tmp < 1 || tmp > al_get_count( &l ) )
{
error( SYNTAX_ERROR,
L"Expected integer or \']\'",
-1 );
is_ok = 0;
-1,
L"Array index out of bounds" );
is_ok=0;
al_truncate( &idx, j );
break;
}
al_push( &idx, (void *)tmp );
stop_pos = end-in;
}
}
if( is_ok )
{
expand_variable_array( var_val, &l );
if( !all_vars )
{
int j;
for( j=0; j<al_get_count( &idx ); j++)
}
else
{
int tmp = (int)al_get( &idx, j );
if( tmp < 1 || tmp > al_get_count( &l ) )
{
error( SYNTAX_ERROR, L"Array index out of bounds", -1 );
is_ok=0;
al_truncate( &idx, j );
break;
}
else
{
/* Move string from list l to list idx */
al_set( &idx, j, al_get( &l, tmp-1 ) );
al_set( &l, tmp-1, 0 );
}
/* Move string from list l to list idx */
al_set( &idx, j, al_get( &l, tmp-1 ) );
al_set( &l, tmp-1, 0 );
}
/* Free remaining strings in list l and truncate it */
al_foreach( &l, (void (*)(const void *))&free );
al_truncate( &l, 0 );
/* Add items from list idx back to list l */
al_push_all( &l, &idx );
}
free( var_val );
}
/* Free remaining strings in list l and truncate it */
al_foreach( &l, (void (*)(const void *))&free );
al_truncate( &l, 0 );
/* Add items from list idx back to list l */
al_push_all( &l, &idx );
}
free( var_val );
}
if( is_single )
{
string_buffer_t res;
sb_init( &res );
in[i]=0;
sb_append( &res, in );
sb_append_char( &res, INTERNAL_SEPARATOR );
for( j=0; j<al_get_count( &l); j++ )
{
wchar_t *next = (wchar_t *)al_get( &l, j );
if( is_ok )
{
if( j != 0 )
sb_append( &res, L" " );
sb_append( &res, next );
}
free( next );
}
sb_append( &res, &in[stop_pos] );
is_ok &= expand_variables( wcsdup((wchar_t *)res.buff), out );
sb_destroy( &res );
}
else
{
for( j=0; j<al_get_count( &l); j++ )
{
wchar_t *next = (wchar_t *)al_get( &l, j );
if( is_ok )
{
new_len = wcslen(in) - (stop_pos-start_pos+1) + wcslen( next) +2;
if( !(new_in = malloc( sizeof(wchar_t)*new_len )))
{
error( OOM, L"Out of memory", -1 );
is_ok = 0;
die_mem();
}
else
{
@@ -817,21 +956,54 @@ static int expand_variables( wchar_t *in, array_list_t *out )
}
}
free( next );
}
al_destroy( &l );
al_destroy( &idx );
free(in);
free(var_name );
return is_ok;
}
}
al_destroy( &l );
al_destroy( &idx );
free(in);
free(var_name );
return is_ok;
}
else
{
/*
Expand a non-existing variable
*/
if( c == VARIABLE_EXPAND )
{
/*
Regular expansion, i.e. expand this argument to nothing
*/
empty = 1;
}
else
{
empty = 1;
/*
Expansion to single argument.
*/
string_buffer_t res;
sb_init( &res );
in[i]=0;
sb_append( &res, in );
sb_append( &res, &in[stop_pos] );
is_ok &= expand_variables( wcsdup((wchar_t *)res.buff), out );
sb_destroy( &res );
free(in);
free(var_name );
return is_ok;
}
free(var_name );
}
free(var_name );
}
prev_char = c;
}
@@ -930,7 +1102,9 @@ static int expand_brackets( wchar_t *in, int flags, array_list_t *out )
if( syntax_error )
{
error( SYNTAX_ERROR, L"Mismatched brackets", -1 );
error( SYNTAX_ERROR,
-1,
L"Mismatched brackets" );
return 0;
}
@@ -1053,6 +1227,11 @@ int expand_locate_subshell( wchar_t *in,
*begin = paran_begin;
*end = paran_count?in+wcslen(in):paran_end;
/* assert( *begin >= in );
assert( *begin < (in+wcslen(in) ) );
assert( *end >= *begin );
assert( *end < (in+wcslen(in) ) );
*/
return 1;
}
@@ -1076,7 +1255,9 @@ static int expand_subshell( wchar_t *in, array_list_t *out )
0 ) )
{
case -1:
error( SYNTAX_ERROR, L"Mismatched parans", -1 );
error( SYNTAX_ERROR,
-1,
L"Mismatched parans" );
return 0;
case 0:
al_push( out, in );
@@ -1085,9 +1266,7 @@ static int expand_subshell( wchar_t *in, array_list_t *out )
break;
}
}
len1 = (paran_begin-in);
len2 = wcslen(paran_end)-1;
@@ -1111,10 +1290,10 @@ static int expand_subshell( wchar_t *in, array_list_t *out )
free( subcmd );
return 0;
}
al_init( &tail_expand );
expand_subshell( wcsdup(paran_end+1), &tail_expand );
for( i=0; i<al_get_count( &sub_res ); i++ )
{
wchar_t *sub_item, *sub_item2;
@@ -1122,20 +1301,20 @@ static int expand_subshell( wchar_t *in, array_list_t *out )
sub_item2 = expand_escape( sub_item, 1 );
free(sub_item);
int item_len = wcslen( sub_item2 );
for( j=0; j<al_get_count( &tail_expand ); j++ )
{
string_buffer_t whole_item;
wchar_t *tail_item = (wchar_t *)al_get( &tail_expand, j );
sb_init( &whole_item );
sb_append_substring( &whole_item, in, len1 );
sb_append_char( &whole_item, INTERNAL_SEPARATOR );
sb_append_substring( &whole_item, sub_item2, item_len );
sb_append_char( &whole_item, INTERNAL_SEPARATOR );
sb_append( &whole_item, tail_item );
al_push( out, whole_item.buff );
}
@@ -1147,7 +1326,7 @@ static int expand_subshell( wchar_t *in, array_list_t *out )
al_foreach( &tail_expand, (void (*)(const void *))&free );
al_destroy( &tail_expand );
free( subcmd );
return 1;
}
@@ -1157,26 +1336,25 @@ wchar_t *expand_unescape( const wchar_t * in, int escape_special )
{
wchar_t *res = unescape( in, escape_special );
if( !res )
error( SYNTAX_ERROR, L"Unexpected end of string", -1 );
error( SYNTAX_ERROR, -1, L"Unexpected end of string" );
return res;
}
/**
Attempts tilde expansion. Of the string specified. If tilde
expansion is performed, the argument is freed and a new string is
allocated in its place. Horrible call signature. Should be
altered. Fugly!
expansion is performed, the original string is freed and a new
string allocated using malloc is returned, otherwise, the original
string is returned.
*/
static int tilde_expand( wchar_t **ptr )
static wchar_t * expand_tilde_internal( wchar_t *in )
{
wchar_t *in = *ptr;
if( in[0] == HOME_DIRECTORY )
{
int tilde_error = 0;
wchar_t *home=0;
wchar_t *new_in;
wchar_t *old_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' )
@@ -1210,7 +1388,7 @@ static int tilde_expand( wchar_t **ptr )
old_in = name_end;
char *name_str = wcs2str( name );
struct passwd *userinfo =
getpwnam( name_str );
@@ -1233,26 +1411,23 @@ static int tilde_expand( wchar_t **ptr )
free(name);
}
if( !tilde_error )
if( !tilde_error && home && old_in )
{
new_in = wcsdupcat( home, old_in );
free( in );
in = new_in;
free(home);
*ptr = in;
}
}
free(home);
free( in );
return new_in;
}
return 1;
return in;
}
wchar_t *expand_tilde(wchar_t *in)
wchar_t *expand_tilde( wchar_t *in)
{
if( in[0] == L'~' )
{
in[0] = HOME_DIRECTORY;
tilde_expand( &in );
return in;
return expand_tilde_internal( in );
}
return in;
}
@@ -1266,8 +1441,6 @@ static void remove_internal_separator( const void *s, int conv )
wchar_t *in = (wchar_t *)s;
wchar_t *out=in;
// int changed=0;
while( *in )
{
switch( *in )
@@ -1291,16 +1464,11 @@ static void remove_internal_separator( const void *s, int conv )
}
}
*out=0;
/* if( changed )
{
fwprintf( stderr, L" -> %ls\n", s );
}
*/
}
/**
The real expansion function. All other expansion functions are wrappers to this one.
The real expansion function. expand_one is just a wrapper around this one.
*/
int expand_string( wchar_t *str,
array_list_t *end_out,
@@ -1311,7 +1479,17 @@ int expand_string( wchar_t *str,
int i;
int subshell_ok = 1;
int res = EXPAND_OK;
// debug( 1, L"Expand %ls", str );
if( (!(flags & ACCEPT_INCOMPLETE)) && is_clean( str ) )
{
al_push( end_out, str );
return EXPAND_OK;
}
al_init( &list1 );
al_init( &list2 );
@@ -1327,10 +1505,11 @@ int expand_string( wchar_t *str,
if( (pos == str) || ( *(pos-1) != L'\\' ) )
{
error( SUBSHELL_ERROR, L"Subshells not allowed", -1 );
error( SUBSHELL_ERROR, -1, L"Subshells not allowed" );
free( str );
al_destroy( &list1 );
al_destroy( &list2 );
return 0;
return EXPAND_ERROR;
}
pos++;
}
@@ -1344,7 +1523,7 @@ int expand_string( wchar_t *str,
if( !subshell_ok )
{
al_destroy( &list1 );
return 0;
return EXPAND_ERROR;
}
else
{
@@ -1354,12 +1533,12 @@ int expand_string( wchar_t *str,
for( i=0; i<al_get_count( in ); i++ )
{
wchar_t *next;
next = expand_unescape( (wchar_t *)al_get( in, i ),
1);
free( (void *)al_get( in, i ) );
if( !next )
continue;
@@ -1378,7 +1557,7 @@ int expand_string( wchar_t *str,
{
al_destroy( in );
al_destroy( out );
return 0;
return EXPAND_ERROR;
}
}
}
@@ -1395,7 +1574,7 @@ int expand_string( wchar_t *str,
{
al_destroy( in );
al_destroy( out );
return 0;
return EXPAND_ERROR;
}
}
al_truncate( in, 0 );
@@ -1406,21 +1585,26 @@ int expand_string( wchar_t *str,
for( i=0; i<al_get_count( in ); i++ )
{
wchar_t *next = (wchar_t *)al_get( in, i );
if(!tilde_expand( &next ))
if( !(next=expand_tilde_internal( next ) ) )
{
al_destroy( in );
al_destroy( out );
return 0;
return EXPAND_ERROR;
}
if( flags & ACCEPT_INCOMPLETE )
{
if( *next == PROCESS_EXPAND )
{
/*
If process expansion matches, we are not
interested in other completions, so we
short-circut and return
*/
expand_pid( next, flags, end_out );
al_destroy( in );
al_destroy( out );
return 1;
return EXPAND_OK;
}
else
al_push( out, next );
@@ -1431,7 +1615,7 @@ int expand_string( wchar_t *str,
{
al_destroy( in );
al_destroy( out );
return 0;
return EXPAND_ERROR;
}
}
}
@@ -1464,19 +1648,18 @@ int expand_string( wchar_t *str,
case 0:
if( !(flags & ACCEPT_INCOMPLETE) )
{
if( res == EXPAND_OK )
res = EXPAND_WILDCARD_NO_MATCH;
break;
}
case 1:
res = EXPAND_WILDCARD_MATCH;
sort_list( out );
al_push_all( end_out, out );
al_truncate( out, 0 );
break;
default:
fwprintf( stderr, L"error\n" );
/*al_destroy( &list1 );*/
/*al_destroy( &list2 );*/
/*return 0;*/
}
}
else
@@ -1491,7 +1674,8 @@ int expand_string( wchar_t *str,
al_destroy( out );
}
return 1;
return res;
}
@@ -1500,12 +1684,14 @@ wchar_t *expand_one( wchar_t *string, int flags )
array_list_t l;
int res;
wchar_t *one;
if( (!(flags & ACCEPT_INCOMPLETE)) && is_clean( string ) )
return string;
al_init( &l );
res = expand_string( string, &l, flags );
if( !res )
{
free( string );
one = 0;
}
else
@@ -1520,7 +1706,7 @@ wchar_t *expand_one( wchar_t *string, int flags )
al_set( &l, 0, 0 );
}
}
al_foreach( &l, (void(*)(const void *))&free );
al_destroy( &l );
return one;

View File

@@ -1,15 +1,18 @@
/**\file expand.h
Prototypes for string expantion functions. These functions perform
several kinds of parameter expantion. There are a lot of issues
Prototypes for string expansion functions. These functions perform
several kinds of parameter expansion. There are a lot of issues
with regards to memory allocation. Overall, these functions would
benefit from using a more clever memory allocation scheme, perhaps
an evil combination of talloc, string buffers and reference
counting.
*/
#ifndef FISH_EXPAND_H
/**
Header guard
*/
#define FISH_EXPAND_H
#include <wchar.h>
@@ -17,17 +20,17 @@
#include "util.h"
/**
Flag specifying that subshell expantion should be skipped
Flag specifying that subshell expansion should be skipped
*/
#define EXPAND_SKIP_SUBSHELL 1
/**
Flag specifying that variable expantion should be skipped
Flag specifying that variable expansion should be skipped
*/
#define EXPAND_SKIP_VARIABLES 2
/**
Flag specifying that wildcard expantion should be skipped
Flag specifying that wildcard expansion should be skipped
*/
#define EXPAND_SKIP_WILDCARDS 4
@@ -51,7 +54,7 @@
#define DIRECTORIES_ONLY 32
/*
/**
Use unencoded private-use keycodes for internal characters
*/
#define EXPAND_RESERVED 0xf000
@@ -61,20 +64,45 @@ enum
/** Character represeting a home directory */
HOME_DIRECTORY = EXPAND_RESERVED,
/** Character represeting process expantion */
/** Character represeting process expansion */
PROCESS_EXPAND,
/** Character representing variable expantion */
/** Character representing variable expansion */
VARIABLE_EXPAND,
/** Character representing the start of a bracket expantion */
/** Character rpresenting variable expansion into a single element*/
VARIABLE_EXPAND_SINGLE,
/** Character representing the start of a bracket expansion */
BRACKET_BEGIN,
/** Character representing the end of a bracket expantion */
/** Character representing the end of a bracket expansion */
BRACKET_END,
/** Character representing separation between two bracket elements */
BRACKET_SEP,
/**
Separate subtokens in a token with this character.
*/
INTERNAL_SEPARATOR,
}
;
/**
These are the possible return values for expand_string
*/
enum
{
/** Error */
EXPAND_ERROR,
/** Ok */
EXPAND_OK,
/** Ok, a wildcard in the string matched no files */
EXPAND_WILDCARD_NO_MATCH,
/* Ok, a wildcard in the string matched a file */
EXPAND_WILDCARD_MATCH
}
;
@@ -84,18 +112,13 @@ enum
/** String containing the character for separating two array elements */
#define ARRAY_SEP_STR L"\x1e"
/**
Separate subtokens in a token with this character.
*/
#define INTERNAL_SEPARATOR 0xfffffff0
/**
Perform various forms of expansion on in, such as tilde expansion
(~USER becomes the users home directory), variable expansion
($VAR_NAME becomes the value of the environment variable VAR_NAME),
subshell expantion and wildcard expansion. The results are inserted
subshell expansion and wildcard expansion. The results are inserted
into the list out.
If the parameter does not need expansion, it is copied into the list
@@ -103,8 +126,9 @@ enum
newly allocated strings are inserted into the list out.
\param in The parameter to expand
\param flag Specifies if any expantion pass should be skipped. Legal values are any combination of EXPAND_SKIP_SUBSHELL EXPAND_SKIP_VARIABLES and EXPAND_SKIP_WILDCARDS
\param flag Specifies if any expansion pass should be skipped. Legal values are any combination of EXPAND_SKIP_SUBSHELL EXPAND_SKIP_VARIABLES and EXPAND_SKIP_WILDCARDS
\param out The list to which the result will be appended.
\return One of EXPAND_OK, EXPAND_ERROR, EXPAND_WILDCARD_MATCH and EXPAND_WILDCARD_NO_MATCH
*/
int expand_string( wchar_t *in, array_list_t *out, int flag );
@@ -114,7 +138,7 @@ int expand_string( wchar_t *in, array_list_t *out, int flag );
names.
\param in The parameter to expand
\param flag Specifies if any expantion pass should be skipped. Legal values are any combination of EXPAND_SKIP_SUBSHELL EXPAND_SKIP_VARIABLES and EXPAND_SKIP_WILDCARDS
\param flag Specifies if any expansion pass should be skipped. Legal values are any combination of EXPAND_SKIP_SUBSHELL EXPAND_SKIP_VARIABLES and EXPAND_SKIP_WILDCARDS
\return The expanded parameter, or 0 on failiure
*/
wchar_t *expand_one( wchar_t *in, int flag );
@@ -122,11 +146,9 @@ wchar_t *expand_one( wchar_t *in, int flag );
/**
Expand backslashed escapes and substitute them with their unescaped
counterparts. Also optionally change the wildcards, the tilde
character and a few more into constants which are defined to be
outside of the valid character space, but still inside the valid
space for a wchar_t. This assumes that a wchar_t is at least 32
bits long AND that the characterset is UCS4 or some other 31-bit
character set.
character and a few more into constants which are defined in a
private use area of Unicode. This assumes wchar_t is a unicode
character. character set.
The result must be free()d. The original string is not modified. If
an invalid sequence is specified, 0 is returned.
@@ -153,15 +175,15 @@ wchar_t *expand_escape_variable( const wchar_t *in );
/**
Perform tilde expantion and nothing else on the specified string.
Perform tilde expansion and nothing else on the specified string.
If tilde expantion is needed, the original string is freed and a
If tilde expansion is needed, the original string is freed and a
new string, allocated using malloc, is returned.
*/
wchar_t *expand_tilde(wchar_t *in);
/**
Locate the last subshell in the specified string.
Locate the first subshell in the specified string.
\param in the string to search for subshells
\param begin the starting paranthesis of the subshell

View File

@@ -51,14 +51,14 @@ fi
%_mandir/man1/xsel.1x*
%_mandir/man1/mimedb.1*
%_mandir/man1/set_color.1*
%_mandir/man1/tokenize.1*
%_mandir/man1/count.1*
%_mandir/man1/fishd.1*
%_mandir/man1/fish_pager.1*
%attr(0755,root,root) %_bindir/fish
%attr(0755,root,root) %_bindir/fishd
%attr(0755,root,root) %_bindir/fish_pager
%attr(0755,root,root) %_bindir/xsel
%attr(0755,root,root) %_bindir/set_color
%attr(0755,root,root) %_bindir/tokenize
%attr(0755,root,root) %_bindir/mimedb
%attr(0755,root,root) %_bindir/count
%config %_sysconfdir/fish
@@ -67,8 +67,12 @@ fi
%config %_sysconfdir/fish.d/fish_*.fish
%dir %_sysconfdir/fish.d/completions
%config %_sysconfdir/fish.d/completions/*.fish
%_datadir/locale/*/LC_MESSAGES/fish.mo
%changelog
* Tue Nov 29 2005 Axel Liljencrantz <axel@liljencrantz.se> 1.17.0-0
- 1.17.0
* Sat Sep 24 2005 Axel Liljencrantz <axel@liljencrantz.se> 1.14.0-0
- 1.14.0

View File

@@ -27,7 +27,12 @@
#include <termio.h>
#endif
#if HAVE_TERM_H
#include <term.h>
#elif HAVE_NCURSES_TERM_H
#include <ncurses/term.h>
#endif
#include <signal.h>
#include "util.h"
@@ -422,9 +427,10 @@ static void printed_length( wchar_t *str,
case L'^':
case L'<':
case L'>':
case L'@':
case L'(':
case L')':
case L'[':
case L']':
case L'{':
case L'}':
case L'?':
@@ -432,6 +438,11 @@ static void printed_length( wchar_t *str,
case L'|':
case L';':
case L':':
case L'\'':
case L'"':
case L'%':
case L'~':
if( has_description )
desc_len++;
else
@@ -839,8 +850,7 @@ static void init()
{
struct sigaction act;
program_name = L"fish_pager";
fish_setlocale( LC_ALL, L"" );
wsetlocale( LC_ALL, L"" );
int out = dup( 1 );
close(1);

View File

@@ -1,4 +1,4 @@
/** \file main.c
/** \file fish_tests.c
Various bug and feature tests. Compiled and run by make test.
*/
@@ -38,11 +38,23 @@
#include "expand.h"
#include "parser.h"
#include "tokenizer.h"
#include "output.h"
#include "exec.h"
#include "event.h"
/**
Number of laps to run performance testing loop
*/
#define LAPS 50
/**
Number of encountered errors
*/
static int err_count=0;
/**
Print formatted output
*/
static void say( wchar_t *blah, ... )
{
va_list va;
@@ -52,6 +64,9 @@ static void say( wchar_t *blah, ... )
wprintf( L"\n" );
}
/**
Print formatted error string
*/
static void err( wchar_t *blah, ... )
{
va_list va;
@@ -64,16 +79,25 @@ static void err( wchar_t *blah, ... )
wprintf( L"\n" );
}
/**
Print ok message
*/
static void ok()
{
wprintf( L"OK\n" );
}
/**
Compare two pointers
*/
static int pq_compare( void *e1, void *e2 )
{
return e1-e2;
}
/**
Test priority queue functionality
*/
static int pq_test( int elements )
{
int i;
@@ -114,7 +138,9 @@ static int pq_test( int elements )
}
}
/**
Test stack functionality
*/
static int stack_test( int elements )
{
int i;
@@ -160,7 +186,9 @@ static int stack_test( int elements )
return res;
}
/**
Hash function for pointers
*/
static int hash_func( const void *data )
{
/* srand( (int)data );
@@ -170,12 +198,18 @@ static int hash_func( const void *data )
return 127*((foo^0xefc7e214)) ^(foo<<11);
}
/**
Pointer hash comparison function
*/
static int compare_func( const void *key1, const void *key2 )
{
return key1==key2;
}
/**
Hashtable test
*/
static int hash_test( int elements )
{
int i;
@@ -249,6 +283,9 @@ static int hash_test( int elements )
}
/**
Arraylist test
*/
static int al_test( int sz)
{
int i;
@@ -280,6 +317,9 @@ static int al_test( int sz)
}
}
/**
Stringbuffer test
*/
static void sb_test()
{
string_buffer_t b;
@@ -299,7 +339,9 @@ static void sb_test()
say( (wchar_t *)b.buff );
}
/**
Performs all tests of the util library
*/
static void test_util()
{
int i;
@@ -346,8 +388,9 @@ static void test_util()
}
/**
Test the tokenizer
*/
static void test_tok()
{
tokenizer t;
@@ -412,6 +455,9 @@ static void test_tok()
}
/**
Test the parser
*/
static void test_parser()
{
say( L"Testing parser" );
@@ -472,7 +518,7 @@ static void test_parser()
}
/**
Perform parameter expantion and test if the output equals the zero-terminated parameter list supplied.
Perform parameter expansion and test if the output equals the zero-terminated parameter list supplied.
\param in the string to expand
\param flags the flags to send to expand_string
@@ -514,10 +560,12 @@ static int expand_test( const wchar_t *in, int flags, ... )
}
/**
Test globbing and other parameter expansion
*/
static void test_expand()
{
say( L"Testing parameter expantion" );
say( L"Testing parameter expansion" );
if( !expand_test( L"foo", 0, L"foo", 0 ))
{
@@ -526,17 +574,19 @@ static void test_expand()
if( !expand_test( L"a{b,c,d}e", 0, L"abe", L"ace", L"ade", 0 ) )
{
err( L"Bracket expantion is broken" );
err( L"Bracket expansion is broken" );
}
if( !expand_test( L"a*", EXPAND_SKIP_WILDCARDS, L"a*", 0 ) )
{
err( L"Cannot skip wildcard expantion" );
err( L"Cannot skip wildcard expansion" );
}
}
/**
Test speed of completion calculations
*/
void perf_complete()
{
wchar_t c;
@@ -607,7 +657,9 @@ void perf_complete()
}
/**
Main test
*/
int main( int argc, char **argv )
{

193
fishd.c
View File

@@ -2,11 +2,45 @@
The universal variable server. fishd is automatically started by fish
if a fishd server isn't already running. fishd reads any saved
variables from ~/.fishd, and takes care of commonication between fish
variables from ~/.fishd, and takes care of communication between fish
instances. When no clients are running, fishd will automatically shut
down and save.
\subsection fishd-commands Commands
Fishd works by sending and receiving commands. Each command is ended
with a newline. These are the commands supported by fishd:
<pre>set KEY:VALUE
set_export KEY:VALUE
</pre>
These commands update the value of a variable. The only difference
between the two is that <tt>set_export</tt>-variables should be
exported to children of the process using them. The variable value may
be escaped using C-style backslash escapes. In fact, this is required
for newline characters, which would otherwise be interpreted as end of
command.
<pre>erase KEY
</pre>
Erase the variable with the specified name.
<pre>barrier
barrier_reply
</pre>
A \c barrier command will result in a barrier_reply being added to
the end of the senders queue of unsent messages. These commands are
used to synchronize clients, since once the reply for a barrier
message returns, the sender can know that any updates available at the
time the original barrier request was sent have been received.
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>
@@ -19,6 +53,10 @@ down and save.
#include <pwd.h>
#include <fcntl.h>
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
#include <errno.h>
#include <locale.h>
#include <signal.h>
@@ -35,6 +73,15 @@ down and save.
#define UNIX_PATH_MAX 100
#endif
/**
Fallback if MSG_DONTWAIT isn't defined. That's actually prerry bad,
and may lead to strange fishd behaviour, but at least it should
work most of the time.
*/
#ifndef MSG_DONTWAIT
#define MSG_DONTWAIT 0
#endif
/**
Small greeting to show that fishd is running
*/
@@ -70,6 +117,16 @@ static connection_t *conn;
*/
static int sock;
/**
Set to one when fishd should save and exit
*/
static int quit=0;
/**
Dynamically generated function, made from the documentation in doc_src.
*/
void print_help();
/**
Constructs the fish socket filename
*/
@@ -110,6 +167,15 @@ static char *get_socket_filename()
return name;
}
/**
Signal handler for the term signal.
*/
static void handle_term( int signal )
{
quit=1;
}
/**
Acquire the lock for the socket
Returns the name of the lock file if successful or
@@ -160,8 +226,8 @@ static int get_socket()
local.sun_family = AF_UNIX;
strcpy( local.sun_path, sock_name );
len = strlen( local.sun_path ) + sizeof( local.sun_family );
len = sizeof(local);
debug(1, L"Connect to socket at %s", sock_name);
if( ( s = socket( AF_UNIX, SOCK_STREAM, 0 ) ) == -1 )
@@ -268,26 +334,37 @@ static void daemonize()
case 0:
{
/*
Make fishd ignore the HUP signal.
*/
struct sigaction act;
sigemptyset( & act.sa_mask );
act.sa_flags=0;
act.sa_handler=SIG_IGN;
sigaction( SIGHUP, &act, 0);
/*
Make fishd save and exit on the TERM signal.
*/
sigfillset( & act.sa_mask );
act.sa_flags=0;
act.sa_handler=&handle_term;
sigaction( SIGTERM, &act, 0);
break;
}
default:
{
debug( 0, L"Parent calling exit" );
debug( 0, L"Parent process exiting (This is normal)" );
exit(0);
}
}
/*
Put ourself in out own processing group
*/
setsid();
/*
Close stdin and stdout. We only use stderr, anyway.
*/
@@ -350,12 +427,17 @@ void load_or_save( int save)
close( c.fd );
}
/**
Load variables from disk
*/
static void load()
{
load_or_save(0);
}
/**
Save variables to disk
*/
static void save()
{
load_or_save(1);
@@ -366,28 +448,89 @@ static void save()
*/
static void init()
{
program_name=L"fishd";
sock = get_socket();
daemonize();
fish_setlocale( LC_ALL, L"" );
env_universal_common_init( &broadcast );
load();
}
/**
Main function for fishd
*/
int main( int argc, char ** argv )
{
int child_socket, t;
int child_socket;
struct sockaddr_un remote;
socklen_t t;
int max_fd;
int update_count=0;
fd_set read_fd, write_fd;
init();
program_name=L"fishd";
wsetlocale( LC_ALL, L"" );
/*
Parse options
*/
while( 1 )
{
#ifdef HAVE_GETOPT_LONG
static struct option
long_options[] =
{
{
"help", no_argument, 0, 'h'
}
,
{
"version", no_argument, 0, 'v'
}
,
{
0, 0, 0, 0
}
}
;
int opt_index = 0;
int opt = getopt_long( argc,
argv,
"hv",
long_options,
&opt_index );
#else
int opt = getopt( argc,
argv,
"hv" );
#endif
if( opt == -1 )
break;
switch( opt )
{
case 0:
break;
case 'h':
print_help();
exit(0);
case 'v':
debug( 0, L"%ls, version %s\n", program_name, PACKAGE_VERSION );
exit( 0 );
case '?':
return 1;
}
}
init();
while(1)
{
connection_t *c;
@@ -409,15 +552,27 @@ int main( int argc, char ** argv )
FD_SET( c->fd, &write_fd );
}
}
res=select( max_fd, &read_fd, &write_fd, 0, 0 );
if( res==-1 )
while( 1 )
{
wperror( L"select" );
exit(1);
res=select( max_fd, &read_fd, &write_fd, 0, 0 );
if( quit )
{
save();
exit(0);
}
if( res != -1 )
break;
if( errno != EINTR )
{
wperror( L"select" );
exit(1);
}
}
if( FD_ISSET( sock, &read_fd ) )
{
if( (child_socket =

View File

@@ -9,6 +9,7 @@
#include <signal.h>
#include "config.h"
#include "wutil.h"
#include "util.h"
#include "function.h"
#include "proc.h"
@@ -16,6 +17,7 @@
#include "common.h"
#include "intern.h"
#include "event.h"
#include "reader.h"
/**
@@ -27,6 +29,8 @@ typedef struct
wchar_t *cmd;
/** Function description */
wchar_t *desc;
const wchar_t *definition_file;
int definition_offset;
int is_binding;
}
function_data_t;
@@ -61,6 +65,19 @@ void function_destroy()
hash_destroy( &function );
}
static int count_lineno( const wchar_t *str, int len )
{
int res = 0;
int i;
for( i=0; i<len; i++ )
{
if( str[i] == L'\n' )
res++;
}
return res;
}
void function_add( const wchar_t *name,
const wchar_t *val,
const wchar_t *desc,
@@ -68,16 +85,28 @@ void function_add( const wchar_t *name,
int is_binding )
{
int i;
wchar_t *cmd_end;
if( function_exists( name ) )
function_remove( name );
function_data_t *d = malloc( sizeof( function_data_t ) );
d->definition_offset = count_lineno( parser_get_buffer(), current_block->tok_pos );
d->cmd = wcsdup( val );
cmd_end = d->cmd + wcslen(d->cmd)-1;
while( (cmd_end>d->cmd) && wcschr( L"\n\r\t ", *cmd_end ) )
{
*cmd_end-- = 0;
}
d->desc = desc?wcsdup( desc ):0;
d->is_binding = is_binding;
d->definition_file = reader_current_filename()?intern(reader_current_filename()):0;
hash_put( &function, intern(name), d );
for( i=0; i<al_get_count( events ); i++ )
{
event_add_handler( (event_t *)al_get( events, i ) );
@@ -127,7 +156,7 @@ const wchar_t *function_get_desc( const wchar_t *argv )
if( data == 0 )
return 0;
return data->desc?data->desc:data->cmd;
return data->desc;
}
void function_set_desc( const wchar_t *name, const wchar_t *desc )
@@ -163,3 +192,26 @@ void function_get_names( array_list_t *list, int get_hidden )
}
const wchar_t *function_get_definition_file( const wchar_t *argv )
{
function_data_t *data =
(function_data_t *)hash_get( &function, argv );
if( data == 0 )
return 0;
return data->definition_file;
}
int function_get_definition_offset( const wchar_t *argv )
{
function_data_t *data =
(function_data_t *)hash_get( &function, argv );
if( data == 0 )
return -1;
return data->definition_offset;
}

View File

@@ -58,7 +58,7 @@ void function_set_desc( const wchar_t *name, const wchar_t *desc );
/**
Returns true if the function witrh the name name exists.
*/
int function_exists( const wchar_t *name);
int function_exists( const wchar_t *name );
/**
Insert all function names into l. These are not copies of the strings and should not be freed after use.
@@ -69,4 +69,8 @@ int function_exists( const wchar_t *name);
void function_get_names( array_list_t *list,
int get_hidden );
const wchar_t *function_get_definition_file( const wchar_t *name );
int function_get_definition_offset( const wchar_t *name );
#endif

View File

@@ -357,7 +357,7 @@ void highlight_shell( wchar_t * buff,
/*
Locate and syntax highlight subshells recursively
*/
wchar_t *buffcpy = wcsdup( buff );
wchar_t *subpos=buffcpy;
int done=0;
@@ -386,8 +386,9 @@ void highlight_shell( wchar_t * buff,
break;
subpos = end+1;
}
free( buffcpy );
free( buffcpy);
last_val=0;

View File

@@ -127,8 +127,8 @@ static void history_load( wchar_t *name )
Use a hashtable to check for duplicates instead.
*/
if( !hash_get( &used,
buff ) )
if( wcslen(buff) && !hash_get( &used,
buff ) )
{
history_count++;
@@ -465,10 +465,7 @@ const wchar_t *history_prev_match( const wchar_t *str )
if( history_current->prev == 0 )
{
if( history_test( str, history_current->data ) )
return (wchar_t *)history_current->data;
else
return str;
return str;
}
if( past_end )
past_end = 0;

View File

@@ -1,8 +1,8 @@
#apm
complete -f -c apm -s V -l version -d "print version"
complete -f -c apm -s v -l verbose -d "print APM info"
complete -f -c apm -s m -l minutes -d "print time remaining"
complete -f -c apm -s M -l monitor -d "monitor status info"
complete -f -c apm -s S -l standby -d "request APM standby mode"
complete -f -c apm -s s -l suspend -d "request APM suspend mode"
complete -f -c apm -s d -l debug -d "APM status debuggin info"
complete -f -c apm -s V -l version -d (_ "Display version and exit")
complete -f -c apm -s v -l verbose -d (_ "Print APM info")
complete -f -c apm -s m -l minutes -d (_ "Print time remaining")
complete -f -c apm -s M -l monitor -d (_ "Monitor status info")
complete -f -c apm -s S -l standby -d (_ "Request APM standby mode")
complete -f -c apm -s s -l suspend -d (_ "Request APM suspend mode")
complete -f -c apm -s d -l debug -d (_ "APM status debugging info")

View File

@@ -1,20 +1,21 @@
function __fish_complete_apropos
if test (commandline -ct)
set str (commandline -ct)
apropos $str|sed -e 's/^\(.*'$str'\([^ ]*\).*\)$/'$str'\2\t\1/'
apropos $str|sed -e "s/^\(.*$str\([^ ]*\).*\)$/$str\2\t\1/"
end
end
complete -xc apropos -a "(__fish_complete_apropos)" -d "Whatis entry"
complete -xc apropos -a '(__fish_complete_apropos)' -d (_ "whatis entry")
complete -c apropos -s h -l help -d "apropos command help"
complete -f -c apropos -s d -l debug -d "print debugging info"
complete -f -c apropos -s v -l verbose -d "print verbose warning"
complete -f -c apropos -s r -l regex -d "keyword as regex"
complete -f -c apropos -s w -l wildcard -d "keyword as wildwards"
complete -f -c apropos -s e -l exact -d "keyword as exactly match"
complete -x -c apropos -s m -l system -d "search for other system"
complete -x -c apropos -s M -l manpath -a "(echo $MANPATH)" -d "specify man path"
complete -x -c apropos -s C -l config-file -d "specify a conf file"
complete -f -c apropos -s V -l version -d "Display version"
complete -c apropos -s h -l help -d (_ "Display help and exit")
complete -f -c apropos -s d -l debug -d (_ "Print debugging info")
complete -f -c apropos -s v -l verbose -d (_ "Verbose mode")
complete -f -c apropos -s r -l regex -d (_ "Keyword as regex")
complete -f -c apropos -s w -l wildcard -d (_ "Keyword as wildwards")
complete -f -c apropos -s e -l exact -d (_ "Keyword as exactly match")
complete -x -c apropos -s m -l system -d (_ "Search for other system")
complete -x -c apropos -s M -l manpath -a '(echo $MANPATH)' -d (_ "Specify man path")
complete -x -c apropos -s C -l config-file -d (_ "Specify a configuration file")
complete -f -c apropos -s V -l version -d (_ "Display version and exit")

View File

@@ -1,29 +1,29 @@
#apt-build
complete -c apt-build -l help -d "apt-build command help"
complete -f -c apt-build -a update -d "update list of packages"
complete -f -c apt-build -a upgrade -d "upgrade packages"
complete -f -c apt-bulid -a world -d "rebuild your system"
complete -x -c apt-build -a install -d "build and install a new pkg"
complete -x -c apt-build -a source -d "download and extract a src"
complete -x -c apt-build -a info -d "info on a pkg"
complete -x -c apt-build -a remove -d "remove packages"
complete -x -c apt-build -a clean-build -d "erase built pkgs"
complete -x -c apt-build -a build-source -d "build src without install"
complete -x -c apt-build -a clean-sources -d "clean src dirs"
complete -x -c apt-build -a update-source -d "update src and rebuild them"
complete -x -c apt-build -a update-repository -d "update the repository"
complete -f -c apt-build -l nowrapper -d "do not use gcc wrapper"
complete -f -c apt-build -l remove-builddep -d "remove build-dep"
complete -f -c apt-build -l no-source -d "do not download source"
complete -f -c apt-build -l build-dir -d "specify build-dir"
complete -f -c apt-build -l rebuild -d "rebuild a package"
complete -f -c apt-build -l reinstall -d "rebuild and install an installed pkg"
complete -r -f -c apt-build -l build-command -d "use <command> to build"
complete -r -c apt-build -l patch -d "apply <file> patch"
complete -c apt-build -s p -l patch-strip -d "prefix to strip on patch"
complete -c apt-build -s y -l yes -d "assume yes"
complete -c apt-build -l purge -d "use purge instead of remove"
complete -c apt-build -l noupdate -d "do not run update"
complete -r -c apt-build -l source-list -d "specify sources.list file"
complete -f -c apt-build -s v -l version -d "show version"
complete -c apt-build -l help -d (_ "Display help and exit")
complete -f -c apt-build -a update -d (_ "Update list of packages")
complete -f -c apt-build -a upgrade -d (_ "Upgrade packages")
complete -f -c apt-bulid -a world -d (_ "Rebuild your system")
complete -x -c apt-build -a install -d (_ "Build and install a new package")
complete -x -c apt-build -a source -d (_ "Download and extract a source")
complete -x -c apt-build -a info -d (_ "Info on a package")
complete -x -c apt-build -a remove -d (_ "Remove packages")
complete -x -c apt-build -a clean-build -d (_ "Erase built packages")
complete -x -c apt-build -a build-source -d (_ "Build source without install")
complete -x -c apt-build -a clean-sources -d (_ "Clean source directories")
complete -x -c apt-build -a update-source -d (_ "Update source and rebuild")
complete -x -c apt-build -a update-repository -d (_ "Update the repository")
complete -f -c apt-build -l nowrapper -d (_ "Do not use gcc wrapper")
complete -f -c apt-build -l remove-builddep -d (_ "Remove build-dep")
complete -f -c apt-build -l no-source -d (_ "Do not download source")
complete -f -c apt-build -l build-dir -d (_ "Specify build-dir")
complete -f -c apt-build -l rebuild -d (_ "Rebuild a package")
complete -f -c apt-build -l reinstall -d (_ "Rebuild and install an installed package")
complete -r -f -c apt-build -l build-command -d (_ "Use <command> to build")
complete -r -c apt-build -l patch -d (_ "Apply <file> patch")
complete -c apt-build -s p -l patch-strip -d (_ "Prefix to strip on patch")
complete -c apt-build -s y -l yes -d (_ "Assume yes to all questions")
complete -c apt-build -l purge -d (_ "Use purge instead of remove")
complete -c apt-build -l noupdate -d (_ "Do not run update")
complete -r -c apt-build -l source-list -d (_ "Specify sources.list file")
complete -f -c apt-build -s v -l version -d (_ "Display version and exit")

View File

@@ -1,33 +1,31 @@
#apt-cache
complete -c apt-cache -s h -l help -d "apt-cache command help"
complete -c apt-cache -a add -d "add index files Debug only"
complete -f -c apt-cache -a gencaches -d "build apt cache"
complete -x -c apt-cache -a showpkg -d "show package info"
complete -f -c apt-cache -a stats -d "show cache statistics"
complete -x -c apt-cache -a showsrc -d "show source package"
complete -f -c apt-cache -a dump -d "show packages in cache"
complete -f -c apt-cache -a dumpavail -d "print available list"
complete -f -c apt-cache -a unmet -d "list unmet dep in cache"
complete -x -c apt-cache -a show -d "display package record"
complete -x -c apt-cache -a search -d "search pkgname by REGEX"
complete -c apt-cache -l full -a search -d "search full package name"
complete -x -c apt-cache -l names-only -a search -d "search pkgname only"
complete -x -c apt-cache -a depends -d "list dep for the package"
complete -x -c apt-cache -a rdepends -d "list reverse dep for the package"
complete -x -c apt-cache -a pkgnames -d "print package name by prefix"
complete -x -c apt-cache -a dotty -d "generate dotty output for packages"
complete -x -c apt-cache -a policy -d "debug preferences file"
complete -x -c apt-cache -a madison -d "mimic madison"
complete -r -c apt-cache -s p -l pkg-cache -d "select file to store pkg cache"
complete -r -c apt-cache -s s -l src-cache -d "select file to store src cache"
complete -f -c apt-cache -s q -l quiet -d "quiet output"
complete -f -c apt-cache -s i -l important -d "print important deps"
complete -f -c apt-cache -s a -l all-versions -d "print full records"
complete -f -c apt-cache -s g -l generate -d "auto-gen package cache"
complete -f -c apt-cache -l all-names -d "print all names"
complete -f -c apt-cache -l recurse -d "dep and rdep recursive"
complete -f -c apt-cache -l installed -d "limit to installed"
complete -f -c apt-cache -s v -l version -d "show version"
complete -r -c apt-cache -s c -l config-file -d "specify config file"
complete -x -c apt-cache -s o -l option -d "specify options"
complete -c apt-cache -s h -l help -d (_ "Display help and exit")
complete -f -c apt-cache -a gencaches -d (_ "Build apt cache")
complete -x -c apt-cache -a showpkg -d (_ "Show package info")
complete -f -c apt-cache -a stats -d (_ "Show cache statistics")
complete -x -c apt-cache -a showsrc -d (_ "Show source package")
complete -f -c apt-cache -a dump -d (_ "Show packages in cache")
complete -f -c apt-cache -a dumpavail -d (_ "Print available list")
complete -f -c apt-cache -a unmet -d (_ "List unmet dependencies in cache")
complete -x -c apt-cache -a show -d (_ "Display package record")
complete -x -c apt-cache -a search -d (_ "Search packagename by REGEX")
complete -c apt-cache -l full -a search -d (_ "Search full package name")
complete -x -c apt-cache -l names-only -a search -d (_ "Search packagename only")
complete -x -c apt-cache -a depends -d (_ "List dependencies for the package")
complete -x -c apt-cache -a rdepends -d (_ "List reverse dependencies for the package")
complete -x -c apt-cache -a pkgnames -d (_ "Print package name by prefix")
complete -x -c apt-cache -a dotty -d (_ "Generate dotty output for packages")
complete -x -c apt-cache -a policy -d (_ "Debug preferences file")
complete -r -c apt-cache -s p -l pkg-cache -d (_ "Select file to store package cache")
complete -r -c apt-cache -s s -l src-cache -d (_ "Select file to store source cache")
complete -f -c apt-cache -s q -l quiet -d (_ "Quiet mode")
complete -f -c apt-cache -s i -l important -d (_ "Print important dependencies")
complete -f -c apt-cache -s a -l all-versions -d (_ "Print full records")
complete -f -c apt-cache -s g -l generate -d (_ "Auto-gen package cache")
complete -f -c apt-cache -l all-names -d (_ "Print all names")
complete -f -c apt-cache -l recurse -d (_ "Dep and rdep recursive")
complete -f -c apt-cache -l installed -d (_ "Limit to installed")
complete -f -c apt-cache -s v -l version -d (_ "Display version and exit")
complete -r -c apt-cache -s c -l config-file -d (_ "Specify config file")
complete -x -c apt-cache -s o -l option -d (_ "Specify options")

View File

@@ -1,13 +1,13 @@
#apt-cdrom
complete -c apt-cdrom -s h -l help -d "apt-cdrom command help"
complete -r -c apt-cdrom -a add -d "add new disc to source list"
complete -x -c apt-cdrom -a ident -d "report identity of disc"
complete -r -c apt-cdrom -s d -l cdrom -d "mount point"
complete -f -c apt-cdrom -s r -l rename -d "rename a disc"
complete -f -c apt-cdrom -s m -l no-mount -d "no mounting"
complete -f -c apt-cdrom -s f -l fast -d "fast copy"
complete -f -c apt-cdrom -s a -l thorough -d "thorough pkg scan"
complete -f -c apt-cdrom -s n -l no-act -d "no changes"
complete -f -c apt-cdrom -s v -l version -d "show version"
complete -r -c apt-cdrom -s c -l config-file -d "specify config file"
complete -x -c apt-cdrom -s o -l option -d "specify options"
complete -c apt-cdrom -s h -l help -d (_ "Display help and exit")
complete -r -c apt-cdrom -a add -d (_ "Add new disc to source list")
complete -x -c apt-cdrom -a ident -d (_ "Report identity of disc")
complete -r -c apt-cdrom -s d -l cdrom -d (_ "Mount point")
complete -f -c apt-cdrom -s r -l rename -d (_ "Rename a disc")
complete -f -c apt-cdrom -s m -l no-mount -d (_ "No mounting")
complete -f -c apt-cdrom -s f -l fast -d (_ "Fast copy")
complete -f -c apt-cdrom -s a -l thorough -d (_ "Thorough package scan")
complete -f -c apt-cdrom -s n -l no-act -d (_ "No changes")
complete -f -c apt-cdrom -s v -l version -d (_ "Display version and exit")
complete -r -c apt-cdrom -s c -l config-file -d (_ "Specify config file")
complete -x -c apt-cdrom -s o -l option -d (_ "Specify options")

View File

@@ -1,7 +1,7 @@
#apt-config
complete -c apt-config -s h -l help -d "apt-config command help"
complete -c apt-config -a shell -d "access config file from shell"
complete -f -c apt-config -a dump -d "dump contents of config file"
complete -f -c apt-config -s v -l version -d "show version"
complete -r -c apt-config -s c -l config-file -d "specify config file"
complete -x -c apt-config -s o -l option -d "specify options"
complete -c apt-config -s h -l help -d (_ "Display help and exit")
complete -c apt-config -a shell -d (_ "Access config file from shell")
complete -f -c apt-config -a dump -d (_ "Dump contents of config file")
complete -f -c apt-config -s v -l version -d (_ "Display version and exit")
complete -r -c apt-config -s c -l config-file -d (_ "Specify config file")
complete -x -c apt-config -s o -l option -d (_ "Specify options")

View File

@@ -1,7 +1,7 @@
#apt-extracttemplates
complete -c apt-extracttemplates -s h -l help -d "apt-extracttemplates command help"
complete -r -c apt-extracttemplates -s t -d "set temp dir"
complete -r -c apt-extracttemplates -s c -d "specifiy config file"
complete -r -c apt-extracttemplates -s o -d "specify options"
complete -c apt-extracttemplates -s h -l help -d (_ "Display help and exit")
complete -r -c apt-extracttemplates -s t -d (_ "Set temp dir")
complete -r -c apt-extracttemplates -s c -d (_ "Specifiy config file")
complete -r -c apt-extracttemplates -s o -d (_ "Specify options")

View File

@@ -1,17 +1,17 @@
#apt-file
complete -c apt-file -s h -l help -d "apt-file command help"
complete -x -c apt-file -a update -d "resync pkg contents from source"
complete -r -c apt-file -a search -d "search pkg containing pattern"
complete -r -c apt-file -a list -d "list contents of a pkg matching pattern"
complete -x -c apt-file -a purge -d "remove all gz files from cache"
complete -r -c apt-file -s c -l cache -d "set cache dir"
complete -f -c apt-file -s v -l verbose -d "run in verbose"
complete -c apt-file -s d -l cdrom-mount -d "use cdrom-mount-point"
complete -f -c apt-file -s i -l ignore-case -d "do not expand pattern"
complete -f -c apt-file -s x -l regexp -d "pattern is regexp"
complete -f -c apt-file -s V -l version -d "show version"
complete -f -c apt-file -s a -l architecture -d "set arch"
complete -r -c apt-file -s s -l sources-list -a "(ls /etc/apt)" -d "set sources.list file"
complete -f -c apt-file -s l -l package-only -d "only display pkg name"
complete -f -c apt-file -s F -l fixed-string -d "do not expand pattern"
complete -f -c apt-file -s y -l dummy -d "run in dummy mode"
complete -c apt-file -s h -l help -d (_ "Display help and exit")
complete -x -c apt-file -a update -d (_ "Resync package contents from source")
complete -r -c apt-file -a search -d (_ "Search package containing pattern")
complete -r -c apt-file -a list -d (_ "List contents of a package matching pattern")
complete -x -c apt-file -a purge -d (_ "Remove all gz files from cache")
complete -r -c apt-file -s c -l cache -d (_ "Set cache dir")
complete -f -c apt-file -s v -l verbose -d (_ "Verbose mode")
complete -c apt-file -s d -l cdrom-mount -d (_ "Use cdrom-mount-point")
complete -f -c apt-file -s i -l ignore-case -d (_ "Do not expand pattern")
complete -f -c apt-file -s x -l regexp -d (_ "Pattern is regexp")
complete -f -c apt-file -s V -l version -d (_ "Display version and exit")
complete -f -c apt-file -s a -l architecture -d (_ "Set arch")
complete -r -c apt-file -s s -l sources-list -a "(ls /etc/apt)" -d (_ "Set sources.list file")
complete -f -c apt-file -s l -l package-only -d (_ "Only display package name")
complete -f -c apt-file -s F -l fixed-string -d (_ "Do not expand pattern")
complete -f -c apt-file -s y -l dummy -d (_ "Run in dummy mode")

View File

@@ -1,17 +1,17 @@
#apt-ftparchive
complete -c apt-ftparchive -s h -l help -d "apt-ftparchive command help"
complete -f -c apt-ftparchive -a packages -d "generate pkg from source"
complete -f -c apt-ftparchive -a sources -d "generate source index file"
complete -f -c apt-ftparchive -a contents -d "generate contents file"
complete -f -c apt-ftparchive -a release -d "generate release file"
complete -f -c apt-ftparchive -a clean -d "remove records"
complete -f -c apt-ftparchive -l md5 -d "generate MD5 sums"
complete -f -c apt-ftparchive -s d -l db -d "use a binary db"
complete -f -c apt-ftparchive -s q -l quiet -d "quiet mode"
complete -f -c apt-ftparchive -l delink -d "perform delinking"
complete -f -c apt-ftparchive -l contents -d "perform contents generation"
complete -c apt-ftparchive -s s -l source-override -d "use source override"
complete -f -c apt-ftparchive -l readonly -d "make caching db readonly"
complete -f -c apt-ftparchive -s v -l version -d "show version"
complete -r -c apt-ftparchive -s c -l config-file -d "use config file"
complete -r -c apt-ftparchive -s o -l option -d "set config options"
complete -c apt-ftparchive -s h -l help -d (_ "Display help and exit")
complete -f -c apt-ftparchive -a packages -d (_ "Generate package from source")
complete -f -c apt-ftparchive -a sources -d (_ "Generate source index file")
complete -f -c apt-ftparchive -a contents -d (_ "Generate contents file")
complete -f -c apt-ftparchive -a release -d (_ "Generate release file")
complete -f -c apt-ftparchive -a clean -d (_ "Remove records")
complete -f -c apt-ftparchive -l md5 -d (_ "Generate MD5 sums")
complete -f -c apt-ftparchive -s d -l db -d (_ "Use a binary db")
complete -f -c apt-ftparchive -s q -l quiet -d (_ "Quiet mode")
complete -f -c apt-ftparchive -l delink -d (_ "Perform delinking")
complete -f -c apt-ftparchive -l contents -d (_ "Perform contents generation")
complete -c apt-ftparchive -s s -l source-override -d (_ "Use source override")
complete -f -c apt-ftparchive -l readonly -d (_ "Make caching db readonly")
complete -f -c apt-ftparchive -s v -l version -d (_ "Display version and exit")
complete -r -c apt-ftparchive -s c -l config-file -d (_ "Use config file")
complete -r -c apt-ftparchive -s o -l option -d (_ "Set config options")

View File

@@ -1,6 +1,6 @@
#completion for apt-get
function __fish_apt_no_subcommand -d "test if apt has yet to be given the subcommand"
function __fish_apt_no_subcommand -d (_ 'Test if apt has yet to be given the subcommand')
for i in (commandline -opc)
if contains -- $i update upgrade dselect-upgrade dist-upgrade install remove source build-dep check clean autoclean
return 1
@@ -9,7 +9,7 @@ function __fish_apt_no_subcommand -d "test if apt has yet to be given the subcom
return 0
end
function __fish_apt_use_package -d "Test if apt command should have packages as potential completion"
function __fish_apt_use_package -d (_ 'Test if apt command should have packages as potential completion')
for i in (commandline -opc)
if contains -- $i contains install remove build-dep
return 0
@@ -18,47 +18,47 @@ function __fish_apt_use_package -d "Test if apt command should have packages as
return 1
end
complete -c apt-get -n "__fish_apt_use_package" -a "(__fish_print_packages)" -d "Package"
complete -c apt-get -n '__fish_apt_use_package' -a '(__fish_print_packages)' -d (_ 'Package')
complete -c apt-get -s h -l help -d "apt-get command help"
complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "update" -d "update sources"
complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "upgrade" -d "upgrade or install newest packages"
complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "dselect-upgrade" -d "use with dselect front-end"
complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "dist-upgrade" -d "distro upgrade"
complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "install" -d "install one or more packages"
complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "remove" -d "remove one or more packages"
complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "source" -d "fetch source packages"
complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "build-dep" -d "install/remove packages for dependencies"
complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "check" -d "update cache and check dep"
complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "clean" -d "clean local caches and packages"
complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "autoclean" -d "clean packages no longer be downloaded"
complete -c apt-get -s d -l download-only -d "Download Only"
complete -c apt-get -s f -l fix-broken -d "correct broken deps"
complete -c apt-get -s m -l fix-missing -d "ignore missing packages"
complete -c apt-get -l no-download -d "Disable downloading packages"
complete -c apt-get -s q -l quiet -d "quiet output"
complete -c apt-get -s s -l simulate -d "perform a siulation"
complete -c apt-get -s y -l assume-yes -d "automatic yes to prompts"
complete -c apt-get -s u -l show-upgraded -d "show upgraded packages"
complete -c apt-get -s V -l verbose-versions -d "show full versions for packages"
complete -c apt-get -s b -l compile -d "compile source packages"
complete -c apt-get -s b -l build -d "compile source packages"
complete -c apt-get -l ignore-hold -d "ignore package Holds"
complete -c apt-get -l no-upgrade -d "Do not upgrade packages"
complete -c apt-get -l force-yes -d "Force yes"
complete -c apt-get -l print-uris -d "print the URIs"
complete -c apt-get -l purge -d "use purge instead of remove"
complete -c apt-get -l reinstall -d "reinstall packages"
complete -c apt-get -l list-cleanup -d "erase obsolete files"
complete -c apt-get -s t -l target-release -d "control default input to the policy engine"
complete -c apt-get -l trivial-only -d "only perform operations that are trivial"
complete -c apt-get -l no-remove -d "abort if any packages are to be removed"
complete -c apt-get -l only-source -d "only accept source packages"
complete -c apt-get -l diff-only -d "download only diff file"
complete -c apt-get -l tar-only -d "download only tar file"
complete -c apt-get -l arch-only -d "only process arch-dep build-deps"
complete -c apt-get -l allow-unauthenticated -d "ignore non-authenticated packages"
complete -c apt-get -s v -l version -d "show program version"
complete -r -c apt-get -s c -l config-file -d "specify a config file"
complete -r -c apt-get -s o -l option -d "set a config option"
complete -c apt-get -s h -l help -d (_ 'Display help and exit')
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'update' -d (_ 'Update sources')
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'upgrade' -d (_ 'Upgrade or install newest packages')
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'dselect-upgrade' -d (_ 'Use with dselect front-end')
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'dist-upgrade' -d (_ 'Distro upgrade')
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'install' -d (_ 'Install one or more packages')
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'remove' -d (_ 'Remove one or more packages')
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'source' -d (_ 'Fetch source packages')
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'build-dep' -d (_ 'Install/remove packages for dependencies')
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'check' -d (_ 'Update cache and check dependencies')
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'clean' -d (_ 'Clean local caches and packages')
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'autoclean' -d (_ 'Clean packages no longer be downloaded')
complete -c apt-get -s d -l download-only -d (_ 'Download Only')
complete -c apt-get -s f -l fix-broken -d (_ 'Correct broken dependencies')
complete -c apt-get -s m -l fix-missing -d (_ 'Ignore missing packages')
complete -c apt-get -l no-download -d (_ 'Disable downloading packages')
complete -c apt-get -s q -l quiet -d (_ 'Quiet mode')
complete -c apt-get -s s -l simulate -d (_ 'Perform a simulation')
complete -c apt-get -s y -l assume-yes -d (_ 'Automatic yes to prompts')
complete -c apt-get -s u -l show-upgraded -d (_ 'Show upgraded packages')
complete -c apt-get -s V -l verbose-versions -d (_ 'Show full versions for packages')
complete -c apt-get -s b -l compile -d (_ 'Compile source packages')
complete -c apt-get -s b -l build -d (_ 'Compile source packages')
complete -c apt-get -l ignore-hold -d (_ 'Ignore package Holds')
complete -c apt-get -l no-upgrade -d (_ "Do not upgrade packages")
complete -c apt-get -l force-yes -d (_ 'Force yes')
complete -c apt-get -l print-uris -d (_ 'Print the URIs')
complete -c apt-get -l purge -d (_ 'Use purge instead of remove')
complete -c apt-get -l reinstall -d (_ 'Reinstall packages')
complete -c apt-get -l list-cleanup -d (_ 'Erase obsolete files')
complete -c apt-get -s t -l target-release -d (_ 'Control default input to the policy engine')
complete -c apt-get -l trivial-only -d (_ 'Only perform operations that are trivial')
complete -c apt-get -l no-remove -d (_ 'Abort if any packages are to be removed')
complete -c apt-get -l only-source -d (_ 'Only accept source packages')
complete -c apt-get -l diff-only -d (_ 'Download only diff file')
complete -c apt-get -l tar-only -d (_ 'Download only tar file')
complete -c apt-get -l arch-only -d (_ 'Only process arch-dependant build-dependencies')
complete -c apt-get -l allow-unauthenticated -d (_ 'Ignore non-authenticated packages')
complete -c apt-get -s v -l version -d (_ 'Display version and exit')
complete -r -c apt-get -s c -l config-file -d (_ 'Specify a config file')
complete -r -c apt-get -s o -l option -d (_ 'Set a config option')

View File

@@ -1,5 +1,5 @@
#apt-key
complete -r -c apt-key -a add -d "add a new key"
complete -f -c apt-key -a del -d "remove a key"
complete -f -c apt-key -a list -d "list trusted keys"
complete -r -c apt-key -a add -d (_ "Add a new key")
complete -f -c apt-key -a del -d (_ "Remove a key")
complete -f -c apt-key -a list -d (_ "List trusted keys")

View File

@@ -1,25 +1,25 @@
#apt-listbugs
complete -c apt-listbugs -s h -l help -d "apt-listbugs command help"
complete -f -c apt-listbugs -s s -l severity -a "critical grave" -d "set severity"
complete -f -c apt-listbugs -s T -l tag -d "Targs you want to see"
complete -f -c apt-listbugs -s S -l stats -d "outstanding 'pending upload' resolved done open" -d "status you want to see"
complete -f -c apt-listbugs -s l -l showless -d "ignore bugs in your system"
complete -f -c apt-listbugs -s g -l showgreater -d "ignore newer bugs than upgrade pkgs"
complete -f -c apt-listbugs -s D -l show-downgrade -d "bugs for downgrade pkgs"
complete -f -c apt-listbugs -s H -l hostname -a "osdn.debian.or.jp" -d "Bug Tracking system"
complete -f -c apt-listbugs -s p -l port -d "specify port for web interface"
complete -f -c apt-listbugs -s R -l release-critical -d "use daily bug report"
complete -f -c apt-listbugs -s I -l index -d "use the raw index.db"
complete -f -c apt-listbugs -s X -l indexdir -d "specify index dir"
complete -f -c apt-listbugs -s P -l pin-priority -d "specify Pin-Priority value"
complete -f -c apt-listbugs -l title -d "specify the title of rss"
complete -f -c apt-listbugs -s f -l force-download -d "retrieve fresh bugs"
complete -f -c apt-listbugs -s q -l quiet -d "do not display progress bar"
complete -f -c apt-listbugs -s c -l cache-dir -a "/var/cache/apt-listbugs/" -d "specify local cache dir"
complete -f -c apt-listbugs -s t -l timer -d "specify the expire cache timer"
complete -c apt-listbugs -s C -l aptconf -d "specify apt config file"
complete -f -c apt-listbugs -s y -l force-yes -d "assume all yes"
complete -f -c apt-listbugs -s n -l force-no -d "assume all no"
complete -c apt-listbugs -a list -d "list bugs from pkgs"
complete -c apt-listbugs -a rss -d "list bugs in rss format"
complete -c apt-listbugs -s h -l help -d (_ "Display help and exit")
complete -f -c apt-listbugs -s s -l severity -a "critical grave" -d (_ "Set severity")
complete -f -c apt-listbugs -s T -l tag -d (_ "Tags you want to see")
complete -f -c apt-listbugs -s S -l stats -a "outstanding 'pending upload' resolved done open" -d (_ "Bug-status you want to see")
complete -f -c apt-listbugs -s l -l showless -d (_ "Ignore bugs in your system")
complete -f -c apt-listbugs -s g -l showgreater -d (_ "Ignore newer bugs than upgrade packages")
complete -f -c apt-listbugs -s D -l show-downgrade -d (_ "Bugs for downgrade packages")
complete -f -c apt-listbugs -s H -l hostname -a "osdn.debian.or.jp" -d (_ "Bug Tracking system")
complete -f -c apt-listbugs -s p -l port -d (_ "Specify port for web interface")
complete -f -c apt-listbugs -s R -l release-critical -d (_ "Use daily bug report")
complete -f -c apt-listbugs -s I -l index -d (_ "Use the raw index.db")
complete -f -c apt-listbugs -s X -l indexdir -d (_ "Specify index dir")
complete -f -c apt-listbugs -s P -l pin-priority -d (_ "Specify Pin-Priority value")
complete -f -c apt-listbugs -l title -d (_ "Specify the title of rss")
complete -f -c apt-listbugs -s f -l force-download -d (_ "Retrieve fresh bugs")
complete -f -c apt-listbugs -s q -l quiet -d (_ "Do not display progress bar")
complete -f -c apt-listbugs -s c -l cache-dir -a "/var/cache/apt-listbugs/" -d (_ "Specify local cache dir")
complete -f -c apt-listbugs -s t -l timer -d (_ "Specify the expire cache timer")
complete -c apt-listbugs -s C -l aptconf -d (_ "Specify apt config file")
complete -f -c apt-listbugs -s y -l force-yes -d (_ "Assume yes to all questions")
complete -f -c apt-listbugs -s n -l force-no -d (_ "Assume no to all questions")
complete -c apt-listbugs -a list -d (_ "List bugs from packages")
complete -c apt-listbugs -a rss -d (_ "List bugs in rss format")

View File

@@ -1,13 +1,13 @@
#apt-listchanges
complete -c apt-listchanges -l help -d "apt-listchanges command help"
complete -c apt-listchanges -l apt -d "read filenames from pipe"
complete -f -c apt-listchanges -s v -l verbose -d "verbose info"
complete -f -c apt-listchanges -s f -l frontend -a "pager browser xterm-pager xterm-browser text mail none" -d "select fronend interface"
complete -r -f -c apt-listchanges -l email-address -d "specify email address"
complete -f -c apt-listchanges -s c -l confirm -d "ask confirmation"
complete -f -c apt-listchanges -s a -l all -d "display all changelogs"
complete -r -c apt-listchanges -l save_seen -d "avoid changelogs from db in named file"
complete -r -f -c apt-listchanges -l which -a "news changelogs both" -d "select display"
complete -f -c apt-listchanges -s h -l headers -d "insert header"
complete -f -c apt-listchanges -l debug -d "display debug info"
complete -r -c apt-listchanges -l profile -d "select an option profile"
complete -c apt-listchanges -l help -d (_ "Display help and exit")
complete -c apt-listchanges -l apt -d (_ "Read filenames from pipe")
complete -f -c apt-listchanges -s v -l verbose -d (_ "Verbose mode")
complete -f -c apt-listchanges -s f -l frontend -a "pager browser xterm-pager xterm-browser text mail none" -d (_ "Select fronend interface")
complete -r -f -c apt-listchanges -l email-address -d (_ "Specify email address")
complete -f -c apt-listchanges -s c -l confirm -d (_ "Ask confirmation")
complete -f -c apt-listchanges -s a -l all -d (_ "Display all changelogs")
complete -r -c apt-listchanges -l save_seen -d (_ "Avoid changelogs from db in named file")
complete -r -f -c apt-listchanges -l which -a "news changelogs both" -d (_ "Select display")
complete -f -c apt-listchanges -s h -l headers -d (_ "Insert header")
complete -f -c apt-listchanges -l debug -d (_ "Display debug info")
complete -r -c apt-listchanges -l profile -d (_ "Select an option profile")

View File

@@ -1,23 +1,22 @@
#apt-move
complete -c apt-move -a get -d "generate master file"
complete -c apt-move -a getlocal -d "alias of get"
complete -f -c apt-move -a move -d "move pkgs to local tree"
complete -f -c apt-move -a delete -d "delete obsolete pkg files"
complete -f -c apt-move -a packages -d "build new local files"
complete -f -c apt-move -a fsck -d "rebuild index files"
complete -f -c apt-move -a update -d "move pkgs from cache to local mirror"
complete -f -c apt-move -a local -d "alias to move delete packages"
complete -f -c apt-move -a localupdate -d "alias for update"
complete -f -c apt-move -a mirror -d "download pkg missing from mirror"
complete -f -c apt-move -a sync -d "sync pkgs installed"
complete -c apt-move -a get -d (_ "Generate master file")
complete -c apt-move -a getlocal -d (_ "Alias for 'get'")
complete -f -c apt-move -a move -d (_ "Move packages to local tree")
complete -f -c apt-move -a delete -d (_ "Delete obsolete package files")
complete -f -c apt-move -a packages -d (_ "Build new local files")
complete -f -c apt-move -a fsck -d (_ "Rebuild index files")
complete -f -c apt-move -a update -d (_ "Move packages from cache to local mirror")
complete -f -c apt-move -a local -d (_ "Alias for 'move delete packages'")
complete -f -c apt-move -a localupdate -d (_ "Alias for 'update'")
complete -f -c apt-move -a mirror -d (_ "Download package missing from mirror")
complete -f -c apt-move -a sync -d (_ "Sync packages installed")
complete -f -c apt-move -a exclude -d 'test $LOCALDIR/.exclude file'
complete -c apt-move -a movefile -d "move file from CLI"
complete -f -c apt-move -a listbin -d "mirror|sync|repo"
complete -f -c apt-move -a mirrorbin -d "fetch pkg from STDIN"
complete -f -c apt-move -a mirrorsrc -d "fetch src pkg from STDIN"
complete -f -c apt-move -s a -d "process all pkgs"
complete -c apt-move -s c -d "use specific conffile"
complete -f -c apt-move -s d -d "use specific dist"
complete -f -c apt-move -s f -d "force deletion"
complete -f -c apt-move -s q -d "suppresses normal output"
complete -f -c apt-move -s t -d "test run"
complete -c apt-move -a movefile -d (_ "Move file specified on commandline")
complete -f -c apt-move -a listbin -d (_ "List packags that may serve as input to mirrorbin or mirrorsource" )
complete -f -c apt-move -a mirrorbin -d (_ "Fetch package from STDIN")
complete -f -c apt-move -a mirrorsrc -d (_ "Fetch source package from STDIN")
complete -f -c apt-move -s a -d (_ "Process all packages")
complete -c apt-move -s c -d (_ "Use specific conffile")
complete -f -c apt-move -s f -d (_ "Force deletion")
complete -f -c apt-move -s q -d (_ "Suppresses normal output")
complete -f -c apt-move -s t -d (_ "Test run")

View File

@@ -1,10 +1,10 @@
#apt-proxy-import
complete -c apt-proxy-import -s h -l help -d "apt-proxy-import command help"
complete -f -c apt-proxy-import -s V -l version -d "print version"
complete -f -c apt-proxy-import -s v -l verbose -d "verbose info"
complete -f -c apt-proxy-import -s q -l quiet -d "no message to STDOUT"
complete -f -c apt-proxy-import -s r -l recursive -d "recurse into subdir"
complete -r -c apt-proxy-import -s i -l import-dir -a "(ls -Fp|grep /$)" -d "dir to import"
complete -r -c apt-proxy-import -s u -l user -a "(__fish_complete_users)" -d "change to user"
complete -r -c apt-proxy-import -s d -l debug -d "debug level[default 0]"
complete -c apt-proxy-import -s h -l help -d (_ 'Display help and exit')
complete -f -c apt-proxy-import -s V -l version -d (_ 'Display version and exit')
complete -f -c apt-proxy-import -s v -l verbose -d (_ 'Verbose mode')
complete -f -c apt-proxy-import -s q -l quiet -d (_ 'No message to STDOUT')
complete -f -c apt-proxy-import -s r -l recursive -d (_ 'Recurse into subdir')
complete -r -c apt-proxy-import -s i -l import-dir -a '(ls -Fp|grep /$)' -d (_ 'Dir to import')
complete -r -c apt-proxy-import -s u -l user -a '(__fish_complete_users)' -d (_ 'Change to user')
complete -r -c apt-proxy-import -s d -l debug -d (_ 'Debug level[default 0]')

View File

@@ -1,13 +1,13 @@
#apt-rdepends
complete -c apt-rdepends -l help -d "apt-rdepends command help"
complete -f -c apt-rdepends -s b -l build-depends -d "show bulid deps"
complete -f -c apt-rdepends -s d -l dotty -d "generate a dotty graph"
complete -f -c apt-rdepends -s p -l print-state -d "show state of deps"
complete -f -c apt-rdepends -s r -l reverse -d "list pkgs depending on"
complete -r -f -c apt-rdepends -s f -l follow -d "only follow DEPENDS recursively"
complete -r -f -c apt-rdepends -s s -l show -d "only show DEPENDS"
complete -r -f -c apt-rdepends -l state-follow -d "only follow STATES recursively"
complete -r -f -c apt-rdepends -l state-show -d "only show STATES"
complete -f -c apt-rdepends -l man -d "display man page"
complete -f -c apt-rdepends -l version -d "print version"
complete -c apt-rdepends -l help -d (_ "Display help and exit")
complete -f -c apt-rdepends -s b -l build-depends -d (_ "Show bulid dependencies")
complete -f -c apt-rdepends -s d -l dotty -d (_ "Generate a dotty graph")
complete -f -c apt-rdepends -s p -l print-state -d (_ "Show state of dependencies")
complete -f -c apt-rdepends -s r -l reverse -d (_ "List packages depending on")
complete -r -f -c apt-rdepends -s f -l follow -d (_ "Comma-separated list of dependancy types to follow recursively")
complete -r -f -c apt-rdepends -s s -l show -d (_ "Comma-separated list of dependancy types to show")
complete -r -f -c apt-rdepends -l state-follow -d (_ "Comma-separated list of package installation states to follow recursively")
complete -r -f -c apt-rdepends -l state-show -d (_ "Comma-separated list of package installation states to show")
complete -f -c apt-rdepends -l man -d (_ "Display man page")
complete -f -c apt-rdepends -l version -d (_ "Display version and exit")

View File

@@ -1,4 +1,4 @@
#apt-setup
complete -c apt-setup -a probe -d "probe a CD"
complete -c apt-setup -s N -d "run in noninteractive mode"
complete -c apt-setup -a probe -d (_ "Probe a CD")
complete -c apt-setup -s N -d (_ "Run in noninteractive mode")

View File

@@ -1,10 +1,10 @@
#apt-show-source
complete -c apt-show-source -s h -l help -d "apt-show-source command help"
complete -r -c apt-show-source -l status-file -d "read pkg from FILE" -f
complete -r -c apt-show-source -o stf -d "read pkg from FILE" -f
complete -r -c apt-show-source -l list-dir -a "(ls -Fp .|grep /$) /var/lib/apt/lists" -d "specify APT list dir"
complete -r -c apt-show-source -o ld -a "(ls -Fp .|grep /$) /var/lib/apt/lists" -d "specify APT list dir"
complete -r -c apt-show-source -s p -l package -a "(apt-cache pkgnames)" -d "list PKG info"
complete -f -c apt-show-source -l version-only -d "print version only"
complete -f -c apt-show-source -s a -l all -d "print all src pkgs with version"
complete -f -c apt-show-source -s v -l verbose -d "verbose message"
complete -c apt-show-source -s h -l help -d (_ 'Display help and exit')
complete -r -c apt-show-source -l status-file -d (_ 'Read package from file') -f
complete -r -c apt-show-source -o stf -d (_ 'Read package from file') -f
complete -r -c apt-show-source -l list-dir -a '(ls -Fp .|grep /$) /var/lib/apt/lists' -d (_ 'Specify APT list dir')
complete -r -c apt-show-source -o ld -a '(ls -Fp .|grep /$) /var/lib/apt/lists' -d (_ 'Specify APT list dir')
complete -r -c apt-show-source -s p -l package -a '(apt-cache pkgnames)' -d (_ 'List PKG info')
complete -f -c apt-show-source -l version-only -d (_ 'Display version and exit')
complete -f -c apt-show-source -s a -l all -d (_ 'Print all source packages with version')
complete -f -c apt-show-source -s v -l verbose -d (_ 'Verbose mode')

View File

@@ -1,14 +1,14 @@
#apt-show-versions
complete -c apt-show-source -s h -l help -d "apt-show-versions command help"
complete -r -c apt-show-versions -s p -l packages -a "(apt-cache pkgnames)" -d "print PKG versions"
complete -f -c apt-show-versions -s r -l regex -d "using regex"
complete -f -c apt-show-versions -s u -l upgradeable -d "print only upgradeable pkgs"
complete -f -c apt-show-versions -s a -l allversions -d "print all versions"
complete -f -c apt-show-versions -s b -l brief -d "print pkg name/distro"
complete -f -c apt-show-versions -s v -l verbose -d "print verbose info"
complete -f -c apt-show-versions -s i -l initialize -d "init or update cache only"
complete -r -c apt-show-versions -l status-file -d "read pkg from FILE"
complete -r -c apt-show-versions -o stf -d "read pkg from FILE"
complete -r -c apt-show-versions -l list-dir -a "(ls -Fp .|grep /$) /var/lib/apt/lists /var/state/apt/lists" -d "specify APT list dir"
complete -r -c apt-show-versions -o ld -a "(ls -Fp .|grep /$) /var/lib/apt/lists /var/state/apt/lists" -d "specify APT list dir"
complete -c apt-show-source -s h -l help -d (_ 'Display help and exit')
complete -r -c apt-show-versions -s p -l packages -a '(apt-cache pkgnames)' -d (_ 'Print PKG versions')
complete -f -c apt-show-versions -s r -l regex -d (_ 'Using regex')
complete -f -c apt-show-versions -s u -l upgradeable -d (_ 'Print only upgradeable packages')
complete -f -c apt-show-versions -s a -l allversions -d (_ 'Print all versions')
complete -f -c apt-show-versions -s b -l brief -d (_ 'Print package name/distro')
complete -f -c apt-show-versions -s v -l verbose -d (_ 'Print verbose info')
complete -f -c apt-show-versions -s i -l initialize -d (_ 'Init or update cache only')
complete -r -c apt-show-versions -l status-file -d (_ 'Read package from file')
complete -r -c apt-show-versions -o stf -d (_ 'Read package from file')
complete -r -c apt-show-versions -l list-dir -a '(ls -Fp .|grep /$) /var/lib/apt/lists /var/state/apt/lists' -d (_ 'Specify APT list dir')
complete -r -c apt-show-versions -o ld -a '(ls -Fp .|grep /$) /var/lib/apt/lists /var/state/apt/lists' -d (_ 'Specify APT list dir')

View File

@@ -1,7 +1,7 @@
#apt-sortpkgs
complete -c apt-sortpkgs -s h -l help -d "apt-sortpkgs command help"
complete -f -c apt-sortpkgs -s s -l source -d "use source index field"
complete -f -c apt-sortpkgs -s v -l version -d "show version"
complete -r -c apt-sortpkgs -s c -l conf-file -d "specify conffile"
complete -r -f -c apt-sortpkgs -s o -l option -d "set config options"
complete -c apt-sortpkgs -s h -l help -d (_ "Display help and exit")
complete -f -c apt-sortpkgs -s s -l source -d (_ "Use source index field")
complete -f -c apt-sortpkgs -s v -l version -d (_ "Display version and exit")
complete -r -c apt-sortpkgs -s c -l conf-file -d (_ "Specify conffile")
complete -r -f -c apt-sortpkgs -s o -l option -d (_ "Set config options")

View File

@@ -1,20 +1,20 @@
#apt-spy
complete -c apt-spy -s h -d "apt-spy command help"
complete -f -c apt-spy -s d -a "stable testing unstable" -d "Debian distribtion"
complete -f -c apt-spy -s a -a "Africa Asia Europe North-America Oceania South-America" -d "servers in the areas"
complete -c apt-spy -s c -d "conf file"
complete -f -c apt-spy -s e -d "finish after number of servers"
complete -c apt-spy -s f -d "file to grab servers"
complete -c apt-spy -s i -d "file as input"
complete -c apt-spy -s m -d "mirror-list file"
complete -c apt-spy -s o -d "output sources.list file"
complete -f -c apt-spy -s p -d "use proxy server"
complete -f -c apt-spy -s s -d "comma separated country list"
complete -f -c apt-spy -s t -d "how long in sec to download"
complete -f -c apt-spy -s u -d "custom URL to get mirror list"
complete -c apt-spy -s w -d "write top servers to file"
complete -f -c apt-spy -s n -d "number of top servers"
complete -f -c apt-spy -a "update" -d "update mirror list"
complete -f -c apt-spy -s v -d "version number"
complete -c apt-spy -s h -d (_ "Display help and exit")
complete -f -c apt-spy -s d -a "stable testing unstable" -d (_ "Debian distribtion")
complete -f -c apt-spy -s a -a "Africa Asia Europe North-America Oceania South-America" -d (_ "Servers in the areas")
complete -c apt-spy -s c -d (_ "Conf file")
complete -f -c apt-spy -s e -d (_ "Finish after number of servers")
complete -c apt-spy -s f -d (_ "File to grab servers")
complete -c apt-spy -s i -d (_ "File as input")
complete -c apt-spy -s m -d (_ "Mirror-list file")
complete -c apt-spy -s o -d (_ "Output sources.list file")
complete -f -c apt-spy -s p -d (_ "Use proxy server")
complete -f -c apt-spy -s s -d (_ "Comma separated country list")
complete -f -c apt-spy -s t -d (_ "How long in sec to download")
complete -f -c apt-spy -s u -d (_ "Custom URL to get mirror list")
complete -c apt-spy -s w -d (_ "Write top servers to file")
complete -f -c apt-spy -s n -d (_ "Number of top servers")
complete -f -c apt-spy -a "update" -d (_ "Update mirror list")
complete -f -c apt-spy -s v -d (_ "Version number")

View File

@@ -1,24 +1,24 @@
#apt-src
complete -c apt-src -s h -l help -d "apt-src command help"
complete -f -c apt-src -a "update" -d "update list of src pkgs"
complete -f -c apt-src -a "install" -d "install src pkgs"
complete -f -c apt-src -a "upgrade" -d "upgrade src pkgs"
complete -f -c apt-src -a "remove" -d "remove src pkgs"
complete -f -c apt-src -a "build" -d "build src pkgs"
complete -f -c apt-src -a "clean" -d "clean src pkgs"
complete -f -c apt-src -a "import" -d "detect known src tree"
complete -f -c apt-src -a "list" -d "list installed src pkg\(s\)"
complete -f -c apt-src -a "location" -d "root src tree"
complete -f -c apt-src -a "version" -d "version of src pkg"
complete -f -c apt-src -a "name" -d "name of the src pkg"
complete -f -c apt-src -s b -l build -d "build src pkgs"
complete -f -c apt-src -s i -l installdebs -d "install after build"
complete -f -c apt-src -s p -l patch -d "patch local changes"
complete -r -c apt-src -s l -l location -d "specify a dir"
complete -c apt-src -s c -l here -d "run on current dir"
complete -f -c apt-src -l upstream-version -d "omit debian version"
complete -f -c apt-src -s k -l keep-built -d "do not del built files"
complete -f -c apt-src -s n -l no-delete-source -d "do not del source files"
complete -f -c apt-src -l version -d "source tree version"
complete -f -c apt-src -s q -l quiet -d "output to /dev/null"
complete -f -c apt-src -s t -l trace -d "output trace"
complete -c apt-src -s h -l help -d (_ "Display help and exit")
complete -f -c apt-src -a "update" -d (_ "Update list of source packages")
complete -f -c apt-src -a "install" -d (_ "Install source packages")
complete -f -c apt-src -a "upgrade" -d (_ "Upgrade source packages")
complete -f -c apt-src -a "remove" -d (_ "Remove source packages")
complete -f -c apt-src -a "build" -d (_ "Build source packages")
complete -f -c apt-src -a "clean" -d (_ "Clean source packages")
complete -f -c apt-src -a "import" -d (_ "Detect known source tree")
complete -f -c apt-src -a "list" -d (_ "List installed source package\(s\)")
complete -f -c apt-src -a "location" -d (_ "Root source tree")
complete -f -c apt-src -a "version" -d (_ "Version of source package")
complete -f -c apt-src -a "name" -d (_ "Name of the source package")
complete -f -c apt-src -s b -l build -d (_ "Build source packages")
complete -f -c apt-src -s i -l installdebs -d (_ "Install after build")
complete -f -c apt-src -s p -l patch -d (_ "Patch local changes")
complete -r -c apt-src -s l -l location -d (_ "Specify a dir")
complete -c apt-src -s c -l here -d (_ "Run on current dir")
complete -f -c apt-src -l upstream-version -d (_ "Omit debian version")
complete -f -c apt-src -s k -l keep-built -d (_ "Do not del built files")
complete -f -c apt-src -s n -l no-delete-source -d (_ "Do not del source files")
complete -f -c apt-src -l version -d (_ "Source tree version")
complete -f -c apt-src -s q -l quiet -d (_ "Output to /dev/null")
complete -f -c apt-src -s t -l trace -d (_ "Output trace")

View File

@@ -1,10 +1,10 @@
#apt-zip-inst
complete -c apt-zip-inst -s h -l help -d "apt-zip-inst command help"
complete -f -c apt-zip-inst -s V -l version -d "show version"
complete -c apt-zip-inst -s m -l medium -d "removable medium"
complete -f -c apt-zip-inst -s a -l aptgetaction -a "dselect-upgrade upgrade dist-upgrade" -d "select an action"
complete -c apt-zip-inst -s p -l packages -d "list of pkgs to install"
complete -f -c apt-zip-inst -s f -l fix-broken -d "fix broken option"
complete -c apt-zip-inst -l skip-mount -d "specify a non-mountpoint dir"
complete -c apt-zip-inst -s h -l help -d (_ "Display help and exit")
complete -f -c apt-zip-inst -s V -l version -d (_ "Display version and exit")
complete -c apt-zip-inst -s m -l medium -d (_ "Removable medium")
complete -f -c apt-zip-inst -s a -l aptgetaction -a "dselect-upgrade upgrade dist-upgrade" -d (_ "Select an action")
complete -c apt-zip-inst -s p -l packages -d (_ "List of packages to install")
complete -f -c apt-zip-inst -s f -l fix-broken -d (_ "Fix broken option")
complete -c apt-zip-inst -l skip-mount -d (_ "Specify a non-mountpoint dir")

View File

@@ -1,13 +1,13 @@
#apt-zip-list
complete -c apt-zip-list -s h -l help -d "apt-zip-list command help"
complete -f -c apt-zip-list -s V -l version -d "show version"
complete -c apt-zip-list -s m -l medium -d "removable medium"
complete -f -c apt-zip-list -s a -l aptgetaction -a "dselect-upgrade upgrade dist-upgrade" -d "select an action"
complete -c apt-zip-list -s p -l packages -d "list of pkgs to install"
complete -f -c apt-zip-list -s f -l fix-broken -d "fix broken option"
complete -c apt-zip-list -l skip-mount -d "specify a non-mountpoint dir"
complete -c apt-zip-list -s M -l method -d "select a method"
complete -c apt-zip-list -s o -l options -a "tar restart" -d "specify options"
complete -c apt-zip-list -s A -l accept -a "http ftp" -d "accept protocols"
complete -c apt-zip-list -s R -l reject -a "http ftp" -d "reject protocols"
complete -c apt-zip-list -s h -l help -d (_ "Display help and exit")
complete -f -c apt-zip-list -s V -l version -d (_ "Display version and exit")
complete -c apt-zip-list -s m -l medium -d (_ "Removable medium")
complete -f -c apt-zip-list -s a -l aptgetaction -a "dselect-upgrade upgrade dist-upgrade" -d (_ "Select an action")
complete -c apt-zip-list -s p -l packages -d (_ "List of packages to install")
complete -f -c apt-zip-list -s f -l fix-broken -d (_ "Fix broken option")
complete -c apt-zip-list -l skip-mount -d (_ "Specify a non-mountpoint dir")
complete -c apt-zip-list -s M -l method -d (_ "Select a method")
complete -c apt-zip-list -s o -l options -a "tar restart" -d (_ "Specify options")
complete -c apt-zip-list -s A -l accept -a "http ftp" -d (_ "Accept protocols")
complete -c apt-zip-list -s R -l reject -a "http ftp" -d (_ "Reject protocols")

View File

@@ -1,11 +1,11 @@
#completion for arp
complete -c arp -s v -l verbose -d "verbose mode"
complete -c arp -s n -l numeric -d "numerical address"
complete -x -c arp -s H -l tw-type -a "ether arcnet pronet ax25 netrom" -d "class of hw type"
complete -c arp -s a -l display -x -a "(__fish_print_hostnames)" -d "show arp entries"
complete -x -c arp -s d -l delete -a "(__fish_print_hostnames)" -d "remove an entry for hostname"
complete -c arp -s D -l use-device -d "use hardware address"
complete -x -c arp -s i -l device -a "(__fish_print_interfaces)" -d "select interface"
complete -x -c arp -s s -l set -d "Manually create ARP address" -a "(__fish_print_hostnames)"
complete -f -c arp -s f -l file -d "taken addr from filename, default /etc/ethers"
complete -c arp -s v -l verbose -d (_ "Verbose mode")
complete -c arp -s n -l numeric -d (_ "Numerical address")
complete -x -c arp -s H -l tw-type -a "ether arcnet pronet ax25 netrom" -d (_ "Class of hw type")
complete -c arp -s a -l display -x -a "(__fish_print_hostnames)" -d (_ "Show arp entries")
complete -x -c arp -s d -l delete -a "(__fish_print_hostnames)" -d (_ "Remove an entry for hostname")
complete -c arp -s D -l use-device -d (_ "Use hardware address")
complete -x -c arp -s i -l device -a "(__fish_print_interfaces)" -d (_ "Select interface")
complete -x -c arp -s s -l set -d (_ "Manually create ARP address") -a "(__fish_print_hostnames)"
complete -f -c arp -s f -l file -d (_ "Take addr from filename, default /etc/ethers")

View File

@@ -1,10 +1,10 @@
#at
complete -f -c at -s V -d "print version"
complete -f -c at -s q -d "use specified queue"
complete -f -c at -s m -d "send mail to user"
complete -c at -s f -x -a "(__fish_complete_suffix (commandline -ct) '' 'At job')" -d "Read job from file"
complete -f -c at -s l -d "alias for atq"
complete -f -c at -s d -d "alias for atrm"
complete -f -c at -s v -d "show the time"
complete -f -c at -s c -d "cat the jobs listed"
complete -f -c at -s V -d (_ "Display version and exit")
complete -f -c at -s q -d (_ "Use specified queue")
complete -f -c at -s m -d (_ "Send mail to user")
complete -c at -s f -x -a "(__fish_complete_suffix (commandline -ct) '' 'At job')" -d (_ "Read job from file")
complete -f -c at -s l -d (_ "Alias for atq")
complete -f -c at -s d -d (_ "Alias for atrm")
complete -f -c at -s v -d (_ "Show the time")
complete -f -c at -s c -d (_ "Print the jobs listed")

View File

@@ -1,6 +1,6 @@
#atd
complete -f -c atd -s l -d "limiting load factor"
complete -f -c atd -s b -d "minimum interval in seconds"
complete -f -c atd -s d -d "Debug mode"
complete -f -c atd -s s -d "process at queue only once"
complete -f -c atd -s l -d (_ "Limiting load factor")
complete -f -c atd -s b -d (_ "Minimum interval in seconds")
complete -f -c atd -s d -d (_ "Debug mode")
complete -f -c atd -s s -d (_ "Process at queue only once")

View File

@@ -1,4 +1,4 @@
#atq
complete -f -c atq -s V -d "print version"
complete -f -c atq -s q -d "use specified queue"
complete -f -c atq -s V -d (_ "Display version and exit")
complete -f -c atq -s q -d (_ "Use specified queue")

View File

@@ -1,2 +1,2 @@
#atrm
complete -f -c atrm -s V -d "print version"
complete -f -c atrm -s V -d (_ "Display version and exit")

View File

@@ -1,9 +1,9 @@
# Completions for the binary calculator
complete -c bc -s i -l interactive -d "Force interactive mode"
complete -c bc -s l -l math-lib -d "Define math library"
complete -c bc -s w -l warn -d "Give warnings for extensions to POSIX bc"
complete -c bc -s s -l standard -d "Process exactly POSIX bc"
complete -c bc -s q -l quiet -d "Do not print the GNU welcome"
complete -c bc -s v -l version -d "Display version and exit"
complete -c bc -s h -l help -d "Display help and exit"
complete -c bc -s i -l interactive -d (_ "Force interactive mode")
complete -c bc -s l -l math-lib -d (_ "Define math library")
complete -c bc -s w -l warn -d (_ "Give warnings for extensions to POSIX bc")
complete -c bc -s s -l standard -d (_ "Process exactly POSIX bc")
complete -c bc -s q -l quiet -d (_ "Do not print the GNU welcome")
complete -c bc -s v -l version -d (_ "Display version and exit")
complete -c bc -s h -l help -d (_ "Display help and exit")

View File

@@ -1,34 +1,33 @@
# Bittorrent commands
for i in btdownloadcurses.py btdownloadheadless.py;
complete -c $i -l max_uploads -x -d "Maximum uploads at once"
complete -c $i -l keepalive_interval -x -d "Number of seconds between keepalives"
complete -c $i -l download_slice_size -x -d "Bytes per request"
complete -c $i -l request_backlog -x -d "Requests per pipe"
complete -c $i -l max_message_length -x -d "Maximum length prefix encoding"
complete -c $i -l ip -d "IP to report to the tracker" -x -a "(__fish_print_addresses)"
complete -c $i -l minport -d "Minimum port to listen to"
complete -c $i -l maxport -d "Maximum port to listen to"
complete -c $i -l responsefile -r -d "File for server response"
complete -c $i -l url -x -d "URL to get file from"
complete -c $i -l saveas -r -d "Local file target"
complete -c $i -l timeout -x -d "Time to close inactive socket"
complete -c $i -l timeout_check_interval -x -d "Time between checking timeouts"
complete -c $i -l max_slice_length -x -d "Maximum outgoing slice length"
complete -c $i -l max_rate_period -x -d "Maximum time to guess rate"
complete -c $i -l bind -x -d "IP to bind to locally" -a "(__fish_print_addresses)"
complete -c $i -l upload_rate_fudge -x -d "time equivalent of writing to kernel-level TCP buffer"
complete -c $i -l display_interval -x -d "Time between screen updates"
complete -c $i -l rerequest_interval -x -d "Time to wait between requesting more peers"
complete -c $i -l min_peers -x -d "Minimum number of peers to not do requesting"
complete -c $i -l http_timeout -x -d "Number of seconds before assuming http timeout"
complete -c $i -l max_initiate -x -d "Number of peers at which to stop initiating new connections"
complete -c $i -l max_allow_in -x -d "Maximum number of connections to allow"
complete -c $i -l check_hashes -x -d "Whether to check hashes on disk"
complete -c $i -l max_upload_rate -x -d "Maximum kB/s to upload at"
complete -c $i -l snub_time -x -d "Seconds to wait for data to come in before assuming choking"
complete -c $i -l spew -x -d "Whether to display diagnostic info"
complete -c $i -l rarest_first_cutoff -x -d "Number of downloads at which to switch from random to rarest first"
complete -c $i -l min_uploads -x -d "Number of uploads to fill out to with optimistic unchokes"
complete -c $i -l report_hash_failiures -x -d "Whether to inform the user that hash failures occur"
complete -c $i -l max_uploads -x -d (_ "Maximum uploads at once")
complete -c $i -l keepalive_interval -x -d (_ "Number of seconds between keepalives")
complete -c $i -l download_slice_size -x -d (_ "Bytes per request")
complete -c $i -l request_backlog -x -d (_ "Requests per pipe")
complete -c $i -l max_message_length -x -d (_ "Maximum length prefix encoding")
complete -c $i -l ip -d (_ "IP to report to the tracker") -x -a "(__fish_print_addresses)"
complete -c $i -l minport -d (_ "Minimum port to listen to")
complete -c $i -l maxport -d (_ "Maximum port to listen to")
complete -c $i -l responsefile -r -d (_ "File for server response")
complete -c $i -l url -x -d (_ "URL to get file from")
complete -c $i -l saveas -r -d (_ "Local file target")
complete -c $i -l timeout -x -d (_ "Time to close inactive socket")
complete -c $i -l timeout_check_interval -x -d (_ "Time between checking timeouts")
complete -c $i -l max_slice_length -x -d (_ "Maximum outgoing slice length")
complete -c $i -l max_rate_period -x -d (_ "Maximum time to guess rate")
complete -c $i -l bind -x -d (_ "IP to bind to locally") -a "(__fish_print_addresses)"
complete -c $i -l display_interval -x -d (_ "Time between screen updates")
complete -c $i -l rerequest_interval -x -d (_ "Time to wait between requesting more peers")
complete -c $i -l min_peers -x -d (_ "Minimum number of peers to not do requesting")
complete -c $i -l http_timeout -x -d (_ "Number of seconds before assuming http timeout")
complete -c $i -l max_initiate -x -d (_ "Number of peers at which to stop initiating new connections")
complete -c $i -l max_allow_in -x -d (_ "Maximum number of connections to allow")
complete -c $i -l check_hashes -x -d (_ "Whether to check hashes on disk")
complete -c $i -l max_upload_rate -x -d (_ "Maximum kB/s to upload at")
complete -c $i -l snub_time -x -d (_ "Seconds to wait for data to come in before assuming choking")
complete -c $i -l spew -x -d (_ "Whether to display diagnostic info")
complete -c $i -l rarest_first_cutoff -x -d (_ "Number of downloads at which to switch from random to rarest first")
complete -c $i -l min_uploads -x -d (_ "Number of uploads to fill out to with optimistic unchokes")
complete -c $i -l report_hash_failiures -x -d (_ "Whether to inform the user that hash failures occur")
end;

View File

@@ -6,10 +6,10 @@ complete -c bunzip2 -x -a "(
)
"
complete -c bunzip2 -s c -l stdout -d "Decompress to stdout"
complete -c bunzip2 -s f -l force -d "Overwrite"
complete -c bunzip2 -s k -l keep -d "Do not overwrite"
complete -c bunzip2 -s s -l small -d "Reduce memory usage"
complete -c bunzip2 -s v -l verbose -d "Print compression ratios"
complete -c bunzip2 -s L -l license -d "Print license"
complete -c bunzip2 -s V -l version -d "Print version"
complete -c bunzip2 -s c -l stdout -d (_ "Decompress to stdout")
complete -c bunzip2 -s f -l force -d (_ "Overwrite")
complete -c bunzip2 -s k -l keep -d (_ "Do not overwrite")
complete -c bunzip2 -s s -l small -d (_ "Reduce memory usage")
complete -c bunzip2 -s v -l verbose -d (_ "Print compression ratios")
complete -c bunzip2 -s L -l license -d (_ "Print license")
complete -c bunzip2 -s V -l version -d (_ "Display version and exit")

View File

@@ -5,4 +5,4 @@ complete -c bzcat -x -a "(
__fish_complete_suffix (commandline -ct) .tbz2 'Compressed archive'
)
"
complete -c bzcat -s s -l small -d "Reduce memory usage"
complete -c bzcat -s s -l small -d (_ "Reduce memory usage")

View File

@@ -1,4 +1,4 @@
complete -c bzip2 -s c -l stdout -d "Compress to stdout"
complete -c bzip2 -s c -l stdout -d (_ "Compress to stdout")
complete -c bzip2 -s d -l decompress -x -a "(
__fish_complete_suffix (commandline -ct) .bz 'Compressed file'
__fish_complete_suffix (commandline -ct) .bz2 'Compressed file'
@@ -6,14 +6,14 @@ complete -c bzip2 -s d -l decompress -x -a "(
__fish_complete_suffix (commandline -ct) .tbz2 'Compressed archive'
)
"
complete -c bzip2 -s z -l compress -d "Compress file"
complete -c bzip2 -s t -l test -d "Check integrity"
complete -c bzip2 -s f -l force -d "Overwrite"
complete -c bzip2 -s k -l keep -d "Do not overwrite"
complete -c bzip2 -s s -l small -d "Reduce memory usage"
complete -c bzip2 -s q -l quiet -d "Supress errors"
complete -c bzip2 -s v -l verbose -d "Print compression ratios"
complete -c bzip2 -s L -l license -d "Print license"
complete -c bzip2 -s V -l version -d "Print version"
complete -c bzip2 -s 1 -l fast -d "Small block size"
complete -c bzip2 -s 9 -l best -d "Large block size"
complete -c bzip2 -s z -l compress -d (_ "Compress file")
complete -c bzip2 -s t -l test -d (_ "Check integrity")
complete -c bzip2 -s f -l force -d (_ "Overwrite")
complete -c bzip2 -s k -l keep -d (_ "Do not overwrite")
complete -c bzip2 -s s -l small -d (_ "Reduce memory usage")
complete -c bzip2 -s q -l quiet -d (_ "Supress errors")
complete -c bzip2 -s v -l verbose -d (_ "Print compression ratios")
complete -c bzip2 -s L -l license -d (_ "Print license")
complete -c bzip2 -s V -l version -d (_ "Display version and exit")
complete -c bzip2 -s 1 -l fast -d (_ "Small block size")
complete -c bzip2 -s 9 -l best -d (_ "Large block size")

View File

@@ -1,12 +1,12 @@
complete -c cat -s A -l show-all -d "Escape all non-printing characters"
complete -c cat -s b -l number-nonblank -d "Number nonblank lines"
complete -c cat -s e -d "Escape non-printing characters except tab"
complete -c cat -s E -l show-ends -d "Display $ at end of line"
complete -c cat -s n -l number -d "Number all lines"
complete -c cat -s s -l squeeze-blank -d "Never more than single blank line"
complete -c cat -s t -d "Escape non-printing characters except newline"
complete -c cat -s T -l show-tabs -d "Escape tab"
complete -c cat -s v -d "Escape non-printing except newline and tab"
complete -c cat -l help -d "Display help and exit"
complete -c cat -l version -d "Display version and exit"
complete -c cat -s A -l show-all -d (_ "Escape all non-printing characters")
complete -c cat -s b -l number-nonblank -d (_ "Number nonblank lines")
complete -c cat -s e -d (_ "Escape non-printing characters except tab")
complete -c cat -s E -l show-ends -d (_ "Display \$ at end of line")
complete -c cat -s n -l number -d (_ "Number all lines")
complete -c cat -s s -l squeeze-blank -d (_ "Never more than single blank line")
complete -c cat -s t -d (_ "Escape non-printing characters except newline")
complete -c cat -s T -l show-tabs -d (_ "Escape tab")
complete -c cat -s v -d (_ "Escape non-printing except newline and tab")
complete -c cat -l help -d (_ "Display help and exit")
complete -c cat -l version -d (_ "Display version and exit")

View File

@@ -1,12 +1,12 @@
complete -c chgrp -s c -l changes -d "Output diagnostic for changed files"
complete -c chgrp -l dereference -d "Dereferense symbolic links"
complete -c chgrp -s h -l no-dereference -d "Do not dereference symbolic links"
complete -c chgrp -l from -d "Change from owner/group"
complete -c chgrp -s f -l silent -d "Supress errors"
complete -c chgrp -l reference -d "Use same owner/group as file" -r
complete -c chgrp -s R -l recursive -d "Operate recursively"
complete -c chgrp -s v -l verbose -d "Output diagnostic for every file"
complete -c chgrp -s h -l help -d "Display help and exit"
complete -c chgrp -l version -d "Display version and exit"
complete -c chgrp -s c -l changes -d (_ "Output diagnostic for changed files")
complete -c chgrp -l dereference -d (_ "Dereferense symbolic links")
complete -c chgrp -s h -l no-dereference -d (_ "Do not dereference symbolic links")
complete -c chgrp -l from -d (_ "Change from owner/group")
complete -c chgrp -s f -l silent -d (_ "Supress errors")
complete -c chgrp -l reference -d (_ "Use same owner/group as file") -r
complete -c chgrp -s R -l recursive -d (_ "Operate recursively")
complete -c chgrp -s v -l verbose -d (_ "Output diagnostic for every file")
complete -c chgrp -s h -l help -d (_ "Display help and exit")
complete -c chgrp -l version -d (_ "Display version and exit")
complete -c chgrp -d Group -a "(__fish_complete_groups)"

View File

@@ -1,12 +1,12 @@
complete -c chown -s c -l changes -d "Output diagnostic for changed files"
complete -c chown -l dereference -d "Dereferense symbolic links"
complete -c chown -s h -l no-dereference -d "Do not dereference symbolic links"
complete -c chown -l from -d "Change from owner/group"
complete -c chown -s f -l silent -d "Supress errors"
complete -c chown -l reference -d "Use same owner/group as file" -r
complete -c chown -s R -l recursive -d "Operate recursively"
complete -c chown -s v -l verbose -d "Output diagnostic for every file"
complete -c chown -s h -l help -d "Display help and exit"
complete -c chown -l version -d "Display version and exit"
complete -c chown -d "Username" -a "(__fish_print_users):"
complete -c chown -d "Username" -a "(echo (commandline -ct)|grep -o '.*:')(cat /etc/group |cut -d : -f 1)"
complete -c chown -s c -l changes -d (_ "Output diagnostic for changed files")
complete -c chown -l dereference -d (_ "Dereferense symbolic links")
complete -c chown -s h -l no-dereference -d (_ "Do not dereference symbolic links")
complete -c chown -l from -d (_ "Change from owner/group")
complete -c chown -s f -l silent -d (_ "Supress errors")
complete -c chown -l reference -d (_ "Use same owner/group as file") -r
complete -c chown -s R -l recursive -d (_ "Operate recursively")
complete -c chown -s v -l verbose -d (_ "Output diagnostic for every file")
complete -c chown -s h -l help -d (_ "Display help and exit")
complete -c chown -l version -d (_ "Display version and exit")
complete -c chown -d (_ "Username") -a "(__fish_print_users):"
complete -c chown -d (_ "Username") -a "(echo (commandline -ct)|grep -o '.*:')(cat /etc/group |cut -d : -f 1)"

View File

@@ -0,0 +1,10 @@
#
# Completions for the chsh command
#
complete -c chsh -s s -l shell -x -a "(chsh -l)" -d "Specify your login shell"
complete -c chsh -s l -l list-shells -d "Display the list of shells listed in /etc/shells and exit"
complete -c chsh -s u -l help -d "Display help and exit"
complete -c chsh -s v -l version -d "Display version and exit"
complete -x -c chsh -a "(__fish_complete_users)"

View File

@@ -1,12 +1,12 @@
complete -c commandline -s a -l append -d "Add text to the end of commandline"
complete -c commandline -s i -l insert -d "Add text at cursor"
complete -c commandline -s r -l replace -d "Replace selected part of buffer (replace)"
complete -c commandline -s a -l append -d (_ "Add text to the end of the selected area")
complete -c commandline -s i -l insert -d (_ "Add text at cursor")
complete -c commandline -s r -l replace -d (_ "Replace selected part")
complete -c commandline -s j -l current-job -d "Operate only on job under cursor"
complete -c commandline -s p -l current-process -d "Operate only on process under cursor"
complete -c commandline -s t -l current-token -d "Operate only on tokenizer token under cursor"
complete -c commandline -s b -l current-buffer -d "Operate on entire buffer (default)"
complete -c commandline -s j -l current-job -d (_ "Select job under cursor")
complete -c commandline -s p -l current-process -d (_ "Select process under cursor")
complete -c commandline -s t -l current-token -d (_ "Select token under cursor")
complete -c commandline -s b -l current-buffer -d (_ "Select entire command line (default)")
complete -c commandline -s c -l cut-at-cursor -d "Only return part of commandline before the cursor"
complete -c commandline -s f -l function -d "Inject readline functions to reader"
complete -c commandline -s c -l cut-at-cursor -d (_ "Only return that part of the command line before the cursor")
complete -c commandline -s f -l function -d (_ "Inject readline functions to reader")

View File

@@ -1,13 +1,13 @@
complete -c complete -s c -l command -d "Command to add completion to" -r
complete -c complete -s p -l path -d "Path to add completion to"
complete -c complete -s s -l short-option -d "Posix-style option to complete"
complete -c complete -s l -l long-option -d "GNU-style option to complete"
complete -c complete -s o -l old-option -d "Old style long option to complete"
complete -c complete -s f -l no-files -d "Do not use file completion"
complete -c complete -s r -l require-parameter -d "Require parameter"
complete -c complete -s x -l exclusive -d "Require parameter and do not use file completion"
complete -c complete -s a -l arguments -d "A list of possible arguments"
complete -c complete -s d -l description -d "Description of this completions"
complete -c complete -s u -l unauthorative -d "Option list is not complete"
complete -c complete -s e -l erase -d "Remove completion"
complete -c complete -s h -l help -d "Display help and exit"
complete -c complete -s c -l command -d (_ "Command to add completion to") -r
complete -c complete -s p -l path -d (_ "Path to add completion to")
complete -c complete -s s -l short-option -d (_ "Posix-style option to complete")
complete -c complete -s l -l long-option -d (_ "GNU-style option to complete")
complete -c complete -s o -l old-option -d (_ "Old style long option to complete")
complete -c complete -s f -l no-files -d (_ "Do not use file completion")
complete -c complete -s r -l require-parameter -d (_ "Require parameter")
complete -c complete -s x -l exclusive -d (_ "Require parameter and do not use file completion")
complete -c complete -s a -l arguments -d (_ "A list of possible arguments")
complete -c complete -s d -l description -d (_ "Description of this completions")
complete -c complete -s u -l unauthorative -d (_ "Option list is not complete")
complete -c complete -s e -l erase -d (_ "Remove completion")
complete -c complete -s h -l help -d (_ "Display help and exit")

Some files were not shown because too many files have changed in this diff Show More