mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-01 13:01:21 -03:00
Compare commits
2052 Commits
pre_whites
...
2.2b1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14bf2ee5cb | ||
|
|
cec1dc2095 | ||
|
|
9b5026f7e5 | ||
|
|
96dfd27725 | ||
|
|
905d8b2aa5 | ||
|
|
3ca518255e | ||
|
|
c59119e0b7 | ||
|
|
0748a4d8b6 | ||
|
|
3722f91e38 | ||
|
|
ba721d6cbf | ||
|
|
5532e5aa8a | ||
|
|
9cae8bf8a6 | ||
|
|
cb92a1d12f | ||
|
|
1242e63b6a | ||
|
|
f30872a7b5 | ||
|
|
9c3a9a1e73 | ||
|
|
c91f70523c | ||
|
|
3d9c24196d | ||
|
|
6f438f65de | ||
|
|
879d03d0fe | ||
|
|
7a1fc028e3 | ||
|
|
c3ef23b10f | ||
|
|
722fedc8fd | ||
|
|
32936b0eb9 | ||
|
|
3559f20c8f | ||
|
|
9dc53f7c1b | ||
|
|
9c007d1c94 | ||
|
|
6faac2d2c8 | ||
|
|
665314b240 | ||
|
|
cb1e3c501d | ||
|
|
9e8e5af064 | ||
|
|
fd731fb74f | ||
|
|
d1a56139e1 | ||
|
|
3408b2759e | ||
|
|
fbe28fd5d8 | ||
|
|
97aa1c033b | ||
|
|
34296dd440 | ||
|
|
87428672d8 | ||
|
|
84899fb2f8 | ||
|
|
73f344f41b | ||
|
|
9f8cec7f9e | ||
|
|
318daaffb2 | ||
|
|
cad1dc5293 | ||
|
|
900a8a1408 | ||
|
|
384cb2d735 | ||
|
|
ad61c3f0d6 | ||
|
|
c10aab77da | ||
|
|
e17f6fb2dc | ||
|
|
e896acffd7 | ||
|
|
20a6b65b25 | ||
|
|
01026c137f | ||
|
|
7aac3db55c | ||
|
|
0ecf294d34 | ||
|
|
89da09636e | ||
|
|
f8299a1274 | ||
|
|
94e9d6a5ef | ||
|
|
733108e33b | ||
|
|
48d353610f | ||
|
|
bff68f3bfc | ||
|
|
b9bd0166b6 | ||
|
|
1116929d2f | ||
|
|
22103e4849 | ||
|
|
e421c12cc4 | ||
|
|
5a9b1b1b57 | ||
|
|
d99ed89aa3 | ||
|
|
b9dd057a04 | ||
|
|
369a09e57e | ||
|
|
468648ff51 | ||
|
|
8c41a053fe | ||
|
|
a1b3358cb8 | ||
|
|
16e65c849c | ||
|
|
33c0d93b20 | ||
|
|
3d163eb910 | ||
|
|
3e32715693 | ||
|
|
388a8d09d8 | ||
|
|
b4aa2b7c2c | ||
|
|
dd595dd110 | ||
|
|
95687a03fb | ||
|
|
b3aa187867 | ||
|
|
b5d9e366ad | ||
|
|
d7ba6e4a1d | ||
|
|
981a71555f | ||
|
|
597dda5a4b | ||
|
|
66acd17bc0 | ||
|
|
793784c087 | ||
|
|
df6f1e8f62 | ||
|
|
facfe33218 | ||
|
|
78dfc57b1e | ||
|
|
d17ba69f9e | ||
|
|
5c16b5598b | ||
|
|
028d9e8e3b | ||
|
|
53a4814d8b | ||
|
|
1ff9aba6b1 | ||
|
|
39748870b6 | ||
|
|
b0cbad84f4 | ||
|
|
f920be5ea3 | ||
|
|
f9384fe323 | ||
|
|
789a54222d | ||
|
|
68efa5233c | ||
|
|
dce487380c | ||
|
|
75a76c596c | ||
|
|
7164769d33 | ||
|
|
9e3f912747 | ||
|
|
e529b78365 | ||
|
|
9374494d2b | ||
|
|
2018b9b217 | ||
|
|
3c0902b7e4 | ||
|
|
b31305b9bd | ||
|
|
d4eded2376 | ||
|
|
20974edc14 | ||
|
|
6e2132e01f | ||
|
|
34db67680d | ||
|
|
7864d0d416 | ||
|
|
d1feb9bcbf | ||
|
|
906d235601 | ||
|
|
e045eabad6 | ||
|
|
218bd7a687 | ||
|
|
70a99e494d | ||
|
|
e340baf6cc | ||
|
|
182faca2e5 | ||
|
|
14834ff076 | ||
|
|
a0127a0c7a | ||
|
|
390fe05a87 | ||
|
|
b9ff17f33c | ||
|
|
5f2ea007a5 | ||
|
|
e5a2343879 | ||
|
|
8d50b2509d | ||
|
|
a76afd6dae | ||
|
|
77a7dd82a9 | ||
|
|
04651105a8 | ||
|
|
d300bd4b62 | ||
|
|
a21db45cee | ||
|
|
2e948d9d6d | ||
|
|
6fa9a18a2b | ||
|
|
da2e2c2e99 | ||
|
|
8ba0ab2172 | ||
|
|
96589920d5 | ||
|
|
8c17d48c83 | ||
|
|
d458a8a03d | ||
|
|
39fe9fcfcd | ||
|
|
bf80b0db19 | ||
|
|
ebfaa8cc95 | ||
|
|
46cd89c2db | ||
|
|
8124b5073f | ||
|
|
a4e81d3978 | ||
|
|
147078f43d | ||
|
|
90629caa61 | ||
|
|
9cec0ad02c | ||
|
|
11bece80a8 | ||
|
|
a10f729ef9 | ||
|
|
b9db555343 | ||
|
|
9b43e6fa8b | ||
|
|
1edb7d3aa5 | ||
|
|
14fde56d32 | ||
|
|
a8059c5962 | ||
|
|
381404c4f4 | ||
|
|
68029095b5 | ||
|
|
9a34df604d | ||
|
|
2f96d2b19a | ||
|
|
bfd1951023 | ||
|
|
019c0fed23 | ||
|
|
bb01e5f81a | ||
|
|
8526a82947 | ||
|
|
94a3203c74 | ||
|
|
184110c2e7 | ||
|
|
3b3fde1c5e | ||
|
|
60a2e0a2ad | ||
|
|
c78e56c509 | ||
|
|
190cac07a3 | ||
|
|
efc3846fcf | ||
|
|
83df5ea660 | ||
|
|
e13d423b68 | ||
|
|
eafd577629 | ||
|
|
196a7c9d18 | ||
|
|
daa856ed47 | ||
|
|
04dc0aca50 | ||
|
|
918d5595bd | ||
|
|
0abdf9eeff | ||
|
|
8e8549ef7a | ||
|
|
cfc2d7fb3f | ||
|
|
c77f8e73c8 | ||
|
|
dda6be2592 | ||
|
|
93eea8de66 | ||
|
|
2ddd839f52 | ||
|
|
7555772432 | ||
|
|
33f9e071a4 | ||
|
|
9aaf93f364 | ||
|
|
14fa48864a | ||
|
|
206ea15b68 | ||
|
|
a7bab7b18b | ||
|
|
a6a41d159c | ||
|
|
59da180b8f | ||
|
|
51e446bc5f | ||
|
|
f68f91b399 | ||
|
|
0ea80a319e | ||
|
|
38caa0d988 | ||
|
|
7c2a420e88 | ||
|
|
d944add782 | ||
|
|
338a1311f5 | ||
|
|
00e0ed64bc | ||
|
|
f2447c537e | ||
|
|
220a15b8f6 | ||
|
|
330e996c30 | ||
|
|
32c0afe5a9 | ||
|
|
e83441395e | ||
|
|
43d23ee56e | ||
|
|
58a0f7f091 | ||
|
|
09bac97bb4 | ||
|
|
701a37fd00 | ||
|
|
9d7fbd2cc0 | ||
|
|
32010d1d93 | ||
|
|
75860db511 | ||
|
|
4d588a24e9 | ||
|
|
9382dc32df | ||
|
|
6db82c162c | ||
|
|
c31ad3ed07 | ||
|
|
c33a3862cc | ||
|
|
6cc64fc9e3 | ||
|
|
aafff91ac8 | ||
|
|
4b6639f697 | ||
|
|
fa588db148 | ||
|
|
851f0bcfb3 | ||
|
|
d9d9fa512d | ||
|
|
84372ba79d | ||
|
|
7ac593273e | ||
|
|
a529fc9d83 | ||
|
|
173a6a71c0 | ||
|
|
a177eb8c16 | ||
|
|
16459099af | ||
|
|
fa854d7a01 | ||
|
|
b3b83449cf | ||
|
|
d62694a9ce | ||
|
|
6044ac7e5e | ||
|
|
ec5f3d0cc8 | ||
|
|
f03d90e9de | ||
|
|
a31b44f9b2 | ||
|
|
a580d04dbc | ||
|
|
c84cdcd00c | ||
|
|
5638764bad | ||
|
|
ab7af98ded | ||
|
|
b0e09303a6 | ||
|
|
a242a64833 | ||
|
|
315ff1e712 | ||
|
|
21a751d153 | ||
|
|
090f027de1 | ||
|
|
cfa41686d2 | ||
|
|
3fe1069219 | ||
|
|
98091faeaf | ||
|
|
15e095233b | ||
|
|
a64c372a28 | ||
|
|
1f91a2a6f5 | ||
|
|
4aa38db56f | ||
|
|
9e32b330aa | ||
|
|
049bd227ed | ||
|
|
ff7108877b | ||
|
|
1927ebbc5d | ||
|
|
5db9548f40 | ||
|
|
cab115c8b9 | ||
|
|
4568359e27 | ||
|
|
07e4170418 | ||
|
|
0372cdbe7e | ||
|
|
5d1ddc9c58 | ||
|
|
c0b8e81b02 | ||
|
|
c3bacc78c7 | ||
|
|
4140e678f4 | ||
|
|
cc0fcdc18d | ||
|
|
fbade198b9 | ||
|
|
d982f2a575 | ||
|
|
becdc8b4fc | ||
|
|
76c6985f82 | ||
|
|
ac8c5910eb | ||
|
|
cc7f1755aa | ||
|
|
7493c9a040 | ||
|
|
9fc8729b96 | ||
|
|
80859b8483 | ||
|
|
71c55e1a4a | ||
|
|
d2f23e1df4 | ||
|
|
c70769c656 | ||
|
|
a13e067b85 | ||
|
|
8e8e63144b | ||
|
|
14724401ff | ||
|
|
72f5ab3186 | ||
|
|
3f0210dc96 | ||
|
|
3c8b344a41 | ||
|
|
46241e383f | ||
|
|
ea79f6b03f | ||
|
|
649c3f262d | ||
|
|
f85ec782a0 | ||
|
|
9df0bcea99 | ||
|
|
7764a1a6f8 | ||
|
|
980bf6e2f4 | ||
|
|
501c3d5518 | ||
|
|
6a0931aeae | ||
|
|
d7b3821c0a | ||
|
|
1665f84d60 | ||
|
|
fabee7e246 | ||
|
|
0ffa434926 | ||
|
|
a7727765dc | ||
|
|
33a76e1f8e | ||
|
|
cfc06203e7 | ||
|
|
6d7a7b00d7 | ||
|
|
3f11d90744 | ||
|
|
ae7b6156ac | ||
|
|
4ba95ad1c3 | ||
|
|
bae2b2cc47 | ||
|
|
47c357a354 | ||
|
|
b592da41f6 | ||
|
|
646d9ab431 | ||
|
|
43e451d4d8 | ||
|
|
1be5e68e99 | ||
|
|
ab5b22982f | ||
|
|
5157ac30fa | ||
|
|
3616dd5889 | ||
|
|
489fb7ec3f | ||
|
|
51527612d3 | ||
|
|
c181de1d7f | ||
|
|
d67800bbce | ||
|
|
27dd37ebb4 | ||
|
|
a186f04f15 | ||
|
|
15ca3b426f | ||
|
|
1c9aec4899 | ||
|
|
f0d8d90ed1 | ||
|
|
6ece8523b1 | ||
|
|
84af3dcd18 | ||
|
|
26051ea198 | ||
|
|
b00cbae4b5 | ||
|
|
4f4734fc9b | ||
|
|
3ac28f2b01 | ||
|
|
2f71c15b93 | ||
|
|
7cad0069e8 | ||
|
|
a0e5cdd178 | ||
|
|
ba11a0eb9b | ||
|
|
b511550917 | ||
|
|
7935b86cb2 | ||
|
|
fb8eb22e56 | ||
|
|
6925cd5d88 | ||
|
|
35595dbffd | ||
|
|
cd4fa518b8 | ||
|
|
316d7004a3 | ||
|
|
1096b1acd5 | ||
|
|
5766c7c53a | ||
|
|
bbce0909fe | ||
|
|
73158d6255 | ||
|
|
0986b6d991 | ||
|
|
c4a453fb22 | ||
|
|
1563501868 | ||
|
|
5f82f721d2 | ||
|
|
8d03baa4e0 | ||
|
|
a9b7e4582f | ||
|
|
2726712e01 | ||
|
|
8d3d51a020 | ||
|
|
5afd42c097 | ||
|
|
5b33e60752 | ||
|
|
80078491bd | ||
|
|
0a3f220572 | ||
|
|
5eee7d17f6 | ||
|
|
4718636ae2 | ||
|
|
2cd7f1443c | ||
|
|
7a9e2d733a | ||
|
|
4ed4b265a5 | ||
|
|
e689a38663 | ||
|
|
e5aa06991e | ||
|
|
cb40507b7b | ||
|
|
7d7a636f24 | ||
|
|
2450d00693 | ||
|
|
a4059d3e60 | ||
|
|
fe9cf673a2 | ||
|
|
b480c8ce79 | ||
|
|
94e535507c | ||
|
|
a027566295 | ||
|
|
e1f623f548 | ||
|
|
4573a4d69c | ||
|
|
a012aedb31 | ||
|
|
a9c8b75599 | ||
|
|
c64f38f0bf | ||
|
|
8f8c4cdd17 | ||
|
|
f889ad0fda | ||
|
|
166a2f91bd | ||
|
|
a069aec11d | ||
|
|
8a3cf144f2 | ||
|
|
a381ac2691 | ||
|
|
e2be71cbe4 | ||
|
|
b8181f9eb8 | ||
|
|
555ff00a30 | ||
|
|
6083c6fc72 | ||
|
|
940f264ee6 | ||
|
|
761be8ab7f | ||
|
|
51c2005ea2 | ||
|
|
510ff6a689 | ||
|
|
7229d7a326 | ||
|
|
1a7b33e8fb | ||
|
|
2d3f7babe3 | ||
|
|
0a32d96b27 | ||
|
|
174f5ba99a | ||
|
|
708e21f929 | ||
|
|
eb40baacfc | ||
|
|
133ba6e01b | ||
|
|
7f4908b0db | ||
|
|
9bfb4f1e11 | ||
|
|
ea435d35ad | ||
|
|
5b709eb5df | ||
|
|
5c25be51ea | ||
|
|
f6da9d4d5d | ||
|
|
f22864b813 | ||
|
|
22fd8e65ad | ||
|
|
190712d4b0 | ||
|
|
efb1467e4e | ||
|
|
6b75a4593b | ||
|
|
a04d5fd065 | ||
|
|
8643a5e266 | ||
|
|
47f97bbdd5 | ||
|
|
2e034e767f | ||
|
|
aed92b9a2c | ||
|
|
482e615fe0 | ||
|
|
cb46ed3701 | ||
|
|
9c78295a9a | ||
|
|
15cf06438e | ||
|
|
93b296d899 | ||
|
|
6e133c90e8 | ||
|
|
f1bd2b823d | ||
|
|
ac92f54ca6 | ||
|
|
1b4c85eb69 | ||
|
|
fb792c60cd | ||
|
|
38e153f568 | ||
|
|
6821f5ef4a | ||
|
|
ab433cfe65 | ||
|
|
6a57a50968 | ||
|
|
cb9ef98bed | ||
|
|
89f0b9abc3 | ||
|
|
0e5ddfd9f5 | ||
|
|
0a249c84ce | ||
|
|
fd70ae0b61 | ||
|
|
76aeae5db6 | ||
|
|
1facdd30fb | ||
|
|
4b7dc525b8 | ||
|
|
4acea72700 | ||
|
|
cf688f6ba2 | ||
|
|
5f3b0d9f1e | ||
|
|
05848038db | ||
|
|
664e2e5686 | ||
|
|
adbcecb456 | ||
|
|
3df9e20ca7 | ||
|
|
3f005c928a | ||
|
|
b3e28ac41a | ||
|
|
c39fe3433b | ||
|
|
668fa66d78 | ||
|
|
98ebb21489 | ||
|
|
137abd0cfa | ||
|
|
d7308fecbe | ||
|
|
73fb9915fd | ||
|
|
855a119654 | ||
|
|
cf7a6a6a65 | ||
|
|
509d152e54 | ||
|
|
35e6fb3788 | ||
|
|
9b79931265 | ||
|
|
14a7118499 | ||
|
|
afdabd97ff | ||
|
|
07f8fc7697 | ||
|
|
def7666609 | ||
|
|
c900f23662 | ||
|
|
7b093ee4b3 | ||
|
|
9f75cef5e5 | ||
|
|
a410c31bf8 | ||
|
|
1cd50ba572 | ||
|
|
1052eeee8c | ||
|
|
e22f0dda32 | ||
|
|
766a6b8309 | ||
|
|
d282bc4625 | ||
|
|
677cee44ad | ||
|
|
60e7726832 | ||
|
|
385b00a468 | ||
|
|
1c4223889b | ||
|
|
90a4fd34d2 | ||
|
|
2820c7a9cd | ||
|
|
edd4f3d5ad | ||
|
|
aa7fe3b132 | ||
|
|
1d9886d0f7 | ||
|
|
6068e85ef2 | ||
|
|
ced471d4ce | ||
|
|
2445ac4a53 | ||
|
|
1d0279eac5 | ||
|
|
f8b21fe199 | ||
|
|
0f330d7226 | ||
|
|
cb29350954 | ||
|
|
7fce9e2411 | ||
|
|
cc52a59e1a | ||
|
|
24ac7d2698 | ||
|
|
130619d6b0 | ||
|
|
71ab40e536 | ||
|
|
7638a7d531 | ||
|
|
b92a09d5e7 | ||
|
|
3d29cc8636 | ||
|
|
d6c5a1e0c4 | ||
|
|
9bcd4a6811 | ||
|
|
e90b1651e4 | ||
|
|
66ccae4bfe | ||
|
|
02a07164f3 | ||
|
|
9419191aa6 | ||
|
|
f71b10df8c | ||
|
|
0b7735d279 | ||
|
|
1f3a93a3af | ||
|
|
f9f773cc28 | ||
|
|
d9bf53c6e5 | ||
|
|
f549ada16c | ||
|
|
d8b955294a | ||
|
|
8aad53556d | ||
|
|
61ce9db4ba | ||
|
|
2da435712a | ||
|
|
9079ec459c | ||
|
|
aaddccfdb1 | ||
|
|
033373f078 | ||
|
|
d63db59ade | ||
|
|
20899f2df9 | ||
|
|
b9948ca297 | ||
|
|
f33e6a053e | ||
|
|
9f725bee1f | ||
|
|
3e2d68a059 | ||
|
|
2974025010 | ||
|
|
9a90e041f3 | ||
|
|
b0be15d4f7 | ||
|
|
a24998abac | ||
|
|
cc49042294 | ||
|
|
3981b644d6 | ||
|
|
4651919bd8 | ||
|
|
fed4bb5c07 | ||
|
|
ec903ce625 | ||
|
|
3ea956a0b4 | ||
|
|
d0c85471b4 | ||
|
|
3cc62c1fd2 | ||
|
|
079e369e91 | ||
|
|
06400b83b1 | ||
|
|
fe68d30be9 | ||
|
|
a3a11c2e0c | ||
|
|
3f526698ab | ||
|
|
78e2b7cc08 | ||
|
|
6ce74febc7 | ||
|
|
ede3d422a0 | ||
|
|
629a39b45b | ||
|
|
397249a8d5 | ||
|
|
b44b624ca5 | ||
|
|
6513c7eab8 | ||
|
|
276d90a45d | ||
|
|
c94b15a951 | ||
|
|
e4d6eaf17a | ||
|
|
60b9f8db18 | ||
|
|
cff928e2dc | ||
|
|
6aa701b3ee | ||
|
|
cb480dddf6 | ||
|
|
33c714ca03 | ||
|
|
bcda3f1baa | ||
|
|
4ae2753025 | ||
|
|
b5cd21c337 | ||
|
|
8844f0c142 | ||
|
|
4cb4fc3ef8 | ||
|
|
6cabd42ed2 | ||
|
|
0daee33ad6 | ||
|
|
b97a94ccc8 | ||
|
|
5cc3dcdbd8 | ||
|
|
7e3382340e | ||
|
|
87abcecca6 | ||
|
|
8ca88f14f7 | ||
|
|
b4a4a7c611 | ||
|
|
556680cf5e | ||
|
|
f4077bd41f | ||
|
|
cb5c560688 | ||
|
|
8ac0fdfea7 | ||
|
|
6dfd71670a | ||
|
|
4d4cc34aff | ||
|
|
c070a2aa3e | ||
|
|
af14cf8f8b | ||
|
|
35ba97cbdf | ||
|
|
9f59cf1468 | ||
|
|
6c80a3461c | ||
|
|
5591afff6e | ||
|
|
8144725739 | ||
|
|
52ae5f885e | ||
|
|
b6658c5497 | ||
|
|
aad5163b49 | ||
|
|
6d18bf5cd4 | ||
|
|
adabc2d7a0 | ||
|
|
d07ea3b66a | ||
|
|
2bb08a4ca0 | ||
|
|
30ae473d85 | ||
|
|
e9f870e25a | ||
|
|
317660c2fe | ||
|
|
5e60efefbf | ||
|
|
f6a89d13c2 | ||
|
|
3e01dd955f | ||
|
|
27fa0ea9d7 | ||
|
|
2de914d8c3 | ||
|
|
616fa85458 | ||
|
|
20ad496c00 | ||
|
|
fa88c42cf1 | ||
|
|
e84a762171 | ||
|
|
16e50c258a | ||
|
|
cce4265cef | ||
|
|
973dd6ffbd | ||
|
|
72e8489d50 | ||
|
|
cfa13ed84c | ||
|
|
29b3b6b31e | ||
|
|
533496e43a | ||
|
|
6f7a7459c1 | ||
|
|
6b062b07b4 | ||
|
|
bfd3a47380 | ||
|
|
0933e5cab4 | ||
|
|
cc565fc16c | ||
|
|
62d86b3d18 | ||
|
|
4bbbd2dde6 | ||
|
|
b884117a9e | ||
|
|
7def139020 | ||
|
|
b667eee351 | ||
|
|
891f55b2b3 | ||
|
|
7b12fd26f3 | ||
|
|
387ec5c06a | ||
|
|
dcc043df3b | ||
|
|
2457997cd9 | ||
|
|
d9bed68fe9 | ||
|
|
2eb65b3625 | ||
|
|
76fdfe6890 | ||
|
|
495adee269 | ||
|
|
383aaa236e | ||
|
|
8c89e6bce5 | ||
|
|
98297e5234 | ||
|
|
3915faf382 | ||
|
|
d5fa4b2ccb | ||
|
|
3ff104ba30 | ||
|
|
706286c289 | ||
|
|
18c1b12741 | ||
|
|
5cda1e55e0 | ||
|
|
195cd130f8 | ||
|
|
b19f45e15d | ||
|
|
3acd0dfe48 | ||
|
|
74cedbf1c5 | ||
|
|
7d47ec4c46 | ||
|
|
14cdd24f78 | ||
|
|
1cfd055f82 | ||
|
|
ed5e585684 | ||
|
|
32948b8dc6 | ||
|
|
ad5ad3d1ad | ||
|
|
3bc2dda00d | ||
|
|
ee8e9c0291 | ||
|
|
f4bc1ef4a2 | ||
|
|
3513ce3ac0 | ||
|
|
6277a2e4a4 | ||
|
|
84faa60c4e | ||
|
|
735195e8ea | ||
|
|
0f15ab8d05 | ||
|
|
17c2d76c5e | ||
|
|
11c1562512 | ||
|
|
ef646f0f78 | ||
|
|
7b3132d39d | ||
|
|
8345fc2b9e | ||
|
|
58f4182880 | ||
|
|
ecf56606dc | ||
|
|
be3e64e5ea | ||
|
|
741342ba1d | ||
|
|
d97e31b4ab | ||
|
|
ce4081af93 | ||
|
|
32f5edc9c5 | ||
|
|
b481128a93 | ||
|
|
ab62001b74 | ||
|
|
2dfd57bb8c | ||
|
|
20d7a142c5 | ||
|
|
9ae06c541f | ||
|
|
655293ece9 | ||
|
|
a983318501 | ||
|
|
8769c06350 | ||
|
|
5066710e60 | ||
|
|
451c97f35a | ||
|
|
8a577a9d4d | ||
|
|
950150469a | ||
|
|
3cbace98a7 | ||
|
|
e214df8980 | ||
|
|
e3cccdf571 | ||
|
|
a0bf841be2 | ||
|
|
73cbb0c65f | ||
|
|
2f89ddbead | ||
|
|
a526693915 | ||
|
|
31f2a3a7d7 | ||
|
|
147403f958 | ||
|
|
38c52cf9b5 | ||
|
|
64c1c75c42 | ||
|
|
2b11d1060c | ||
|
|
a73b903df9 | ||
|
|
30cfb3e795 | ||
|
|
a0e6d4375a | ||
|
|
c7aca5cc35 | ||
|
|
3225d7e169 | ||
|
|
6596d91c82 | ||
|
|
d554b7da08 | ||
|
|
cd7f1a15f8 | ||
|
|
fa68c2619f | ||
|
|
e97bec10ea | ||
|
|
7763718b60 | ||
|
|
7f2c4cbf8a | ||
|
|
91ebe12fc2 | ||
|
|
13e1e7e1e9 | ||
|
|
8a263952ad | ||
|
|
f27232bd0a | ||
|
|
16534ec644 | ||
|
|
7e44bcfd8a | ||
|
|
8cbd66b0f9 | ||
|
|
47a81c2b39 | ||
|
|
56bf209f84 | ||
|
|
333fb1bf97 | ||
|
|
cbef88a593 | ||
|
|
b13179d4f4 | ||
|
|
cf89d9bfb0 | ||
|
|
f49848c8a4 | ||
|
|
0101b39f6c | ||
|
|
4285baa6e1 | ||
|
|
e530af1ff7 | ||
|
|
60e94a4ec8 | ||
|
|
c66a574fa0 | ||
|
|
ef3259035d | ||
|
|
4226f4412b | ||
|
|
368983d8da | ||
|
|
16b982958b | ||
|
|
0c4819131c | ||
|
|
186b0f62eb | ||
|
|
77bc4c5725 | ||
|
|
dd47da92f5 | ||
|
|
f8e35de18d | ||
|
|
a7facfb760 | ||
|
|
f5e62f28bc | ||
|
|
60c8012e9e | ||
|
|
08d6e515c7 | ||
|
|
fac2f27dd3 | ||
|
|
ed37427f9e | ||
|
|
7a5a277c29 | ||
|
|
38da76804e | ||
|
|
a949f0b0c3 | ||
|
|
ffc23046a2 | ||
|
|
07944cfd20 | ||
|
|
91aadab3dd | ||
|
|
c3425bc55f | ||
|
|
55bc4168bf | ||
|
|
ba1b5e34a7 | ||
|
|
753c42a3d5 | ||
|
|
97c2ec8dcf | ||
|
|
4948508277 | ||
|
|
fb89c762fc | ||
|
|
58ebdd4a7e | ||
|
|
d7f22a0c27 | ||
|
|
3b4794ae94 | ||
|
|
c0989dce2d | ||
|
|
8412c867a5 | ||
|
|
10642a34f1 | ||
|
|
6a94b51cba | ||
|
|
36ef521c0e | ||
|
|
bf14668b2a | ||
|
|
a475dd15e6 | ||
|
|
bb0b82a110 | ||
|
|
2bbb59964f | ||
|
|
4fd32eb48e | ||
|
|
2872a98b2b | ||
|
|
023af5585f | ||
|
|
3d85000f13 | ||
|
|
3d1a204c83 | ||
|
|
1ce30deec3 | ||
|
|
8ed08872b9 | ||
|
|
7a75e7341b | ||
|
|
ec6dee8bd1 | ||
|
|
f2a507c4a7 | ||
|
|
17ab7bde44 | ||
|
|
fcc363333c | ||
|
|
7ef9e4d8e7 | ||
|
|
3180910fd1 | ||
|
|
b01d09d704 | ||
|
|
2f6551b3b1 | ||
|
|
50ae14cf7b | ||
|
|
79b7cd69bb | ||
|
|
cf237a0e4f | ||
|
|
c0d147c5c4 | ||
|
|
bd707b4a96 | ||
|
|
daaed863da | ||
|
|
2bdfac2036 | ||
|
|
d74a23e583 | ||
|
|
44b35f7735 | ||
|
|
0d3169ef70 | ||
|
|
fe3b439e31 | ||
|
|
6c987d6708 | ||
|
|
28fd1a4c5d | ||
|
|
bd895aa76c | ||
|
|
1177daecde | ||
|
|
42813eeb84 | ||
|
|
d4fafeb6d6 | ||
|
|
1270384ede | ||
|
|
aa1b065dd1 | ||
|
|
7248b2213d | ||
|
|
74b28f0a86 | ||
|
|
005edf71a8 | ||
|
|
c1f64ba017 | ||
|
|
42166be22e | ||
|
|
62b3ed17ba | ||
|
|
31bf50b2d4 | ||
|
|
0325c1ba65 | ||
|
|
f2a437bd3b | ||
|
|
7a7fb423b3 | ||
|
|
d533c1b1c8 | ||
|
|
2db013a5fa | ||
|
|
9fece3fdf1 | ||
|
|
b520a03c57 | ||
|
|
a4cafaad2e | ||
|
|
0d64bbed46 | ||
|
|
9718e70260 | ||
|
|
a67dd9fbdd | ||
|
|
aabed8279e | ||
|
|
06eb271bda | ||
|
|
12025e3050 | ||
|
|
ad6367018b | ||
|
|
c71b168402 | ||
|
|
4deb46290d | ||
|
|
e5ef45e4c0 | ||
|
|
e780637cf4 | ||
|
|
d659e55646 | ||
|
|
1c58b6d83e | ||
|
|
1305c02579 | ||
|
|
2c19ca0dbf | ||
|
|
3cfdc6d126 | ||
|
|
8ec73b2dd4 | ||
|
|
5f11854286 | ||
|
|
14f4e0e271 | ||
|
|
5c54ef7b0d | ||
|
|
73c2846d64 | ||
|
|
acd2038407 | ||
|
|
2442ae60db | ||
|
|
6c096191ba | ||
|
|
20f9dd9a6b | ||
|
|
44e94b8cfa | ||
|
|
8c21cf7761 | ||
|
|
d2851cf5c5 | ||
|
|
b0716253a2 | ||
|
|
eaf023b4d8 | ||
|
|
e47ad09130 | ||
|
|
689d0082d8 | ||
|
|
390a49072d | ||
|
|
7dc0b6f40b | ||
|
|
79d14521db | ||
|
|
8d6b0c8d76 | ||
|
|
1486774249 | ||
|
|
1fa9167f25 | ||
|
|
cc12225142 | ||
|
|
6b3a37c597 | ||
|
|
b187125b63 | ||
|
|
d232a0f951 | ||
|
|
84ea96f383 | ||
|
|
be33d3f2a4 | ||
|
|
0e991c596f | ||
|
|
858b6aa257 | ||
|
|
74135c0600 | ||
|
|
18dd6f58e3 | ||
|
|
ddcd2b0810 | ||
|
|
6d749789ce | ||
|
|
3224062b32 | ||
|
|
688ea28bed | ||
|
|
5e7c01c251 | ||
|
|
de2eea05b4 | ||
|
|
1de819e3de | ||
|
|
bc43409624 | ||
|
|
a57077aba3 | ||
|
|
8eaabacf44 | ||
|
|
adf5b036d6 | ||
|
|
3ab954644f | ||
|
|
64953e26fc | ||
|
|
2e1024d275 | ||
|
|
2253c57628 | ||
|
|
9c7d1dbb6f | ||
|
|
ef9f2ab31f | ||
|
|
64ca6c066c | ||
|
|
d1cf5ab286 | ||
|
|
b1545c5ce2 | ||
|
|
de8bae3f0f | ||
|
|
1fbf633817 | ||
|
|
f733dc5eae | ||
|
|
503bbd85b5 | ||
|
|
29ddb68da4 | ||
|
|
dd49399e45 | ||
|
|
3678f134d9 | ||
|
|
bbd784a2e8 | ||
|
|
77dbaf3aef | ||
|
|
9b9ee338c1 | ||
|
|
5ea7f52df2 | ||
|
|
414530c9c2 | ||
|
|
e632d39b1f | ||
|
|
09054a09fa | ||
|
|
01ec55366d | ||
|
|
e2388344b2 | ||
|
|
fd10844c2b | ||
|
|
35f2302352 | ||
|
|
e908b731ab | ||
|
|
b475325b5e | ||
|
|
7e769252e7 | ||
|
|
699d78bcfe | ||
|
|
7d345018af | ||
|
|
bac3b39227 | ||
|
|
c168e6f870 | ||
|
|
27b6fe682d | ||
|
|
a1b43b7a09 | ||
|
|
bfc78186f5 | ||
|
|
20130d89dc | ||
|
|
8490aac025 | ||
|
|
8fbffe250a | ||
|
|
60808a4820 | ||
|
|
d5cb16aa1f | ||
|
|
afd6ca314c | ||
|
|
441522f97b | ||
|
|
369229ea71 | ||
|
|
15a63805d9 | ||
|
|
7d8766980b | ||
|
|
5be3606236 | ||
|
|
ce4c145f1c | ||
|
|
b9372944f5 | ||
|
|
f58dff62c7 | ||
|
|
6d13b8bbc0 | ||
|
|
2139334c36 | ||
|
|
67bb12e569 | ||
|
|
2d43517914 | ||
|
|
df60c00d16 | ||
|
|
0fbddb0df1 | ||
|
|
4c5c1fc9ef | ||
|
|
4ffd2380c3 | ||
|
|
5849cd3a2e | ||
|
|
0a1960865e | ||
|
|
830ab99e6e | ||
|
|
2e4b7b3d19 | ||
|
|
8cb051d44d | ||
|
|
535445a555 | ||
|
|
f6afddd94b | ||
|
|
844b01cb6b | ||
|
|
0f2ee308de | ||
|
|
7d3f808e4c | ||
|
|
45465e0c45 | ||
|
|
4a9be7bf11 | ||
|
|
c8e0d18d18 | ||
|
|
ee9a4082b6 | ||
|
|
e6c70bf392 | ||
|
|
9edf9ad2ac | ||
|
|
f714d80c93 | ||
|
|
605c306bef | ||
|
|
5e2cda183a | ||
|
|
f284f00935 | ||
|
|
777e4fe49e | ||
|
|
8daf0223dc | ||
|
|
f77fb0b948 | ||
|
|
71992158bf | ||
|
|
fd8ab78372 | ||
|
|
1514ab8ec5 | ||
|
|
3591900070 | ||
|
|
44c6fa68cf | ||
|
|
7df4a966ea | ||
|
|
998ce1fe89 | ||
|
|
1279888567 | ||
|
|
d9d65577f4 | ||
|
|
f2f6055109 | ||
|
|
db0506c1df | ||
|
|
114f803a88 | ||
|
|
69778efb6b | ||
|
|
e7df20f69b | ||
|
|
1157d330a6 | ||
|
|
cd64a777c3 | ||
|
|
808bc42f2a | ||
|
|
3728fc7dba | ||
|
|
9920047b34 | ||
|
|
b758c0c335 | ||
|
|
32054b6f32 | ||
|
|
c6e5201e15 | ||
|
|
88eae68987 | ||
|
|
8b89bd7a1f | ||
|
|
fc68b9d7cd | ||
|
|
64b1b5ca38 | ||
|
|
8e77aca854 | ||
|
|
0627ae82fb | ||
|
|
0cd125b55c | ||
|
|
444cb894be | ||
|
|
8138b2080b | ||
|
|
d0c3cc6016 | ||
|
|
737b204b2c | ||
|
|
bd313b0b3d | ||
|
|
568de7e818 | ||
|
|
3106cffb65 | ||
|
|
21e9615243 | ||
|
|
9e27ba5109 | ||
|
|
7874cdf52a | ||
|
|
213e907044 | ||
|
|
c8d5131a42 | ||
|
|
fc21bb6eda | ||
|
|
3a9173858b | ||
|
|
dede320630 | ||
|
|
c25e2e611d | ||
|
|
54689f6087 | ||
|
|
370b47d23f | ||
|
|
53814983ff | ||
|
|
5953170f14 | ||
|
|
40897cd7da | ||
|
|
e2fe873049 | ||
|
|
9f3a16a4ae | ||
|
|
9da3d890e4 | ||
|
|
9684cbf850 | ||
|
|
295c8f48a6 | ||
|
|
7be8147b80 | ||
|
|
c22d94bba6 | ||
|
|
b0e94c15e6 | ||
|
|
874d3aca45 | ||
|
|
4a20febe96 | ||
|
|
28c7094f5b | ||
|
|
ff5e2746da | ||
|
|
dc8014562b | ||
|
|
b9394b9599 | ||
|
|
899dafb33f | ||
|
|
104cf87b89 | ||
|
|
290aae80e1 | ||
|
|
212eeaa77c | ||
|
|
eb28c710ba | ||
|
|
129d2f803a | ||
|
|
71f6986dd6 | ||
|
|
6fc1d7dc77 | ||
|
|
d9056081e7 | ||
|
|
95f87cdd56 | ||
|
|
746cc4c10b | ||
|
|
51c18e3f9a | ||
|
|
25b25e3e49 | ||
|
|
096f850433 | ||
|
|
ec469782c8 | ||
|
|
40e223c12d | ||
|
|
b2c78dbd57 | ||
|
|
89069fdaa4 | ||
|
|
75b02e1d27 | ||
|
|
1130e4782d | ||
|
|
2927514e68 | ||
|
|
0e9d159bc2 | ||
|
|
d69f408b14 | ||
|
|
e8d6c96c1e | ||
|
|
041120aab4 | ||
|
|
d20f45b949 | ||
|
|
02bd933c58 | ||
|
|
b34721b3f4 | ||
|
|
cb6be2a50d | ||
|
|
45852f0497 | ||
|
|
8160c85e44 | ||
|
|
426f58aa61 | ||
|
|
e0bfa1e422 | ||
|
|
bf75731bbe | ||
|
|
c8eec109b2 | ||
|
|
b8079953d8 | ||
|
|
993148552e | ||
|
|
1863be7be4 | ||
|
|
358145c4bd | ||
|
|
fb882f0b69 | ||
|
|
27cba56761 | ||
|
|
e2da73bf4f | ||
|
|
4402f73bf7 | ||
|
|
dc90cd6bc4 | ||
|
|
7356a0f6c8 | ||
|
|
f408bc4808 | ||
|
|
a302f37447 | ||
|
|
f501e30353 | ||
|
|
2587649ca2 | ||
|
|
d1faac58dd | ||
|
|
1efb120248 | ||
|
|
8078d29fda | ||
|
|
a9787b769f | ||
|
|
a42711e31c | ||
|
|
c632307eaa | ||
|
|
0f9de11a67 | ||
|
|
541db5fbbe | ||
|
|
715823a666 | ||
|
|
6ce4b344e4 | ||
|
|
a6ca809a4e | ||
|
|
c1a13ae8bc | ||
|
|
6536ffe178 | ||
|
|
562946d055 | ||
|
|
924b8cbe24 | ||
|
|
93f7c14ea6 | ||
|
|
5b1a532652 | ||
|
|
a3a918e900 | ||
|
|
b6af3e51ab | ||
|
|
3707dcbf33 | ||
|
|
ebc8bd6ff5 | ||
|
|
ed70195c7e | ||
|
|
e38217683c | ||
|
|
739e529416 | ||
|
|
12be83562d | ||
|
|
8bcb5e4ed7 | ||
|
|
5c96bca1ca | ||
|
|
384987cd5b | ||
|
|
af21dfd294 | ||
|
|
3e9153d955 | ||
|
|
0e421ea31d | ||
|
|
471f7f06f7 | ||
|
|
ddb37a47da | ||
|
|
5b24aac266 | ||
|
|
d61adfbc53 | ||
|
|
602f040940 | ||
|
|
5cf59de676 | ||
|
|
e25d49b80b | ||
|
|
d5d9b9284a | ||
|
|
0ec97c5d1e | ||
|
|
9bbda857c3 | ||
|
|
383b6aabf5 | ||
|
|
7a3f5afee7 | ||
|
|
5769fa6aed | ||
|
|
925fe65dd8 | ||
|
|
67b1f14a6f | ||
|
|
dd0cc5ed9f | ||
|
|
a23441109d | ||
|
|
ef4465efdb | ||
|
|
646180518a | ||
|
|
659541f4a5 | ||
|
|
0e7acaa3c4 | ||
|
|
f0946baeaa | ||
|
|
76ecf897ce | ||
|
|
7db755dd68 | ||
|
|
2efc0bad1c | ||
|
|
3978de2cde | ||
|
|
263f919beb | ||
|
|
4aaa9e7d9f | ||
|
|
e1608362d0 | ||
|
|
9f986d8a86 | ||
|
|
e0b78f7f2a | ||
|
|
1eb09f3eb2 | ||
|
|
0e7790df8c | ||
|
|
591abd340b | ||
|
|
44d13869ad | ||
|
|
9862eb930d | ||
|
|
0c4dab54f1 | ||
|
|
84483b4aac | ||
|
|
9f5547327e | ||
|
|
b04fc5a39e | ||
|
|
5121417725 | ||
|
|
2c39d5b6c0 | ||
|
|
8d1667e9e8 | ||
|
|
5b3397359f | ||
|
|
ded64758d5 | ||
|
|
2813dcc6cc | ||
|
|
0a54558ee2 | ||
|
|
168d25e780 | ||
|
|
63a15e232b | ||
|
|
cb86b8f8fc | ||
|
|
f2211ff3ad | ||
|
|
312977d5a6 | ||
|
|
3eac5f9ab7 | ||
|
|
fcb3f36065 | ||
|
|
ac7a461070 | ||
|
|
2a1fd421bd | ||
|
|
920adb8296 | ||
|
|
8ceb4b83a4 | ||
|
|
34540babdb | ||
|
|
9f6223311e | ||
|
|
90b78326d3 | ||
|
|
8fc26c1e58 | ||
|
|
6eb7530f75 | ||
|
|
76ab22f74c | ||
|
|
cfbb511d26 | ||
|
|
14b6d32fe6 | ||
|
|
0de26732bf | ||
|
|
0f02997bcc | ||
|
|
2271526d2f | ||
|
|
ea2e1f016f | ||
|
|
c4aa223698 | ||
|
|
63233655f4 | ||
|
|
63d93a2f9a | ||
|
|
ba2fcd9dae | ||
|
|
c0ad54fe02 | ||
|
|
fe3bca3a88 | ||
|
|
8621399d78 | ||
|
|
5d84e86d89 | ||
|
|
6640167410 | ||
|
|
6d542b8bb0 | ||
|
|
e86d31e7a5 | ||
|
|
c5c59d4acb | ||
|
|
4dc40b83e4 | ||
|
|
f186812f18 | ||
|
|
4a6592597a | ||
|
|
afb9401fc7 | ||
|
|
3c65cd41a5 | ||
|
|
8376a44f65 | ||
|
|
9a36435016 | ||
|
|
edc4614e63 | ||
|
|
964c7e6f3b | ||
|
|
9e424ed921 | ||
|
|
cf766b55cc | ||
|
|
03c65d7a96 | ||
|
|
e05743d0ba | ||
|
|
e204ced1ae | ||
|
|
be55d2c57f | ||
|
|
119dd06ea8 | ||
|
|
aed26f8c1e | ||
|
|
6482fd52fb | ||
|
|
44b091a7c6 | ||
|
|
8279a0d477 | ||
|
|
7709af7a62 | ||
|
|
59dd6678c3 | ||
|
|
137463dc6d | ||
|
|
b652920500 | ||
|
|
80a48be324 | ||
|
|
bc9e2266be | ||
|
|
fd25a6425c | ||
|
|
ff4d0ce1e1 | ||
|
|
5d8c776250 | ||
|
|
3d2315d596 | ||
|
|
892cc7da31 | ||
|
|
eb9e712f91 | ||
|
|
2a6eb83fb4 | ||
|
|
ef99a11001 | ||
|
|
2520019fb8 | ||
|
|
877a14c0b8 | ||
|
|
0ad6e6f459 | ||
|
|
885c23b453 | ||
|
|
7cb8f6e9fc | ||
|
|
04f518082c | ||
|
|
26926551cf | ||
|
|
2069094f55 | ||
|
|
976a0a6264 | ||
|
|
8edcf25ba3 | ||
|
|
e4029d00b6 | ||
|
|
044ff5e055 | ||
|
|
0de8c28cf4 | ||
|
|
a1bca962a7 | ||
|
|
f1a13c4ee5 | ||
|
|
5f6ec391e3 | ||
|
|
bf656577d9 | ||
|
|
171bcb1ccf | ||
|
|
5e53c1cde8 | ||
|
|
72431456ff | ||
|
|
b8deb49007 | ||
|
|
6b34f19396 | ||
|
|
c018bfdb4d | ||
|
|
f4f36e356f | ||
|
|
6de9a92582 | ||
|
|
630b0515ad | ||
|
|
b06e798373 | ||
|
|
3b25795ee5 | ||
|
|
ef18d6f70c | ||
|
|
838e784c5f | ||
|
|
1feec5a96c | ||
|
|
7d95768a92 | ||
|
|
9cb95274a6 | ||
|
|
3c5d5b344e | ||
|
|
4980959fce | ||
|
|
22d22f6aa8 | ||
|
|
e8ba3c2f4d | ||
|
|
ce857b0770 | ||
|
|
ce7c681462 | ||
|
|
41e562ebc2 | ||
|
|
ddf98661e4 | ||
|
|
1349d129c5 | ||
|
|
cbd8a27a6d | ||
|
|
b60db79866 | ||
|
|
ddec870d25 | ||
|
|
77e358a001 | ||
|
|
5490f54d00 | ||
|
|
58447c147f | ||
|
|
97e731e05c | ||
|
|
e763345f25 | ||
|
|
7b86b2e05a | ||
|
|
a51bd03a5c | ||
|
|
54d7c29221 | ||
|
|
997e3e16dd | ||
|
|
c6eef16664 | ||
|
|
4f718e83b3 | ||
|
|
20ccda69f4 | ||
|
|
14741518a7 | ||
|
|
dd91779442 | ||
|
|
553eb6ed40 | ||
|
|
8edb53e902 | ||
|
|
460bfc6853 | ||
|
|
3e5b8f1e97 | ||
|
|
fab7299d49 | ||
|
|
09ff1e7af0 | ||
|
|
ad5ae9ba3b | ||
|
|
3788f462b4 | ||
|
|
238bbfcbbb | ||
|
|
0efa211a05 | ||
|
|
00a890c8c7 | ||
|
|
6990871efd | ||
|
|
a62ebc9a69 | ||
|
|
6c82e7acda | ||
|
|
084e435883 | ||
|
|
2f33e5919d | ||
|
|
cbe615224d | ||
|
|
6c70ed79ae | ||
|
|
488652c23a | ||
|
|
bb3a00d1eb | ||
|
|
bf3cf2580f | ||
|
|
843944f558 | ||
|
|
991c900fc6 | ||
|
|
0d2af9e742 | ||
|
|
1c8c9a10b5 | ||
|
|
4aa9f76d06 | ||
|
|
fc7c489ab6 | ||
|
|
4856567a2a | ||
|
|
7d0722bc18 | ||
|
|
1235e60a29 | ||
|
|
4340368277 | ||
|
|
735af50ce9 | ||
|
|
7ce5f34d6f | ||
|
|
f76a16a727 | ||
|
|
f2a5237802 | ||
|
|
4ea92a97ea | ||
|
|
a7ed3658e3 | ||
|
|
061b872498 | ||
|
|
97ea61a407 | ||
|
|
44bd405ed3 | ||
|
|
73f1030bde | ||
|
|
fdef82f89c | ||
|
|
3d68d1bbe2 | ||
|
|
c2dcfc9176 | ||
|
|
df300e042b | ||
|
|
3996f178e5 | ||
|
|
7935b1613a | ||
|
|
8df81f93c8 | ||
|
|
95d5e55df2 | ||
|
|
daf3469ce4 | ||
|
|
1565f9d9c3 | ||
|
|
b56542a9f1 | ||
|
|
5b5b53872c | ||
|
|
1442a2abe8 | ||
|
|
e031fa7207 | ||
|
|
1b521d0822 | ||
|
|
e529f4d75f | ||
|
|
307a4ae9e8 | ||
|
|
46452e7634 | ||
|
|
ee3b355c34 | ||
|
|
61c5b631f3 | ||
|
|
b993dce12f | ||
|
|
cd1c2f74d3 | ||
|
|
a1020b3e61 | ||
|
|
1b1aa07414 | ||
|
|
5023ade7ac | ||
|
|
9921e9e79f | ||
|
|
5ef13d9011 | ||
|
|
3816abb9de | ||
|
|
7561075af8 | ||
|
|
fe10f98038 | ||
|
|
6709d1067d | ||
|
|
74e27a0a82 | ||
|
|
04c0ac9ee8 | ||
|
|
8159f55243 | ||
|
|
cca60adc35 | ||
|
|
16ba544edd | ||
|
|
f230da12c5 | ||
|
|
03aae47424 | ||
|
|
df0aaa1ebe | ||
|
|
68f9342060 | ||
|
|
c38a40d193 | ||
|
|
23ba7b5bff | ||
|
|
173fd4fd23 | ||
|
|
3a893ff17f | ||
|
|
da89591a53 | ||
|
|
097e2030b4 | ||
|
|
24f1da7f30 | ||
|
|
85ce80d72e | ||
|
|
ec1037fcbc | ||
|
|
7a1bedcab6 | ||
|
|
06b4964dd8 | ||
|
|
d2ffdc8986 | ||
|
|
7e1a3148fb | ||
|
|
5559962f6f | ||
|
|
1d67d8ff23 | ||
|
|
9f46881c16 | ||
|
|
dead45fa67 | ||
|
|
a8af974895 | ||
|
|
8605cc685d | ||
|
|
9a49b2c9fb | ||
|
|
b6f495d107 | ||
|
|
05233aa6f4 | ||
|
|
7541fac245 | ||
|
|
7b6780f712 | ||
|
|
d6791a836b | ||
|
|
69c6b007aa | ||
|
|
ee113a5632 | ||
|
|
4899086b3c | ||
|
|
f4f2847662 | ||
|
|
fb89e1a26f | ||
|
|
e849beabba | ||
|
|
2979d3bf16 | ||
|
|
88efc73797 | ||
|
|
77b13d02f0 | ||
|
|
588c520c4a | ||
|
|
d371af0504 | ||
|
|
3e115b7a85 | ||
|
|
ca8e4c08a7 | ||
|
|
6ec4591f02 | ||
|
|
679ef95257 | ||
|
|
5818289c2d | ||
|
|
d407d680ea | ||
|
|
feb36e7342 | ||
|
|
8ab81e6d4b | ||
|
|
4fc2ee1bd4 | ||
|
|
07c48590c0 | ||
|
|
4388b73077 | ||
|
|
d7c6855918 | ||
|
|
e5e7da1482 | ||
|
|
64921fe08a | ||
|
|
79d5ff0350 | ||
|
|
ada3ab4213 | ||
|
|
a00b979bb6 | ||
|
|
b1d8492c3f | ||
|
|
75fe438f21 | ||
|
|
8cdcfc2a91 | ||
|
|
2a06c72113 | ||
|
|
05563ab11e | ||
|
|
625a1cb0b5 | ||
|
|
e58b73179f | ||
|
|
8e07e55c1f | ||
|
|
6a6593335d | ||
|
|
876b9d49b4 | ||
|
|
ed8ff85d2a | ||
|
|
b482cab7be | ||
|
|
0bf5316249 | ||
|
|
969928e500 | ||
|
|
f30a5fe288 | ||
|
|
6f3d7209c2 | ||
|
|
82b589e390 | ||
|
|
b280cc5e75 | ||
|
|
1964b04ea9 | ||
|
|
c4bc216815 | ||
|
|
3af40efdb1 | ||
|
|
27d84ef8be | ||
|
|
680ac41bb1 | ||
|
|
b133137a1f | ||
|
|
be77b9201e | ||
|
|
0479f0ad63 | ||
|
|
aa8b3cb6d6 | ||
|
|
c62d9c37d2 | ||
|
|
70fbb4623f | ||
|
|
6aebeca1d0 | ||
|
|
e3ea953ff4 | ||
|
|
9dc91925e7 | ||
|
|
8dd9602f06 | ||
|
|
92d2e681d6 | ||
|
|
c82dbaca8b | ||
|
|
6faeb71770 | ||
|
|
d534b0ba81 | ||
|
|
87a0363ba7 | ||
|
|
0005702399 | ||
|
|
8642a1e68e | ||
|
|
ec1d2e86c8 | ||
|
|
2a46b984cd | ||
|
|
5a7b85adc7 | ||
|
|
914f83cb10 | ||
|
|
db969dc85a | ||
|
|
5b39d1819f | ||
|
|
3fe1adfc6d | ||
|
|
0af49d0533 | ||
|
|
d5c1bf98d7 | ||
|
|
5753fa2106 | ||
|
|
31b01f8de3 | ||
|
|
4f8d4f378c | ||
|
|
222e36ee3e | ||
|
|
3e3eefc2dc | ||
|
|
77b6b0a9b2 | ||
|
|
551d2dfebd | ||
|
|
f9c2a77c67 | ||
|
|
92099c7af2 | ||
|
|
58ad04b61c | ||
|
|
97bea94550 | ||
|
|
51ae9b3ed4 | ||
|
|
4726221d18 | ||
|
|
7353c6f94d | ||
|
|
91a04c7638 | ||
|
|
1511de68ed | ||
|
|
d6c9d3ce94 | ||
|
|
c64a86efae | ||
|
|
c522c0833a | ||
|
|
28fdfec7cb | ||
|
|
d3bb2a718a | ||
|
|
cabebd9f51 | ||
|
|
886c4320d6 | ||
|
|
93f27666db | ||
|
|
379cf3d249 | ||
|
|
0fe44f0e2a | ||
|
|
66d5436789 | ||
|
|
70b83a3bbb | ||
|
|
eba5b0e4c5 | ||
|
|
66af0c1a53 | ||
|
|
70c6ca76cb | ||
|
|
d840643cb3 | ||
|
|
07b7a65b86 | ||
|
|
7e7b50cd74 | ||
|
|
0b8f7d4fe7 | ||
|
|
93278dc7e3 | ||
|
|
b771e97ac6 | ||
|
|
a3c87fb30b | ||
|
|
228fa38240 | ||
|
|
a142c5e1ec | ||
|
|
4702283280 | ||
|
|
918df393e6 | ||
|
|
1e415a9943 | ||
|
|
c955379971 | ||
|
|
1debe4f055 | ||
|
|
9b9ce31550 | ||
|
|
bdd8ef5a52 | ||
|
|
292908c00a | ||
|
|
e027492e11 | ||
|
|
640118e781 | ||
|
|
c6ec2645dc | ||
|
|
2ffc2a288c | ||
|
|
5d75ee7721 | ||
|
|
4ca46b7883 | ||
|
|
827a9d640c | ||
|
|
70208eb33a | ||
|
|
e2a506e54a | ||
|
|
048f08080d | ||
|
|
0a02e0db4b | ||
|
|
825a7311ea | ||
|
|
09b0213738 | ||
|
|
f3e5262dc0 | ||
|
|
99494afd08 | ||
|
|
8214ae9b15 | ||
|
|
e63ef84ac1 | ||
|
|
697c44a293 | ||
|
|
18e34902a5 | ||
|
|
4b0c3ffc2f | ||
|
|
b4d33a58b1 | ||
|
|
c177965da5 | ||
|
|
220e1e8fb5 | ||
|
|
464187491f | ||
|
|
fd15d30987 | ||
|
|
03e36bda72 | ||
|
|
a259c37415 | ||
|
|
54c21f5974 | ||
|
|
08f378c359 | ||
|
|
58818e9738 | ||
|
|
599556d7d1 | ||
|
|
9e4d7b41e0 | ||
|
|
b35a2d568a | ||
|
|
9ca12e9f9d | ||
|
|
d54346b205 | ||
|
|
54f683fc6b | ||
|
|
908b07527e | ||
|
|
ee7339b661 | ||
|
|
35610da204 | ||
|
|
c06b1694a2 | ||
|
|
c238bdd861 | ||
|
|
d378904b98 | ||
|
|
3a4a2a6dac | ||
|
|
cfe815135e | ||
|
|
2eb97edf02 | ||
|
|
cdfb5c2bd8 | ||
|
|
8f9ba2cd09 | ||
|
|
ee95a7309a | ||
|
|
f32dfe2da6 | ||
|
|
9f0775c873 | ||
|
|
9169a673d5 | ||
|
|
37123ee053 | ||
|
|
c2616e385c | ||
|
|
5297d46017 | ||
|
|
2ef9126744 | ||
|
|
1d2cd99e96 | ||
|
|
994e9fe9de | ||
|
|
e63a2a2152 | ||
|
|
2997ce2e3c | ||
|
|
b8028c1b1d | ||
|
|
568de8157a | ||
|
|
924b646b79 | ||
|
|
f8786c25be | ||
|
|
92b2c28532 | ||
|
|
cc0c44f36b | ||
|
|
ce279e9c2d | ||
|
|
84978b7132 | ||
|
|
e4e9f6f221 | ||
|
|
77ec902ca7 | ||
|
|
7d9b0a00e4 | ||
|
|
f3c1ca3564 | ||
|
|
f109fa227d | ||
|
|
8befc474c1 | ||
|
|
622efba247 | ||
|
|
ce0c52d353 | ||
|
|
b03515276e | ||
|
|
30af350be0 | ||
|
|
1287b9d823 | ||
|
|
91aab03b90 | ||
|
|
e921dc50e0 | ||
|
|
dd6bb04ba7 | ||
|
|
c80bd104d2 | ||
|
|
22d1aaa27d | ||
|
|
2f5016262a | ||
|
|
47583877f1 | ||
|
|
1dbff80691 | ||
|
|
7abf6c71ad | ||
|
|
2da81b0ae7 | ||
|
|
d4c881791f | ||
|
|
516be01366 | ||
|
|
2b99190a1b | ||
|
|
3087f57453 | ||
|
|
4a4f8ec523 | ||
|
|
0c004147c0 | ||
|
|
451eb13e0e | ||
|
|
4e84cf1d38 | ||
|
|
72b7e64ad8 | ||
|
|
c3690b0878 | ||
|
|
b3f248fd19 | ||
|
|
d4686e6a59 | ||
|
|
14af6ba2af | ||
|
|
c3ee3af201 | ||
|
|
6496adf101 | ||
|
|
79f8d5c51e | ||
|
|
74ef1bc8ff | ||
|
|
26eeb9f37a | ||
|
|
ab385cd609 | ||
|
|
0f12f2b6b1 | ||
|
|
32c1d50887 | ||
|
|
956c94f30a | ||
|
|
3e69e5b082 | ||
|
|
330faab6cd | ||
|
|
fe6699f0bf | ||
|
|
807c5f2ef2 | ||
|
|
f7708955b6 | ||
|
|
be9024767e | ||
|
|
a1a83f8880 | ||
|
|
eb3a1f6739 | ||
|
|
03c1f2ef5b | ||
|
|
d215e86662 | ||
|
|
10962d7175 | ||
|
|
6889232b41 | ||
|
|
c54097af20 | ||
|
|
7c6695354e | ||
|
|
2d7fbf2476 | ||
|
|
1ef8206db1 | ||
|
|
b65f8d81fc | ||
|
|
e285d2939b | ||
|
|
6b602a4589 | ||
|
|
084542b943 | ||
|
|
ef8ea97044 | ||
|
|
dd6d0e774c | ||
|
|
f934310337 | ||
|
|
afe293c20a | ||
|
|
7f0a68f8d6 | ||
|
|
2517832718 | ||
|
|
bcf3accb74 | ||
|
|
1c5556334d | ||
|
|
299d803396 | ||
|
|
d513ace39d | ||
|
|
d5a9a4463c | ||
|
|
cf0baada2c | ||
|
|
49589e2da0 | ||
|
|
0e24676144 | ||
|
|
b0132821ac | ||
|
|
24afe544a3 | ||
|
|
3d7ff9f758 | ||
|
|
a81e70350b | ||
|
|
7f6f0ca103 | ||
|
|
c89bc73740 | ||
|
|
3100669b79 | ||
|
|
22c670c3d3 | ||
|
|
c37c7cee05 | ||
|
|
46579f3799 | ||
|
|
6de30028a8 | ||
|
|
c78c1427be | ||
|
|
953e7fd717 | ||
|
|
1ae08cfedf | ||
|
|
3c116cd077 | ||
|
|
bcab703e31 | ||
|
|
73046ec838 | ||
|
|
e1734468f5 | ||
|
|
aa78292c2a | ||
|
|
8bbd8ab073 | ||
|
|
b936be8e34 | ||
|
|
b8f34cdd35 | ||
|
|
993c028579 | ||
|
|
9285ade8a8 | ||
|
|
83e9f0dd91 | ||
|
|
c641f5cbdc | ||
|
|
c6302e3b3f | ||
|
|
94acb6ed5d | ||
|
|
42497d9932 | ||
|
|
3f172d13b2 | ||
|
|
437b4397b9 | ||
|
|
3a7ab3f030 | ||
|
|
fccf38a4d6 | ||
|
|
46edc49ede | ||
|
|
c05281492d | ||
|
|
5cebd3abf7 | ||
|
|
5ed5d637b8 | ||
|
|
516e18900c | ||
|
|
0970487cca | ||
|
|
d38f1380e9 | ||
|
|
2626b83b08 | ||
|
|
db0659aab4 | ||
|
|
e23a60a6bb | ||
|
|
3ea8d83d3f | ||
|
|
d9445f04b1 | ||
|
|
1543d02f96 | ||
|
|
11a444e914 | ||
|
|
2a6412481e | ||
|
|
b4447bfa4d | ||
|
|
72b5988e56 | ||
|
|
3a2c3c2288 | ||
|
|
9762a8ca1e | ||
|
|
e02e5e503d | ||
|
|
e4329f3ae7 | ||
|
|
f7082ee034 | ||
|
|
3ac9621f87 | ||
|
|
46e92e998e | ||
|
|
77dfd7b783 | ||
|
|
7d480ff579 | ||
|
|
37140d5e10 | ||
|
|
b04e874e43 | ||
|
|
d146f578a4 | ||
|
|
40c0c5a298 | ||
|
|
3a475a99fc | ||
|
|
9394583f96 | ||
|
|
3b4f4c5f59 | ||
|
|
34f2f77067 | ||
|
|
6b94708508 | ||
|
|
1d93e89eed | ||
|
|
e0e0bcdc1e | ||
|
|
1ed8af2ee8 | ||
|
|
3830c0adc4 | ||
|
|
5dbda6cd95 | ||
|
|
d8dbdc83c0 | ||
|
|
359a7cebde | ||
|
|
490ead52eb | ||
|
|
a5a7a32447 | ||
|
|
7e9652787b | ||
|
|
3b00d06a62 | ||
|
|
234fb7c2fe | ||
|
|
2c7e0ef577 | ||
|
|
2cbcc82968 | ||
|
|
b48e504522 | ||
|
|
4cce303c89 | ||
|
|
6a97b45ad1 | ||
|
|
1afdbb848e | ||
|
|
4d19bb17a9 | ||
|
|
b2012467b3 | ||
|
|
daf5ef1bbd | ||
|
|
85a5319c4b | ||
|
|
6ca11044a4 | ||
|
|
42be7733fe | ||
|
|
1d75c232ff | ||
|
|
97c9c9c9d1 | ||
|
|
ab52469fbb | ||
|
|
fba984272a | ||
|
|
fb3a41d3ad | ||
|
|
be7d02ebdd | ||
|
|
b989978dd3 | ||
|
|
d9c9760aac | ||
|
|
6ff88a44f0 | ||
|
|
cbcc439e03 | ||
|
|
bf282e9bd7 | ||
|
|
4c3d3af73e | ||
|
|
10648cac5b | ||
|
|
3bfcd5e105 | ||
|
|
87aca05e7f | ||
|
|
94b1d58cc2 | ||
|
|
c55cbd3f2f | ||
|
|
d89fcdcc5f | ||
|
|
76f715c486 | ||
|
|
bbab6b2fdc | ||
|
|
a8e92639af | ||
|
|
d99c2cb9a7 | ||
|
|
9f8fe3d5e3 | ||
|
|
3c8c8a7559 | ||
|
|
a61e2caadb | ||
|
|
f109d535b1 | ||
|
|
12095c721c | ||
|
|
7b873179ad | ||
|
|
f1d923714a | ||
|
|
b9ba227733 | ||
|
|
f7754a2927 | ||
|
|
125d12798d | ||
|
|
d3bec4e686 | ||
|
|
1b0e4a0067 | ||
|
|
286bef5eb7 | ||
|
|
c9b4163e23 | ||
|
|
fbedf020bc | ||
|
|
d3e9183303 | ||
|
|
aaa0c25ff7 | ||
|
|
2f43584727 | ||
|
|
e7c1cb7185 | ||
|
|
911c37e63e | ||
|
|
8b40f09e17 | ||
|
|
93dfb6f7d6 | ||
|
|
547b0a9850 | ||
|
|
4416753df0 | ||
|
|
dc54ec5b2b | ||
|
|
b682c4102e | ||
|
|
6d522e6ed6 | ||
|
|
635c87d629 | ||
|
|
a355cf24f1 | ||
|
|
bc7ad955a3 | ||
|
|
05125341f1 | ||
|
|
12332328c1 | ||
|
|
8d95d0834d | ||
|
|
db5eebd372 | ||
|
|
b119b4f1da | ||
|
|
694ab455cd | ||
|
|
46edc07ae4 | ||
|
|
2a7fc9c3a5 | ||
|
|
be23c0755e | ||
|
|
db55176212 | ||
|
|
66a445f043 | ||
|
|
6527a48897 | ||
|
|
3f9706a7f3 | ||
|
|
41fc3bcb74 | ||
|
|
d46859b9e8 | ||
|
|
51a955c75c | ||
|
|
9a89da3b33 | ||
|
|
e8da9999f6 | ||
|
|
3f5c02bf92 | ||
|
|
e918851902 | ||
|
|
e411bac592 | ||
|
|
ded81ec186 | ||
|
|
cd276030c1 | ||
|
|
818533f9f0 | ||
|
|
ff7cbab991 | ||
|
|
ad8d68dd43 | ||
|
|
0db1b6ce44 | ||
|
|
843d5a5977 | ||
|
|
406d7f1a47 | ||
|
|
7df89566f3 | ||
|
|
32b2c9fc9e | ||
|
|
3f8baeba20 | ||
|
|
1879dc4b59 | ||
|
|
ea8c6bc15e | ||
|
|
4683ce2771 | ||
|
|
798537d47b | ||
|
|
0257b02a8c | ||
|
|
27e71c5f37 | ||
|
|
cddf7e0986 | ||
|
|
2b35b3f06e | ||
|
|
92b2376c23 | ||
|
|
412902e4ae | ||
|
|
29fda9cb6c | ||
|
|
e7b3f5745c | ||
|
|
268d64d244 | ||
|
|
8f045b9ec5 | ||
|
|
2ea1c2be92 | ||
|
|
5e9ca72731 | ||
|
|
debfc0f712 | ||
|
|
1e65e7c996 | ||
|
|
d12b1650aa | ||
|
|
70a75dc88a | ||
|
|
fa090f2c9f | ||
|
|
b6bd6e399d | ||
|
|
a3b497b271 | ||
|
|
55b3cf4627 | ||
|
|
eb1c00c56b | ||
|
|
c58278758c | ||
|
|
3d0d9a250b | ||
|
|
274f018494 | ||
|
|
970d05df39 | ||
|
|
abae08a9fb | ||
|
|
a0edee51fa | ||
|
|
887474d607 | ||
|
|
3bf3c11b0b | ||
|
|
6d61919941 | ||
|
|
e07de09460 | ||
|
|
98a17f4046 | ||
|
|
f850c021b7 | ||
|
|
8600243683 | ||
|
|
c6e5987480 | ||
|
|
e0c858478a | ||
|
|
a3b15b995e | ||
|
|
57ef5289fe | ||
|
|
a63c0311bb | ||
|
|
9808829ece | ||
|
|
00b6431ad9 | ||
|
|
e020ad0c06 | ||
|
|
df0c1eb32c | ||
|
|
9057801c4b | ||
|
|
0f443ef37b | ||
|
|
a20e0b9e2e | ||
|
|
4b6bd7cae5 | ||
|
|
6f35792c74 | ||
|
|
f1b375b042 | ||
|
|
4e672427bc | ||
|
|
165068c81d | ||
|
|
89993e9cbf | ||
|
|
78ab7e7ba1 | ||
|
|
424bb589a2 | ||
|
|
664fee5c6e | ||
|
|
146a353085 | ||
|
|
214ef3dd0b | ||
|
|
406c8a6d1e | ||
|
|
6416cb45fb | ||
|
|
1db7c6233b | ||
|
|
640beafa8c | ||
|
|
44f70d2b52 | ||
|
|
acbb6fb8e2 | ||
|
|
1163961927 | ||
|
|
e1190eb1f3 | ||
|
|
dc37a8079e | ||
|
|
373cca0bf6 | ||
|
|
b32fcc7a8e | ||
|
|
e9c226b8be | ||
|
|
af9d611847 | ||
|
|
9d6c4fa678 | ||
|
|
b66233de78 | ||
|
|
ff49792f44 | ||
|
|
b2abd963f0 | ||
|
|
0ab9cf8054 | ||
|
|
c70e92e98d | ||
|
|
bf10d6c03b | ||
|
|
de084b4a0d | ||
|
|
e46cbea251 | ||
|
|
7f6e63aba5 | ||
|
|
25081f60c4 | ||
|
|
91bf41cfce | ||
|
|
552d8f394e | ||
|
|
f8e01628b2 | ||
|
|
3d1ad89963 | ||
|
|
2188bb9b88 | ||
|
|
f0000ea7d2 | ||
|
|
5b173dafae | ||
|
|
c939f2ee45 | ||
|
|
309dfeb6a8 | ||
|
|
bf3e4126b2 | ||
|
|
8a357e1866 | ||
|
|
b8135574c3 | ||
|
|
85fdf587c0 | ||
|
|
8d4a701f86 | ||
|
|
1c83144773 | ||
|
|
edb973fadc | ||
|
|
77f1b1f0fe | ||
|
|
a79d3c680c | ||
|
|
ac023f7588 | ||
|
|
f3c8f535a4 | ||
|
|
b02f6cf3bc | ||
|
|
b7c4a4fc3b | ||
|
|
9f33050a32 | ||
|
|
f73caeb6a3 | ||
|
|
15da4aaec7 | ||
|
|
9ee7b0a501 | ||
|
|
3c116f6ab3 | ||
|
|
431ef224e0 | ||
|
|
600aeb6ccc | ||
|
|
a4c646f75c | ||
|
|
7f35f98d7d | ||
|
|
8b10b0a614 | ||
|
|
a9ada13a23 | ||
|
|
1ae0e5d7cb | ||
|
|
808fac9b14 | ||
|
|
737972be2f | ||
|
|
4cb70e8e2a | ||
|
|
abf3ee6563 | ||
|
|
1a0a3d85ca | ||
|
|
1bbac9e5ce | ||
|
|
705793eae6 | ||
|
|
efa6e38741 | ||
|
|
183aea5c96 | ||
|
|
97ddf9a4f3 | ||
|
|
489366290a | ||
|
|
fb8f16373f | ||
|
|
fed352653d | ||
|
|
a697b2b60e | ||
|
|
efe9c82bc6 | ||
|
|
2bdb199169 | ||
|
|
d0dabb0ff6 | ||
|
|
27e4ece24f | ||
|
|
fc898eff65 | ||
|
|
dd317709f8 | ||
|
|
fde9842a8e | ||
|
|
3bf88110aa | ||
|
|
cc5c411039 | ||
|
|
37bdb20092 | ||
|
|
e31431140a | ||
|
|
8a66ba6c35 | ||
|
|
8a446f43ff | ||
|
|
d6b5558cf2 | ||
|
|
50c04752f5 | ||
|
|
2a91a7640c | ||
|
|
6b35250099 | ||
|
|
2ba92f92b7 | ||
|
|
0b1e371880 | ||
|
|
ce15abd577 | ||
|
|
30392bf66a | ||
|
|
71233ee894 | ||
|
|
af3059ab2a | ||
|
|
1f0ae8b06d | ||
|
|
d5af389d2e | ||
|
|
644607c29f | ||
|
|
aa477195d4 | ||
|
|
b0a9a5a756 | ||
|
|
882a62ad52 | ||
|
|
f9697c8e36 | ||
|
|
0479060858 | ||
|
|
c2e5403408 | ||
|
|
3d2b12e72a | ||
|
|
09b1eee5d0 | ||
|
|
28264423a4 | ||
|
|
87baa4d3d2 | ||
|
|
c5031c2b39 | ||
|
|
82223d3bad | ||
|
|
56dd25667d | ||
|
|
d4a171a791 | ||
|
|
978066a6de | ||
|
|
2628da4a59 | ||
|
|
ccb157c7a3 | ||
|
|
d43c803bfe | ||
|
|
eec6db0a23 | ||
|
|
983bc5cecc | ||
|
|
60435f99b9 | ||
|
|
332cda6b16 | ||
|
|
8d73f2af34 | ||
|
|
6a8219a02e | ||
|
|
c8f7d33a9a | ||
|
|
40ec2303ff | ||
|
|
19eddddcff | ||
|
|
b1e86d6fea | ||
|
|
b9283d48b5 | ||
|
|
33fc5c99ea | ||
|
|
a4581cb233 | ||
|
|
36dfc9f1bf | ||
|
|
4a55fff3b9 | ||
|
|
02f16e90b6 | ||
|
|
984a498063 | ||
|
|
c1b51c6530 | ||
|
|
224de547b3 | ||
|
|
43d2e15bb7 | ||
|
|
ac70772070 | ||
|
|
1feea366ca | ||
|
|
f599239fd4 | ||
|
|
a122d2eb50 | ||
|
|
17e7860700 | ||
|
|
34fab879cb | ||
|
|
b02ed0bbe6 | ||
|
|
165ba535f0 | ||
|
|
8253df7c3d | ||
|
|
4788da204b | ||
|
|
cf11d1e4e6 | ||
|
|
e557327860 | ||
|
|
e152cfac34 | ||
|
|
464f1f44aa | ||
|
|
bf27cb1f5e | ||
|
|
654010f639 | ||
|
|
918f84438f | ||
|
|
93e2415924 | ||
|
|
4837a2d0df | ||
|
|
be80e1a863 | ||
|
|
e53e00c4f9 | ||
|
|
90495f3ac5 | ||
|
|
6fc9e6f21e | ||
|
|
7117c4a5ee | ||
|
|
a3a7c48799 | ||
|
|
f545fb2491 | ||
|
|
e73be48d96 | ||
|
|
04b1b83039 | ||
|
|
e9d216bc84 | ||
|
|
87510ac77d | ||
|
|
44ce3e6731 | ||
|
|
26678682ca | ||
|
|
7d63900fb8 | ||
|
|
e47d56a84f | ||
|
|
9b52269a5b | ||
|
|
9992b8eb0e | ||
|
|
bab69f2672 | ||
|
|
2e33633698 | ||
|
|
eb7601d116 | ||
|
|
47df1ae40a |
19
.gitattributes
vendored
19
.gitattributes
vendored
@@ -1,4 +1,21 @@
|
|||||||
.gitattributes export-ignore
|
.gitattributes export-ignore
|
||||||
.gitignore export-ignore
|
.gitignore export-ignore
|
||||||
/build_tools export-ignore
|
.travis.yml export-ignore
|
||||||
|
/build_tools/make_svn_completions.fish export-ignore
|
||||||
|
/build_tools/description-pak export-ignore
|
||||||
|
/build_tools/make_hg_completions.fish export-ignore
|
||||||
|
/build_tools/make_vcs_completions.fish export-ignore
|
||||||
|
/build_tools/make_vcs_completions_generic.fish export-ignore
|
||||||
|
/build_tools/osx_package_resources export-ignore
|
||||||
|
/build_tools/osx_package_resources/terminal_logo.png export-ignore
|
||||||
|
/build_tools/osx_package_resources/welcome.rtf export-ignore
|
||||||
|
/build_tools/make_csv_completions.fish export-ignore
|
||||||
|
/build_tools/osx_distribution.xml export-ignore
|
||||||
|
/build_tools/make_tarball.sh export-ignore
|
||||||
|
/build_tools/make_deb.sh export-ignore
|
||||||
|
/build_tools/osx_package_scripts export-ignore
|
||||||
|
/build_tools/osx_package_scripts/add-shell export-ignore
|
||||||
|
/build_tools/osx_package_scripts/postinstall export-ignore
|
||||||
|
/build_tools/make_pkg.sh export-ignore
|
||||||
|
/build_tools/make_darcs_completions.fish export-ignore
|
||||||
|
|
||||||
|
|||||||
23
.gitignore
vendored
23
.gitignore
vendored
@@ -1,27 +1,29 @@
|
|||||||
*.o
|
*.o
|
||||||
*~
|
*~
|
||||||
|
*.exe
|
||||||
|
*.xccheckout
|
||||||
|
|
||||||
Doxyfile.help
|
.DS_Store
|
||||||
Makefile
|
Makefile
|
||||||
autom4te.cache/
|
autom4te.cache/
|
||||||
builtin_scripts.cpp
|
build/
|
||||||
builtin_scripts.h
|
|
||||||
command_list.txt
|
command_list.txt
|
||||||
|
command_list_toc.txt
|
||||||
|
confdefs.h
|
||||||
config.h
|
config.h
|
||||||
config.h.in
|
config.h.in
|
||||||
config.log
|
config.log
|
||||||
config.status
|
config.status
|
||||||
configure
|
configure
|
||||||
|
doc/
|
||||||
doc.h
|
doc.h
|
||||||
doc_src/commands.hdr
|
doc_src/commands.hdr
|
||||||
doc_src/index.hdr
|
doc_src/index.hdr
|
||||||
po/*.gmo
|
po/*.gmo
|
||||||
fish
|
fish
|
||||||
fish.spec
|
|
||||||
fish_indent
|
fish_indent
|
||||||
fish_pager
|
|
||||||
fish_tests
|
fish_tests
|
||||||
fishd
|
fish.pc
|
||||||
mimedb
|
mimedb
|
||||||
seq
|
seq
|
||||||
set_color
|
set_color
|
||||||
@@ -29,6 +31,13 @@ share/config.fish
|
|||||||
share/man/
|
share/man/
|
||||||
toc.txt
|
toc.txt
|
||||||
user_doc/
|
user_doc/
|
||||||
xsel-1.2.0/
|
xcuserdata
|
||||||
tests/*tmp.*
|
tests/*tmp.*
|
||||||
tests/foo.txt
|
tests/foo.txt
|
||||||
|
FISH-BUILD-VERSION-FILE
|
||||||
|
version
|
||||||
|
messages.pot
|
||||||
|
lexicon.txt
|
||||||
|
lexicon_filter
|
||||||
|
lexicon.log
|
||||||
|
|
||||||
|
|||||||
27
.travis.yml
Normal file
27
.travis.yml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
language: cpp
|
||||||
|
compiler:
|
||||||
|
- gcc
|
||||||
|
- clang
|
||||||
|
before_install:
|
||||||
|
- sudo apt-get update
|
||||||
|
install:
|
||||||
|
- sudo apt-get install --no-install-recommends bc doxygen expect gettext libncurses5-dev
|
||||||
|
script:
|
||||||
|
- autoreconf
|
||||||
|
- ./configure
|
||||||
|
- make -j2
|
||||||
|
- sudo make install
|
||||||
|
- make test SHOW_INTERACTIVE_LOG=1
|
||||||
|
notifications:
|
||||||
|
irc:
|
||||||
|
channels:
|
||||||
|
- "irc.oftc.net#fish"
|
||||||
|
template:
|
||||||
|
- "%{repository}#%{build_number} (%{commit} on %{branch} by %{author}): %{message} Details at %{build_url}"
|
||||||
|
use_notice: true
|
||||||
|
skip_join: true
|
||||||
|
webhooks:
|
||||||
|
urls:
|
||||||
|
- https://webhooks.gitter.im/e/61821cec3015bf0f8bb1
|
||||||
|
matrix:
|
||||||
|
fast_finish: true
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
24-01-2012 Jan Kanis
|
|
||||||
* Added a changelog file
|
|
||||||
* removed unescaping if the 'commandline' builtin is called without the -o (tokenise) flag
|
|
||||||
105
CONTRIBUTING.md
Normal file
105
CONTRIBUTING.md
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
# Style guide
|
||||||
|
|
||||||
|
This is style guide for fish contributors. You should use it for any new code
|
||||||
|
that you would add to this project and try to format existing code to use this
|
||||||
|
style.
|
||||||
|
|
||||||
|
## Formatting
|
||||||
|
|
||||||
|
1. fish uses the Allman/BSD style of indentation.
|
||||||
|
2. Indent with spaces, not tabs.
|
||||||
|
3. Use 4 spaces per indent (unless needed like `Makefile`).
|
||||||
|
4. Opening curly bracket is on the following line:
|
||||||
|
|
||||||
|
// ✔:
|
||||||
|
struct name
|
||||||
|
{
|
||||||
|
// code
|
||||||
|
};
|
||||||
|
|
||||||
|
void func()
|
||||||
|
{
|
||||||
|
// code
|
||||||
|
}
|
||||||
|
|
||||||
|
if (...)
|
||||||
|
{
|
||||||
|
// code
|
||||||
|
}
|
||||||
|
|
||||||
|
// ✗:
|
||||||
|
void func() {
|
||||||
|
// code
|
||||||
|
}
|
||||||
|
|
||||||
|
5. Put space after `if`, `while` and `for` before conditions.
|
||||||
|
|
||||||
|
// ✔:
|
||||||
|
if () {}
|
||||||
|
|
||||||
|
// ✗:
|
||||||
|
if() {}
|
||||||
|
|
||||||
|
6. Put spaces before and after operators excluding increment and decrement;
|
||||||
|
|
||||||
|
// ✔:
|
||||||
|
int a = 1 + 2 * 3;
|
||||||
|
a++;
|
||||||
|
|
||||||
|
// ✗:
|
||||||
|
int a=1+2*3;
|
||||||
|
a ++;
|
||||||
|
|
||||||
|
7. Never put spaces between function name and parameters list.
|
||||||
|
|
||||||
|
// ✔:
|
||||||
|
func(args);
|
||||||
|
|
||||||
|
// ✗:
|
||||||
|
func (args);
|
||||||
|
|
||||||
|
8. Never put spaces after `(` and before `)`.
|
||||||
|
9. Always put space after comma and semicolon.
|
||||||
|
|
||||||
|
// ✔:
|
||||||
|
func(arg1, arg2);
|
||||||
|
|
||||||
|
for (int i = 0; i < LENGTH; i++) {}
|
||||||
|
|
||||||
|
// ✗:
|
||||||
|
func(arg1,arg2);
|
||||||
|
|
||||||
|
for (int i = 0;i<LENGTH;i++) {}
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
Document your code using [Doxygen][dox].
|
||||||
|
|
||||||
|
1. Documentation comment should use double star notation or tripple slash:
|
||||||
|
|
||||||
|
// ✔:
|
||||||
|
/// Some var
|
||||||
|
int var;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Some func
|
||||||
|
*/
|
||||||
|
void func();
|
||||||
|
|
||||||
|
2. Use slash as tag mark:
|
||||||
|
|
||||||
|
// ✔:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \param a an integer argument.
|
||||||
|
* \param s a constant character pointer.
|
||||||
|
* \return The results
|
||||||
|
*/
|
||||||
|
int foo(int a, const char *s);
|
||||||
|
|
||||||
|
## Naming
|
||||||
|
|
||||||
|
All names in code should be `small_snake_case`. No Hungarian notation is used.
|
||||||
|
Classes and structs names should be followed by `_t`.
|
||||||
|
|
||||||
|
[dox]: http://www.stack.nl/~dimitri/doxygen/ "Doxygen homepage"
|
||||||
19
COPYING
Normal file
19
COPYING
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
Fish is a smart and user-friendly command line shell.
|
||||||
|
|
||||||
|
Copyright (C) 2005-2009 Axel Liljencrantz
|
||||||
|
|
||||||
|
fish is free software.
|
||||||
|
|
||||||
|
Most of fish is licensed under the GNU General Public License version 2, and
|
||||||
|
you can redistribute it and/or modify it under the terms of the GNU GPL as
|
||||||
|
published by the Free Software Foundation.
|
||||||
|
|
||||||
|
fish also includes software licensed under the GNU Lesser General Public
|
||||||
|
License version 2, the OpenBSD license and the ISC license.
|
||||||
|
|
||||||
|
Full licensing information is contained in doc_src/license.hdr.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
more details.
|
||||||
19
Dockerfile
Normal file
19
Dockerfile
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
FROM centos:latest
|
||||||
|
|
||||||
|
# Build dependency
|
||||||
|
RUN yum update -y &&\
|
||||||
|
yum install -y autoconf automake bc clang gcc-c++ make ncurses-devel &&\
|
||||||
|
yum clean all
|
||||||
|
|
||||||
|
# Test dependency
|
||||||
|
RUN yum install -y expect vim-common
|
||||||
|
|
||||||
|
ADD . /src
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
# Build fish
|
||||||
|
RUN autoreconf &&\
|
||||||
|
./configure &&\
|
||||||
|
make &&\
|
||||||
|
make install
|
||||||
|
|
||||||
2355
Doxyfile.help
Normal file
2355
Doxyfile.help
Normal file
File diff suppressed because it is too large
Load Diff
1161
Doxyfile.help.in
1161
Doxyfile.help.in
File diff suppressed because it is too large
Load Diff
2356
Doxyfile.user
2356
Doxyfile.user
File diff suppressed because it is too large
Load Diff
78
INSTALL
78
INSTALL
@@ -1,78 +0,0 @@
|
|||||||
|
|
||||||
Known issues
|
|
||||||
============
|
|
||||||
|
|
||||||
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
|
|
||||||
to have this problem.
|
|
||||||
|
|
||||||
|
|
||||||
Prerequisites
|
|
||||||
=============
|
|
||||||
|
|
||||||
Fish requires the following programs and libraries to build:
|
|
||||||
|
|
||||||
- Doxygen
|
|
||||||
- Curses or Ncurses
|
|
||||||
- GNU make
|
|
||||||
- GCC
|
|
||||||
|
|
||||||
fish also relies on standard unix tools such as cat, cut, grep, sed,
|
|
||||||
whoami, bc and echo. Fish does not yet support cross-compilation,
|
|
||||||
separate build directories or any other fancy configure options.
|
|
||||||
|
|
||||||
|
|
||||||
Simple install procedure
|
|
||||||
========================
|
|
||||||
|
|
||||||
Always begin by uninstalling any previous fish versions. This is done
|
|
||||||
by running the command 'make uninstall' in the source directory of
|
|
||||||
your previous fish installation.
|
|
||||||
|
|
||||||
Next, if you have downloaded a fresh copy of the darcs repository of
|
|
||||||
fish, you need to run the 'autoconf' command.
|
|
||||||
|
|
||||||
Then, use following commands to compile fish:
|
|
||||||
|
|
||||||
./configure
|
|
||||||
make # Compile fish
|
|
||||||
make install # Install fish
|
|
||||||
echo /usr/local/bin/fish >>/etc/shells # Add fish to list of shells
|
|
||||||
|
|
||||||
Finally, if you wish to use fish as your default shell, use the
|
|
||||||
following command:
|
|
||||||
|
|
||||||
% chsh -s /usr/local/bin/fish
|
|
||||||
|
|
||||||
chsh will prompt you for your password, and change your default shell.
|
|
||||||
|
|
||||||
To switch your default shell back, you can run:
|
|
||||||
|
|
||||||
% chsh -s /bin/bash
|
|
||||||
|
|
||||||
Substitute /bin/bash with /bin/tcsh or /bin/zsh as appropriate.
|
|
||||||
|
|
||||||
Local install procedure
|
|
||||||
=======================
|
|
||||||
|
|
||||||
If you have downloaded the darcs repository of fish, you need to run
|
|
||||||
autoconf to generate the configure script.
|
|
||||||
|
|
||||||
To install fish in your own home directory (typically as non-root),
|
|
||||||
type:
|
|
||||||
|
|
||||||
% ./configure --prefix=$HOME
|
|
||||||
% make # Compile fish
|
|
||||||
% make install # Install fish
|
|
||||||
|
|
||||||
You will not be able to use fish as the default shell unless you also
|
|
||||||
add the corresponding line to /etc/shells, which mostly defeats the
|
|
||||||
point of a local install. As a workaround, you can add fish as the
|
|
||||||
last command of the init files for your regular shell.
|
|
||||||
798
Makefile.in
798
Makefile.in
File diff suppressed because it is too large
Load Diff
72
README.md
72
README.md
@@ -1,39 +1,89 @@
|
|||||||
[fish](http://ridiculousfish.com/shell/) - the friendly interactive shell
|
[fish](http://fishshell.com/) - the friendly interactive shell [](https://travis-ci.org/fish-shell/fish-shell)
|
||||||
================================================
|
================================================
|
||||||
|
|
||||||
fish is a smart and user-friendly command line shell for OS X, Linux, and the rest of the family. fish includes features like syntax highlighting, autosuggest-as-you-type, and fancy tab completions that just work, with no configuration required.
|
fish is a smart and user-friendly command line shell for OS X, Linux, and the rest of the family. fish includes features like syntax highlighting, autosuggest-as-you-type, and fancy tab completions that just work, with no configuration required.
|
||||||
|
|
||||||
For more on fish's design philosophy, see the [design document](http://ridiculousfish.com/shell/user_doc/html/design.html).
|
For more on fish's design philosophy, see the [design document](http://fishshell.com/docs/current/design.html).
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
fish generally works like other shells, like bash or zsh. A few important differences are documented at <http://ridiculousfish.com/shell/faq.html>
|
fish generally works like other shells, like bash or zsh. A few important differences can be found at <http://fishshell.com/docs/current/tutorial.html> by searching for the magic phrase 'unlike other shells'.
|
||||||
|
|
||||||
Detailed user documentation is available by running `help` within fish, and also at <http://ridiculousfish.com/shell/user_doc/html/>
|
Detailed user documentation is available by running `help` within fish, and also at <http://fishshell.com/docs/current/index.html>
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
fish can be built using autotools or Xcode.
|
fish is written in a sane subset of C++98, with a few components from C++TR1. It builds successfully with g++ 4.2 or later, and with clang. It also will build as C++11.
|
||||||
|
|
||||||
|
fish can be built using autotools or Xcode. autoconf 2.60 or later is required.
|
||||||
|
|
||||||
|
fish depends on a curses implementation, such as ncurses. The headers and libraries are required for building.
|
||||||
|
|
||||||
|
fish requires gettext for translation support.
|
||||||
|
|
||||||
|
Building the documentation requires Doxygen 1.8.7 or newer.
|
||||||
|
|
||||||
### Autotools Build
|
### Autotools Build
|
||||||
|
|
||||||
autoconf
|
autoconf
|
||||||
./configure [--without-xsel]
|
./configure
|
||||||
make [gmake on BSD]
|
make [gmake on BSD]
|
||||||
sudo make install
|
sudo make install
|
||||||
|
|
||||||
### Xcode Development Build
|
### Xcode Development Build
|
||||||
|
|
||||||
* Build the `base` target in Xcode
|
* Build the `base` target in Xcode
|
||||||
* Run the fish executable, for example, in `DerivedData/FishsFish/Build/Products/Debug/base/bin/fish`
|
* Run the fish executable, for example, in `DerivedData/fish/Build/Products/Debug/base/bin/fish`
|
||||||
|
|
||||||
### Xcode Build and Install
|
### Xcode Build and Install
|
||||||
|
|
||||||
mkdir /tmp/fish_build
|
xcodebuild install
|
||||||
xcodebuild install -target install_tree DSTROOT=/tmp/fish_build
|
sudo ditto /tmp/fish.dst /
|
||||||
sudo ditto /tmp/fish_build/ /
|
|
||||||
|
## Help, it didn't build!
|
||||||
|
|
||||||
|
If fish reports that it could not find curses, try installing a curses development package and build again.
|
||||||
|
|
||||||
|
On Debian or Ubuntu you want:
|
||||||
|
|
||||||
|
sudo apt-get install build-essential ncurses-dev libncurses5-dev gettext
|
||||||
|
|
||||||
|
On RedHat, CentOS, or Amazon EC2:
|
||||||
|
|
||||||
|
sudo yum install ncurses-devel
|
||||||
|
|
||||||
|
## Runtime Dependencies
|
||||||
|
|
||||||
|
fish requires a curses implementation, such as ncurses, to run.
|
||||||
|
|
||||||
|
fish requires a number of utilities to operate, which should be present on any Unix, GNU/Linux or OS X system. These include (but are not limited to) hostname, grep, awk, sed, which, and getopt. fish also requires the bc program.
|
||||||
|
|
||||||
|
Translation support requires the gettext program.
|
||||||
|
|
||||||
|
Some optional features of fish, such as the manual page completion parser and the web configuration tool, require Python.
|
||||||
|
|
||||||
|
In order to generate completions from man pages compressed with either lzma or xz, you may need to install an extra Python package. Python versions prior to 2.6 are not supported. For Python versions 2.6 to 3.2 you need to install the module `backports.lzma`. How to install it depends on your system and how you installed Python. Most Linux distributions should include it as a package named `backports-lzma` (or similar). From version 3.3 onwards, Python already includes the required module.
|
||||||
|
|
||||||
|
## Packages for Linux
|
||||||
|
|
||||||
|
Instructions on how to find builds for several Linux distros are at <https://github.com/fish-shell/fish-shell/wiki/Nightly-builds>
|
||||||
|
|
||||||
|
## Switching to fish
|
||||||
|
|
||||||
|
If you wish to use fish as your default shell, use the following command:
|
||||||
|
|
||||||
|
chsh -s /usr/local/bin/fish
|
||||||
|
|
||||||
|
chsh will prompt you for your password, and change your default shell.
|
||||||
|
|
||||||
|
To switch your default shell back, you can run:
|
||||||
|
|
||||||
|
chsh -s /bin/bash
|
||||||
|
|
||||||
|
Substitute /bin/bash with /bin/tcsh or /bin/zsh as appropriate.
|
||||||
|
|
||||||
## Contact Us
|
## Contact Us
|
||||||
|
|
||||||
Questions, comments, rants and raves can be posted to the official fish mailing list at <https://lists.sourceforge.net/lists/listinfo/fish-users>
|
Questions, comments, rants and raves can be posted to the official fish mailing list at <https://lists.sourceforge.net/lists/listinfo/fish-users> or join us on our IRC channel [#fish at irc.oftc.net](https://webchat.oftc.net/?channels=fish).
|
||||||
|
|
||||||
Found a bug? Have an awesome idea? Please open an issue on this github page.
|
Found a bug? Have an awesome idea? Please open an issue on this github page.
|
||||||
|
|||||||
243
autoload.cpp
243
autoload.cpp
@@ -1,5 +1,5 @@
|
|||||||
/** \file autoload.cpp
|
/** \file autoload.cpp
|
||||||
|
|
||||||
The classes responsible for autoloading functions and completions.
|
The classes responsible for autoloading functions and completions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -9,7 +9,6 @@ The classes responsible for autoloading functions and completions.
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "signal.h"
|
#include "signal.h"
|
||||||
#include "env.h"
|
#include "env.h"
|
||||||
#include "builtin_scripts.h"
|
|
||||||
#include "exec.h"
|
#include "exec.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@@ -17,21 +16,28 @@ The classes responsible for autoloading functions and completions.
|
|||||||
/* The time before we'll recheck an autoloaded file */
|
/* The time before we'll recheck an autoloaded file */
|
||||||
static const int kAutoloadStalenessInterval = 15;
|
static const int kAutoloadStalenessInterval = 15;
|
||||||
|
|
||||||
file_access_attempt_t access_file(const wcstring &path, int mode) {
|
file_access_attempt_t access_file(const wcstring &path, int mode)
|
||||||
|
{
|
||||||
//printf("Touch %ls\n", path.c_str());
|
//printf("Touch %ls\n", path.c_str());
|
||||||
file_access_attempt_t result = {0};
|
file_access_attempt_t result = {};
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
if (wstat(path, &statbuf)) {
|
if (wstat(path, &statbuf))
|
||||||
|
{
|
||||||
result.error = errno;
|
result.error = errno;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
result.mod_time = statbuf.st_mtime;
|
result.mod_time = statbuf.st_mtime;
|
||||||
if (waccess(path, mode)) {
|
if (waccess(path, mode))
|
||||||
|
{
|
||||||
result.error = errno;
|
result.error = errno;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
result.accessible = true;
|
result.accessible = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note that we record the last checked time after the call, on the assumption that in a slow filesystem, the lag comes before the kernel check, not after.
|
// Note that we record the last checked time after the call, on the assumption that in a slow filesystem, the lag comes before the kernel check, not after.
|
||||||
result.stale = false;
|
result.stale = false;
|
||||||
result.last_checked = time(NULL);
|
result.last_checked = time(NULL);
|
||||||
@@ -39,93 +45,94 @@ file_access_attempt_t access_file(const wcstring &path, int mode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
autoload_t::autoload_t(const wcstring &env_var_name_var, const builtin_script_t * const scripts, size_t script_count) :
|
autoload_t::autoload_t(const wcstring &env_var_name_var, const builtin_script_t * const scripts, size_t script_count) :
|
||||||
lock(),
|
lock(),
|
||||||
env_var_name(env_var_name_var),
|
env_var_name(env_var_name_var),
|
||||||
builtin_scripts(scripts),
|
builtin_scripts(scripts),
|
||||||
builtin_script_count(script_count),
|
builtin_script_count(script_count)
|
||||||
last_path(),
|
|
||||||
is_loading_set()
|
|
||||||
{
|
{
|
||||||
pthread_mutex_init(&lock, NULL);
|
pthread_mutex_init(&lock, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
autoload_t::~autoload_t() {
|
autoload_t::~autoload_t()
|
||||||
|
{
|
||||||
pthread_mutex_destroy(&lock);
|
pthread_mutex_destroy(&lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void autoload_t::node_was_evicted(autoload_function_t *node) {
|
void autoload_t::node_was_evicted(autoload_function_t *node)
|
||||||
|
{
|
||||||
// This should only ever happen on the main thread
|
// This should only ever happen on the main thread
|
||||||
ASSERT_IS_MAIN_THREAD();
|
ASSERT_IS_MAIN_THREAD();
|
||||||
|
|
||||||
// Tell ourselves that the command was removed if it was loaded
|
// Tell ourselves that the command was removed if it was loaded
|
||||||
if (! node->is_loaded)
|
if (node->is_loaded)
|
||||||
this->command_removed(node->key);
|
this->command_removed(node->key);
|
||||||
delete node;
|
delete node;
|
||||||
}
|
}
|
||||||
|
|
||||||
int autoload_t::unload( const wcstring &cmd )
|
int autoload_t::unload(const wcstring &cmd)
|
||||||
{
|
{
|
||||||
return this->evict_node(cmd);
|
return this->evict_node(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
int autoload_t::load( const wcstring &cmd, bool reload )
|
int autoload_t::load(const wcstring &cmd, bool reload)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
CHECK_BLOCK( 0 );
|
CHECK_BLOCK(0);
|
||||||
ASSERT_IS_MAIN_THREAD();
|
ASSERT_IS_MAIN_THREAD();
|
||||||
|
|
||||||
env_var_t path_var = env_get_string( env_var_name );
|
env_var_t path_var = env_get_string(env_var_name);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Do we know where to look?
|
Do we know where to look?
|
||||||
*/
|
*/
|
||||||
if( path_var.empty() )
|
if (path_var.empty())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Check if the lookup path has changed. If so, drop all loaded files. path_var may only be inspected on the main thread. */
|
/* Check if the lookup path has changed. If so, drop all loaded files. path_var may only be inspected on the main thread. */
|
||||||
if( path_var != this->last_path )
|
if (path_var != this->last_path)
|
||||||
{
|
{
|
||||||
this->last_path = path_var;
|
this->last_path = path_var;
|
||||||
|
this->last_path_tokenized.clear();
|
||||||
|
tokenize_variable_array(this->last_path, this->last_path_tokenized);
|
||||||
|
|
||||||
scoped_lock locker(lock);
|
scoped_lock locker(lock);
|
||||||
this->evict_all_nodes();
|
this->evict_all_nodes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Mark that we're loading this. Hang onto the iterator for fast erasing later. Note that std::set has guarantees about not invalidating iterators, so this is safe to do across the callouts below. */
|
||||||
|
typedef std::set<wcstring>::iterator set_iterator_t;
|
||||||
|
std::pair<set_iterator_t, bool> insert_result = is_loading_set.insert(cmd);
|
||||||
|
set_iterator_t where = insert_result.first;
|
||||||
|
bool inserted = insert_result.second;
|
||||||
|
|
||||||
/** Warn and fail on infinite recursion. It's OK to do this because this function is only called on the main thread. */
|
/** Warn and fail on infinite recursion. It's OK to do this because this function is only called on the main thread. */
|
||||||
if (this->is_loading(cmd))
|
if (! inserted)
|
||||||
{
|
{
|
||||||
debug( 0,
|
/* We failed to insert */
|
||||||
_( L"Could not autoload item '%ls', it is already being autoloaded. "
|
debug(0,
|
||||||
L"This is a circular dependency in the autoloading scripts, please remove it."),
|
_(L"Could not autoload item '%ls', it is already being autoloaded. "
|
||||||
cmd.c_str() );
|
L"This is a circular dependency in the autoloading scripts, please remove it."),
|
||||||
|
cmd.c_str());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
/* Try loading it */
|
||||||
/* Mark that we're loading this */
|
res = this->locate_file_and_maybe_load_it(cmd, true, reload, this->last_path_tokenized);
|
||||||
is_loading_set.insert(cmd);
|
|
||||||
|
|
||||||
/* Get the list of paths from which we will try to load */
|
|
||||||
std::vector<wcstring> path_list;
|
|
||||||
tokenize_variable_array( path_var, path_list );
|
|
||||||
|
|
||||||
/* Try loading it */
|
|
||||||
res = this->locate_file_and_maybe_load_it( cmd, true, reload, path_list );
|
|
||||||
|
|
||||||
/* Clean up */
|
/* Clean up */
|
||||||
bool erased = !! is_loading_set.erase(cmd);
|
is_loading_set.erase(where);
|
||||||
assert(erased);
|
|
||||||
|
return res;
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool autoload_t::can_load( const wcstring &cmd, const env_vars_snapshot_t &vars )
|
bool autoload_t::can_load(const wcstring &cmd, const env_vars_snapshot_t &vars)
|
||||||
{
|
{
|
||||||
const env_var_t path_var = vars.get(env_var_name);
|
const env_var_t path_var = vars.get(env_var_name);
|
||||||
if (path_var.missing_or_empty())
|
if (path_var.missing_or_empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::vector<wcstring> path_list;
|
std::vector<wcstring> path_list;
|
||||||
tokenize_variable_array( path_var, path_list );
|
tokenize_variable_array(path_var, path_list);
|
||||||
return this->locate_file_and_maybe_load_it( cmd, false, false, path_list );
|
return this->locate_file_and_maybe_load_it(cmd, false, false, path_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool script_name_precedes_script_name(const builtin_script_t &script1, const builtin_script_t &script2)
|
static bool script_name_precedes_script_name(const builtin_script_t &script1, const builtin_script_t &script2)
|
||||||
@@ -133,20 +140,22 @@ static bool script_name_precedes_script_name(const builtin_script_t &script1, co
|
|||||||
return wcscmp(script1.name, script2.name) < 0;
|
return wcscmp(script1.name, script2.name) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void autoload_t::unload_all(void) {
|
void autoload_t::unload_all(void)
|
||||||
|
{
|
||||||
scoped_lock locker(lock);
|
scoped_lock locker(lock);
|
||||||
this->evict_all_nodes();
|
this->evict_all_nodes();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check whether the given command is loaded. */
|
/** Check whether the given command is loaded. */
|
||||||
bool autoload_t::has_tried_loading( const wcstring &cmd )
|
bool autoload_t::has_tried_loading(const wcstring &cmd)
|
||||||
{
|
{
|
||||||
scoped_lock locker(lock);
|
scoped_lock locker(lock);
|
||||||
autoload_function_t * func = this->get_node(cmd);
|
autoload_function_t * func = this->get_node(cmd);
|
||||||
return func != NULL;
|
return func != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool is_stale(const autoload_function_t *func) {
|
static bool is_stale(const autoload_function_t *func)
|
||||||
|
{
|
||||||
/** Return whether this function is stale. Internalized functions can never be stale. */
|
/** Return whether this function is stale. Internalized functions can never be stale. */
|
||||||
return ! func->is_internalized && time(NULL) - func->access.last_checked > kAutoloadStalenessInterval;
|
return ! func->is_internalized && time(NULL) - func->access.last_checked > kAutoloadStalenessInterval;
|
||||||
}
|
}
|
||||||
@@ -155,11 +164,15 @@ autoload_function_t *autoload_t::get_autoloaded_function_with_creation(const wcs
|
|||||||
{
|
{
|
||||||
ASSERT_IS_LOCKED(lock);
|
ASSERT_IS_LOCKED(lock);
|
||||||
autoload_function_t *func = this->get_node(cmd);
|
autoload_function_t *func = this->get_node(cmd);
|
||||||
if (! func) {
|
if (! func)
|
||||||
|
{
|
||||||
func = new autoload_function_t(cmd);
|
func = new autoload_function_t(cmd);
|
||||||
if (allow_eviction) {
|
if (allow_eviction)
|
||||||
|
{
|
||||||
this->add_node(func);
|
this->add_node(func);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->add_node_without_eviction(func);
|
this->add_node_without_eviction(func);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -170,58 +183,66 @@ autoload_function_t *autoload_t::get_autoloaded_function_with_creation(const wcs
|
|||||||
This internal helper function does all the real work. By using two
|
This internal helper function does all the real work. By using two
|
||||||
functions, the internal function can return on various places in
|
functions, the internal function can return on various places in
|
||||||
the code, and the caller can take care of various cleanup work.
|
the code, and the caller can take care of various cleanup work.
|
||||||
|
|
||||||
cmd: the command name ('grep')
|
cmd: the command name ('grep')
|
||||||
really_load: whether to actually parse it as a function, or just check it it exists
|
really_load: whether to actually parse it as a function, or just check it it exists
|
||||||
reload: whether to reload it if it's already loaded
|
reload: whether to reload it if it's already loaded
|
||||||
path_list: the set of paths to check
|
path_list: the set of paths to check
|
||||||
|
|
||||||
Result: if really_load is true, returns whether the function was loaded. Otherwise returns whether the function existed.
|
Result: if really_load is true, returns whether the function was loaded. Otherwise returns whether the function existed.
|
||||||
*/
|
*/
|
||||||
bool autoload_t::locate_file_and_maybe_load_it( const wcstring &cmd, bool really_load, bool reload, const wcstring_list_t &path_list )
|
bool autoload_t::locate_file_and_maybe_load_it(const wcstring &cmd, bool really_load, bool reload, const wcstring_list_t &path_list)
|
||||||
{
|
{
|
||||||
/* Note that we are NOT locked in this function! */
|
/* Note that we are NOT locked in this function! */
|
||||||
size_t i;
|
bool reloaded = 0;
|
||||||
bool reloaded = 0;
|
|
||||||
|
|
||||||
/* Try using a cached function. If we really want the function to be loaded, require that it be really loaded. If we're not reloading, allow stale functions. */
|
/* Try using a cached function. If we really want the function to be loaded, require that it be really loaded. If we're not reloading, allow stale functions. */
|
||||||
{
|
{
|
||||||
bool allow_stale_functions = ! reload;
|
bool allow_stale_functions = ! reload;
|
||||||
|
|
||||||
/* Take a lock */
|
/* Take a lock */
|
||||||
scoped_lock locker(lock);
|
scoped_lock locker(lock);
|
||||||
|
|
||||||
/* Get the function */
|
/* Get the function */
|
||||||
autoload_function_t * func = this->get_node(cmd);
|
autoload_function_t * func = this->get_node(cmd);
|
||||||
|
|
||||||
/* Determine if we can use this cached function */
|
/* Determine if we can use this cached function */
|
||||||
bool use_cached;
|
bool use_cached;
|
||||||
if (! func) {
|
if (! func)
|
||||||
|
{
|
||||||
/* Can't use a function that doesn't exist */
|
/* Can't use a function that doesn't exist */
|
||||||
use_cached = false;
|
use_cached = false;
|
||||||
} else if (really_load && ! func->is_placeholder && ! func->is_loaded) {
|
}
|
||||||
|
else if (really_load && ! func->is_placeholder && ! func->is_loaded)
|
||||||
|
{
|
||||||
/* Can't use an unloaded function */
|
/* Can't use an unloaded function */
|
||||||
use_cached = false;
|
use_cached = false;
|
||||||
} else if ( ! allow_stale_functions && is_stale(func)) {
|
}
|
||||||
|
else if (! allow_stale_functions && is_stale(func))
|
||||||
|
{
|
||||||
/* Can't use a stale function */
|
/* Can't use a stale function */
|
||||||
use_cached = false;
|
use_cached = false;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
/* I guess we can use it */
|
/* I guess we can use it */
|
||||||
use_cached = true;
|
use_cached = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we can use this function, return whether we were able to access it */
|
/* If we can use this function, return whether we were able to access it */
|
||||||
if (use_cached) {
|
if (use_cached)
|
||||||
|
{
|
||||||
|
assert(func != NULL);
|
||||||
return func->is_internalized || func->access.accessible;
|
return func->is_internalized || func->access.accessible;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* The source of the script will end up here */
|
/* The source of the script will end up here */
|
||||||
wcstring script_source;
|
wcstring script_source;
|
||||||
bool has_script_source = false;
|
bool has_script_source = false;
|
||||||
|
|
||||||
/* Whether we found an accessible file */
|
/* Whether we found an accessible file */
|
||||||
bool found_file = false;
|
bool found_file = false;
|
||||||
|
|
||||||
/* Look for built-in scripts via a binary search */
|
/* Look for built-in scripts via a binary search */
|
||||||
const builtin_script_t *matching_builtin_script = NULL;
|
const builtin_script_t *matching_builtin_script = NULL;
|
||||||
if (builtin_script_count > 0)
|
if (builtin_script_count > 0)
|
||||||
@@ -235,65 +256,70 @@ bool autoload_t::locate_file_and_maybe_load_it( const wcstring &cmd, bool really
|
|||||||
matching_builtin_script = found;
|
matching_builtin_script = found;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (matching_builtin_script) {
|
if (matching_builtin_script)
|
||||||
|
{
|
||||||
has_script_source = true;
|
has_script_source = true;
|
||||||
script_source = str2wcstring(matching_builtin_script->def);
|
script_source = str2wcstring(matching_builtin_script->def);
|
||||||
|
|
||||||
/* Make a node representing this function */
|
/* Make a node representing this function */
|
||||||
scoped_lock locker(lock);
|
scoped_lock locker(lock);
|
||||||
autoload_function_t *func = this->get_autoloaded_function_with_creation(cmd, really_load);
|
autoload_function_t *func = this->get_autoloaded_function_with_creation(cmd, really_load);
|
||||||
|
|
||||||
/* This function is internalized */
|
/* This function is internalized */
|
||||||
func->is_internalized = true;
|
func->is_internalized = true;
|
||||||
|
|
||||||
/* It's a fiction to say the script is loaded at this point, but we're definitely going to load it down below. */
|
/* It's a fiction to say the script is loaded at this point, but we're definitely going to load it down below. */
|
||||||
if (really_load) func->is_loaded = true;
|
if (really_load) func->is_loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! has_script_source)
|
if (! has_script_source)
|
||||||
{
|
{
|
||||||
/* Iterate over path searching for suitable completion files */
|
/* Iterate over path searching for suitable completion files */
|
||||||
for( i=0; i<path_list.size(); i++ )
|
for (size_t i=0; i<path_list.size(); i++)
|
||||||
{
|
{
|
||||||
wcstring next = path_list.at(i);
|
wcstring next = path_list.at(i);
|
||||||
wcstring path = next + L"/" + cmd + L".fish";
|
wcstring path = next + L"/" + cmd + L".fish";
|
||||||
|
|
||||||
const file_access_attempt_t access = access_file(path, R_OK);
|
const file_access_attempt_t access = access_file(path, R_OK);
|
||||||
if (access.accessible) {
|
if (access.accessible)
|
||||||
|
{
|
||||||
/* Found it! */
|
/* Found it! */
|
||||||
found_file = true;
|
found_file = true;
|
||||||
|
|
||||||
/* Now we're actually going to take the lock. */
|
/* Now we're actually going to take the lock. */
|
||||||
scoped_lock locker(lock);
|
scoped_lock locker(lock);
|
||||||
autoload_function_t *func = this->get_node(cmd);
|
autoload_function_t *func = this->get_node(cmd);
|
||||||
|
|
||||||
/* Generate the source if we need to load it */
|
/* Generate the source if we need to load it */
|
||||||
bool need_to_load_function = really_load && (func == NULL || func->access.mod_time != access.mod_time || ! func->is_loaded);
|
bool need_to_load_function = really_load && (func == NULL || func->access.mod_time != access.mod_time || ! func->is_loaded);
|
||||||
if (need_to_load_function) {
|
if (need_to_load_function)
|
||||||
|
{
|
||||||
|
|
||||||
/* Generate the script source */
|
/* Generate the script source */
|
||||||
wcstring esc = escape_string(path, 1);
|
wcstring esc = escape_string(path, 1);
|
||||||
script_source = L". " + esc;
|
script_source = L"source " + esc;
|
||||||
has_script_source = true;
|
has_script_source = true;
|
||||||
|
|
||||||
/* Remove any loaded command because we are going to reload it. Note that this will deadlock if command_removed calls back into us. */
|
/* Remove any loaded command because we are going to reload it. Note that this will deadlock if command_removed calls back into us. */
|
||||||
if (func && func->is_loaded) {
|
if (func && func->is_loaded)
|
||||||
|
{
|
||||||
command_removed(cmd);
|
command_removed(cmd);
|
||||||
func->is_placeholder = false;
|
func->is_placeholder = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mark that we're reloading it */
|
/* Mark that we're reloading it */
|
||||||
reloaded = true;
|
reloaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create the function if we haven't yet. This does not load it. Do not trigger eviction unless we are actually loading, because we don't want to evict off of the main thread. */
|
/* Create the function if we haven't yet. This does not load it. Do not trigger eviction unless we are actually loading, because we don't want to evict off of the main thread. */
|
||||||
if (! func) {
|
if (! func)
|
||||||
|
{
|
||||||
func = get_autoloaded_function_with_creation(cmd, really_load);
|
func = get_autoloaded_function_with_creation(cmd, really_load);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* It's a fiction to say the script is loaded at this point, but we're definitely going to load it down below. */
|
/* It's a fiction to say the script is loaded at this point, but we're definitely going to load it down below. */
|
||||||
if (need_to_load_function) func->is_loaded = true;
|
if (need_to_load_function) func->is_loaded = true;
|
||||||
|
|
||||||
/* Unconditionally record our access time */
|
/* Unconditionally record our access time */
|
||||||
func->access = access;
|
func->access = access;
|
||||||
|
|
||||||
@@ -306,39 +332,44 @@ bool autoload_t::locate_file_and_maybe_load_it( const wcstring &cmd, bool really
|
|||||||
Later we only research if the current time is at least five seconds later.
|
Later we only research if the current time is at least five seconds later.
|
||||||
This way, the files won't be searched over and over again.
|
This way, the files won't be searched over and over again.
|
||||||
*/
|
*/
|
||||||
if( ! found_file && ! has_script_source )
|
if (! found_file && ! has_script_source)
|
||||||
{
|
{
|
||||||
scoped_lock locker(lock);
|
scoped_lock locker(lock);
|
||||||
/* Generate a placeholder */
|
/* Generate a placeholder */
|
||||||
autoload_function_t *func = this->get_node(cmd);
|
autoload_function_t *func = this->get_node(cmd);
|
||||||
if (! func) {
|
if (! func)
|
||||||
|
{
|
||||||
func = new autoload_function_t(cmd);
|
func = new autoload_function_t(cmd);
|
||||||
func->is_placeholder = true;
|
func->is_placeholder = true;
|
||||||
if (really_load) {
|
if (really_load)
|
||||||
|
{
|
||||||
this->add_node(func);
|
this->add_node(func);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->add_node_without_eviction(func);
|
this->add_node_without_eviction(func);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func->access.last_checked = time(NULL);
|
func->access.last_checked = time(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we have a script, either built-in or a file source, then run it */
|
/* If we have a script, either built-in or a file source, then run it */
|
||||||
if (really_load && has_script_source)
|
if (really_load && has_script_source)
|
||||||
{
|
{
|
||||||
if( exec_subshell( script_source) == -1 )
|
if (exec_subshell(script_source, false /* do not apply exit status */) == -1)
|
||||||
{
|
{
|
||||||
/*
|
/* Do nothing on failure */
|
||||||
Do nothing on failiure
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (really_load) {
|
if (really_load)
|
||||||
|
{
|
||||||
return reloaded;
|
return reloaded;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
return found_file || has_script_source;
|
return found_file || has_script_source;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
77
autoload.h
77
autoload.h
@@ -14,7 +14,8 @@
|
|||||||
#include "lru.h"
|
#include "lru.h"
|
||||||
|
|
||||||
/** A struct responsible for recording an attempt to access a file. */
|
/** A struct responsible for recording an attempt to access a file. */
|
||||||
struct file_access_attempt_t {
|
struct file_access_attempt_t
|
||||||
|
{
|
||||||
time_t mod_time; /** The modification time of the file */
|
time_t mod_time; /** The modification time of the file */
|
||||||
time_t last_checked; /** When we last checked the file */
|
time_t last_checked; /** When we last checked the file */
|
||||||
bool accessible; /** Whether we believe we could access this file */
|
bool accessible; /** Whether we believe we could access this file */
|
||||||
@@ -25,7 +26,7 @@ struct file_access_attempt_t {
|
|||||||
file_access_attempt_t access_file(const wcstring &path, int mode);
|
file_access_attempt_t access_file(const wcstring &path, int mode);
|
||||||
|
|
||||||
struct autoload_function_t : public lru_node_t
|
struct autoload_function_t : public lru_node_t
|
||||||
{
|
{
|
||||||
autoload_function_t(const wcstring &key) : lru_node_t(key), access(), is_loaded(false), is_placeholder(false), is_internalized(false) { }
|
autoload_function_t(const wcstring &key) : lru_node_t(key), access(), is_loaded(false), is_placeholder(false), is_internalized(false) { }
|
||||||
file_access_attempt_t access; /** The last access attempt */
|
file_access_attempt_t access; /** The last access attempt */
|
||||||
bool is_loaded; /** Whether we have actually loaded this function */
|
bool is_loaded; /** Whether we have actually loaded this function */
|
||||||
@@ -33,6 +34,11 @@ struct autoload_function_t : public lru_node_t
|
|||||||
bool is_internalized; /** Whether this function came from a builtin "internalized" script */
|
bool is_internalized; /** Whether this function came from a builtin "internalized" script */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct builtin_script_t
|
||||||
|
{
|
||||||
|
const wchar_t *name;
|
||||||
|
const char *def;
|
||||||
|
};
|
||||||
|
|
||||||
struct builtin_script_t;
|
struct builtin_script_t;
|
||||||
class env_vars_snapshot_t;
|
class env_vars_snapshot_t;
|
||||||
@@ -40,7 +46,8 @@ class env_vars_snapshot_t;
|
|||||||
/**
|
/**
|
||||||
A class that represents a path from which we can autoload, and the autoloaded contents.
|
A class that represents a path from which we can autoload, and the autoloaded contents.
|
||||||
*/
|
*/
|
||||||
class autoload_t : private lru_cache_t<autoload_function_t> {
|
class autoload_t : private lru_cache_t<autoload_function_t>
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/** Lock for thread safety */
|
/** Lock for thread safety */
|
||||||
@@ -48,63 +55,63 @@ class autoload_t : private lru_cache_t<autoload_function_t> {
|
|||||||
|
|
||||||
/** The environment variable name */
|
/** The environment variable name */
|
||||||
const wcstring env_var_name;
|
const wcstring env_var_name;
|
||||||
|
|
||||||
/** Builtin script array */
|
/** Builtin script array */
|
||||||
const struct builtin_script_t *const builtin_scripts;
|
const struct builtin_script_t *const builtin_scripts;
|
||||||
|
|
||||||
/** Builtin script count */
|
/** Builtin script count */
|
||||||
const size_t builtin_script_count;
|
const size_t builtin_script_count;
|
||||||
|
|
||||||
/** The path from which we most recently autoloaded */
|
/** The path from which we most recently autoloaded */
|
||||||
wcstring last_path;
|
wcstring last_path;
|
||||||
|
|
||||||
/**
|
/** That path, tokenized (split on separators) */
|
||||||
A table containing all the files that are currently being
|
wcstring_list_t last_path_tokenized;
|
||||||
loaded. This is here to help prevent recursion.
|
|
||||||
*/
|
/**
|
||||||
|
A table containing all the files that are currently being
|
||||||
|
loaded. This is here to help prevent recursion.
|
||||||
|
*/
|
||||||
std::set<wcstring> is_loading_set;
|
std::set<wcstring> is_loading_set;
|
||||||
|
|
||||||
bool is_loading(const wcstring &name) const {
|
void remove_all_functions(void)
|
||||||
return is_loading_set.find(name) != is_loading_set.end();
|
{
|
||||||
}
|
|
||||||
|
|
||||||
void remove_all_functions(void) {
|
|
||||||
this->evict_all_nodes();
|
this->evict_all_nodes();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool locate_file_and_maybe_load_it( const wcstring &cmd, bool really_load, bool reload, const wcstring_list_t &path_list );
|
bool locate_file_and_maybe_load_it(const wcstring &cmd, bool really_load, bool reload, const wcstring_list_t &path_list);
|
||||||
|
|
||||||
virtual void node_was_evicted(autoload_function_t *node);
|
virtual void node_was_evicted(autoload_function_t *node);
|
||||||
|
|
||||||
autoload_function_t *get_autoloaded_function_with_creation(const wcstring &cmd, bool allow_eviction);
|
autoload_function_t *get_autoloaded_function_with_creation(const wcstring &cmd, bool allow_eviction);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** Overridable callback for when a command is removed */
|
/** Overridable callback for when a command is removed */
|
||||||
virtual void command_removed(const wcstring &cmd) { }
|
virtual void command_removed(const wcstring &cmd) { }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** Create an autoload_t for the given environment variable name */
|
/** Create an autoload_t for the given environment variable name */
|
||||||
autoload_t(const wcstring &env_var_name_var, const builtin_script_t *scripts, size_t script_count );
|
autoload_t(const wcstring &env_var_name_var, const builtin_script_t *scripts, size_t script_count);
|
||||||
|
|
||||||
/** Destructor */
|
/** Destructor */
|
||||||
virtual ~autoload_t();
|
virtual ~autoload_t();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Autoload the specified file, if it exists in the specified path. Do
|
Autoload the specified file, if it exists in the specified path. Do
|
||||||
not load it multiple times unless it's timestamp changes or
|
not load it multiple times unless its timestamp changes or
|
||||||
parse_util_unload is called.
|
parse_util_unload is called.
|
||||||
|
|
||||||
Autoloading one file may unload another.
|
Autoloading one file may unload another.
|
||||||
|
|
||||||
\param cmd the filename to search for. The suffix '.fish' is always added to this name
|
\param cmd the filename to search for. The suffix '.fish' is always added to this name
|
||||||
\param on_unload a callback function to run if a suitable file is found, which has not already been run. unload will also be called for old files which are unloaded.
|
\param on_unload a callback function to run if a suitable file is found, which has not already been run. unload will also be called for old files which are unloaded.
|
||||||
\param reload wheter to recheck file timestamps on already loaded files
|
\param reload wheter to recheck file timestamps on already loaded files
|
||||||
*/
|
*/
|
||||||
int load( const wcstring &cmd, bool reload );
|
int load(const wcstring &cmd, bool reload);
|
||||||
|
|
||||||
/** Check whether we have tried loading the given command. Does not do any I/O. */
|
/** Check whether we have tried loading the given command. Does not do any I/O. */
|
||||||
bool has_tried_loading( const wcstring &cmd );
|
bool has_tried_loading(const wcstring &cmd);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Tell the autoloader that the specified file, in the specified path,
|
Tell the autoloader that the specified file, in the specified path,
|
||||||
@@ -114,15 +121,15 @@ class autoload_t : private lru_cache_t<autoload_function_t> {
|
|||||||
\param on_unload a callback function which will be called before (re)loading a file, may be used to unload the previous file.
|
\param on_unload a callback function which will be called before (re)loading a file, may be used to unload the previous file.
|
||||||
\return non-zero if the file was removed, zero if the file had not yet been loaded
|
\return non-zero if the file was removed, zero if the file had not yet been loaded
|
||||||
*/
|
*/
|
||||||
int unload( const wcstring &cmd );
|
int unload(const wcstring &cmd);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Unloads all files.
|
Unloads all files.
|
||||||
*/
|
*/
|
||||||
void unload_all( );
|
void unload_all();
|
||||||
|
|
||||||
/** Check whether the given command could be loaded, but do not load it. */
|
/** Check whether the given command could be loaded, but do not load it. */
|
||||||
bool can_load( const wcstring &cmd, const env_vars_snapshot_t &vars );
|
bool can_load(const wcstring &cmd, const env_vars_snapshot_t &vars);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
144
build_tools/build_documentation.sh
Executable file
144
build_tools/build_documentation.sh
Executable file
@@ -0,0 +1,144 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# This script is run as part of the build process
|
||||||
|
|
||||||
|
if test $# -eq 0
|
||||||
|
then
|
||||||
|
# Use fish's defaults
|
||||||
|
DOXYFILE=Doxyfile.help
|
||||||
|
INPUTDIR=doc_src
|
||||||
|
OUTPUTDIR=share
|
||||||
|
echo "Using defaults: $0 ${DOXYFILE} ${INPUTDIR} ${OUTPUTDIR}"
|
||||||
|
elif test $# -eq 3
|
||||||
|
then
|
||||||
|
DOXYFILE="$1"
|
||||||
|
INPUTDIR="$2"
|
||||||
|
OUTPUTDIR="$3"
|
||||||
|
else
|
||||||
|
echo "Usage: $0 doxygen_file input_directory output_directory"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Determine which man pages we don't want to generate.
|
||||||
|
# on OS X, don't make a man page for open, since we defeat fish's open function on OS X.
|
||||||
|
CONDEMNED_PAGES=
|
||||||
|
if test `uname` = 'Darwin'; then
|
||||||
|
CONDEMNED_PAGES="$CONDEMNED_PAGES open.1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Helper function to turn a relative path into an absolute path
|
||||||
|
resolve_path()
|
||||||
|
{
|
||||||
|
D=`command dirname "$1"`
|
||||||
|
B=`command basename "$1"`
|
||||||
|
echo "`cd \"$D\" 2>/dev/null && pwd || echo \"$D\"`/$B"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Expand relative paths
|
||||||
|
DOXYFILE=`resolve_path "$DOXYFILE"`
|
||||||
|
INPUTDIR=`resolve_path "$INPUTDIR"`
|
||||||
|
INPUTFILTER=`resolve_path "$INPUT_FILTER"`
|
||||||
|
OUTPUTDIR=`resolve_path "$OUTPUTDIR"`
|
||||||
|
|
||||||
|
echo " doxygen file: $DOXYFILE"
|
||||||
|
echo " input directory: $INPUTDIR"
|
||||||
|
echo " input filter: $INPUTFILTER"
|
||||||
|
echo " output directory: $OUTPUTDIR"
|
||||||
|
echo " skipping: $CONDEMNED_PAGES"
|
||||||
|
|
||||||
|
# Make sure INPUTDIR is found
|
||||||
|
if test ! -d "$INPUTDIR"; then
|
||||||
|
echo >&2 "Could not find input directory '${INPUTDIR}'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make sure doxygen is found
|
||||||
|
DOXYGENPATH=`command -v doxygen`
|
||||||
|
if test -z "$DOXYGENPATH" ; then
|
||||||
|
for i in /usr/local/bin/doxygen /opt/bin/doxygen /Applications/Doxygen.app/Contents/Resources/doxygen ~/Applications/Doxygen.app/Contents/Resources/doxygen ; do
|
||||||
|
if test -f "$i"; then
|
||||||
|
DOXYGENPATH="$i"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -z "$DOXYGENPATH"; then
|
||||||
|
echo >&2 "doxygen is not installed, so documentation will not be built."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check we have the lexicon filter
|
||||||
|
if test -z "$INPUT_FILTER"; then
|
||||||
|
echo >&2 "Lexicon filter is not available. Continuing without."
|
||||||
|
INPUTFILTER=''
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Determine where our output should go
|
||||||
|
if ! mkdir -p "${OUTPUTDIR}" ; then
|
||||||
|
echo "Could not create output directory '${OUTPUTDIR}'"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make a temporary directory
|
||||||
|
TMPLOC=`mktemp -d -t fish_doc_build_XXXXXX` || { echo >&2 "Could not build documentation because mktemp failed"; exit 1; }
|
||||||
|
|
||||||
|
# Copy stuff to the temp directory
|
||||||
|
for i in "$INPUTDIR"/*.txt; do
|
||||||
|
INPUTFILE=$TMPLOC/`basename $i .txt`.doxygen
|
||||||
|
echo "/** \page" `basename $i .txt` > $INPUTFILE
|
||||||
|
cat $i >>$INPUTFILE
|
||||||
|
echo "*/" >>$INPUTFILE
|
||||||
|
done
|
||||||
|
|
||||||
|
# Make some extra stuff to pass to doxygen
|
||||||
|
# Input is kept as . because we cd to the input directory beforehand
|
||||||
|
# This prevents doxygen from generating "documentation" for intermediate directories
|
||||||
|
DOXYPARAMS=$(cat <<EOF
|
||||||
|
PROJECT_NUMBER=$PROJECT_NUMBER
|
||||||
|
INPUT_FILTER=$INPUTFILTER
|
||||||
|
INPUT=.
|
||||||
|
OUTPUT_DIRECTORY=$OUTPUTDIR
|
||||||
|
QUIET=YES
|
||||||
|
EOF
|
||||||
|
);
|
||||||
|
|
||||||
|
# echo "$DOXYPARAMS"
|
||||||
|
|
||||||
|
# Clear out the output directory first
|
||||||
|
find "${OUTPUTDIR}" -name "*.1" -delete
|
||||||
|
|
||||||
|
# Run doxygen
|
||||||
|
cd "$TMPLOC"
|
||||||
|
(cat "${DOXYFILE}" ; echo "$DOXYPARAMS";) | "$DOXYGENPATH" -
|
||||||
|
|
||||||
|
# Remember errors
|
||||||
|
RESULT=$?
|
||||||
|
|
||||||
|
cd "${OUTPUTDIR}/man/man1/"
|
||||||
|
if test "$RESULT" = 0 ; then
|
||||||
|
|
||||||
|
# Postprocess the files
|
||||||
|
for i in "$INPUTDIR"/*.txt; do
|
||||||
|
# It would be nice to use -i here for edit in place, but that is not portable
|
||||||
|
CMD_NAME=`basename "$i" .txt`;
|
||||||
|
sed < ${CMD_NAME}.1 > ${CMD_NAME}.1.tmp \
|
||||||
|
-e "/.SH \"$CMD_NAME/d" \
|
||||||
|
-e "s/^$CMD_NAME * \\\- \([^ ]*\) /\\\fB\1\\\fP -/"
|
||||||
|
mv "${CMD_NAME}.1.tmp" "${CMD_NAME}.1"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Erase condemned pages
|
||||||
|
rm -f $CONDEMNED_PAGES
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Destroy TMPLOC
|
||||||
|
echo "Cleaning up '$TMPLOC'"
|
||||||
|
rm -Rf "$TMPLOC"
|
||||||
|
|
||||||
|
if test "$RESULT" = 0; then
|
||||||
|
# Tell the user what we did
|
||||||
|
echo "Output man pages into '${OUTPUTDIR}'"
|
||||||
|
else
|
||||||
|
echo "Doxygen failed. See the output log for details."
|
||||||
|
fi
|
||||||
|
exit $RESULT
|
||||||
@@ -1 +0,0 @@
|
|||||||
<pkg-contents spec="1.12"/>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
<pkgref spec="1.12" uuid="6A7E1ED5-E40E-4ACE-959B-B9D77555AD39"><config><identifier>com.ridiculousfish.fish-shell.fishShell.fish_pkg.pkg</identifier><version>1.0</version><description></description><post-install type="none"/><requireAuthorization/><installFrom>/private/tmp/fish_pkg</installFrom><installTo>/</installTo><flags><followSymbolicLinks/></flags><packageStore type="internal"></packageStore><mod>parent</mod><mod>installTo</mod></config></pkgref>
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
<pkmkdoc spec="1.12"><properties><title>fish shell</title><organization>com.ridiculousfish.fish-shell</organization><userSees ui="easy"/><min-target os="3"/><domain anywhere="true"/></properties><distribution><versions min-spec="1.000000"/><scripts></scripts></distribution><contents><choice title="fish_pkg" id="fish shell" starts_selected="true" starts_enabled="true" starts_hidden="false"><pkgref id="com.ridiculousfish.fish-shell.fishShell.fish_pkg.pkg"/></choice></contents><resources bg-scale="proportional" bg-align="bottomleft"><locale lang="en"><resource mod="true" type="background">/Users/peter/Desktop/Untitled.pdf</resource><resource mime-type="text/rtf" kind="embedded" type="welcome"><![CDATA[{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf470
|
|
||||||
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
|
|
||||||
{\colortbl;\red255\green255\blue255;}
|
|
||||||
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural
|
|
||||||
|
|
||||||
\f0\fs30 \cf0 This installs ridiculous_fish's fork of fish, a command line shell for Mac OS X, Linux, and the rest of the family. For more information on fish, visit {\field{\*\fldinst{HYPERLINK "http://ridiculousfish.com/shell/"}}{\fldrslt http://ridiculousfish.com/shell/}}\
|
|
||||||
\
|
|
||||||
The path to fish will be added to /etc/shells, but your default shell will not be modified. \
|
|
||||||
\
|
|
||||||
This release is beta r2.\
|
|
||||||
}]]></resource><resource mime-type="text/rtf" kind="embedded" type="conclusion"><![CDATA[{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf470
|
|
||||||
{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fnil\fcharset0 Monaco;}
|
|
||||||
{\colortbl;\red255\green255\blue255;}
|
|
||||||
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural
|
|
||||||
|
|
||||||
\f0\fs26 \cf0 Run
|
|
||||||
\f1 fish
|
|
||||||
\f0 at the command line to start it up! Some useful commands:\
|
|
||||||
\
|
|
||||||
Interactively set your colors from a web page:\
|
|
||||||
\
|
|
||||||
|
|
||||||
\f1 fish_config
|
|
||||||
\f0 \
|
|
||||||
\
|
|
||||||
Update man-page completions:\
|
|
||||||
\
|
|
||||||
|
|
||||||
\f1 fish_update_completions
|
|
||||||
\f0 \
|
|
||||||
\
|
|
||||||
Make fish your default shell:\
|
|
||||||
\
|
|
||||||
|
|
||||||
\f1 chsh -s /usr/local/bin/fish\
|
|
||||||
|
|
||||||
\f0 \
|
|
||||||
\
|
|
||||||
Enjoy!\
|
|
||||||
}]]></resource></locale></resources><flags/><item type="file">01fish.xml</item><mod>properties.title</mod><mod>description</mod></pkmkdoc>
|
|
||||||
28
build_tools/git_version_gen.sh
Executable file
28
build_tools/git_version_gen.sh
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Originally from the git sources (GIT-VERSION-GEN)
|
||||||
|
# Presumably (C) Junio C Hamano <junkio@cox.net>
|
||||||
|
# Reused under GPL v2.0
|
||||||
|
# Modified for fish by David Adam <zanchey@ucc.gu.uwa.edu.au>
|
||||||
|
|
||||||
|
FBVF=FISH-BUILD-VERSION-FILE
|
||||||
|
DEF_VER=unknown
|
||||||
|
|
||||||
|
# First see if there is a version file (included in release tarballs),
|
||||||
|
# then try git-describe, then default.
|
||||||
|
if test -f version
|
||||||
|
then
|
||||||
|
VN=$(cat version) || VN="$DEF_VER"
|
||||||
|
elif ! VN=$(git describe --always --dirty 2>/dev/null); then
|
||||||
|
VN="$DEF_VER"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -r $FBVF
|
||||||
|
then
|
||||||
|
VC=$(sed -e 's/^FISH_BUILD_VERSION = //' <$FBVF)
|
||||||
|
else
|
||||||
|
VC=unset
|
||||||
|
fi
|
||||||
|
test "$VN" = "$VC" || {
|
||||||
|
echo >&2 "FISH_BUILD_VERSION = $VN"
|
||||||
|
echo "FISH_BUILD_VERSION = $VN" >$FBVF
|
||||||
|
}
|
||||||
8
build_tools/make_csv_completions.fish
Executable file
8
build_tools/make_csv_completions.fish
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env fish
|
||||||
|
#
|
||||||
|
# This file produces command specific completions for csv. Meant to be executed
|
||||||
|
# from the root directory (so the completions get put in the right place).
|
||||||
|
|
||||||
|
. build_tools/make_vcs_completions_generic.fish
|
||||||
|
|
||||||
|
write_completions csv >share/completions/csv.fish
|
||||||
12
build_tools/make_darcs_completions.fish
Executable file
12
build_tools/make_darcs_completions.fish
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env fish
|
||||||
|
#
|
||||||
|
# This file produces command specific completions for darcs. Meant to be
|
||||||
|
# executed from the root directory (so the completions get put in the right
|
||||||
|
# place).
|
||||||
|
|
||||||
|
. build_tools/make_vcs_completions_generic.fish
|
||||||
|
|
||||||
|
set darcs_comp 'complete -c darcs -n "not __fish_use_subcommand" -a "(test -f _darcs/prefs/repos; and cat _darcs/prefs/repos)" --description "Darcs repo"'
|
||||||
|
set darcs_comp $darcs_comp 'complete -c darcs -a "test predist boringfile binariesfile" -n "contains setpref (commandline -poc)" --description "Set the specified option" -x'
|
||||||
|
|
||||||
|
write_completions darcs $darcs_comp >share/completions/darcs.fish
|
||||||
8
build_tools/make_hg_completions.fish
Executable file
8
build_tools/make_hg_completions.fish
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env fish
|
||||||
|
#
|
||||||
|
# This file produces command specific completions for hg. Meant to be executed
|
||||||
|
# from the root directory (so the completions get put in the right place).
|
||||||
|
|
||||||
|
. build_tools/make_vcs_completions_generic.fish
|
||||||
|
|
||||||
|
write_completions hg >share/completions/hg.fish
|
||||||
@@ -1,31 +1,30 @@
|
|||||||
#!/bin/sh -x
|
#!/bin/sh
|
||||||
|
|
||||||
|
VERSION=`sed -E -n 's/^.*PACKAGE_VERSION "([0-9.]+)"/\1/p' osx/config.h`
|
||||||
|
if test -z "$VERSION" ; then
|
||||||
|
echo "Could not get version from osx/config.h"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Version is $VERSION"
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
make distclean
|
make distclean
|
||||||
rm -rf /tmp/fish_pkg
|
rm -Rf /tmp/fish_pkg
|
||||||
mkdir -p /tmp/fish_pkg/
|
|
||||||
|
|
||||||
# Make sure what we build can run on SnowLeopard
|
#Exit on error
|
||||||
export OSX_SDK="/Developer/SDKs/MacOSX10.6.sdk"
|
set -e
|
||||||
export MACOSX_DEPLOYMENT_TARGET="10.6"
|
|
||||||
export CC="clang -isysroot $OSX_SDK -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET"
|
|
||||||
export CCX="clang++ -isysroot $OSX_SDK -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET"
|
|
||||||
export CFLAGS="$CFLAGS -isysroot $OSX_SDK -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET"
|
|
||||||
export CXXFLAGS="$CXXFLAGS -isysroot $OSX_SDK -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET"
|
|
||||||
export LDFLAGS="$LDFLAGS -isysroot $OSX_SDK -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET"
|
|
||||||
autoconf
|
|
||||||
./configure --without-xsel
|
|
||||||
|
|
||||||
# Actually build it now
|
mkdir -p /tmp/fish_pkg/root /tmp/fish_pkg/intermediates /tmp/fish_pkg/dst
|
||||||
if make -j 4 DESTDIR=/tmp/fish_pkg install
|
xcodebuild install -scheme install_tree -configuration Release DSTROOT=/tmp/fish_pkg/root/
|
||||||
then
|
pkgbuild --scripts build_tools/osx_package_scripts --root /tmp/fish_pkg/root/ --identifier 'com.ridiculousfish.fish-shell-pkg' --version "$VERSION" /tmp/fish_pkg/intermediates/fish.pkg
|
||||||
echo "Root written to /tmp/fish_pkg/"
|
|
||||||
if /Developer/usr/bin/packagemaker --doc ./build_tools/fish_shell.pmdoc --out ~/fish_built/fishfish.pkg
|
productbuild --package-path /tmp/fish_pkg/intermediates --distribution build_tools/osx_distribution.xml --resources build_tools/osx_package_resources/ ~/fish_built/fish.pkg
|
||||||
then
|
|
||||||
echo "Package written to ~/fish_built/fishfish.pkg"
|
|
||||||
else
|
# Make the app
|
||||||
echo "Package could not be written"
|
xcodebuild -scheme fish.app -configuration Release DSTROOT=/tmp/fish_app/
|
||||||
fi
|
rm -f ~/fish_built/fish.app.zip
|
||||||
|
cd DerivedData/fish/Build/Products/Release/
|
||||||
else
|
zip -r ~/fish_built/fish.app.zip fish.app
|
||||||
echo "Root could not be written"
|
|
||||||
fi
|
|
||||||
|
|||||||
8
build_tools/make_svn_completions.fish
Executable file
8
build_tools/make_svn_completions.fish
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env fish
|
||||||
|
#
|
||||||
|
# This file produces command specific completions for svn. Meant to be executed
|
||||||
|
# from the root directory (so the completions get put in the right place).
|
||||||
|
|
||||||
|
. build_tools/make_vcs_completions_generic.fish
|
||||||
|
|
||||||
|
write_completions svn >share/completions/svn.fish
|
||||||
@@ -19,23 +19,35 @@ wd="$PWD"
|
|||||||
# The name of the prefix, which is the directory that you get when you untar
|
# The name of the prefix, which is the directory that you get when you untar
|
||||||
prefix="fish"
|
prefix="fish"
|
||||||
|
|
||||||
|
# Get the version from git-describe
|
||||||
|
VERSION=`git describe --dirty 2>/dev/null`
|
||||||
|
prefix="$prefix-$VERSION"
|
||||||
|
|
||||||
# The path where we will output the tar file
|
# The path where we will output the tar file
|
||||||
path=~/fish_built/fish-2.0.tar
|
path=~/fish_built/$prefix.tar
|
||||||
|
|
||||||
# Clean up stuff we've written before
|
# Clean up stuff we've written before
|
||||||
rm -f "$path" "$path".gz
|
rm -f "$path" "$path".gz
|
||||||
|
|
||||||
# git starts the archive
|
# git starts the archive
|
||||||
git archive --format=tar --prefix="$prefix"/ master > "$path"
|
git archive --format=tar --prefix="$prefix"/ HEAD > "$path"
|
||||||
|
|
||||||
# tarball out the documentation
|
# tarball out the documentation, generate a configure script and version file
|
||||||
make user_doc
|
# Don't use autoreconf since it invokes commands that may not be installed, like aclocal
|
||||||
make share/man
|
# Don't run autoheader since configure.ac runs it. autoconf is enough.
|
||||||
|
autoconf
|
||||||
|
./configure --with-doxygen
|
||||||
|
make user_doc share/man
|
||||||
|
echo $VERSION > version
|
||||||
cd /tmp
|
cd /tmp
|
||||||
rm -f "$prefix"
|
rm -f "$prefix"
|
||||||
ln -s "$wd" "$prefix"
|
ln -s "$wd" "$prefix"
|
||||||
tar --append --file="$path" "$prefix"/user_doc/html
|
TAR_APPEND="gnutar --append --file=$path --mtime=now --owner=0 --group=0 --mode=g+w,a+rX"
|
||||||
tar --append --file="$path" "$prefix"/share/man
|
$TAR_APPEND --no-recursion "$prefix"/user_doc
|
||||||
|
$TAR_APPEND "$prefix"/user_doc/html "$prefix"/share/man
|
||||||
|
$TAR_APPEND "$prefix"/version
|
||||||
|
$TAR_APPEND "$prefix"/configure "$prefix"/config.h.in
|
||||||
|
rm -f "$prefix"/version
|
||||||
rm -f "$prefix"
|
rm -f "$prefix"
|
||||||
|
|
||||||
# gzip it
|
# gzip it
|
||||||
|
|||||||
9
build_tools/make_vcs_completions.fish
Executable file
9
build_tools/make_vcs_completions.fish
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env fish
|
||||||
|
#
|
||||||
|
# This file produces command specific completions for hg, darcs and a
|
||||||
|
# few other vcs systems.
|
||||||
|
|
||||||
|
build_tools/make_darcs_completions.fish
|
||||||
|
build_tools/make_hg_completions.fish
|
||||||
|
build_tools/make_svn_completions.fish
|
||||||
|
build_tools/make_csv_completions.fish
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/env fish
|
#!/usr/bin/env fish
|
||||||
#
|
#
|
||||||
# This file produces command specific completions for hg, darcs and a
|
# This file provides generic functions for generating specific completions for
|
||||||
# few other vcs systems. It uses the fact that all these systems have a
|
# hg, darcs and a few other vcs systems. It uses the fact that all these
|
||||||
# somewhat uniform command line help mechanism.
|
# systems have a somewhat uniform command line help mechanism.
|
||||||
#
|
#
|
||||||
|
|
||||||
function cap
|
function cap
|
||||||
@@ -227,11 +227,3 @@ function write_completions
|
|||||||
echo \n\n
|
echo \n\n
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
set darcs_comp 'complete -c darcs -n "not __fish_use_subcommand" -a "(test -f _darcs/prefs/repos; and cat _darcs/prefs/repos)" --description "Darcs repo"'
|
|
||||||
set darcs_comp $darcs_comp 'complete -c darcs -a "test predist boringfile binariesfile" -n "contains setpref (commandline -poc)" --description "Set the specified option" -x'
|
|
||||||
|
|
||||||
write_completions darcs $darcs_comp >share/completions/darcs.fish
|
|
||||||
write_completions hg >share/completions/hg.fish
|
|
||||||
write_completions svn >share/completions/svn.fish
|
|
||||||
write_completions cvs >share/completions/cvs.fish
|
|
||||||
18
build_tools/osx_distribution.xml
Normal file
18
build_tools/osx_distribution.xml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
|
<installer-gui-script minSpecVersion="1">
|
||||||
|
<title>fish shell</title>
|
||||||
|
<welcome file="welcome.rtf"/>
|
||||||
|
<background file="terminal_logo.png" scaling="proportional" alignment="bottomleft"/>
|
||||||
|
<pkg-ref id="com.ridiculousfish.fish-shell-pkg"/>
|
||||||
|
<options customize="never" require-scripts="false"/>
|
||||||
|
<choices-outline>
|
||||||
|
<line choice="default">
|
||||||
|
<line choice="com.ridiculousfish.fish-shell-pkg"/>
|
||||||
|
</line>
|
||||||
|
</choices-outline>
|
||||||
|
<choice id="default"/>
|
||||||
|
<choice id="com.ridiculousfish.fish-shell-pkg" visible="false">
|
||||||
|
<pkg-ref id="com.ridiculousfish.fish-shell-pkg"/>
|
||||||
|
</choice>
|
||||||
|
<pkg-ref id="com.ridiculousfish.fish-shell-pkg" version="0" onConclusion="none">fish.pkg</pkg-ref>
|
||||||
|
</installer-gui-script>
|
||||||
BIN
build_tools/osx_package_resources/terminal_logo.png
Normal file
BIN
build_tools/osx_package_resources/terminal_logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 51 KiB |
25
build_tools/osx_package_resources/welcome.rtf
Normal file
25
build_tools/osx_package_resources/welcome.rtf
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370
|
||||||
|
{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fnil\fcharset0 Monaco;}
|
||||||
|
{\colortbl;\red255\green255\blue255;}
|
||||||
|
{\info
|
||||||
|
{\author dlkfjslfjsfdlkfk}}\margl1440\margr1440\vieww10800\viewh8400\viewkind0
|
||||||
|
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural
|
||||||
|
|
||||||
|
\f0\fs30 \cf0 The fish shell is a smart and user friendly command line shell. For more information, visit {\field{\*\fldinst{HYPERLINK "http://fishshell.com"}}{\fldrslt http://fishshell.com}}.\
|
||||||
|
\
|
||||||
|
fish will be installed into
|
||||||
|
\f1\fs26 /usr/local/
|
||||||
|
\f0\fs30 , and fish will be added to
|
||||||
|
\f1\fs26 /etc/shells
|
||||||
|
\f0\fs30 if necessary.\
|
||||||
|
\
|
||||||
|
Your default shell will
|
||||||
|
\i not
|
||||||
|
\i0 be changed. To make fish your default, run:\
|
||||||
|
\
|
||||||
|
|
||||||
|
\f1 chsh -s /usr/local/bin/fish
|
||||||
|
\f0 \
|
||||||
|
\
|
||||||
|
Enjoy!\
|
||||||
|
}
|
||||||
6141
builtin.cpp
6141
builtin.cpp
File diff suppressed because it is too large
Load Diff
56
builtin.h
56
builtin.h
@@ -1,5 +1,5 @@
|
|||||||
/** \file builtin.h
|
/** \file builtin.h
|
||||||
Prototypes for functions for executing builtin functions.
|
Prototypes for functions for executing builtin functions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef FISH_BUILTIN_H
|
#ifndef FISH_BUILTIN_H
|
||||||
@@ -15,9 +15,9 @@ class parser_t;
|
|||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
COMMAND_NOT_BUILTIN,
|
COMMAND_NOT_BUILTIN,
|
||||||
BUILTIN_REGULAR,
|
BUILTIN_REGULAR,
|
||||||
BUILTIN_FUNCTION
|
BUILTIN_FUNCTION
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ enum
|
|||||||
/**
|
/**
|
||||||
Error message for unknown switch
|
Error message for unknown switch
|
||||||
*/
|
*/
|
||||||
#define BUILTIN_ERR_UNKNOWN _( L"%ls: Unknown option '%ls'\n" )
|
#define BUILTIN_ERR_UNKNOWN _( L"%ls: Unknown option '%ls'\n" )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Error message for invalid character in variable name
|
Error message for invalid character in variable name
|
||||||
@@ -67,7 +67,7 @@ enum
|
|||||||
#define BUILTIN_FOR_ERR_IN _( L"%ls: Second argument must be 'in'\n" )
|
#define BUILTIN_FOR_ERR_IN _( L"%ls: Second argument must be 'in'\n" )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Error message for insufficient number of arguments
|
Error message for insufficient number of arguments
|
||||||
*/
|
*/
|
||||||
#define BUILTIN_FOR_ERR_COUNT _( L"%ls: Expected at least two arguments, got %d\n")
|
#define BUILTIN_FOR_ERR_COUNT _( L"%ls: Expected at least two arguments, got %d\n")
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ extern int builtin_err_redirect;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize builtin data.
|
Initialize builtin data.
|
||||||
*/
|
*/
|
||||||
void builtin_init();
|
void builtin_init();
|
||||||
|
|
||||||
@@ -125,21 +125,21 @@ void builtin_destroy();
|
|||||||
/**
|
/**
|
||||||
Is there a builtin command with the given name?
|
Is there a builtin command with the given name?
|
||||||
*/
|
*/
|
||||||
int builtin_exists( const wcstring &cmd );
|
int builtin_exists(const wcstring &cmd);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Execute a builtin command
|
Execute a builtin command
|
||||||
|
|
||||||
\param parser The parser being used
|
\param parser The parser being used
|
||||||
\param argv Array containing the command and parameters
|
\param argv Array containing the command and parameters
|
||||||
of the builtin. The list is terminated by a
|
of the builtin. The list is terminated by a
|
||||||
null pointer. This syntax resembles the syntax
|
null pointer. This syntax resembles the syntax
|
||||||
for exec.
|
for exec.
|
||||||
\param io the io redirections to perform on this builtin.
|
\param io the io redirections to perform on this builtin.
|
||||||
|
|
||||||
\return the exit status of the builtin command
|
\return the exit status of the builtin command
|
||||||
*/
|
*/
|
||||||
int builtin_run( parser_t &parser, const wchar_t * const *argv, const io_chain_t &io );
|
int builtin_run(parser_t &parser, const wchar_t * const *argv, const io_chain_t &io);
|
||||||
|
|
||||||
/** Returns a list of all builtin names */
|
/** Returns a list of all builtin names */
|
||||||
wcstring_list_t builtin_get_names(void);
|
wcstring_list_t builtin_get_names(void);
|
||||||
@@ -150,7 +150,7 @@ void builtin_get_names(std::vector<completion_t> &list);
|
|||||||
/**
|
/**
|
||||||
Pushes a new set of input/output to the stack. The new stdin is supplied, a new set of output strings is created.
|
Pushes a new set of input/output to the stack. The new stdin is supplied, a new set of output strings is created.
|
||||||
*/
|
*/
|
||||||
void builtin_push_io( parser_t &parser, int stdin_fd );
|
void builtin_push_io(parser_t &parser, int stdin_fd);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Pops a set of input/output from the stack. The output strings are destroued, but the input file is not closed.
|
Pops a set of input/output from the stack. The output strings are destroued, but the input file is not closed.
|
||||||
@@ -161,22 +161,38 @@ void builtin_pop_io(parser_t &parser);
|
|||||||
/**
|
/**
|
||||||
Return a one-line description of the specified builtin.
|
Return a one-line description of the specified builtin.
|
||||||
*/
|
*/
|
||||||
wcstring builtin_get_desc( const wcstring &b );
|
wcstring builtin_get_desc(const wcstring &b);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Slightly kludgy function used with 'complete -C' in order to make
|
/** Support for setting and removing transient command lines.
|
||||||
the commandline builtin operate on the string to complete instead
|
This is used by 'complete -C' in order to make
|
||||||
of operating on whatever is to be completed.
|
the commandline builtin operate on the string to complete instead
|
||||||
|
of operating on whatever is to be completed. It's also used by
|
||||||
|
completion wrappers, to allow a command to appear as the command
|
||||||
|
being wrapped for the purposes of completion.
|
||||||
|
|
||||||
|
Instantiating an instance of builtin_commandline_scoped_transient_t
|
||||||
|
pushes the command as the new transient commandline. The destructor removes it.
|
||||||
|
It will assert if construction/destruction does not happen in a stack-like (LIFO) order.
|
||||||
*/
|
*/
|
||||||
const wchar_t *builtin_complete_get_temporary_buffer();
|
class builtin_commandline_scoped_transient_t
|
||||||
|
{
|
||||||
|
size_t token;
|
||||||
|
public:
|
||||||
|
builtin_commandline_scoped_transient_t(const wcstring &cmd);
|
||||||
|
~builtin_commandline_scoped_transient_t();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Run the __fish_print_help function to obtain the help information
|
Run the __fish_print_help function to obtain the help information
|
||||||
for the specified command.
|
for the specified command.
|
||||||
*/
|
*/
|
||||||
|
wcstring builtin_help_get(parser_t &parser, const wchar_t *cmd);
|
||||||
|
|
||||||
|
/** Defines a function, like builtin_function. Returns 0 on success. args should NOT contain 'function' as the first argument. */
|
||||||
|
int define_function(parser_t &parser, const wcstring_list_t &args, const wcstring &contents, int definition_line_offset, wcstring *out_err);
|
||||||
|
|
||||||
wcstring builtin_help_get( parser_t &parser, const wchar_t *cmd );
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
1036
builtin_complete.cpp
1036
builtin_complete.cpp
File diff suppressed because it is too large
Load Diff
480
builtin_jobs.cpp
480
builtin_jobs.cpp
@@ -1,5 +1,5 @@
|
|||||||
/** \file builtin_jobs.c
|
/** \file builtin_jobs.c
|
||||||
Functions for executing the jobs builtin.
|
Functions for executing the jobs builtin.
|
||||||
*/
|
*/
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
@@ -30,12 +30,12 @@
|
|||||||
*/
|
*/
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
JOBS_DEFAULT, /**< Print lots of general info */
|
JOBS_DEFAULT, /**< Print lots of general info */
|
||||||
JOBS_PRINT_PID, /**< Print pid of each process in job */
|
JOBS_PRINT_PID, /**< Print pid of each process in job */
|
||||||
JOBS_PRINT_COMMAND, /**< Print command name of each process in job */
|
JOBS_PRINT_COMMAND, /**< Print command name of each process in job */
|
||||||
JOBS_PRINT_GROUP, /**< Print group id of job */
|
JOBS_PRINT_GROUP, /**< Print group id of job */
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -43,113 +43,113 @@ enum
|
|||||||
/**
|
/**
|
||||||
Calculates the cpu usage (in percent) of the specified job.
|
Calculates the cpu usage (in percent) of the specified job.
|
||||||
*/
|
*/
|
||||||
static int cpu_use( const job_t *j )
|
static int cpu_use(const job_t *j)
|
||||||
{
|
{
|
||||||
double u=0;
|
double u=0;
|
||||||
process_t *p;
|
process_t *p;
|
||||||
|
|
||||||
for( p=j->first_process; p; p=p->next )
|
for (p=j->first_process; p; p=p->next)
|
||||||
{
|
{
|
||||||
struct timeval t;
|
struct timeval t;
|
||||||
int jiffies;
|
int jiffies;
|
||||||
gettimeofday( &t, 0 );
|
gettimeofday(&t, 0);
|
||||||
jiffies = proc_get_jiffies( p );
|
jiffies = proc_get_jiffies(p);
|
||||||
|
|
||||||
double t1 = 1000000.0*p->last_time.tv_sec+p->last_time.tv_usec;
|
double t1 = 1000000.0*p->last_time.tv_sec+p->last_time.tv_usec;
|
||||||
double t2 = 1000000.0*t.tv_sec+t.tv_usec;
|
double t2 = 1000000.0*t.tv_sec+t.tv_usec;
|
||||||
|
|
||||||
/* fwprintf( stderr, L"t1 %f t2 %f p1 %d p2 %d\n",
|
/* fwprintf( stderr, L"t1 %f t2 %f p1 %d p2 %d\n",
|
||||||
t1, t2, jiffies, p->last_jiffies );
|
t1, t2, jiffies, p->last_jiffies );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
u += ((double)(jiffies-p->last_jiffies))/(t2-t1);
|
u += ((double)(jiffies-p->last_jiffies))/(t2-t1);
|
||||||
}
|
}
|
||||||
return u*1000000;
|
return u*1000000;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Print information about the specified job
|
Print information about the specified job
|
||||||
*/
|
*/
|
||||||
static void builtin_jobs_print( const job_t *j, int mode, int header )
|
static void builtin_jobs_print(const job_t *j, int mode, int header)
|
||||||
{
|
{
|
||||||
process_t *p;
|
process_t *p;
|
||||||
switch( mode )
|
switch (mode)
|
||||||
{
|
{
|
||||||
case JOBS_DEFAULT:
|
case JOBS_DEFAULT:
|
||||||
{
|
{
|
||||||
|
|
||||||
if( header )
|
if (header)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Print table header before first job
|
Print table header before first job
|
||||||
*/
|
*/
|
||||||
stdout_buffer.append( _( L"Job\tGroup\t" ));
|
stdout_buffer.append(_(L"Job\tGroup\t"));
|
||||||
#ifdef HAVE__PROC_SELF_STAT
|
#ifdef HAVE__PROC_SELF_STAT
|
||||||
stdout_buffer.append( _( L"CPU\t" ) );
|
stdout_buffer.append(_(L"CPU\t"));
|
||||||
#endif
|
#endif
|
||||||
stdout_buffer.append( _( L"State\tCommand\n" ) );
|
stdout_buffer.append(_(L"State\tCommand\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
append_format(stdout_buffer, L"%d\t%d\t", j->job_id, j->pgid );
|
append_format(stdout_buffer, L"%d\t%d\t", j->job_id, j->pgid);
|
||||||
|
|
||||||
#ifdef HAVE__PROC_SELF_STAT
|
#ifdef HAVE__PROC_SELF_STAT
|
||||||
append_format(stdout_buffer, L"%d%%\t", cpu_use(j) );
|
append_format(stdout_buffer, L"%d%%\t", cpu_use(j));
|
||||||
#endif
|
#endif
|
||||||
stdout_buffer.append(job_is_stopped(j)?_(L"stopped"):_(L"running"));
|
stdout_buffer.append(job_is_stopped(j)?_(L"stopped"):_(L"running"));
|
||||||
stdout_buffer.append(L"\t");
|
stdout_buffer.append(L"\t");
|
||||||
stdout_buffer.append(j->command_wcstr());
|
stdout_buffer.append(j->command_wcstr());
|
||||||
stdout_buffer.append(L"\n");
|
stdout_buffer.append(L"\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case JOBS_PRINT_GROUP:
|
case JOBS_PRINT_GROUP:
|
||||||
{
|
{
|
||||||
if( header )
|
if (header)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Print table header before first job
|
Print table header before first job
|
||||||
*/
|
*/
|
||||||
stdout_buffer.append( _( L"Group\n" ));
|
stdout_buffer.append(_(L"Group\n"));
|
||||||
}
|
}
|
||||||
append_format(stdout_buffer, L"%d\n", j->pgid );
|
append_format(stdout_buffer, L"%d\n", j->pgid);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case JOBS_PRINT_PID:
|
case JOBS_PRINT_PID:
|
||||||
{
|
{
|
||||||
if( header )
|
if (header)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Print table header before first job
|
Print table header before first job
|
||||||
*/
|
*/
|
||||||
stdout_buffer.append( _( L"Procces\n" ));
|
stdout_buffer.append(_(L"Process\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
for( p=j->first_process; p; p=p->next )
|
for (p=j->first_process; p; p=p->next)
|
||||||
{
|
{
|
||||||
append_format(stdout_buffer, L"%d\n", p->pid );
|
append_format(stdout_buffer, L"%d\n", p->pid);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case JOBS_PRINT_COMMAND:
|
case JOBS_PRINT_COMMAND:
|
||||||
{
|
{
|
||||||
if( header )
|
if (header)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Print table header before first job
|
Print table header before first job
|
||||||
*/
|
*/
|
||||||
stdout_buffer.append( _( L"Command\n" ));
|
stdout_buffer.append(_(L"Command\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
for( p=j->first_process; p; p=p->next )
|
for (p=j->first_process; p; p=p->next)
|
||||||
{
|
{
|
||||||
append_format(stdout_buffer, L"%ls\n", p->argv0() );
|
append_format(stdout_buffer, L"%ls\n", p->argv0());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,194 +158,194 @@ static void builtin_jobs_print( const job_t *j, int mode, int header )
|
|||||||
/**
|
/**
|
||||||
The jobs builtin. Used fopr printing running jobs. Defined in builtin_jobs.c.
|
The jobs builtin. Used fopr printing running jobs. Defined in builtin_jobs.c.
|
||||||
*/
|
*/
|
||||||
static int builtin_jobs( parser_t &parser, wchar_t **argv )
|
static int builtin_jobs(parser_t &parser, wchar_t **argv)
|
||||||
{
|
{
|
||||||
int argc=0;
|
int argc=0;
|
||||||
int found=0;
|
int found=0;
|
||||||
int mode=JOBS_DEFAULT;
|
int mode=JOBS_DEFAULT;
|
||||||
int print_last = 0;
|
int print_last = 0;
|
||||||
const job_t *j;
|
|
||||||
|
|
||||||
argc = builtin_count_args( argv );
|
argc = builtin_count_args(argv);
|
||||||
woptind=0;
|
woptind=0;
|
||||||
|
|
||||||
while( 1 )
|
while (1)
|
||||||
{
|
{
|
||||||
static const struct woption
|
static const struct woption
|
||||||
long_options[] =
|
long_options[] =
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
L"pid", no_argument, 0, 'p'
|
L"pid", no_argument, 0, 'p'
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
L"command", no_argument, 0, 'c'
|
L"command", no_argument, 0, 'c'
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
L"group", no_argument, 0, 'g'
|
L"group", no_argument, 0, 'g'
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
L"last", no_argument, 0, 'l'
|
L"last", no_argument, 0, 'l'
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
L"help", no_argument, 0, 'h'
|
L"help", no_argument, 0, 'h'
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
0, 0, 0, 0
|
0, 0, 0, 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
int opt_index = 0;
|
int opt_index = 0;
|
||||||
|
|
||||||
int opt = wgetopt_long( argc,
|
int opt = wgetopt_long(argc,
|
||||||
argv,
|
argv,
|
||||||
L"pclgh",
|
L"pclgh",
|
||||||
long_options,
|
long_options,
|
||||||
&opt_index );
|
&opt_index);
|
||||||
if( opt == -1 )
|
if (opt == -1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
switch( opt )
|
switch (opt)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
if(long_options[opt_index].flag != 0)
|
if (long_options[opt_index].flag != 0)
|
||||||
break;
|
break;
|
||||||
append_format(stderr_buffer,
|
append_format(stderr_buffer,
|
||||||
BUILTIN_ERR_UNKNOWN,
|
BUILTIN_ERR_UNKNOWN,
|
||||||
argv[0],
|
argv[0],
|
||||||
long_options[opt_index].name );
|
long_options[opt_index].name);
|
||||||
|
|
||||||
builtin_print_help( parser, argv[0], stderr_buffer );
|
builtin_print_help(parser, argv[0], stderr_buffer);
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|
||||||
case 'p':
|
case 'p':
|
||||||
mode=JOBS_PRINT_PID;
|
mode=JOBS_PRINT_PID;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'c':
|
case 'c':
|
||||||
mode=JOBS_PRINT_COMMAND;
|
mode=JOBS_PRINT_COMMAND;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'g':
|
case 'g':
|
||||||
mode=JOBS_PRINT_GROUP;
|
mode=JOBS_PRINT_GROUP;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'l':
|
case 'l':
|
||||||
{
|
{
|
||||||
print_last = 1;
|
print_last = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
builtin_print_help( parser, argv[0], stdout_buffer );
|
builtin_print_help(parser, argv[0], stdout_buffer);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
builtin_unknown_option( parser, argv[0], argv[woptind-1] );
|
builtin_unknown_option(parser, argv[0], argv[woptind-1]);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Do not babble if not interactive
|
Do not babble if not interactive
|
||||||
*/
|
*/
|
||||||
if( builtin_out_redirect )
|
if (builtin_out_redirect)
|
||||||
{
|
{
|
||||||
found=1;
|
found=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( print_last )
|
if (print_last)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Ignore unconstructed jobs, i.e. ourself.
|
Ignore unconstructed jobs, i.e. ourself.
|
||||||
*/
|
*/
|
||||||
job_iterator_t jobs;
|
job_iterator_t jobs;
|
||||||
const job_t *j;
|
const job_t *j;
|
||||||
while ((j = jobs.next()))
|
while ((j = jobs.next()))
|
||||||
{
|
{
|
||||||
|
|
||||||
if( (j->flags & JOB_CONSTRUCTED) && !job_is_completed(j) )
|
|
||||||
{
|
|
||||||
builtin_jobs_print( j, mode, !found );
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
if ((j->flags & JOB_CONSTRUCTED) && !job_is_completed(j))
|
||||||
else
|
{
|
||||||
{
|
builtin_jobs_print(j, mode, !found);
|
||||||
if( woptind < argc )
|
return 0;
|
||||||
{
|
}
|
||||||
int i;
|
}
|
||||||
|
|
||||||
found = 1;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (woptind < argc)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
for( i=woptind; i<argc; i++ )
|
found = 1;
|
||||||
{
|
|
||||||
int pid;
|
|
||||||
wchar_t *end;
|
|
||||||
errno=0;
|
|
||||||
pid=fish_wcstoi( argv[i], &end, 10 );
|
|
||||||
if( errno || *end )
|
|
||||||
{
|
|
||||||
append_format(stderr_buffer,
|
|
||||||
_( L"%ls: '%ls' is not a job\n" ),
|
|
||||||
argv[0],
|
|
||||||
argv[i] );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
j = job_get_from_pid( pid );
|
for (i=woptind; i<argc; i++)
|
||||||
|
{
|
||||||
|
int pid;
|
||||||
|
wchar_t *end;
|
||||||
|
errno=0;
|
||||||
|
pid=fish_wcstoi(argv[i], &end, 10);
|
||||||
|
if (errno || *end)
|
||||||
|
{
|
||||||
|
append_format(stderr_buffer,
|
||||||
|
_(L"%ls: '%ls' is not a job\n"),
|
||||||
|
argv[0],
|
||||||
|
argv[i]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if( j && !job_is_completed( j ) )
|
const job_t *j = job_get_from_pid(pid);
|
||||||
{
|
|
||||||
builtin_jobs_print( j, mode, !found );
|
if (j && !job_is_completed(j))
|
||||||
}
|
{
|
||||||
else
|
builtin_jobs_print(j, mode, !found);
|
||||||
{
|
}
|
||||||
append_format(stderr_buffer,
|
else
|
||||||
_( L"%ls: No suitable job: %d\n" ),
|
{
|
||||||
argv[0],
|
append_format(stderr_buffer,
|
||||||
pid );
|
_(L"%ls: No suitable job: %d\n"),
|
||||||
return 1;
|
argv[0],
|
||||||
}
|
pid);
|
||||||
}
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
job_iterator_t jobs;
|
job_iterator_t jobs;
|
||||||
const job_t *j;
|
const job_t *j;
|
||||||
while ((j = jobs.next()))
|
while ((j = jobs.next()))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Ignore unconstructed jobs, i.e. ourself.
|
Ignore unconstructed jobs, i.e. ourself.
|
||||||
*/
|
*/
|
||||||
if( (j->flags & JOB_CONSTRUCTED) && !job_is_completed(j) )
|
if ((j->flags & JOB_CONSTRUCTED) && !job_is_completed(j))
|
||||||
{
|
{
|
||||||
builtin_jobs_print( j, mode, !found );
|
builtin_jobs_print(j, mode, !found);
|
||||||
found = 1;
|
found = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !found )
|
if (!found)
|
||||||
{
|
{
|
||||||
append_format(stdout_buffer,
|
append_format(stdout_buffer,
|
||||||
_( L"%ls: There are no jobs\n" ),
|
_(L"%ls: There are no jobs\n"),
|
||||||
argv[0] );
|
argv[0]);
|
||||||
}
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
787
builtin_printf.cpp
Normal file
787
builtin_printf.cpp
Normal file
@@ -0,0 +1,787 @@
|
|||||||
|
/* printf - format and print data
|
||||||
|
Copyright (C) 1990-2007 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
|
||||||
|
/* Usage: printf format [argument...]
|
||||||
|
|
||||||
|
A front end to the printf function that lets it be used from the shell.
|
||||||
|
|
||||||
|
Backslash escapes:
|
||||||
|
|
||||||
|
\" = double quote
|
||||||
|
\\ = backslash
|
||||||
|
\a = alert (bell)
|
||||||
|
\b = backspace
|
||||||
|
\c = produce no further output
|
||||||
|
\e = escape
|
||||||
|
\f = form feed
|
||||||
|
\n = new line
|
||||||
|
\r = carriage return
|
||||||
|
\t = horizontal tab
|
||||||
|
\v = vertical tab
|
||||||
|
\ooo = octal number (ooo is 1 to 3 digits)
|
||||||
|
\xhh = hexadecimal number (hhh is 1 to 2 digits)
|
||||||
|
\uhhhh = 16-bit Unicode character (hhhh is 4 digits)
|
||||||
|
\Uhhhhhhhh = 32-bit Unicode character (hhhhhhhh is 8 digits)
|
||||||
|
|
||||||
|
Additional directive:
|
||||||
|
|
||||||
|
%b = print an argument string, interpreting backslash escapes,
|
||||||
|
except that octal escapes are of the form \0 or \0ooo.
|
||||||
|
|
||||||
|
The `format' argument is re-used as many times as necessary
|
||||||
|
to convert all of the given arguments.
|
||||||
|
|
||||||
|
David MacKenzie <djm@gnu.ai.mit.edu> */
|
||||||
|
|
||||||
|
/* This file has been imported from source code of printf command in GNU Coreutils version 6.9 */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
struct builtin_printf_state_t
|
||||||
|
{
|
||||||
|
/* The status of the operation */
|
||||||
|
int exit_code;
|
||||||
|
|
||||||
|
/* Whether we should stop outputting. This gets set in the case of an error, and also with the \c escape. */
|
||||||
|
bool early_exit;
|
||||||
|
|
||||||
|
builtin_printf_state_t() : exit_code(0), early_exit(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void verify_numeric(const wchar_t *s, const wchar_t *end, int errcode);
|
||||||
|
|
||||||
|
void print_direc(const wchar_t *start, size_t length, wchar_t conversion,
|
||||||
|
bool have_field_width, int field_width,
|
||||||
|
bool have_precision, int precision,
|
||||||
|
wchar_t const *argument);
|
||||||
|
|
||||||
|
int print_formatted(const wchar_t *format, int argc, wchar_t **argv);
|
||||||
|
|
||||||
|
void fatal_error(const wchar_t *format, ...);
|
||||||
|
|
||||||
|
long print_esc(const wchar_t *escstart, bool octal_0);
|
||||||
|
void print_esc_string(const wchar_t *str);
|
||||||
|
void print_esc_char(wchar_t c);
|
||||||
|
|
||||||
|
void append_output(wchar_t c);
|
||||||
|
void append_output(const wchar_t *c);
|
||||||
|
void append_format_output(const wchar_t *fmt, ...);
|
||||||
|
};
|
||||||
|
|
||||||
|
static bool is_octal_digit(wchar_t c)
|
||||||
|
{
|
||||||
|
return c != L'\0' && wcschr(L"01234567", c) != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool is_hex_digit(wchar_t c)
|
||||||
|
{
|
||||||
|
return c != L'\0' && wcschr(L"0123456789ABCDEFabcdef", c) != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int hex_to_bin(const wchar_t &c)
|
||||||
|
{
|
||||||
|
switch (c)
|
||||||
|
{
|
||||||
|
case L'0':
|
||||||
|
return 0;
|
||||||
|
case L'1':
|
||||||
|
return 1;
|
||||||
|
case L'2':
|
||||||
|
return 2;
|
||||||
|
case L'3':
|
||||||
|
return 3;
|
||||||
|
case L'4':
|
||||||
|
return 4;
|
||||||
|
case L'5':
|
||||||
|
return 5;
|
||||||
|
case L'6':
|
||||||
|
return 6;
|
||||||
|
case L'7':
|
||||||
|
return 7;
|
||||||
|
case L'8':
|
||||||
|
return 8;
|
||||||
|
case L'9':
|
||||||
|
return 9;
|
||||||
|
case L'a':
|
||||||
|
case L'A':
|
||||||
|
return 10;
|
||||||
|
case L'b':
|
||||||
|
case L'B':
|
||||||
|
return 11;
|
||||||
|
case L'c':
|
||||||
|
case L'C':
|
||||||
|
return 12;
|
||||||
|
case L'd':
|
||||||
|
case L'D':
|
||||||
|
return 13;
|
||||||
|
case L'e':
|
||||||
|
case L'E':
|
||||||
|
return 14;
|
||||||
|
case L'f':
|
||||||
|
case L'F':
|
||||||
|
return 15;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int octal_to_bin(wchar_t c)
|
||||||
|
{
|
||||||
|
switch (c)
|
||||||
|
{
|
||||||
|
case L'0':
|
||||||
|
return 0;
|
||||||
|
case L'1':
|
||||||
|
return 1;
|
||||||
|
case L'2':
|
||||||
|
return 2;
|
||||||
|
case L'3':
|
||||||
|
return 3;
|
||||||
|
case L'4':
|
||||||
|
return 4;
|
||||||
|
case L'5':
|
||||||
|
return 5;
|
||||||
|
case L'6':
|
||||||
|
return 6;
|
||||||
|
case L'7':
|
||||||
|
return 7;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This message appears in N_() here rather than just in _() below because
|
||||||
|
the sole use would have been in a #define. */
|
||||||
|
static wchar_t const *const cfcc_msg =
|
||||||
|
N_(L"warning: %ls: character(s) following character constant have been ignored");
|
||||||
|
|
||||||
|
double C_STRTOD(wchar_t const *nptr, wchar_t **endptr)
|
||||||
|
{
|
||||||
|
double r;
|
||||||
|
|
||||||
|
const wcstring saved_locale = wsetlocale(LC_NUMERIC, NULL);
|
||||||
|
|
||||||
|
if (!saved_locale.empty())
|
||||||
|
{
|
||||||
|
wsetlocale(LC_NUMERIC, L"C");
|
||||||
|
}
|
||||||
|
|
||||||
|
r = wcstod(nptr, endptr);
|
||||||
|
|
||||||
|
if (!saved_locale.empty())
|
||||||
|
{
|
||||||
|
wsetlocale(LC_NUMERIC, saved_locale.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
void builtin_printf_state_t::fatal_error(const wchar_t *fmt, ...)
|
||||||
|
{
|
||||||
|
// Don't error twice
|
||||||
|
if (early_exit)
|
||||||
|
return;
|
||||||
|
|
||||||
|
va_list va;
|
||||||
|
va_start(va, fmt);
|
||||||
|
wcstring errstr = vformat_string(fmt, va);
|
||||||
|
va_end(va);
|
||||||
|
stderr_buffer.append(errstr);
|
||||||
|
if (! string_suffixes_string(L"\n", errstr))
|
||||||
|
stderr_buffer.push_back(L'\n');
|
||||||
|
|
||||||
|
this->exit_code = STATUS_BUILTIN_ERROR;
|
||||||
|
this->early_exit = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void builtin_printf_state_t::append_output(wchar_t c)
|
||||||
|
{
|
||||||
|
// Don't output if we're done
|
||||||
|
if (early_exit)
|
||||||
|
return;
|
||||||
|
|
||||||
|
stdout_buffer.push_back(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
void builtin_printf_state_t::append_output(const wchar_t *c)
|
||||||
|
{
|
||||||
|
// Don't output if we're done
|
||||||
|
if (early_exit)
|
||||||
|
return;
|
||||||
|
|
||||||
|
stdout_buffer.append(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
void builtin_printf_state_t::append_format_output(const wchar_t *fmt, ...)
|
||||||
|
{
|
||||||
|
// Don't output if we're done
|
||||||
|
if (early_exit)
|
||||||
|
return;
|
||||||
|
|
||||||
|
va_list va;
|
||||||
|
va_start(va, fmt);
|
||||||
|
append_formatv(stdout_buffer, fmt, va);
|
||||||
|
va_end(va);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void builtin_printf_state_t::verify_numeric(const wchar_t *s, const wchar_t *end, int errcode)
|
||||||
|
{
|
||||||
|
if (errcode != 0)
|
||||||
|
{
|
||||||
|
this->fatal_error(L"%ls: %s", s, strerror(errcode));
|
||||||
|
}
|
||||||
|
else if (*end)
|
||||||
|
{
|
||||||
|
if (s == end)
|
||||||
|
this->fatal_error(_(L"%ls: expected a numeric value"), s);
|
||||||
|
else
|
||||||
|
this->fatal_error(_(L"%ls: value not completely converted"), s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
static T raw_string_to_scalar_type(const wchar_t *s, wchar_t ** end);
|
||||||
|
|
||||||
|
// we use wcstoll instead of wcstoimax because FreeBSD 8 has busted wcstoumax and wcstoimax - see #626
|
||||||
|
template<>
|
||||||
|
intmax_t raw_string_to_scalar_type(const wchar_t *s, wchar_t ** end)
|
||||||
|
{
|
||||||
|
return wcstoll(s, end, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
uintmax_t raw_string_to_scalar_type(const wchar_t *s, wchar_t ** end)
|
||||||
|
{
|
||||||
|
return wcstoull(s, end, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
long double raw_string_to_scalar_type(const wchar_t *s, wchar_t ** end)
|
||||||
|
{
|
||||||
|
return C_STRTOD(s, end);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
static T string_to_scalar_type(const wchar_t *s, builtin_printf_state_t *state)
|
||||||
|
{
|
||||||
|
T val;
|
||||||
|
if (*s == L'\"' || *s == L'\'')
|
||||||
|
{
|
||||||
|
wchar_t ch = *++s;
|
||||||
|
val = ch;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wchar_t *end = NULL;
|
||||||
|
errno = 0;
|
||||||
|
val = raw_string_to_scalar_type<T>(s, &end);
|
||||||
|
state->verify_numeric(s, end, errno);
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Output a single-character \ escape. */
|
||||||
|
|
||||||
|
void builtin_printf_state_t::print_esc_char(wchar_t c)
|
||||||
|
{
|
||||||
|
switch (c)
|
||||||
|
{
|
||||||
|
case L'a': /* Alert. */
|
||||||
|
this->append_output(L'\a');
|
||||||
|
break;
|
||||||
|
case L'b': /* Backspace. */
|
||||||
|
this->append_output(L'\b');
|
||||||
|
break;
|
||||||
|
case L'c': /* Cancel the rest of the output. */
|
||||||
|
this->early_exit = true;
|
||||||
|
break;
|
||||||
|
case L'e': /* Escape */
|
||||||
|
this->append_output(L'\x1B');
|
||||||
|
break;
|
||||||
|
case L'f': /* Form feed. */
|
||||||
|
this->append_output(L'\f');
|
||||||
|
break;
|
||||||
|
case L'n': /* New line. */
|
||||||
|
this->append_output(L'\n');
|
||||||
|
break;
|
||||||
|
case L'r': /* Carriage return. */
|
||||||
|
this->append_output(L'\r');
|
||||||
|
break;
|
||||||
|
case L't': /* Horizontal tab. */
|
||||||
|
this->append_output(L'\t');
|
||||||
|
break;
|
||||||
|
case L'v': /* Vertical tab. */
|
||||||
|
this->append_output(L'\v');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
this->append_output(c);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Print a \ escape sequence starting at ESCSTART.
|
||||||
|
Return the number of characters in the escape sequence
|
||||||
|
besides the backslash.
|
||||||
|
If OCTAL_0 is nonzero, octal escapes are of the form \0ooo, where o
|
||||||
|
is an octal digit; otherwise they are of the form \ooo. */
|
||||||
|
long builtin_printf_state_t::print_esc(const wchar_t *escstart, bool octal_0)
|
||||||
|
{
|
||||||
|
const wchar_t *p = escstart + 1;
|
||||||
|
int esc_value = 0; /* Value of \nnn escape. */
|
||||||
|
int esc_length; /* Length of \nnn escape. */
|
||||||
|
|
||||||
|
if (*p == L'x')
|
||||||
|
{
|
||||||
|
/* A hexadecimal \xhh escape sequence must have 1 or 2 hex. digits. */
|
||||||
|
for (esc_length = 0, ++p; esc_length < 2 && is_hex_digit(*p); ++esc_length, ++p)
|
||||||
|
esc_value = esc_value * 16 + hex_to_bin(*p);
|
||||||
|
if (esc_length == 0)
|
||||||
|
this->fatal_error(_(L"missing hexadecimal number in escape"));
|
||||||
|
this->append_output(ENCODE_DIRECT_BASE + esc_value % 256);
|
||||||
|
}
|
||||||
|
else if (is_octal_digit(*p))
|
||||||
|
{
|
||||||
|
/* Parse \0ooo (if octal_0 && *p == L'0') or \ooo (otherwise).
|
||||||
|
Allow \ooo if octal_0 && *p != L'0'; this is an undocumented
|
||||||
|
extension to POSIX that is compatible with Bash 2.05b. */
|
||||||
|
/* Wrap mod 256, which matches historic behavior */
|
||||||
|
for (esc_length = 0, p += octal_0 && *p == L'0'; esc_length < 3 && is_octal_digit(*p); ++esc_length, ++p)
|
||||||
|
esc_value = esc_value * 8 + octal_to_bin(*p);
|
||||||
|
this->append_output(ENCODE_DIRECT_BASE + esc_value % 256);
|
||||||
|
}
|
||||||
|
else if (*p && wcschr(L"\"\\abcefnrtv", *p))
|
||||||
|
{
|
||||||
|
print_esc_char(*p++);
|
||||||
|
}
|
||||||
|
else if (*p == L'u' || *p == L'U')
|
||||||
|
{
|
||||||
|
wchar_t esc_char = *p;
|
||||||
|
p++;
|
||||||
|
uint32_t uni_value = 0;
|
||||||
|
for (size_t esc_length = 0; esc_length < (esc_char == L'u' ? 4 : 8); esc_length++)
|
||||||
|
{
|
||||||
|
if (! is_hex_digit(*p))
|
||||||
|
{
|
||||||
|
/* Escape sequence must be done. Complain if we didn't get anything */
|
||||||
|
if (esc_length == 0)
|
||||||
|
{
|
||||||
|
this->fatal_error(_(L"Missing hexadecimal number in Unicode escape"));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
uni_value = uni_value * 16 + hex_to_bin(*p);
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PCA GNU printf respects the limitations described in ISO N717, about which universal characters "shall not" be specified. I believe this limitation is for the benefit of compilers; I see no reason to impose it in builtin_printf.
|
||||||
|
|
||||||
|
If __STDC_ISO_10646__ is defined, then it means wchar_t can and does hold Unicode code points, so just use that. If not defined, use the %lc printf conversion; this probably won't do anything good if your wide character set is not Unicode, but such platforms are exceedingly rare.
|
||||||
|
*/
|
||||||
|
if (uni_value > 0x10FFFF)
|
||||||
|
{
|
||||||
|
this->fatal_error(_(L"Unicode character out of range: \\%c%0*x"), esc_char, (esc_char == L'u' ? 4 : 8), uni_value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#if defined(__STDC_ISO_10646__)
|
||||||
|
this->append_output(uni_value);
|
||||||
|
#else
|
||||||
|
this->append_format_output(L"%lc", uni_value);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->append_output(L'\\');
|
||||||
|
if (*p)
|
||||||
|
{
|
||||||
|
this->append_output(*p);
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return p - escstart - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Print string STR, evaluating \ escapes. */
|
||||||
|
|
||||||
|
void builtin_printf_state_t::print_esc_string(const wchar_t *str)
|
||||||
|
{
|
||||||
|
for (; *str; str++)
|
||||||
|
if (*str == L'\\')
|
||||||
|
str += print_esc(str, true);
|
||||||
|
else
|
||||||
|
this->append_output(*str);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Evaluate a printf conversion specification. START is the start of
|
||||||
|
the directive, LENGTH is its length, and CONVERSION specifies the
|
||||||
|
type of conversion. LENGTH does not include any length modifier or
|
||||||
|
the conversion specifier itself. FIELD_WIDTH and PRECISION are the
|
||||||
|
field width and precision for '*' values, if HAVE_FIELD_WIDTH and
|
||||||
|
HAVE_PRECISION are true, respectively. ARGUMENT is the argument to
|
||||||
|
be formatted. */
|
||||||
|
|
||||||
|
void builtin_printf_state_t::print_direc(const wchar_t *start, size_t length, wchar_t conversion,
|
||||||
|
bool have_field_width, int field_width,
|
||||||
|
bool have_precision, int precision,
|
||||||
|
wchar_t const *argument)
|
||||||
|
{
|
||||||
|
// Start with everything except the conversion specifier
|
||||||
|
wcstring fmt(start, length);
|
||||||
|
|
||||||
|
/* Create a copy of the % directive, with an intmax_t-wide width modifier substituted for any existing integer length modifier. */
|
||||||
|
switch (conversion)
|
||||||
|
{
|
||||||
|
case L'd':
|
||||||
|
case L'i':
|
||||||
|
case L'u':
|
||||||
|
fmt.append(L"ll");
|
||||||
|
break;
|
||||||
|
case L'a':
|
||||||
|
case L'e':
|
||||||
|
case L'f':
|
||||||
|
case L'g':
|
||||||
|
case L'A':
|
||||||
|
case L'E':
|
||||||
|
case L'F':
|
||||||
|
case L'G':
|
||||||
|
fmt.append(L"L");
|
||||||
|
break;
|
||||||
|
case L's':
|
||||||
|
case L'c':
|
||||||
|
fmt.append(L"l");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Append the conversion itself
|
||||||
|
fmt.push_back(conversion);
|
||||||
|
|
||||||
|
switch (conversion)
|
||||||
|
{
|
||||||
|
case L'd':
|
||||||
|
case L'i':
|
||||||
|
{
|
||||||
|
intmax_t arg = string_to_scalar_type<intmax_t>(argument, this);
|
||||||
|
if (! have_field_width)
|
||||||
|
{
|
||||||
|
if (! have_precision)
|
||||||
|
this->append_format_output(fmt.c_str(), arg);
|
||||||
|
else
|
||||||
|
this->append_format_output(fmt.c_str(), precision, arg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (! have_precision)
|
||||||
|
this->append_format_output(fmt.c_str(), field_width, arg);
|
||||||
|
else
|
||||||
|
this->append_format_output(fmt.c_str(), field_width, precision, arg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case L'o':
|
||||||
|
case L'u':
|
||||||
|
case L'x':
|
||||||
|
case L'X':
|
||||||
|
{
|
||||||
|
uintmax_t arg = string_to_scalar_type<uintmax_t>(argument, this);
|
||||||
|
if (!have_field_width)
|
||||||
|
{
|
||||||
|
if (!have_precision)
|
||||||
|
this->append_format_output(fmt.c_str(), arg);
|
||||||
|
else
|
||||||
|
this->append_format_output(fmt.c_str(), precision, arg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!have_precision)
|
||||||
|
this->append_format_output(fmt.c_str(), field_width, arg);
|
||||||
|
else
|
||||||
|
this->append_format_output(fmt.c_str(), field_width, precision, arg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case L'a':
|
||||||
|
case L'A':
|
||||||
|
case L'e':
|
||||||
|
case L'E':
|
||||||
|
case L'f':
|
||||||
|
case L'F':
|
||||||
|
case L'g':
|
||||||
|
case L'G':
|
||||||
|
{
|
||||||
|
long double arg = string_to_scalar_type<long double>(argument, this);
|
||||||
|
if (!have_field_width)
|
||||||
|
{
|
||||||
|
if (!have_precision)
|
||||||
|
this->append_format_output(fmt.c_str(), arg);
|
||||||
|
else
|
||||||
|
this->append_format_output(fmt.c_str(), precision, arg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!have_precision)
|
||||||
|
this->append_format_output(fmt.c_str(), field_width, arg);
|
||||||
|
else
|
||||||
|
this->append_format_output(fmt.c_str(), field_width, precision, arg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case L'c':
|
||||||
|
if (!have_field_width)
|
||||||
|
this->append_format_output(fmt.c_str(), *argument);
|
||||||
|
else
|
||||||
|
this->append_format_output(fmt.c_str(), field_width, *argument);
|
||||||
|
break;
|
||||||
|
case L's':
|
||||||
|
if (!have_field_width)
|
||||||
|
{
|
||||||
|
if (!have_precision)
|
||||||
|
{
|
||||||
|
this->append_format_output(fmt.c_str(), argument);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
this->append_format_output(fmt.c_str(), precision, argument);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!have_precision)
|
||||||
|
this->append_format_output(fmt.c_str(), field_width, argument);
|
||||||
|
else
|
||||||
|
this->append_format_output(fmt.c_str(), field_width, precision, argument);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* For each character in str, set the corresponding boolean in the array to the given flag */
|
||||||
|
static inline void modify_allowed_format_specifiers(bool ok[UCHAR_MAX + 1], const char *str, bool flag)
|
||||||
|
{
|
||||||
|
for (const char *c = str; *c != '\0'; c++)
|
||||||
|
{
|
||||||
|
unsigned char idx = static_cast<unsigned char>(*c);
|
||||||
|
ok[idx] = flag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Print the text in FORMAT, using ARGV (with ARGC elements) for
|
||||||
|
arguments to any `%' directives.
|
||||||
|
Return the number of elements of ARGV used. */
|
||||||
|
|
||||||
|
int builtin_printf_state_t::print_formatted(const wchar_t *format, int argc, wchar_t **argv)
|
||||||
|
{
|
||||||
|
int save_argc = argc; /* Preserve original value. */
|
||||||
|
const wchar_t *f; /* Pointer into `format'. */
|
||||||
|
const wchar_t *direc_start; /* Start of % directive. */
|
||||||
|
size_t direc_length; /* Length of % directive. */
|
||||||
|
bool have_field_width; /* True if FIELD_WIDTH is valid. */
|
||||||
|
int field_width = 0; /* Arg to first '*'. */
|
||||||
|
bool have_precision; /* True if PRECISION is valid. */
|
||||||
|
int precision = 0; /* Arg to second '*'. */
|
||||||
|
bool ok[UCHAR_MAX + 1] = { }; /* ok['x'] is true if %x is allowed. */
|
||||||
|
|
||||||
|
for (f = format; *f != L'\0'; ++f)
|
||||||
|
{
|
||||||
|
switch (*f)
|
||||||
|
{
|
||||||
|
case L'%':
|
||||||
|
direc_start = f++;
|
||||||
|
direc_length = 1;
|
||||||
|
have_field_width = have_precision = false;
|
||||||
|
if (*f == L'%')
|
||||||
|
{
|
||||||
|
this->append_output(L'%');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (*f == L'b')
|
||||||
|
{
|
||||||
|
/* FIXME: Field width and precision are not supported
|
||||||
|
for %b, even though POSIX requires it. */
|
||||||
|
if (argc > 0)
|
||||||
|
{
|
||||||
|
print_esc_string(*argv);
|
||||||
|
++argv;
|
||||||
|
--argc;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
modify_allowed_format_specifiers(ok, "aAcdeEfFgGiosuxX", true);
|
||||||
|
|
||||||
|
for (;; f++, direc_length++)
|
||||||
|
{
|
||||||
|
switch (*f)
|
||||||
|
{
|
||||||
|
case L'I':
|
||||||
|
case L'\'':
|
||||||
|
modify_allowed_format_specifiers(ok, "aAceEosxX", false);
|
||||||
|
break;
|
||||||
|
case '-':
|
||||||
|
case '+':
|
||||||
|
case ' ':
|
||||||
|
break;
|
||||||
|
case L'#':
|
||||||
|
modify_allowed_format_specifiers(ok, "cdisu", false);
|
||||||
|
break;
|
||||||
|
case '0':
|
||||||
|
modify_allowed_format_specifiers(ok, "cs", false);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
goto no_more_flag_characters;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
no_more_flag_characters:
|
||||||
|
;
|
||||||
|
|
||||||
|
if (*f == L'*')
|
||||||
|
{
|
||||||
|
++f;
|
||||||
|
++direc_length;
|
||||||
|
if (argc > 0)
|
||||||
|
{
|
||||||
|
intmax_t width = string_to_scalar_type<intmax_t>(*argv, this);
|
||||||
|
if (INT_MIN <= width && width <= INT_MAX)
|
||||||
|
field_width = static_cast<int>(width);
|
||||||
|
else
|
||||||
|
this->fatal_error(_(L"invalid field width: %ls"), *argv);
|
||||||
|
++argv;
|
||||||
|
--argc;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
field_width = 0;
|
||||||
|
}
|
||||||
|
have_field_width = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
while (iswdigit(*f))
|
||||||
|
{
|
||||||
|
++f;
|
||||||
|
++direc_length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (*f == L'.')
|
||||||
|
{
|
||||||
|
++f;
|
||||||
|
++direc_length;
|
||||||
|
modify_allowed_format_specifiers(ok, "c", false);
|
||||||
|
if (*f == L'*')
|
||||||
|
{
|
||||||
|
++f;
|
||||||
|
++direc_length;
|
||||||
|
if (argc > 0)
|
||||||
|
{
|
||||||
|
intmax_t prec = string_to_scalar_type<intmax_t>(*argv, this);
|
||||||
|
if (prec < 0)
|
||||||
|
{
|
||||||
|
/* A negative precision is taken as if the
|
||||||
|
precision were omitted, so -1 is safe
|
||||||
|
here even if prec < INT_MIN. */
|
||||||
|
precision = -1;
|
||||||
|
}
|
||||||
|
else if (INT_MAX < prec)
|
||||||
|
this->fatal_error(_(L"invalid precision: %ls"), *argv);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
precision = static_cast<int>(prec);
|
||||||
|
}
|
||||||
|
++argv;
|
||||||
|
--argc;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
precision = 0;
|
||||||
|
}
|
||||||
|
have_precision = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
while (iswdigit(*f))
|
||||||
|
{
|
||||||
|
++f;
|
||||||
|
++direc_length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (*f == L'l' || *f == L'L' || *f == L'h' || *f == L'j' || *f == L't' || *f == L'z')
|
||||||
|
++f;
|
||||||
|
|
||||||
|
{
|
||||||
|
wchar_t conversion = *f;
|
||||||
|
if (conversion > 0xFF || ! ok[conversion])
|
||||||
|
{
|
||||||
|
this->fatal_error(_(L"%.*ls: invalid conversion specification"), (int)(f + 1 - direc_start), direc_start);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print_direc(direc_start, direc_length, *f,
|
||||||
|
have_field_width, field_width,
|
||||||
|
have_precision, precision,
|
||||||
|
(argc <= 0 ? L"" : (argc--, *argv++)));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case L'\\':
|
||||||
|
f += print_esc(f, false);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
this->append_output(*f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return save_argc - argc;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int builtin_printf(parser_t &parser, wchar_t **argv)
|
||||||
|
{
|
||||||
|
builtin_printf_state_t state;
|
||||||
|
|
||||||
|
wchar_t *format;
|
||||||
|
int args_used;
|
||||||
|
int argc = builtin_count_args(argv);
|
||||||
|
|
||||||
|
if (argc <= 1)
|
||||||
|
{
|
||||||
|
state.fatal_error(_(L"printf: not enough arguments"));
|
||||||
|
return STATUS_BUILTIN_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
format = argv[1];
|
||||||
|
argc -= 2;
|
||||||
|
argv += 2;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
args_used = state.print_formatted(format, argc, argv);
|
||||||
|
argc -= args_used;
|
||||||
|
argv += args_used;
|
||||||
|
}
|
||||||
|
while (args_used > 0 && argc > 0 && ! state.early_exit);
|
||||||
|
return state.exit_code;
|
||||||
|
}
|
||||||
1221
builtin_set.cpp
1221
builtin_set.cpp
File diff suppressed because it is too large
Load Diff
243
builtin_set_color.cpp
Normal file
243
builtin_set_color.cpp
Normal file
@@ -0,0 +1,243 @@
|
|||||||
|
/** \file builtin_set_color.cpp Functions defining the set_color builtin
|
||||||
|
|
||||||
|
Functions used for implementing the set_color builtin.
|
||||||
|
|
||||||
|
*/
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "builtin.h"
|
||||||
|
#include "color.h"
|
||||||
|
#include "output.h"
|
||||||
|
|
||||||
|
#if HAVE_NCURSES_H
|
||||||
|
#include <ncurses.h>
|
||||||
|
#elif HAVE_NCURSES_CURSES_H
|
||||||
|
#include <ncurses/curses.h>
|
||||||
|
#else
|
||||||
|
#include <curses.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_TERM_H
|
||||||
|
#include <term.h>
|
||||||
|
#elif HAVE_NCURSES_TERM_H
|
||||||
|
#include <ncurses/term.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* We know about these buffers */
|
||||||
|
extern wcstring stdout_buffer, stderr_buffer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Error message for invalid path operations
|
||||||
|
*/
|
||||||
|
#define BUILTIN_SET_PATH_ERROR L"%ls: Warning: path component %ls may not be valid in %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"
|
||||||
|
|
||||||
|
static void print_colors(void)
|
||||||
|
{
|
||||||
|
const wcstring_list_t result = rgb_color_t::named_color_names();
|
||||||
|
size_t i;
|
||||||
|
for (i=0; i < result.size(); i++)
|
||||||
|
{
|
||||||
|
stdout_buffer.append(result.at(i));
|
||||||
|
stdout_buffer.push_back(L'\n');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* function we set as the output writer */
|
||||||
|
static std::string builtin_set_color_output;
|
||||||
|
static int set_color_builtin_outputter(char c)
|
||||||
|
{
|
||||||
|
ASSERT_IS_MAIN_THREAD();
|
||||||
|
builtin_set_color_output.push_back(c);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
set_color builtin
|
||||||
|
*/
|
||||||
|
static int builtin_set_color(parser_t &parser, wchar_t **argv)
|
||||||
|
{
|
||||||
|
/** Variables used for parsing the argument list */
|
||||||
|
const struct woption long_options[] =
|
||||||
|
{
|
||||||
|
{ L"background", required_argument, 0, 'b'},
|
||||||
|
{ L"help", no_argument, 0, 'h' },
|
||||||
|
{ L"bold", no_argument, 0, 'o' },
|
||||||
|
{ L"underline", no_argument, 0, 'u' },
|
||||||
|
{ L"version", no_argument, 0, 'v' },
|
||||||
|
{ L"print-colors", no_argument, 0, 'c' },
|
||||||
|
{ 0, 0, 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
const wchar_t *short_options = L"b:hvocu";
|
||||||
|
|
||||||
|
int argc = builtin_count_args(argv);
|
||||||
|
|
||||||
|
/* Some code passes variables to set_color that don't exist, like $fish_user_whatever. As a hack, quietly return failure. */
|
||||||
|
if (argc <= 1)
|
||||||
|
{
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
const wchar_t *bgcolor = NULL;
|
||||||
|
bool bold = false, underline=false;
|
||||||
|
int errret;
|
||||||
|
|
||||||
|
/* Parse options to obtain the requested operation and the modifiers */
|
||||||
|
woptind = 0;
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
int c = wgetopt_long(argc, argv, short_options, long_options, 0);
|
||||||
|
|
||||||
|
if (c == -1)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (c)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'b':
|
||||||
|
bgcolor = woptarg;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'h':
|
||||||
|
builtin_print_help(parser, argv[0], stdout_buffer);
|
||||||
|
return STATUS_BUILTIN_OK;
|
||||||
|
|
||||||
|
case 'o':
|
||||||
|
bold = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'u':
|
||||||
|
underline = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'c':
|
||||||
|
print_colors();
|
||||||
|
return STATUS_BUILTIN_OK;
|
||||||
|
|
||||||
|
case '?':
|
||||||
|
return STATUS_BUILTIN_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Remaining arguments are foreground color */
|
||||||
|
std::vector<rgb_color_t> fgcolors;
|
||||||
|
for (; woptind < argc; woptind++)
|
||||||
|
{
|
||||||
|
rgb_color_t fg = rgb_color_t(argv[woptind]);
|
||||||
|
if (fg.is_none() || fg.is_ignore())
|
||||||
|
{
|
||||||
|
append_format(stderr_buffer, _(L"%ls: Unknown color '%ls'\n"), argv[0], argv[woptind]);
|
||||||
|
return STATUS_BUILTIN_ERROR;
|
||||||
|
}
|
||||||
|
fgcolors.push_back(fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fgcolors.empty() && bgcolor == NULL && !bold && !underline)
|
||||||
|
{
|
||||||
|
append_format(stderr_buffer,
|
||||||
|
_(L"%ls: Expected an argument\n"),
|
||||||
|
argv[0]);
|
||||||
|
return STATUS_BUILTIN_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// #1323: We may have multiple foreground colors. Choose the best one.
|
||||||
|
// If we had no foreground coor, we'll get none(); if we have at least one we expect not-none
|
||||||
|
const rgb_color_t fg = best_color(fgcolors, output_get_color_support());
|
||||||
|
assert(fgcolors.empty() || !(fg.is_none() || fg.is_ignore()));
|
||||||
|
|
||||||
|
const rgb_color_t bg = rgb_color_t(bgcolor ? bgcolor : L"");
|
||||||
|
if (bgcolor && (bg.is_none() || bg.is_ignore()))
|
||||||
|
{
|
||||||
|
append_format(stderr_buffer, _(L"%ls: Unknown color '%ls'\n"), argv[0], bgcolor);
|
||||||
|
return STATUS_BUILTIN_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Make sure that the term exists */
|
||||||
|
if (cur_term == NULL && setupterm(0, STDOUT_FILENO, &errret) == ERR)
|
||||||
|
{
|
||||||
|
append_format(stderr_buffer, _(L"%ls: Could not set up terminal\n"), argv[0]);
|
||||||
|
return STATUS_BUILTIN_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Test if we have at least basic support for setting fonts, colors
|
||||||
|
and related bits - otherwise just give up...
|
||||||
|
*/
|
||||||
|
if (! exit_attribute_mode)
|
||||||
|
{
|
||||||
|
return STATUS_BUILTIN_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Save old output function so we can restore it */
|
||||||
|
int (* const saved_writer_func)(char) = output_get_writer();
|
||||||
|
|
||||||
|
/* Set our output function, which writes to a std::string */
|
||||||
|
builtin_set_color_output.clear();
|
||||||
|
output_set_writer(set_color_builtin_outputter);
|
||||||
|
|
||||||
|
if (bold)
|
||||||
|
{
|
||||||
|
if (enter_bold_mode)
|
||||||
|
writembs(tparm(enter_bold_mode));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (underline)
|
||||||
|
{
|
||||||
|
if (enter_underline_mode)
|
||||||
|
writembs(enter_underline_mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bgcolor != NULL)
|
||||||
|
{
|
||||||
|
if (bg.is_normal())
|
||||||
|
{
|
||||||
|
write_color(rgb_color_t::black(), false /* not is_fg */);
|
||||||
|
writembs(tparm(exit_attribute_mode));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! fg.is_none())
|
||||||
|
{
|
||||||
|
if (fg.is_normal() || fg.is_reset())
|
||||||
|
{
|
||||||
|
write_color(rgb_color_t::black(), true /* is_fg */);
|
||||||
|
writembs(tparm(exit_attribute_mode));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
write_color(fg, true /* is_fg */);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bgcolor != NULL)
|
||||||
|
{
|
||||||
|
if (! bg.is_normal() && ! bg.is_reset())
|
||||||
|
{
|
||||||
|
write_color(bg, false /* not is_fg */);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Restore saved writer function */
|
||||||
|
output_set_writer(saved_writer_func);
|
||||||
|
|
||||||
|
/* Output the collected string */
|
||||||
|
stdout_buffer.append(str2wcstring(builtin_set_color_output));
|
||||||
|
builtin_set_color_output.clear();
|
||||||
|
|
||||||
|
return STATUS_BUILTIN_OK;
|
||||||
|
}
|
||||||
1553
builtin_test.cpp
1553
builtin_test.cpp
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
/** \file builtin_ulimit.c Functions defining the ulimit builtin
|
/** \file builtin_ulimit.c Functions defining the ulimit builtin
|
||||||
|
|
||||||
Functions used for implementing the ulimit builtin.
|
Functions used for implementing the ulimit builtin.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@@ -27,99 +27,99 @@ Functions used for implementing the ulimit builtin.
|
|||||||
*/
|
*/
|
||||||
struct resource_t
|
struct resource_t
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
Resource id
|
Resource id
|
||||||
*/
|
*/
|
||||||
int resource;
|
int resource;
|
||||||
/**
|
/**
|
||||||
Description of resource
|
Description of resource
|
||||||
*/
|
*/
|
||||||
const wchar_t *desc;
|
const wchar_t *desc;
|
||||||
/**
|
/**
|
||||||
Switch used on commandline to specify resource
|
Switch used on commandline to specify resource
|
||||||
*/
|
*/
|
||||||
wchar_t switch_char;
|
wchar_t switch_char;
|
||||||
/**
|
/**
|
||||||
The implicit multiplier used when setting getting values
|
The implicit multiplier used when setting getting values
|
||||||
*/
|
*/
|
||||||
int multiplier;
|
int multiplier;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Array of resource_t structs, describing all known resource types.
|
Array of resource_t structs, describing all known resource types.
|
||||||
*/
|
*/
|
||||||
static const struct resource_t resource_arr[] =
|
static const struct resource_t resource_arr[] =
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
RLIMIT_CORE, L"Maximum size of core files created", L'c', 1024
|
RLIMIT_CORE, L"Maximum size of core files created", L'c', 1024
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
RLIMIT_DATA, L"Maximum size of a process’s data segment", L'd', 1024
|
RLIMIT_DATA, L"Maximum size of a process’s data segment", L'd', 1024
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
RLIMIT_FSIZE, L"Maximum size of files created by the shell", L'f', 1024
|
RLIMIT_FSIZE, L"Maximum size of files created by the shell", L'f', 1024
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
#ifdef RLIMIT_MEMLOCK
|
#ifdef RLIMIT_MEMLOCK
|
||||||
{
|
{
|
||||||
RLIMIT_MEMLOCK, L"Maximum size that may be locked into memory", L'l', 1024
|
RLIMIT_MEMLOCK, L"Maximum size that may be locked into memory", L'l', 1024
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
#endif
|
#endif
|
||||||
#ifdef RLIMIT_RSS
|
#ifdef RLIMIT_RSS
|
||||||
{
|
{
|
||||||
RLIMIT_RSS, L"Maximum resident set size", L'm', 1024
|
RLIMIT_RSS, L"Maximum resident set size", L'm', 1024
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
RLIMIT_NOFILE, L"Maximum number of open file descriptors", L'n', 1
|
RLIMIT_NOFILE, L"Maximum number of open file descriptors", L'n', 1
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
RLIMIT_STACK, L"Maximum stack size", L's', 1024
|
RLIMIT_STACK, L"Maximum stack size", L's', 1024
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
RLIMIT_CPU, L"Maximum amount of cpu time in seconds", L't', 1
|
RLIMIT_CPU, L"Maximum amount of cpu time in seconds", L't', 1
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
#ifdef RLIMIT_NPROC
|
#ifdef RLIMIT_NPROC
|
||||||
{
|
{
|
||||||
RLIMIT_NPROC, L"Maximum number of processes available to a single user", L'u', 1
|
RLIMIT_NPROC, L"Maximum number of processes available to a single user", L'u', 1
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
#endif
|
#endif
|
||||||
#ifdef RLIMIT_AS
|
#ifdef RLIMIT_AS
|
||||||
{
|
{
|
||||||
RLIMIT_AS, L"Maximum amount of virtual memory available to the shell", L'v', 1024
|
RLIMIT_AS, L"Maximum amount of virtual memory available to the shell", L'v', 1024
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
0, 0, 0, 0
|
0, 0, 0, 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the implicit multiplication factor for the specified resource limit
|
Get the implicit multiplication factor for the specified resource limit
|
||||||
*/
|
*/
|
||||||
static int get_multiplier( int what )
|
static int get_multiplier(int what)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for( i=0; resource_arr[i].desc; i++ )
|
for (i=0; resource_arr[i].desc; i++)
|
||||||
{
|
{
|
||||||
if( resource_arr[i].resource == what )
|
if (resource_arr[i].resource == what)
|
||||||
{
|
{
|
||||||
return resource_arr[i].multiplier;
|
return resource_arr[i].multiplier;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -127,85 +127,85 @@ static int get_multiplier( int what )
|
|||||||
does _not_ multiply the limit value by the multiplier constant used
|
does _not_ multiply the limit value by the multiplier constant used
|
||||||
by the commandline ulimit.
|
by the commandline ulimit.
|
||||||
*/
|
*/
|
||||||
static rlim_t get( int resource, int hard )
|
static rlim_t get(int resource, int hard)
|
||||||
{
|
{
|
||||||
struct rlimit ls;
|
struct rlimit ls;
|
||||||
|
|
||||||
getrlimit( resource, &ls );
|
getrlimit(resource, &ls);
|
||||||
|
|
||||||
return hard ? ls.rlim_max:ls.rlim_cur;
|
return hard ? ls.rlim_max:ls.rlim_cur;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Print the value of the specified resource limit
|
Print the value of the specified resource limit
|
||||||
*/
|
*/
|
||||||
static void print( int resource, int hard )
|
static void print(int resource, int hard)
|
||||||
{
|
{
|
||||||
rlim_t l = get( resource, hard );
|
rlim_t l = get(resource, hard);
|
||||||
|
|
||||||
|
if (l == RLIM_INFINITY)
|
||||||
|
stdout_buffer.append(L"unlimited\n");
|
||||||
|
else
|
||||||
|
append_format(stdout_buffer, L"%d\n", l / get_multiplier(resource));
|
||||||
|
|
||||||
if( l == RLIM_INFINITY )
|
|
||||||
stdout_buffer.append( L"unlimited\n" );
|
|
||||||
else
|
|
||||||
append_format(stdout_buffer, L"%d\n", l / get_multiplier( resource ) );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Print values of all resource limits
|
Print values of all resource limits
|
||||||
*/
|
*/
|
||||||
static void print_all( int hard )
|
static void print_all(int hard)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int w=0;
|
int w=0;
|
||||||
|
|
||||||
for( i=0; resource_arr[i].desc; i++ )
|
for (i=0; resource_arr[i].desc; i++)
|
||||||
{
|
{
|
||||||
w=maxi( w, my_wcswidth(resource_arr[i].desc));
|
w=maxi(w, fish_wcswidth(resource_arr[i].desc));
|
||||||
}
|
}
|
||||||
|
|
||||||
for( i=0; resource_arr[i].desc; i++ )
|
for (i=0; resource_arr[i].desc; i++)
|
||||||
{
|
{
|
||||||
struct rlimit ls;
|
struct rlimit ls;
|
||||||
rlim_t l;
|
rlim_t l;
|
||||||
getrlimit( resource_arr[i].resource, &ls );
|
getrlimit(resource_arr[i].resource, &ls);
|
||||||
l = hard ? ls.rlim_max:ls.rlim_cur;
|
l = hard ? ls.rlim_max:ls.rlim_cur;
|
||||||
|
|
||||||
|
const wchar_t *unit = ((resource_arr[i].resource==RLIMIT_CPU)?L"(seconds, ":(get_multiplier(resource_arr[i].resource)==1?L"(":L"(kB, "));
|
||||||
|
|
||||||
|
append_format(stdout_buffer,
|
||||||
|
L"%-*ls %10ls-%lc) ",
|
||||||
|
w,
|
||||||
|
resource_arr[i].desc,
|
||||||
|
unit,
|
||||||
|
resource_arr[i].switch_char);
|
||||||
|
|
||||||
|
if (l == RLIM_INFINITY)
|
||||||
|
{
|
||||||
|
stdout_buffer.append(L"unlimited\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
append_format(stdout_buffer, L"%d\n", l/get_multiplier(resource_arr[i].resource));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const wchar_t *unit = ((resource_arr[i].resource==RLIMIT_CPU)?L"(seconds, ":(get_multiplier(resource_arr[i].resource)==1?L"(":L"(kB, "));
|
|
||||||
|
|
||||||
append_format(stdout_buffer,
|
|
||||||
L"%-*ls %10ls-%lc) ",
|
|
||||||
w,
|
|
||||||
resource_arr[i].desc,
|
|
||||||
unit,
|
|
||||||
resource_arr[i].switch_char);
|
|
||||||
|
|
||||||
if( l == RLIM_INFINITY )
|
|
||||||
{
|
|
||||||
stdout_buffer.append( L"unlimited\n" );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
append_format(stdout_buffer, L"%d\n", l/get_multiplier(resource_arr[i].resource) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the description for the specified resource limit
|
Returns the description for the specified resource limit
|
||||||
*/
|
*/
|
||||||
static const wchar_t *get_desc( int what )
|
static const wchar_t *get_desc(int what)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for( i=0; resource_arr[i].desc; i++ )
|
for (i=0; resource_arr[i].desc; i++)
|
||||||
{
|
{
|
||||||
if( resource_arr[i].resource == what )
|
if (resource_arr[i].resource == what)
|
||||||
{
|
{
|
||||||
return resource_arr[i].desc;
|
return resource_arr[i].desc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return L"Not a resource";
|
return L"Not a resource";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -213,300 +213,300 @@ static const wchar_t *get_desc( int what )
|
|||||||
does _not_ multiply the limit value by the multiplier constant used
|
does _not_ multiply the limit value by the multiplier constant used
|
||||||
by the commandline ulimit.
|
by the commandline ulimit.
|
||||||
*/
|
*/
|
||||||
static int set( int resource, int hard, int soft, rlim_t value )
|
static int set(int resource, int hard, int soft, rlim_t value)
|
||||||
{
|
{
|
||||||
struct rlimit ls;
|
struct rlimit ls;
|
||||||
getrlimit( resource, &ls );
|
getrlimit(resource, &ls);
|
||||||
|
|
||||||
if( hard )
|
if (hard)
|
||||||
{
|
{
|
||||||
ls.rlim_max = value;
|
ls.rlim_max = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( soft )
|
if (soft)
|
||||||
{
|
{
|
||||||
ls.rlim_cur = value;
|
ls.rlim_cur = value;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Do not attempt to set the soft limit higher than the hard limit
|
Do not attempt to set the soft limit higher than the hard limit
|
||||||
*/
|
*/
|
||||||
if( ( value == RLIM_INFINITY && ls.rlim_max != RLIM_INFINITY ) ||
|
if ((value == RLIM_INFINITY && ls.rlim_max != RLIM_INFINITY) ||
|
||||||
( value != RLIM_INFINITY && ls.rlim_max != RLIM_INFINITY && value > ls.rlim_max))
|
(value != RLIM_INFINITY && ls.rlim_max != RLIM_INFINITY && value > ls.rlim_max))
|
||||||
{
|
{
|
||||||
ls.rlim_cur = ls.rlim_max;
|
ls.rlim_cur = ls.rlim_max;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( setrlimit( resource, &ls ) )
|
if (setrlimit(resource, &ls))
|
||||||
{
|
{
|
||||||
if( errno == EPERM )
|
if (errno == EPERM)
|
||||||
append_format(stderr_buffer, L"ulimit: Permission denied when changing resource of type '%ls'\n", get_desc( resource ) );
|
append_format(stderr_buffer, L"ulimit: Permission denied when changing resource of type '%ls'\n", get_desc(resource));
|
||||||
else
|
else
|
||||||
builtin_wperror( L"ulimit" );
|
builtin_wperror(L"ulimit");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The ulimit builtin, used for setting resource limits. Defined in
|
The ulimit builtin, used for setting resource limits. Defined in
|
||||||
builtin_ulimit.c.
|
builtin_ulimit.c.
|
||||||
*/
|
*/
|
||||||
static int builtin_ulimit( parser_t &parser, wchar_t ** argv )
|
static int builtin_ulimit(parser_t &parser, wchar_t ** argv)
|
||||||
{
|
{
|
||||||
int hard=0;
|
int hard=0;
|
||||||
int soft=0;
|
int soft=0;
|
||||||
|
|
||||||
int what = RLIMIT_FSIZE;
|
|
||||||
int report_all = 0;
|
|
||||||
|
|
||||||
int argc = builtin_count_args( argv );
|
int what = RLIMIT_FSIZE;
|
||||||
|
int report_all = 0;
|
||||||
woptind=0;
|
|
||||||
|
|
||||||
while( 1 )
|
|
||||||
{
|
|
||||||
static const struct woption
|
|
||||||
long_options[] =
|
|
||||||
{
|
|
||||||
{
|
|
||||||
L"all", no_argument, 0, 'a'
|
|
||||||
}
|
|
||||||
,
|
|
||||||
{
|
|
||||||
L"hard", no_argument, 0, 'H'
|
|
||||||
}
|
|
||||||
,
|
|
||||||
{
|
|
||||||
L"soft", no_argument, 0, 'S'
|
|
||||||
}
|
|
||||||
,
|
|
||||||
{
|
|
||||||
L"core-size", no_argument, 0, 'c'
|
|
||||||
}
|
|
||||||
,
|
|
||||||
{
|
|
||||||
L"data-size", no_argument, 0, 'd'
|
|
||||||
}
|
|
||||||
,
|
|
||||||
{
|
|
||||||
L"file-size", no_argument, 0, 'f'
|
|
||||||
}
|
|
||||||
,
|
|
||||||
{
|
|
||||||
L"lock-size", no_argument, 0, 'l'
|
|
||||||
}
|
|
||||||
,
|
|
||||||
{
|
|
||||||
L"resident-set-size", no_argument, 0, 'm'
|
|
||||||
}
|
|
||||||
,
|
|
||||||
{
|
|
||||||
L"file-descriptor-count", no_argument, 0, 'n'
|
|
||||||
}
|
|
||||||
,
|
|
||||||
{
|
|
||||||
L"stack-size", no_argument, 0, 's'
|
|
||||||
}
|
|
||||||
,
|
|
||||||
{
|
|
||||||
L"cpu-time", no_argument, 0, 't'
|
|
||||||
}
|
|
||||||
,
|
|
||||||
{
|
|
||||||
L"process-count", no_argument, 0, 'u'
|
|
||||||
}
|
|
||||||
,
|
|
||||||
{
|
|
||||||
L"virtual-memory-size", no_argument, 0, 'v'
|
|
||||||
}
|
|
||||||
,
|
|
||||||
{
|
|
||||||
L"help", no_argument, 0, 'h'
|
|
||||||
}
|
|
||||||
,
|
|
||||||
{
|
|
||||||
0, 0, 0, 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
int opt_index = 0;
|
int argc = builtin_count_args(argv);
|
||||||
|
|
||||||
int opt = wgetopt_long( argc,
|
woptind=0;
|
||||||
argv,
|
|
||||||
L"aHScdflmnstuvh",
|
while (1)
|
||||||
long_options,
|
{
|
||||||
&opt_index );
|
static const struct woption
|
||||||
if( opt == -1 )
|
long_options[] =
|
||||||
break;
|
{
|
||||||
|
{
|
||||||
switch( opt )
|
L"all", no_argument, 0, 'a'
|
||||||
{
|
}
|
||||||
case 0:
|
,
|
||||||
if(long_options[opt_index].flag != 0)
|
{
|
||||||
break;
|
L"hard", no_argument, 0, 'H'
|
||||||
|
}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
L"soft", no_argument, 0, 'S'
|
||||||
|
}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
L"core-size", no_argument, 0, 'c'
|
||||||
|
}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
L"data-size", no_argument, 0, 'd'
|
||||||
|
}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
L"file-size", no_argument, 0, 'f'
|
||||||
|
}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
L"lock-size", no_argument, 0, 'l'
|
||||||
|
}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
L"resident-set-size", no_argument, 0, 'm'
|
||||||
|
}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
L"file-descriptor-count", no_argument, 0, 'n'
|
||||||
|
}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
L"stack-size", no_argument, 0, 's'
|
||||||
|
}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
L"cpu-time", no_argument, 0, 't'
|
||||||
|
}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
L"process-count", no_argument, 0, 'u'
|
||||||
|
}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
L"virtual-memory-size", no_argument, 0, 'v'
|
||||||
|
}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
L"help", no_argument, 0, 'h'
|
||||||
|
}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
0, 0, 0, 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
int opt_index = 0;
|
||||||
|
|
||||||
|
int opt = wgetopt_long(argc,
|
||||||
|
argv,
|
||||||
|
L"aHScdflmnstuvh",
|
||||||
|
long_options,
|
||||||
|
&opt_index);
|
||||||
|
if (opt == -1)
|
||||||
|
break;
|
||||||
|
|
||||||
|
switch (opt)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
if (long_options[opt_index].flag != 0)
|
||||||
|
break;
|
||||||
append_format(stderr_buffer,
|
append_format(stderr_buffer,
|
||||||
BUILTIN_ERR_UNKNOWN,
|
BUILTIN_ERR_UNKNOWN,
|
||||||
argv[0],
|
argv[0],
|
||||||
long_options[opt_index].name );
|
long_options[opt_index].name);
|
||||||
builtin_print_help( parser, argv[0], stderr_buffer );
|
builtin_print_help(parser, argv[0], stderr_buffer);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case L'a':
|
|
||||||
report_all=1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case L'H':
|
case L'a':
|
||||||
hard=1;
|
report_all=1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case L'S':
|
case L'H':
|
||||||
soft=1;
|
hard=1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case L'c':
|
case L'S':
|
||||||
what=RLIMIT_CORE;
|
soft=1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case L'd':
|
case L'c':
|
||||||
what=RLIMIT_DATA;
|
what=RLIMIT_CORE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case L'f':
|
case L'd':
|
||||||
what=RLIMIT_FSIZE;
|
what=RLIMIT_DATA;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case L'f':
|
||||||
|
what=RLIMIT_FSIZE;
|
||||||
|
break;
|
||||||
#ifdef RLIMIT_MEMLOCK
|
#ifdef RLIMIT_MEMLOCK
|
||||||
case L'l':
|
case L'l':
|
||||||
what=RLIMIT_MEMLOCK;
|
what=RLIMIT_MEMLOCK;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RLIMIT_RSS
|
#ifdef RLIMIT_RSS
|
||||||
case L'm':
|
case L'm':
|
||||||
what=RLIMIT_RSS;
|
what=RLIMIT_RSS;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case L'n':
|
|
||||||
what=RLIMIT_NOFILE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case L's':
|
|
||||||
what=RLIMIT_STACK;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case L't':
|
|
||||||
what=RLIMIT_CPU;
|
|
||||||
break;
|
|
||||||
|
|
||||||
#ifdef RLIMIT_NPROC
|
|
||||||
case L'u':
|
|
||||||
what=RLIMIT_NPROC;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RLIMIT_AS
|
|
||||||
case L'v':
|
|
||||||
what=RLIMIT_AS;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
case L'h':
|
|
||||||
builtin_print_help( parser, argv[0], stdout_buffer );
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
case L'?':
|
case L'n':
|
||||||
builtin_unknown_option( parser, argv[0], argv[woptind-1] );
|
what=RLIMIT_NOFILE;
|
||||||
return 1;
|
break;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( report_all )
|
case L's':
|
||||||
{
|
what=RLIMIT_STACK;
|
||||||
if( argc - woptind == 0 )
|
break;
|
||||||
{
|
|
||||||
print_all( hard );
|
case L't':
|
||||||
}
|
what=RLIMIT_CPU;
|
||||||
else
|
break;
|
||||||
{
|
|
||||||
|
#ifdef RLIMIT_NPROC
|
||||||
|
case L'u':
|
||||||
|
what=RLIMIT_NPROC;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef RLIMIT_AS
|
||||||
|
case L'v':
|
||||||
|
what=RLIMIT_AS;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
case L'h':
|
||||||
|
builtin_print_help(parser, argv[0], stdout_buffer);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
case L'?':
|
||||||
|
builtin_unknown_option(parser, argv[0], argv[woptind-1]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (report_all)
|
||||||
|
{
|
||||||
|
if (argc - woptind == 0)
|
||||||
|
{
|
||||||
|
print_all(hard);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
stderr_buffer.append(argv[0]);
|
stderr_buffer.append(argv[0]);
|
||||||
stderr_buffer.append(L": Too many arguments\n");
|
stderr_buffer.append(L": Too many arguments\n");
|
||||||
builtin_print_help( parser, argv[0], stderr_buffer );
|
builtin_print_help(parser, argv[0], stderr_buffer);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( argc - woptind )
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
Show current limit value
|
|
||||||
*/
|
|
||||||
print( what, hard );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
Change current limit value
|
|
||||||
*/
|
|
||||||
rlim_t new_limit;
|
|
||||||
wchar_t *end;
|
|
||||||
|
|
||||||
/*
|
switch (argc - woptind)
|
||||||
Set both hard and soft limits if nothing else was specified
|
{
|
||||||
*/
|
case 0:
|
||||||
if( !(hard+soft) )
|
{
|
||||||
{
|
/*
|
||||||
hard=soft=1;
|
Show current limit value
|
||||||
}
|
*/
|
||||||
|
print(what, hard);
|
||||||
if( wcscasecmp( argv[woptind], L"unlimited" )==0)
|
break;
|
||||||
{
|
}
|
||||||
new_limit = RLIM_INFINITY;
|
|
||||||
}
|
case 1:
|
||||||
else if( wcscasecmp( argv[woptind], L"hard" )==0)
|
{
|
||||||
{
|
/*
|
||||||
new_limit = get( what, 1 );
|
Change current limit value
|
||||||
}
|
*/
|
||||||
else if( wcscasecmp( argv[woptind], L"soft" )==0)
|
rlim_t new_limit;
|
||||||
{
|
wchar_t *end;
|
||||||
new_limit = get( what, soft );
|
|
||||||
}
|
/*
|
||||||
else
|
Set both hard and soft limits if nothing else was specified
|
||||||
{
|
*/
|
||||||
errno=0;
|
if (!(hard+soft))
|
||||||
new_limit = wcstol( argv[woptind], &end, 10 );
|
{
|
||||||
if( errno || *end )
|
hard=soft=1;
|
||||||
{
|
}
|
||||||
append_format(stderr_buffer,
|
|
||||||
L"%ls: Invalid limit '%ls'\n",
|
if (wcscasecmp(argv[woptind], L"unlimited")==0)
|
||||||
argv[0],
|
{
|
||||||
argv[woptind] );
|
new_limit = RLIM_INFINITY;
|
||||||
builtin_print_help( parser, argv[0], stderr_buffer );
|
}
|
||||||
return 1;
|
else if (wcscasecmp(argv[woptind], L"hard")==0)
|
||||||
}
|
{
|
||||||
new_limit *= get_multiplier( what );
|
new_limit = get(what, 1);
|
||||||
}
|
}
|
||||||
|
else if (wcscasecmp(argv[woptind], L"soft")==0)
|
||||||
return set( what, hard, soft, new_limit );
|
{
|
||||||
}
|
new_limit = get(what, soft);
|
||||||
|
}
|
||||||
default:
|
else
|
||||||
{
|
{
|
||||||
|
errno=0;
|
||||||
|
new_limit = wcstol(argv[woptind], &end, 10);
|
||||||
|
if (errno || *end)
|
||||||
|
{
|
||||||
|
append_format(stderr_buffer,
|
||||||
|
L"%ls: Invalid limit '%ls'\n",
|
||||||
|
argv[0],
|
||||||
|
argv[woptind]);
|
||||||
|
builtin_print_help(parser, argv[0], stderr_buffer);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
new_limit *= get_multiplier(what);
|
||||||
|
}
|
||||||
|
|
||||||
|
return set(what, hard, soft, new_limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
stderr_buffer.append(argv[0]);
|
stderr_buffer.append(argv[0]);
|
||||||
stderr_buffer.append(L": Too many arguments\n");
|
stderr_buffer.append(L": Too many arguments\n");
|
||||||
builtin_print_help( parser, argv[0], stderr_buffer );
|
builtin_print_help(parser, argv[0], stderr_buffer);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
297
color.cpp
297
color.cpp
@@ -4,40 +4,73 @@
|
|||||||
#include "color.h"
|
#include "color.h"
|
||||||
#include "fallback.h"
|
#include "fallback.h"
|
||||||
|
|
||||||
bool rgb_color_t::try_parse_special(const wcstring &special) {
|
bool rgb_color_t::try_parse_special(const wcstring &special)
|
||||||
bzero(&data, sizeof data);
|
{
|
||||||
|
memset(&data, 0, sizeof data);
|
||||||
const wchar_t *name = special.c_str();
|
const wchar_t *name = special.c_str();
|
||||||
if (! wcscasecmp(name, L"normal")) {
|
if (! wcscasecmp(name, L"normal"))
|
||||||
|
{
|
||||||
this->type = type_normal;
|
this->type = type_normal;
|
||||||
} else if (! wcscasecmp(name, L"reset")) {
|
}
|
||||||
|
else if (! wcscasecmp(name, L"reset"))
|
||||||
|
{
|
||||||
this->type = type_reset;
|
this->type = type_reset;
|
||||||
} else if (! wcscasecmp(name, L"ignore")) {
|
}
|
||||||
|
else if (! wcscasecmp(name, L"ignore"))
|
||||||
|
{
|
||||||
this->type = type_ignore;
|
this->type = type_ignore;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->type = type_none;
|
this->type = type_none;
|
||||||
}
|
}
|
||||||
return this->type != type_none;
|
return this->type != type_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int parse_hex_digit(wchar_t x) {
|
static int parse_hex_digit(wchar_t x)
|
||||||
switch (x) {
|
{
|
||||||
case L'0': return 0x0;
|
switch (x)
|
||||||
case L'1': return 0x1;
|
{
|
||||||
case L'2': return 0x2;
|
case L'0':
|
||||||
case L'3': return 0x3;
|
return 0x0;
|
||||||
case L'4': return 0x4;
|
case L'1':
|
||||||
case L'5': return 0x5;
|
return 0x1;
|
||||||
case L'6': return 0x6;
|
case L'2':
|
||||||
case L'7': return 0x7;
|
return 0x2;
|
||||||
case L'8': return 0x8;
|
case L'3':
|
||||||
case L'9': return 0x9;
|
return 0x3;
|
||||||
case L'a':case L'A': return 0xA;
|
case L'4':
|
||||||
case L'b':case L'B': return 0xB;
|
return 0x4;
|
||||||
case L'c':case L'C': return 0xC;
|
case L'5':
|
||||||
case L'd':case L'D': return 0xD;
|
return 0x5;
|
||||||
case L'e':case L'E': return 0xE;
|
case L'6':
|
||||||
case L'f':case L'F': return 0xF;
|
return 0x6;
|
||||||
default: return -1;
|
case L'7':
|
||||||
|
return 0x7;
|
||||||
|
case L'8':
|
||||||
|
return 0x8;
|
||||||
|
case L'9':
|
||||||
|
return 0x9;
|
||||||
|
case L'a':
|
||||||
|
case L'A':
|
||||||
|
return 0xA;
|
||||||
|
case L'b':
|
||||||
|
case L'B':
|
||||||
|
return 0xB;
|
||||||
|
case L'c':
|
||||||
|
case L'C':
|
||||||
|
return 0xC;
|
||||||
|
case L'd':
|
||||||
|
case L'D':
|
||||||
|
return 0xD;
|
||||||
|
case L'e':
|
||||||
|
case L'E':
|
||||||
|
return 0xE;
|
||||||
|
case L'f':
|
||||||
|
case L'F':
|
||||||
|
return 0xF;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,15 +80,18 @@ static unsigned long squared_difference(long p1, long p2)
|
|||||||
return diff * diff;
|
return diff * diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned char convert_color(const unsigned char rgb[3], const uint32_t *colors, size_t color_count) {
|
static unsigned char convert_color(const unsigned char rgb[3], const uint32_t *colors, size_t color_count)
|
||||||
|
{
|
||||||
long r = rgb[0], g = rgb[1], b = rgb[2];
|
long r = rgb[0], g = rgb[1], b = rgb[2];
|
||||||
unsigned long best_distance = (unsigned long)(-1);
|
unsigned long best_distance = (unsigned long)(-1);
|
||||||
unsigned char best_index = (unsigned char)(-1);
|
unsigned char best_index = (unsigned char)(-1);
|
||||||
for (unsigned char idx = 0; idx < color_count; idx++) {
|
for (unsigned char idx = 0; idx < color_count; idx++)
|
||||||
|
{
|
||||||
uint32_t color = colors[idx];
|
uint32_t color = colors[idx];
|
||||||
long test_r = (color >> 16) & 0xFF, test_g = (color >> 8) & 0xFF, test_b = (color >> 0) & 0xFF;
|
long test_r = (color >> 16) & 0xFF, test_g = (color >> 8) & 0xFF, test_b = (color >> 0) & 0xFF;
|
||||||
unsigned long distance = squared_difference(r, test_r) + squared_difference(g, test_g) + squared_difference(b, test_b);
|
unsigned long distance = squared_difference(r, test_r) + squared_difference(g, test_g) + squared_difference(b, test_b);
|
||||||
if (distance <= best_distance) {
|
if (distance <= best_distance)
|
||||||
|
{
|
||||||
best_index = idx;
|
best_index = idx;
|
||||||
best_distance = distance;
|
best_distance = distance;
|
||||||
}
|
}
|
||||||
@@ -64,54 +100,63 @@ static unsigned char convert_color(const unsigned char rgb[3], const uint32_t *c
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rgb_color_t::try_parse_rgb(const wcstring &name) {
|
bool rgb_color_t::try_parse_rgb(const wcstring &name)
|
||||||
bzero(&data, sizeof data);
|
{
|
||||||
|
memset(&data, 0, sizeof data);
|
||||||
/* We support the following style of rgb formats (case insensitive):
|
/* We support the following style of rgb formats (case insensitive):
|
||||||
#FA3
|
#FA3
|
||||||
#F3A035
|
#F3A035
|
||||||
FA3
|
FA3
|
||||||
F3A035
|
F3A035
|
||||||
*/
|
*/
|
||||||
|
|
||||||
size_t digit_idx = 0, len = name.size();
|
size_t digit_idx = 0, len = name.size();
|
||||||
|
|
||||||
/* Skip any leading # */
|
/* Skip any leading # */
|
||||||
if (len > 0 && name.at(0) == L'#')
|
if (len > 0 && name.at(0) == L'#')
|
||||||
digit_idx++;
|
digit_idx++;
|
||||||
|
|
||||||
bool success = false;
|
bool success = false;
|
||||||
size_t i;
|
size_t i;
|
||||||
if (len - digit_idx == 3) {
|
if (len - digit_idx == 3)
|
||||||
|
{
|
||||||
// type FA3
|
// type FA3
|
||||||
for (i=0; i < 3; i++) {
|
for (i=0; i < 3; i++)
|
||||||
|
{
|
||||||
int val = parse_hex_digit(name.at(digit_idx++));
|
int val = parse_hex_digit(name.at(digit_idx++));
|
||||||
if (val < 0) break;
|
if (val < 0) break;
|
||||||
data.rgb[i] = val*16+val;
|
data.color.rgb[i] = val*16+val;
|
||||||
}
|
}
|
||||||
success = (i == 3);
|
success = (i == 3);
|
||||||
} else if (len - digit_idx == 6) {
|
}
|
||||||
|
else if (len - digit_idx == 6)
|
||||||
|
{
|
||||||
// type F3A035
|
// type F3A035
|
||||||
for (i=0; i < 3; i++) {
|
for (i=0; i < 3; i++)
|
||||||
|
{
|
||||||
int hi = parse_hex_digit(name.at(digit_idx++));
|
int hi = parse_hex_digit(name.at(digit_idx++));
|
||||||
int lo = parse_hex_digit(name.at(digit_idx++));
|
int lo = parse_hex_digit(name.at(digit_idx++));
|
||||||
if (lo < 0 || hi < 0) break;
|
if (lo < 0 || hi < 0) break;
|
||||||
data.rgb[i] = hi*16+lo;
|
data.color.rgb[i] = hi*16+lo;
|
||||||
}
|
}
|
||||||
success = (i == 3);
|
success = (i == 3);
|
||||||
}
|
}
|
||||||
if (success) {
|
if (success)
|
||||||
|
{
|
||||||
this->type = type_rgb;
|
this->type = type_rgb;
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct named_color_t {
|
struct named_color_t
|
||||||
|
{
|
||||||
const wchar_t * name;
|
const wchar_t * name;
|
||||||
unsigned char idx;
|
unsigned char idx;
|
||||||
unsigned char rgb[3];
|
unsigned char rgb[3];
|
||||||
};
|
};
|
||||||
|
|
||||||
static const named_color_t named_colors[11] = {
|
static const named_color_t named_colors[11] =
|
||||||
|
{
|
||||||
{L"black", 0, {0, 0, 0}},
|
{L"black", 0, {0, 0, 0}},
|
||||||
{L"red", 1, {0xFF, 0, 0}},
|
{L"red", 1, {0xFF, 0, 0}},
|
||||||
{L"green", 2, {0, 0xFF, 0}},
|
{L"green", 2, {0, 0xFF, 0}},
|
||||||
@@ -125,11 +170,26 @@ static const named_color_t named_colors[11] = {
|
|||||||
{L"normal", 8, {0xFF, 0xFF, 0XFF}}
|
{L"normal", 8, {0xFF, 0xFF, 0XFF}}
|
||||||
};
|
};
|
||||||
|
|
||||||
bool rgb_color_t::try_parse_named(const wcstring &str) {
|
wcstring_list_t rgb_color_t::named_color_names(void)
|
||||||
bzero(&data, sizeof data);
|
{
|
||||||
|
size_t count = sizeof named_colors / sizeof *named_colors;
|
||||||
|
wcstring_list_t result;
|
||||||
|
result.reserve(count);
|
||||||
|
for (size_t i=0; i < count; i++)
|
||||||
|
{
|
||||||
|
result.push_back(named_colors[i].name);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool rgb_color_t::try_parse_named(const wcstring &str)
|
||||||
|
{
|
||||||
|
memset(&data, 0, sizeof data);
|
||||||
size_t max = sizeof named_colors / sizeof *named_colors;
|
size_t max = sizeof named_colors / sizeof *named_colors;
|
||||||
for (size_t idx=0; idx < max; idx++) {
|
for (size_t idx=0; idx < max; idx++)
|
||||||
if (0 == wcscasecmp(str.c_str(), named_colors[idx].name)) {
|
{
|
||||||
|
if (0 == wcscasecmp(str.c_str(), named_colors[idx].name))
|
||||||
|
{
|
||||||
data.name_idx = named_colors[idx].idx;
|
data.name_idx = named_colors[idx].idx;
|
||||||
this->type = type_named;
|
this->type = type_named;
|
||||||
return true;
|
return true;
|
||||||
@@ -138,29 +198,53 @@ bool rgb_color_t::try_parse_named(const wcstring &str) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const wchar_t *name_for_color_idx(unsigned char idx) {
|
static const wchar_t *name_for_color_idx(unsigned char idx)
|
||||||
|
{
|
||||||
size_t max = sizeof named_colors / sizeof *named_colors;
|
size_t max = sizeof named_colors / sizeof *named_colors;
|
||||||
for (size_t i=0; i < max; i++) {
|
for (size_t i=0; i < max; i++)
|
||||||
if (named_colors[i].idx == idx) {
|
{
|
||||||
|
if (named_colors[i].idx == idx)
|
||||||
|
{
|
||||||
return named_colors[i].name;
|
return named_colors[i].name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return L"unknown";
|
return L"unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
rgb_color_t::rgb_color_t(unsigned char t, unsigned char i) : type(t), flags(), data() {
|
rgb_color_t::rgb_color_t(unsigned char t, unsigned char i) : type(t), flags(), data()
|
||||||
|
{
|
||||||
data.name_idx = i;
|
data.name_idx = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
rgb_color_t rgb_color_t::normal() { return rgb_color_t(type_normal); }
|
rgb_color_t rgb_color_t::normal()
|
||||||
rgb_color_t rgb_color_t::reset() { return rgb_color_t(type_reset); }
|
{
|
||||||
rgb_color_t rgb_color_t::ignore() { return rgb_color_t(type_ignore); }
|
return rgb_color_t(type_normal);
|
||||||
rgb_color_t rgb_color_t::none() { return rgb_color_t(type_none); }
|
}
|
||||||
rgb_color_t rgb_color_t::white() { return rgb_color_t(type_named, 7); }
|
rgb_color_t rgb_color_t::reset()
|
||||||
rgb_color_t rgb_color_t::black() { return rgb_color_t(type_named, 0); }
|
{
|
||||||
|
return rgb_color_t(type_reset);
|
||||||
|
}
|
||||||
|
rgb_color_t rgb_color_t::ignore()
|
||||||
|
{
|
||||||
|
return rgb_color_t(type_ignore);
|
||||||
|
}
|
||||||
|
rgb_color_t rgb_color_t::none()
|
||||||
|
{
|
||||||
|
return rgb_color_t(type_none);
|
||||||
|
}
|
||||||
|
rgb_color_t rgb_color_t::white()
|
||||||
|
{
|
||||||
|
return rgb_color_t(type_named, 7);
|
||||||
|
}
|
||||||
|
rgb_color_t rgb_color_t::black()
|
||||||
|
{
|
||||||
|
return rgb_color_t(type_named, 0);
|
||||||
|
}
|
||||||
|
|
||||||
static unsigned char term8_color_for_rgb(const unsigned char rgb[3]) {
|
static unsigned char term8_color_for_rgb(const unsigned char rgb[3])
|
||||||
const uint32_t kColors[] = {
|
{
|
||||||
|
const uint32_t kColors[] =
|
||||||
|
{
|
||||||
0x000000, //Black
|
0x000000, //Black
|
||||||
0xFF0000, //Red
|
0xFF0000, //Red
|
||||||
0x00FF00, //Green
|
0x00FF00, //Green
|
||||||
@@ -173,8 +257,10 @@ static unsigned char term8_color_for_rgb(const unsigned char rgb[3]) {
|
|||||||
return convert_color(rgb, kColors, sizeof kColors / sizeof *kColors);
|
return convert_color(rgb, kColors, sizeof kColors / sizeof *kColors);
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned char term256_color_for_rgb(const unsigned char rgb[3]) {
|
static unsigned char term256_color_for_rgb(const unsigned char rgb[3])
|
||||||
const uint32_t kColors[240] = {
|
{
|
||||||
|
const uint32_t kColors[240] =
|
||||||
|
{
|
||||||
0x000000, 0x00005f, 0x000087, 0x0000af, 0x0000d7, 0x0000ff, 0x005f00, 0x005f5f,
|
0x000000, 0x00005f, 0x000087, 0x0000af, 0x0000d7, 0x0000ff, 0x005f00, 0x005f5f,
|
||||||
0x005f87, 0x005faf, 0x005fd7, 0x005fff, 0x008700, 0x00875f, 0x008787, 0x0087af,
|
0x005f87, 0x005faf, 0x005fd7, 0x005fff, 0x008700, 0x00875f, 0x008787, 0x0087af,
|
||||||
0x0087d7, 0x0087ff, 0x00af00, 0x00af5f, 0x00af87, 0x00afaf, 0x00afd7, 0x00afff,
|
0x0087d7, 0x0087ff, 0x00af00, 0x00af5f, 0x00af87, 0x00afaf, 0x00afd7, 0x00afff,
|
||||||
@@ -184,75 +270,94 @@ static unsigned char term256_color_for_rgb(const unsigned char rgb[3]) {
|
|||||||
0x5f8700, 0x5f875f, 0x5f8787, 0x5f87af, 0x5f87d7, 0x5f87ff, 0x5faf00, 0x5faf5f,
|
0x5f8700, 0x5f875f, 0x5f8787, 0x5f87af, 0x5f87d7, 0x5f87ff, 0x5faf00, 0x5faf5f,
|
||||||
0x5faf87, 0x5fafaf, 0x5fafd7, 0x5fafff, 0x5fd700, 0x5fd75f, 0x5fd787, 0x5fd7af,
|
0x5faf87, 0x5fafaf, 0x5fafd7, 0x5fafff, 0x5fd700, 0x5fd75f, 0x5fd787, 0x5fd7af,
|
||||||
0x5fd7d7, 0x5fd7ff, 0x5fff00, 0x5fff5f, 0x5fff87, 0x5fffaf, 0x5fffd7, 0x5fffff,
|
0x5fd7d7, 0x5fd7ff, 0x5fff00, 0x5fff5f, 0x5fff87, 0x5fffaf, 0x5fffd7, 0x5fffff,
|
||||||
0x870000, 0x87005f, 0x870087, 0x8700af, 0x8700d7, 0x8700ff, 0x875f00, 0x875f5f,
|
0x870000, 0x87005f, 0x870087, 0x8700af, 0x8700d7, 0x8700ff, 0x875f00, 0x875f5f,
|
||||||
0x875f87, 0x875faf, 0x875fd7, 0x875fff, 0x878700, 0x87875f, 0x878787, 0x8787af,
|
0x875f87, 0x875faf, 0x875fd7, 0x875fff, 0x878700, 0x87875f, 0x878787, 0x8787af,
|
||||||
0x8787d7, 0x8787ff, 0x87af00, 0x87af5f, 0x87af87, 0x87afaf, 0x87afd7, 0x87afff,
|
0x8787d7, 0x8787ff, 0x87af00, 0x87af5f, 0x87af87, 0x87afaf, 0x87afd7, 0x87afff,
|
||||||
0x87d700, 0x87d75f, 0x87d787, 0x87d7af, 0x87d7d7, 0x87d7ff, 0x87ff00, 0x87ff5f,
|
0x87d700, 0x87d75f, 0x87d787, 0x87d7af, 0x87d7d7, 0x87d7ff, 0x87ff00, 0x87ff5f,
|
||||||
0x87ff87, 0x87ffaf, 0x87ffd7, 0x87ffff, 0xaf0000, 0xaf005f, 0xaf0087, 0xaf00af,
|
0x87ff87, 0x87ffaf, 0x87ffd7, 0x87ffff, 0xaf0000, 0xaf005f, 0xaf0087, 0xaf00af,
|
||||||
0xaf00d7, 0xaf00ff, 0xaf5f00, 0xaf5f5f, 0xaf5f87, 0xaf5faf, 0xaf5fd7, 0xaf5fff,
|
0xaf00d7, 0xaf00ff, 0xaf5f00, 0xaf5f5f, 0xaf5f87, 0xaf5faf, 0xaf5fd7, 0xaf5fff,
|
||||||
0xaf8700, 0xaf875f, 0xaf8787, 0xaf87af, 0xaf87d7, 0xaf87ff, 0xafaf00, 0xafaf5f,
|
0xaf8700, 0xaf875f, 0xaf8787, 0xaf87af, 0xaf87d7, 0xaf87ff, 0xafaf00, 0xafaf5f,
|
||||||
0xafaf87, 0xafafaf, 0xafafd7, 0xafafff, 0xafd700, 0xafd75f, 0xafd787, 0xafd7af,
|
0xafaf87, 0xafafaf, 0xafafd7, 0xafafff, 0xafd700, 0xafd75f, 0xafd787, 0xafd7af,
|
||||||
0xafd7d7, 0xafd7ff, 0xafff00, 0xafff5f, 0xafff87, 0xafffaf, 0xafffd7, 0xafffff,
|
0xafd7d7, 0xafd7ff, 0xafff00, 0xafff5f, 0xafff87, 0xafffaf, 0xafffd7, 0xafffff,
|
||||||
0xd70000, 0xd7005f, 0xd70087, 0xd700af, 0xd700d7, 0xd700ff, 0xd75f00, 0xd75f5f,
|
0xd70000, 0xd7005f, 0xd70087, 0xd700af, 0xd700d7, 0xd700ff, 0xd75f00, 0xd75f5f,
|
||||||
0xd75f87, 0xd75faf, 0xd75fd7, 0xd75fff, 0xd78700, 0xd7875f, 0xd78787, 0xd787af,
|
0xd75f87, 0xd75faf, 0xd75fd7, 0xd75fff, 0xd78700, 0xd7875f, 0xd78787, 0xd787af,
|
||||||
0xd787d7, 0xd787ff, 0xd7af00, 0xd7af5f, 0xd7af87, 0xd7afaf, 0xd7afd7, 0xd7afff,
|
0xd787d7, 0xd787ff, 0xd7af00, 0xd7af5f, 0xd7af87, 0xd7afaf, 0xd7afd7, 0xd7afff,
|
||||||
0xd7d700, 0xd7d75f, 0xd7d787, 0xd7d7af, 0xd7d7d7, 0xd7d7ff, 0xd7ff00, 0xd7ff5f,
|
0xd7d700, 0xd7d75f, 0xd7d787, 0xd7d7af, 0xd7d7d7, 0xd7d7ff, 0xd7ff00, 0xd7ff5f,
|
||||||
0xd7ff87, 0xd7ffaf, 0xd7ffd7, 0xd7ffff, 0xff0000, 0xff005f, 0xff0087, 0xff00af,
|
0xd7ff87, 0xd7ffaf, 0xd7ffd7, 0xd7ffff, 0xff0000, 0xff005f, 0xff0087, 0xff00af,
|
||||||
0xff00d7, 0xff00ff, 0xff5f00, 0xff5f5f, 0xff5f87, 0xff5faf, 0xff5fd7, 0xff5fff,
|
0xff00d7, 0xff00ff, 0xff5f00, 0xff5f5f, 0xff5f87, 0xff5faf, 0xff5fd7, 0xff5fff,
|
||||||
0xff8700, 0xff875f, 0xff8787, 0xff87af, 0xff87d7, 0xff87ff, 0xffaf00, 0xffaf5f,
|
0xff8700, 0xff875f, 0xff8787, 0xff87af, 0xff87d7, 0xff87ff, 0xffaf00, 0xffaf5f,
|
||||||
0xffaf87, 0xffafaf, 0xffafd7, 0xffafff, 0xffd700, 0xffd75f, 0xffd787, 0xffd7af,
|
0xffaf87, 0xffafaf, 0xffafd7, 0xffafff, 0xffd700, 0xffd75f, 0xffd787, 0xffd7af,
|
||||||
0xffd7d7, 0xffd7ff, 0xffff00, 0xffff5f, 0xffff87, 0xffffaf, 0xffffd7, 0xffffff,
|
0xffd7d7, 0xffd7ff, 0xffff00, 0xffff5f, 0xffff87, 0xffffaf, 0xffffd7, 0xffffff,
|
||||||
0x080808, 0x121212, 0x1c1c1c, 0x262626, 0x303030, 0x3a3a3a, 0x444444, 0x4e4e4e,
|
0x080808, 0x121212, 0x1c1c1c, 0x262626, 0x303030, 0x3a3a3a, 0x444444, 0x4e4e4e,
|
||||||
0x585858, 0x626262, 0x6c6c6c, 0x767676, 0x808080, 0x8a8a8a, 0x949494, 0x9e9e9e,
|
0x585858, 0x626262, 0x6c6c6c, 0x767676, 0x808080, 0x8a8a8a, 0x949494, 0x9e9e9e,
|
||||||
0xa8a8a8, 0xb2b2b2, 0xbcbcbc, 0xc6c6c6, 0xd0d0d0, 0xdadada, 0xe4e4e4, 0xeeeeee
|
0xa8a8a8, 0xb2b2b2, 0xbcbcbc, 0xc6c6c6, 0xd0d0d0, 0xdadada, 0xe4e4e4, 0xeeeeee
|
||||||
};
|
};
|
||||||
return 16 + convert_color(rgb, kColors, sizeof kColors / sizeof *kColors);
|
return 16 + convert_color(rgb, kColors, sizeof kColors / sizeof *kColors);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char rgb_color_t::to_term256_index() const {
|
unsigned char rgb_color_t::to_term256_index() const
|
||||||
|
{
|
||||||
assert(type == type_rgb);
|
assert(type == type_rgb);
|
||||||
return term256_color_for_rgb(data.rgb);
|
return term256_color_for_rgb(data.color.rgb);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char rgb_color_t::to_name_index() const {
|
color24_t rgb_color_t::to_color24() const
|
||||||
|
{
|
||||||
|
assert(type == type_rgb);
|
||||||
|
return data.color;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char rgb_color_t::to_name_index() const
|
||||||
|
{
|
||||||
assert(type == type_named || type == type_rgb);
|
assert(type == type_named || type == type_rgb);
|
||||||
if (type == type_named) {
|
if (type == type_named)
|
||||||
|
{
|
||||||
return data.name_idx;
|
return data.name_idx;
|
||||||
} else if (type == type_rgb) {
|
}
|
||||||
return term8_color_for_rgb(data.rgb);
|
else if (type == type_rgb)
|
||||||
} else {
|
{
|
||||||
|
return term8_color_for_rgb(data.color.rgb);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
/* This is an error */
|
/* This is an error */
|
||||||
return (unsigned char)(-1);
|
return (unsigned char)(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void rgb_color_t::parse(const wcstring &str) {
|
void rgb_color_t::parse(const wcstring &str)
|
||||||
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
if (! success) success = try_parse_special(str);
|
if (! success) success = try_parse_special(str);
|
||||||
if (! success) success = try_parse_named(str);
|
if (! success) success = try_parse_named(str);
|
||||||
if (! success) success = try_parse_rgb(str);
|
if (! success) success = try_parse_rgb(str);
|
||||||
if (! success) {
|
if (! success)
|
||||||
bzero(this->data.rgb, sizeof this->data.rgb);
|
{
|
||||||
|
memset(&this->data, 0, sizeof this->data);
|
||||||
this->type = type_none;
|
this->type = type_none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rgb_color_t::rgb_color_t(const wcstring &str) {
|
rgb_color_t::rgb_color_t(const wcstring &str)
|
||||||
|
{
|
||||||
this->parse(str);
|
this->parse(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
rgb_color_t::rgb_color_t(const std::string &str) {
|
rgb_color_t::rgb_color_t(const std::string &str)
|
||||||
|
{
|
||||||
this->parse(str2wcstring(str));
|
this->parse(str2wcstring(str));
|
||||||
}
|
}
|
||||||
|
|
||||||
wcstring rgb_color_t::description() const {
|
wcstring rgb_color_t::description() const
|
||||||
switch (type) {
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
case type_none:
|
case type_none:
|
||||||
return L"none";
|
return L"none";
|
||||||
case type_named:
|
case type_named:
|
||||||
return format_string(L"named(%d: %ls)", (int)data.name_idx, name_for_color_idx(data.name_idx));
|
return format_string(L"named(%d: %ls)", (int)data.name_idx, name_for_color_idx(data.name_idx));
|
||||||
case type_rgb:
|
case type_rgb:
|
||||||
return format_string(L"rgb(0x%02x%02x%02x)", data.rgb[0], data.rgb[1], data.rgb[2]);
|
return format_string(L"rgb(0x%02x%02x%02x)", data.color.rgb[0], data.color.rgb[1], data.color.rgb[2]);
|
||||||
case type_reset:
|
case type_reset:
|
||||||
return L"reset";
|
return L"reset";
|
||||||
case type_normal:
|
case type_normal:
|
||||||
|
|||||||
144
color.h
144
color.h
@@ -8,12 +8,19 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
/* 24 bit color */
|
||||||
|
struct color24_t
|
||||||
|
{
|
||||||
|
unsigned char rgb[3];
|
||||||
|
};
|
||||||
|
|
||||||
/* A type that represents a color. We work hard to keep it at a size of 4 bytes. */
|
/* A type that represents a color. We work hard to keep it at a size of 4 bytes. */
|
||||||
class rgb_color_t {
|
class rgb_color_t
|
||||||
|
{
|
||||||
|
|
||||||
/* Types */
|
/* Types */
|
||||||
enum {
|
enum
|
||||||
|
{
|
||||||
type_none,
|
type_none,
|
||||||
type_named,
|
type_named,
|
||||||
type_rgb,
|
type_rgb,
|
||||||
@@ -22,22 +29,24 @@ class rgb_color_t {
|
|||||||
type_ignore
|
type_ignore
|
||||||
};
|
};
|
||||||
unsigned char type:4;
|
unsigned char type:4;
|
||||||
|
|
||||||
/* Flags */
|
/* Flags */
|
||||||
enum {
|
enum
|
||||||
|
{
|
||||||
flag_bold = 1 << 0,
|
flag_bold = 1 << 0,
|
||||||
flag_underline = 1 << 1
|
flag_underline = 1 << 1
|
||||||
};
|
};
|
||||||
unsigned char flags:4;
|
unsigned char flags:4;
|
||||||
|
|
||||||
union {
|
union
|
||||||
|
{
|
||||||
unsigned char name_idx; //0-10
|
unsigned char name_idx; //0-10
|
||||||
unsigned char rgb[3];
|
color24_t color;
|
||||||
} data;
|
} data;
|
||||||
|
|
||||||
/** Try parsing a special color name like "normal" */
|
/** Try parsing a special color name like "normal" */
|
||||||
bool try_parse_special(const wcstring &str);
|
bool try_parse_special(const wcstring &str);
|
||||||
|
|
||||||
/** Try parsing an rgb color like "#F0A030" */
|
/** Try parsing an rgb color like "#F0A030" */
|
||||||
bool try_parse_rgb(const wcstring &str);
|
bool try_parse_rgb(const wcstring &str);
|
||||||
|
|
||||||
@@ -49,85 +58,128 @@ class rgb_color_t {
|
|||||||
|
|
||||||
/** Private constructor */
|
/** Private constructor */
|
||||||
explicit rgb_color_t(unsigned char t, unsigned char i=0);
|
explicit rgb_color_t(unsigned char t, unsigned char i=0);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** Default constructor of type none */
|
/** Default constructor of type none */
|
||||||
explicit rgb_color_t() : type(type_none), flags(), data() {}
|
explicit rgb_color_t() : type(type_none), flags(), data() {}
|
||||||
|
|
||||||
/** Parse a color from a string */
|
/** Parse a color from a string */
|
||||||
explicit rgb_color_t(const wcstring &str);
|
explicit rgb_color_t(const wcstring &str);
|
||||||
explicit rgb_color_t(const std::string &str);
|
explicit rgb_color_t(const std::string &str);
|
||||||
|
|
||||||
/** Returns white */
|
/** Returns white */
|
||||||
static rgb_color_t white();
|
static rgb_color_t white();
|
||||||
|
|
||||||
/** Returns black */
|
/** Returns black */
|
||||||
static rgb_color_t black();
|
static rgb_color_t black();
|
||||||
|
|
||||||
/** Returns the reset special color */
|
/** Returns the reset special color */
|
||||||
static rgb_color_t reset();
|
static rgb_color_t reset();
|
||||||
|
|
||||||
/** Returns the normal special color */
|
/** Returns the normal special color */
|
||||||
static rgb_color_t normal();
|
static rgb_color_t normal();
|
||||||
|
|
||||||
/** Returns the ignore special color */
|
/** Returns the ignore special color */
|
||||||
static rgb_color_t ignore();
|
static rgb_color_t ignore();
|
||||||
|
|
||||||
/** Returns the none special color */
|
/** Returns the none special color */
|
||||||
static rgb_color_t none();
|
static rgb_color_t none();
|
||||||
|
|
||||||
/** Returns whether the color is the ignore special color */
|
/** Returns whether the color is the ignore special color */
|
||||||
bool is_ignore(void) const { return type == type_ignore; }
|
bool is_ignore(void) const
|
||||||
|
{
|
||||||
|
return type == type_ignore;
|
||||||
|
}
|
||||||
|
|
||||||
/** Returns whether the color is the normal special color */
|
/** Returns whether the color is the normal special color */
|
||||||
bool is_normal(void) const { return type == type_normal; }
|
bool is_normal(void) const
|
||||||
|
{
|
||||||
|
return type == type_normal;
|
||||||
|
}
|
||||||
|
|
||||||
/** Returns whether the color is the reset special color */
|
/** Returns whether the color is the reset special color */
|
||||||
bool is_reset(void) const { return type == type_reset; }
|
bool is_reset(void) const
|
||||||
|
{
|
||||||
|
return type == type_reset;
|
||||||
|
}
|
||||||
|
|
||||||
/** Returns whether the color is the none special color */
|
/** Returns whether the color is the none special color */
|
||||||
bool is_none(void) const { return type == type_none; }
|
bool is_none(void) const
|
||||||
|
{
|
||||||
|
return type == type_none;
|
||||||
|
}
|
||||||
|
|
||||||
/** Returns whether the color is a named color (like "magenta") */
|
/** Returns whether the color is a named color (like "magenta") */
|
||||||
bool is_named(void) const { return type == type_named; }
|
bool is_named(void) const
|
||||||
|
{
|
||||||
|
return type == type_named;
|
||||||
|
}
|
||||||
|
|
||||||
/** Returns whether the color is specified via RGB components */
|
/** Returns whether the color is specified via RGB components */
|
||||||
bool is_rgb(void) const { return type == type_rgb; }
|
bool is_rgb(void) const
|
||||||
|
{
|
||||||
|
return type == type_rgb;
|
||||||
|
}
|
||||||
|
|
||||||
/** Returns whether the color is special, that is, not rgb or named */
|
/** Returns whether the color is special, that is, not rgb or named */
|
||||||
bool is_special(void) const { return type != type_named && type != type_rgb; }
|
bool is_special(void) const
|
||||||
|
{
|
||||||
|
return type != type_named && type != type_rgb;
|
||||||
|
}
|
||||||
|
|
||||||
/** Returns a description of the color */
|
/** Returns a description of the color */
|
||||||
wcstring description() const;
|
wcstring description() const;
|
||||||
|
|
||||||
/** Returns the name index for the given color. Requires that the color be named or RGB. */
|
/** Returns the name index for the given color. Requires that the color be named or RGB. */
|
||||||
unsigned char to_name_index() const;
|
unsigned char to_name_index() const;
|
||||||
|
|
||||||
/** Returns the term256 index for the given color. Requires that the color be named or RGB. */
|
/** Returns the term256 index for the given color. Requires that the color be RGB. */
|
||||||
unsigned char to_term256_index() const;
|
unsigned char to_term256_index() const;
|
||||||
|
|
||||||
|
/** Returns the 24 bit color for the given color. Requires that the color be RGB. */
|
||||||
|
color24_t to_color24() const;
|
||||||
|
|
||||||
/** Returns whether the color is bold */
|
/** Returns whether the color is bold */
|
||||||
bool is_bold() const { return flags & flag_bold; }
|
bool is_bold() const
|
||||||
|
{
|
||||||
|
return !!(flags & flag_bold);
|
||||||
|
}
|
||||||
|
|
||||||
/** Set whether the color is bold */
|
/** Set whether the color is bold */
|
||||||
void set_bold(bool x) { if (x) flags |= flag_bold; else flags &= ~flag_bold; }
|
void set_bold(bool x)
|
||||||
|
{
|
||||||
|
if (x) flags |= flag_bold;
|
||||||
|
else flags &= ~flag_bold;
|
||||||
|
}
|
||||||
|
|
||||||
/** Returns whether the color is underlined */
|
/** Returns whether the color is underlined */
|
||||||
bool is_underline() const { return !! (flags & flag_underline); }
|
bool is_underline() const
|
||||||
|
{
|
||||||
|
return !!(flags & flag_underline);
|
||||||
|
}
|
||||||
|
|
||||||
/** Set whether the color is underlined */
|
/** Set whether the color is underlined */
|
||||||
void set_underline(bool x) { if (x) flags |= flag_underline; else flags &= ~flag_underline; }
|
void set_underline(bool x)
|
||||||
|
{
|
||||||
|
if (x) flags |= flag_underline;
|
||||||
|
else flags &= ~flag_underline;
|
||||||
|
}
|
||||||
|
|
||||||
/** Compare two colors for equality */
|
/** Compare two colors for equality */
|
||||||
bool operator==(const rgb_color_t &other) const {
|
bool operator==(const rgb_color_t &other) const
|
||||||
|
{
|
||||||
return type == other.type && ! memcmp(&data, &other.data, sizeof data);
|
return type == other.type && ! memcmp(&data, &other.data, sizeof data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Compare two colors for inequality */
|
/** Compare two colors for inequality */
|
||||||
bool operator!=(const rgb_color_t &other) const {
|
bool operator!=(const rgb_color_t &other) const
|
||||||
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Returns the names of all named colors */
|
||||||
|
static wcstring_list_t named_color_names(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
3155
common.cpp
3155
common.cpp
File diff suppressed because it is too large
Load Diff
631
common.h
631
common.h
@@ -22,6 +22,12 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
Avoid writing the type name twice in a common "static_cast-initialization".
|
||||||
|
Caveat: This doesn't work with type names containing commas!
|
||||||
|
*/
|
||||||
|
#define CAST_INIT(type, dst, src) type dst = static_cast<type >(src)
|
||||||
|
|
||||||
class completion_t;
|
class completion_t;
|
||||||
|
|
||||||
/* Common string type */
|
/* Common string type */
|
||||||
@@ -53,41 +59,86 @@ typedef std::vector<wcstring> wcstring_list_t;
|
|||||||
*/
|
*/
|
||||||
#define BYTE_MAX 0xffu
|
#define BYTE_MAX 0xffu
|
||||||
|
|
||||||
/**
|
/** BOM value */
|
||||||
Escape special fish syntax characters like the semicolon
|
#define UTF8_BOM_WCHAR 0xFEFFu
|
||||||
*/
|
|
||||||
#define UNESCAPE_SPECIAL 1
|
|
||||||
|
|
||||||
/**
|
/* Flags for unescape_string functions */
|
||||||
Allow incomplete escape sequences
|
enum
|
||||||
*/
|
{
|
||||||
#define UNESCAPE_INCOMPLETE 2
|
/* Default behavior */
|
||||||
|
UNESCAPE_DEFAULT = 0,
|
||||||
|
|
||||||
|
/* Escape special fish syntax characters like the semicolon */
|
||||||
|
UNESCAPE_SPECIAL = 1 << 0,
|
||||||
|
|
||||||
|
/* Allow incomplete escape sequences */
|
||||||
|
UNESCAPE_INCOMPLETE = 1 << 1
|
||||||
|
};
|
||||||
|
typedef unsigned int unescape_flags_t;
|
||||||
|
|
||||||
/* Flags for the escape() and escape_string() functions */
|
/* Flags for the escape() and escape_string() functions */
|
||||||
enum {
|
enum
|
||||||
|
{
|
||||||
/** Escape all characters, including magic characters like the semicolon */
|
/** Escape all characters, including magic characters like the semicolon */
|
||||||
ESCAPE_ALL = 1 << 0,
|
ESCAPE_ALL = 1 << 0,
|
||||||
|
|
||||||
/** Do not try to use 'simplified' quoted escapes, and do not use empty quotes as the empty string */
|
/** Do not try to use 'simplified' quoted escapes, and do not use empty quotes as the empty string */
|
||||||
ESCAPE_NO_QUOTED = 1 << 1,
|
ESCAPE_NO_QUOTED = 1 << 1,
|
||||||
|
|
||||||
/** Do not escape tildes */
|
/** Do not escape tildes */
|
||||||
ESCAPE_NO_TILDE = 1 << 2
|
ESCAPE_NO_TILDE = 1 << 2
|
||||||
};
|
};
|
||||||
typedef unsigned int escape_flags_t;
|
typedef unsigned int escape_flags_t;
|
||||||
|
|
||||||
|
/* Directions */
|
||||||
|
enum selection_direction_t
|
||||||
|
{
|
||||||
|
/* visual directions */
|
||||||
|
direction_north,
|
||||||
|
direction_east,
|
||||||
|
direction_south,
|
||||||
|
direction_west,
|
||||||
|
direction_page_north,
|
||||||
|
direction_page_south,
|
||||||
|
|
||||||
|
/* logical directions */
|
||||||
|
direction_next,
|
||||||
|
direction_prev,
|
||||||
|
|
||||||
|
/* special value that means deselect */
|
||||||
|
direction_deselect
|
||||||
|
};
|
||||||
|
|
||||||
|
inline bool selection_direction_is_cardinal(selection_direction_t dir)
|
||||||
|
{
|
||||||
|
switch (dir)
|
||||||
|
{
|
||||||
|
case direction_north:
|
||||||
|
case direction_page_north:
|
||||||
|
case direction_east:
|
||||||
|
case direction_page_south:
|
||||||
|
case direction_south:
|
||||||
|
case direction_west:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Helper macro for errors
|
Helper macro for errors
|
||||||
*/
|
*/
|
||||||
#define VOMIT_ON_FAILURE(a) do { if (0 != (a)) { int err = errno; fprintf(stderr, "%s failed on line %d in file %s: %d (%s)\n", #a, __LINE__, __FILE__, err, strerror(err)); abort(); }} while (0)
|
#define VOMIT_ON_FAILURE(a) do { if (0 != (a)) { VOMIT_ABORT(errno, #a); } } while (0)
|
||||||
|
#define VOMIT_ON_FAILURE_NO_ERRNO(a) do { int err = (a); if (0 != err) { VOMIT_ABORT(err, #a); } } while (0)
|
||||||
|
#define VOMIT_ABORT(err, str) do { int code = (err); fprintf(stderr, "%s failed on line %d in file %s: %d (%s)\n", str, __LINE__, __FILE__, code, strerror(code)); abort(); } while(0)
|
||||||
|
|
||||||
/** Exits without invoking destructors (via _exit), useful for code after fork. */
|
/** Exits without invoking destructors (via _exit), useful for code after fork. */
|
||||||
void exit_without_destructors(int code) __attribute__ ((noreturn));
|
void exit_without_destructors(int code) __attribute__((noreturn));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Save the shell mode on startup so we can restore them on exit
|
Save the shell mode on startup so we can restore them on exit
|
||||||
*/
|
*/
|
||||||
extern struct termios shell_modes;
|
extern struct termios shell_modes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The character to use where the text has been truncated. Is an
|
The character to use where the text has been truncated. Is an
|
||||||
@@ -95,6 +146,9 @@ extern struct termios shell_modes;
|
|||||||
*/
|
*/
|
||||||
extern wchar_t ellipsis_char;
|
extern wchar_t ellipsis_char;
|
||||||
|
|
||||||
|
/* Character representing an omitted newline at the end of text */
|
||||||
|
extern wchar_t omitted_newline_char;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The verbosity level of fish. If a call to debug has a severity
|
The verbosity level of fish. If a call to debug has a severity
|
||||||
level higher than \c debug_level, it will not be printed.
|
level higher than \c debug_level, it will not be printed.
|
||||||
@@ -104,7 +158,7 @@ extern int debug_level;
|
|||||||
/**
|
/**
|
||||||
Profiling flag. True if commands should be profiled.
|
Profiling flag. True if commands should be profiled.
|
||||||
*/
|
*/
|
||||||
extern char *profile;
|
extern bool g_profiling_active;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Name of the current program. Should be set at startup. Used by the
|
Name of the current program. Should be set at startup. Used by the
|
||||||
@@ -112,14 +166,18 @@ extern char *profile;
|
|||||||
*/
|
*/
|
||||||
extern const wchar_t *program_name;
|
extern const wchar_t *program_name;
|
||||||
|
|
||||||
|
/* Variants of read() and write() that ignores return values, defeating a warning */
|
||||||
|
void read_ignore(int fd, void *buff, size_t count);
|
||||||
|
void write_ignore(int fd, const void *buff, size_t count);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This macro is used to check that an input argument is not null. It
|
This macro is used to check that an input argument is not null. It
|
||||||
is a bit lika a non-fatal form of assert. Instead of exit-ing on
|
is a bit lika a non-fatal form of assert. Instead of exit-ing on
|
||||||
failiure, the current function is ended at once. The second
|
failure, the current function is ended at once. The second
|
||||||
parameter is the return value of the current function on failiure.
|
parameter is the return value of the current function on failure.
|
||||||
*/
|
*/
|
||||||
#define CHECK( arg, retval ) \
|
#define CHECK( arg, retval ) \
|
||||||
if( !(arg) ) \
|
if (!(arg)) \
|
||||||
{ \
|
{ \
|
||||||
debug( 0, \
|
debug( 0, \
|
||||||
"function %s called with null value for argument %s. ", \
|
"function %s called with null value for argument %s. ", \
|
||||||
@@ -135,12 +193,12 @@ extern const wchar_t *program_name;
|
|||||||
*/
|
*/
|
||||||
#define FATAL_EXIT() \
|
#define FATAL_EXIT() \
|
||||||
{ \
|
{ \
|
||||||
char exit_read_buff; \
|
char exit_read_buff; \
|
||||||
show_stackframe(); \
|
show_stackframe(); \
|
||||||
read( 0, &exit_read_buff, 1 ); \
|
read_ignore( 0, &exit_read_buff, 1 ); \
|
||||||
exit_without_destructors( 1 ); \
|
exit_without_destructors( 1 ); \
|
||||||
} \
|
} \
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Exit program at once, leaving an error message about running out of memory.
|
Exit program at once, leaving an error message about running out of memory.
|
||||||
@@ -158,8 +216,8 @@ extern const wchar_t *program_name;
|
|||||||
Check if signals are blocked. If so, print an error message and
|
Check if signals are blocked. If so, print an error message and
|
||||||
return from the function performing this check.
|
return from the function performing this check.
|
||||||
*/
|
*/
|
||||||
#define CHECK_BLOCK( retval ) \
|
#define CHECK_BLOCK(retval) \
|
||||||
if( signal_is_blocked() ) \
|
if (signal_is_blocked()) \
|
||||||
{ \
|
{ \
|
||||||
debug( 0, \
|
debug( 0, \
|
||||||
"function %s called while blocking signals. ", \
|
"function %s called while blocking signals. ", \
|
||||||
@@ -168,22 +226,22 @@ extern const wchar_t *program_name;
|
|||||||
show_stackframe(); \
|
show_stackframe(); \
|
||||||
return retval; \
|
return retval; \
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Shorthand for wgettext call
|
Shorthand for wgettext call
|
||||||
*/
|
*/
|
||||||
#define _(wstr) wgettext((const wchar_t *)wstr)
|
#define _(wstr) wgettext(wstr)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Noop, used to tell xgettext that a string should be translated,
|
Noop, used to tell xgettext that a string should be translated,
|
||||||
even though it is not directly sent to wgettext.
|
even though it is not directly sent to wgettext.
|
||||||
*/
|
*/
|
||||||
#define N_(wstr) wstr
|
#define N_(wstr) wstr
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check if the specified string element is a part of the specified string list
|
Check if the specified string element is a part of the specified string list
|
||||||
*/
|
*/
|
||||||
#define contains( str,... ) contains_internal( str, __VA_ARGS__, NULL )
|
#define contains( str, ... ) contains_internal( str, 0, __VA_ARGS__, NULL )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Print a stack trace to stderr
|
Print a stack trace to stderr
|
||||||
@@ -192,8 +250,8 @@ void show_stackframe();
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Read a line from the stream f into the string. Returns
|
Read a line from the stream f into the string. Returns
|
||||||
the number of bytes read or -1 on failiure.
|
the number of bytes read or -1 on failure.
|
||||||
|
|
||||||
If the carriage return character is encountered, it is
|
If the carriage return character is encountered, it is
|
||||||
ignored. fgetws() considers the line to end if reading the file
|
ignored. fgetws() considers the line to end if reading the file
|
||||||
@@ -202,34 +260,17 @@ void show_stackframe();
|
|||||||
*/
|
*/
|
||||||
int fgetws2(wcstring *s, FILE *f);
|
int fgetws2(wcstring *s, FILE *f);
|
||||||
|
|
||||||
/**
|
|
||||||
Returns a newly allocated wide character string equivalent of the
|
|
||||||
specified multibyte character string
|
|
||||||
|
|
||||||
This function encodes illegal character sequences in a reversible
|
|
||||||
way using the private use area.
|
|
||||||
*/
|
|
||||||
wchar_t *str2wcs( const char *in );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns a newly allocated wide character string equivalent of the
|
Returns a wide character string equivalent of the
|
||||||
specified multibyte character string
|
specified multibyte character string
|
||||||
|
|
||||||
This function encodes illegal character sequences in a reversible
|
This function encodes illegal character sequences in a reversible
|
||||||
way using the private use area.
|
way using the private use area.
|
||||||
*/
|
*/
|
||||||
wcstring str2wcstring( const char *in );
|
wcstring str2wcstring(const char *in);
|
||||||
wcstring str2wcstring( const std::string &in );
|
wcstring str2wcstring(const char *in, size_t len);
|
||||||
|
wcstring str2wcstring(const std::string &in);
|
||||||
/**
|
|
||||||
Converts the narrow character string \c in into it's wide
|
|
||||||
equivalent, stored in \c out. \c out must have enough space to fit
|
|
||||||
the entire string.
|
|
||||||
|
|
||||||
This function encodes illegal character sequences in a reversible
|
|
||||||
way using the private use area.
|
|
||||||
*/
|
|
||||||
wchar_t *str2wcs_internal( const char *in, wchar_t *out );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns a newly allocated multibyte character string equivalent of
|
Returns a newly allocated multibyte character string equivalent of
|
||||||
@@ -238,7 +279,8 @@ wchar_t *str2wcs_internal( const char *in, wchar_t *out );
|
|||||||
This function decodes illegal character sequences in a reversible
|
This function decodes illegal character sequences in a reversible
|
||||||
way using the private use area.
|
way using the private use area.
|
||||||
*/
|
*/
|
||||||
char *wcs2str( const wchar_t *in );
|
char *wcs2str(const wchar_t *in);
|
||||||
|
char *wcs2str(const wcstring &in);
|
||||||
std::string wcs2string(const wcstring &input);
|
std::string wcs2string(const wcstring &input);
|
||||||
|
|
||||||
/** Test if a string prefixes another. Returns true if a is a prefix of b */
|
/** Test if a string prefixes another. Returns true if a is a prefix of b */
|
||||||
@@ -249,10 +291,81 @@ bool string_prefixes_string(const wchar_t *proposed_prefix, const wcstring &valu
|
|||||||
bool string_suffixes_string(const wcstring &proposed_suffix, const wcstring &value);
|
bool string_suffixes_string(const wcstring &proposed_suffix, const wcstring &value);
|
||||||
bool string_suffixes_string(const wchar_t *proposed_suffix, const wcstring &value);
|
bool string_suffixes_string(const wchar_t *proposed_suffix, const wcstring &value);
|
||||||
|
|
||||||
|
|
||||||
/** Test if a string prefixes another without regard to case. Returns true if a is a prefix of b */
|
/** Test if a string prefixes another without regard to case. Returns true if a is a prefix of b */
|
||||||
bool string_prefixes_string_case_insensitive(const wcstring &proposed_prefix, const wcstring &value);
|
bool string_prefixes_string_case_insensitive(const wcstring &proposed_prefix, const wcstring &value);
|
||||||
|
|
||||||
|
enum fuzzy_match_type_t
|
||||||
|
{
|
||||||
|
/* We match the string exactly: FOOBAR matches FOOBAR */
|
||||||
|
fuzzy_match_exact = 0,
|
||||||
|
|
||||||
|
/* We match a prefix of the string: FO matches FOOBAR */
|
||||||
|
fuzzy_match_prefix,
|
||||||
|
|
||||||
|
/* We match the string exactly, but in a case insensitive way: foobar matches FOOBAR */
|
||||||
|
fuzzy_match_case_insensitive,
|
||||||
|
|
||||||
|
/* We match a prefix of the string, in a case insensitive way: foo matches FOOBAR */
|
||||||
|
fuzzy_match_prefix_case_insensitive,
|
||||||
|
|
||||||
|
/* We match a substring of the string: OOBA matches FOOBAR */
|
||||||
|
fuzzy_match_substring,
|
||||||
|
|
||||||
|
/* A subsequence match with insertions only: FBR matches FOOBAR */
|
||||||
|
fuzzy_match_subsequence_insertions_only,
|
||||||
|
|
||||||
|
/* We don't match the string */
|
||||||
|
fuzzy_match_none
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Indicates where a match type requires replacing the entire token */
|
||||||
|
static inline bool match_type_requires_full_replacement(fuzzy_match_type_t t)
|
||||||
|
{
|
||||||
|
switch (t)
|
||||||
|
{
|
||||||
|
case fuzzy_match_exact:
|
||||||
|
case fuzzy_match_prefix:
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Indicates where a match shares a prefix with the string it matches */
|
||||||
|
static inline bool match_type_shares_prefix(fuzzy_match_type_t t)
|
||||||
|
{
|
||||||
|
switch (t)
|
||||||
|
{
|
||||||
|
case fuzzy_match_exact:
|
||||||
|
case fuzzy_match_prefix:
|
||||||
|
case fuzzy_match_case_insensitive:
|
||||||
|
case fuzzy_match_prefix_case_insensitive:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Test if string is a fuzzy match to another */
|
||||||
|
struct string_fuzzy_match_t
|
||||||
|
{
|
||||||
|
enum fuzzy_match_type_t type;
|
||||||
|
|
||||||
|
/* Strength of the match. The value depends on the type. Lower is stronger. */
|
||||||
|
size_t match_distance_first;
|
||||||
|
size_t match_distance_second;
|
||||||
|
|
||||||
|
/* Constructor */
|
||||||
|
string_fuzzy_match_t(enum fuzzy_match_type_t t, size_t distance_first = 0, size_t distance_second = 0);
|
||||||
|
|
||||||
|
/* Return -1, 0, 1 if this match is (respectively) better than, equal to, or worse than rhs */
|
||||||
|
int compare(const string_fuzzy_match_t &rhs) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Compute a fuzzy match for a string. If maximum_match is not fuzzy_match_none, limit the type to matches at or below that type. */
|
||||||
|
string_fuzzy_match_t string_fuzzy_match_string(const wcstring &string, const wcstring &match_against, fuzzy_match_type_t limit_type = fuzzy_match_none);
|
||||||
|
|
||||||
|
|
||||||
/** Test if a list contains a string using a linear search. */
|
/** Test if a list contains a string using a linear search. */
|
||||||
bool list_contains_string(const wcstring_list_t &list, const wcstring &str);
|
bool list_contains_string(const wcstring_list_t &list, const wcstring &str);
|
||||||
|
|
||||||
@@ -269,16 +382,6 @@ void assert_is_background_thread(const char *who);
|
|||||||
void assert_is_locked(void *mutex, const char *who, const char *caller);
|
void assert_is_locked(void *mutex, const char *who, const char *caller);
|
||||||
#define ASSERT_IS_LOCKED(x) assert_is_locked((void *)(&x), #x, __FUNCTION__)
|
#define ASSERT_IS_LOCKED(x) assert_is_locked((void *)(&x), #x, __FUNCTION__)
|
||||||
|
|
||||||
/**
|
|
||||||
Converts the wide character string \c in into it's narrow
|
|
||||||
equivalent, stored in \c out. \c out must have enough space to fit
|
|
||||||
the entire string.
|
|
||||||
|
|
||||||
This function decodes illegal character sequences in a reversible
|
|
||||||
way using the private use area.
|
|
||||||
*/
|
|
||||||
char *wcs2str_internal( const wchar_t *in, char *out );
|
|
||||||
|
|
||||||
/** Format the specified size (in bytes, kilobytes, etc.) into the specified stringbuffer. */
|
/** Format the specified size (in bytes, kilobytes, etc.) into the specified stringbuffer. */
|
||||||
wcstring format_size(long long sz);
|
wcstring format_size(long long sz);
|
||||||
|
|
||||||
@@ -289,12 +392,13 @@ void format_size_safe(char buff[128], unsigned long long sz);
|
|||||||
void debug_safe(int level, const char *msg, const char *param1 = NULL, const char *param2 = NULL, const char *param3 = NULL, const char *param4 = NULL, const char *param5 = NULL, const char *param6 = NULL, const char *param7 = NULL, const char *param8 = NULL, const char *param9 = NULL, const char *param10 = NULL, const char *param11 = NULL, const char *param12 = NULL);
|
void debug_safe(int level, const char *msg, const char *param1 = NULL, const char *param2 = NULL, const char *param3 = NULL, const char *param4 = NULL, const char *param5 = NULL, const char *param6 = NULL, const char *param7 = NULL, const char *param8 = NULL, const char *param9 = NULL, const char *param10 = NULL, const char *param11 = NULL, const char *param12 = NULL);
|
||||||
|
|
||||||
/** Writes out a long safely */
|
/** Writes out a long safely */
|
||||||
void format_long_safe(char buff[128], long val);
|
void format_long_safe(char buff[64], long val);
|
||||||
void format_long_safe(wchar_t buff[128], long val);
|
void format_long_safe(wchar_t buff[64], long val);
|
||||||
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T from_string(const wcstring &x) {
|
T from_string(const wcstring &x)
|
||||||
|
{
|
||||||
T result;
|
T result;
|
||||||
std::wstringstream stream(x);
|
std::wstringstream stream(x);
|
||||||
stream >> result;
|
stream >> result;
|
||||||
@@ -302,7 +406,8 @@ T from_string(const wcstring &x) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T from_string(const std::string &x) {
|
T from_string(const std::string &x)
|
||||||
|
{
|
||||||
T result = T();
|
T result = T();
|
||||||
std::stringstream stream(x);
|
std::stringstream stream(x);
|
||||||
stream >> result;
|
stream >> result;
|
||||||
@@ -310,7 +415,8 @@ T from_string(const std::string &x) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
wcstring to_string(const T &x) {
|
wcstring to_string(const T &x)
|
||||||
|
{
|
||||||
std::wstringstream stream;
|
std::wstringstream stream;
|
||||||
stream << x;
|
stream << x;
|
||||||
return stream.str();
|
return stream.str();
|
||||||
@@ -318,165 +424,150 @@ wcstring to_string(const T &x) {
|
|||||||
|
|
||||||
/* wstringstream is a huge memory pig. Let's provide some specializations where we can. */
|
/* wstringstream is a huge memory pig. Let's provide some specializations where we can. */
|
||||||
template<>
|
template<>
|
||||||
inline wcstring to_string(const long &x) {
|
inline wcstring to_string(const long &x)
|
||||||
|
{
|
||||||
wchar_t buff[128];
|
wchar_t buff[128];
|
||||||
format_long_safe(buff, x);
|
format_long_safe(buff, x);
|
||||||
return wcstring(buff);
|
return wcstring(buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
inline bool from_string(const std::string &x) {
|
inline bool from_string(const std::string &x)
|
||||||
|
{
|
||||||
return ! x.empty() && strchr("YTyt1", x.at(0));
|
return ! x.empty() && strchr("YTyt1", x.at(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
inline bool from_string(const wcstring &x) {
|
inline bool from_string(const wcstring &x)
|
||||||
|
{
|
||||||
return ! x.empty() && wcschr(L"YTyt1", x.at(0));
|
return ! x.empty() && wcschr(L"YTyt1", x.at(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
inline wcstring to_string(const int &x) {
|
inline wcstring to_string(const int &x)
|
||||||
|
{
|
||||||
return to_string(static_cast<long>(x));
|
return to_string(static_cast<long>(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wchar_t **make_null_terminated_array(const wcstring_list_t &lst);
|
||||||
|
char **make_null_terminated_array(const std::vector<std::string> &lst);
|
||||||
|
|
||||||
/* Helper class for managing a null-terminated array of null-terminated strings (of some char type) */
|
/* Helper class for managing a null-terminated array of null-terminated strings (of some char type) */
|
||||||
template <typename CharType_t>
|
template <typename CharType_t>
|
||||||
class null_terminated_array_t {
|
class null_terminated_array_t
|
||||||
|
{
|
||||||
CharType_t **array;
|
CharType_t **array;
|
||||||
|
|
||||||
typedef std::basic_string<CharType_t> string_t;
|
|
||||||
typedef std::vector<string_t> string_list_t;
|
|
||||||
|
|
||||||
void swap(null_terminated_array_t<CharType_t> &him) { std::swap(array, him.array); }
|
/* No assignment or copying */
|
||||||
|
void operator=(null_terminated_array_t rhs);
|
||||||
|
null_terminated_array_t(const null_terminated_array_t &);
|
||||||
|
|
||||||
/* Silly function to get the length of a null terminated array of...something */
|
typedef std::vector<std::basic_string<CharType_t> > string_list_t;
|
||||||
template <typename T>
|
|
||||||
static size_t count_not_null(const T *arr) {
|
|
||||||
size_t len;
|
|
||||||
for (len=0; arr[len] != T(0); len++)
|
|
||||||
;
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t size() const {
|
size_t size() const
|
||||||
return count_not_null(array);
|
{
|
||||||
}
|
size_t len = 0;
|
||||||
|
if (array != NULL)
|
||||||
void free(void) {
|
{
|
||||||
if (array != NULL) {
|
while (array[len] != NULL)
|
||||||
for (size_t i = 0; array[i] != NULL; i++) {
|
{
|
||||||
delete [] array[i];
|
len++;
|
||||||
}
|
}
|
||||||
delete [] array;
|
|
||||||
array = NULL;
|
|
||||||
}
|
}
|
||||||
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
void free(void)
|
||||||
|
{
|
||||||
|
::free((void *)array);
|
||||||
|
array = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
null_terminated_array_t() : array(NULL) { }
|
null_terminated_array_t() : array(NULL) { }
|
||||||
null_terminated_array_t(const string_list_t &argv) : array(NULL) { this->set(argv); }
|
null_terminated_array_t(const string_list_t &argv) : array(make_null_terminated_array(argv))
|
||||||
~null_terminated_array_t() { this->free(); }
|
{
|
||||||
|
|
||||||
/** operator=. Notice the pass-by-value parameter. */
|
|
||||||
null_terminated_array_t& operator=(null_terminated_array_t rhs) {
|
|
||||||
if (this != &rhs)
|
|
||||||
this->swap(rhs);
|
|
||||||
return *this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy constructor. */
|
|
||||||
null_terminated_array_t(const null_terminated_array_t &him) : array(NULL) {
|
|
||||||
this->set(him.array);
|
|
||||||
}
|
|
||||||
|
|
||||||
void set(const string_list_t &argv) {
|
|
||||||
/* Get rid of the old argv */
|
|
||||||
this->free();
|
|
||||||
|
|
||||||
/* Allocate our null-terminated array of null-terminated strings */
|
~null_terminated_array_t()
|
||||||
size_t i, count = argv.size();
|
{
|
||||||
this->array = new CharType_t * [count + 1];
|
|
||||||
for (i=0; i < count; i++) {
|
|
||||||
const string_t &str = argv.at(i);
|
|
||||||
this->array[i] = new CharType_t [1 + str.size()];
|
|
||||||
std::copy(str.begin(), str.end(), this->array[i]);
|
|
||||||
this->array[i][str.size()] = CharType_t(0);
|
|
||||||
}
|
|
||||||
this->array[count] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void set(const CharType_t * const *new_array) {
|
|
||||||
if (new_array == array)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Get rid of the old argv */
|
|
||||||
this->free();
|
this->free();
|
||||||
|
|
||||||
/* Copy the new one */
|
|
||||||
if (new_array) {
|
|
||||||
size_t i, count = count_not_null(new_array);
|
|
||||||
this->array = new CharType_t * [count + 1];
|
|
||||||
for (i=0; i < count; i++) {
|
|
||||||
size_t len = count_not_null(new_array[i]);
|
|
||||||
this->array[i] = new CharType_t [1 + len];
|
|
||||||
std::copy(new_array[i], new_array[i] + len, this->array[i]);
|
|
||||||
this->array[i][len] = CharType_t(0);
|
|
||||||
}
|
|
||||||
this->array[count] = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CharType_t **get() { return array; }
|
void set(const string_list_t &argv)
|
||||||
const CharType_t * const *get() const { return array; }
|
{
|
||||||
|
this->free();
|
||||||
string_list_t to_list() const {
|
this->array = make_null_terminated_array(argv);
|
||||||
string_list_t lst;
|
}
|
||||||
if (array != NULL) {
|
|
||||||
size_t count = this->size();
|
const CharType_t * const *get() const
|
||||||
lst.reserve(count);
|
{
|
||||||
lst.insert(lst.end(), array, array + count);
|
return array;
|
||||||
}
|
}
|
||||||
return lst;
|
|
||||||
|
void clear()
|
||||||
|
{
|
||||||
|
this->free();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Helper function to convert from a null_terminated_array_t<wchar_t> to a null_terminated_array_t<char_t> */
|
/* Helper function to convert from a null_terminated_array_t<wchar_t> to a null_terminated_array_t<char_t> */
|
||||||
null_terminated_array_t<char> convert_wide_array_to_narrow(const null_terminated_array_t<wchar_t> &arr);
|
void convert_wide_array_to_narrow(const null_terminated_array_t<wchar_t> &arr, null_terminated_array_t<char> *output);
|
||||||
|
|
||||||
/* Helper class to cache a narrow version of a wcstring in a malloc'd buffer, so that we can read it after fork() */
|
/* Helper class to cache a narrow version of a wcstring in a malloc'd buffer, so that we can read it after fork() */
|
||||||
class narrow_string_rep_t {
|
class narrow_string_rep_t
|
||||||
private:
|
{
|
||||||
|
private:
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
||||||
/* No copying */
|
/* No copying */
|
||||||
narrow_string_rep_t &operator=(const narrow_string_rep_t &);
|
narrow_string_rep_t &operator=(const narrow_string_rep_t &);
|
||||||
narrow_string_rep_t(const narrow_string_rep_t &x);
|
narrow_string_rep_t(const narrow_string_rep_t &x);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~narrow_string_rep_t() {
|
~narrow_string_rep_t()
|
||||||
|
{
|
||||||
free((void *)str);
|
free((void *)str);
|
||||||
}
|
}
|
||||||
|
|
||||||
narrow_string_rep_t() : str(NULL) {}
|
narrow_string_rep_t() : str(NULL) {}
|
||||||
|
|
||||||
void set(const wcstring &s) {
|
void set(const wcstring &s)
|
||||||
|
{
|
||||||
free((void *)str);
|
free((void *)str);
|
||||||
str = wcs2str(s.c_str());
|
str = wcs2str(s.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *get() const {
|
const char *get() const
|
||||||
|
{
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
bool is_forked_child();
|
bool is_forked_child();
|
||||||
|
|
||||||
|
|
||||||
|
class mutex_lock_t
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
pthread_mutex_t mutex;
|
||||||
|
mutex_lock_t()
|
||||||
|
{
|
||||||
|
VOMIT_ON_FAILURE_NO_ERRNO(pthread_mutex_init(&mutex, NULL));
|
||||||
|
}
|
||||||
|
|
||||||
|
~mutex_lock_t()
|
||||||
|
{
|
||||||
|
VOMIT_ON_FAILURE_NO_ERRNO(pthread_mutex_destroy(&mutex));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/* Basic scoped lock class */
|
/* Basic scoped lock class */
|
||||||
class scoped_lock {
|
class scoped_lock
|
||||||
|
{
|
||||||
pthread_mutex_t *lock_obj;
|
pthread_mutex_t *lock_obj;
|
||||||
bool locked;
|
bool locked;
|
||||||
|
|
||||||
/* No copying */
|
/* No copying */
|
||||||
scoped_lock &operator=(const scoped_lock &);
|
scoped_lock &operator=(const scoped_lock &);
|
||||||
scoped_lock(const scoped_lock &);
|
scoped_lock(const scoped_lock &);
|
||||||
@@ -485,25 +576,110 @@ class scoped_lock {
|
|||||||
void lock(void);
|
void lock(void);
|
||||||
void unlock(void);
|
void unlock(void);
|
||||||
scoped_lock(pthread_mutex_t &mutex);
|
scoped_lock(pthread_mutex_t &mutex);
|
||||||
|
scoped_lock(mutex_lock_t &lock);
|
||||||
~scoped_lock();
|
~scoped_lock();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class rwlock_t
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
pthread_rwlock_t rwlock;
|
||||||
|
rwlock_t()
|
||||||
|
{
|
||||||
|
VOMIT_ON_FAILURE_NO_ERRNO(pthread_rwlock_init(&rwlock, NULL));
|
||||||
|
}
|
||||||
|
|
||||||
|
~rwlock_t()
|
||||||
|
{
|
||||||
|
VOMIT_ON_FAILURE_NO_ERRNO(pthread_rwlock_destroy(&rwlock));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Scoped lock class for rwlocks
|
||||||
|
*/
|
||||||
|
class scoped_rwlock
|
||||||
|
{
|
||||||
|
pthread_rwlock_t *rwlock_obj;
|
||||||
|
bool locked;
|
||||||
|
bool locked_shared;
|
||||||
|
|
||||||
|
/* No copying */
|
||||||
|
scoped_rwlock &operator=(const scoped_lock &);
|
||||||
|
scoped_rwlock(const scoped_lock &);
|
||||||
|
|
||||||
|
public:
|
||||||
|
void lock(void);
|
||||||
|
void unlock(void);
|
||||||
|
void lock_shared(void);
|
||||||
|
void unlock_shared(void);
|
||||||
|
/*
|
||||||
|
upgrade shared lock to exclusive.
|
||||||
|
equivalent to `lock.unlock_shared(); lock.lock();`
|
||||||
|
*/
|
||||||
|
void upgrade(void);
|
||||||
|
scoped_rwlock(pthread_rwlock_t &rwlock, bool shared = false);
|
||||||
|
scoped_rwlock(rwlock_t &rwlock, bool shared = false);
|
||||||
|
~scoped_rwlock();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
A scoped manager to save the current value of some variable, and optionally
|
||||||
|
set it to a new value. On destruction it restores the variable to its old
|
||||||
|
value.
|
||||||
|
|
||||||
|
This can be handy when there are multiple code paths to exit a block.
|
||||||
|
*/
|
||||||
|
template <typename T>
|
||||||
|
class scoped_push
|
||||||
|
{
|
||||||
|
T * const ref;
|
||||||
|
T saved_value;
|
||||||
|
bool restored;
|
||||||
|
|
||||||
|
public:
|
||||||
|
scoped_push(T *r): ref(r), saved_value(*r), restored(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
scoped_push(T *r, const T &new_value) : ref(r), saved_value(*r), restored(false)
|
||||||
|
{
|
||||||
|
*r = new_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
~scoped_push()
|
||||||
|
{
|
||||||
|
restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
void restore()
|
||||||
|
{
|
||||||
|
if (!restored)
|
||||||
|
{
|
||||||
|
std::swap(*ref, saved_value);
|
||||||
|
restored = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Wrapper around wcstok */
|
/* Wrapper around wcstok */
|
||||||
class wcstokenizer {
|
class wcstokenizer
|
||||||
|
{
|
||||||
wchar_t *buffer, *str, *state;
|
wchar_t *buffer, *str, *state;
|
||||||
const wcstring sep;
|
const wcstring sep;
|
||||||
|
|
||||||
/* No copying */
|
/* No copying */
|
||||||
wcstokenizer &operator=(const wcstokenizer &);
|
wcstokenizer &operator=(const wcstokenizer &);
|
||||||
wcstokenizer(const wcstokenizer &);
|
wcstokenizer(const wcstokenizer &);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wcstokenizer(const wcstring &s, const wcstring &separator);
|
wcstokenizer(const wcstring &s, const wcstring &separator);
|
||||||
bool next(wcstring &result);
|
bool next(wcstring &result);
|
||||||
~wcstokenizer();
|
~wcstokenizer();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Appends a path component, with a / if necessary
|
Appends a path component, with a / if necessary
|
||||||
*/
|
*/
|
||||||
void append_path_component(wcstring &path, const wcstring &component);
|
void append_path_component(wcstring &path, const wcstring &component);
|
||||||
@@ -511,43 +687,40 @@ void append_path_component(wcstring &path, const wcstring &component);
|
|||||||
wcstring format_string(const wchar_t *format, ...);
|
wcstring format_string(const wchar_t *format, ...);
|
||||||
wcstring vformat_string(const wchar_t *format, va_list va_orig);
|
wcstring vformat_string(const wchar_t *format, va_list va_orig);
|
||||||
void append_format(wcstring &str, const wchar_t *format, ...);
|
void append_format(wcstring &str, const wchar_t *format, ...);
|
||||||
|
void append_formatv(wcstring &str, const wchar_t *format, va_list ap);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns a newly allocated wide character string array equivalent of
|
Test if the given string is a valid variable name.
|
||||||
the specified multibyte character string array
|
|
||||||
*/
|
|
||||||
char **wcsv2strv( const wchar_t * const *in );
|
|
||||||
|
|
||||||
/**
|
|
||||||
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
|
\return null if this is a valid name, and a pointer to the first invalid character otherwise
|
||||||
*/
|
*/
|
||||||
|
|
||||||
wchar_t *wcsvarname( const wchar_t *str );
|
const wchar_t *wcsvarname(const wchar_t *str);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Test if the given string is a valid function name.
|
Test if the given string is a valid function name.
|
||||||
|
|
||||||
\return null if this is a valid name, and a pointer to the first invalid character otherwise
|
\return null if this is a valid name, and a pointer to the first invalid character otherwise
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const wchar_t *wcsfuncname( const wchar_t *str );
|
const wchar_t *wcsfuncname(const wchar_t *str);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Test if the given string is valid in a variable name
|
Test if the given string is valid in a variable name
|
||||||
|
|
||||||
\return 1 if this is a valid name, 0 otherwise
|
\return true if this is a valid name, false otherwise
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int wcsvarchr( wchar_t chr );
|
bool wcsvarchr(wchar_t chr);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
A wcswidth workalike. Fish uses this since the regular wcswidth seems flaky.
|
Convenience variants on fish_wcwswidth().
|
||||||
|
|
||||||
|
See fallback.h for the normal definitions.
|
||||||
*/
|
*/
|
||||||
int my_wcswidth( const wchar_t *c );
|
int fish_wcswidth(const wchar_t *str);
|
||||||
|
int fish_wcswidth(const wcstring& str);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This functions returns the end of the quoted substring beginning at
|
This functions returns the end of the quoted substring beginning at
|
||||||
@@ -556,7 +729,7 @@ int my_wcswidth( const wchar_t *c );
|
|||||||
|
|
||||||
\param in the position of the opening quote
|
\param in the position of the opening quote
|
||||||
*/
|
*/
|
||||||
wchar_t *quote_end( const wchar_t *in );
|
wchar_t *quote_end(const wchar_t *in);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
A call to this function will reset the error counter. Some
|
A call to this function will reset the error counter. Some
|
||||||
@@ -572,19 +745,19 @@ void error_reset();
|
|||||||
This function behaves exactly like a wide character equivalent of
|
This function behaves exactly like a wide character equivalent of
|
||||||
the C function setlocale, except that it will also try to detect if
|
the C function setlocale, except that it will also try to detect if
|
||||||
the user is using a Unicode character set, and if so, use the
|
the user is using a Unicode character set, and if so, use the
|
||||||
unicode ellipsis character as ellipsis, instead of '$'.
|
unicode ellipsis character as ellipsis, instead of '$'.
|
||||||
*/
|
*/
|
||||||
wcstring wsetlocale( int category, const wchar_t *locale );
|
wcstring wsetlocale(int category, const wchar_t *locale);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Checks if \c needle is included in the list of strings specified. A warning is printed if needle is zero.
|
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
|
\param needle the string to search for in the list
|
||||||
|
|
||||||
\return zero if needle is not found, of if needle is null, non-zero otherwise
|
\return zero if needle is not found, of if needle is null, non-zero otherwise
|
||||||
*/
|
*/
|
||||||
__sentinel bool contains_internal( const wchar_t *needle, ... );
|
__sentinel bool contains_internal(const wchar_t *needle, int vararg_handle, ...);
|
||||||
__sentinel bool contains_internal( const wcstring &needle, ... );
|
__sentinel bool contains_internal(const wcstring &needle, int vararg_handle, ...);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Call read while blocking the SIGCHLD signal. Should only be called
|
Call read while blocking the SIGCHLD signal. Should only be called
|
||||||
@@ -594,13 +767,13 @@ __sentinel bool contains_internal( const wcstring &needle, ... );
|
|||||||
long read_blocked(int fd, void *buf, size_t count);
|
long read_blocked(int fd, void *buf, size_t count);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Loop a write request while failiure is non-critical. Return -1 and set errno
|
Loop a write request while failure is non-critical. Return -1 and set errno
|
||||||
in case of critical error.
|
in case of critical error.
|
||||||
*/
|
*/
|
||||||
ssize_t write_loop(int fd, const char *buff, size_t count);
|
ssize_t write_loop(int fd, const char *buff, size_t count);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Loop a read request while failiure is non-critical. Return -1 and set errno
|
Loop a read request while failure is non-critical. Return -1 and set errno
|
||||||
in case of critical error.
|
in case of critical error.
|
||||||
*/
|
*/
|
||||||
ssize_t read_loop(int fd, void *buff, size_t count);
|
ssize_t read_loop(int fd, void *buff, size_t count);
|
||||||
@@ -614,9 +787,9 @@ ssize_t read_loop(int fd, void *buff, size_t count);
|
|||||||
Because debug is often called to tell the user about an error,
|
Because debug is often called to tell the user about an error,
|
||||||
before using wperror to give a specific error message, debug will
|
before using wperror to give a specific error message, debug will
|
||||||
never ever modify the value of errno.
|
never ever modify the value of errno.
|
||||||
|
|
||||||
\param level the priority of the message. Lower number means higher priority. Messages with a priority_number higher than \c debug_level will be ignored..
|
\param level the priority of the message. Lower number means higher priority. Messages with a priority_number higher than \c debug_level will be ignored..
|
||||||
\param msg the message format string.
|
\param msg the message format string.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
@@ -624,20 +797,23 @@ ssize_t read_loop(int fd, void *buff, size_t count);
|
|||||||
|
|
||||||
will print the string 'fish: Pi = 3.141', given that debug_level is 1 or higher, and that program_name is 'fish'.
|
will print the string 'fish: Pi = 3.141', given that debug_level is 1 or higher, and that program_name is 'fish'.
|
||||||
*/
|
*/
|
||||||
void debug( int level, const char *msg, ... );
|
void debug(int level, const char *msg, ...);
|
||||||
void debug( int level, const wchar_t *msg, ... );
|
void debug(int level, const wchar_t *msg, ...);
|
||||||
|
|
||||||
|
/** Writes a string to stderr, followed by a newline */
|
||||||
|
void print_stderr(const wcstring &str);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Replace special characters with backslash escape sequences. Newline is
|
Replace special characters with backslash escape sequences. Newline is
|
||||||
replaced with \n, etc.
|
replaced with \n, etc.
|
||||||
|
|
||||||
\param in The string to be escaped
|
\param in The string to be escaped
|
||||||
\param escape_all Whether all characters wich hold special meaning in fish (Pipe, semicolon, etc,) should be escaped, or only unprintable characters
|
\param flags Flags to control the escaping
|
||||||
\return The escaped string, or 0 if there is not enough memory
|
\return The escaped string
|
||||||
*/
|
*/
|
||||||
|
|
||||||
wchar_t *escape( const wchar_t *in, escape_flags_t flags );
|
wcstring escape(const wchar_t *in, escape_flags_t flags);
|
||||||
wcstring escape_string( const wcstring &in, escape_flags_t flags );
|
wcstring escape_string(const wcstring &in, escape_flags_t flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Expand backslashed escapes and substitute them with their unescaped
|
Expand backslashed escapes and substitute them with their unescaped
|
||||||
@@ -645,19 +821,17 @@ wcstring escape_string( const wcstring &in, escape_flags_t flags );
|
|||||||
character and a few more into constants which are defined in a
|
character and a few more into constants which are defined in a
|
||||||
private use area of Unicode. This assumes wchar_t is a unicode
|
private use area of Unicode. This assumes wchar_t is a unicode
|
||||||
character set.
|
character set.
|
||||||
|
|
||||||
The result must be free()d. The original string is not modified. If
|
|
||||||
an invalid sequence is specified, 0 is returned.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
wchar_t *unescape( const wchar_t * in,
|
|
||||||
int escape_special );
|
|
||||||
|
|
||||||
bool unescape_string( wcstring &str,
|
/** Unescapes a string in-place. A true result indicates the string was unescaped, a false result indicates the string was unmodified. */
|
||||||
int escape_special );
|
bool unescape_string_in_place(wcstring *str, unescape_flags_t escape_special);
|
||||||
|
|
||||||
|
/** Unescapes a string, returning the unescaped value by reference. On failure, the output is set to an empty string. */
|
||||||
|
bool unescape_string(const wchar_t *input, wcstring *output, unescape_flags_t escape_special);
|
||||||
|
bool unescape_string(const wcstring &input, wcstring *output, unescape_flags_t escape_special);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the width of the terminal window, so that not all
|
Returns the width of the terminal window, so that not all
|
||||||
functions that use these values continually have to keep track of
|
functions that use these values continually have to keep track of
|
||||||
it separately.
|
it separately.
|
||||||
@@ -679,20 +853,20 @@ int common_get_height();
|
|||||||
saving it in an internal variable used by common_get_wisth and
|
saving it in an internal variable used by common_get_wisth and
|
||||||
common_get_height().
|
common_get_height().
|
||||||
*/
|
*/
|
||||||
void common_handle_winch( int signal );
|
void common_handle_winch(int signal);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Write paragraph of output to the specified stringbuffer, and redo
|
Write paragraph of output to the specified stringbuffer, and redo
|
||||||
the linebreaks to fit the current screen.
|
the linebreaks to fit the current screen.
|
||||||
*/
|
*/
|
||||||
void write_screen( const wcstring &msg, wcstring &buff );
|
void write_screen(const wcstring &msg, wcstring &buff);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Tokenize the specified string into the specified wcstring_list_t.
|
Tokenize the specified string into the specified wcstring_list_t.
|
||||||
\param val the input string. The contents of this string is not changed.
|
\param val the input string. The contents of this string is not changed.
|
||||||
\param out the list in which to place the elements.
|
\param out the list in which to place the elements.
|
||||||
*/
|
*/
|
||||||
void tokenize_variable_array( const wcstring &val, wcstring_list_t &out);
|
void tokenize_variable_array(const wcstring &val, wcstring_list_t &out);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Make sure the specified direcotry exists. If needed, try to create
|
Make sure the specified direcotry exists. If needed, try to create
|
||||||
@@ -700,7 +874,7 @@ void tokenize_variable_array( const wcstring &val, wcstring_list_t &out);
|
|||||||
|
|
||||||
\return 0 if, at the time of function return the directory exists, -1 otherwise.
|
\return 0 if, at the time of function return the directory exists, -1 otherwise.
|
||||||
*/
|
*/
|
||||||
int create_directory( const wcstring &d );
|
int create_directory(const wcstring &d);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Print a short message about how to file a bug report to stderr
|
Print a short message about how to file a bug report to stderr
|
||||||
@@ -739,8 +913,11 @@ void assert_is_not_forked_child(const char *who);
|
|||||||
#define ASSERT_IS_NOT_FORKED_CHILD_TRAMPOLINE(x) assert_is_not_forked_child(x)
|
#define ASSERT_IS_NOT_FORKED_CHILD_TRAMPOLINE(x) assert_is_not_forked_child(x)
|
||||||
#define ASSERT_IS_NOT_FORKED_CHILD() ASSERT_IS_NOT_FORKED_CHILD_TRAMPOLINE(__FUNCTION__)
|
#define ASSERT_IS_NOT_FORKED_CHILD() ASSERT_IS_NOT_FORKED_CHILD_TRAMPOLINE(__FUNCTION__)
|
||||||
|
|
||||||
|
/** Macro to help suppress potentially unused variable warnings */
|
||||||
|
#define USE(var) (void)(var)
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
__attribute__((noinline)) void debug_thread_error(void);
|
__attribute__((noinline)) void debug_thread_error(void);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
2767
complete.cpp
2767
complete.cpp
File diff suppressed because it is too large
Load Diff
283
complete.h
283
complete.h
@@ -1,8 +1,8 @@
|
|||||||
/** \file complete.h
|
/** \file complete.h
|
||||||
Prototypes for functions related to tab-completion.
|
Prototypes for functions related to tab-completion.
|
||||||
|
|
||||||
These functions are used for storing and retrieving tab-completion
|
These functions are used for storing and retrieving tab-completion
|
||||||
data, as well as for performing tab-completion.
|
data, as well as for performing tab-completion.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef FISH_COMPLETE_H
|
#ifndef FISH_COMPLETE_H
|
||||||
@@ -14,92 +14,73 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
/**
|
/**
|
||||||
Use all completions
|
* Use all completions
|
||||||
*/
|
*/
|
||||||
#define SHARED 0
|
#define SHARED 0
|
||||||
/**
|
/**
|
||||||
Do not use file completion
|
* Do not use file completion
|
||||||
*/
|
*/
|
||||||
#define NO_FILES 1
|
#define NO_FILES 1
|
||||||
/**
|
/**
|
||||||
Require a parameter after completion
|
* Require a parameter after completion
|
||||||
*/
|
*/
|
||||||
#define NO_COMMON 2
|
#define NO_COMMON 2
|
||||||
/**
|
/**
|
||||||
Only use the argument list specifies with completion after
|
* Only use the argument list specifies with completion after
|
||||||
option. This is the same as (NO_FILES & NO_COMMON)
|
* option. This is the same as (NO_FILES | NO_COMMON)
|
||||||
*/
|
*/
|
||||||
#define EXCLUSIVE 3
|
#define EXCLUSIVE 3
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Command is a path
|
* Command is a path
|
||||||
*/
|
*/
|
||||||
#define PATH 1
|
#define PATH 1
|
||||||
/**
|
/**
|
||||||
Command is not a path
|
* Command is not a path
|
||||||
*/
|
*/
|
||||||
#define COMMAND 0
|
#define COMMAND 0
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Separator between completion and description
|
* Separator between completion and description
|
||||||
*/
|
*/
|
||||||
#define COMPLETE_SEP L'\004'
|
#define COMPLETE_SEP L'\004'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Separator between completion and description
|
* Separator between completion and description
|
||||||
*/
|
*/
|
||||||
#define COMPLETE_SEP_STR L"\004"
|
#define COMPLETE_SEP_STR L"\004"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Separator between completion items in fish_pager. This is used for
|
* Character that separates the completion and description on
|
||||||
completion grouping, e.g. when putting completions with the same
|
* programmable completions
|
||||||
descriptions on the same line.
|
*/
|
||||||
*/
|
|
||||||
#define COMPLETE_ITEM_SEP L'\uf500'
|
|
||||||
|
|
||||||
/**
|
|
||||||
Character that separates the completion and description on
|
|
||||||
programmable completions
|
|
||||||
*/
|
|
||||||
#define PROG_COMPLETE_SEP L'\t'
|
#define PROG_COMPLETE_SEP L'\t'
|
||||||
|
|
||||||
enum {
|
enum
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
Do not insert space afterwards if this is the only completion. (The
|
Do not insert space afterwards if this is the only completion. (The
|
||||||
default is to try insert a space)
|
default is to try insert a space)
|
||||||
*/
|
*/
|
||||||
COMPLETE_NO_SPACE = 1 << 0,
|
COMPLETE_NO_SPACE = 1 << 0,
|
||||||
|
|
||||||
/**
|
/** This is not the suffix of a token, but replaces it entirely */
|
||||||
This compeltion is case insensitive.
|
COMPLETE_REPLACES_TOKEN = 1 << 2,
|
||||||
|
|
||||||
Warning: The contents of the completion_t structure is actually
|
/** This completion may or may not want a space at the end - guess by
|
||||||
different if this flag is set! Specifically, the completion string
|
checking the last character of the completion. */
|
||||||
contains the _entire_ completion token, not only the current
|
|
||||||
*/
|
|
||||||
COMPLETE_NO_CASE = 1 << 1,
|
|
||||||
|
|
||||||
/**
|
|
||||||
This compeltion is the whole argument, not just the remainder. This
|
|
||||||
flag must never be set on completions returned from the complete()
|
|
||||||
function. It is strictly for internal use in the completion code.
|
|
||||||
*/
|
|
||||||
COMPLETE_WHOLE_ARGUMENT = 1 << 2,
|
|
||||||
|
|
||||||
/**
|
|
||||||
This completion may or may not want a space at the end - guess by
|
|
||||||
checking the last character of the completion.
|
|
||||||
*/
|
|
||||||
COMPLETE_AUTO_SPACE = 1 << 3,
|
COMPLETE_AUTO_SPACE = 1 << 3,
|
||||||
|
|
||||||
/**
|
/** This completion should be inserted as-is, without escaping. */
|
||||||
This completion should be inserted as-is, without escaping.
|
COMPLETE_DONT_ESCAPE = 1 << 4,
|
||||||
*/
|
|
||||||
COMPLETE_DONT_ESCAPE = 1 << 4
|
/** If you do escape, don't escape tildes */
|
||||||
|
COMPLETE_DONT_ESCAPE_TILDES = 1 << 5
|
||||||
};
|
};
|
||||||
typedef int complete_flags_t;
|
typedef int complete_flags_t;
|
||||||
|
|
||||||
@@ -109,68 +90,67 @@ class completion_t
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
/* No public default constructor */
|
/* No public default constructor */
|
||||||
completion_t();
|
completion_t();
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/* Destructor. Not inlining it saves code size. */
|
||||||
The completion string
|
~completion_t();
|
||||||
*/
|
|
||||||
wcstring completion;
|
|
||||||
|
|
||||||
/**
|
/** The completion string */
|
||||||
The description for this completion
|
wcstring completion;
|
||||||
*/
|
|
||||||
wcstring description;
|
|
||||||
|
|
||||||
/**
|
/** The description for this completion */
|
||||||
Flags determining the completion behaviour.
|
wcstring description;
|
||||||
|
|
||||||
Determines whether a space should be inserted after this
|
/** The type of fuzzy match */
|
||||||
compeltion if it is the only possible completion using the
|
string_fuzzy_match_t match;
|
||||||
COMPLETE_NO_SPACE flag.
|
|
||||||
|
/**
|
||||||
|
Flags determining the completion behaviour.
|
||||||
|
|
||||||
|
Determines whether a space should be inserted after this
|
||||||
|
completion if it is the only possible completion using the
|
||||||
|
COMPLETE_NO_SPACE flag.
|
||||||
|
|
||||||
|
The COMPLETE_NO_CASE can be used to signal that this completion
|
||||||
|
is case insensitive.
|
||||||
|
*/
|
||||||
|
complete_flags_t flags;
|
||||||
|
|
||||||
The COMPLETE_NO_CASE can be used to signal that this completion
|
|
||||||
is case insensitive.
|
|
||||||
*/
|
|
||||||
int flags;
|
|
||||||
|
|
||||||
bool is_case_insensitive() const { return !! (flags & COMPLETE_NO_CASE); }
|
|
||||||
|
|
||||||
/* Construction. Note: defining these so that they are not inlined reduces the executable size. */
|
/* Construction. Note: defining these so that they are not inlined reduces the executable size. */
|
||||||
completion_t(const wcstring &comp, const wcstring &desc = L"", int flags_val = 0);
|
completion_t(const wcstring &comp, const wcstring &desc = wcstring(), string_fuzzy_match_t match = string_fuzzy_match_t(fuzzy_match_exact), complete_flags_t flags_val = 0);
|
||||||
completion_t(const completion_t &);
|
completion_t(const completion_t &);
|
||||||
completion_t &operator=(const completion_t &);
|
completion_t &operator=(const completion_t &);
|
||||||
|
|
||||||
|
/* Compare two completions. No operating overlaoding to make this always explicit (there's potentially multiple ways to compare completions). */
|
||||||
|
|
||||||
/* The following are needed for sorting and uniquing completions */
|
/* "Naturally less than" means in a natural ordering, where digits are treated as numbers. For example, foo10 is naturally greater than foo2 (but alphabetically less than it) */
|
||||||
bool operator < (const completion_t& rhs) const;
|
static bool is_naturally_less_than(const completion_t &a, const completion_t &b);
|
||||||
bool operator == (const completion_t& rhs) const;
|
static bool is_alphabetically_equal_to(const completion_t &a, const completion_t &b);
|
||||||
bool operator != (const completion_t& rhs) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum complete_type_t {
|
enum
|
||||||
COMPLETE_DEFAULT,
|
{
|
||||||
COMPLETE_AUTOSUGGEST
|
COMPLETION_REQUEST_DEFAULT = 0,
|
||||||
|
COMPLETION_REQUEST_AUTOSUGGESTION = 1 << 0, // indicates the completion is for an autosuggestion
|
||||||
|
COMPLETION_REQUEST_DESCRIPTIONS = 1 << 1, // indicates that we want descriptions
|
||||||
|
COMPLETION_REQUEST_FUZZY_MATCH = 1 << 2 // indicates that we don't require a prefix match
|
||||||
};
|
};
|
||||||
|
typedef uint32_t completion_request_flags_t;
|
||||||
/** Given a list of completions, returns a list of their completion fields */
|
|
||||||
wcstring_list_t completions_to_wcstring_list( const std::vector<completion_t> &completions );
|
|
||||||
|
|
||||||
/** Sorts a list of completions */
|
|
||||||
void sort_completions( std::vector<completion_t> &completions);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Add a completion.
|
Add a completion.
|
||||||
|
|
||||||
All supplied values are copied, they should be freed by or otherwise
|
All supplied values are copied, they should be freed by or otherwise
|
||||||
disposed by the caller.
|
disposed by the caller.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
The command 'gcc -o' requires that a file follows it, so the
|
The command 'gcc -o' requires that a file follows it, so the
|
||||||
NO_COMMON option is suitable. This can be done using the following
|
NO_COMMON option is suitable. This can be done using the following
|
||||||
line:
|
line:
|
||||||
|
|
||||||
complete -c gcc -s o -r
|
complete -c gcc -s o -r
|
||||||
|
|
||||||
The command 'grep -d' required that one of the strings 'read',
|
The command 'grep -d' required that one of the strings 'read',
|
||||||
@@ -183,74 +163,81 @@ void sort_completions( std::vector<completion_t> &completions);
|
|||||||
|
|
||||||
\param cmd Command to complete.
|
\param cmd Command to complete.
|
||||||
\param cmd_type If cmd_type is PATH, cmd will be interpreted as the absolute
|
\param cmd_type If cmd_type is PATH, cmd will be interpreted as the absolute
|
||||||
path of the program (optionally containing wildcards), otherwise it
|
path of the program (optionally containing wildcards), otherwise it
|
||||||
will be interpreted as the command name.
|
will be interpreted as the command name.
|
||||||
\param short_opt The single character name of an option. (-a is a short option, --all and -funroll are long options)
|
\param short_opt The single character name of an option. (-a is a short option,
|
||||||
\param long_opt The multi character name of an option. (-a is a short option, --all and -funroll are long options)
|
--all and -funroll are long options)
|
||||||
\param long_mode Whether to use old style, single dash long options.
|
\param long_opt The multi character name of an option. (-a is a short option,
|
||||||
|
--all and -funroll are long options)
|
||||||
|
\param long_mode Whether to use old style, single dash long options.
|
||||||
\param result_mode Whether to search further completions when this
|
\param result_mode Whether to search further completions when this
|
||||||
completion has been succesfully matched. If result_mode is SHARED,
|
completion has been succesfully matched. If result_mode is SHARED,
|
||||||
any other completions may also be used. If result_mode is NO_FILES,
|
any other completions may also be used. If result_mode is NO_FILES,
|
||||||
file completion should not be used, but other completions may be
|
file completion should not be used, but other completions may be
|
||||||
used. If result_mode is NO_COMMON, on option may follow it - only a
|
used. If result_mode is NO_COMMON, on option may follow it - only a
|
||||||
parameter. If result_mode is EXCLUSIVE, no option may follow it, and
|
parameter. If result_mode is EXCLUSIVE, no option may follow it, and
|
||||||
file completion is not performed.
|
file completion is not performed.
|
||||||
\param comp A space separated list of completions which may contain subshells.
|
\param comp A space separated list of completions which may contain subshells.
|
||||||
\param desc A description of the completion.
|
\param desc A description of the completion.
|
||||||
\param condition a command to be run to check it this completion should be used. If \c condition is empty, the completion is always used.
|
\param condition a command to be run to check it this completion should be used.
|
||||||
|
If \c condition is empty, the completion is always used.
|
||||||
\param flags A set of completion flags
|
\param flags A set of completion flags
|
||||||
*/
|
*/
|
||||||
void complete_add( const wchar_t *cmd,
|
void complete_add(const wchar_t *cmd,
|
||||||
bool cmd_is_path,
|
bool cmd_is_path,
|
||||||
wchar_t short_opt,
|
wchar_t short_opt,
|
||||||
const wchar_t *long_opt,
|
const wchar_t *long_opt,
|
||||||
int long_mode,
|
int long_mode,
|
||||||
int result_mode,
|
int result_mode,
|
||||||
const wchar_t *condition,
|
const wchar_t *condition,
|
||||||
const wchar_t *comp,
|
const wchar_t *comp,
|
||||||
const wchar_t *desc,
|
const wchar_t *desc,
|
||||||
int flags );
|
int flags);
|
||||||
/**
|
/**
|
||||||
Sets whether the completion list for this command is complete. If
|
Sets whether the completion list for this command is complete. If
|
||||||
true, any options not matching one of the provided options will be
|
true, any options not matching one of the provided options will be
|
||||||
flagged as an error by syntax highlighting.
|
flagged as an error by syntax highlighting.
|
||||||
*/
|
*/
|
||||||
void complete_set_authoritative( const wchar_t *cmd, bool cmd_type, bool authoritative );
|
void complete_set_authoritative(const wchar_t *cmd, bool cmd_type, bool authoritative);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Remove a previously defined completion
|
Remove a previously defined completion
|
||||||
*/
|
*/
|
||||||
void complete_remove( const wchar_t *cmd,
|
void complete_remove(const wchar_t *cmd,
|
||||||
bool cmd_is_path,
|
bool cmd_is_path,
|
||||||
wchar_t short_opt,
|
wchar_t short_opt,
|
||||||
const wchar_t *long_opt );
|
const wchar_t *long_opt,
|
||||||
|
int long_mode);
|
||||||
|
|
||||||
|
|
||||||
/** Find all completions of the command cmd, insert them into out. If to_load is not NULL, append all commands that we would autoload, but did not (presumably because this is not the main thread) */
|
/** Find all completions of the command cmd, insert them into out.
|
||||||
void complete( const wcstring &cmd, std::vector<completion_t> &comp, complete_type_t type, wcstring_list_t *to_load = NULL );
|
*/
|
||||||
|
void complete(const wcstring &cmd,
|
||||||
|
std::vector<completion_t> &comp,
|
||||||
|
completion_request_flags_t flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Print a list of all current completions into the string.
|
Print a list of all current completions into the string.
|
||||||
|
|
||||||
\param out The string to write completions to
|
\param out The string to write completions to
|
||||||
*/
|
*/
|
||||||
void complete_print( wcstring &out );
|
void complete_print(wcstring &out);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Tests if the specified option is defined for the specified command
|
Tests if the specified option is defined for the specified command
|
||||||
*/
|
*/
|
||||||
int complete_is_valid_option( const wcstring &str,
|
int complete_is_valid_option(const wcstring &str,
|
||||||
const wcstring &opt,
|
const wcstring &opt,
|
||||||
wcstring_list_t *inErrorsOrNull,
|
wcstring_list_t *inErrorsOrNull,
|
||||||
bool allow_autoload );
|
bool allow_autoload);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Tests if the specified argument is valid for the specified option
|
Tests if the specified argument is valid for the specified option
|
||||||
and command
|
and command
|
||||||
*/
|
*/
|
||||||
bool complete_is_valid_argument( const wcstring &str,
|
bool complete_is_valid_argument(const wcstring &str,
|
||||||
const wcstring &opt,
|
const wcstring &opt,
|
||||||
const wcstring &arg );
|
const wcstring &arg);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -260,9 +247,11 @@ bool complete_is_valid_argument( const wcstring &str,
|
|||||||
with internal dependencies.
|
with internal dependencies.
|
||||||
|
|
||||||
\param cmd the command for which to load command-specific completions
|
\param cmd the command for which to load command-specific completions
|
||||||
\param reload should the commands completions be reloaded, even if they where previously loaded. (This is set to true on actual completions, so that changed completion are updated in running shells)
|
\param reload should the commands completions be reloaded, even if they where
|
||||||
|
previously loaded. (This is set to true on actual completions, so that
|
||||||
|
changed completion are updated in running shells)
|
||||||
*/
|
*/
|
||||||
void complete_load( const wcstring &cmd, bool reload );
|
void complete_load(const wcstring &cmd, bool reload);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create a new completion entry
|
Create a new completion entry
|
||||||
@@ -273,7 +262,17 @@ void complete_load( const wcstring &cmd, bool reload );
|
|||||||
\param flags completion flags
|
\param flags completion flags
|
||||||
|
|
||||||
*/
|
*/
|
||||||
void append_completion(std::vector<completion_t> &completions, const wcstring &comp, const wcstring &desc = L"", int flags = 0);
|
void append_completion(std::vector<completion_t> &completions, const wcstring &comp, const wcstring &desc = wcstring(), int flags = 0, string_fuzzy_match_t match = string_fuzzy_match_t(fuzzy_match_exact));
|
||||||
|
|
||||||
|
/* Function used for testing */
|
||||||
|
void complete_set_variable_names(const wcstring_list_t *names);
|
||||||
|
|
||||||
|
/* Support for "wrap targets." A wrap target is a command that completes liek another command. The target chain is the sequence of wraps (A wraps B wraps C...). Any loops in the chain are silently ignored. */
|
||||||
|
bool complete_add_wrapper(const wcstring &command, const wcstring &wrap_target);
|
||||||
|
bool complete_remove_wrapper(const wcstring &command, const wcstring &wrap_target);
|
||||||
|
wcstring_list_t complete_get_wrap_chain(const wcstring &command);
|
||||||
|
|
||||||
|
/* Wonky interface: returns all wraps. Even-values are the commands, odd values are the targets. */
|
||||||
|
wcstring_list_t complete_get_wrap_pairs();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
570
config.guess
vendored
570
config.guess
vendored
@@ -1,10 +1,10 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Attempt to guess a canonical system name.
|
# Attempt to guess a canonical system name.
|
||||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
|
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||||
# Inc.
|
# 2011, 2012 Free Software Foundation, Inc.
|
||||||
|
|
||||||
timestamp='2006-02-27'
|
timestamp='2012-02-10'
|
||||||
|
|
||||||
# This file is free software; you can redistribute it and/or modify it
|
# This file is free software; you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU General Public License as published by
|
# under the terms of the GNU General Public License as published by
|
||||||
@@ -17,9 +17,7 @@ timestamp='2006-02-27'
|
|||||||
# General Public License for more details.
|
# General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
|
|
||||||
# 02110-1301, USA.
|
|
||||||
#
|
#
|
||||||
# As a special exception to the GNU General Public License, if you
|
# As a special exception to the GNU General Public License, if you
|
||||||
# distribute this file as part of a program that contains a
|
# distribute this file as part of a program that contains a
|
||||||
@@ -27,16 +25,16 @@ timestamp='2006-02-27'
|
|||||||
# the same distribution terms that you use for the rest of that program.
|
# the same distribution terms that you use for the rest of that program.
|
||||||
|
|
||||||
|
|
||||||
# Originally written by Per Bothner <per@bothner.com>.
|
# Originally written by Per Bothner. Please send patches (context
|
||||||
# Please send patches to <config-patches@gnu.org>. Submit a context
|
# diff format) to <config-patches@gnu.org> and include a ChangeLog
|
||||||
# diff and a properly formatted ChangeLog entry.
|
# entry.
|
||||||
#
|
#
|
||||||
# This script attempts to guess a canonical system name similar to
|
# This script attempts to guess a canonical system name similar to
|
||||||
# config.sub. If it succeeds, it prints the system name on stdout, and
|
# config.sub. If it succeeds, it prints the system name on stdout, and
|
||||||
# exits with 0. Otherwise, it exits with 1.
|
# exits with 0. Otherwise, it exits with 1.
|
||||||
#
|
#
|
||||||
# The plan is that this can be called by configure scripts if you
|
# You can get the latest version of this script from:
|
||||||
# don't specify an explicit build system type.
|
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
|
||||||
|
|
||||||
me=`echo "$0" | sed -e 's,.*/,,'`
|
me=`echo "$0" | sed -e 's,.*/,,'`
|
||||||
|
|
||||||
@@ -56,7 +54,8 @@ version="\
|
|||||||
GNU config.guess ($timestamp)
|
GNU config.guess ($timestamp)
|
||||||
|
|
||||||
Originally written by Per Bothner.
|
Originally written by Per Bothner.
|
||||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||||
|
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This is free software; see the source for copying conditions. There is NO
|
This is free software; see the source for copying conditions. There is NO
|
||||||
@@ -144,7 +143,7 @@ UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
|
|||||||
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||||
*:NetBSD:*:*)
|
*:NetBSD:*:*)
|
||||||
# NetBSD (nbsd) targets should (where applicable) match one or
|
# NetBSD (nbsd) targets should (where applicable) match one or
|
||||||
# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
|
# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
|
||||||
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
|
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
|
||||||
# switched to ELF, *-*-netbsd* would select the old
|
# switched to ELF, *-*-netbsd* would select the old
|
||||||
# object file format. This provides both forward
|
# object file format. This provides both forward
|
||||||
@@ -161,6 +160,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
arm*) machine=arm-unknown ;;
|
arm*) machine=arm-unknown ;;
|
||||||
sh3el) machine=shl-unknown ;;
|
sh3el) machine=shl-unknown ;;
|
||||||
sh3eb) machine=sh-unknown ;;
|
sh3eb) machine=sh-unknown ;;
|
||||||
|
sh5el) machine=sh5le-unknown ;;
|
||||||
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
|
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
|
||||||
esac
|
esac
|
||||||
# The Operating System including object format, if it has switched
|
# The Operating System including object format, if it has switched
|
||||||
@@ -169,7 +169,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
|
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
|
||||||
eval $set_cc_for_build
|
eval $set_cc_for_build
|
||||||
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||||
| grep __ELF__ >/dev/null
|
| grep -q __ELF__
|
||||||
then
|
then
|
||||||
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
|
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
|
||||||
# Return netbsd for either. FIX?
|
# Return netbsd for either. FIX?
|
||||||
@@ -179,7 +179,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
os=netbsd
|
os=netbsd
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
# The OS release
|
# The OS release
|
||||||
@@ -211,7 +211,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
|
echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
macppc:MirBSD:*:*)
|
macppc:MirBSD:*:*)
|
||||||
echo powerppc-unknown-mirbsd${UNAME_RELEASE}
|
echo powerpc-unknown-mirbsd${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
*:MirBSD:*:*)
|
*:MirBSD:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
|
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
|
||||||
@@ -222,7 +222,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
|
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
|
||||||
;;
|
;;
|
||||||
*5.*)
|
*5.*)
|
||||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
|
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
# According to Compaq, /usr/sbin/psrinfo has been available on
|
# According to Compaq, /usr/sbin/psrinfo has been available on
|
||||||
@@ -268,7 +268,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
# A Xn.n version is an unreleased experimental baselevel.
|
# A Xn.n version is an unreleased experimental baselevel.
|
||||||
# 1.2 uses "1.2" for uname -r.
|
# 1.2 uses "1.2" for uname -r.
|
||||||
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||||
exit ;;
|
# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
|
||||||
|
exitcode=$?
|
||||||
|
trap '' 0
|
||||||
|
exit $exitcode ;;
|
||||||
Alpha\ *:Windows_NT*:*)
|
Alpha\ *:Windows_NT*:*)
|
||||||
# How do we know it's Interix rather than the generic POSIX subsystem?
|
# How do we know it's Interix rather than the generic POSIX subsystem?
|
||||||
# Should we change UNAME_MACHINE based on the output of uname instead
|
# Should we change UNAME_MACHINE based on the output of uname instead
|
||||||
@@ -294,7 +297,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
echo s390-ibm-zvmoe
|
echo s390-ibm-zvmoe
|
||||||
exit ;;
|
exit ;;
|
||||||
*:OS400:*:*)
|
*:OS400:*:*)
|
||||||
echo powerpc-ibm-os400
|
echo powerpc-ibm-os400
|
||||||
exit ;;
|
exit ;;
|
||||||
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
||||||
echo arm-acorn-riscix${UNAME_RELEASE}
|
echo arm-acorn-riscix${UNAME_RELEASE}
|
||||||
@@ -323,14 +326,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
case `/usr/bin/uname -p` in
|
case `/usr/bin/uname -p` in
|
||||||
sparc) echo sparc-icl-nx7; exit ;;
|
sparc) echo sparc-icl-nx7; exit ;;
|
||||||
esac ;;
|
esac ;;
|
||||||
|
s390x:SunOS:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||||
|
exit ;;
|
||||||
sun4H:SunOS:5.*:*)
|
sun4H:SunOS:5.*:*)
|
||||||
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||||
exit ;;
|
exit ;;
|
||||||
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
|
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
|
||||||
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||||
exit ;;
|
exit ;;
|
||||||
i86pc:SunOS:5.*:*)
|
i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
|
||||||
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
echo i386-pc-auroraux${UNAME_RELEASE}
|
||||||
|
exit ;;
|
||||||
|
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
|
||||||
|
eval $set_cc_for_build
|
||||||
|
SUN_ARCH="i386"
|
||||||
|
# If there is a compiler, see if it is configured for 64-bit objects.
|
||||||
|
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
|
||||||
|
# This test works for both compilers.
|
||||||
|
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
|
||||||
|
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
|
||||||
|
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
|
||||||
|
grep IS_64BIT_ARCH >/dev/null
|
||||||
|
then
|
||||||
|
SUN_ARCH="x86_64"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||||
exit ;;
|
exit ;;
|
||||||
sun4*:SunOS:6*:*)
|
sun4*:SunOS:6*:*)
|
||||||
# According to config.sub, this is the proper way to canonicalize
|
# According to config.sub, this is the proper way to canonicalize
|
||||||
@@ -374,23 +396,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
# MiNT. But MiNT is downward compatible to TOS, so this should
|
# MiNT. But MiNT is downward compatible to TOS, so this should
|
||||||
# be no problem.
|
# be no problem.
|
||||||
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
|
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
|
||||||
echo m68k-atari-mint${UNAME_RELEASE}
|
echo m68k-atari-mint${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
|
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
|
||||||
echo m68k-atari-mint${UNAME_RELEASE}
|
echo m68k-atari-mint${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
|
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
|
||||||
echo m68k-atari-mint${UNAME_RELEASE}
|
echo m68k-atari-mint${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
|
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
|
||||||
echo m68k-milan-mint${UNAME_RELEASE}
|
echo m68k-milan-mint${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
|
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
|
||||||
echo m68k-hades-mint${UNAME_RELEASE}
|
echo m68k-hades-mint${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
|
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
|
||||||
echo m68k-unknown-mint${UNAME_RELEASE}
|
echo m68k-unknown-mint${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
m68k:machten:*:*)
|
m68k:machten:*:*)
|
||||||
echo m68k-apple-machten${UNAME_RELEASE}
|
echo m68k-apple-machten${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
@@ -460,8 +482,8 @@ EOF
|
|||||||
echo m88k-motorola-sysv3
|
echo m88k-motorola-sysv3
|
||||||
exit ;;
|
exit ;;
|
||||||
AViiON:dgux:*:*)
|
AViiON:dgux:*:*)
|
||||||
# DG/UX returns AViiON for all architectures
|
# DG/UX returns AViiON for all architectures
|
||||||
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
||||||
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
|
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
|
||||||
then
|
then
|
||||||
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
|
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
|
||||||
@@ -474,7 +496,7 @@ EOF
|
|||||||
else
|
else
|
||||||
echo i586-dg-dgux${UNAME_RELEASE}
|
echo i586-dg-dgux${UNAME_RELEASE}
|
||||||
fi
|
fi
|
||||||
exit ;;
|
exit ;;
|
||||||
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
|
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
|
||||||
echo m88k-dolphin-sysv3
|
echo m88k-dolphin-sysv3
|
||||||
exit ;;
|
exit ;;
|
||||||
@@ -531,7 +553,7 @@ EOF
|
|||||||
echo rs6000-ibm-aix3.2
|
echo rs6000-ibm-aix3.2
|
||||||
fi
|
fi
|
||||||
exit ;;
|
exit ;;
|
||||||
*:AIX:*:[45])
|
*:AIX:*:[4567])
|
||||||
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
|
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
|
||||||
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
|
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
|
||||||
IBM_ARCH=rs6000
|
IBM_ARCH=rs6000
|
||||||
@@ -574,52 +596,52 @@ EOF
|
|||||||
9000/[678][0-9][0-9])
|
9000/[678][0-9][0-9])
|
||||||
if [ -x /usr/bin/getconf ]; then
|
if [ -x /usr/bin/getconf ]; then
|
||||||
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
|
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
|
||||||
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
|
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
|
||||||
case "${sc_cpu_version}" in
|
case "${sc_cpu_version}" in
|
||||||
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
|
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
|
||||||
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
|
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
|
||||||
532) # CPU_PA_RISC2_0
|
532) # CPU_PA_RISC2_0
|
||||||
case "${sc_kernel_bits}" in
|
case "${sc_kernel_bits}" in
|
||||||
32) HP_ARCH="hppa2.0n" ;;
|
32) HP_ARCH="hppa2.0n" ;;
|
||||||
64) HP_ARCH="hppa2.0w" ;;
|
64) HP_ARCH="hppa2.0w" ;;
|
||||||
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
|
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
|
||||||
esac ;;
|
esac ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
if [ "${HP_ARCH}" = "" ]; then
|
if [ "${HP_ARCH}" = "" ]; then
|
||||||
eval $set_cc_for_build
|
eval $set_cc_for_build
|
||||||
sed 's/^ //' << EOF >$dummy.c
|
sed 's/^ //' << EOF >$dummy.c
|
||||||
|
|
||||||
#define _HPUX_SOURCE
|
#define _HPUX_SOURCE
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
int main ()
|
int main ()
|
||||||
{
|
{
|
||||||
#if defined(_SC_KERNEL_BITS)
|
#if defined(_SC_KERNEL_BITS)
|
||||||
long bits = sysconf(_SC_KERNEL_BITS);
|
long bits = sysconf(_SC_KERNEL_BITS);
|
||||||
#endif
|
#endif
|
||||||
long cpu = sysconf (_SC_CPU_VERSION);
|
long cpu = sysconf (_SC_CPU_VERSION);
|
||||||
|
|
||||||
switch (cpu)
|
switch (cpu)
|
||||||
{
|
{
|
||||||
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
|
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
|
||||||
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
|
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
|
||||||
case CPU_PA_RISC2_0:
|
case CPU_PA_RISC2_0:
|
||||||
#if defined(_SC_KERNEL_BITS)
|
#if defined(_SC_KERNEL_BITS)
|
||||||
switch (bits)
|
switch (bits)
|
||||||
{
|
{
|
||||||
case 64: puts ("hppa2.0w"); break;
|
case 64: puts ("hppa2.0w"); break;
|
||||||
case 32: puts ("hppa2.0n"); break;
|
case 32: puts ("hppa2.0n"); break;
|
||||||
default: puts ("hppa2.0"); break;
|
default: puts ("hppa2.0"); break;
|
||||||
} break;
|
} break;
|
||||||
#else /* !defined(_SC_KERNEL_BITS) */
|
#else /* !defined(_SC_KERNEL_BITS) */
|
||||||
puts ("hppa2.0"); break;
|
puts ("hppa2.0"); break;
|
||||||
#endif
|
#endif
|
||||||
default: puts ("hppa1.0"); break;
|
default: puts ("hppa1.0"); break;
|
||||||
}
|
}
|
||||||
exit (0);
|
exit (0);
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
|
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
|
||||||
test -z "$HP_ARCH" && HP_ARCH=hppa
|
test -z "$HP_ARCH" && HP_ARCH=hppa
|
||||||
@@ -639,7 +661,7 @@ EOF
|
|||||||
# => hppa64-hp-hpux11.23
|
# => hppa64-hp-hpux11.23
|
||||||
|
|
||||||
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
|
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
|
||||||
grep __LP64__ >/dev/null
|
grep -q __LP64__
|
||||||
then
|
then
|
||||||
HP_ARCH="hppa2.0w"
|
HP_ARCH="hppa2.0w"
|
||||||
else
|
else
|
||||||
@@ -710,22 +732,22 @@ EOF
|
|||||||
exit ;;
|
exit ;;
|
||||||
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
|
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
|
||||||
echo c1-convex-bsd
|
echo c1-convex-bsd
|
||||||
exit ;;
|
exit ;;
|
||||||
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
|
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
|
||||||
if getsysinfo -f scalar_acc
|
if getsysinfo -f scalar_acc
|
||||||
then echo c32-convex-bsd
|
then echo c32-convex-bsd
|
||||||
else echo c2-convex-bsd
|
else echo c2-convex-bsd
|
||||||
fi
|
fi
|
||||||
exit ;;
|
exit ;;
|
||||||
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
|
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
|
||||||
echo c34-convex-bsd
|
echo c34-convex-bsd
|
||||||
exit ;;
|
exit ;;
|
||||||
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
|
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
|
||||||
echo c38-convex-bsd
|
echo c38-convex-bsd
|
||||||
exit ;;
|
exit ;;
|
||||||
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
|
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
|
||||||
echo c4-convex-bsd
|
echo c4-convex-bsd
|
||||||
exit ;;
|
exit ;;
|
||||||
CRAY*Y-MP:*:*:*)
|
CRAY*Y-MP:*:*:*)
|
||||||
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
||||||
exit ;;
|
exit ;;
|
||||||
@@ -749,14 +771,14 @@ EOF
|
|||||||
exit ;;
|
exit ;;
|
||||||
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
|
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
|
||||||
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
||||||
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||||
exit ;;
|
exit ;;
|
||||||
5000:UNIX_System_V:4.*:*)
|
5000:UNIX_System_V:4.*:*)
|
||||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
|
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
|
||||||
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||||
exit ;;
|
exit ;;
|
||||||
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
|
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
|
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
|
||||||
@@ -768,38 +790,48 @@ EOF
|
|||||||
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
|
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
*:FreeBSD:*:*)
|
*:FreeBSD:*:*)
|
||||||
case ${UNAME_MACHINE} in
|
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
||||||
pc98)
|
case ${UNAME_PROCESSOR} in
|
||||||
echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
amd64)
|
||||||
|
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||||
*)
|
*)
|
||||||
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||||
esac
|
esac
|
||||||
exit ;;
|
exit ;;
|
||||||
i*:CYGWIN*:*)
|
i*:CYGWIN*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-cygwin
|
echo ${UNAME_MACHINE}-pc-cygwin
|
||||||
exit ;;
|
exit ;;
|
||||||
i*:MINGW*:*)
|
*:MINGW*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-mingw32
|
echo ${UNAME_MACHINE}-pc-mingw32
|
||||||
exit ;;
|
exit ;;
|
||||||
i*:MSYS_NT-*:*:*)
|
i*:MSYS*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-mingw32
|
echo ${UNAME_MACHINE}-pc-msys
|
||||||
exit ;;
|
exit ;;
|
||||||
i*:windows32*:*)
|
i*:windows32*:*)
|
||||||
# uname -m includes "-pc" on this system.
|
# uname -m includes "-pc" on this system.
|
||||||
echo ${UNAME_MACHINE}-mingw32
|
echo ${UNAME_MACHINE}-mingw32
|
||||||
exit ;;
|
exit ;;
|
||||||
i*:PW*:*)
|
i*:PW*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-pw32
|
echo ${UNAME_MACHINE}-pc-pw32
|
||||||
exit ;;
|
exit ;;
|
||||||
x86:Interix*:[345]*)
|
*:Interix*:*)
|
||||||
echo i586-pc-interix${UNAME_RELEASE}
|
case ${UNAME_MACHINE} in
|
||||||
exit ;;
|
x86)
|
||||||
EM64T:Interix*:[345]*)
|
echo i586-pc-interix${UNAME_RELEASE}
|
||||||
echo x86_64-unknown-interix${UNAME_RELEASE}
|
exit ;;
|
||||||
exit ;;
|
authenticamd | genuineintel | EM64T)
|
||||||
|
echo x86_64-unknown-interix${UNAME_RELEASE}
|
||||||
|
exit ;;
|
||||||
|
IA64)
|
||||||
|
echo ia64-unknown-interix${UNAME_RELEASE}
|
||||||
|
exit ;;
|
||||||
|
esac ;;
|
||||||
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
|
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
|
||||||
echo i${UNAME_MACHINE}-pc-mks
|
echo i${UNAME_MACHINE}-pc-mks
|
||||||
exit ;;
|
exit ;;
|
||||||
|
8664:Windows_NT:*)
|
||||||
|
echo x86_64-pc-mks
|
||||||
|
exit ;;
|
||||||
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
|
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
|
||||||
# How do we know it's Interix rather than the generic POSIX subsystem?
|
# How do we know it's Interix rather than the generic POSIX subsystem?
|
||||||
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
|
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
|
||||||
@@ -829,82 +861,13 @@ EOF
|
|||||||
i*86:Minix:*:*)
|
i*86:Minix:*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-minix
|
echo ${UNAME_MACHINE}-pc-minix
|
||||||
exit ;;
|
exit ;;
|
||||||
arm*:Linux:*:*)
|
aarch64:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
cris:Linux:*:*)
|
aarch64_be:Linux:*:*)
|
||||||
echo cris-axis-linux-gnu
|
UNAME_MACHINE=aarch64_be
|
||||||
exit ;;
|
|
||||||
crisv32:Linux:*:*)
|
|
||||||
echo crisv32-axis-linux-gnu
|
|
||||||
exit ;;
|
|
||||||
frv:Linux:*:*)
|
|
||||||
echo frv-unknown-linux-gnu
|
|
||||||
exit ;;
|
|
||||||
ia64:Linux:*:*)
|
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
m32r*:Linux:*:*)
|
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
|
||||||
exit ;;
|
|
||||||
m68*:Linux:*:*)
|
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
|
||||||
exit ;;
|
|
||||||
mips:Linux:*:*)
|
|
||||||
eval $set_cc_for_build
|
|
||||||
sed 's/^ //' << EOF >$dummy.c
|
|
||||||
#undef CPU
|
|
||||||
#undef mips
|
|
||||||
#undef mipsel
|
|
||||||
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
|
|
||||||
CPU=mipsel
|
|
||||||
#else
|
|
||||||
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
|
|
||||||
CPU=mips
|
|
||||||
#else
|
|
||||||
CPU=
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
EOF
|
|
||||||
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
|
|
||||||
/^CPU/{
|
|
||||||
s: ::g
|
|
||||||
p
|
|
||||||
}'`"
|
|
||||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
|
|
||||||
;;
|
|
||||||
mips64:Linux:*:*)
|
|
||||||
eval $set_cc_for_build
|
|
||||||
sed 's/^ //' << EOF >$dummy.c
|
|
||||||
#undef CPU
|
|
||||||
#undef mips64
|
|
||||||
#undef mips64el
|
|
||||||
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
|
|
||||||
CPU=mips64el
|
|
||||||
#else
|
|
||||||
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
|
|
||||||
CPU=mips64
|
|
||||||
#else
|
|
||||||
CPU=
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
EOF
|
|
||||||
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
|
|
||||||
/^CPU/{
|
|
||||||
s: ::g
|
|
||||||
p
|
|
||||||
}'`"
|
|
||||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
|
|
||||||
;;
|
|
||||||
or32:Linux:*:*)
|
|
||||||
echo or32-unknown-linux-gnu
|
|
||||||
exit ;;
|
|
||||||
ppc:Linux:*:*)
|
|
||||||
echo powerpc-unknown-linux-gnu
|
|
||||||
exit ;;
|
|
||||||
ppc64:Linux:*:*)
|
|
||||||
echo powerpc64-unknown-linux-gnu
|
|
||||||
exit ;;
|
|
||||||
alpha:Linux:*:*)
|
alpha:Linux:*:*)
|
||||||
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
|
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
|
||||||
EV5) UNAME_MACHINE=alphaev5 ;;
|
EV5) UNAME_MACHINE=alphaev5 ;;
|
||||||
@@ -914,11 +877,90 @@ EOF
|
|||||||
EV6) UNAME_MACHINE=alphaev6 ;;
|
EV6) UNAME_MACHINE=alphaev6 ;;
|
||||||
EV67) UNAME_MACHINE=alphaev67 ;;
|
EV67) UNAME_MACHINE=alphaev67 ;;
|
||||||
EV68*) UNAME_MACHINE=alphaev68 ;;
|
EV68*) UNAME_MACHINE=alphaev68 ;;
|
||||||
esac
|
esac
|
||||||
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
|
objdump --private-headers /bin/sh | grep -q ld.so.1
|
||||||
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
|
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
|
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
|
||||||
exit ;;
|
exit ;;
|
||||||
|
arm*:Linux:*:*)
|
||||||
|
eval $set_cc_for_build
|
||||||
|
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||||
|
| grep -q __ARM_EABI__
|
||||||
|
then
|
||||||
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
|
else
|
||||||
|
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||||
|
| grep -q __ARM_PCS_VFP
|
||||||
|
then
|
||||||
|
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
|
||||||
|
else
|
||||||
|
echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
exit ;;
|
||||||
|
avr32*:Linux:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
|
exit ;;
|
||||||
|
cris:Linux:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-axis-linux-gnu
|
||||||
|
exit ;;
|
||||||
|
crisv32:Linux:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-axis-linux-gnu
|
||||||
|
exit ;;
|
||||||
|
frv:Linux:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
|
exit ;;
|
||||||
|
hexagon:Linux:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
|
exit ;;
|
||||||
|
i*86:Linux:*:*)
|
||||||
|
LIBC=gnu
|
||||||
|
eval $set_cc_for_build
|
||||||
|
sed 's/^ //' << EOF >$dummy.c
|
||||||
|
#ifdef __dietlibc__
|
||||||
|
LIBC=dietlibc
|
||||||
|
#endif
|
||||||
|
EOF
|
||||||
|
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
|
||||||
|
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
|
||||||
|
exit ;;
|
||||||
|
ia64:Linux:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
|
exit ;;
|
||||||
|
m32r*:Linux:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
|
exit ;;
|
||||||
|
m68*:Linux:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
|
exit ;;
|
||||||
|
mips:Linux:*:* | mips64:Linux:*:*)
|
||||||
|
eval $set_cc_for_build
|
||||||
|
sed 's/^ //' << EOF >$dummy.c
|
||||||
|
#undef CPU
|
||||||
|
#undef ${UNAME_MACHINE}
|
||||||
|
#undef ${UNAME_MACHINE}el
|
||||||
|
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
|
||||||
|
CPU=${UNAME_MACHINE}el
|
||||||
|
#else
|
||||||
|
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
|
||||||
|
CPU=${UNAME_MACHINE}
|
||||||
|
#else
|
||||||
|
CPU=
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
EOF
|
||||||
|
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
|
||||||
|
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
|
||||||
|
;;
|
||||||
|
or32:Linux:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
|
exit ;;
|
||||||
|
padre:Linux:*:*)
|
||||||
|
echo sparc-unknown-linux-gnu
|
||||||
|
exit ;;
|
||||||
|
parisc64:Linux:*:* | hppa64:Linux:*:*)
|
||||||
|
echo hppa64-unknown-linux-gnu
|
||||||
|
exit ;;
|
||||||
parisc:Linux:*:* | hppa:Linux:*:*)
|
parisc:Linux:*:* | hppa:Linux:*:*)
|
||||||
# Look for CPU level
|
# Look for CPU level
|
||||||
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
|
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
|
||||||
@@ -927,14 +969,17 @@ EOF
|
|||||||
*) echo hppa-unknown-linux-gnu ;;
|
*) echo hppa-unknown-linux-gnu ;;
|
||||||
esac
|
esac
|
||||||
exit ;;
|
exit ;;
|
||||||
parisc64:Linux:*:* | hppa64:Linux:*:*)
|
ppc64:Linux:*:*)
|
||||||
echo hppa64-unknown-linux-gnu
|
echo powerpc64-unknown-linux-gnu
|
||||||
|
exit ;;
|
||||||
|
ppc:Linux:*:*)
|
||||||
|
echo powerpc-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
s390:Linux:*:* | s390x:Linux:*:*)
|
s390:Linux:*:* | s390x:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-ibm-linux
|
echo ${UNAME_MACHINE}-ibm-linux
|
||||||
exit ;;
|
exit ;;
|
||||||
sh64*:Linux:*:*)
|
sh64*:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
sh*:Linux:*:*)
|
sh*:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
@@ -942,75 +987,18 @@ EOF
|
|||||||
sparc:Linux:*:* | sparc64:Linux:*:*)
|
sparc:Linux:*:* | sparc64:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
|
tile*:Linux:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
|
exit ;;
|
||||||
vax:Linux:*:*)
|
vax:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-dec-linux-gnu
|
echo ${UNAME_MACHINE}-dec-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
x86_64:Linux:*:*)
|
x86_64:Linux:*:*)
|
||||||
echo x86_64-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
|
exit ;;
|
||||||
|
xtensa*:Linux:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
i*86:Linux:*:*)
|
|
||||||
# The BFD linker knows what the default object file format is, so
|
|
||||||
# first see if it will tell us. cd to the root directory to prevent
|
|
||||||
# problems with other programs or directories called `ld' in the path.
|
|
||||||
# Set LC_ALL=C to ensure ld outputs messages in English.
|
|
||||||
ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
|
|
||||||
| sed -ne '/supported targets:/!d
|
|
||||||
s/[ ][ ]*/ /g
|
|
||||||
s/.*supported targets: *//
|
|
||||||
s/ .*//
|
|
||||||
p'`
|
|
||||||
case "$ld_supported_targets" in
|
|
||||||
elf32-i386)
|
|
||||||
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
|
|
||||||
;;
|
|
||||||
a.out-i386-linux)
|
|
||||||
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
|
|
||||||
exit ;;
|
|
||||||
coff-i386)
|
|
||||||
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
|
|
||||||
exit ;;
|
|
||||||
"")
|
|
||||||
# Either a pre-BFD a.out linker (linux-gnuoldld) or
|
|
||||||
# one that does not give us useful --help.
|
|
||||||
echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
|
|
||||||
exit ;;
|
|
||||||
esac
|
|
||||||
# Determine whether the default compiler is a.out or elf
|
|
||||||
eval $set_cc_for_build
|
|
||||||
sed 's/^ //' << EOF >$dummy.c
|
|
||||||
#include <features.h>
|
|
||||||
#ifdef __ELF__
|
|
||||||
# ifdef __GLIBC__
|
|
||||||
# if __GLIBC__ >= 2
|
|
||||||
LIBC=gnu
|
|
||||||
# else
|
|
||||||
LIBC=gnulibc1
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
LIBC=gnulibc1
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__sun)
|
|
||||||
LIBC=gnu
|
|
||||||
#else
|
|
||||||
LIBC=gnuaout
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#ifdef __dietlibc__
|
|
||||||
LIBC=dietlibc
|
|
||||||
#endif
|
|
||||||
EOF
|
|
||||||
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
|
|
||||||
/^LIBC/{
|
|
||||||
s: ::g
|
|
||||||
p
|
|
||||||
}'`"
|
|
||||||
test x"${LIBC}" != x && {
|
|
||||||
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
|
|
||||||
exit
|
|
||||||
}
|
|
||||||
test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
|
|
||||||
;;
|
|
||||||
i*86:DYNIX/ptx:4*:*)
|
i*86:DYNIX/ptx:4*:*)
|
||||||
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
|
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
|
||||||
# earlier versions are messed up and put the nodename in both
|
# earlier versions are messed up and put the nodename in both
|
||||||
@@ -1018,11 +1006,11 @@ EOF
|
|||||||
echo i386-sequent-sysv4
|
echo i386-sequent-sysv4
|
||||||
exit ;;
|
exit ;;
|
||||||
i*86:UNIX_SV:4.2MP:2.*)
|
i*86:UNIX_SV:4.2MP:2.*)
|
||||||
# Unixware is an offshoot of SVR4, but it has its own version
|
# Unixware is an offshoot of SVR4, but it has its own version
|
||||||
# number series starting with 2...
|
# number series starting with 2...
|
||||||
# I am not positive that other SVR4 systems won't match this,
|
# I am not positive that other SVR4 systems won't match this,
|
||||||
# I just have to hope. -- rms.
|
# I just have to hope. -- rms.
|
||||||
# Use sysv4.2uw... so that sysv4* matches it.
|
# Use sysv4.2uw... so that sysv4* matches it.
|
||||||
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
|
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
|
||||||
exit ;;
|
exit ;;
|
||||||
i*86:OS/2:*:*)
|
i*86:OS/2:*:*)
|
||||||
@@ -1039,7 +1027,7 @@ EOF
|
|||||||
i*86:syllable:*:*)
|
i*86:syllable:*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-syllable
|
echo ${UNAME_MACHINE}-pc-syllable
|
||||||
exit ;;
|
exit ;;
|
||||||
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
|
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
|
||||||
echo i386-unknown-lynxos${UNAME_RELEASE}
|
echo i386-unknown-lynxos${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
i*86:*DOS:*:*)
|
i*86:*DOS:*:*)
|
||||||
@@ -1054,7 +1042,7 @@ EOF
|
|||||||
fi
|
fi
|
||||||
exit ;;
|
exit ;;
|
||||||
i*86:*:5:[678]*)
|
i*86:*:5:[678]*)
|
||||||
# UnixWare 7.x, OpenUNIX and OpenServer 6.
|
# UnixWare 7.x, OpenUNIX and OpenServer 6.
|
||||||
case `/bin/uname -X | grep "^Machine"` in
|
case `/bin/uname -X | grep "^Machine"` in
|
||||||
*486*) UNAME_MACHINE=i486 ;;
|
*486*) UNAME_MACHINE=i486 ;;
|
||||||
*Pentium) UNAME_MACHINE=i586 ;;
|
*Pentium) UNAME_MACHINE=i586 ;;
|
||||||
@@ -1082,10 +1070,13 @@ EOF
|
|||||||
exit ;;
|
exit ;;
|
||||||
pc:*:*:*)
|
pc:*:*:*)
|
||||||
# Left here for compatibility:
|
# Left here for compatibility:
|
||||||
# uname -m prints for DJGPP always 'pc', but it prints nothing about
|
# uname -m prints for DJGPP always 'pc', but it prints nothing about
|
||||||
# the processor, so we play safe by assuming i386.
|
# the processor, so we play safe by assuming i586.
|
||||||
echo i386-pc-msdosdjgpp
|
# Note: whatever this is, it MUST be the same as what config.sub
|
||||||
exit ;;
|
# prints for the "djgpp" host, or else GDB configury will decide that
|
||||||
|
# this is a cross-build.
|
||||||
|
echo i586-pc-msdosdjgpp
|
||||||
|
exit ;;
|
||||||
Intel:Mach:3*:*)
|
Intel:Mach:3*:*)
|
||||||
echo i386-pc-mach3
|
echo i386-pc-mach3
|
||||||
exit ;;
|
exit ;;
|
||||||
@@ -1120,8 +1111,18 @@ EOF
|
|||||||
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
|
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
|
||||||
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
|
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
|
||||||
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
|
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
|
||||||
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||||
&& { echo i486-ncr-sysv4; exit; } ;;
|
&& { echo i486-ncr-sysv4; exit; } ;;
|
||||||
|
NCR*:*:4.2:* | MPRAS*:*:4.2:*)
|
||||||
|
OS_REL='.3'
|
||||||
|
test -r /etc/.relid \
|
||||||
|
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
|
||||||
|
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||||
|
&& { echo i486-ncr-sysv4.3${OS_REL}; exit; }
|
||||||
|
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
|
||||||
|
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; }
|
||||||
|
/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
|
||||||
|
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
|
||||||
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
|
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
|
||||||
echo m68k-unknown-lynxos${UNAME_RELEASE}
|
echo m68k-unknown-lynxos${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
@@ -1134,7 +1135,7 @@ EOF
|
|||||||
rs6000:LynxOS:2.*:*)
|
rs6000:LynxOS:2.*:*)
|
||||||
echo rs6000-unknown-lynxos${UNAME_RELEASE}
|
echo rs6000-unknown-lynxos${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
|
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
|
||||||
echo powerpc-unknown-lynxos${UNAME_RELEASE}
|
echo powerpc-unknown-lynxos${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
SM[BE]S:UNIX_SV:*:*)
|
SM[BE]S:UNIX_SV:*:*)
|
||||||
@@ -1154,10 +1155,10 @@ EOF
|
|||||||
echo ns32k-sni-sysv
|
echo ns32k-sni-sysv
|
||||||
fi
|
fi
|
||||||
exit ;;
|
exit ;;
|
||||||
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
|
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
|
||||||
# says <Richard.M.Bartel@ccMail.Census.GOV>
|
# says <Richard.M.Bartel@ccMail.Census.GOV>
|
||||||
echo i586-unisys-sysv4
|
echo i586-unisys-sysv4
|
||||||
exit ;;
|
exit ;;
|
||||||
*:UNIX_System_V:4*:FTX*)
|
*:UNIX_System_V:4*:FTX*)
|
||||||
# From Gerald Hewes <hewes@openmarket.com>.
|
# From Gerald Hewes <hewes@openmarket.com>.
|
||||||
# How about differentiating between stratus architectures? -djm
|
# How about differentiating between stratus architectures? -djm
|
||||||
@@ -1183,11 +1184,11 @@ EOF
|
|||||||
exit ;;
|
exit ;;
|
||||||
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
|
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
|
||||||
if [ -d /usr/nec ]; then
|
if [ -d /usr/nec ]; then
|
||||||
echo mips-nec-sysv${UNAME_RELEASE}
|
echo mips-nec-sysv${UNAME_RELEASE}
|
||||||
else
|
else
|
||||||
echo mips-unknown-sysv${UNAME_RELEASE}
|
echo mips-unknown-sysv${UNAME_RELEASE}
|
||||||
fi
|
fi
|
||||||
exit ;;
|
exit ;;
|
||||||
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
|
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
|
||||||
echo powerpc-be-beos
|
echo powerpc-be-beos
|
||||||
exit ;;
|
exit ;;
|
||||||
@@ -1197,6 +1198,9 @@ EOF
|
|||||||
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
|
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
|
||||||
echo i586-pc-beos
|
echo i586-pc-beos
|
||||||
exit ;;
|
exit ;;
|
||||||
|
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
|
||||||
|
echo i586-pc-haiku
|
||||||
|
exit ;;
|
||||||
SX-4:SUPER-UX:*:*)
|
SX-4:SUPER-UX:*:*)
|
||||||
echo sx4-nec-superux${UNAME_RELEASE}
|
echo sx4-nec-superux${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
@@ -1206,6 +1210,15 @@ EOF
|
|||||||
SX-6:SUPER-UX:*:*)
|
SX-6:SUPER-UX:*:*)
|
||||||
echo sx6-nec-superux${UNAME_RELEASE}
|
echo sx6-nec-superux${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
|
SX-7:SUPER-UX:*:*)
|
||||||
|
echo sx7-nec-superux${UNAME_RELEASE}
|
||||||
|
exit ;;
|
||||||
|
SX-8:SUPER-UX:*:*)
|
||||||
|
echo sx8-nec-superux${UNAME_RELEASE}
|
||||||
|
exit ;;
|
||||||
|
SX-8R:SUPER-UX:*:*)
|
||||||
|
echo sx8r-nec-superux${UNAME_RELEASE}
|
||||||
|
exit ;;
|
||||||
Power*:Rhapsody:*:*)
|
Power*:Rhapsody:*:*)
|
||||||
echo powerpc-apple-rhapsody${UNAME_RELEASE}
|
echo powerpc-apple-rhapsody${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
@@ -1215,6 +1228,16 @@ EOF
|
|||||||
*:Darwin:*:*)
|
*:Darwin:*:*)
|
||||||
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
|
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
|
||||||
case $UNAME_PROCESSOR in
|
case $UNAME_PROCESSOR in
|
||||||
|
i386)
|
||||||
|
eval $set_cc_for_build
|
||||||
|
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
|
||||||
|
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
|
||||||
|
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
|
||||||
|
grep IS_64BIT_ARCH >/dev/null
|
||||||
|
then
|
||||||
|
UNAME_PROCESSOR="x86_64"
|
||||||
|
fi
|
||||||
|
fi ;;
|
||||||
unknown) UNAME_PROCESSOR=powerpc ;;
|
unknown) UNAME_PROCESSOR=powerpc ;;
|
||||||
esac
|
esac
|
||||||
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
|
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
|
||||||
@@ -1230,6 +1253,9 @@ EOF
|
|||||||
*:QNX:*:4*)
|
*:QNX:*:4*)
|
||||||
echo i386-pc-qnx
|
echo i386-pc-qnx
|
||||||
exit ;;
|
exit ;;
|
||||||
|
NEO-?:NONSTOP_KERNEL:*:*)
|
||||||
|
echo neo-tandem-nsk${UNAME_RELEASE}
|
||||||
|
exit ;;
|
||||||
NSE-?:NONSTOP_KERNEL:*:*)
|
NSE-?:NONSTOP_KERNEL:*:*)
|
||||||
echo nse-tandem-nsk${UNAME_RELEASE}
|
echo nse-tandem-nsk${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
@@ -1275,13 +1301,13 @@ EOF
|
|||||||
echo pdp10-unknown-its
|
echo pdp10-unknown-its
|
||||||
exit ;;
|
exit ;;
|
||||||
SEI:*:*:SEIUX)
|
SEI:*:*:SEIUX)
|
||||||
echo mips-sei-seiux${UNAME_RELEASE}
|
echo mips-sei-seiux${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
*:DragonFly:*:*)
|
*:DragonFly:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
||||||
exit ;;
|
exit ;;
|
||||||
*:*VMS:*:*)
|
*:*VMS:*:*)
|
||||||
UNAME_MACHINE=`(uname -p) 2>/dev/null`
|
UNAME_MACHINE=`(uname -p) 2>/dev/null`
|
||||||
case "${UNAME_MACHINE}" in
|
case "${UNAME_MACHINE}" in
|
||||||
A*) echo alpha-dec-vms ; exit ;;
|
A*) echo alpha-dec-vms ; exit ;;
|
||||||
I*) echo ia64-dec-vms ; exit ;;
|
I*) echo ia64-dec-vms ; exit ;;
|
||||||
@@ -1296,6 +1322,12 @@ EOF
|
|||||||
i*86:rdos:*:*)
|
i*86:rdos:*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-rdos
|
echo ${UNAME_MACHINE}-pc-rdos
|
||||||
exit ;;
|
exit ;;
|
||||||
|
i*86:AROS:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-pc-aros
|
||||||
|
exit ;;
|
||||||
|
x86_64:VMkernel:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-unknown-esx
|
||||||
|
exit ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
#echo '(No uname command or uname output not recognized.)' 1>&2
|
#echo '(No uname command or uname output not recognized.)' 1>&2
|
||||||
@@ -1318,11 +1350,11 @@ main ()
|
|||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
printf ("m68k-sony-newsos%s\n",
|
printf ("m68k-sony-newsos%s\n",
|
||||||
#ifdef NEWSOS4
|
#ifdef NEWSOS4
|
||||||
"4"
|
"4"
|
||||||
#else
|
#else
|
||||||
""
|
""
|
||||||
#endif
|
#endif
|
||||||
); exit (0);
|
); exit (0);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1456,9 +1488,9 @@ This script, last modified $timestamp, has failed to recognize
|
|||||||
the operating system you are using. It is advised that you
|
the operating system you are using. It is advised that you
|
||||||
download the most up to date version of the config scripts from
|
download the most up to date version of the config scripts from
|
||||||
|
|
||||||
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
|
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
|
||||||
and
|
and
|
||||||
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
|
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
|
||||||
|
|
||||||
If the version you run ($0) is already up to date, please
|
If the version you run ($0) is already up to date, please
|
||||||
send the following data and any information you think might be
|
send the following data and any information you think might be
|
||||||
|
|||||||
337
config.sub
vendored
337
config.sub
vendored
@@ -1,10 +1,10 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Configuration validation subroutine script.
|
# Configuration validation subroutine script.
|
||||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
|
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||||
# Inc.
|
# 2011, 2012 Free Software Foundation, Inc.
|
||||||
|
|
||||||
timestamp='2006-02-27'
|
timestamp='2012-04-18'
|
||||||
|
|
||||||
# This file is (in principle) common to ALL GNU software.
|
# This file is (in principle) common to ALL GNU software.
|
||||||
# The presence of a machine in this file suggests that SOME GNU software
|
# The presence of a machine in this file suggests that SOME GNU software
|
||||||
@@ -21,9 +21,7 @@ timestamp='2006-02-27'
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
|
|
||||||
# 02110-1301, USA.
|
|
||||||
#
|
#
|
||||||
# As a special exception to the GNU General Public License, if you
|
# As a special exception to the GNU General Public License, if you
|
||||||
# distribute this file as part of a program that contains a
|
# distribute this file as part of a program that contains a
|
||||||
@@ -32,13 +30,16 @@ timestamp='2006-02-27'
|
|||||||
|
|
||||||
|
|
||||||
# Please send patches to <config-patches@gnu.org>. Submit a context
|
# Please send patches to <config-patches@gnu.org>. Submit a context
|
||||||
# diff and a properly formatted ChangeLog entry.
|
# diff and a properly formatted GNU ChangeLog entry.
|
||||||
#
|
#
|
||||||
# Configuration subroutine to validate and canonicalize a configuration type.
|
# Configuration subroutine to validate and canonicalize a configuration type.
|
||||||
# Supply the specified configuration type as an argument.
|
# Supply the specified configuration type as an argument.
|
||||||
# If it is invalid, we print an error message on stderr and exit with code 1.
|
# If it is invalid, we print an error message on stderr and exit with code 1.
|
||||||
# Otherwise, we print the canonical config type on stdout and succeed.
|
# Otherwise, we print the canonical config type on stdout and succeed.
|
||||||
|
|
||||||
|
# You can get the latest version of this script from:
|
||||||
|
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
|
||||||
|
|
||||||
# This file is supposed to be the same for all GNU packages
|
# This file is supposed to be the same for all GNU packages
|
||||||
# and recognize all the CPU types, system types and aliases
|
# and recognize all the CPU types, system types and aliases
|
||||||
# that are meaningful with *any* GNU software.
|
# that are meaningful with *any* GNU software.
|
||||||
@@ -72,7 +73,8 @@ Report bugs and patches to <config-patches@gnu.org>."
|
|||||||
version="\
|
version="\
|
||||||
GNU config.sub ($timestamp)
|
GNU config.sub ($timestamp)
|
||||||
|
|
||||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||||
|
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This is free software; see the source for copying conditions. There is NO
|
This is free software; see the source for copying conditions. There is NO
|
||||||
@@ -120,12 +122,18 @@ esac
|
|||||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||||
case $maybe_os in
|
case $maybe_os in
|
||||||
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
|
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
|
||||||
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
|
linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
|
||||||
|
knetbsd*-gnu* | netbsd*-gnu* | \
|
||||||
|
kopensolaris*-gnu* | \
|
||||||
storm-chaos* | os2-emx* | rtmk-nova*)
|
storm-chaos* | os2-emx* | rtmk-nova*)
|
||||||
os=-$maybe_os
|
os=-$maybe_os
|
||||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||||
;;
|
;;
|
||||||
|
android-linux)
|
||||||
|
os=-linux-android
|
||||||
|
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
|
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
|
||||||
if [ $basic_machine != $1 ]
|
if [ $basic_machine != $1 ]
|
||||||
@@ -148,10 +156,13 @@ case $os in
|
|||||||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||||
-apple | -axis | -knuth | -cray)
|
-apple | -axis | -knuth | -cray | -microblaze)
|
||||||
os=
|
os=
|
||||||
basic_machine=$1
|
basic_machine=$1
|
||||||
;;
|
;;
|
||||||
|
-bluegene*)
|
||||||
|
os=-cnk
|
||||||
|
;;
|
||||||
-sim | -cisco | -oki | -wec | -winbond)
|
-sim | -cisco | -oki | -wec | -winbond)
|
||||||
os=
|
os=
|
||||||
basic_machine=$1
|
basic_machine=$1
|
||||||
@@ -166,10 +177,10 @@ case $os in
|
|||||||
os=-chorusos
|
os=-chorusos
|
||||||
basic_machine=$1
|
basic_machine=$1
|
||||||
;;
|
;;
|
||||||
-chorusrdb)
|
-chorusrdb)
|
||||||
os=-chorusrdb
|
os=-chorusrdb
|
||||||
basic_machine=$1
|
basic_machine=$1
|
||||||
;;
|
;;
|
||||||
-hiux*)
|
-hiux*)
|
||||||
os=-hiuxwe2
|
os=-hiuxwe2
|
||||||
;;
|
;;
|
||||||
@@ -214,6 +225,12 @@ case $os in
|
|||||||
-isc*)
|
-isc*)
|
||||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||||
;;
|
;;
|
||||||
|
-lynx*178)
|
||||||
|
os=-lynxos178
|
||||||
|
;;
|
||||||
|
-lynx*5)
|
||||||
|
os=-lynxos5
|
||||||
|
;;
|
||||||
-lynx*)
|
-lynx*)
|
||||||
os=-lynxos
|
os=-lynxos
|
||||||
;;
|
;;
|
||||||
@@ -238,23 +255,32 @@ case $basic_machine in
|
|||||||
# Some are omitted here because they have special meanings below.
|
# Some are omitted here because they have special meanings below.
|
||||||
1750a | 580 \
|
1750a | 580 \
|
||||||
| a29k \
|
| a29k \
|
||||||
|
| aarch64 | aarch64_be \
|
||||||
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
|
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
|
||||||
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
|
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
|
||||||
| am33_2.0 \
|
| am33_2.0 \
|
||||||
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
|
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
|
||||||
|
| be32 | be64 \
|
||||||
| bfin \
|
| bfin \
|
||||||
| c4x | clipper \
|
| c4x | clipper \
|
||||||
| d10v | d30v | dlx | dsp16xx \
|
| d10v | d30v | dlx | dsp16xx \
|
||||||
| fr30 | frv \
|
| epiphany \
|
||||||
|
| fido | fr30 | frv \
|
||||||
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||||
|
| hexagon \
|
||||||
| i370 | i860 | i960 | ia64 \
|
| i370 | i860 | i960 | ia64 \
|
||||||
| ip2k | iq2000 \
|
| ip2k | iq2000 \
|
||||||
| m32r | m32rle | m68000 | m68k | m88k | maxq | mb | microblaze | mcore \
|
| le32 | le64 \
|
||||||
|
| lm32 \
|
||||||
|
| m32c | m32r | m32rle | m68000 | m68k | m88k \
|
||||||
|
| maxq | mb | microblaze | mcore | mep | metag \
|
||||||
| mips | mipsbe | mipseb | mipsel | mipsle \
|
| mips | mipsbe | mipseb | mipsel | mipsle \
|
||||||
| mips16 \
|
| mips16 \
|
||||||
| mips64 | mips64el \
|
| mips64 | mips64el \
|
||||||
| mips64vr | mips64vrel \
|
| mips64octeon | mips64octeonel \
|
||||||
| mips64orion | mips64orionel \
|
| mips64orion | mips64orionel \
|
||||||
|
| mips64r5900 | mips64r5900el \
|
||||||
|
| mips64vr | mips64vrel \
|
||||||
| mips64vr4100 | mips64vr4100el \
|
| mips64vr4100 | mips64vr4100el \
|
||||||
| mips64vr4300 | mips64vr4300el \
|
| mips64vr4300 | mips64vr4300el \
|
||||||
| mips64vr5000 | mips64vr5000el \
|
| mips64vr5000 | mips64vr5000el \
|
||||||
@@ -267,31 +293,42 @@ case $basic_machine in
|
|||||||
| mipsisa64sr71k | mipsisa64sr71kel \
|
| mipsisa64sr71k | mipsisa64sr71kel \
|
||||||
| mipstx39 | mipstx39el \
|
| mipstx39 | mipstx39el \
|
||||||
| mn10200 | mn10300 \
|
| mn10200 | mn10300 \
|
||||||
|
| moxie \
|
||||||
| mt \
|
| mt \
|
||||||
| msp430 \
|
| msp430 \
|
||||||
|
| nds32 | nds32le | nds32be \
|
||||||
| nios | nios2 \
|
| nios | nios2 \
|
||||||
| ns16k | ns32k \
|
| ns16k | ns32k \
|
||||||
|
| open8 \
|
||||||
| or32 \
|
| or32 \
|
||||||
| pdp10 | pdp11 | pj | pjl \
|
| pdp10 | pdp11 | pj | pjl \
|
||||||
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
|
| powerpc | powerpc64 | powerpc64le | powerpcle \
|
||||||
| pyramid \
|
| pyramid \
|
||||||
| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
|
| rl78 | rx \
|
||||||
|
| score \
|
||||||
|
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
||||||
| sh64 | sh64le \
|
| sh64 | sh64le \
|
||||||
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
|
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
|
||||||
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
|
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
|
||||||
| strongarm \
|
| spu \
|
||||||
| tahoe | thumb | tic4x | tic80 | tron \
|
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
|
||||||
| v850 | v850e \
|
| ubicom32 \
|
||||||
|
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
|
||||||
| we32k \
|
| we32k \
|
||||||
| x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
|
| x86 | xc16x | xstormy16 | xtensa \
|
||||||
| z8k)
|
| z8k | z80)
|
||||||
basic_machine=$basic_machine-unknown
|
basic_machine=$basic_machine-unknown
|
||||||
;;
|
;;
|
||||||
m32c)
|
c54x)
|
||||||
basic_machine=$basic_machine-unknown
|
basic_machine=tic54x-unknown
|
||||||
;;
|
;;
|
||||||
m6811 | m68hc11 | m6812 | m68hc12)
|
c55x)
|
||||||
# Motorola 68HC11/12.
|
basic_machine=tic55x-unknown
|
||||||
|
;;
|
||||||
|
c6x)
|
||||||
|
basic_machine=tic6x-unknown
|
||||||
|
;;
|
||||||
|
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
|
||||||
basic_machine=$basic_machine-unknown
|
basic_machine=$basic_machine-unknown
|
||||||
os=-none
|
os=-none
|
||||||
;;
|
;;
|
||||||
@@ -301,6 +338,21 @@ case $basic_machine in
|
|||||||
basic_machine=mt-unknown
|
basic_machine=mt-unknown
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
strongarm | thumb | xscale)
|
||||||
|
basic_machine=arm-unknown
|
||||||
|
;;
|
||||||
|
xgate)
|
||||||
|
basic_machine=$basic_machine-unknown
|
||||||
|
os=-none
|
||||||
|
;;
|
||||||
|
xscaleeb)
|
||||||
|
basic_machine=armeb-unknown
|
||||||
|
;;
|
||||||
|
|
||||||
|
xscaleel)
|
||||||
|
basic_machine=armel-unknown
|
||||||
|
;;
|
||||||
|
|
||||||
# We use `pc' rather than `unknown'
|
# We use `pc' rather than `unknown'
|
||||||
# because (1) that's what they normally are, and
|
# because (1) that's what they normally are, and
|
||||||
# (2) the word "unknown" tends to confuse beginning users.
|
# (2) the word "unknown" tends to confuse beginning users.
|
||||||
@@ -315,29 +367,36 @@ case $basic_machine in
|
|||||||
# Recognize the basic CPU types with company name.
|
# Recognize the basic CPU types with company name.
|
||||||
580-* \
|
580-* \
|
||||||
| a29k-* \
|
| a29k-* \
|
||||||
|
| aarch64-* | aarch64_be-* \
|
||||||
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
|
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
|
||||||
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
|
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
|
||||||
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
|
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
|
||||||
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
||||||
| avr-* \
|
| avr-* | avr32-* \
|
||||||
|
| be32-* | be64-* \
|
||||||
| bfin-* | bs2000-* \
|
| bfin-* | bs2000-* \
|
||||||
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
|
| c[123]* | c30-* | [cjt]90-* | c4x-* \
|
||||||
| clipper-* | craynv-* | cydra-* \
|
| clipper-* | craynv-* | cydra-* \
|
||||||
| d10v-* | d30v-* | dlx-* \
|
| d10v-* | d30v-* | dlx-* \
|
||||||
| elxsi-* \
|
| elxsi-* \
|
||||||
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
|
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
|
||||||
| h8300-* | h8500-* \
|
| h8300-* | h8500-* \
|
||||||
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
||||||
|
| hexagon-* \
|
||||||
| i*86-* | i860-* | i960-* | ia64-* \
|
| i*86-* | i860-* | i960-* | ia64-* \
|
||||||
| ip2k-* | iq2000-* \
|
| ip2k-* | iq2000-* \
|
||||||
| m32r-* | m32rle-* \
|
| le32-* | le64-* \
|
||||||
|
| lm32-* \
|
||||||
|
| m32c-* | m32r-* | m32rle-* \
|
||||||
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
||||||
| m88110-* | m88k-* | maxq-* | mcore-* \
|
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
|
||||||
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
||||||
| mips16-* \
|
| mips16-* \
|
||||||
| mips64-* | mips64el-* \
|
| mips64-* | mips64el-* \
|
||||||
| mips64vr-* | mips64vrel-* \
|
| mips64octeon-* | mips64octeonel-* \
|
||||||
| mips64orion-* | mips64orionel-* \
|
| mips64orion-* | mips64orionel-* \
|
||||||
|
| mips64r5900-* | mips64r5900el-* \
|
||||||
|
| mips64vr-* | mips64vrel-* \
|
||||||
| mips64vr4100-* | mips64vr4100el-* \
|
| mips64vr4100-* | mips64vr4100el-* \
|
||||||
| mips64vr4300-* | mips64vr4300el-* \
|
| mips64vr4300-* | mips64vr4300el-* \
|
||||||
| mips64vr5000-* | mips64vr5000el-* \
|
| mips64vr5000-* | mips64vr5000el-* \
|
||||||
@@ -352,29 +411,36 @@ case $basic_machine in
|
|||||||
| mmix-* \
|
| mmix-* \
|
||||||
| mt-* \
|
| mt-* \
|
||||||
| msp430-* \
|
| msp430-* \
|
||||||
|
| nds32-* | nds32le-* | nds32be-* \
|
||||||
| nios-* | nios2-* \
|
| nios-* | nios2-* \
|
||||||
| none-* | np1-* | ns16k-* | ns32k-* \
|
| none-* | np1-* | ns16k-* | ns32k-* \
|
||||||
|
| open8-* \
|
||||||
| orion-* \
|
| orion-* \
|
||||||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
|
||||||
| pyramid-* \
|
| pyramid-* \
|
||||||
| romp-* | rs6000-* \
|
| rl78-* | romp-* | rs6000-* | rx-* \
|
||||||
| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
|
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
|
||||||
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
||||||
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
|
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
|
||||||
| sparclite-* \
|
| sparclite-* \
|
||||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
|
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
|
||||||
| tahoe-* | thumb-* \
|
| tahoe-* \
|
||||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
||||||
|
| tile*-* \
|
||||||
| tron-* \
|
| tron-* \
|
||||||
| v850-* | v850e-* | vax-* \
|
| ubicom32-* \
|
||||||
|
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
|
||||||
|
| vax-* \
|
||||||
| we32k-* \
|
| we32k-* \
|
||||||
| x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
|
| x86-* | x86_64-* | xc16x-* | xps100-* \
|
||||||
| xstormy16-* | xtensa-* \
|
| xstormy16-* | xtensa*-* \
|
||||||
| ymp-* \
|
| ymp-* \
|
||||||
| z8k-*)
|
| z8k-* | z80-*)
|
||||||
;;
|
;;
|
||||||
m32c-*)
|
# Recognize the basic CPU types without company name, with glob match.
|
||||||
|
xtensa*)
|
||||||
|
basic_machine=$basic_machine-unknown
|
||||||
;;
|
;;
|
||||||
# Recognize the various machine names and aliases which stand
|
# Recognize the various machine names and aliases which stand
|
||||||
# for a CPU type and a company and sometimes even an OS.
|
# for a CPU type and a company and sometimes even an OS.
|
||||||
@@ -392,7 +458,7 @@ case $basic_machine in
|
|||||||
basic_machine=a29k-amd
|
basic_machine=a29k-amd
|
||||||
os=-udi
|
os=-udi
|
||||||
;;
|
;;
|
||||||
abacus)
|
abacus)
|
||||||
basic_machine=abacus-unknown
|
basic_machine=abacus-unknown
|
||||||
;;
|
;;
|
||||||
adobe68k)
|
adobe68k)
|
||||||
@@ -438,6 +504,10 @@ case $basic_machine in
|
|||||||
basic_machine=m68k-apollo
|
basic_machine=m68k-apollo
|
||||||
os=-bsd
|
os=-bsd
|
||||||
;;
|
;;
|
||||||
|
aros)
|
||||||
|
basic_machine=i386-pc
|
||||||
|
os=-aros
|
||||||
|
;;
|
||||||
aux)
|
aux)
|
||||||
basic_machine=m68k-apple
|
basic_machine=m68k-apple
|
||||||
os=-aux
|
os=-aux
|
||||||
@@ -446,10 +516,35 @@ case $basic_machine in
|
|||||||
basic_machine=ns32k-sequent
|
basic_machine=ns32k-sequent
|
||||||
os=-dynix
|
os=-dynix
|
||||||
;;
|
;;
|
||||||
|
blackfin)
|
||||||
|
basic_machine=bfin-unknown
|
||||||
|
os=-linux
|
||||||
|
;;
|
||||||
|
blackfin-*)
|
||||||
|
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
os=-linux
|
||||||
|
;;
|
||||||
|
bluegene*)
|
||||||
|
basic_machine=powerpc-ibm
|
||||||
|
os=-cnk
|
||||||
|
;;
|
||||||
|
c54x-*)
|
||||||
|
basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
;;
|
||||||
|
c55x-*)
|
||||||
|
basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
;;
|
||||||
|
c6x-*)
|
||||||
|
basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
;;
|
||||||
c90)
|
c90)
|
||||||
basic_machine=c90-cray
|
basic_machine=c90-cray
|
||||||
os=-unicos
|
os=-unicos
|
||||||
;;
|
;;
|
||||||
|
cegcc)
|
||||||
|
basic_machine=arm-unknown
|
||||||
|
os=-cegcc
|
||||||
|
;;
|
||||||
convex-c1)
|
convex-c1)
|
||||||
basic_machine=c1-convex
|
basic_machine=c1-convex
|
||||||
os=-bsd
|
os=-bsd
|
||||||
@@ -478,8 +573,8 @@ case $basic_machine in
|
|||||||
basic_machine=craynv-cray
|
basic_machine=craynv-cray
|
||||||
os=-unicosmp
|
os=-unicosmp
|
||||||
;;
|
;;
|
||||||
cr16c)
|
cr16 | cr16-*)
|
||||||
basic_machine=cr16c-unknown
|
basic_machine=cr16-unknown
|
||||||
os=-elf
|
os=-elf
|
||||||
;;
|
;;
|
||||||
crds | unos)
|
crds | unos)
|
||||||
@@ -517,6 +612,10 @@ case $basic_machine in
|
|||||||
basic_machine=m88k-motorola
|
basic_machine=m88k-motorola
|
||||||
os=-sysv3
|
os=-sysv3
|
||||||
;;
|
;;
|
||||||
|
dicos)
|
||||||
|
basic_machine=i686-pc
|
||||||
|
os=-dicos
|
||||||
|
;;
|
||||||
djgpp)
|
djgpp)
|
||||||
basic_machine=i586-pc
|
basic_machine=i586-pc
|
||||||
os=-msdosdjgpp
|
os=-msdosdjgpp
|
||||||
@@ -632,7 +731,6 @@ case $basic_machine in
|
|||||||
i370-ibm* | ibm*)
|
i370-ibm* | ibm*)
|
||||||
basic_machine=i370-ibm
|
basic_machine=i370-ibm
|
||||||
;;
|
;;
|
||||||
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
|
|
||||||
i*86v32)
|
i*86v32)
|
||||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||||
os=-sysv32
|
os=-sysv32
|
||||||
@@ -671,6 +769,14 @@ case $basic_machine in
|
|||||||
basic_machine=m68k-isi
|
basic_machine=m68k-isi
|
||||||
os=-sysv
|
os=-sysv
|
||||||
;;
|
;;
|
||||||
|
m68knommu)
|
||||||
|
basic_machine=m68k-unknown
|
||||||
|
os=-linux
|
||||||
|
;;
|
||||||
|
m68knommu-*)
|
||||||
|
basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
os=-linux
|
||||||
|
;;
|
||||||
m88k-omron*)
|
m88k-omron*)
|
||||||
basic_machine=m88k-omron
|
basic_machine=m88k-omron
|
||||||
;;
|
;;
|
||||||
@@ -682,10 +788,17 @@ case $basic_machine in
|
|||||||
basic_machine=ns32k-utek
|
basic_machine=ns32k-utek
|
||||||
os=-sysv
|
os=-sysv
|
||||||
;;
|
;;
|
||||||
|
microblaze)
|
||||||
|
basic_machine=microblaze-xilinx
|
||||||
|
;;
|
||||||
mingw32)
|
mingw32)
|
||||||
basic_machine=i386-pc
|
basic_machine=i386-pc
|
||||||
os=-mingw32
|
os=-mingw32
|
||||||
;;
|
;;
|
||||||
|
mingw32ce)
|
||||||
|
basic_machine=arm-unknown
|
||||||
|
os=-mingw32ce
|
||||||
|
;;
|
||||||
miniframe)
|
miniframe)
|
||||||
basic_machine=m68000-convergent
|
basic_machine=m68000-convergent
|
||||||
;;
|
;;
|
||||||
@@ -714,10 +827,18 @@ case $basic_machine in
|
|||||||
ms1-*)
|
ms1-*)
|
||||||
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
|
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
|
||||||
;;
|
;;
|
||||||
|
msys)
|
||||||
|
basic_machine=i386-pc
|
||||||
|
os=-msys
|
||||||
|
;;
|
||||||
mvs)
|
mvs)
|
||||||
basic_machine=i370-ibm
|
basic_machine=i370-ibm
|
||||||
os=-mvs
|
os=-mvs
|
||||||
;;
|
;;
|
||||||
|
nacl)
|
||||||
|
basic_machine=le32-unknown
|
||||||
|
os=-nacl
|
||||||
|
;;
|
||||||
ncr3000)
|
ncr3000)
|
||||||
basic_machine=i486-ncr
|
basic_machine=i486-ncr
|
||||||
os=-sysv4
|
os=-sysv4
|
||||||
@@ -782,6 +903,12 @@ case $basic_machine in
|
|||||||
np1)
|
np1)
|
||||||
basic_machine=np1-gould
|
basic_machine=np1-gould
|
||||||
;;
|
;;
|
||||||
|
neo-tandem)
|
||||||
|
basic_machine=neo-tandem
|
||||||
|
;;
|
||||||
|
nse-tandem)
|
||||||
|
basic_machine=nse-tandem
|
||||||
|
;;
|
||||||
nsr-tandem)
|
nsr-tandem)
|
||||||
basic_machine=nsr-tandem
|
basic_machine=nsr-tandem
|
||||||
;;
|
;;
|
||||||
@@ -812,6 +939,14 @@ case $basic_machine in
|
|||||||
basic_machine=i860-intel
|
basic_machine=i860-intel
|
||||||
os=-osf
|
os=-osf
|
||||||
;;
|
;;
|
||||||
|
parisc)
|
||||||
|
basic_machine=hppa-unknown
|
||||||
|
os=-linux
|
||||||
|
;;
|
||||||
|
parisc-*)
|
||||||
|
basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
os=-linux
|
||||||
|
;;
|
||||||
pbd)
|
pbd)
|
||||||
basic_machine=sparc-tti
|
basic_machine=sparc-tti
|
||||||
;;
|
;;
|
||||||
@@ -856,9 +991,10 @@ case $basic_machine in
|
|||||||
;;
|
;;
|
||||||
power) basic_machine=power-ibm
|
power) basic_machine=power-ibm
|
||||||
;;
|
;;
|
||||||
ppc) basic_machine=powerpc-unknown
|
ppc | ppcbe) basic_machine=powerpc-unknown
|
||||||
;;
|
;;
|
||||||
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
ppc-* | ppcbe-*)
|
||||||
|
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
;;
|
;;
|
||||||
ppcle | powerpclittle | ppc-le | powerpc-little)
|
ppcle | powerpclittle | ppc-le | powerpc-little)
|
||||||
basic_machine=powerpcle-unknown
|
basic_machine=powerpcle-unknown
|
||||||
@@ -913,6 +1049,10 @@ case $basic_machine in
|
|||||||
sb1el)
|
sb1el)
|
||||||
basic_machine=mipsisa64sb1el-unknown
|
basic_machine=mipsisa64sb1el-unknown
|
||||||
;;
|
;;
|
||||||
|
sde)
|
||||||
|
basic_machine=mipsisa32-sde
|
||||||
|
os=-elf
|
||||||
|
;;
|
||||||
sei)
|
sei)
|
||||||
basic_machine=mips-sei
|
basic_machine=mips-sei
|
||||||
os=-seiux
|
os=-seiux
|
||||||
@@ -924,6 +1064,9 @@ case $basic_machine in
|
|||||||
basic_machine=sh-hitachi
|
basic_machine=sh-hitachi
|
||||||
os=-hms
|
os=-hms
|
||||||
;;
|
;;
|
||||||
|
sh5el)
|
||||||
|
basic_machine=sh5le-unknown
|
||||||
|
;;
|
||||||
sh64)
|
sh64)
|
||||||
basic_machine=sh64-unknown
|
basic_machine=sh64-unknown
|
||||||
;;
|
;;
|
||||||
@@ -945,6 +1088,9 @@ case $basic_machine in
|
|||||||
basic_machine=i860-stratus
|
basic_machine=i860-stratus
|
||||||
os=-sysv4
|
os=-sysv4
|
||||||
;;
|
;;
|
||||||
|
strongarm-* | thumb-*)
|
||||||
|
basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
;;
|
||||||
sun2)
|
sun2)
|
||||||
basic_machine=m68000-sun
|
basic_machine=m68000-sun
|
||||||
;;
|
;;
|
||||||
@@ -1001,17 +1147,9 @@ case $basic_machine in
|
|||||||
basic_machine=t90-cray
|
basic_machine=t90-cray
|
||||||
os=-unicos
|
os=-unicos
|
||||||
;;
|
;;
|
||||||
tic54x | c54x*)
|
tile*)
|
||||||
basic_machine=tic54x-unknown
|
basic_machine=$basic_machine-unknown
|
||||||
os=-coff
|
os=-linux-gnu
|
||||||
;;
|
|
||||||
tic55x | c55x*)
|
|
||||||
basic_machine=tic55x-unknown
|
|
||||||
os=-coff
|
|
||||||
;;
|
|
||||||
tic6x | c6x*)
|
|
||||||
basic_machine=tic6x-unknown
|
|
||||||
os=-coff
|
|
||||||
;;
|
;;
|
||||||
tx39)
|
tx39)
|
||||||
basic_machine=mipstx39-unknown
|
basic_machine=mipstx39-unknown
|
||||||
@@ -1080,6 +1218,9 @@ case $basic_machine in
|
|||||||
xps | xps100)
|
xps | xps100)
|
||||||
basic_machine=xps100-honeywell
|
basic_machine=xps100-honeywell
|
||||||
;;
|
;;
|
||||||
|
xscale-* | xscalee[bl]-*)
|
||||||
|
basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
|
||||||
|
;;
|
||||||
ymp)
|
ymp)
|
||||||
basic_machine=ymp-cray
|
basic_machine=ymp-cray
|
||||||
os=-unicos
|
os=-unicos
|
||||||
@@ -1088,6 +1229,10 @@ case $basic_machine in
|
|||||||
basic_machine=z8k-unknown
|
basic_machine=z8k-unknown
|
||||||
os=-sim
|
os=-sim
|
||||||
;;
|
;;
|
||||||
|
z80-*-coff)
|
||||||
|
basic_machine=z80-unknown
|
||||||
|
os=-sim
|
||||||
|
;;
|
||||||
none)
|
none)
|
||||||
basic_machine=none-none
|
basic_machine=none-none
|
||||||
os=-none
|
os=-none
|
||||||
@@ -1126,7 +1271,7 @@ case $basic_machine in
|
|||||||
we32k)
|
we32k)
|
||||||
basic_machine=we32k-att
|
basic_machine=we32k-att
|
||||||
;;
|
;;
|
||||||
sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
|
sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
|
||||||
basic_machine=sh-unknown
|
basic_machine=sh-unknown
|
||||||
;;
|
;;
|
||||||
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
|
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
|
||||||
@@ -1173,9 +1318,12 @@ esac
|
|||||||
if [ x"$os" != x"" ]
|
if [ x"$os" != x"" ]
|
||||||
then
|
then
|
||||||
case $os in
|
case $os in
|
||||||
# First match some system type aliases
|
# First match some system type aliases
|
||||||
# that might get confused with valid system types.
|
# that might get confused with valid system types.
|
||||||
# -solaris* is a basic system type, with this one exception.
|
# -solaris* is a basic system type, with this one exception.
|
||||||
|
-auroraux)
|
||||||
|
os=-auroraux
|
||||||
|
;;
|
||||||
-solaris1 | -solaris1.*)
|
-solaris1 | -solaris1.*)
|
||||||
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
||||||
;;
|
;;
|
||||||
@@ -1196,10 +1344,11 @@ case $os in
|
|||||||
# Each alternative MUST END IN A *, to match a version number.
|
# Each alternative MUST END IN A *, to match a version number.
|
||||||
# -sysv* is not here because it comes later, after sysvr4.
|
# -sysv* is not here because it comes later, after sysvr4.
|
||||||
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
||||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
|
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
|
||||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
|
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
|
||||||
|
| -sym* | -kopensolaris* \
|
||||||
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
||||||
| -aos* \
|
| -aos* | -aros* \
|
||||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||||
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
|
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
|
||||||
@@ -1208,9 +1357,10 @@ case $os in
|
|||||||
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||||
| -chorusos* | -chorusrdb* \
|
| -chorusos* | -chorusrdb* | -cegcc* \
|
||||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||||
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
|
| -mingw32* | -linux-gnu* | -linux-android* \
|
||||||
|
| -linux-newlib* | -linux-uclibc* \
|
||||||
| -uxpv* | -beos* | -mpeix* | -udk* \
|
| -uxpv* | -beos* | -mpeix* | -udk* \
|
||||||
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
||||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
||||||
@@ -1218,7 +1368,7 @@ case $os in
|
|||||||
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
||||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
||||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
|
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
|
||||||
| -skyos* | -haiku* | -rdos*)
|
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
|
||||||
# Remember, each alternative MUST END IN *, to match a version number.
|
# Remember, each alternative MUST END IN *, to match a version number.
|
||||||
;;
|
;;
|
||||||
-qnx*)
|
-qnx*)
|
||||||
@@ -1257,7 +1407,7 @@ case $os in
|
|||||||
-opened*)
|
-opened*)
|
||||||
os=-openedition
|
os=-openedition
|
||||||
;;
|
;;
|
||||||
-os400*)
|
-os400*)
|
||||||
os=-os400
|
os=-os400
|
||||||
;;
|
;;
|
||||||
-wince*)
|
-wince*)
|
||||||
@@ -1306,7 +1456,7 @@ case $os in
|
|||||||
-sinix*)
|
-sinix*)
|
||||||
os=-sysv4
|
os=-sysv4
|
||||||
;;
|
;;
|
||||||
-tpf*)
|
-tpf*)
|
||||||
os=-tpf
|
os=-tpf
|
||||||
;;
|
;;
|
||||||
-triton*)
|
-triton*)
|
||||||
@@ -1348,6 +1498,11 @@ case $os in
|
|||||||
-zvmoe)
|
-zvmoe)
|
||||||
os=-zvmoe
|
os=-zvmoe
|
||||||
;;
|
;;
|
||||||
|
-dicos*)
|
||||||
|
os=-dicos
|
||||||
|
;;
|
||||||
|
-nacl*)
|
||||||
|
;;
|
||||||
-none)
|
-none)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@@ -1370,6 +1525,12 @@ else
|
|||||||
# system, and we'll never get to this point.
|
# system, and we'll never get to this point.
|
||||||
|
|
||||||
case $basic_machine in
|
case $basic_machine in
|
||||||
|
score-*)
|
||||||
|
os=-elf
|
||||||
|
;;
|
||||||
|
spu-*)
|
||||||
|
os=-elf
|
||||||
|
;;
|
||||||
*-acorn)
|
*-acorn)
|
||||||
os=-riscix1.2
|
os=-riscix1.2
|
||||||
;;
|
;;
|
||||||
@@ -1379,9 +1540,21 @@ case $basic_machine in
|
|||||||
arm*-semi)
|
arm*-semi)
|
||||||
os=-aout
|
os=-aout
|
||||||
;;
|
;;
|
||||||
c4x-* | tic4x-*)
|
c4x-* | tic4x-*)
|
||||||
os=-coff
|
os=-coff
|
||||||
;;
|
;;
|
||||||
|
hexagon-*)
|
||||||
|
os=-elf
|
||||||
|
;;
|
||||||
|
tic54x-*)
|
||||||
|
os=-coff
|
||||||
|
;;
|
||||||
|
tic55x-*)
|
||||||
|
os=-coff
|
||||||
|
;;
|
||||||
|
tic6x-*)
|
||||||
|
os=-coff
|
||||||
|
;;
|
||||||
# This must come before the *-dec entry.
|
# This must come before the *-dec entry.
|
||||||
pdp10-*)
|
pdp10-*)
|
||||||
os=-tops20
|
os=-tops20
|
||||||
@@ -1400,13 +1573,13 @@ case $basic_machine in
|
|||||||
;;
|
;;
|
||||||
m68000-sun)
|
m68000-sun)
|
||||||
os=-sunos3
|
os=-sunos3
|
||||||
# This also exists in the configure program, but was not the
|
|
||||||
# default.
|
|
||||||
# os=-sunos4
|
|
||||||
;;
|
;;
|
||||||
m68*-cisco)
|
m68*-cisco)
|
||||||
os=-aout
|
os=-aout
|
||||||
;;
|
;;
|
||||||
|
mep-*)
|
||||||
|
os=-elf
|
||||||
|
;;
|
||||||
mips*-cisco)
|
mips*-cisco)
|
||||||
os=-elf
|
os=-elf
|
||||||
;;
|
;;
|
||||||
@@ -1431,7 +1604,7 @@ case $basic_machine in
|
|||||||
*-ibm)
|
*-ibm)
|
||||||
os=-aix
|
os=-aix
|
||||||
;;
|
;;
|
||||||
*-knuth)
|
*-knuth)
|
||||||
os=-mmixware
|
os=-mmixware
|
||||||
;;
|
;;
|
||||||
*-wec)
|
*-wec)
|
||||||
@@ -1536,7 +1709,7 @@ case $basic_machine in
|
|||||||
-sunos*)
|
-sunos*)
|
||||||
vendor=sun
|
vendor=sun
|
||||||
;;
|
;;
|
||||||
-aix*)
|
-cnk*|-aix*)
|
||||||
vendor=ibm
|
vendor=ibm
|
||||||
;;
|
;;
|
||||||
-beos*)
|
-beos*)
|
||||||
|
|||||||
1111
configure.ac
1111
configure.ac
File diff suppressed because it is too large
Load Diff
262
doc_src/FORMATTING.md
Normal file
262
doc_src/FORMATTING.md
Normal file
@@ -0,0 +1,262 @@
|
|||||||
|
# Formatting guide for fish docs
|
||||||
|
|
||||||
|
The fish documentation has been updated to support Doxygen 1.8.7+, and while the main benefit of this change is extensive Markdown support, the addition of a fish lexicon and syntax filter, combined with semantic markup rules allows for automatic formatting enhancements across the HTML user_docs, the developer docs and the man pages.
|
||||||
|
|
||||||
|
Initially my motivation was to fix a problem with long options ([Issue #1557](https://github.com/fish-shell/fish-shell/issues/1557) on GitHub), but as I worked on fixing the issue I realised there was an opportunity to simplify, reinforce and clarify the current documentation, hopefully making further contribution easier and cleaner, while allowing the documentation examples to presented more clearly with less author effort.
|
||||||
|
|
||||||
|
While the documentation is pretty robust to variations in the documentation source, adherence to the following style guide will help keep the already excellent documention in good shape moving forward.
|
||||||
|
|
||||||
|
## Line breaks and wrapping
|
||||||
|
|
||||||
|
Contrary to the rest of the fish source code, the documentation greatly benefits from the use of long lines and soft wrapping. It allows paragraphs to be treated as complete blocks by Doxygen, means that the semantic filter can see complete lines when deciding on how to apply syntax highlighting, and means that man pages will consistently wrap to the width of the users console in advanced pagers, such as 'most'.
|
||||||
|
|
||||||
|
## Doxygen special commands and aliases
|
||||||
|
|
||||||
|
While Markdown syntax forms the basis of the documentation content, there are some exceptions that require the use of Doxygen special commands. On the whole, Doxygen commands should be avoided, especially inline word formatting such as \\c as this would allow Doxygen to make unhelpful assumptions, such as converting double dashes (\--) to n-dashes (–).
|
||||||
|
|
||||||
|
### Structure: \\page, \\section and \\subsection
|
||||||
|
|
||||||
|
Use of Doxygen sections markers are important, as these determine what will be eventually output as a web page, man page or included in the developer docs.
|
||||||
|
|
||||||
|
Currently the make process for the documentation is quite convoluted, but basically the HTML docs are produced from a single, compiled file, doc.h. This contains a number of \\page markers that produce the various pages used in the documentation. The format of a \\page mark is:
|
||||||
|
|
||||||
|
\page universally_unique_page_id Page title
|
||||||
|
|
||||||
|
The source files that contain the page markers are currently:
|
||||||
|
|
||||||
|
- __index.hdr.in__: Core documentation
|
||||||
|
- __commands.hdr.in__: Individual commands
|
||||||
|
- __tutorial.hdr__: Tutorial
|
||||||
|
- __design.hdr__: Design document
|
||||||
|
- __faq.hdr__: Frequently Asked Questions
|
||||||
|
- __license.hdr__: Fish and 3rd party licences
|
||||||
|
|
||||||
|
Unless there is a _VERY_ good reason and developer consensus, new pages should never be added.
|
||||||
|
|
||||||
|
The rest of the documentation is structured using \\section and \\subsection markers. Most of the source files (listed above) contain their full content, the exception being commands, which are separated out into source text files in the doc_src directory. These files are concatenated into one file, so each one starts with a \\section declaration. The synopsis, description and examples (if present) are declared as \\subsections. The format of these marks is practically identical to the page mark.
|
||||||
|
|
||||||
|
\section universally_unique_section_id Section title
|
||||||
|
\subsection universally_unique_subsection_id Subsection title
|
||||||
|
|
||||||
|
Each page, section and subsection id _must_ be unique across the whole of the documentation, otherwise Doxygen will issue a warning.
|
||||||
|
|
||||||
|
### Semantic markup: the \\fish .. \\endfish block
|
||||||
|
|
||||||
|
While Doxygen has support for \\code..\\endcode blocks with enhanced markup and syntax colouring, it only understands the core Doxygen languages: C, C++, Objective C, Java, PHP, Python, Tcl and Fortran. To enhance Fish's syntax presentation, use the special \\fish..\\endfish blocks instead.
|
||||||
|
|
||||||
|
Text placed in this block will be parsed by Doxygen using the included lexicon filter (see lexicon_filter.in) as a Doxygen input filter. The filter is built during make so that it can pick up information on builtins, functions and shell commands mentioned in completions and apply markup to keywords found inside the \\fish block.
|
||||||
|
|
||||||
|
Basically, preformatted plain text inside the \\fish block is fed through the filter and is returned marked up so that Doxygen aliases can convert it back to a presentable form, according to the output document type.
|
||||||
|
|
||||||
|
For instance:
|
||||||
|
|
||||||
|
`echo hello world`
|
||||||
|
|
||||||
|
is transformed into:
|
||||||
|
|
||||||
|
`@cmnd{echo} @args{hello} @args{world}`
|
||||||
|
|
||||||
|
which is then transformed by Doxygen into an HTML version (`make user_doc`):
|
||||||
|
|
||||||
|
`<span class="command">echo</span> <span class="argument">hello</span> <span class="argument">world</span>`
|
||||||
|
|
||||||
|
A man page version (`make share/man`):
|
||||||
|
|
||||||
|
__echo__ hello world
|
||||||
|
|
||||||
|
And a simple HTML version for the developer docs (`make doc`) and the LATEX/PDF manual (`make doc/refman.pdf`):
|
||||||
|
|
||||||
|
`echo hello world`
|
||||||
|
|
||||||
|
### Fonts
|
||||||
|
|
||||||
|
In older browsers, it was easy to set the fonts used for the three basic type styles (serif, sans-serif and monospace). Modern browsers have removed these options in their respective quests for simplification, assuming the content author will provide suitable styles for the content in the site's CSS, or the end user will provide overriding styles manually. Doxygen's default styling is very simple and most users will just accept this default.
|
||||||
|
|
||||||
|
I've tried to use a sensible set of fonts in the documentation's CSS based on 'good' terminal fonts and as a result the firt preference font used throughout the documentation is '[DejaVu](http://dejavu-fonts.org)'. The rationale behaind this is that while DejaVu is getting a little long in the tooth, it still provides the most complete support across serif, sans-serif and monospace styles (giving a well balanced feel and consistent [x-height](http://en.wikipedia.org/wiki/X-height)), has the widest support for extended Unicode characters and has a free, permissive licenses (though it's still incompatible with GPLv2, though arguably less so than the SIL Open Font license, though this is a moot point when using it solely in the docs).
|
||||||
|
|
||||||
|
#### Fonts inside \\fish blocks and \`backticks\`
|
||||||
|
|
||||||
|
As the point of these contructs is to make fish's syntax clearer to the user, it makes sense to mimic what the user will see in the console, therefore any content is formatted using the monospaced style, specifically monospaced fonts are chosen in the following order:
|
||||||
|
|
||||||
|
1. __DejaVu Sans Mono__: Explained above. [[↓](http://dejavu-fonts.org)]
|
||||||
|
2. __Source Code Pro__: Monospaced code font, part of Adobe's free Edge Web Fonts. [[↓](https://edgewebfonts.adobe.com)]
|
||||||
|
3. __Menlo__: Apple supplied variant of DejaVu.
|
||||||
|
4. __Ubuntu Mono__: Ubuntu Linux's default monospaced font. [[↓](http://font.ubuntu.com)]
|
||||||
|
5. __Consolas__: Modern Microsoft supplied console font.
|
||||||
|
6. __Monaco__: Apple supplied console font since 1984!
|
||||||
|
7. __Lucida Console__: Generic mono terminal font, standard in many OS's and distros.
|
||||||
|
8. __monospace__: Catchall style. Chooses default monospaced font, often Courier.
|
||||||
|
9. __fixed__: As above, more often used on mobile devices.
|
||||||
|
|
||||||
|
#### General Fonts
|
||||||
|
|
||||||
|
1. __DejaVu Sans__: As above.[[↓](http://dejavu-fonts.org)]
|
||||||
|
2. __Roboto__: Elegant Google free font and is Doxygen's default [[↓](http://www.google.com/fonts/specimen/Roboto)]
|
||||||
|
3. __Lucida Grande__: Default Apple OS X content font.
|
||||||
|
4. __Calibri__: Default Microsoft Office font (since 2007).
|
||||||
|
5. __Verdana__: Good general font found in a lot of OSs.
|
||||||
|
6. __Helvetica Neue__: Better spaced and balanced Helvetica/Arial variant.
|
||||||
|
7. __Helvetica__: Standard humanist typeface found almost everywhere.
|
||||||
|
8. __Arial__: Microsoft's Helvetica.
|
||||||
|
9. __sans-serif__: Catchall style. Chooses default sans-serif typeface, often Helvetica.
|
||||||
|
|
||||||
|
The ordering of the fonts is important as it's designed to allow the documentation to settle into a number of different identities according to the fonts available. If you have the complete DejaVu family installed, then the docs are presented using that, and if your Console is set up to use the same fonts, presentation will be completely consistent.
|
||||||
|
|
||||||
|
On OS X, with nothing extra installed, the docs will default to Menlo and Lucida Grande giving a Mac feel. Under Windows, it will default to using Consolas and Calibri on recent versions, giving a modern Windows style.
|
||||||
|
|
||||||
|
#### Other sources:
|
||||||
|
|
||||||
|
- [Font Squirrel](http://www.fontsquirrel.com): Good source of open source font packages.
|
||||||
|
|
||||||
|
### Choosing a CLI style: using a \\fish{style} block
|
||||||
|
|
||||||
|
By default, when output as HTML, a \\fish block uses syntax colouring suited to the style of the documentation rather than trying to mimic the terminal. The block has a light, bordered background and a colour scheme that 'suggests' what the user would see in a console.
|
||||||
|
|
||||||
|
Additional stying can be applied adding a style declaration:
|
||||||
|
|
||||||
|
\fish{additional_style [another_style...]}
|
||||||
|
...
|
||||||
|
\endfish
|
||||||
|
|
||||||
|
This will translate to classes applied to the `<div>` tag, like so:
|
||||||
|
|
||||||
|
<div class="fish additional_style another_style">
|
||||||
|
...
|
||||||
|
</div>
|
||||||
|
|
||||||
|
The various classes are defined in `doc_src/user_doc.css` and new style can be simply added
|
||||||
|
|
||||||
|
The documentation currently defines a couple of additional styles:
|
||||||
|
|
||||||
|
- __cli-dark__: Used in the _tutorial_ and _FAQ_ to simulate a dark background terminal, with fish's default colours (slightly tweaked for legibility in the browser).
|
||||||
|
|
||||||
|
- __synopsis__: A simple colour theme helpful for displaying the logical 'summary' of a command's syntax, options and structure.
|
||||||
|
|
||||||
|
## Markdown
|
||||||
|
|
||||||
|
Apart from the exceptions discussed above, the rest of the documentation now supports the use of Markdown. As such the use of Doxygen special commands for HTML tags is unnecessary.
|
||||||
|
|
||||||
|
There are a few exceptions and extensions to the Markdown [standard](http://daringfireball.net/projects/markdown/) that are documented in the Doxygen [documentation](http://www.stack.nl/~dimitri/doxygen/manual/markdown.html).
|
||||||
|
|
||||||
|
### \`Backticks\`
|
||||||
|
|
||||||
|
As is standard in Markdown and 'Github Flavoured Markdown' (GFM), backticks can be used to denote inline technical terms in the documentation, `like so`. In the documentation this will set the font to the monospaced 'console' typeface and will cause the enclosed term to stand out.
|
||||||
|
|
||||||
|
However, fenced code blocks using 4 spaces or 3 backticks (\`\`\`) should be avoided as Doxygen will interpret these as \\code blocks and try to apply standard syntax colouring, which doesn't work so well for fish examples. Use `\fish..\endfish` blocks instead.
|
||||||
|
|
||||||
|
### Lists
|
||||||
|
|
||||||
|
Standard Markdown list rules apply, but as Doxygen will collapse white space on output, combined with the use of long lines, it's a good idea to include an extra new line between long list items to assist future editing.
|
||||||
|
|
||||||
|
## Special cases
|
||||||
|
|
||||||
|
The following can be used in \\fish blocks to render some fish scenarios. These are mostly used in the tutorial when an interactive situation needs to be displayed.
|
||||||
|
|
||||||
|
### Custom formatting tags
|
||||||
|
|
||||||
|
- `<s>`: auto\<s\>suggestion\</s\>.
|
||||||
|
- `<m>`: \<m\>Matched\</m\> items, such as tab completions.
|
||||||
|
- `<sm>`: Matched items \<sm\>searched\<sm\> for, like grep results.
|
||||||
|
- `<error>`: \<error\>This would be shown as an error.\</error\>
|
||||||
|
- `<asis>`: \<asis\>This test will not be parsed for fish markup.\</asis\>
|
||||||
|
- `<outp>`: \<outp\>This would be rendered as command/script output.\</outp\>
|
||||||
|
|
||||||
|
### Prompts and cursors
|
||||||
|
|
||||||
|
- `>_`: Display a basic prompt.
|
||||||
|
- `~>_`: Display a prompt with a the home directory as the current working directory.
|
||||||
|
- `___` (3 underscores): Display a cursor.
|
||||||
|
|
||||||
|
|
||||||
|
### Keyboard shortcuts: @key{} and @cursor_key{}
|
||||||
|
|
||||||
|
Graphical keyboard shortcuts can be defined using the following special commands. These allow for the different text requirements across the html and man pages. The HTML uses CSS to create a keyboard style, whereas the man page would display the key as text.
|
||||||
|
|
||||||
|
- `@key{lable}`
|
||||||
|
Displays a key with a purely textual lable, such as: 'Tab', 'Page Up', 'Page Down', 'Home', 'End', 'F1', 'F19' and so on.
|
||||||
|
|
||||||
|
- `@key{modifier,lable}`
|
||||||
|
Displays a keystroke requiring the use of a 'modifier' key, such as 'Control-A', 'Shift-X', 'Alt-Tab' etc.
|
||||||
|
|
||||||
|
- `@key{modifier,entity,lable}`
|
||||||
|
Displays a keystroke using a graphical entity, such as an arrow symbol for cursor key based shortcuts.
|
||||||
|
|
||||||
|
- `@cursor_key{entity,lable}`
|
||||||
|
A special case for cursor keys, when no modifier is needed. i.e. `@cursor_key{↑,up}` for the up arrow key.
|
||||||
|
|
||||||
|
Some useful Unicode/HTML5 entities:
|
||||||
|
|
||||||
|
- Up arrow: `↑`
|
||||||
|
- Down arrow: `↓`
|
||||||
|
- Left arrow: `←`
|
||||||
|
- Right arrow `→`
|
||||||
|
- Shift: `⇧`
|
||||||
|
- Tab: `⇥`
|
||||||
|
- Mac option: `⌥`
|
||||||
|
- Mac command: `⌘`
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
### Doxygen
|
||||||
|
|
||||||
|
Tested on:
|
||||||
|
- Ubuntu 14.04 with Doxygen 1.8.8, built from [GitHub source](https://github.com/doxygen/doxygen.git).
|
||||||
|
- CentOS 6.5 with Doxygen 1.8.8, built from [GitHub source](https://github.com/doxygen/doxygen.git).
|
||||||
|
- Mac OS X 10.9 with Homebrew install Doxygen 1.8.7 and 1.8.8.
|
||||||
|
|
||||||
|
Graphviz was also installed in all the above testing.
|
||||||
|
|
||||||
|
Doxygen 1.8.6 and lower do not have the \\htmlonly[block] directive which fixes a multitude of problems in the rendering of the docs. In Doxygen 1.8.7 the list of understood HTML entities was greatly increased. I tested earlier versions and many little issues returned.
|
||||||
|
|
||||||
|
As fish ships with pre-built documentation, I don't see this as an issue.
|
||||||
|
|
||||||
|
### Updated Configure/Makefile
|
||||||
|
|
||||||
|
- Tested on Ubuntu 14.04, CentOS 6.5 and Mac OS X 10.9.
|
||||||
|
- Makefile has GNU/BSD sed/grep detection.
|
||||||
|
|
||||||
|
### HTML output
|
||||||
|
|
||||||
|
- The output HTML is HTML5 compliant, but should quickly and elegantly degrade on older browsers without losing basic structure.
|
||||||
|
- The CSS avoids the use or browser specific extenstions (i.e. -webkit, -moz etc), using the W3C HTML5 standard instead.
|
||||||
|
- It's been tested in Chrome 37.0 and Firefox 32.0 on Mac OS X 10.9 (+Safari 7), Windows 8.1 (+Internet Explorer 11) and Ubuntu Desktop 14.04.
|
||||||
|
- My assumption is basically that if someone cares enough to want to install fish, they'll be keeping a browser current.
|
||||||
|
|
||||||
|
### Man page output
|
||||||
|
|
||||||
|
- Tested on Ubuntu 14.04, CentOS 6.5 and Mac OS X 10.9.
|
||||||
|
- Output is substantially cleaner.
|
||||||
|
- Tested in cat, less, more and most pagers using the following fish script:
|
||||||
|
|
||||||
|
```
|
||||||
|
function manTest --description 'Test manpage' --argument page
|
||||||
|
set -l pager
|
||||||
|
for i in $argv
|
||||||
|
switch $i
|
||||||
|
case "-l"
|
||||||
|
set pager -P '/usr/bin/less -is'
|
||||||
|
case "-m"
|
||||||
|
set pager -P '/usr/bin/more -s'
|
||||||
|
case "-c"
|
||||||
|
set pager -P '/bin/cat'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
man $pager ~/Projects/OpenSource/fish-shell/share/man/man1/$page.1
|
||||||
|
end
|
||||||
|
|
||||||
|
# Assumes 'most' is the default system pager.
|
||||||
|
# NOT PORTABLE! Paths would be need to be updated on other systems.
|
||||||
|
```
|
||||||
|
|
||||||
|
### Developer docs and LATEX/PDF output
|
||||||
|
|
||||||
|
- HTML developer docs tested on Ubuntu 14.04, CentOS 6.5 and Mac OS X 10.9.
|
||||||
|
- LATEX/PDF reference manual tested on Mac OS X 10.9 using MacTEX. PDF production returns an error (due to Doxygen's use of an outdated 'float' package), but manual PDF output is ok.
|
||||||
|
|
||||||
|
### Future changes
|
||||||
|
|
||||||
|
1. The documentation creation process would be better if it could be modularised further and moved out of the makefile into a number of supporting scripts. This would allow both the automake and Xcode build processes to use the documentation scripts directly.
|
||||||
|
2. Remove the Doxygen dependency entirely for the user documentation. This would be very acheivable now that the bulk of the documentation is in Markdown.
|
||||||
|
3. It would be useful to gauge what parts of the documentation are actually used by users. Judging by the amount of 'missing comment' errors during the developer docs build phase, this aspect of the docs has been rather neglected. If it is not longer used or useful, then this could change the future direction of the documentation and significantly streamline the process.
|
||||||
|
|
||||||
|
#### Author: Mark Griffiths [@GitHub](https://github.com/MarkGriffiths)
|
||||||
44
doc_src/abbr.txt
Normal file
44
doc_src/abbr.txt
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
\section abbr abbr - manage fish abbreviations
|
||||||
|
|
||||||
|
\subsection abbr-synopsis Synopsis
|
||||||
|
\fish{synopsis}
|
||||||
|
abbr -a word="phrase"
|
||||||
|
abbr -s
|
||||||
|
abbr -l
|
||||||
|
abbr -r word
|
||||||
|
\endfish
|
||||||
|
|
||||||
|
\subsection abbr-description Description
|
||||||
|
|
||||||
|
`abbr` manipulates the list of abbreviations that fish will expand.
|
||||||
|
|
||||||
|
Abbreviations are user-defined character sequences or words that are replaced with longer phrases after they are entered. For example, a frequently-run command such as `git checkout` can be abbreviated to `gco`. After entering `gco` and pressing @key{Space} or @key{Enter}, the full text `git checkout` will appear in the command line.
|
||||||
|
|
||||||
|
Abbreviations are stored, by default, in a universal variable.
|
||||||
|
|
||||||
|
The following parameters are available:
|
||||||
|
|
||||||
|
- `-a WORD PHRASE` or `--add WORD PHRASE` Adds a new abbreviation, where WORD will be expanded to PHRASE.
|
||||||
|
|
||||||
|
- `-s` or `--show` Show all abbreviated words and their expanded phrases in a manner suitable for export and import.
|
||||||
|
|
||||||
|
- `-l` or `--list` Lists all abbreviated words.
|
||||||
|
|
||||||
|
- `-r WORD` or `--remove WORD` Remove the abbreviation WORD.
|
||||||
|
|
||||||
|
\subsection abbr-example Examples
|
||||||
|
|
||||||
|
\fish
|
||||||
|
abbr -a gco git checkout
|
||||||
|
\endfish
|
||||||
|
Add a new abbreviation where `gco` will be replaced with `git checkout`.
|
||||||
|
|
||||||
|
\fish
|
||||||
|
abbr -r gco
|
||||||
|
\endfish
|
||||||
|
Remove the `gco` abbreviation.
|
||||||
|
|
||||||
|
\fish
|
||||||
|
ssh another_host abbr -s | source
|
||||||
|
\endfish
|
||||||
|
Import the abbreviations defined on another_host over SSH.
|
||||||
@@ -1,18 +1,34 @@
|
|||||||
\section alias alias - create a function
|
\section alias alias - create a function
|
||||||
|
|
||||||
\subsection alias-synopsis Synopsis
|
\subsection alias-synopsis Synopsis
|
||||||
<pre>alias NAME DEFINITION
|
\fish{synopsis}
|
||||||
alias NAME=DEFINITION</pre>
|
alias NAME DEFINITION
|
||||||
|
alias NAME=DEFINITION
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection alias-description Description
|
\subsection alias-description Description
|
||||||
|
|
||||||
Alias is a shellscript wrapper around the function builtin.
|
`alias` is a simple wrapper for the `function` builtin. It exists for backwards compatibility with Posix shells. For other uses, it is recommended to define a <a href='#function'>function</a>.
|
||||||
It exists for backwards compatibility with Posix
|
|
||||||
shells. For other uses, it is recommended to define a <a
|
|
||||||
href='#function'>function</a>.
|
|
||||||
|
|
||||||
Alias does not keep track of which functions have been defined using
|
`fish` does not keep track of which functions have been defined using `alias`. They must be erased using `functions -e`.
|
||||||
alias, nor does it allow erasing of aliases.
|
|
||||||
|
|
||||||
- NAME is the name of the function to define
|
- `NAME` is the name of the alias
|
||||||
- DEFINITION is the body of the function. The string " $argv" will be appended to the body.
|
|
||||||
|
- `DEFINITION` is the actual command to execute. The string `$argv` will be appended.
|
||||||
|
|
||||||
|
You cannot create an alias to a function with the same name.
|
||||||
|
|
||||||
|
|
||||||
|
\subsection alias-example Example
|
||||||
|
|
||||||
|
The following code will create `rmi`, which runs `rm` with additional arguments on every invocation.
|
||||||
|
|
||||||
|
\fish
|
||||||
|
alias rmi "rm -i"
|
||||||
|
|
||||||
|
# This is equivalent to entering the following function:
|
||||||
|
|
||||||
|
function rmi
|
||||||
|
rm -i $argv
|
||||||
|
end
|
||||||
|
\endfish
|
||||||
|
|||||||
@@ -1,27 +1,24 @@
|
|||||||
\section and and - conditionally execute a command
|
\section and and - conditionally execute a command
|
||||||
|
|
||||||
\subsection and-synopsis Synopsis
|
\subsection and-synopsis Synopsis
|
||||||
<tt>COMMAND1; and COMMAND2</tt>
|
\fish{synopsis}
|
||||||
|
COMMAND1; and COMMAND2
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection and-description Description
|
\subsection and-description Description
|
||||||
|
|
||||||
The \c and builtin is used to execute a command if the current exit
|
`and` is used to execute a command if the current exit status (as set by the last previous command) is 0.
|
||||||
status (as set by the last previous command) is 0.
|
|
||||||
|
|
||||||
The and command does not change the current exit status.
|
`and` does not change the current exit status.
|
||||||
|
|
||||||
|
The exit status of the last foreground command to exit can always be accessed using the <a href="index.html#variables-status">$status</a> variable.
|
||||||
|
|
||||||
The exit status of the last foreground command to exit can always be
|
|
||||||
accessed using the <a href="index.html#variables-status">$status</a>
|
|
||||||
variable.
|
|
||||||
|
|
||||||
\subsection and-example Example
|
\subsection and-example Example
|
||||||
|
|
||||||
The following code runs the \c make command to build a program, if the
|
The following code runs the `make` command to build a program. If the build succeeds, `make`'s exit status is 0, and the program is installed. If either step fails, the exit status is 1, and `make clean` is run, which removes the files created by the build process.
|
||||||
build succeeds, the program is installed. If either step fails,
|
|
||||||
<tt>make clean</tt> is run, which removes the files created by the
|
|
||||||
build process
|
|
||||||
|
|
||||||
<pre>
|
\fish
|
||||||
make; and make install; or make clean
|
make; and make install; or make clean
|
||||||
</pre>
|
\endfish
|
||||||
|
|
||||||
|
|||||||
BIN
doc_src/ascii_fish.png
Normal file
BIN
doc_src/ascii_fish.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
@@ -1,46 +1,45 @@
|
|||||||
\section begin begin - start a new block of code
|
\section begin begin - start a new block of code
|
||||||
|
|
||||||
\subsection begin-synopsis Synopsis
|
\subsection begin-synopsis Synopsis
|
||||||
<tt>begin; [COMMANDS...;] end</tt>
|
\fish{synopsis}
|
||||||
|
begin; [COMMANDS...;] end
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection begin-description Description
|
\subsection begin-description Description
|
||||||
|
|
||||||
The \c begin builtin is used to create a new block of code. The block
|
`begin` is used to create a new block of code.
|
||||||
is unconditionally executed. <code>begin; ...; end</tt> is equivalent
|
|
||||||
to <tt>if true; ...; end</tt>. The begin command is used to group any
|
The block is unconditionally executed. `begin; ...; end` is equivalent to `if true; ...; end`.
|
||||||
number of commands into a block. The reason for doing so is usually
|
|
||||||
either to introduce a new variable scope, to redirect the input or
|
`begin` is used to group a number of commands into a block. This allows the introduction of a new variable scope, redirection of the input or output of a set of commands as a group, or to specify precedence when using the conditional commands like `and`.
|
||||||
output of a set of commands as a group, or to specify precedence when
|
|
||||||
using the conditional commands like \c and.
|
`begin` does not change the current exit status.
|
||||||
|
|
||||||
The \c begin command does not change the current exit status.
|
|
||||||
|
|
||||||
\subsection begin-example Example
|
\subsection begin-example Example
|
||||||
|
|
||||||
The following code sets a number of variables inside of a block
|
The following code sets a number of variables inside of a block scope. Since the variables are set inside the block and have local scope, they will be automatically deleted when the block ends.
|
||||||
scope. Since the variables are set inside the block and have local
|
|
||||||
scope, they will be automatically deleted when the block ends.
|
|
||||||
|
|
||||||
<pre>
|
\fish
|
||||||
begin
|
begin
|
||||||
set -l PIRATE Yarrr
|
set -l PIRATE Yarrr
|
||||||
...
|
...
|
||||||
end
|
end
|
||||||
# This will not output anything, since the PIRATE variable went out
|
|
||||||
# of scope at the end of the block
|
|
||||||
echo $PIRATE
|
echo $PIRATE
|
||||||
</pre>
|
# This will not output anything, since the PIRATE variable
|
||||||
|
# went out of scope at the end of the block
|
||||||
|
\endfish
|
||||||
|
|
||||||
In the following code, all output is redirected to the file out.html.
|
In the following code, all output is redirected to the file out.html.
|
||||||
|
|
||||||
<pre>
|
\fish
|
||||||
begin
|
begin
|
||||||
echo $xml_header
|
echo $xml_header
|
||||||
echo $html_header
|
echo $html_header
|
||||||
if test -e $file
|
if test -e $file
|
||||||
...
|
...
|
||||||
end
|
end
|
||||||
...
|
...
|
||||||
|
end > out.html
|
||||||
end > out.html
|
\endfish
|
||||||
</pre>
|
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
\section bg bg - send to background
|
\section bg bg - send jobs to background
|
||||||
|
|
||||||
\subsection bg-synopsis Synopsis
|
\subsection bg-synopsis Synopsis
|
||||||
<tt>bg [PID...]</tt>
|
\fish{synopsis}
|
||||||
|
bg [PID...]
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection bg-description Description
|
\subsection bg-description Description
|
||||||
Sends the specified jobs to the background. A background job is
|
|
||||||
executed simultaneously with fish, and does not have access to the
|
`bg` sends <a href="index.html#syntax-job-control">jobs</a> to the background, resuming them if they are stopped. A background job is executed simultaneously with fish, and does not have access to the keyboard. If no job is specified, the last job to be used is put in the background. If PID is specified, the jobs with the specified process group IDs are put in the background.
|
||||||
keyboard. If no job is specified, the last job to be used is put in the background. If PID is specified, the jobs with the specified group ids are put in the background.
|
|
||||||
|
|
||||||
The PID of the desired process is usually found by using <a href="index.html#expand-process">process expansion</a>.
|
The PID of the desired process is usually found by using <a href="index.html#expand-process">process expansion</a>.
|
||||||
|
|
||||||
|
|
||||||
\subsection bg-example Example
|
\subsection bg-example Example
|
||||||
|
|
||||||
<tt>bg \%0</tt> will put the job with job id 0 in the background.
|
`bg %1` will put the job with job ID 1 in the background.
|
||||||
|
|
||||||
|
|||||||
154
doc_src/bind.txt
154
doc_src/bind.txt
@@ -1,63 +1,125 @@
|
|||||||
\section bind bind - handle fish key bindings
|
\section bind bind - handle fish key bindings
|
||||||
|
|
||||||
\subsection bind-synopsis Synopsis
|
\subsection bind-synopsis Synopsis
|
||||||
<tt>bind [OPTIONS] SEQUENCE COMMAND</tt>
|
\fish{synopsis}
|
||||||
|
bind [(-M | --mode) MODE] [(-m | --sets-mode) NEW_MODE]
|
||||||
|
[(-k | --key)] SEQUENCE COMMAND [COMMAND...]
|
||||||
|
bind [(-M | --mode) MODE] [(-k | --key)] SEQUENCE
|
||||||
|
bind (-K | --key-names) [(-a | --all)]
|
||||||
|
bind (-f | --function-names)
|
||||||
|
bind (-e | --erase) [(-M | --mode) MODE]
|
||||||
|
(-a | --all | [(-k | --key)] SEQUENCE [SEQUENCE...])
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection bind-description Description
|
\subsection bind-description Description
|
||||||
|
|
||||||
The <tt>bind</tt> builtin causes fish to add a key binding from the specified sequence.
|
`bind` adds a binding for the specified key sequence to the specified command.
|
||||||
|
|
||||||
SEQUENCE is the character sequence to bind to. Usually, one would use
|
SEQUENCE is the character sequence to bind to. These should be written as <a href="index.html#escapes">fish escape sequences</a>. For example, because pressing the Alt key and another character sends that character prefixed with an escape character, Alt-based key bindings can be written using the `\e` escape. For example, @key{Alt,w} can be written as `\ew`. The control character can be written in much the same way using the `\c` escape, for example @key{Control,X} (^X) can be written as `\cx`. Note that Alt-based key bindings are case sensitive and Control-based key bindings are not. This is a constraint of text-based terminals, not `fish`.
|
||||||
fish escape sequences to express them. For example, because pressing
|
|
||||||
the Alt key and another character sends that character prefixed with
|
|
||||||
an escape character, Alt-based key bindings can be written using the
|
|
||||||
\c \\e escape. For example, Alt-w can be written as
|
|
||||||
<tt>\\ew</tt>. Control character can be written in much the same way
|
|
||||||
using the \c \\c escape, for example Control-x can be written as
|
|
||||||
<tt>\\cx</tt>. Note that Alt-based key bindings are case sensitive and
|
|
||||||
Control base key bindings are not. This is not a design choice in
|
|
||||||
fish, it is simply how terminals work.
|
|
||||||
|
|
||||||
If SEQUENCE is the empty string, i.e. an empty set of quotes, this is
|
The default key binding can be set by specifying a `SEQUENCE` of the empty string (that is, ```''``` ). It will be used whenever no other binding matches. For most key bindings, it makes sense to use the `self-insert` function (i.e. ```bind '' self-insert```) as the default keybinding. This will insert any keystrokes not specifically bound to into the editor. Non- printable characters are ignored by the editor, so this will not result in control sequences being printable.
|
||||||
interpreted as the default keybinding. It will be used whenever no
|
|
||||||
other binding matches. For most key bindings, it makes sense to use
|
|
||||||
the \c self-insert function (i.e. <tt>bind '' self-insert</tt> as the
|
|
||||||
default keybining. This will insert any keystrokes not specifically
|
|
||||||
bound to into the editor. Non-printable characters are ignored by the
|
|
||||||
editor, so this will not result in e.g. control sequences being
|
|
||||||
printable.
|
|
||||||
|
|
||||||
If the -k switch is used, the name of the key (such as down, up or
|
If the `-k` switch is used, the name of the key (such as 'down', 'up' or 'backspace') is used instead of a sequence. The names used are the same as the corresponding curses variables, but without the 'key_' prefix. (See `terminfo(5)` for more information, or use `bind --key-names` for a list of all available named keys.)
|
||||||
backspace) is used instead of a sequence. The names used are the same
|
|
||||||
as the corresponding curses variables, but without the 'key_'
|
|
||||||
prefix. (See man 5 terminfo for more information, or use <tt>bind
|
|
||||||
--key-names</tt> for a list of all available named keys)
|
|
||||||
|
|
||||||
COMMAND can be any fish command, but it can also be one of a set of
|
`COMMAND` can be any fish command, but it can also be one of a set of special input functions. These include functions for moving the cursor, operating on the kill-ring, performing tab completion, etc. Use `bind --function-names` for a complete list of these input functions.
|
||||||
special input functions. These include functions for moving the
|
|
||||||
cursor, operating on the kill-ring, performing tab completion,
|
|
||||||
etc. Use 'bind --function-names' for a complete list of these input
|
|
||||||
functions.
|
|
||||||
|
|
||||||
When COMMAND is a shellscript command, it is a good practice to put
|
When `COMMAND` is a shellscript command, it is a good practice to put the actual code into a <a href="#function">function</a> and simply bind to the function name. This way it becomes significantly easier to test the function while editing, and the result is usually more readable as well.
|
||||||
the actual code into a <a href="#function">function</a> and simply
|
|
||||||
bind to the function name. This way it becomes significantly easier to
|
|
||||||
test the function while editing, and the result is usually more
|
|
||||||
readable as well.
|
|
||||||
|
|
||||||
If you want to autoload bindings each time you start shell, you should
|
If such a script produces output, the script needs to finish by calling `commandline -f repaint` in order to tell fish that a repaint is in order.
|
||||||
define them inside fish_user_key_bindings function.
|
|
||||||
|
|
||||||
- <tt>-a</tt> or <tt>--all</tt> If --key-names is specified, show all key names, not only the ones that actually are defined for the current terminal. If erase mode is specified, this switch will cause all current bindings to be erased.
|
When multiple `COMMAND`s are provided, they are all run in the specified order when the key is pressed.
|
||||||
- <tt>-e</tt> or <tt>--erase</tt> Erase mode. All non-switch arguments are interpreted as character sequences and any commands associated with those sequences are erased.
|
|
||||||
- <tt>-h</tt> or <tt>--help</tt> Display help and exit
|
|
||||||
- <tt>-k</tt> or <tt>--key</tt> Specify a key name, such as 'left' or 'backspace' instead of a character sequence
|
|
||||||
- <tt>-K</tt> or <tt>--key-names</tt> Display a list of available key names
|
|
||||||
- <tt>-f</tt> or <tt>--function-names</tt> Display a list of available input functions
|
|
||||||
|
|
||||||
\subsection bind-example Example
|
If no `SEQUENCE` is provided, all bindings (or just the bindings in the specified `MODE`) are printed. If `SEQUENCE` is provided without `COMMAND`, just the binding matching that sequence is printed.
|
||||||
|
|
||||||
<tt>bind \\cd 'exit'</tt> causes fish to exit on Control-d
|
Key bindings are not saved between sessions by default. To save custom keybindings, edit the `fish_user_key_bindings` function and insert the appropriate `bind` statements.
|
||||||
|
|
||||||
<tt>bind -k ppage history-search-backward</tt> Causes fish to perform a history search when the page up key is pressed
|
Key bindings may use "modes", which mimics Vi's modal input behavior. The default mode is "default", and every bind applies to a single mode. The mode can be viewed/changed with the `$fish_bind_mode` variable.
|
||||||
|
|
||||||
|
The following parameters are available:
|
||||||
|
|
||||||
|
- `-k` or `--key` Specify a key name, such as 'left' or 'backspace' instead of a character sequence
|
||||||
|
|
||||||
|
- `-K` or `--key-names` Display a list of available key names. Specifying `-a` or `--all` includes keys that don't have a known mapping
|
||||||
|
|
||||||
|
- `-f` or `--function-names` Display a list of available input functions
|
||||||
|
|
||||||
|
- `-M MODE` or `--mode MODE` Specify a bind mode that the bind is used in. Defaults to "default"
|
||||||
|
|
||||||
|
- `-m NEW_MODE` or `--sets-mode NEW_MODE` Change the current mode to `NEW_MODE` after this binding is executed
|
||||||
|
|
||||||
|
- `-e` or `--erase` Erase the binding with the given sequence and mode instead of defining a new one. Multiple sequences can be specified with this flag. Specifying `-a` or `--all` with `-M` or `--mode` erases all binds in the given mode regardless of sequence. Specifying `-a` or `--all` without `-M` or `--mode` erases all binds in all modes regardless of sequence.
|
||||||
|
|
||||||
|
- `-a` or `--all` See `--erase` and `--key-names`
|
||||||
|
|
||||||
|
The following special input functions are available:
|
||||||
|
|
||||||
|
- `backward-char`, moves one character to the left
|
||||||
|
|
||||||
|
- `backward-delete-char`, deletes one character of input to the left of the cursor
|
||||||
|
|
||||||
|
- `backward-kill-line`, move everything from the beginning of the line to the cursor to the killring
|
||||||
|
|
||||||
|
- `backward-kill-word`, move the word to the left of the cursor to the killring
|
||||||
|
|
||||||
|
- `backward-word`, move one word to the left
|
||||||
|
|
||||||
|
- `beginning-of-history`, move to the beginning of the history
|
||||||
|
|
||||||
|
- `beginning-of-line`, move to the beginning of the line
|
||||||
|
|
||||||
|
- `capitalize-word`, make the current word begin with a capital letter
|
||||||
|
|
||||||
|
- `complete`, guess the remainder of the current token
|
||||||
|
|
||||||
|
- `delete-char`, delete one character to the right of the cursor
|
||||||
|
|
||||||
|
- `delete-line`, delete the entire line
|
||||||
|
|
||||||
|
- `downcase-word`, make the current word lowercase
|
||||||
|
|
||||||
|
- `dump-functions`, print a list of all key-bindings
|
||||||
|
|
||||||
|
- `end-of-history`, move to the end of the history
|
||||||
|
|
||||||
|
- `end-of-line`, move to the end of the line
|
||||||
|
|
||||||
|
- `explain`, print a description of possible problems with the current command
|
||||||
|
|
||||||
|
- `forward-char`, move one character to the right
|
||||||
|
|
||||||
|
- `forward-word`, move one word to the right
|
||||||
|
|
||||||
|
- `history-search-backward`, search the history for the previous match
|
||||||
|
|
||||||
|
- `history-search-forward`, search the history for the next match
|
||||||
|
|
||||||
|
- `kill-line`, move everything from the cursor to the end of the line to the killring
|
||||||
|
|
||||||
|
- `kill-whole-line`, move the line to the killring
|
||||||
|
|
||||||
|
- `kill-word`, move the next word to the killring
|
||||||
|
|
||||||
|
- `upcase-word`, make the current word uppercase
|
||||||
|
|
||||||
|
- `yank`, insert the latest entry of the killring into the buffer
|
||||||
|
|
||||||
|
- `yank-pop`, rotate to the previous entry of the killring
|
||||||
|
|
||||||
|
|
||||||
|
\subsection bind-example Examples
|
||||||
|
|
||||||
|
\fish
|
||||||
|
bind \cd 'exit'
|
||||||
|
\endfish
|
||||||
|
Causes `fish` to exit when @key{Control,D} is pressed.
|
||||||
|
|
||||||
|
\fish
|
||||||
|
bind -k ppage history-search-backward
|
||||||
|
\endfish
|
||||||
|
Performs a history search when the @key{Page Up} key is pressed.
|
||||||
|
|
||||||
|
\fish
|
||||||
|
set -g fish_key_bindings fish_vi_key_bindings
|
||||||
|
bind -M insert \cc kill-whole-line force-repaint
|
||||||
|
\endfish
|
||||||
|
Turns on Vi key bindings and rebinds @key{Control,C} to clear the input line.
|
||||||
|
|||||||
@@ -1,19 +1,41 @@
|
|||||||
\section block block - temporarily block delivery of events
|
\section block block - temporarily block delivery of events
|
||||||
|
|
||||||
\subsection block-synopsis Synopsis
|
\subsection block-synopsis Synopsis
|
||||||
<tt>block [OPTIONS...]</tt>
|
\fish{synopsis}
|
||||||
|
block [OPTIONS...]
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection block-description Description
|
\subsection block-description Description
|
||||||
|
|
||||||
- <tt>-l</tt> or <tt>--local</tt> Release the block at the end of the currently innermost block scope
|
`block` prevents events triggered by `fish` or the <a href="commands.html#emit">`emit`</a> command from being delivered and acted upon while the block is in place.
|
||||||
- <tt>-g</tt> or <tt>--global</tt> Never automatically release the lock
|
|
||||||
- <tt>-e</tt> or <tt>--erase</tt> Release global block
|
In functions, `block` can be useful while performing work that should not be interrupted by the shell.
|
||||||
|
|
||||||
|
The block can be removed. Any events which triggered while the block was in place will then be delivered.
|
||||||
|
|
||||||
|
Event blocks should not be confused with code blocks, which are created with `begin`, `if`, `while` or `for`
|
||||||
|
|
||||||
|
The following parameters are available:
|
||||||
|
|
||||||
|
- `-l` or `--local` Release the block automatically at the end of the current innermost code block scope
|
||||||
|
|
||||||
|
- `-g` or `--global` Never automatically release the lock
|
||||||
|
|
||||||
|
- `-e` or `--erase` Release global block
|
||||||
|
|
||||||
|
|
||||||
\subsection block-example Example
|
\subsection block-example Example
|
||||||
|
|
||||||
<pre>
|
\fish
|
||||||
block -g
|
# Create a function that listens for events
|
||||||
\#Do something that should not be interrupted
|
function --on-event foo foo; echo 'foo fired'; end
|
||||||
block -e
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
|
# Block the delivery of events
|
||||||
|
block -g
|
||||||
|
|
||||||
|
emit foo
|
||||||
|
# No output will be produced
|
||||||
|
|
||||||
|
block -e
|
||||||
|
# 'foo fired' will now be printed
|
||||||
|
\endfish
|
||||||
|
|||||||
@@ -1,19 +1,25 @@
|
|||||||
\section break break - stop the innermost currently evaluated loop
|
\section break break - stop the current inner loop
|
||||||
|
|
||||||
\subsection break-synopsis Synopsis
|
\subsection break-synopsis Synopsis
|
||||||
<tt>LOOP_CONSTRUCT; [COMMANDS...] break; [COMMANDS...] end</tt>
|
\fish{synopsis}
|
||||||
|
LOOP_CONSTRUCT; [COMMANDS...] break; [COMMANDS...] end
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection break-description Description
|
\subsection break-description Description
|
||||||
The \c break builtin is used to halt a currently running loop, such as a <a href="#for">for</a> loop or a <a href="#while">while</a> loop. It is usually added inside of a conditional block such as an <a href="#if">if</a> statement or a <a href="#switch">switch</a> statement.
|
|
||||||
|
`break` halts a currently running loop, such as a <a href="#for">for</a> loop or a <a href="#while">while</a> loop. It is usually added inside of a conditional block such as an <a href="#if">if</a> statement or a <a href="#switch">switch</a> statement.
|
||||||
|
|
||||||
|
There are no parameters for `break`.
|
||||||
|
|
||||||
|
|
||||||
\subsection break-example Example
|
\subsection break-example Example
|
||||||
The following code searches all .c files for smurfs, and halts at the first occurrence.
|
The following code searches all .c files for "smurf", and halts at the first occurrence.
|
||||||
|
|
||||||
<pre>
|
\fish
|
||||||
for i in *.c
|
for i in *.c
|
||||||
if grep smurf $i
|
if grep smurf $i
|
||||||
echo Smurfs are present in $i
|
echo Smurfs are present in $i
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
</pre>
|
\endfish
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
\section breakpoint breakpoint - Launch debug mode
|
\section breakpoint breakpoint - Launch debug mode
|
||||||
|
|
||||||
\subsection breakpoint-synopsis Synopsis
|
\subsection breakpoint-synopsis Synopsis
|
||||||
<tt>breakpoint</tt>
|
\fish{synopsis}
|
||||||
|
breakpoint
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection breakpoint-description Description
|
\subsection breakpoint-description Description
|
||||||
|
|
||||||
The \c breakpoint builtin is used to halt a running script and launch
|
`breakpoint` is used to halt a running script and launch an interactive debugging prompt.
|
||||||
an interactive debug prompt.
|
|
||||||
|
|
||||||
|
For more details, see <a href="index.html#debugging">Debugging fish scripts</a> in the `fish` manual.
|
||||||
|
|
||||||
|
There are no parameters for `breakpoint`.
|
||||||
|
|||||||
@@ -1,16 +1,22 @@
|
|||||||
\section builtin builtin - run a builtin command
|
\section builtin builtin - run a builtin command
|
||||||
|
|
||||||
\subsection builtin-synopsis Synopsis
|
\subsection builtin-synopsis Synopsis
|
||||||
<tt>builtin BUILTINNAME [OPTIONS...]</tt>
|
\fish{synopsis}
|
||||||
|
builtin BUILTINNAME [OPTIONS...]
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection builtin-description Description
|
\subsection builtin-description Description
|
||||||
|
|
||||||
- <tt>-n</tt> or <tt>--names</tt> List the names of all defined builtins
|
`builtin` forces the shell to use a builtin command, rather than a function or program.
|
||||||
|
|
||||||
|
The following parameters are available:
|
||||||
|
|
||||||
|
- `-n` or `--names` List the names of all defined builtins
|
||||||
|
|
||||||
Prefixing a command with the word 'builtin' forces fish to ignore any functions with the same name.
|
|
||||||
|
|
||||||
\subsection builtin-example Example
|
\subsection builtin-example Example
|
||||||
|
|
||||||
<tt>builtin jobs</tt>
|
\fish
|
||||||
|
builtin jobs
|
||||||
causes fish to execute the jobs builtin, even if a function named jobs exists.
|
# executes the jobs builtin, even if a function named jobs exists
|
||||||
|
\endfish
|
||||||
|
|||||||
@@ -1,38 +1,27 @@
|
|||||||
\section case case - conditionally execute a block of commands
|
\section case case - conditionally execute a block of commands
|
||||||
|
|
||||||
\subsection case-synopsis Synopsis
|
\subsection case-synopsis Synopsis
|
||||||
<tt>switch VALUE; [case [WILDCARD...]; [COMMANDS...]; ...] end</tt>
|
\fish{synopsis}
|
||||||
|
switch VALUE; [case [WILDCARD...]; [COMMANDS...]; ...] end
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection case-description Description
|
\subsection case-description Description
|
||||||
|
|
||||||
The \c switch statement is used to perform one of several blocks of
|
`switch` performs one of several blocks of commands, depending on whether a specified value equals one of several wildcarded values. `case` is used together with the `switch` statement in order to determine which block should be executed.
|
||||||
commands depending on whether a specified value equals one of several
|
|
||||||
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
|
Each `case` command is given one or more parameters. The first `case` command with a parameter that matches the string specified in the switch command will be evaluated. `case` parameters may contain wildcards. These need to be escaped or quoted in order to avoid regular wildcard expansion using filenames.
|
||||||
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
|
Note that fish does not fall through on case statements. Only the first matching case is executed.
|
||||||
syntax may look a bit like C switch statements, it behaves more like
|
|
||||||
the case statements of traditional shells.
|
Note that command substitutions in a case statement will be evaluated even if its body is not taken. All substitutions, including command substitutions, must be performed before the value can be compared against the parameter.
|
||||||
|
|
||||||
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
|
\subsection case-example Example
|
||||||
|
|
||||||
If the variable \$animal contains the name of an animal, the following
|
If the variable \$animal contains the name of an animal, the following
|
||||||
code would attempt to classify it:
|
code would attempt to classify it:
|
||||||
|
|
||||||
<pre>
|
\fish
|
||||||
switch $animal
|
switch $animal
|
||||||
case cat
|
case cat
|
||||||
echo evil
|
echo evil
|
||||||
@@ -42,11 +31,12 @@ switch $animal
|
|||||||
echo bird
|
echo bird
|
||||||
case shark trout stingray
|
case shark trout stingray
|
||||||
echo fish
|
echo fish
|
||||||
|
# Note that the next case has a wildcard which is quoted
|
||||||
case '*'
|
case '*'
|
||||||
echo I have no idea what a $animal is
|
echo I have no idea what a $animal is
|
||||||
end
|
end
|
||||||
</pre>
|
\endfish
|
||||||
|
|
||||||
If the above code was run with \c \$animal set to \c whale, the output
|
If the above code was run with `$animal` set to `whale`, the output
|
||||||
would be \c mammal.
|
would be `mammal`.
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,26 @@
|
|||||||
\section cd cd - change directory
|
\section cd cd - change directory
|
||||||
|
|
||||||
\subsection cd-synopsis Synopsis
|
\subsection cd-synopsis Synopsis
|
||||||
<tt>cd [DIRECTORY]</tt>
|
\fish{synopsis}
|
||||||
|
cd [DIRECTORY]
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection cd-description Description Changes the current
|
\subsection cd-description Description
|
||||||
directory. If <tt>DIRECTORY</tt> is supplied it will become the new
|
`cd` changes the current working directory.
|
||||||
directory. If \c DIRECTORY is a relative path, the paths found in the
|
|
||||||
CDPATH environment variable array will be tried as prefixes for the
|
If `DIRECTORY` is supplied, it will become the new directory. If no parameter is given, the contents of the `HOME` environment variable will be used.
|
||||||
specified path. If CDPATH is not set, it is assumed to be '.'. If \c
|
|
||||||
DIRECTORY is not specified, \$HOME will be the new directory.
|
If `DIRECTORY` is a relative path, the paths found in the `CDPATH` environment variable array will be tried as prefixes for the specified path.
|
||||||
|
|
||||||
|
Note that the shell will attempt to change directory without requiring `cd` if the name of a directory is provided (starting with `.`, `/` or `~`, or ending with `/`).
|
||||||
|
|
||||||
|
|
||||||
|
\subsection cd-example Examples
|
||||||
|
|
||||||
|
\fish
|
||||||
|
cd
|
||||||
|
# changes the working directory to your home directory.
|
||||||
|
|
||||||
|
cd /usr/src/fish-shell
|
||||||
|
# changes the working directory to /usr/src/fish-shell
|
||||||
|
\endfish
|
||||||
|
|||||||
@@ -1,14 +1,24 @@
|
|||||||
\section command command - run a program
|
\section command command - run a program
|
||||||
|
|
||||||
\subsection command-synopsis Synopsis
|
\subsection command-synopsis Synopsis
|
||||||
<tt>command COMMANDNAME [OPTIONS...]</tt>
|
\fish{synopsis}
|
||||||
|
command [OPTIONS] COMMANDNAME [ARGS...]
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection command-description Description
|
\subsection command-description Description
|
||||||
prefixing a command with the word 'command' forces fish to ignore any functions or builtins with the same name.
|
|
||||||
|
|
||||||
\subsection command-example Example
|
`command` forces the shell to execute the program `COMMANDNAME` and ignore any functions or builtins with the same name.
|
||||||
|
|
||||||
|
The following options are available:
|
||||||
|
|
||||||
<tt>command ls</tt>
|
- `-s` or `--search` returns the name of the disk file that would be executed, or nothing if no file with the specified name could be found in the `$PATH`.
|
||||||
|
|
||||||
causes fish to execute the ls program, even if there exists a 'ls' function.
|
With the `-s` option, `command` treats every argument as a separate command to look up and sets the exit status to 0 if any of the specified commands were found, or 1 if no commands could be found.
|
||||||
|
|
||||||
|
For basic compatibility with POSIX `command`, the `-v` flag is recognized as an alias for `-s`.
|
||||||
|
|
||||||
|
\subsection command-example Examples
|
||||||
|
|
||||||
|
`command ls` causes fish to execute the `ls` program, even if an `ls` function exists.
|
||||||
|
|
||||||
|
`command -s ls` returns the path to the `ls` program.
|
||||||
|
|||||||
@@ -1,63 +1,59 @@
|
|||||||
\section commandline commandline - set or get the current commandline buffer
|
\section commandline commandline - set or get the current command line buffer
|
||||||
|
|
||||||
\subsection commandline-synopsis Synopsis
|
\subsection commandline-synopsis Synopsis
|
||||||
<tt>commandline [OPTIONS] [CMD]</tt>
|
\fish{synopsis}
|
||||||
|
commandline [OPTIONS] [CMD]
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection commandline-description Description
|
\subsection commandline-description Description
|
||||||
|
|
||||||
|
`commandline` can be used to set or get the current contents of the command line buffer.
|
||||||
|
|
||||||
- \c CMD is the new value of the commandline. If unspecified, the
|
With no parameters, `commandline` returns the current value of the command line.
|
||||||
current value of the commandline is written to standard output. All
|
|
||||||
output from the commandline builtin is escaped, i.e. quotes are
|
|
||||||
removed, backslash escapes are expanded, etc..
|
|
||||||
|
|
||||||
The following switches change what the commandline builtin does
|
With `CMD` specified, the command line buffer is erased and replaced with the contents of `CMD`.
|
||||||
|
|
||||||
- \c -C or \c --cursor set or get the current cursor position, not
|
The following options are available:
|
||||||
the contents of the buffer. If no argument is given, the current
|
|
||||||
cursor position is printed, otherwise the argument is interpreted
|
|
||||||
as the new cursor position.
|
|
||||||
- \c -f or \c --function inject readline functions into the
|
|
||||||
reader. This option can not be combined with any other option. It
|
|
||||||
will cause any additional arguments to be interpreted as readline
|
|
||||||
functions, and these functions will be injected into the reader, so
|
|
||||||
that they will be returned to the reader before any additional
|
|
||||||
actual key presses are read.
|
|
||||||
|
|
||||||
|
- `-C` or `--cursor` set or get the current cursor position, not the contents of the buffer. If no argument is given, the current cursor position is printed, otherwise the argument is interpreted as the new cursor position.
|
||||||
|
|
||||||
The following switches change the way \c commandline updates the
|
- `-f` or `--function` inject readline functions into the reader. This option cannot be combined with any other option. It will cause any additional arguments to be interpreted as readline functions, and these functions will be injected into the reader, so that they will be returned to the reader before any additional actual key presses are read.
|
||||||
commandline buffer
|
|
||||||
|
|
||||||
- \c -a or \c --append do not remove the current commandline, append
|
The following options change the way `commandline` updates the command line buffer:
|
||||||
the specified string at the end of it
|
|
||||||
- \c -i or \c --insert do not remove the current commandline, insert
|
|
||||||
the specified string at the current cursor position
|
|
||||||
- \c -r or \c --replace remove the current commandline and replace it
|
|
||||||
with the specified string (default)
|
|
||||||
|
|
||||||
The following switches change what part of the commandline is printed
|
- `-a` or `--append` do not remove the current commandline, append the specified string at the end of it
|
||||||
or updated
|
|
||||||
|
|
||||||
- \c -b or \c --current-buffer select the entire buffer (default)
|
- `-i` or `--insert` do not remove the current commandline, insert the specified string at the current cursor position
|
||||||
- \c -j or \c --current-job select the current job
|
|
||||||
- \c -p or \c --current-process select the current process
|
|
||||||
- \c -t or \c --current-token select the current token.
|
|
||||||
|
|
||||||
The following switch changes the way \c commandline prints the current
|
- `-r` or `--replace` remove the current commandline and replace it with the specified string (default)
|
||||||
commandline buffer
|
|
||||||
|
|
||||||
- \c -c or \c --cut-at-cursor only print selection up until the
|
The following options change what part of the commandline is printed or updated:
|
||||||
current cursor position
|
|
||||||
- \c -o or \c --tokenize tokenize the selection and print one string-type token per line
|
|
||||||
|
|
||||||
|
- `-b` or `--current-buffer` select the entire buffer (default)
|
||||||
|
|
||||||
|
- `-j` or `--current-job` select the current job
|
||||||
|
|
||||||
|
- `-p` or `--current-process` select the current process
|
||||||
|
|
||||||
|
- `-t` or `--current-token` select the current token.
|
||||||
|
|
||||||
|
The following options change the way `commandline` prints the current commandline buffer:
|
||||||
|
|
||||||
|
- `-c` or `--cut-at-cursor` only print selection up until the current cursor position
|
||||||
|
|
||||||
|
- `-o` or `--tokenize` tokenize the selection and print one string-type token per line
|
||||||
|
|
||||||
|
If `commandline` is called during a call to complete a given string using `complete -C STRING`, `commandline` will consider the specified string to be the current contents of the command line.
|
||||||
|
|
||||||
|
The following options output metadata about the commandline state:
|
||||||
|
|
||||||
|
- `-L` or `--line` print the line that the cursor is on, with the topmost line starting at 1
|
||||||
|
|
||||||
|
- `-S` or `--search-mode` evaluates to true if the commandline is performing a history search
|
||||||
|
|
||||||
|
- `-P` or `--paging-mode` evaluates to true if the commandline is showing pager contents, such as tab completions
|
||||||
|
|
||||||
If commandline is called during a call to complete a given string
|
|
||||||
using <code>complete -C STRING</code>, commandline will consider the
|
|
||||||
specified string to be the current contents of the commandline.
|
|
||||||
|
|
||||||
\subsection commandline-example Example
|
\subsection commandline-example Example
|
||||||
|
|
||||||
<tt>commandline -j $history[3]</tt>
|
`commandline -j $history[3]` replaces the job under the cursor with the third item from the command line history.
|
||||||
|
|
||||||
replaces the job under the cursor with the third item from the
|
|
||||||
commandline history.
|
|
||||||
|
|||||||
@@ -1,6 +1,38 @@
|
|||||||
/** \page commands Commands, functions and builtins bundled with fish
|
/**
|
||||||
Fish ships with a large number of builtin commands, shellscript functions and external commands. These are all described below.
|
\page commands Commands
|
||||||
|
\htmlonly[block]
|
||||||
|
<div class="fish_left_bar">
|
||||||
|
<div class="logo"></div>
|
||||||
|
<div class="menu commands_menu">
|
||||||
|
\endhtmlonly
|
||||||
|
@command_list_toc@
|
||||||
|
|
||||||
|
\htmlonly[block]
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="commands fish_right_bar">
|
||||||
|
<h1 class="interior_title">Command reference</h1>
|
||||||
|
\endhtmlonly
|
||||||
|
`fish` ships with a large number of builtin commands, shellscript functions and external commands. These are all described below.
|
||||||
|
|
||||||
|
Almost all fish commands respond to the `-h` or `--help` options to display their relevant help, also accessible using the `help` and `man` commands, like so:
|
||||||
|
|
||||||
|
\fish
|
||||||
|
echo -h
|
||||||
|
echo --help
|
||||||
|
# Prints help to the terminal window
|
||||||
|
|
||||||
|
man echo
|
||||||
|
# Displays the man page in the system pager
|
||||||
|
# (normally 'less', 'more' or 'most').
|
||||||
|
|
||||||
|
help echo
|
||||||
|
# Open a web browser to show the relevant documentation
|
||||||
|
\endfish
|
||||||
|
|
||||||
@command_list@
|
@command_list@
|
||||||
|
|
||||||
|
\htmlonly[block]
|
||||||
|
</div>
|
||||||
|
\endhtmlonly
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,77 +1,103 @@
|
|||||||
\section complete complete - edit command specific tab-completions.
|
\section complete complete - edit command specific tab-completions
|
||||||
|
|
||||||
\subsection complete-synopsis Synopsis
|
\subsection complete-synopsis Synopsis
|
||||||
<tt>complete (-c|--command|-p|--path) COMMAND [(-s|--short-option) SHORT_OPTION] [(-l|--long-option|-o|--old-option) LONG_OPTION [(-a||--arguments) OPTION_ARGUMENTS] [(-d|--description) DESCRIPTION] </tt>
|
\fish{synopsis}
|
||||||
|
complete ( -c | --command | -p | --path ) COMMAND
|
||||||
|
[( -s | --short-option ) SHORT_OPTION]
|
||||||
|
[( -l | --long-option | -o | --old-option ) LONG_OPTION]
|
||||||
|
[( -a | --arguments ) OPTION_ARGUMENTS]
|
||||||
|
[( -w | --wraps ) WRAPPED_COMMAND]
|
||||||
|
[( -d | --description ) DESCRIPTION]
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection complete-description Description
|
\subsection complete-description Description
|
||||||
|
|
||||||
For an introduction to how to specify completions, see the section <a
|
For an introduction to specifying completions, see <a
|
||||||
href='index.html#completion-own'>Writing your own completions</a> of
|
href='index.html#completion-own'>Writing your own completions</a> in
|
||||||
the fish manual.
|
the fish manual.
|
||||||
|
|
||||||
- <tt>COMMAND</tt> is the name of the command for which to add a completion
|
- `COMMAND` is the name of the command for which to add a completion.
|
||||||
- <tt>SHORT_OPTION</tt> is a one character option for the command
|
|
||||||
- <tt>LONG_OPTION</tt> is a multi character option for the command
|
|
||||||
- <tt>OPTION_ARGUMENTS</tt> is parameter containing a space-separated list of possible option-arguments, which may contain subshells
|
|
||||||
- <tt>DESCRIPTION</tt> is a description of what the option and/or option arguments do
|
|
||||||
- <tt>-C STRING</tt> or <tt>--do-complete=STRING</tt> makes complete try to find all possible completions for the specified string
|
|
||||||
- <tt>-e</tt> or <tt>--erase</tt> implies that the specified completion should be deleted
|
|
||||||
- <tt>-f</tt> or <tt>--no-files</tt> specifies that the option specified by this completion may not be followed by a filename
|
|
||||||
- <tt>-n</tt> or <tt>--condition</tt> specifies a shell command that must return 0 if the completion is to be used. This makes it possible to specify completions that should only be used in some cases.
|
|
||||||
- <tt>-o</tt> or <tt>--old-option</tt> implies that the command uses old long style options with only one dash
|
|
||||||
- <tt>-p</tt> or <tt>--path</tt> implies that the string COMMAND is the full path of the command
|
|
||||||
- <tt>-r</tt> or <tt>--require-parameter</tt> specifies that the option specified by this completion always must have an option argument, i.e. may not be followed by another option
|
|
||||||
- <tt>-u</tt> or <tt>--unauthoritative</tt> implies that there may be more options than the ones specified, and that fish should not assume that options not listed are spelling errors
|
|
||||||
- <tt>-A</tt> or <tt>--authoritative</tt> implies that there may be no more options than the ones specified, and that fish should assume that options not listed are spelling errors
|
|
||||||
- <tt>-x</tt> or <tt>--exclusive</tt> implies both <tt>-r</tt> and <tt>-f</tt>
|
|
||||||
|
|
||||||
Command specific tab-completions in \c fish are based on the notion
|
- `SHORT_OPTION` is a one character option for the command.
|
||||||
of options and arguments. An option is a parameter which begins with a
|
|
||||||
hyphen, such as '-h', '-help' or '--help'. Arguments are parameters
|
|
||||||
that do not begin with a hyphen. Fish recognizes three styles of
|
|
||||||
options, the same styles as the GNU version of the getopt
|
|
||||||
library. These styles are:
|
|
||||||
|
|
||||||
- Short options, like '-a'. Short options are a single character long, are preceded by a single hyphen and may be grouped together (like '-la', which is equivalent to '-l -a'). Option arguments may be specified in the following parameter ('-w 32') or by appending the option with the value ('-w32').
|
- `LONG_OPTION` is a multi character option for the command.
|
||||||
- Old style long options, like '-Wall'. Old style long options can be more than one character long, are preceded by a single hyphen and may not be grouped together. Option arguments are specified in the following parameter ('-ao null').
|
|
||||||
- GNU style long options, like '--colors'. GNU style long options can be more than one character long, are preceded by two hyphens, and may not be grouped together. Option arguments may be specified in the following parameter ('--quoting-style shell') or by appending the option with a '=' and the value ('--quoting-style=shell'). GNU style long options may be abbreviated so long as the abbreviation is unique ('--h' is equivalent to '--help' if help is the only long option beginning with an 'h').
|
|
||||||
|
|
||||||
The options for specifying command name, command path, or command
|
- `OPTION_ARGUMENTS` is parameter containing a space-separated list of possible option-arguments, which may contain subshells.
|
||||||
switches may all be used multiple times to specify multiple commands
|
|
||||||
which have the same completion or multiple switches accepted by a
|
- `DESCRIPTION` is a description of what the option and/or option arguments do.
|
||||||
command.
|
|
||||||
|
- `-C STRING` or `--do-complete=STRING` makes complete try to find all possible completions for the specified string.
|
||||||
|
|
||||||
|
- `-w WRAPPED_COMMAND` or `--wraps=WRAPPED_COMMAND` causes the specified command to inherit completions from the wrapped command.
|
||||||
|
|
||||||
|
- `-e` or `--erase` implies that the specified completion should be deleted.
|
||||||
|
|
||||||
|
- `-f` or `--no-files` specifies that the option specified by this completion may not be followed by a filename.
|
||||||
|
|
||||||
|
- `-n` or `--condition` specifies a shell command that must return 0 if the completion is to be used. This makes it possible to specify completions that should only be used in some cases.
|
||||||
|
|
||||||
|
- `-o` or `--old-option` implies that the command uses old long style options with only one dash.
|
||||||
|
|
||||||
|
- `-p` or `--path` implies that the string `COMMAND` is the full path of the command.
|
||||||
|
|
||||||
|
- `-r` or `--require-parameter` specifies that the option specified by this completion always must have an option argument, i.e. may not be followed by another option.
|
||||||
|
|
||||||
|
- `-u` or `--unauthoritative` implies that there may be more options than the ones specified, and that fish should not assume that options not listed are spelling errors.
|
||||||
|
|
||||||
|
- `-A` or `--authoritative` implies that there may be no more options than the ones specified, and that fish should assume that options not listed are spelling errors.
|
||||||
|
|
||||||
|
- `-x` or `--exclusive` implies both `-r` and `-f`.
|
||||||
|
|
||||||
|
Command specific tab-completions in `fish` are based on the notion of options and arguments. An option is a parameter which begins with a hyphen, such as '`-h`', '`-help`' or '`--help`'. Arguments are parameters that do not begin with a hyphen. Fish recognizes three styles of options, the same styles as the GNU version of the getopt library. These styles are:
|
||||||
|
|
||||||
|
- Short options, like '`-a`'. Short options are a single character long, are preceded by a single hyphen and may be grouped together (like '`-la`', which is equivalent to '`-l -a`'). Option arguments may be specified in the following parameter ('`-w 32`') or by appending the option with the value ('`-w32`').
|
||||||
|
|
||||||
|
- Old style long options, like '`-Wall`'. Old style long options can be more than one character long, are preceded by a single hyphen and may not be grouped together. Option arguments are specified in the following parameter ('`-ao null`').
|
||||||
|
|
||||||
|
- GNU style long options, like '`--colors`'. GNU style long options can be more than one character long, are preceded by two hyphens, and may not be grouped together. Option arguments may be specified in the following parameter ('`--quoting-style`') or by appending the option with a '`=`' and the value ('`--quoting-style=shell`'). GNU style long options may be abbreviated so long as the abbreviation is unique ('`--h`') is equivalent to '`--help`' if help is the only long option beginning with an 'h').
|
||||||
|
|
||||||
|
The options for specifying command name, command path, or command switches may all be used multiple times to specify multiple commands which have the same completion or multiple switches accepted by a command.
|
||||||
|
|
||||||
|
The `-w` or `--wraps` options causes the specified command to inherit completions from another command. The inheriting command is said to "wrap" the inherited command. The wrapping command may have its own completions in addition to inherited ones. A command may wrap multiple commands, and wrapping is transitive: if A wraps B, and B wraps C, then A automatically inherits all of C's completions. Wrapping can be removed using the `-e` or `--erase` options.
|
||||||
|
|
||||||
|
When erasing completions, it is possible to either erase all completions for a specific command by specifying `complete -e -c COMMAND`, or by specifying a specific completion option to delete by specifying either a long, short or old style option.
|
||||||
|
|
||||||
When erasing completions, it is possible to either erase all
|
|
||||||
completions for a specific command by specifying <tt>complete -e -c
|
|
||||||
COMMAND</tt>, or by specifying a specific completion option to delete
|
|
||||||
by specifying either a long, short or old style option.
|
|
||||||
|
|
||||||
\subsection complete-example Example
|
\subsection complete-example Example
|
||||||
|
|
||||||
The short style option <tt>-o</tt> for the \c gcc command requires
|
The short style option `-o` for the `gcc` command requires that a file follows it. This can be done using writing:
|
||||||
that a file follows it. This can be done using writing <tt>complete
|
|
||||||
-c gcc -s o -r</tt>.
|
|
||||||
|
|
||||||
The short style option <tt>-d</tt> for the \c grep command requires
|
\fish
|
||||||
that one of the strings 'read', 'skip' or 'recurse' is used. This can
|
complete -c gcc -s o -r
|
||||||
be specified writing <tt>complete -c grep -s d -x -a "read skip
|
\endfish
|
||||||
recurse"</tt>.
|
|
||||||
|
|
||||||
The \c su command takes any username as an argument. Usernames are
|
The short style option `-d` for the `grep` command requires that one of the strings '`read`', '`skip`' or '`recurse`' is used. This can be specified writing:
|
||||||
given as the first colon-separated field in the file /etc/passwd. This
|
|
||||||
can be specified as: <tt>complete -x -c su -d "Username" -a "(cat
|
|
||||||
/etc/passwd|cut -d : -f 1)" </tt>.
|
|
||||||
|
|
||||||
The \c rpm command has several different modes. If the \c -e or \c
|
\fish
|
||||||
--erase flag has been specified, \c rpm should delete one or more
|
complete -c grep -s d -x -a "read skip recurse"
|
||||||
packages, in which case several switches related to deleting packages
|
\endfish
|
||||||
are valid, like the \c nodeps switch.
|
|
||||||
|
The `su` command takes any username as an argument. Usernames are given as the first colon-separated field in the file /etc/passwd. This can be specified as:
|
||||||
|
|
||||||
|
\fish
|
||||||
|
complete -x -c su -d "Username" -a "(cat /etc/passwd | cut -d : -f 1)"
|
||||||
|
\endfish
|
||||||
|
|
||||||
|
The `rpm` command has several different modes. If the `-e` or `--erase` flag has been specified, `rpm` should delete one or more packages, in which case several switches related to deleting packages are valid, like the `nodeps` switch.
|
||||||
|
|
||||||
This can be written as:
|
This can be written as:
|
||||||
|
|
||||||
<tt>complete -c rpm -n "__fish_contains_opt -s e erase" -l nodeps -d
|
\fish
|
||||||
"Don't check dependencies"</tt>
|
complete -c rpm -n "__fish_contains_opt -s e erase" -l nodeps -d "Don't check dependencies"
|
||||||
|
\endfish
|
||||||
|
|
||||||
where \c __fish_contains_opt is a function that checks the commandline
|
where `__fish_contains_opt` is a function that checks the commandline buffer for the presence of a specified set of options.
|
||||||
buffer for the presence of a specified set of options.
|
|
||||||
|
To implement an alias, use the `-w` or `--wraps` option:
|
||||||
|
|
||||||
|
\fish
|
||||||
|
complete -c hub -w git
|
||||||
|
\endfish
|
||||||
|
|
||||||
|
Now hub inherits all of the completions from git. Note this can also be specified in a function declaration.
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +1,38 @@
|
|||||||
\section contains contains - test if a word is present in a list
|
\section contains contains - test if a word is present in a list
|
||||||
|
|
||||||
\subsection contains-synopsis Synopsis
|
\subsection contains-synopsis Synopsis
|
||||||
<code>contains [OPTIONS] KEY [VALUES...]</code>
|
\fish{synopsis}
|
||||||
|
contains [OPTIONS] KEY [VALUES...]
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection contains-description Description
|
\subsection contains-description Description
|
||||||
|
|
||||||
- \c -i or \c --index print the the word index
|
`contains` tests whether the set `VALUES` contains the string `KEY`. If so, `contains` exits with status 0; if not, it exits with status 1.
|
||||||
- \c -h or \c --help display this message
|
|
||||||
|
|
||||||
Test if the set VALUES contains the string KEY. Return status is 0 if
|
The following options are available:
|
||||||
yes, 1 otherwise
|
|
||||||
|
|
||||||
|
- `-i` or `--index` print the word index
|
||||||
|
|
||||||
|
Note that, like GNU tools, `contains` interprets all arguments starting with a `-` as options to contains, until it reaches an argument that is `--` (two dashes). See the examples below.
|
||||||
|
|
||||||
\subsection contains-example Example
|
\subsection contains-example Example
|
||||||
<pre>
|
|
||||||
for i in ~/bin /usr/local/bin
|
|
||||||
if not contains \$i \$PATH
|
|
||||||
set PATH \$PATH i
|
|
||||||
end
|
|
||||||
end
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
The above code tests if ~/bin and /usr/local/bin are in the path and if they are not, they are added.
|
\fish
|
||||||
|
for i in ~/bin /usr/local/bin
|
||||||
|
if not contains $i $PATH
|
||||||
|
set PATH $PATH $i
|
||||||
|
end
|
||||||
|
end
|
||||||
|
\endfish
|
||||||
|
|
||||||
|
The above code tests if `~/bin` and `/usr/local/bin` are in the path and adds them if not.
|
||||||
|
|
||||||
|
\fish
|
||||||
|
function hasargs
|
||||||
|
if contains -- -q $argv
|
||||||
|
echo '$argv contains a -q option'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
\endfish
|
||||||
|
|
||||||
|
The above code checks for `-q` in the argument list, using the `--` argument to demarcate options to `contains` from the key to search for.
|
||||||
|
|||||||
@@ -1,19 +1,23 @@
|
|||||||
\section continue continue - skip the rest of the current lap of the innermost currently evaluated loop
|
\section continue continue - skip the remainder of the current iteration of the current inner loop
|
||||||
|
|
||||||
\subsection continue-synopsis Synopsis
|
\subsection continue-synopsis Synopsis
|
||||||
<tt>LOOP_CONSTRUCT; [COMMANDS...;] continue; [COMMANDS...;] end</tt>
|
\fish{synopsis}
|
||||||
|
LOOP_CONSTRUCT; [COMMANDS...;] continue; [COMMANDS...;] end
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection continue-description Description
|
\subsection continue-description Description
|
||||||
The \c continue builtin is used to skip the current lap of the innermost currently running loop, such as a <a href="#for">for</a> loop or a <a href="#while">while</a> loop. It is usually added inside of a conditional block such as an <a href="#if">if</a> statement or a <a href="#switch">switch</a> statement.
|
|
||||||
|
`continue` skips the remainder of the current iteration of the current inner loop, such as a <a href="#for">for</a> loop or a <a href="#while">while</a> loop. It is usually added inside of a conditional block such as an <a href="#if">if</a> statement or a <a href="#switch">switch</a> statement.
|
||||||
|
|
||||||
\subsection continue-example Example
|
\subsection continue-example Example
|
||||||
The following code removes all tmp files without smurfs.
|
|
||||||
|
|
||||||
<pre>
|
The following code removes all tmp files that do not contain the word smurf.
|
||||||
|
|
||||||
|
\fish
|
||||||
for i in *.tmp
|
for i in *.tmp
|
||||||
if grep smurf $i
|
if grep smurf $i
|
||||||
continue
|
continue
|
||||||
end
|
end
|
||||||
rm $i
|
rm $i
|
||||||
end
|
end
|
||||||
</pre>
|
\endfish
|
||||||
|
|||||||
@@ -1,36 +1,25 @@
|
|||||||
\section count count - count the number of elements of an array
|
\section count count - count the number of elements of an array
|
||||||
|
|
||||||
\subsection count-synopsis Synopsis
|
\subsection count-synopsis Synopsis
|
||||||
<tt>count $VARIABLE</tt>
|
\fish{synopsis}
|
||||||
|
count $VARIABLE
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection count-description Description
|
\subsection count-description Description
|
||||||
|
|
||||||
The <tt>count</tt> builtin prints the number of arguments that were
|
`count` prints the number of arguments that were passed to it. This is usually used to find out how many elements an environment variable array contains.
|
||||||
passed to it. This is usually used to find out how many elements an
|
|
||||||
environment variable array contains, but this is not the only
|
|
||||||
potential usage for the count command.
|
|
||||||
|
|
||||||
The count command does not accept any options, not even '-h'. This way
|
`count` does not accept any options, including `-h` or `--help`.
|
||||||
the user does not have to worry about an array containing elements
|
|
||||||
such as dashes. \c fish performs a special check when invoking the
|
`count` exits with a non-zero exit status if no arguments were passed to it, and with zero if at least one argument was passed.
|
||||||
count command, and if the user uses a help option, this help page is
|
|
||||||
displayed, but if a help option is contained inside of a variable or
|
|
||||||
is the result of expansion, it will simply be counted like any other
|
|
||||||
argument.
|
|
||||||
|
|
||||||
Count exits with a non-zero exit status if no arguments where passed
|
|
||||||
to it, with zero otherwise.
|
|
||||||
|
|
||||||
\subsection count-example Example
|
\subsection count-example Example
|
||||||
|
|
||||||
<pre>
|
\fish
|
||||||
count $PATH
|
count $PATH
|
||||||
</pre>
|
# Returns the number of directories in the users PATH variable.
|
||||||
|
|
||||||
returns the number of directories in the users PATH variable.
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
count *.txt
|
count *.txt
|
||||||
</pre>
|
# Returns the number of files in the current working directory ending with the suffix '.txt'.
|
||||||
|
\endfish
|
||||||
returns the number of files in the current working directory ending with the suffix '.txt'.
|
|
||||||
@@ -1,155 +1,110 @@
|
|||||||
/** \page design Design document
|
/**
|
||||||
|
\page design Design document
|
||||||
|
\htmlonly[block]
|
||||||
|
<div class="fish_only_bar">
|
||||||
|
<div class="design">
|
||||||
|
<h1 class="interior_title">Design documentation</h1>
|
||||||
|
\endhtmlonly
|
||||||
|
|
||||||
\section design-overview Overview
|
\section design-overview Overview
|
||||||
|
|
||||||
This is a description of the design principles that have been used to
|
This is a description of the design principles that have been used to design fish. The fish design has three high level goals. These are:
|
||||||
design fish. The fish design has three high level goals. These are:
|
|
||||||
|
|
||||||
-# Everything that can be done in other shell languages should be
|
-# Everything that can be done in other shell languages should be possible to do in fish, though fish may rely on external commands in doing so.
|
||||||
possible to do in fish, though fish may rely on external commands in
|
|
||||||
doing so.
|
-# Fish should be user friendly, but not at the expense of expressiveness. Most tradeoffs between power and ease of use can be avoided with careful design.
|
||||||
-# Fish should be user friendly, but not at the expense of expressiveness.
|
|
||||||
Most tradeoffs between power and ease of use can be avoided with careful design.
|
-# Whenever possible without breaking the above goals, fish should follow the Posix syntax.
|
||||||
-# Whenever possible without breaking the above goals, fish should
|
|
||||||
follow the Posix syntax.
|
To achieve these high-level goals, the fish design relies on a number of more specific design principles. These are presented below, together with a rationale and a few examples for each.
|
||||||
|
|
||||||
To achive these high-level goals, the fish design relies on a number
|
|
||||||
of more specific design principles. These are presented below,
|
|
||||||
together with a rationale and a few examples for each.
|
|
||||||
|
|
||||||
\section ortho The law of orthogonality
|
\section ortho The law of orthogonality
|
||||||
|
|
||||||
The shell language should have a small set of orthogonal features. Any
|
The shell language should have a small set of orthogonal features. Any situation where two features are related but not identical, one of them should be removed, and the other should be made powerful and general enough to handle all common use cases of either feature.
|
||||||
situation where two features are related but not identical, one of them
|
|
||||||
should be removed, and the other should be made powerful and general
|
|
||||||
enough to handle all common use cases of either feature.
|
|
||||||
|
|
||||||
Rationale:
|
Rationale:
|
||||||
|
|
||||||
Related features make the language larger, which makes it harder to
|
Related features make the language larger, which makes it harder to learn. It also increases the size of the source code, making the program harder to maintain and update.
|
||||||
learn. It also increases the size of the sourcecode, making the
|
|
||||||
program harder to maintain and update.
|
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
- Here documents are too similar to using echo inside of a pipeline.
|
- 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 functions have none of the drawbacks of either syntax.
|
- Subshells, command substitution and process substitution are strongly related. `fish` only supports command substitution, the others can be achieved either using a block or the psub shellscript function.
|
||||||
- The many Posix quoting styles are silly, especially \$''.
|
|
||||||
|
- Having both aliases and functions is confusing, especially since both of them have limitations and problems. `fish` functions have none of the drawbacks of either syntax.
|
||||||
|
|
||||||
|
- The many Posix quoting styles are silly, especially $''.
|
||||||
|
|
||||||
|
|
||||||
\section sep The law of minimalism
|
\section design-response The law of responsiveness
|
||||||
|
|
||||||
The shell should only contain features that cannot be implemented in
|
The shell should attempt to remain responsive to the user at all times, even in the face of contended or unresponsive filesystems. It is only acceptable to block in response to a user initiated action, such as running a command.
|
||||||
a reasonable way outside of the shell. A large performance decrease,
|
|
||||||
as well as some program complexity increase is acceptable in order to
|
|
||||||
improve separation.
|
|
||||||
|
|
||||||
Rationale:
|
Rationale:
|
||||||
|
Bad performance increases user-facing complexity, because it trains users to recognize and route around slow use cases. It is also incredibly frustrating.
|
||||||
A modular project is easier to maintain since smaller programs are far
|
|
||||||
easier to understand than larger ones. A modular project is also more
|
|
||||||
future proof since the modules can be individually
|
|
||||||
replaced. Modularity also decreases the severity of bugs, since there
|
|
||||||
is good hope that a bug, even a serious one, in one module, does not
|
|
||||||
take the whole system down.
|
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
- Builtin commands should only be created when it cannot be
|
- Features like syntax highlighting and autosuggestions must perform all of their disk I/O asynchronously.
|
||||||
avoided. \c echo, \c kill, \c printf and \c time are among the commands
|
|
||||||
that fish does not implement internally since they can be provided as
|
|
||||||
external commands. Several other commands that are commonly implemented
|
|
||||||
as builtins and can not be implemented as external commands,
|
|
||||||
including \c type, \c vared, \c pushd and \c popd are implemented as shellscript
|
|
||||||
functions in fish.
|
|
||||||
- Mathematical calculations, regex matching, generating lists of numbers
|
|
||||||
and many other funtions can easily be done in external programs. They
|
|
||||||
should not be supported internally by the shell.
|
|
||||||
|
|
||||||
The law of minimalism does not imply that a large feature set is
|
- Startup should minimize forks and disk I/O, so that fish can be started even if the system is under load.
|
||||||
bad. So long as a feature is not part of the shell itself, but a
|
|
||||||
separate command or at least a shellscript function, bloat is fine.
|
|
||||||
|
|
||||||
\section conf Configurability is the root of all evil
|
\section design-configurability Configurability is the root of all evil
|
||||||
|
|
||||||
Every configuration option in a program is a place where the program
|
Every configuration option in a program is a place where the program is too stupid to figure out for itself what the user really wants, and should be considered a failure of both the program and the programmer who implemented it.
|
||||||
is too stupid to figure out for itself what the user really wants, and
|
|
||||||
should be considered a failiure of both the program and the programmer
|
|
||||||
who implemented it.
|
|
||||||
|
|
||||||
Rationale:
|
Rationale:
|
||||||
|
Different configuration options are a nightmare to maintain, since the number of potential bugs caused by specific configuration combinations quickly becomes an issue. Configuration options often imply assumptions about the code which change when reimplementing the code, causing issues with backwards compatibility. But mostly, configuration options should be avoided since they simply should not exist, as the program should be smart enough to do what is best, or at least a good enough approximation of it.
|
||||||
Different configuration options are a nightmare to maintain, since the
|
|
||||||
number of potential bugs caused by specific configuration combinations
|
|
||||||
quickly becomes an issue. Configuration options often imply
|
|
||||||
assumptions about the code which change when reimplementing the code,
|
|
||||||
causing issues with backwards compatibility. But mostly, configuration
|
|
||||||
options should be avoided since they simply should not exist, as the
|
|
||||||
program should be smart enough to do what is best, or at least a good
|
|
||||||
enough approximation of it.
|
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
- Fish allows the user to set various syntax highlighting colors. This is needed because fish does not know what colors the terminal uses by default, which might make some things unreadable. The proper solution would be for text color preferences to be defined centrally by the user for all programs, and for the terminal emulator to send these color properties to fish.
|
- Fish allows the user to set various syntax highlighting colors. This is needed because fish does not know what colors the terminal uses by default, which might make some things unreadable. The proper solution would be for text color preferences to be defined centrally by the user for all programs, and for the terminal emulator to send these color properties to fish.
|
||||||
|
|
||||||
- Fish does not allow you to set the history filename, the number of history entries, different language substyles or any number of other common shell configuration options.
|
- Fish does not allow you to set the history filename, the number of history entries, different language substyles or any number of other common shell configuration options.
|
||||||
|
|
||||||
A special note on the evils of configurability is the long list of
|
A special note on the evils of configurability is the long list of very useful features found in some shells, that are not turned on by default. Both zsh and bash support command-specific completions, but no such completions are shipped with bash by default, and they are turned off by default in zsh. Other features that zsh supports that are disabled by default include tab-completion of strings containing wildcards, a sane completion pager and a history file.
|
||||||
very useful features found in some shells, that are not turned on by
|
|
||||||
default. Both zsh and bash support command specific completions, but
|
|
||||||
no such completions are shipped with bash by default, and they are
|
|
||||||
turned of by default in zsh. Other features that zsh support that are
|
|
||||||
disabled by default include tab-completion of strings containing
|
|
||||||
wildcards, a sane completion pager and a history file.
|
|
||||||
|
|
||||||
\section user The law of user focus
|
\section user The law of user focus
|
||||||
|
|
||||||
When designing a program, one should first think about how to make a
|
When designing a program, one should first think about how to make a intuitive and powerful program. Implementation issues should only be considered once a user interface has been designed.
|
||||||
intuitive and powerful program. Implementation issues should only be
|
|
||||||
considered once a user interface has been designed.
|
|
||||||
|
|
||||||
Rationale:
|
Rationale:
|
||||||
|
|
||||||
This design rule is different than the others, since it describes how
|
This design rule is different than the others, since it describes how one should go about designing new features, not what the features should be. The problem with focusing on what can be done, and what is easy to do, is that too much of the implementation is exposed. This means that the user must know a great deal about the underlying system to be able to guess how the shell works, it also means that the language will often be rather low-level.
|
||||||
one should go about designing new features, not what the features
|
|
||||||
should be. The problem with focusing on what can be done, and what is
|
|
||||||
easy to do, is that to much of the implementation is exposed. This
|
|
||||||
means that the user must know a great deal about the underlying system
|
|
||||||
to be able to guess how the shell works, it also means that the
|
|
||||||
language will often be rather low-level.
|
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
- There should only be one type of input to the shell, lists of commands. Loops, conditionals and variable assignments are all performed through regular commands.
|
- There should only be one type of input to the shell, lists of commands. Loops, conditionals and variable assignments are all performed through regular commands.
|
||||||
- The differences between builtin commands, shellscript functions and builtin commands should be made as small as possible. Builtins and shellscript functions should have exactly the same types of argument expansion as other commands, should be possible to use in any position in a pipeline, and should support any io redirection.
|
|
||||||
|
- The differences between built-in commands and shellscript functions should be made as small as possible. Built-ins and shellscript functions should have exactly the same types of argument expansion as other commands, should be possible to use in any position in a pipeline, and should support any I/O redirection.
|
||||||
|
|
||||||
- Instead of forking when performing command substitution to provide a fake variable scope, all fish commands are performed from the same process, and fish instead supports true scoping.
|
- Instead of forking when performing command substitution to provide a fake variable scope, all fish commands are performed from the same process, and fish instead supports true scoping.
|
||||||
- All blocks end with the \c end builtin.
|
|
||||||
|
- All blocks end with the `end` built-in.
|
||||||
|
|
||||||
\section disc The law of discoverability
|
\section disc The law of discoverability
|
||||||
|
|
||||||
A program should be designed to make its features as
|
A program should be designed to make its features as easy as possible to discover for the user.
|
||||||
easy as possible to discover for the user.
|
|
||||||
|
|
||||||
Rationale:
|
Rationale:
|
||||||
|
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.
|
||||||
|
|
||||||
A program whose features are discoverable turns a new user into an
|
The main benefit of a graphical program over a command-line-based program is discoverability. In a graphical program, one can discover all the common features by simply looking at the user interface and guessing what the different buttons, menus and other widgets do. The traditional way to discover features in command-line programs is through manual pages. This requires both that the user starts to use a different program, and then she/he remembers the new information until the next time she/he uses the same program.
|
||||||
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
|
|
||||||
all the common features by simply looking at the user interface and
|
|
||||||
guessing what the different buttons, menus and other widgets do. The
|
|
||||||
traditional way to discover features in commandline programs is
|
|
||||||
through manual pages. This requires both that the user starts to use a
|
|
||||||
different program, and the she/he then remembers the new information
|
|
||||||
until the next time she/he uses the same program.
|
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
- Everything should be tab-completable, and every tab completion should have a description.
|
- Everything should be tab-completable, and every tab completion should have a description.
|
||||||
- Every syntax error and error in a builtin command should contain an error message describing what went wrong and a relevant help page. Whenever possible, errors should be flagged red by the syntax highlighter.
|
|
||||||
|
- Every syntax error and error in a built-in command should contain an error message describing what went wrong and a relevant help page. Whenever possible, errors should be flagged red by the syntax highlighter.
|
||||||
|
|
||||||
- The help manual should be easy to read, easily available from the shell, complete and contain many examples
|
- The help manual should be easy to read, easily available from the shell, complete and contain many examples
|
||||||
- The language should be uniform, so that once the user understands the command/argument syntax, he will know the whole language, and be able to use tab-completion to discover new featues.
|
|
||||||
|
- The language should be uniform, so that once the user understands the command/argument syntax, she/he will know the whole language, and be able to use tab-completion to discover new features.
|
||||||
|
|
||||||
|
|
||||||
|
\htmlonly[block]
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
\endhtmlonly
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
\section dirh dirh - print directory history
|
\section dirh dirh - print directory history
|
||||||
|
|
||||||
\subsection dirh-synopsis Synopsis
|
\subsection dirh-synopsis Synopsis
|
||||||
<tt>dirh</tt>
|
\fish{synopsis}
|
||||||
|
dirh
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection dirh-description Description
|
\subsection dirh-description Description
|
||||||
<tt>dirh</tt> prints the current directory history. The current position in the
|
|
||||||
history is highlighted using <tt>$fish_color_history_current</tt>.
|
`dirh` prints the current directory history. The current position in the history is highlighted using the color defined in the `fish_color_history_current` environment variable.
|
||||||
|
|
||||||
|
`dirh` does not accept any parameters.
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
\section dirs dirs - print directory stack
|
\section dirs dirs - print directory stack
|
||||||
|
|
||||||
\subsection dirs-synopsis Synopsis
|
\subsection dirs-synopsis Synopsis
|
||||||
<tt>dirs</tt>
|
\fish{synopsis}
|
||||||
|
dirs
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection dirs-description Description
|
\subsection dirs-description Description
|
||||||
<tt>dirs</tt> prints the current directory stack.
|
|
||||||
|
`dirs` prints the current directory stack, as created by the <a href="#pushd">`pushd`</a> command.
|
||||||
|
|
||||||
|
`dirs` does not accept any parameters.
|
||||||
|
|||||||
@@ -1,16 +1,60 @@
|
|||||||
\section echo echo - display a line of text
|
\section echo echo - display a line of text
|
||||||
|
|
||||||
\subsection echo-synopsis Synopsis
|
\subsection echo-synopsis Synopsis
|
||||||
<tt>echo [STRING]</tt>
|
\fish{synopsis}
|
||||||
|
echo [OPTIONS] [STRING]
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection echo-description Description
|
\subsection echo-description Description
|
||||||
|
|
||||||
Display a line of text.
|
`echo` displays a string of text.
|
||||||
|
|
||||||
- \c -n, \c Do not output a newline
|
The following options are available:
|
||||||
- \c -s, \c Do not separate arguments with spaces
|
|
||||||
- \c -h, \c --help Display this help
|
- `-n`, Do not output a newline
|
||||||
|
|
||||||
|
- `-s`, Do not separate arguments with spaces
|
||||||
|
|
||||||
|
- `-E`, Disable interpretation of backslash escapes (default)
|
||||||
|
|
||||||
|
- `-e`, Enable interpretation of backslash escapes
|
||||||
|
|
||||||
|
\subsection echo-escapes Escape Sequences
|
||||||
|
|
||||||
|
If `-e` is used, the following sequences are recognized:
|
||||||
|
|
||||||
|
- `\` backslash
|
||||||
|
|
||||||
|
- `\a` alert (BEL)
|
||||||
|
|
||||||
|
- `\b` backspace
|
||||||
|
|
||||||
|
- `\c` produce no further output
|
||||||
|
|
||||||
|
- `\e` escape
|
||||||
|
|
||||||
|
- `\f` form feed
|
||||||
|
|
||||||
|
- `\n` new line
|
||||||
|
|
||||||
|
- `\r` carriage return
|
||||||
|
|
||||||
|
- `\t` horizontal tab
|
||||||
|
|
||||||
|
- `\v` vertical tab
|
||||||
|
|
||||||
|
- `\0NNN` byte with octal value NNN (1 to 3 digits)
|
||||||
|
|
||||||
|
- `\xHH` byte with hexadecimal value HH (1 to 2 digits)
|
||||||
|
|
||||||
\subsection echo-example Example
|
\subsection echo-example Example
|
||||||
|
|
||||||
<tt>echo 'Hello World'</tt> Print hello world to stdout
|
\fish
|
||||||
|
echo 'Hello World'
|
||||||
|
\endfish
|
||||||
|
Print hello world to stdout
|
||||||
|
|
||||||
|
\fish
|
||||||
|
echo -e 'Top\nBottom'
|
||||||
|
\endfish
|
||||||
|
Print Top and Bottom on separate lines, using an escape sequence
|
||||||
|
|||||||
@@ -1,17 +1,23 @@
|
|||||||
\section else else - execute command if a condition is not met
|
\section else else - execute command if a condition is not met
|
||||||
|
|
||||||
\subsection else-synopsis Synopsis
|
\subsection else-synopsis Synopsis
|
||||||
<tt>if CONDITION; COMMANDS_TRUE...; [else; COMMANDS_FALSE...;] end</tt>
|
\fish{synopsis}
|
||||||
|
if CONDITION; COMMANDS_TRUE...; [else; COMMANDS_FALSE...;] end
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection else-description Description
|
\subsection else-description Description
|
||||||
<tt>if</tt> will execute the command CONDITION. If the condition's exit
|
|
||||||
status is 0, the commands COMMANDS_TRUE will execute. If it is not 0 and
|
`if` will execute the command `CONDITION`. If the condition's exit status is 0, the commands `COMMANDS_TRUE` will execute. If it is not 0 and `else` is given, `COMMANDS_FALSE` will be executed.
|
||||||
<tt>else</tt> is given, COMMANDS_FALSE will be executed. Hint: use
|
|
||||||
<a href="#begin"><tt>begin; ...; end</tt></a> for complex conditions.
|
|
||||||
|
|
||||||
\subsection else-example Example
|
\subsection else-example Example
|
||||||
|
|
||||||
The command <tt>if test -f foo.txt; echo foo.txt exists; else; echo foo.txt does not exist; end</tt>
|
The following code tests whether a file `foo.txt` exists as a regular file.
|
||||||
will print <tt>foo.txt exists</tt> if the file foo.txt
|
|
||||||
exists and is a regular file, otherwise it will print
|
\fish
|
||||||
<tt>foo.txt does not exist</tt>.
|
if test -f foo.txt
|
||||||
|
echo foo.txt exists
|
||||||
|
else
|
||||||
|
echo foo.txt does not exist
|
||||||
|
end
|
||||||
|
\endfish
|
||||||
|
|||||||
@@ -1,19 +1,23 @@
|
|||||||
\section emit emit - Emit a generic event
|
\section emit emit - Emit a generic event
|
||||||
|
|
||||||
\subsection block-synopsis Synopsis
|
\subsection emit-synopsis Synopsis
|
||||||
<tt>emit EVENT_NAME</tt>
|
\fish{synopsis}
|
||||||
|
emit EVENT_NAME [ARGUMENTS...]
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection emit-description Description
|
\subsection emit-description Description
|
||||||
|
|
||||||
The emit builtin fires a generic fish event. Such events can be caught by special functions called event handlers.
|
`emit` emits, or fires, an event. Events are delivered to, or caught by, special functions called event handlers. The arguments are passed to the event handlers as function arguments.
|
||||||
|
|
||||||
|
|
||||||
\subsection emit-example Example
|
\subsection emit-example Example
|
||||||
|
|
||||||
The following code first defines an event handler for the generic
|
The following code first defines an event handler for the generic event named 'test_event', and then emits an event of that type.
|
||||||
event named 'test_event', and then emits an event of that type.
|
|
||||||
|
|
||||||
<pre>function event_test --on-event test_event
|
\fish
|
||||||
echo event test!!!
|
function event_test --on-event test_event
|
||||||
|
echo event test: $argv
|
||||||
end
|
end
|
||||||
|
|
||||||
emit test_event</pre>
|
emit test_event something
|
||||||
|
\endfish
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
\section end end - end a block of commands.
|
\section end end - end a block of commands.
|
||||||
|
|
||||||
\subsection end-synopsis Synopsis
|
\subsection end-synopsis Synopsis
|
||||||
<pre>
|
\fish{synopsis}
|
||||||
begin; [COMMANDS...] end
|
begin; [COMMANDS...] end
|
||||||
if CONDITION; COMMANDS_TRUE...; [else; COMMANDS_FALSE...;] end
|
if CONDITION; COMMANDS_TRUE...; [else; COMMANDS_FALSE...;] end
|
||||||
while CONDITION; COMMANDS...; end
|
while CONDITION; COMMANDS...; end
|
||||||
for VARNAME in [VALUES...]; COMMANDS...; end
|
for VARNAME in [VALUES...]; COMMANDS...; end
|
||||||
switch VALUE; [case [WILDCARD...]; [COMMANDS...]; ...] end
|
switch VALUE; [case [WILDCARD...]; [COMMANDS...]; ...] end
|
||||||
</pre>
|
\endfish
|
||||||
|
|
||||||
\subsection end-description Description
|
\subsection end-description Description
|
||||||
<tt>end</tt> ends a block of commands. For more information, read the
|
|
||||||
documentation for the block constructs, such as \c if, \c for and \c
|
|
||||||
while.
|
|
||||||
|
|
||||||
The \c end command does not change the current exit status.
|
`end` ends a block of commands.
|
||||||
|
|
||||||
|
For more information, read the
|
||||||
|
documentation for the block constructs, such as `if`, `for` and `while`.
|
||||||
|
|
||||||
|
The `end` command does not change the current exit status.
|
||||||
|
|||||||
@@ -1,16 +1,20 @@
|
|||||||
\section eval eval - evaluate the specified commands
|
\section eval eval - evaluate the specified commands
|
||||||
|
|
||||||
\subsection eval-synopsis Synopsis
|
\subsection eval-synopsis Synopsis
|
||||||
<tt>eval [COMMANDS...]</tt>
|
\fish{synopsis}
|
||||||
|
eval [COMMANDS...]
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection eval-description Description
|
\subsection eval-description Description
|
||||||
The <tt>eval</tt> function causes fish to evaluate the specified parameters as a command. If more than one parameter is specified, all parameters will be joined using a space character as a separator.
|
`eval` evaluates the specified parameters as a command. If more than one parameter is specified, all parameters will be joined using a space character as a separator.
|
||||||
|
|
||||||
|
|
||||||
\subsection eval-example Example
|
\subsection eval-example Example
|
||||||
|
|
||||||
<pre>
|
The following code will call the ls command. Note that `fish` does not support the use of shell variables as direct commands; `eval` can be used to work around this.
|
||||||
|
|
||||||
|
\fish
|
||||||
set cmd ls
|
set cmd ls
|
||||||
eval $cmd
|
eval $cmd
|
||||||
</pre>
|
\endfish
|
||||||
|
|
||||||
will call the ls command.
|
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
\section exec exec - execute command in current process
|
\section exec exec - execute command in current process
|
||||||
|
|
||||||
\subsection exec-synopsis Synopsis
|
\subsection exec-synopsis Synopsis
|
||||||
<tt>exec COMMAND [OPTIONS...]</tt>
|
\fish{synopsis}
|
||||||
|
exec COMMAND [OPTIONS...]
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection exec-description Description
|
\subsection exec-description Description
|
||||||
|
|
||||||
The \c exec builtin is used to replace the currently running shells
|
`exec` replaces the currently running shell with a new command. On successful completion, `exec` never returns. `exec` cannot be used inside a pipeline.
|
||||||
process image with a new command. On successful completion, exec never
|
|
||||||
returns. exec can not be used inside a pipeline.
|
|
||||||
|
|
||||||
\subsection exec-example Example
|
\subsection exec-example Example
|
||||||
|
|
||||||
<tt>exec emacs</tt> starts up the emacs text editor. When emacs exits,
|
`exec emacs` starts up the emacs text editor, and exits `fish`. When emacs exits, the session will terminate.
|
||||||
the session will terminate.
|
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
\section exit exit - exit the shell.
|
\section exit exit - exit the shell
|
||||||
|
|
||||||
\subsection exit-synopsis Synopsis
|
\subsection exit-synopsis Synopsis
|
||||||
<tt>exit [STATUS]</tt>
|
\fish{synopsis}
|
||||||
|
exit [STATUS]
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection exit-description Description
|
\subsection exit-description Description
|
||||||
|
|
||||||
The <tt>exit</tt> builtin causes fish to exit. If <tt>STATUS</tt> is
|
`exit` causes fish to exit. If `STATUS` is supplied, it will be converted to an integer and used as the exit code. Otherwise, the exit code will be that of the last command executed.
|
||||||
supplied, it will be converted to an integer and used as the exit
|
|
||||||
code. Otherwise the exit code will be that of the last command executed.
|
|
||||||
|
|
||||||
If exit is called while sourcing a file (using the <a
|
If exit is called while sourcing a file (using the <a href="#source">source</a> builtin) the rest of the file will be skipped, but the shell itself will not exit.
|
||||||
href="#source">.</a> builtin) the rest of the file will be skipped,
|
|
||||||
but the shell itself will not exit.
|
|
||||||
|
|||||||
10
doc_src/false.txt
Normal file
10
doc_src/false.txt
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
\section false false - return an unsuccessful result
|
||||||
|
|
||||||
|
\subsection false-synopsis Synopsis
|
||||||
|
\fish{synopsis}
|
||||||
|
false
|
||||||
|
\endfish
|
||||||
|
|
||||||
|
\subsection false-description Description
|
||||||
|
|
||||||
|
`false` sets the exit status to 1.
|
||||||
251
doc_src/faq.hdr
251
doc_src/faq.hdr
@@ -1,161 +1,222 @@
|
|||||||
/** \page faq Frequently asked questions
|
/**
|
||||||
|
\page faq Frequently asked questions
|
||||||
|
\htmlonly[block]
|
||||||
|
<div class="fish_left_bar">
|
||||||
|
<div class="logo"></div>
|
||||||
|
<div class="menu faq_menu">
|
||||||
|
|
||||||
|
\endhtmlonly
|
||||||
|
|
||||||
|
- <a href='#faq-envvar'>How do I set or clear an environment variable?</a>
|
||||||
|
- <a href='#faq-login-cmd'>How do I run a command every login? What's fish's equivalent to `.bashrc`?</a>
|
||||||
|
- <a href='#faq-prompt'>How do I set my prompt?</a>
|
||||||
|
- <a href='#faq-cmd-history'>How do I run a command from history?</a>
|
||||||
|
- <a href='#faq-subcommand'>How do I run a subcommand? The backtick doesn't work!</a>
|
||||||
|
- <a href='#faq-exit-status'>How do I get the exit status of a command?</a>
|
||||||
|
- <a href='#faq-single-env'>How do I set an environment variable for just one command?</a>
|
||||||
|
- <a href='#faq-customize-colors'>How do I customize my syntax highlighting colors?</a>
|
||||||
|
- <a href='#faq-update-manpage-completions'>How do I update man page completions?</a>
|
||||||
- <a href='#faq-cwd-symlink'>Why does cd, pwd and other fish commands always resolve symlinked directories to their canonical path?</a>
|
- <a href='#faq-cwd-symlink'>Why does cd, pwd and other fish commands always resolve symlinked directories to their canonical path?</a>
|
||||||
- <a href='#faq-cd-autocomplete'>Why does the cd command autocompletion list the subdirectories of my home directory as completions?</a>
|
|
||||||
- <a href='#faq-cd-implicit'>I accidentally entered a directory path and fish changed directory. What happened?</a>
|
- <a href='#faq-cd-implicit'>I accidentally entered a directory path and fish changed directory. What happened?</a>
|
||||||
- <a href='#faq-open'>The open command doesn't work.</a>
|
- <a href='#faq-open'>The open command doesn't work.</a>
|
||||||
- <a href='#faq-default'>How do I make fish my default shell?</a>
|
- <a href='#faq-default'>How do I make fish my default shell?</a>
|
||||||
- <a href='#faq-titlebar'>I'm seeing weird output before each prompt when using screen. What's wrong?</a>
|
- <a href='#faq-titlebar'>I'm seeing weird output before each prompt when using screen. What's wrong?</a>
|
||||||
- <a href='#faq-greeting'>How do I change the greeting message?</a>
|
- <a href='#faq-greeting'>How do I change the greeting message?</a>
|
||||||
- <a href='#faq-history'>Why doesn't history substitution ("!$" etc.) work?</a>
|
- <a href='#faq-history'>Why doesn't history substitution ("!$" etc.) work?</a>
|
||||||
|
- <a href='#faq-uninstalling'>How do I uninstall fish?</a>
|
||||||
|
|
||||||
|
\htmlonly[block]
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="faq fish_right_bar">
|
||||||
|
<h1 class="interior_title">Frequently Asked Questions</h1>
|
||||||
|
\endhtmlonly
|
||||||
|
|
||||||
|
|
||||||
|
\section faq-envvar How do I set or clear an environment variable?
|
||||||
|
|
||||||
|
Use the <a href="commands.html#set">`set`</a> command:
|
||||||
|
|
||||||
|
\fish{cli-dark}
|
||||||
|
set -x key value
|
||||||
|
set -e key
|
||||||
|
\endfish
|
||||||
|
|
||||||
|
|
||||||
|
\section faq-login-cmd How do I run a command every login? What's fish's equivalent to .bashrc?
|
||||||
|
|
||||||
|
Edit the file `~/.config/fish/config.fish`, creating it if it does not exist (Note the leading period).
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
\section faq-prompt How do I set my prompt?
|
||||||
|
|
||||||
|
The prompt is the output of the `fish_prompt` function. Put it in `~/.config/fish/functions/fish_prompt.fish`. For example, a simple prompt is:
|
||||||
|
|
||||||
|
\fish{cli-dark}
|
||||||
|
function fish_prompt
|
||||||
|
set_color $fish_color_cwd
|
||||||
|
echo -n (prompt_pwd)
|
||||||
|
set_color normal
|
||||||
|
echo -n ' > '
|
||||||
|
end
|
||||||
|
\endfish
|
||||||
|
|
||||||
|
You can also use the Web configuration tool, <a href="commands.html#fish_config">`fish_config`</a>, to preview and choose from a gallery of sample prompts.
|
||||||
|
|
||||||
|
|
||||||
|
\section faq-cmd-history How do I run a command from history?
|
||||||
|
|
||||||
|
Type some part of the command, and then hit the @cursor_key{↑,up} or @cursor_key{↓,down} arrow keys to navigate through history matches.
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
\section faq-subcommand How do I run a subcommand? The backtick doesn't work!
|
||||||
|
|
||||||
|
`fish` uses parentheses for subcommands. For example:
|
||||||
|
|
||||||
|
\fish{cli-dark}
|
||||||
|
for i in (ls)
|
||||||
|
echo $i
|
||||||
|
end
|
||||||
|
\endfish
|
||||||
|
|
||||||
|
|
||||||
|
\section faq-exit-status How do I get the exit status of a command?
|
||||||
|
|
||||||
|
Use the `$status` variable. This replaces the `$?` variable used in some other shells.
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
\section faq-single-env How do I set an environment variable for just one command?
|
||||||
|
|
||||||
|
<i>`SOME_VAR=1 command` produces an error: `Unknown command "SOME_VAR=1"`.</i>
|
||||||
|
|
||||||
|
Use the `env` command.
|
||||||
|
|
||||||
|
`env SOME_VAR=1 command`
|
||||||
|
|
||||||
|
You can also declare a local variable in a block:
|
||||||
|
|
||||||
|
\fish{cli-dark}
|
||||||
|
begin
|
||||||
|
set -lx SOME_VAR 1
|
||||||
|
command
|
||||||
|
end
|
||||||
|
\endfish
|
||||||
|
|
||||||
|
|
||||||
|
\section faq-customize-colors How do I customize my syntax highlighting colors?
|
||||||
|
|
||||||
|
Use the web configuration tool, <a href="commands.html#fish_config">`fish_config`</a>, or alter the <a href="index.html#variables-color">`fish_color` family of environment variables</a>.
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
\section faq-update-manpage-completions How do I update man page completions?
|
||||||
|
|
||||||
|
Use the <a href="commands.html#fish_update_completions">`fish_update_completions`</a> command.
|
||||||
|
|
||||||
|
<hr>
|
||||||
\section faq-cwd-symlink Why does cd, $PWD and and various fish commands always resolve symlinked directories to their canonical path?
|
\section faq-cwd-symlink Why does cd, $PWD and and various fish commands always resolve symlinked directories to their canonical path?
|
||||||
|
|
||||||
<i>
|
<i>For example if `~/images` is a symlink to `~/Documents/Images`, if I write '`cd images`', my prompt will say `~/Documents/Images`, not `~/images`.</i>
|
||||||
For example if ~/images is a symlink to ~/Documents/Images, if I write
|
|
||||||
'cd images', my prompt will say ~/D/Images, not ~/images.
|
|
||||||
</i>
|
|
||||||
|
|
||||||
Because it is impossible to consistently keep symlinked directories
|
Because it is impossible to consistently keep symlinked directories unresolved. It is indeed possible to do this partially, and many other shells do so. But it was felt there are enough serious corner cases that this is a bad idea. Most such issues have to do with how '..' is handled, and are varitations of the following example:
|
||||||
unresolved. It is indeed possible to do this partially, and many other
|
|
||||||
shells do so. But it was felt there are enough serious corner cases
|
|
||||||
that this is a bad idea. Most such issues have to do with how '..' is
|
|
||||||
handled, and are varitations of the following example:
|
|
||||||
|
|
||||||
Writing <code>cd images; ls ..</code> given the above directory
|
Writing `cd images; ls ..` given the above directory structure would list the contents of `~/Documents`, not of `~`, even though using `cd ..` changes the current directory to `~`, and the prompt, the `pwd` builtin and many other directory information sources suggest that the current directory is `~/images` and its parent is `~`. This issue is not possible to fix without either making every single command into a builtin, breaking Unix semantics or implementing kludges in every single command. This issue can also be seen when doing IO redirection.
|
||||||
structure would list the contents of ~/Documents, not of ~, even
|
|
||||||
though using <code>cd ..</code> changes the current direcotry to ~,
|
|
||||||
and the prompt, the pwd builtin and many other directory information
|
|
||||||
sources suggest that the the current directory is ~/images and it's
|
|
||||||
parent is ~. This issue is not possible to fix without either making
|
|
||||||
every single command into a builtin, breaking Unix semantics or
|
|
||||||
implementing kludges in every single command.
|
|
||||||
|
|
||||||
This issue can also be seen when doing IO redirection.
|
Another related issue is that many programs that operate on recursive directory trees, like the find command, silently ignore symlinked directories. For example, ```find $PWD -name '*.txt'``` silently fails in shells that don't resolve symlinked paths.
|
||||||
|
|
||||||
Another related issue is that many programs that operate on recursive
|
|
||||||
directory trees, like the find command, silently ignore symlinked
|
|
||||||
directories. For example, <code>find $PWD -name '*.txt'</code>
|
|
||||||
silently fails in shells that don't resolve symlinked paths.
|
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
\section faq-cd-autocomplete Why does the cd command autocompletion list the subdirectories of my home directory as completions?
|
|
||||||
|
|
||||||
Because they are completions. In fish, if you specify a relative
|
|
||||||
directory to the cd command, i.e. any path that does not start with
|
|
||||||
either './' or '/', the environment variable CDPATH will be examined, and any
|
|
||||||
directories in this path is used as a base direcotry. To disable this
|
|
||||||
feature, write <code>set CDPATH .</code> on the commandline.
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
\section faq-cd-implicit I accidentally entered a directory path and fish changed directory. What happened?
|
\section faq-cd-implicit I accidentally entered a directory path and fish changed directory. What happened?
|
||||||
|
|
||||||
If fish is unable to locate a command with a given name, fish will
|
If fish is unable to locate a command with a given name, and it starts with '`.`', '`/`' or '`~`', fish will test if a directory of that name exists. If it does, it is implicitly assumed that you want to change working directory. For example, the fastest way to switch to your home directory is to simply press `~` and enter.
|
||||||
test if a directory of that name exists. If it does, it is implicitly
|
|
||||||
assumed that you want to change working directory. For example, the
|
|
||||||
fastest way to switch to your home directory is to simply press
|
|
||||||
<code>~</code> and enter.
|
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
\section faq-open The open command doesn't work.
|
\section faq-open The open command doesn't work.
|
||||||
|
|
||||||
The open command uses the mimetype database and the .desktop files
|
The `open` command uses the MIME type database and the `.desktop` files used by Gnome and KDE to identify filetypes and default actions. If at least one of these environments is installed, but the open command is not working, this probably means that the relevant files are installed in a non-standard location. Consider <a href="index.html#more-help">asking for more help</a>.
|
||||||
used by Gnome and KDE to identify filetypes and default actions. If
|
|
||||||
at least one of these two desktops are installed, but the open command is
|
|
||||||
not working, this probably means that the relevant files are installed
|
|
||||||
in a nonstandard location. Please contact the <a
|
|
||||||
href='mailto:fish-users@lists.sf.net'>fish mailing list</a>, and
|
|
||||||
hopefully this can be resolved.
|
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
\section faq-default How do I make fish my default shell?
|
\section faq-default How do I make fish my default shell?
|
||||||
|
|
||||||
If you installed fish manually (e.g. by compiling it, not by using a
|
If you installed fish manually (e.g. by compiling it, not by using a package manager), you first need to add fish to the list of shells by executing the following command (assuming you installed fish in /usr/local) as root:
|
||||||
package manager), you first need to add fish to the list of shells by
|
|
||||||
executing the following command (assuming you installed fish in
|
|
||||||
/usr/local) as root:
|
|
||||||
|
|
||||||
|
\fish{cli-dark}
|
||||||
|
echo /usr/local/bin/fish >>/etc/shells
|
||||||
|
\endfish
|
||||||
|
|
||||||
<code>echo /usr/local/bin/fish >>/etc/shells</code>
|
If you installed a prepackaged version of fish, the package manager should have already done this for you.
|
||||||
|
|
||||||
If you installed a prepackaged version of fish, the package manager
|
|
||||||
should have already done this for you.
|
|
||||||
|
|
||||||
In order to change your default shell, type:
|
In order to change your default shell, type:
|
||||||
|
|
||||||
<code>chsh -s /usr/local/bin/fish</code>
|
\fish{cli-dark}
|
||||||
|
chsh -s /usr/local/bin/fish
|
||||||
|
\endfish
|
||||||
|
|
||||||
You may need to adjust the above path to e.g. /usr/bin/fish. Use the command <code>which fish</code> if you are unsure of where fish is installed.
|
You may need to adjust the above path to e.g. `/usr/bin/fish`. Use the command `which fish` if you are unsure of where fish is installed.
|
||||||
|
|
||||||
Unfortunatly, there is no way to make the changes take effect at once,
|
Unfortunately, there is no way to make the changes take effect at once. You will need to log out and back in again.
|
||||||
you will need to log out and back in again.
|
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
\section faq-titlebar I'm seeing weird output before each prompt when using screen. What's wrong?
|
\section faq-titlebar I'm seeing weird output before each prompt when using screen. What's wrong?
|
||||||
|
|
||||||
Quick answer:
|
Quick answer:
|
||||||
|
|
||||||
Run the following command in fish:
|
Run the following command in fish:
|
||||||
|
|
||||||
<pre>
|
\fish{cli-dark}
|
||||||
echo 'function fish_title;end' > ~/.config/fish/config.fish
|
echo 'function fish_title;end' >> ~/.config/fish/config.fish
|
||||||
</pre>
|
\endfish
|
||||||
|
|
||||||
Problem solved!
|
Problem solved!
|
||||||
|
|
||||||
The long answer:
|
The long answer:
|
||||||
|
|
||||||
Fish is trying to set the titlebar message of your terminal. While
|
Fish is trying to set the titlebar message of your terminal. While screen itself supports this feature, your terminal does not. Unfortunately, when the underlying terminal doesn't support setting the titlebar, screen simply passes through the escape codes and text to the underlying terminal instead of ignoring them. It is impossible to detect and resolve this problem from inside fish since fish has no way of knowing what the underlying terminal type is. For now, the only way to fix this is to unset the titlebar message, as suggested above.
|
||||||
screen itself supports this feature, your terminal does
|
|
||||||
not. Unfortuntaly, when the underlying terminal doesn't support
|
|
||||||
setting the titlebar, screen simply passes through the escape codes
|
|
||||||
and text to the underlying terminal instead of ignoring them. It is
|
|
||||||
impossible detect and resolve this problem from inside fish since fish
|
|
||||||
has no way of knowing what the underlying terminal type is. For now,
|
|
||||||
the only way to fix this is to unset the titlebar message, as
|
|
||||||
suggested above.
|
|
||||||
|
|
||||||
Note that fish has a default titlebar message, which will be used if
|
Note that fish has a default titlebar message, which will be used if the fish_title function is undefined. So simply unsetting the fish_title function will not work.
|
||||||
the fish_title function is undefined. So simply unsetting the
|
|
||||||
fish_title function will not work.
|
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
\section faq-greeting How do I change the greeting message?
|
\section faq-greeting How do I change the greeting message?
|
||||||
|
|
||||||
Change the value of the variable fish_greeting. For example, to remove
|
Change the value of the variable `fish_greeting` or create a `fish_greeting` function. For example, to remove the greeting use:
|
||||||
the greeting use:
|
|
||||||
|
|
||||||
<pre>
|
\fish{cli-dark}
|
||||||
set fish_greeting
|
set fish_greeting
|
||||||
</pre>
|
\endfish
|
||||||
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
\section faq-history Why doesn't history substitution ("!$" etc.) work?
|
\section faq-history Why doesn't history substitution ("!$" etc.) work?
|
||||||
|
|
||||||
Because history substitution is an awkward interface that was invented before
|
Because history substitution is an awkward interface that was invented before interactive line editing was even possible. Fish drops it in favor of perfecting the interactive history recall interface. Switching requires a small change of habits: if you want to modify an old line/word, first recall it, then edit. E.g. don't type "sudo !!" - first press Up, then Home, then type "sudo ".
|
||||||
interactive line editing was even possible. Fish drops it in favor of
|
|
||||||
perfecting the interactive history recall interface. Switching requires a
|
|
||||||
small change of habits: if you want to modify an old line/word, first recall
|
|
||||||
it, then edit. E.g. don't type "sudo !!" - first press Up, then Home, then
|
|
||||||
type "sudo ".
|
|
||||||
|
|
||||||
Fish history recall is very simple yet effective:
|
Fish history recall is very simple yet effective:
|
||||||
|
|
||||||
- As in any modern shell, the Up arrow recalls whole lines, starting from the last line executed. A single press replaces "!!", later presses replace "!-3" and the like.
|
- As in any modern shell, the Up arrow, @cursor_key{↑,Up} recalls whole lines, starting from the last line executed. A single press replaces "!!", later presses replace "!-3" and the like.
|
||||||
- If the line you want is far back in the history, type any part of the line and then press Up one or more times. This will constrain the recall to lines that include this text, and you will get to the line you want much faster. This replaces "!vi", "!?bar.c" and the like.
|
|
||||||
- Alt+Up recalls individual arguments, starting from the last argument in the last line executed. A single press replaces "!$", later presses replace "!!:4" and the like.
|
- If the line you want is far back in the history, type any part of the line and then press Up one or more times. This will constrain the recall to lines that include this text, and you will get to the line you want much faster. This replaces "!vi", "!?bar.c" and the like.
|
||||||
- If the argument you want is far back in history (e.g. 2 lines back - that's a lot of words!), type any part of it and then press Alt+Up. This will show only arguments containing that part and you will get what you want much faster. Try it out, this is very convenient!
|
|
||||||
- If you want to reuse several arguments from the same line ("!!:3*" and the like), consider recalling the whole line and removing what you don't need (Alt+D and Alt+Backspace are your friends).
|
- @key{Alt,↑,Up} recalls individual arguments, starting from the last argument in the last line executed. A single press replaces "!$", later presses replace "!!:4" and the like.
|
||||||
|
|
||||||
|
- If the argument you want is far back in history (e.g. 2 lines back - that's a lot of words!), type any part of it and then press @key{Alt,↑,Up}. This will show only arguments containing that part and you will get what you want much faster. Try it out, this is very convenient!
|
||||||
|
|
||||||
|
- If you want to reuse several arguments from the same line ("!!:3*" and the like), consider recalling the whole line and removing what you don't need (@key{Alt,D} and @key{Alt,Backspace} are your friends).
|
||||||
|
|
||||||
See <a href='index.html#editor'>documentation</a> for more details about line editing in fish.
|
See <a href='index.html#editor'>documentation</a> for more details about line editing in fish.
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
\section faq-uninstalling Uninstalling fish
|
||||||
|
|
||||||
|
Should you wish to uninstall fish, first ensure fish is not set as your shell. Run `chsh -s /bin/bash` if you are not sure.
|
||||||
|
|
||||||
|
Next, do the following (assuming fish was installed to /usr/local):
|
||||||
|
|
||||||
|
\fish{cli-dark}
|
||||||
|
rm -Rf /usr/local/etc/fish /usr/local/share/fish ~/.config/fish
|
||||||
|
rm /usr/local/share/man/man1/fish*.1
|
||||||
|
cd /usr/local/bin
|
||||||
|
rm -f fish mimedb fishd fish_indent
|
||||||
|
\endfish
|
||||||
|
|
||||||
|
\htmlonly[block]
|
||||||
|
</div>
|
||||||
|
\endhtmlonly
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,14 +1,17 @@
|
|||||||
\section fg fg - send job to foreground
|
\section fg fg - bring job to foreground
|
||||||
|
|
||||||
\subsection fg-synopsis Synopsis
|
\subsection fg-synopsis Synopsis
|
||||||
<tt>fg [PID]</tt>
|
\fish{synopsis}
|
||||||
|
fg [PID]
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection fg-description Description
|
\subsection fg-description Description
|
||||||
Sends the specified job to the foreground. While a foreground job is
|
|
||||||
executed, fish is suspended. If no job is specified, the last job to be used is put in the foreground. If PID is specified, the job with the specified group id is put in the foreground.
|
`fg` brings the specified <a href="index.html#syntax-job-control">job</a> to the foreground, resuming it if it is stopped. While a foreground job is executed, fish is suspended. If no job is specified, the last job to be used is put in the foreground. If PID is specified, the job with the specified group ID is put in the foreground.
|
||||||
|
|
||||||
The PID of the desired process is usually found by using <a href="index.html#expand-process">process expansion</a>.
|
The PID of the desired process is usually found by using <a href="index.html#expand-process">process expansion</a>.
|
||||||
|
|
||||||
|
|
||||||
\subsection fg-example Example
|
\subsection fg-example Example
|
||||||
|
|
||||||
<tt>fg \%0</tt> will put the job with job id 0 in the foreground.
|
`fg %1` will put the job with job ID 1 in the foreground.
|
||||||
|
|||||||
@@ -1,23 +1,28 @@
|
|||||||
\section fish fish - the friendly interactive shell
|
\section fish fish - the friendly interactive shell
|
||||||
|
|
||||||
\subsection fish-synopsis Synopsis
|
\subsection fish-synopsis Synopsis
|
||||||
fish [-h] [-v] [-c command] [FILE [ARGUMENTS...]]
|
\fish{synopsis}
|
||||||
|
fish [OPTIONS] [-c command] [FILE [ARGUMENTS...]]
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection fish-description Description
|
\subsection fish-description Description
|
||||||
|
|
||||||
A commandline shell written mainly with interactive use in mind. The
|
`fish` is a command-line shell written mainly with interactive use in mind. The full manual is available <a href='index.html'>in HTML</a> by using the <a href='#help'>help</a> command from inside fish.
|
||||||
full manual is available <a href='index.html'>in html</a> by using the
|
|
||||||
<a href='#help'>help</a> command from inside fish.
|
|
||||||
|
|
||||||
- <code>-c</code> or <code>--command=COMMANDS</code> evaluate the specified commands instead of reading from the commandline
|
The following options are available:
|
||||||
- <code>-d</code> or <code>--debug-level=DEBUG_LEVEL</code> specify the verbosity level of fish. A higher number means higher verbosity. The default level is 1.
|
|
||||||
- <code>-h</code> or <code>--help</code> display help and exit
|
|
||||||
- <code>-i</code> or <code>--interactive</code> specify that fish is to run in interactive mode
|
|
||||||
- <code>-l</code> or <code>--login</code> specify that fish is to run as a login shell
|
|
||||||
- <code>-n</code> or <code>--no-execute</code> do not execute any commands, only perform syntax checking
|
|
||||||
- <code>-p</code> or <code>--profile=PROFILE_FILE</code> when fish exits, output timing information on all executed commands to the specified file
|
|
||||||
- <code>-v</code> or <code>--version</code> display version and exit
|
|
||||||
|
|
||||||
The fish exit status is generally the exit status of the last
|
- `-c` or `--command=COMMANDS` evaluate the specified commands instead of reading from the commandline
|
||||||
foreground command. If fish is exiting because of a parse error, the
|
|
||||||
exit status is 127.
|
- `-d` or `--debug-level=DEBUG_LEVEL` specify the verbosity level of fish. A higher number means higher verbosity. The default level is 1.
|
||||||
|
|
||||||
|
- `-i` or `--interactive` specify that fish is to run in interactive mode
|
||||||
|
|
||||||
|
- `-l` or `--login` specify that fish is to run as a login shell
|
||||||
|
|
||||||
|
- `-n` or `--no-execute` do not execute any commands, only perform syntax checking
|
||||||
|
|
||||||
|
- `-p` or `--profile=PROFILE_FILE` when fish exits, output timing information on all executed commands to the specified file
|
||||||
|
|
||||||
|
- `-v` or `--version` display version and exit
|
||||||
|
|
||||||
|
The fish exit status is generally the exit status of the last foreground command. If fish is exiting because of a parse error, the exit status is 127.
|
||||||
|
|||||||
@@ -1,5 +1,18 @@
|
|||||||
\section fish_config fish_config - Start up the web-based configuration interface
|
\section fish_config fish_config - start the web-based configuration interface
|
||||||
|
|
||||||
\subsection fish_config-description Description
|
\subsection fish_config-description Description
|
||||||
|
|
||||||
This command starts up the web-based configuration interface, which allows you to edit your colors and view your functions, variables, and history.
|
`fish_config` starts the web-based configuration interface.
|
||||||
|
|
||||||
|
The web interface allows you to view your functions, variables and history, and to make changes to your prompt and color configuration.
|
||||||
|
|
||||||
|
`fish_config` starts a local web server and then opens a web browser window; when you have finished, close the browser window and then press the Enter key to terminate the configuration session.
|
||||||
|
|
||||||
|
`fish_config` optionally accepts name of the initial configuration tab. For e.g. `fish_config history` will start configuration interface with history tab.
|
||||||
|
|
||||||
|
If the `BROWSER` environment variable is set, it will be used as the name of the web browser to open instead of the system default.
|
||||||
|
|
||||||
|
|
||||||
|
\subsection fish_config-example Example
|
||||||
|
|
||||||
|
`fish_config` opens a new web browser window and allows you to configure certain fish settings.
|
||||||
|
|||||||
@@ -1,17 +1,20 @@
|
|||||||
\section fish_indent fish_indent - indenter and prettifier
|
\section fish_indent fish_indent - indenter and prettifier
|
||||||
|
|
||||||
\subsection fish_indent-synopsis Synopsis
|
\subsection fish_indent-synopsis Synopsis
|
||||||
<tt>fish_indent [options]</tt>
|
\fish{synopsis}
|
||||||
|
fish_indent [OPTIONS]
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection fish_indent-description Description
|
\subsection fish_indent-description Description
|
||||||
|
|
||||||
\c fish_indent is used to indent or otherwise prettify a piece of fish
|
`fish_indent` is used to indent a piece of fish code. `fish_indent` reads commands from standard input and outputs them to standard output.
|
||||||
code. \c fish_indent reads commands from standard input and outputs
|
|
||||||
them to standard output.
|
|
||||||
|
|
||||||
\c fish_indent understands the following options:
|
The following options are available:
|
||||||
|
|
||||||
- <tt>-h</tt> or <tt>--help</tt> displays this help message and then exits
|
- `-i` or `--no-indent` do not indent commands; only reformat to one job per line
|
||||||
- <tt>-i</tt> or <tt>--no-indent</tt> do not indent commands
|
|
||||||
- <tt>-v</tt> or <tt>--version</tt> displays the current fish version and then exits
|
|
||||||
|
|
||||||
|
- `-v` or `--version` displays the current fish version and then exits
|
||||||
|
|
||||||
|
- `--ansi` colorizes the output using ANSI escape sequences, appropriate for the current $TERM, using the colors defined in the environment (such as `$fish_color_command`).
|
||||||
|
|
||||||
|
- `--html` outputs HTML, which supports syntax highlighting if the appropriate CSS is defined. The CSS class names are the same as the variable names, such as `fish_color_command`
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
\section fish_pager fish_pager - internal command used by fish
|
|
||||||
|
|
||||||
\subsection fish_pager-description Description
|
|
||||||
|
|
||||||
This command is used internally by fish to display a list of
|
|
||||||
completions. It should not be used by other commands, as it's
|
|
||||||
interface is liable to change in the future.
|
|
||||||
|
|
||||||
@@ -1,26 +1,29 @@
|
|||||||
\section fish_prompt fish_prompt - define the apperance of the command line prompt
|
\section fish_prompt fish_prompt - define the appearance of the command line prompt
|
||||||
|
|
||||||
\subsection fish_prompt-synopsis Synopsis
|
\subsection fish_prompt-synopsis Synopsis
|
||||||
<pre>function fish_prompt
|
\fish{synopsis}
|
||||||
|
function fish_prompt
|
||||||
...
|
...
|
||||||
end</pre>
|
end
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection fish_prompt-description Description
|
\subsection fish_prompt-description Description
|
||||||
|
|
||||||
By defining the \c fish_prompt function, the user can choose a custom
|
By defining the `fish_prompt` function, the user can choose a custom prompt. The `fish_prompt` function is executed when the prompt is to be shown, and the output is used as a prompt.
|
||||||
prompt. The \c fish_prompt function is executed when the prompt is to
|
|
||||||
be shown, and the output is used as a prompt.
|
The exit status of commands within `fish_prompt` will not modify the value of <a href="index.html#variables-status">$status</a> outside of the `fish_prompt` function.
|
||||||
|
|
||||||
|
`fish` ships with a number of example prompts that can be chosen with the `fish_config` command.
|
||||||
|
|
||||||
Please keep in mind that the function is executed by <a
|
|
||||||
href='index.html#expand-command-substitution'>command substitution</a>, and so the exit status of commands within fish_prompt will not modify the <a href="index.html#variables-status">$status</a> seen outside of fish_prompt.
|
|
||||||
|
|
||||||
\subsection fish_prompt-example Example
|
\subsection fish_prompt-example Example
|
||||||
|
|
||||||
A simple prompt:
|
A simple prompt:
|
||||||
|
|
||||||
<pre>
|
\fish
|
||||||
function fish_prompt -d "Write out the prompt"
|
function fish_prompt -d "Write out the prompt"
|
||||||
printf '\%s\@\%s\%s\%s\%s> ' (whoami) (hostname|cut -d . -f 1) (set_color \$fish_color_cwd) (prompt_pwd) (set_color normal)
|
printf '%s@%s%s%s%s> ' (whoami) (hostname | cut -d . -f 1) \
|
||||||
|
(set_color $fish_color_cwd) (prompt_pwd) (set_color normal)
|
||||||
end
|
end
|
||||||
</pre>
|
\endfish
|
||||||
|
|
||||||
|
|||||||
@@ -1,23 +1,26 @@
|
|||||||
\section fish_right_prompt fish_right_prompt - define the apperance of the right-side command line prompt
|
\section fish_right_prompt fish_right_prompt - define the appearance of the right-side command line prompt
|
||||||
|
|
||||||
\subsection fish_right_prompt-synopsis Synopsis
|
\subsection fish_right_prompt-synopsis Synopsis
|
||||||
<pre>function fish_right_prompt
|
\fish{synopsis}
|
||||||
|
function fish_right_prompt
|
||||||
...
|
...
|
||||||
end</pre>
|
end
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection fish_right_prompt-description Description
|
\subsection fish_right_prompt-description Description
|
||||||
|
|
||||||
\c fish_right_prompt is similar to \c fish_prompt, except that it appears on the right side of the terminal window.
|
`fish_right_prompt` is similar to `fish_prompt`, except that it appears on the right side of the terminal window.
|
||||||
|
|
||||||
Multiple lines are not supported in \c fish_right_prompt.
|
Multiple lines are not supported in `fish_right_prompt`.
|
||||||
|
|
||||||
\subsection fish_prompt-example Example
|
|
||||||
|
\subsection fish_right_prompt-example Example
|
||||||
|
|
||||||
A simple right prompt:
|
A simple right prompt:
|
||||||
|
|
||||||
<pre>
|
\fish
|
||||||
function fish_right_prompt -d "Write out the right prompt"
|
function fish_right_prompt -d "Write out the right prompt"
|
||||||
date "+%m/%d/%y"
|
date "+%m/%d/%y"
|
||||||
end
|
end
|
||||||
</pre>
|
\endfish
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
\section fish_update_completions fish_update_completions - Update man-page completions
|
\section fish_update_completions fish_update_completions - Update completions using manual pages
|
||||||
|
|
||||||
\subsection fish_update_completions-description Description
|
\subsection fish_update_completions-description Description
|
||||||
|
|
||||||
This command parses your installed man pages and writes completion files to the fish config directory. This does not overwrite custom completions.
|
`fish_update_completions` parses manual pages installed on the system, and attempts to create completion files in the `fish` configuration directory.
|
||||||
|
|
||||||
|
This does not overwrite custom completions.
|
||||||
|
|
||||||
|
There are no parameters for `fish_update_completions`.
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
\section fishd fishd - universal variable daemon
|
|
||||||
|
|
||||||
\subsection fishd-synopsis Synopsis
|
|
||||||
<tt>fishd [(-h|--help|-v|--version)]</tt>
|
|
||||||
|
|
||||||
\subsection fishd-description Description
|
|
||||||
|
|
||||||
The \c fishd daemon is used to load, save and distribute universal
|
|
||||||
variable information. fish automatically connects to fishd via a socket
|
|
||||||
on startup. If no instance of fishd is running, fish spawns a new
|
|
||||||
fishd instance. fishd will create a socket in /tmp, and wait for
|
|
||||||
incoming connections from universal variable clients, such as fish,
|
|
||||||
When no clients are connected, fishd will automatically shut down.
|
|
||||||
|
|
||||||
- <tt>-h</tt> or <tt>--help</tt> displays this help message and then exits
|
|
||||||
- <tt>-v</tt> or <tt>--version</tt> displays the current fish version and then exits
|
|
||||||
|
|
||||||
\subsection fishd-files Files
|
|
||||||
|
|
||||||
\c ~/.config/fish/fishd.HOSTNAME permanent storage location for universal
|
|
||||||
variable data. The data is stored as a set of \c set and \c set_export
|
|
||||||
commands such as would be parsed by fishd. The file must always be
|
|
||||||
stored in ASCII format. If an instance of fishd is running (which is
|
|
||||||
generally the case), manual modifications to ~/.fishd.HOSTNAME will be
|
|
||||||
lost. Do NOT edit this file manually!
|
|
||||||
|
|
||||||
\c /tmp/fishd.socket.USERNAME the socket which fishd uses to communicate
|
|
||||||
with all clients.
|
|
||||||
|
|
||||||
/tmp/fishd.log.USERNAME the fishd log file
|
|
||||||
|
|
||||||
@@ -1,25 +1,21 @@
|
|||||||
\section for for - perform a set of commands multiple times.
|
\section for for - perform a set of commands multiple times.
|
||||||
|
|
||||||
\subsection for-synopsis Synopsis
|
\subsection for-synopsis Synopsis
|
||||||
<tt>for VARNAME in [VALUES...]; COMMANDS...; end</tt>
|
\fish{synopsis}
|
||||||
|
for VARNAME in [VALUES...]; COMMANDS...; end
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection for-description Description
|
\subsection for-description Description
|
||||||
<tt>for</tt> is a loop construct. It will perform the commands specified by
|
|
||||||
COMMANDS multiple times. Each time the environment variable specified by
|
`for` is a loop construct. It will perform the commands specified by `COMMANDS` multiple times. On each iteration, the local variable specified by `VARNAME` is assigned a new value from `VALUES`. If `VALUES` is empty, `COMMANDS` will not be executed at all.
|
||||||
VARNAME is assigned a new value from VALUES. If VALUES is empty, COMMANDS will
|
|
||||||
not be executed at all.
|
|
||||||
|
|
||||||
\subsection for-example Example
|
\subsection for-example Example
|
||||||
|
|
||||||
The command
|
\fish
|
||||||
|
for i in foo bar baz; echo $i; end
|
||||||
|
|
||||||
<tt>for i in foo bar baz; echo $i; end</tt>
|
# would output:
|
||||||
|
|
||||||
would output:
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
foo
|
foo
|
||||||
bar
|
bar
|
||||||
baz
|
baz
|
||||||
</pre>
|
\endfish
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,18 @@
|
|||||||
\section funced funced - edit a function interactively
|
\section funced funced - edit a function interactively
|
||||||
|
|
||||||
\subsection funced-synopsis Synopsis
|
\subsection funced-synopsis Synopsis
|
||||||
<code>funced [OPTIONS] NAME</code>
|
\fish{synopsis}
|
||||||
|
funced [OPTIONS] NAME
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection funced-description Description
|
\subsection funced-description Description
|
||||||
|
|
||||||
Use the funced command to edit the definition of a
|
`funced` provides an interface to edit the definition of the function `NAME`.
|
||||||
function. If there is no function with the name specified, a skeleton function is inserted, if a function exist, the definition will be shown in your editor or on the command line.
|
|
||||||
|
|
||||||
By default, funced edits functions using the text editor in your $EDITOR variable, if set; otherwise it uses the built-in editor.
|
If the `$EDITOR` environment variable is set, it will be used as the program to edit the function. Otherwise, a built-in editor will be used.
|
||||||
|
|
||||||
- <code>-e command</code> or <code>--editor command</code> Open the function body inside the text editor given by the command (for example, "vi"). The command 'fish' will use the built-in editor.
|
If there is no function called `NAME` a new function will be created with the specified name
|
||||||
- <code>-i</code> or <code>--interactive</code> Open function body in built-in editor.
|
|
||||||
|
- `-e command` or `--editor command` Open the function body inside the text editor given by the command (for example, "vi"). The command 'fish' will use the built-in editor.
|
||||||
|
|
||||||
|
- `-i` or `--interactive` Open function body in the built-in editor.
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
\section funcsave funcsave - save the definition of a function to the users autoload directory
|
\section funcsave funcsave - save the definition of a function to the user's autoload directory
|
||||||
|
|
||||||
\subsection funcsave-synopsis Synopsis
|
\subsection funcsave-synopsis Synopsis
|
||||||
<tt>funcsave FUNCTION_NAME</tt>
|
\fish{synopsis}
|
||||||
|
funcsave FUNCTION_NAME
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection funcsave-description Description
|
\subsection funcsave-description Description
|
||||||
|
|
||||||
funcsave is used to save the current definition of a function to
|
`funcsave` saves the current definition of a function to a file in the fish configuration directory. This function will be automatically loaded by current and future fish sessions. This can be useful if you have interactively created a new function and wish to save it for later use.
|
||||||
a file which will be autoloaded by current and future fish
|
|
||||||
sessions. This can be useful if you have interactively created a new
|
|
||||||
function and wish to save it for later use.
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,62 +1,93 @@
|
|||||||
\section function function - create a function
|
\section function function - create a function
|
||||||
|
|
||||||
\subsection function-synopsis Synopsis
|
\subsection function-synopsis Synopsis
|
||||||
<code>function [OPTIONS] NAME; BODY; end </code>
|
\fish{synopsis}
|
||||||
|
function [OPTIONS] NAME; BODY; end
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection function-description Description
|
\subsection function-description Description
|
||||||
|
|
||||||
- <code>-d DESCRIPTION</code> or \c --description=DESCRIPTION is a description of what the function does, suitable as a completion description
|
`function` creates a new function `NAME` with the body `BODY`.
|
||||||
- <code>-e</code> or <code>--on-event EVENT_NAME</code> tells fish to run this function when the specified named event is emitted. Fish internally generates named events e.g. when showing the prompt.
|
|
||||||
- <code>-j PID</code> or <code> --on-job-exit PID</code> tells fish to run this function when the job with group id PID exits. Instead of PID, the string 'caller' can be specified. This is only legal when in a command substitution, and will result in the handler being triggered by the exit of the job which created this command substitution.
|
|
||||||
- <code>-p PID</code> or <code> --on-process-exit PID</code> tells fish to run this function when the fish child process with process id PID exits
|
|
||||||
- <code>-s</code> or <code>--on-signal SIGSPEC</code> tells fish to run this function when the signal SIGSPEC is delivered. SIGSPEC can be a signal number, or the signal name, such as SIGHUP (or just HUP)
|
|
||||||
- <code>-v</code> or <code>--on-variable VARIABLE_NAME</code> tells fish to run this function when the variable VARIABLE_NAME changes value
|
|
||||||
|
|
||||||
This builtin command is used to create a new function. A function is a
|
A function is a list of commands that will be executed when the name of the function is given as a command.
|
||||||
list of commands that will be executed when the name of the function
|
|
||||||
is entered. The function
|
|
||||||
|
|
||||||
<pre>
|
The following options are available:
|
||||||
function hi
|
|
||||||
echo hello
|
|
||||||
end
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
will write <code>hello</code> whenever the user enters \c hi.
|
- `-a NAMES` or `--argument-names NAMES` assigns the value of successive command-line arguments to the names given in NAMES.
|
||||||
|
|
||||||
If the user enters any additional arguments after the function, they
|
- `-d DESCRIPTION` or `--description=DESCRIPTION` is a description of what the function does, suitable as a completion description.
|
||||||
are inserted into the environment <a href="index.html#variables-arrays">variable array</a> argv.
|
|
||||||
|
|
||||||
By using one of the event handler switches, a function can be made to run automatically at specific events. The user may generate new events using the <a href='#emit">emit</a> builtin. Fish generates the following named events:
|
- `-w WRAPPED_COMMAND` or `--wraps=WRAPPED_COMMAND` causes the function to inherit completions from the given wrapped command. See the documentation for <a href="#complete">`complete`</a> for more information.
|
||||||
|
|
||||||
|
- `-e` or `--on-event EVENT_NAME` tells fish to run this function when the specified named event is emitted. Fish internally generates named events e.g. when showing the prompt.
|
||||||
|
|
||||||
|
- `-v` or `--on-variable VARIABLE_NAME` tells fish to run this function when the variable VARIABLE_NAME changes value.
|
||||||
|
|
||||||
|
- `-j PGID` or `--on-job-exit PGID` tells fish to run this function when the job with group ID PGID exits. Instead of PGID, the string 'caller' can be specified. This is only legal when in a command substitution, and will result in the handler being triggered by the exit of the job which created this command substitution.
|
||||||
|
|
||||||
|
- `-p PID` or `--on-process-exit PID` tells fish to run this function when the fish child process with process ID PID exits.
|
||||||
|
|
||||||
|
- `-s` or `--on-signal SIGSPEC` tells fish to run this function when the signal SIGSPEC is delivered. SIGSPEC can be a signal number, or the signal name, such as SIGHUP (or just HUP).
|
||||||
|
|
||||||
|
- `-S` or `--no-scope-shadowing` allows the function to access the variables of calling functions. Normally, any variables inside the function that have the same name as variables from the calling function are "shadowed", and their contents is independent of the calling function.
|
||||||
|
|
||||||
|
- `-V` or `--inherit-variable NAME` snapshots the value of the variable `NAME` and defines a local variable with that same name and value when the function is executed.
|
||||||
|
|
||||||
|
If the user enters any additional arguments after the function, they are inserted into the environment <a href="index.html#variables-arrays">variable array</a> `$argv`. If the `--argument-names` option is provided, the arguments are also assigned to names specified in that option.
|
||||||
|
|
||||||
|
By using one of the event handler switches, a function can be made to run automatically at specific events. The user may generate new events using the <a href="#emit">emit</a> builtin. Fish generates the following named events:
|
||||||
|
|
||||||
|
- `fish_prompt`, which is emitted whenever a new fish prompt is about to be displayed.
|
||||||
|
|
||||||
|
- `fish_command_not_found`, which is emitted whenever a command lookup failed.
|
||||||
|
|
||||||
|
- `fish_preexec`, which is emitted right before executing an interactive command. The commandline is passed as the first parameter.
|
||||||
|
|
||||||
|
Note: This event will be emitted even if the command is invalid. The commandline parameter includes the entire commandline verbatim, and may potentially include newlines.
|
||||||
|
|
||||||
|
- `fish_postexec`, which is emitted right after executing an interactive command. The commandline is passed as the first parameter.
|
||||||
|
|
||||||
|
Note: This event will be emitted even if the command is invalid. The commandline parameter includes the entire commandline verbatim, and may potentially include newlines.
|
||||||
|
|
||||||
- \c fish_prompt, which is emitted whenever a new fish prompt is about to be displayed
|
|
||||||
- \c fish_command_not_found, which is emitted whenever a command lookup failed
|
|
||||||
|
|
||||||
\subsection function-example Example
|
\subsection function-example Example
|
||||||
|
|
||||||
<pre>
|
\fish
|
||||||
function ll
|
function ll
|
||||||
ls -l $argv
|
ls -l $argv
|
||||||
end
|
end
|
||||||
</pre>
|
\endfish
|
||||||
|
|
||||||
will run the \c ls command, using the \c -l option, while passing on any additional files and switches to \c ls.
|
will run the `ls` command, using the `-l` option, while passing on any additional files and switches to `ls`.
|
||||||
|
|
||||||
<pre>
|
\fish
|
||||||
function mkdir -d "Create a directory and set CWD"
|
function mkdir -d "Create a directory and set CWD"
|
||||||
mkdir $argv
|
command mkdir $argv
|
||||||
if test $status = 0
|
if test $status = 0
|
||||||
switch $argv[(count $argv)]
|
switch $argv[(count $argv)]
|
||||||
case '-*'
|
case '-*'
|
||||||
|
|
||||||
case '*'
|
case '*'
|
||||||
cd $argv[(count $argv)]
|
cd $argv[(count $argv)]
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
</pre>
|
\endfish
|
||||||
|
|
||||||
will run the mkdir command, and if it is successful, change the
|
This will run the `mkdir` command, and if it is successful, change the current working directory to the one just created.
|
||||||
current working directory to the one just created.
|
|
||||||
|
\fish
|
||||||
|
function notify
|
||||||
|
set -l job (jobs -l -g)
|
||||||
|
or begin; echo "There are no jobs" >&2; return 1; end
|
||||||
|
|
||||||
|
function _notify_job_$job --on-job-exit $job --inherit-variable job
|
||||||
|
echo -n \a # beep
|
||||||
|
functions -e _notify_job_$job
|
||||||
|
end
|
||||||
|
end
|
||||||
|
\endfish
|
||||||
|
|
||||||
|
This will beep when the most recent job completes.
|
||||||
|
|
||||||
|
|||||||
@@ -1,31 +1,52 @@
|
|||||||
\section functions functions - print or erase functions
|
\section functions functions - print or erase functions
|
||||||
|
|
||||||
\subsection function-synopsis Synopsis
|
\subsection functions-synopsis Synopsis
|
||||||
<code>functions [-e] FUNCTIONS...</code>
|
\fish{synopsis}
|
||||||
|
functions [ -a | --all ] [ -n | --names ]
|
||||||
|
functions -c OLDNAME NEWNAME
|
||||||
|
functions -d DESCRIPTION FUNCTION
|
||||||
|
functions [ -e | -q ] FUNCTIONS...
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection functions-description Description
|
\subsection functions-description Description
|
||||||
|
|
||||||
This builtin command is used to print or erase functions.
|
`functions` prints or erases functions.
|
||||||
|
|
||||||
- <code>-a</code> or <code>--all</code> list all functions, even those whose name start with an underscore.
|
The following options are available:
|
||||||
- <code>-c OLDNAME NEWNAME</code> or <code>--copy OLDNAME NEWNAME</code> creates a new function named NEWNAME, using the definition of the OLDNAME function.
|
|
||||||
- <code>-d DESCRIPTION</code> or <code>--description=DESCRIPTION</code> change the description of this function
|
|
||||||
- <code>-e</code> or <code>--erase</code> causes the specified functions to be erased.
|
|
||||||
- <code>-h</code> or <code>--help</code> display a help message and exit
|
|
||||||
- <code>-n</code> or <code>--names</code> list only the names of all defined functions, not their definition
|
|
||||||
- <code>-q</code> or <code>--query</code> test if the specified functions exist. Does not output anything, but the builtins exit status is the number of functions specified that were not defined.
|
|
||||||
|
|
||||||
The default behavior of \c functions when called with no arguments,
|
- `-a` or `--all` lists all functions, even those whose name start with an underscore.
|
||||||
is to print the names and definitions of all defined functions. If any
|
|
||||||
non-switch parameters are given, only the definition of the specified
|
|
||||||
functions are printed.
|
|
||||||
|
|
||||||
Automatically loaded functions can not be removed using functions
|
- `-c OLDNAME NEWNAME` or `--copy OLDNAME NEWNAME` creates a new function named NEWNAME, using the definition of the OLDNAME function.
|
||||||
-e. Either remove the definition file or change the
|
|
||||||
$fish_function_path variable to remove autoloaded functions.
|
|
||||||
|
|
||||||
Function copies, created with -c, will not have any event/signal/on-exit
|
- `-d DESCRIPTION` or `--description=DESCRIPTION` changes the description of this function.
|
||||||
notifications that the original may have had.
|
|
||||||
|
|
||||||
The exit status of the functions builtin is the number functions
|
- `-e` or `--erase` causes the specified functions to be erased.
|
||||||
specified in the argument list that do not exist.
|
|
||||||
|
- `-n` or `--names` lists the names of all defined functions.
|
||||||
|
|
||||||
|
- `-q` or `--query` tests if the specified functions exist.
|
||||||
|
|
||||||
|
The default behavior of `functions`, when called with no arguments, is to print the names of all defined functions. Unless the `-a` option is given, no functions starting with underscores are not included in the output.
|
||||||
|
|
||||||
|
If any non-option parameters are given, the definition of the specified functions are printed.
|
||||||
|
|
||||||
|
Automatically loaded functions cannot be removed using `functions -e`. Either remove the definition file or change the $fish_function_path variable to remove autoloaded functions.
|
||||||
|
|
||||||
|
Copying a function using `-c` copies only the body of the function, and does not attach any event notifications from the original function.
|
||||||
|
|
||||||
|
Only one function's description can be changed in a single invocation of `functions -d`.
|
||||||
|
|
||||||
|
The exit status of `functions` is the number of functions specified in the argument list that do not exist, which can be used in concert with the `-q` option.
|
||||||
|
|
||||||
|
|
||||||
|
\subsection functions-example Examples
|
||||||
|
\fish
|
||||||
|
functions -n
|
||||||
|
# Displays a list of currently-defined functions
|
||||||
|
|
||||||
|
functions -c foo bar
|
||||||
|
# Copies the 'foo' function to a new function called 'bar'
|
||||||
|
|
||||||
|
functions -e bar
|
||||||
|
# Erases the function `bar`
|
||||||
|
\endfish
|
||||||
|
|||||||
@@ -1,18 +1,21 @@
|
|||||||
\section help help - display fish documentation
|
\section help help - display fish documentation
|
||||||
|
|
||||||
\subsection help-synopsis Synopsis
|
\subsection help-synopsis Synopsis
|
||||||
<tt>help [SECTION]</tt>
|
\fish{synopsis}
|
||||||
|
help [SECTION]
|
||||||
|
\endfish
|
||||||
|
|
||||||
\subsection help-description Description
|
\subsection help-description Description
|
||||||
|
|
||||||
The \c help command is used to display a section of the fish help documentation.
|
`help` displays the fish help documentation.
|
||||||
|
|
||||||
If the BROWSER environment variable is set, it will be used to display the
|
If a `SECTION` is specified, the help for that command is shown.
|
||||||
documentation, otherwise fish will search for a suitable browser.
|
|
||||||
|
If the BROWSER environment variable is set, it will be used to display the documentation. Otherwise, fish will search for a suitable browser.
|
||||||
|
|
||||||
|
Note that most builtin commands display their help in the terminal when given the `--help` option.
|
||||||
|
|
||||||
Note also that most builtin commands display their help in the terminal when
|
|
||||||
given the <tt>--help</tt> option.
|
|
||||||
|
|
||||||
\subsection help-example Example
|
\subsection help-example Example
|
||||||
|
|
||||||
<tt>help fg</tt> shows the documentation for the \c fg builtin.
|
`help fg` shows the documentation for the `fg` builtin.
|
||||||
|
|||||||
@@ -1,36 +1,44 @@
|
|||||||
\section history history - Show and manipulate user's command history
|
\section history history - Show and manipulate command history
|
||||||
|
|
||||||
\subsection history-synopsis Synopsis
|
\subsection history-synopsis Synopsis
|
||||||
<pre>
|
\fish{synopsis}
|
||||||
history (--save | --clear)
|
history ( --merge | --save | --clear )
|
||||||
history (--search | --delete ) (--prefix "prefix string" | --contains "search string")
|
history ( --search | --delete ) [ --prefix "prefix string" | --contains "search string" ]
|
||||||
</pre>
|
\endfish
|
||||||
|
|
||||||
\subsection history-description Description
|
\subsection history-description Description
|
||||||
|
|
||||||
history is used to list, search and delete user's command history
|
`history` is used to list, search and delete the history of commands used.
|
||||||
|
|
||||||
|
The following options are available:
|
||||||
|
- `--merge` immediately incorporates history changes from other sessions. Ordinarily `fish` ignores history changes from sessions started after the current one. This command applies those changes immediately.
|
||||||
|
|
||||||
|
- `--save` saves all changes in the history file. The shell automatically saves the history file; this option is provided for internal use.
|
||||||
|
|
||||||
|
- `--clear` clears the history file. A prompt is displayed before the history is erased.
|
||||||
|
|
||||||
|
- `--search` returns history items in keeping with the `--prefix` or `--contains` options.
|
||||||
|
|
||||||
|
- `--delete` deletes history items.
|
||||||
|
|
||||||
|
- `--prefix` searches or deletes items in the history that begin with the specified text string.
|
||||||
|
|
||||||
|
- `--contains` searches or deletes items in the history that contain the specified text string.
|
||||||
|
|
||||||
|
If `--search` is specified without `--contains` or `--prefix`, `--contains` will be assumed.
|
||||||
|
|
||||||
|
If `--delete` is specified without `--contains` or `--prefix`, only a history item which exactly matches the parameter will be erased. No prompt will be given. If `--delete` is specified with either of these parameters, an interactive prompt will be displayed before any items are deleted.
|
||||||
|
|
||||||
|
|
||||||
\subsection history-examples Example
|
\subsection history-examples Example
|
||||||
|
|
||||||
<pre>
|
\fish
|
||||||
history --save
|
|
||||||
Save all changes in history file
|
|
||||||
|
|
||||||
history --clear
|
history --clear
|
||||||
Delete all history items
|
# Deletes all history items
|
||||||
|
|
||||||
history --search --contains "foo"
|
history --search --contains "foo"
|
||||||
Searches commands containing "foo" string
|
# Outputs a list of all previous commands containing the string "foo".
|
||||||
|
|
||||||
history --search --prefix "foo"
|
|
||||||
Searches for commands with prefix "foo"
|
|
||||||
|
|
||||||
history --delete --contains "foo"
|
|
||||||
Interactively delete commands containing string "foo"
|
|
||||||
|
|
||||||
history --delete --prefix "foo"
|
history --delete --prefix "foo"
|
||||||
Interactively delete commands with prefix "foo"
|
# Interactively deletes the record of previous commands which start with "foo".
|
||||||
|
\endfish
|
||||||
history --delete "foo"
|
|
||||||
Delete command "foo" from history
|
|
||||||
</pre>
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user