Compare commits

..

179 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
234 changed files with 9047 additions and 6106 deletions

13
INSTALL
View File

@@ -2,11 +2,12 @@
Known issues
============
Fish currently requires a semi-modern GCC version to
compile. Specifically, GCC 2.95.* won't compile fish, but GCC 3.23
should work. Fish has not been coded with an C99- or GNU-specific
features in mind, so it is hoped that it should be possible to make
fish work with other compilers. Patches are welcome.
Fish is developed using GCC, with the goal of using only C89 language
features. Fish does, however use the *wprintf family of functions,
which are new to the C99 standrard. It is not unlikely that any given
release contains a few GCC:isms, but ICC 9.0.030 has been found to
produce working binaries. GCC 2.95.* won't compile fish, but GCC 3.2.3
is known to work. Patches to fix any remaining GNU:isms are welcome.
Older versions of Doxygen has bugs in the man-page generation which
cause the builtin help to render incorrectly. Doxygen 1.2.14 is known
@@ -52,7 +53,7 @@ Local install procedure
=======================
If you have downloaded the darcs repository of fish, you need to run
autoconf first.
autoconf to generate the configure script.
To install fish in your own home directory (typically as non-root),
type:

View File

@@ -36,8 +36,7 @@
CC := @CC@
INSTALL:=@INSTALL@
# Compiler flags
CFLAGS:=@CFLAGS@ -Wall -std=gnu99 -fno-strict-aliasing
CFLAGS:=@CFLAGS@
CPPFLAGS=@CPPFLAGS@
LDFLAGS:= @LIBS@ @LDFLAGS@
@@ -57,7 +56,7 @@ 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
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.
@@ -73,7 +72,7 @@ COMMON_OBJS_WITH_HEADER := builtin_help.o
# main.c exists, but main.h does not, etc.
COMMON_OBJS_WITH_CODE := builtin_set.o builtin_commandline.o \
builtin_ulimit.c builtin_complete.o
builtin_ulimit.o builtin_complete.o builtin_jobs.o
# All objects that the system needs to build fish
FISH_OBJS := $(COMMON_OBJS) $(COMMON_OBJS_WITH_CODE) \
@@ -94,7 +93,7 @@ FISHD_OBJS := fishd.o env_universal_common.o wutil.o \
# All objects needed to build mimedb
MIME_OBJS := mimedb.o xdgmimealias.o xdgmime.o xdgmimeglob.o \
xdgmimeint.o xdgmimemagic.o xdgmimeparent.o wutil.o
xdgmimeint.o xdgmimemagic.o xdgmimeparent.o wutil.o $(CORE_OBJS)
#
# Files containing documentation for builtins. Should be listed
@@ -165,14 +164,16 @@ ETC_DIR_FILES :=etc/fish.in etc/fish_inputrc \
etc/fish_interactive.fish.in
# Files in ./share/
SHARE_DIR_FILES :=share/fish
SHARE_DIR_FILES :=share/fish.in
# Files in ./tests/
TESTS_DIR_FILES := $(TEST_IN) $(TEST_IN:.in=.out) $(TEST_IN:.in=.err) \
$(TEST_IN:.in=.status) tests/test.fish tests/gen_output.fish
# Files in ./share/completions/
COMPLETIONS_DIR_FILES := $(wildcard share/completions/*.fish)
# Files in ./share/functions/
FUNCTIONS_DIR_FILES := $(wildcard share/functions/*.fish)
# Programs to build
@@ -196,8 +197,14 @@ all: $(PROGRAMS) user_doc
@echo Use \'make install\' to install fish.
.PHONY: all
configure: configure.ac
./config.status --recheck
Makefile: Makefile.in configure
./config.status
debug:
make fish CFLAGS="-O0 -Wno-unused -Werror -g -Wall -std=gnu99 -fno-strict-aliasing"
make fish CFLAGS="@CFLAGS@ -O0 -Wno-unused -Werror -g"
.PHONY: debug
# User documentation, describing the features of the fish shell.
@@ -268,8 +275,8 @@ doc.h:$(BUILTIN_DOC_SRC) $(CMD_DOC_SRC) doc_src/doc.hdr
# 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_ -kcomplete_desc *.c *.h -o messages.pot; \
if ! xgettext -j -k_ -LShell etc/*.in share/fish share/completions/*.fish share/functions/*.fish seq -o messages.pot; then \
xgettext -k_ -kN_ *.c *.h -o messages.pot; \
if ! xgettext -j -k_ -kN_ -LShell etc/*.in share/fish share/completions/*.fish share/functions/*.fish seq -o messages.pot; then \
echo "Your xgettext version is too old to build the messages.pot file"\
rm messages.pot\
false;\
@@ -337,7 +344,6 @@ builtin_help.c: $(BUILTIN_DOC_HDR) doc_src/count.doxygen gen_hdr2 gen_hdr.sh bui
./gen_hdr.sh $*.doxygen >>$@
echo ");" >>$@
echo "}" >>$@
#man -- doc_src/builtin_doc/man/man1/`basename $@ .c`.1 | cat -s | ./gen_hdr2 >>$@
#
# The build rules for installing/uninstalling fish
@@ -406,7 +412,7 @@ install-force: all install-translations
@echo \* use the command \'chsh -s $(DESTDIR)$(bindir)/fish\'.
@echo
@echo Have fun!
.PHONY: force-install
.PHONY: install-force
# Uninstall this fish version
@@ -447,6 +453,8 @@ uninstall-legacy: uninstall
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 \
@@ -483,25 +491,26 @@ 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 $@
set_color: set_color.o doc_src/set_color.o
$(CC) set_color.o doc_src/set_color.o $(LDFLAGS) -o $@
# Test program for the tokenizer library
tokenizer_test: tokenizer.c tokenizer.h util.o wutil.o common.o
$(CC) ${CFLAGS} tokenizer.c util.o wutil.o common.o -D TOKENIZER_TEST $(LDFLAGS) -o $@
# Neat little program to show output from terminal
key_reader: key_reader.o input_common.o common.o env_universal.o env_universal_common.o util.o wutil.o
$(CC) key_reader.o input_common.o common.o env_universal.o env_universal_common.o util.o wutil.o $(LDFLAGS) -o $@
key_reader: key_reader.o input_common.o $(CORE_OBJS) env_universal.o env_universal_common.o wutil.o
$(CC) key_reader.o input_common.o $(CORE_OBJS) env_universal.o env_universal_common.o wutil.o $(LDFLAGS) -o $@
#
# Update dependencies
#
depend:
makedepend -fMakefile.in -Y *.c
./config.status
.PHONY: depend
# Copy all the source files into a new directory and use tar to create
@@ -531,15 +540,27 @@ fish-@PACKAGE_VERSION@.tar: $(DOC_SRC_DIR_FILES) $(MAIN_DIR_FILES) $(ETC_DIR_FIL
tar -c fish-@PACKAGE_VERSION@ >fish-@PACKAGE_VERSION@.tar
rm -rf fish-@PACKAGE_VERSION@
tar: fish-@PACKAGE_VERSION@.tar
.PHONY: tar
fish-@PACKAGE_VERSION@.tar.gz: fish-@PACKAGE_VERSION@.tar
gzip -f --best -c fish-@PACKAGE_VERSION@.tar >fish-@PACKAGE_VERSION@.tar.gz
fish-@PACKAGE_VERSION@.tar.bz2: fish-@PACKAGE_VERSION@.tar
bzip2 -f --best -k fish-@PACKAGE_VERSION@.tar
dist: fish-@PACKAGE_VERSION@.tar.bz2
.PHONY: dist
# Create .rpm file for the current systems architecture and an
# .src.rpm file.
rpm: fish-@PACKAGE_VERSION@.tar.bz2
@if ! which rpmbuild; then \
echo Could not find the rpmbuild command, needed to build an rpm; \
echo You may be able to install it using the following command:; \
echo \'yum install rpm-build\'; \
false; \
fi
cp fish.spec /usr/src/redhat/SPECS/
cp fish-@PACKAGE_VERSION@.tar.bz2 /usr/src/redhat/SOURCES/
rpmbuild -ba --clean /usr/src/redhat/SPECS/fish.spec
@@ -553,15 +574,15 @@ rpm: fish-@PACKAGE_VERSION@.tar.bz2
distclean: clean
rm -f fish.spec doc_src/fish.1 doc_src/Doxyfile
rm -f etc/fish etc/fish_interactive.fish share/fish
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 *.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
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
@@ -575,105 +596,112 @@ clean:
# DO NOT DELETE THIS LINE -- make depend depends on it.
builtin.o: config.h util.h wutil.h builtin.h function.h complete.h proc.h
builtin.o: io.h parser.h event.h reader.h env.h common.h wgetopt.h sanity.h
builtin.o: tokenizer.h builtin_help.h wildcard.h input_common.h input.h
builtin.o: intern.h signal.h translate.h halloc.h halloc_util.h parse_util.h
builtin.o: expand.h
builtin_commandline.o: signal.h config.h util.h wutil.h builtin.h common.h
builtin_commandline.o: wgetopt.h reader.h proc.h io.h parser.h event.h
builtin_commandline.o: tokenizer.h input_common.h input.h translate.h
builtin.o: config.h fallback.h common.h util.h wutil.h builtin.h function.h
builtin.o: complete.h proc.h io.h parser.h event.h reader.h env.h wgetopt.h
builtin.o: sanity.h tokenizer.h builtin_help.h wildcard.h input_common.h
builtin.o: input.h intern.h signal.h translate.h halloc.h halloc_util.h
builtin.o: parse_util.h expand.h
builtin_commandline.o: signal.h config.h fallback.h common.h util.h wutil.h
builtin_commandline.o: builtin.h wgetopt.h reader.h proc.h io.h parser.h
builtin_commandline.o: event.h tokenizer.h input_common.h input.h translate.h
builtin_commandline.o: parse_util.h
builtin_complete.o: signal.h config.h util.h wutil.h builtin.h common.h
builtin_complete.o: complete.h wgetopt.h parser.h proc.h io.h event.h
builtin_complete.o: reader.h translate.h
builtin_complete.o: signal.h config.h fallback.h common.h util.h wutil.h
builtin_complete.o: builtin.h complete.h wgetopt.h parser.h proc.h io.h
builtin_complete.o: event.h reader.h translate.h
builtin_help.o: config.h util.h common.h builtin_help.h
builtin_set.o: signal.h config.h util.h wutil.h builtin.h env.h expand.h
builtin_set.o: common.h wgetopt.h proc.h io.h parser.h event.h translate.h
builtin_ulimit.o: config.h util.h builtin.h common.h wgetopt.h translate.h
common.o: config.h util.h wutil.h common.h expand.h proc.h io.h wildcard.h
common.o: parser.h event.h
complete.o: signal.h config.h util.h tokenizer.h wildcard.h proc.h io.h
complete.o: parser.h event.h function.h complete.h builtin.h env.h exec.h
complete.o: expand.h common.h reader.h history.h intern.h translate.h
complete.o: parse_util.h halloc_util.h wutil.h
env.o: config.h signal.h util.h wutil.h proc.h io.h common.h env.h sanity.h
env.o: expand.h history.h reader.h parser.h event.h env_universal.h
builtin_set.o: signal.h config.h fallback.h common.h util.h wutil.h builtin.h
builtin_set.o: env.h expand.h wgetopt.h proc.h io.h parser.h event.h
builtin_set.o: translate.h
builtin_ulimit.o: config.h fallback.h common.h util.h builtin.h wgetopt.h
builtin_ulimit.o: translate.h
common.o: config.h fallback.h common.h util.h wutil.h expand.h proc.h io.h
common.o: wildcard.h parser.h event.h
complete.o: signal.h config.h fallback.h common.h util.h tokenizer.h
complete.o: wildcard.h proc.h io.h parser.h event.h function.h complete.h
complete.o: builtin.h env.h exec.h expand.h reader.h history.h intern.h
complete.o: translate.h parse_util.h halloc_util.h wutil.h
env.o: config.h signal.h fallback.h common.h util.h wutil.h proc.h io.h env.h
env.o: sanity.h expand.h history.h reader.h parser.h event.h env_universal.h
env.o: env_universal_common.h input_common.h translate.h complete.h
env_universal.o: config.h signal.h util.h common.h wutil.h
env_universal.o: config.h signal.h fallback.h common.h util.h wutil.h
env_universal.o: env_universal_common.h env_universal.h
env_universal_common.o: config.h signal.h util.h common.h wutil.h
env_universal_common.o: config.h signal.h fallback.h common.h util.h wutil.h
env_universal_common.o: env_universal_common.h
event.o: signal.h config.h util.h wutil.h function.h proc.h io.h parser.h
event.o: event.h common.h translate.h halloc_util.h
exec.o: signal.h config.h util.h common.h wutil.h proc.h io.h exec.h parser.h
exec.o: event.h builtin.h function.h env.h wildcard.h sanity.h expand.h
exec.o: env_universal.h env_universal_common.h translate.h halloc.h
exec.o: halloc_util.h parse_util.h
expand.o: signal.h config.h util.h common.h wutil.h env.h proc.h io.h
expand.o: parser.h event.h expand.h wildcard.h exec.h tokenizer.h complete.h
expand.o: translate.h parse_util.h halloc_util.h
fishd.o: config.h signal.h util.h common.h wutil.h env_universal_common.h
fish_pager.o: config.h signal.h util.h wutil.h common.h complete.h output.h
fish_pager.o: input_common.h env_universal.h env_universal_common.h halloc.h
fish_pager.o: halloc_util.h
fish_tests.o: config.h signal.h util.h common.h proc.h io.h reader.h
fish_tests.o: builtin.h function.h complete.h wutil.h env.h expand.h parser.h
fish_tests.o: event.h tokenizer.h output.h exec.h halloc_util.h
function.o: signal.h config.h wutil.h util.h function.h proc.h io.h parser.h
function.o: event.h common.h intern.h reader.h parse_util.h env.h expand.h
halloc.o: config.h util.h common.h halloc.h
halloc_util.o: config.h util.h common.h halloc.h
highlight.o: signal.h config.h util.h wutil.h highlight.h tokenizer.h proc.h
highlight.o: io.h parser.h event.h parse_util.h builtin.h function.h env.h
highlight.o: expand.h sanity.h common.h complete.h output.h
history.o: config.h util.h wutil.h history.h common.h reader.h env.h sanity.h
history.o: signal.h
input.o: config.h signal.h util.h wutil.h reader.h proc.h io.h common.h
input.o: sanity.h input_common.h input.h parser.h event.h env.h expand.h
event.o: signal.h config.h fallback.h common.h util.h wutil.h function.h
event.o: proc.h io.h parser.h event.h translate.h halloc_util.h
exec.o: signal.h config.h fallback.h common.h util.h wutil.h proc.h io.h
exec.o: exec.h parser.h event.h builtin.h function.h env.h wildcard.h
exec.o: sanity.h expand.h env_universal.h env_universal_common.h translate.h
exec.o: halloc.h halloc_util.h parse_util.h
expand.o: signal.h config.h fallback.h common.h util.h wutil.h env.h proc.h
expand.o: io.h parser.h event.h expand.h wildcard.h exec.h tokenizer.h
expand.o: complete.h translate.h parse_util.h halloc_util.h
fallback.o: config.h 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 util.h common.h wutil.h input_common.h
input_common.o: config.h fallback.h common.h util.h wutil.h input_common.h
input_common.o: env_universal.h env_universal_common.h
intern.o: config.h util.h wutil.h common.h intern.h
io.o: config.h util.h wutil.h exec.h proc.h io.h common.h translate.h
io.o: halloc.h
key_reader.o: input_common.h
kill.o: signal.h config.h util.h wutil.h kill.h proc.h io.h sanity.h common.h
kill.o: env.h exec.h parser.h event.h
main.o: config.h signal.h util.h common.h reader.h builtin.h function.h
main.o: complete.h wutil.h env.h sanity.h proc.h io.h parser.h event.h
main.o: expand.h intern.h exec.h output.h translate.h halloc_util.h
mimedb.o: config.h xdgmime.h util.h
output.o: config.h signal.h util.h wutil.h expand.h common.h output.h
output.o: halloc_util.h highlight.h
parser.o: signal.h config.h util.h common.h wutil.h proc.h io.h parser.h
parser.o: event.h tokenizer.h exec.h wildcard.h function.h builtin.h
intern.o: config.h fallback.h common.h util.h wutil.h intern.h
io.o: config.h fallback.h common.h util.h wutil.h exec.h proc.h io.h
io.o: translate.h halloc.h
key_reader.o: fallback.h common.h util.h input_common.h
kill.o: signal.h config.h fallback.h common.h util.h wutil.h kill.h proc.h
kill.o: io.h sanity.h env.h exec.h parser.h event.h
main.o: config.h signal.h fallback.h common.h util.h reader.h builtin.h
main.o: function.h complete.h wutil.h env.h sanity.h proc.h io.h parser.h
main.o: event.h expand.h intern.h exec.h output.h translate.h halloc_util.h
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 util.h wutil.h common.h tokenizer.h parse_util.h
parse_util.o: expand.h intern.h exec.h proc.h io.h env.h halloc_util.h
proc.o: config.h signal.h util.h wutil.h proc.h io.h common.h reader.h
proc.o: sanity.h env.h parser.h event.h translate.h halloc.h halloc_util.h
proc.o: output.h
reader.o: config.h signal.h util.h wutil.h highlight.h reader.h proc.h io.h
reader.o: parser.h event.h complete.h history.h common.h sanity.h env.h
reader.o: exec.h expand.h tokenizer.h kill.h input_common.h input.h
parse_util.o: config.h fallback.h common.h util.h wutil.h tokenizer.h
parse_util.o: parse_util.h expand.h intern.h exec.h proc.h io.h env.h
parse_util.o: wildcard.h halloc_util.h
proc.o: config.h signal.h fallback.h common.h util.h wutil.h proc.h io.h
proc.o: reader.h sanity.h env.h parser.h event.h translate.h halloc.h
proc.o: halloc_util.h output.h
reader.o: config.h signal.h fallback.h common.h util.h wutil.h highlight.h
reader.o: reader.h proc.h io.h parser.h event.h complete.h history.h sanity.h
reader.o: env.h exec.h expand.h tokenizer.h kill.h input_common.h input.h
reader.o: function.h output.h translate.h parse_util.h
refcount.o: config.h util.h wutil.h common.h refcount.h
sanity.o: signal.h config.h util.h common.h sanity.h proc.h io.h history.h
sanity.o: reader.h kill.h wutil.h translate.h
refcount.o: config.h fallback.h common.h util.h wutil.h refcount.h
sanity.o: signal.h config.h fallback.h common.h util.h sanity.h proc.h io.h
sanity.o: history.h reader.h kill.h wutil.h translate.h
set_color.o: config.h
signal.o: config.h signal.h common.h util.h wutil.h event.h reader.h proc.h
signal.o: io.h translate.h
tokenizer.o: config.h util.h wutil.h tokenizer.h common.h wildcard.h
tokenizer.o: translate.h
translate.o: config.h common.h util.h halloc_util.h
util.o: config.h util.h common.h wutil.h
wgetopt.o: config.h wgetopt.h wutil.h translate.h
wildcard.o: config.h util.h wutil.h complete.h common.h wildcard.h reader.h
wildcard.o: expand.h translate.h
wutil.o: config.h util.h common.h wutil.h
signal.o: config.h signal.h common.h util.h fallback.h wutil.h event.h
signal.o: reader.h proc.h io.h translate.h
tokenizer.o: config.h fallback.h common.h util.h wutil.h tokenizer.h
tokenizer.o: wildcard.h translate.h
translate.o: config.h common.h util.h fallback.h halloc_util.h
util.o: config.h fallback.h common.h util.h wutil.h
wgetopt.o: config.h wgetopt.h wutil.h fallback.h common.h util.h translate.h
wildcard.o: config.h fallback.h common.h util.h wutil.h complete.h wildcard.h
wildcard.o: reader.h expand.h translate.h
wutil.o: config.h fallback.h common.h util.h wutil.h
xdgmimealias.o: xdgmimealias.h xdgmime.h xdgmimeint.h
xdgmime.o: xdgmime.h xdgmimeint.h xdgmimeglob.h xdgmimemagic.h xdgmimealias.h
xdgmime.o: xdgmimeparent.h

614
builtin.c
View File

@@ -38,7 +38,10 @@
#include <time.h>
#include "config.h"
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "builtin.h"
#include "function.h"
@@ -89,18 +92,6 @@ typedef struct builtin_data
builtin_data_t;
/**
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 */
}
;
/**
Table of all builtins
*/
@@ -156,6 +147,15 @@ void builtin_wperror( const wchar_t *s)
}
}
static int count_char( const wchar_t *str, wchar_t c )
{
int res = 0;
for( ; *str; str++ )
{
res += (*str==c);
}
return res;
}
/*
Here follows the definition of all builtin commands. The function
@@ -167,10 +167,12 @@ void builtin_wperror( const wchar_t *s)
are part of the parser. (They are not parsed as commands, instead
they only slightly alter the parser state)
If \c b is the buffer representing standard error, and the help
message is about to be printed to an interactive screen, it may be
shortened to fit the screen.
*/
void builtin_print_help( wchar_t *cmd, string_buffer_t *b )
{
const char *h;
@@ -186,11 +188,50 @@ void builtin_print_help( wchar_t *cmd, string_buffer_t *b )
if( !h )
return;
wchar_t *str = str2wcs(builtin_help_get( cmd ));
wchar_t *str = str2wcs( h );
if( str )
{
if( is_interactive && !builtin_out_redirect && b==sb_err)
{
/* Interactive mode help to screen - only print synopsis if the rest won't fit */
int screen_height, lines;
screen_height = common_get_height();
lines = count_char( str, L'\n' );
if( lines > 2*screen_height/3 )
{
wchar_t *pos;
/* Find first empty line */
for( pos=str; *pos; pos++ )
{
if( *pos == L'\n' )
{
wchar_t *pos2;
int is_empty = 1;
for( pos2 = pos+1; *pos2; pos2++ )
{
if( *pos2 == L'\n' )
break;
if( *pos2 != L'\t' && *pos2 !=L' ' )
{
is_empty = 0;
break;
}
}
if( is_empty )
{
*(pos+1)=L'\0';
}
}
}
}
}
sb_append( b, str );
free( str );
}
@@ -212,6 +253,10 @@ static int builtin_bind( wchar_t **argv )
L"set-mode", required_argument, 0, 'M'
}
,
{
L"help", no_argument, 0, 'h'
}
,
{
0, 0, 0, 0
}
@@ -224,7 +269,7 @@ static int builtin_bind( wchar_t **argv )
int opt = wgetopt_long( argc,
argv,
L"M:",
L"M:h",
long_options,
&opt_index );
if( opt == -1 )
@@ -247,6 +292,10 @@ static int builtin_bind( wchar_t **argv )
input_set_mode( woptarg );
break;
case 'h':
builtin_print_help( argv[0], sb_out );
return 0;
case '?':
builtin_print_help( argv[0], sb_err );
@@ -334,7 +383,7 @@ static int builtin_block( wchar_t **argv )
return 1;
case 'h':
builtin_print_help( argv[0], sb_err );
builtin_print_help( argv[0], sb_out );
return 0;
case 'g':
@@ -475,7 +524,7 @@ static int builtin_builtin( wchar_t **argv )
return 1;
case 'h':
builtin_print_help( argv[0], sb_err );
builtin_print_help( argv[0], sb_out );
return 0;
case 'n':
@@ -494,27 +543,24 @@ static int builtin_builtin( wchar_t **argv )
if( list )
{
array_list_t names;
wchar_t **names_arr;
int i;
al_init( &names );
builtin_get_names( &names );
names_arr = list_to_char_arr( &names );
qsort( names_arr,
al_get_count( &names ),
sizeof(wchar_t *),
(int (*)(const void *, const void *))&wcsfilecmp );
sort_list( &names );
for( i=0; i<al_get_count( &names ); i++ )
{
if( wcscmp( names_arr[i], L"count" ) == 0 )
wchar_t *el = (wchar_t *)al_get( &names, i );
if( wcscmp( el, L"count" ) == 0 )
continue;
sb_append2( sb_out,
names_arr[i],
el,
L"\n",
(void *)0 );
}
free( names_arr );
al_destroy( &names );
}
return 0;
@@ -583,6 +629,7 @@ static int builtin_generic( wchar_t **argv )
}
/**
Output a definition of the specified function to the sb_out
stringbuffer. Used by the functions builtin.
*/
static void functions_def( wchar_t *name )
@@ -673,7 +720,6 @@ static int builtin_functions( wchar_t **argv )
wchar_t *desc=0;
array_list_t names;
wchar_t **names_arr;
int argc=builtin_count_args( argv );
int list=0;
@@ -701,6 +747,10 @@ static int builtin_functions( wchar_t **argv )
L"all", no_argument, 0, 'a'
}
,
{
L"help", no_argument, 0, 'h'
}
,
{
0, 0, 0, 0
}
@@ -713,7 +763,7 @@ static int builtin_functions( wchar_t **argv )
int opt = wgetopt_long( argc,
argv,
L"ed:na",
L"ed:nah",
long_options,
&opt_index );
if( opt == -1 )
@@ -749,6 +799,10 @@ static int builtin_functions( wchar_t **argv )
show_hidden=1;
break;
case 'h':
builtin_print_help( argv[0], sb_out );
return 0;
case '?':
builtin_print_help( argv[0], sb_err );
@@ -816,11 +870,7 @@ static int builtin_functions( wchar_t **argv )
al_init( &names );
function_get_names( &names, show_hidden );
names_arr = list_to_char_arr( &names );
qsort( names_arr,
al_get_count( &names ),
sizeof(wchar_t *),
(int (*)(const void *, const void *))&wcsfilecmp );
sort_list( &names );
if( is_screen )
{
string_buffer_t buff;
@@ -829,12 +879,12 @@ static int builtin_functions( wchar_t **argv )
for( i=0; i<al_get_count( &names ); i++ )
{
sb_append2( &buff,
names_arr[i],
al_get(&names, i),
L", ",
(void *)0 );
}
write_screen( (wchar_t *)buff.buff );
write_screen( (wchar_t *)buff.buff, sb_out );
sb_destroy( &buff );
}
else
@@ -842,13 +892,12 @@ static int builtin_functions( wchar_t **argv )
for( i=0; i<al_get_count( &names ); i++ )
{
sb_append2( sb_out,
names_arr[i],
al_get(&names, i),
L"\n",
(void *)0 );
}
}
free( names_arr );
al_destroy( &names );
return 0;
}
@@ -861,16 +910,13 @@ static int builtin_functions( wchar_t **argv )
sb_append( sb_out, _( L"Current function definitions are:\n\n" ) );
al_init( &names );
function_get_names( &names, show_hidden );
names_arr = list_to_char_arr( &names );
qsort( names_arr,
al_get_count( &names ),
sizeof(wchar_t *),
(int (*)(const void *, const void *))&wcsfilecmp );
sort_list( &names );
for( i=0; i<al_get_count( &names ); i++ )
{
functions_def( names_arr[i] );
functions_def( (wchar_t *)al_get( &names, i ) );
}
free( names_arr );
al_destroy( &names );
break;
}
@@ -956,6 +1002,10 @@ static int builtin_function( wchar_t **argv )
L"on-variable", required_argument, 0, 'v'
}
,
{
L"help", no_argument, 0, 'h'
}
,
{
0, 0, 0, 0
}
@@ -968,7 +1018,7 @@ static int builtin_function( wchar_t **argv )
int opt = wgetopt_long( argc,
argv,
L"bd:s:j:p:v:",
L"bd:s:j:p:v:h",
long_options,
&opt_index );
if( opt == -1 )
@@ -1025,7 +1075,7 @@ static int builtin_function( wchar_t **argv )
{
event_t *e;
if( !wcsvarname( woptarg ) )
if( wcsvarname( woptarg ) )
{
sb_printf( sb_err,
_( L"%ls: Invalid variable name '%ls'\n" ),
@@ -1122,6 +1172,10 @@ static int builtin_function( wchar_t **argv )
break;
}
case 'h':
builtin_print_help( argv[0], sb_out );
return 0;
case '?':
builtin_print_help( argv[0], sb_err );
res = 1;
@@ -1141,7 +1195,7 @@ static int builtin_function( wchar_t **argv )
argc-woptind );
res=1;
}
else if( !(is_binding?wcsbindingname( argv[woptind] ) : wcsvarname( argv[woptind] ) ))
else if( !(is_binding?wcsbindingname( argv[woptind] ) : !wcsvarname( argv[woptind] ) ))
{
sb_printf( sb_err,
_( L"%ls: Illegal function name '%ls'\n" ),
@@ -1166,24 +1220,20 @@ static int builtin_function( wchar_t **argv )
{
int i;
array_list_t names;
wchar_t **names_arr;
int chars=0;
// builtin_print_help( argv[0], sb_err );
builtin_print_help( argv[0], sb_err );
const wchar_t *cfa = _( L"Current functions are: " );
sb_append( sb_err, cfa );
chars += wcslen( cfa );
al_init( &names );
function_get_names( &names, 0 );
names_arr = list_to_char_arr( &names );
qsort( names_arr,
al_get_count( &names ),
sizeof(wchar_t *),
(int (*)(const void *, const void *))&wcsfilecmp );
sort_list( &names );
for( i=0; i<al_get_count( &names ); i++ )
{
wchar_t *nxt = names_arr[i];
wchar_t *nxt = (wchar_t *)al_get( &names, i );
int l = wcslen( nxt + 2 );
if( chars+l > common_get_width() )
{
@@ -1194,7 +1244,6 @@ static int builtin_function( wchar_t **argv )
sb_append2( sb_err,
nxt, L" ", (void *)0 );
}
free( names_arr );
al_destroy( &names );
sb_append( sb_err, L"\n" );
@@ -1271,7 +1320,7 @@ static int builtin_random( wchar_t **argv )
return 1;
case 'h':
builtin_print_help( argv[0], sb_err );
builtin_print_help( argv[0], sb_out );
break;
case '?':
@@ -1344,9 +1393,10 @@ static int builtin_read( wchar_t **argv )
wchar_t *nxt;
wchar_t *prompt = DEFAULT_READ_PROMPT;
wchar_t *commandline = L"";
int exit_res=0;
woptind=0;
while( 1 )
{
const static struct woption
@@ -1380,6 +1430,10 @@ static int builtin_read( wchar_t **argv )
L"command", required_argument, 0, 'c'
}
,
{
L"help", no_argument, 0, 'h'
}
,
{
0, 0, 0, 0
}
@@ -1390,7 +1444,7 @@ static int builtin_read( wchar_t **argv )
int opt = wgetopt_long( argc,
argv,
L"xglUup:c:",
L"xglUup:c:h",
long_options,
&opt_index );
if( opt == -1 )
@@ -1431,10 +1485,13 @@ static int builtin_read( wchar_t **argv )
commandline = woptarg;
break;
case 'h':
builtin_print_help( argv[0], sb_out );
return 0;
case L'?':
builtin_print_help( argv[0], sb_err );
return 1;
}
@@ -1463,20 +1520,6 @@ static int builtin_read( wchar_t **argv )
return 1;
}
if( woptind == argc )
{
sb_printf( sb_err,
BUILTIN_ERR_MISSING,
argv[0] );
sb_append2( sb_err,
parser_current_line(),
L"\n",
(void *)0 );
builtin_print_help( argv[0], sb_err );
return 1;
}
/*
Verify all variable names
*/
@@ -1507,10 +1550,6 @@ static int builtin_read( wchar_t **argv )
*/
i=woptind;
ifs = env_get( L"IFS" );
if( ifs == 0 )
ifs = L"";
/*
Check if we should read interactively using \c reader_readline()
*/
@@ -1526,10 +1565,12 @@ static int builtin_read( wchar_t **argv )
else
{
string_buffer_t sb;
int eof=0;
sb_init( &sb );
while( 1 )
{
int eof=0;
int finished=0;
wchar_t res=0;
@@ -1570,30 +1611,46 @@ static int builtin_read( wchar_t **argv )
if( eof )
break;
if( res == L'\n' )
break;
sb_append_char( &sb, res );
}
if( sb.used < 2 && eof )
{
exit_res = 1;
}
buff = wcsdup( (wchar_t *)sb.buff );
sb_destroy( &sb );
}
wchar_t *state;
nxt = wcstok( buff, (i<argc-1)?ifs:L"", &state );
while( i<argc )
if( i != argc )
{
env_set( argv[i], nxt != 0 ? nxt: L"", place );
wchar_t *state;
i++;
if( nxt != 0 )
nxt = wcstok( 0, (i<argc-1)?ifs:L"", &state);
ifs = env_get( L"IFS" );
if( ifs == 0 )
ifs = L"";
nxt = wcstok( buff, (i<argc-1)?ifs:L"", &state );
while( i<argc )
{
env_set( argv[i], nxt != 0 ? nxt: L"", place );
i++;
if( nxt != 0 )
nxt = wcstok( 0, (i<argc-1)?ifs:L"", &state);
}
}
free( buff );
return 0;
return exit_res;
}
/**
@@ -1708,7 +1765,7 @@ static int builtin_status( wchar_t **argv )
return 1;
case 'h':
builtin_print_help( argv[0], sb_err );
builtin_print_help( argv[0], sb_out );
return 0;
case 'j':
@@ -1862,14 +1919,14 @@ static int builtin_exit( wchar_t **argv )
default:
sb_printf( sb_err,
_( L"%ls: Too many arguments\n" ),
BUILTIN_ERR_TOO_MANY_ARGUMENTS,
argv[0] );
builtin_print_help( argv[0], sb_err );
return 1;
}
reader_exit( 1 );
reader_exit( 1, 0 );
return ec;
}
@@ -2014,10 +2071,10 @@ static int builtin_source( wchar_t ** argv )
parser_push_block( SOURCE );
reader_push_current_filename( fn_intern );
current_block->param1.source_dest = fn_intern;
parse_util_set_argv( argv+2);
res = reader_read( fd );
parser_pop_block();
@@ -2026,8 +2083,7 @@ static int builtin_source( wchar_t ** argv )
sb_printf( sb_err,
_( L"%ls: Error while reading file '%ls'\n" ),
argv[0],
argv[1]
);
argv[1] );
}
/*
@@ -2073,7 +2129,7 @@ static void make_first( job_t *j )
*/
static int builtin_fg( wchar_t **argv )
{
job_t *j;
job_t *j=0;
if( argv[1] == 0 )
{
@@ -2123,27 +2179,40 @@ static int builtin_fg( wchar_t **argv )
}
else
{
int pid = abs(wcstol( argv[1], 0, 10 ));
j = job_get_from_pid( pid );
if( !j )
wchar_t *end;
int pid = abs(wcstol( argv[1], &end, 10 ));
if( *end )
{
sb_printf( sb_err,
_( L"%ls: No suitable job: %d\n" ),
argv[0],
pid );
builtin_print_help( argv[0], sb_err );
sb_printf( sb_err,
_( L"%ls: Argument must be a number: %ls\n" ),
argv[0],
argv[1] );
builtin_print_help( argv[0], sb_err );
}
if( !j->job_control )
else
{
sb_printf( sb_err,
_( L"%ls: Can't put job %d, '%ls' to foreground because it is not under job control\n" ),
argv[0],
pid,
j->command );
builtin_print_help( argv[0], sb_err );
j=0;
j = job_get_from_pid( pid );
if( !j || !j->constructed || job_is_completed( j ))
{
sb_printf( sb_err,
_( L"%ls: No suitable job: %d\n" ),
argv[0],
pid );
builtin_print_help( argv[0], sb_err );
j=0;
}
else if( !j->job_control )
{
sb_printf( sb_err,
_( L"%ls: Can't put job %d, '%ls' to foreground because it is not under job control\n" ),
argv[0],
pid,
j->command );
builtin_print_help( argv[0], sb_err );
j=0;
}
}
}
if( j )
@@ -2260,309 +2329,6 @@ static int builtin_bg( wchar_t **argv )
}
#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;
}
}
}
/**
Builtin for printing running jobs
*/
static 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'
}
,
{
0, 0, 0, 0
}
}
;
int opt_index = 0;
int opt = wgetopt_long( argc,
argv,
L"pclg",
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 '?':
// 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 )
{
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 )
{
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 /*&& j->skip_notification*/ )
{
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;
}
/**
Builtin for looping over a list
*/
@@ -2580,7 +2346,7 @@ static int builtin_for( wchar_t **argv )
argv[0] );
builtin_print_help( argv[0], sb_err );
}
else if ( !wcsvarname(argv[1]) )
else if ( wcsvarname(argv[1]) )
{
sb_printf( sb_err,
_( L"%ls: '%ls' is not a valid variable name\n" ),
@@ -2591,7 +2357,7 @@ static int builtin_for( wchar_t **argv )
else if (wcscmp( argv[2], L"in") != 0 )
{
sb_printf( sb_err,
_( L"%ls: Second argument must be 'in'\n" ),
BUILTIN_FOR_ERR_IN,
argv[0] );
builtin_print_help( argv[0], sb_err );
}
@@ -3218,7 +2984,7 @@ static int internal_help( wchar_t *cmd )
int builtin_run( wchar_t **argv )
{
int (*cmd)(wchar_t **argv)=0;
cmd = hash_get( &builtin, argv[0] );
cmd = (int (*)(wchar_t **))hash_get( &builtin, argv[0] );
if( argv[1] != 0 && !internal_help(argv[0]) )
{

View File

@@ -57,6 +57,13 @@ enum
*/
#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
*/
@@ -132,33 +139,42 @@ 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.
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();
/**

View File

@@ -12,7 +12,10 @@ Functions used for implementing the commandline builtin.
#include <signal.h>
#include "config.h"
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "builtin.h"
#include "common.h"
@@ -262,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
}
@@ -272,7 +279,7 @@ int builtin_commandline( wchar_t **argv )
int opt = wgetopt_long( argc,
argv,
L"aijpctwfor",
L"aijpctwforh",
long_options,
&opt_index );
if( opt == -1 )
@@ -327,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;

View File

@@ -12,7 +12,10 @@ Functions used for implementing the complete builtin.
#include <signal.h>
#include "config.h"
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "builtin.h"
#include "common.h"
@@ -338,6 +341,10 @@ int builtin_complete( wchar_t **argv )
L"do-complete", required_argument, 0, 'C'
}
,
{
L"help", no_argument, 0, 'h'
}
,
{
0, 0, 0, 0
}
@@ -348,7 +355,7 @@ int builtin_complete( wchar_t **argv )
int opt = wgetopt_long( argc,
argv,
L"a:c:p:s:l:o:d:frxeun:C:",
L"a:c:p:s:l:o:d:frxeun:C:h",
long_options,
&opt_index );
if( opt == -1 )
@@ -366,7 +373,7 @@ int builtin_complete( wchar_t **argv )
sb_append( sb_err,
parser_current_line() );
// builtin_print_help( argv[0], sb_err );
builtin_print_help( argv[0], sb_err );
res = 1;
@@ -428,10 +435,14 @@ int builtin_complete( wchar_t **argv )
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 );
builtin_print_help( argv[0], sb_err );
res = 1;
break;
@@ -440,6 +451,42 @@ int builtin_complete( wchar_t **argv )
}
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 )
@@ -482,7 +529,7 @@ int builtin_complete( wchar_t **argv )
argv[0] );
sb_append( sb_err,
parser_current_line() );
// builtin_print_help( argv[0], sb_err );
builtin_print_help( argv[0], sb_err );
res = 1;
}

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,10 @@ Functions used for implementing the set builtin.
#include <signal.h>
#include "config.h"
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "builtin.h"
#include "env.h"
@@ -23,46 +26,164 @@ Functions used for implementing the set builtin.
#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_printf( sb_err, BUILTIN_ERR_VARCHAR, L"set", *src );
sb_append2(sb_err, parser_current_line(), L"\n", (void *)0 );
// builtin_print_help( L"set", sb_err );
return -1;
}
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++;
@@ -95,9 +227,9 @@ static int parse_fill_indexes( array_list_t *indexes,
if (end == src)
{
sb_printf(sb_err, _(L"%ls: Invalid index starting at '%ls'\n"), L"set", src);
return -1;
return 0;
}
int *ind = (int *) calloc(1, sizeof(int));
*ind = (int) l_ind;
al_push(indexes, ind);
@@ -111,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,
@@ -119,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""));
}
@@ -148,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;
}
@@ -161,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++)
@@ -185,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);
}
@@ -251,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);
@@ -306,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)
@@ -329,37 +450,61 @@ 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_printf(sb_err,
@@ -372,7 +517,7 @@ int builtin_set( wchar_t **argv )
}
/* Check operation and modifiers sanity */
/* We can't both list and erase varaibles */
if( erase && list )
{
sb_printf(sb_err,
@@ -384,6 +529,9 @@ int builtin_set( wchar_t **argv )
return 1;
}
/*
Variables can only have one scope
*/
if( local + global + universal > 1 )
{
sb_printf( sb_err,
@@ -394,6 +542,9 @@ int builtin_set( wchar_t **argv )
return 1;
}
/*
Variables can only have one export status
*/
if( export && unexport )
{
sb_printf( sb_err,
@@ -404,205 +555,211 @@ int builtin_set( wchar_t **argv )
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
*/
if( !wcslen( dest ) )
if( erase )
{
free( dest );
sb_printf( sb_err, BUILTIN_ERR_VARNAME_ZERO, argv[0] );
return 1;
}
}
/* 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)
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_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;
}
else
{
print_variables( 1, 1, scope );
}
finished=1;
}
if( !finished )
{
if( al_get_count( &values ) == 0 &&
al_get_count( &indexes ) == 0 &&
!erase &&
!list )
{
env_set( name, 0, scope );
finished = 1;
}
print_variables( 1, 1, scope );
}
if( !finished )
return retcode;
}
if( list )
{
/* Maybe we should issue an error if there are any other arguments? */
print_variables(0, 0, scope);
return 0;
}
if( !(dest = wcsdup(argv[woptind])))
{
die_mem();
}
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;
}
/*
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 )
{
/* There are some arguments, we have at least a variable name */
if( erase && al_get_count(&values) != 0 )
/*
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() );
builtin_print_help( argv[0], sb_err );
retcode = 1;
}
retcode=1;
}
else
{
/* All ok, we can alter the specified variable */
array_list_t val_l;
al_init(&val_l);
void *old=0;
if (al_get_count(&indexes) == 0)
{
/* We will act upon the entire variable */
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 );
fill_buffer_from_list( &result_sb,
&val_l );
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);
{
env_remove( dest, ENV_USER );
}
}
else
{
array_list_t val;
al_init( &val );
for( i=woptind; i<argc; i++ )
{
al_push( &val, argv[i] );
}
al_foreach( &indexes, (void (*)(const void *))&free );
al_destroy(&indexes);
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,8 +14,9 @@ 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"
@@ -60,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
}
@@ -84,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
}
@@ -323,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
}
@@ -334,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 )
@@ -376,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;
@@ -400,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;

207
common.c
View File

@@ -6,6 +6,7 @@ parts of fish.
#include "config.h"
#include <stdlib.h>
#include <termios.h>
#include <wchar.h>
@@ -50,7 +51,9 @@ parts of fish.
#include <ncurses/term.h>
#endif
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "common.h"
#include "expand.h"
@@ -58,11 +61,6 @@ parts of fish.
#include "wildcard.h"
#include "parser.h"
/**
The maximum number of minor errors to report. Further errors will be omitted.
*/
#define ERROR_MAX_COUNT 1
/**
The number of milliseconds to wait between polls when attempting to acquire
a lockfile
@@ -297,19 +295,14 @@ char *wcs2str_internal( const wchar_t *in, char *out )
{
res = wcrtomb( &out[out_pos], in[in_pos], &state );
switch( res )
if( res == (size_t)(-1) )
{
case (size_t)(-1):
{
debug( 1, L"Wide character has no narrow representation" );
memset( &state, 0, sizeof(state) );
break;
}
default:
{
out_pos += res;
break;
}
debug( 1, L"Wide character has no narrow representation" );
memset( &state, 0, sizeof(state) );
}
else
{
out_pos += res;
}
}
in_pos++;
@@ -402,119 +395,17 @@ wchar_t **strv2wcsv( const char **in )
}
/*$OpenBSD: strlcat.c,v 1.11 2003/06/17 21:56:24 millert Exp $*/
/*
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
size_t
wcslcat(wchar_t *dst, const wchar_t *src, size_t siz)
{
register wchar_t *d = dst;
register const wchar_t *s = src;
register size_t n = siz;
size_t dlen;
/* Find the end of dst and adjust bytes left but don't go past end */
while (n-- != 0 && *d != '\0')
d++;
dlen = d - dst;
n = siz - dlen;
if (n == 0)
return(dlen + wcslen(s));
while (*s != '\0')
{
if (n != 1)
{
*d++ = *s;
n--;
}
s++;
}
*d = '\0';
return(dlen + (s - src));
/* count does not include NUL */
}
/*$OpenBSD: strlcpy.c,v 1.8 2003/06/17 21:56:24 millert Exp $*/
/*
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
size_t
wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz)
{
register wchar_t *d = dst;
register const wchar_t *s = src;
register size_t n = siz;
/* Copy as many bytes as will fit */
if (n != 0 && --n != 0)
{
do
{
if ((*d++ = *s++) == 0)
break;
}
while (--n != 0);
}
/* Not enough room in dst, add NUL and traverse rest of src */
if (n == 0)
{
if (siz != 0)
*d = '\0';
/* NUL-terminate dst */
while (*s++)
;
}
return(s - src - 1);
/* count does not include NUL */
}
int wcsvarname( wchar_t *str )
wchar_t *wcsvarname( wchar_t *str )
{
while( *str )
{
if( (!iswalnum(*str)) && (*str != L'_' ) )
{
return 0;
return str;
}
str++;
}
return 1;
return 0;
}
@@ -599,6 +490,12 @@ int contains_str( const wchar_t *a, ... )
wchar_t *arg;
va_list va;
int res = 0;
if( !a )
{
debug( 1, L"Warning: Called contains_str with null argument. This is a bug." );
return 0;
}
va_start( va, a );
while( (arg=va_arg(va, wchar_t *) )!= 0 )
@@ -643,23 +540,28 @@ void debug( int level, const wchar_t *msg, ... )
{
va_list va;
string_buffer_t sb;
string_buffer_t sb2;
if( level > debug_level )
return;
sb_init( &sb );
va_start( va, msg );
sb_init( &sb2 );
sb_printf( &sb, L"%ls: ", program_name );
va_start( va, msg );
sb_vprintf( &sb, msg, va );
va_end( va );
write_screen( (wchar_t *)sb.buff );
write_screen( (wchar_t *)sb.buff, &sb2 );
fwprintf( stderr, L"%ls", sb2.buff );
sb_destroy( &sb );
sb_destroy( &sb2 );
}
void write_screen( const wchar_t *msg )
void write_screen( const wchar_t *msg, string_buffer_t *buff )
{
const wchar_t *start, *pos;
int line_width = 0;
@@ -680,7 +582,7 @@ void write_screen( const wchar_t *msg )
*/
while( *pos && ( !wcschr( L" \n\r\t", *pos ) ) )
{
/*
Check is token is wider than one line.
If so we mark it as an overflow and break the token.
@@ -705,12 +607,12 @@ void write_screen( const wchar_t *msg )
else if( overflow )
{
/*
In case of overflow, we print a newline, except if we alreade are at position 0
In case of overflow, we print a newline, except if we already are at position 0
*/
wchar_t *token = wcsndup( start, pos-start );
if( line_width != 0 )
putwc( L'\n', stderr );
fwprintf( stderr, L"%ls-\n", token );
sb_append_char( buff, L'\n' );
sb_printf( buff, L"%ls-\n", token );
free( token );
line_width=0;
}
@@ -722,13 +624,14 @@ void write_screen( const wchar_t *msg )
wchar_t *token = wcsndup( start, pos-start );
if( (line_width + (line_width!=0?1:0) + tok_width) > screen_width )
{
putwc( L'\n', stderr );
sb_append_char( buff, L'\n' );
line_width=0;
}
fwprintf( stderr, L"%ls%ls", line_width?L" ":L"", token );
sb_printf( buff, L"%ls%ls", line_width?L" ":L"", token );
free( token );
line_width += (line_width!=0?1:0) + tok_width;
}
/*
Break on end of string
*/
@@ -740,9 +643,9 @@ void write_screen( const wchar_t *msg )
}
else
{
fwprintf( stderr, L"%ls", msg );
sb_printf( buff, L"%ls", msg );
}
putwc( L'\n', stderr );
sb_append_char( buff, L'\n' );
}
wchar_t *escape( const wchar_t *in,
@@ -936,14 +839,14 @@ wchar_t *unescape( const wchar_t * orig, int unescape_special )
int base=16;
int byte = 0;
int max_val = 127;
wchar_t max_val = ASCII_MAX;
switch( in[in_pos] )
{
case L'u':
{
chars=4;
max_val = 35535;
max_val = UCS2_MAX;
break;
}
@@ -962,7 +865,7 @@ wchar_t *unescape( const wchar_t * orig, int unescape_special )
case L'X':
{
byte=1;
max_val = 255;
max_val = BYTE_MAX;
break;
}
@@ -988,7 +891,7 @@ wchar_t *unescape( const wchar_t * orig, int unescape_special )
res=(res*base)|d;
}
if( (res > 0) && (res <= max_val) )
if( (res <= max_val) )
{
in[out_pos] = (byte?ENCODE_DIRECT_BASE:0)+res;
}
@@ -1156,6 +1059,7 @@ wchar_t *unescape( const wchar_t * orig, int unescape_special )
{
switch( in[++in_pos] )
{
case '\\':
case L'\'':
{
in[out_pos]=in[in_pos];
@@ -1213,6 +1117,7 @@ wchar_t *unescape( const wchar_t * orig, int unescape_special )
return 0;
}
case '\\':
case L'$':
case '"':
{
@@ -1500,3 +1405,29 @@ int common_get_height()
return termsize.ws_row;
}
void tokenize_variable_array( const wchar_t *val, array_list_t *out )
{
if( val )
{
wchar_t *cpy = wcsdup( val );
wchar_t *pos, *start;
if( !cpy )
{
die_mem();
}
for( start=pos=cpy; *pos; pos++ )
{
if( *pos == ARRAY_SEP )
{
*pos=0;
al_push( out, start==cpy?cpy:wcsdup(start) );
start=pos+1;
}
}
al_push( out, start==cpy?cpy:wcsdup(start) );
}
}

View File

@@ -15,40 +15,31 @@
#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.
*/
#define FISH_COLOR_IGNORE -1
/**
Color code for set_color. Sets the default color.
*/
#define FISH_COLOR_RESET -2
/**
This is in the unicode private use area.
*/
#define ENCODE_DIRECT_BASE 0xf100
/**
Highest legal ascii value
*/
#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
*/
@@ -147,35 +138,18 @@ wchar_t *wcsdupcat( const wchar_t *a, const wchar_t *b );
*/
wchar_t *wcsdupcat2( const wchar_t *a, ... );
/**
Appends src to string dst of size siz (unlike wcsncat, siz is the
full size of dst, not space left). At most siz-1 characters will be
copied. Always NUL terminates (unless siz <= wcslen(dst)). Returns
wcslen(src) + MIN(siz, wcslen(initial dst)). If retval >= siz,
truncation occurred.
This is the OpenBSD strlcat function, modified for wide characters,
and renamed to reflect this change.
*/
size_t wcslcat( wchar_t *dst, const wchar_t *src, size_t siz );
/**
Copy src to string dst of size siz. At most siz-1 characters will
be copied. Always NUL terminates (unless siz == 0). Returns
wcslen(src); if retval >= siz, truncation occurred.
This is the OpenBSD strlcpy function, modified for wide characters,
and renamed to reflect this change.
*/
size_t wcslcpy( wchar_t *dst, const wchar_t *src, size_t siz );
/**
Test if the given string is a valid variable name
*/
int wcsvarname( wchar_t *str );
/**
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
*/
wchar_t *wcsvarname( wchar_t *str );
/**
@@ -211,9 +185,11 @@ void error_reset();
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, ... );
@@ -315,10 +291,20 @@ int common_get_height();
void common_handle_winch( int signal );
/**
Write paragraph of output to screen. Ignore newlines in message and
perform internal line-breaking.
Write paragraph of output to the specified stringbuffer, and redo
the linebreaks to fit the current screen.
*/
void write_screen( const wchar_t *msg );
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

View File

@@ -21,7 +21,10 @@
#include <wchar.h>
#include "config.h"
#include "fallback.h"
#include "util.h"
#include "tokenizer.h"
#include "wildcard.h"
#include "proc.h"
@@ -1557,7 +1560,7 @@ static int complete_param( wchar_t *cmd_orig,
{
use_common &= ((o->result_mode & NO_COMMON )==0);
use_files &= ((o->result_mode & NO_FILES )==0);
complete_from_args( arg, o->comp, o->desc, comp_out );
complete_from_args( arg, o->comp, _(o->desc), comp_out );
}
}
@@ -1581,7 +1584,7 @@ static int complete_param( wchar_t *cmd_orig,
found_old = 1;
use_common &= ((o->result_mode & NO_COMMON )==0);
use_files &= ((o->result_mode & NO_FILES )==0);
complete_from_args( str, o->comp, o->desc, comp_out );
complete_from_args( str, o->comp, _(o->desc), comp_out );
}
}
}
@@ -1607,7 +1610,7 @@ static int complete_param( wchar_t *cmd_orig,
{
use_common &= ((o->result_mode & NO_COMMON )==0);
use_files &= ((o->result_mode & NO_FILES )==0);
complete_from_args( str, o->comp, o->desc, comp_out );
complete_from_args( str, o->comp, _(o->desc), comp_out );
}
}
@@ -1631,7 +1634,7 @@ static int complete_param( wchar_t *cmd_orig,
if( (o->short_opt == L'\0' ) && (o->long_opt[0]==L'\0'))
{
use_files &= ((o->result_mode & NO_FILES )==0);
complete_from_args( str, o->comp, o->desc, comp_out );
complete_from_args( str, o->comp, _(o->desc), comp_out );
}
if( wcslen(str) > 0 )
@@ -1642,15 +1645,16 @@ static int complete_param( wchar_t *cmd_orig,
if( o->short_opt != L'\0' &&
short_ok( str, o->short_opt, i->short_opt_str ) )
{
const wchar_t *desc = _(o->desc );
wchar_t *next_opt =
malloc( sizeof(wchar_t)*(3 + wcslen(o->desc)));
malloc( sizeof(wchar_t)*(3 + wcslen(desc)));
if( !next_opt )
die_mem();
next_opt[0]=o->short_opt;
next_opt[1]=COMPLETE_SEP;
next_opt[2]=L'\0';
wcscat( next_opt, o->desc );
wcscat( next_opt, desc );
al_push( comp_out, next_opt );
}
@@ -1678,7 +1682,7 @@ static int complete_param( wchar_t *cmd_orig,
al_push( comp_out,
wcsdupcat2( &((wchar_t *)whole_opt.buff)[wcslen(str)],
COMPLETE_SEP_STR,
o->desc,
_(o->desc),
(void *)0) );
}
@@ -1688,7 +1692,7 @@ static int complete_param( wchar_t *cmd_orig,
wcsdupcat2( &((wchar_t *)whole_opt.buff)[wcslen(str)],
L"=",
COMPLETE_SEP_STR,
o->desc,
_(o->desc),
(void *)0) );
}
}
@@ -1979,7 +1983,8 @@ void complete( const wchar_t *cmd,
{
if( parser_is_subcommand( tok_last( &tok ) ) )
break;
free( current_command );
current_command = wcsdup( tok_last( &tok ) );
on_command = (pos <= tok_get_pos( &tok) + wcslen( tok_last( &tok ) ) );
@@ -2018,9 +2023,28 @@ void complete( const wchar_t *cmd,
current_token = wcsndup( begin, cursor_pos-(begin-cmd) );
prev_token = prev_begin ? wcsndup( prev_begin, prev_end - prev_begin ): wcsdup(L"");
// fwprintf( stderr, L"on_command: %d, %ls %ls\n", on_command, current_compmand, current_token );
if( !had_cmd )
{
on_command=1;
}
if( !current_token )
{
current_token = wcsdup(L"");
}
if( !current_command )
{
current_command = wcsdup(L"");
}
if( !prev_token )
{
prev_token = wcsdup(L"");
}
if( current_token && current_command && prev_token )
{
if( on_command )
@@ -2040,16 +2064,17 @@ void complete( const wchar_t *cmd,
*/
int do_file;
do_file = complete_param( current_command, prev_token, current_token, comp );
complete_param_expand( current_token, comp, do_file );
}
}
free( current_token );
free( current_command );
free( prev_token );
}
free( current_token );
free( current_command );
free( prev_token );
error_max=old_error_max;
condition_cache_clear();
@@ -2116,7 +2141,7 @@ void complete_print( string_buffer_t *out )
append_switch( out,
L"description",
o->desc );
_(o->desc) );
append_switch( out,
L"arguments",

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,14 +1,57 @@
# Process this file with autoconf to produce a configure script.
AC_INIT(fish,1.21.0,fish-users@lists.sf.net)
AC_INIT(fish,1.21.8,fish-users@lists.sf.net)
# If needed, run autoconf to regenerate the configure file
AC_MSG_CHECKING([if autoconf needs to be run])
if test configure -ot configure.ac; then
AC_MSG_RESULT([yes])
if which autoconf >/dev/null; then
# No need to provide any error messages if autoconf fails, the
# shell and autconf should take care of that themselves
AC_MSG_NOTICE([running autoconf])
if autoconf; then
./configure "$@"
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
# 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)
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING([for $i/lib library directory])
@@ -31,22 +74,6 @@ done
AC_SUBST( optbindirs, $optbindirs )
# If needed, run autoheader automatically
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 is needed because the configure.ac file has been modified.
Please install it and try again.])
fi
else
AC_MSG_RESULT([no])
fi
# Tell autoconf to create config.h header
AC_CONFIG_HEADERS(config.h)
@@ -58,16 +85,17 @@ AC_PROG_INSTALL
# Check for doxygen, which is needed to build
AC_CHECK_PROG( has_doxygen, [doxygen], "true")
if ! test $has_doxygen = "true"; then
if ! test "$has_doxygen" = "true"; then
AC_MSG_ERROR( [cannot find the Doxygen program in your path.
This program is needed to build fish.
Please install it and try again.])
fi
# Check for seq program. If missing, install fallback shellscript implementation
# Check for seq command. If missing, make sure fallback shellscript
# implementation is installed
AC_CHECK_PROG( SEQ_FALLBACK, seq, [ ], [seq])
# Optionally drop xsel
# Optionally drop xsel command
AC_ARG_WITH( xsel,
AC_HELP_STRING([--without-xsel],
[do not build the xsel program needed for X clipboard integration]),
@@ -84,17 +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
AC_DEFINE_UNQUOTED([CPU],[L"$target_cpu"],[CPU type])
# Set up installation directories
# Set up PREFIX and related preprocessor symbols. Fish needs to know
# where it will be installed. One of the reasons for this is so that
# it can make sure the fish installation directory is in the path
# during startup.
if [[ "$prefix" = NONE ]]; then
AC_DEFINE_UNQUOTED( [PREFIX], L"/usr/local", [Installation directory])
AC_SUBST( PREFIX, /usr/local)
@@ -103,7 +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)"] )
# Set up the directory where the documentation files should be
# installed
AC_ARG_VAR( [docdir], [Documentation direcotry] )
if test -z $docdir; then
@@ -111,71 +243,49 @@ if test -z $docdir; then
fi
AC_DEFINE_UNQUOTED( DOCDIR, [L"$(eval echo $docdir)"], [Documentation directory] )
AC_DEFINE_UNQUOTED( SYSCONFDIR, [L"$(eval echo $sysconfdir)"], [System configuration directory] )
AC_DEFINE_UNQUOTED( DATADIR, [L"$(eval echo $datadir)"], [System configuration directory] )
AC_SUBST( SYSCONFDIR, ["$(eval echo $sysconfdir)"] )
AC_SUBST( DATADIR, ["$(eval echo $datadir)"] )
# Set up locale directory
# Set up locale directory. This is where the .po files will be
# installed.
AC_DEFINE_UNQUOTED( [LOCALEDIR], "$(eval echo $datadir)/locale", [Locale directory])
AC_SUBST( [LOCALEDIR], [$datadir/locale])
# See if Linux procfs is present
# See if Linux procfs is present. This is used to get extra
# information about running processes.
AC_CHECK_FILES([/proc/self/stat])
# 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>.])
else
AC_MSG_RESULT(no)
fi
# This is ued to tell the wgetopt library to translate strings. This
# way wgetopt can be dropped into any project without requiring i18n.
# 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
AC_DEFINE([HAVE_TRANSLATE_H], [1],
[Define to 1 if the wgettext function should be used for translating strings.])
# Check for RLIMIT_RSS in sys/resource.h.
AC_MSG_CHECKING([for RLIMIT_RSS in sys/resource.h])
AC_TRY_COMPILE([#include <sys/resource.h>],
[int tmp; tmp=RLIMIT_RSS;], have_rlimit_as=yes, have_rlimit_as=no)
if test "$have_rlimit_as" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_RLIMIT_RSS], [1],
[Define to 1 if HAVE_RLIMIT_RSS is defined in <sys/resource.h>.])
else
AC_MSG_RESULT(no)
fi
# Check for 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])
# 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_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>
[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 );])],
@@ -190,30 +300,32 @@ else
AC_MSG_RESULT(no)
fi
# If we have a fwprintf in libc, test that it actually works. As of
# March 2006, it is broken under Dragonfly BSD.
if test "$ac_cv_func_fwprintf" = yes; then
# Check for libraries
AC_CHECK_LIB(socket, connect)
AC_CHECK_LIB(rt, nanosleep)
AC_CHECK_LIB(intl, gettext)
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])
] )
# Check for various header files
AC_CHECK_HEADERS([getopt.h termio.h sys/resource.h term.h ncurses/term.h libintl.h ncurses.h curses.h])
fi
AC_CHECK_HEADER([regex.h],
[AC_DEFINE([HAVE_REGEX_H], [1], [Define to 1 if you have the <regex.h> header file.])],
[AC_MSG_ERROR([Could not find the header regex.h, needed to build fish])])
# Check for various functions, and insert results into config.h
AC_CHECK_FUNCS( wcsdup wcsndup wcslen wcscasecmp wcsncasecmp gettext fwprintf )
AC_CHECK_FUNCS( futimes wcwidth wcswidth getopt_long wcstok fputwc fgetwc )
AC_CHECK_FUNCS( wcstol dcgettext )
AC_DEFINE([HAVE_TRANSLATE_H], [1],
[Define to 1 if the wgettext function should be used for translating strings.])
# Check again for gettext library, and insert results into the Makefile
AC_CHECK_FUNC(gettext, AC_SUBST(HAVE_GETTEXT,1), AC_SUBST(HAVE_GETTEXT,0) )
# Check for _nl_msg_cat_cntr symbol
AC_MSG_CHECKING([for _nl_msg_cat_cntr symbol])
@@ -223,18 +335,30 @@ AC_TRY_LINK([#if HAVE_LIBINTL_H]
[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_MSG_RESULT(yes)
AC_DEFINE([HAVE__NL_MSG_CAT_CNTR], [1],
[Define to 1 if the _nl_msg_cat_cntr symbol is exported.])
else
AC_MSG_RESULT(no)
fi
# Check if we have ncurses, and use it rather than curses if possible.
AC_SEARCH_LIBS( setupterm, [ncurses curses], [ AC_MSG_NOTICE([Found curses implementation])], [AC_MSG_ERROR([Could not find a curses implementation, needed to build fish])] )
# Check if we are using basic BSD curses - in that case we redefine
# del_curterm as a no-op, to avoid a double-free
AC_CONFIG_FILES([Makefile fish.spec doc_src/fish.1 doc_src/Doxyfile etc/fish etc/fish_interactive.fish seq])
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
# 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 "Now run 'make' and 'make install' to built and install fish."
echo "Good luck!"
echo "fish is now configured."
echo "Use 'make' and 'make install' to built and install fish."

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
@@ -27,9 +43,11 @@ switch $animal
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

@@ -33,8 +33,9 @@ the manual page for the echo command by writing:
<code>man echo</code>
\c man is a command for displaying a manual page on a given
topic. There are manual pages for almost every command on most
\c man is a command for displaying a manual page on a given topic. The
man command takes the name of the manual page to display as an
argument. There are manual pages for almost every command on most
computers. There are also manual pages for many other things, such as
system libraries and important files.
@@ -48,18 +49,29 @@ has to be used.
Here is a list of some useful commands:
- \c cd, change the current directory
- \c ls, list the contents of a directory
- \c man, print a manual page
- \c mv, move files
- \c ls, list files and directories
- \c man, display a manual page on the screen
- \c mv, move (rename) files
- \c cp, copy files
- \c open, open files with the default application associated with each filetype
- \c less, read the contents of files
- \c less, list the contents of files
Commands and parameters are separated by the space character
(&nbsp;). Every command ends with either a newline (i.e. by pressing
the return key) or a semicolon (;). More than one command can be
written on the same line by separating them with semicolons.
A switch is a very common special type of argument. Switches almost
always start with one or more hyphens (-) and alter the way a command
operates. For example, the \c ls command usually lists all the files
and directories in the current working directory, but by using the \c
-l switch, the behaviour of ls is changed to not only display the
filename, but also the size, permissions, owner and modification time
of each file. Switches differ between commands and are documented in
the manual page for each command. Some switches are common to most
command though, for example '--help' will usually display a help text,
'-i' will often turn on interactive prompting before taking action,
while '-f' will turn it off.
\subsection quotes Quotes
@@ -72,10 +84,11 @@ quoted string, <a href='#expand-variable'>variable expansion</a> still
takes place. Other than that, a quoted parameter will not be parameter
expanded, may contain spaces, and escape sequences are ignored. The
only backslash escape accepted within single quotes is \\', which
escapes a single quote. The only backslash escapes accepted within
double quotes are \\", which escapes a double quote, and \\$, which
escapes a dollar character. Single quotes have no special meaning
withing double quotes and vice versa.
escapes a single quote and \\\\, which escapes the backslash
symbol. The only backslash escapes accepted within double quotes are
\\", which escapes a double quote, \\$, which escapes a dollar
character, and \\\\, which escapes the backslash symbol. Single quotes
have no special meaning withing double quotes and vice versa.
Example:
@@ -103,6 +116,7 @@ these characters, so called escape sequences are provided. These are:
- <code>'\\*'</code>, escapes the star character
- <code>'\\?'</code>, escapes the question mark character
- <code>'\\~'</code>, escapes the tilde character
- <code>'\\%'</code>, escapes the percent character
- <code>'\\#'</code>, escapes the hash character
- <code>'\\('</code>, escapes the left parenthesis character
- <code>'\\)'</code>, escapes the right parenthesis character
@@ -131,7 +145,7 @@ a number called a file descriptor (FD). These are:
The reason for providing for two output file descriptors is to allow
separation of errors and warnings from regular program output.
Any file descriptor can be directed to a different output than it's
Any file descriptor can be directed to a different output than its
default through a simple mechanism called a redirection.
An example of a file redirection is <code> echo hello \>output.txt</code>,
@@ -199,7 +213,15 @@ When you start a job in \c fish, \c fish itself will pause, and give
control of the terminal to the program just started. Sometimes, you
want to continue using the commandline, and have the job run in the
background. To create a background job, append a \& (ampersand) to
your command. This will tell fish to run the job in the background.
your command. This will tell fish to run the job in the
background. Background jobs are very useful when running programs that
have a graphical user interface.
Example:
<code>emacs \&</code>
will start the emacs text editor in the background.
\subsection syntax-job-control Job control
@@ -210,16 +232,17 @@ programs and do anything you want. If you then want to go back to the
suspended command by using the <a href="builtins.html#fg">fg</a>
command.
If you instead want to put a suspended job into the foreground, use
the <a href="builtins.html#fg">fg</a> command.
If you instead want to put a suspended job into the background, use
the <a href="builtins.html#bg">bg</a> command.
To get a listing of all currently started jobs, use the <a
href="builtins.html#jobs">jobs</a> command.
\subsection syntax-function Shellscript functions
Functions are used to group together commands and arguments
using a single name. For example, the following is a function
Functions are used to group together commands and arguments using a
single name. It can also be used to start a specific command with
additional arguments. For example, the following is a function
definition that calls the command 'ls -l' to print a detailed listing
of the contents of the current directory:
@@ -236,14 +259,14 @@ $argv</code> should be called when ll is invoked. $argv is an array
variable, which always contains all arguments sent to the function. In
the example above, these are simply passed on to the ls command. For
more information on functions, see the documentation for the <a
href='builtin.html#function'>function builtin</a>.
href='builtin.html#function'>function</a> builtin.
Functions can be defined on the commandline or in a configuration
file, but they can also be automatically loaded. Fish automatically
searches through any directories in the array variable
\$fish_function_path, and any functions defined are automatically
loaded when needed. A function definition file must have a filename
consisting of the name of the function and the suffix '.fish'.
consisting of the name of the function plus the suffix '.fish'.
The default value for \$fish_function_path is ~/.fish.d/functions,
/etc/fish.d/functions /usr/share/fish/functions. The exact path to the
@@ -258,12 +281,13 @@ functions and the last one is for default fish functions.
This is a short explanation of some of the commonly used words in fish.
- argument, a parameter given to a command
- builtin, a command that is implemented in the shell
- command, a program
- function, a block of one or more fish commands that can be called as a single command. By using functions, it is possible to string together multiple smaller commands into one more advanced command.
- builtin, a command that is implemented in the shell. Builtins are commands that are so closely tied to the shell that it is impossible to implement them as external commands.
- command, a program that the shell can run.
- function, a block of commands and arguments that can be called as if they where a single command. By using functions, it is possible to string together multiple smaller commands into one more advanced command.
- job, a running pipeline or command
- pipeline, a set of commands stringed together so that the output of one command is the input of the next command
- redirection, a operation that changes one of the input/output streams associated with a job
- switch, a special flag sent as an argument to a command that will alter the behavious of the command. A switch almost always begins with one or two hyphens.
\section help Help
@@ -450,22 +474,22 @@ personalized Japanese greeting.
The {$USER}san syntax might need a bit of an elaboration. Posix
shells allow you to specify a variable name using '$VARNAME' or
'${VARNAME}'. Fish only supports the former, but has no support
whatsoever for the latter or anything remotely like it. So what is
'{$VARNAME}' then? Well, '{WHATEVER}' is <a href='#brace'>brace
expansion</a>, the same as supported by Posix shells, i.e. 'a{b,c}d'
-> 'abd acd' works both in bash and on fish. So '{$VARNAME}' is a
bracket-expansion with only a single element, i.e. it becomes
expanded to '$VARNAME', which will be variable expanded to the value
of the variable 'VARNAME'. So you might think that the brackets don't
actually do anything, and that is nearly the truth. The snag is that
there once along the way was a '}' in there somewhere, and } is not a
valid character in a variable name. So anything after the otherwise
pointless bracket expansion becomes NOT a part of the variable name,
even if it happens to be a legal variable name character. That's why
'{$USER}san' looks for the variable '$USER' and not for the variable
'$USERsan'. It's a case of one syntax lending itself nicely to
solving an unrelated problem in it's spare time.
'${VARNAME}'. Fish supports the former, and has no support whatsoever
for the latter or anything like it. So what is '{$VARNAME}' then?
Well, '{WHATEVER}' is <a href='#brace'>brace expansion</a>, identical
to that supported by Posix shells, i.e. 'a{b,c}d' -> 'abd acd' works
both in bash and on fish. So '{$VARNAME}' is a bracket-expansion with
only a single element, i.e. it becomes expanded to '$VARNAME', which
will be variable expanded to the value of the variable 'VARNAME'. So
you might think that the brackets don't actually do anything, and that
is nearly the truth. The snag is that there once along the way was a
'}' in there somewhere, and } is not a valid character in a variable
name. So anything after the otherwise pointless bracket expansion
becomes explicitly NOT a part of the variable name, even if it happens
to be a legal variable name character. That's why '{$USER}san' looks
for the variable '$USER' and not for the variable '$USERsan'. It's
simply a case of one syntax lending itself nicely to solving an
unrelated problem in its spare time.
Variable expansion is the only type of expansion performed on double
quoted strings. There is, however, an important difference in how
@@ -479,6 +503,29 @@ result in exactly one argument. Undefined variables will expand to the
empty string, and array variables will be concatenated using the space
character.
There is one further notable feature of fish variable
expansion. Consider the following code snippet:
<pre>
set foo a b c
set a 10; set b 20; set c 30
for i in (seq (count $$foo))
echo $$foo[$i]
end
# Output is:
# 10
# 20
# 30
</pre>
The above code demonstrates how to use multiple '$' symbols to expand
the value of a variable as a variable name. One can simply think of
the $-symbol as a variable dereference operator. When using this
feature together with array brackets, the brackets will always match
the innermost $ dereference. Thus, $$foo[5] will always mean the fift
element of the foo variable should be dereferenced and never that the fift
element of the doubly dereferenced variable foo. The latter can
instead be expressed as $$foo[1][5].
\subsection expand-home Home directory expansion
@@ -494,6 +541,7 @@ a string is expanded into a process id. The following expansions are
performed:
- If the string is the entire word \c self, the shells pid is the result
- When inside a command substitution, if the string is the entire word \c caller, the job number (not the pid) of the job the created the command substitution is the result
- Otherwise, if the string is the id of a job, the result is the process
group id of the job.
- Otherwise, if any child processes match the specified string, their
@@ -598,7 +646,7 @@ echo $pirate
\subsection variables-universal More on universal variables
Universal variables are variables that are shared between all the
users fish sessions on the computer. Fish stores many of it's
users fish sessions on the computer. Fish stores many of its
configuration options as universal variables. This means that in order
to change fish settings, all you have to do is change the variable
value once, and it will be automatically updated for all sessions, and
@@ -706,28 +754,68 @@ certain environment variables.
- \c BROWSER, which is the users preferred web browser. If this variable is set, fish will use the specified browser instead of the system default browser to display the fish documentation.
- \c CDPATH, which is an array of directories in which to search for the new directory for the \c cd builtin.
- \c fish_color_normal, \c fish_color_command, \c fish_color_substitution, \c fish_color_redirection, \c fish_color_end, \c fish_color_error, \c fish_color_param, \c fish_color_comment, \c fish_color_match, \c fish_color_search_match, \c fish_color_cwd, \c fish_pager_color_prefix, \c fish_pager_color_completion, \c fish_pager_color_description and \c fish_pager_color_progress are used to change the color of various elements in \c fish. These variables are universal, i.e. when changing them, their new value will be used by all running fish sessions. The new value will also be retained when restarting fish.
- A large number of variable starting with the prefixes \c fish_color and \c fish_pager_color. See <a href='#variables-color'>Variables for changing highlighting colors</a> for more information.
- \c LANG, \c LC_ALL, \c LC_COLLATE, \c LC_CTYPE, \c LC_MESSAGES, \c LC_MONETARY, \c LC_NUMERIC and \c LC_TIME set the language option for the shell and subprograms. See the section <a href='#variables-locale'>Locale variables</a> for more information.
- \c PATH, which is an array of directories in which to search for commands
- \c umask, which is the current file creation mask. The preferred way to change the umask variable is through the <a href="commands.html#umask">umask shellscript function</a>. An attempt to set umask to an invalid value will always fail.
\c fish also sends additional information to the user through the
values of certain environment variables. The user can not change the
values of these variables. They are:
values of most of these variables.
- \c _, which is the name of the currently running command.
- \c argv, which is an array of arguments to the shell or function. \c argv is only defined when inside a function call, or if fish was invoked with a list of arguments, like 'fish myscript.fish foo bar'. This variable can be changed by the user.
- \c history, which is an array containing the last commands that where entered.
- \c HOME, which is the users home directory. This variable can only be changed by the root user.
- \c PWD, which is the current working directory.
- \c status, which is the exit status of the last foreground job to exit. If a job contains pipelines, the status of the last command in the pipeline is the status for the job.
- \c USER, which is the username. This variable can only be changed by the root user.
- \c LANG, \c LC_ALL, \c LC_COLLATE, \c LC_CTYPE, \c LC_MESSAGES, \c LC_MONETARY, \c LC_NUMERIC and \c LC_TIME set the language option for the shell and subprograms. See the section <a href='#variables-locale'>Locale variables</a> for more information.
Variables whose name are in uppercase are exported to the commands
started by fish. This rule is not enforced by fish, but it is good
coding practice to use casing to distinguish between exported and
unexported variables. \c fish also uses several variables
internally. Such variables are prefixed with the string __FISH or
__fish. These should be ignored by the user.
started by fish, those in lowercase are not exported. This rule is not
enforced by fish, but it is good coding practice to use casing to
distinguish between exported and unexported variables. \c fish also
uses several variables internally. Such variables are prefixed with
the string __FISH or __fish. These should be ignored by the user.
\subsection variables-color Variables for changing highlighting colors
The colors used by fish for syntax highlighting can be configured by
changing the values of a various variables. The value of these
variables can be one of the colors accepted by the <a
href='commands.html#set_color'>\c set_color</a> command. The \c --bold
or \c -b switches accepted by \c set_color are also accepted.
The following variables are available to change the highligting colors
in fish:
- \c fish_color_normal, the default color
- \c fish_color_command, the color for commands
- \c fish_color_quote, the color for quoted blocks of text
- \c fish_color_redirection, the color for IO redirections
- \c fish_color_end, the color for process separators like ';' and '&'
- \c fish_color_error, the color used to highlight potential errors
- \c fish_color_param, the color for regular command parameters
- \c fish_color_comment, the color used for code comments
- \c fish_color_match, the color used to highlight matching parenthesis
- \c fish_color_search_match, the color used to highlight history search matches
- \c fish_color_operator, the color for parameter expansion operators like '*' and '~'
- \c fish_color_escape, the color used to highlight character escapes like '\\n' and '\\x70'
- \c fish_color_cwd, the color used for the current working directory in the default prompt
Additionally, the following variables are available to change the
highlighting in the completion pager:
- \c fish_pager_color_prefix, the color of the prefix string, i.e. the string that is to be completed
- \c fish_pager_color_completion, the color of the completion itself
- \c fish_pager_color_description, the color of the completion description
- \c fish_pager_color_progress, the color of the progress bar at the bottom left corner
Example:
To make errors highlighted and red, use:
<code>set fish_color_error red --bold</code>D
\subsection variables-locale Locale variables
@@ -979,7 +1067,7 @@ Detected errors include:
- Mismatched parenthesis
When the cursor is over a parenthesis or a quote, \c fish also
highlights it's matching quote or parenthesis.
highlights its matching quote or parenthesis.
To customize the syntax highlighting, you can set the environment
variables \c fish_color_normal, \c fish_color_command, \c
@@ -1021,9 +1109,14 @@ where \c prompt_pwd is a shellscript function that displays a condensed version
\subsection title Programmable title
When running in a virtual terminal, the user define the \c fish_title
function to print a custom titlebar message. The \c fish_title
function is executed and the output is used as a titlebar message.
When using most virtual terminals, it is possible to set the message
displayed in the titlebar of the terminal window. This can be done
automatically in fish by defining the \c fish_title function. The \c
fish_title function is executed before and after a new command is
executed or put into the foreground and the output is used as a
titlebar message. The $_ environment variable will always contain the
name of the job to be put into the foreground (Or 'fish' if control is
returning to the shell) when the fish_prompt function is called.
Example:
<p>
@@ -1065,7 +1158,7 @@ command.
If you install fish in your home directory, fish will not work
correctly for any other user than yourself. This is because fish needs
it's initalization files to function properly. To solve this
its initalization files to function properly. To solve this
problem, either copy the initialization files to each fish users home
directory, or install them in /etc.
@@ -1125,7 +1218,7 @@ msgstr "%ls: Inget passande jobb\n"
placeholders. These will be replaced by a value by fish at
runtime. You must always take care to use exactly the same
placeholders in the same order in your translation. (Actually, there
are ways to avoid this, but they are to complicated for this short
are ways to avoid this, but they are too complicated for this short
introduction. See the full manual for the printf C function for more
information.)
@@ -1137,19 +1230,17 @@ href='fish-users@lists.sf.net'>fish-users@lists.sf.net</a>.
\subsection todo-features Missing features
- Complete vi-mode key bindings
- next-history-complete
- More completions (for example xterm, vim,
konsole, gnome-terminal, dcop, cdrecord, cron, xargs
konsole, gnome-terminal, dcop, cron,
rlogin, telnet, rsync, arch, finger, nice, locate,
bibtex, patch, aspell, xpdf,
bibtex, aspell, xpdf,
compress, wine, xmms, dig, wine, batch, cron,
g++, javac, java, gcj, lpr, doxygen, whois, find)
- Undo support
- Check keybinding commands for output - if nothing has happened, don't repaint to reduce flicker
- The jobs builtin should be able to give information on a specific job, such as the pids of the processes in the job
- Syntax highlighting should mark cd to non-existing directories as an error
- wait shellscript
- Signal handler to save the history file before exiting from a signal
- Support for the screen clipboard
\subsection todo-possible Possible features
@@ -1167,17 +1258,16 @@ g++, javac, java, gcj, lpr, doxygen, whois, find)
- Inclusion guards for the init files to make them evaluate only once, even if the user has installed fish both in /etc and in $HOME
- Do not actually load/parse .fish_history, only mmap it and use some clever string handling. Should save ~150 kB of memory permanently, but is very hard to implement.
- command specific wildcarding (use case * instead of case '*', etc.)
- show the whole list of commands on using tab on an empty commandline
- Automatically move cursor to the end of the current token before completing
- Map variables. (export only the values. When expanding with no key specified, expand to all values.)
- Descriptions for variables using 'set -d'.
- Parse errors should when possible honor IO redirections
- Support for writing strings like /u/l/b/foo and have them expand to /usr/local/bin/foo - perhaps through tab expansion
\subsection bugs Known bugs
- Completion for gcc -\#\#\# option doesn't work.
- Yanking weird characters from clipboard prints Unicode escapes
- Yanking weird characters from the clipboard prints Unicode escapes
- Suspending and then resuming pipelines containing a builtin is broken. How should this be handled?
If you think you have found a bug not described here, please send a
@@ -1233,7 +1323,7 @@ Examples:
- Here documents are too similar to using echo inside of a pipeline.
- Subshells, command substitution and process substitution are strongly related. \c fish only supports command substitution, the others can be achived either using a block or the psub shellscript function.
- Having both aliases and functions is confusing, especially since both of them have limitations and problems. \c fish sunctions have none of the drawbacks of either syntax.
- Having both aliases and functions is confusing, especially since both of them have limitations and problems. \c fish functions have none of the drawbacks of either syntax.
- The many Posix quoting styles are silly, especially \$''.
@@ -1326,14 +1416,14 @@ Examples:
\subsection disc The law of discoverability
The shell should implement it's features in a way that makes them as
easy as possible for the user to discover for her/himself.
A program should be designed to make its features as
easy as possible to discover for the user.
Rationale:
A program whose features are discoverable makes a new user into an
expert in a shorter span of time, since the user will learn how to use
the program simply by using it.
A program whose features are discoverable turns a new user into an
expert in a shorter span of time, since the user will become an expert
on the program simply by using it.
The main benefit of a graphical program over a command line-based
program is discoverability. In a graphical program, one can discover
@@ -1355,8 +1445,8 @@ Examples:
/** \page license Licenses
Fish Copyright (C) 2005 Axel Liljencrantz. Fish is released under the
GNU General Public License. The license agreement is included
below.
GNU General Public License, version 2. The license agreement is
included below.
Fish contains code under the BSD license, namely versions of the
two functions strlcat and strlcpy, modified for use with wide
@@ -1365,11 +1455,16 @@ license agreement is included below.
The XSel command, written and copyrighted by Conrad Parker, is
distributed together with, and used by fish. It is released under the MIT
license. The license agreement is included below.
license. The license agreement is included below.
The xdgmime library, written and copyrighted by Red Hat, Inc, is used
by the mimedb command, which is a part of fish. It is released under
the LGPL license. The license agreement is included below.
the LGPL. The license agreement is included below.
Fish contains code from the glibc library, namely the wcstok
function. This code is licensed under the LGPL. The license agreement
is included below.
<HR>
@@ -2407,4 +2502,4 @@ href='mailto:fish-users@lists.sf.net'>fish mailing list</a>, and
hopefully this can be resolved.
*/
*/

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

@@ -3,6 +3,10 @@
\subsection set-synopsis Synopsis
<code>set [OPTIONS] [VARIABLE_NAME [VALUES...]]</code>
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
@@ -29,7 +33,9 @@ elements, it will become an array with zero elements.
If the variable name is one or more array elements, such as
<code>PATH[1 3 7]</code>, only those array elements specified will be
changed.
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

View File

@@ -8,7 +8,19 @@
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
@@ -26,12 +38,14 @@ switch $animal
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
If the above code was run with \c \$animal set to \c whale, the output
would be \c mammal.
</p>

58
env.c
View File

@@ -33,7 +33,10 @@
#include <errno.h>
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "proc.h"
#include "common.h"
@@ -101,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;
@@ -393,7 +396,7 @@ static void setup_path()
al_init( &l );
if( path )
expand_variable_array( path, &l );
tokenize_variable_array( path, &l );
for( j=0; path_el[j]; j++ )
{
@@ -435,7 +438,7 @@ static void setup_path()
al_foreach( &l, (void (*)(const void *))&free );
path = env_get( L"PATH" );
al_truncate( &l, 0 );
expand_variable_array( path, &l );
tokenize_variable_array( path, &l );
}
}
@@ -605,9 +608,9 @@ static env_node_t *env_get_node( const wchar_t *key )
return 0;
}
void env_set( const wchar_t *key,
const wchar_t *val,
int var_mode )
int env_set( const wchar_t *key,
const wchar_t *val,
int var_mode )
{
int free_val = 0;
var_entry_t *entry;
@@ -623,7 +626,7 @@ void env_set( const wchar_t *key,
if( (var_mode & ENV_USER ) &&
hash_get( &env_read_only, key ) )
{
return;
return ENV_PERM;
}
if( wcscmp( key, L"umask" ) == 0)
@@ -647,7 +650,7 @@ void env_set( const wchar_t *key,
/*
Do not actually create a umask variable, on env_get, it will be calculated dynamically
*/
return;
return 0;
}
/*
@@ -746,7 +749,7 @@ void env_set( const wchar_t *key,
node = top;
while( node->next && !node->new_scope )
node = node->next;
}
}
}
@@ -794,6 +797,7 @@ void env_set( const wchar_t *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 );
@@ -806,25 +810,33 @@ void env_set( const wchar_t *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;
@@ -853,7 +865,22 @@ 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 );
}
@@ -889,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 item at index %d\n" ), i );
/*
This is not an error - it simply means the user has
a short history
*/
break;
}

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>
@@ -26,7 +27,9 @@
#include <signal.h>
#include "fallback.h"
#include "util.h"
#include "common.h"
#include "wutil.h"
#include "env_universal_common.h"

View File

@@ -7,6 +7,7 @@
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
@@ -27,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"

View File

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

View File

@@ -42,12 +42,15 @@ end
#
# Set various color values
# Set various defaults using these throwaway functions
#
function set_default -d "Set an exported universal variable, unless it has already been set"
function set_default -d "Set an universal variable, unless it has already been set"
if not set -q $argv[1]
set -Ux -- $argv
set -U -- $argv
end
if not set -q $argv[1]
set -g -- $argv
end
end
@@ -55,6 +58,9 @@ function set_exported_default -d "Set an exported universal variable, unless it
if not set -q $argv[1]
set -Ux -- $argv
end
if not set -q $argv[1]
set -gx -- $argv
end
end
@@ -62,8 +68,11 @@ end
set_default fish_color_normal normal
set_default fish_color_command green
set_default fish_color_redirection normal
set_default fish_color_comment brown
set_default fish_color_error red
set_default fish_color_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
@@ -79,7 +88,10 @@ set_default fish_pager_color_completion normal
set_default fish_pager_color_description normal
set_default fish_pager_color_progress cyan
#
# Directory history colors
#
set_default fish_color_history_current cyan
@@ -90,7 +102,7 @@ set_default fish_color_history_current cyan
set_default CDPATH . ~
#
# Remove temporary functions
# Remove temporary functions for setting default variable values
#
functions -e set_exported_default

16
event.c
View File

@@ -12,7 +12,10 @@
#include <string.h>
#include "config.h"
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "function.h"
#include "proc.h"
@@ -54,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
@@ -270,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 )
@@ -614,7 +620,6 @@ void event_fire( event_t *event )
void event_init()
{
sig_list[active_list].count=0;
}
void event_destroy()
@@ -650,3 +655,4 @@ void event_free( event_t *e )
free( (void *)e->param1.variable );
free( e );
}

40
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"
@@ -123,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] );
@@ -161,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 )
{
@@ -182,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.
*/
@@ -561,7 +551,7 @@ static void internal_exec_helper( const wchar_t *def,
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
*/
@@ -572,7 +562,7 @@ static void internal_exec_helper( const wchar_t *def,
}
signal_unblock();
eval( def, io_internal, block_type );
signal_block();
@@ -650,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;
@@ -664,6 +652,11 @@ void exec( job_t *j )
*/
int exec_error=0;
if( no_exec )
return;
sigemptyset( &chldset );
sigaddset( &chldset, SIGCHLD );
debug( 4, L"Exec job '%ls' with id %d", j->command, j->job_id );
@@ -831,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;
@@ -846,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 )
@@ -1203,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,

11
exec.h
View File

@@ -18,17 +18,6 @@
*/
#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();
/**
Execute the processes specified by j.

191
expand.c
View File

@@ -27,7 +27,10 @@ parameter expansion.
#endif
#include "config.h"
#include "fallback.h"
#include "util.h"
#include "common.h"
#include "wutil.h"
#include "env.h"
@@ -73,27 +76,6 @@ parameter expansion.
*/
#define COMPLETE_LAST_DESC _( L"Last background job")
/**
Error issued on invalid variable name
*/
#define COMPLETE_VAR_DESC _( L"The '$' character begins a variable name. The character '%lc', which directly followed a '$', is not allowed as a part of a variable name, and variable names may not be zero characters long. To learn more about variable expansion in fish, type 'help expand-variable'.")
/**
Error issued on invalid variable name
*/
#define COMPLETE_VAR_NULL_DESC _( L"The '$' begins a variable name. It was given at the end of an argument. Variable names may not be zero characters long. To learn more about variable expansion in fish, type 'help expand-variable'.")
/**
Error issued on invalid variable name
*/
#define COMPLETE_VAR_BRACKET_DESC _( L"Did you mean {$VARIABLE}? The '$' character begins a variable name. A bracket, which directly followed a '$', is not allowed as a part of a variable name, and variable names may not be zero characters long. To learn more about variable expansion in fish, type 'help expand-variable'." )
/**
Error issued on invalid variable name
*/
#define COMPLETE_VAR_PARAN_DESC _( L"Did you mean (COMMAND)? In fish, the '$' character is only used for accessing variables. To learn more about command substitution in fish, type 'help expand-command-substitution'.")
/**
String in process expansion denoting ourself
*/
@@ -114,15 +96,7 @@ parameter expansion.
*/
#define UNCLEAN L"$*?\\\"'({})"
/**
Test if the specified argument is clean, i.e. it does not contain
any tokens which need to be expanded or otherwise altered. Clean
strings can be passed through expand_string and expand_one without
changing them. About 90% of all strings are clean, so skipping
expansion on them actually does save a small amount of time, since
it avoids multiple memory allocations during the expansion process.
*/
static int is_clean( const wchar_t *in )
int expand_is_clean( const wchar_t *in )
{
const wchar_t * str = in;
@@ -156,32 +130,6 @@ static wchar_t *expand_var( wchar_t *in )
return env_get( in );
}
void expand_variable_array( const wchar_t *val, array_list_t *out )
{
if( val )
{
wchar_t *cpy = wcsdup( val );
wchar_t *pos, *start;
if( !cpy )
{
die_mem();
}
for( start=pos=cpy; *pos; pos++ )
{
if( *pos == ARRAY_SEP )
{
*pos=0;
al_push( out, start==cpy?cpy:wcsdup(start) );
start=pos+1;
}
}
al_push( out, start==cpy?cpy:wcsdup(start) );
}
}
/**
Test if the specified string does not contain character which can
not be used inside a quoted string.
@@ -214,7 +162,7 @@ wchar_t *expand_escape_variable( const wchar_t *in )
string_buffer_t buff;
al_init( &l );
expand_variable_array( in, &l );
tokenize_variable_array( in, &l );
sb_init( &buff );
switch( al_get_count( &l) )
@@ -222,7 +170,7 @@ wchar_t *expand_escape_variable( const wchar_t *in )
case 0:
sb_append( &buff, L"''");
break;
case 1:
{
wchar_t *el = (wchar_t *)al_get( &l, 0 );
@@ -278,28 +226,19 @@ wchar_t *expand_escape_variable( const wchar_t *in )
}
/**
Tests if all characters in the string are numeric
*/
static int isnumeric( const char *n )
{
if( *n == '\0' )
return 1;
if( *n < '0' || *n > '9' )
return 0;
return isnumeric( n+1 );
}
/**
Tests if all characters in the wide string are numeric
*/
static int iswnumeric( const wchar_t *n )
{
if( *n == L'\0' )
return 1;
if( *n < L'0' || *n > L'9' )
return 0;
return iswnumeric( n+1 );
for( ; *n; n++ )
{
if( *n < L'0' || *n > L'9' )
{
return 0;
}
}
return 1;
}
/**
@@ -374,9 +313,9 @@ static int find_process( const wchar_t *proc,
array_list_t *out )
{
DIR *dir;
struct dirent *next;
char *pdir_name;
char *pfile_name;
struct wdirent *next;
wchar_t *pdir_name;
wchar_t *pfile_name;
wchar_t *cmd=0;
int sz=0;
int found = 0;
@@ -418,17 +357,18 @@ static int find_process( const wchar_t *proc,
{
int jid = wcstol( proc, 0, 10 );
j = job_get( jid );
if( (j != 0) && (j->command != 0 ) )
if( jid > 0 )
{
j = job_get( jid );
if( (j != 0) && (j->command != 0 ) )
{
result = malloc(sizeof(wchar_t)*16 );
swprintf( result, 16, L"%d", j->pgid );
//fwprintf( stderr, L"pid %d %ls\n", j->pgid, result );
al_push( out, result );
found = 1;
{
result = malloc(sizeof(wchar_t)*16 );
swprintf( result, 16, L"%d", j->pgid );
al_push( out, result );
found = 1;
}
}
}
}
@@ -438,12 +378,9 @@ static int find_process( const wchar_t *proc,
for( j=first_job; j != 0; j=j->next )
{
// fwprintf( stderr, L"..." );
if( j->command == 0 )
continue;
// fwprintf( stderr, L"match '%ls' '%ls'\n\n\n", j->command, proc );
if( match_pid( j->command, proc, flags ) )
{
if( flags & ACCEPT_INCOMPLETE )
@@ -452,8 +389,6 @@ static int find_process( const wchar_t *proc,
COMPLETE_SEP_STR,
COMPLETE_JOB_DESC,
(void *)0 );
// fwprintf( stderr, L"Woot %ls\n", res );
al_push( out, res );
}
else
@@ -479,12 +414,9 @@ static int find_process( const wchar_t *proc,
for( p=j->first_process; p; p=p->next )
{
// fwprintf( stderr, L"..." );
if( p->actual_cmd == 0 )
continue;
// fwprintf( stderr, L"match '%ls' '%ls'\n\n\n", j->command, proc );
if( match_pid( p->actual_cmd, proc, flags ) )
{
if( flags & ACCEPT_INCOMPLETE )
@@ -519,20 +451,20 @@ static int find_process( const wchar_t *proc,
return 1;
}
pdir_name = malloc( 256 );
pfile_name = malloc( 64 );
strcpy( pdir_name, "/proc/" );
while( (next=readdir(dir))!=0 )
pdir_name = malloc( sizeof(wchar_t)*256 );
pfile_name = malloc( sizeof(wchar_t)*64 );
wcscpy( pdir_name, L"/proc/" );
while( (next=wreaddir(dir))!=0 )
{
char *name = next->d_name;
wchar_t *name = next->d_name;
struct stat buf;
if( !isnumeric( name ) )
if( !iswnumeric( name ) )
continue;
strcpy( pdir_name + 6, name );
if( stat( pdir_name, &buf ) )
wcscpy( pdir_name + 6, name );
if( wstat( pdir_name, &buf ) )
{
continue;
}
@@ -540,17 +472,17 @@ static int find_process( const wchar_t *proc,
{
continue;
}
strcpy( pfile_name, pdir_name );
strcat( pfile_name, "/cmdline" );
wcscpy( pfile_name, pdir_name );
wcscat( pfile_name, L"/cmdline" );
if( !stat( pfile_name, &buf ) )
if( !wstat( pfile_name, &buf ) )
{
/*
the 'cmdline' file exists, it should contain the commandline
*/
FILE *cmdfile;
if((cmdfile=fopen( pfile_name, "r" ))==0)
if((cmdfile=wfopen( pfile_name, "r" ))==0)
{
wperror( L"fopen" );
continue;
@@ -565,15 +497,15 @@ static int find_process( const wchar_t *proc,
else
{
#ifdef SunOS
strcpy( pfile_name, pdir_name );
strcat( pfile_name, "/psinfo" );
if( !stat( pfile_name, &buf ) )
wcscpy( pfile_name, pdir_name );
wcscat( pfile_name, L"/psinfo" );
if( !wstat( pfile_name, &buf ) )
{
psinfo_t info;
FILE *psfile;
if((psfile=fopen( pfile_name, "r" ))==0)
if((psfile=wfopen( pfile_name, "r" ))==0)
{
wperror( L"fopen" );
continue;
@@ -612,7 +544,7 @@ static int find_process( const wchar_t *proc,
}
else
{
wchar_t *res = str2wcs(name);
wchar_t *res = wcsdup(name);
if( res )
al_push( out, res );
}
@@ -684,27 +616,22 @@ static int expand_pid( wchar_t *in,
}
}
// fwprintf( stderr, L"expand_pid() %ls\n", in );
int prev = al_get_count( out );
if( !find_process( in+1, flags, out ) )
return 0;
if( prev == al_get_count( out ) )
{
// fwprintf( stderr, L"no match\n" );
if( flags & ACCEPT_INCOMPLETE )
free( in );
else
{
*in = L'%';
// fwprintf( stderr, L"return %ls\n", in );
al_push( out, in );
}
}
else
{
// fwprintf( stderr, L"match\n" );
free( in );
}
@@ -813,8 +740,7 @@ static int expand_variables( wchar_t *in, array_list_t *out, int last_idx )
{
error( SYNTAX_ERROR,
-1,
COMPLETE_VAR_NULL_DESC,
in[stop_pos] );
COMPLETE_VAR_NULL_DESC );
break;
}
@@ -882,7 +808,7 @@ static int expand_variables( wchar_t *in, array_list_t *out, int last_idx )
if( is_ok )
{
expand_variable_array( var_val, &var_item_list );
tokenize_variable_array( var_val, &var_item_list );
if( !all_vars )
{
int j;
@@ -964,7 +890,7 @@ static int expand_variables( wchar_t *in, array_list_t *out, int last_idx )
else
{
wcsncpy( new_in, in, start_pos-1 );
wcslcpy( new_in, in, start_pos );
if(start_pos>1 && new_in[start_pos-2]!=VARIABLE_EXPAND)
{
@@ -977,7 +903,6 @@ static int expand_variables( wchar_t *in, array_list_t *out, int last_idx )
wcscat( new_in, next );
wcscat( new_in, &in[stop_pos] );
// fwprintf( stderr, L"New value %ls\n", new_in );
is_ok &= expand_variables( new_in, out, i );
}
}
@@ -1056,9 +981,6 @@ static int expand_brackets( wchar_t *in, int flags, array_list_t *out )
wchar_t *item_begin;
int len1, len2, tot_len;
// fwprintf( stderr, L"expand %ls\n", in );
for( pos=in;
(!bracket_end) && (*pos) && !syntax_error;
pos++ )
@@ -1150,8 +1072,8 @@ static int expand_brackets( wchar_t *in, int flags, array_list_t *out )
int item_len = pos-item_begin;
whole_item = malloc( sizeof(wchar_t)*(tot_len + item_len + 1) );
wcsncpy( whole_item, in, len1 );
wcsncpy( whole_item+len1, item_begin, item_len );
wcslcpy( whole_item, in, len1+1 );
wcslcpy( whole_item+len1, item_begin, item_len+1 );
wcscpy( whole_item+len1+item_len, bracket_end+1 );
expand_brackets( whole_item, flags, out );
@@ -1231,7 +1153,7 @@ static int expand_subshell( wchar_t *in, array_list_t *out )
return 0;
}
wcsncpy( subcmd, paran_begin+1, paran_end-paran_begin-1 );
wcslcpy( subcmd, paran_begin+1, paran_end-paran_begin );
subcmd[ paran_end-paran_begin-1]=0;
if( exec_subshell( subcmd, &sub_res)==-1 )
@@ -1307,7 +1229,6 @@ static wchar_t * expand_tilde_internal( wchar_t *in )
wchar_t *new_in=0;
wchar_t *old_in=0;
// fwprintf( stderr, L"Tilde expand ~%ls\n", (*ptr)+1 );
if( in[1] == '/' || in[1] == '\0' )
{
/* Current users home directory */
@@ -1417,7 +1338,6 @@ static void remove_internal_separator( const void *s, int conv )
*out=0;
}
/**
The real expansion function. expand_one is just a wrapper around this one.
*/
@@ -1434,10 +1354,7 @@ int expand_string( void *context,
int res = EXPAND_OK;
int start_count = al_get_count( end_out );
// debug( 1, L"Expand %ls", str );
if( (!(flags & ACCEPT_INCOMPLETE)) && is_clean( str ) )
if( (!(flags & ACCEPT_INCOMPLETE)) && expand_is_clean( str ) )
{
halloc_register( context, str );
al_push( end_out, str );
@@ -1682,8 +1599,8 @@ wchar_t *expand_one( void *context, wchar_t *string, int flags )
array_list_t l;
int res;
wchar_t *one;
if( (!(flags & ACCEPT_INCOMPLETE)) && is_clean( string ) )
if( (!(flags & ACCEPT_INCOMPLETE)) && expand_is_clean( string ) )
{
halloc_register( context, string );
return string;

View File

@@ -112,6 +112,27 @@ enum
/** String containing the character for separating two array elements */
#define ARRAY_SEP_STR L"\x1e"
/**
Error issued on invalid variable name
*/
#define COMPLETE_VAR_DESC _( L"The '$' character begins a variable name. The character '%lc', which directly followed a '$', is not allowed as a part of a variable name, and variable names may not be zero characters long. To learn more about variable expansion in fish, type 'help expand-variable'.")
/**
Error issued on invalid variable name
*/
#define COMPLETE_VAR_NULL_DESC _( L"The '$' begins a variable name. It was given at the end of an argument. Variable names may not be zero characters long. To learn more about variable expansion in fish, type 'help expand-variable'.")
/**
Error issued on invalid variable name
*/
#define COMPLETE_VAR_BRACKET_DESC _( L"Did you mean {$VARIABLE}? The '$' character begins a variable name. A bracket, which directly followed a '$', is not allowed as a part of a variable name, and variable names may not be zero characters long. To learn more about variable expansion in fish, type 'help expand-variable'." )
/**
Error issued on invalid variable name
*/
#define COMPLETE_VAR_PARAN_DESC _( L"Did you mean (COMMAND)? In fish, the '$' character is only used for accessing variables. To learn more about command substitution in fish, type 'help expand-command-substitution'.")
/**
@@ -158,13 +179,14 @@ wchar_t *expand_tilde(wchar_t *in);
/**
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,8 +13,9 @@ URL: http://roo.no-ip.org/fish/
Source0: http://roo.no-ip.org/%{name}/files/%{version}/%{name}-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: doxygen ncurses-devel xorg-x11-devel
BuildRequires: doxygen ncurses-devel
BuildRequires: %{xinclude}/X11/StringDefs.h, %{xinclude}/X11/Xlib.h
BuildRequires: %{xinclude}/X11/Intrinsic.h, %{xinclude}/X11/Xatom.h

View File

@@ -35,7 +35,10 @@
#include <signal.h>
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "common.h"
#include "complete.h"
@@ -987,9 +990,12 @@ int main( int argc, char **argv )
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"
@@ -99,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;
@@ -287,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;
@@ -687,7 +690,6 @@ int main( int argc, char **argv )
proc_init();
halloc_util_init();
event_init();
exec_init();
parser_init();
function_init();
builtin_init();
@@ -715,7 +717,6 @@ int main( int argc, char **argv )
builtin_destroy();
complete_destroy();
wutil_destroy();
exec_destroy();
event_destroy();
proc_destroy();
halloc_util_destroy();

12
fishd.c
View File

@@ -41,6 +41,7 @@ time the original barrier request was sent have been received.
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>
@@ -61,7 +62,9 @@ time the original barrier request was sent have been received.
#include <locale.h>
#include <signal.h>
#include "fallback.h"
#include "util.h"
#include "common.h"
#include "wutil.h"
#include "env_universal_common.h"
@@ -107,6 +110,11 @@ time the original barrier request was sent have been received.
*/
#define LOCKTIMEOUT 1
/**
Getopt short switches for fishd
*/
#define GETOPT_STRING "hv"
/**
The list of connections to clients
*/
@@ -499,14 +507,14 @@ int main( int argc, char ** argv )
int opt = getopt_long( argc,
argv,
"hv",
GETOPT_STRING,
long_options,
&opt_index );
#else
int opt = getopt( argc,
argv,
"hv" );
GETOPT_STRING );
#endif
if( opt == -1 )
break;

View File

@@ -9,10 +9,14 @@
#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"
@@ -83,7 +87,7 @@ static void autoload_names( array_list_t *out, int get_hidden )
al_init( &path_list );
expand_variable_array( path_var, &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 );
@@ -191,14 +195,17 @@ int function_exists( const wchar_t *cmd )
void function_remove( const wchar_t *name )
{
void *key;
const void *dv;
function_data_t *d;
event_t ev;
hash_remove( &function,
name,
(const void **) &key,
(const void **)&d );
&dv );
d=(function_data_t *)dv;
if( !key )
return;
@@ -227,7 +234,7 @@ const wchar_t *function_get_desc( const wchar_t *argv )
if( data == 0 )
return 0;
return data->desc;
return _(data->desc);
}
void function_set_desc( const wchar_t *name, const wchar_t *desc )
@@ -241,6 +248,19 @@ void function_set_desc( const wchar_t *name, const wchar_t *desc )
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
*/
@@ -251,8 +271,25 @@ 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 )
@@ -260,9 +297,13 @@ 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 );
}
}

View File

@@ -8,10 +8,13 @@
#include "config.h"
#include <stdlib.h>
#include <unistd.h>
#include "fallback.h"
#include "util.h"
#include "common.h"
#include "halloc.h"
@@ -38,7 +41,7 @@ typedef struct halloc
static halloc_t *halloc_from_data( void *data )
{
return (halloc_t *)(data - sizeof( halloc_t ) );
return (halloc_t *)(((char *)data) - sizeof( halloc_t ) );
}
static void late_free( void *data)
@@ -80,7 +83,7 @@ void *halloc( void *context, size_t size )
{
res = parent->scratch;
parent->scratch_free -= size;
parent->scratch += size;
parent->scratch = ((char *)parent->scratch)+size;
}
else
{
@@ -95,7 +98,7 @@ void *halloc( void *context, size_t size )
alloc_spill += parent->scratch_free;
#endif
res = calloc( 1, size + HALLOC_BLOCK_SIZE );
parent->scratch = res + size;
parent->scratch = (char *)res + size;
parent->scratch_free = HALLOC_BLOCK_SIZE;
}
else
@@ -118,7 +121,7 @@ void *halloc( void *context, size_t size )
#ifdef HALLOC_DEBUG
parent_count++;
#endif
me->scratch = ((void *)me) + sizeof(halloc_t) + size;
me->scratch = ((char *)me) + sizeof(halloc_t) + size;
me->scratch_free = HALLOC_BLOCK_SIZE;
al_init( &me->children );

View File

@@ -8,11 +8,14 @@
#include "config.h"
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include "fallback.h"
#include "util.h"
#include "common.h"
#include "halloc.h"

View File

@@ -12,7 +12,10 @@
#include <signal.h>
#include "config.h"
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "highlight.h"
#include "tokenizer.h"
@@ -37,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",
@@ -49,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 )
{
@@ -76,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,
@@ -122,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
{
@@ -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,7 +12,10 @@
#include "config.h"
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "history.h"
#include "common.h"
@@ -199,6 +202,10 @@ static void history_to_hash()
{
history_data *d;
if( !history_last )
return;
d = (history_data *)hash_get( &history_table,
mode_name );
@@ -288,7 +295,7 @@ static void history_save()
history_count=0;
past_end=1;
history_load( mode_name );
history_load();
if( real_pos != 0 )
{
/*

24
input.c
View File

@@ -43,7 +43,10 @@ implementation in fish is as of yet incomplete.
#include <wctype.h>
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "reader.h"
#include "proc.h"
@@ -116,7 +119,8 @@ const wchar_t *name_arr[] =
L"history-token-search-backward",
L"history-token-search-forward",
L"self-insert",
L"null"
L"null",
L"eof"
}
;
@@ -152,7 +156,8 @@ const wchar_t *desc_arr[] =
L"Search backward through list of previous commands for matching token",
L"Search forward through list of previous commands for matching token",
L"Insert the pressed key",
L"Do nothing"
L"Do nothing",
L"End of file"
}
;
@@ -188,7 +193,8 @@ const wchar_t code_arr[] =
R_HISTORY_TOKEN_SEARCH_BACKWARD,
R_HISTORY_TOKEN_SEARCH_FORWARD,
R_SELF_INSERT,
R_NULL
R_NULL,
R_EOF
}
;
@@ -225,6 +231,8 @@ static int inputrc_block_count=0;
*/
static int inputrc_error = 0;
static int is_init = 0;
wchar_t input_get_code( wchar_t *name )
{
@@ -1343,6 +1351,11 @@ int input_init()
{
wchar_t *fn;
if( is_init )
return 1;
is_init = 1;
input_common_init( &interrupt_handler );
if( setupterm( 0, STDOUT_FILENO, 0) == ERR )
@@ -1421,6 +1434,11 @@ static void destroy_mapping( const void *key, const void *val )
void input_destroy()
{
if( !is_init )
return;
is_init=0;
input_common_destroy();
hash_foreach( &all_mappings, &destroy_mapping );

View File

@@ -9,6 +9,7 @@ inputrc information for key bindings.
#define FISH_INPUT_H
#include <wchar.h>
#include "input_common.h"
/**
Key codes for inputrc-style keyboard functions that are passed on
@@ -16,7 +17,7 @@ inputrc information for key bindings.
*/
enum
{
R_BEGINNING_OF_LINE = R_NULL+1,
R_BEGINNING_OF_LINE = R_NULL+10, /* This give input_common ten slots for lowlevel keycodes */
R_END_OF_LINE,
R_FORWARD_CHAR,
R_BACKWARD_CHAR,

View File

@@ -5,6 +5,7 @@ Implementation file for the low level input library
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -15,7 +16,9 @@ Implementation file for the low level input library
#include <wchar.h>
#include "fallback.h"
#include "util.h"
#include "common.h"
#include "wutil.h"
#include "input_common.h"
@@ -61,7 +64,7 @@ static wint_t readb()
{
unsigned char arr[1];
int do_loop = 0;
do
{
fd_set fd;
@@ -86,28 +89,25 @@ static wint_t readb()
case EINTR:
case EAGAIN:
{
// wperror( L"select" );
if( interrupt_handler )
{
int res = interrupt_handler();
/* debug( 0,
L"interrupt, %d is %ls",
res,
(res==R_NULL?L"good": L"Bad") );
*/
if( res )
{
return res;
}
}
do_loop = 1;
break;
}
default:
{
debug( 0, L"Error while reading input from keyboard, shutting down" );
wperror(L"read");
exit(1);
/*
The teminal has been closed. Save and exit.
*/
return R_EOF;
}
}
}
@@ -119,17 +119,17 @@ static wint_t readb()
{
debug( 3, L"Wake up on universal variable event" );
env_universal_read_all();
debug( 3, L"Return R_NULL" );
return R_NULL;
do_loop = 1;
}
}
if( FD_ISSET( 0, &fd ) )
{
if( read_blocked( 0, arr, 1 ) == -1 )
if( read_blocked( 0, arr, 1 ) != 1 )
{
debug( 0, L"Error while reading input from keyboard, shutting down" );
wperror(L"read");
exit(1);
/*
The teminal has been closed. Save and exit.
*/
return R_EOF;
}
do_loop = 0;
}
@@ -140,6 +140,7 @@ static wint_t readb()
return arr[0];
}
wchar_t input_common_readch( int timed )
{
if( lookahead_count == 0 )
@@ -183,8 +184,8 @@ wchar_t input_common_readch( int timed )
int sz;
if( b == R_NULL )
return R_NULL;
if( (b == R_NULL) || (b == R_EOF) )
return b;
bb=b;

View File

@@ -20,7 +20,8 @@ enum
requested but none could be delivered, or when an exception
happened.
*/
R_NULL = INPUT_COMMON_RESERVED
R_NULL = INPUT_COMMON_RESERVED,
R_EOF
}
;

View File

@@ -5,12 +5,15 @@
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
#include <unistd.h>
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "common.h"
#include "intern.h"

20
io.c
View File

@@ -5,6 +5,7 @@ Utilities for io redirection.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
@@ -31,7 +32,9 @@ Utilities for io redirection.
#include <ncurses/term.h>
#endif
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "exec.h"
#include "common.h"
@@ -210,37 +213,34 @@ io_data_t *io_get( io_data_t *io, int fd )
return 0;
}
/*
static void io_print( io_data_t *io )
void io_print( io_data_t *io )
{
if( !io )
{
fwprintf( stderr, L"\n" );
return;
}
fwprintf( stderr, L"IO fd %d, type ",
debug( 1, L"IO fd %d, type ",
io->fd );
switch( io->io_mode )
{
case IO_PIPE:
fwprintf(stderr, L"PIPE, data %d\n", io->pipe_fd[io->fd?1:0] );
debug( 1, L"PIPE, data %d", io->param1.pipe_fd[io->fd?1:0] );
break;
case IO_FD:
fwprintf(stderr, L"FD, copy %d\n", io->old_fd );
debug( 1, L"FD, copy %d", io->param1.old_fd );
break;
case IO_BUFFER:
fwprintf( stderr, L"BUFFER\n" );
debug( 1, L"BUFFER" );
break;
default:
fwprintf( stderr, L"OTHER\n" );
debug( 1, L"OTHER" );
}
io_print( io->next );
}
*/

2
io.h
View File

@@ -89,4 +89,6 @@ io_data_t *io_buffer_create();
*/
void io_buffer_read( io_data_t *d );
void io_print( io_data_t *io );
#endif

View File

@@ -5,6 +5,8 @@
Type ^C to exit the program.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -13,6 +15,8 @@
#include <locale.h>
#include <termcap.h>
#include "fallback.h"
#include "input_common.h"
int writestr( char *str )

3
kill.c
View File

@@ -18,7 +18,10 @@
#include "config.h"
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "kill.h"
#include "proc.h"

57
main.c
View File

@@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
@@ -40,7 +41,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <locale.h>
#include <signal.h>
#include "fallback.h"
#include "util.h"
#include "common.h"
#include "reader.h"
#include "builtin.h"
@@ -58,6 +61,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "output.h"
#include "translate.h"
#include "halloc_util.h"
#include "history.h"
/**
The string describing the single-character options accepted by the main fish binary
*/
#define GETOPT_STRING "hilnvc:p:d:"
/**
Parse init files
@@ -66,7 +75,7 @@ static int read_init()
{
char cwd[4096];
wchar_t *wcwd;
if( !getcwd( cwd, 4096 ) )
{
wperror( L"getcwd" );
@@ -74,11 +83,11 @@ static int read_init()
}
env_set( L"__fish_help_dir", DOCDIR, 0);
eval( L"builtin cd " DATADIR L"/fish 2>/dev/null; . fish 2>/dev/null", 0, TOP );
eval( L"builtin cd " SYSCONFDIR L" 2>/dev/null; . fish 2>/dev/null", 0, TOP );
eval( L"builtin cd 2>/dev/null;. .fish 2>/dev/null", 0, TOP );
eval( L"builtin cd " DATADIR L"/fish 2>/dev/null; and . fish 2>/dev/null", 0, TOP );
eval( L"builtin cd " SYSCONFDIR L" 2>/dev/null; and . fish 2>/dev/null", 0, TOP );
eval( L"builtin cd 2>/dev/null; and . .fish 2>/dev/null", 0, TOP );
if( chdir( cwd ) == -1 )
{
// fwprintf( stderr, L"Invalid directory: %s\n", cwd );
@@ -134,6 +143,10 @@ int main( int argc, char **argv )
"login", no_argument, 0, 'l'
}
,
{
"no-execute", no_argument, 0, 'n'
}
,
{
"profile", required_argument, 0, 'p'
}
@@ -156,14 +169,14 @@ int main( int argc, char **argv )
int opt = getopt_long( argc,
argv,
"hilvc:p:d:",
GETOPT_STRING,
long_options,
&opt_index );
#else
int opt = getopt( argc,
argv,
"hilvc:p:d:" );
GETOPT_STRING );
#endif
if( opt == -1 )
break;
@@ -206,6 +219,10 @@ int main( int argc, char **argv )
is_login=1;
break;
case 'n':
no_exec=1;
break;
case 'p':
profile = optarg;
break;
@@ -232,12 +249,20 @@ int main( int argc, char **argv )
is_interactive_session &= isatty(STDIN_FILENO);
is_interactive_session |= force_interactive;
/*
No-exec is prohibited when in interactive mode
*/
if( is_interactive_session && no_exec)
{
debug( 1, _(L"Can not use the no-execute mode when running an interactive session") );
no_exec = 0;
}
common_init();
halloc_util_init();
proc_init();
event_init();
exec_init();
wutil_init();
parser_init();
builtin_init();
@@ -245,7 +270,8 @@ int main( int argc, char **argv )
env_init();
complete_init();
reader_init();
history_init();
if( read_init() )
{
if( cmd != 0 )
@@ -253,7 +279,7 @@ int main( int argc, char **argv )
wchar_t *cmd_wcs = str2wcs( cmd );
res = eval( cmd_wcs, 0, TOP );
free(cmd_wcs);
reader_exit(0);
reader_exit(0, 0);
}
else
{
@@ -276,10 +302,10 @@ int main( int argc, char **argv )
return 1;
}
sb_init( &sb );
if( *(argv+2))
{
sb_init( &sb );
for( i=1,ptr = argv+2; *ptr; i++, ptr++ )
{
if( i != 1 )
@@ -315,7 +341,8 @@ int main( int argc, char **argv )
}
proc_fire_event( L"PROCESS_EXIT", EVENT_EXIT, getpid(), res );
history_destroy();
complete_destroy();
proc_destroy();
env_destroy();
@@ -324,12 +351,12 @@ int main( int argc, char **argv )
reader_destroy();
parser_destroy();
wutil_destroy();
exec_destroy();
event_destroy();
common_destroy();
halloc_util_destroy();
intern_free_all();
return res;
}

View File

@@ -21,6 +21,7 @@ license. Read the source code of the library for more information.
#include "config.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
@@ -43,8 +44,10 @@ license. Read the source code of the library for more information.
#endif
#include "xdgmime.h"
#include "fallback.h"
#include "util.h"
/**
Location of the applications .desktop file, relative to a base mime directory
*/
@@ -85,6 +88,11 @@ license. Read the source code of the library for more information.
*/
#define MIMEDB "mimedb"
/**
Getopt short switches for mimedb
*/
#define GETOPT_STRING "tfimdalhv"
/**
All types of input and output possible
*/
@@ -1213,14 +1221,14 @@ int main (int argc, char *argv[])
int opt = getopt_long( argc,
argv,
"tfimdalhv",
GETOPT_STRING,
long_options,
&opt_index );
#else
int opt = getopt( argc,
argv,
"tfimdalhv" );
GETOPT_STRING );
#endif
if( opt == -1 )
break;

104
output.c
View File

@@ -38,7 +38,10 @@
#include <time.h>
#include <wchar.h>
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "expand.h"
#include "common.h"
@@ -125,9 +128,20 @@ void set_color( int c, int c2 )
{
static int last_color = FISH_COLOR_NORMAL;
static int last_color2 = FISH_COLOR_NORMAL;
static int was_bold=0;
int bg_set=0, last_bg_set=0;
char *fg = 0, *bg=0;
int is_bold = 0;
is_bold |= (c&FISH_COLOR_BOLD)!=0;
is_bold |= (c2&FISH_COLOR_BOLD)!=0;
// debug( 1, L"WOO %d %d %d", is_bold, c&FISH_COLOR_BOLD,c2&FISH_COLOR_BOLD);
c = c&(~FISH_COLOR_BOLD);
c2 = c2&(~FISH_COLOR_BOLD);
if( (set_a_foreground != 0) && (strlen( set_a_foreground) != 0 ) )
{
fg = set_a_foreground;
@@ -142,14 +156,31 @@ void set_color( int c, int c2 )
if( (c == FISH_COLOR_RESET) || (c2 == FISH_COLOR_RESET))
{
c = c2 = FISH_COLOR_NORMAL;
was_bold=0;
if( fg )
{
/*
If we exit attibute mode, we must first set a color, or
previously coloured text might lose it's
color. Terminals are weird...
*/
writembs( tparm( fg, 0 ) );
}
writembs( exit_attribute_mode );
return;
}
if( was_bold && !is_bold )
{
/*
Only way to exit bold mode is a reset of all attributes.
*/
writembs( exit_attribute_mode );
last_color = FISH_COLOR_NORMAL;
last_color2 = FISH_COLOR_NORMAL;
was_bold=0;
}
if( last_color2 != FISH_COLOR_NORMAL &&
last_color2 != FISH_COLOR_RESET &&
last_color2 != FISH_COLOR_IGNORE )
@@ -161,7 +192,6 @@ void set_color( int c, int c2 )
}
if( c2 != FISH_COLOR_NORMAL &&
c2 != FISH_COLOR_RESET &&
c2 != FISH_COLOR_IGNORE )
{
/*
@@ -177,7 +207,8 @@ void set_color( int c, int c2 )
{
/*
Background color changed and is set, so we enter bold
mode to make reading easier
mode to make reading easier. This means bold mode is
_always_ on when the background color is set.
*/
writembs( enter_bold_mode );
}
@@ -249,8 +280,21 @@ void set_color( int c, int c2 )
last_color2 = c2;
}
}
/*
Lastly, we set bold mode correctly
*/
if( (enter_bold_mode != 0) && (strlen(enter_bold_mode) > 0) && !bg_set )
{
if( is_bold && !was_bold )
{
writembs( tparm( enter_bold_mode ) );
}
was_bold = is_bold;
}
}
/**
perm_left_cursor and parm_right_cursor don't seem to be properly
emulated by many terminal emulators, so we only use plain
@@ -292,15 +336,7 @@ int writeb( tputs_arg_t b )
int writembs( char *str )
{
#ifdef TPUTS_KLUDGE
while( *str )
{
out( *str );
}
#else
tputs(str,1,writeb);
#endif
return 0;
return tputs(str,1,&writeb)==ERR?1:0;
}
int writech( wint_t ch )
@@ -480,23 +516,37 @@ int writespace( int c )
int output_color_code( const wchar_t *val )
{
int i, color=-1;
int j, i, color=FISH_COLOR_NORMAL;
array_list_t el;
int is_bold=0;
for( i=0; i<COLORS; i++ )
{
if( wcscasecmp( col[i], val ) == 0 )
{
color = col_idx[i];
break;
}
}
if( color >= 0 )
{
return color;
}
else
{
if( !val )
return FISH_COLOR_NORMAL;
al_init( &el );
tokenize_variable_array( val, &el );
for( j=0; j<al_get_count( &el ); j++ )
{
wchar_t *next = (wchar_t *)al_get( &el, j );
is_bold |= (wcsncmp( next, L"--bold", wcslen(next) ) == 0 ) && wcslen(next)>=3;
is_bold |= wcscmp( next, L"-b" ) == 0;
for( i=0; i<COLORS; i++ )
{
if( wcscasecmp( col[i], next ) == 0 )
{
color = col_idx[i];
break;
}
}
}
al_foreach( &el, (void (*)(const void *))&free );
al_destroy( &el );
return color | (is_bold?FISH_COLOR_BOLD:0);
}

View File

@@ -14,7 +14,6 @@ enum
{
HIGHLIGHT_NORMAL,
HIGHLIGHT_COMMAND,
HIGHLIGHT_SUBSHELL,
HIGHLIGHT_REDIRECTION,
HIGHLIGHT_END,
HIGHLIGHT_ERROR,
@@ -22,6 +21,9 @@ enum
HIGHLIGHT_COMMENT,
HIGHLIGHT_MATCH,
HIGHLIGHT_SEARCH_MATCH,
HIGHLIGHT_OPERATOR,
HIGHLIGHT_ESCAPE,
HIGHLIGHT_QUOTE,
}
;
@@ -39,10 +41,13 @@ enum
FISH_COLOR_CYAN,
FISH_COLOR_WHITE,
/** The default fg color of the terminal */
FISH_COLOR_NORMAL
FISH_COLOR_NORMAL,
FISH_COLOR_IGNORE,
FISH_COLOR_RESET
}
;
#define FISH_COLOR_BOLD 0x80
/**
Sets the fg and bg color. May be called as often as you like, since

View File

@@ -6,6 +6,7 @@
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
@@ -17,7 +18,9 @@
#include <time.h>
#include <assert.h>
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "common.h"
#include "tokenizer.h"
@@ -555,7 +558,7 @@ int parse_util_load( const wchar_t *cmd,
else
sb_clear( path );
expand_variable_array( path_var, path_list );
tokenize_variable_array( path_var, path_list );
/*
Iterate over path searching for suitable completion files

750
parser.c

File diff suppressed because it is too large Load Diff

View File

@@ -259,6 +259,12 @@ int parser_is_subcommand( const wchar_t *cmd );
*/
int parser_is_reserved( const wchar_t *word );
/**
Test if the specified string is command that opens a new block
*/
int parser_is_block( const wchar_t *word);
/**
Returns a string describing the current parser pisition in the format 'FILENAME (line LINE_NUMBER): LINE'.
Example:
@@ -309,10 +315,20 @@ const wchar_t *parser_get_block_desc( int block );
/**
Test if the specified string can be parsed, or if more bytes need to be read first.
The result has the first bit set if the string contains errors, and the second bit is set if the string contains an unclosed block.
Test if the specified string can be parsed, or if more bytes need
to be read first. The result has the first bit set if the string
contains errors, and the second bit is set if the string contains
an unclosed block.
*/
int parser_test( wchar_t * buff, int babble );
int parser_test( const wchar_t * buff, int babble );
/**
Test if the specified string can be parsed as an argument list,
e.g. sent to eval_args. The result has the first bit set if the
string contains errors, and the second bit is set if the string
contains an unclosed block.
*/
int parser_test_args( const wchar_t * buff, int babble );
/**
Returns the full path of the specified directory. If the \c in is a

View File

@@ -1300,11 +1300,11 @@ msgstr "fish"
#: init/fish_interactive.fish.in:13 init/fish_interactive.fish:13
msgid "Welcome to fish, the friendly interactive shell\\n"
msgstr "Willkommen zu fish, der Freundlichen Interaktiven SHell"
msgstr "Willkommen zu fish, der Freundlichen Interaktiven Shell\\n"
#: init/fish_interactive.fish.in:14 init/fish_interactive.fish:14
msgid "Type %shelp%s for instructions on how to use fish\\n"
msgstr "Anweisungen zur fish-Benutzung erhalten Sie über %shelp%s "
msgstr "Anweisungen zur fish-Benutzung erhalten Sie über %shelp%s\\n"
#: init/fish_interactive.fish.in:20 init/fish_interactive.fish:20
msgid "Commands to execute when fish exits"

1381
po/sv.po

File diff suppressed because it is too large Load Diff

50
proc.c
View File

@@ -42,7 +42,10 @@ Some of the code in this file is based on code from the Glibc manual.
#include <ncurses/term.h>
#endif
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "proc.h"
#include "common.h"
@@ -87,6 +90,8 @@ int is_event=0;
int proc_had_barrier;
pid_t proc_last_bg_pid = 0;
int job_control_mode = JOB_CONTROL_INTERACTIVE;
int no_exec=0;
/**
The event variable used to send all process event
@@ -177,7 +182,7 @@ int proc_get_last_status()
job_t *job_create()
{
int free_id=0;
int free_id=1;
job_t *res;
while( job_get( free_id ) != 0 )
@@ -189,7 +194,7 @@ job_t *job_create()
res->job_control = (job_control_mode==JOB_CONTROL_ALL) ||
((job_control_mode == JOB_CONTROL_INTERACTIVE) && (is_interactive));
// if( res->job_id > 2 )
// fwprintf( stderr, L"Create job %d\n", res->job_id );
return res;
@@ -199,7 +204,7 @@ job_t *job_create()
job_t *job_get( int id )
{
job_t *res = first_job;
if( id == -1 )
if( id <= 0 )
{
return res;
}
@@ -260,28 +265,12 @@ int job_is_completed( const job_t *j )
{
if (!p->completed)
{
// fwprintf( stderr, L"Process %ls not finished\n", p->argv[0] );
return 0;
}
}
return 1;
}
/**
Return true if all processes in the job have completed.
\param j the job to test
*/
static int job_last_is_completed( const job_t *j )
{
process_t *p;
for (p = j->first_process; p->next; p = p->next)
;
return p->completed;
}
/**
Store the status of the process pid that was returned by waitpid.
Return 0 if all went well, nonzero otherwise.
@@ -498,6 +487,11 @@ int job_reap( int interactive )
static int locked = 0;
locked++;
/*
job_read may fire an event handler, we do not want to call
ourselves recursively (to avoid infinite recursion).
*/
if( locked>1 )
return 0;
@@ -506,6 +500,11 @@ int job_reap( int interactive )
process_t *p;
jnext = j->next;
/*
If we are reaping only jobs who do not need status messages
sent to the console, do not consider reaping jobs that need
status messages
*/
if( (!j->skip_notification) && (!interactive) && (!j->fg))
{
continue;
@@ -810,8 +809,7 @@ static void read_try( job_t *j )
else
{
b_append( buff->param2.out_buffer, b, l );
}
}
}
}
}
@@ -826,14 +824,14 @@ void job_continue (job_t *j, int cont)
j->next = first_job;
first_job = j;
j->notified = 0;
debug( 4,
L"Continue on job %d (%ls), %ls, %ls",
L"Continue job %d (%ls), %ls, %ls",
j->job_id,
j->command,
job_is_completed( j )?L"COMPLETED":L"UNCOMPLETED",
is_interactive?L"INTERACTIVE":L"NON-INTERACTIVE" );
if( !job_is_completed( j ) )
{
if( j->terminal && j->fg )
@@ -911,7 +909,7 @@ void job_continue (job_t *j, int cont)
do
{
got_signal = 0;
quit = job_is_stopped( j ) || job_last_is_completed( j );
quit = job_is_stopped( j ) || job_is_completed( j );
}
while( got_signal && !quit );
if( !quit )
@@ -1035,7 +1033,7 @@ void proc_sanity_check()
/*
More than one foreground job?
*/
if( j->fg && !(job_is_stopped(j) || job_last_is_completed(j) ) )
if( j->fg && !(job_is_stopped(j) || job_is_completed(j) ) )
{
if( fg_job != 0 )
{

11
proc.h
View File

@@ -231,6 +231,12 @@ extern pid_t proc_last_bg_pid;
*/
extern int job_control_mode;
/**
If this flag is set, fish will never fork or run execve.
*/
extern int no_exec;
/**
Sets the status of the last process to exit
*/
@@ -255,7 +261,7 @@ job_t *job_create();
/**
Return the job with the specified job id.
If id is -1, return the last job used.
If id is 0 or less, return the last job used.
*/
job_t *job_get(int id);
@@ -322,7 +328,8 @@ void proc_update_jiffies();
void proc_sanity_check();
/**
Send of an process/job exit event notification. This function is a conveniance wrapper around event_fire().
Send a process/job exit event notification. This function is a
conveniance wrapper around event_fire().
*/
void proc_fire_event( const wchar_t *msg, int type, pid_t pid, int status );

201
reader.c
View File

@@ -59,7 +59,10 @@ commence.
#include <assert.h>
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "highlight.h"
#include "reader.h"
@@ -229,6 +232,11 @@ typedef struct reader_data
When this is true, the reader will exit
*/
int end_loop;
/**
If this is true, exit reader even if there are running
jobs. This happens if we press e.g. ^D twice.
*/
int prev_end_loop;
/**
Pointer to previous reader_data
@@ -266,12 +274,6 @@ static struct stat prev_buff_1, prev_buff_2, post_buff_1, post_buff_2;
*/
static array_list_t prompt_list;
/**
Stores the previous termios mode so we can reset the modes when
we execute programs and when the shell exits.
*/
static struct termios saved_modes;
/**
Store the pid of the parent process, so the exit function knows whether it should reset the terminal or not.
@@ -292,10 +294,21 @@ static struct termios old_modes;
Prototypes for a bunch of functions defined later on.
*/
/**
Stores the previous termios mode so we can reset the modes when
we execute programs and when the shell exits.
*/
static struct termios saved_modes;
static void reader_save_status();
static void reader_check_status();
static void reader_super_highlight_me_plenty( wchar_t * buff, int *color, int pos, array_list_t *error );
/**
Variable to keep track of forced exits - see \c reader_exit_forced();
*/
static int exit_forced;
/**
Give up control of terminal
@@ -367,6 +380,12 @@ static int room_for_usec(struct stat *st)
return res;
}
int reader_exit_forced()
{
return exit_forced;
}
/**
string_buffer used as temporary storage for the reader_readline function
*/
@@ -838,6 +857,16 @@ static void write_cmdline()
void reader_init()
{
tcgetattr(0,&shell_modes); /* get the current terminal modes */
memcpy( &saved_modes,
&shell_modes,
sizeof(saved_modes)); /* save a copy so we can reset the terminal later */
shell_modes.c_lflag &= ~ICANON; /* turn off canonical mode */
shell_modes.c_lflag &= ~ECHO; /* turn off echo mode */
shell_modes.c_cc[VMIN]=1;
shell_modes.c_cc[VTIME]=0;
al_init( &current_filename);
}
@@ -851,14 +880,19 @@ void reader_destroy()
free( readline_buffer );
readline_buffer=0;
}
tcsetattr(0, TCSANOW, &saved_modes);
}
void reader_exit( int do_exit )
void reader_exit( int do_exit, int forced )
{
if( data )
data->end_loop=do_exit;
end_loop=do_exit;
if( forced )
exit_forced = 1;
}
void repaint()
@@ -883,7 +917,7 @@ void repaint()
if( steps )
move_cursor( -steps );
set_color( FISH_COLOR_NORMAL, -1 );
set_color( FISH_COLOR_NORMAL, FISH_COLOR_IGNORE );
reader_save_status();
}
@@ -1110,7 +1144,7 @@ static int insert_char( int c )
}
else
writech(c);
set_color( FISH_COLOR_NORMAL, -1 );
set_color( FISH_COLOR_NORMAL, FISH_COLOR_IGNORE );
}
else
{
@@ -1568,18 +1602,6 @@ static int handle_completions( array_list_t *comp )
}
}
/**
Reset the terminal. This function is placed in the list of
functions to call when exiting by using the atexit function. It
checks whether it is the original parent process that is exiting
and not a subshell, and if it is the parent, it restores the
terminal.
*/
static void exit_func()
{
if( getpid() == original_pid )
tcsetattr(0, TCSANOW, &saved_modes);
}
/**
Initialize data for interactive use
@@ -1628,20 +1650,9 @@ static void reader_interactive_init()
al_init( &prompt_list );
history_init();
common_handle_winch(0);
tcgetattr(0,&shell_modes); /* get the current terminal modes */
memcpy( &saved_modes,
&shell_modes,
sizeof(saved_modes)); /* save a copy so we can reset the terminal later */
shell_modes.c_lflag &= ~ICANON; /* turn off canonical mode */
shell_modes.c_lflag &= ~ECHO; /* turn off echo mode */
shell_modes.c_cc[VMIN]=1;
shell_modes.c_cc[VTIME]=0;
if( tcsetattr(0,TCSANOW,&shell_modes)) /* set the new modes */
{
wperror(L"tcsetattr");
@@ -1654,9 +1665,6 @@ static void reader_interactive_init()
*/
original_pid = getpid();
if( atexit( &exit_func ) )
debug( 1, _( L"Could not set exit function" ) );
env_set( L"_", L"fish", ENV_GLOBAL );
}
@@ -1668,7 +1676,6 @@ static void reader_interactive_destroy()
kill_destroy();
al_foreach( &prompt_list, (void (*)(const void *))&free );
al_destroy( &prompt_list );
history_destroy();
writestr( L"\n" );
set_color( FISH_COLOR_RESET, FISH_COLOR_RESET );
@@ -2075,7 +2082,7 @@ void reader_run_command( wchar_t *cmd )
term_steal();
env_set( L"_", L"fish", ENV_GLOBAL );
env_set( L"_", program_name, ENV_GLOBAL );
#ifdef HAVE__PROC_SELF_STAT
proc_update_jiffies();
@@ -2092,7 +2099,13 @@ void reader_run_command( wchar_t *cmd )
static int shell_test( wchar_t *b )
{
return !wcslen(b);
if( parser_test( b, 0 ) )
{
writech( L'\n' );
parser_test( b, 1 );
return 1;
}
return 0;
}
/**
@@ -2242,7 +2255,6 @@ int exit_status()
*/
static int read_i()
{
int prev_end_loop=0;
reader_push(L"fish");
reader_set_complete_function( &complete );
@@ -2250,6 +2262,7 @@ static int read_i()
reader_set_test_function( &shell_test );
data->prompt_width=60;
data->prev_end_loop=0;
while( (!data->end_loop) && (!sanity_check()) )
{
@@ -2266,26 +2279,40 @@ static int read_i()
during evaluation.
*/
tmp = wcsdup( reader_readline() );
data->buff_pos=data->buff_len=0;
data->buff[data->buff_len]=L'\0';
reader_run_command( tmp );
free( tmp );
tmp = reader_readline();
if( data->end_loop)
{
if( !prev_end_loop && first_job != 0 )
job_t *j;
int has_job=0;
for( j=first_job; j; j=j->next )
{
if( !job_is_completed(j) )
{
has_job = 1;
break;
}
}
if( !reader_exit_forced() && !data->prev_end_loop && has_job )
{
writestr(_( L"There are stopped jobs\n" ));
write_prompt();
data->end_loop = 0;
prev_end_loop=1;
data->prev_end_loop=1;
}
}
else
{
prev_end_loop=0;
tmp = wcsdup( tmp );
data->buff_pos=data->buff_len=0;
data->buff[data->buff_len]=L'\0';
reader_run_command( tmp );
free( tmp );
data->prev_end_loop=0;
}
}
@@ -2442,6 +2469,13 @@ wchar_t *reader_readline()
break;
}
case R_EOF:
{
exit_forced = 1;
data->end_loop=1;
break;
}
/* complete */
case R_COMPLETE:
{
@@ -2456,15 +2490,21 @@ wchar_t *reader_readline()
if( comp_empty )
{
const wchar_t *begin, *end;
const wchar_t *token_begin, *token_end;
wchar_t *buffcpy;
int len;
int cursor_steps;
parse_util_cmdsubst_extent( data->buff, data->buff_pos, &begin, &end );
int len = data->buff_pos - (data->buff - begin);
parse_util_token_extent( begin, data->buff_pos - (begin-data->buff), &token_begin, &token_end, 0, 0 );
cursor_steps = token_end - data->buff- data->buff_pos;
data->buff_pos += cursor_steps;
move_cursor( cursor_steps );
len = data->buff_pos - (data->buff - begin);
buffcpy = wcsndup( begin, len );
//fwprintf( stderr, L"String is %ls\n", buffcpy );
reader_save_status();
data->complete_func( buffcpy, &comp );
reader_check_status();
@@ -2473,6 +2513,7 @@ wchar_t *reader_readline()
remove_duplicates( &comp );
free( buffcpy );
}
if( (comp_empty =
handle_completions( &comp ) ) )
@@ -2493,7 +2534,6 @@ wchar_t *reader_readline()
repaint();
// wcscpy(data->search_buff,data->buff);
break;
}
@@ -2513,7 +2553,6 @@ wchar_t *reader_readline()
reader_super_highlight_me_plenty( data->buff, data->color, data->buff_pos, 0 );
repaint();
// wcscpy(data->search_buff,data->buff);
break;
}
@@ -2525,7 +2564,6 @@ wchar_t *reader_readline()
reader_super_highlight_me_plenty( data->buff, data->color, data->buff_pos, 0 );
repaint();
// wcscpy(data->search_buff,data->buff);
break;
}
@@ -2534,7 +2572,6 @@ wchar_t *reader_readline()
{ yank_str = kill_yank();
insert_str( yank_str );
yank = wcslen( yank_str );
// wcscpy(data->search_buff,data->buff);
break;
}
@@ -2697,6 +2734,7 @@ wchar_t *reader_readline()
/* Move left*/
case R_BACKWARD_CHAR:
{
if( data->buff_pos > 0 )
{
data->buff_pos--;
@@ -2711,8 +2749,9 @@ wchar_t *reader_readline()
}
}
break;
/* Move right*/
}
/* Move right*/
case R_FORWARD_CHAR:
{
if( data->buff_pos < data->buff_len )
@@ -2796,7 +2835,16 @@ wchar_t *reader_readline()
if( (!wchar_private(c)) && (c>31) && (c != 127) )
insert_char( c );
else
debug( 0, _( L"Unknown keybinding %d" ), c );
{
/*
Carriage returns happen - they are usually a
sign of an incorrectly set terminal, but there
really isn't very much we can do at this point,
so we ignore them.
*/
if( c != 13 )
debug( 0, _( L"Unknown keybinding %d" ), c );
}
break;
}
@@ -2819,14 +2867,17 @@ wchar_t *reader_readline()
}
al_destroy( &comp );
if( tcsetattr(0,TCSANOW,&old_modes)) /* return to previous mode */
{
wperror(L"tcsetattr");
exit(1);
}
set_color( FISH_COLOR_RESET, FISH_COLOR_RESET );
if( !reader_exit_forced() )
{
if( tcsetattr(0,TCSANOW,&old_modes)) /* return to previous mode */
{
wperror(L"tcsetattr");
exit(1);
}
set_color( FISH_COLOR_RESET, FISH_COLOR_RESET );
}
return data->buff;
}
@@ -2870,7 +2921,7 @@ static int read_ni( int fd )
_( L"Error while reading commands" ) );
/*
Reset buffer. We won't evaluate incomplete files.
Reset buffer on error. We won't evaluate incomplete files.
*/
acc.used=0;
break;
@@ -2891,13 +2942,10 @@ static int read_ni( int fd )
res = 1;
}
// fwprintf( stderr, L"Woot is %d chars\n", wcslen( acc.buff ) );
if( str )
{
if( !parser_test( str, 1 ) )
{
//fwprintf( stderr, L"We parse it\n" );
eval( str, 0, TOP );
}
else
@@ -2940,19 +2988,20 @@ static int read_ni( int fd )
int reader_read( int fd )
{
int res;
/*
If reader_read is called recursively through the '.' builtin,
we need to preserve is_interactive, so we save the
original state. We also update the signal handlers.
If reader_read is called recursively through the '.' builtin, we
need to preserve is_interactive. This, and signal handler setup
is handled by proc_push_interactive/proc_pop_interactive.
*/
proc_push_interactive( ((fd == 0) && isatty(STDIN_FILENO)));
res= is_interactive?read_i():read_ni( fd );
/*
If the exit command was called in a script, only exit the
script, not the program
script, not the program.
*/
if( data )
data->end_loop = 0;

View File

@@ -21,7 +21,7 @@ int reader_read( int fd);
/**
Tell the shell that it should exit after the currently running command finishes.
*/
void reader_exit( int do_exit );
void reader_exit( int do_exit, int force );
/**
Check that the reader is in a sane state
@@ -162,5 +162,10 @@ void reader_replace_current_token( wchar_t *new_token );
*/
void reader_handle_int( int signal );
/**
This function returns true if fish is exiting by force, i.e. because stdin died
*/
int reader_exit_forced();
#endif

View File

@@ -14,7 +14,10 @@
#include "config.h"
#include "fallback.h"
#include "util.h"
#include "common.h"
#include "sanity.h"
#include "proc.h"

4
seq.in
View File

@@ -34,14 +34,14 @@ switch (count $argv)
case '*'
printf (_ "%s: Expected 1, 2 or 3 arguments, got %d\n") seq (count $argv)
return 1
exit 1
end
for i in $from $step $to
if not echo $i | grep '^-\?[0-9]*\(\|.[0-9]\+\)$' >/dev/null
printf (_ "%s: '%s' is not a number\n") seq $i
return 1
exit 1
end
end

View File

@@ -1,5 +1,6 @@
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -48,6 +49,11 @@
*/
#define SET_COLOR "set_color"
/**
Getopt short switches for set_color
*/
#define GETOPT_STRING "b:hvoc"
#if HAVE_GETTEXT
#define _(string) gettext(string)
#else
@@ -185,13 +191,13 @@ int main( int argc, char **argv )
int opt = getopt_long( argc,
argv,
"b:hvoc",
GETOPT_STRING,
long_options,
&opt_index );
#else
int opt = getopt( argc,
argv,
"b:hvoc" );
GETOPT_STRING );
#endif
if( opt == -1 )
break;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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