Compare commits

..

597 Commits

Author SHA1 Message Date
axel
ec58ffa641 Bump version number
darcs-hash:20060531154529-ac50b-92c8377b8b3164fa280c02b4752243295c4b7c40.gz
2006-06-01 01:45:29 +10:00
axel
2c44ecb4a3 Drop debug message
darcs-hash:20060531154456-ac50b-2367291f440bff21b3029829ff7dff86be5b5ec1.gz
2006-06-01 01:44:56 +10:00
axel
2eebb6e7ed Revert addition of the seq file to repo - only seq.in should be there. Also apply earlier fix to seq.in
darcs-hash:20060531154428-ac50b-7ddeef083d3d965eb484cb11a71c1291660fee89.gz
2006-06-01 01:44:28 +10:00
axel
1a3ab8a189 Make validation code show offening parameter on perameter expansion problems
darcs-hash:20060531154147-ac50b-dd9b9a3e000352b045a4a9c3122a45a312c43f19.gz
2006-06-01 01:41:47 +10:00
axel
4722ddc373 Increase size of buffer for parser error string. Should change this to a dynamically allocated string.
darcs-hash:20060531154028-ac50b-ada120ecfe65bcf1ad1b3d1a5fad41ae9dec133c.gz
2006-06-01 01:40:28 +10:00
axel
25365dbc54 Minor change to the strings to a printf comman, since it seems to work differently under different platforms
darcs-hash:20060530091417-ac50b-4eead9f39433b54ab66dea1c336b533689d85c46.gz
2006-05-30 19:14:17 +10:00
axel
6a5f11879b Minor code simplifications in highlighting code
darcs-hash:20060530003535-ac50b-6babcc9880a018a669e123c2acdb548adb4406ce.gz
2006-05-30 10:35:35 +10:00
axel
b028e41f7f Slightly updated fusermount completions - Thanks to Sean Higgins
darcs-hash:20060529135227-ac50b-ffce282fc850a895da75f64cd8a151277f42a937.gz
2006-05-29 23:52:27 +10:00
axel
86593cd6a2 Add highlighting to a few missing escape sequences
darcs-hash:20060529134659-ac50b-48de59c1c84e4e3d3a6cf6283ec8a652986c380d.gz
2006-05-29 23:46:59 +10:00
axel
6cae5c8b0a Minor rewordings and additions to the manual
darcs-hash:20060529134607-ac50b-097cf23e8009b13afa456cf3946cc0799b0fd471.gz
2006-05-29 23:46:07 +10:00
axel
29cd62ab6e Check documentation for listing of external commands instead of relying on out of date static lists in various places
darcs-hash:20060529133239-ac50b-48392cfa1e5817ed8df452f0632658af7fe47a28.gz
2006-05-29 23:32:39 +10:00
axel
4c7e06e752 Add missing event trigger when non-universal variable is erased
darcs-hash:20060529131217-ac50b-feb2034230297d9edc120369d8f3c1cfff6acfcd.gz
2006-05-29 23:12:17 +10:00
axel
433169dca4 Avoid using the pwd command in favour of the $PWD variable, since the pwd command does not seem to work well with fuse
darcs-hash:20060529130753-ac50b-0d32fe0924dbf9e83520d26402e9daae77789419.gz
2006-05-29 23:07:53 +10:00
axel
d46dade284 Rename function expand_variable_array to tokenize_variable_array and move it from expand.c to common.c, since it is used by fish_pager, which should not depend on expand.o
darcs-hash:20060529111342-ac50b-315d7dcf04e05fa8f32e16801e6793ac4e4e022e.gz
2006-05-29 21:13:42 +10:00
axel
79b466441b Fix major memory leak in highlighting code and a minor leak in the parser
darcs-hash:20060528110630-ac50b-94a83ec6731b39ebcf864b7491ec3c372e28a135.gz
2006-05-28 21:06:30 +10:00
axel
9f14d50974 Extend manual section on highlighting colors
darcs-hash:20060528105437-ac50b-c1c703206e855e5a4b5d7cf48bc19c48e12d2833.gz
2006-05-28 20:54:37 +10:00
axel
990803009e Minor edits
darcs-hash:20060527134918-ac50b-b244916fc6649e1abb4832bdaa3fff81fcbe3937.gz
2006-05-27 23:49:18 +10:00
axel
6dfd629fc5 Update todo list
darcs-hash:20060527134859-ac50b-3890023bb4003bbf773bf68dbcb9588c6ec55600.gz
2006-05-27 23:48:59 +10:00
axel
d97f8f3fde Add missing completion for complete builtin
darcs-hash:20060527134741-ac50b-dd50e408384d48b4b859240ac4fb6ad1ea8d25a5.gz
2006-05-27 23:47:41 +10:00
axel
95ca3d1c69 Minor clarifications for documentation for the set builtin
darcs-hash:20060527134723-ac50b-8ad44bf44a8537f12b45281950fcaf85abbdd8f4.gz
2006-05-27 23:47:23 +10:00
axel
c8b04f70cf Add highlighting of a few missing escapes
darcs-hash:20060527134026-ac50b-3ff05d1fe0246d37c1be6e4a6d4492bf411808b7.gz
2006-05-27 23:40:26 +10:00
axel
bffff77d17 Add support for bold highligting
darcs-hash:20060527133930-ac50b-515d0887567c0e89fdfe10fe8310d6ebb4485974.gz
2006-05-27 23:39:30 +10:00
axel
6bdb0cde8b Add support for highligting qutes in a special color - defaults to blue
darcs-hash:20060527123516-ac50b-d6e0cf08bd9dfe8514e64004d93dc4035e73fad8.gz
2006-05-27 22:35:16 +10:00
axel
42a260f1e6 Use ahead of time validator to make sure that commands entered on the command line are valid
darcs-hash:20060527111456-ac50b-1bc070467029b851d34a1b99457415e3f0b24429.gz
2006-05-27 21:14:56 +10:00
axel
148cb68700 Add Parenthesis and braces to list of highlighted operators, and do minor code cleanup
darcs-hash:20060527005618-ac50b-272d096796b732b7d6c000c30be1a9ca1e1995a6.gz
2006-05-27 10:56:18 +10:00
axel
18c185c256 Add support for highlighting operators and escaped sequences
darcs-hash:20060526164638-ac50b-2259579e0460df0641683ce6127bb8516fca8c7e.gz
2006-05-27 02:46:38 +10:00
axel
b5b49e7a4d Make sure that getopt flags are only written down once
darcs-hash:20060526145551-ac50b-5411809433e277cd0bdebc34907ee3312a8a0263.gz
2006-05-27 00:55:51 +10:00
axel
28ea5ce732 Add missing N_.fish file to repo
darcs-hash:20060526120906-ac50b-5c903a99dfcb176c454bec2abc25360e8a7bf79a.gz
2006-05-26 22:09:06 +10:00
axel
eccba7626d Properly exit ca_mode terminal mode on exit
darcs-hash:20060526120331-ac50b-bbddd181b0784072a47e0f852012b9588c4fc3d6.gz
2006-05-26 22:03:31 +10:00
axel
79d3207d51 The fallback seq implementation was missing in the darcs repo, add it and fix a bug in it
darcs-hash:20060526114722-ac50b-4b75ac32c6490b358bb1003736fdc47198f37030.gz
2006-05-26 21:47:22 +10:00
axel
d6bf879675 Move jobs builtin to its own file
darcs-hash:20060526113811-ac50b-9c0ed1aa26cd2f247978e406bea86e8c36d73710.gz
2006-05-26 21:38:11 +10:00
axel
051f557e8f Minor code polish for the validation code
darcs-hash:20060526112525-ac50b-d15f974d7abc5ffdc61273c1642c1cb711bc23fd.gz
2006-05-26 21:25:25 +10:00
axel
17171c3277 If a help page for a builtin is showed in response to an error, make sure it fits on screen, or only print the synopsis - this patch also contains a huge number of tweaks to where and when the help pages are printed
darcs-hash:20060526112402-ac50b-88993e45f411b2f1c45b3202c393c5328f1c7429.gz
2006-05-26 21:24:02 +10:00
axel
18a59291ed Bugfix for previous patch to simplify configuration checks for ulimit builtin
darcs-hash:20060526111934-ac50b-ae9e85cd3e18994d2c56c2f6c69df6a1d93f9ea6.gz
2006-05-26 21:19:34 +10:00
axel
29e86254d0 Allow tab completion of empty command names
darcs-hash:20060521223213-ac50b-5201b7f0dfe5227f93aae6db94450e165c9a5a34.gz
2006-05-22 08:32:13 +10:00
axel
b746a803a9 Add validator check to make sure the second argument to 'for' is 'in'
darcs-hash:20060521221604-ac50b-5bc4ce217a08304f68b97b20e908ea1279fe26e9.gz
2006-05-22 08:16:04 +10:00
axel
07e14ed7a8 Rewrite small amount of code in parameter expansion to use wide character strings, not narrow
darcs-hash:20060521214601-ac50b-bb3937f5abd2780a7ecf8ab13975a0f6b622323f.gz
2006-05-22 07:46:01 +10:00
axel
df5cc6f858 Fix bugs detected by the ahead-of-time syntax checking in the complete builtin
darcs-hash:20060521192705-ac50b-b4304328fb4b9cce853055a2f231c48050a17471.gz
2006-05-22 05:27:05 +10:00
axel
409a407ca0 Use ahead-of-time syntax checker to validate input for complete builtin
darcs-hash:20060521192630-ac50b-c469f5bb3bd2afddce3ffa80adba0589d515b938.gz
2006-05-22 05:26:30 +10:00
axel
1c2cbb00bc Major update to the ahead-of-time syntax checker
darcs-hash:20060521192524-ac50b-48713f826558e66ef21046d1bb779623cc2fd97a.gz
2006-05-22 05:25:24 +10:00
axel
bbf2a3836f Simplify code for detecting which macros are defined in sys/resource.h, no configure-time tests are needed
darcs-hash:20060519151443-ac50b-c87dba2175f5bf8d652c783559c3a9992247aa01.gz
2006-05-20 01:14:43 +10:00
axel
1aa1ab540e Bump version number
darcs-hash:20060519141037-ac50b-52155b56cfcd60f4a57787cd29ef8fa3f6348acc.gz
2006-05-20 00:10:37 +10:00
axel
27c9eb8758 Fix test suite
darcs-hash:20060519141023-ac50b-96cb2401e68ed0fa169c332c8efa8037a8482011.gz
2006-05-20 00:10:23 +10:00
axel
e6b1035ddc Spelling fixes - Thanks Netocrat!
darcs-hash:20060519140425-ac50b-e687924b06a7711b4e92930e239aea4b01076434.gz
2006-05-20 00:04:25 +10:00
axel
9f6aba38d6 Define WCHAR_MAX to INT_MAX, not 0x7fffffff if undefined, as per suggestion from Netocrat
darcs-hash:20060519095948-ac50b-19842d18f4a020da7895d21df2f289dcf42f30bf.gz
2006-05-19 19:59:48 +10:00
axel
b52fe0feb6 Minor edits to builtin_set.c
darcs-hash:20060519085813-ac50b-67b6772ac7723e13312e444944cc4b077ba23479.gz
2006-05-19 18:58:13 +10:00
axel
db459f869a Update the PATH checking code to work in batch mode
darcs-hash:20060518133726-ac50b-81759f01565fdfdb85c042c1db1b766a9a6adcda.gz
2006-05-18 23:37:26 +10:00
axel
763a6b8351 Minor cleanup
darcs-hash:20060518130039-ac50b-c17e794113c38909d90be840fce36c7727c628b4.gz
2006-05-18 23:00:39 +10:00
axel
4a06821d99 Make fish remove invalid PATH entries on startup, and give a warning about it
darcs-hash:20060518130017-ac50b-9326ed6b5671bbe0285fd2d5604e4ea69087c7c1.gz
2006-05-18 23:00:17 +10:00
axel
22f3dcfd35 Fix bug that causes fish to elongate the PATH whith directories which are already there
darcs-hash:20060518125909-ac50b-9c23915bb6f51f9105e04ad71b102b386b5d43a9.gz
2006-05-18 22:59:09 +10:00
axel
dbb66e1895 Remove two minor memory leaks
darcs-hash:20060514223903-ac50b-4e764c460effd8c45493acfe5682626c3711c77e.gz
2006-05-15 08:39:03 +10:00
axel
5a7a264b96 Fix bug that caused block level io redirection to break on while loops
darcs-hash:20060514222905-ac50b-7dec0ed716f5fe6af9069b597eee464829a8d820.gz
2006-05-15 08:29:05 +10:00
axel
3d601bd751 Remove superflous event_signal_listen function, replace all calls to it with event_get
darcs-hash:20060514222758-ac50b-de4457154510b89d1c9b893bc39f06a23c8fc08f.gz
2006-05-15 08:27:58 +10:00
axel
c9deea2237 Minor edits
darcs-hash:20060514163936-ac50b-2a208818ccb26dabb60fba18078c3824da40adf5.gz
2006-05-15 02:39:36 +10:00
axel
32e54fd719 Remove some hardcoded values in favour of constants
darcs-hash:20060514132510-ac50b-2c703e8892d04b7d74555d05eb6618140e281a61.gz
2006-05-14 23:25:10 +10:00
axel
9ebdc16be6 Fix the longstanding hang-on-exit bug in eterm, as well as making sure the history is saved when the terminal emulator exits
darcs-hash:20060514101623-ac50b-f8ce693ec111e3c158640ef8de309bf7e5484c5b.gz
2006-05-14 20:16:23 +10:00
axel
92ecc01baa Fix broken method for sorting output of builtin commands 'functions', 'set' and others
darcs-hash:20060514094721-ac50b-9f1d8b6a2e8b4438e6a655de61af54d15cd4f537.gz
2006-05-14 19:47:21 +10:00
axel
ff1c5e058f Fix output of the functions command, where a single function would sometimes be printed twice
darcs-hash:20060514094635-ac50b-0cb03011b667a2458c19619a04d46140834e637c.gz
2006-05-14 19:46:35 +10:00
axel
3d192a8e93 Remoce C99:ism (Non-constant expression as array size)
darcs-hash:20060512154447-ac50b-5731603e1bf75f91703bf79cc06f6bbdb94e6a61.gz
2006-05-13 01:44:47 +10:00
axel
f5c6306bde Do not repaint prompt on universal variable events, but add event handler for fish_color_cwd to repiant prompt on change
darcs-hash:20060511122629-ac50b-a725d87fe9ec911282e8de79aa9de5c00d180caa.gz
2006-05-11 22:26:29 +10:00
axel
524e0aa174 Add fallback del_curterm which does nothing, used in preference to BSD curses del_curterm, which seems to do a double-free
darcs-hash:20060511115846-ac50b-8d5fc054d31cff637d30e858ae8ffe2b1d1e8c03.gz
2006-05-11 21:58:46 +10:00
axel
94abb30f94 Do not try to read init files if the cd to the proper directory fails
darcs-hash:20060511115758-ac50b-94661cb36c5a55bc78ddfe576d1cd40fada5f065.gz
2006-05-11 21:57:58 +10:00
axel
af8e053896 Include stdint.h, in fallback.h, since WCHAR_MAX might be defined there and not in wchar.h, as the C standard says - Thanks to Peter Moulder for pointing this one out
darcs-hash:20060510132704-ac50b-9da156a6ee5f04e33fa8d5bf8cee581a88643cb2.gz
2006-05-10 23:27:04 +10:00
axel
633e2f498f Escape $ character in apropos completions - Thanks to Peter Moulder for pointing this one out
darcs-hash:20060510115641-ac50b-51db7d181d63119c6edc223b06f8b8b63e8149d6.gz
2006-05-10 21:56:41 +10:00
axel
4932538c74 Add a few NULL checks to the codebase to avoid crashes on minor bugs
darcs-hash:20060510115431-ac50b-f6b50fb29b95ff88e7504355aaffef1edcb6739d.gz
2006-05-10 21:54:31 +10:00
axel
786144ba86 Make sure tokenization errors in eval_args doesn't cause fish to crash while error reporting
darcs-hash:20060510115351-ac50b-57354a1a6f044504a16e294840d0092ebf98f600.gz
2006-05-10 21:53:51 +10:00
axel
e3dd94f272 Add missing quote escape to ls completions
darcs-hash:20060510115243-ac50b-6aff103edec7d1499702d5eb38d9841571d95c16.gz
2006-05-10 21:52:43 +10:00
axel
b110a0ae21 Allow backslash escape fur null byte
darcs-hash:20060509165501-ac50b-3a69a7ed0b96d5be7860aa997b7c77e37a6b1dc7.gz
2006-05-10 02:55:01 +10:00
axel
48d9c38d1e Fixed use of improper storage type for variable
darcs-hash:20060509165207-ac50b-48561332ab938fe7972bbf07f32ac1f92322d316.gz
2006-05-10 02:52:07 +10:00
axel
51f8272ebd Make sure WCHAR_MAX is defined (This is missing on OpenBSD for example)
darcs-hash:20060509164222-ac50b-595fd7507e2e5585b1a14e32792a38853b795b47.gz
2006-05-10 02:42:22 +10:00
axel
77f35c1b41 Add a little padding in the documentation stylesheet to make it easier to differ between different header levels
darcs-hash:20060509164146-ac50b-f165e89d3cf5d9a8db9826d804cd62b85bd6a3f7.gz
2006-05-10 02:41:46 +10:00
axel
06668bfacb Alter syntax for set builtin so that better slicing operations are possible
darcs-hash:20060509164055-ac50b-8514b73bb9e992c463966f95f783f01893ba93bd.gz
2006-05-10 02:40:55 +10:00
axel
df59b8498f Minor edits of function descriptions, includes, etc.
darcs-hash:20060502162950-ac50b-c2fcfc957d55f292744bcb4b33b4d66fc42087ed.gz
2006-05-03 02:29:50 +10:00
axel
92fde30c0c Fix segfault when using the 'set' command with no arguments
darcs-hash:20060502162830-ac50b-d3ab63c29a6daeaa62803923b060ec69942911f8.gz
2006-05-03 02:28:30 +10:00
axel
d690a15b29 Make job id numbering start from 1, not 0
darcs-hash:20060428132137-ac50b-8e5adcdbc18ad7627b66e9129a13b037a669dd02.gz
2006-04-28 23:21:37 +10:00
axel
445f6539cf Fix two bugs in the jobs builtin, causing freezes and other incorrect behaviours
darcs-hash:20060424153434-ac50b-2434329395cbd4a258d6fb9f15e166065b2eb164.gz
2006-04-25 01:34:34 +10:00
axel
13a7269378 Bump version number
darcs-hash:20060422101024-ac50b-8cfc71d94572187d8d3a6ce890beee0a0225a09a.gz
2006-04-22 20:10:24 +10:00
axel
fd2644ce49 Tweaks to a few error messages (Thanks to Philip Ganchev)
darcs-hash:20060422100630-ac50b-18cef1e493321e8ad0cf65982dc1748965d02630.gz
2006-04-22 20:06:30 +10:00
axel
508de57459 Change setup to avoid invalid directories and warnings, also revert directory checking for fish_*_path, it makes sense to add non-empty directories to these
darcs-hash:20060421150558-ac50b-90aff08f81b3d280badba4cc14fb6a0897c39f9e.gz
2006-04-22 01:05:58 +10:00
axel
de2405b35a Add more descriptive error messages when trying to use variables in command names
darcs-hash:20060421142939-ac50b-d1809fa4687706b433d1d0a5e0a0c9d791de510f.gz
2006-04-22 00:29:39 +10:00
axel
a7f977836a Expand the switch/case documentation
darcs-hash:20060421083529-ac50b-f287424c0cc9377085b49492453d35a5512cbc90.gz
2006-04-21 18:35:29 +10:00
axel
f59e4a88c6 If PATH is unset, use a default value
darcs-hash:20060420183502-ac50b-8e746ae4ed00c354712cf61e57e0a187aa40a4fa.gz
2006-04-21 04:35:02 +10:00
axel
c755bd0358 Only allow real directories in PATH, CDPATH, etc. If user tries to use ':' instead of arrays, give a friendly pointer on how to use arrays
darcs-hash:20060420182944-ac50b-fbb5dc63c2a4d3fe3bde92ad7699b1cad972dd0f.gz
2006-04-21 04:29:44 +10:00
axel
536523ffd7 Minor comment and documentation edits
darcs-hash:20060420150206-ac50b-c5c91053ee37a6c3f763287c42b430cdc99bb45b.gz
2006-04-21 01:02:06 +10:00
axel
ca82fc2f03 Add missing documentation for the read builtin
darcs-hash:20060420150124-ac50b-71a94cea3fedb0265af71718022e54e42567d69e.gz
2006-04-21 01:01:24 +10:00
axel
d1411c42d6 Minor edits to Makefile. A mistyped .PHONY was corrected, a few stray .o files are now properly removed by make clean, and the dependency list has been updated
darcs-hash:20060420150028-ac50b-b3b6b04023f1c039d167e5f67c89cbbaa6bd0cdc.gz
2006-04-21 01:00:28 +10:00
axel
9d770af5f4 Earlier history in non-interactive mode bugfix contained a new bug causing fish to crash if read is not used in non-interactive mode
darcs-hash:20060419234211-ac50b-886a33e96cb3f95e9b2c632f03eb3b2b20a560fd.gz
2006-04-20 09:42:11 +10:00
axel
d1ff6a323a Bump version number
darcs-hash:20060419124513-ac50b-f0c4bacee786ca9e147a86004aa90f5a09c04b34.gz
2006-04-19 22:45:13 +10:00
axel
112ea1759a Minor code cleanup
darcs-hash:20060419124315-ac50b-e7e9cafe6850e1fe805bad82278d15c2de327f5d.gz
2006-04-19 22:43:15 +10:00
axel
76bafbef2a Make the read builtin accept 0 parameters and drop the input instead of showing an error message
darcs-hash:20060419100830-ac50b-50f96925481bb29ad840fb12240ef9b9b86d18c4.gz
2006-04-19 20:08:30 +10:00
axel
1947ec88f1 Remove minor memory leak on init
darcs-hash:20060419095818-ac50b-d2146525feba5f00d224bce920ab40cc023e390d.gz
2006-04-19 19:58:18 +10:00
axel
d0956f1e43 Use libc implementations of wcslcpy and wcslcat if they exist. Move internal implementations to fallback.c.
darcs-hash:20060419095628-ac50b-0e94e4205306bb99bb9dea72eec43b442520bf1b.gz
2006-04-19 19:56:28 +10:00
axel
6996c7718e Always init history on startup, to avoid destorying history multiple times when reading interactively in a non-interactive script
darcs-hash:20060419095502-ac50b-abf2fe39cf9c027bdbc69d78fe858e946f7c81f2.gz
2006-04-19 19:55:02 +10:00
axel
45d56d8e05 Drop all calls to wcsncpy
darcs-hash:20060413121851-ac50b-1f479b96b3aa1050a30e9ee0ed27cc107ce2bc45.gz
2006-04-13 22:18:51 +10:00
axel
53295d38b7 Change var_entry_t struct to be ANSI C compliant (Wastes a few hundred bytes)
darcs-hash:20060410160109-ac50b-fa8b097722f06aee5fb09095e89f6b39ff90d44b.gz
2006-04-11 02:01:09 +10:00
axel
bd9c843fd1 Add warning when trying to change read-only variable
darcs-hash:20060410153626-ac50b-700ff7687647b8aab47ba79d759d1739cbe60425.gz
2006-04-11 01:36:26 +10:00
axel
f812b9b26c Fix bug in type command causing type -f to return true even when no file was found
darcs-hash:20060410143201-ac50b-4d8a70cd9721edcddaf11324f0b575d3f8cbace8.gz
2006-04-11 00:32:01 +10:00
axel
52851a3ba4 Quote Doxygen test in configure script to remove warning - thanks to Ray Hammond for the report and the fix
darcs-hash:20060410141909-ac50b-f310b7e326ce28ae8a3bbc1a3c1d247511f3d860.gz
2006-04-11 00:19:09 +10:00
axel
b1bf115fa2 Bump version number
darcs-hash:20060408143210-ac50b-0a143a45d0510e67a75024b802a1ca677480e4c0.gz
2006-04-09 00:32:10 +10:00
axel
0f25ef365d Tiny documentation edits
darcs-hash:20060408143134-ac50b-eae8cf585d3801b51bba415955ef2aacf98baeb2.gz
2006-04-09 00:31:34 +10:00
axel
55ea4b6fc0 Documentation additions
darcs-hash:20060405132928-ac50b-d551c31d04426c75c756d513e02e34b91bfc4ad6.gz
2006-04-05 23:29:28 +10:00
axel
5ef8cccf21 Mention in the license section that fish includes the glibc wcstok implementation as a fallback for libc implementations lacking wcstok
darcs-hash:20060405125956-ac50b-9e5b51d94676868365878387cd8c7e14a1684348.gz
2006-04-05 22:59:56 +10:00
axel
5613d96001 Do not call autoconf in Makefile, since configure will automatically reconfigure itself if configure.ac has changed
darcs-hash:20060405124918-ac50b-0f45ddc7759383d930e0473a281f092566570210.gz
2006-04-05 22:49:18 +10:00
axel
5d9ba8c1a2 Delete some commented code and tweak a few comments
darcs-hash:20060405124825-ac50b-8242b2a9c788cf147f864329797b2e24a7040f0b.gz
2006-04-05 22:48:25 +10:00
axel
0de232bf54 Do not return to the shell until all processes of a job have finished (Previous behaviour was to return once the last job had exited, and could cause e.g. the jobs builtin to print out the job responsible for repainting the titlebar). Also validate that jobs have not completed in various places where the job list is examined
darcs-hash:20060404112722-ac50b-4b6a55ce7c57d39213cdd0ed0f581795a72859b7.gz
2006-04-04 21:27:22 +10:00
axel
db5b887824 PPC fix by James Vega, fixing an issue with a variable named putc, which clashed with the putc macro
darcs-hash:20060403150422-ac50b-78d5db541cb1f41bfea55deac7578c0df73605bd.gz
2006-04-04 01:04:22 +10:00
axel
634bdb8b3b Release 1.21.3
darcs-hash:20060402111721-ac50b-f5df9a3a3154a9bb37f4fcc6db3d4f44d12830ce.gz
2006-04-02 21:17:21 +10:00
axel
9c579a37bb Swedish translation checkin
darcs-hash:20060402111659-ac50b-c23841e44c3de1cc4db9c2897fff59faf820c3d9.gz
2006-04-02 21:16:59 +10:00
axel
1502acd83e Add tar and dist Makefile targets
darcs-hash:20060402111622-ac50b-8ac169b0f05fd68c1c8a375ae60049422e3fad47.gz
2006-04-02 21:16:22 +10:00
axel
ef3430f669 Add Makefile rules for regenerating Makefile, configure script, etc. when needed
darcs-hash:20060402111525-ac50b-533e15f7ab5d63c2f8258b5a5ae8adc5bafd9221.gz
2006-04-02 21:15:25 +10:00
axel
01af64cf1f Add missing space in shellscript for building rpms
darcs-hash:20060331165626-ac50b-922778808ac54955cf6b1a43e4ae5e2264ac6ae1.gz
2006-04-01 02:56:26 +10:00
axel
349f52a1a5 Telnet completions from Sean Higgins
darcs-hash:20060331165554-ac50b-5b0300d89ac2b2fbc6bc4bfcf228572fdce2e284.gz
2006-04-01 02:55:54 +10:00
axel
850aa1963f Change rpm .spec file so it will work both on systems that install X headers in /usr/include and /usr/X11R6/include
darcs-hash:20060329213330-ac50b-b478b18ae9aeb070ade5176c9813ffb74ac7006e.gz
2006-03-30 07:33:30 +10:00
axel
185d0c3c1c Minor edits in configure.ac
darcs-hash:20060329213124-ac50b-8d25a34d621d698425b54e032238a2fe89d4a031.gz
2006-03-30 07:31:24 +10:00
axel
3656443b1f Update section about compilers in INSTALL file to reflect that fish is known to work with ICC
darcs-hash:20060329213031-ac50b-34ca7b4f2ba557faf7d1ad17bde194b1a1f0acce.gz
2006-03-30 07:30:31 +10:00
axel
6748b9699f Make parser_is_block public
darcs-hash:20060329212942-ac50b-ad8334532a719152766b4b530474616b78564f24.gz
2006-03-30 07:29:42 +10:00
axel
dc91d7aec4 Further improvements to build system wrt detection of compiler and libc features and prototypes, as discussed with James Antill on mailin list
darcs-hash:20060329002500-ac50b-e7618e476ea69802bd2cb0076244f49a0f178df7.gz
2006-03-29 10:25:00 +10:00
axel
13a51ba4c2 Fix warnings from ICC
darcs-hash:20060329001450-ac50b-9c3fe4f7ca14a077997c421616c07dde03b48c6d.gz
2006-03-29 10:14:50 +10:00
axel
749dad1309 Fix wildcarding bug where ? at end of wildcard could match 0 characters
darcs-hash:20060328180916-ac50b-6f77d936a1e46e411a12ca96fd9ad3bb844d321b.gz
2006-03-29 04:09:16 +10:00
axel
7a07d7c188 Add hint on how to fix missing rpm-build when trying make rpm
darcs-hash:20060326175237-ac50b-703940a231be96991d5d94c451b12f7c4e6f649f.gz
2006-03-27 03:52:37 +10:00
axel
53c95abfb2 Change how a few pointer are supplied to functions, removes warnings about breaking aliasing rules
darcs-hash:20060326112339-ac50b-eb135567f6a6183e5dbc310c093d2139ecc8fa4b.gz
2006-03-26 21:23:39 +10:00
axel
7fd2ae4ffd Third try on correct fallback headers - re-add the checks to only include prototypes for functions which are known to be missing, and also add any compiler directives which may help in adding additional prototypes in the system headers (separate patch)
darcs-hash:20060325162103-ac50b-18f5074838a1c304c3d013378b7fa4e66b544cd9.gz
2006-03-26 02:21:03 +10:00
axel
717ac3f7fe Remove gcc-specific cflags from makefile. Add them in the configure file, but only if the compiler is gcc.
darcs-hash:20060325161848-ac50b-23919c1d23bbc5eed81fd709b95802ea2d4e8f52.gz
2006-03-26 02:18:48 +10:00
axel
50fa7234ea Fix completion describtion bug causing filesizes below 1024 bytes to be reported as 0 bytes on big-endian systems
darcs-hash:20060322001712-ac50b-1a42b3dcb868161f13d45d80d16aeb119f6ec9cd.gz
2006-03-22 10:17:12 +10:00
axel
80b4055eab Add support for the -n switch to skip execution of any commands
darcs-hash:20060318010459-ac50b-9d9e5c489e0e4df2159d8c1d0ff952d42e2a2a82.gz
2006-03-18 11:04:59 +10:00
axel
94b7c8d5e6 Don't call the type function when defining the _ function, as this will cause a recursive dependency
darcs-hash:20060317132356-ac50b-4b3b0b6ec3f2e82649c74cc358f1505bf202bbd4.gz
2006-03-17 23:23:56 +10:00
axel
580ec26885 Minor code tweak in type function, and add a missing newline to an output string
darcs-hash:20060317132256-ac50b-87c066ec3aba2eded333ecbf2198de001c313570.gz
2006-03-17 23:22:56 +10:00
axel
6ba5d80a20 Cleanup after patch conflict
darcs-hash:20060314002216-ac50b-c5b2b0d677f45818d2496f00fb9cfc774460397e.gz
2006-03-14 10:22:16 +10:00
axel
d58b9de63b Use 'type -f' instead of 'which' to test for presense of command, since the latter does not set the exit status correctly on all platforms
darcs-hash:20060314002127-ac50b-6ed726bdcc9e3a7a9608a904c382973799dc73ef.gz
2006-03-14 10:21:27 +10:00
npilon
99a93b5add Fish PATH Fix
Moved PATH detection code to the start of share/fish.

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

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

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

darcs-hash:20060313014333-c90d9-de59932f81dd6debbfb48225893983df485df12b.gz
2006-03-13 11:43:33 +10:00
axel
dd8150d98d Minor comment and documentation changes
darcs-hash:20060314000914-ac50b-63c49a59804f51c4dd19de574db41298b1ef67c5.gz
2006-03-14 10:09:14 +10:00
axel
99662d7711 Move typedef of tputs_arg_t from common.h to fallback.h
darcs-hash:20060314000801-ac50b-466d5b90d9a1bea0e55c8657748edf6663edd06f.gz
2006-03-14 10:08:01 +10:00
axel
5f3ad87a98 Make the type builtin not rely on the exit status of the which command
darcs-hash:20060314000641-ac50b-cc92a519b6c8981a50aea0f25f407dfe2b5f51dc.gz
2006-03-14 10:06:41 +10:00
axel
83d05f9170 Move to end of current token on completion
darcs-hash:20060311115612-ac50b-70f15c50b6cb8ad89d84ae6c8a3ffc4b7551223b.gz
2006-03-11 21:56:12 +10:00
axel
0d56818664 Fix bad return status in read builtin
darcs-hash:20060310195100-ac50b-2b7d94510661d901fd804074e6cf03e926dddc79.gz
2006-03-11 05:51:00 +10:00
axel
5b0cd5a911 Changes in quoting of backslashes lead to minor bug in awk script for munging command descriptions
darcs-hash:20060310142808-ac50b-75e4be2daa924e4a565b1a11f69068340022c367.gz
2006-03-11 00:28:08 +10:00
axel
102b99a17b Add further checks to unicode_start to see that the command exists
darcs-hash:20060310135129-ac50b-8345a137b73e91084ad82cba06413580e3ca87e7.gz
2006-03-10 23:51:29 +10:00
axel
6222d00ffc Add minor comment about error handling to configure.ac
darcs-hash:20060310135024-ac50b-dd496725134db7eb3b55e7358a37eec481043b3e.gz
2006-03-10 23:50:24 +10:00
axel
73370f5f39 Avoid extended regexps in grep, they are not portable
darcs-hash:20060310134350-ac50b-7138e53ed815986ccb78e909f50c9939382a1e89.gz
2006-03-10 23:43:50 +10:00
axel
883ce6e440 Adapt key_reader to changes in buildfiles
darcs-hash:20060310134317-ac50b-14691f97a817f52f663679797e69f60419ec5d03.gz
2006-03-10 23:43:17 +10:00
axel
f320f5f710 Move LANG init back to /etc where it belongs. IT was temporarily moved earlier to do some translations at init time, but that is no longer needed
darcs-hash:20060310134039-ac50b-e826176a9d574b26235013384963f2dd7e9e9457.gz
2006-03-10 23:40:39 +10:00
axel
32b531667a Fix bug that causing terminal corruption if a job is put under job control before running in interactive mode. This is fixed by doing more inits at startup (but only slightly more)
darcs-hash:20060310133809-ac50b-d31cd7bab1a3a58de2833f73735817a3d0b3ed7d.gz
2006-03-10 23:38:09 +10:00
axel
c47dae77a4 Bump version number
darcs-hash:20060309120008-ac50b-071e0ba004f208993cc09f1494dcae7b8be17a25.gz
2006-03-09 22:00:08 +10:00
axel
53160d134e Swedish translation additions (incomplete)
darcs-hash:20060309115938-ac50b-ad4fa762e70fcf3116f8db52a0740f92c3367c3e.gz
2006-03-09 21:59:38 +10:00
axel
619defd748 Update todo list
darcs-hash:20060309115916-ac50b-da0ad8d0b29088c9d9daff4ec0c856289d8dd93d.gz
2006-03-09 21:59:16 +10:00
axel
40db2b3c2a Further comment clarification on -fno-optimize-sibling
darcs-hash:20060309115638-ac50b-e6a67c4061bd576a8de261d46b85d984fd926b0c.gz
2006-03-09 21:56:38 +10:00
axel
b05ccee0f0 Remove extra spaces in descriptions for a few completions
darcs-hash:20060309115250-ac50b-c0c30e25f9d3e4b9390924a5a5686ad5dc159882.gz
2006-03-09 21:52:50 +10:00
axel
d722fa59ca Add completions for cdrecord, patch and xargs
darcs-hash:20060306232645-ac50b-89f38afaa1ae3106c18fc55acc75fc0dd702bd9a.gz
2006-03-07 09:26:45 +10:00
axel
60065614bd Updates to the swedish translation
darcs-hash:20060306231504-ac50b-93579475d50f2d643676a0b93d520fcbd9ffabdf.gz
2006-03-07 09:15:04 +10:00
axel
05b39a9bdb Drop the -fno-strict-aliasing flag for GCC in Makefile.in, since it dealt with type punning using anonymous unions, which fish doesn't have anymore
darcs-hash:20060306184924-ac50b-cfcb9fff791a1fc6d8d18961cf760c13829b5707.gz
2006-03-07 04:49:24 +10:00
axel
91ab644173 Add support for \\ in quoted strings
darcs-hash:20060306015012-ac50b-a510764b624d1e4416d134f5b92532e046a6125b.gz
2006-03-06 11:50:12 +10:00
axel
083fcd6491 Remove fish_tests when doing make clean. This patch has been applied before, but must have gotten lost along the way.
darcs-hash:20060305212706-ac50b-751e88e86e03b94a18566ce02a0808697298d3bf.gz
2006-03-06 07:27:06 +10:00
axel
7e9e7d77d1 Add output message when uninstalling legacy fish version
darcs-hash:20060305212630-ac50b-8ff128370f83ef6d12a1f3941a7fd6f73852dbc3.gz
2006-03-06 07:26:30 +10:00
axel
66ee644130 Make the functions for setting default values use gobal values if universal variables are broken
darcs-hash:20060305212601-ac50b-075bc6976435e5bd86151603cb8f0fc634c542bb.gz
2006-03-06 07:26:01 +10:00
axel
c20b8982bc Always define prototypes in fallback.h, so that if the prototypes are missing in the libc headers, things will still work
darcs-hash:20060305212513-ac50b-11820bbcc4193d8588246848161909baf3726edf.gz
2006-03-06 07:25:13 +10:00
axel
15bb8f712d Add missing includes
darcs-hash:20060305212411-ac50b-4d672d98dd57914be7906e756e5e59e15bb02570.gz
2006-03-06 07:24:11 +10:00
axel
d48e9ef8b1 Some compiler flag tweaks, and elaborated comments on compiler flags use
darcs-hash:20060305212330-ac50b-f37c3f5464545965c1b4ace9282622111f8783a9.gz
2006-03-06 07:23:30 +10:00
axel
acd28b5dc4 Re-add accidantally removed HAVE_GETTEXT substitution
darcs-hash:20060302134541-ac50b-c3b8feb5e7838dac62465b08f809c16408473da3.gz
2006-03-02 23:45:41 +10:00
axel
1fe4863039 Automatically rerun autoconf inside configure when needed
darcs-hash:20060302134444-ac50b-3fc88b85997b1839989e786db63ce6d44dbff2a8.gz
2006-03-02 23:44:44 +10:00
axel
d347da963b Add documentation about indirect variable expansion
darcs-hash:20060302115108-ac50b-6803fad305e1caff02b33ab31bec869ac05a018e.gz
2006-03-02 21:51:08 +10:00
axel
930bb9c6d1 Remove warning for missing history value - it is not a bug
darcs-hash:20060302113314-ac50b-65bd93a0e31e5ac69167ecc84346fa44d55dec71.gz
2006-03-02 21:33:14 +10:00
axel
676c3ed505 Small edit in common.c
darcs-hash:20060302113142-ac50b-33e3e91e0ae1787784fde100c9c0878cdd2ed45f.gz
2006-03-02 21:31:42 +10:00
axel
2d3588fa51 Add two newlines to german translation
darcs-hash:20060302113055-ac50b-56d31b568f3174e3808d7d06f0fbd398d47e1270.gz
2006-03-02 21:30:55 +10:00
axel
4835945c09 Add missing includes in fallback.c
darcs-hash:20060302113029-ac50b-cd2416c2a687beade622aae6ca0e87afd52195d8.gz
2006-03-02 21:30:29 +10:00
axel
82bff9f407 Unbreak fwprintf autoconf check cpp symbols
darcs-hash:20060302112917-ac50b-29d524dc3df09ad9a6e88669e6c20f46677ec2ee.gz
2006-03-02 21:29:17 +10:00
axel
3b6d8756ea Fix various uses of the GNUism of allowing backslash escapes in the second half of a sed regexp substitution
darcs-hash:20060302112808-ac50b-46cdf8e99f8f6e8cab0d54f32cf4e4d309775aa1.gz
2006-03-02 21:28:08 +10:00
axel
d1bb30afae Better commenting in configure.ac
darcs-hash:20060302014729-ac50b-fba9ec3e24abb387bc63effbc86dd9177a9b95f0.gz
2006-03-02 11:47:29 +10:00
axel
7a1d64637d Add additional -I includes to both CFLAGS and CPPFLAGS
darcs-hash:20060302013016-ac50b-38373bd0c6fd64189e4f87a90171cfa716ecf11e.gz
2006-03-02 11:30:16 +10:00
axel
5f85d27671 Add an autoconf test to verify that fwprintf doesn't crash to avoid non-working fish on DragonFlyBSD
darcs-hash:20060302012858-ac50b-df97c2a1b4770473d2724222c51abe7110715813.gz
2006-03-02 11:28:58 +10:00
axel
5d828b5fcf Remove correct files when using make distclean
darcs-hash:20060302012654-ac50b-e441be3287ca2a14d11fc8491a45407e72b6598a.gz
2006-03-02 11:26:54 +10:00
axel
c2f6c6c1d2 Do gettext translation of descriptions just-in-time internally in fish
darcs-hash:20060301165347-ac50b-3df9feec60dd9860e0988396d10b550a501f6802.gz
2006-03-02 02:53:47 +10:00
axel
7726cffdab Update to latest config.sub and config.guess versions
darcs-hash:20060301162821-ac50b-508c855d9be360cdd4cb46fe9c4a6b2f0414ab65.gz
2006-03-02 02:28:21 +10:00
axel
3570013496 Use correct objects list when building mimedb
darcs-hash:20060301012818-ac50b-aa2429ac2b7a0af4d91e4b59038e345115a6350f.gz
2006-03-01 11:28:18 +10:00
axel
2401a163fe Move all fallbacks for standard and not-so-standard unix functions to fallback.c, in order to have a one-stop place to look for such functions
darcs-hash:20060228131716-ac50b-0832193dbcaf7191dcb24456dc40f2e861a1382e.gz
2006-02-28 23:17:16 +10:00
axel
e8d802c5e1 Bump version number to 1.21.1
darcs-hash:20060225112956-ac50b-d54565f84c9082c32bf0110163ab495778a9c347.gz
2006-02-25 21:29:56 +10:00
axel
dca4167de6 Fix broken function/completion paths, sent by Sean Higgins
darcs-hash:20060225112911-ac50b-c1aa4f172f4aae5d725230ccba43cdc1fce924f5.gz
2006-02-25 21:29:11 +10:00
axel
6d0b6e5de5 Bump version number to 1.21.0
darcs-hash:20060225022220-ac50b-27a71eef149c0caa5336d425f24686ce152dcad1.gz
2006-02-25 12:22:20 +10:00
axel
fd6bf06f15 Various minor edits
darcs-hash:20060225022139-ac50b-9ef43f88e2266978e9b39038a6a5087ff1305509.gz
2006-02-25 12:21:39 +10:00
axel
d2e11ea61d Fix crash bug on invalid input to fish_pager
darcs-hash:20060224184050-ac50b-da122d893fa0e2aabbd48058c696e2815c4657ca.gz
2006-02-25 04:40:50 +10:00
axel
dad2b93d1e Add functiopn prototype completions for valgrind --alloc-fn
darcs-hash:20060224135618-ac50b-bcd2fa57593f6a5c9f41b9513ac25f859baf1659.gz
2006-02-24 23:56:18 +10:00
axel
1075ca69b0 Switch to standard syntax for octal escapes
darcs-hash:20060224121829-ac50b-8e19f27857378e6456ae08269721138bd60f3464.gz
2006-02-24 22:18:29 +10:00
axel
e29f5c5474 Add an FAQ section to the documentation, and remove a few seactions of the manual containing introductory material on fish which was no longer accurate
darcs-hash:20060224011446-ac50b-e9246e23dbf725a3e2488f7831b1c7420cdd42db.gz
2006-02-24 11:14:46 +10:00
axel
22bfa6638a Update of the makefile on how to handle the directory hierarchy transition
darcs-hash:20060223153556-ac50b-4af8c2376a37c28f056b7fef37db3fb371a3e899.gz
2006-02-24 01:35:56 +10:00
axel
1a48941f6b Protect against double-free of the process argument list
darcs-hash:20060222175107-ac50b-87c36439e2ec2f8be652db1595dad9a09e20f36c.gz
2006-02-23 03:51:07 +10:00
axel
68e0c94dbb Do not unescape strings from completion callouts. Why was this done before?
darcs-hash:20060222174716-ac50b-218c6896918e5cf8047ea6291a8cde44061d0b57.gz
2006-02-23 03:47:16 +10:00
axel
ca04fc745d Add some input validation code to various functions
darcs-hash:20060222154152-ac50b-608032284165f099beecd1cd4f7c6bb2b45df432.gz
2006-02-23 01:41:52 +10:00
axel
3afead1827 Documentation clarification for the cd builtin
darcs-hash:20060222142137-ac50b-cc9200ed23fa5796a56dc4ee3dde1ff7e8768fc3.gz
2006-02-23 00:21:37 +10:00
axel
0ea69dab7b Drop unuses error counter for string conversions
darcs-hash:20060222142042-ac50b-25f2e050c680071ccec6989e477f6db5904a2713.gz
2006-02-23 00:20:42 +10:00
axel
a4a025b786 Allow multiple slashes in a wildcard to be used as a single directory separator
darcs-hash:20060221154738-ac50b-e4b35d3604d8e39d3aff7b8da38617272bd6e89e.gz
2006-02-22 01:47:38 +10:00
axel
328c3a39a1 Move _ shellscript function to it's own file
darcs-hash:20060221153701-ac50b-05cecdac1221e0abc709d9e9c1799faa7986fa78.gz
2006-02-22 01:37:01 +10:00
axel
5aa019a0b5 Fix off-by-one error resulting in truncated output from wcsndup fallback and halloc_wcsndup
darcs-hash:20060221144642-ac50b-9dcd77238bc4bd740bbda6e15ded793fad44c363.gz
2006-02-22 00:46:42 +10:00
axel
92aa99104a Fix rare accidental ellipsisizing of strings that will actually fit in fish_pager
darcs-hash:20060221103435-ac50b-f46a08e29e7860886a357bc1c5d314b594793e68.gz
2006-02-21 20:34:35 +10:00
axel
6b544bc3c2 API documentation, code style cleanup, etc.
darcs-hash:20060220131146-ac50b-6ec3664e5e3eaefa2296a93d39014058df37fdf2.gz
2006-02-20 23:11:46 +10:00
axel
ea0005e16d Move code for setting ls and grep colors to function definition files
darcs-hash:20060220130203-ac50b-feb426f6450a0bbd17cb9dacdca94d4d5b72c113.gz
2006-02-20 23:02:03 +10:00
axel
6901ad361d Make fish continue parsing/executing a file if a command is not found
darcs-hash:20060220125524-ac50b-1f85e530cbbcb45988254c75cd45c11395c5cd27.gz
2006-02-20 22:55:24 +10:00
axel
b21cccf5f0 A flag got reversed, causing children to execute even if an IO redirection failed
darcs-hash:20060220014036-ac50b-43156940397e0535cfa9dd7e88d61e4ca4bab13b.gz
2006-02-20 11:40:36 +10:00
axel
7740035d14 Remove some ancient debug messages, drop two warnings, add some braces and other minor code tweaks
darcs-hash:20060219181932-ac50b-2d032e7a64257a6ca0db078ea9c81ae04a01120f.gz
2006-02-20 04:19:32 +10:00
axel
7dc3934997 Use variable name as index for tables when autoloading functions and completions in order to better handle changes on path variable values
darcs-hash:20060219170116-ac50b-8f617c6f8960660e6227827914dc910a78655c13.gz
2006-02-20 03:01:16 +10:00
axel
845e15876c Minor edits, additional comments, etc.
darcs-hash:20060219015438-ac50b-b6346876460912f3c27d1bb4287aeab962260ab6.gz
2006-02-19 11:54:38 +10:00
axel
c4e7a7992f Fix bug causing fish to occasionally reset line number for error reporting
darcs-hash:20060219011702-ac50b-c72b1f5ae56d3757c3fbfca002f1bc33c36a7660.gz
2006-02-19 11:17:02 +10:00
axel
43ab84397b Make sure that command specific completions can handle input strings with wildcards reasonably well
darcs-hash:20060219011432-ac50b-89a73a3d414f2dbd8a213b851fcb1c494e022eae.gz
2006-02-19 11:14:32 +10:00
axel
0840c9248f Give more detail in an error message
darcs-hash:20060218024346-ac50b-f26f6ef107fffa398b6ff61baff81914b998940a.gz
2006-02-18 12:43:46 +10:00
axel
dd79d75504 Move a few shellscript bits around
darcs-hash:20060218024145-ac50b-207ca782808ea8968cb38253c7bc2563350f38b2.gz
2006-02-18 12:41:45 +10:00
axel
7073f0b58b Change translation file offsets in swedish translation, needed to avoid darcs hang
darcs-hash:20060218023559-ac50b-bf6f5802b7ab810a3a8167f92358c085e3f02401.gz
2006-02-18 12:35:59 +10:00
axel
15916bfbdc Update build dependencies
darcs-hash:20060218023432-ac50b-9cfdc633f4b6834dea4324f429b1decca6d9e110.gz
2006-02-18 12:34:32 +10:00
axel
228fdbef5a Use the right sources for generating translation strings
darcs-hash:20060218023332-ac50b-5a2cec156ad5c49d052f17cf14fd14e72e0aa137.gz
2006-02-18 12:33:32 +10:00
axel
7f7f8fb156 Fix broken call to source /fish/fish on startup
darcs-hash:20060217223236-ac50b-384ea2549a2bbf445842700e693f5edc8bf72023.gz
2006-02-18 08:32:36 +10:00
axel
2ae9735858 Add the LGPL license to the license section of the documentation - xdgmime is released under this license. Also add a few rulers, and make some other minor edits to the license section.
darcs-hash:20060217222051-ac50b-8fc2e6d4e32d0f7f67cde8ff475ec0e16f72ffa1.gz
2006-02-18 08:20:51 +10:00
axel
8ac1688c89 Allow backslash-escaping of newlines
darcs-hash:20060217164119-ac50b-6efd2491fb7f504ad26ca35b2a7421d24c61ec63.gz
2006-02-18 02:41:19 +10:00
axel
9cd2dbc9e7 Remove note about problem with ancient fish version
darcs-hash:20060217125341-ac50b-8f4dc873c8b7146cfdae00b62a139c0643e4156e.gz
2006-02-17 22:53:41 +10:00
axel
a74055bc33 Proper ordering on paths for dynamic loading - user stuff should override sysadmin stuff should overrtide default stuff
darcs-hash:20060217125318-ac50b-f74103958cf01103b351227ae561703ac96ebe95.gz
2006-02-17 22:53:18 +10:00
axel
e1d0b9370e Minor edits in parse_util.c
darcs-hash:20060217125205-ac50b-f3cd1572eec966581730ee1983d06b64caac566f.gz
2006-02-17 22:52:05 +10:00
axel
5dfa28059e Remove dropped fish_function.fish from Makefile
darcs-hash:20060217103540-ac50b-5ea95b93bd93512100e652e2cd8146d4f2fdbf58.gz
2006-02-17 20:35:40 +10:00
axel
7ead45d899 More missing files
darcs-hash:20060217103214-ac50b-f0f65a28d574e6a7258148fd1162677be287e99c.gz
2006-02-17 20:32:14 +10:00
axel
5c9ac72c19 Add missing files
darcs-hash:20060217103018-ac50b-9097f60908d06d89f235d969719fe654117b423e.gz
2006-02-17 20:30:18 +10:00
axel
343cafef34 Redo installation file structure, move lots of things to $PREFIX/share/fish
darcs-hash:20060217101339-ac50b-d93d2c620a4b7f75f05ff461a6edbee001da7613.gz
2006-02-17 20:13:39 +10:00
axel
95a01f3c8f Use plgin support in output.c to make buffered pager output - noticably faster printing in many situations
darcs-hash:20060216142159-ac50b-2c31025be7d12fcc32f4ba352b59ea4cc3cc1387.gz
2006-02-17 00:21:59 +10:00
axel
cfa367f14c Finish support for plugging in a new output function for output.c
darcs-hash:20060216142100-ac50b-06db798debb56c7640f7ffec0bc32c8ca7b013e5.gz
2006-02-17 00:21:00 +10:00
axel
94cae410f3 Move the move_cursor and writeb functions to output.c, and make the output function used by output.c configurable
darcs-hash:20060216134025-ac50b-360d4816ee2c3f2ffdc8e5660502cb97b31d699e.gz
2006-02-16 23:40:25 +10:00
axel
cc69afc4fe Fix bug in fish causing occasionally incorrect signal handlers
darcs-hash:20060216133632-ac50b-f24c049830f9c6deca50aca640189ad3f87b630a.gz
2006-02-16 23:36:32 +10:00
axel
777a559e12 Use env to work around path issues on the shebang line for the seq fallback implementation
darcs-hash:20060216121617-ac50b-6c7e34329a5ca8f3cd6756f1860fa10693db21e4.gz
2006-02-16 22:16:17 +10:00
axel
0427ccbb55 Fix invalid destruction order on exit
darcs-hash:20060215222513-ac50b-f3b489568e4bad3532c36f9c66a3c0d61352cd5b.gz
2006-02-16 08:25:13 +10:00
axel
f9a4699147 Add swedish translation of function descriptions
darcs-hash:20060215180031-ac50b-f21e471c178610b7a2912f82b3d46b46f76d350c.gz
2006-02-16 04:00:31 +10:00
axel
e6e287ae1f Make function descriptions for dynamically loaded functions translatable
darcs-hash:20060215175925-ac50b-5dc52c615650779771a6c4a3c5d006b72dbca67d.gz
2006-02-16 03:59:25 +10:00
axel
143602e5f6 Minor edits
darcs-hash:20060215024900-ac50b-51863879c32660d9787db706c34fef10aa4c30c2.gz
2006-02-15 12:49:00 +10:00
axel
1c2d3583e7 Drop fuction from man completion file, already lives in it's own file
darcs-hash:20060215024822-ac50b-dbb1e3769f0b3101f634d4bf5f5e530aacc1dfda.gz
2006-02-15 12:48:22 +10:00
axel
e58110da2c Reset list of loaded completion files when running complete_destroy. Otherwise completions will not get propely loaded on language changes.
darcs-hash:20060215024644-ac50b-d259cdac14dccb55309a4702683f1b881636e9ac.gz
2006-02-15 12:46:44 +10:00
axel
0d1683edc8 Add missing function prototype in parse_util.h
darcs-hash:20060215022415-ac50b-a6510213a3559c7bd6b944bbe87c739faaef4792.gz
2006-02-15 12:24:15 +10:00
axel
c94b9e504d Remove the rather stupid -y option for complete, which loads another commands completions. Mostly the same results can be had with fewer bugs and corner cases vy using the new dynamically loaded functions.
darcs-hash:20060215022228-ac50b-85614ed684f73460d43543a579ff2c7e7914efeb.gz
2006-02-15 12:22:28 +10:00
axel
8be3bf3e5d Add support for checking current filename and current line nuber to status builtin
darcs-hash:20060214195747-ac50b-77b6aba42c99da4f79ea500c47cc00bba12ec663.gz
2006-02-15 05:57:47 +10:00
axel
3e165297ce Add support for sending arguments whenusing the source builtin
darcs-hash:20060214195636-ac50b-511c211368103df6923d63cef99ce20a88d31be3.gz
2006-02-15 05:56:36 +10:00
axel
7ac922def6 Fix timestap checking bug when autoloading scripts
darcs-hash:20060214195517-ac50b-3d084f351c5d1f4f11afb4fc1c706c843de98da1.gz
2006-02-15 05:55:17 +10:00
axel
f12127c775 Add missing translation string
darcs-hash:20060214114804-ac50b-1ce10e7613ebec38a283cd6f6f8ad08397cec529.gz
2006-02-14 21:48:04 +10:00
axel
73d84fe136 Escape semicolons and other chars that have syntactic meaning in various shell command situations
darcs-hash:20060214114739-ac50b-17616bf01a0504041c0d29ee9428abd8a9f9ad3a.gz
2006-02-14 21:47:39 +10:00
axel
c595448f9c Add missing #define, needed by new fish_pager code
darcs-hash:20060214114631-ac50b-39756b670fd0ab1f5a6bd067ba2ff3f9d6f82fc2.gz
2006-02-14 21:46:31 +10:00
axel
5a2aeb1511 Swedish translation checkin
darcs-hash:20060214113926-ac50b-86926878d127405be8a3acd8cf9ac36a56ea432e.gz
2006-02-14 21:39:26 +10:00
axel
5fb9d9aa38 Fix clash in usage of unicode private use area
darcs-hash:20060214113514-ac50b-5160e3b7ac9401a7ef198121d39e33225df4b766.gz
2006-02-14 21:35:14 +10:00
axel
8258961c29 Fix minor display bugs and a memory leak in fish_pager
darcs-hash:20060214113347-ac50b-302a7da47f9c07af3acc9a2dcc5c8007127fc3a2.gz
2006-02-14 21:33:47 +10:00
axel
0dab94a54c Group multiple switches with common description together when printing completions
darcs-hash:20060214000823-ac50b-2bde1ac964baf12a515d763a076434757ac9fd21.gz
2006-02-14 10:08:23 +10:00
axel
3097f71abd Initial checkin of german translation
darcs-hash:20060213215118-ac50b-7981b89adff210e5b53cc18cdc0ad6f1c865cd83.gz
2006-02-14 07:51:18 +10:00
axel
ea5e1b70db Fix memory leak and missing error check in dynamic function lookup
darcs-hash:20060213214416-ac50b-2bd8532aed600c06234e6fce500c737fcb415a5c.gz
2006-02-14 07:44:16 +10:00
axel
6b393d35a9 Spelling fixes from HJB
darcs-hash:20060213213659-ac50b-024e99d5c3a56d1c7308bf5cc291e032aa65bc0e.gz
2006-02-14 07:36:59 +10:00
axel
a5dde6021c Change a few chars to be long
darcs-hash:20060213111023-ac50b-5ad5ddf9beb72117fc1dc81c048a83e5480bc510.gz
2006-02-13 21:10:23 +10:00
axel
a015472739 Remova a few calls to free that are handled by halloc now
darcs-hash:20060213110929-ac50b-95bba1b70840ef16e45f3876c5d0521a51b90561.gz
2006-02-13 21:09:29 +10:00
axel
6affa4452b Check for translation strings in function files
darcs-hash:20060212222406-ac50b-10424c1daeb9e81054c87bbf8f7839da72cb05bb.gz
2006-02-13 08:24:06 +10:00
axel
7ebfa380dd Variable used for filenmae length was accidentally set to static
darcs-hash:20060212222313-ac50b-1893f4fbe52a8c72ebc8332b1e575c1b8a2b31d5.gz
2006-02-13 08:23:13 +10:00
axel
370336e7c7 Fix various minor misses in moving of shellscript functions
darcs-hash:20060212222205-ac50b-d7bccc4c1e1dd752ca40560e81309bb37bb4dca8.gz
2006-02-13 08:22:05 +10:00
axel
bad4269dc9 Remove trailing periods from descriptions
darcs-hash:20060212221918-ac50b-d2310f6a166b585b242a9b548b1d1f890cac2e03.gz
2006-02-13 08:19:18 +10:00
axel
effe6f47a3 Minor hallocifications
darcs-hash:20060212190301-ac50b-c15b9a8c6c2897189c4343946d9bd115eefb4972.gz
2006-02-13 05:03:01 +10:00
axel
7eb3a5a17d Allow backslash of quotes within quotes
darcs-hash:20060212161331-ac50b-c25affaa4b18e1654dab3d08debafa95017009ea.gz
2006-02-13 02:13:31 +10:00
axel
b6cd723eb7 Fix a few compiler warnings, add halloc debug output on exit if HALLOC_DEBUG is defined and other minor tweaks
darcs-hash:20060212131846-ac50b-128685d1c043697768be70631c736567544abf2c.gz
2006-02-12 23:18:46 +10:00
axel
a2cd8c8a8d Move a few more shellscript functions to their own files
darcs-hash:20060212131421-ac50b-861f8941af76cf9a1e6fb7da2ac7f33795fab272.gz
2006-02-12 23:14:21 +10:00
axel
3b03bd6a10 Check if curses-string 'flash_screen' is set before using it in fish_pager
darcs-hash:20060212131253-ac50b-39c03e4223e66230c9c76a59bc95eeadc38637c9.gz
2006-02-12 23:12:53 +10:00
Nicholas Pilon
6caff2d85d svn completions
Command-line completions for svn. This includes some tweaks to the cvs completions file, to move a common function out into fish_complete.fish.

darcs-hash:20060210004314-494f2-c12a77084499cbc4216e8c5603ae4fadfb6b384c.gz
2006-02-10 10:43:14 +10:00
axel
eeaa241be8 Optimizations of how variable expansion implementation
darcs-hash:20060212112930-ac50b-9b8bb640ef1a5bd14230ecd276167a80d6d986c9.gz
2006-02-12 21:29:30 +10:00
axel
8fdb4d2a17 Define fish_function_path at the top of the first init file to improve preformance (each non-existing variable causes a universal variable barrier)
darcs-hash:20060212112349-ac50b-51956f701d11ae897c560617e4b476fb51b576c7.gz
2006-02-12 21:23:49 +10:00
axel
7c7f744b4c Add %o, %x and %X formats to *wprintf fallback implemnentation
darcs-hash:20060212112030-ac50b-1e3153c25dca3d2e12a8eb0e65da29bf70fa0d2e.gz
2006-02-12 21:20:30 +10:00
axel
5718ea41df Add comment in manual about array base index
darcs-hash:20060211001546-ac50b-cebbcd5ca6709c8370433abf366c0aa318ec48ec.gz
2006-02-11 10:15:46 +10:00
axel
20c83ba605 Optimize the halloc implementation so that mutiple calls to halloc can be satisfied by a single malloc, also add wcsdup and wcsndup workalikes using halloc
darcs-hash:20060211001317-ac50b-c9cf234c334b4d697fe1251c21013c8ec7f7b0a1.gz
2006-02-11 10:13:17 +10:00
axel
e9e32f980b Re-add check for presense of ncurses.h header file
darcs-hash:20060211001050-ac50b-434f0d6ea015325f75f27aaebbc54d4b81f18a2c.gz
2006-02-11 10:10:50 +10:00
axel
4b2cc49aaa Registered wrong string with halloc in expand_one, causing potential crash.
darcs-hash:20060210003539-ac50b-523cbc848435b7f2b4239cc83da897cc65c00c1c.gz
2006-02-10 10:35:39 +10:00
axel
28f65c07b0 Use consistent quoting in wgetopt
darcs-hash:20060209215120-ac50b-4dda64a6791be33b6493899714485d55372ca8ea.gz
2006-02-10 07:51:20 +10:00
axel
18279c3867 make sure fish_tests is deleted on make clean
darcs-hash:20060209215101-ac50b-48d6e4ffa276e55e0ab896040a7070294061a4ce.gz
2006-02-10 07:51:01 +10:00
axel
d1c9bca2e9 Another halloc:ification of fish. Halloc has been extended to allow registering function calls, this has allowed the creation of halloc-handled arraylists, stringbuffers, etc. More job parsing halloc-ification has reduced the error handling code to only a shadow of it's former self
darcs-hash:20060209155020-ac50b-e119c5293ce2368e252cfc01b98ab7c629fdd678.gz
2006-02-10 01:50:20 +10:00
axel
49973b85da Add source documentation for functions in parse_util.h
darcs-hash:20060208184737-ac50b-e86de902a966621501eea1b706b181bcda91fb61.gz
2006-02-09 04:47:37 +10:00
axel
47373c4f68 Fix bug where recursive function loading crashed fish
darcs-hash:20060208184437-ac50b-c6b2001fbab07ac9561ba7aa941fbab0d93d7cd7.gz
2006-02-09 04:44:37 +10:00
axel
cbf1dbaa2e Add missing fish_tests file to make clean
darcs-hash:20060208180342-ac50b-a4cf2411534c8c1bd3db335152d4615f951529c8.gz
2006-02-09 04:03:42 +10:00
axel
fdaa79416a Make sure dynamically loaded functions are completable, even if they have not yet been loaded
darcs-hash:20060208173718-ac50b-40c93b82f3b8a717d220642e22c4b4005d8871d0.gz
2006-02-09 03:37:18 +10:00
axel
7c3700c190 Fix crash bug caused by trying to free halloc:ed memory
darcs-hash:20060208153904-ac50b-f8b3d2aadb12fa1e6aca0c4ca7a6046a09a0450d.gz
2006-02-09 01:39:04 +10:00
axel
a0e1f9113e Do not use CDPATH when completing arguments starting with a '.'
darcs-hash:20060208152909-ac50b-650092242a4d9454db6cf4d73858c137040db4c5.gz
2006-02-09 01:29:09 +10:00
axel
133b682793 New wreaddir function, wide character version of readdir
darcs-hash:20060208145847-ac50b-0e250edb67dd095e90054ed55f88a2638ba9b02a.gz
2006-02-09 00:58:47 +10:00
axel
824f4ee566 Make the __fish_describe_command function strip spaces and newlines
darcs-hash:20060208102236-ac50b-6df5b077a09eda9180a1405305e12fd15967eb31.gz
2006-02-08 20:22:36 +10:00
axel
1cb9b65744 Fis function signature for a few functions in parser.c
darcs-hash:20060208102203-ac50b-5e81c6580302ca3a1cee0d03f179b5d75ff61be3.gz
2006-02-08 20:22:03 +10:00
axel
35dde5de15 Move more functions to autoload
darcs-hash:20060208102043-ac50b-4e26615523a6b9528c2ea4768f41ad1b2e1c4a0f.gz
2006-02-08 20:20:43 +10:00
Nicholas Pilon
4d9bb19467 cvs completions
Better completions for cvs. Covers most flags in the manual, except for some for history that I couldn't write good descriptions for. Descriptions could probably use some tweaking, but the basic structure should be much better than what we had before.

darcs-hash:20060208023146-494f2-bea009421c161257f09c0f53c52ab1ee116fc3dc.gz
2006-02-08 12:31:46 +10:00
axel
2555353161 Make 'exit' work in even handlers
darcs-hash:20060208092429-ac50b-f88534a423dc194fdb6453d66b5d4cc7733e54fb.gz
2006-02-08 19:24:29 +10:00
axel
73a9c8bcb8 Autoloaded functions
darcs-hash:20060208092005-ac50b-8e784f79a4e158c8c15b553fad85002dccc7bd03.gz
2006-02-08 19:20:05 +10:00
Nicholas Pilon
47b652c76e Awk Indent Fix
Indented the awk script for command description.

darcs-hash:20060208004201-494f2-2f08b1b7999c690bd1815b6c1702529c932b364d.gz
2006-02-08 10:42:01 +10:00
axel
0b044b785a 1.20.2
darcs-hash:20060207115300-ac50b-036d087b1f3493d9ecd7fd1c31d31be5c77c26b6.gz
2006-02-07 21:53:00 +10:00
axel
ddff3561e3 Minor tweaks to expand_Variables, fixes rare memory leak
darcs-hash:20060207114857-ac50b-9b2ecf31106678ec35d888066162bf14605c6003.gz
2006-02-07 21:48:57 +10:00
axel
c4dfdfa849 Fix various uses of old set syntax
darcs-hash:20060206184145-ac50b-5140cacddec9da734d4ef9a38f053259ea1f479a.gz
2006-02-07 04:41:45 +10:00
axel
08251dcc98 Only hide /private directories under OS X
darcs-hash:20060206181717-ac50b-043020858020be5dc55c34240329916696f5892a.gz
2006-02-07 04:17:17 +10:00
axel
57d53c70e3 Further halloc:ification if fish
darcs-hash:20060206181101-ac50b-db0aac307a81e7f0677acd15a9f38ff8c7ff36d2.gz
2006-02-07 04:11:01 +10:00
axel
4e77ee4516 Fix bug that would accidentally disable interactive mode on OS X when writing the titlebar message on some systems. Found by Nick Pilon
darcs-hash:20060206152015-ac50b-63d86ca778c240012bbe1e0d28062591a10f3a54.gz
2006-02-07 01:20:15 +10:00
axel
6291be256b Second checkin of halloc changeover. Make the argv array, but not it's contents, be allocated using halloc. Also make list_to_char_arr use halloc
darcs-hash:20060206151817-ac50b-e8fd4cff831ee975c5bf3855d9ecfc15a3fb9215.gz
2006-02-07 01:18:17 +10:00
axel
e756f7d619 Minor code cleanup, don't use expand_escape and expand_unescape any more
darcs-hash:20060206151552-ac50b-e2229d096926461f643fdcdfc79ef1ff01344a35.gz
2006-02-07 01:15:52 +10:00
axel
cf3d30d4e4 Lazily load history file
darcs-hash:20060206150810-ac50b-f4e5fe9312aa898fa025d2874444c4fc5724c309.gz
2006-02-07 01:08:10 +10:00
axel
585191310b First checkin of transition to using a new hierarchical memory allocator, some of the memory associated with a job is covered
darcs-hash:20060206142502-ac50b-ba1c9a4f64ea0f44f65303a125f9ddae5bd31e2f.gz
2006-02-07 00:25:02 +10:00
axel
530bbfc9ac Make sure line counting doesn't move past end of string
darcs-hash:20060206134757-ac50b-2e80cf3ec104f7b40babef5260fb1d5435dbc74d.gz
2006-02-06 23:47:57 +10:00
axel
a521fa4165 Make execution of functions use wcsdup to make sure no memory errors happen if a function removes itself
darcs-hash:20060206134701-ac50b-27be7fe76512d6ac4313eea79b45a9c11083bccd.gz
2006-02-06 23:47:01 +10:00
axel
0f76f77173 Make sure interactive mode is of when firing events
darcs-hash:20060206134532-ac50b-93f8a7cf7be2a82a1222fb520541b08bef33baa4.gz
2006-02-06 23:45:32 +10:00
axel
c743ebf211 Add long style option support for prevd/pushd, also add a few missing translation strings
darcs-hash:20060206112453-ac50b-271b830b35176d1ff93d9d9fb6c30343b4f1b4df.gz
2006-02-06 21:24:53 +10:00
Nicholas Pilon
04ce9ecf16 Darwin Open
Tweak the open function to use /usr/bin/open on Darwin, and mimedb on everything else.

darcs-hash:20060206012623-494f2-e4626c03895065837f0c8981482d5b16313dfc08.gz
2006-02-06 11:26:23 +10:00
Nicholas Pilon
bde5921258 Describe Command awk-ification
Changed __fish_describe_command to use awk instead of sed, and handle 'alternative' names, as used by OS X. (And possibly some BSDs?)

darcs-hash:20060205221805-494f2-85a48edd8e6fbcfc1dcd28079e4adfa52a0466d0.gz
2006-02-06 08:18:05 +10:00
Nicholas Pilon
89ae02976f Completion: System Commands
Tiny tweak to sed expression to get descriptions for system commands too.

darcs-hash:20060205194830-494f2-1f1df9c2d4d1d2302e34df113c4919078388aa1a.gz
2006-02-06 05:48:30 +10:00
Nicholas Pilon
d8382acc74 PWD Tweaks
Tweaked prompt_pwd and pwd to omit the leading /private from some system directories on OS X.

darcs-hash:20060205194908-494f2-936d1346a4cd118f763bea24495edf9829b59748.gz
2006-02-06 05:49:08 +10:00
axel
749c44fe27 Minor edits of builtin.c, some reindentation and code comment improvement
darcs-hash:20060205212050-ac50b-70c1b34208b442b5670fde2c6655e09c4480c7e7.gz
2006-02-06 07:20:50 +10:00
axel
88ec924323 Another set of spelling corrections from HJB
darcs-hash:20060205211835-ac50b-d08f069c3307ec7785b038f157c919416c6bb8b7.gz
2006-02-06 07:18:35 +10:00
axel
7ff069a2e1 Make LS_COLORS non-univerasl, and contain many more filetypes
darcs-hash:20060205131422-ac50b-521f4764e463acab1fc0414f58e73af55bd62c5c.gz
2006-02-05 23:14:22 +10:00
axel
8e05c8bee8 Tiny performance tweaks
darcs-hash:20060205131335-ac50b-5b1895d50334dfe9e375ab60e723d1b62b712707.gz
2006-02-05 23:13:35 +10:00
axel
0fa3c15114 Tweaks to some source comments
darcs-hash:20060205131253-ac50b-c3ad91b280a73fc8ec318ca6c285de773ffecfc6.gz
2006-02-05 23:12:53 +10:00
axel
58667673d9 Remove duplicate line counting code. Make the remaining implementation have a two element cache.
darcs-hash:20060205131035-ac50b-885c6ba87a6d16aa48dfa7ee4608ae8891c71724.gz
2006-02-05 23:10:35 +10:00
axel
a53a9aa293 Clean up init code in builtin.c
darcs-hash:20060205130840-ac50b-1a2b29671b7d8c557ebd284513c535e082ee5cf3.gz
2006-02-05 23:08:40 +10:00
axel
09402223e8 Minor edits to the INSTALL file
darcs-hash:20060204131412-ac50b-3713bdae731b4853e598930c9823b950d3039a72.gz
2006-02-04 23:14:12 +10:00
axel
4f947015d2 Minor tweaks, including a few small performance improvements
darcs-hash:20060204130914-ac50b-331e83fd8fe472545fce60fc4b76bb8300526d64.gz
2006-02-04 23:09:14 +10:00
axel
9f3a7543aa Remove some unneeded debug messages
darcs-hash:20060204115812-ac50b-b756b9d1257be714fae52f713a48a360903437dd.gz
2006-02-04 21:58:12 +10:00
axel
7ae6805698 Minor optimization - only set locale if we actually want to output something in set_color
darcs-hash:20060204114256-ac50b-5ec72de2f15d359b8edb330ae6c5f05c4c54e4b5.gz
2006-02-04 21:42:56 +10:00
axel
1401c44a79 Don't print full stack trace for failiures in cd in interactive mode
darcs-hash:20060204113650-ac50b-465dd4b3fb27e8d90127231cccdae29ac7b8fd20.gz
2006-02-04 21:36:50 +10:00
axel
40ea5987b2 Add /opt and /opt/local to list of possibly interesting directories for PATH and library path
darcs-hash:20060204113619-ac50b-97b1e6b3c2cf32fa12bf42486f9249319f4a531b.gz
2006-02-04 21:36:19 +10:00
axel
6920f039eb Minor optimization to the prompt command
darcs-hash:20060204113512-ac50b-4604692cac17972b379a7f40599a30e0bbfc3f89.gz
2006-02-04 21:35:12 +10:00
axel
ff00354305 Make sure completions aren't run in interactive mode
darcs-hash:20060204113433-ac50b-454170ab12fbbcec9cfb6615910b611c680fcc3d.gz
2006-02-04 21:34:33 +10:00
axel
f9c63a142b Don't print errors if parent can't give child control of terminal during exec(), since child may have already exited
darcs-hash:20060204113320-ac50b-385b600789e7d1aee2a15a69658e9e0b4af838d0.gz
2006-02-04 21:33:20 +10:00
axel
3733fe3997 Make children set their own process group instead of waiting for their parent to do it for them
darcs-hash:20060203215031-ac50b-d00ce5c09b469edd968618a4bba4b5c1f7dc075c.gz
2006-02-04 07:50:31 +10:00
axel
7e3128f097 Minor comment edits in complete.c
darcs-hash:20060203213006-ac50b-86ccb93b4c984ab0d29423b8a63269bd1e161410.gz
2006-02-04 07:30:06 +10:00
axel
727472d5bd Correct broken test for gettext command
darcs-hash:20060203212939-ac50b-8a99c32124c6b643443bc7295df91d6f0c903247.gz
2006-02-04 07:29:39 +10:00
axel
3616a23bdd Add fink and pkgsrc /bin directories to PATH if they exist
darcs-hash:20060203212901-ac50b-94e02eea218c2f40542efd62060a74796cdbe363.gz
2006-02-04 07:29:01 +10:00
axel
f13262d87e Move parts of the command description lookup code to a shellscript function
darcs-hash:20060203172736-ac50b-95430eb4ca0d7ee2859237e8543a4e0883349fdb.gz
2006-02-04 03:27:36 +10:00
axel
f71cd494de prompt and terminal functions should not be run in interactive mode
darcs-hash:20060203093426-ac50b-5e6bf8382c6a5fb4b409439eddf612fffa9c752e.gz
2006-02-03 19:34:26 +10:00
axel
264c065006 Remove old unneeded code that makes fish_pager wait to become owner of the terminal
darcs-hash:20060203093314-ac50b-537c521093e85a110f822cde37b022d7706e8cb0.gz
2006-02-03 19:33:14 +10:00
axel
07c89c71d8 Fix broken test for realpath taking null as a second argument
darcs-hash:20060203004145-ac50b-5357d5f203fa66d5aaef9059e3f03866d2e7f67d.gz
2006-02-03 10:41:45 +10:00
axel
19c67db731 Make hostname completion code more robust
darcs-hash:20060203004114-ac50b-54fda8fe89649d404cd6981d7783e18f5092f217.gz
2006-02-03 10:41:14 +10:00
axel
294da72d11 Make string conversion in wutil.c handle special 'broken encoding' sequences
darcs-hash:20060203004028-ac50b-01fbe7b22aece08a7a4d1afe84affd80ce944d40.gz
2006-02-03 10:40:28 +10:00
axel
847b6daa34 Minor fix for completions for status builtin
darcs-hash:20060203003935-ac50b-fd3e5b642cdca5631f36942309b017ebbaa63cb2.gz
2006-02-03 10:39:35 +10:00
axel
807a0b8dbd Improved error checking in main()
darcs-hash:20060203003855-ac50b-d4f5c4e183dc1b38bbfe15bf44be746bb188ef10.gz
2006-02-03 10:38:55 +10:00
axel
c3a1473419 Add fish switch to enter login mode
darcs-hash:20060203003754-ac50b-99961eb6635beb0700fbd542fc7ff979ab1ceeb9.gz
2006-02-03 10:37:54 +10:00
axel
29707e66e6 Update INSTALL file to be less redundant and contain a bit of information about compilers
darcs-hash:20060202153401-ac50b-502136b1a0e1c5117a34cc1e105a718d6ea8884b.gz
2006-02-03 01:34:01 +10:00
axel
a97b652046 Minor source documentation edits
darcs-hash:20060202153330-ac50b-63ad1ac0f20b94f6015e472b52ac32040a942280.gz
2006-02-03 01:33:30 +10:00
axel
91b46b305d Make error message in contains function translatable
darcs-hash:20060202153304-ac50b-69fc557308b7ae7eb3a3d8d658e6f7c871aa68cd.gz
2006-02-03 01:33:04 +10:00
axel
fbe66f54aa Make completion of subsommands for time and sudo a bit better at differing between command and subcommand
darcs-hash:20060202153151-ac50b-d943052af165dc345366b49a5db413f635a2f28a.gz
2006-02-03 01:31:51 +10:00
axel
ff03fe7e41 Make autoconf detection for have__nl_msg_cat_cntr slightly more robust
darcs-hash:20060202152939-ac50b-9b38585f8c1d1855d08cc7fd1a75e51ff54a9b0e.gz
2006-02-03 01:29:39 +10:00
axel
06fd1aa9f8 Make stack traces print absolute filenames
darcs-hash:20060202152356-ac50b-9e6ab31c03d5f49824ccca7eee3b8e62d66b0009.gz
2006-02-03 01:23:56 +10:00
axel
5942a6d6c1 Don't reset history on cursor movement
darcs-hash:20060201155546-ac50b-975730e850775a9f47e15a65c9c5959a335edc93.gz
2006-02-02 01:55:46 +10:00
axel
a781736fb7 Swedish translation checkin
darcs-hash:20060201155516-ac50b-aeeebdc296c8684325a97edf92ad360f7675a981.gz
2006-02-02 01:55:16 +10:00
axel
feabc032f6 Generalize the stack tracing code, add support for showing events and command substitutions in stack traces
darcs-hash:20060201154911-ac50b-707358ea50231661c05a92b40ca109ec801081e6.gz
2006-02-02 01:49:11 +10:00
axel
9f9f7bf95a Minor edits to fish documentation
darcs-hash:20060201134029-ac50b-c80a9dadb4960dfbba255ca046682f2798621cf2.gz
2006-02-01 23:40:29 +10:00
axel
02f638ad2b Minor spelling fixes from Hermann J. Beckers
darcs-hash:20060201122912-ac50b-88d59b8c0e94e8a2db5b1a6f94b4fa7f25c7859e.gz
2006-02-01 22:29:12 +10:00
axel
e95effb043 Readd the terminal flag for jobs, as not all jobs under job control should be given the terminal.
darcs-hash:20060201122715-ac50b-7efc499e8905e9898c214816d0a3468e077c7005.gz
2006-02-01 22:27:15 +10:00
axel
7a1a5a6f01 Swedish translation checkin
darcs-hash:20060131220043-ac50b-f4885e4fb81bea7b84b0ea85669f813f751b9903.gz
2006-02-01 08:00:43 +10:00
axel
bfefe7f262 Add completions for the status builtin
darcs-hash:20060131215933-ac50b-330b6cb15406ee62006d0dcd3b9ae4cf70ee1e68.gz
2006-02-01 07:59:33 +10:00
axel
44e8dcd331 Add not on commandline behaviour when using complete -C to documentation
darcs-hash:20060131214646-ac50b-dc7b1510ceefc7645061d91bbe5022c09c209a34.gz
2006-02-01 07:46:46 +10:00
axel
3580811f8e Minor documentation correction regarding how to use io redirection to close a fd
darcs-hash:20060131214551-ac50b-0b687b3279d3a9c94338092bff1b0a8001e9566d.gz
2006-02-01 07:45:51 +10:00
axel
35cf20640f Add mention of the new -C switch for complete in the documentation
darcs-hash:20060131214426-ac50b-16a1b18cf8f5c05e59e1b338dde1c13089321bac.gz
2006-02-01 07:44:26 +10:00
axel
eff36003db Remove fallback version of the _nl_msg_cat_cntr symbol. We check for it at configure-time and only use it if it exists
darcs-hash:20060131214303-ac50b-c13a7addd8f35e0adce72213f5aa6dc2a35b7a73.gz
2006-02-01 07:43:03 +10:00
axel
0eab394c24 Fix for how fish parses the double quote character
darcs-hash:20060131214201-ac50b-d921c2c74fa40723ae064a90d445258aa41ec94f.gz
2006-02-01 07:42:01 +10:00
axel
028e1f36a1 Improve the status builtin
darcs-hash:20060130195310-ac50b-5da6881a847170242be56555646bbf037218d545.gz
2006-01-31 05:53:10 +10:00
axel
f59e9baab9 Rename the 'terminal' flag to 'job_control', make sure fg and bg only considers jobs under job control and make it configurable which jobs are put under job control using the status builtin. Also add an option to the status builtin to print a stack trace.
darcs-hash:20060130175426-ac50b-46fb79797284cb600c67cb19462b53761446f00a.gz
2006-01-31 03:54:26 +10:00
axel
1c6f685522 Minor code tweaks
darcs-hash:20060130165800-ac50b-8fa4a7ff78365497c5d03d6c7643d5206f41de37.gz
2006-01-31 02:58:00 +10:00
axel
c8a36c9889 Autoconf tweaks to make library detection more robust
darcs-hash:20060130165706-ac50b-e7685a85f07811815fb01ac3b79609ea7f0a7786.gz
2006-01-31 02:57:06 +10:00
axel
521d09b6d0 Add support for calculating completions for arbitrary commands through the 'complete' builtin
darcs-hash:20060130165150-ac50b-5e2ef3bb0298dd5e1a5d6fbdade314cc73ef36f3.gz
2006-01-31 02:51:50 +10:00
axel
3efb0bf5cf Fix bug that caused shellscript functions in pipelines that don't have any output to never be properly removed
darcs-hash:20060129220414-ac50b-8c26e83933a73ef146c28bed020a6a2dfeca425f.gz
2006-01-30 08:04:14 +10:00
axel
003c4d776f Display use of . (source) builtin in stack traces
darcs-hash:20060128113440-ac50b-6556097eb766cc7561a3d30ef994bc913181fe65.gz
2006-01-28 21:34:40 +10:00
axel
00dea8a082 Optimize the fish_prompt function
darcs-hash:20060128102551-ac50b-58580c29fd9537e502bacaad7949433010b5a04b.gz
2006-01-28 20:25:51 +10:00
axel
7f195b2f23 Swedish translation checkin (small)
darcs-hash:20060128022149-ac50b-e4089e5517b80ea05aa2d1e2597fc83fc346feb4.gz
2006-01-28 12:21:49 +10:00
axel
ecc2fbca98 Minor documentation tweaks
darcs-hash:20060128022118-ac50b-555ebb17d4f43692a5f363a085dcbcf57aa69111.gz
2006-01-28 12:21:18 +10:00
axel
631acd529d Fix typo in sudo completions
darcs-hash:20060128022054-ac50b-8d859c4481c34c5830e9b5fa9e436e165160547e.gz
2006-01-28 12:20:54 +10:00
axel
369f1709be Misc init-files cleanup, including making sure various variables are function-local
darcs-hash:20060128022022-ac50b-3a9fabe385f53559dd9e0bb5d8f9994d833ced1d.gz
2006-01-28 12:20:22 +10:00
axel
1505cc3d81 Add comment in documentation for set builtin about not allowing switches after non-switches
darcs-hash:20060128021933-ac50b-db340075e9a57b41a91d6b64d56d9b5579185254.gz
2006-01-28 12:19:33 +10:00
axel
78ae6d3bea Check for gettext in seq fallback implementation
darcs-hash:20060128021846-ac50b-7c11eea694e5c3b87e00508fbeaedc9dcd163726.gz
2006-01-28 12:18:46 +10:00
axel
ea81321ccb Add translation support to wgetopt library
darcs-hash:20060128021740-ac50b-f670531d3d79cb8070756669f83f4e8b25233a0a.gz
2006-01-28 12:17:40 +10:00
axel
1977d3beb3 Add support for correctly handling illegal character strings
darcs-hash:20060128020329-ac50b-d3499e6ff9108cef25bf7e00f39bbe1476896e07.gz
2006-01-28 12:03:29 +10:00
axel
285984196d More spelling fixes from Hermann J. Beckers
darcs-hash:20060128003459-ac50b-af346d3abc52bf1bb4de43cbbaa3d87b3b7264eb.gz
2006-01-28 10:34:59 +10:00
axel
5f8e6c85e4 Small fixes for emerge completions, sent by Mike Auty
darcs-hash:20060127082639-ac50b-881d00da4712a2d149618c07356c8d711bf55ac9.gz
2006-01-27 18:26:39 +10:00
axel
e01ccb14af shellscript functions should use the help command to display help
darcs-hash:20060126173437-ac50b-69c03761554180467f741a9597205fab6c823378.gz
2006-01-27 03:34:37 +10:00
axel
86b7ae6d21 1.20.1
darcs-hash:20060126163046-ac50b-483c77663467060a13015bcee755f708a86157e9.gz
2006-01-27 02:30:46 +10:00
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
438 changed files with 41908 additions and 14034 deletions

1016
ChangeLog

File diff suppressed because it is too large Load Diff

48
INSTALL
View File

@@ -2,41 +2,44 @@
Known issues
============
Older versions of Doxygen has bugs in the man-page generation which
cause the builtin help to render incorrectly. Version 1.2.14 is known
to have this problem.
Fish is developed using GCC, with the goal of using only C89 language
features. Fish does, however use the *wprintf family of functions,
which are new to the C99 standrard. It is not unlikely that any given
release contains a few GCC:isms, but ICC 9.0.030 has been found to
produce working binaries. GCC 2.95.* won't compile fish, but GCC 3.2.3
is known to work. Patches to fix any remaining GNU:isms are welcome.
In version 1.9.2, the installation prefix for fish rpms and debs has
changed from /usr/local to /usr. The package should automatically
change any instances of /usr/local/bin/fish in /etc/passwd to
/usr/bin/fish, but some programs, like screen, may need to be
restarted to notice the changes. You may also run into problems when
switching between using a package and personal builds.
Older versions of Doxygen has bugs in the man-page generation which
cause the builtin help to render incorrectly. Doxygen 1.2.14 is known
to have this problem.
Prerequisites
=============
Fish requires the following packages to build:
Fish requires the following programs and libraries to build:
- Doxygen
- Curses or Ncurses
- GNU make
- GCC
fish also relies on standard unix tools such as cat, cut, grep, sed,
whoami and echo. Fish does not support cross-compilation, separate
build directories or any other fancy configure options. Use a recent
version of Doxygen, since older versions have bugs that make the
builtin help pages render incorrectly. Version 1.2.14 is known to be
broken.
whoami, bc and echo. Fish does not yet support cross-compilation,
separate build directories or any other fancy configure options.
Simple install procedure
========================
If you have downloaded the darcs repository of fish, you need to run
the autoconf command first. Then use the following commands to compile
fish:
% ./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 to generate the configure script.
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

@@ -16,6 +16,10 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#
# @configure_input@
#
#
# Makefile for the fish shell. Can build fish and associated
# applications, install them, recalculate dependencies and also create
@@ -28,64 +32,83 @@
# hallucinations.
#
# Compiler flags
# Programs
CC := @CC@
CFLAGS := @CFLAGS@ @INCLUDEDIR@ -Wall -std=gnu99 -fno-strict-aliasing
CPPFLAGS=@CPPFLAGS@
LDFLAGS:= -l@CURSESLIB@ @LIBS@ @LDFLAGS@ @LIBDIR@
INSTALL:=@INSTALL@
CFLAGS:=@CFLAGS@
CPPFLAGS=@CPPFLAGS@
LDFLAGS:= @LIBS@ @LDFLAGS@
# Installation directories
prefix = @prefix@
exec_prefix = @exec_prefix@
datadir = @datadir@
bindir = @bindir@
mandir = @mandir@
sysconfdir = @sysconfdir@
fishdir = @fishdir@
fishfile = @fishfile@
fishinputfile = @fishinputfile@
docdir = @docdir@
#etc files to install
ETC_DIR_INSTALL = etc/fish_interactive.fish
# Set to 1 if we have gettext
HAVE_GETTEXT=@HAVE_GETTEXT@
CORE_OBJS := util.o common.o halloc.o halloc_util.o fallback.o
# All objects used by fish, that are compiled from an ordinary .c file
# using an ordinary .h file.
COMMON_OBJS := function.o builtin.o common.o complete.o env.o exec.o \
COMMON_OBJS := function.o builtin.o complete.o env.o exec.o \
expand.o highlight.o history.o kill.o parser.o proc.o reader.o \
sanity.o tokenizer.o util.o wildcard.o wgetopt.o wutil.o input.o \
sanity.o tokenizer.o wildcard.o wgetopt.o wutil.o input.o \
output.o intern.o env_universal.o env_universal_common.o \
input_common.o event.o signal.o io.o
input_common.o event.o signal.o io.o translate.o parse_util.o \
$(CORE_OBJS)
# builtin_help.h exists, but builtin_help.c is autogenerated
COMMON_OBJS_WITH_HEADER := builtin_help.o
# 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.o builtin_complete.o builtin_jobs.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
FISHD_OBJS := fishd.o env_universal_common.o common.o util.o wutil.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 output.o wutil.o \
tokenizer.o input_common.o env_universal.o env_universal_common.o \
translate.o $(CORE_OBJS)
#All objects that the system needs to build mimedb
MIME_OBJS := mimedb.o xdgmimealias.o xdgmime.o xdgmimeglob.o \
xdgmimeint.o xdgmimemagic.o xdgmimeparent.o wutil.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 wutil.o \
doc_src/fishd.o $(CORE_OBJS)
# All objects needed to build mimedb
MIME_OBJS := mimedb.o xdgmimealias.o xdgmime.o xdgmimeglob.o \
xdgmimeint.o xdgmimemagic.o xdgmimeparent.o wutil.o $(CORE_OBJS)
#
# Files containing documentation for builtins. Should be listed
# 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 +123,22 @@ 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/vared.txt
CMD_DOC_SRC := doc_src/contains.txt doc_src/count.txt doc_src/dirh.txt \
doc_src/dirs.txt doc_src/fish_pager.txt doc_src/fishd.txt \
doc_src/help.txt doc_src/mimedb.txt doc_src/nextd.txt \
doc_src/open.txt doc_src/popd.txt doc_src/prevd.txt \
doc_src/psub.txt doc_src/pushd.txt doc_src/set_color.txt \
doc_src/trap.txt doc_src/type.txt doc_src/umask.txt \
doc_src/vared.txt
#
# Files generated by running doxygen on the files in $(CMD_DOC_SRC)
#
CMD_DOC_HDR := $(CMD_DOC_SRC:.txt=.doxygen)
#
# Files in the test directory
#
TEST_IN := $(wildcard tests/test*.in)
#
@@ -126,42 +152,66 @@ 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/fish_function.fish init/fish_inputrc \
init/fish_interactive.fish
# Files in ./etc/
ETC_DIR_FILES :=etc/fish.in etc/fish_inputrc \
etc/fish_interactive.fish.in
# Files in ./share/
SHARE_DIR_FILES :=share/fish.in
# Files in ./tests/
TESTS_DIR_FILES := $(TEST_IN) $(TEST_IN:.in=.out) $(TEST_IN:.in=.err) \
$(TEST_IN:.in=.status) tests/test.fish tests/gen_output.fish
COMPLETIONS_DIR_FILES := $(wildcard init/completions/*.fish)
# Files in ./share/completions/
COMPLETIONS_DIR_FILES := $(wildcard share/completions/*.fish)
# Files in ./share/functions/
FUNCTIONS_DIR_FILES := $(wildcard share/functions/*.fish)
# Programs to build
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
configure: configure.ac
./config.status --recheck
Makefile: Makefile.in configure
./config.status
debug:
make fish CFLAGS="@CFLAGS@ -O0 -Wno-unused -Werror -g"
.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 +225,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 +256,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 etc/*.in share/fish share/completions/*.fish share/functions/*.fish seq
if test $(HAVE_GETTEXT) = 1;then \
xgettext -k_ -kN_ *.c *.h -o messages.pot; \
if ! xgettext -j -k_ -kN_ -LShell etc/*.in share/fish share/completions/*.fish share/functions/*.fish seq -o messages.pot; then \
echo "Your xgettext version is too old to build the messages.pot file"\
rm messages.pot\
false;\
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 +318,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,82 +340,178 @@ 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 fish
#
# Check for an incompatible installed fish version, and fail with an
# error if found
check-uninstall:
if test -f $(DESTDIR)$(sysconfdir)/fish.d/fish_function.fish -o -f $(DESTDIR)$(sysconfdir)/fish.d/fish_complete.fish; then \
echo;\
echo ERROR;\
echo;\
echo An older fish installation using an incompatible filesystem hierarchy was detected;\
echo You must uninstall this fish version before installing proceeding;\
echo type \'make uninstall-legacy\' to uninstall these files,;\
echo or type \'make force-install\' to force installation.;\
echo The latter may result in a broken installation.;\
echo;\
false;\
fi;
.PHONY: check-uninstall
# Try to install after checking for incompatible installed versions
install: all check-uninstall install-force
.PHONY: install
# Force installation, even in presense of incompatible previous
# version
install-force: all install-translations
$(INSTALL) -m 755 -d $(DESTDIR)$(bindir)
for i in $(PROGRAMS); do\
$(INSTALL) -m 755 $$i $(DESTDIR)$(bindir) ; \
done;
$(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)$(fishdir)
$(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)$(fishdir)/completions
$(INSTALL) -m 644 init/fish $(DESTDIR)$(sysconfdir)$(fishfile)
for i in init/fish_interactive.fish init/fish_function.fish init/fish_complete.fish ; do \
$(INSTALL) -m 644 $$i $(DESTDIR)$(sysconfdir)$(fishdir); \
$(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)/fish.d
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/completions
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/functions
$(INSTALL) -m 644 etc/fish $(DESTDIR)$(sysconfdir)/fish
$(INSTALL) -m 644 share/fish $(DESTDIR)$(datadir)/fish
for i in $(ETC_DIR_INSTALL); do \
$(INSTALL) -m 644 $$i $(DESTDIR)$(sysconfdir)/fish.d; \
done;
for i in $(COMPLETIONS_DIR_FILES); do \
$(INSTALL) -m 644 $$i $(DESTDIR)$(sysconfdir)$(fishdir)/completions/; \
$(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/completions/; \
done;
$(INSTALL) -m 644 init/fish_inputrc $(DESTDIR)$(sysconfdir)$(fishinputfile);
for i in $(FUNCTIONS_DIR_FILES); do \
$(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/functions/; \
done;
$(INSTALL) -m 644 etc/fish_inputrc $(DESTDIR)$(sysconfdir)/fish_inputrc;
$(INSTALL) -m 755 -d $(DESTDIR)$(docdir)
for i in user_doc/html/* ChangeLog; do \
$(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-force
uninstall:
# Uninstall this fish version
uninstall: uninstall-translations
for i in $(PROGRAMS); do \
rm -f $(DESTDIR)$(bindir)/$$i; \
done;
rm -f $(DESTDIR)$(bindir)/xsel
rm -f $(DESTDIR)$(sysconfdir)$(fishfile)
rm -f $(DESTDIR)$(sysconfdir)$(fishinputfile)
rm -r $(DESTDIR)$(sysconfdir)$(fishdir)
rm -r $(DESTDIR)$(docdir)
for i in fish.1* @XSEL_MAN@ mimedb.1* set_color.1* tokenize.1* count.1*; do \
rm $(DESTDIR)$(mandir)/man1/$$i; \
rm -f $(DESTDIR)$(sysconfdir)/fish
rm -f $(DESTDIR)$(sysconfdir)/fish_inputrc
if test -d $(DESTDIR)$(datadir)/fish; then \
rm -r $(DESTDIR)$(datadir)/fish; \
fi
if test -d $(DESTDIR)$(docdir); then \
rm -r $(DESTDIR)$(docdir);\
fi
for i in fish.1 @XSEL_MAN@ mimedb.1 fishd.1 set_color.1 count.1; do \
rm -f $(DESTDIR)$(mandir)/man1/$$i*; \
done;
.PHONY: uninstall
# Uninstall older fish release. This is not the default uninstall
# since there is a slight chance that it removes a file put in place by
# the sysadmin.
uninstall-legacy: uninstall
rm -f $(DESTDIR)$(sysconfdir)/fish.d/fish_interactive.fish
rm -f $(DESTDIR)$(sysconfdir)/fish.d/fish_complete.fish
rm -f $(DESTDIR)$(sysconfdir)/fish.d/fish_function.fish
if test -d $(DESTDIR)$(sysconfdir)/fish.d/completions; then \
for i in $(COMPLETIONS_DIR_FILES); do \
basename=`basename $$i`; \
if test -f $(DESTDIR)$(sysconfdir)/fish.d/completions/$$basename; then \
rm $(DESTDIR)$(sysconfdir)/fish.d/completions/$$basename; \
fi; \
done; \
fi;
rmdir $(DESTDIR)$(sysconfdir)/fish.d/completions; true
rmdir $(DESTDIR)$(sysconfdir)/fish.d; true
@echo The previous fish installation has been removed.
.PHONY: uninstall-legacy
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/*/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)
$(CC) $(FISH_TESTS_OBJS) $(LDFLAGS) -o $@
mimedb: $(MIME_OBJS) util.o common.o doc_src/mimedb.c
$(CC) ${MIME_OBJS} util.o common.o doc_src/mimedb.c $(LDFLAGS) -o $@
mimedb: $(MIME_OBJS) doc_src/mimedb.o
$(CC) ${MIME_OBJS} doc_src/mimedb.o $(LDFLAGS) -o $@
set_color: set_color.o doc_src/set_color.c
$(CC) set_color.o doc_src/set_color.c $(LDFLAGS) -o $@
tokenize: tokenize.o doc_src/tokenize.c
$(CC) tokenize.o doc_src/tokenize.c $(LDFLAGS) -o $@
set_color: set_color.o doc_src/set_color.o
$(CC) set_color.o doc_src/set_color.o $(LDFLAGS) -o $@
# Test program for the tokenizer library
tokenizer_test: tokenizer.c tokenizer.h util.o wutil.o common.o
$(CC) ${CFLAGS} tokenizer.c util.o wutil.o common.o -D TOKENIZER_TEST $(LDFLAGS) -o $@
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 $@
# Neat little program to show output from terminal
key_reader: key_reader.o input_common.o $(CORE_OBJS) env_universal.o env_universal_common.o wutil.o
$(CC) key_reader.o input_common.o $(CORE_OBJS) env_universal.o env_universal_common.o wutil.o $(LDFLAGS) -o $@
#
# Update dependencies
#
depend:
makedepend -fMakefile.in -Y *.c
./config.status
.PHONY: depend
# Copy all the source files into a new directory and use tar to create
# an archive from it. Simplest way I could think of to make an archive
@@ -344,40 +519,70 @@ depend:
#
# Uses install instead of mkdir so build won't fail if the directory
# exists
fish-@PACKAGE_VERSION@.tar: $(DOC_SRC_DIR_FILES) $(MAIN_DIR_FILES) $(INIT_DIR_FILES) $(TEST_DIR_FILES) $(COMPLETIONS_DIR_FILES) ChangeLog
fish-@PACKAGE_VERSION@.tar: $(DOC_SRC_DIR_FILES) $(MAIN_DIR_FILES) $(ETC_DIR_FILES) $(TEST_DIR_FILES) $(SHARE_DIR_FILES) $(FUNCTIONS_DIR_FILES) $(COMPLETIONS_DIR_FILES) ChangeLog
rm -rf fish-@PACKAGE_VERSION@
$(INSTALL) -d fish-@PACKAGE_VERSION@
$(INSTALL) -d fish-@PACKAGE_VERSION@/doc_src
$(INSTALL) -d fish-@PACKAGE_VERSION@/init
$(INSTALL) -d fish-@PACKAGE_VERSION@/init/completions
$(INSTALL) -d fish-@PACKAGE_VERSION@/etc
$(INSTALL) -d fish-@PACKAGE_VERSION@/share
$(INSTALL) -d fish-@PACKAGE_VERSION@/share/completions
$(INSTALL) -d fish-@PACKAGE_VERSION@/share/functions
$(INSTALL) -d fish-@PACKAGE_VERSION@/tests
$(INSTALL) -d fish-@PACKAGE_VERSION@/po
cp -f $(DOC_SRC_DIR_FILES) fish-@PACKAGE_VERSION@/doc_src
cp -f $(MAIN_DIR_FILES) fish-@PACKAGE_VERSION@/
cp -f $(INIT_DIR_FILES) fish-@PACKAGE_VERSION@/init/
cp -f $(COMPLETIONS_DIR_FILES) fish-@PACKAGE_VERSION@/init/completions/
cp -f $(ETC_DIR_FILES) fish-@PACKAGE_VERSION@/etc/
cp -f $(SHARE_DIR_FILES) fish-@PACKAGE_VERSION@/share/
cp -f $(COMPLETIONS_DIR_FILES) fish-@PACKAGE_VERSION@/share/completions/
cp -f $(FUNCTIONS_DIR_FILES) fish-@PACKAGE_VERSION@/share/functions/
cp -f $(TESTS_DIR_FILES) fish-@PACKAGE_VERSION@/tests/
cp -f $(TRANSLATIONS_SRC) fish-@PACKAGE_VERSION@/po/
tar -c fish-@PACKAGE_VERSION@ >fish-@PACKAGE_VERSION@.tar
rm -rf fish-@PACKAGE_VERSION@
tar: fish-@PACKAGE_VERSION@.tar
.PHONY: tar
fish-@PACKAGE_VERSION@.tar.gz: fish-@PACKAGE_VERSION@.tar
gzip -f --best -c fish-@PACKAGE_VERSION@.tar >fish-@PACKAGE_VERSION@.tar.gz
fish-@PACKAGE_VERSION@.tar.bz2: fish-@PACKAGE_VERSION@.tar
bzip2 -f --best -k fish-@PACKAGE_VERSION@.tar
dist: fish-@PACKAGE_VERSION@.tar.bz2
.PHONY: dist
# Create .rpm file for the current systems architecture and an
# .src.rpm file.
rpm: fish-@PACKAGE_VERSION@.tar.bz2
@if ! which rpmbuild; then \
echo Could not find the rpmbuild command, needed to build an rpm; \
echo You may be able to install it using the following command:; \
echo \'yum install rpm-build\'; \
false; \
fi
cp fish.spec /usr/src/redhat/SPECS/
cp fish-@PACKAGE_VERSION@.tar.bz2 /usr/src/redhat/SOURCES/
rpmbuild -ba --clean /usr/src/redhat/SPECS/fish.spec
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 etc/fish etc/fish_interactive.fish seq
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 *.o doc.h doc_src/*.doxygen doc_src/*.c builtin_help.c doc_src/*.o
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 fish_tests
rm -f fish-@PACKAGE_VERSION@.tar
rm -f fish-@PACKAGE_VERSION@.tar.gz
rm -f fish-@PACKAGE_VERSION@.tar.bz2
@@ -386,71 +591,117 @@ 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: 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: config.h fallback.h common.h util.h wutil.h builtin.h function.h
builtin.o: complete.h proc.h io.h parser.h event.h reader.h env.h wgetopt.h
builtin.o: sanity.h tokenizer.h builtin_help.h wildcard.h input_common.h
builtin.o: input.h intern.h signal.h translate.h halloc.h halloc_util.h
builtin.o: parse_util.h expand.h
builtin_commandline.o: signal.h config.h fallback.h common.h util.h wutil.h
builtin_commandline.o: builtin.h wgetopt.h reader.h proc.h io.h parser.h
builtin_commandline.o: event.h tokenizer.h input_common.h input.h translate.h
builtin_commandline.o: parse_util.h
builtin_complete.o: signal.h config.h fallback.h common.h util.h wutil.h
builtin_complete.o: builtin.h complete.h wgetopt.h parser.h proc.h io.h
builtin_complete.o: event.h reader.h translate.h
builtin_help.o: config.h util.h common.h builtin_help.h
builtin_set.o: 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
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
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_common.o: config.h util.h common.h wutil.h input_common.h
builtin_set.o: signal.h config.h fallback.h common.h util.h wutil.h builtin.h
builtin_set.o: env.h expand.h wgetopt.h proc.h io.h parser.h event.h
builtin_set.o: translate.h
builtin_ulimit.o: config.h fallback.h common.h util.h builtin.h wgetopt.h
builtin_ulimit.o: translate.h
common.o: config.h fallback.h common.h util.h wutil.h expand.h proc.h io.h
common.o: wildcard.h parser.h event.h
complete.o: signal.h config.h fallback.h common.h util.h tokenizer.h
complete.o: wildcard.h proc.h io.h parser.h event.h function.h complete.h
complete.o: builtin.h env.h exec.h expand.h reader.h history.h intern.h
complete.o: translate.h parse_util.h halloc_util.h wutil.h
env.o: config.h signal.h fallback.h common.h util.h wutil.h proc.h io.h env.h
env.o: sanity.h expand.h history.h reader.h parser.h event.h env_universal.h
env.o: env_universal_common.h input_common.h translate.h complete.h
env_universal.o: config.h signal.h fallback.h common.h util.h wutil.h
env_universal.o: env_universal_common.h env_universal.h
env_universal_common.o: config.h signal.h fallback.h common.h util.h wutil.h
env_universal_common.o: env_universal_common.h
event.o: signal.h config.h fallback.h common.h util.h wutil.h function.h
event.o: proc.h io.h parser.h event.h translate.h halloc_util.h
exec.o: signal.h config.h fallback.h common.h util.h wutil.h proc.h io.h
exec.o: exec.h parser.h event.h builtin.h function.h env.h wildcard.h
exec.o: sanity.h expand.h env_universal.h env_universal_common.h translate.h
exec.o: halloc.h halloc_util.h parse_util.h
expand.o: signal.h config.h fallback.h common.h util.h wutil.h env.h proc.h
expand.o: io.h parser.h event.h expand.h wildcard.h exec.h tokenizer.h
expand.o: complete.h translate.h parse_util.h halloc_util.h
fallback.o: config.h fallback.h common.h util.h
fishd.o: config.h signal.h fallback.h common.h util.h wutil.h
fishd.o: env_universal_common.h
fish_pager.o: config.h signal.h fallback.h common.h util.h wutil.h complete.h
fish_pager.o: output.h input_common.h env_universal.h env_universal_common.h
fish_pager.o: halloc.h halloc_util.h
fish_tests.o: config.h signal.h fallback.h common.h util.h proc.h io.h
fish_tests.o: reader.h builtin.h function.h complete.h wutil.h env.h expand.h
fish_tests.o: parser.h event.h tokenizer.h output.h exec.h halloc_util.h
function.o: signal.h config.h wutil.h fallback.h common.h util.h function.h
function.o: proc.h io.h translate.h parser.h event.h intern.h reader.h
function.o: parse_util.h env.h expand.h
halloc.o: config.h fallback.h common.h util.h halloc.h
halloc_util.o: config.h fallback.h common.h util.h halloc.h
highlight.o: signal.h config.h fallback.h common.h util.h wutil.h highlight.h
highlight.o: tokenizer.h proc.h io.h parser.h event.h parse_util.h builtin.h
highlight.o: function.h env.h expand.h sanity.h complete.h output.h
history.o: config.h fallback.h common.h util.h wutil.h history.h reader.h
history.o: env.h sanity.h signal.h
input.o: config.h signal.h fallback.h common.h util.h wutil.h reader.h proc.h
input.o: io.h sanity.h input_common.h input.h parser.h event.h env.h expand.h
input.o: translate.h output.h
input_common.o: config.h fallback.h common.h util.h wutil.h input_common.h
input_common.o: env_universal.h env_universal_common.h
intern.o: config.h util.h 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
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
intern.o: config.h fallback.h common.h util.h wutil.h intern.h
io.o: config.h fallback.h common.h util.h wutil.h exec.h proc.h io.h
io.o: translate.h halloc.h
key_reader.o: fallback.h common.h util.h input_common.h
kill.o: signal.h config.h fallback.h common.h util.h wutil.h kill.h proc.h
kill.o: io.h sanity.h env.h exec.h parser.h event.h
main.o: config.h signal.h fallback.h common.h util.h reader.h builtin.h
main.o: function.h complete.h wutil.h env.h sanity.h proc.h io.h parser.h
main.o: event.h expand.h intern.h exec.h output.h translate.h halloc_util.h
main.o: history.h
mimedb.o: config.h xdgmime.h fallback.h common.h util.h
output.o: config.h signal.h fallback.h common.h util.h wutil.h expand.h
output.o: output.h halloc_util.h highlight.h
parser.o: signal.h config.h fallback.h common.h util.h wutil.h proc.h io.h
parser.o: parser.h event.h tokenizer.h exec.h wildcard.h function.h builtin.h
parser.o: builtin_help.h env.h expand.h reader.h sanity.h env_universal.h
parser.o: env_universal_common.h translate.h intern.h parse_util.h halloc.h
parser.o: halloc_util.h
parse_util.o: config.h fallback.h common.h util.h wutil.h tokenizer.h
parse_util.o: parse_util.h expand.h intern.h exec.h proc.h io.h env.h
parse_util.o: wildcard.h halloc_util.h
proc.o: config.h signal.h fallback.h common.h util.h wutil.h proc.h io.h
proc.o: reader.h sanity.h env.h parser.h event.h translate.h halloc.h
proc.o: halloc_util.h output.h
reader.o: config.h signal.h fallback.h common.h util.h wutil.h highlight.h
reader.o: reader.h proc.h io.h parser.h event.h complete.h history.h sanity.h
reader.o: env.h exec.h expand.h tokenizer.h kill.h input_common.h input.h
reader.o: function.h output.h translate.h parse_util.h
refcount.o: config.h fallback.h common.h util.h wutil.h refcount.h
sanity.o: signal.h config.h fallback.h common.h util.h sanity.h proc.h io.h
sanity.o: history.h reader.h kill.h wutil.h translate.h
set_color.o: config.h
tokenize.o: config.h
tokenizer.o: config.h util.h wutil.h tokenizer.h common.h wildcard.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
wutil.o: config.h util.h common.h wutil.h
signal.o: config.h signal.h common.h util.h fallback.h wutil.h event.h
signal.o: reader.h proc.h io.h translate.h
tokenizer.o: config.h fallback.h common.h util.h wutil.h tokenizer.h
tokenizer.o: wildcard.h translate.h
translate.o: config.h common.h util.h fallback.h halloc_util.h
util.o: config.h fallback.h common.h util.h wutil.h
wgetopt.o: config.h wgetopt.h wutil.h fallback.h common.h util.h translate.h
wildcard.o: config.h fallback.h common.h util.h wutil.h complete.h wildcard.h
wildcard.o: reader.h expand.h translate.h
wutil.o: config.h fallback.h common.h util.h wutil.h
xdgmimealias.o: xdgmimealias.h xdgmime.h xdgmimeint.h
xdgmime.o: xdgmime.h xdgmimeint.h xdgmimeglob.h xdgmimemagic.h xdgmimealias.h
xdgmime.o: xdgmimeparent.h

2968
builtin.c

File diff suppressed because it is too large Load Diff

View File

@@ -20,27 +20,49 @@ enum
/**
Error message on missing argument
*/
#define BUILTIN_ERR_MISSING L": Expected argument"
#define BUILTIN_ERR_MISSING _( L"%ls: Expected argument\n" )
/**
Error message on invalid combination of options
*/
#define BUILTIN_ERR_COMBO L": 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": Variable can only be one of universal, global and local"
#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": Variable can't be both exported and unexported"
#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": Unknown option"
#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" )
/**
Error message when second argument to for isn't 'in'
*/
#define BUILTIN_FOR_ERR_IN _( L"%ls: Second argument must be 'in'\n" )
#define BUILTIN_ERR_TOO_MANY_ARGUMENTS _( L"%ls: Too many arguments\n" )
/**
Stringbuffer used to represent standard output
@@ -117,26 +139,44 @@ const wchar_t *builtin_get_desc( const wchar_t *b );
int builtin_count_args( wchar_t **argv );
/**
Print help for the specified builtin. If \c b is sb_err, also print the line information
Print help for the specified builtin. If \c b is sb_err, also print
the line information
*/
void builtin_print_help( wchar_t *cmd, string_buffer_t *b );
/**
The set builtin, used for setting variables. Defined in builtin_set.c.
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.
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.
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. Defined in builtin_complete.c
*/
int builtin_complete(wchar_t **argv);
/**
The jobs builtin. Used fopr printing running jobs. Defined in builtin_jobs.c.
*/
int builtin_jobs(wchar_t **argv);
const wchar_t *builtin_complete_get_temporary_buffer();
/**
This function works like wperror, but it prints its result into
the sb_err string_buffer_t instead of to stderr. Used by the builtin

View File

@@ -12,7 +12,11 @@ Functions used for implementing the commandline builtin.
#include <signal.h>
#include "config.h"
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "builtin.h"
#include "common.h"
#include "wgetopt.h"
@@ -22,16 +26,18 @@ Functions used for implementing the commandline builtin.
#include "tokenizer.h"
#include "input_common.h"
#include "input.h"
#include "translate.h"
#include "parse_util.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,12 +46,32 @@ 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 */
}
;
/**
Returns the current commandline buffer.
*/
static const wchar_t *get_buffer()
{
const wchar_t *buff = builtin_complete_get_temporary_buffer();
if( !buff )
buff = reader_get_buffer();
return buff;
}
static int get_cursor_pos()
{
const wchar_t *buff = builtin_complete_get_temporary_buffer();
if( buff )
return wcslen( buff );
else
return reader_get_cursor_pos();
}
/**
Replace/append/insert the selection with/at/after the specified string.
@@ -55,21 +81,17 @@ enum
\param insert the string to insert
\param append_mode can be one of REPLACE_MODE, INSERT_MODE or APPEND_MODE, affects the way the test update is performed
*/
static void replace_part( wchar_t *begin,
wchar_t *end,
static void replace_part( const wchar_t *begin,
const wchar_t *end,
wchar_t *insert,
int append_mode )
{
wchar_t *buff = reader_get_buffer();
const wchar_t *buff = get_buffer();
string_buffer_t out;
int out_pos=reader_get_cursor_pos();
int out_pos=get_cursor_pos();
sb_init( &out );
// 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)
@@ -90,7 +112,7 @@ static void replace_part( wchar_t *begin,
}
case INSERT_MODE:
{
int cursor = reader_get_cursor_pos() -(begin-buff);
int cursor = get_cursor_pos() -(begin-buff);
sb_append_substring( &out, begin, cursor );
sb_append( &out, insert );
sb_append_substring( &out, begin+cursor, end-begin-cursor );
@@ -111,8 +133,8 @@ static void replace_part( wchar_t *begin,
\param cut_at_cursor whether printing should stop at the surrent cursor position
\param tokenize whether the string should be tokenized, printing one string token on every line and skipping non-string tokens
*/
static void write_part( wchar_t *begin,
wchar_t *end,
static void write_part( const wchar_t *begin,
const wchar_t *end,
int cut_at_cursor,
int tokenize )
{
@@ -121,7 +143,7 @@ static void write_part( wchar_t *begin,
wchar_t *buff;
int pos;
pos = reader_get_cursor_pos()-(begin-reader_get_buffer());
pos = get_cursor_pos()-(begin-get_buffer());
if( tokenize )
{
@@ -186,7 +208,7 @@ int builtin_commandline( wchar_t **argv )
int tokenize = 0;
if( !reader_get_buffer() )
if( !get_buffer() )
{
sb_append2( sb_err,
argv[0],
@@ -243,6 +265,10 @@ int builtin_commandline( wchar_t **argv )
L"tokenize", no_argument, 0, 'o'
}
,
{
L"help", no_argument, 0, 'h'
}
,
{
0, 0, 0, 0
}
@@ -253,7 +279,7 @@ int builtin_commandline( wchar_t **argv )
int opt = wgetopt_long( argc,
argv,
L"aijpctwfo",
L"aijpctwforh",
long_options,
&opt_index );
if( opt == -1 )
@@ -264,13 +290,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;
@@ -282,7 +305,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;
@@ -307,6 +334,10 @@ int builtin_commandline( wchar_t **argv )
tokenize=1;
break;
case 'h':
builtin_print_help( argv[0], sb_out );
return 0;
case L'?':
builtin_print_help( argv[0], sb_err );
return 1;
@@ -322,10 +353,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);
@@ -335,10 +367,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 );
@@ -394,22 +427,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;
}
@@ -427,32 +461,42 @@ int builtin_commandline( wchar_t **argv )
buffer_part = STRING_MODE;
}
wchar_t *begin, *end;
const wchar_t *begin, *end;
switch( buffer_part )
{
case STRING_MODE:
{
begin = reader_get_buffer();
begin = get_buffer();
end = begin+wcslen(begin);
break;
}
case PROCESS_MODE:
{
reader_current_process_extent( &begin, &end );
parse_util_process_extent( get_buffer(),
get_cursor_pos(),
&begin,
&end );
break;
}
case JOB_MODE:
{
reader_current_job_extent( &begin, &end );
parse_util_job_extent( get_buffer(),
get_cursor_pos(),
&begin,
&end );
break;
}
case TOKEN_MODE:
{
reader_current_token_extent( &begin, &end, 0, 0 );
parse_util_token_extent( get_buffer(),
get_cursor_pos(),
&begin,
&end,
0, 0 );
break;
}

579
builtin_complete.c Normal file
View File

@@ -0,0 +1,579 @@
/** \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 "fallback.h"
#include "util.h"
#include "wutil.h"
#include "builtin.h"
#include "common.h"
#include "complete.h"
#include "wgetopt.h"
#include "parser.h"
#include "reader.h"
#include "translate.h"
const static wchar_t *temporary_buffer;
/*
builtin_complete_* are a set of rather silly looping functions that
make sure that all the proper combinations of complete_add or
complete_remove get called.
*/
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 );
}
}
const wchar_t *builtin_complete_get_temporary_buffer()
{
return temporary_buffer;
}
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"";
wchar_t *do_complete = 0;
array_list_t cmd;
array_list_t path;
static int recursion_level=0;
if( !is_interactive_session )
{
debug( 1, _(L"%ls: Command only available in interactive sessions"), argv[0] );
}
al_init( &cmd );
al_init( &path );
sb_init( &short_opt );
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"do-complete", required_argument, 0, 'C'
}
,
{
L"help", no_argument, 0, 'h'
}
,
{
0, 0, 0, 0
}
}
;
int opt_index = 0;
int opt = wgetopt_long( argc,
argv,
L"a:c:p:s:l:o:d:frxeun:C:h",
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 'C':
do_complete = woptarg?woptarg:reader_get_buffer();
break;
case 'h':
builtin_print_help( argv[0], sb_out );
return 0;
case '?':
sb_append( sb_err,
parser_current_line() );
builtin_print_help( argv[0], sb_err );
res = 1;
break;
}
}
if( !res )
{
if( condition && wcslen( condition ) )
{
if( parser_test( condition, 0 ) )
{
sb_printf( sb_err,
L"%ls: Condition '%ls' contained a syntax error\n",
argv[0],
condition );
parser_test( condition, 1 );
res = 1;
}
}
}
if( !res )
{
if( comp && wcslen( comp ) )
{
if( parser_test_args( comp, 0 ) )
{
sb_printf( sb_err,
L"%ls: Completion '%ls' contained a syntax error\n",
argv[0],
comp );
parser_test_args( comp, 1 );
res = 1;
}
}
}
if( !res )
{
if( do_complete )
{
array_list_t comp;
int i;
const wchar_t *prev_temporary_buffer = temporary_buffer;
temporary_buffer = do_complete;
if( recursion_level < 1 )
{
recursion_level++;
al_init( &comp );
complete( do_complete, &comp );
for( i=0; i<al_get_count( &comp ); i++ )
{
wchar_t *next = (wchar_t *)al_get( &comp, i );
wchar_t *sep = wcschr( next, COMPLETE_SEP );
if( sep )
*sep = L'\t';
sb_printf( sb_out, L"%ls\n", next );
}
al_foreach( &comp, (void (*)(const void *))&free );
al_destroy( &comp );
recursion_level--;
}
temporary_buffer = prev_temporary_buffer;
}
else if( woptind != argc )
{
sb_printf( sb_err,
_( L"%ls: Too many arguments\n" ),
argv[0] );
sb_append( sb_err,
parser_current_line() );
builtin_print_help( argv[0], sb_err );
res = 1;
}
else if( (al_get_count( &cmd) == 0 ) && (al_get_count( &path) == 0 ) )
{
/* No arguments specified, meaning we print the definitions of
* all specified completions to stdout.*/
complete_print( sb_out );
}
else
{
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"

349
builtin_jobs.c Normal file
View File

@@ -0,0 +1,349 @@
/** \file builtin_jobs.c
Functions for executing the jobs builtin.
*/
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
#include <unistd.h>
#include <termios.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <wctype.h>
#include "config.h"
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "builtin.h"
#include "proc.h"
#include "parser.h"
#include "common.h"
#include "wgetopt.h"
#include "translate.h"
/**
Print modes for the jobs builtin
*/
enum
{
JOBS_DEFAULT, /**< Print lots of general info */
JOBS_PRINT_PID, /**< Print pid of each process in job */
JOBS_PRINT_COMMAND, /**< Print command name of each process in job */
JOBS_PRINT_GROUP, /**< Print group id of job */
}
;
#ifdef HAVE__PROC_SELF_STAT
/**
Calculates the cpu usage (in percent) of the specified job.
*/
static int cpu_use( job_t *j )
{
double u=0;
process_t *p;
for( p=j->first_process; p; p=p->next )
{
struct timeval t;
int jiffies;
gettimeofday( &t, 0 );
jiffies = proc_get_jiffies( p );
double t1 = 1000000.0*p->last_time.tv_sec+p->last_time.tv_usec;
double t2 = 1000000.0*t.tv_sec+t.tv_usec;
/* fwprintf( stderr, L"t1 %f t2 %f p1 %d p2 %d\n",
t1, t2, jiffies, p->last_jiffies );
*/
u += ((double)(jiffies-p->last_jiffies))/(t2-t1);
}
return u*1000000;
}
#endif
/**
Print information about the specified job
*/
static void builtin_jobs_print( job_t *j, int mode, int header )
{
process_t *p;
switch( mode )
{
case JOBS_DEFAULT:
{
if( header )
{
/*
Print table header before first job
*/
sb_append( sb_out, _( L"Job\tGroup\t" ));
#ifdef HAVE__PROC_SELF_STAT
sb_append( sb_out, _( L"CPU\t" ) );
#endif
sb_append( sb_out, _( L"State\tCommand\n" ) );
}
sb_printf( sb_out, L"%d\t%d\t", j->job_id, j->pgid );
#ifdef HAVE__PROC_SELF_STAT
sb_printf( sb_out, L"%d%%\t", cpu_use(j) );
#endif
sb_append2( sb_out,
job_is_stopped(j)?_(L"stopped"):_(L"running"),
L"\t",
j->command,
L"\n",
(void *)0 );
break;
}
case JOBS_PRINT_GROUP:
{
if( header )
{
/*
Print table header before first job
*/
sb_append( sb_out, _( L"Group\n" ));
}
sb_printf( sb_out, L"%d\n", j->pgid );
break;
}
case JOBS_PRINT_PID:
{
if( header )
{
/*
Print table header before first job
*/
sb_append( sb_out, _( L"Procces\n" ));
}
for( p=j->first_process; p; p=p->next )
{
sb_printf( sb_out, L"%d\n", p->pid );
}
break;
}
case JOBS_PRINT_COMMAND:
{
if( header )
{
/*
Print table header before first job
*/
sb_append( sb_out, _( L"Command\n" ));
}
for( p=j->first_process; p; p=p->next )
{
sb_printf( sb_out, L"%ls\n", p->argv[0] );
}
break;
}
}
}
int builtin_jobs( wchar_t **argv )
{
int argc=0;
int found=0;
int mode=JOBS_DEFAULT;
int print_last = 0;
job_t *j;
argc = builtin_count_args( argv );
woptind=0;
while( 1 )
{
const static struct woption
long_options[] =
{
{
L"pid", no_argument, 0, 'p'
}
,
{
L"command", no_argument, 0, 'c'
}
,
{
L"group", no_argument, 0, 'g'
}
,
{
L"last", no_argument, 0, 'l'
}
,
{
L"help", no_argument, 0, 'h'
}
,
{
0, 0, 0, 0
}
}
;
int opt_index = 0;
int opt = wgetopt_long( argc,
argv,
L"pclgh",
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 );
return 1;
case 'p':
mode=JOBS_PRINT_PID;
break;
case 'c':
mode=JOBS_PRINT_COMMAND;
break;
case 'g':
mode=JOBS_PRINT_GROUP;
break;
case 'l':
{
print_last = 1;
break;
}
case 'h':
builtin_print_help( argv[0], sb_out );
return 0;
case '?':
builtin_print_help( argv[0], sb_err );
return 1;
}
}
/*
Do not babble if not interactive
*/
if( builtin_out_redirect )
{
found=1;
}
if( print_last )
{
/*
Ignore unconstructed jobs, i.e. ourself.
*/
for( j=first_job; j; j=j->next )
{
if( j->constructed && !job_is_completed(j) )
{
builtin_jobs_print( j, mode, !found );
return 0;
}
}
}
else
{
if( woptind < argc )
{
int i;
found = 1;
for( i=woptind; i<argc; i++ )
{
long pid;
wchar_t *end;
errno=0;
pid=wcstol( argv[i], &end, 10 );
if( errno || *end )
{
sb_printf( sb_err,
_( L"%ls: '%ls' is not a job\n" ),
argv[0],
argv[i] );
return 1;
}
j = job_get_from_pid( pid );
if( j && !job_is_completed( j ) )
{
builtin_jobs_print( j, mode, !found );
}
else
{
sb_printf( sb_err,
_( L"%ls: No suitable job: %d\n" ),
argv[0],
pid );
return 1;
}
}
}
else
{
for( j= first_job; j; j=j->next )
{
/*
Ignore unconstructed jobs, i.e. ourself.
*/
if( j->constructed && !job_is_completed(j) )
{
builtin_jobs_print( j, mode, !found );
found = 1;
}
}
}
}
if( !found )
{
sb_printf( sb_out,
_( L"%ls: There are no jobs\n" ),
argv[0] );
}
return 0;
}

View File

@@ -12,7 +12,11 @@ Functions used for implementing the set builtin.
#include <signal.h>
#include "config.h"
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "builtin.h"
#include "env.h"
#include "expand.h"
@@ -20,49 +24,166 @@ 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...]
/**
Error message for invalid path operations
*/
static int parse_fill_name( string_buffer_t *name,
const wchar_t *src)
#define BUILTIN_SET_PATH_ERROR L"%ls: Could not add component %ls to %ls.\n"
/**
Hint for invalid path operation with a colon
*/
#define BUILTIN_SET_PATH_HINT L"%ls: Did you mean 'set %ls $%ls %ls'?\n"
/**
Error for mismatch between index count and elements
*/
#define BUILTIN_SET_ARG_COUNT L"%ls: The number of variable indexes does not match the number of values\n"
/**
Test if the specified variable should be subject to path validation
*/
static int is_path_variable( const wchar_t *env )
{
if (src == 0)
{
return 0;
}
while (iswalnum(*src) || *src == L'_')
{
sb_append_char(name, *src++);
}
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 );
// builtin_print_help( L"set", sb_err );
return -1;
}
else
{
return 0;
}
return contains_str( env,
L"PATH",
L"CDPATH",
(void *)0 );
}
/**
Call env_set. If this is a path variable, e.g. PATH, validate the
elements. On error, print a description of the problem to stderr.
*/
static int my_env_set( const wchar_t *key, array_list_t *val, int scope )
{
string_buffer_t sb;
int i;
int retcode = 0;
wchar_t *val_str=0;
if( is_path_variable( key ) )
{
int error = 0;
for( i=0; i<al_get_count( val ); i++ )
{
int show_perror = 0;
int show_hint = 0;
struct stat buff;
wchar_t *dir = (wchar_t *)al_get( val, i );
if( wstat( dir, &buff ) )
{
error = 1;
show_perror = 1;
}
if( !( S_IFDIR & buff.st_mode ) )
{
error = 1;
}
if( error )
{
wchar_t *colon;
sb_printf( sb_err,
_(BUILTIN_SET_PATH_ERROR),
L"set",
dir,
key );
colon = wcschr( dir, L':' );
if( colon && *(colon+1) )
{
show_hint = 1;
}
}
if( show_perror )
{
builtin_wperror( L"set" );
}
if( show_hint )
{
sb_printf( sb_err,
_(BUILTIN_SET_PATH_HINT),
L"set",
key,
key,
wcschr( dir, L':' )+1);
}
if( error )
{
break;
}
}
if( error )
{
return 1;
}
}
sb_init( &sb );
if( al_get_count( val ) )
{
for( i=0; i<al_get_count( val ); i++ )
{
sb_append( &sb, (wchar_t *)al_get( val, i ) );
if( i<al_get_count( val )-1 )
{
sb_append( &sb, ARRAY_SEP_STR );
}
}
val_str = (wchar_t *)sb.buff;
}
switch( env_set( key, val_str, scope | ENV_USER ) )
{
case ENV_PERM:
{
sb_printf( sb_err, _(L"%ls: Tried to change the read-only variable '%ls'\n"), L"set", key );
retcode=1;
break;
}
}
sb_destroy( &sb );
return retcode;
}
/**
Extract indexes from a destination argument of the form name[index1 index2...]
*/
static int parse_fill_indexes( array_list_t *indexes,
const wchar_t *src)
{
int count = 0;
\param indexes the list to insert the new indexes into
\param src the source string to parse
\param name the name of the element. Return null if the name in \c src does not match this name
\return the number of indexes parsed, or -1 on error
*/
static int parse_index( array_list_t *indexes,
const wchar_t *src,
const wchar_t *name )
{
int len;
int count = 0;
const wchar_t *src_orig = src;
if (src == 0)
{
return 0;
@@ -73,16 +194,27 @@ static int parse_fill_indexes( array_list_t *indexes,
src++;
}
if (*src == L'\0')
if (*src != L'[')
{
sb_printf( sb_err, _(BUILTIN_SET_ARG_COUNT), L"set" );
return 0;
}
if (*src++ != L'[')
{
return -1;
}
len = src-src_orig;
if( (wcsncmp( src_orig, name, len )!=0) || (wcslen(name) != (len)) )
{
sb_printf( sb_err,
_(L"%ls: Multiple variable names specified in single call (%ls and %.*ls)\n"),
L"set",
name,
len,
src_orig);
return 0;
}
src++;
while (iswspace(*src))
{
src++;
@@ -94,12 +226,10 @@ 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);
return -1;
sb_printf(sb_err, _(L"%ls: Invalid index starting at '%ls'\n"), L"set", src);
return 0;
}
int *ind = (int *) calloc(1, sizeof(int));
*ind = (int) l_ind;
al_push(indexes, ind);
@@ -113,7 +243,13 @@ static int parse_fill_indexes( array_list_t *indexes,
/**
Update a list by writing the specified values at the specified indexes
Update a list \c list by writing copies (using wcsdup) of the
values specified by \c values to the indexes specified by \c
indexes. The previous entries at the specidied position will be
free'd.
\return The number of elements in the list after the modifications
have been made
*/
static int update_values( array_list_t *list,
array_list_t *indexes,
@@ -121,16 +257,12 @@ static int update_values( array_list_t *list,
{
int i;
//fwprintf(stderr, L"Scan complete\n");
/* Replace values where needed */
for( i = 0; i < al_get_count(indexes); i++ )
{
int ind = *(int *) al_get(indexes, i) - 1;
void *new = (void *) al_get(values, i);
if (al_get(list, ind) != 0)
{
free((void *) al_get(list, ind));
}
free((void *) al_get(list, ind));
al_set(list, ind, new != 0 ? wcsdup(new) : wcsdup(L""));
}
@@ -150,7 +282,7 @@ static int al_contains_int( array_list_t *list,
for (i = 0; i < al_get_count(list); i++)
{
int *current = (int *) al_get(list, i);
if (current != 0 && *current == val)
if( current != 0 && *current == val )
{
return 1;
}
@@ -163,13 +295,11 @@ static int al_contains_int( array_list_t *list,
/**
Erase from a list values at specified indexes
*/
static int erase_values(array_list_t *list, array_list_t *indexes)
static void erase_values(array_list_t *list, array_list_t *indexes)
{
int i;
array_list_t result;
//fwprintf(stderr, L"Starting with %d\n", al_get_count(list));
al_init(&result);
for (i = 0; i < al_get_count(list); i++)
@@ -187,33 +317,6 @@ static int erase_values(array_list_t *list, array_list_t *indexes)
al_truncate(list,0);
al_push_all( list, &result );
al_destroy(&result);
//fwprintf(stderr, L"Remaining: %d\n", al_get_count(&result));
return al_get_count(list);
}
/**
Fill a string buffer with values from a list, using ARRAY_SEP_STR to separate them
*/
static int fill_buffer_from_list(string_buffer_t *sb, array_list_t *list)
{
int i;
for (i = 0; i < al_get_count(list); i++)
{
wchar_t *v = (wchar_t *) al_get(list, i);
if (v != 0)
{
// fwprintf(stderr, L".\n");
// fwprintf(stderr, L"Collecting %ls from %d\n", v, i);
sb_append(sb, v);
}
if (i < al_get_count(list) - 1)
sb_append(sb, ARRAY_SEP_STR);
}
return al_get_count(list);
}
@@ -253,46 +356,64 @@ static void print_variables(int include_values, int esc, int scope)
al_destroy(&names);
}
/**
The set builtin. Creates, updates and erases environment variables and environemnt variable arrays.
*/
/**
The set builtin. Creates, updates and erases environment variables
and environemnt variable arrays.
*/
int builtin_set( wchar_t **argv )
{
/**
Variables used for parsing the argument list
*/
const static struct woption
long_options[] =
{
{
L"export", no_argument, 0, 'x'
},
}
,
{
L"global", no_argument, 0, 'g'
},
}
,
{
L"local", no_argument, 0, 'l'
},
}
,
{
L"erase", no_argument, 0, 'e'
},
}
,
{
L"names", no_argument, 0, 'n'
} ,
}
,
{
L"unexport", no_argument, 0, 'u'
} ,
}
,
{
L"universal", no_argument, 0, 'U'
} ,
}
,
{
L"query", no_argument, 0, 'q'
} ,
}
,
{
L"help", no_argument, 0, 'h'
}
,
{
0, 0, 0, 0
}
}
;
wchar_t short_options[] = L"xglenuUq";
const wchar_t *short_options = L"+xglenuUqh";
int argc = builtin_count_args(argv);
@@ -308,14 +429,12 @@ int builtin_set( wchar_t **argv )
Variables used for performing the actual work
*/
wchar_t *dest = 0;
array_list_t values;
string_buffer_t name_sb;
int retcode=0;
wchar_t *name;
array_list_t indexes;
int retval;
int scope;
int slice=0;
int i;
/* Parse options to obtain the requested operation and the modifiers */
woptind = 0;
while (1)
@@ -331,286 +450,316 @@ int builtin_set( wchar_t **argv )
{
case 0:
break;
case 'e':
erase = 1;
break;
case 'n':
list = 1;
break;
case 'x':
export = 1;
break;
case 'l':
local = 1;
break;
case 'g':
global = 1;
break;
case 'u':
unexport = 1;
break;
case 'U':
universal = 1;
break;
case 'q':
query = 1;
break;
case 'h':
builtin_print_help( argv[0], sb_out );
return 0;
case '?':
builtin_print_help( argv[0], sb_err );
return 1;
default:
break;
}
}
/*
Ok, all arguments have been parsed, let's validate them
*/
/*
If we are checking the existance of a variable (-q) we can not
also specify scope
*/
if( query && (erase || list || global || local || universal || export || unexport ) )
{
sb_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;
}
/* Check operation and modifiers sanity */
/* We can't both list and erase varaibles */
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;
}
/*
Variables can only have one scope
*/
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;
}
/*
Variables can only have one export status
*/
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;
}
/*
Calculate the scope value for variable assignement
*/
scope = (local ? ENV_LOCAL : 0) | (global ? ENV_GLOBAL : 0) | (export ? ENV_EXPORT : 0) | (unexport ? ENV_UNEXPORT : 0) | (universal ? ENV_UNIVERSAL:0) | ENV_USER;
if( query )
{
/*
Query mode. Return number of specified variables that do not exist.
Query mode. Return the number variables that do not exist
out of the specified variables.
*/
int i;
for( i=woptind; i<argc; i++ )
{
if( !env_exist( argv[i] ) )
{
retcode++;
}
}
return retcode;
}
/* Parse destination */
if( woptind < argc )
if( woptind == argc )
{
dest = wcsdup(argv[woptind++]);
//fwprintf(stderr, L"Dest: %ls\n", dest);
}
/*
Print values of variables
*/
/* Parse values */
// wchar_t **values = woptind < argc ? (wchar_t **) calloc(argc - woptind, sizeof(wchar_t *)) : 0;
al_init(&values);
while( woptind < argc )
{
al_push(&values, argv[woptind++]);
// fwprintf(stderr, L"Val: %ls\n", argv[woptind - 1]);
}
/* Extract variable name and indexes */
sb_init(&name_sb);
retval = parse_fill_name(&name_sb, dest);
if( retval < 0 )
retcode=1;
if( !retcode )
{
name = (wchar_t *) name_sb.buff;
//fwprintf(stderr, L"Name is %ls\n", name);
al_init(&indexes);
retval = parse_fill_indexes(&indexes, dest);
if (retval < 0)
if( erase )
{
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;
}
if( !retcode )
{
int i;
int finished=0;
/* Do the actual work */
int scope = (local ? ENV_LOCAL : 0) | (global ? ENV_GLOBAL : 0) | (export ? ENV_EXPORT : 0) | (unexport ? ENV_UNEXPORT : 0) | (universal ? ENV_UNIVERSAL:0) | ENV_USER;
if( list )
}
else
{
/* Maybe we should issue an error if there are any other arguments */
print_variables(0, 0, scope);
finished=1;
}
if( (!finished ) &&
(name == 0 || wcslen(name) == 0))
{
/* 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 );
builtin_print_help( argv[0], sb_err );
retcode = 1;
}
else
{
print_variables( 1, 1, scope );
}
finished=1;
}
if( !finished )
{
if( al_get_count( &values ) == 0 &&
al_get_count( &indexes ) == 0 &&
!erase &&
!list )
{
/*
Only update the variable scope
*/
env_set( name, 0, scope );
finished = 1;
}
print_variables( 1, 1, scope );
}
if( !finished )
{
/* 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 );
builtin_print_help( argv[0], sb_err );
retcode = 1;
}
else
{
/* All ok, we can alter the specified variable */
array_list_t val_l;
al_init(&val_l);
return retcode;
}
void *old=0;
if (al_get_count(&indexes) == 0)
{
/* We will act upon the entire variable */
if( list )
{
/* Maybe we should issue an error if there are any other arguments? */
print_variables(0, 0, scope);
return 0;
}
al_push( &val_l, wcsdup(L"") );
old = val_l.arr;
/* Build indexes for all variable or all new values */
int end_index = erase ? al_get_count(&val_l) : al_get_count(&values);
for (i = 0; i < end_index; i++)
{
int *ind = (int *) calloc(1, sizeof(int));
*ind = i + 1;
al_push(&indexes, ind);
}
}
else
{
/* We will act upon some specific indexes */
expand_variable_array( env_get(name), &val_l );
}
string_buffer_t result_sb;
sb_init(&result_sb);
if (erase)
{
int rem = erase_values(&val_l, &indexes);
if (rem == 0)
{
env_remove(name, ENV_USER);
}
else
{
fill_buffer_from_list(&result_sb, &val_l);
env_set(name, (wchar_t *) result_sb.buff, scope);
}
}
else
{
update_values( &val_l,
&indexes,
&values );
if( !(dest = wcsdup(argv[woptind])))
{
die_mem();
}
fill_buffer_from_list( &result_sb,
&val_l );
if( wcschr( dest, L'[' ) )
{
slice = 1;
*wcschr( dest, L'[' )=0;
}
if( !wcslen( dest ) )
{
free( dest );
sb_printf( sb_err, BUILTIN_ERR_VARNAME_ZERO, argv[0] );
return 1;
}
env_set(name,
(wchar_t *) result_sb.buff,
scope);
}
al_foreach( &val_l, (void (*)(const void *))&free );
al_destroy(&val_l);
sb_destroy(&result_sb);
/*
set assignment can work in two modes, either using slices or
using the whole array. We detect which mode is used here.
*/
if( slice )
{
/*
Slice mode
*/
int idx_count, val_count;
array_list_t values;
array_list_t indexes;
al_init(&values);
al_init(&indexes);
for( ; woptind<argc; woptind++ )
{
if( !parse_index( &indexes, argv[woptind], dest ) )
{
retcode = 1;
break;
}
val_count = argc-woptind-1;
idx_count = al_get_count( &indexes );
if( !erase )
{
if( val_count < idx_count )
{
sb_printf( sb_err, _(BUILTIN_SET_ARG_COUNT), argv[0] );
retcode=1;
break;
}
if( val_count == idx_count )
{
woptind++;
break;
}
}
}
if( !retcode )
{
/*
Slice indexes have been calculated, do the actual work
*/
array_list_t result;
al_init(&result);
tokenize_variable_array( env_get(dest), &result );
if( erase )
{
erase_values(&result, &indexes);
my_env_set( dest, &result, scope);
}
else
{
array_list_t value;
al_init(&value);
while( woptind < argc )
{
al_push(&value, argv[woptind++]);
}
update_values( &result,
&indexes,
&value );
my_env_set(dest,
&result,
scope);
al_destroy( &value );
}
al_foreach( &result, (void (*)(const void *))&free );
al_destroy( &result );
}
al_foreach( &indexes, (void (*)(const void *))&free );
al_destroy(&indexes);
al_destroy(&values);
}
else
{
woptind++;
/*
No slicing
*/
if( erase )
{
if( woptind != argc )
{
sb_printf( sb_err,
_(L"%ls: Values cannot be specfied with erase\n%ls\n"),
argv[0],
parser_current_line() );
retcode=1;
}
else
{
env_remove( dest, ENV_USER );
}
}
else
{
array_list_t val;
al_init( &val );
for( i=woptind; i<argc; i++ )
{
al_push( &val, argv[i] );
}
retcode = my_env_set( dest, &val, scope );
al_destroy( &val );
}
}
/* Common cleanup */
//fwprintf(stderr, L"Cleanup\n");
free(dest);
sb_destroy(&name_sb);
al_destroy( &values );
free( dest );
return retcode;
}

View File

@@ -3,6 +3,8 @@
Functions used for implementing the ulimit builtin.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
@@ -12,11 +14,13 @@ Functions used for implementing the ulimit builtin.
#include <unistd.h>
#include <errno.h>
#include "config.h"
#include "fallback.h"
#include "util.h"
#include "builtin.h"
#include "common.h"
#include "wgetopt.h"
#include "translate.h"
/**
Struct describing a resource limit
@@ -59,13 +63,13 @@ const static struct resource_t resource_arr[] =
RLIMIT_FSIZE, L"Maximum size of files created by the shell", L'f', 1024
}
,
#if HAVE_RLIMIT_MEMLOCK
#ifdef RLIMIT_MEMLOCK
{
RLIMIT_MEMLOCK, L"Maximum size that may be locked into memory", L'l', 1024
}
,
#endif
#if HAVE_RLIMIT_RSS
#ifdef RLIMIT_RSS
{
RLIMIT_RSS, L"Maximum resident set size", L'm', 1024
}
@@ -83,13 +87,13 @@ const static struct resource_t resource_arr[] =
RLIMIT_CPU, L"Maximum amount of cpu time in seconds", L't', 1
}
,
#if HAVE_RLIMIT_NPROC
#ifdef RLIMIT_NPROC
{
RLIMIT_NPROC, L"Maximum number of processes available to a single user", L'u', 1
}
,
#endif
#if HAVE_RLIMIT_AS
#ifdef RLIMIT_AS
{
RLIMIT_AS, L"Maximum amount of virtual memory available to the shell", L'v', 1024
}
@@ -322,6 +326,10 @@ int builtin_ulimit( wchar_t ** argv )
L"virtual-memory-size", no_argument, 0, 'v'
}
,
{
L"help", no_argument, 0, 'h'
}
,
{
0, 0, 0, 0
}
@@ -333,7 +341,7 @@ int builtin_ulimit( wchar_t ** argv )
int opt = wgetopt_long( argc,
argv,
L"aHScdflmnptuv",
L"aHScdflmnptuvh",
long_options,
&opt_index );
if( opt == -1 )
@@ -344,13 +352,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;
@@ -378,13 +383,13 @@ int builtin_ulimit( wchar_t ** argv )
case L'f':
what=RLIMIT_FSIZE;
break;
#if HAVE_RLIMIT_MEMLOCK
#ifdef RLIMIT_MEMLOCK
case L'l':
what=RLIMIT_MEMLOCK;
break;
#endif
#if HAVE_RLIMIT_RSS
#ifdef RLIMIT_RSS
case L'm':
what=RLIMIT_RSS;
break;
@@ -402,18 +407,22 @@ int builtin_ulimit( wchar_t ** argv )
what=RLIMIT_CPU;
break;
#if HAVE_RLIMIT_NPROC
#ifdef RLIMIT_NPROC
case L'u':
what=RLIMIT_NPROC;
break;
#endif
#if HAVE_RLIMIT_AS
#ifdef RLIMIT_AS
case L'v':
what=RLIMIT_AS;
break;
#endif
case L'h':
builtin_print_help( argv[0], sb_out );
return 0;
case L'?':
builtin_print_help( argv[0], sb_err );
return 1;

752
common.c

File diff suppressed because it is too large Load Diff

196
common.h
View File

@@ -8,39 +8,37 @@
*/
#define FISH_COMMON_H
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
#include <termios.h>
#include "util.h"
/**
Under curses, tputs expects an int (*func)(char) as its last
parameter, but in ncurses, tputs expects a int (*func)(int) as its
last parameter. tputs_arg_t is defined to always be what tputs
expects. Hopefully.
*/
#ifdef NCURSES_VERSION
typedef int tputs_arg_t;
#else
typedef char tputs_arg_t;
#endif
/**
Maximum number of bytes used by a single utf-8 character
*/
#define MAX_UTF8_BYTES 6
/**
Color code for set_color. Does not update the color.
This is in the unicode private use area.
*/
#define FISH_COLOR_IGNORE -1
#define ENCODE_DIRECT_BASE 0xf100
/**
Color code for set_color. Sets the default color.
Highest legal ascii value
*/
#define FISH_COLOR_RESET -2
#define ASCII_MAX 127u
/**
Highest legal 16-bit unicode value
*/
#define UCS2_MAX 0xffffu
/**
Highest legal byte value
*/
#define BYTE_MAX 0xffu
/**
Save the shell mode on startup so we can restore them on exit
@@ -76,7 +74,10 @@ extern wchar_t *program_name;
/**
Take an array_list_t containing wide strings and converts them to a
single null-terminated wchar_t **.
single null-terminated wchar_t **. The array is allocated using
halloc, and uses the \c context parameter as context. If \c context
is not noll, all elements of the \c array_list_t are also
registered to \c context using \c halloc_register().
*/
wchar_t **list_to_char_arr( array_list_t *l );
@@ -104,6 +105,7 @@ void sort_list( array_list_t *comp );
specified multibyte character string
*/
wchar_t *str2wcs( const char *in );
wchar_t *str2wcs_internal( const char *in, wchar_t *out );
/**
Returns a newly allocated multibyte character string equivalent of
@@ -111,6 +113,8 @@ wchar_t *str2wcs( const char *in );
*/
char *wcs2str( const wchar_t *in );
char *wcs2str_internal( const wchar_t *in, char *out );
/**
Returns a newly allocated wide character string array equivalent of
the specified multibyte character string array
@@ -134,99 +138,18 @@ wchar_t *wcsdupcat( const wchar_t *a, const wchar_t *b );
*/
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 );
/**
Convert a wide character string to a number in the specified
base. This functions is the wide character string equivalent of
strtol. For bases of 10 or lower, 0..9 are used to represent
numbers. For bases below 36, a-z and A-Z are used to represent
numbers higher than 9. Higher bases than 36 are not supported.
*/
long wcstol(const wchar_t *nptr,
wchar_t **endptr,
int base);
/**
Appends src to string dst of size siz (unlike wcsncat, siz is the
full size of dst, not space left). At most siz-1 characters will be
copied. Always NUL terminates (unless siz <= wcslen(dst)). Returns
wcslen(src) + MIN(siz, wcslen(initial dst)). If retval >= siz,
truncation occurred.
This is the OpenBSD strlcat function, modified for wide characters,
and renamed to reflect this change.
*/
size_t wcslcat( wchar_t *dst, const wchar_t *src, size_t siz );
/**
Copy src to string dst of size siz. At most siz-1 characters will
be copied. Always NUL terminates (unless siz == 0). Returns
wcslen(src); if retval >= siz, truncation occurred.
This is the OpenBSD strlcpy function, modified for wide characters,
and renamed to reflect this change.
*/
size_t wcslcpy( wchar_t *dst, const wchar_t *src, size_t siz );
/**
Create a dublicate string. Wide string version of strdup. Will
automatically exit if out of memory.
*/
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. Using wcscasecmp on
a user-supplied string should be considered a bug.
*/
int wcscasecmp( const wchar_t *a, const wchar_t *b );
/**
Case insensitive string compare function. Wide string version of
strncasecmp.
This implementation of wcsncasecmp does not take into account
esoteric locales where uppercase and lowercase do not cleanly
transform between each other. Hopefully this should be fine since
fish only uses this function with one of the strings supplied by
fish and guaranteed to be a sane, english word. Using wcsncasecmp on
a user-supplied string should be considered a bug.
*/
int wcsncasecmp( const wchar_t *a, const wchar_t *b, int count );
/**
Test if the given string is a valid variable name
*/
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.
Test if the given string is a valid variable name.
\return null if this is a valid name, and a pointer to the first invalid character otherwise
*/
int wcwidth( wchar_t c );
wchar_t *wcsvarname( wchar_t *str );
/**
@@ -236,12 +159,12 @@ int my_wcswidth( const wchar_t *c );
/**
This functions returns the end of the quoted substring beginning at
\c in. It can handle both single and double quotes. Returns 0 on
error.
\c in. The type of quoting character is detemrined by examining \c
in. Returns 0 on error.
\param in the position of the opening quote
*/
wchar_t *quote_end( const wchar_t *in );
const wchar_t *quote_end( const wchar_t *in );
/**
A call to this function will reset the error counter. Some
@@ -254,14 +177,19 @@ 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
Checks if \c needle is included in the list of strings specified. A warning is printed if needle is zero.
\param needle the string to search for in the list
\return zero is needle is not found, of if needle is null, non-zero otherwise
*/
int contains_str( const wchar_t *needle, ... );
@@ -271,20 +199,18 @@ int contains_str( const wchar_t *needle, ... );
*/
int read_blocked(int fd, void *buf, size_t count);
/**
This is for writing process notification messages. Has to write to
stdout, so clr_eol and such functions will work correctly. Not an
issue since this function is only used in interactive mode anyway.
*/
int writeb( tputs_arg_t b );
/**
Exit program at once, leaving an error message about running out of memory
*/
void die_mem();
/**
Clean up
Create global_context using halloc
*/
void common_init();
/**
Free global_context using halloc_free
*/
void common_destroy();
@@ -302,7 +228,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
@@ -313,8 +239,7 @@ void debug( int level, wchar_t *msg, ... );
\return The escaped string, or 0 if there is not enough memory
*/
wchar_t *escape( const wchar_t *in,
int escape_all );
wchar_t *escape( const wchar_t *in, int escape_all );
/**
Expand backslashed escapes and substitute them with their unescaped
@@ -330,16 +255,6 @@ wchar_t *escape( const wchar_t *in,
wchar_t *unescape( const wchar_t * in,
int escape_special );
/**
Block SIGCHLD. Calls to block/unblock may be nested, and only once the nest count reaches zero wiull the block be removed.
*/
void block();
/**
undo call to block().
*/
void unblock();
/**
Attempt to acquire a lock based on a lockfile, waiting LOCKPOLLINTERVAL
milliseconds between polls and timing out after timeout seconds,
@@ -375,5 +290,22 @@ int common_get_height();
*/
void common_handle_winch( int signal );
/**
Write paragraph of output to the specified stringbuffer, and redo
the linebreaks to fit the current screen.
*/
void write_screen( const wchar_t *msg, string_buffer_t *buff );
/**
Tokenize the specified string into the specified array_list_t.
Each new element is allocated using malloc and must be freed by the
caller.
\param val the input string. The contents of this string is not changed.
\param out the list in which to place the elements.
*/
void tokenize_variable_array( const wchar_t *val, array_list_t *out );
#endif

1153
complete.c

File diff suppressed because it is too large Load Diff

View File

@@ -33,6 +33,8 @@
/** Separateor between completion and description*/
#define COMPLETE_SEP_STR L"\004"
#define COMPLETE_ITEM_SEP L'\uf500'
/**
Character that separates the completion and description on programmable completions
*/
@@ -162,6 +164,6 @@ int complete_is_valid_argument( const wchar_t *str,
\param cmd the command for which to load command-specific completions
\param reload should the commands completions be reloaded, even if they where previously loaded. (This is set to true on actual completions, so that changed completion are updated in running shells)
*/
void complete_load( wchar_t *cmd, int reload );
void complete_load( const wchar_t *cmd, int reload );
#endif

665
config.guess vendored

File diff suppressed because it is too large Load Diff

219
config.sub vendored
View File

@@ -1,9 +1,10 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
# Inc.
timestamp='2003-06-18'
timestamp='2006-02-27'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@@ -21,14 +22,15 @@ timestamp='2003-06-18'
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
# 02110-1301, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted ChangeLog entry.
#
@@ -70,7 +72,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
@@ -83,11 +85,11 @@ Try \`$me --help' for more information."
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
echo "$timestamp" ; exit 0 ;;
echo "$timestamp" ; exit ;;
--version | -v )
echo "$version" ; exit 0 ;;
echo "$version" ; exit ;;
--help | --h* | -h )
echo "$usage"; exit 0 ;;
echo "$usage"; exit ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
@@ -99,7 +101,7 @@ while test $# -gt 0 ; do
*local*)
# First pass through any local machine types.
echo $1
exit 0;;
exit ;;
* )
break ;;
@@ -118,7 +120,9 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
@@ -144,7 +148,7 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple | -axis)
-apple | -axis | -knuth | -cray)
os=
basic_machine=$1
;;
@@ -169,6 +173,10 @@ case $os in
-hiux*)
os=-hiuxwe2
;;
-sco6)
os=-sco5v6
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco5)
os=-sco3.2v5
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@@ -185,6 +193,10 @@ case $os in
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco5v6*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco*)
os=-sco3.2v2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@@ -228,14 +240,16 @@ case $basic_machine in
| a29k \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
| bfin \
| c4x | clipper \
| d10v | d30v | dlx | dsp16xx \
| fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
| ip2k \
| m32r | m68000 | m68k | m88k | mcore \
| ip2k | iq2000 \
| m32r | m32rle | m68000 | m68k | m88k | maxq | mb | microblaze | mcore \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
@@ -244,31 +258,38 @@ case $basic_machine in
| mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
| mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| mt \
| msp430 \
| nios | nios2 \
| ns16k | ns32k \
| openrisc | or32 \
| or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
| s390 | s390x \
| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
| strongarm \
| tahoe | thumb | tic4x | tic80 | tron \
| v850 | v850e \
| we32k \
| x86 | xscale | xstormy16 | xtensa \
| x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
| z8k)
basic_machine=$basic_machine-unknown
;;
m32c)
basic_machine=$basic_machine-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12)
# Motorola 68HC11/12.
basic_machine=$basic_machine-unknown
@@ -276,6 +297,9 @@ case $basic_machine in
;;
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
;;
ms1)
basic_machine=mt-unknown
;;
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
@@ -296,19 +320,19 @@ case $basic_machine in
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* \
| bs2000-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
| clipper-* | cydra-* \
| clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* \
| m32r-* \
| ip2k-* | iq2000-* \
| m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | mcore-* \
| m88110-* | m88k-* | maxq-* | mcore-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
@@ -317,34 +341,41 @@ case $basic_machine in
| mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \
| mips64vr5900-* | mips64vr5900el-* \
| mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa64-* | mipsisa64el-* \
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
| msp430-* \
| none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
| nios-* | nios2-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \
| romp-* | rs6000-* \
| s390-* | s390x-* \
| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tron-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
| xtensa-* \
| x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
| xstormy16-* | xtensa-* \
| ymp-* \
| z8k-*)
;;
m32c-*)
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
386bsd)
@@ -361,6 +392,9 @@ case $basic_machine in
basic_machine=a29k-amd
os=-udi
;;
abacus)
basic_machine=abacus-unknown
;;
adobe68k)
basic_machine=m68010-adobe
os=-scout
@@ -378,6 +412,9 @@ case $basic_machine in
amd64)
basic_machine=x86_64-pc
;;
amd64-*)
basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
amdahl)
basic_machine=580-amdahl
os=-sysv
@@ -437,12 +474,27 @@ case $basic_machine in
basic_machine=j90-cray
os=-unicos
;;
craynv)
basic_machine=craynv-cray
os=-unicosmp
;;
cr16c)
basic_machine=cr16c-unknown
os=-elf
;;
crds | unos)
basic_machine=m68k-crds
;;
crisv32 | crisv32-* | etraxfs*)
basic_machine=crisv32-axis
;;
cris | cris-* | etrax*)
basic_machine=cris-axis
;;
crx)
basic_machine=crx-unknown
os=-elf
;;
da30 | da30-*)
basic_machine=m68k-da30
;;
@@ -465,6 +517,10 @@ case $basic_machine in
basic_machine=m88k-motorola
os=-sysv3
;;
djgpp)
basic_machine=i586-pc
os=-msdosdjgpp
;;
dpx20 | dpx20-*)
basic_machine=rs6000-bull
os=-bosx
@@ -643,10 +699,6 @@ case $basic_machine in
mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;;
mmix*)
basic_machine=mmix-knuth
os=-mmixware
;;
monitor)
basic_machine=m68k-rom68k
os=-coff
@@ -659,6 +711,9 @@ case $basic_machine in
basic_machine=i386-pc
os=-msdos
;;
ms1-*)
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
mvs)
basic_machine=i370-ibm
os=-mvs
@@ -727,10 +782,6 @@ case $basic_machine in
np1)
basic_machine=np1-gould
;;
nv1)
basic_machine=nv1-cray
os=-unicosmp
;;
nsr-tandem)
basic_machine=nsr-tandem
;;
@@ -738,9 +789,12 @@ case $basic_machine in
basic_machine=hppa1.1-oki
os=-proelf
;;
or32 | or32-*)
openrisc | openrisc-*)
basic_machine=or32-unknown
os=-coff
;;
os400)
basic_machine=powerpc-ibm
os=-os400
;;
OSE68000 | ose68000)
basic_machine=m68000-ericsson
@@ -767,6 +821,12 @@ case $basic_machine in
pc532 | pc532-*)
basic_machine=ns32k-pc532
;;
pc98)
basic_machine=i386-pc
;;
pc98-*)
basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentium | p5 | k5 | k6 | nexgen | viac3)
basic_machine=i586-pc
;;
@@ -823,6 +883,10 @@ case $basic_machine in
basic_machine=i586-unknown
os=-pw32
;;
rdos)
basic_machine=i386-pc
os=-rdos
;;
rom68k)
basic_machine=m68k-rom68k
os=-coff
@@ -833,6 +897,12 @@ case $basic_machine in
rtpc | rtpc-*)
basic_machine=romp-ibm
;;
s390 | s390-*)
basic_machine=s390-ibm
;;
s390x | s390x-*)
basic_machine=s390x-ibm
;;
sa29200)
basic_machine=a29k-amd
os=-udi
@@ -956,6 +1026,10 @@ case $basic_machine in
tower | tower-32)
basic_machine=m68k-ncr
;;
tpf)
basic_machine=s390x-ibm
os=-tpf
;;
udi29k)
basic_machine=a29k-amd
os=-udi
@@ -999,6 +1073,10 @@ case $basic_machine in
basic_machine=hppa1.1-winbond
os=-proelf
;;
xbox)
basic_machine=i686-pc
os=-mingw32
;;
xps | xps100)
basic_machine=xps100-honeywell
;;
@@ -1029,6 +1107,9 @@ case $basic_machine in
romp)
basic_machine=romp-ibm
;;
mmix)
basic_machine=mmix-knuth
;;
rs6000)
basic_machine=rs6000-ibm
;;
@@ -1045,13 +1126,10 @@ case $basic_machine in
we32k)
basic_machine=we32k-att
;;
sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown
;;
sh64)
basic_machine=sh64-unknown
;;
sparc | sparcv9 | sparcv9b)
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
basic_machine=sparc-sun
;;
cydra)
@@ -1124,19 +1202,23 @@ case $os in
| -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
| -openbsd* | -solidbsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei*)
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@@ -1154,12 +1236,15 @@ case $os in
os=`echo $os | sed -e 's|nto|nto-qnx|'`
;;
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
| -windows* | -osx | -abug | -netware* | -os9* | -beos* \
| -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
;;
-mac*)
os=`echo $os | sed -e 's|mac|macos|'`
;;
-linux-dietlibc)
os=-linux-dietlibc
;;
-linux*)
os=`echo $os | sed -e 's|linux|linux-gnu|'`
;;
@@ -1172,6 +1257,9 @@ case $os in
-opened*)
os=-openedition
;;
-os400*)
os=-os400
;;
-wince*)
os=-wince
;;
@@ -1193,6 +1281,9 @@ case $os in
-atheos*)
os=-atheos
;;
-syllable*)
os=-syllable
;;
-386bsd)
os=-bsd
;;
@@ -1215,6 +1306,9 @@ case $os in
-sinix*)
os=-sysv4
;;
-tpf*)
os=-tpf
;;
-triton*)
os=-sysv3
;;
@@ -1251,6 +1345,9 @@ case $os in
-kaos*)
os=-kaos
;;
-zvmoe)
os=-zvmoe
;;
-none)
;;
*)
@@ -1282,9 +1379,9 @@ case $basic_machine in
arm*-semi)
os=-aout
;;
c4x-* | tic4x-*)
os=-coff
;;
c4x-* | tic4x-*)
os=-coff
;;
# This must come before the *-dec entry.
pdp10-*)
os=-tops20
@@ -1328,9 +1425,15 @@ case $basic_machine in
*-be)
os=-beos
;;
*-haiku)
os=-haiku
;;
*-ibm)
os=-aix
;;
*-knuth)
os=-mmixware
;;
*-wec)
os=-proelf
;;
@@ -1463,9 +1566,15 @@ case $basic_machine in
-mvs* | -opened*)
vendor=ibm
;;
-os400*)
vendor=ibm
;;
-ptx*)
vendor=sequent
;;
-tpf*)
vendor=ibm
;;
-vxsim* | -vxworks* | -windiss*)
vendor=wrs
;;
@@ -1490,7 +1599,7 @@ case $basic_machine in
esac
echo $basic_machine$os
exit 0
exit
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)

View File

@@ -1,24 +1,101 @@
# Process this file with autoconf to produce a configure script.
AC_INIT(fish,1.17.0,axel@liljencrantz.se)
AC_INIT(fish,1.21.8,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 autoconf to regenerate the configure file
AC_MSG_CHECKING([if autoconf needs to be run])
if test configure -ot configure.ac; then
AC_MSG_RESULT([yes])
if which autoconf >/dev/null; then
# No need to provide any error messages if autoconf fails, the
# shell and autconf should take care of that themselves
AC_MSG_NOTICE([running autoconf])
if autoconf; then
./configure "$@"
fi
exit
else
AC_MSG_ERROR( [cannot find the autoconf program in your path.
This program needs to be run whenever the configure.ac file is modified.
Please install it and try again.])
fi
else
AC_MSG_RESULT([no])
fi
AC_DEFINE_UNQUOTED([CPU],[L"$target_cpu"],[CPU type])
# If needed, run autoheader to regenerate config.h.in
AC_MSG_CHECKING([if autoheader needs to be run])
if test ! -f ./config.h.in -o config.h.in -ot configure.ac; then
AC_MSG_RESULT([yes])
if which autoheader >/dev/null; then
AC_MSG_NOTICE([running autoheader])
autoheader
else
AC_MSG_ERROR( [cannot find the autoheader program in your path.
This program needs to be run whenever the configure.ac file is modified.
Please install it and try again.])
fi
else
AC_MSG_RESULT([no])
fi
# Detect directories which may contain additional headers, libraries
# and commands. This needs to be done early - before Autoconf starts
# to mess with CFLAGS and all the other environemnt variables.
for i in /usr/pkg /sw /opt /opt/local; do
AC_MSG_CHECKING([for $i/include include directory])
if test -d $i/include; then
AC_MSG_RESULT(yes)
CPPFLAGS="$CPPFLAGS -I$i/include/"
CFLAGS="$CFLAGS -I$i/include/"
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING([for $i/lib library directory])
if test -d $i/lib; then
AC_MSG_RESULT(yes)
LDFLAGS="$LDFLAGS -L$i/lib/ -R$i/lib/"
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING([for $i/bin command directory])
if test -d $i/bin; then
AC_MSG_RESULT(yes)
optbindirs="$optbindirs $i/bin"
else
AC_MSG_RESULT(no)
fi
done
AC_SUBST( optbindirs, $optbindirs )
# Tell autoconf to create config.h header
AC_CONFIG_HEADERS(config.h)
# 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
# Optionally drop xsel
# Check for doxygen, which is needed to build
AC_CHECK_PROG( has_doxygen, [doxygen], "true")
if ! test "$has_doxygen" = "true"; then
AC_MSG_ERROR( [cannot find the Doxygen program in your path.
This program is needed to build fish.
Please install it and try again.])
fi
# Check for seq command. If missing, make sure fallback shellscript
# implementation is installed
AC_CHECK_PROG( SEQ_FALLBACK, seq, [ ], [seq])
# Optionally drop xsel command
AC_ARG_WITH( xsel,
AC_HELP_STRING([--without-xsel],
[do not build the xsel program needed for X clipboard integration]),
@@ -35,6 +112,114 @@ else
AC_SUBST( XSEL_MAN_PATH,[ ])
fi
#
# Test if the compiler accepts the -std=c99 flag. If so, using it
# increases the odds of correct compilation, since we want to use the
# *wprintf functions, which where defined in C99.
#
XCFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -std=c99"
AC_MSG_CHECKING(if -std=c99 works)
AC_CACHE_VAL(local_cv_has__std_c99,[
AC_TRY_RUN([
#include <stdlib.h>
#include <stdio.h>
int main() {
return 0;
}],
local_cv_has__std_c99=yes,
local_cv_has__std_c99=no,
)])
AC_MSG_RESULT($local_cv_has__std_c99)
case x$local_cv_has__std_c99 in
xno) CFLAGS="$XCFLAGS" ;;
esac
#
# If we are using gcc, set some flags that increase the odds of the
# compiler producing a working binary...
#
if test "$CC" = gcc; then
#
# -fno-optimize-sibling-calls seems to work around a bug where
# sending a SIGWINCH to fish on NetBSD causes fish to exit when
# compiled with GCC 3.3.3. This is probably either a compiler bug
# or a libc bug, but adding this flag seems to fix things for
# now. Long term, the real problem should be tracked down and
# truly fixed, at which point we can remove this silly flag. This
# bug has been verified to not exist on Linux using GCC 3.3.3.
#
CFLAGS="$CFLAGS -fno-optimize-sibling-calls"
#
# -Wall is there to keep me on my toes
#
CFLAGS="$CFLAGS -Wall"
fi
#
# If we are compiling against glibc, set some flags to work around
# some rather stupid attempts to hide prototypes for *wprintf
# functions, as well as prototypes of various gnu extensions.
#
AC_MSG_CHECKING([if we are compiling against glibc])
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([
#include <stdlib.h>
#ifdef __GLIBC__
#define STATUS 0
#else
#define STATUS 1
#endif],
[return STATUS;])],
[glibc=yes],
[glibc=no] )
if test "$glibc" = yes; then
AC_MSG_RESULT(yes)
#
# This gives us access to prototypes for gnu extensions and C99
# functions if we are compiling agains glibc. All GNU extensions
# that are used must have a fallback implementation available in
# fallback.h, in order to keep fish working on non-gnu platforms.
#
CFLAGS="$CFLAGS -D _GNU_SOURCE -D _ISOC99_SOURCE"
else
AC_MSG_RESULT(no)
fi
# Test cpu for special handling of ppc
#
# This is used to skip use of tputs on ppc systems, since it seemed to
# be broken, at least on older debin-based systems. This is obviously
# not the right way to to detect whether this workaround should be
# used, since it catches far to many systems, but I do not have the
# hardware available to narrow this problem down, and in practice, it
# seems that tputs is never really needed.
#
AC_CANONICAL_TARGET
if test $target_cpu = powerpc; then
AC_DEFINE([TPUTS_KLUDGE],[1],[Evil kludge to get Power based machines to work])
fi
# Set up PREFIX and related preprocessor symbols. Fish needs to know
# where it will be installed. One of the reasons for this is so that
# it can make sure the fish installation directory is in the path
# during startup.
if [[ "$prefix" = NONE ]]; then
AC_DEFINE_UNQUOTED( [PREFIX], L"/usr/local", [Installation directory])
AC_SUBST( PREFIX, /usr/local)
@@ -43,11 +228,14 @@ else
AC_DEFINE_UNQUOTED( [PREFIX], L"$prefix", [Installation directory])
AC_SUBST( PREFIX, [$prefix])
fi
AC_DEFINE_UNQUOTED( SYSCONFDIR, [L"$(eval echo $sysconfdir)"], [System configuration directory] )
AC_DEFINE_UNQUOTED( DATADIR, [L"$(eval echo $datadir)"], [System configuration directory] )
AC_SUBST( SYSCONFDIR, ["$(eval echo $sysconfdir)"] )
AC_SUBST( DATADIR, ["$(eval echo $datadir)"] )
AC_SUBST(fishdir,[/fish.d])
AC_SUBST(fishfile,[/fish])
AC_SUBST(fishinputfile,[/fish_inputrc])
# Set up the directory where the documentation files should be
# installed
AC_ARG_VAR( [docdir], [Documentation direcotry] )
if test -z $docdir; then
@@ -55,77 +243,122 @@ if test -z $docdir; then
fi
AC_DEFINE_UNQUOTED( DOCDIR, [L"$(eval echo $docdir)"], [Documentation directory] )
AC_DEFINE_UNQUOTED( SYSCONFDIR, [L"$(eval echo $sysconfdir)"], [System configuration directory] )
# See if Linux procfs is present
# Set up locale directory. This is where the .po files will be
# installed.
AC_DEFINE_UNQUOTED( [LOCALEDIR], "$(eval echo $datadir)/locale", [Locale directory])
AC_SUBST( [LOCALEDIR], [$datadir/locale])
# See if Linux procfs is present. This is used to get extra
# information about running processes.
AC_CHECK_FILES([/proc/self/stat])
# See if NetBSD pkgsrc is installed
AC_CHECK_FILE([/usr/pkg/lib],[AC_SUBST(LIBDIR,[-L/usr/pkg/lib\ -R/usr/pkg/lib])])
AC_CHECK_FILE([/usr/pkg/include],[AC_SUBST(INCLUDEDIR,[-I/usr/pkg/include])])
# This is ued to tell the wgetopt library to translate strings. This
# way wgetopt can be dropped into any project without requiring i18n.
AC_CHECK_FUNCS( [wprintf futimes wcwidth wcswidth getopt_long] )
AC_CHECK_HEADERS([getopt.h termio.h sys/resource.h])
AC_DEFINE([HAVE_TRANSLATE_H], [1],
[Define to 1 if the wgettext function should be used for translating strings.])
# 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>],
[int tmp; tmp=RLIMIT_AS;], have_rlimit_as=yes, have_rlimit_as=no)
if test "$have_rlimit_as" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_RLIMIT_AS], [1],
[Define to 1 if HAVE_RLIMIT_AS is defined in <sys/resource.h>.])
# Check for presense of various libraries
AC_SEARCH_LIBS( gettext, intl, AC_SUBST( HAVE_GETTEXT, [1] ), AC_SUBST( HAVE_GETTEXT, [0] ) )
AC_SEARCH_LIBS( connect, socket, , [AC_MSG_ERROR([Cannot find the socket library, needed to build this package.] )] )
AC_SEARCH_LIBS( nanosleep, rt, , [AC_MSG_ERROR([Cannot find the rt library, needed to build this package.] )] )
AC_SEARCH_LIBS( setupterm, [ncurses curses], , [AC_MSG_ERROR([Could not find a curses implementation, needed to build fish])] )
# Check for presense of various header files
AC_CHECK_HEADERS([getopt.h termio.h sys/resource.h term.h ncurses/term.h libintl.h ncurses.h curses.h])
AC_CHECK_HEADER([regex.h],
[AC_DEFINE([HAVE_REGEX_H], [1], [Define to 1 if you have the <regex.h> header file.])],
[AC_MSG_ERROR([Could not find the header regex.h, needed to build fish])])
# Check for presense of various functions
AC_CHECK_FUNCS( wcsdup wcsndup wcslen wcscasecmp wcsncasecmp gettext fwprintf )
AC_CHECK_FUNCS( futimes wcwidth wcswidth getopt_long wcstok fputwc fgetwc )
AC_CHECK_FUNCS( wcstol dcgettext wcslcat wcslcpy )
# Here follows a list of small programs used to test for various
# features that Autoconf doesn't tell us about
# Check if realpath accepts null for its second argument
AC_MSG_CHECKING([if realpath accepts null for its second argument])
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([
#include <limits.h>
#include <errno.h>
#include <stdlib.h>],
[int status; char *res; res = realpath( "somefile", 0 ); status = !(res != 0 || errno == ENOENT); exit( status );])],
[have_realpath_null=yes],
[have_realpath_null=no] )
if test "$have_realpath_null" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_REALPATH_NULL], [1],
[Define to 1 if realpath accepts null for its second argument.])
else
AC_MSG_RESULT(no)
fi
# If we have a fwprintf in libc, test that it actually works. As of
# March 2006, it is broken under Dragonfly BSD.
if test "$ac_cv_func_fwprintf" = yes; then
AC_MSG_CHECKING([if fwprintf is broken])
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([
#include <stdlib.h>
#include <stdio.h>
#include <locale.h>
#include <wchar.h>
],
[
setlocale( LC_ALL, "" );
fwprintf( stderr, L"%ls%ls", L"", L"fish:" );
])],
[
AC_MSG_RESULT(no)
],
[
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_BROKEN_FWPRINTF], [1], [Define to 1 one if the implemented fwprintf is broken])
] )
fi
# Check for _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; exit(tmp);], have__nl_msg_cat_cntr=yes, have__nl_msg_cat_cntr=no)
if test "$have__nl_msg_cat_cntr" = yes; then
AC_MSG_RESULT(yes)
AC_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 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 if we are using basic BSD curses - in that case we redefine
# del_curterm as a no-op, to avoid a double-free
# 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
AC_MSG_CHECKING([If we are using BSD curses])
case $target_os in
*bsd*)
AC_MSG_RESULT(yes)
AC_CHECK_LIB( ncurses, del_curterm, true, [AC_DEFINE([HAVE_BROKEN_DEL_CURTERM],[1],[We are using basic BSD curses, redefine del_curterm to a no-op to avoid a double-free bug])])
;;
*)
AC_MSG_RESULT(no)
;;
esac
# 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
AC_CHECK_LIB(socket, connect)
AC_CHECK_LIB(rt, nanosleep)
# Check if we have ncurses, and use it rather than curses if possible.
AC_CHECK_HEADERS([ncurses.h],[AC_SUBST(CURSESLIB,[ncurses]) AC_DEFINE(HAVE_NCURSES_H)],[AC_SUBST(CURSESLIB,[curses])])
#Force use of ncurses if it is avialable via NetBSD pkgsrc. This is an
#ugly kludge to force NetBSD to use ncurses, since NetBSDs own version
#does not properly support terminfo.
AC_CHECK_FILE([/usr/pkg/include/ncurses.h],[AC_SUBST(CURSESLIB,[ncurses]) AC_DEFINE(HAVE_NCURSES_H)])
AC_CONFIG_FILES([Makefile fish.spec doc_src/fish.1 doc_src/Doxyfile init/fish])
# Tell the world what we know
AC_CONFIG_FILES([Makefile fish.spec doc_src/fish.1 doc_src/Doxyfile etc/fish etc/fish_interactive.fish share/fish seq])
AC_OUTPUT
echo "fish is now configured."
echo "Use 'make' and 'make install' to built and install fish."

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

@@ -11,6 +11,22 @@ wildcarded values. The \c case statement is used together with the \c
switch statement in order to determine which block should be
performed.
Each \c case command is given one or more parameter. The first \c case
command with a parameter that matches the string specified in the
switch command will be evaluated. \c case parameters may contain
wildcards. These need to be escaped or quoted in order to avoid
regular wildcard expansion using filenames.
Note that fish does not fall through on case statements. Though the
syntax may look a bit like C switch statements, it behaves more like
the case stamantes of traditional shells.
Also note that command substitutions in a case statement will be
evaluated even if it's body is not taken. This may seem
counterintuitive at first, but it is unavoidable, since it would be
impossible to know if a case command will evaluate to true before all
forms of parameter expansion have been performed for the case command.
\subsection case-example Example
If the variable \$animal contains the name of an animal, the following
@@ -23,13 +39,15 @@ 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
case '*'
echo I have no idea what a $animal is
end
</pre>
</p>
<p>
If the above code was run with \$animal set to \c whale, the output would be \c mammal.
If the above code was run with \c \$animal set to \c whale, the output would be \c mammal.
</p>

View File

@@ -3,10 +3,9 @@
\subsection cd-synopsis Synopsis
<tt>cd [DIRECTORY]</tt>
\subsection cd-description Description
Changes the current directory. If <tt>DIRECTORY</tt> is supplied it
will become the new directory. If \c DIRECTORY is a relative path, the
CDPATH environment variable will be separated using the : as
separator, and the resulting list will be searched for a suitable new
current directory. If CDPATH is not set, it is assumed to be '.'. If
\c DIRECTORY is not specified, \$HOME will be the new directory.
\subsection cd-description Description Changes the current
directory. If <tt>DIRECTORY</tt> is supplied it will become the new
directory. If \c DIRECTORY is a relative path, the paths found in the
CDPATH environment variable array will be tried as prefixes for the
specified path. If CDPATH is not set, it is assumed to be '.'. If \c
DIRECTORY is not specified, \$HOME will be the new directory.

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
@@ -43,6 +43,10 @@ Other switches
that they will be returned to the reader before any additional
actual keypresses are read.
If commandline is called during a call to complete a given string
using <code>complete -C STRING</code>, commandline will consider the
specified string to be the current contents of the commandline.
\subsection commandline-example Example
<tt>commandline -j $history[3]</tt>

View File

@@ -1,18 +1,24 @@
\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
- <tt>OPTION_ARGUMENTS</tt> is parameter containing a space-separated list of possible option-arguments, which may contain subshells
- <tt>DESCRIPTION</tt> is a description of what the option and/or option arguments do
- <tt>-C STRING</tt> or <tt>--do-complete=STRING</tt> makes complete try to find all possible completions for the specified string
- <tt>-e</tt> or <tt>--erase</tt> implies that the specified completion should be deleted
- <tt>-f</tt> or <tt>--no-files</tt> specifies that the option specified by this completion may not be followed by a filename
- <tt>-n</tt> or <tt>--condition</tt> 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 +31,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 can be more than one character long, are preceded by a single hyphen and may not be grouped together. Option arguments are specified in the following parameter ('-ao null').
- GNU style long options, like '--colors'. GNU style long options can be more than one character long, are preceded by two hyphens, and may not be grouped together. Option arguments may be specified in the following parameter ('--quoting-style shell') or by appending the option with a '=' and the value ('--quoting-style=shell'). GNU style long options may be abbreviated so long as the abbreviation is unique ('--h' is equivalent to '--help' if help is the only long option beginning with an 'h').
\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 +68,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.

24
doc_src/contains.txt Normal file
View File

@@ -0,0 +1,24 @@
\section contains contains - Test if a word is present in a list
\subsection contains-synopsis Synopsis
<code>contains [OPTIONS] KEY [VALUES...]</code>
\subsection contains-description Description
- \c -h or \c --help display this message
Test if the set VALUES contains the string KEY. Return status is 0 if
yes, 1 otherwise
\subsection contains-example Example
<pre>
for i in ~/bin /usr/local/bin
if not contains \$i \$PATH
set PATH \$PATH i
end
end
</pre>
The above code tests if ~/bin and /usr/local/bin are in the path and if they are not, they are added.

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

File diff suppressed because it is too large Load Diff

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

9
doc_src/fish_pager.txt Normal file
View File

@@ -0,0 +1,9 @@
\section fish_pager fish_pager - Internal command used by fish
\subsection fish_pager-description Description
This command is used internally by fish to display a list of
completions. It should not be used by other commands, as it's
interface is liable to change in the future.

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

@@ -1,9 +1,10 @@
\section nextd nextd
\subsection nextd-synopsis Synopsis
<tt>nextd [-l] [pos]</tt>
<tt>nextd [-l | --list] [pos]</tt>
\subsection nextd-description Description
<tt>nextd</tt> moves forwards <tt>pos</tt> positions in the history of visited directories;
if the end of the history has been hit, a warning is printed. If the <tt>-l></tt> flag is
specified, the current history is also displayed.
\subsection nextd-description Description <tt>nextd</tt> moves
forwards <tt>pos</tt> positions in the history of visited directories;
if the end of the history has been hit, a warning is printed. If the
<code>-l></code> or <code>--list</code> flag is specified, the current
history is also displayed.

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,9 +1,10 @@
\section prevd prevd
\subsection prevd-synopsis Synopsis
<tt>prevd [-l] [pos]</tt>
<tt>prevd [-l | --list] [pos]</tt>
\subsection prevd-description Description
<tt>prevd</tt> moves backwards <tt>pos</tt> positions in the history of visited directories;
if the beginning of the history has been hit, a warning is printed. If the <tt>-l</tt> flag
is specified, the current history is also displayed.
\subsection prevd-description Description <tt>prevd</tt> moves
backwards <tt>pos</tt> positions in the history of visited
directories; if the beginning of the history has been hit, a warning
is printed. If the <code>-l</code> or <code>--list</code> flag is
specified, the current history is also displayed.

View File

@@ -8,10 +8,13 @@
The <tt>read</tt> builtin causes fish to read one line from standard
input and store the result in one or more environment variables.
- <tt>-c CMD</tt> or <tt>--command=CMD</tt> specifies that the initial string in the interactive mode command buffer should be CMD.
- <tt>-e</tt> or <tt>--export</tt> specifies that the variables will be exported to subshells.
- <tt>-g</tt> or <tt>--global</tt> specifies that the variables will be made global.
- <tt>-pPROMPT_CMD</tt> or <tt>--prompt=PROMPT_CMD</tt> specifies that the output of the shell command PROMPT_CMD should be used as the prompt for the interactive mode prompt. The default prompt command is <tt>set_color green; echo read; set_color normal; echo "> "</tt>.
- <tt>-cCMD</tt> or <tt>--command=CMD</tt> specifies that the initial string in the interactive mode command buffer should be CMD.
- <tt>-p PROMPT_CMD</tt> or <tt>--prompt=PROMPT_CMD</tt> specifies that the output of the shell command PROMPT_CMD should be used as the prompt for the interactive mode prompt. The default prompt command is <tt>set_color green; echo read; set_color normal; echo "> "</tt>.
- <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
Read starts by reading a single line of input from stdin, the line is
then tokenized using the <tt>IFS</tt> environment variable. Each variable

View File

@@ -1,41 +1,53 @@
\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>.
or
<code>set [OPTIONS] [VARIABLE_NAME[INDICES]... [VALUES...]]</code>
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. When array indices are specified to set, multiple arguments
may be used to specify additional indexes, e.g. <code>set PATH[1]
PATH[4] /bin /sbin</code>.
The set command requires all switch arguments to come before any
non-switch arguments. For example, <code>set flags -l</code> will have
the effect of setting the value of the variable <code>flags</code> to
'-l', not making the variable local.
\subsection set-example Example
<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

@@ -20,3 +20,8 @@ purple, cyan, white and normal.
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

@@ -8,11 +8,23 @@
The \c switch statement is used to perform one of several blocks of
commands depending on whether a specified value equals one of several
wildcarded values.
wildcarded values. The \c case statement is used together with the \c
switch statement in order to determine which block should be
performed.
Each \c case command is given one or more parameter. The first \c case
command with a parameter that matches the string specified in the
switch command will be evaluated. \c case parameters may contain
wildcards. These need to be escaped or quoted in order to avoid
regular wildcard expansion using filenames.
Note that fish does not fall through on case statements. Though the
syntax may look a bit like C switch statements, it behaves more like
the case stamantes of traditional shells.
\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,16 +34,18 @@ 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
case '*'
echo I have no idea what a $animal is
end
</pre>
</p>
<p>
If the above code was run with \$animal set to \c whale, the output
would be \c mammal.
If the above code was run with \c \$animal set to \c whale, the output
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,7 +10,7 @@ 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.
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
@@ -19,7 +19,7 @@ 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
specifiec other users rights and \c a specifies all three should be
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
@@ -27,7 +27,7 @@ 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 compination of \c r, \c w and \c x, representing
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

432
env.c
View File

@@ -25,10 +25,18 @@
#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 "fallback.h"
#include "util.h"
#include "wutil.h"
#include "proc.h"
#include "common.h"
@@ -41,6 +49,8 @@
#include "env_universal.h"
#include "input_common.h"
#include "event.h"
#include "translate.h"
#include "complete.h"
/**
Command used to start fishd
@@ -94,7 +104,7 @@ typedef struct env_node
typedef struct var_entry
{
int export; /**< Whether the variable should be exported */
wchar_t val[0]; /**< The value of the variable */
wchar_t val[1]; /**< The value of the variable */
}
var_entry_t;
@@ -141,19 +151,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.
@@ -171,6 +168,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
@@ -182,7 +209,7 @@ static void start_fishd()
{
string_buffer_t cmd;
struct passwd *pw;
sb_init( &cmd );
pw = getpwuid(getuid());
@@ -190,7 +217,7 @@ static void start_fishd()
if( !pw )
{
debug( 0, L"Could not get user information" );
debug( 0, _( L"Could not get user information" ) );
return;
}
@@ -213,6 +240,90 @@ static mode_t get_umask()
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.
@@ -223,6 +334,9 @@ static void universal_callback( int type,
{
wchar_t *str=0;
if( is_locale( name ) )
handle_locale();
switch( type )
{
case SET:
@@ -236,7 +350,6 @@ static void universal_callback( int type,
if( str )
{
array_list_t arg;
event_t ev;
has_changed=1;
@@ -245,31 +358,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 );
path=0;
}
al_init( &l );
if( path )
tokenize_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 );
tokenize_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, *path;
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"" );
@@ -302,6 +492,11 @@ void env_init()
hash_init( &top->env, &hash_wcs_func, &hash_wcs_cmp );
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
@@ -339,77 +534,14 @@ void env_init()
free(key);
}
path = env_get( L"PATH" );
if( !path )
{
env_set( L"PATH", L"/bin" ARRAY_SEP_STR L"/usr/bin", ENV_EXPORT | ENV_GLOBAL );
path = env_get( L"PATH" );
}
else
{
int i, j;
array_list_t l;
al_init( &l );
expand_variable_array( path, &l );
/*
Set up the PATH variable
*/
setup_path();
debug( 3, L"PATH is %ls", path );
const wchar_t *path_el[] =
{
L"/bin",
L"/usr/bin",
PREFIX L"/bin",
0
}
;
for( j=0; path_el[j]; j++ )
{
int has_el=0;
debug( 3, L"Check directory %ls", path_el[j] );
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 );
sb_append2( &b, path,
ARRAY_SEP_STR,
path_el[j],
(void *)0 );
env_set( L"PATH", (wchar_t *)b.buff, ENV_GLOBAL | ENV_EXPORT );
sb_destroy( &b );
path = env_get( L"PATH" );
}
}
debug( 3, L"After: PATH is %ls", path );
al_foreach( &l, (void (*)(const void *))&free );
al_destroy( &l );
}
/*
Set up the USER variable
*/
pw = getpwuid( getuid() );
if( pw )
{
@@ -418,7 +550,7 @@ void env_init()
free( uname );
}
env_universal_init( env_get( L"FISHD_SOKET_DIR"),
env_universal_init( env_get( L"FISHD_SOCKET_DIR"),
env_get( L"USER" ),
&start_fishd,
&universal_callback );
@@ -475,10 +607,10 @@ static env_node_t *env_get_node( const wchar_t *key )
return 0;
}
void env_set( const wchar_t *key,
const wchar_t *val,
int var_mode )
int env_set( const wchar_t *key,
const wchar_t *val,
int var_mode )
{
int free_val = 0;
var_entry_t *entry;
@@ -489,20 +621,14 @@ 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;
return ENV_PERM;
}
if( wcscmp(key, L"LANG" )==0 )
{
fish_setlocale(LC_ALL,val);
}
if( wcscmp( key, L"umask" ) == 0)
{
wchar_t *end;
@@ -524,14 +650,13 @@ void env_set( const wchar_t *key,
/*
Do not actually create a umask variable, on env_get, it will be calculated dynamically
*/
return;
return 0;
}
/*
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;
}
@@ -618,12 +743,13 @@ 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 )
node = node->next;
}
}
}
@@ -669,33 +795,48 @@ 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, L"SET" );
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();
}
return 0;
}
/**
Attempt to remove/free the specified key/value pair from the
specified hash table.
\return zero if the variable was not found, non-zero otherwise
*/
static int try_remove( env_node_t *n,
const wchar_t *key )
{
const void *old_key_void, *old_val_void;
wchar_t *old_key, *old_val;
if( n == 0 )
return 0;
hash_remove( &n->env,
key,
(const void **)&old_key,
(const void **)&old_val );
&old_key_void,
&old_val_void );
old_key = (wchar_t *)old_key_void;
old_val = (wchar_t *)old_val_void;
if( old_key != 0 )
{
var_entry_t * v = (var_entry_t *)old_val;
@@ -724,10 +865,29 @@ void env_remove( const wchar_t *key, int var_mode )
return;
}
if( !try_remove( top, key ) )
if( try_remove( top, key ) )
{
event_t ev;
ev.type=EVENT_VARIABLE;
ev.param1.variable=key;
ev.function_name=0;
al_init( &ev.arguments );
al_push( &ev.arguments, L"VARIABLE" );
al_push( &ev.arguments, L"ERASE" );
al_push( &ev.arguments, key );
event_fire( &ev );
al_destroy( &ev.arguments );
}
else
{
env_universal_remove( key );
}
if( is_locale( key ) )
handle_locale();
}
@@ -756,7 +916,10 @@ 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 );
/*
This is not an error - it simply means the user has
a short history
*/
break;
}
@@ -900,8 +1063,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 );
@@ -911,12 +1086,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();
}
}
@@ -933,7 +1111,9 @@ 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 );
}
}
/**

13
env.h
View File

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

View File

@@ -1,5 +1,6 @@
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
@@ -11,15 +12,24 @@
#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 "fallback.h"
#include "util.h"
#include "common.h"
#include "wutil.h"
#include "env_universal_common.h"
@@ -112,7 +122,7 @@ 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 )
{
@@ -207,7 +217,7 @@ void env_universal_init( wchar_t * p,
void (*sf)(),
void (*cb)( int type, const wchar_t *name, const wchar_t *val ))
{
debug( 2, L"env_universal_init()" );
debug( 3, L"env_universal_init()" );
path=p;
user=u;
start_fishd=sf;
@@ -226,7 +236,7 @@ void env_universal_init( wchar_t * p,
{
env_universal_barrier();
}
debug( 2, L"end env_universal_init()" );
debug( 3, L"end env_universal_init()" );
}
void env_universal_destroy()

View File

@@ -5,6 +5,9 @@
client library and by the daemon.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
@@ -25,7 +28,9 @@
#include <signal.h>
#include <sys/stat.h>
#include "fallback.h"
#include "util.h"
#include "common.h"
#include "wutil.h"
#include "env_universal_common.h"
@@ -103,7 +108,7 @@ static int get_names_show_unexported;
void env_universal_common_init( void (*cb)(int type, const wchar_t *key, const wchar_t *val ) )
{
debug( 2, L"Init env_universal_common" );
debug( 3, L"Init env_universal_common" );
callback = cb;
hash_init( &env_universal_var, &hash_wcs_func, &hash_wcs_cmp );
}
@@ -186,7 +191,7 @@ void read_message( connection_t *src )
}
else
{
sb_printf( &src->input, L"%lc", res );
sb_append_char( &src->input, res );
}
}
}
@@ -227,7 +232,7 @@ static int match( const wchar_t *msg, const wchar_t *cmd )
static void parse_message( wchar_t *msg,
connection_t *src )
{
debug( 2, L"parse_message( %ls );", msg );
debug( 3, L"parse_message( %ls );", msg );
if( msg[0] == L'#' )
return;

71
etc/fish.in Normal file
View File

@@ -0,0 +1,71 @@
#
# Init file for fish
#
# @configure_input@
#
# Set default search paths for completions and shellscript functions
#
set -g fish_function_path ~/.fish.d/functions @SYSCONFDIR@/fish.d/functions @DATADIR@/fish/functions
set -g fish_complete_path ~/.fish.d/completions @SYSCONFDIR@/fish.d/completions @DATADIR@/fish/completions
#
# Set default field separators
#
set -g IFS \ \t\n
#
# Some things should only be done for login terminals
#
if status --is-login
#
# Set some value for LANG if nothing was set before, and this is a
# login shell.
#
if not set -q LANG >/dev/null
set -gx LANG en_US.UTF-8
end
# Check for i18n information in
# /etc/sysconfig/i18n
if test -f /etc/sysconfig/i18n
eval (cat /etc/sysconfig/i18n |sed -ne 's/^\([a-zA-Z]*\)=\(.*\)$/set -gx \1 \2;/p')
end
#
# Put linux consoles in unicode mode.
#
if expr "$LANG" : ".*\.[Uu][Tt][Ff].*" >/dev/null
if test "$TERM" = linux
if which unicode_start >/dev/null
unicode_start
end
end
end
end
#
# There are variables that contain colons that are not arrays. This
# reverts them back to regular strings.
#
for i in DISPLAY
if set -q $i
set -- $i (printf ":%s" $$i|cut -c 2-)
end
end
#
# Load additional initialization files
#
for i in fish.d/*.fish
. $i
end

View File

@@ -19,7 +19,7 @@ $if fish
"\M-d": if test -z (commandline); dirh; else; commandline -f kill-word; end
"\C-d": delete-or-exit
# This will make sure the output of the current command is paged using the less pager when you press Meta-p
"\M-p": if commandline -j|grep -v "less *$" >/dev/null; commandline -aj "|less;"; end
"\M-p": if commandline -j|grep -v 'less *$' >/dev/null; commandline -aj "|less;"; end
$endif
# Include user-specific inputrc file after including fish-specific

View File

@@ -0,0 +1,109 @@
#
# Initializations that should only be performed when in interactive mode
#
# @configure_input@
if not status --is-interactive
exit
end
#
# Print a greeting
#
printf (_ 'Welcome to fish, the friendly interactive shell\n')
printf (_ 'Type %shelp%s for instructions on how to use fish\n') (set_color green) (set_color normal)
#
# Set exit message
#
function fish_on_exit -d (_ "Commands to execute when fish exits") --on-process %self
printf (_ "Good bye\n")
end
#
# Set INPUTRC to something nice
#
# We override INPUTRC if already set, since it may be set by a shell
# other than fish, which may use a different file. The new value should
# be exported, since the fish inputrc file plays nice with other files
# by including them when found.
# Give priority to the default file installed with fish in
# @SYSCONFDIR@/fish_inputrc.
#
for i in ~/.fish_inputrc @SYSCONFDIR@/fish_inputrc ~/.inputrc /etc/inputrc
if test -f $i
set -xg INPUTRC $i
break
end
end
#
# Set various defaults using these throwaway functions
#
function set_default -d "Set an universal variable, unless it has already been set"
if not set -q $argv[1]
set -U -- $argv
end
if not set -q $argv[1]
set -g -- $argv
end
end
function set_exported_default -d "Set an exported universal variable, unless it has already been set"
if not set -q $argv[1]
set -Ux -- $argv
end
if not set -q $argv[1]
set -gx -- $argv
end
end
# Regular syntax highlighting colors
set_default fish_color_normal normal
set_default fish_color_command green
set_default fish_color_redirection normal
set_default fish_color_comment red
set_default fish_color_error red --bold
set_default fish_color_escape cyan
set_default fish_color_operator cyan
set_default fish_color_quote brown
set_default fish_color_cwd green
# Background color for matching quotes and parenthesis
set_default fish_color_match cyan
# Background color for search matches
set_default fish_color_search_match purple
# Pager colors
set_default fish_pager_color_prefix cyan
set_default fish_pager_color_completion normal
set_default fish_pager_color_description normal
set_default fish_pager_color_progress cyan
#
# Directory history colors
#
set_default fish_color_history_current cyan
#
# Setup the CDPATH variable
#
set_default CDPATH . ~
#
# Remove temporary functions for setting default variable values
#
functions -e set_exported_default
functions -e set_default

241
event.c
View File

@@ -12,13 +12,19 @@
#include <string.h>
#include "config.h"
#include "fallback.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"
#include "halloc_util.h"
/**
Number of signals that can be queued before an overflow occurs
@@ -51,7 +57,7 @@ typedef struct
active, which is the one that new events is written to. The inactive
one contains the events that are currently beeing performed.
*/
static signal_list_t sig_list[2];
static signal_list_t sig_list[]={{0,0},{0,0}};
/**
The index of sig_list that is the list of signals currently written to
@@ -67,10 +73,20 @@ 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;
/**
String buffer used for formating event descriptions in event_get_desc()
*/
static string_buffer_t *get_desc_buff=0;
/**
Tests if one event instance matches the definition of a event
class. If the class defines a function name, that will also be a
match criterion.
class. If both the class and the instance name a function,
they must name the same function.
*/
static int event_match( event_t *class, event_t *instance )
@@ -120,7 +136,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 )
@@ -133,15 +149,114 @@ 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;
}
const wchar_t *event_get_desc( event_t *e )
{
if( !get_desc_buff )
{
get_desc_buff=sb_halloc( global_context );
}
else
{
sb_clear( get_desc_buff );
}
switch( e->type )
{
case EVENT_SIGNAL:
sb_printf( get_desc_buff, _(L"signal handler for %ls (%ls)"), sig2wcs(e->param1.signal ), signal_get_desc( e->param1.signal ) );
break;
case EVENT_VARIABLE:
sb_printf( get_desc_buff, _(L"handler for variable '%ls'"), e->param1.variable );
break;
case EVENT_EXIT:
if( e->param1.pid > 0 )
{
sb_printf( get_desc_buff, _(L"exit handler for process %d"), e->param1.pid );
}
else
{
job_t *j = job_get_from_pid( -e->param1.pid );
if( j )
sb_printf( get_desc_buff, _(L"exit handler for job %d, '%ls'"), j->job_id, j->command );
else
sb_printf( get_desc_buff, _(L"exit handler for job with process group %d"), -e->param1.pid );
}
break;
case EVENT_JOB_ID:
{
job_t *j = job_get( e->param1.job_id );
if( j )
sb_printf( get_desc_buff, _(L"exit handler for job %d, '%ls'"), j->job_id, j->command );
else
sb_printf( get_desc_buff, _(L"exit handler for job with job id %d"), j->job_id );
break;
}
}
return (const wchar_t *)get_desc_buff->buff;
}
void event_add_handler( event_t *event )
{
event_t *e = event_copy( event );
event_t *e;
e = event_copy( event, 0 );
if( !events )
events = al_new();
events = al_new();
if( e->type == EVENT_SIGNAL )
{
@@ -158,9 +273,12 @@ void event_remove( event_t *criterion )
event_t e;
/*
Because of concurrency issues, env_remove does not actually free
any events - instead it simply moves all events that should be
removed from the event list to the killme list.
Because of concurrency issues (env_remove could remove an event
that is currently being executed), env_remove does not actually
free any events - instead it simply moves all events that should
be removed from the event list to the killme list, and the ones
that shouldn't be killed to new_list, and then drops the empty
events-list.
*/
if( !events )
@@ -268,7 +386,7 @@ 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;
@@ -334,9 +452,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), 1 );
sb_append( b, L" " );
sb_append( b, arg_esc );
free( arg_esc );
@@ -344,13 +462,16 @@ static void event_fire_internal( event_t *event, array_list_t *arguments )
// debug( 1, L"Event handler fires command '%ls'", (wchar_t *)b->buff );
is_subshell=1;
is_interactive=1;
/*
Event handlers are not part of the main flow of code, so
they are marked as non-interactive and as a subshell
*/
proc_push_interactive(0);
parser_push_block( EVENT );
current_block->param1.event = event;
eval( (wchar_t *)b->buff, 0, TOP );
is_subshell=0;
is_interactive=1;
parser_pop_block();
proc_pop_interactive();
}
if( b )
@@ -375,15 +496,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
@@ -402,7 +548,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." ) );
}
/*
@@ -411,19 +557,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) )
@@ -438,27 +592,39 @@ 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--;
}
void event_init()
{
sig_list[active_list].count=0;
}
void event_destroy()
{
if( events )
{
al_foreach( events, (void (*)(const void *))&event_free );
@@ -466,6 +632,7 @@ void event_destroy()
free( events );
events=0;
}
if( killme )
{
al_foreach( killme, (void (*)(const void *))&event_free );
@@ -477,9 +644,15 @@ 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 );
}

34
event.h
View File

@@ -17,6 +17,9 @@
*/
#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
@@ -112,4 +130,10 @@ void event_destroy();
*/
void event_free( event_t *e );
/**
Returns a string describing the specified event. The string should
not be freed.
*/
const wchar_t *event_get_desc( event_t *e );
#endif

460
exec.c
View File

@@ -22,7 +22,10 @@
#include <dirent.h>
#include "config.h"
#include "fallback.h"
#include "util.h"
#include "common.h"
#include "wutil.h"
#include "proc.h"
@@ -36,6 +39,10 @@
#include "expand.h"
#include "signal.h"
#include "env_universal.h"
#include "translate.h"
#include "halloc.h"
#include "halloc_util.h"
#include "parse_util.h"
/**
Prototype for the getpgid library function. The prototype for this
@@ -48,15 +55,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" )
/**
@@ -66,6 +73,8 @@ pid_t getpgid( pid_t pid );
*/
static array_list_t *open_fds=0;
static int set_child_group( job_t *j, process_t *p, int print_errors );
void exec_close( int fd )
{
@@ -117,7 +126,7 @@ int exec_pipe( int fd[2])
if( open_fds == 0 )
{
open_fds = al_new();
open_fds = al_halloc( global_context );
}
al_push( open_fds, (void *)(long)fd[0] );
@@ -155,7 +164,8 @@ static int use_fd_in_pipe( int fd, io_data_t *io )
the redirection list io. This should make sure that there are no
stray opened file descriptors in the child.
\param io the list of io redirections for this job. Pipes mentioned here should not be closed.
\param io the list of io redirections for this job. Pipes mentioned
here should not be closed.
*/
static void close_unused_internal_pipes( io_data_t *io )
{
@@ -176,20 +186,6 @@ static void close_unused_internal_pipes( io_data_t *io )
}
}
void exec_init()
{
}
void exec_destroy()
{
if( open_fds )
{
al_destroy( open_fds );
free( open_fds );
}
}
/**
Make sure the fd used by this redirection is not used by i.e. a pipe.
*/
@@ -235,14 +231,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 0 on sucess, -1 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 )
{
@@ -256,7 +252,7 @@ static void handle_child_io( io_data_t *io )
if( io->fd > 2 )
{
/*
Make sure the fd used by this redirection is not used by i.e. a pipe.
Make sure the fd used by this redirection is not used by e.g. a pipe.
*/
free_fd( io, io->fd );
}
@@ -276,7 +272,14 @@ 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 -1;
}
}
else if( tmp != io->fd)
{
@@ -288,7 +291,14 @@ static void handle_child_io( io_data_t *io )
FD_ERROR,
io->fd );
wperror( L"dup2" );
exit(1);
if( exit_on_error )
{
exit(1);
}
else
{
return -1;
}
}
exec_close( tmp );
}
@@ -298,19 +308,21 @@ static void handle_child_io( io_data_t *io )
case IO_FD:
{
close(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 );
*/
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 -1;
}
}
break;
}
@@ -318,21 +330,23 @@ static void handle_child_io( io_data_t *io )
case IO_BUFFER:
case IO_PIPE:
{
close(io->fd);
/* 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 -1;
}
}
if( fd_to_dup != 0 )
@@ -341,28 +355,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 0;
}
/**
@@ -371,42 +378,37 @@ 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.
*/
static void setup_child_process( job_t *j )
{
if( is_interactive && !is_subshell && !is_block)
{
pid_t pid;
/*
Put the process into the process group and give the process
group the terminal, if appropriate. This has to be done
both by the shell and in the individual child processes
because of potential race conditions.
*/
pid = getpid ();
if (j->pgid == 0)
j->pgid = pid;
/* Wait till shell puts os in our own group */
while( getpgrp() != j->pgid )
sleep(0);
/* Wait till shell gives us stdin */
if ( j->fg )
{
while( tcgetpgrp( 0 ) != j->pgid )
sleep(0);
}
\param j the job to set up the IO for
\param p the child process to set up
\return 0 on sucess, -1 on failiure
*/
static int setup_child_process( job_t *j, process_t *p )
{
int res=0;
if( p )
{
res = set_child_group( j, p, 1 );
}
if( !res )
{
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;
}
@@ -418,10 +420,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);
@@ -438,11 +441,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 )
{
@@ -458,7 +483,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 )
{
/*
@@ -487,7 +513,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;
@@ -495,31 +522,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.
@@ -529,43 +544,51 @@ 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;
/*
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;
}
/**
This function should be called by the parent process right after
fork() has been called. If job control is enabled, the child is put
in the jobs group.
This function should be called by both the parent process and the
child right after fork() has been called. If job control is
enabled, the child is put in the jobs group, and if the child is
also in the foreground, it is also given control of the
terminal. When called in the parent process, this function may
fail, since the child might have already finished and called
exit. The parent process may safely ignore the exit status of this
call.
Returns 0 on sucess, -1 on failiure.
*/
static int handle_new_child( job_t *j, process_t *p )
static int set_child_group( job_t *j, process_t *p, int print_errors )
{
int res = 0;
if(is_interactive && !is_subshell && !is_block)
if( j->job_control )
{
int new_pgid=0;
@@ -577,46 +600,36 @@ static int handle_new_child( job_t *j, process_t *p )
if( setpgid (p->pid, j->pgid) )
{
if( getpgid( p->pid) != j->pgid )
if( getpgid( p->pid) != j->pgid && print_errors )
{
debug( 1,
L"Could not send process %d from group %d to group %d",
_( L"Could not send process %d from group %d to group %d" ),
p->pid,
getpgid( p->pid),
j->pgid );
wperror( L"setpgid" );
res = -1;
}
}
if( j->fg )
{
if( tcsetpgrp (0, j->pgid) )
{
debug( 1, L"Could not send job %d ('%ls')to foreground",
j->job_id,
j->command );
wperror( L"tcsetpgrp" );
return -1;
}
}
if( j->fg && new_pgid)
{
if( tcsetpgrp (0, j->pgid) )
{
debug( 1, L"Could not send job %d ('%ls')to foreground",
j->job_id,
j->command );
wperror( L"tcsetpgrp" );
return -1;
}
}
}
else
{
j->pgid = getpid();
}
return 0;
if( j->terminal && j->fg )
{
if( tcsetpgrp (0, j->pgid) && print_errors )
{
debug( 1, _( L"Could not send job %d ('%ls') to foreground" ),
j->job_id,
j->command );
wperror( L"tcsetpgrp" );
res = -1;
}
}
return res;
}
@@ -627,8 +640,6 @@ void exec( job_t *j )
pid_t pid;
int mypipe[2];
sigset_t chldset;
sigemptyset( &chldset );
sigaddset( &chldset, SIGCHLD );
int skip_fork;
io_data_t pipe_read, pipe_write;
@@ -641,8 +652,13 @@ void exec( job_t *j )
*/
int exec_error=0;
if( no_exec )
return;
debug( 4, L"Exec job %ls with id %d", j->command, j->job_id );
sigemptyset( &chldset );
sigaddset( &chldset, SIGCHLD );
debug( 4, L"Exec job '%ls' with id %d", j->command, j->job_id );
if( j->first_process->type==INTERNAL_EXEC )
{
@@ -652,15 +668,24 @@ void exec( job_t *j )
signal_block();
/*
setup_child_process make sure signals are propelry set up
setup_child_process make sure signals are properly set
up. It will also call signal_unblock
*/
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;
@@ -677,9 +702,9 @@ void exec( job_t *j )
if( block_io )
{
if( j->io )
j->io = io_add( io_duplicate(block_io), j->io );
j->io = io_add( io_duplicate( j, block_io), j->io );
else
j->io=io_duplicate(block_io);
j->io=io_duplicate( j, block_io);
}
j->io = io_add( j->io, &pipe_write );
@@ -758,33 +783,22 @@ void exec( job_t *j )
{
case INTERNAL_FUNCTION:
{
wchar_t **arg;
int i;
string_buffer_t sb;
const wchar_t * def = function_get_definition( p->argv[0] );
// fwprintf( stderr, L"run function %ls\n", argv[0] );
wchar_t * def = halloc_register( j, wcsdup( function_get_definition( p->argv[0] )));
//fwprintf( stderr, L"run function %ls\n", argv[0] );
if( def == 0 )
{
debug( 0, L"Unknown function %ls", p->argv[0] );
debug( 0, _( L"Unknown function '%ls'" ), p->argv[0] );
break;
}
parser_push_block( FUNCTION_CALL );
if( builtin_count_args(p->argv)>1 )
{
sb_init( &sb );
for( i=1, arg=p->argv+1; *arg; i++, arg++ )
{
if( i != 1 )
sb_append( &sb, ARRAY_SEP_STR );
sb_append( &sb, *arg );
}
env_set( L"argv", (wchar_t *)sb.buff, ENV_LOCAL );
sb_destroy( &sb );
}
current_block->param2.function_call_process = p;
current_block->param1.function_name = halloc_register( current_block, wcsdup( p->argv[0] ) );
parse_util_set_argv( p->argv+1 );
parser_forbid_function( p->argv[0] );
if( p->next )
@@ -810,7 +824,7 @@ void exec( job_t *j )
io_buffer = io_buffer_create();
j->io = io_add( j->io, io_buffer );
}
internal_exec_helper( p->argv[0], TOP, j->io );
break;
@@ -825,6 +839,7 @@ void exec( job_t *j )
if( p == j->first_process )
{
io_data_t *in = io_get( j->io, 0 );
if( in )
{
switch( in->io_mode )
@@ -874,7 +889,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;
}
@@ -951,7 +966,7 @@ void exec( job_t *j )
if( !io_buffer )
{
/*
No buffer, se we exit directly. This means we
No buffer, so we exit directly. This means we
have to manually set the exit status.
*/
if( p->next == 0 )
@@ -969,13 +984,14 @@ void exec( job_t *j )
if( io_buffer->param2.out_buffer->used != 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 );
@@ -996,12 +1012,19 @@ void exec( job_t *j )
it control over the terminal.
*/
p->pid = pid;
if( handle_new_child( j, p ) )
exit(1);
set_child_group( j, p, 0 );
}
}
else
{
if( p->next == 0 )
{
proc_set_last_status( j->negate?(status?0:1):status);
}
p->completed = 1;
}
io_buffer_destroy( io_buffer );
@@ -1063,7 +1086,7 @@ void exec( job_t *j )
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 )
@@ -1088,9 +1111,8 @@ void exec( job_t *j )
*/
p->pid = pid;
if( handle_new_child( j, p ) )
exit( 1 );
set_child_group( j, p, 0 );
}
break;
@@ -1105,7 +1127,7 @@ void exec( job_t *j )
This is the child process.
*/
p->pid = getpid();
setup_child_process( j );
setup_child_process( j, p );
launch_process( p );
/*
@@ -1128,20 +1150,16 @@ void exec( job_t *j )
*/
p->pid = pid;
if( handle_new_child( j, p ) )
exit( 1 );
set_child_group( j, p, 0 );
}
break;
}
}
if( p->type == INTERNAL_BUILTIN )
builtin_pop_io();
builtin_pop_io();
/*
Close the pipe the current process uses to read from the previous process_t
@@ -1179,14 +1197,12 @@ void exec( job_t *j )
{
proc_last_bg_pid = j->pgid;
}
if( !exec_error )
{
job_continue (j, 0);
}
debug( 3, L"End of exec()" );
}
int exec_subshell( const wchar_t *cmd,
@@ -1201,7 +1217,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;
}
@@ -1236,18 +1252,31 @@ int exec_subshell( const wchar_t *cmd,
{
wchar_t *el = str2wcs( begin );
if( el )
{
al_push( l, el );
}
else
{
debug( 2, L"Got null string on line %d of file %s", __LINE__, __FILE__ );
}
}
io_buffer_destroy( io_buffer );
return status;
case '\n':
{
wchar_t *el;
*end=0;
el = str2wcs( begin );
al_push( l, el );
el = str2wcs( begin );
if( el )
{
al_push( l, el );
}
else
{
debug( 2, L"Got null string on line %d of file %s", __LINE__, __FILE__ );
}
begin = end+1;
break;
}
@@ -1257,5 +1286,6 @@ int exec_subshell( const wchar_t *cmd,
}
io_buffer_destroy( io_buffer );
return status;
}

13
exec.h
View File

@@ -16,18 +16,7 @@
/**
pipe redirection error message
*/
#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
*/
void exec_destroy();
#define PIPE_ERROR _(L"An error occurred while setting up pipe")
/**
Execute the processes specified by j.

1118
expand.c

File diff suppressed because it is too large Load Diff

134
expand.h
View File

@@ -1,12 +1,12 @@
/**\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
@@ -20,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
@@ -64,23 +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 rpresenting variable expantion into a single element*/
/** Character rpresenting variable expansion into a single element*/
VARIABLE_EXPAND_SINGLE,
/** Character representing the start of a bracket expantion */
/** 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
}
;
@@ -91,9 +113,25 @@ enum
#define ARRAY_SEP_STR L"\x1e"
/**
Separate subtokens in a token with this character.
Error issued on invalid variable name
*/
#define INTERNAL_SEPARATOR 0xfffffff0
#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'.")
@@ -101,7 +139,7 @@ enum
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
@@ -109,10 +147,11 @@ 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 );
int expand_string( void *context, wchar_t *in, array_list_t *out, int flag );
/**
expand_one is identical to expand_string, except it will fail if in
@@ -120,73 +159,34 @@ 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 );
/**
Expand backslashed escapes and substitute them with their unescaped
counterparts. Also optionally change the wildcards, the tilde
character and a few more into constants which are defined in a
private use area of Unicode. This assumes wchar_t is a unicode
character. character set.
The result must be free()d. The original string is not modified. If
an invalid sequence is specified, 0 is returned.
*/
wchar_t *expand_unescape( const wchar_t * in, int escape_special );
/**
Replace special characters with escape sequences. Newline is
replaced with \n, etc.
The result must be free()d. The original string is not modified.
\param in The string to be escaped
\param escape_all Whether all characters wich hold special meaning in fish (Pipe, semicolon, etc,) should be escaped, or only unprintable characters
\return The escaped string
*/
wchar_t *expand_escape( const wchar_t *in, int escape_all );
wchar_t *expand_one( void *context, wchar_t *in, int flag );
/**
Convert the variable value to a human readable form, i.e. escape things, handle arrays, etc. Suitable for pretty-printing.
*/
wchar_t *expand_escape_variable( const wchar_t *in );
/**
Perform tilde 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 first subshell in the specified string.
\param in the string to search for subshells
\param begin the starting paranthesis of the subshell
\param end the ending paranthesis of the subshell
\param flags set this variable to ACCEPT_INCOMPLETE if in tab_completion mode
\return -1 on syntax error, 0 if no subshells exist and 1 on sucess
*/
int expand_locate_subshell( wchar_t *in,
wchar_t **begin,
wchar_t **end,
int flags );
/**
Tokenize the specified string into the specified array_list_t.
Each new element is allocated using malloc and must be freed by the
caller.
\param val the input string. The contents of this string is not changed.
\param out the list in which to place the elements.
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 two thirds 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.
*/
void expand_variable_array( const wchar_t *val, array_list_t *out );
int expand_is_clean( const wchar_t *in );
#endif

1007
fallback.c Normal file

File diff suppressed because it is too large Load Diff

282
fallback.h Normal file
View File

@@ -0,0 +1,282 @@
#ifndef FISH_FALLBACK_H
#define FISH_FALLBACK_H
#include <stdio.h>
#include <stdint.h>
#include <stdarg.h>
#include <wctype.h>
#include <wchar.h>
#include <limits.h>
#ifndef WCHAR_MAX
/**
This _should_ be defined by wchar.h, but e.g. OpenBSD doesn't.
*/
#define WCHAR_MAX INT_MAX
#endif
/**
Under curses, tputs expects an int (*func)(char) as its last
parameter, but in ncurses, tputs expects a int (*func)(int) as its
last parameter. tputs_arg_t is defined to always be what tputs
expects. Hopefully.
*/
#ifdef NCURSES_VERSION
typedef int tputs_arg_t;
#else
typedef char tputs_arg_t;
#endif
#ifdef TPUTS_KLUDGE
/**
Linux on PPC seems to have a tputs implementation that sometimes
behaves strangely. This fallback seems to fix things.
*/
int tputs(const char *str, int affcnt, int (*fish_putc)(tputs_arg_t));
#endif
#ifndef HAVE_FWPRINTF
/**
Print formated string. Some operating systems (Like NetBSD) do not
have wide string formating functions. Therefore we implement our
own. Not at all complete. Supports wide and narrow characters,
strings and decimal numbers, position (%n), field width and
precision.
*/
int fwprintf( FILE *f, const wchar_t *format, ... );
/**
Print formated string. Some operating systems (Like NetBSD) do not
have wide string formating functions. Therefore we define our
own. Not at all complete. Supports wide and narrow characters,
strings and decimal numbers, position (%n), field width and
precision.
*/
int swprintf( wchar_t *str, size_t l, const wchar_t *format, ... );
/**
Print formated string. Some operating systems (Like NetBSD) do not
have wide string formating functions. Therefore we define our
own. Not at all complete. Supports wide and narrow characters,
strings and decimal numbers, position (%n), field width and
precision.
*/
int wprintf( const wchar_t *format, ... );
/**
Print formated string. Some operating systems (Like NetBSD) do not
have wide string formating functions. Therefore we define our
own. Not at all complete. Supports wide and narrow characters,
strings and decimal numbers, position (%n), field width and
precision.
*/
int vwprintf( const wchar_t *filter, va_list va );
/**
Print formated string. Some operating systems (Like NetBSD) do not
have wide string formating functions. Therefore we define our
own. Not at all complete. Supports wide and narrow characters,
strings and decimal numbers, position (%n), field width and
precision.
*/
int vfwprintf( FILE *f, const wchar_t *filter, va_list va );
/**
Print formated string. Some operating systems (Like NetBSD) do not
have wide string formating functions. Therefore we define our
own. Not at all complete. Supports wide and narrow characters,
strings and decimal numbers, position (%n), field width and
precision.
*/
int vswprintf( wchar_t *out, size_t n, const wchar_t *filter, va_list va );
#endif
#ifndef HAVE_FGETWC
/**
Fallback implementation of fgetwc
*/
wint_t fgetwc(FILE *stream);
/**
Fallback implementation of getwc
*/
wint_t getwc(FILE *stream);
#endif
#ifndef HAVE_FPUTWC
/**
Fallback implementation of fputwc
*/
wint_t fputwc(wchar_t wc, FILE *stream);
/**
Fallback implementation of putwc
*/
wint_t putwc(wchar_t wc, FILE *stream);
#endif
#ifndef HAVE_WCSTOK
/**
Fallback implementation of wcstok. Uses code borrowed from glibc.
*/
wchar_t *wcstok(wchar_t *wcs, const wchar_t *delim, wchar_t **ptr);
#endif
#ifndef HAVE_WCWIDTH
/**
Return the number of columns used by a character. This is a libc
function, but the prototype for this function is missing in some libc
implementations.
Fish has a fallback implementation in case the implementation is
missing altogether. In locales without a native wcwidth, Unicode
is probably so broken that it isn't worth trying to implement a
real wcwidth. Therefore, the fallback wcwidth assumes any printing
character takes up one column and anything else uses 0 columns.
*/
int wcwidth( wchar_t c );
#endif
#ifndef HAVE_WCSDUP
/**
Create a duplicate string. Wide string version of strdup. Will
automatically exit if out of memory.
*/
wchar_t *wcsdup(const wchar_t *in);
#endif
#ifndef HAVE_WCSLEN
/**
Fallback for wcsen. Returns the length of the specified string.
*/
size_t wcslen(const wchar_t *in);
#endif
#ifndef HAVE_WCSCASECMP
/**
Case insensitive string compare function. Wide string version of
strcasecmp.
This implementation of wcscasecmp does not take into account
esoteric locales where uppercase and lowercase do not cleanly
transform between each other. Hopefully this should be fine since
fish only uses this function with one of the strings supplied by
fish and guaranteed to be a sane, english word. Using wcscasecmp on
a user-supplied string should be considered a bug.
*/
int wcscasecmp( const wchar_t *a, const wchar_t *b );
#endif
#ifndef HAVE_WCSNCASECMP
/**
Case insensitive string compare function. Wide string version of
strncasecmp.
This implementation of wcsncasecmp does not take into account
esoteric locales where uppercase and lowercase do not cleanly
transform between each other. Hopefully this should be fine since
fish only uses this function with one of the strings supplied by
fish and guaranteed to be a sane, english word. Using wcsncasecmp on
a user-supplied string should be considered a bug.
*/
int wcsncasecmp( const wchar_t *a, const wchar_t *b, int count );
/**
Returns a newly allocated wide character string wich is a copy of
the string in, but of length c or shorter. The returned string is
always null terminated, and the null is not included in the string
length.
*/
#endif
#ifndef HAVE_WCSNDUP
/**
Fallback for wcsndup function. Returns a copy of \c in, truncated
to a maximum length of \c c.
*/
wchar_t *wcsndup( const wchar_t *in, int c );
#endif
/**
Converts from wide char to digit in the specified base. If d is not
a valid digit in the specified base, return -1. This is a helper
function for wcstol, but it is useful itself, so it is exported.
*/
long convert_digit( wchar_t d, int base );
#ifndef HAVE_WCSTOL
/**
Fallback implementation. Convert a wide character string to a
number in the specified base. This functions is the wide character
string equivalent of strtol. For bases of 10 or lower, 0..9 are
used to represent numbers. For bases below 36, a-z and A-Z are used
to represent numbers higher than 9. Higher bases than 36 are not
supported.
*/
long wcstol(const wchar_t *nptr,
wchar_t **endptr,
int base);
#endif
#ifndef HAVE_WCSLCAT
/**
Appends src to string dst of size siz (unlike wcsncat, siz is the
full size of dst, not space left). At most siz-1 characters will be
copied. Always NUL terminates (unless siz <= wcslen(dst)). Returns
wcslen(src) + MIN(siz, wcslen(initial dst)). If retval >= siz,
truncation occurred.
This is the OpenBSD strlcat function, modified for wide characters,
and renamed to reflect this change.
*/
size_t wcslcat( wchar_t *dst, const wchar_t *src, size_t siz );
#endif
#ifndef HAVE_WCSLCPY
/**
Copy src to string dst of size siz. At most siz-1 characters will
be copied. Always NUL terminates (unless siz == 0). Returns
wcslen(src); if retval >= siz, truncation occurred.
This is the OpenBSD strlcpy function, modified for wide characters,
and renamed to reflect this change.
*/
size_t wcslcpy( wchar_t *dst, const wchar_t *src, size_t siz );
#endif
#ifdef HAVE_BROKEN_DEL_CURTERM
/**
BSD del_curterm seems to do a double-free. We redefine it as a no-op
*/
int del_curterm(TERMINAL *oterm);
#endif
#endif

View File

@@ -1,3 +1,5 @@
%define xinclude %( if test -d /usr/X11R6/include; then echo /usr/X11R6/include; else echo /usr/include; fi )
Summary: A friendly interactive shell
Name: @PACKAGE_NAME@
@@ -11,62 +13,102 @@ URL: http://roo.no-ip.org/fish/
Source0: http://roo.no-ip.org/%{name}/files/%{version}/%{name}-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: doxygen ncurses-devel xorg-x11-devel
BuildRequires: doxygen ncurses-devel
BuildRequires: %{xinclude}/X11/StringDefs.h, %{xinclude}/X11/Xlib.h
BuildRequires: %{xinclude}/X11/Intrinsic.h, %{xinclude}/X11/Xatom.h
%description
fish is a shell geared towards interactive use. It's features are
focused on user friendlieness and discoverability. The language syntax
is simple but incompatible with other shell languages.
%prep
%setup -q
%build
%build
%configure docdir=%_datadir/doc/%{name}-%{version}
make %{?_smp_mflags}
%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR="$RPM_BUILD_ROOT"
%clean
rm -rf $RPM_BUILD_ROOT
%post
if ! grep %_bindir/fish %_sysconfdir/shells >/dev/null; then
echo %_bindir/fish >>%_sysconfdir/shells
fi
%postun
if [ "$1" = 0 ]; then
grep -v %_bindir/fish %_sysconfdir/shells >%_sysconfdir/fish.tmp
mv %_sysconfdir/fish.tmp %_sysconfdir/shells
fi
%files
%defattr(-,root,root,-)
%doc %_datadir/doc/%{name}-%{version}
%_mandir/man1/fish.1*
%_mandir/man1/xsel.1x*
%_mandir/man1/mimedb.1*
%_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
%config %_sysconfdir/fish_inputrc
%dir %_sysconfdir/fish.d
%config %_sysconfdir/fish.d/fish_*.fish
%dir %_sysconfdir/fish.d/completions
%config %_sysconfdir/fish.d/completions/*.fish
%dir %_datadir/fish
%_datadir/fish/fish
%dir %_datadir/fish/completions
%_datadir/fish/completions/*.fish
%dir %_datadir/fish/functions
%_datadir/fish/functions/*.fish
%_datadir/locale/*/LC_MESSAGES/fish.mo
%changelog
* Tue Nov 29 2005 Axel Liljencrantz <axel@liljencrantz.se> 1.17.0-0

View File

@@ -27,16 +27,26 @@
#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 "fallback.h"
#include "util.h"
#include "wutil.h"
#include "common.h"
#include "complete.h"
#include "output.h"
#include "input_common.h"
#include "env_universal.h"
#include "halloc.h"
#include "halloc_util.h"
enum
{
@@ -69,6 +79,7 @@ static struct termios pager_modes;
static int is_ca_mode = 0;
static buffer_t *pager_buffer;
/**
The environment variables used to specify the color of different
@@ -86,8 +97,18 @@ static wchar_t *hightlight_var[] =
static string_buffer_t out_buff;
static FILE *out_file;
typedef struct
{
array_list_t *comp;
wchar_t *desc;
int comp_width;
int desc_width;
int pref_width;
int min_width;
}
comp_t;
int get_color( int highlight )
static int get_color( int highlight )
{
if( highlight < 0 )
return FISH_COLOR_NORMAL;
@@ -96,9 +117,6 @@ int get_color( int highlight )
wchar_t *val = env_universal_get( hightlight_var[highlight]);
if( val == 0 )
return FISH_COLOR_NORMAL;
if( val == 0 )
{
return FISH_COLOR_NORMAL;
@@ -107,7 +125,20 @@ int get_color( int highlight )
return output_color_code( val );
}
int try_sequence( char *seq )
static void recalc_width( array_list_t *l, const wchar_t *prefix )
{
int i;
for( i=0; i<al_get_count( l ); i++ )
{
comp_t *c = (comp_t *)al_get( l, i );
c->min_width = mini( c->desc_width, maxi(0,termsize.ws_col/3 - 2)) +
mini( c->desc_width, maxi(0,termsize.ws_col/5 - 4)) +4;
}
}
static int try_sequence( char *seq )
{
int j, k;
wint_t c=0;
@@ -190,6 +221,110 @@ static wint_t readch()
}
static int pager_buffered_writer( char c)
{
b_append( pager_buffer, &c, 1 );
return 0;
}
static void pager_flush()
{
write( 1, pager_buffer->buff, pager_buffer->used );
pager_buffer->used = 0;
}
static int print_max( const wchar_t *str, int max, int has_more )
{
int i;
int written = 0;
for( i=0; str[i]; i++ )
{
if( written + wcwidth(str[i]) > max )
break;
if( ( written + wcwidth(str[i]) == max) && (has_more || str[i+1]) )
{
writech( ellipsis_char );
written += wcwidth(ellipsis_char );
break;
}
writech( str[i] );
written+= wcwidth( str[i] );
}
return written;
}
static void completion_print_item( const wchar_t *prefix, comp_t *c, int width )
{
int comp_width=0, desc_width=0;
int i;
int written=0;
if( c->pref_width <= width )
{
/*
The entry fits, we give it as much space as it wants
*/
comp_width = c->comp_width;
desc_width = c->desc_width;
}
else
{
/*
The completion and description won't fit on the
allocated space. Give a maximum of 2/3 of the
space to the completion, and whatever is left to
the description.
*/
int desc_all = c->desc_width?c->desc_width+4:0;
comp_width = maxi( mini( c->comp_width,
2*(width-4)/3 ),
width - desc_all );
if( c->desc_width )
desc_width = width-comp_width-4;
else
c->desc_width=0;
}
for( i=0; i<al_get_count( c->comp ); i++ )
{
const wchar_t *comp = (const wchar_t *)al_get( c->comp, i );
if( i != 0 )
written += print_max( L" ", comp_width - written, 2 );
set_color( get_color(HIGHLIGHT_PAGER_PREFIX),FISH_COLOR_NORMAL );
written += print_max( prefix, comp_width - written, comp[0]?1:0 );
set_color( get_color(HIGHLIGHT_PAGER_COMPLETION),FISH_COLOR_IGNORE );
written += print_max( comp, comp_width - written, i!=(al_get_count(c->comp)-1) );
}
if( desc_width )
{
while( written < (width-desc_width-2))
{
written++;
writech( L' ');
}
written += print_max( L"(", 1, 0 );
set_color( get_color( HIGHLIGHT_PAGER_DESCRIPTION ),
FISH_COLOR_IGNORE );
written += print_max( c->desc, desc_width, 0 );
written += print_max( L")", 1, 0 );
}
else
{
while( written < width )
{
written++;
writech( L' ');
}
}
}
/**
Print the specified part of the completion list, using the
specified column offsets and quoting style.
@@ -214,271 +349,29 @@ static void completion_print( int cols,
int rows = (al_get_count( l )-1)/cols+1;
int i, j;
int prefix_width= my_wcswidth(prefix);
for( i = row_start; i<row_stop; i++ )
{
for( j = 0; j < cols; j++ )
{
wchar_t *el, *el_end;
comp_t *el;
int is_last = (j==(cols-1));
if( al_get_count( l ) <= j*rows + i )
continue;
el = (wchar_t *)al_get( l, j*rows + i );
el_end= wcschr( el, COMPLETE_SEP );
set_color( get_color(HIGHLIGHT_PAGER_PREFIX),FISH_COLOR_NORMAL );
writestr( prefix );
set_color( get_color(HIGHLIGHT_PAGER_COMPLETION),FISH_COLOR_IGNORE );
if( el_end == 0 )
{
/* We do not have a description for this completion */
int written = 0;
int max_written = width[j] - prefix_width - (j==cols-1?0:2);
if( is_quoted )
{
for( i=0; i<max_written; i++ )
{
if( !el[i] )
break;
writech( el[i] );
written+= wcwidth( el[i] );
}
}
else
{
written = write_escaped_str( el, max_written );
}
set_color( get_color( HIGHLIGHT_PAGER_DESCRIPTION ),
FISH_COLOR_IGNORE );
writespace( width[j]-
written-
prefix_width );
}
else
{
int whole_desc_width = my_wcswidth(el_end+1);
int whole_comp_width;
/*
Temporarily drop the description so that wcswidth et
al only calculate the width of the completion.
*/
*el_end = L'\0';
/*
Calculate preferred completion width
*/
if( is_quoted )
{
whole_comp_width = my_wcswidth(el);
}
else
{
wchar_t *tmp = escape( el, 1 );
whole_comp_width = my_wcswidth( tmp );
free(tmp);
}
/*
Calculate how wide this entry 'wants' to be
*/
int pref_width = whole_desc_width + 4 + prefix_width + 2 -
(j==cols-1?2:0) + whole_comp_width;
int comp_width, desc_width;
if( pref_width <= width[j] )
{
/*
The entry fits, we give it as much space as it wants
*/
comp_width = whole_comp_width;
desc_width = whole_desc_width;
}
else
{
/*
The completion and description won't fit on the
allocated space. Give a maximum of 2/3 of the
space to the completion, and whatever is left to
the description.
*/
int sum = width[j] - prefix_width - 4 - 2 + (j==cols-1?2:0);
comp_width = maxi( mini( whole_comp_width,
2*sum/3 ),
sum - whole_desc_width );
desc_width = sum-comp_width;
}
/* First we must print the completion. */
if( is_quoted )
{
writestr_ellipsis( el, comp_width);
}
else
{
write_escaped_str( el, comp_width );
}
/* Put the description back */
*el_end = COMPLETE_SEP;
/* And print it */
set_color( get_color(HIGHLIGHT_PAGER_DESCRIPTION),
FISH_COLOR_IGNORE );
writespace( maxi( 2,
width[j]
- comp_width
- desc_width
- 4
- prefix_width
+ (j==cols-1?2:0) ) );
/* Print description */
writestr(L"(");
writestr_ellipsis( el_end+1, desc_width);
writestr(L")");
if( j != cols-1)
writestr( L" " );
}
el = (comp_t *)al_get( l, j*rows + i );
completion_print_item( prefix, el, width[j] - (is_last?0:2) );
if( !is_last)
writestr( L" " );
}
writech( L'\n' );
}
}
/**
Calculates how long the specified string would be when printed on the command line.
\param str The string to be printed.
\param is_quoted Whether the string would be printed quoted or unquoted
\param pref_width the preferred width for this item
\param min_width the minimum width for this item
*/
static void printed_length( wchar_t *str,
int is_quoted,
int *pref_width,
int *min_width )
{
if( is_quoted )
{
wchar_t *sep = wcschr(str,COMPLETE_SEP);
if( sep )
{
*sep=0;
int cw = my_wcswidth( str );
int dw = my_wcswidth(sep+1);
if( termsize.ws_col > 80 )
dw = mini( dw, termsize.ws_col/3 );
*pref_width = cw+dw+4;
if( dw > termsize.ws_col/3 )
{
dw = termsize.ws_col/3;
}
*min_width=cw+dw+4;
*sep= COMPLETE_SEP;
return;
}
else
{
*pref_width=*min_width= my_wcswidth( str );
return;
}
}
else
{
int comp_len=0, desc_len=0;
int has_description = 0;
while( *str != 0 )
{
switch( *str )
{
case L'\n':
case L'\b':
case L'\r':
case L'\e':
case L'\t':
case L'\\':
case L'&':
case L'$':
case L' ':
case L'#':
case L'^':
case L'<':
case L'>':
case L'@':
case L'(':
case L')':
case L'{':
case L'}':
case L'?':
case L'*':
case L'|':
case L';':
case L':':
if( has_description )
desc_len++;
else
comp_len+=2;
break;
case COMPLETE_SEP:
has_description = 1;
break;
default:
if( has_description )
desc_len+= wcwidth(*str);
else
comp_len+= wcwidth(*str);
break;
}
str++;
}
if( has_description )
{
/*
Mangle long descriptions to make formating look nicer
*/
debug( 3, L"Desc, width = %d %d\n", comp_len, desc_len );
// if( termsize.ws_col > 80 )
// desc_len = mini( desc_len, termsize.ws_col/3 );
*pref_width = comp_len+ desc_len+4;;
comp_len = mini( comp_len, maxi(0,termsize.ws_col/3 - 2));
desc_len = mini( desc_len, maxi(0,termsize.ws_col/5 - 4));
*min_width = comp_len+ desc_len+4;
return;
}
else
{
debug( 3, L"No desc, width = %d\n", comp_len );
*pref_width=*min_width= comp_len;
return;
}
}
}
/**
Try to print the list of completions l with the prefix prefix using
@@ -526,8 +419,6 @@ static int completion_try_print( int cols,
int pref_tot_width=0;
int min_tot_width = 0;
int prefix_width = my_wcswidth( prefix );
int res=0;
/*
Skip completions on tiny terminals
@@ -535,25 +426,24 @@ static int completion_try_print( int cols,
if( termsize.ws_col < 16 )
return 1;
memset( pref_width, 0, sizeof(pref_width) );
memset( min_width, 0, sizeof(min_width) );
/* Calculated how wide the list would be */
/* Calculate how wide the list would be */
for( j = 0; j < cols; j++ )
{
for( i = 0; i<rows; i++ )
{
int pref,min;
wchar_t *el;
comp_t *c;
if( al_get_count( l ) <= j*rows + i )
continue;
el = (wchar_t *)al_get( l, j*rows + i );
printed_length( el, is_quoted, &pref, &min );
pref += prefix_width;
min += prefix_width;
c = (comp_t *)al_get( l, j*rows + i );
pref = c->pref_width;
min = c->min_width;
if( j != cols-1 )
{
pref += 2;
@@ -635,6 +525,7 @@ static int completion_try_print( int cols,
}
completion_print( cols, width, 0, rows, prefix, is_quoted, l);
pager_flush();
}
else
{
@@ -667,6 +558,7 @@ static int completion_try_print( int cols,
percent );
writestr(msg);
set_color( FISH_COLOR_NORMAL, FISH_COLOR_NORMAL );
pager_flush();
int c = readch();
switch( c )
@@ -728,7 +620,8 @@ static int completion_try_print( int cols,
}
else
{
writembs( flash_screen );
if( flash_screen )
writembs( flash_screen );
}
break;
@@ -752,7 +645,8 @@ static int completion_try_print( int cols,
}
else
{
writembs( flash_screen );
if( flash_screen )
writembs( flash_screen );
}
break;
}
@@ -780,7 +674,9 @@ static int completion_try_print( int cols,
}
/**
Substitute any series of tabs, newlines, etc. with a single space character in completion description
Substitute any series of whitespace with a single space character
inside completion descriptions. Remove all whitespace from
beginning/end of completion descriptions.
*/
static void mangle_descriptions( array_list_t *l )
{
@@ -789,7 +685,7 @@ static void mangle_descriptions( array_list_t *l )
{
wchar_t *next = (wchar_t *)al_get(l, i);
wchar_t *in, *out;
skip=0;
skip=1;
while( *next != COMPLETE_SEP && *next )
next++;
@@ -818,6 +714,125 @@ static void mangle_descriptions( array_list_t *l )
}
}
/**
Merge multiple completions with the same description to the same line
*/
static void join_completions( array_list_t *l )
{
int i, in, out;
hash_table_t desc_table;
hash_init( &desc_table, &hash_wcs_func, &hash_wcs_cmp );
for( i=0; i<al_get_count(l); i++ )
{
wchar_t *item = (wchar_t *)al_get( l, i );
wchar_t *desc = wcschr( item, COMPLETE_SEP );
long prev_idx;
if( !desc )
continue;
desc++;
prev_idx = ((long)hash_get( &desc_table, desc) )-1;
if( prev_idx == -1 )
{
hash_put( &desc_table, halloc_wcsdup( global_context, desc), (void *)(i+1));
}
else
{
string_buffer_t foo;
wchar_t *old = (wchar_t *)al_get( l, prev_idx );
wchar_t *old_end = wcschr( old, COMPLETE_SEP );
if( old_end )
{
*old_end = 0;
sb_init( &foo );
sb_append( &foo, old );
sb_append_char( &foo, COMPLETE_ITEM_SEP );
sb_append( &foo, item );
free( (void *)al_get( l, prev_idx ) );
al_set( l, prev_idx, foo.buff );
free( (void *)al_get( l, i ) );
al_set( l, i, 0 );
}
// debug( 1, L"WOOT WOOT %ls är släkt med %ls", item, al_get( l, prev_idx ) );
}
}
hash_destroy( &desc_table );
out=0;
for( in=0; in < al_get_count(l); in++ )
{
const void * d = al_get( l, in );
if( d )
{
al_set( l, out++, d );
}
}
al_truncate( l, out );
}
/**
Replace completion strings with a comp_t structure
*/
static void mangle_completions( array_list_t *l, const wchar_t *prefix )
{
int i;
for( i=0; i<al_get_count( l ); i++ )
{
wchar_t *next = (wchar_t *)al_get( l, i );
wchar_t *start, *end;
comp_t *comp = halloc( global_context, sizeof( comp_t ) );
comp->comp = al_halloc( global_context );
for( start=end=next; 1; end++ )
{
wchar_t c = *end;
if( (c == COMPLETE_ITEM_SEP) || (c==COMPLETE_SEP) || !c)
{
*end = 0;
wchar_t * str = escape( start, 1 );
comp->comp_width += my_wcswidth( str );
halloc_register( global_context, str );
al_push( comp->comp, str );
start = end+1;
}
if( c == COMPLETE_SEP )
{
comp->desc = halloc_wcsdup( global_context, start );
break;
}
if( !c )
break;
}
comp->comp_width += my_wcswidth(prefix)*al_get_count(comp->comp) + 2*(al_get_count(comp->comp)-1);
comp->desc_width = comp->desc?my_wcswidth( comp->desc ):0;
comp->pref_width = comp->comp_width + comp->desc_width + (comp->desc_width?4:0);
free( next );
al_set( l, i, comp );
}
recalc_width( l, prefix );
}
/**
Respond to a winch signal by checking the terminal size
*/
@@ -839,9 +854,12 @@ static void init()
{
struct sigaction act;
program_name = L"fish_pager";
fish_setlocale( LC_ALL, L"" );
wsetlocale( LC_ALL, L"" );
/*
Make fd 1 output to screen, and use some other fd for writing
the resulting output back to the caller
*/
int out = dup( 1 );
close(1);
if( open( ttyname(0), O_WRONLY ) != 1 )
@@ -853,11 +871,18 @@ static void init()
}
}
out_file = fdopen( out, "w" );
/**
Init the stringbuffer used to keep any output in
*/
sb_init( &out_buff );
output_init();
halloc_util_init();
env_universal_init( 0, 0, 0, 0);
input_common_init( &interrupt_handler );
output_set_writer( &pager_buffered_writer );
pager_buffer = halloc( global_context, sizeof( buffer_t ) );
halloc_register_function( global_context, (void (*)(void *))&b_destroy, pager_buffer );
sigemptyset( & act.sa_mask );
act.sa_flags=0;
@@ -870,33 +895,6 @@ static void init()
exit(1);
}
/* Loop until we are in the foreground. */
while (tcgetpgrp( 0 ) != getpid())
{
kill (- getpid(), SIGTTIN);
}
/* Put ourselves in our own process group. */
if( getpgrp() != getpid() )
{
if (setpgid (getpid(), getpid()) < 0)
{
debug( 1,
L"Couldn't put the shell in its own process group");
wperror( L"setpgid" );
exit (1);
}
}
/* Grab control of the terminal. */
if( tcsetpgrp (STDIN_FILENO, getpid()) )
{
debug( 1,
L"Couldn't grab control of terminal" );
wperror( L"tcsetpgrp" );
exit(1);
}
handle_winch( 0 ); /* Set handler for window change events */
tcgetattr(0,&pager_modes); /* get the current terminal modes */
@@ -909,6 +907,9 @@ static void init()
pager_modes.c_cc[VMIN]=1;
pager_modes.c_cc[VTIME]=0;
/*
*/
if( tcsetattr(0,TCSANOW,&pager_modes)) /* set the new modes */
{
wperror(L"tcsetattr");
@@ -927,45 +928,51 @@ void destroy()
{
env_universal_destroy();
input_common_destroy();
output_destroy();
halloc_util_destroy();
del_curterm( cur_term );
sb_destroy( &out_buff );
fclose( out_file );
}
int main( int argc, char **argv )
{
int i;
int is_quoted=0;
array_list_t comp;
array_list_t *comp;
wchar_t *prefix;
init();
if( argc < 3 )
{
debug( 0, L"Insufficient arguments" );
}
else
{
comp = al_halloc( global_context );
prefix = str2wcs( argv[2] );
is_quoted = strcmp( "1", argv[1] )==0;
is_quoted = 0;
debug( 3, L"prefix is '%ls'", prefix );
al_init( &comp );
for( i=3; i<argc; i++ )
{
al_push( &comp, str2wcs( argv[i] ) );
wchar_t *wcs = str2wcs( argv[i] );
if( wcs )
{
al_push( comp, wcs );
}
}
mangle_descriptions( comp );
if( wcscmp( prefix, L"-" ) == 0 )
join_completions( comp );
mangle_completions( comp, prefix );
mangle_descriptions( &comp );
for( i = 6; i>0; i-- )
{
switch( completion_try_print( i, prefix, is_quoted, &comp ) )
switch( completion_try_print( i, prefix, is_quoted, comp ) )
{
case 0:
break;
@@ -979,15 +986,16 @@ int main( int argc, char **argv )
}
al_foreach( &comp, (void(*)(const void *))&free );
al_destroy( &comp );
free(prefix );
fwprintf( out_file, L"%ls", (wchar_t *)out_buff.buff );
if( is_ca_mode )
{
writembs(exit_ca_mode);
pager_flush();
}
}
destroy();
}

View File

@@ -4,6 +4,7 @@
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
@@ -26,7 +27,9 @@
#include <locale.h>
#include <dirent.h>
#include "fallback.h"
#include "util.h"
#include "common.h"
#include "proc.h"
#include "reader.h"
@@ -41,6 +44,7 @@
#include "output.h"
#include "exec.h"
#include "event.h"
#include "halloc_util.h"
/**
Number of laps to run performance testing loop
@@ -98,7 +102,7 @@ static int pq_compare( void *e1, void *e2 )
/**
Test priority queue functionality
*/
static int pq_test( int elements )
static void pq_test( int elements )
{
int i;
int prev;
@@ -286,7 +290,7 @@ static int hash_test( int elements )
/**
Arraylist test
*/
static int al_test( int sz)
static void al_test( int sz)
{
int i;
array_list_t l;
@@ -327,7 +331,7 @@ static void sb_test()
sb_init( &b );
if( res=sb_printf( &b, L"%ls%s", L"Testing ", "string_buffer_t " ) == -1 )
if( (res=sb_printf( &b, L"%ls%s", L"Testing ", "string_buffer_t " )) == -1 )
{
err( L"Error %d while testing stringbuffers", res );
}
@@ -336,7 +340,22 @@ static void sb_test()
{
err( L"Error %d while testing stringbuffers", res );
}
say( (wchar_t *)b.buff );
sb_clear( &b );
#define NUM_ANS L"-7 99999999 1234567 deadbeef DEADBEEFDEADBEEF"
sb_printf( &b, L"%d %u %o %x %llX", -7, 99999999, 01234567, 0xdeadbeef, 0xdeadbeefdeadbeefll );
if( wcscmp( (wchar_t *)b.buff, NUM_ANS) != 0 )
{
err( L"numerical formating is broken, '%ls' != '%ls'", (wchar_t *)b.buff, NUM_ANS );
}
else
say( L"numerical formating works" );
}
/**
@@ -518,7 +537,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
@@ -533,7 +552,7 @@ static int expand_test( const wchar_t *in, int flags, ... )
wchar_t *arg;
al_init( &out );
expand_string( wcsdup(in), &out, flags);
expand_string( 0, wcsdup(in), &out, flags);
va_start( va, flags );
@@ -561,11 +580,11 @@ static int expand_test( const wchar_t *in, int flags, ... )
}
/**
Test globbing and other parameter expantion
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 ))
{
@@ -574,12 +593,12 @@ 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" );
}
}
@@ -669,9 +688,8 @@ int main( int argc, char **argv )
say( L"Lines beginning with '(ignore):' are not errors, they are warning messages\ngenerated by the fish parser library when given broken input, and can be\nignored. All actual errors begin with 'Error:'." );
proc_init();
output_init();
halloc_util_init();
event_init();
exec_init();
parser_init();
function_init();
builtin_init();
@@ -699,9 +717,8 @@ int main( int argc, char **argv )
builtin_destroy();
complete_destroy();
wutil_destroy();
exec_destroy();
event_destroy();
output_destroy();
proc_destroy();
halloc_util_destroy();
}

130
fishd.c
View File

@@ -2,11 +2,46 @@
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,11 +54,17 @@ 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>
#include "fallback.h"
#include "util.h"
#include "common.h"
#include "wutil.h"
#include "env_universal_common.h"
@@ -35,6 +76,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
*/
@@ -60,6 +110,11 @@ down and save.
*/
#define LOCKTIMEOUT 1
/**
Getopt short switches for fishd
*/
#define GETOPT_STRING "hv"
/**
The list of connections to clients
*/
@@ -75,6 +130,11 @@ static int sock;
*/
static int quit=0;
/**
Dynamically generated function, made from the documentation in doc_src.
*/
void print_help();
/**
Constructs the fish socket filename
*/
@@ -174,8 +234,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 )
@@ -396,11 +456,9 @@ 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();
@@ -419,8 +477,68 @@ int main( int argc, char ** argv )
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,
GETOPT_STRING,
long_options,
&opt_index );
#else
int opt = getopt( argc,
argv,
GETOPT_STRING );
#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;

View File

@@ -9,13 +9,22 @@
#include <signal.h>
#include "config.h"
#include "wutil.h"
#include "fallback.h"
#include "util.h"
#include "function.h"
#include "proc.h"
#include "translate.h"
#include "parser.h"
#include "common.h"
#include "intern.h"
#include "event.h"
#include "reader.h"
#include "parse_util.h"
#include "env.h"
#include "expand.h"
/**
@@ -27,7 +36,10 @@ typedef struct
wchar_t *cmd;
/** Function description */
wchar_t *desc;
const wchar_t *definition_file;
int definition_offset;
int is_binding;
int is_autoload;
}
function_data_t;
@@ -35,6 +47,79 @@ typedef struct
Table containing all functions
*/
static hash_table_t function;
static int is_autoload = 0;
/**
Make sure that if the specified function is a dynamically loaded
function, it has been fully loaded.
*/
static int load( const wchar_t *name )
{
int was_autoload = is_autoload;
int res;
function_data_t *data;
data = (function_data_t *)hash_get( &function, name );
if( data && !data->is_autoload )
return 0;
is_autoload = 1;
res = parse_util_load( name,
L"fish_function_path",
&function_remove,
1 );
is_autoload = was_autoload;
return res;
}
/**
Insert a list of all dynamically loaded functions into the
specified list.
*/
static void autoload_names( array_list_t *out, int get_hidden )
{
int i;
array_list_t path_list;
const wchar_t *path_var = env_get( L"fish_function_path" );
if( ! path_var )
return;
al_init( &path_list );
tokenize_variable_array( path_var, &path_list );
for( i=0; i<al_get_count( &path_list ); i++ )
{
wchar_t *ndir = (wchar_t *)al_get( &path_list, i );
DIR *dir = wopendir( ndir );
if( !dir )
continue;
struct wdirent *next;
while( (next=wreaddir(dir))!=0 )
{
wchar_t *fn = next->d_name;
wchar_t *suffix;
if( !get_hidden && fn[0] == L'_' )
continue;
suffix = wcsrchr( fn, L'.' );
if( suffix && (wcscmp( suffix, L".fish" ) == 0 ) )
{
const wchar_t *dup;
*suffix = 0;
dup = intern( fn );
if( !dup )
die_mem();
al_push( out, dup );
}
}
closedir(dir);
}
al_foreach( &path_list, (void (*)(const void *))&free );
al_destroy( &path_list );
}
/**
Free all contents of an entry to the function hash table
@@ -61,6 +146,7 @@ void function_destroy()
hash_destroy( &function );
}
void function_add( const wchar_t *name,
const wchar_t *val,
const wchar_t *desc,
@@ -68,16 +154,28 @@ void function_add( const wchar_t *name,
int is_binding )
{
int i;
wchar_t *cmd_end;
function_data_t *d;
if( function_exists( name ) )
function_remove( name );
function_remove( name );
function_data_t *d = malloc( sizeof( function_data_t ) );
d = malloc( sizeof( function_data_t ) );
d->definition_offset = parse_util_lineno( parser_get_buffer(), current_block->tok_pos );
d->cmd = wcsdup( val );
cmd_end = d->cmd + wcslen(d->cmd)-1;
while( (cmd_end>d->cmd) && wcschr( L"\n\r\t ", *cmd_end ) )
{
*cmd_end-- = 0;
}
d->desc = desc?wcsdup( desc ):0;
d->is_binding = is_binding;
d->definition_file = intern(reader_current_filename());
d->is_autoload = is_autoload;
hash_put( &function, intern(name), d );
for( i=0; i<al_get_count( events ); i++ )
{
event_add_handler( (event_t *)al_get( events, i ) );
@@ -87,34 +185,42 @@ void function_add( const wchar_t *name,
int function_exists( const wchar_t *cmd )
{
if( parser_is_reserved(cmd) )
return 0;
load( cmd );
return (hash_get(&function, cmd) != 0 );
}
void function_remove( const wchar_t *name )
{
void *key;
const void *dv;
function_data_t *d;
event_t ev;
ev.type=EVENT_ANY;
ev.function_name=name;
event_remove( &ev );
hash_remove( &function,
name,
(const void **) &key,
(const void **)&d );
&dv );
if( !d )
d=(function_data_t *)dv;
if( !key )
return;
ev.type=EVENT_ANY;
ev.function_name=name;
event_remove( &ev );
clear_function_entry( key, d );
}
const wchar_t *function_get_definition( const wchar_t *argv )
{
function_data_t *data =
(function_data_t *)hash_get( &function, argv );
function_data_t *data;
load( argv );
data = (function_data_t *)hash_get( &function, argv );
if( data == 0 )
return 0;
return data->cmd;
@@ -122,24 +228,39 @@ const wchar_t *function_get_definition( const wchar_t *argv )
const wchar_t *function_get_desc( const wchar_t *argv )
{
function_data_t *data =
(function_data_t *)hash_get( &function, argv );
function_data_t *data;
load( argv );
data = (function_data_t *)hash_get( &function, argv );
if( data == 0 )
return 0;
return data->desc?data->desc:data->cmd;
return _(data->desc);
}
void function_set_desc( const wchar_t *name, const wchar_t *desc )
{
function_data_t *data =
(function_data_t *)hash_get( &function, name );
function_data_t *data;
load( name );
data = (function_data_t *)hash_get( &function, name );
if( data == 0 )
return;
data->desc =wcsdup(desc);
}
static int al_contains_str( array_list_t *list, const wchar_t * str )
{
int i;
for( i=0; i<al_get_count( list ); i++ )
{
if( wcscmp( al_get( list, i ), str) == 0 )
{
return 1;
}
}
return 0;
}
/**
Helper function for removing hidden functions
*/
@@ -150,16 +271,62 @@ static void get_names_internal( const void *key,
wchar_t *name = (wchar_t *)key;
function_data_t *f = (function_data_t *)val;
if( name[0] != L'_' && !f->is_binding)
if( name[0] != L'_' && !f->is_binding && !al_contains_str( (array_list_t *)aux, name ) )
{
al_push( (array_list_t *)aux, name );
}
}
/**
Helper function for removing hidden functions
*/
static void get_names_internal_all( const void *key,
const void *val,
void *aux )
{
wchar_t *name = (wchar_t *)key;
if( !al_contains_str( (array_list_t *)aux, name ) )
{
al_push( (array_list_t *)aux, name );
}
}
void function_get_names( array_list_t *list, int get_hidden )
{
autoload_names( list, get_hidden );
if( get_hidden )
hash_get_keys( &function, list );
{
hash_foreach2( &function, &get_names_internal_all, list );
}
else
{
hash_foreach2( &function, &get_names_internal, list );
}
}
const wchar_t *function_get_definition_file( const wchar_t *argv )
{
function_data_t *data;
load( argv );
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;
load( argv );
data = (function_data_t *)hash_get( &function, argv );
if( data == 0 )
return -1;
return data->definition_offset;
}

View File

@@ -69,4 +69,15 @@ int function_exists( const wchar_t *name );
void function_get_names( array_list_t *list,
int get_hidden );
/**
Returns tha absolute path of the file where the specified function
was defined. Returns 0 if the file was defined on the commandline.
*/
const wchar_t *function_get_definition_file( const wchar_t *name );
/**
Returns the linenumber where the definition of the specified function started
*/
int function_get_definition_offset( const wchar_t *name );
#endif

173
halloc.c Normal file
View File

@@ -0,0 +1,173 @@
/** \file halloc.c
A hierarchical memory allocation system. Works just like talloc
used in Samba, except that an arbitrary block allocated with
malloc() can be registered to be freed by halloc_free.
*/
#include "config.h"
#include <stdlib.h>
#include <unistd.h>
#include "fallback.h"
#include "util.h"
#include "common.h"
#include "halloc.h"
#define HALLOC_BLOCK_SIZE 128
#define HALLOC_SCRAP_SIZE 16
#ifdef HALLOC_DEBUG
static int child_count=0;
static int child_size=0;
static int alloc_count =0;
static int alloc_spill = 0;
static pid_t pid=0;
static int parent_count=0;
#endif
typedef struct halloc
{
array_list_t children;
void *scratch;
size_t scratch_free;
long long data[0];
}
halloc_t;
static halloc_t *halloc_from_data( void *data )
{
return (halloc_t *)(((char *)data) - sizeof( halloc_t ) );
}
static void late_free( void *data)
{
}
#ifdef HALLOC_DEBUG
static void woot()
{
if( getpid() == pid )
{
debug( 1, L"%d parents, %d children with average child size of %.2f bytes caused %d allocs, average spill of %.2f bytes",
parent_count, child_count, (double)child_size/child_count,
parent_count+alloc_count, (double)alloc_spill/(parent_count+alloc_count) );
}
}
#endif
void *halloc( void *context, size_t size )
{
halloc_t *me, *parent;
if( context )
{
void *res;
#ifdef HALLOC_DEBUG
if( !child_count )
{
pid = getpid();
atexit( woot );
}
child_count++;
child_size += size;
#endif
parent = halloc_from_data( context );
if( size <= parent->scratch_free )
{
res = parent->scratch;
parent->scratch_free -= size;
parent->scratch = ((char *)parent->scratch)+size;
}
else
{
#ifdef HALLOC_DEBUG
alloc_count++;
#endif
if( parent->scratch_free < HALLOC_SCRAP_SIZE )
{
#ifdef HALLOC_DEBUG
alloc_spill += parent->scratch_free;
#endif
res = calloc( 1, size + HALLOC_BLOCK_SIZE );
parent->scratch = (char *)res + size;
parent->scratch_free = HALLOC_BLOCK_SIZE;
}
else
{
res = calloc( 1, size );
}
al_push( &parent->children, &late_free );
al_push( &parent->children, res );
}
return res;
}
else
{
me = (halloc_t *)calloc( 1, sizeof(halloc_t) + size + HALLOC_BLOCK_SIZE );
if( !me )
return 0;
#ifdef HALLOC_DEBUG
parent_count++;
#endif
me->scratch = ((char *)me) + sizeof(halloc_t) + size;
me->scratch_free = HALLOC_BLOCK_SIZE;
al_init( &me->children );
return &me->data;
}
}
void halloc_register_function( void *context, void (*func)(void *), void *data )
{
halloc_t *me;
if( !context )
return;
me = halloc_from_data( context );
al_push( &me->children, func );
al_push( &me->children, data );
}
void halloc_free( void *context )
{
halloc_t *me;
int i;
if( !context )
return;
me = halloc_from_data( context );
#ifdef HALLOC_DEBUG
alloc_spill += me->scratch_free;
#endif
for( i=0; i<al_get_count(&me->children); i+=2 )
{
void (*func)(void *) = (void (*)(void *))al_get( &me->children, i );
void * data = (void *)al_get( &me->children, i+1 );
if( func != &late_free )
func( data );
}
for( i=0; i<al_get_count(&me->children); i+=2 )
{
void (*func)(void *) = (void (*)(void *))al_get( &me->children, i );
void * data = (void *)al_get( &me->children, i+1 );
if( func == &late_free )
free( data );
}
al_destroy( &me->children );
free(me);
}

48
halloc.h Normal file
View File

@@ -0,0 +1,48 @@
/** \file halloc.h
A hierarchical memory allocation system. Works mostly like talloc
used in Samba, except that an arbitrary block allocated with
malloc() can be registered to be freed by halloc_free.
*/
#ifndef FISH_HALLOC_H
#define FISH_HALLOC_H
/**
Allocate new memory using specified parent memory context. Context
_must_ be either 0 or the result of a previous call to halloc.
If \c context is null, the resulting block is a root block, and
must be freed with a call to halloc_free().
If \c context is not null, context must be a halloc root block. the
resulting memory block is a child context, and must never be
explicitly freed, it will be automatically freed whenever the
parent context is freed. Child blocks can also never be used as the
context in calls to halloc_register_function, halloc_free, etc.
*/
void *halloc( void *context, size_t size );
/**
Make the specified function run whenever context is free'd, using data as argument.
\c context a halloc root block
*/
void halloc_register_function( void *context, void (*func)(void *), void *data );
/**
Free memory context and all children contexts. Only root contexts
may be freed explicitly.
All functions registered with halloc_register_function are run in
the order they where added. Afterwards, all memory allocated using
halloc itself is free'd.
\c context a halloc root block
*/
void halloc_free( void *context );
#endif

97
halloc_util.c Normal file
View File

@@ -0,0 +1,97 @@
/** \file halloc.c
A hierarchical memory allocation system. Works just like talloc
used in Samba, except that an arbitrary block allocated with
malloc() can be registered to be freed by halloc_free.
*/
#include "config.h"
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include "fallback.h"
#include "util.h"
#include "common.h"
#include "halloc.h"
void *global_context=0;
void halloc_util_init()
{
global_context = halloc( 0, 0 );
}
void halloc_util_destroy()
{
halloc_free( global_context );
}
array_list_t *al_halloc( void *context )
{
array_list_t *res = halloc( context, sizeof( array_list_t ) );
if( !res )
die_mem();
al_init( res );
halloc_register_function( context, (void (*)(void *)) &al_destroy, res );
return res;
}
string_buffer_t *sb_halloc( void *context )
{
string_buffer_t *res = halloc( context, sizeof( string_buffer_t ) );
if( !res )
die_mem();
sb_init( res );
halloc_register_function( context, (void (*)(void *)) &sb_destroy, res );
return res;
}
static void halloc_passthrough( void *f )
{
void (*func)() = (void (*)() )f;
func();
}
void halloc_register_function_void( void *context, void (*func)() )
{
halloc_register_function( context, &halloc_passthrough, (void *)func );
}
void *halloc_register( void *context, void *data )
{
if( !data )
return 0;
halloc_register_function( context, &free, data );
return data;
}
wchar_t *halloc_wcsdup( void *context, wchar_t *in )
{
size_t len=wcslen(in);
wchar_t *out = halloc( context, sizeof( wchar_t)*(len+1));
if( out == 0 )
{
die_mem();
}
memcpy( out, in, sizeof( wchar_t)*(len+1));
return out;
}
wchar_t *halloc_wcsndup( void * context, const wchar_t *in, int c )
{
wchar_t *res = halloc( context, sizeof(wchar_t)*(c+1) );
if( res == 0 )
{
die_mem();
}
wcslcpy( res, in, c+1 );
res[c] = L'\0';
return res;
}

66
halloc_util.h Normal file
View File

@@ -0,0 +1,66 @@
/**
\file halloc_util.h
Various halloc-related utility functions.
*/
#ifndef FISH_HALLOC_UTIL_H
#define FISH_HALLOC_UTIL_H
/**
This pointer is a valid halloc context that will be freed right
before program shutdown. It may be used to allocate memory that
should be freed when the program shuts down.
*/
extern void *global_context;
/**
Create the global_context halloc object
*/
void halloc_util_init();
/**
Free the global_context halloc object
*/
void halloc_util_destroy();
/**
Allocate a array_list_t that will be automatically disposed of when
the specified context is free'd
*/
array_list_t *al_halloc( void *context );
/**
Allocate a string_buffer_t that will be automatically disposed of
when the specified context is free'd
*/
string_buffer_t *sb_halloc( void *context );
/**
Register the specified function to run when the specified context
is free'd. This function is related to halloc_register_function,
but the specified function dowes not take an argument.
*/
void halloc_register_function_void( void *context, void (*func)() );
/**
Free the memory pointed to by \c data when the memory pointed to by
\c context is free:d. Note that this will _not_ turn the specified
memory area into a valid halloc context. Only memory areas created
using a call to halloc( 0, size ) can be used as a context.
*/
void *halloc_register( void *context, void *data );
/**
Make a copy of the specified string using memory allocated using
halloc and the specified context
*/
wchar_t *halloc_wcsdup( void *context, wchar_t *str );
/**
Make a copy of the specified substring using memory allocated using
halloc and the specified context
*/
wchar_t *halloc_wcsndup( void * context, const wchar_t *in, int c );
#endif

View File

@@ -12,12 +12,16 @@
#include <signal.h>
#include "config.h"
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "highlight.h"
#include "tokenizer.h"
#include "proc.h"
#include "parser.h"
#include "parse_util.h"
#include "builtin.h"
#include "function.h"
#include "env.h"
@@ -36,11 +40,10 @@ static void highlight_universal_internal( wchar_t * buff,
/**
The environment variables used to specify the color of different tokens.
*/
static wchar_t *hightlight_var[] =
static wchar_t *highlight_var[] =
{
L"fish_color_normal",
L"fish_color_command",
L"fish_color_subshell",
L"fish_color_redirection",
L"fish_color_end",
L"fish_color_error",
@@ -48,24 +51,24 @@ static wchar_t *hightlight_var[] =
L"fish_color_comment",
L"fish_color_match",
L"fish_color_search_match",
L"fish_color_pager_prefix",
L"fish_color_pager_completion",
L"fish_color_pager_description",
L"fish_color_pager_progress"
L"fish_color_operator",
L"fish_color_escape",
L"fish_color_quote"
}
;
#define VAR_COUNT ( sizeof(highlight_var)/sizeof(wchar_t *) )
int highlight_get_color( int highlight )
{
if( highlight < 0 )
return FISH_COLOR_NORMAL;
if( highlight >= (12) )
if( highlight >= VAR_COUNT )
return FISH_COLOR_NORMAL;
wchar_t *val = env_get( hightlight_var[highlight]);
wchar_t *val = env_get( highlight_var[highlight]);
if( val == 0 )
val = env_get( hightlight_var[HIGHLIGHT_NORMAL]);
val = env_get( highlight_var[HIGHLIGHT_NORMAL]);
if( val == 0 )
{
@@ -75,6 +78,289 @@ int highlight_get_color( int highlight )
return output_color_code( val );
}
/**
Highligt operators (such as $, ~, %, as well as escaped characters.
*/
static void highlight_param( const wchar_t * buff,
int *color,
int pos,
array_list_t *error )
{
int mode = 0;
int in_pos, len = wcslen( buff );
int bracket_count=0;
wchar_t c;
for( in_pos=0;
in_pos<len;
in_pos++ )
{
c = buff[in_pos];
switch( mode )
{
/*
Mode 0 means unquoted string
*/
case 0:
{
if( c == L'\\' )
{
int start_pos = in_pos;
in_pos++;
if( wcschr( L"~%", buff[in_pos] ) )
{
if( in_pos == 1 )
{
color[start_pos] = HIGHLIGHT_ESCAPE;
color[in_pos+1] = HIGHLIGHT_NORMAL;
}
}
else if( buff[in_pos]==L',' )
{
if( bracket_count )
{
color[start_pos] = HIGHLIGHT_ESCAPE;
color[in_pos+1] = HIGHLIGHT_NORMAL;
}
}
else if( wcschr( L"nrtbe*?$(){}'\"<>^ \\#;|&", buff[in_pos] ) )
{
color[start_pos]=HIGHLIGHT_ESCAPE;
color[in_pos+1]=HIGHLIGHT_NORMAL;
}
else if( wcschr( L"uUxX01234567", buff[in_pos] ) )
{
int i;
long long res=0;
int chars=2;
int base=16;
int byte = 0;
wchar_t max_val = ASCII_MAX;
switch( buff[in_pos] )
{
case L'u':
{
chars=4;
max_val = UCS2_MAX;
break;
}
case L'U':
{
chars=8;
max_val = WCHAR_MAX;
break;
}
case L'x':
{
break;
}
case L'X':
{
byte=1;
max_val = BYTE_MAX;
break;
}
default:
{
base=8;
chars=3;
in_pos--;
break;
}
}
for( i=0; i<chars; i++ )
{
int d = convert_digit( buff[++in_pos],base);
if( d < 0 )
{
in_pos--;
break;
}
res=(res*base)|d;
}
if( (res <= max_val) )
{
color[start_pos] = HIGHLIGHT_ESCAPE;
color[in_pos+1] = HIGHLIGHT_NORMAL;
}
else
{
color[start_pos] = HIGHLIGHT_ERROR;
color[in_pos+1] = HIGHLIGHT_NORMAL;
}
}
}
else
{
switch( buff[in_pos]){
case L'~':
case L'%':
{
if( in_pos == 0 )
{
color[in_pos] = HIGHLIGHT_OPERATOR;
color[in_pos+1] = HIGHLIGHT_NORMAL;
}
break;
}
case L'*':
case L'?':
case L'$':
case L'(':
case L')':
{
color[in_pos] = HIGHLIGHT_OPERATOR;
color[in_pos+1] = HIGHLIGHT_NORMAL;
break;
}
case L'{':
{
color[in_pos] = HIGHLIGHT_OPERATOR;
color[in_pos+1] = HIGHLIGHT_NORMAL;
bracket_count++;
break;
}
case L'}':
{
color[in_pos] = HIGHLIGHT_OPERATOR;
color[in_pos+1] = HIGHLIGHT_NORMAL;
bracket_count--;
break;
}
case L',':
{
if( bracket_count )
{
color[in_pos] = HIGHLIGHT_OPERATOR;
color[in_pos+1] = HIGHLIGHT_NORMAL;
}
break;
}
case L'\'':
{
color[in_pos] = HIGHLIGHT_QUOTE;
mode = 1;
break;
}
case L'\"':
{
color[in_pos] = HIGHLIGHT_QUOTE;
mode = 2;
break;
}
}
}
break;
}
/*
Mode 1 means single quoted string, i.e 'foo'
*/
case 1:
{
if( c == L'\\' )
{
int start_pos = in_pos;
switch( buff[++in_pos] )
{
case '\\':
case L'\'':
{
color[start_pos] = HIGHLIGHT_ESCAPE;
color[in_pos+1] = HIGHLIGHT_QUOTE;
break;
}
case 0:
{
return;
}
}
}
if( c == L'\'' )
{
mode = 0;
color[in_pos+1] = HIGHLIGHT_NORMAL;
}
break;
}
/*
Mode 2 means double quoted string, i.e. "foo"
*/
case 2:
{
switch( c )
{
case '"':
{
mode = 0;
color[in_pos+1] = HIGHLIGHT_NORMAL;
break;
}
case '\\':
{
int start_pos = in_pos;
switch( buff[++in_pos] )
{
case L'\0':
{
return;
}
case '\\':
case L'$':
case '"':
{
color[start_pos] = HIGHLIGHT_ESCAPE;
color[in_pos+1] = HIGHLIGHT_QUOTE;
break;
}
}
break;
}
case '$':
{
color[in_pos] = HIGHLIGHT_OPERATOR;
color[in_pos+1] = HIGHLIGHT_QUOTE;
break;
}
}
break;
}
}
}
}
void highlight_shell( wchar_t * buff,
int *color,
@@ -121,6 +407,12 @@ void highlight_shell( wchar_t * buff,
{
color[ tok_get_pos( &tok ) ] = HIGHLIGHT_PARAM;
}
highlight_param( param,
&color[tok_get_pos( &tok )],
pos-tok_get_pos( &tok ),
error );
}
else
{
@@ -129,10 +421,10 @@ void highlight_shell( wchar_t * buff,
/*
Command. First check that the command actually exists.
*/
wchar_t *cmd =
(last_type == TOK_STRING) ?
expand_one(wcsdup(tok_last( &tok )),EXPAND_SKIP_SUBSHELL | EXPAND_SKIP_VARIABLES) :
wcsdup(tok_last( &tok ));
wchar_t *cmd = expand_one( 0,
wcsdup(tok_last( &tok )),
EXPAND_SKIP_SUBSHELL | EXPAND_SKIP_VARIABLES);
if( cmd == 0 )
{
color[ tok_get_pos( &tok ) ] = HIGHLIGHT_ERROR;
@@ -144,7 +436,6 @@ void highlight_shell( wchar_t * buff,
int is_subcommand = 0;
int mark = tok_get_pos( &tok );
color[ tok_get_pos( &tok ) ] = HIGHLIGHT_COMMAND;
if( parser_is_subcommand( cmd ) )
{
@@ -247,7 +538,7 @@ void highlight_shell( wchar_t * buff,
{
case TOK_STRING:
{
target = expand_one( wcsdup( tok_last( &tok ) ), EXPAND_SKIP_SUBSHELL);
target = expand_one( 0, wcsdup( tok_last( &tok ) ), EXPAND_SKIP_SUBSHELL);
/*
Redirect filename may contain a subshell.
If so, it will be ignored/not flagged.
@@ -365,11 +656,11 @@ void highlight_shell( wchar_t * buff,
while( 1 )
{
wchar_t *begin, *end;
if( expand_locate_subshell( subpos,
&begin,
&end,
1) <= 0)
if( parse_util_locate_cmdsubst( subpos,
(const wchar_t **)&begin,
(const wchar_t **)&end,
1) <= 0)
{
break;
}
@@ -380,7 +671,7 @@ void highlight_shell( wchar_t * buff,
*end=0;
highlight_shell( begin+1, color +(begin-buffcpy)+1, -1, error );
color[end-buffcpy]=HIGHLIGHT_PARAM;
color[end-buffcpy]=HIGHLIGHT_OPERATOR;
if( done )
break;

View File

@@ -12,13 +12,17 @@
#include "config.h"
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "history.h"
#include "common.h"
#include "reader.h"
#include "env.h"
#include "sanity.h"
#include "signal.h"
/*
The history is implemented using a linked list. Searches are done
@@ -45,6 +49,8 @@ typedef struct
The last item loaded from file
*/
ll_node_t *last_loaded;
int is_loaded;
}
history_data;
@@ -82,25 +88,31 @@ static wchar_t *mode_name;
*/
static hash_table_t history_table;
/**
Flag, set to 1 once the history file has been loaded
*/
static int is_loaded;
/**
Load history from ~/.fish_history
Load history from file
*/
static void history_load( wchar_t *name )
static void history_load()
{
wchar_t *fn;
wchar_t *buff=0;
int buff_len=0;
FILE *in_stream;
hash_table_t used;
block();
is_loaded = 1;
signal_block();
hash_init2( &used,
&hash_wcs_func,
&hash_wcs_cmp,
4096 );
fn = wcsdupcat2( env_get(L"HOME"), L"/.", name, L"_history", 0 );
fn = wcsdupcat2( env_get(L"HOME"), L"/.", mode_name, L"_history", 0 );
in_stream = wfopen( fn, "r" );
@@ -111,12 +123,12 @@ static void history_load( wchar_t *name )
int buff_read = fgetws2( &buff, &buff_len, in_stream );
if( buff_read == -1 )
{
debug( 1, L"The following non-fatal error occurred while reading command history from \'%ls\':", name );
debug( 1, L"The following non-fatal error occurred while reading command history from \'%ls\':", mode_name );
wperror( L"fgetws2" );
fclose( in_stream );
free( fn );
free( buff );
unblock();
signal_unblock();
return;
}
@@ -127,8 +139,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++;
@@ -161,7 +173,7 @@ static void history_load( wchar_t *name )
{
if( errno != ENOENT )
{
debug( 1, L"The following non-fatal error occurred while reading command history from \'%ls\':", name );
debug( 1, L"The following non-fatal error occurred while reading command history from \'%ls\':", mode_name );
wperror( L"fopen" );
}
@@ -173,7 +185,7 @@ static void history_load( wchar_t *name )
free( buff );
free( fn );
last_loaded = history_last;
unblock();
signal_unblock();
}
void history_init()
@@ -190,6 +202,10 @@ static void history_to_hash()
{
history_data *d;
if( !history_last )
return;
d = (history_data *)hash_get( &history_table,
mode_name );
@@ -198,6 +214,7 @@ static void history_to_hash()
d->last=history_last;
d->last_loaded=last_loaded;
d->count=history_count;
d->is_loaded = is_loaded;
hash_put( &history_table,
mode_name,
@@ -223,13 +240,14 @@ void history_set_mode( wchar_t *name )
history_current = history_last = curr->last;
last_loaded = curr->last_loaded;
history_count = curr->count;
is_loaded = curr->is_loaded;
}
else
{
history_count=0;
history_last = history_current = last_loaded=0;
mode_name = wcsdup( name );
history_load( name );
is_loaded = 0;
}
past_end=1;
@@ -259,6 +277,9 @@ static void history_save()
/* First we save this sessions history in local variables */
ll_node_t *real_pos = history_last, *real_first = last_loaded;
if( !is_loaded )
return;
if( !real_first )
{
real_first = history_current;
@@ -274,7 +295,7 @@ static void history_save()
history_count=0;
past_end=1;
history_load( mode_name );
history_load();
if( real_pos != 0 )
{
/*
@@ -390,6 +411,9 @@ void history_destroy()
*/
static ll_node_t *history_find( ll_node_t *n, const wchar_t *s )
{
if( !is_loaded )
history_load();
if( n == 0 )
return 0;
@@ -406,6 +430,9 @@ void history_add( const wchar_t *str )
{
ll_node_t *old_node;
if( !is_loaded )
history_load();
if( wcslen( str ) == 0 )
return;
@@ -460,15 +487,15 @@ static int history_test( const wchar_t *needle, const wchar_t *haystack )
const wchar_t *history_prev_match( const wchar_t *str )
{
if( !is_loaded )
history_load();
if( history_current == 0 )
return str;
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;
@@ -484,6 +511,9 @@ const wchar_t *history_prev_match( const wchar_t *str )
const wchar_t *history_next_match( const wchar_t *str)
{
if( !is_loaded )
history_load();
if( history_current == 0 )
return str;
@@ -510,15 +540,21 @@ void history_reset()
*/
void history_first()
{
while( history_current->prev )
history_current = history_current->prev;
if( is_loaded )
while( history_current->prev )
history_current = history_current->prev;
}
wchar_t *history_get( int idx )
{
ll_node_t *n=history_last;
ll_node_t *n;
int i;
if( !is_loaded )
history_load();
n = history_last;
if( idx<0)
{
debug( 1, L"Tried to access negative history index %d", idx );

View File

@@ -8,7 +8,8 @@
#include <wchar.h>
/**
Load history from file.
Init history library. The history file won't actually be loaded
until the first time a history search is performed.
*/
void history_init();

View File

@@ -1,8 +0,0 @@
#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"

View File

@@ -1,21 +0,0 @@
function __fish_complete_apropos
if test (commandline -ct)
set str (commandline -ct)
apropos $str|sed -e "s/^\(.*$str\([^ ]*\).*\)$/$str\2\t\1/"
end
end
complete -xc apropos -a '(__fish_complete_apropos)' -d "Whatis entry"
complete -c apropos -s h -l help -d "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"

View File

@@ -1,29 +0,0 @@
#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"

View File

@@ -1,33 +0,0 @@
#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"

View File

@@ -1,13 +0,0 @@
#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"

View File

@@ -1,7 +0,0 @@
#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"

View File

@@ -1,7 +0,0 @@
#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"

View File

@@ -1,17 +0,0 @@
#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"

View File

@@ -1,17 +0,0 @@
#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"

View File

@@ -1,64 +0,0 @@
#completion for apt-get
function __fish_apt_no_subcommand -d 'test if apt has yet to be given the subcommand'
for i in (commandline -opc)
if contains -- $i update upgrade dselect-upgrade dist-upgrade install remove source build-dep check clean autoclean
return 1
end
end
return 0
end
function __fish_apt_use_package -d 'Test if apt command should have packages as potential completion'
for i in (commandline -opc)
if contains -- $i contains install remove build-dep
return 0
end
end
return 1
end
complete -c apt-get -n '__fish_apt_use_package' -a '(__fish_print_packages)' -d 'Package'
complete -c apt-get -s h -l help -d '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'

View File

@@ -1,5 +0,0 @@
#apt-key
complete -r -c apt-key -a add -d "add a new key"
complete -f -c apt-key -a del -d "remove a key"
complete -f -c apt-key -a list -d "list trusted keys"

View File

@@ -1,25 +0,0 @@
#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"

View File

@@ -1,13 +0,0 @@
#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"

View File

@@ -1,23 +0,0 @@
#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 -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"

View File

@@ -1,10 +0,0 @@
#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]'

View File

@@ -1,13 +0,0 @@
#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"

View File

@@ -1,4 +0,0 @@
#apt-setup
complete -c apt-setup -a probe -d "probe a CD"
complete -c apt-setup -s N -d "run in noninteractive mode"

View File

@@ -1,10 +0,0 @@
#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'

View File

@@ -1,14 +0,0 @@
#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'

View File

@@ -1,7 +0,0 @@
#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"

View File

@@ -1,20 +0,0 @@
#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"

View File

@@ -1,24 +0,0 @@
#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"

View File

@@ -1,10 +0,0 @@
#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"

View File

@@ -1,13 +0,0 @@
#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"

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