Compare commits
394 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c6718cf209 | ||
|
|
a88347069c | ||
|
|
35fb55aba2 | ||
|
|
c08368bd19 | ||
|
|
b4041d6821 | ||
|
|
95f3812db1 | ||
|
|
a27bd65057 | ||
|
|
bb50b305d5 | ||
|
|
7e8dd19a72 | ||
|
|
df13e3beef | ||
|
|
7dfec43f42 | ||
|
|
69a28122c1 | ||
|
|
76356bd05b | ||
|
|
82dc1c17f2 | ||
|
|
95e39e5f46 | ||
|
|
1e7f1ea1e8 | ||
|
|
6420d445c2 | ||
|
|
049e4a5db3 | ||
|
|
6b24856c2f | ||
|
|
c7b6ac5afe | ||
|
|
00d7798756 | ||
|
|
ce62e82a93 | ||
|
|
73cd1a5ded | ||
|
|
76f63ff58d | ||
|
|
22fac783f5 | ||
|
|
c53ab2a854 | ||
|
|
4d44d2de0e | ||
|
|
8bf9ba0c16 | ||
|
|
76fb3eccda | ||
|
|
b8c479a9e9 | ||
|
|
a6d26d04fd | ||
|
|
906257932f | ||
|
|
9ef3adbc1d | ||
|
|
819c7f0327 | ||
|
|
f56cc9e0e9 | ||
|
|
360093a652 | ||
|
|
86e851b4e7 | ||
|
|
2d140c2980 | ||
|
|
7d3817fb3e | ||
|
|
331e659e98 | ||
|
|
8aaf03000b | ||
|
|
ad1fd0d968 | ||
|
|
1536f8613d | ||
|
|
c41d428b41 | ||
|
|
8037fe076b | ||
|
|
94b975ce7c | ||
|
|
04419b9702 | ||
|
|
36dd87b1fb | ||
|
|
24f10c30c3 | ||
|
|
fd3039a8e7 | ||
|
|
fb8bf40efb | ||
|
|
aea4dabf59 | ||
|
|
300b87fda6 | ||
|
|
49c3f2406d | ||
|
|
576bf331ef | ||
|
|
d717d4bac6 | ||
|
|
0273829353 | ||
|
|
f708037715 | ||
|
|
a5dda84a07 | ||
|
|
0af8604ec9 | ||
|
|
ec721c8e80 | ||
|
|
2ad320926f | ||
|
|
962cc74620 | ||
|
|
25529074d3 | ||
|
|
f7b5d930a9 | ||
|
|
309fbcbddf | ||
|
|
4693864a78 | ||
|
|
01a6bf4f9a | ||
|
|
c8c69d5449 | ||
|
|
edab0cc0a5 | ||
|
|
72e51ab037 | ||
|
|
74912c6090 | ||
|
|
ebd0d7c859 | ||
|
|
0fb841a78a | ||
|
|
cff5558394 | ||
|
|
db357a1ece | ||
|
|
a539fce4ad | ||
|
|
d36715e8ac | ||
|
|
e1151561ad | ||
|
|
dbde9d7577 | ||
|
|
524534405b | ||
|
|
21ad762998 | ||
|
|
d350727726 | ||
|
|
91bc83a97a | ||
|
|
537a880856 | ||
|
|
85529b37c6 | ||
|
|
973a96be62 | ||
|
|
4e1a98c9c3 | ||
|
|
45eda52d7e | ||
|
|
74af3a7419 | ||
|
|
3b0729cf5d | ||
|
|
2b6c3018b0 | ||
|
|
452513750b | ||
|
|
a9a6ce09d6 | ||
|
|
7ea39efdbd | ||
|
|
d8974451f0 | ||
|
|
e65e639465 | ||
|
|
16eb518dcd | ||
|
|
498e13df30 | ||
|
|
ae064bf255 | ||
|
|
e7638ea75f | ||
|
|
ce1d7652f3 | ||
|
|
0675c2f355 | ||
|
|
18b583d55b | ||
|
|
9a527f5a17 | ||
|
|
684b19380e | ||
|
|
4a80fcff4e | ||
|
|
f521b60f52 | ||
|
|
28260475bb | ||
|
|
c21790d6d9 | ||
|
|
be26561620 | ||
|
|
b6a4b10daf | ||
|
|
8d911991a3 | ||
|
|
89bb93733a | ||
|
|
2c62b07d2b | ||
|
|
483ea32c75 | ||
|
|
c833d9e80f | ||
|
|
12e066f9d4 | ||
|
|
9d325a03d9 | ||
|
|
32e3b88e09 | ||
|
|
dd7cc7230e | ||
|
|
3aedb36e68 | ||
|
|
570ea8969b | ||
|
|
2ed225f78d | ||
|
|
48ae986730 | ||
|
|
d12fd4b1fb | ||
|
|
0aa2264687 | ||
|
|
2f0d03b4a2 | ||
|
|
228148b87a | ||
|
|
c372488179 | ||
|
|
8328fc2439 | ||
|
|
da141063e3 | ||
|
|
0d29555a13 | ||
|
|
c279a63100 | ||
|
|
5a8995a097 | ||
|
|
32613fa3f6 | ||
|
|
2e3aeae5bc | ||
|
|
32d19ce47c | ||
|
|
a9fcaa589a | ||
|
|
1b525e9ad6 | ||
|
|
4be15f0158 | ||
|
|
4178db0328 | ||
|
|
1dcf36a370 | ||
|
|
fa394047ba | ||
|
|
bcebe325f0 | ||
|
|
14bf80399f | ||
|
|
c7acf69cb2 | ||
|
|
684e7ebd37 | ||
|
|
8e4adcdac3 | ||
|
|
e608f94a6f | ||
|
|
fd462b164e | ||
|
|
837a02b256 | ||
|
|
d7fd200a6a | ||
|
|
36e363f525 | ||
|
|
1cadddd111 | ||
|
|
7097d7b6d2 | ||
|
|
1d43db879e | ||
|
|
97133f5963 | ||
|
|
fda18c3935 | ||
|
|
d4693cb0be | ||
|
|
021960dfb7 | ||
|
|
68a44a4905 | ||
|
|
f613ca78c6 | ||
|
|
94e7094cee | ||
|
|
1122c85e34 | ||
|
|
8d3e7f3217 | ||
|
|
9830d7500f | ||
|
|
71d0a1fab3 | ||
|
|
2c4c788477 | ||
|
|
5aa39834aa | ||
|
|
a849ab12ea | ||
|
|
0381c2199d | ||
|
|
4b741b9c7b | ||
|
|
d893fa946d | ||
|
|
e5b2f83031 | ||
|
|
d62b63492a | ||
|
|
b88234049d | ||
|
|
dc35cb8e16 | ||
|
|
0a25808f34 | ||
|
|
805547fed0 | ||
|
|
45108343c8 | ||
|
|
f38230ae6d | ||
|
|
9be546b2f3 | ||
|
|
604caf3d6c | ||
|
|
07d3febe1b | ||
|
|
e1e7cb250e | ||
|
|
edc1ea4c16 | ||
|
|
d7db0a6dbf | ||
|
|
5520e85ee4 | ||
|
|
a3370c4232 | ||
|
|
befb25a4e6 | ||
|
|
f70f0cf6bd | ||
|
|
44e7f82e0e | ||
|
|
0b047c561d | ||
|
|
ce991bb3ad | ||
|
|
fd1768a902 | ||
|
|
1576d537a6 | ||
|
|
7947544460 | ||
|
|
b977515bd7 | ||
|
|
aca5d04f42 | ||
|
|
6aec4b85e6 | ||
|
|
dc10ecbbd6 | ||
|
|
b6aa42864e | ||
|
|
bf3c93e268 | ||
|
|
c6908f28b7 | ||
|
|
58924035c8 | ||
|
|
2a464cb07d | ||
|
|
35557c555c | ||
|
|
221ebcdf70 | ||
|
|
da35251e98 | ||
|
|
a9cd41c42d | ||
|
|
37be3edebc | ||
|
|
5ae684fc81 | ||
|
|
d7f5ad9786 | ||
|
|
a619ae69bf | ||
|
|
8911e235ba | ||
|
|
ce364e2a57 | ||
|
|
ea43a1dbca | ||
|
|
b34c683f3f | ||
|
|
ba7b1681a2 | ||
|
|
588ca6b79e | ||
|
|
04e42a6bcc | ||
|
|
6a2877d399 | ||
|
|
81e157cd38 | ||
|
|
807681ac7e | ||
|
|
281e0563c6 | ||
|
|
95b7bdbdb0 | ||
|
|
24ae56cd4b | ||
|
|
60b942c64f | ||
|
|
b55e382dfc | ||
|
|
3af54d3ff5 | ||
|
|
37853fd4ce | ||
|
|
475a2a7410 | ||
|
|
a7c9364641 | ||
|
|
f5300af90a | ||
|
|
1044d74fd3 | ||
|
|
656dd9c7eb | ||
|
|
369732ff81 | ||
|
|
795a16b959 | ||
|
|
b7e5cf6538 | ||
|
|
d390dd8ea7 | ||
|
|
815cba87e5 | ||
|
|
cb34a67ea1 | ||
|
|
ee383dbd6c | ||
|
|
1bc9219beb | ||
|
|
00c2054780 | ||
|
|
250267777c | ||
|
|
be66a6b078 | ||
|
|
53809440f3 | ||
|
|
273d2ce2d5 | ||
|
|
c91696e6df | ||
|
|
d03216a1ac | ||
|
|
58f6d836d9 | ||
|
|
2897d2b8b8 | ||
|
|
0ee54d9fb2 | ||
|
|
1eadebe21f | ||
|
|
35961c4252 | ||
|
|
c2c5a51e52 | ||
|
|
66081d4e70 | ||
|
|
fdece4621f | ||
|
|
250613665f | ||
|
|
70bd6e0dcb | ||
|
|
41151ac50d | ||
|
|
3e3fab5a0f | ||
|
|
62187d9ced | ||
|
|
9da0831dbf | ||
|
|
e97c8d5918 | ||
|
|
9591ee5d0a | ||
|
|
760a2dc9b2 | ||
|
|
c53a92d973 | ||
|
|
d5be947021 | ||
|
|
f0b3009400 | ||
|
|
606dfda47a | ||
|
|
fa1497b38f | ||
|
|
6481c3fb2d | ||
|
|
f28f50e6b5 | ||
|
|
f8ddf31bfb | ||
|
|
9e45a47054 | ||
|
|
9b5bd42978 | ||
|
|
47162bc428 | ||
|
|
e190ff30f2 | ||
|
|
afb75f22b2 | ||
|
|
32559294e8 | ||
|
|
c2946fbe09 | ||
|
|
2a4ab6d29d | ||
|
|
76c4b33ef4 | ||
|
|
8213850df6 | ||
|
|
f427694400 | ||
|
|
18394ac621 | ||
|
|
d29146040b | ||
|
|
a593f538dd | ||
|
|
45cfbece4c | ||
|
|
895e65ce1a | ||
|
|
4dca76f2e9 | ||
|
|
82a8f91392 | ||
|
|
bc503c80db | ||
|
|
a5d8e54ab9 | ||
|
|
10dd6c7714 | ||
|
|
4e25410680 | ||
|
|
637f6e50c0 | ||
|
|
7776ef9149 | ||
|
|
8fa1976796 | ||
|
|
7127857924 | ||
|
|
b7cb6a38c8 | ||
|
|
b78649b664 | ||
|
|
95114c1bc4 | ||
|
|
133f7b16ea | ||
|
|
8bbd1eb89f | ||
|
|
f6cf4a7d7c | ||
|
|
13dfdb2493 | ||
|
|
699412175d | ||
|
|
3a420879d6 | ||
|
|
c1f630e914 | ||
|
|
5f34d6e3b0 | ||
|
|
25307257c9 | ||
|
|
bb7e2cbfad | ||
|
|
f5b256bb9f | ||
|
|
4dcd070cdf | ||
|
|
0362c58b37 | ||
|
|
99bede34e7 | ||
|
|
2dd7ed14bc | ||
|
|
f03c78b382 | ||
|
|
5dcba30395 | ||
|
|
7bf00de84f | ||
|
|
a3831ab2b8 | ||
|
|
f0b7dcaa99 | ||
|
|
9eff7465d9 | ||
|
|
da8fd8f894 | ||
|
|
5ffbec56f6 | ||
|
|
b23554fa25 | ||
|
|
1356a0a72d | ||
|
|
c97acfb2d6 | ||
|
|
14509a3aa2 | ||
|
|
7f47d42289 | ||
|
|
d91ab6e912 | ||
|
|
dc9c40a56d | ||
|
|
e0a9f50a64 | ||
|
|
298b975264 | ||
|
|
417b03a4c3 | ||
|
|
21cc550752 | ||
|
|
3bd9628b38 | ||
|
|
74ea836fcc | ||
|
|
8faf305d0c | ||
|
|
954b00de74 | ||
|
|
79c849a4a9 | ||
|
|
cb7ee0e491 | ||
|
|
aaad3af523 | ||
|
|
ec290f2385 | ||
|
|
27863665ca | ||
|
|
ba6fd42b3c | ||
|
|
e04970675f | ||
|
|
222feaa953 | ||
|
|
10187610f8 | ||
|
|
a9cebd8054 | ||
|
|
4d7c260270 | ||
|
|
f3fee5db91 | ||
|
|
21599f805b | ||
|
|
6954f05276 | ||
|
|
194c26f879 | ||
|
|
3364214200 | ||
|
|
c30fc242c3 | ||
|
|
66d60099a2 | ||
|
|
f9390afbd1 | ||
|
|
4f5335d93e | ||
|
|
653d614439 | ||
|
|
13f094e80e | ||
|
|
6d97d18fba | ||
|
|
b764eb6663 | ||
|
|
70047eef7d | ||
|
|
d995e9a762 | ||
|
|
9e74ade187 | ||
|
|
a1475aedd2 | ||
|
|
5b63eafd83 | ||
|
|
67fa8935aa | ||
|
|
b111f57082 | ||
|
|
023e9cda99 | ||
|
|
4654cd19bd | ||
|
|
2e6d0ca131 | ||
|
|
d8ce36e6e1 | ||
|
|
cccc511fef | ||
|
|
ffe575f509 | ||
|
|
aa4593124d | ||
|
|
8151ba5a1a | ||
|
|
4b376a4982 | ||
|
|
e1e0fd634b | ||
|
|
0f4a7dc53a | ||
|
|
e2a9e3c5fa | ||
|
|
db469d8666 | ||
|
|
8f711b8d6b | ||
|
|
d845193a1d | ||
|
|
53c3b47bf9 | ||
|
|
23f575628a | ||
|
|
723399a3a2 | ||
|
|
dbc3ec72e1 |
@@ -18,10 +18,7 @@ depcomp
|
||||
install-sh
|
||||
missing
|
||||
mkinstalldirs
|
||||
nano
|
||||
nano.info
|
||||
nano.spec
|
||||
stamp-h
|
||||
stamp-h.in
|
||||
stamp-h1
|
||||
texinfo.tex
|
||||
|
||||
13
AUTHORS
13
AUTHORS
@@ -4,7 +4,13 @@ editor. Please see the ChangeLog for specific changes by author.
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
Chris Allegretta <chrisa@asty.org>
|
||||
* Main program author and maintainer.
|
||||
* Original program author, stable series maintainer.
|
||||
|
||||
David Lawrence Ramsey <pooka_regent@sluggy.net>
|
||||
* Development series maintainer. Multiple buffer support,
|
||||
operating dir (-o) option, bug fixes for display routines,
|
||||
wrapping code, spelling fixes, const mode and various other
|
||||
fixes.
|
||||
|
||||
Jordi Mallach <jordi@sindominio.net>
|
||||
* Debian package maintainer, fellow bug squasher.
|
||||
@@ -25,11 +31,6 @@ Rocco Corsi <rocco.corsi@sympatico.ca>
|
||||
findnextstr and search-related functions, various display and
|
||||
file handling fixes.
|
||||
|
||||
David Lawrence Ramsey <pooka_regent@sluggy.net>
|
||||
* Multiple buffer support, operating dir (-o) option, bug fixes
|
||||
for display routines, wrapping code, spelling fixes, const
|
||||
mode and various other fixes.
|
||||
|
||||
David Benbennick <dbenbenn@math.cornell.edu>
|
||||
* Wrap and justify bugfixes/enhancements, new color syntax
|
||||
code, memleak fixes and other miscellaneous fixes.
|
||||
|
||||
29
Makefile.am
29
Makefile.am
@@ -1,36 +1,11 @@
|
||||
## $Id$
|
||||
AUTOMAKE_OPTIONS = gnu no-dependencies
|
||||
|
||||
DEFS= -DSYSCONFDIR=\"$(sysconfdir)\"
|
||||
SUBDIRS = doc m4 po src
|
||||
|
||||
bin_PROGRAMS = nano
|
||||
nano_SOURCES = color.c \
|
||||
cut.c \
|
||||
files.c \
|
||||
global.c \
|
||||
move.c \
|
||||
nano.c \
|
||||
nano.h \
|
||||
proto.h \
|
||||
rcfile.c \
|
||||
search.c \
|
||||
utils.c \
|
||||
winio.c
|
||||
|
||||
man_MANS = nano.1 nanorc.5
|
||||
nano_LDADD = @GLIB_LIBS@ @LIBINTL@
|
||||
|
||||
info_TEXINFOS = nano.texi
|
||||
MAKEINFO = makeinfo --no-split
|
||||
|
||||
EXTRA_DIST = ABOUT-NLS AUTHORS BUGS COPYING ChangeLog INSTALL NEWS \
|
||||
README THANKS TODO UPGRADE config.rpath install-sh missing \
|
||||
mkinstalldirs nano.1.html nanorc.5.html faq.html \
|
||||
nanorc.sample nano.spec $(man_MANS)
|
||||
|
||||
SUBDIRS = po m4
|
||||
|
||||
localedir = $(datadir)/locale
|
||||
INCLUDES = -Iintl -DLOCALEDIR=\"$(localedir)\" -I@includedir@
|
||||
mkinstalldirs nano.spec
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
68
README
68
README
@@ -7,19 +7,20 @@ Overview
|
||||
wonderfully easy-to-use and friendly Pico text editor.
|
||||
|
||||
First and foremost is its license: the Pine suite does not use the
|
||||
GPL or a GPL-friendly license, and has unclear restrictions on
|
||||
redistribution. Because of this, Pine and Pico are not included with
|
||||
many GNU/Linux distributions. Also, other features (like goto line
|
||||
number or search and replace) were unavailable until recently or
|
||||
require a command line flag. Yuck.
|
||||
GPL or a GPL-friendly license, and has unclear restrictions on
|
||||
redistribution. Because of this, Pine and Pico are not included
|
||||
with many GNU/Linux distributions. Also, other features (like goto
|
||||
line number or search and replace) were unavailable until recently
|
||||
or require a command line flag. Yuck.
|
||||
|
||||
nano aims to solve these problems by emulating the functionality of
|
||||
Pico as closely as possible while addressing the problems above and
|
||||
perhaps providing other extra functionality.
|
||||
|
||||
The nano editor is now an official GNU package. For more information
|
||||
on GNU and the Free Software Foundation please see http://www.gnu.org.
|
||||
|
||||
The nano editor is now an official GNU package. For more
|
||||
information on GNU and the Free Software Foundation please see
|
||||
http://www.gnu.org.
|
||||
|
||||
How to compile and install nano
|
||||
|
||||
Download the nano source code, then:
|
||||
@@ -28,60 +29,41 @@ How to compile and install nano
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
It's that simple. Use --prefix with configure to override the
|
||||
|
||||
It's that simple. Use --prefix with configure to override the
|
||||
default installation directory of /usr/local.
|
||||
|
||||
|
||||
Web Page
|
||||
|
||||
http://www.nano-editor.org
|
||||
|
||||
|
||||
Mailing List and Bug Reports
|
||||
|
||||
Savannah hosts all the nano-related mailing-lists.
|
||||
|
||||
+ info-nano@gnu.org is a very low traffic list
|
||||
used to announce new Nano versions or other important information
|
||||
about the project.
|
||||
used to announce new nano versions or other important
|
||||
information about the project.
|
||||
+ help-nano@gnu.org is for those seeking to get help without
|
||||
wanting to hear about the technical details of its
|
||||
development.
|
||||
+ nano-devel@gnu.org is the list used by the people
|
||||
that make Nano and a general development discussion list, with
|
||||
that make nano and a general development discussion list, with
|
||||
moderate traffic.
|
||||
To subscribe, send email to nano-<name>-request@gnu.org
|
||||
with a subject of "subscribe", where <name> is the list you want to
|
||||
|
||||
To subscribe, send email to nano-<name>-request@gnu.org with a
|
||||
subject of "subscribe", where <name> is the list you want to
|
||||
subscribe to.
|
||||
|
||||
For general bug reports, send a description of the problem to
|
||||
nano@nano-editor.org or directly to the development list.
|
||||
|
||||
Current Status
|
||||
|
||||
This is the 1.1 or unstable branch of nano. New features
|
||||
will be added and things will be changed around and basically
|
||||
stability is not guaranteed. If this is not what you're
|
||||
interested in, please use the latest 1.0.x release of nano.
|
||||
|
||||
New features in this branch include:
|
||||
+ .nanorc file support (--enable-nanorc configure option,
|
||||
see sample.nanorc file)
|
||||
+ Negative -r value for "#cols from right", allows dynamic adjustment
|
||||
of wrap margin based on window size.
|
||||
+ Write marked text to separate file (^O after selecting with ^^).
|
||||
+ Append to file (Meta-A at write file menu).
|
||||
+ Multiple file buffers! (--enable-multibuffer configure option,
|
||||
--multibuffer, -F cmdline flag, Meta-F toggle, then ^R to load).
|
||||
+ Better compatibility with Pico. Mouse mode now supports clicking
|
||||
shortcuts and files in browser, search toggles that are Pico
|
||||
extensions moved to Meta keys so as to not interfere with Pico
|
||||
control sequences.
|
||||
+ Smooth scrolling through files, instead of the jerky half-page
|
||||
down, half-page up method. This is available by using the
|
||||
-S or --smooth switch, or the Meta-S toggle.
|
||||
+ Better non-*nix file support. GNU nano now automatically
|
||||
converts files from DOS format or Mac format to standard file
|
||||
format. It can also write files in either format by using the
|
||||
appropriate command line (-D, --dos or -M, --mac) or toggle
|
||||
(Meta-D, Meta-O).
|
||||
GNU nano has reached its second major milestone, 1.2.x.
|
||||
Development of new features will continue in the 1.3.x branch,
|
||||
while 1.2.x versions will be dedicated to bugfixing and
|
||||
polishing.
|
||||
|
||||
Chris Allegretta (chrisa@asty.org)
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ more care than the official stable and unstable tarballs.
|
||||
To successfully compile GNU nano from CVS, you'll need the
|
||||
following packages:
|
||||
|
||||
- autoconf (version >= 2.52)
|
||||
- automake (version >= 1.6, 1.7.x recommended)
|
||||
- autoconf (version >= 2.54)
|
||||
- automake (version >= 1.7)
|
||||
- gettext (version >= 0.11.5)
|
||||
- texinfo
|
||||
- cvs
|
||||
|
||||
6
THANKS
6
THANKS
@@ -2,13 +2,16 @@ The following people have helped GNU nano in some way or another.
|
||||
If we missed you here, let us know!
|
||||
|
||||
Sharuzzaman Ahmat Raslan <sharuzzaman@excite.com>
|
||||
Bahasa Melayu translator
|
||||
Malay translator
|
||||
Laurentiu Buzdugan <buzdugan@voyager.net> Romanian translator
|
||||
CHAO Wei-Lun <chaoweilun@pcmail.com.tw> Traditional Chinese translator
|
||||
Ricardo Cárdenes Medina <ricardo@conisys.com> Spanish translator
|
||||
Marco Colombo <magicdice@inwind.it> Italian translator
|
||||
Karl Eichwalder <keichwa@gmx.net> German translator
|
||||
Doruk Fisek <dfisek@fisek.com.tr> Turkish translator
|
||||
Jean-Philippe Guérard <jean-philippe.guerard@laposte.net>
|
||||
French translator
|
||||
Geir Helland Norwegian bokmål translator
|
||||
Tedi Heriyanto <tedi_h@gmx.net> Indonesian translator
|
||||
Václav Haisman <V.Haisman@sh.cvut.cz> Czech translator
|
||||
Szabolcs Horvath <horvaths@janus.gimsz.sulinet.hu>
|
||||
@@ -26,6 +29,7 @@ Sergey A. Ribalchenko <fisher@obu.ck.ua> Russian, Ukrainian translator
|
||||
Michel Robitaille <robitail@IRO.UMontreal.CA> French translator
|
||||
Christian Rose <menthos@menthos.com> Swedish translator
|
||||
Stig E Sandoe <stig@ii.uib.no> Norwegian bokmål translator
|
||||
Danilo Segan <dsegan@gmx.net> Serbian translator
|
||||
Keld Simonsen <keld@dkuug.dk> Danish translator
|
||||
Guus Sliepen <guus@nl.linux.org> Dutch translator
|
||||
Cezary Sliwa <sliwa@cft.edu.pl> Polish translator
|
||||
|
||||
43
TODO
43
TODO
@@ -1,34 +1,41 @@
|
||||
TODO file (? means the feature may be implemented, but not definitely)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
For version 1.4:
|
||||
- UTF-8 support.
|
||||
- Support for paragraph searches. [DONE]
|
||||
- Support for justifying the entire file at once. [DONE]
|
||||
- Support for filename searches in the file browser.
|
||||
- Undo/Redo key?
|
||||
- Rebindable keys?
|
||||
- Keystroke to implement "Add next sequence as raw" like vi's ^V.
|
||||
[DONE for edit window, needs to be done for statusbar prompt]
|
||||
- Spell check selected text only. [DONE]
|
||||
- Make "To line" (^W^T) and "Read from Command" (^R^X) re-enter their
|
||||
parent menu when their keystroke is entered a second time (^W^T^T and
|
||||
(^R^X^X)(requires figuring out when to keep cursor pos and when not
|
||||
to).
|
||||
- Fix resetstatuspos global which we shouldn't have.
|
||||
- Rewrite the nano FAQ in SGML.
|
||||
|
||||
Old requests:
|
||||
|
||||
For version 1.2:
|
||||
- Single line scroll up/down? [DONE]
|
||||
- Color syntax highlighting? (certainly seems like there's a demand for it.)
|
||||
- Color syntax highlighting? (certainly seems like there's a demand for
|
||||
it.) [DONE]
|
||||
- .nanorc [DONE]
|
||||
- Backup making (filename~)? [DONE]
|
||||
- Search (etc.) string history [DONE]
|
||||
- Implement Pico's -j and -g flags, as they are pretty easy to do. [DONE]
|
||||
- Implement Pico's -j and -g flags, as they are pretty easy to do.
|
||||
[DONE]
|
||||
- Make mouse support work with clicking on the shortcuts (-m). Must
|
||||
make global variable pointing to current shortcut list to determine what
|
||||
keystroke to ungetch(). [DONE].
|
||||
make global variable pointing to current shortcut list to determine
|
||||
what keystroke to ungetch(). [DONE].
|
||||
- Implement -o (chroot of sorts) [DONE]
|
||||
- Allow -r to take a negative argument, meaning right margin instead of
|
||||
left (allows resizing that way), formerly -W arg. [DONE]
|
||||
|
||||
For version 1.4:
|
||||
- UTF-8 support.
|
||||
- Support for Pico's paragraph searching ability.
|
||||
- Undo/Redo key?
|
||||
- Remindable keys?
|
||||
- Keystroke to implement "Add next sequence as raw" like vi's ^V.
|
||||
- Spell check selected text only.
|
||||
- Make "To line" (^W^T) and "Read from Command" (^R^X) re-enter their
|
||||
parent menu when their keystroke is entered a second time (^W^T^T and
|
||||
(^R^X^X)(requires figuring out when to keep cursor pos and when not to).
|
||||
- Fix resetstatuspos global which we shouldn't have.
|
||||
|
||||
Old requests:
|
||||
|
||||
For version 1.0:
|
||||
- Implement Spelling [DONE]
|
||||
- Implement Help [DONE]
|
||||
|
||||
2
UPGRADE
2
UPGRADE
@@ -6,7 +6,7 @@ Visible changes since 1.0
|
||||
* Editor Features
|
||||
- Complete Pico compatibility (--pico has been removed, and -p means
|
||||
something else, see below).
|
||||
- nanorc support.
|
||||
- nanorc support (see nanorc.sample included in sources).
|
||||
- Smooth scrolling (-S).
|
||||
- Searching of matching brace/bracket/etc.
|
||||
- Help for all editor features.
|
||||
|
||||
@@ -125,7 +125,7 @@ if test "$with_gnu_ld" = yes; then
|
||||
ld_shlibs=no
|
||||
;;
|
||||
beos*)
|
||||
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
|
||||
if $LD --help 2>&1 | grep -E ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
@@ -137,9 +137,9 @@ if test "$with_gnu_ld" = yes; then
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
;;
|
||||
solaris* | sysv5*)
|
||||
if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
|
||||
if $LD -v 2>&1 | grep -E 'BFD 2\.8' > /dev/null; then
|
||||
ld_shlibs=no
|
||||
elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
|
||||
elif $LD --help 2>&1 | grep -E ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
@@ -149,7 +149,7 @@ if test "$with_gnu_ld" = yes; then
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
*)
|
||||
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
|
||||
if $LD --help 2>&1 | grep -E ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
|
||||
107
configure.ac
107
configure.ac
@@ -2,32 +2,34 @@
|
||||
#
|
||||
# Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
#
|
||||
# GNU Nano is free software; you can redistribute it and/or modify
|
||||
# GNU nano 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.
|
||||
#
|
||||
# GNU Nano is distributed in the hope that it will be useful,
|
||||
# GNU nano 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 GNU Nano; if not, write to the Free Software
|
||||
# along with GNU nano; if not, write to the Free Software
|
||||
# Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# $Id$
|
||||
|
||||
AC_INIT([GNU Nano], [1.2.0], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([nano.c])
|
||||
AC_INIT([GNU nano], [1.3.4], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([src/nano.c])
|
||||
AM_INIT_AUTOMAKE
|
||||
AM_CONFIG_HEADER([config.h:config.h.in])
|
||||
|
||||
AC_PREREQ(2.52)
|
||||
AC_PREREQ(2.54)
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_GNU_SOURCE
|
||||
AC_PROG_CC
|
||||
AC_PROG_LN_S
|
||||
AC_ISC_POSIX
|
||||
AC_SYS_LARGEFILE
|
||||
|
||||
@@ -38,12 +40,31 @@ AM_GNU_GETTEXT([external], [need-ngettext])
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(fcntl.h getopt.h libintl.h limits.h regex.h termio.h termios.h unistd.h)
|
||||
AC_CHECK_HEADER(regex.h,
|
||||
AC_MSG_CHECKING([for broken regexec])
|
||||
AC_TRY_RUN([
|
||||
#include <sys/types.h>
|
||||
#include <regex.h>
|
||||
int main(void)
|
||||
{
|
||||
regex_t reg;
|
||||
size_t n = 1;
|
||||
regmatch_t r;
|
||||
regcomp(®, "\\<", 0);
|
||||
regexec(®, "", n, &r, 0);
|
||||
regfree(®);
|
||||
return 0;
|
||||
}],
|
||||
AC_MSG_RESULT(no),
|
||||
AC_MSG_RESULT(yes); AC_DEFINE(BROKEN_REGEXEC, 1, [Define this if your regexec() function segfaults when passed an empty string under certain conditions.])
|
||||
)
|
||||
)
|
||||
|
||||
dnl options
|
||||
AC_ARG_ENABLE(debug,
|
||||
[ --enable-debug Enable debugging (disabled by default)],
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(DEBUG, 1, [Define this to enable nano debug messages and assert warnings.])
|
||||
AC_DEFINE(DEBUG, 1, [Define this to enable nano debug messages and assert warnings.])
|
||||
debug_support=yes
|
||||
fi])
|
||||
|
||||
@@ -125,7 +146,6 @@ AC_ARG_ENABLE(wrapping-as-root,
|
||||
AC_DEFINE(DISABLE_ROOTWRAP, 1, [Define this to disable wrapping as root by default.])
|
||||
fi])
|
||||
|
||||
|
||||
AC_ARG_ENABLE(color,
|
||||
[ --enable-color Enable color and syntax highlighting],
|
||||
[if test x$enableval = xyes; then
|
||||
@@ -190,9 +210,12 @@ AC_ARG_WITH(slang,
|
||||
_libs=$LIBS
|
||||
LIBS="$LIBS -lslang"
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <slcurses.h>
|
||||
int main () { SLtt_initialize (NULL); return 0; }],
|
||||
int main(void)
|
||||
{
|
||||
SLtt_initialize(NULL);
|
||||
return 0;
|
||||
}],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
|
||||
slang_support=yes
|
||||
@@ -212,9 +235,12 @@ int main () { SLtt_initialize (NULL); return 0; }],
|
||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap])
|
||||
LIBS="$LIBS $tcap"
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <slcurses.h>
|
||||
int main () { SLtt_initialize (NULL); return 0; }],
|
||||
int main(void)
|
||||
{
|
||||
SLtt_initialize(NULL);
|
||||
return 0;
|
||||
}],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
|
||||
slang_support=yes
|
||||
@@ -229,9 +255,12 @@ int main () { SLtt_initialize (NULL); return 0; }],
|
||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap -lm])
|
||||
LIBS="$LIBS -lm"
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <slcurses.h>
|
||||
int main () { SLtt_initialize (NULL); return 0; }],
|
||||
int main(void)
|
||||
{
|
||||
SLtt_initialize(NULL);
|
||||
return 0;
|
||||
}],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
|
||||
slang_support=yes
|
||||
@@ -261,17 +290,16 @@ AC_MSG_WARN([*** Can not use slang when cross-compiling])),
|
||||
esac], [AC_MSG_RESULT(no)])
|
||||
|
||||
dnl Checks for functions
|
||||
AC_CHECK_FUNCS(snprintf vsnprintf strcasecmp strncasecmp)
|
||||
AC_CHECK_FUNCS(snprintf vsnprintf isblank strcasecmp strncasecmp strcasestr strnlen getline getdelim)
|
||||
if test "x$ac_cv_func_snprintf" = "xno" -o "xac_cv_func_vsnprintf" = "xno"
|
||||
then
|
||||
AM_PATH_GLIB(1.2.4,,
|
||||
[AC_MSG_ERROR([
|
||||
AM_PATH_GLIB_2_0(2.0.0,,
|
||||
[AM_PATH_GLIB(1.2.4,,
|
||||
[AC_MSG_ERROR([
|
||||
*** snprintf() and/or vsnprintf() not found. GLIB not found either.
|
||||
*** You need both snprintf() and vsnprintf(). Alternatively you can
|
||||
*** install the GLIB library which can be found at ftp://ftp.gtk.org/.])],
|
||||
glib)
|
||||
glib_cflags=`$GLIB_CONFIG --cflags glib`
|
||||
glib_libs=`$GLIB_CONFIG --libs glib`
|
||||
glib)])
|
||||
fi
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
@@ -318,24 +346,6 @@ fi
|
||||
|
||||
|
||||
AC_CHECK_LIB([$CURSES_LIB_NAME], use_default_colors, AC_DEFINE(HAVE_USE_DEFAULT_COLORS, 1, [Define this if your curses library has the use_default_colors command.]))
|
||||
if test x$slang_support != xyes; then
|
||||
AC_CHECK_LIB([$CURSES_LIB_NAME], wresize, AC_DEFINE(HAVE_WRESIZE, 1, [Define this if you have the wresize function in your ncurses-type library.]))
|
||||
AC_CHECK_LIB([$CURSES_LIB_NAME], resizeterm, AC_DEFINE(HAVE_RESIZETERM, 1, [Define this if you have the resizeterm function in your ncurses-type library.]))
|
||||
|
||||
# Taken from aumix (can't tell from the variable name?)
|
||||
AC_CACHE_CHECK([for private member _use_keypad in WINDOW],
|
||||
aumix_cv_struct_window_usekeypad,
|
||||
[AC_TRY_COMPILE([#ifdef HAVE_NCURSES_H
|
||||
#include <ncurses.h>
|
||||
#else
|
||||
#include <curses.h>
|
||||
#endif], [WINDOW w; w._use_keypad;],
|
||||
aumix_cv_struct_window_usekeypad=yes, aumix_cv_struct_window_usekeypad=no)])
|
||||
|
||||
if test $aumix_cv_struct_window_usekeypad = yes; then
|
||||
AC_DEFINE(HAVE_USEKEYPAD, 1, [Define this if your curses lib has the _use_keypad flag.])
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Parse any configure options
|
||||
|
||||
@@ -343,14 +353,25 @@ LIBS="$LIBS $CURSES_LIB"
|
||||
|
||||
AC_SUBST(CURSES_LIB)
|
||||
|
||||
if test "x$glib_cflags" != "x"
|
||||
if test "x$GLIB_CFLAGS" != "x"
|
||||
then
|
||||
CFLAGS="$CFLAGS $glib_cflags"
|
||||
CFLAGS="$CFLAGS $GLIB_CFLAGS"
|
||||
fi
|
||||
if test "x$glib_libs" != "x"
|
||||
if test "x$GLIB_LIBS" != "x"
|
||||
then
|
||||
LDFLAGS="$LDFLAGS $glib_libs"
|
||||
LDFLAGS="$LDFLAGS $GLIB_LIBS"
|
||||
fi
|
||||
|
||||
AC_CONFIG_FILES([Makefile m4/Makefile po/Makefile.in nano.spec])
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
doc/Makefile
|
||||
doc/man/Makefile
|
||||
doc/man/fr/Makefile
|
||||
doc/texinfo/Makefile
|
||||
m4/Makefile
|
||||
po/Makefile.in
|
||||
src/Makefile
|
||||
nano.spec
|
||||
])
|
||||
|
||||
AC_OUTPUT
|
||||
|
||||
469
cut.c
469
cut.c
@@ -1,469 +0,0 @@
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* cut.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2003 Chris Allegretta *
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
static int marked_cut; /* Is the cutbuffer from a mark? */
|
||||
static filestruct *cutbottom = NULL;
|
||||
/* Pointer to end of cutbuffer */
|
||||
|
||||
filestruct *get_cutbottom(void)
|
||||
{
|
||||
return cutbottom;
|
||||
}
|
||||
|
||||
void add_to_cutbuffer(filestruct *inptr)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("add_to_cutbuffer() called with inptr->data = %s\n"),
|
||||
inptr->data);
|
||||
#endif
|
||||
|
||||
if (cutbuffer == NULL) {
|
||||
cutbuffer = inptr;
|
||||
inptr->prev = NULL;
|
||||
} else {
|
||||
cutbottom->next = inptr;
|
||||
inptr->prev = cutbottom;
|
||||
}
|
||||
|
||||
inptr->next = NULL;
|
||||
cutbottom = inptr;
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* Cut a marked segment instead of a whole line.
|
||||
*
|
||||
* The first cut character is top->data[top_x]. Unless top == bot, the
|
||||
* last cut line has length bot_x. That is, if bot_x > 0 then we cut to
|
||||
* bot->data[bot_x - 1].
|
||||
*
|
||||
* destructive is whether to actually modify the file structure, if not
|
||||
* then just copy the buffer into cutbuffer and don't pull it from the
|
||||
* file.
|
||||
*
|
||||
* If destructive, then we maintain totsize, totlines, filebot, the
|
||||
* magic line, and line numbers. Also, we set current and current_x so
|
||||
* the cursor will be on the first character after what was cut. We do
|
||||
* not do any screen updates. */
|
||||
void cut_marked_segment(filestruct *top, size_t top_x, filestruct *bot,
|
||||
size_t bot_x, int destructive)
|
||||
{
|
||||
filestruct *tmp, *next;
|
||||
size_t newsize;
|
||||
|
||||
if (top == bot && top_x == bot_x)
|
||||
return;
|
||||
assert(top != NULL && bot != NULL);
|
||||
|
||||
/* Make top be no later than bot. */
|
||||
if (top->lineno > bot->lineno) {
|
||||
filestruct *swap = top;
|
||||
int swap2 = top_x;
|
||||
|
||||
top = bot;
|
||||
bot = swap;
|
||||
|
||||
top_x = bot_x;
|
||||
bot_x = swap2;
|
||||
} else if (top == bot && top_x > bot_x) {
|
||||
/* And bot_x can't be an earlier character than top_x. */
|
||||
int swap = top_x;
|
||||
|
||||
top_x = bot_x;
|
||||
bot_x = swap;
|
||||
}
|
||||
|
||||
/* Make the first cut line manually. */
|
||||
tmp = copy_node(top);
|
||||
newsize = (top == bot ? bot_x - top_x : strlen(top->data + top_x));
|
||||
memmove(tmp->data, top->data + top_x, newsize);
|
||||
null_at(&tmp->data, newsize);
|
||||
add_to_cutbuffer(tmp);
|
||||
|
||||
/* And make the remainder line manually too. */
|
||||
if (destructive) {
|
||||
current_x = top_x;
|
||||
totsize -= newsize;
|
||||
totlines -= bot->lineno - top->lineno;
|
||||
|
||||
newsize = top_x + strlen(bot->data + bot_x) + 1;
|
||||
if (top == bot) {
|
||||
/* In this case, the remainder line is shorter, so we must
|
||||
move text from the end forward first. */
|
||||
memmove(top->data + top_x, bot->data + bot_x,
|
||||
newsize - top_x);
|
||||
top->data = (char *)nrealloc(top->data,
|
||||
sizeof(char) * newsize);
|
||||
} else {
|
||||
totsize -= bot_x + 1;
|
||||
|
||||
/* Here, the remainder line might get longer, so we
|
||||
realloc() it first. */
|
||||
top->data = (char *)nrealloc(top->data,
|
||||
sizeof(char) * newsize);
|
||||
memmove(top->data + top_x, bot->data + bot_x,
|
||||
newsize - top_x);
|
||||
}
|
||||
}
|
||||
|
||||
if (top == bot) {
|
||||
#ifdef DEBUG
|
||||
dump_buffer(cutbuffer);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
tmp = top->next;
|
||||
while (tmp != bot) {
|
||||
next = tmp->next;
|
||||
if (!destructive)
|
||||
tmp = copy_node(tmp);
|
||||
else
|
||||
totsize -= strlen(tmp->data) + 1;
|
||||
add_to_cutbuffer(tmp);
|
||||
tmp = next;
|
||||
}
|
||||
|
||||
/* Make the last cut line manually. */
|
||||
tmp = copy_node(bot);
|
||||
null_at(&tmp->data, bot_x);
|
||||
add_to_cutbuffer(tmp);
|
||||
#ifdef DEBUG
|
||||
dump_buffer(cutbuffer);
|
||||
#endif
|
||||
|
||||
if (destructive) {
|
||||
top->next = bot->next;
|
||||
if (top->next != NULL)
|
||||
top->next->prev = top;
|
||||
delete_node(bot);
|
||||
renumber(top);
|
||||
current = top;
|
||||
if (bot == filebot) {
|
||||
filebot = top;
|
||||
assert(bot_x == 0);
|
||||
if (top_x > 0)
|
||||
new_magicline();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int do_cut_text(void)
|
||||
{
|
||||
filestruct *fileptr;
|
||||
#ifndef NANO_SMALL
|
||||
int dontupdate = 0;
|
||||
#endif
|
||||
|
||||
assert(current != NULL && current->data != NULL);
|
||||
|
||||
check_statblank();
|
||||
|
||||
if (!ISSET(KEEP_CUTBUFFER)) {
|
||||
free_filestruct(cutbuffer);
|
||||
cutbuffer = NULL;
|
||||
marked_cut = 0;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("Blew away cutbuffer =)\n"));
|
||||
#endif
|
||||
}
|
||||
|
||||
/* You can't cut the magic line except with the mark. But
|
||||
trying does clear the cutbuffer if KEEP_CUTBUFFER is not set. */
|
||||
if (current == filebot
|
||||
#ifndef NANO_SMALL
|
||||
&& !ISSET(MARK_ISSET)
|
||||
#endif
|
||||
)
|
||||
return 0;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(CUT_TO_END) && !ISSET(MARK_ISSET)) {
|
||||
assert(current_x >= 0 && current_x <= strlen(current->data));
|
||||
|
||||
if (current->data[current_x] == '\0') {
|
||||
/* If the line is empty and we didn't just cut a non-blank
|
||||
line, create a dummy line and add it to the cutbuffer */
|
||||
if (marked_cut != 1 && current->next != filebot) {
|
||||
filestruct *junk = make_new_node(current);
|
||||
|
||||
junk->data = charalloc(1);
|
||||
junk->data[0] = '\0';
|
||||
add_to_cutbuffer(junk);
|
||||
#ifdef DEBUG
|
||||
dump_buffer(cutbuffer);
|
||||
#endif
|
||||
}
|
||||
|
||||
do_delete();
|
||||
SET(KEEP_CUTBUFFER);
|
||||
marked_cut = 2;
|
||||
return 1;
|
||||
} else {
|
||||
SET(MARK_ISSET);
|
||||
SET(KEEP_CUTBUFFER);
|
||||
|
||||
mark_beginx = strlen(current->data);
|
||||
mark_beginbuf = current;
|
||||
dontupdate = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (ISSET(MARK_ISSET)) {
|
||||
/* Don't do_update() and move the screen position if the marked
|
||||
area lies entirely within the screen buffer */
|
||||
dontupdate |= current->lineno >= edittop->lineno &&
|
||||
current->lineno <= editbot->lineno &&
|
||||
mark_beginbuf->lineno >= edittop->lineno &&
|
||||
mark_beginbuf->lineno <= editbot->lineno;
|
||||
cut_marked_segment(current, current_x, mark_beginbuf,
|
||||
mark_beginx, 1);
|
||||
|
||||
placewewant = xplustabs();
|
||||
UNSET(MARK_ISSET);
|
||||
|
||||
marked_cut = 1;
|
||||
if (dontupdate)
|
||||
edit_refresh();
|
||||
else
|
||||
edit_update(current, CENTER);
|
||||
set_modified();
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
totlines--;
|
||||
totsize -= strlen(current->data) + 1;
|
||||
fileptr = current;
|
||||
current = current->next;
|
||||
current->prev = fileptr->prev;
|
||||
add_to_cutbuffer(fileptr);
|
||||
#ifdef DEBUG
|
||||
dump_buffer(cutbuffer);
|
||||
#endif
|
||||
|
||||
if (fileptr == fileage)
|
||||
fileage = current;
|
||||
else
|
||||
current->prev->next = current;
|
||||
|
||||
if (fileptr == edittop)
|
||||
edittop = current;
|
||||
|
||||
renumber(current);
|
||||
current_x = 0;
|
||||
edit_refresh();
|
||||
set_modified();
|
||||
marked_cut = 0;
|
||||
placewewant = 0;
|
||||
SET(KEEP_CUTBUFFER);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int do_uncut_text(void)
|
||||
{
|
||||
filestruct *tmp = current, *fileptr = current;
|
||||
filestruct *newbuf = NULL, *newend = NULL;
|
||||
char *tmpstr, *tmpstr2;
|
||||
filestruct *hold = current;
|
||||
int i;
|
||||
|
||||
wrap_reset();
|
||||
check_statblank();
|
||||
if (cutbuffer == NULL || fileptr == NULL)
|
||||
return 0; /* AIEEEEEEEEEEEE */
|
||||
|
||||
/* If we're uncutting a previously non-marked block, uncut to end if
|
||||
we're not at the beginning of the line. If we are at the
|
||||
beginning of the line, set placewewant to 0. Pico does both of
|
||||
these. */
|
||||
if (marked_cut == 0) {
|
||||
if (current_x != 0)
|
||||
marked_cut = 2;
|
||||
else
|
||||
placewewant = 0;
|
||||
}
|
||||
|
||||
if (marked_cut == 0 || cutbuffer->next != NULL)
|
||||
{
|
||||
newbuf = copy_filestruct(cutbuffer);
|
||||
for (newend = newbuf; newend->next != NULL && newend != NULL;
|
||||
newend = newend->next)
|
||||
totlines++;
|
||||
}
|
||||
|
||||
/* Hook newbuf into fileptr */
|
||||
if (marked_cut != 0) {
|
||||
int recenter_me = 0;
|
||||
/* Should we eventually use edit_update(CENTER)? */
|
||||
|
||||
/* If there's only one line in the cutbuffer */
|
||||
if (cutbuffer->next == NULL) {
|
||||
size_t buf_len = strlen(cutbuffer->data);
|
||||
size_t cur_len = strlen(current->data);
|
||||
|
||||
current->data = nrealloc(current->data, cur_len + buf_len + 1);
|
||||
memmove(current->data + current_x + buf_len,
|
||||
current->data + current_x, cur_len - current_x + 1);
|
||||
strncpy(current->data + current_x, cutbuffer->data, buf_len);
|
||||
/* Use strncpy() to not copy the terminal '\0'. */
|
||||
|
||||
current_x += buf_len;
|
||||
totsize += buf_len;
|
||||
/* If we've uncut a line, make sure there's a magicline after
|
||||
it */
|
||||
if (current->next == NULL)
|
||||
new_magicline();
|
||||
|
||||
placewewant = xplustabs();
|
||||
update_cursor();
|
||||
} else { /* yuck -- no kidding! */
|
||||
tmp = current->next;
|
||||
/* New beginning */
|
||||
tmpstr = charalloc(current_x + strlen(newbuf->data) + 1);
|
||||
strncpy(tmpstr, current->data, current_x);
|
||||
strcpy(&tmpstr[current_x], newbuf->data);
|
||||
totsize += strlen(newbuf->data) + strlen(newend->data) + 1;
|
||||
|
||||
/* New end */
|
||||
tmpstr2 = charalloc(strlen(newend->data) +
|
||||
strlen(¤t->data[current_x]) + 1);
|
||||
strcpy(tmpstr2, newend->data);
|
||||
strcat(tmpstr2, ¤t->data[current_x]);
|
||||
|
||||
free(current->data);
|
||||
current->data = tmpstr;
|
||||
current->next = newbuf->next;
|
||||
newbuf->next->prev = current;
|
||||
delete_node(newbuf);
|
||||
|
||||
current_x = strlen(newend->data);
|
||||
placewewant = xplustabs();
|
||||
free(newend->data);
|
||||
newend->data = tmpstr2;
|
||||
|
||||
newend->next = tmp;
|
||||
|
||||
/* If tmp isn't null, we're in the middle: update the
|
||||
prev pointer. If it IS null, we're at the end; update
|
||||
the filebot pointer */
|
||||
|
||||
if (tmp != NULL)
|
||||
tmp->prev = newend;
|
||||
else {
|
||||
/* Fix the editbot pointer too */
|
||||
if (editbot == filebot)
|
||||
editbot = newend;
|
||||
filebot = newend;
|
||||
new_magicline();
|
||||
}
|
||||
|
||||
/* Now why don't we update the totsize also */
|
||||
for (tmp = current->next; tmp != newend; tmp = tmp->next)
|
||||
totsize += strlen(tmp->data) + 1;
|
||||
|
||||
current = newend;
|
||||
if (editbot->lineno < newend->lineno)
|
||||
recenter_me = 1;
|
||||
}
|
||||
|
||||
/* If marked cut == 2, that means that we're doing a cut to end
|
||||
and we don't want anything else on the line, so we have to
|
||||
screw up all the work we just did and separate the line.
|
||||
There must be a better way to do this, but not at 1AM on a
|
||||
work night. */
|
||||
|
||||
if (marked_cut == 2) {
|
||||
tmp = make_new_node(current);
|
||||
tmp->data = mallocstrcpy(NULL, current->data + current_x);
|
||||
splice_node(current, tmp, current->next);
|
||||
null_at(¤t->data, current_x);
|
||||
current = current->next;
|
||||
current_x = 0;
|
||||
placewewant = 0;
|
||||
|
||||
/* Extra line added, update stuff */
|
||||
totlines++;
|
||||
totsize++;
|
||||
}
|
||||
/* Renumber from BEFORE where we pasted ;) */
|
||||
renumber(hold);
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_buffer(fileage);
|
||||
dump_buffer(cutbuffer);
|
||||
#endif
|
||||
set_modified();
|
||||
if (recenter_me)
|
||||
edit_update(current, CENTER);
|
||||
else
|
||||
edit_refresh();
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (fileptr != fileage) {
|
||||
tmp = fileptr->prev;
|
||||
tmp->next = newbuf;
|
||||
newbuf->prev = tmp;
|
||||
} else
|
||||
fileage = newbuf;
|
||||
totlines++; /* Unmarked uncuts don't split lines */
|
||||
|
||||
/* This is so uncutting at the top of the buffer will work => */
|
||||
if (current_y == 0)
|
||||
edittop = newbuf;
|
||||
|
||||
/* Connect the end of the buffer to the filestruct */
|
||||
newend->next = fileptr;
|
||||
fileptr->prev = newend;
|
||||
|
||||
/* Recalculate size *sigh* */
|
||||
for (tmp = newbuf; tmp != fileptr; tmp = tmp->next)
|
||||
totsize += strlen(tmp->data) + 1;
|
||||
|
||||
i = editbot->lineno;
|
||||
renumber(newbuf);
|
||||
/* Center the screen if we've moved beyond the line numbers of both
|
||||
the old and new editbots */
|
||||
if (i < newend->lineno && editbot->lineno < newend->lineno)
|
||||
edit_update(fileptr, CENTER);
|
||||
else
|
||||
edit_refresh();
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_buffer_reverse();
|
||||
#endif
|
||||
|
||||
set_modified();
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
return 1;
|
||||
}
|
||||
2
doc/.cvsignore
Normal file
2
doc/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
3
doc/Makefile.am
Normal file
3
doc/Makefile.am
Normal file
@@ -0,0 +1,3 @@
|
||||
SUBDIRS = man texinfo
|
||||
|
||||
EXTRA_DIST = faq.html nanorc.sample
|
||||
@@ -29,16 +29,17 @@
|
||||
<a href="#3.5">3.5. Nano should automatically run strip on the binary when installing it!</a><br>
|
||||
<a href="#3.6">3.6. How can I make the executable smaller? This is too bloated!</a><br>
|
||||
<a href="#3.7">3.7. Tell me more about this multibuffer stuff!</a><br>
|
||||
<a href="#3.8">3.8. How do I make a .nanorc file that nano will read when I start it?</a></p></blockquote>
|
||||
<a href="#3.8">3.8. Tell me more about this verbatim input stuff!</a><br>
|
||||
<a href="#3.9">3.9. How do I make a .nanorc file that nano will read when I start it?</a></p></blockquote>
|
||||
<h2><a href="#4">4. Running</a></h2>
|
||||
<blockquote><p><a href="#4.1">4.1. Ack! My backspace/delete/enter/double bucky/meta key doesn't seem to work! What can I do?</a><br>
|
||||
<a href="#4.2">4.2. Nano crashes when I type <insert keystroke here>!</a><br>
|
||||
<a href="#4.3">4.3. Nano crashes when I resize my window. How can I fix that?</a><br>
|
||||
<a href="#4.4">4.4. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</a><br>
|
||||
<a href="#4.5a">4.5a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</a><br>
|
||||
<a href="#4.5b">4.5b. [version 1.2.0 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</a><br>
|
||||
<a href="#4.6">4.6. I get the message "NumLock glitch detected. Keypad will malfunction with NumLock off." What gives?</a><br>
|
||||
<a href="#4.7">4.7. How do I make nano my default editor (in Pine, mutt, etc.)?</a></p></blockquote>
|
||||
<a href="#4.5b">4.5b. [version 1.2.2 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</a><br>
|
||||
<a href="#4.6">4.6. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
|
||||
<a href="#4.7">4.7. I've compiled nano with color support, but I don't see any color when I run it!</a></p></blockquote>
|
||||
<h2><a href="#5">5. Internationalization</a></h2>
|
||||
<blockquote><p><a href="#5.1">5.1. There's no translation for my language!</a><br>
|
||||
<a href="#5.2">5.2. I don't like the translation for <x> in my language. How can I fix it?</a></p></blockquote>
|
||||
@@ -77,7 +78,7 @@
|
||||
<h2><a name="1.5"></a>1.5. Why the name change from TIP?</h2>
|
||||
<blockquote><p>On January 10, 2000, TIP was officially renamed to nano because of a namespace conflict with another program called 'tip'. The original 'tip' program "establishes a full duplex terminal connection to a remote host", and was included with many older Unix systems (and newer ones like Solaris). The conflict was not noticed at first because there is no 'tip' utility included with most GNU/Linux distributions (where nano was developed).</p></blockquote>
|
||||
<h2><a name="1.6"></a>1.6. What is the current version of nano?</h2>
|
||||
<blockquote><p>The current version of nano *should* be 1.2.0. Of course you should always check the nano homepage to see what the latest and greatest version is.</p></blockquote>
|
||||
<blockquote><p>The current version of nano *should* be 1.3.4. Of course you should always check the nano homepage to see what the latest and greatest version is.</p></blockquote>
|
||||
<h2><a name="1.7"></a>1.7. I want to read the man page without having to download the program!</h2>
|
||||
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="http://www.nano-editor.org/dist/v1.2/nano.1.html">here</a>.</p></blockquote>
|
||||
<hr width="100%">
|
||||
@@ -93,8 +94,8 @@
|
||||
<h2><a name="2.2"></a>2.2. RedHat and derivatives (.rpm) packages.</h2>
|
||||
<blockquote>
|
||||
<ul>
|
||||
<li><a href="http://www.nano-editor.org/dist/v1.0/RPMS/">http://www.nano-editor.org/dist/v1.0/RPMS/</a></li>
|
||||
<li><a href="http://www.ewtoo.org/~astyanax/nano/dist/v1.0/RPMS/">http://www.ewtoo.org/~astyanax/nano/dist/v1.0/RPMS/</a></li>
|
||||
<li><a href="http://www.nano-editor.org/dist/v1.2/RPMS/">http://www.nano-editor.org/dist/v1.2/RPMS/</a></li>
|
||||
<li><a href="http://www.ewtoo.org/~astyanax/nano/dist/v1.2/RPMS/">http://www.ewtoo.org/~astyanax/nano/dist/v1.2/RPMS/</a></li>
|
||||
</ul>
|
||||
<p>Additionally, check out the RedHat contribs section at:</p>
|
||||
<ul>
|
||||
@@ -156,10 +157,14 @@
|
||||
<b>--enable-multibuffer</b> Enables having multiple file buffers open
|
||||
<b>--enable-all</b> Enables all of the above features</pre></blockquote>
|
||||
<h2><a name="3.7"></a>3.7. Tell me more about this multibuffer stuff!</h2>
|
||||
<blockquote><p>To use multiple file buffers, you must be using nano 1.1.12 or newer, and you must have configured nano with <b>--enable-multibuffer</b> or <b>--enable-extra</b> (use nano -V to check). Then when you want to enable inserting a file into its own buffer instead of into the current file, just hit <b>Meta-F</b>, then insert the file as normal with <b>^R</b>. If you always want files to be loaded into their own buffers, use the <b>--multibuffer</b> or <b>-F</b> flag when you invoke nano. </p>
|
||||
<blockquote><p>To use multiple file buffers, you must be using nano 1.1.0 or newer, and you must have configured nano with <b>--enable-multibuffer</b> or <b>--enable-extra</b> (use nano -V to check). Then when you want to enable inserting a file into its own buffer instead of into the current file, just hit <b>Meta-F</b>, then insert the file as normal with <b>^R</b>. If you always want files to be loaded into their own buffers, use the <b>--multibuffer</b> or <b>-F</b> flag when you invoke nano.</p>
|
||||
<p>You can move between the buffers you have open with the <b>Meta-<</b> and <b>Meta-></b> keys, or more easily with <b>Meta-,</b> and <b>Meta-.</b> (clear as mud, right? =-). When you have more than one file buffer open, the ^X shortcut will say "Close", instead of the normal "Exit" when only one buffer is open.</p></blockquote>
|
||||
<h2><a name="3.8"></a>3.8. How do I make a .nanorc file that nano will read when I start it?</h2>
|
||||
<blockquote>It's not hard at all! But, your version of nano must have been compiled with <b>--enable-nanorc</b>, and again must be version 1.1.12 or newer (use nano -V to check your version and compiled features). Then simply copy the <b>nanorc.sample</b> that came with the nano source or your nano package (most likely in /usr/doc/nano) to .nanorc in your home directory. If you didn't get one, the syntax is simple. Flags are turned on and off by using the word <b>set</b> and the getopt_long flag for the feature, for example "set pico" or "set nowrap".</blockquote>
|
||||
<h2><a name="3.8"></a>3.8. Tell me more about this verbatim input stuff!</h2>
|
||||
<blockquote><p>To use verbatim input, you must be using nano 1.3.1 or newer. When you want to insert a literal character into the file you're editing, such as a control character that nano usually treats as a command, first press <b>Meta-V</b>. (If you're not at a prompt, you'll get the message "Verbatim input".) Then press the key(s) that generate the character you want.</p>
|
||||
<p>Alternatively, you can press <b>Meta-V</b> and then type a three-digit ASCII code from 000 to 255, and the character with that ASCII code will be inserted instead.</p>
|
||||
<p><b>NOTE:</b> Verbatim input doesn't work at prompts right now. This will be fixed soon.</p></blockquote>
|
||||
<h2><a name="3.9"></a>3.9. How do I make a .nanorc file that nano will read when I start it?</h2>
|
||||
<blockquote><p>It's not hard at all! But, your version of nano must have been compiled with <b>--enable-nanorc</b>, and again must be version 1.1.12 or newer (use nano -V to check your version and compiled features). Then simply copy the <b>nanorc.sample</b> that came with the nano source or your nano package (most likely in /usr/doc/nano) to .nanorc in your home directory. If you didn't get one, the syntax is simple. Flags are turned on and off by using the word <b>set</b> and the getopt_long flag for the feature, for example "set nowrap" or "set suspend".</p></blockquote>
|
||||
<hr width="100%">
|
||||
<h1><a name="4"></a>4. Running</h1>
|
||||
<h2><a name="4.1"></a>4.1. Ack! My backspace/delete/enter/double bucky/meta key doesn't seem to work! What can I do?</h2>
|
||||
@@ -175,12 +180,9 @@
|
||||
<a name="4.5"></a>
|
||||
<h2><a name="4.5a"></a>4.5a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</h2>
|
||||
<blockquote><p>In nano version 0.9.20, the default is to have a completely consistent user interface across all user input functions. This means that regardless of whether you're being asked for a filename to insert or write, or a string to search for, the previous value is already inserted before the cursor. If you prefer the old behavior, use the Pico emulation mode (-p or --pico) or just hit Meta-P while in nano (see the ^G help text for more details).</p></blockquote>
|
||||
<h2><a name="4.5b"></a>4.5b. [version 1.2.0 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</h2>
|
||||
<h2><a name="4.5b"></a>4.5b. [version 1.2.2 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</h2>
|
||||
<blockquote><p>It was decided that consistency was nice, but people are used to Pico's inconsistent behavior. Also, in version 1.1.99pre1, search and replace history was introduced. If you wish to edit your previous search/replace entry (or any previous entry), you can do so by hitting the up arrow to cycle through your history. This method allows the best of both worlds: You don't need to erase the previous string if you want to enter a new one, but you can with one keystroke recall previous entries for editing. Therefore there is now no "Pico mode", nano is and has always been a Pico <b>clone</b>, and clones by default should be compatible.</p></blockquote>
|
||||
<h2><a name="4.6"></a>4.6. I get the message "NumLock glitch detected. Keypad will malfunction with NumLock off." What gives?</h2>
|
||||
<blockquote><p>Nano (and actually almost all console editors) has issues when cycling the NumLock key in certain X terminals (rxvt, aterm, wterm, etc...). When you switch NumLock from on to off, you put the terminal into an "application mode" that changes what sequences are sent by the keypad. These sequences vary sufficiently from terminal to terminal that it is nearly impossible to work around them from within nano.</p>
|
||||
<p>In a nutshell, if you want to be able to use the keypad with the arrow and page up/down functionality, you have to exit nano and reset your terminal (presumably with "reset" or "stty sane" or similar) and then run nano again with NumLock off. If you know an easier way to restore "normal mode", please mail <a href="mailto:nano@nano-editor.org">nano@nano-editor.org</a>.</p></blockquote>
|
||||
<h2><a name="4.7"></a>4.7. How do I make nano my default editor (in Pine, mutt, etc.)?</h2>
|
||||
<h2><a name="4.6"></a>4.6. How do I make nano my default editor (in Pine, mutt, etc.)?</h2>
|
||||
<blockquote><p>You need to make nano your $EDITOR. If you want this to be saved, you should put a line like this in your <b>.bashrc</b> if you use bash (or <b>.zshrc</b> if you believe in zsh):</p>
|
||||
<p><b>export EDITOR=/usr/local/bin/nano</b></p>
|
||||
<p>or if you use tcsh put this in your <b>.cshrc</b> file:</p>
|
||||
@@ -193,6 +195,8 @@
|
||||
<p>Mutt users should see an effect immediately the next time you log in, no further configuration is needed. However, if you want to let people know you use nano to compose your email messages, you can put a line like this in your <b>.muttrc</b>:</p>
|
||||
<p><b>my_hdr X-Composer: nano x.y.z</b></p>
|
||||
<p>Again, replace x.y.z with the version of nano you use.</p></blockquote>
|
||||
<h2><a name="4.7"></a>4.7. I've compiled nano with color support, but I don't see any color when I run it!</h2>
|
||||
<blockquote><p>If you want nano to actually use color, you have to specify the color configurations you want it to use in your .nanorc. Some example configurations are in the <b>nanorc.sample</b> that comes with the nano source or your nano package. See Section <a href="#3.9">3.9</a>.</p></blockquote>
|
||||
<hr width="100%">
|
||||
<h1><a name="5"></a>5. Internationalization</h1>
|
||||
<h2><a name="5.1"></a>5.1. There's no translation for my language!</h2>
|
||||
@@ -233,7 +237,12 @@
|
||||
<h2><a name="8"></a>8. ChangeLog</h2>
|
||||
<blockquote>
|
||||
<p>
|
||||
2003/01/16 - Split section 4.5 into 4.5a and 4.5b for search string behavior. Added --enable-all docs.<br>
|
||||
2004/04/07 - Removed NumLock glitch question, as it's no longer needed. (DLR)<br>
|
||||
2004/01/30 - Fixed inaccuracy: multibuffer mode was first in nano 1.1.0, not 1.1.12. (DLR)<br>
|
||||
2003/12/31 - Added question about the new verbatim input function, and a few minor fixes. Removed reference to "set pico" (DLR).<br>
|
||||
2003/07/02 - Added question about nano's not showing color when it's compiled with color support (DLR; suggested by Jordi).<br>
|
||||
2003/02/23 - Updated RPM links for nano 1.2.x (DLR).<br>
|
||||
2003/01/16 - Split section 4.5 into 4.5a and 4.5b for search string behavior. Added --enable-all docs.<br>
|
||||
2002/12/28 - More misc. fixes (David Benbennick, DLR).<br>
|
||||
2002/10/25 - Misc. fixes and link updates (DLR).<br>
|
||||
2002/09/10 - Another typo fix (DLR).<br>
|
||||
4
doc/man/.cvsignore
Normal file
4
doc/man/.cvsignore
Normal file
@@ -0,0 +1,4 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
nanorc.5.html
|
||||
nano.1.html
|
||||
12
doc/man/Makefile.am
Normal file
12
doc/man/Makefile.am
Normal file
@@ -0,0 +1,12 @@
|
||||
SUBDIRS = fr
|
||||
|
||||
man_MANS = nano.1 nanorc.5
|
||||
|
||||
BUILT_SOURCES = nano.1.html nanorc.5.html
|
||||
|
||||
nano.1.html: nano.1
|
||||
cat $< | groff -t -mandoc -Thtml > $@
|
||||
nanorc.5.html: nanorc.5
|
||||
cat $< | groff -t -mandoc -Thtml > $@
|
||||
|
||||
EXTRA_DIST = $(man_MANS) $(BUILT_SOURCES)
|
||||
4
doc/man/fr/.cvsignore
Normal file
4
doc/man/fr/.cvsignore
Normal file
@@ -0,0 +1,4 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
nanorc.5.html
|
||||
nano.1.html
|
||||
10
doc/man/fr/Makefile.am
Normal file
10
doc/man/fr/Makefile.am
Normal file
@@ -0,0 +1,10 @@
|
||||
man_MANS = nano.1 nanorc.5
|
||||
|
||||
BUILT_SOURCES = nano.1.html nanorc.5.html
|
||||
|
||||
nano.1.html: nano.1
|
||||
cat $< | groff -t -mandoc -Thtml > $@
|
||||
nanorc.5.html: nanorc.5
|
||||
cat $< | groff -t -mandoc -Thtml > $@
|
||||
|
||||
EXTRA_DIST = $(man_MANS) $(BUILT_SOURCES)
|
||||
229
doc/man/fr/nano.1
Normal file
229
doc/man/fr/nano.1
Normal file
@@ -0,0 +1,229 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" nano.1 is copyright (C) 1999, 2000, 2001, 2002, 2003 by
|
||||
.\" Chris Allegretta <chrisa@asty.org>
|
||||
.\"
|
||||
.\" (c) 2003 Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>
|
||||
.\" pour l'adaptation française
|
||||
.\"
|
||||
.\" This is free documentation, see the latest version of the GNU General
|
||||
.\" Public License for copying conditions. There is NO warranty.
|
||||
.\"
|
||||
.\" Ce document est libre. Reportez-vous à la dernière version de la
|
||||
.\" licence publique générale GNU (GNU GPL) pour connaître ses
|
||||
.\" conditions d'utilisation. AUCUNE garantie n'est offerte.
|
||||
.\"
|
||||
.TH NANO 1 "19 juin 2003 (v.f. du 25 août 2003)"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
|
||||
|
||||
.SH NOM
|
||||
nano \- NAno un NOuvel éditeur, un clone libre et amélioré de Pico
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B nano
|
||||
.I [\+LIGNE]\ [options]\ [fichier]
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
Cette page de manuel décrit brièvement la commande \fBnano\fP.
|
||||
.PP
|
||||
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
|
||||
.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
|
||||
.\" respectively.
|
||||
\fBnano\fP est un petit éditeur sympathique et libre, qui vise à remplacer
|
||||
Pico, l'éditeur par défaut du paquet non-libre Pine. \fBnano\fP ne se
|
||||
contentant pas de copier l'interface et l'ergonomie de Pico, il offre
|
||||
également certaines fonctionnalités manquantes (ou désactivées par
|
||||
défaut) de Pico. Ces fonctionnalités sont, par exemple, les fonctions de
|
||||
recherche et de remplacement, et la possibilité de sauter directement à
|
||||
un numéro de ligne.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \+\fILIGNE\fP
|
||||
Démarre avec le curseur positionné à la ligne numéro \fILIGNE\fP.
|
||||
.TP
|
||||
.B \-B (\-\-backup)
|
||||
Lors de l'écriture d'un fichier, crée une copie de sécurité de la
|
||||
version précédente, en ajoutant un tilde (~) au nom du fichier.
|
||||
.TP
|
||||
.B \-D (\-\-dos)
|
||||
Écrit le fichier au format DOS.
|
||||
.TP
|
||||
.B \-F (\-\-multibuffer)
|
||||
Active le mode multifichiers, autorisant l'édition simultanée de
|
||||
plusieurs fichiers, si ce mode est disponible.
|
||||
.TP
|
||||
.B \-H (\-\-historylog)
|
||||
Enregistre les chaînes ayant fait l'objet d'une recherche ou d'un
|
||||
remplacement dans le fichier
|
||||
.I ~/.nano_history
|
||||
afin de permettre leur réutilisation. Ceci n'est possible que si
|
||||
.B nano
|
||||
est capable d'utiliser les fichiers
|
||||
nanorc.
|
||||
.TP
|
||||
.B \-I (\-\-ignorercfiles)
|
||||
N'utilise pas les fichiers
|
||||
.I $SYSCONFDIR/nanorc
|
||||
et
|
||||
.IR ~/.nanorc ,
|
||||
même si
|
||||
.B nano
|
||||
est capable de les utiliser.
|
||||
.TP
|
||||
.B \-K (\-\-keypad)
|
||||
Essaie au maximum de ne pas utiliser les appels keypad() de ncurses.
|
||||
Utilisez ce paramètre si vous vous apercevez que les flèches du pavé
|
||||
numérique ne fonctionnent pas sous nano.
|
||||
.TP
|
||||
.B \-M (\-\-mac)
|
||||
Écrit le fichier au format Mac.
|
||||
.TP
|
||||
.B \-N (\-\-noconvert)
|
||||
Désactive la conversion automatique des fichiers depuis les
|
||||
formats Mac et DOS.
|
||||
.TP
|
||||
.B \-Q \fIchaîne\fP (\-\-quotestr=\fIchaîne\fP)
|
||||
Définit le préfixe par défaut des citations. Nano utilise ce préfixe
|
||||
pour réaliser une justification correcte des citations.
|
||||
Si nano est capable d'utiliser des expressions rationnelles, le préfixe
|
||||
par défaut sera "^([\ \\t]*[|>:}#])+", sinon, ce sera ">\ ".
|
||||
.TP
|
||||
.B \-R (\-\-regexp)
|
||||
Active l'utilisation d'expressions rationnelles lors des recherches,
|
||||
ainsi que la possibilité d'utiliser \\\fIn\fP dans les chaînes de
|
||||
remplacement pour faire référence à la \fIn\fP-ième sous-expression du
|
||||
motif de recherche, si cette fonction est disponible.
|
||||
.TP
|
||||
.B \-S (\-\-smooth)
|
||||
Active le défilement progressif. Le texte défilera ligne-par-ligne au
|
||||
lieu de défiler morceau-par-morceau.
|
||||
.TP
|
||||
.B \-T \fInombre\fP (\-\-tabsize=\fInombre\fP)
|
||||
Définit la taille (largeur) des tabulations.
|
||||
.TP
|
||||
.B \-V (\-\-version)
|
||||
Affiche le numéro de version et l'auteur.
|
||||
.TP
|
||||
.B \-Y \fIchaîne\fP (\-\-syntax=\fIchaîne\fP)
|
||||
Indique quel mode de colorisation syntaxique adopter, parmi les modes
|
||||
définis dans le fichier
|
||||
.IR .nanorc ,
|
||||
si cette fonctionnalité est disponible.
|
||||
.TP
|
||||
.B \-c (\-\-const)
|
||||
Affiche en permanence la position du curseur.
|
||||
.TP
|
||||
.B \-h (\-\-help)
|
||||
Affiche de la liste des options disponibles en ligne de commande.
|
||||
.TP
|
||||
.B \-i (\-\-autoindent)
|
||||
Indentation automatique. Commence chaque nouvelle ligne au même niveau
|
||||
que la ligne précédente. Utile pour l'édition de code source.
|
||||
.TP
|
||||
.B \-k (\-\-cut)
|
||||
^K coupe le texte du curseur à la fin de la ligne, au lieu de couper la
|
||||
ligne entière.
|
||||
.TP
|
||||
.B \-l (\-\-nofollow)
|
||||
Si le fichier édité est un lien symbolique, remplace le lien par le
|
||||
nouveau fichier, sans le suivre. Ce mode ne serait-il pas utile pour
|
||||
éditer les fichiers de
|
||||
.IR /tmp \ ?
|
||||
.TP
|
||||
.B \-m (\-\-mouse)
|
||||
Active l'utilisation de la souris (si elle est disponible sur votre
|
||||
système).
|
||||
.TP
|
||||
.B \-o \fIrépertoire\fP (\-\-operatingdir=\fIrépertoire\fP)
|
||||
Définit le répertoire de travail. Demande à nano de mettre en place
|
||||
quelque-chose de similaire à une cage chroot.
|
||||
.TP
|
||||
.B \-p (\-\-preserve)
|
||||
Préserve les séquences XON et XOFF (^Q et ^S), afin qu'elle soient
|
||||
reçues par le terminal.
|
||||
.TP
|
||||
.B \-r \fIcolonne\fP (\-\-fill=\fIcolonne\fP)
|
||||
Passe automatiquement à la ligne à la colonne \fIcolonne\fP. Par défaut,
|
||||
le passage à la ligne se fait à la taille de l'écran moins huit. Si la
|
||||
valeur indiquée est négative, le point de passage à la ligne sera
|
||||
calculé relativement au bord droit de l'écran. Cela permet de faire
|
||||
varier le point de passage à la ligne lorsque l'on change la taille de
|
||||
l'écran.
|
||||
.TP
|
||||
.B \-s \fIprogramme\fP (\-\-speller=\fIprogramme\fP)
|
||||
Choix d'un correcteur orthographique de remplacement.
|
||||
.TP
|
||||
.B \-t (\-\-tempfile)
|
||||
S'il a été modifié, le fichier sera sauvegardé automatiquement sans
|
||||
demande de confirmation. Identique à l'option -t de Pico.
|
||||
.TP
|
||||
.B \-v (\-\-view)
|
||||
Mode visualisation (lecture seule).
|
||||
.TP
|
||||
.B \-w (\-\-nowrap)
|
||||
Désactive le passage automatique à la ligne.
|
||||
.TP
|
||||
.B \-x (\-\-nohelp)
|
||||
Désactive la barre d'aide affichée en bas de l'écran.
|
||||
.TP
|
||||
.B \-z (\-\-suspend)
|
||||
Autorise à suspendre l'éditeur.
|
||||
.TP
|
||||
.B \-a, \-b, \-e, \-f, \-g, \-j
|
||||
Ignoré, pour être compatible avec Pico.
|
||||
|
||||
.SH FICHIERS D'INITIALISATION
|
||||
\fBnano\fP lit les fichiers d'initialisation dans l'ordre suivant\ :
|
||||
\fI$SYSCONFDIR/nanorc\fP, puis \fI~/.nanorc\fP. Reportez-vous à la page
|
||||
de manuel de \fBnanorc\fP(5) et au fichier-exemple \fInanorc.sample\fP
|
||||
qui devrait être livré avec \fBnano\fP.
|
||||
|
||||
.SH NOTES
|
||||
Dans certains cas, \fBnano\fP essaiera de sauvegarder le fichier en
|
||||
cours d'édition dans un fichier de secours. Cela arrivera
|
||||
principalement si \fBnano\fP reçoit un signal SIGHUP ou SIGTERM, ou
|
||||
bien se trouve à court de mémoire. Le nom de ce fichier de secours sera
|
||||
\fInano.save\fP si le fichier en cours n'avait pas encore de nom, ou
|
||||
sera composé du nom du fichier en cours suivi du suffixe «\ .save\ ». Si
|
||||
un fichier de ce nom existe déjà dans le répertoire, un «\ .save\ » et
|
||||
un nombre seront ajoutée à la fin du nom du fichier en cours afin de le
|
||||
rendre unique (par exemple, «\ .save.1\ »). En mode multifichiers,
|
||||
\fBnano\fP réalisera une sauvegarde de tous les fichiers en cours dans
|
||||
leurs fichiers de secours respectifs.
|
||||
|
||||
.SH BOGUES
|
||||
Merci de nous faire parvenir vos commentaires et de nous signaler les
|
||||
bogues, en écrivant, en anglais, à
|
||||
.BR nano@nano-editor.org .
|
||||
|
||||
N'hésitez pas à faire parvenir vos suggestions et commentaires relatifs
|
||||
à la version française de \fBnano\fP à
|
||||
.BR jean-philippe.guerard@corbeaunoir.org .
|
||||
|
||||
La liste de discussion anglophone \fBnano\fP est disponible via
|
||||
.BR nano-devel@gnu.org .
|
||||
Pour vous abonner, envoyez un courrier électronique à
|
||||
.BR nano-devel-request@gnu.org ,
|
||||
ayant pour objet «\ subscribe\ ».
|
||||
|
||||
.SH SITE INTERNET
|
||||
http://www.nano-editor.org/
|
||||
|
||||
.SH VOIR AUSSI
|
||||
.PD 0
|
||||
.TP
|
||||
\fBnanorc\fP(5)
|
||||
.PP
|
||||
\fI/usr/share/doc/nano/\fP (ou son équivalent sur votre système)
|
||||
|
||||
.SH AUTEUR
|
||||
Chris Allegretta <chrisa@asty.org> et d'autres (voir les fichiers
|
||||
\fIAUTHORS\fP et \fITHANKS\fP pour plus d'information). Cette page de
|
||||
manuel a été initialement rédigée par Jordi Mallach
|
||||
<jordi@sindominio.net> pour le système GNU Debian (mais elle peut être
|
||||
utilisée par d'autres).
|
||||
|
||||
.SH TRADUCTION
|
||||
Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>, 2003.
|
||||
198
doc/man/fr/nanorc.5
Normal file
198
doc/man/fr/nanorc.5
Normal file
@@ -0,0 +1,198 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" nanorc.5 is Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
.\"
|
||||
.\" (c) 2003 Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>
|
||||
.\" pour l'adaptation française
|
||||
.\"
|
||||
.\" This is free documentation, see the latest version of the GNU General
|
||||
.\" Public License for copying conditions. There is NO warranty.
|
||||
.\"
|
||||
.\" Ce document est libre. Reportez-vous à la dernière version de la
|
||||
.\" licence publique générale GNU (GNU GPL) pour connaître ses
|
||||
.\" conditions d'utilisation. AUCUNE garantie n'est offerte.
|
||||
.\"
|
||||
.TH NANORC 5 "19 juin 2003 (v.f. du 25 août 2003)"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
|
||||
|
||||
.SH NAME
|
||||
nanorc \- fichier de configuration de l'éditeur nano du projet GNU
|
||||
|
||||
.SH DESCRIPTION
|
||||
Cette page de manuel décrit brièvement le fichier de configuration de
|
||||
l'éditeur \fBnano\fP du projet GNU.
|
||||
.PP
|
||||
\fBnano\fP est un petit éditeur sympathique et libre, qui vise à
|
||||
remplacer Pico, l'éditeur par défaut du paquet non-libre Pine.
|
||||
\fBnano\fP ne se contentant pas de copier l'interface et l'ergonomie de
|
||||
Pico, il offre également certaines fonctionnalités manquantes (ou
|
||||
désactivées par défaut) de Pico. Ces fonctionnalités sont, par exemple,
|
||||
les fonctions de recherche et de remplacement, et la possibilité de
|
||||
sauter directement à un numéro de ligne.
|
||||
.PP
|
||||
Le fichier \fInanorc\fP contient les paramètres par défaut de
|
||||
\fBnano\fP. Lors de son démarrage, nano commence par lire le fichier de
|
||||
configuration général \fI$SYSCONFDIR/nanorc\fP, puis lit le fichier de
|
||||
configuration personnel de l'utilisateur \fI~/.nanorc\fP.
|
||||
|
||||
.SH OPTIONS
|
||||
Le fichier de configuration accepte une série de commandes «\ set\ »
|
||||
(activer) et «\ unset\ » (désactiver), qui permettent de définir la
|
||||
configuration de nano au démarrage sans avoir à utiliser d'options sur
|
||||
la ligne de commande.
|
||||
De plus, les mots clefs «\ syntax\ » (syntaxe) et «\ color\ » (couleur)
|
||||
sont utilisés pour définir les règles de colorisation pour différents
|
||||
motifs de texte. Nano lira une commande par ligne.
|
||||
|
||||
Les options du fichier de configuration ont priorité sur les valeurs par
|
||||
défaut utilisées par nano. Les options données sur la ligne de commande
|
||||
permettent d'outrepasser les options du fichier de configuration.
|
||||
|
||||
Les options sont désactivées (unset) par défaut, sauf les options
|
||||
prenant un argument.
|
||||
|
||||
Les commandes et arguments reconnus sont\ :
|
||||
|
||||
.TP 3
|
||||
\fBset/unset autoindent\fP
|
||||
Active l'indentation automatique.
|
||||
.TP
|
||||
\fBset/unset backup\fP
|
||||
Crée des copie de sécurité appelées
|
||||
.IR nom_du_fichier~ .
|
||||
.TP
|
||||
\fBset/unset const\fP
|
||||
Affiche en permanence la position du curseur dans la barre
|
||||
d'information.
|
||||
.TP
|
||||
\fBset/unset cut\fP
|
||||
Par défaut, utilise ^K pour couper le texte du curseur à la fin de la
|
||||
ligne, au lieu de couper la ligne entière.
|
||||
.TP
|
||||
\fBset fill \fIn\fP\fP
|
||||
Passe automatiquement à la ligne à la colonne \fIn\fP. Si la valeur
|
||||
indiquée est 0 ou moins, la longueur de la ligne sera égale à la largeur
|
||||
de l'écran moins \fIn\fP. La valeur par défaut est -8.
|
||||
.TP
|
||||
\fBset/unset historylog\fP
|
||||
Active l'utilisation de
|
||||
.I ~/.nano_history
|
||||
pour enregistrer et relire les chaînes ayant fait l'objet d'une
|
||||
recherche ou d'un remplacement.
|
||||
.TP
|
||||
\fBset/unset keypad\fP
|
||||
Utilise l'autre gestion du pavé numérique.
|
||||
.TP
|
||||
\fBset/unset multibuffer\fP
|
||||
Permet de charger simultanément plusieurs fichiers.
|
||||
.TP
|
||||
\fBset/unset noconvert\fP
|
||||
Pas de conversion depuis les formats DOS et Mac.
|
||||
.TP
|
||||
\fBset/unset nofollow\fP
|
||||
Ne suit pas les liens symboliques lors de l'écriture des fichiers.
|
||||
.TP
|
||||
\fBset/unset nohelp\fP
|
||||
Désactive la barre d'aide affichée en bas de l'écran.
|
||||
.TP
|
||||
\fBset/unset nowrap\fP
|
||||
Désactive le passage automatique à la ligne.
|
||||
.TP
|
||||
\fBset operatingdir "\fIrépertoire\fP"\fP
|
||||
\fBnano\fP ne lira et n'écrira des fichiers qu'à l'intérieur du
|
||||
\fIrépertoire\fP et de ses sous-répertoires. De plus, celui-ci devient
|
||||
le répertoire courant, afin que les fichiers soient écrits dans ce
|
||||
dossier. Par défaut, cette fonction est désactivée.
|
||||
.TP
|
||||
\fBset/unset preserve\fP
|
||||
Préserve les séquences XON et XOFF (^Q et ^S).
|
||||
.TP
|
||||
\fBset quotestr "\fIchaîne\fP"\fP
|
||||
Définit le préfixe par défaut utilisé pour les citations dans les
|
||||
courriers électroniques. Ce préfixe est utilisé pour réaliser une
|
||||
justification correcte de ces citations. Il s'agira, si votre système le
|
||||
permet, d'une «\ expression rationnelle étendue\ ». Dans le cas
|
||||
contraire, il s'agira d'une chaîne de texte brut. Si vous disposez des
|
||||
expressions rationnelles, la valeur par défaut sera\ :
|
||||
|
||||
set quotestr "^([\ \\t]*[|>:}#])+"
|
||||
|
||||
Sinon, ce sera ">\ ". Notez que le «\ \\t\ » ci-dessus correspond à un
|
||||
caractère de tabulation.
|
||||
.TP
|
||||
\fBset/unset regexp\fP
|
||||
Utilise par défaut des expressions rationnelles pour les recherches.
|
||||
.TP
|
||||
\fBset/unset smooth\fP
|
||||
Active le défilement ligne-par-ligne du texte.
|
||||
.TP
|
||||
\fBset speller \fIprogramme\fP\fP
|
||||
Utilise le correcteur orthographique \fIprogramme\fP au lieu du
|
||||
correcteur intégré, qui s'appuie sur \fIspell\fP.
|
||||
.TP
|
||||
\fBset/unset suspend\fP
|
||||
Autorise à suspendre nano avec ^Z.
|
||||
.TP
|
||||
\fBset tabsize \fIn\fP\fP
|
||||
Utilise une largeur de tabulation de \fIn\fP au lieu de la valeur par
|
||||
défaut (8). Cette valeur doit être supérieur à 0.
|
||||
.TP
|
||||
\fBset/unset tempfile\fP
|
||||
S'il a été modifié, le fichier sera sauvegardé automatiquement
|
||||
sans demande de confirmation.
|
||||
.TP
|
||||
\fBset/unset view\fP
|
||||
Interdit la modification du fichier.
|
||||
.TP
|
||||
.B syntax "\fIchaîne\fP" ["\fImotif_de_fichier\fP" ... ]
|
||||
Définit une syntaxe nommée \fIchaîne\fP qui pourra être activé via
|
||||
l'option \fB-Y\fP, ou qui sera automatiquement activé si le nom du
|
||||
fichier en cours correspond au \fImotif_de_fichier\fP. Toutes les
|
||||
instructions de colorisation \fBcolor\fP suivantes s'appliqueront à cette
|
||||
syntaxe, jusqu'à la définition d'une nouvelle syntaxe.
|
||||
.TP
|
||||
.B color \fIcouleur_texte\fP[,\fIcouleur_fond\fP] "\fImotif\fP" ...
|
||||
Pour la syntaxe en cours, affiche toutes les expressions correspondant à
|
||||
l'expression rationnelle \fImotif\fP en utilisant la couleur de texte
|
||||
\fIcouleur_texte\fP et éventuellement la couleur de fond
|
||||
\fIcouleur_fond\fP. Les couleurs acceptées par \fBnano\fP pour le
|
||||
texte et le fond sont\ : \fIwhite\fP (blanc), \fIblack\fP (noir),
|
||||
\fIred\fP (rouge), \fIblue\fP (bleu), \fIgreen\fP (vert), \fIyellow\fP
|
||||
(jaune), \fImagenta\fP, et \fIcyan\fP. Vous pouvez ajouter à
|
||||
ces couleurs le préfixe \fIbright\fP pour obtenir une couleur plus
|
||||
lumineuse. Si votre terminal est capable de gérer la transparence, ne
|
||||
pas spécifier de \fIcouleur_fond\fP indique à \fBnano\fP d'essayer
|
||||
d'utiliser un fond transparent.
|
||||
.TP
|
||||
.B color \fIcouleur_texte\fP[,\fIcouleur_fond\fP] start="\fImotif_début\fP" end="\fImotif_fin\fP"
|
||||
Affiche les expressions commençant par \fImotif_début\fP et se terminant
|
||||
par \fImotif_fin\fP en utilisant la couleur de texte \fIcouleur_texte\fP
|
||||
et éventuellement la couleur de fond \fIcouleur_fond\fP. Cela permet à
|
||||
la colorisation syntaxique de s'étendre sur plusieurs lignes. Notez que
|
||||
toutes les occurrences successives de \fImotif_début\fP après le
|
||||
\fImotif_début\fP initial seront colorées jusqu'à la prochaine instance
|
||||
de \fImotif_fin\fP.
|
||||
|
||||
.SH FICHIERS
|
||||
.TP
|
||||
.I $SYSCONFDIR/nanorc
|
||||
Fichier de configuration général
|
||||
.TP
|
||||
.I ~/.nanorc
|
||||
Fichier de configuration personnel
|
||||
|
||||
.SH VOIR AUSSI
|
||||
.PD 0
|
||||
.TP
|
||||
\fBnano\fP(1)
|
||||
.PP
|
||||
\fI/usr/share/doc/nano/examples/nanorc.sample\fP (ou son équivalent sur
|
||||
votre système)
|
||||
|
||||
.SH AUTEUR
|
||||
Chris Allegretta <chrisa@asty.org> et d'autres (voir les fichiers
|
||||
\fIAUTHORS\fP et \fITHANKS\fP pour plus d'information). Cette page de
|
||||
manuel a été rédigée par Jordi Mallach <jordi@gnu.org>.
|
||||
|
||||
.SH TRADUCTION
|
||||
Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>, 2003.
|
||||
@@ -3,10 +3,10 @@
|
||||
.\" Chris Allegretta <chrisa@asty.org>
|
||||
.\"
|
||||
.\" This is free documentation, see the latest version of the GNU General
|
||||
.\" Public License for copying conditions. There is NO warranty.
|
||||
.\" Public License for copying conditions. There is NO warranty.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH NANO 1 "February 9, 2003"
|
||||
.TH NANO 1 "version 1.3.4" "August 17, 2004"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
|
||||
@@ -22,10 +22,10 @@ nano \- Nano's ANOther editor, an enhanced free Pico clone
|
||||
This manual page documents briefly the \fBnano\fP command.
|
||||
.PP
|
||||
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
|
||||
.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
|
||||
.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
|
||||
.\" respectively.
|
||||
\fBnano\fP is a small, free and friendly editor which aims to replace
|
||||
Pico, the default editor included in the non-free Pine package. Rather
|
||||
Pico, the default editor included in the non-free Pine package. Rather
|
||||
than just copying Pico's look and feel, \fBnano\fP also implements some
|
||||
missing (or disabled by default) features in Pico, such as "search and
|
||||
replace" and "go to line number".
|
||||
@@ -35,6 +35,13 @@ replace" and "go to line number".
|
||||
.B \+\fILINE\fP
|
||||
Places cursor at \fILINE\fP on startup.
|
||||
.TP
|
||||
.B \-A (\-\-smarthome)
|
||||
Make the Home key smarter. When Home is pressed anywhere but at the
|
||||
very beginning of non-whitespace characters on a line, the cursor will
|
||||
jump to that beginning (either forwards or backwards). If the cursor is
|
||||
already at that position, it will jump to the true beginning of the
|
||||
line.
|
||||
.TP
|
||||
.B \-B (\-\-backup)
|
||||
When saving a file, back up the previous version of it to the current
|
||||
filename suffixed with a ~.
|
||||
@@ -42,21 +49,25 @@ filename suffixed with a ~.
|
||||
.B \-D (\-\-dos)
|
||||
Write file in DOS format.
|
||||
.TP
|
||||
.B \-E \fIdir\fP (\-\-backupdir=\fIdir\fP)
|
||||
Set the directory where \fBnano\fP puts the backup files if file backups
|
||||
are enabled.
|
||||
.TP
|
||||
.B \-F (\-\-multibuffer)
|
||||
Enable multiple file buffers, if available.
|
||||
.TP
|
||||
.B \-H (\-\-historylog)
|
||||
Log search and replace strings to ~/.nano_history so they may be
|
||||
stored for later editing, if nanorc support is configured.
|
||||
Log search and replace strings to
|
||||
.I ~/.nano_history
|
||||
so they may be stored for later editing, if nanorc support is
|
||||
configured.
|
||||
.TP
|
||||
.B \-I (\-\-ignorercfiles)
|
||||
Don't look at $SYSCONFDIR/nanorc or ~/.nanorc, if nanorc support is
|
||||
available.
|
||||
.TP
|
||||
.B \-K (\-\-keypad)
|
||||
Do not use the ncurses keypad() call unless necessary. Try this flag if
|
||||
you find that the arrow keys on the numeric keypad do not work for you
|
||||
under nano.
|
||||
Don't look at
|
||||
.I SYSCONFDIR/nanorc
|
||||
or
|
||||
.IR ~/.nanorc ,
|
||||
if nanorc support is available.
|
||||
.TP
|
||||
.B \-M (\-\-mac)
|
||||
Write file in Mac format.
|
||||
@@ -66,59 +77,74 @@ Disable automatic conversion of files from DOS/Mac format.
|
||||
.TP
|
||||
.B \-Q \fIstr\fP (\-\-quotestr=\fIstr\fP)
|
||||
Set the quoting string for justifying. The default is
|
||||
"^([ \\t]*[|>:}#])+" if regular expression support is available, or
|
||||
"> " otherwise.
|
||||
"^([\ \\t]*[|>:}#])+" if regular expression support is available, or
|
||||
">\ " otherwise.
|
||||
.TP
|
||||
.B \-R (\-\-regexp)
|
||||
Enable regular expression matching for search strings, as well as
|
||||
\\n subexpression replacement for replace strings, if available.
|
||||
.TP
|
||||
.B \-S (\-\-smooth)
|
||||
Enable smooth scrolling. Text will scroll line-by-line, instead of the
|
||||
Enable smooth scrolling. Text will scroll line-by-line, instead of the
|
||||
usual chunk-by-chunk behavior.
|
||||
.TP
|
||||
.B \-T \fInum\fP (\-\-tabsize=\fInum\fP)
|
||||
Set the size (width) of a tab.
|
||||
.B \-T \fIcols\fP (\-\-tabsize=\fIcols\fP)
|
||||
Set the size (width) of a tab to \fIcols\fP columns.
|
||||
.TP
|
||||
.B \-V (\-\-version)
|
||||
Show the current version number and author.
|
||||
.TP
|
||||
.B \-Y \fIstr\fP (\-\-syntax=\fIstr\fP)
|
||||
Specify a specific syntax highlighting from the .nanorc to use, if
|
||||
available.
|
||||
Specify a specific syntax highlighting from the
|
||||
.I nanorc
|
||||
to use, if available.
|
||||
.TP
|
||||
.B \-Z (\-\-restricted)
|
||||
Restricted mode: Don't read or write to any file not specified on the
|
||||
command line, read any nanorc files, allow suspending, or allow a file
|
||||
to be appended to, prepended to, or saved under a different name if it
|
||||
already has one. Also accessible by invoking \fBnano\fP with any name
|
||||
beginning with 'r' (e.g. "rnano").
|
||||
.TP
|
||||
.B \-c (\-\-const)
|
||||
Constantly show the cursor position.
|
||||
.TP
|
||||
.B \-d (\-\-rebinddelete)
|
||||
Interpret the Delete key differently so that both Backspace and Delete
|
||||
work properly. You should only need to use this option if Backspace
|
||||
acts like Delete on your system.
|
||||
.TP
|
||||
.B \-h (\-\-help)
|
||||
Display a summary of command line options.
|
||||
.TP
|
||||
.B \-i (\-\-autoindent)
|
||||
Indent new lines to the previous line's indentation. Useful when editing
|
||||
source code.
|
||||
Indent new lines to the previous line's indentation. Useful when
|
||||
editing source code.
|
||||
.TP
|
||||
.B \-k (\-\-cut)
|
||||
Enable cut from cursor to end of line with ^K.
|
||||
.TP
|
||||
.B \-l (\-\-nofollow)
|
||||
If the file being edited is a symbolic link, replace the link with
|
||||
a new file, do not follow it. Good for editing files in /tmp, perhaps?
|
||||
a new file, do not follow it. Good for editing files in
|
||||
.IR /tmp ,
|
||||
perhaps?
|
||||
.TP
|
||||
.B \-m (\-\-mouse)
|
||||
Enable mouse support (if available for your system).
|
||||
.TP
|
||||
.B \-o \fIdir\fP (\-\-operatingdir=\fIdir\fP)
|
||||
Set operating directory. Makes nano set up something similar to a
|
||||
Set operating directory. Makes nano set up something similar to a
|
||||
chroot.
|
||||
.TP
|
||||
.B \-p (\-\-preserve)
|
||||
Preserve the XON and XOFF sequences (^Q and ^S) so they will be
|
||||
caught by the terminal.
|
||||
Preserve the XON and XOFF sequences (^Q and ^S) so they will be caught
|
||||
by the terminal.
|
||||
.TP
|
||||
.B \-r \fIcols\fP (\-\-fill=\fIcols\fP)
|
||||
Wrap lines at column \fIcols\fP. By default, this is the width of the
|
||||
screen, less eight. If this value is negative, wrapping will occur at
|
||||
\fIcols\fP columns from the right of the screen, allowing the wrap point
|
||||
\fIcols\fP columns from the right of the screen, allowing the wrap point
|
||||
to vary along with the screen width if resized.
|
||||
.TP
|
||||
.B \-s \fIprog\fP (\-\-speller=\fIprog\fP)
|
||||
@@ -143,32 +169,42 @@ Enable suspend ability.
|
||||
Ignored, for compatibility with Pico.
|
||||
|
||||
.SH INITIALIZATION FILE
|
||||
\fBnano\fP will read initialization files in the following
|
||||
order: $SYSCONFDIR/nanorc, then ~/.nanorc. Please see nanorc(5) and
|
||||
the example file \fBnanorc.sample\fP which should be provided with
|
||||
\fBnano\fP.
|
||||
\fBnano\fP will read initialization files in the following order:
|
||||
.IR SYSCONFDIR/nanorc ,
|
||||
then
|
||||
.IR ~/.nanorc .
|
||||
Please see
|
||||
.BR nanorc (5)
|
||||
and the example file \fBnanorc.sample\fP which should be provided with
|
||||
\fBnano\fP.
|
||||
|
||||
.SH NOTES
|
||||
If no alternative spell checker command is specified on the command
|
||||
line or in one of the nanorc files, \fBnano\fP will check the
|
||||
\fBSPELL\fP environment variable for one.
|
||||
|
||||
\fBnano\fP will try to dump the buffer into an emergency file in some
|
||||
cases. Mainly, this will happen if \fBnano\fP receives a SIGHUP or
|
||||
SIGTERM or runs out of memory, when it will write the buffer into a file
|
||||
named "nano.save" if the buffer didn't have a name already, or will add
|
||||
a ".save" suffix to the current filename. If an emergency file with that
|
||||
name already exists in the current directory, ".save" and a number (e.g.
|
||||
".save.1") will be suffixed to the current filename in order to make it
|
||||
unique. In multibuffer mode, \fBnano\fP will write all the open buffers
|
||||
to the respective emergency files.
|
||||
named
|
||||
.I nano.save
|
||||
if the buffer didn't have a name already, or will add a ".save" suffix
|
||||
to the current filename. If an emergency file with that name already
|
||||
exists in the current directory, ".save" and a number (e.g. ".save.1")
|
||||
will be suffixed to the current filename in order to make it unique. In
|
||||
multibuffer mode, \fBnano\fP will write all the open buffers to the
|
||||
respective emergency files.
|
||||
|
||||
.SH BUGS
|
||||
Please send any comments or bug reports to
|
||||
.br
|
||||
.B nano@nano-editor.org.
|
||||
.br
|
||||
.BR nano@nano-editor.org .
|
||||
|
||||
The \fBnano\fP mailing list is available from
|
||||
.br
|
||||
.B nano-devel@gnu.org.
|
||||
To subscribe, email to nano-devel-request@gnu.org with a
|
||||
subject of "subscribe".
|
||||
.BR nano-devel@gnu.org .
|
||||
|
||||
To subscribe, email to
|
||||
.B nano-devel-request@gnu.org
|
||||
with a subject of "subscribe".
|
||||
|
||||
.SH HOMEPAGE
|
||||
http://www.nano-editor.org/
|
||||
@@ -181,8 +217,10 @@ http://www.nano-editor.org/
|
||||
\fI/usr/share/doc/nano/\fP (or equivalent on your system)
|
||||
|
||||
.SH AUTHOR
|
||||
Chris Allegretta <chrisa@asty.org>, et al (see AUTHORS and THANKS for
|
||||
details).
|
||||
This manual page was originally written by Jordi Mallach
|
||||
<jordi@sindominio.net>, for the Debian GNU system (but may be
|
||||
used by others).
|
||||
Chris Allegretta <chrisa@asty.org>, et al (see
|
||||
.I AUTHORS
|
||||
and
|
||||
.I THANKS
|
||||
for details). This manual page was originally written by Jordi Mallach
|
||||
<jordi@sindominio.net>, for the Debian GNU system (but may be used by
|
||||
others).
|
||||
@@ -2,37 +2,38 @@
|
||||
.\" nanorc.5 is Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
.\"
|
||||
.\" This is free documentation, see the latest version of the GNU General
|
||||
.\" Public License for copying conditions. There is NO warranty.
|
||||
.\" Public License for copying conditions. There is NO warranty.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH NANORC 5 "February 14, 2003"
|
||||
.TH NANORC 5 "version 1.3.4" "August 17, 2004"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.SH NAME
|
||||
nanorc \- GNU nano's rcfile
|
||||
.SH SYNOPSIS
|
||||
.B /etc/nanorc
|
||||
.br
|
||||
.B $HOME/.nanorc
|
||||
.br
|
||||
.SH DESCRIPTION
|
||||
This manual page documents GNU \fBnano\fP's rcfile.
|
||||
.PP
|
||||
\fBnano\fP is a small, free and friendly editor which aims to replace
|
||||
Pico, the default editor included in the non-free Pine package. Rather
|
||||
Pico, the default editor included in the non-free Pine package. Rather
|
||||
than just copying Pico's look and feel, \fBnano\fP also implements some
|
||||
missing (or disabled by default) features in Pico, such as "search and
|
||||
replace" and "go to line number".
|
||||
.PP
|
||||
The \fInanorc\fP file contains the default settings for \fBnano\fP.
|
||||
During startup, \fBnano\fP will first read its system-wide settings from
|
||||
.IR SYSCONFDIR/nanorc ,
|
||||
and then user-specific settings from
|
||||
.IR ~/.nanorc .
|
||||
|
||||
.SH OPTIONS
|
||||
The configuration file accepts a series of "set" and "unset" commands,
|
||||
which can be used to configure nano on startup without using the
|
||||
command-line options. Additionally, the "syntax" and "color" keywords
|
||||
are used to define syntax highlighting rules for different text patterns.
|
||||
GNU nano will read one command per line.
|
||||
command-line options. Additionally, the "syntax" and "color" keywords
|
||||
are used to define syntax highlighting rules for different text
|
||||
patterns. GNU nano will read one command per line.
|
||||
|
||||
Options in rcfiles take precedence over nano's defaults, and command line
|
||||
options override rcfile settings.
|
||||
Options in rcfiles take precedence over nano's defaults, and command
|
||||
line options override rcfile settings.
|
||||
|
||||
Options are unset by default, except for options that take an argument.
|
||||
|
||||
@@ -43,7 +44,16 @@ The supported commands and arguments are:
|
||||
Use auto-indentation.
|
||||
.TP
|
||||
\fBset/unset backup\fP
|
||||
Create backup files in filename~.
|
||||
Create backup files in
|
||||
.IR filename~ .
|
||||
.TP
|
||||
\fBset backupdir "\fIdirectory\fP"\fP
|
||||
Set the directory where \fBnano\fP puts the backup files if file backups
|
||||
are enabled.
|
||||
\fBset brackets "\fIstring\fP"\fP
|
||||
Set the characters treated as closing brackets. They cannot contain
|
||||
tabs or spaces. Only closing punctuation, optionally followed by
|
||||
closing brackets, can end sentences.
|
||||
.TP
|
||||
\fBset/unset const\fP
|
||||
Constantly display the cursor position in the status bar.
|
||||
@@ -55,8 +65,10 @@ Use cut to end of line with ^K by default.
|
||||
Wrap lines at column number \fIn\fP. If \fIn\fP is 0 or less, the line
|
||||
length will be the screen width less \fIn\fP. The default value is -8.
|
||||
.TP
|
||||
\fBset/unset keypad\fP
|
||||
Use alternate keypad routines.
|
||||
\fBset/unset historylog\fP
|
||||
Enable
|
||||
.I ~/.nano_history
|
||||
for saving and reading search/replace strings.
|
||||
.TP
|
||||
\fBset/unset multibuffer\fP
|
||||
Allow inserting files into their own buffers.
|
||||
@@ -75,26 +87,43 @@ Don't wrap text at all.
|
||||
.TP
|
||||
\fBset operatingdir "\fIdirectory\fP"\fP
|
||||
\fBnano\fP will only read and write files inside \fIdirectory\fP and its
|
||||
subdirectories. Also, the current directory is changed to here, so files
|
||||
are inserted from this dir. By default the operating directory feature is
|
||||
turned off.
|
||||
subdirectories. Also, the current directory is changed to here, so
|
||||
files are inserted from this dir. By default the operating directory
|
||||
feature is turned off.
|
||||
.TP
|
||||
\fBset/unset preserve\fP
|
||||
Preserve the XON and XOFF keys (^Q and ^S).
|
||||
.TP
|
||||
\fBset punct "\fIstring\fP"\fP
|
||||
Set the characters treated as closing punctuation. They cannot contain
|
||||
tabs or spaces. Only closing punctuation, optionally followed by
|
||||
closing brackets, can end sentences.
|
||||
.TP
|
||||
\fBset quotestr "\fIstring\fP"\fP
|
||||
The email-quote string, used to justify email-quoted paragraphs. This is
|
||||
an "extended regular expression" if your system supports them, otherwise a
|
||||
literal string. The default value is
|
||||
The email-quote string, used to justify email-quoted paragraphs. This
|
||||
is an "extended regular expression" if your system supports them,
|
||||
otherwise a literal string. The default value is
|
||||
|
||||
set quotestr "^([ \\t]*[|>:}#])+"
|
||||
set quotestr "^([\ \\t]*[|>:}#])+"
|
||||
|
||||
if you have regexps, otherwise set quotestr "> ". Note that '\\t' above
|
||||
stands for a literal Tab character.
|
||||
if you have regexps, otherwise set quotestr ">\ ". Note that '\\t'
|
||||
above stands for a literal Tab character.
|
||||
.TP
|
||||
\fBset/unset rebinddelete\fP
|
||||
Interpret the Delete key differently so that both Backspace and Delete
|
||||
work properly. You should only need to use this option if Backspace
|
||||
acts like Delete on your system.
|
||||
.TP
|
||||
\fBset/unset regexp\fP
|
||||
Do regular expression searches by default.
|
||||
.TP
|
||||
\fBset/unset smarthome\fP
|
||||
Make the Home key smarter. When Home is pressed anywhere but at the
|
||||
very beginning of non-whitespace characters on a line, the cursor will
|
||||
jump to that beginning (either forwards or backwards). If the cursor is
|
||||
already at that position, it will jump to the true beginning of the
|
||||
line.
|
||||
.TP
|
||||
\fBset/unset smooth\fP
|
||||
Use smooth scrolling by default.
|
||||
.TP
|
||||
@@ -106,49 +135,60 @@ calls \fIspell\fP.
|
||||
Allow nano to be suspended with ^Z.
|
||||
.TP
|
||||
\fBset tabsize \fIn\fP\fP
|
||||
Use a tab size of \fIn\fP instead of the default (8); must be greater
|
||||
than 0.
|
||||
Use a tab size of \fIn\fP columns instead of the default (8); must be
|
||||
greater than 0.
|
||||
.TP
|
||||
\fBset/unset tempfile\fP
|
||||
Save automatically on exit, don't prompt.
|
||||
.TP
|
||||
\fBset/unset historylog\fP
|
||||
Enable ~/.nano_history for saving and reading search/replace strings.
|
||||
.TP
|
||||
\fBset/unset view\fP
|
||||
Disallow file modification.
|
||||
.TP
|
||||
\fBset whitespace "\fIstring\fP"\fP
|
||||
Set the two characters used to display the first characters of tabs and
|
||||
spaces. They cannot be control characters.
|
||||
.TP
|
||||
.B syntax "\fIstr\fP" ["\fIfileregex\fP" ... ]
|
||||
Defines a syntax named \fIstr\fP which can be activated via the
|
||||
\fB-Y\fP flag, or will be automatically activated if the current
|
||||
filename matches \fIfileregex\fP. All following \fBcolor\fP statements
|
||||
will apply to \fIsyntax\fP until a new syntax is defined.
|
||||
Defines a syntax named \fIstr\fP which can be activated via the \fB-Y\fP
|
||||
flag, or will be automatically activated if the current filename matches
|
||||
\fIfileregex\fP. All following \fBcolor\fP statements will apply to
|
||||
\fIsyntax\fP until a new syntax is defined.
|
||||
.TP
|
||||
.B color \fIfgcolor\fP[,\fIbgcolor\fP] "\fIregex\fP" ...
|
||||
For the currently defined syntax, display all expressions matching
|
||||
\fIregex\fP with foreground color \fIfgcolor\fP and optional background
|
||||
color \fIbgcolor\fP. Legal colors for foreground and background color are:
|
||||
white, black, red, blue, green, yellow, magenta, and cyan. You may use
|
||||
the prefix "bright" to force a stronger color highlight. If your
|
||||
terminal supports transparency, not specifying a \fIbgcolor\fP tells
|
||||
For the currently defined syntax, display all expressions matching
|
||||
\fIregex\fP with foreground color \fIfgcolor\fP and optional background
|
||||
color \fIbgcolor\fP. Legal colors for foreground and background color
|
||||
are: white, black, red, blue, green, yellow, magenta, and cyan. You may
|
||||
use the prefix "bright" to force a stronger color highlight. If your
|
||||
terminal supports transparency, not specifying a \fIbgcolor\fP tells
|
||||
\fBnano\fP to attempt to use a transparent background.
|
||||
.TP
|
||||
.B color \fIfgcolor\fP[,\fIbgcolor\fP] start="\fIsr\fP" end="\fIer\fP"
|
||||
Display expressions which start with \fIsr\fP and end with \fIer\fP
|
||||
with foreground color \fIfgcolor\fP and optional
|
||||
background color \fIbgcolor\fP. This allows syntax highlighting to span
|
||||
multiple lines. Note that all subsequent instances of \fIsr\fP after
|
||||
an initial \fIsr\fP is found will be highlighted until the first
|
||||
instance of \fIer\fP.
|
||||
Display expressions which start with \fIsr\fP and end with \fIer\fP
|
||||
with foreground color \fIfgcolor\fP and optional background color
|
||||
\fIbgcolor\fP. This allows syntax highlighting to span multiple lines.
|
||||
Note that all subsequent instances of \fIsr\fP after an initial \fIsr\fP
|
||||
is found will be highlighted until the first instance of \fIer\fP.
|
||||
\fI
|
||||
|
||||
.SH FILES
|
||||
.TP
|
||||
.I SYSCONFDIR/nanorc
|
||||
System-wide configuration file
|
||||
.TP
|
||||
.I ~/.nanorc
|
||||
Per-user configuration file
|
||||
.SH SEE ALSO
|
||||
.PD 0
|
||||
.TP
|
||||
\fBnano\fP(1)
|
||||
.PP
|
||||
\fI/usr/share/doc/nano/examples/nanorc.sample\fP (or equivalent on your system)
|
||||
\fI/usr/share/doc/nano/examples/nanorc.sample\fP (or equivalent on your
|
||||
system)
|
||||
.SH AUTHOR
|
||||
Chris Allegretta <chrisa@asty.org>, et al (see AUTHORS and THANKS for
|
||||
details).
|
||||
Chris Allegretta <chrisa@asty.org>, et al (see
|
||||
.I AUTHORS
|
||||
and
|
||||
.I THANKS
|
||||
for details).
|
||||
This manual page was written by Jordi Mallach <jordi@gnu.org>.
|
||||
253
doc/nanorc.sample
Normal file
253
doc/nanorc.sample
Normal file
@@ -0,0 +1,253 @@
|
||||
## Sample initialization file for GNU nano
|
||||
## Please note that you must have configured nano with --enable-nanorc
|
||||
## for this file to be read! Also note that characters specially
|
||||
## interpreted by the shell should not be escaped here.
|
||||
##
|
||||
## To make sure a value is not enabled, use "unset <option>"
|
||||
##
|
||||
## For the options that take parameters, the default value is given.
|
||||
## Other options are unset by default.
|
||||
|
||||
## Use auto-indentation.
|
||||
# set autoindent
|
||||
|
||||
## Backup files to filename~.
|
||||
# set backup
|
||||
|
||||
## The directory to put the backup files in.
|
||||
# set backupdir ""
|
||||
|
||||
## The characters treated as closing brackets. They cannot contain tabs
|
||||
## or spaces. Only closing punctuation, optionally followed by closing
|
||||
## brackets, can end sentences.
|
||||
##
|
||||
# set brackets "'")}]>"
|
||||
|
||||
## Constantly display the cursor position in the status bar.
|
||||
# set const
|
||||
|
||||
## Use cut to end of line with ^K by default.
|
||||
# set cut
|
||||
|
||||
## Set the line length for wrapping text and justifying paragraphs.
|
||||
## If fill is negative, the line length will be the screen width less
|
||||
## this number.
|
||||
##
|
||||
# set fill -8
|
||||
|
||||
## Enable ~/.nano_history for saving and reading search/replace strings.
|
||||
# set historylog
|
||||
|
||||
## Enable mouse support so that mouse clicks can be used to set the mark
|
||||
## and run shortcuts.
|
||||
# set mouse
|
||||
|
||||
## Allow multiple file buffers (using ^R will insert into a separate
|
||||
## buffer). You must have configured with --enable-multibuffer or
|
||||
## --enable-extra for this to work.
|
||||
##
|
||||
# set multibuffer
|
||||
|
||||
## Don't convert files from DOS/Mac format.
|
||||
# set noconvert
|
||||
|
||||
## Don't follow symlinks when writing files.
|
||||
# set nofollow
|
||||
|
||||
## Don't display the helpful shortcut lists at the bottom of the screen.
|
||||
# set nohelp
|
||||
|
||||
## Don't wrap text at all.
|
||||
# set nowrap
|
||||
|
||||
## Set operating directory. nano will not read or write files outside
|
||||
## this directory and its subdirectories. Also, the current directory
|
||||
## is changed to here, so files are inserted from this dir. A blank
|
||||
## string means the operating directory feature is turned off.
|
||||
##
|
||||
# set operatingdir ""
|
||||
|
||||
## Preserve the XON and XOFF keys (^Q and ^S).
|
||||
# set preserve
|
||||
|
||||
## The characters treated as closing punctuation. They cannot contain
|
||||
## tabs or spaces. Only closing punctuation, optionally followed by
|
||||
## closing brackets, can end sentences.
|
||||
##
|
||||
# set punct ".?!"
|
||||
|
||||
## The email-quote string, used to justify email-quoted paragraphs.
|
||||
## This is an extended regular expression if your system supports them,
|
||||
## otherwise a literal string. Default:
|
||||
# set quotestr "^([ ]*[\|>:}#])+"
|
||||
## if you have regexps, otherwise:
|
||||
# set quotestr "> "
|
||||
## You can get old nano quoted-justify behavior via:
|
||||
# set quotestr "(> )+"
|
||||
|
||||
## Fix Backspace/Delete confusion problem.
|
||||
# set rebinddelete
|
||||
|
||||
## Do extended regular expression searches by default.
|
||||
# set regexp
|
||||
|
||||
## Make the Home key smarter. When Home is pressed anywhere but at the
|
||||
## very beginning of non-whitespace characters on a line, the cursor
|
||||
## will jump to that beginning (either forwards or backwards). If the
|
||||
## cursor is already at that position, it will jump to the true
|
||||
## beginning of the line.
|
||||
# set smarthome
|
||||
|
||||
## Use smooth scrolling as the default.
|
||||
# set smooth
|
||||
|
||||
## Use this spelling checker instead of the internal one. This option
|
||||
## does not properly have a default value.
|
||||
##
|
||||
# set speller "aspell -c"
|
||||
|
||||
## Allow nano to be suspended with ^Z.
|
||||
# set suspend
|
||||
|
||||
## Use this tab size instead of the default; it must be greater than 0.
|
||||
# set tabsize 8
|
||||
|
||||
## Save automatically on exit, don't prompt.
|
||||
# set tempfile
|
||||
|
||||
## Disallow file modification, why would you want this in an rc file? ;)
|
||||
# set view
|
||||
|
||||
## The two characters used to display the first characters of tabs and
|
||||
## spaces. ASCII 187 and ASCII 183 seem to be good values for these.
|
||||
# set whitespace " "
|
||||
|
||||
## Color setup
|
||||
## Format:
|
||||
## syntax "short description" ["filename regex" ...]
|
||||
## color foreground,background "regex" ["regex"...]
|
||||
##
|
||||
## Legal colors: white, black, red, blue, green, yellow, magenta, cyan.
|
||||
## You may use the prefix "bright" to mean a stronger color highlight.
|
||||
##
|
||||
## To use multi-line regexes use the start="regex" end="regex" format.
|
||||
##
|
||||
## If your system supports transparency, not specifying a background
|
||||
## color will use a transparent color. If you don't want this, be sure
|
||||
## to set the background color to black or white.
|
||||
##
|
||||
# syntax "c-file" "\.(c|h)$"
|
||||
# color red "\<[A-Z_]{2,}\>"
|
||||
# color green "\<(float|double|char|int|short|long|enum|void|static|const|struct|union|typedef|extern|signed|unsigned|inline)\>"
|
||||
# color brightyellow "\<(for|if|while|do|else|case|switch|break)\>"
|
||||
# color brightcyan "^ *# *(define|undef|include|ifn?def|endif|elif|else|if)"
|
||||
##
|
||||
## You will in general want your comments and strings to come last,
|
||||
## because syntax highlighting rules will be applied in the order they
|
||||
## are read in.
|
||||
##
|
||||
# color brightyellow "<[^= ]*>" ""(\\.|[^\"])*""
|
||||
##
|
||||
## This string is VERY resource intensive!!!
|
||||
# color brightyellow start=""(\\.|[^\"])*\\ *$" end="^(\\.|[^\"])*""
|
||||
##
|
||||
## And we want to have some nice comment highlighting too
|
||||
# color brightblue "//.*"
|
||||
# color brightblue start="/\*" end="\*/"
|
||||
|
||||
## Here is a short example for HTML
|
||||
# syntax "HTML" "\.html$"
|
||||
# color blue start="<" end=">"
|
||||
# color red "&[^; ]*;"
|
||||
|
||||
## Here is a short example for TeX files
|
||||
# syntax "TeX" "\.tex$"
|
||||
# color green "\\.|\\[A-Za-z]*"
|
||||
# color magenta "[{}]"
|
||||
# color blue "%.*"
|
||||
|
||||
## Here is an example for quoted emails (under e.g. mutt)
|
||||
# syntax "mutt"
|
||||
# color green "^>.*"
|
||||
|
||||
## Here is an example for groff
|
||||
##
|
||||
# syntax "groff" "\.ms$" "\.mm$" "\.me$" "\.tmac$" "^tmac." ".rof"
|
||||
## The argument of .nr or .ds
|
||||
# color cyan "^\.ds [^ ]*"
|
||||
# color cyan "^\.nr [^ ]*"
|
||||
## Single character escapes
|
||||
# color brightmagenta "\\."
|
||||
## Highlight the argument of \f or \s in the same color
|
||||
# color brightmagenta "\\f."
|
||||
# color brightmagenta "\\f\(.."
|
||||
# color brightmagenta "\\s(\+|\-)?[0-9]"
|
||||
## \n
|
||||
# color cyan "(\\|\\\\)n."
|
||||
# color cyan "(\\|\\\\)n\(.."
|
||||
# color cyan start="(\\|\\\\)n\[" end="]"
|
||||
## Requests
|
||||
# color brightgreen "^\. *[^ ]*"
|
||||
## Comments
|
||||
# color yellow "^\.\\\".*$"
|
||||
## Strings
|
||||
# color green "(\\|\\\\)\*."
|
||||
# color green "(\\|\\\\)\*\(.."
|
||||
# color green start="(\\|\\\\)\*\[" end="]"
|
||||
## Characters
|
||||
# color brightred "\\\(.."
|
||||
# color brightred start="\\\[" end="]"
|
||||
## Macro arguments
|
||||
# color brightcyan "\\\\\$[1-9]"
|
||||
|
||||
## Here is an example for perl
|
||||
##
|
||||
# syntax "perl" "\.p[lm]$"
|
||||
# color red "\<(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork)|get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join|keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek|seekdir|se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr|y|truncate|umask|un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\>"
|
||||
# color magenta "\<(continue|else|elsif|do|for|foreach|if|unless|until|while|eq|ne|lt|gt|le|ge|cmp|x|my|sub|use|package|can|isa)\>"
|
||||
# color cyan start="[$@%]" end="( |\\W|-)"
|
||||
# color yellow "".*"|qq\|.*\|"
|
||||
# color white "[sm]/.*/"
|
||||
# color white start="(^use| = new)" end=";"
|
||||
# color green "#.*"
|
||||
# color yellow start="<< 'STOP'" end="STOP"
|
||||
|
||||
## Here is an example for Java source
|
||||
##
|
||||
# syntax "Java source" "\.java$"
|
||||
# color green "\<(boolean|byte|char|double|float|int|long|new|short|this|transient|void)\>"
|
||||
# color red "\<(break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while)\>"
|
||||
# color cyan "\<(abstract|class|extends|final|implements|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)\>"
|
||||
# color red ""[^\"]*""
|
||||
# color yellow "\<(true|false|null)\>"
|
||||
# color blue "//.*"
|
||||
# color blue start="/\*" end="\*/"
|
||||
# color brightblue start="/\*\*" end="\*/"
|
||||
# color brightgreen,green " +$"
|
||||
|
||||
## Here is an example for patch files
|
||||
##
|
||||
# syntax "patch" "\.(patch|diff)$"
|
||||
# color brightgreen "^\+.*"
|
||||
# color green "^\+\+\+.*"
|
||||
# color brightblue "^ .*"
|
||||
# color brightred "^-.*"
|
||||
# color red "^---.*"
|
||||
# color brightyellow "^@@.*"
|
||||
# color magenta "^diff.*"
|
||||
|
||||
## Here is an example for your .nanorc
|
||||
##
|
||||
#syntax "nanorc" "(\.|/|)nanorc$"
|
||||
## highlight possible errors and parameters
|
||||
#color brightwhite "^ *(set|unset|syntax|color).*$"
|
||||
## set, unset and syntax
|
||||
#color cyan "^ *(set|unset) +(autoindent|backup|backupdir|brackets|const|cut|fill|historylog|mouse|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|punct|quotestr|rebinddelete|regexp|smarthome|smooth|speller|suspend|tabsize|tempfile|view|whitespace)"
|
||||
#color green "^ *(set|unset|syntax)\>"
|
||||
## colors
|
||||
#color yellow "^ *color +(bright)?(white|black|red|blue|green|yellow|magenta|cyan)(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
|
||||
#color magenta "^ *color\>" "\<(start|end)="
|
||||
## strings
|
||||
#color white "\"(\\.|[^\"])*\""
|
||||
## comments
|
||||
#color blue "^ *#.*$"
|
||||
4
doc/texinfo/.cvsignore
Normal file
4
doc/texinfo/.cvsignore
Normal file
@@ -0,0 +1,4 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
nano.info
|
||||
texinfo.tex
|
||||
4
doc/texinfo/Makefile.am
Normal file
4
doc/texinfo/Makefile.am
Normal file
@@ -0,0 +1,4 @@
|
||||
info_TEXINFOS = nano.texi
|
||||
MAKEINFO = makeinfo --no-split
|
||||
|
||||
EXTRA_DIST = nano.info
|
||||
@@ -8,8 +8,8 @@
|
||||
@c Run `makeinfo' rather than `texinfo-format-buffer'.
|
||||
@smallbook
|
||||
@set EDITION 0.1
|
||||
@set VERSION 1.2.0
|
||||
@set UPDATED 17 Jan 2003
|
||||
@set VERSION 1.3.4
|
||||
@set UPDATED 17 Aug 2004
|
||||
|
||||
@dircategory Editors
|
||||
@direntry
|
||||
@@ -23,7 +23,7 @@
|
||||
@titlepage
|
||||
@title GNU @code{nano}
|
||||
@subtitle a small and friendly text editor.
|
||||
@subtitle version 1.2.0
|
||||
@subtitle version 1.3.4
|
||||
|
||||
@author Chris Allegretta
|
||||
@page
|
||||
@@ -95,10 +95,10 @@ internationalization support, and filename tab completion.
|
||||
|
||||
The original goal for @code{nano} was a complete bug-for-bug compatible
|
||||
emulation of Pico, but nano's main goal is to be as compatible as
|
||||
possible while offering a superset of Pico's functionality.
|
||||
Also see @xref{Pico Compatibility}, for other differences.
|
||||
possible while offering a superset of Pico's functionality. Also see
|
||||
@xref{Pico Compatibility}, for other differences.
|
||||
|
||||
Email bug reports to @email{nano@@nano-editor.org}.
|
||||
Email bug reports to @email{nano@@nano-editor.org}.
|
||||
|
||||
@node Command Line Options, , Overview, Introduction
|
||||
@section Command Line Options
|
||||
@@ -107,6 +107,13 @@ Email bug reports to @email{nano@@nano-editor.org}.
|
||||
|
||||
@table @code
|
||||
|
||||
@item -A, --smarthome
|
||||
Make the Home key smarter. When Home is pressed anywhere but at the
|
||||
very beginning of non-whitespace characters on a line, the cursor will
|
||||
jump to that beginning (either forwards or backwards). If the cursor is
|
||||
already at that position, it will jump to the true beginning of the
|
||||
line.
|
||||
|
||||
@item -B, --backup
|
||||
When saving a file, back up the previous version of it to the current
|
||||
filename suffixed with a ~.
|
||||
@@ -114,18 +121,17 @@ filename suffixed with a ~.
|
||||
@item -D, --dos
|
||||
Write file in DOS format.
|
||||
|
||||
@item -E, --backupdir=[dir]
|
||||
Set the directory where @code{nano} puts the backup files if file
|
||||
backups are enabled.
|
||||
|
||||
@item -F, --multibuffer
|
||||
Enable multiple file buffers, if available.
|
||||
|
||||
@item -I, --ignorercfiles
|
||||
Don't look at $SYSCONFDIR/nanorc or ~/.nanorc, if nanorc support is
|
||||
Don't look at SYSCONFDIR/nanorc or ~/.nanorc, if nanorc support is
|
||||
available.
|
||||
|
||||
@item -K, --keypad
|
||||
Do not use the ncurses keypad() call unless necessary. Try this flag if
|
||||
you find that the arrow keys on the numeric keypad do not work for you
|
||||
under @code{nano}.
|
||||
|
||||
@item -M, --mac
|
||||
Write file in Mac format.
|
||||
|
||||
@@ -148,19 +154,31 @@ Turn on regular expression search and search/replace.
|
||||
@item -S, --smooth
|
||||
Enable smooth scrolling.
|
||||
|
||||
@item -T [num], --tabsize=[num]
|
||||
Set the displayed tab length to [num] columns.
|
||||
@item -T [num], --tabsize=[#cols]
|
||||
Set the displayed tab length to [#cols] columns.
|
||||
|
||||
@item -V, --version
|
||||
@item -V, --version
|
||||
Print the version number and copyright and quit.
|
||||
|
||||
@item -Y, --syntax=[str]
|
||||
Specify a specific syntax highlighting from the .nanorc to use, if
|
||||
available.
|
||||
|
||||
@item -Z, --restricted
|
||||
Restricted mode: Don't read or write to any file not specified on the
|
||||
command line, read any nanorc files, allow suspending, or allow a file
|
||||
to be appended to, prepended to, or saved under a different name if it
|
||||
already has one. Also accessible by invoking @code{nano} with any name
|
||||
beginning with 'r' (e.g. "rnano").
|
||||
|
||||
@item -c, --const
|
||||
Constantly display the cursor position and line number on the statusbar.
|
||||
|
||||
@item -d, --rebinddelete
|
||||
Interpret the Delete key differently so that both Backspace and Delete
|
||||
work properly. You should only need to use this option if Backspace
|
||||
acts like Delete on your system.
|
||||
|
||||
@item -h, --help
|
||||
Print the usage and exit.
|
||||
|
||||
@@ -181,23 +199,24 @@ Enables the use of the mouse to select text (currently only useful for
|
||||
running under the X window system).
|
||||
|
||||
@item -o [dir], --operatingdir=[dir]
|
||||
Set operating directory. Makes @code{nano} set up something similar to a
|
||||
chroot.
|
||||
Set operating directory. Makes @code{nano} set up something similar to
|
||||
a chroot.
|
||||
|
||||
@item -p, --preserve
|
||||
Preserve the ^Q (XON) and ^S (XOFF) sequences so data being sent to the editor
|
||||
can be can be stopped and started.
|
||||
Preserve the ^Q (XON) and ^S (XOFF) sequences so data being sent to the
|
||||
editor can be can be stopped and started.
|
||||
|
||||
@item -r [#cols], --fill=[#cols].
|
||||
Wrap lines at column #cols. By default this is the width of the screen,
|
||||
less eight. If this value is negative, wrapping will occur at #cols from
|
||||
the right of the screen, allowing it to vary along with the screen width
|
||||
if the screen is resized.
|
||||
less eight. If this value is negative, wrapping will occur at #cols
|
||||
from the right of the screen, allowing it to vary along with the screen
|
||||
width if the screen is resized.
|
||||
|
||||
@item -s [prog], --speller=[prog]
|
||||
Invoke [prog] as the spell checker. By default, @code{nano} uses its
|
||||
own interactive spell checker that requires the @code{spell} program be
|
||||
installed on your system.
|
||||
Invoke [prog] as the spell checker. By default, @code{nano} uses the
|
||||
command specified in the SPELL environment variable, or, if SPELL is not
|
||||
set, its own interactive spell checker that requires the @code{spell}
|
||||
program to be installed on your system.
|
||||
|
||||
@item -t, --tempfile
|
||||
Do not ask whether or not to save the current contents of the file when
|
||||
@@ -206,21 +225,21 @@ composer of a mailer program.
|
||||
|
||||
@anchor{Expert Mode}
|
||||
@item -x, --nohelp
|
||||
In Expert Mode, the Shortcut Lists will not appear at the bottom of the
|
||||
screen. This affects the location of the statusbar as well, as in Expert
|
||||
Mode it is located at the very bottom of the editor.
|
||||
In Expert Mode, the Shortcut Lists will not appear at the bottom of the
|
||||
screen. This affects the location of the statusbar as well, as in
|
||||
Expert Mode it is located at the very bottom of the editor.
|
||||
|
||||
Note: When accessing the help system, Expert Mode is temporarily disabled
|
||||
to display the help system navigation keys.
|
||||
Note: When accessing the help system, Expert Mode is temporarily
|
||||
disabled to display the help system navigation keys.
|
||||
|
||||
@item -v, --view
|
||||
Do not allow the contents of the file to be altered. Note that this
|
||||
flag should NOT be used in place of correct file permissions to implement
|
||||
a read-only file.
|
||||
flag should NOT be used in place of correct file permissions to
|
||||
implement a read-only file.
|
||||
|
||||
@item -w, --nowrap
|
||||
Do not wrap long lines at any length. This option overrides any value for
|
||||
-r.
|
||||
Do not wrap long lines at any length. This option overrides any value
|
||||
for -r.
|
||||
|
||||
@item -z, --suspend
|
||||
Enable suspend ability of @code{nano} using the system's suspend
|
||||
@@ -249,38 +268,41 @@ Start at line number LINE instead of the default of line 1.
|
||||
All key sequences in @code{nano} are entered using the keyboard.
|
||||
@code{nano} is a ``modeless'' editor. All keys with the exception of
|
||||
Control and Meta key sequences will enter text into the file being
|
||||
edited.
|
||||
edited.
|
||||
|
||||
@node Special Functions, The Titlebar, Entering Text, Editor Basics
|
||||
@section Special Functions
|
||||
|
||||
Special functions use the Control key (displayed in the help and
|
||||
shortcut lists as ^) or the Meta key (displayed as M).
|
||||
|
||||
shortcut lists as ^), the Meta key (displayed as M), or the Esc key.
|
||||
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
Control key sequences are entered by holding down the Control key and
|
||||
pressing the desired letter.
|
||||
pressing the desired key, or by pressing the Esc key twice and pressing
|
||||
the desired key.
|
||||
@item
|
||||
Meta key sequences can be entered in a number of
|
||||
possible ways: Pressing the Escape key, then releasing it and pressing
|
||||
the desired key, or holding down the Alt key while pressing the desired
|
||||
key. This varies from keyboard to keyboard, and certain commercial
|
||||
operating systems ``swallow'' the Alt key so that it never reaches the
|
||||
application. If your operating system does this, you should use the
|
||||
Escape key to generate Meta key sequences.
|
||||
Pressing Esc twice and then typing a three-digit number from 000 to 255
|
||||
will enter the character with the corresponding ASCII code.
|
||||
@item
|
||||
Meta key sequences can be entered in a number of possible ways: Pressing
|
||||
the Escape key, then releasing it and pressing the desired key, or
|
||||
holding down the Alt key while pressing the desired key. This varies
|
||||
from keyboard to keyboard, and certain commercial operating systems
|
||||
``swallow'' the Alt key so that it never reaches the application. If
|
||||
your operating system does this, you should use the Escape key to
|
||||
generate Meta key sequences.
|
||||
@end itemize
|
||||
|
||||
@node The Titlebar, The Statusbar, Special Functions, Editor Basics
|
||||
@section The Titlebar
|
||||
|
||||
The titlebar is the line displayed at the top of the editor. There are
|
||||
three sections: left, center and right. The section on the left displays
|
||||
the version of @code{nano} being used. The center section displays the
|
||||
current file name, or ``New Buffer'' if the file has not yet been named.
|
||||
The section on the right will display ``Modified'' if the file has been
|
||||
modified since it was last saved or opened.
|
||||
three sections: left, center and right. The section on the left
|
||||
displays the version of @code{nano} being used. The center section
|
||||
displays the current file name, or ``New Buffer'' if the file has not
|
||||
yet been named. The section on the right will display ``Modified'' if
|
||||
the file has been modified since it was last saved or opened.
|
||||
|
||||
Special modes: When @code{nano} is in ``File browser'' mode, the center
|
||||
section will display the current directory instead of the filename.
|
||||
@@ -302,13 +324,13 @@ the statusbar.
|
||||
@section Shortcut Lists
|
||||
|
||||
The Shortcut Lists are the two lines at the bottom of the screen which
|
||||
show some of the more commonly used functions in the editor.
|
||||
show some of the more commonly used functions in the editor.
|
||||
|
||||
@node Online Help, Feature Toggles, Editor Basics, Top
|
||||
@chapter Online Help
|
||||
|
||||
The online help system in @code{nano} is available by pressing ^G.
|
||||
It is fairly self explanatory, documenting the various parts of the
|
||||
It is fairly self explanatory, documenting the various parts of the
|
||||
editor and available keystrokes. Navigation is via the ^Y (Page Up)
|
||||
and ^V (Page Down) keys. ^X exits the help system.
|
||||
|
||||
@@ -317,8 +339,8 @@ and ^V (Page Down) keys. ^X exits the help system.
|
||||
@chapter Feature Toggles
|
||||
|
||||
Toggles allow you to change certain aspects of the editor that
|
||||
would normally be done via command line flags. They are invoked via
|
||||
certain Meta key sequences. @xref{Special Functions}, for more info.
|
||||
would normally be done via command line flags. They are invoked via
|
||||
certain Meta key sequences. @xref{Special Functions}, for more info.
|
||||
The following global toggles are available:
|
||||
|
||||
@table @code
|
||||
@@ -332,12 +354,18 @@ toggles the -D (@code{--dos}) command line flag.
|
||||
@item Multiple Files Toggle (Meta-F)
|
||||
toggles the -F (@code{--multibuffer}) command line flag.
|
||||
|
||||
@item Backup File Toggle (Meta-H)
|
||||
toggles the -A (@code{--smarthome}) command line flag.
|
||||
|
||||
@item AutoIndent Toggle (Meta-I)
|
||||
toggles the -i (@code{--autoindent}) command line flag.
|
||||
|
||||
@item Cut To End Toggle (Meta-K)
|
||||
toggles the -k (@code{--cut}) command line flag.
|
||||
|
||||
@item Auto Line Wrap Toggle (Meta-L)
|
||||
toggles the -w (@code{--nowrap}) command line flag.
|
||||
|
||||
@item Mouse Toggle (Meta-M)
|
||||
toggles the -m (@code{--mouse}) command line flag.
|
||||
|
||||
@@ -347,21 +375,12 @@ toggles the -M (@code{--mac}) command line flag.
|
||||
@item Smooth Scrolling Toggle (Meta-S)
|
||||
toggles the -S (@code{--smooth}) command line flag.
|
||||
|
||||
@item AutoWrap Toggle (Meta-W)
|
||||
toggles the -w (@code{--nowrap}) command line flag.
|
||||
|
||||
@item Expert/Nohelp Toggle (Meta-X)
|
||||
toggles the -x (@code{--nohelp}) command line flag.
|
||||
|
||||
@item Suspend Toggle (Meta-Z)
|
||||
toggles the -z (@code{--suspend}) command line flag.
|
||||
|
||||
@item Open Previous File Toggle (Meta-<)
|
||||
changes buffer to previously loaded file.
|
||||
|
||||
@item Open Next File Toggle (Meta->)
|
||||
changes buffer to next loaded file.
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
@@ -375,7 +394,7 @@ find the desired file.
|
||||
Basic movement in the file browser is accomplished with the arrow keys
|
||||
and page up/down. The behavior of the enter (or `s') key varies by what
|
||||
is currently selected. If the currently selected object is a directory,
|
||||
the file browser will enter and display the contents of the directory.
|
||||
the file browser will enter and display the contents of the directory.
|
||||
If the object is a file, this filename and path are copied to the
|
||||
statusbar and the file browser is exited.
|
||||
|
||||
@@ -387,17 +406,18 @@ are certain differences between the editors:
|
||||
|
||||
@table @code
|
||||
@item Search and Replace History
|
||||
As of version 1.2.0 of @code{nano}, text entered as search or replace
|
||||
strings will be stored and can be accessed with the up/down
|
||||
arrow keys. Previously, @code{nano} offered a more consistent, but incompatible
|
||||
with Pico, method for entering search and replace strings. In the old
|
||||
method, previous entries would be displayed by default as editable text
|
||||
in front of the cursor, as opposed to being bracketed and uneditable as
|
||||
it is in Pico. The old behavior could be made compatible with Pico via the
|
||||
@code{-p} flag, but recent versions of Pico use the @code{-p} flag
|
||||
to preserve the XON and XOFF sequences within the editor. Since with the new
|
||||
method search and replace strings can still be edited by simply
|
||||
hitting the up arrow key once, the old method was removed completely.
|
||||
As of version 1.1.99pre1 of @code{nano}, text entered as search or
|
||||
replace strings will be stored and can be accessed with the up/down
|
||||
arrow keys. Previously, @code{nano} offered a more consistent, but
|
||||
incompatible with Pico, method for entering search and replace strings.
|
||||
In the old method, previous entries would be displayed by default as
|
||||
editable text in front of the cursor, as opposed to being bracketed and
|
||||
uneditable as it is in Pico. The old behavior could be made compatible
|
||||
with Pico via the @code{-p} flag, but recent versions of Pico use the
|
||||
@code{-p} flag to preserve the XON and XOFF sequences within the editor.
|
||||
Since with the new method search and replace strings can still be edited
|
||||
by simply hitting the up arrow key once, the old method was removed
|
||||
completely.
|
||||
|
||||
|
||||
@item Writing or Appending Selected Text to Files
|
||||
@@ -405,13 +425,12 @@ Text selected using the Control-Caret (^^) key can be written out or
|
||||
appended to a new or existing file using the Writeout key (^O).
|
||||
|
||||
@item Toggles
|
||||
Many options which alter the functionality of the program can be
|
||||
"toggled" on or off using Meta key sequences, meaning the program does
|
||||
not have to be restarted to turn a particular feature of the editor
|
||||
on or off. Please see the internal help function (^G) for a list of
|
||||
what functions can be toggled for a particular version of
|
||||
@code{nano}. Also see @xref{Feature Toggles}, though this may be out
|
||||
of date.
|
||||
Many options which alter the functionality of the program can be
|
||||
"toggled" on or off using Meta key sequences, meaning the program does
|
||||
not have to be restarted to turn a particular feature of the editor on
|
||||
or off. Please see the internal help function (^G) for a list of what
|
||||
functions can be toggled for a particular version of @code{nano}. Also
|
||||
see @xref{Feature Toggles}, though this may be out of date.
|
||||
|
||||
@item Cursor Position Display
|
||||
The output of the "Display Cursor Position" in @code{nano} displays
|
||||
@@ -420,21 +439,21 @@ position of the cursor.
|
||||
|
||||
@item Interactive Replace and Spell Checker
|
||||
It is worth noting that the @code{nano} replace function is interactive,
|
||||
i.e. it does not stop after one search string is found and automatically
|
||||
i.e, it does not stop after one search string is found and automatically
|
||||
replace it. The @code{nano} implementation will stop at each search
|
||||
string found and query whether to replace this instance or not. The
|
||||
internal spell checker operates similarly. Note that these is no way
|
||||
to force these functions to behave in the Pico fashion. As of
|
||||
version 1.2.0, misspelled words are sorted and trimmed for
|
||||
uniqueness in the internal spell checker such that the words 'apple'
|
||||
and 'Apple' will be prompted for correction separately.
|
||||
string found and query whether to replace this instance or not. The
|
||||
internal spell checker operates similarly. Note that these is no way to
|
||||
force these functions to behave in the Pico fashion. As of version
|
||||
1.1.99pre1, misspelled words are sorted and trimmed for uniqueness in
|
||||
the internal spell checker such that the words 'apple' and 'Apple' will
|
||||
be prompted for correction separately.
|
||||
@end table
|
||||
|
||||
@node Building and Configure Options, , Pico Compatibility, Top
|
||||
@chapter Building and Configure Options
|
||||
|
||||
Building @code{nano} from source is fairly straightforward if you are familiar
|
||||
with compiling programs with autoconf support:
|
||||
Building @code{nano} from source is fairly straightforward if you are
|
||||
familiar with compiling programs with autoconf support:
|
||||
|
||||
@itemize @bullet
|
||||
@item tar xvfz nano-x.y.z.tar.gz (where x.y.z is the version of nano)
|
||||
@@ -486,7 +505,7 @@ Disable all word wrapping in the editor. This also eliminates the -w
|
||||
command line flag, as nonwrapping is then the default behavior.
|
||||
|
||||
@item --disable-nls
|
||||
Disables Native Language support. This will make the available GNU
|
||||
Disables Native Language support. This will make the available GNU
|
||||
@code{nano} translations unusable.
|
||||
|
||||
@item --with-slang
|
||||
908
global.c
908
global.c
@@ -1,908 +0,0 @@
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* global.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2003 Chris Allegretta *
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <sys/stat.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
/* Global variables */
|
||||
|
||||
/* wrap_at might be set in rcfile.c or nano.c */
|
||||
int wrap_at = -CHARS_FROM_EOL;/* Right justified fill value, allows resize */
|
||||
char *last_search = NULL; /* Last string we searched for */
|
||||
char *last_replace = NULL; /* Last replacement string */
|
||||
int search_last_line; /* Is this the last search line? */
|
||||
int search_offscreen; /* Search lines not displayed */
|
||||
|
||||
int flags = 0; /* Our new flag containing many options */
|
||||
WINDOW *edit; /* The file portion of the editor */
|
||||
WINDOW *topwin; /* Top line of screen */
|
||||
WINDOW *bottomwin; /* Bottom buffer */
|
||||
char *filename = NULL; /* Name of the file */
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
struct stat originalfilestat; /* Stat for the file as we loaded it */
|
||||
#endif
|
||||
|
||||
int editwinrows = 0; /* How many rows long is the edit
|
||||
window? */
|
||||
filestruct *current; /* Current buffer pointer */
|
||||
int current_x = 0, current_y = 0; /* Current position of X and Y in
|
||||
the editor - relative to edit
|
||||
window (0,0) */
|
||||
filestruct *fileage = NULL; /* Our file buffer */
|
||||
filestruct *edittop = NULL; /* Pointer to the top of the edit
|
||||
buffer with respect to the
|
||||
file struct */
|
||||
filestruct *editbot = NULL; /* Same for the bottom */
|
||||
filestruct *filebot = NULL; /* Last node in the file struct */
|
||||
filestruct *cutbuffer = NULL; /* A place to store cut text */
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
openfilestruct *open_files = NULL; /* The list of open files */
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
char *quotestr = NULL; /* Quote string. The default value is
|
||||
set in main(). */
|
||||
#endif
|
||||
|
||||
int resetstatuspos; /* Hack for resetting the status bar
|
||||
cursor position */
|
||||
char *answer = NULL; /* Answer str to many questions */
|
||||
int totlines = 0; /* Total number of lines in the file */
|
||||
long totsize = 0; /* Total number of bytes in the file */
|
||||
int placewewant = 0; /* The column we'd like the cursor
|
||||
to jump to when we go to the
|
||||
next or previous line */
|
||||
|
||||
int tabsize = -1; /* Our internal tabsize variable. The
|
||||
default value 8 is set in main(). */
|
||||
|
||||
char *hblank = NULL; /* A horizontal blank line */
|
||||
#ifndef DISABLE_HELP
|
||||
char *help_text; /* The text in the help window */
|
||||
#endif
|
||||
|
||||
/* More stuff for the marker select */
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
filestruct *mark_beginbuf; /* the begin marker buffer */
|
||||
int mark_beginx; /* X value in the string to start */
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
char *operating_dir = NULL; /* Operating directory, which we can't */
|
||||
char *full_operating_dir = NULL;/* go higher than */
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_SPELLER
|
||||
char *alt_speller = NULL; /* Alternative spell command */
|
||||
#endif
|
||||
|
||||
shortcut *main_list = NULL;
|
||||
shortcut *whereis_list = NULL;
|
||||
shortcut *replace_list = NULL;
|
||||
shortcut *replace_list_2 = NULL; /* 2nd half of replace dialog */
|
||||
shortcut *goto_list = NULL;
|
||||
shortcut *writefile_list = NULL;
|
||||
shortcut *insertfile_list = NULL;
|
||||
#ifndef DISABLE_HELP
|
||||
shortcut *help_list = NULL;
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
shortcut *spell_list = NULL;
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
shortcut *extcmd_list = NULL;
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
shortcut *browser_list = NULL;
|
||||
shortcut *gotodir_list = NULL;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
const colortype *colorstrings = NULL;
|
||||
syntaxtype *syntaxes = NULL;
|
||||
char *syntaxstr = NULL;
|
||||
#endif
|
||||
|
||||
#if !defined(DISABLE_BROWSER) || !defined(DISABLE_HELP) || (!defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION))
|
||||
const shortcut *currshortcut; /* Current shortcut list we're using */
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
toggle *toggles = NULL;
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
historyheadtype search_history;
|
||||
historyheadtype replace_history;
|
||||
#endif
|
||||
|
||||
/* Regular expressions */
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
regex_t search_regexp; /* Global to store compiled search regexp */
|
||||
regmatch_t regmatches[10]; /* Match positions for parenthetical
|
||||
subexpressions, max of 10 */
|
||||
#endif
|
||||
|
||||
int curses_ended = FALSE; /* Indicates to statusbar() to simply
|
||||
* write to stderr, since endwin() has
|
||||
* ended curses mode. */
|
||||
|
||||
|
||||
int length_of_list(const shortcut *s)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
for (; s != NULL; s = s->next)
|
||||
i++;
|
||||
return i;
|
||||
}
|
||||
|
||||
/* Initialize a struct *without* our lovely braces =( */
|
||||
void sc_init_one(shortcut **shortcutage, int key, const char *desc,
|
||||
#ifndef DISABLE_HELP
|
||||
const char *help,
|
||||
#endif
|
||||
int alt, int misc1, int misc2, int view, int (*func) (void))
|
||||
{
|
||||
shortcut *s;
|
||||
|
||||
if (*shortcutage == NULL) {
|
||||
*shortcutage = nmalloc(sizeof(shortcut));
|
||||
s = *shortcutage;
|
||||
} else {
|
||||
for (s = *shortcutage; s->next != NULL; s = s->next)
|
||||
;
|
||||
s->next = nmalloc(sizeof(shortcut));
|
||||
s = s->next;
|
||||
}
|
||||
|
||||
s->val = key;
|
||||
s->desc = desc;
|
||||
#ifndef DISABLE_HELP
|
||||
s->help = help;
|
||||
#endif
|
||||
s->altval = alt;
|
||||
s->misc1 = misc1;
|
||||
s->misc2 = misc2;
|
||||
s->viewok = view;
|
||||
s->func = func;
|
||||
s->next = NULL;
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* Create one new toggle structure, at the end of the toggles
|
||||
* linked list. */
|
||||
void toggle_init_one(int val, const char *desc, int flag)
|
||||
{
|
||||
toggle *u;
|
||||
|
||||
if (toggles == NULL) {
|
||||
toggles = nmalloc(sizeof(toggle));
|
||||
u = toggles;
|
||||
} else {
|
||||
for (u = toggles; u->next != NULL; u = u->next)
|
||||
;
|
||||
u->next = nmalloc(sizeof(toggle));
|
||||
u = u->next;
|
||||
}
|
||||
|
||||
u->val = val;
|
||||
u->desc = desc;
|
||||
u->flag = flag;
|
||||
u->next = NULL;
|
||||
}
|
||||
|
||||
void toggle_init(void)
|
||||
{
|
||||
char *toggle_const_msg, *toggle_autoindent_msg, *toggle_suspend_msg,
|
||||
*toggle_nohelp_msg, *toggle_cuttoend_msg,
|
||||
*toggle_noconvert_msg, *toggle_dos_msg, *toggle_mac_msg,
|
||||
*toggle_backup_msg, *toggle_smooth_msg;
|
||||
#if !defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION)
|
||||
char *toggle_mouse_msg;
|
||||
#endif
|
||||
#ifndef DISABLE_WRAPPING
|
||||
char *toggle_wrap_msg;
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
char *toggle_load_msg;
|
||||
#endif
|
||||
#ifdef ENABLE_COLOR
|
||||
char *toggle_syntax_msg;
|
||||
#endif
|
||||
|
||||
/* There is no need to reinitialize the toggles. They can't
|
||||
change. */
|
||||
if (toggles != NULL)
|
||||
return;
|
||||
|
||||
toggle_const_msg = _("Constant cursor position");
|
||||
toggle_autoindent_msg = _("Auto indent");
|
||||
toggle_suspend_msg = _("Suspend");
|
||||
toggle_nohelp_msg = _("Help mode");
|
||||
#if !defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION)
|
||||
toggle_mouse_msg = _("Mouse support");
|
||||
#endif
|
||||
toggle_cuttoend_msg = _("Cut to end");
|
||||
toggle_noconvert_msg = _("No conversion from DOS/Mac format");
|
||||
toggle_dos_msg = _("Writing file in DOS format");
|
||||
toggle_mac_msg = _("Writing file in Mac format");
|
||||
toggle_backup_msg = _("Backing up file");
|
||||
toggle_smooth_msg = _("Smooth scrolling");
|
||||
#ifdef ENABLE_COLOR
|
||||
toggle_syntax_msg = _("Color syntax highlighting");
|
||||
#endif
|
||||
#ifndef DISABLE_WRAPPING
|
||||
toggle_wrap_msg = _("Auto wrap");
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
toggle_load_msg = _("Multiple file buffers");
|
||||
#endif
|
||||
|
||||
toggle_init_one(TOGGLE_CONST_KEY, toggle_const_msg, CONSTUPDATE);
|
||||
toggle_init_one(TOGGLE_AUTOINDENT_KEY, toggle_autoindent_msg, AUTOINDENT);
|
||||
toggle_init_one(TOGGLE_SUSPEND_KEY, toggle_suspend_msg, SUSPEND);
|
||||
toggle_init_one(TOGGLE_NOHELP_KEY, toggle_nohelp_msg, NO_HELP);
|
||||
#ifndef DISABLE_WRAPPING
|
||||
toggle_init_one(TOGGLE_WRAP_KEY, toggle_wrap_msg, NO_WRAP);
|
||||
#endif
|
||||
#if !defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION)
|
||||
toggle_init_one(TOGGLE_MOUSE_KEY, toggle_mouse_msg, USE_MOUSE);
|
||||
#endif
|
||||
toggle_init_one(TOGGLE_CUTTOEND_KEY, toggle_cuttoend_msg, CUT_TO_END);
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
toggle_init_one(TOGGLE_LOAD_KEY, toggle_load_msg, MULTIBUFFER);
|
||||
#endif
|
||||
toggle_init_one(TOGGLE_NOCONVERT_KEY, toggle_noconvert_msg, NO_CONVERT);
|
||||
toggle_init_one(TOGGLE_DOS_KEY, toggle_dos_msg, DOS_FILE);
|
||||
toggle_init_one(TOGGLE_MAC_KEY, toggle_mac_msg, MAC_FILE);
|
||||
toggle_init_one(TOGGLE_BACKUP_KEY, toggle_backup_msg, BACKUP_FILE);
|
||||
toggle_init_one(TOGGLE_SMOOTH_KEY, toggle_smooth_msg, SMOOTHSCROLL);
|
||||
#ifdef ENABLE_COLOR
|
||||
toggle_init_one(TOGGLE_SYNTAX_KEY, toggle_syntax_msg, COLOR_SYNTAX);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/* Deallocate all of the toggles. */
|
||||
void free_toggles(void)
|
||||
{
|
||||
while (toggles != NULL) {
|
||||
toggle *pt = toggles; /* Think "previous toggle" */
|
||||
|
||||
toggles = toggles->next;
|
||||
free(pt);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
/* Deallocate the given shortcut. */
|
||||
void free_shortcutage(shortcut **shortcutage)
|
||||
{
|
||||
assert(shortcutage != NULL);
|
||||
while (*shortcutage != NULL) {
|
||||
shortcut *ps = *shortcutage;
|
||||
*shortcutage = (*shortcutage)->next;
|
||||
free(ps);
|
||||
}
|
||||
}
|
||||
|
||||
void shortcut_init(int unjustify)
|
||||
{
|
||||
#ifndef DISABLE_HELP
|
||||
const char *nano_help_msg = "", *nano_writeout_msg = "", *nano_exit_msg =
|
||||
"", *nano_goto_msg = "", *nano_justify_msg =
|
||||
"", *nano_replace_msg = "", *nano_insert_msg =
|
||||
"", *nano_whereis_msg = "", *nano_prevpage_msg =
|
||||
"", *nano_nextpage_msg = "", *nano_cut_msg =
|
||||
"", *nano_uncut_msg = "", *nano_cursorpos_msg =
|
||||
"", *nano_spell_msg = "", *nano_up_msg = "", *nano_down_msg =
|
||||
"", *nano_forward_msg = "", *nano_back_msg = "", *nano_home_msg =
|
||||
"", *nano_end_msg = "", *nano_firstline_msg =
|
||||
"", *nano_lastline_msg = "", *nano_refresh_msg =
|
||||
"", *nano_mark_msg = "", *nano_delete_msg =
|
||||
"", *nano_backspace_msg = "", *nano_tab_msg =
|
||||
"", *nano_enter_msg = "", *nano_cancel_msg =
|
||||
"", *nano_unjustify_msg = "", *nano_append_msg =
|
||||
"", *nano_prepend_msg = "", *nano_tofiles_msg =
|
||||
"", *nano_gotodir_msg = "", *nano_case_msg =
|
||||
"", *nano_reverse_msg = "", *nano_execute_msg =
|
||||
"", *nano_dos_msg = "", *nano_mac_msg =
|
||||
"", *nano_backup_msg = "", *nano_editstr_msg = "";
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
const char *nano_openprev_msg = "", *nano_opennext_msg =
|
||||
"", *nano_multibuffer_msg = "";
|
||||
#endif
|
||||
#ifdef HAVE_REGEX_H
|
||||
const char *nano_regexp_msg = "", *nano_bracket_msg = "";
|
||||
#endif
|
||||
|
||||
nano_help_msg = _("Invoke the help menu");
|
||||
nano_writeout_msg = _("Write the current file to disk");
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
nano_exit_msg = _("Close currently loaded file/Exit from nano");
|
||||
#else
|
||||
nano_exit_msg = _("Exit from nano");
|
||||
#endif
|
||||
nano_goto_msg = _("Go to a specific line number");
|
||||
nano_justify_msg = _("Justify the current paragraph");
|
||||
nano_unjustify_msg = _("Unjustify after a justify");
|
||||
nano_replace_msg = _("Replace text within the editor");
|
||||
nano_insert_msg = _("Insert another file into the current one");
|
||||
nano_whereis_msg = _("Search for text within the editor");
|
||||
nano_prevpage_msg = _("Move to the previous screen");
|
||||
nano_nextpage_msg = _("Move to the next screen");
|
||||
nano_cut_msg = _("Cut the current line and store it in the cutbuffer");
|
||||
nano_uncut_msg = _("Uncut from the cutbuffer into the current line");
|
||||
nano_cursorpos_msg = _("Show the position of the cursor");
|
||||
nano_spell_msg = _("Invoke the spell checker, if available");
|
||||
nano_up_msg = _("Move up one line");
|
||||
nano_down_msg = _("Move down one line");
|
||||
nano_forward_msg = _("Move forward one character");
|
||||
nano_back_msg = _("Move back one character");
|
||||
nano_home_msg = _("Move to the beginning of the current line");
|
||||
nano_end_msg = _("Move to the end of the current line");
|
||||
nano_firstline_msg = _("Go to the first line of the file");
|
||||
nano_lastline_msg = _("Go to the last line of the file");
|
||||
nano_refresh_msg = _("Refresh (redraw) the current screen");
|
||||
nano_mark_msg = _("Mark text at the current cursor location");
|
||||
nano_delete_msg = _("Delete the character under the cursor");
|
||||
nano_backspace_msg =
|
||||
_("Delete the character to the left of the cursor");
|
||||
nano_tab_msg = _("Insert a tab character");
|
||||
nano_enter_msg = _("Insert a carriage return at the cursor position");
|
||||
nano_case_msg =
|
||||
_("Make the current search or replace case (in)sensitive");
|
||||
nano_tofiles_msg = _("Go to file browser");
|
||||
nano_execute_msg = _("Execute external command");
|
||||
nano_gotodir_msg = _("Go to directory");
|
||||
nano_cancel_msg = _("Cancel the current function");
|
||||
nano_append_msg = _("Append to the current file");
|
||||
nano_prepend_msg = _("Prepend to the current file");
|
||||
nano_reverse_msg = _("Search backwards");
|
||||
nano_dos_msg = _("Write file out in DOS format");
|
||||
nano_mac_msg = _("Write file out in Mac format");
|
||||
nano_backup_msg = _("Back up original file when saving");
|
||||
nano_editstr_msg = _("Edit the previous search/replace strings");
|
||||
#ifdef HAVE_REGEX_H
|
||||
nano_regexp_msg = _("Use regular expressions");
|
||||
nano_bracket_msg = _("Find other bracket");
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
nano_openprev_msg = _("Open previously loaded file");
|
||||
nano_opennext_msg = _("Open next loaded file");
|
||||
nano_multibuffer_msg = _("Toggle insert into new buffer");
|
||||
#endif
|
||||
#endif /* !DISABLE_HELP */
|
||||
|
||||
free_shortcutage(&main_list);
|
||||
|
||||
/* The following macro is to be used in calling sc_init_one. The point is
|
||||
* that sc_init_one takes 9 arguments, unless DISABLE_HELP is defined,
|
||||
* when the fourth one should not be there. */
|
||||
#ifdef DISABLE_HELP
|
||||
# define IFHELP(help, nextvar) nextvar
|
||||
#else
|
||||
# define IFHELP(help, nextvar) help, nextvar
|
||||
#endif
|
||||
|
||||
sc_init_one(&main_list, NANO_HELP_KEY, _("Get Help"),
|
||||
IFHELP(nano_help_msg, 0), NANO_HELP_FKEY, 0, VIEW,
|
||||
do_help);
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (open_files != NULL && (open_files->prev != NULL || open_files->next != NULL))
|
||||
sc_init_one(&main_list, NANO_EXIT_KEY, _("Close"),
|
||||
IFHELP(nano_exit_msg, 0), NANO_EXIT_FKEY, 0, VIEW,
|
||||
do_exit);
|
||||
else
|
||||
#endif
|
||||
|
||||
sc_init_one(&main_list, NANO_EXIT_KEY, _("Exit"),
|
||||
IFHELP(nano_exit_msg, 0), NANO_EXIT_FKEY, 0, VIEW,
|
||||
do_exit);
|
||||
|
||||
sc_init_one(&main_list, NANO_WRITEOUT_KEY, _("WriteOut"),
|
||||
IFHELP(nano_writeout_msg, 0),
|
||||
NANO_WRITEOUT_FKEY, 0, NOVIEW, do_writeout_void);
|
||||
|
||||
sc_init_one(&main_list, NANO_JUSTIFY_KEY, _("Justify"),
|
||||
IFHELP(nano_justify_msg, 0), NANO_JUSTIFY_FKEY, 0,
|
||||
NOVIEW, do_justify);
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
/* this is so we can view multiple files */
|
||||
sc_init_one(&main_list, NANO_INSERTFILE_KEY, _("Read File"),
|
||||
IFHELP(nano_insert_msg, 0),
|
||||
NANO_INSERTFILE_FKEY, 0, VIEW, do_insertfile_void);
|
||||
#else
|
||||
sc_init_one(&main_list, NANO_INSERTFILE_KEY, _("Read File"),
|
||||
IFHELP(nano_insert_msg, 0),
|
||||
NANO_INSERTFILE_FKEY, 0, NOVIEW, do_insertfile_void);
|
||||
#endif
|
||||
|
||||
sc_init_one(&main_list, NANO_WHEREIS_KEY, _("Where Is"),
|
||||
IFHELP(nano_whereis_msg, 0),
|
||||
NANO_WHEREIS_FKEY, 0, VIEW, do_search);
|
||||
|
||||
sc_init_one(&main_list, NANO_PREVPAGE_KEY, _("Prev Page"),
|
||||
IFHELP(nano_prevpage_msg, 0),
|
||||
NANO_PREVPAGE_FKEY, KEY_PPAGE, VIEW, do_page_up);
|
||||
|
||||
sc_init_one(&main_list, NANO_NEXTPAGE_KEY, _("Next Page"),
|
||||
IFHELP(nano_nextpage_msg, 0),
|
||||
NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, do_page_down);
|
||||
|
||||
sc_init_one(&main_list, NANO_CUT_KEY, _("Cut Text"),
|
||||
IFHELP(nano_cut_msg, 0),
|
||||
NANO_CUT_FKEY, 0, NOVIEW, do_cut_text);
|
||||
|
||||
if (unjustify)
|
||||
sc_init_one(&main_list, NANO_UNJUSTIFY_KEY, _("UnJustify"),
|
||||
IFHELP(nano_unjustify_msg, 0),
|
||||
0, 0, NOVIEW, do_uncut_text);
|
||||
else
|
||||
sc_init_one(&main_list, NANO_UNCUT_KEY, _("UnCut Txt"),
|
||||
IFHELP(nano_uncut_msg, 0),
|
||||
NANO_UNCUT_FKEY, 0, NOVIEW, do_uncut_text);
|
||||
|
||||
sc_init_one(&main_list, NANO_CURSORPOS_KEY, _("Cur Pos"),
|
||||
IFHELP(nano_cursorpos_msg, 0),
|
||||
NANO_CURSORPOS_FKEY, 0, VIEW, do_cursorpos_void);
|
||||
|
||||
sc_init_one(&main_list, NANO_SPELL_KEY, _("To Spell"),
|
||||
IFHELP(nano_spell_msg, 0),
|
||||
NANO_SPELL_FKEY, 0, NOVIEW, do_spell);
|
||||
|
||||
sc_init_one(&main_list, NANO_UP_KEY, _("Up"),
|
||||
IFHELP(nano_up_msg, 0),
|
||||
KEY_UP, 0, VIEW, do_up);
|
||||
|
||||
sc_init_one(&main_list, NANO_DOWN_KEY, _("Down"),
|
||||
IFHELP(nano_down_msg, 0),
|
||||
KEY_DOWN, 0, VIEW, do_down);
|
||||
|
||||
sc_init_one(&main_list, NANO_FORWARD_KEY, _("Forward"),
|
||||
IFHELP(nano_forward_msg, 0),
|
||||
KEY_RIGHT, 0, VIEW, do_right);
|
||||
|
||||
sc_init_one(&main_list, NANO_BACK_KEY, _("Back"),
|
||||
IFHELP(nano_back_msg, 0),
|
||||
KEY_LEFT, 0, VIEW, do_left);
|
||||
|
||||
sc_init_one(&main_list, NANO_HOME_KEY, _("Home"),
|
||||
IFHELP(nano_home_msg, 0),
|
||||
KEY_HOME, 362, VIEW, do_home);
|
||||
|
||||
sc_init_one(&main_list, NANO_END_KEY, _("End"),
|
||||
IFHELP(nano_end_msg, 0),
|
||||
KEY_END, 385, VIEW, do_end);
|
||||
|
||||
sc_init_one(&main_list, NANO_REFRESH_KEY, _("Refresh"),
|
||||
IFHELP(nano_refresh_msg, 0),
|
||||
0, 0, VIEW, total_refresh);
|
||||
|
||||
sc_init_one(&main_list, NANO_MARK_KEY, _("Mark Text"),
|
||||
IFHELP(nano_mark_msg, NANO_ALT_MARK_KEY),
|
||||
0, 0, NOVIEW, do_mark);
|
||||
|
||||
sc_init_one(&main_list, NANO_DELETE_KEY, _("Delete"),
|
||||
IFHELP(nano_delete_msg, 0), KEY_DC,
|
||||
NANO_CONTROL_D, NOVIEW, do_delete);
|
||||
|
||||
sc_init_one(&main_list, NANO_BACKSPACE_KEY, _("Backspace"),
|
||||
IFHELP(nano_backspace_msg, 0),
|
||||
KEY_BACKSPACE, 127, NOVIEW, do_backspace);
|
||||
|
||||
sc_init_one(&main_list, NANO_TAB_KEY, _("Tab"),
|
||||
IFHELP(nano_tab_msg, 0), 0, 0, NOVIEW, do_tab);
|
||||
|
||||
sc_init_one(&main_list, NANO_REPLACE_KEY, _("Replace"),
|
||||
IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY),
|
||||
NANO_REPLACE_FKEY, 0, NOVIEW, do_replace);
|
||||
|
||||
sc_init_one(&main_list, NANO_ENTER_KEY, _("Enter"),
|
||||
IFHELP(nano_enter_msg, 0),
|
||||
KEY_ENTER, NANO_CONTROL_M, NOVIEW, do_enter);
|
||||
|
||||
sc_init_one(&main_list, NANO_GOTO_KEY, _("Go To Line"),
|
||||
IFHELP(nano_goto_msg, NANO_ALT_GOTO_KEY),
|
||||
NANO_GOTO_FKEY, 0, VIEW, do_gotoline_void);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
sc_init_one(&main_list, NANO_NEXTWORD_KEY, _("Next Word"),
|
||||
IFHELP(_("Move forward one word"), 0),
|
||||
0, 0, VIEW, do_next_word);
|
||||
|
||||
sc_init_one(&main_list, -9, _("Prev Word"),
|
||||
IFHELP(_("Move backward one word"), NANO_PREVWORD_KEY), 0, 0,
|
||||
VIEW, do_prev_word);
|
||||
#endif
|
||||
#if !defined(NANO_SMALL) && defined(HAVE_REGEX_H)
|
||||
sc_init_one(&main_list, -9, _("Find Other Bracket"),
|
||||
IFHELP(nano_bracket_msg, NANO_BRACKET_KEY),
|
||||
0, 0, VIEW, do_find_bracket);
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
sc_init_one(&main_list, -9, _("Previous File"),
|
||||
IFHELP(nano_openprev_msg, NANO_OPENPREV_KEY),
|
||||
0, 0, VIEW, open_prevfile_void);
|
||||
sc_init_one(&main_list, -9, _("Next File"),
|
||||
IFHELP(nano_opennext_msg, NANO_OPENNEXT_KEY),
|
||||
0, 0, VIEW, open_nextfile_void);
|
||||
#endif
|
||||
|
||||
free_shortcutage(&whereis_list);
|
||||
|
||||
sc_init_one(&whereis_list, NANO_HELP_KEY, _("Get Help"),
|
||||
IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
|
||||
|
||||
sc_init_one(&whereis_list, NANO_CANCEL_KEY, _("Cancel"),
|
||||
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
|
||||
|
||||
sc_init_one(&whereis_list, NANO_FIRSTLINE_KEY, _("First Line"),
|
||||
IFHELP(nano_firstline_msg, 0),
|
||||
0, 0, VIEW, do_first_line);
|
||||
|
||||
sc_init_one(&whereis_list, NANO_LASTLINE_KEY, _("Last Line"),
|
||||
IFHELP(nano_lastline_msg, 0), 0, 0, VIEW, do_last_line);
|
||||
|
||||
sc_init_one(&whereis_list, NANO_OTHERSEARCH_KEY, _("Replace"),
|
||||
IFHELP(nano_replace_msg, 0), 0, 0, VIEW, do_replace);
|
||||
|
||||
sc_init_one(&whereis_list, NANO_FROMSEARCHTOGOTO_KEY, _("Go To Line"),
|
||||
IFHELP(nano_goto_msg, 0), 0, 0, VIEW, do_gotoline_void);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
sc_init_one(&whereis_list, TOGGLE_CASE_KEY, _("Case Sens"),
|
||||
IFHELP(nano_case_msg, 0), 0, 0, VIEW, 0);
|
||||
|
||||
sc_init_one(&whereis_list, TOGGLE_BACKWARDS_KEY, _("Direction"),
|
||||
IFHELP(nano_reverse_msg, 0), 0, 0, VIEW, 0);
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
sc_init_one(&whereis_list, TOGGLE_REGEXP_KEY, _("Regexp"),
|
||||
IFHELP(nano_regexp_msg, 0), 0, 0, VIEW, 0);
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
sc_init_one(&whereis_list, KEY_UP, _("History"),
|
||||
IFHELP(nano_editstr_msg, 0), NANO_UP_KEY, 0, VIEW, 0);
|
||||
#endif
|
||||
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
free_shortcutage(&replace_list);
|
||||
|
||||
sc_init_one(&replace_list, NANO_HELP_KEY, _("Get Help"),
|
||||
IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
|
||||
|
||||
sc_init_one(&replace_list, NANO_CANCEL_KEY, _("Cancel"),
|
||||
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
|
||||
|
||||
sc_init_one(&replace_list, NANO_FIRSTLINE_KEY, _("First Line"),
|
||||
IFHELP(nano_firstline_msg, 0), 0, 0, VIEW, do_first_line);
|
||||
|
||||
sc_init_one(&replace_list, NANO_LASTLINE_KEY, _("Last Line"),
|
||||
IFHELP(nano_lastline_msg, 0), 0, 0, VIEW, do_last_line);
|
||||
|
||||
sc_init_one(&replace_list, NANO_OTHERSEARCH_KEY, _("No Replace"),
|
||||
IFHELP(nano_whereis_msg, 0), 0, 0, VIEW, do_search);
|
||||
|
||||
sc_init_one(&replace_list, NANO_FROMSEARCHTOGOTO_KEY, _("Go To Line"),
|
||||
IFHELP(nano_goto_msg, 0), 0, 0, VIEW, do_gotoline_void);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
sc_init_one(&replace_list, TOGGLE_CASE_KEY, _("Case Sens"),
|
||||
IFHELP(nano_case_msg, 0), 0, 0, VIEW, 0);
|
||||
|
||||
sc_init_one(&replace_list, TOGGLE_BACKWARDS_KEY, _("Direction"),
|
||||
IFHELP(nano_reverse_msg, 0), 0, 0, VIEW, 0);
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
sc_init_one(&replace_list, TOGGLE_REGEXP_KEY, _("Regexp"),
|
||||
IFHELP(nano_regexp_msg, 0), 0, 0, VIEW, 0);
|
||||
#endif
|
||||
|
||||
sc_init_one(&replace_list, KEY_UP, _("History"),
|
||||
IFHELP(nano_editstr_msg, 0), NANO_UP_KEY, 0, VIEW, 0);
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
free_shortcutage(&replace_list_2);
|
||||
|
||||
sc_init_one(&replace_list_2, NANO_HELP_KEY, _("Get Help"),
|
||||
IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
|
||||
|
||||
sc_init_one(&replace_list_2, NANO_CANCEL_KEY, _("Cancel"),
|
||||
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
|
||||
|
||||
sc_init_one(&replace_list_2, NANO_FIRSTLINE_KEY, _("First Line"),
|
||||
IFHELP(nano_firstline_msg, 0), 0, 0, VIEW, do_first_line);
|
||||
|
||||
sc_init_one(&replace_list_2, NANO_LASTLINE_KEY, _("Last Line"),
|
||||
IFHELP(nano_lastline_msg, 0), 0, 0, VIEW, do_last_line);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
sc_init_one(&replace_list_2, KEY_UP, _("History"),
|
||||
IFHELP(nano_editstr_msg, 0), NANO_UP_KEY, 0, VIEW, 0);
|
||||
#endif
|
||||
|
||||
free_shortcutage(&goto_list);
|
||||
|
||||
sc_init_one(&goto_list, NANO_HELP_KEY, _("Get Help"),
|
||||
IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
|
||||
|
||||
sc_init_one(&goto_list, NANO_CANCEL_KEY, _("Cancel"),
|
||||
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
|
||||
|
||||
sc_init_one(&goto_list, NANO_FIRSTLINE_KEY, _("First Line"),
|
||||
IFHELP(nano_firstline_msg, 0), 0, 0, VIEW, do_first_line);
|
||||
|
||||
sc_init_one(&goto_list, NANO_LASTLINE_KEY, _("Last Line"),
|
||||
IFHELP(nano_lastline_msg, 0), 0, 0, VIEW, do_last_line);
|
||||
|
||||
#ifndef DISABLE_HELP
|
||||
free_shortcutage(&help_list);
|
||||
|
||||
sc_init_one(&help_list, NANO_PREVPAGE_KEY, _("Prev Page"),
|
||||
IFHELP(nano_prevpage_msg, 0), NANO_PREVPAGE_FKEY,
|
||||
KEY_PPAGE, VIEW, do_page_up);
|
||||
|
||||
sc_init_one(&help_list, NANO_NEXTPAGE_KEY, _("Next Page"),
|
||||
IFHELP(nano_nextpage_msg, 0),
|
||||
NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, do_page_down);
|
||||
|
||||
sc_init_one(&help_list, NANO_EXIT_KEY, _("Exit"),
|
||||
IFHELP(nano_exit_msg, 0), NANO_EXIT_FKEY, 0, VIEW,
|
||||
do_exit);
|
||||
#endif
|
||||
|
||||
free_shortcutage(&writefile_list);
|
||||
|
||||
sc_init_one(&writefile_list, NANO_HELP_KEY, _("Get Help"),
|
||||
IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
sc_init_one(&writefile_list, NANO_TOFILES_KEY, _("To Files"),
|
||||
IFHELP(nano_tofiles_msg, 0), 0, 0, NOVIEW, 0);
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
sc_init_one(&writefile_list, TOGGLE_DOS_KEY, _("DOS Format"),
|
||||
IFHELP(nano_dos_msg, 0), 0, 0, NOVIEW, 0);
|
||||
|
||||
sc_init_one(&writefile_list, TOGGLE_MAC_KEY, _("Mac Format"),
|
||||
IFHELP(nano_mac_msg, 0), 0, 0, NOVIEW, 0);
|
||||
#endif
|
||||
|
||||
sc_init_one(&writefile_list, NANO_APPEND_KEY, _("Append"),
|
||||
IFHELP(nano_append_msg, 0), 0, 0, NOVIEW, 0);
|
||||
|
||||
sc_init_one(&writefile_list, NANO_PREPEND_KEY, _("Prepend"),
|
||||
IFHELP(nano_prepend_msg, 0), 0, 0, NOVIEW, 0);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
sc_init_one(&writefile_list, TOGGLE_BACKUP_KEY, _("Backup File"),
|
||||
IFHELP(nano_backup_msg, 0), 0, 0, NOVIEW, 0);
|
||||
#endif
|
||||
|
||||
sc_init_one(&writefile_list, NANO_CANCEL_KEY, _("Cancel"),
|
||||
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
|
||||
|
||||
free_shortcutage(&insertfile_list);
|
||||
|
||||
sc_init_one(&insertfile_list, NANO_HELP_KEY, _("Get Help"),
|
||||
IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
|
||||
|
||||
sc_init_one(&insertfile_list, NANO_CANCEL_KEY, _("Cancel"),
|
||||
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
sc_init_one(&insertfile_list, NANO_TOFILES_KEY, _("To Files"),
|
||||
IFHELP(nano_tofiles_msg, 0), 0, 0, NOVIEW, 0);
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
sc_init_one(&insertfile_list, NANO_EXTCMD_KEY, _("Execute Command"),
|
||||
IFHELP(nano_execute_msg, 0), 0, 0, NOVIEW, 0);
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
sc_init_one(&insertfile_list, TOGGLE_LOAD_KEY, _("New Buffer"),
|
||||
IFHELP(nano_multibuffer_msg, 0), 0, 0, NOVIEW, 0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_SPELLER
|
||||
free_shortcutage(&spell_list);
|
||||
|
||||
sc_init_one(&spell_list, NANO_HELP_KEY, _("Get Help"),
|
||||
IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
|
||||
|
||||
sc_init_one(&spell_list, NANO_CANCEL_KEY, _("Cancel"),
|
||||
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
free_shortcutage(&extcmd_list);
|
||||
|
||||
sc_init_one(&extcmd_list, NANO_HELP_KEY, _("Get Help"),
|
||||
IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
|
||||
|
||||
sc_init_one(&extcmd_list, NANO_CANCEL_KEY, _("Cancel"),
|
||||
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
free_shortcutage(&browser_list);
|
||||
|
||||
sc_init_one(&browser_list, NANO_HELP_KEY, _("Get Help"),
|
||||
IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
|
||||
|
||||
sc_init_one(&browser_list, NANO_CANCEL_KEY, _("Cancel"),
|
||||
IFHELP(nano_cancel_msg, 0), NANO_EXIT_FKEY, 0, VIEW, 0);
|
||||
|
||||
sc_init_one(&browser_list, NANO_PREVPAGE_KEY, _("Prev Page"),
|
||||
IFHELP(nano_prevpage_msg, 0), NANO_PREVPAGE_FKEY,
|
||||
KEY_PPAGE, VIEW, 0);
|
||||
|
||||
sc_init_one(&browser_list, NANO_NEXTPAGE_KEY, _("Next Page"),
|
||||
IFHELP(nano_nextpage_msg, 0), NANO_NEXTPAGE_FKEY,
|
||||
KEY_NPAGE, VIEW, 0);
|
||||
|
||||
sc_init_one(&browser_list, NANO_GOTO_KEY, _("Go To Dir"),
|
||||
IFHELP(nano_gotodir_msg, NANO_ALT_GOTO_KEY),
|
||||
NANO_GOTO_FKEY, 0, VIEW, 0);
|
||||
|
||||
free_shortcutage(&gotodir_list);
|
||||
|
||||
sc_init_one(&gotodir_list, NANO_HELP_KEY, _("Get Help"),
|
||||
IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
|
||||
|
||||
sc_init_one(&gotodir_list, NANO_CANCEL_KEY, _("Cancel"),
|
||||
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
|
||||
#endif
|
||||
|
||||
#if !defined(DISABLE_BROWSER) || !defined(DISABLE_HELP) || (!defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION))
|
||||
currshortcut = main_list;
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
toggle_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
/* This function is called just before calling exit(). Practically, the
|
||||
* only effect is to cause a segmentation fault if the various data
|
||||
* structures got bolloxed earlier. Thus, we don't bother having this
|
||||
* function unless debugging is turned on. */
|
||||
#ifdef DEBUG
|
||||
/* added by SPK for memory cleanup, gracefully return our malloc()s */
|
||||
void thanks_for_all_the_fish(void)
|
||||
{
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
if (quotestr != NULL)
|
||||
free(quotestr);
|
||||
#endif
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
if (operating_dir != NULL)
|
||||
free(operating_dir);
|
||||
if (full_operating_dir != NULL)
|
||||
free(full_operating_dir);
|
||||
#endif
|
||||
if (last_search != NULL)
|
||||
free(last_search);
|
||||
if (last_replace != NULL)
|
||||
free(last_replace);
|
||||
if (hblank != NULL)
|
||||
free(hblank);
|
||||
#ifndef DISABLE_SPELLER
|
||||
if (alt_speller != NULL)
|
||||
free(alt_speller);
|
||||
#endif
|
||||
#ifndef DISABLE_HELP
|
||||
if (help_text != NULL)
|
||||
free(help_text);
|
||||
#endif
|
||||
if (filename != NULL)
|
||||
free(filename);
|
||||
if (answer != NULL)
|
||||
free(answer);
|
||||
if (cutbuffer != NULL)
|
||||
free_filestruct(cutbuffer);
|
||||
|
||||
free_shortcutage(&main_list);
|
||||
free_shortcutage(&whereis_list);
|
||||
free_shortcutage(&replace_list);
|
||||
free_shortcutage(&replace_list_2);
|
||||
free_shortcutage(&goto_list);
|
||||
free_shortcutage(&writefile_list);
|
||||
free_shortcutage(&insertfile_list);
|
||||
#ifndef DISABLE_HELP
|
||||
free_shortcutage(&help_list);
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
free_shortcutage(&spell_list);
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
free_shortcutage(&extcmd_list);
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
free_shortcutage(&browser_list);
|
||||
free_shortcutage(&gotodir_list);
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
free_toggles();
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (open_files != NULL) {
|
||||
/* We free the memory associated with each open file. */
|
||||
while (open_files->prev != NULL)
|
||||
open_files = open_files->prev;
|
||||
free_openfilestruct(open_files);
|
||||
}
|
||||
#else
|
||||
free_filestruct(fileage);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
free(syntaxstr);
|
||||
while (syntaxes != NULL) {
|
||||
syntaxtype *bill = syntaxes;
|
||||
|
||||
free(syntaxes->desc);
|
||||
while (syntaxes->extensions != NULL) {
|
||||
exttype *bob = syntaxes->extensions;
|
||||
|
||||
syntaxes->extensions = bob->next;
|
||||
regfree(&bob->val);
|
||||
free(bob);
|
||||
}
|
||||
while (syntaxes->color != NULL) {
|
||||
colortype *bob = syntaxes->color;
|
||||
|
||||
syntaxes->color = bob->next;
|
||||
regfree(&bob->start);
|
||||
if (bob->end != NULL)
|
||||
regfree(bob->end);
|
||||
free(bob->end);
|
||||
free(bob);
|
||||
}
|
||||
syntaxes = syntaxes->next;
|
||||
free(bill);
|
||||
}
|
||||
#endif /* ENABLE_COLOR */
|
||||
#ifndef NANO_SMALL
|
||||
/* free history lists */
|
||||
free_history(&search_history);
|
||||
free_history(&replace_history);
|
||||
#endif
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
230
move.c
230
move.c
@@ -1,230 +0,0 @@
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* move.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2003 Chris Allegretta *
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
int do_home(void)
|
||||
{
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
current_x = 0;
|
||||
placewewant = 0;
|
||||
update_line(current, current_x);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int do_end(void)
|
||||
{
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
current_x = strlen(current->data);
|
||||
placewewant = xplustabs();
|
||||
update_line(current, current_x);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void page_up(void)
|
||||
{
|
||||
if (edittop != fileage) {
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(SMOOTHSCROLL))
|
||||
edit_update(edittop->prev, TOP);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
edit_update(edittop, CENTER);
|
||||
/* Now that we've updated the edit window, edittop might be
|
||||
at the top of the file; if so, just move the cursor up one
|
||||
line and don't center it. */
|
||||
if (edittop != fileage)
|
||||
center_cursor();
|
||||
else
|
||||
reset_cursor();
|
||||
}
|
||||
} else
|
||||
current_y = 0;
|
||||
|
||||
update_cursor();
|
||||
}
|
||||
|
||||
int do_page_up(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
wrap_reset();
|
||||
current_x = 0;
|
||||
placewewant = 0;
|
||||
|
||||
if (current == fileage)
|
||||
return 0;
|
||||
|
||||
current_y = 0;
|
||||
current = edittop;
|
||||
for (i = 0; i <= editwinrows - 3 && current->prev != NULL; i++)
|
||||
current = current->prev;
|
||||
|
||||
edit_update(current, TOP);
|
||||
update_cursor();
|
||||
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
check_statblank();
|
||||
return 1;
|
||||
}
|
||||
|
||||
int do_page_down(void)
|
||||
{
|
||||
wrap_reset();
|
||||
current_x = 0;
|
||||
placewewant = 0;
|
||||
|
||||
if (current == filebot)
|
||||
return 0;
|
||||
|
||||
/* AHEM, if we only have a screen or less of text, DON'T do an
|
||||
edit_update(), just move the cursor to editbot! */
|
||||
if (edittop == fileage && editbot == filebot && totlines < editwinrows) {
|
||||
current = editbot;
|
||||
reset_cursor();
|
||||
#ifndef NANO_SMALL
|
||||
/* ...unless marking is on, in which case we need it to update
|
||||
the highlight. */
|
||||
if (ISSET(MARK_ISSET))
|
||||
edit_update(current, NONE);
|
||||
#endif
|
||||
} else if (editbot != filebot || edittop == fileage) {
|
||||
current_y = 0;
|
||||
current = editbot;
|
||||
|
||||
if (current->prev != NULL)
|
||||
current = current->prev;
|
||||
if (current->prev != NULL)
|
||||
current = current->prev;
|
||||
edit_update(current, TOP);
|
||||
} else {
|
||||
while (current != filebot) {
|
||||
current = current->next;
|
||||
current_y++;
|
||||
}
|
||||
edit_update(edittop, TOP);
|
||||
}
|
||||
|
||||
update_cursor();
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
check_statblank();
|
||||
return 1;
|
||||
}
|
||||
|
||||
int do_up(void)
|
||||
{
|
||||
wrap_reset();
|
||||
if (current->prev != NULL) {
|
||||
current_x = actual_x(current->prev, placewewant);
|
||||
current = current->prev;
|
||||
if (current_y > 0) {
|
||||
update_line(current->next, 0);
|
||||
/* It is necessary to change current first, so the mark
|
||||
display will change! */
|
||||
current_y--;
|
||||
update_line(current, current_x);
|
||||
} else
|
||||
page_up();
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
check_statblank();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Return value 1 means we moved down, 0 means we were already at the
|
||||
* bottom. */
|
||||
int do_down(void)
|
||||
{
|
||||
wrap_reset();
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
check_statblank();
|
||||
|
||||
if (current->next == NULL)
|
||||
return 0;
|
||||
|
||||
current = current->next;
|
||||
current_x = actual_x(current, placewewant);
|
||||
|
||||
/* Note current_y is zero-based. This test checks for the cursor's
|
||||
* being on the last row of the edit window. */
|
||||
if (current_y == editwinrows - 1) {
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(SMOOTHSCROLL)) {
|
||||
/* In this case current_y does not change. The cursor
|
||||
* remains at the bottom of the edit window. */
|
||||
edittop = edittop->next;
|
||||
editbot = editbot->next;
|
||||
edit_refresh();
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
/* Set edittop so editbot->next (or else editbot) is
|
||||
* centered, and set current_y = editwinrows / 2. */
|
||||
edit_update(editbot->next != NULL ? editbot->next : editbot, CENTER);
|
||||
center_cursor();
|
||||
}
|
||||
} else {
|
||||
update_line(current->prev, 0);
|
||||
update_line(current, current_x);
|
||||
current_y++;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int do_left(void)
|
||||
{
|
||||
if (current_x > 0)
|
||||
current_x--;
|
||||
else if (current != fileage) {
|
||||
do_up();
|
||||
current_x = strlen(current->data);
|
||||
}
|
||||
placewewant = xplustabs();
|
||||
update_line(current, current_x);
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
check_statblank();
|
||||
return 1;
|
||||
}
|
||||
|
||||
int do_right(void)
|
||||
{
|
||||
assert(current_x <= strlen(current->data));
|
||||
|
||||
if (current->data[current_x] != '\0')
|
||||
current_x++;
|
||||
else if (current->next != NULL) {
|
||||
do_down();
|
||||
current_x = 0;
|
||||
}
|
||||
placewewant = xplustabs();
|
||||
update_line(current, current_x);
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
check_statblank();
|
||||
return 1;
|
||||
}
|
||||
272
nano.1.html
272
nano.1.html
@@ -1,272 +0,0 @@
|
||||
<HTML><HEAD><TITLE>Manpage of NANO</TITLE>
|
||||
</HEAD><BODY>
|
||||
<H1>NANO</H1>
|
||||
Section: User Commands (1)<BR>Updated: February 9, 2003<BR><A HREF="#index">Index</A>
|
||||
<A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
||||
|
||||
|
||||
|
||||
<P>
|
||||
<A NAME="lbAB"> </A>
|
||||
<H2>NAME</H2>
|
||||
|
||||
nano - Nano's ANOther editor, an enhanced free Pico clone
|
||||
<P>
|
||||
<A NAME="lbAC"> </A>
|
||||
<H2>SYNOPSIS</H2>
|
||||
|
||||
<B>nano</B>
|
||||
|
||||
<I>[+LINE] [options] [file]</I>
|
||||
|
||||
<BR>
|
||||
|
||||
<P>
|
||||
<A NAME="lbAD"> </A>
|
||||
<H2>DESCRIPTION</H2>
|
||||
|
||||
This manual page documents briefly the <B>nano</B> command.
|
||||
<P>
|
||||
|
||||
|
||||
|
||||
|
||||
<B>nano</B> is a small, free and friendly editor which aims to replace
|
||||
Pico, the default editor included in the non-free Pine package. Rather
|
||||
than just copying Pico's look and feel, <B>nano</B> also implements some
|
||||
missing (or disabled by default) features in Pico, such as "search and
|
||||
replace" and "go to line number".
|
||||
<P>
|
||||
<A NAME="lbAE"> </A>
|
||||
<H2>OPTIONS</H2>
|
||||
|
||||
<DL COMPACT>
|
||||
<DT><B>+</B><I>LINE</I>
|
||||
|
||||
<DD>
|
||||
Places cursor at <I>LINE</I> on startup.
|
||||
<DT><B>-B (--backup)</B>
|
||||
|
||||
<DD>
|
||||
When saving a file, back up the previous version of it to the current
|
||||
filename suffixed with a ~.
|
||||
<DT><B>-D (--dos)</B>
|
||||
|
||||
<DD>
|
||||
Write file in DOS format.
|
||||
<DT><B>-F (--multibuffer)</B>
|
||||
|
||||
<DD>
|
||||
Enable multiple file buffers, if available.
|
||||
<DT><B>-H (--historylog)</B>
|
||||
|
||||
<DD>
|
||||
Log search and replace strings to ~/.nano_history so they may be
|
||||
stored for later editing, if nanorc support is configured.
|
||||
<DT><B>-I (--ignorercfiles)</B>
|
||||
|
||||
<DD>
|
||||
Don't look at $SYSCONFDIR/nanorc or ~/.nanorc, if nanorc support is
|
||||
available.
|
||||
<DT><B>-K (--keypad)</B>
|
||||
|
||||
<DD>
|
||||
Do not use the ncurses keypad() call unless necessary. Try this flag if
|
||||
you find that the arrow keys on the numeric keypad do not work for you
|
||||
under nano.
|
||||
<DT><B>-M (--mac)</B>
|
||||
|
||||
<DD>
|
||||
Write file in Mac format.
|
||||
<DT><B>-N (--noconvert)</B>
|
||||
|
||||
<DD>
|
||||
Disable automatic conversion of files from DOS/Mac format.
|
||||
<DT><B>-Q </B><I>str</I> (--quotestr=<I>str</I>)
|
||||
|
||||
<DD>
|
||||
Set the quoting string for justifying. The default is
|
||||
"^([ \t]*[|>:}#])+" if regular expression support is available, or
|
||||
"> " otherwise.
|
||||
<DT><B>-R (--regexp)</B>
|
||||
|
||||
<DD>
|
||||
Enable regular expression matching for search strings, as well as
|
||||
\n subexpression replacement for replace strings, if available.
|
||||
<DT><B>-S (--smooth)</B>
|
||||
|
||||
<DD>
|
||||
Enable smooth scrolling. Text will scroll line-by-line, instead of the
|
||||
usual chunk-by-chunk behavior.
|
||||
<DT><B>-T </B><I>num</I> (--tabsize=<I>num</I>)
|
||||
|
||||
<DD>
|
||||
Set the size (width) of a tab.
|
||||
<DT><B>-V (--version)</B>
|
||||
|
||||
<DD>
|
||||
Show the current version number and author.
|
||||
<DT><B>-Y </B><I>str</I> (--syntax=<I>str</I>)
|
||||
|
||||
<DD>
|
||||
Specify a specific syntax highlighting from the .nanorc to use, if
|
||||
available.
|
||||
<DT><B>-c (--const)</B>
|
||||
|
||||
<DD>
|
||||
Constantly show the cursor position.
|
||||
<DT><B>-h (--help)</B>
|
||||
|
||||
<DD>
|
||||
Display a summary of command line options.
|
||||
<DT><B>-i (--autoindent)</B>
|
||||
|
||||
<DD>
|
||||
Indent new lines to the previous line's indentation. Useful when editing
|
||||
source code.
|
||||
<DT><B>-k (--cut)</B>
|
||||
|
||||
<DD>
|
||||
Enable cut from cursor to end of line with ^K.
|
||||
<DT><B>-l (--nofollow)</B>
|
||||
|
||||
<DD>
|
||||
If the file being edited is a symbolic link, replace the link with
|
||||
a new file, do not follow it. Good for editing files in /tmp, perhaps?
|
||||
<DT><B>-m (--mouse)</B>
|
||||
|
||||
<DD>
|
||||
Enable mouse support (if available for your system).
|
||||
<DT><B>-o </B><I>dir</I> (--operatingdir=<I>dir</I>)
|
||||
|
||||
<DD>
|
||||
Set operating directory. Makes nano set up something similar to a
|
||||
chroot.
|
||||
<DT><B>-p (--preserve)</B>
|
||||
|
||||
<DD>
|
||||
Preserve the XON and XOFF sequences (^Q and ^S) so they will be
|
||||
caught by the terminal.
|
||||
<DT><B>-r </B><I>cols</I> (--fill=<I>cols</I>)
|
||||
|
||||
<DD>
|
||||
Wrap lines at column <I>cols</I>. By default, this is the width of the
|
||||
screen, less eight. If this value is negative, wrapping will occur at
|
||||
<I>cols</I> columns from the right of the screen, allowing the wrap point
|
||||
to vary along with the screen width if resized.
|
||||
<DT><B>-s </B><I>prog</I> (--speller=<I>prog</I>)
|
||||
|
||||
<DD>
|
||||
Enable alternative spell checker command.
|
||||
<DT><B>-t (--tempfile)</B>
|
||||
|
||||
<DD>
|
||||
Always save changed buffer without prompting. Same as Pico -t option.
|
||||
<DT><B>-v (--view)</B>
|
||||
|
||||
<DD>
|
||||
View file (read only) mode.
|
||||
<DT><B>-w (--nowrap)</B>
|
||||
|
||||
<DD>
|
||||
Disable wrapping of long lines.
|
||||
<DT><B>-x (--nohelp)</B>
|
||||
|
||||
<DD>
|
||||
Disable help screen at bottom of editor.
|
||||
<DT><B>-z (--suspend)</B>
|
||||
|
||||
<DD>
|
||||
Enable suspend ability.
|
||||
<DT><B>-a, -b, -e, -f, -g, -j</B>
|
||||
|
||||
<DD>
|
||||
Ignored, for compatibility with Pico.
|
||||
<P>
|
||||
</DL>
|
||||
<A NAME="lbAF"> </A>
|
||||
<H2>INITIALIZATION FILE</H2>
|
||||
|
||||
<B>nano</B> will read initialization files in the following
|
||||
order: $SYSCONFDIR/nanorc, then ~/.nanorc. Please see <A HREF="http://localhost/cgi-bin/man/man2html?5+nanorc">nanorc</A>(5) and
|
||||
the example file <B>nanorc.sample</B> which should be provided with
|
||||
<B>nano</B>.
|
||||
<P>
|
||||
<A NAME="lbAG"> </A>
|
||||
<H2>NOTES</H2>
|
||||
|
||||
<B>nano</B> will try to dump the buffer into an emergency file in some
|
||||
cases. Mainly, this will happen if <B>nano</B> receives a SIGHUP or
|
||||
SIGTERM or runs out of memory, when it will write the buffer into a file
|
||||
named "nano.save" if the buffer didn't have a name already, or will add
|
||||
a ".save" suffix to the current filename. If an emergency file with that
|
||||
name already exists in the current directory, ".save" and a number (e.g.
|
||||
".save.1") will be suffixed to the current filename in order to make it
|
||||
unique. In multibuffer mode, <B>nano</B> will write all the open buffers
|
||||
to the respective emergency files.
|
||||
<P>
|
||||
<A NAME="lbAH"> </A>
|
||||
<H2>BUGS</H2>
|
||||
|
||||
Please send any comments or bug reports to
|
||||
<BR>
|
||||
|
||||
<B><A HREF="mailto:nano@nano-editor.org">nano@nano-editor.org</A>.</B>
|
||||
|
||||
<BR>
|
||||
|
||||
The <B>nano</B> mailing list is available from
|
||||
<BR>
|
||||
|
||||
<B><A HREF="mailto:nano-devel@gnu.org">nano-devel@gnu.org</A>.</B>
|
||||
|
||||
To subscribe, email to <A HREF="mailto:nano-devel-request@gnu.org">nano-devel-request@gnu.org</A> with a
|
||||
subject of "subscribe".
|
||||
<P>
|
||||
<A NAME="lbAI"> </A>
|
||||
<H2>HOMEPAGE</H2>
|
||||
|
||||
<A HREF="http://www.nano-editor.org/">http://www.nano-editor.org/</A>
|
||||
<P>
|
||||
<A NAME="lbAJ"> </A>
|
||||
<H2>SEE ALSO</H2>
|
||||
|
||||
|
||||
<DL COMPACT>
|
||||
<DT><B><A HREF="http://localhost/cgi-bin/man/man2html?5+nanorc">nanorc</A></B>(5)<DD>
|
||||
</DL>
|
||||
<P>
|
||||
|
||||
<I>/usr/share/doc/nano/</I> (or equivalent on your system)
|
||||
<P>
|
||||
<A NAME="lbAK"> </A>
|
||||
<H2>AUTHOR</H2>
|
||||
|
||||
Chris Allegretta <<A HREF="mailto:chrisa@asty.org">chrisa@asty.org</A>>, et al (see AUTHORS and THANKS for
|
||||
details).
|
||||
This manual page was originally written by Jordi Mallach
|
||||
<<A HREF="mailto:jordi@sindominio.net">jordi@sindominio.net</A>>, for the Debian GNU system (but may be
|
||||
used by others).
|
||||
<P>
|
||||
|
||||
<HR>
|
||||
<A NAME="index"> </A><H2>Index</H2>
|
||||
<DL>
|
||||
<DT><A HREF="#lbAB">NAME</A><DD>
|
||||
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
|
||||
<DT><A HREF="#lbAD">DESCRIPTION</A><DD>
|
||||
<DT><A HREF="#lbAE">OPTIONS</A><DD>
|
||||
<DT><A HREF="#lbAF">INITIALIZATION FILE</A><DD>
|
||||
<DT><A HREF="#lbAG">NOTES</A><DD>
|
||||
<DT><A HREF="#lbAH">BUGS</A><DD>
|
||||
<DT><A HREF="#lbAI">HOMEPAGE</A><DD>
|
||||
<DT><A HREF="#lbAJ">SEE ALSO</A><DD>
|
||||
<DT><A HREF="#lbAK">AUTHOR</A><DD>
|
||||
</DL>
|
||||
<HR>
|
||||
This document was created by
|
||||
<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
|
||||
using the manual pages.<BR>
|
||||
Time: 04:08:28 GMT, February 13, 2003
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -9,7 +9,7 @@ Release : %{rel}
|
||||
Copyright : GPL
|
||||
Group : Console/Editors
|
||||
URL : http://www.nano-editor.org
|
||||
Source : http://www.nano-editor.org/dist/v1.2/%{name}-%{ver}.tar.gz
|
||||
Source : http://www.nano-editor.org/dist/v1.3/%{name}-%{ver}.tar.gz
|
||||
BuildRoot : /var/tmp/%{name}-buildroot
|
||||
Requires : ncurses
|
||||
|
||||
@@ -30,8 +30,8 @@ make DESTDIR="$RPM_BUILD_ROOT" install
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%doc AUTHORS BUGS COPYING ChangeLog INSTALL NEWS README THANKS TODO nanorc.sample
|
||||
%{_bindir}/nano
|
||||
%doc AUTHORS BUGS COPYING ChangeLog INSTALL NEWS README THANKS TODO doc/faq.html doc/nanorc.sample
|
||||
%{_bindir}/*
|
||||
%{_mandir}/*/*
|
||||
%{_datadir}/locale/*/LC_MESSAGES/nano.mo
|
||||
%{_infodir}/nano.info*
|
||||
|
||||
160
nanorc.5.html
160
nanorc.5.html
@@ -1,160 +0,0 @@
|
||||
<HTML><HEAD><TITLE>Manpage of NANORC</TITLE>
|
||||
</HEAD><BODY>
|
||||
<H1>NANORC</H1>
|
||||
Section: File Formats (5)<BR>Updated: February 9, 2003<BR><A HREF="#index">Index</A>
|
||||
<A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
||||
|
||||
|
||||
|
||||
<A NAME="lbAB"> </A>
|
||||
<H2>NAME</H2>
|
||||
|
||||
nanorc - GNU nano's rcfile
|
||||
<A NAME="lbAC"> </A>
|
||||
<H2>SYNOPSIS</H2>
|
||||
|
||||
<B>/etc/nanorc</B>
|
||||
|
||||
<B>$HOME/.nanorc</B>
|
||||
|
||||
<BR>
|
||||
|
||||
<A NAME="lbAD"> </A>
|
||||
<H2>DESCRIPTION</H2>
|
||||
|
||||
This manual page documents GNU <B>nano</B>'s rcfile.
|
||||
<P>
|
||||
|
||||
<B>nano</B> is a small, free and friendly editor which aims to replace
|
||||
Pico, the default editor included in the non-free Pine package. Rather
|
||||
than just copying Pico's look and feel, <B>nano</B> also implements some
|
||||
missing (or disabled by default) features in Pico, such as "search and
|
||||
replace" and "go to line number".
|
||||
<P>
|
||||
<A NAME="lbAE"> </A>
|
||||
<H2>OPTIONS</H2>
|
||||
|
||||
The configuration file accepts a series of "set" and "unset" commands,
|
||||
which can be used to configure nano on startup without using the
|
||||
command-line options. Additionally, the "syntax" and "color" keywords
|
||||
are used to define syntax highlighting rules for different text patterns.
|
||||
GNU nano will read one command per line.
|
||||
<P>
|
||||
Options in rcfiles take precedence over nano's defaults, and command line
|
||||
options override rcfile settings.
|
||||
<P>
|
||||
The supported commands and arguments are:
|
||||
<P>
|
||||
<DL COMPACT>
|
||||
<DT><B>set/unset autoindent</B><DD>
|
||||
Use auto-indentation.
|
||||
<DT><B>set/unset backup</B><DD>
|
||||
Create backup files in filename~.
|
||||
<DT><B>set/unset const</B><DD>
|
||||
Constantly update the cursor position.
|
||||
<DT><B>set/unset cut</B><DD>
|
||||
Use cut to end of line with ^K by default.
|
||||
<DT><B>set fill </B><I>n</I><DD>
|
||||
Set the column where lines will be wrapped at to <I>n</I>.
|
||||
<DT><B>set/unset keypad</B><DD>
|
||||
Use alternate keypad routines.
|
||||
<DT><B>set/unset multibuffer</B><DD>
|
||||
Allow inserting files into their own buffers.
|
||||
<DT><B>set/unset noconvert</B><DD>
|
||||
Don't convert files from DOS/Mac format.
|
||||
<DT><B>set/unset nofollow</B><DD>
|
||||
Don't follow symlinks when writing files.
|
||||
<DT><B>set/unset nohelp</B><DD>
|
||||
Don't display the help lists at the bottom of the screen.
|
||||
<DT><B>set/unset nowrap</B><DD>
|
||||
Don't wrap text at all.
|
||||
<DT><B>set operatingdir "</B><I>directory</I>"<DD>
|
||||
Set operating directory (chroots the user to <I>directory</I> and below).
|
||||
<DT><B>set/unset preserve</B><DD>
|
||||
Preserve the XON and XOFF keys (^Q and ^S).
|
||||
<DT><B>set quotestr "</B><I>string</I>"<DD>
|
||||
The email-quote string. This is a "regular expression" if your
|
||||
system supports them, otherwise a literal string.
|
||||
Default value is set quotestr "^([ ]*[|>:}#])+" if you have regexps,
|
||||
otherwise set quotestr "> ".
|
||||
<DT><B>set/unset regexp</B><DD>
|
||||
Do regular expression searches by default.
|
||||
<DT><B>set/unset smooth</B><DD>
|
||||
Use smooth scrolling by default.
|
||||
<DT><B>set speller </B><I>spellprog</I><DD>
|
||||
Use spelling checker <I>spellprog</I> instead of the default (spell).
|
||||
<DT><B>set/unset suspend</B><DD>
|
||||
Allow nano to be suspended with ^Z.
|
||||
<DT><B>set tabsize </B><I>n</I><DD>
|
||||
Use a tab size of <I>n</I> instead of the default (8); must be greater
|
||||
than 0.
|
||||
<DT><B>set/unset tempfile</B><DD>
|
||||
Save automatically on exit, don't prompt.
|
||||
<DT><B>set/unset historylog</B><DD>
|
||||
Enable ~/.nano_history for saving and reading search/replace strings.
|
||||
<DT><B>set/unset view</B><DD>
|
||||
Disallow file modification.
|
||||
<DT><B>syntax </B><I>str</I> [<I>fileregex</I> ... ]
|
||||
|
||||
<DD>
|
||||
Defines a syntax named <I>str</I> which can be activated via the
|
||||
<B>-Y</B> flag, or will be automatically activated if the current
|
||||
filename matches <I>fileregex</I>. All following <B>color</B> statements
|
||||
will apply to <I>syntax</I> until a new syntax is defined.
|
||||
<DT><B>color </B><I>fgcolor</I>[,<I>bgcolor</I>] <I>regex</I> ...
|
||||
|
||||
<DD>
|
||||
For the currently defined syntax, display all expressions matching
|
||||
<I>regex</I> with foreground color <I>fgcolor</I> and optional background
|
||||
color <I>bgcolor</I>. Legal colors for foreground and background color are:
|
||||
white, black, red, blue, green, yellow, magenta, and cyan. You may use
|
||||
the prefix "bright" to force a stronger color highlight. If your
|
||||
terminal supports transparency, not specifying a <I>bgcolor</I> tells
|
||||
<B>nano</B> to attempt to use a transparent background.
|
||||
<DT><B>color </B><I>fgcolor</I>[,<I>bgcolor</I>] start=<I>sr</I> end=<I>er</I>
|
||||
|
||||
<DD>
|
||||
Display expressions which start with <I>sr</I> and end with <I>er</I>
|
||||
with foreground color <I>fgcolor</I> and optional
|
||||
background color <I>bgcolor</I>. This allows syntax highlighting to span
|
||||
multiple lines. Note that all subsequent instances of <I>sr</I> after
|
||||
an initial <I>sr</I> is found will be highlighted until the first
|
||||
instance of <I>er</I>.
|
||||
<I>
|
||||
<P>
|
||||
</DL>
|
||||
</I><A NAME="lbAF"> </A>
|
||||
<H2>SEE ALSO</H2>
|
||||
|
||||
|
||||
<DL COMPACT>
|
||||
<DT><B><A HREF="http://localhost/cgi-bin/man/man2html?1+nano">nano</A></B>(1)<DD>
|
||||
</DL>
|
||||
<P>
|
||||
|
||||
<I>/usr/share/doc/nano/examples/nanorc.sample</I> (or equivalent on your system)
|
||||
<A NAME="lbAG"> </A>
|
||||
<H2>AUTHOR</H2>
|
||||
|
||||
Chris Allegretta <<A HREF="mailto:chrisa@asty.org">chrisa@asty.org</A>>, et al (see AUTHORS and THANKS for
|
||||
details).
|
||||
This manual page was written by Jordi Mallach <<A HREF="mailto:jordi@gnu.org">jordi@gnu.org</A>>.
|
||||
<P>
|
||||
|
||||
<HR>
|
||||
<A NAME="index"> </A><H2>Index</H2>
|
||||
<DL>
|
||||
<DT><A HREF="#lbAB">NAME</A><DD>
|
||||
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
|
||||
<DT><A HREF="#lbAD">DESCRIPTION</A><DD>
|
||||
<DT><A HREF="#lbAE">OPTIONS</A><DD>
|
||||
<DT><A HREF="#lbAF">SEE ALSO</A><DD>
|
||||
<DT><A HREF="#lbAG">AUTHOR</A><DD>
|
||||
</DL>
|
||||
<HR>
|
||||
This document was created by
|
||||
<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
|
||||
using the manual pages.<BR>
|
||||
Time: 04:08:33 GMT, February 13, 2003
|
||||
</BODY>
|
||||
</HTML>
|
||||
177
nanorc.sample
177
nanorc.sample
@@ -1,177 +0,0 @@
|
||||
## Sample initialization file for GNU nano
|
||||
## Please note that you must have configured nano with
|
||||
## --enable-nanorc for this file to be read!
|
||||
##
|
||||
## To make sure a value is not enabled, use "unset <option>"
|
||||
|
||||
## Use auto-indentation
|
||||
# set autoindent
|
||||
|
||||
## Backup files to filename~
|
||||
# set backup
|
||||
|
||||
## Constantly update the cursor position
|
||||
# set const
|
||||
|
||||
## Use cut to end of line with ^K by default
|
||||
# set cut
|
||||
|
||||
## Use this value instead of the default
|
||||
## An out-of-range negative value can make nano die complaining that the
|
||||
## screen is too small
|
||||
## set fill -8
|
||||
|
||||
## Use alternate keypad routines
|
||||
# set keypad
|
||||
|
||||
## Allow multiple file buffers (using ^R inserts into separate buffer)
|
||||
## You must have configured with --enable-multibuffer or --enable-extra
|
||||
## for this to work
|
||||
##
|
||||
## set multibuffer
|
||||
|
||||
## Don't convert files from DOS/Mac format
|
||||
# set noconvert
|
||||
|
||||
## Don't follow symlinks when writing files
|
||||
# set nofollow
|
||||
|
||||
## Don't display the help lists at the bottom of the screen
|
||||
# set nohelp
|
||||
|
||||
## Don't wrap text at all
|
||||
# set nowrap
|
||||
|
||||
## Set operating directory (chroot of sorts)
|
||||
# set operatingdir "~"
|
||||
|
||||
## Preserve the XON and XOFF keys (^Q and ^S)
|
||||
# set preserve
|
||||
|
||||
## The email-quote string. This is a "regular expression" if your
|
||||
## system supports them, otherwise a literal string. Default
|
||||
# set quotestr "^([ \t]*[|>:}#])+" if you have regexps, otherwise
|
||||
# set quotestr "> ".
|
||||
## You can get old nano quoted-justify behavior via:
|
||||
# set quotestr "(> )+"
|
||||
|
||||
## Do regular expression searches by default
|
||||
# set regexp
|
||||
|
||||
## Use smooth scrolling as the default
|
||||
# set smooth
|
||||
|
||||
## Use this spelling checker instead of the default one
|
||||
# set speller aspell
|
||||
|
||||
## Allow nano to be suspended with ^Z
|
||||
# set suspend
|
||||
|
||||
## Use this tab size instead of the default; it must be greater than 0
|
||||
# set tabsize 4
|
||||
|
||||
## Save automatically on exit, don't prompt
|
||||
# set tempfile
|
||||
|
||||
## Enable ~/.nano_history for saving and reading search/replace strings.
|
||||
# set historylog
|
||||
|
||||
## Disallow file modification, why would you want this in an rc file? ;)
|
||||
# set view
|
||||
|
||||
## Color setup
|
||||
## Format:
|
||||
## syntax "short description" ["filename regex" ...]
|
||||
## color foreground,background "regex" ["regex"...]
|
||||
##
|
||||
## Legal colors are: white, black, red, blue, green, yellow, magenta,
|
||||
## cyan. You may use the prefix "bright" to mean a stronger color
|
||||
## highlight.
|
||||
##
|
||||
## To use multi-line regexes use the start="regex" end="regex" format.
|
||||
##
|
||||
## If your system supports transparency, not specifying a background
|
||||
## color will use a transparent color. If you don't want this, be sure
|
||||
## to set the background color to black or white.
|
||||
|
||||
# syntax "c-file" ".*\.c$" ".*\.h$"
|
||||
# color red "\<[A-Z_]{2,}\>"
|
||||
# color green "\<float\>" "\<char\>" "\<int\>" "\<void\>"
|
||||
# color green "\<static\>" "\<const\>" "\<struct\>"
|
||||
# color brightyellow "\<if\>" "\<while\>" "\<do\>" "\<else\>" "\<case\>" "\<switch\>"
|
||||
# color brightcyan "#define" "#include" "#ifn*def" "#endif"
|
||||
# color brightcyan "#elif" "#else" "#if"
|
||||
|
||||
## You will in general want your comments and strings to come last,
|
||||
## because syntax highlighting rules will be applied in the order they
|
||||
## are read in. Note that quotes in regexes should not be escaped (use "
|
||||
## instead of \").
|
||||
|
||||
# color brightyellow "<[^= ]*>" ""(\\.|[^\"])*""
|
||||
|
||||
## This string is VERY resource intensive!!!
|
||||
# color brightyellow start=""(\\.|[^\"])*\\( | )*$" end="^(\\.|[^\"])*""
|
||||
|
||||
## And we want to have some nice comment highlighting too
|
||||
# color brightblue "//.*"
|
||||
# color brightblue start="/\*" end="\*/"
|
||||
|
||||
|
||||
## Here are some short examples for TeX files and HTML
|
||||
# syntax "HTML" "\.html$"
|
||||
#
|
||||
# color blue start="<" end=">"
|
||||
# color red "&([^; ])*;"
|
||||
#
|
||||
# syntax "TeX" "\.tex$"
|
||||
#
|
||||
# color green "\\(.|([A-Za-z]*))"
|
||||
# color magenta "\{" "\}"
|
||||
# color blue "%.*"
|
||||
|
||||
|
||||
## For this you will probably want to set your editor to "nano -Y mutt"
|
||||
# syntax "mutt"
|
||||
# color green "^>.*"
|
||||
|
||||
|
||||
## Here is are examples for groff and for your .nanorc
|
||||
|
||||
#syntax "groff" "\.ms$" "\.mm$" "\.me$" "\.tmac$" "^tmac." ".rof"
|
||||
## The argument of .nr or .ds
|
||||
#color cyan "^\.ds [^ ]*"
|
||||
#color cyan "^\.nr [^ ]*"
|
||||
## Single character escapes
|
||||
#color brightmagenta "\\."
|
||||
## Highlight the argument of \f or \s in the same colour
|
||||
#color brightmagenta "\\f."
|
||||
#color brightmagenta "\\f\(.."
|
||||
#color brightmagenta "\\s(\+|\-)?[0-9]"
|
||||
## \n
|
||||
#color cyan "(\\|\\\\)n."
|
||||
#color cyan "(\\|\\\\)n\(.."
|
||||
#color cyan start="(\\|\\\\)n\[" end="]"
|
||||
## Requests
|
||||
#color brightgreen "^\. *[^ ]*"
|
||||
## Comments
|
||||
#color yellow "^\.\\\".*$"
|
||||
## Strings
|
||||
#color green "(\\|\\\\)\*."
|
||||
#color green "(\\|\\\\)\*\(.."
|
||||
#color green start="(\\|\\\\)\*\[" end="]"
|
||||
## Characters
|
||||
#color brightred "\\\(.."
|
||||
#color brightred start="\\\[" end="]"
|
||||
## Macro arguments
|
||||
#color brightcyan "\\\\\$[1-9]"
|
||||
|
||||
|
||||
#syntax "nanorc" "[\.]*nanorc$"
|
||||
#color white "^ *(set|unset).*$"
|
||||
#color cyan "^ *(set|unset) (autoindent|backup|const|cut|fill|keypad|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|quotestr|regexp|smooth|speller|suspend|tabsize|tempfile|historylog|view)"
|
||||
#color brightwhite "^ *syntax [^ ]*"
|
||||
#color brightblue "^ *set\>" "^ *unset\>" "^ *syntax\>"
|
||||
#color white "^ *color\>.*"
|
||||
#color yellow "^ *color (bright)?(white|black|red|blue|green|yellow|magenta|cyan)\>"
|
||||
#color magenta "^ *color\>"
|
||||
#color green "^#.*$"
|
||||
165
po/ChangeLog
165
po/ChangeLog
@@ -1,7 +1,100 @@
|
||||
2004-06-01 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* zh_TW.po: Added Traditional Chinese translation by
|
||||
CHAO Wei-Lun <chaoweilun@pcmail.com.tw>.
|
||||
* LINGUAS: Added "zh_TW".
|
||||
|
||||
2004-02-24 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ms.po: Updated Malay translation by Sharuzzaman Ahmat Raslan.
|
||||
|
||||
2003-11-25 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ro.po: Updated Romanian translation by Laurentiu Buzdugan.
|
||||
|
||||
2003-11-06 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* sr.po: Added Serbian translation by Danilo Segan <dsegan@gmx.net>.
|
||||
* LINGUAS: Added "sr" (Serbian), and alphabetize.
|
||||
* ChangeLog: Recoded as UTF-8.
|
||||
|
||||
2003-10-30 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* fi.po: Patch from Martin-Eric Racine <q-funk@pp.fishpool.fi>
|
||||
to accept "Yy" and "Nn" as well as the Finnish letters in Yes/No
|
||||
prompts.
|
||||
|
||||
2003-10-18 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ca.po: Updated Catalan translation.
|
||||
|
||||
2003-09-12 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* POTFILES.in: Updated path to sources.
|
||||
|
||||
2003-09-01 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* fr.po: Updated French translation by Jean-Philippe Guérard.
|
||||
|
||||
2003-08-17 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* tr.po: Updated Turkish translation by A. Murat EREN.
|
||||
|
||||
2003-08-05 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ca.po: Updated Catalan translation.
|
||||
|
||||
2003-06-11 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* nb.po: Updated Norwegian bokmål translation by Geir Helland.
|
||||
|
||||
2003-06-10 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* fr.po: Updated French translation by Jean-Philippe Guérard.
|
||||
|
||||
2003-06-02 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* de.po: Updated German translation by Michael Piefel.
|
||||
|
||||
2003-05-06 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ms.po: Updated Malay translation by Sharuzzaman Ahmat Raslan.
|
||||
|
||||
2003-04-24 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ro.po: New Romanian translation by Laurentiu Buzdugan.
|
||||
* id.po: Updated Indonesian translation by Tedi Heriyanto.
|
||||
* LINGUAS: Added "ro" (Romanian).
|
||||
|
||||
2003-04-12 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ms.po: Updated Malay translation by Sharuzzaman Ahmat Raslan.
|
||||
|
||||
2003-04-04 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* fr.po: Updated French translation by Jean-Philippe Guérard.
|
||||
|
||||
2003-03-17 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ms.po: Updated Malay translation by Sharuzzaman Ahmat Raslan.
|
||||
|
||||
2003-03-10 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* da.po: Updated Danish translation by Keld Simonsen.
|
||||
|
||||
2003-03-06 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ms.po: Updated Malay translation by Sharuzzaman Ahmat Raslan.
|
||||
* id.po: Updated Indonesian translation by Tedi Heriyanto.
|
||||
|
||||
2003-02-23 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* nl.po: Updated Dutch translation by Guus Sliepen.
|
||||
|
||||
2003-02-19 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* fi.po: Updated Finnish translation by Kalle Olavi Niemitalo.
|
||||
* es.po: Updated Spanish translation by Ricardo Javier Cárdenes
|
||||
* es.po: Updated Spanish translation by Ricardo Javier Cárdenes
|
||||
Medina.
|
||||
|
||||
2003-02-17 Jordi Mallach <jordi@gnu.org>
|
||||
@@ -12,12 +105,12 @@
|
||||
|
||||
2003-02-16 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* gl.po: Updated Galician translation by Jacobo Tarrío.
|
||||
* fr.po: Updated French translation by Jean-Philippe Guérard.
|
||||
* gl.po: Updated Galician translation by Jacobo Tarrío.
|
||||
* fr.po: Updated French translation by Jean-Philippe Guérard.
|
||||
|
||||
2003-02-15 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* fr.po: Updated French translation by Jean-Philippe Guérard.
|
||||
* fr.po: Updated French translation by Jean-Philippe Guérard.
|
||||
* nl.po: Updated Dutch translation by Guus Sliepen.
|
||||
* sv.po: Updated Swedish translation by Christian Rose.
|
||||
* ca.po: Updated Catalan translation.
|
||||
@@ -44,8 +137,8 @@
|
||||
2003-02-08 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* it.po: Updated Italian translation by Marco Colombo.
|
||||
* gl.po: Updated Galician translation by Jacobo Tarrío.
|
||||
* es.po: Updated Spanish translation by Ricardo Javier Cárdenes
|
||||
* gl.po: Updated Galician translation by Jacobo Tarrío.
|
||||
* es.po: Updated Spanish translation by Ricardo Javier Cárdenes
|
||||
Medina.
|
||||
|
||||
2003-02-06 Jordi Mallach <jordi@gnu.org>
|
||||
@@ -56,13 +149,13 @@
|
||||
2003-02-04 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ca.po: Updated Catalan translation.
|
||||
* fr.po: Updated French translation by Jean-Philippe Guérard.
|
||||
* fr.po: Updated French translation by Jean-Philippe Guérard.
|
||||
* uk.po: Updated Ukrainian translation by Sergey A. Ribalchenko.
|
||||
* de.po: Updated German translation by Michael Piefel.
|
||||
|
||||
2003-01-27 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* es.po: Updated translation by Ricardo Javier Cárdenes Medina.
|
||||
* es.po: Updated translation by Ricardo Javier Cárdenes Medina.
|
||||
|
||||
2002-01-26 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
@@ -70,7 +163,7 @@
|
||||
|
||||
2002-01-25 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* gl.po: Updated translation by Jacobo Tarrío.
|
||||
* gl.po: Updated translation by Jacobo Tarrío.
|
||||
|
||||
2002-01-22 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
@@ -78,13 +171,13 @@
|
||||
|
||||
2003-01-21 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
* ms.po: Updated translation by Sharuzzaman Ahmat Raslan.
|
||||
* uk.po: Updated translation by Sergey A. Ribalchenko.
|
||||
|
||||
2003-01-18 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
* sv.po: Updated translation by Christian Rose.
|
||||
* nl.po: Updated translation by Guus Sliepen.
|
||||
* ca.po: Updated translation.
|
||||
@@ -108,7 +201,7 @@
|
||||
|
||||
2002-12-14 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
* tr.po: New Turkish translation by Doruk Fisek.
|
||||
|
||||
2002-11-10 Jordi Mallach <jordi@sindominio.net>
|
||||
@@ -128,22 +221,22 @@
|
||||
2002-10-29 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
* id.po: Updated translation by Tedi Heriyanto.
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
|
||||
2002-10-27 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
|
||||
2002-10-26 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
* es.po: Updated translation by Ricardo Javier Cárdenes Medina.
|
||||
* es.po: Updated translation by Ricardo Javier Cárdenes Medina.
|
||||
|
||||
2002-10-26 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
* gl.po: Updated translation by Jacobo Tarrío.
|
||||
* gl.po: Updated translation by Jacobo Tarrío.
|
||||
* sv.po: Updated translation by Christian Rose.
|
||||
* de.po: Updated translation by Michael Piefel.
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
* ca.po: Updated translation.
|
||||
|
||||
2002-10-17 Jordi Mallach <jordi@sindominio.net>
|
||||
@@ -152,11 +245,11 @@
|
||||
|
||||
2002-10-14 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
|
||||
2002-10-13 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
* es.po: Updated translation by Ricardo Javier Cárdenes Medina.
|
||||
* es.po: Updated translation by Ricardo Javier Cárdenes Medina.
|
||||
|
||||
2002-10-08 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
@@ -174,7 +267,7 @@
|
||||
2002-10-07 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
* sv.po: Updated translation by Christian Rose.
|
||||
* gl.po: Updated translation by Jacobo Tarrío.
|
||||
* gl.po: Updated translation by Jacobo Tarrío.
|
||||
* pl.po: Updated translation by Wojciech Kotwica.
|
||||
|
||||
2002-09-08 Jordi Mallach <jordi@sindominio.net>
|
||||
@@ -183,7 +276,7 @@
|
||||
|
||||
2002-09-08 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
* da.po: Updated translation by Keld Simonsen.
|
||||
|
||||
2002-08-19 Jordi Mallach <jordi@sindominio.net>
|
||||
@@ -193,15 +286,15 @@
|
||||
|
||||
2002-07-31 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
* gl.po: Updated translation by Jacobo Tarrío.
|
||||
* gl.po: Updated translation by Jacobo Tarrío.
|
||||
|
||||
2002-07-31 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
* es.po: Updated translation by Ricardo Javier Cárdenes Medina.
|
||||
* es.po: Updated translation by Ricardo Javier Cárdenes Medina.
|
||||
|
||||
2002-07-31 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
|
||||
2002-07-30 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
@@ -251,13 +344,13 @@
|
||||
|
||||
2002-05-13 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
* de.po: Updated translation by Michael Piefel.
|
||||
|
||||
2002-05-13 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
* it.po: Updated translation by Marco Colombo.
|
||||
* gl.po: Updated translation by Jacobo Tarrío.
|
||||
* gl.po: Updated translation by Jacobo Tarrío.
|
||||
* ca.po: Updated translation.
|
||||
* es.po: Updated translation.
|
||||
|
||||
@@ -294,7 +387,7 @@
|
||||
|
||||
* gl.po: Updated translation by Jacobo Tarrio.
|
||||
* de.po: Updated translation by Michael Piefel.
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
* ca.po: Updated.
|
||||
* es.po: Updated.
|
||||
|
||||
@@ -312,7 +405,7 @@
|
||||
|
||||
2002-03-17 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
|
||||
2002-03-15 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
@@ -335,7 +428,7 @@
|
||||
|
||||
2002-03-11 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
|
||||
2002-03-09 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
@@ -383,7 +476,7 @@
|
||||
|
||||
2002-02-06 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
* cs.po: Incomplete update by Václav Haisman.
|
||||
* cs.po: Incomplete update by Václav Haisman.
|
||||
|
||||
2002-01-27 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
@@ -391,14 +484,14 @@
|
||||
|
||||
2002-01-26 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
* nn.po: Updated translation by Kjetil Torgrim Homme.
|
||||
* de.po: Updated translation by Michael Piefel.
|
||||
|
||||
2002-01-25 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
* sv.po: Updated translation by Christian Rose.
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
|
||||
2002-01-25 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
@@ -429,21 +522,21 @@
|
||||
|
||||
* no.po: Removed, replaced by nn.po.
|
||||
* nn.po: Updated translation by Kjetil Torgrim Homme.
|
||||
* nb.po: New Norwegian bokmål translation by Stig E Sandoe.
|
||||
* nb.po: New Norwegian bokmål translation by Stig E Sandoe.
|
||||
|
||||
2002-01-12 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
|
||||
2002-01-10 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
|
||||
2002-01-08 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
* ru.po, uk.po: Updated translations by Sergey A.
|
||||
Ribalchenko.
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
* fr.po: Updated translation by Jean-Philippe Guérard.
|
||||
|
||||
2002-01-07 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
# List of available languages.
|
||||
es de fr it id fi hu ca cs gl uk ru sv nn nl da pl nb ms pt_BR tr eu
|
||||
ca cs da de es eu fi fr gl hu id it ms nb nl nn pl pt_BR ro ru sr sv tr uk zh_TW
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
# List of source files containing translatable strings.
|
||||
|
||||
# Package source files
|
||||
cut.c
|
||||
files.c
|
||||
global.c
|
||||
move.c
|
||||
nano.c
|
||||
rcfile.c
|
||||
search.c
|
||||
utils.c
|
||||
winio.c
|
||||
src/cut.c
|
||||
src/files.c
|
||||
src/global.c
|
||||
src/move.c
|
||||
src/nano.c
|
||||
src/rcfile.c
|
||||
src/search.c
|
||||
src/utils.c
|
||||
src/winio.c
|
||||
|
||||
# Package header files
|
||||
nano.h
|
||||
proto.h
|
||||
src/nano.h
|
||||
src/proto.h
|
||||
|
||||
697
po/pt_BR.po
697
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
1603
po/zh_TW.po
Normal file
1603
po/zh_TW.po
Normal file
File diff suppressed because it is too large
Load Diff
4
src/.cvsignore
Normal file
4
src/.cvsignore
Normal file
@@ -0,0 +1,4 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
nano
|
||||
.deps
|
||||
24
src/Makefile.am
Normal file
24
src/Makefile.am
Normal file
@@ -0,0 +1,24 @@
|
||||
DEFS= -DSYSCONFDIR=\"$(sysconfdir)\"
|
||||
localedir = $(datadir)/locale
|
||||
INCLUDES = -Iintl -DLOCALEDIR=\"$(localedir)\" -I@includedir@
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
bin_PROGRAMS = nano
|
||||
nano_SOURCES = color.c \
|
||||
cut.c \
|
||||
files.c \
|
||||
global.c \
|
||||
move.c \
|
||||
nano.c \
|
||||
nano.h \
|
||||
proto.h \
|
||||
rcfile.c \
|
||||
search.c \
|
||||
utils.c \
|
||||
winio.c
|
||||
|
||||
nano_LDADD = @GLIB_LIBS@ @LIBINTL@
|
||||
|
||||
install-exec-hook:
|
||||
cd $(DESTDIR)$(bindir) && $(LN_S) nano rnano
|
||||
@@ -2,7 +2,7 @@
|
||||
/**************************************************************************
|
||||
* color.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2003 Chris Allegretta *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* 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) *
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include "proto.h"
|
||||
@@ -39,14 +38,14 @@ void set_colorpairs(void)
|
||||
{
|
||||
const syntaxtype *this_syntax = syntaxes;
|
||||
|
||||
for(; this_syntax != NULL; this_syntax = this_syntax->next) {
|
||||
for (; this_syntax != NULL; this_syntax = this_syntax->next) {
|
||||
colortype *this_color = this_syntax->color;
|
||||
int color_pair = 1;
|
||||
|
||||
for(; this_color != NULL; this_color = this_color->next) {
|
||||
for (; this_color != NULL; this_color = this_color->next) {
|
||||
const colortype *beforenow = this_syntax->color;
|
||||
|
||||
for(; beforenow != NULL && beforenow != this_color &&
|
||||
for (; beforenow != NULL && beforenow != this_color &&
|
||||
(beforenow->fg != this_color->fg ||
|
||||
beforenow->bg != this_color->bg ||
|
||||
beforenow->bright != this_color->bright);
|
||||
@@ -91,7 +90,7 @@ void do_colorinit(void)
|
||||
init_pair(tmpcolor->pairnum, tmpcolor->fg, background);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("Running %s with fg = %d and bg = %d\n"),
|
||||
fprintf(stderr, "Running %s with fg = %d and bg = %d\n",
|
||||
"init_pair()", tmpcolor->fg, tmpcolor->bg);
|
||||
#endif
|
||||
}
|
||||
@@ -109,7 +108,7 @@ void update_color(void)
|
||||
|
||||
for (e = tmpsyntax->extensions; e != NULL; e = e->next) {
|
||||
/* Set colorstrings if we matched the extension regex */
|
||||
if (!regexec(&e->val, filename, 0, NULL, 0))
|
||||
if (regexec(&e->val, filename, 0, NULL, 0) == 0)
|
||||
colorstrings = tmpsyntax->color;
|
||||
|
||||
if (colorstrings != NULL)
|
||||
@@ -119,9 +118,9 @@ void update_color(void)
|
||||
|
||||
/* if we haven't found a match, use the override string */
|
||||
if (colorstrings == NULL && syntaxstr != NULL) {
|
||||
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
|
||||
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
|
||||
tmpsyntax = tmpsyntax->next) {
|
||||
if (!strcasecmp(tmpsyntax->desc, syntaxstr))
|
||||
if (strcasecmp(tmpsyntax->desc, syntaxstr) == 0)
|
||||
colorstrings = tmpsyntax->color;
|
||||
}
|
||||
}
|
||||
467
src/cut.c
Normal file
467
src/cut.c
Normal file
@@ -0,0 +1,467 @@
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* cut.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
static bool keep_cutbuffer = FALSE;
|
||||
/* Should we keep the contents of the cutbuffer? */
|
||||
static int marked_cut;
|
||||
/* Is the cutbuffer from a mark? 0 means whole-line cut, 1
|
||||
* means mark, and 2 means cut-from-cursor. */
|
||||
#ifndef NANO_SMALL
|
||||
static bool concatenate_cut;
|
||||
/* Should we add this cut string to the end of the last one? */
|
||||
#endif
|
||||
static filestruct *cutbottom = NULL;
|
||||
/* Pointer to end of cutbuffer. */
|
||||
|
||||
void cutbuffer_reset(void)
|
||||
{
|
||||
keep_cutbuffer = FALSE;
|
||||
}
|
||||
|
||||
filestruct *get_cutbottom(void)
|
||||
{
|
||||
return cutbottom;
|
||||
}
|
||||
|
||||
void add_to_cutbuffer(filestruct *inptr, bool allow_concat)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "add_to_cutbuffer(): inptr->data = %s\n", inptr->data);
|
||||
#endif
|
||||
|
||||
if (cutbuffer == NULL)
|
||||
cutbuffer = inptr;
|
||||
#ifndef NANO_SMALL
|
||||
else if (allow_concat && concatenate_cut) {
|
||||
/* Just tack the text in inptr onto the text in cutbottom,
|
||||
* unless allow_concat is FALSE. */
|
||||
cutbottom->data = charealloc(cutbottom->data,
|
||||
strlen(cutbottom->data) + strlen(inptr->data) + 1);
|
||||
strcat(cutbottom->data, inptr->data);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
cutbottom->next = inptr;
|
||||
inptr->prev = cutbottom;
|
||||
}
|
||||
cutbottom = inptr;
|
||||
cutbottom->next = NULL;
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* Cut a marked segment instead of a whole line.
|
||||
*
|
||||
* The first cut character is top->data[top_x]. Unless top == bot, the
|
||||
* last cut line has length bot_x. That is, if bot_x > 0 then we cut to
|
||||
* bot->data[bot_x - 1].
|
||||
*
|
||||
* We maintain totsize, totlines, filebot, the magicline, and line
|
||||
* numbers. Also, we set current and current_x so the cursor will be on
|
||||
* the first character after what was cut. We do not do any screen
|
||||
* updates.
|
||||
*
|
||||
* Note cutbuffer might not be NULL if cut to end is used. */
|
||||
void cut_marked_segment(void)
|
||||
{
|
||||
filestruct *top;
|
||||
filestruct *bot;
|
||||
filestruct *tmp;
|
||||
size_t top_x;
|
||||
size_t bot_x;
|
||||
size_t newsize;
|
||||
|
||||
/* If the mark doesn't cover any text, get out. */
|
||||
if (current == mark_beginbuf && current_x == mark_beginx)
|
||||
return;
|
||||
assert(current != NULL && mark_beginbuf != NULL);
|
||||
|
||||
/* Set up the top and bottom lines and coordinates of the marked
|
||||
* text. */
|
||||
mark_order((const filestruct **)&top, &top_x,
|
||||
(const filestruct **)&bot, &bot_x);
|
||||
|
||||
/* Make the first cut line manually. Move the cut part of the top
|
||||
* line into tmp, and set newsize to that partial line's length. */
|
||||
tmp = copy_node(top);
|
||||
newsize = (top == bot ? bot_x - top_x : strlen(top->data + top_x));
|
||||
charmove(tmp->data, tmp->data + top_x, newsize);
|
||||
null_at(&tmp->data, newsize);
|
||||
|
||||
/* Add the contents of tmp to the cutbuffer. Note that cutbuffer
|
||||
* might be non-NULL if we have cut to end enabled. */
|
||||
if (cutbuffer == NULL) {
|
||||
cutbuffer = tmp;
|
||||
cutbottom = tmp;
|
||||
} else {
|
||||
cutbottom->next = tmp;
|
||||
tmp->prev = cutbottom;
|
||||
cutbottom = tmp;
|
||||
}
|
||||
|
||||
/* And make the top remainder line manually too. Update current_x
|
||||
* and totlines to account for all the cut text, and update totsize
|
||||
* to account for the length of the cut part of the first line. */
|
||||
current_x = top_x;
|
||||
totsize -= newsize;
|
||||
totlines -= bot->lineno - top->lineno;
|
||||
|
||||
/* Now set newsize to be the length of the top remainder line plus
|
||||
* the bottom remainder line, plus one for the null terminator. */
|
||||
newsize = top_x + strlen(bot->data + bot_x) + 1;
|
||||
|
||||
if (top == bot) {
|
||||
/* In this case, we're only cutting one line or part of one
|
||||
* line, so the remainder line is shorter. This means that we
|
||||
* must move text from the end forward first. */
|
||||
charmove(top->data + top_x, bot->data + bot_x, newsize - top_x);
|
||||
top->data = charealloc(top->data, newsize);
|
||||
|
||||
cutbottom->next = NULL;
|
||||
#ifdef DEBUG
|
||||
dump_buffer(cutbuffer);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
/* Update totsize to account for the cut part of the last line. */
|
||||
totsize -= bot_x + 1;
|
||||
|
||||
/* Here, the top remainder line might get longer (if the bottom
|
||||
* remainder line is added to the end of it), so we realloc() it
|
||||
* first. */
|
||||
top->data = charealloc(top->data, newsize);
|
||||
charmove(top->data + top_x, bot->data + bot_x, newsize - top_x);
|
||||
|
||||
assert(cutbottom != NULL && cutbottom->next != NULL);
|
||||
/* We're cutting multiple lines, so in particular the next line is
|
||||
* cut too. */
|
||||
cutbottom->next->prev = cutbottom;
|
||||
|
||||
/* Update totsize to account for all the complete lines that have
|
||||
* been cut. After this, totsize is fully up to date. */
|
||||
for (tmp = top->next; tmp != bot; tmp = tmp->next)
|
||||
totsize -= strlen(tmp->data) + 1;
|
||||
|
||||
/* Make the last cut line manually. */
|
||||
null_at(&bot->data, bot_x);
|
||||
|
||||
/* Move the rest of the cut text (other than the cut part of the top
|
||||
* line) from the buffer to the end of the cutbuffer, and fix the
|
||||
* edit buffer to account for the cut text. */
|
||||
top->next = bot->next;
|
||||
cutbottom = bot;
|
||||
cutbottom->next = NULL;
|
||||
if (top->next != NULL)
|
||||
top->next->prev = top;
|
||||
renumber(top);
|
||||
current = top;
|
||||
|
||||
/* If the bottom line of the cut was the magicline, set filebot
|
||||
* properly, and add a new magicline if the top remainder line
|
||||
* (which is now the new bottom line) is non-blank. */
|
||||
if (bot == filebot) {
|
||||
filebot = top;
|
||||
assert(bot_x == 0);
|
||||
if (top_x > 0)
|
||||
new_magicline();
|
||||
}
|
||||
#ifdef DEBUG
|
||||
dump_buffer(cutbuffer);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void do_cut_text(void)
|
||||
{
|
||||
filestruct *fileptr;
|
||||
|
||||
assert(current != NULL && current->data != NULL);
|
||||
|
||||
check_statblank();
|
||||
|
||||
if (!keep_cutbuffer) {
|
||||
free_filestruct(cutbuffer);
|
||||
cutbuffer = NULL;
|
||||
marked_cut = 0;
|
||||
#ifndef NANO_SMALL
|
||||
concatenate_cut = FALSE;
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Blew away cutbuffer =)\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
/* You can't cut the magicline except with the mark. But trying
|
||||
* does clear the cutbuffer if keep_cutbuffer is FALSE. */
|
||||
if (current == filebot
|
||||
#ifndef NANO_SMALL
|
||||
&& !ISSET(MARK_ISSET)
|
||||
#endif
|
||||
)
|
||||
return;
|
||||
|
||||
keep_cutbuffer = TRUE;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(CUT_TO_END) && !ISSET(MARK_ISSET)) {
|
||||
assert(current_x >= 0 && current_x <= strlen(current->data));
|
||||
|
||||
if (current->data[current_x] == '\0') {
|
||||
/* If the line is empty and we didn't just cut a non-blank
|
||||
* line, create a dummy blank line and add it to the
|
||||
* cutbuffer. */
|
||||
if (marked_cut != 1 && current->next != filebot) {
|
||||
filestruct *junk = make_new_node(current);
|
||||
|
||||
junk->data = charalloc(1);
|
||||
junk->data[0] = '\0';
|
||||
add_to_cutbuffer(junk, TRUE);
|
||||
#ifdef DEBUG
|
||||
dump_buffer(cutbuffer);
|
||||
#endif
|
||||
}
|
||||
|
||||
do_delete();
|
||||
marked_cut = 2;
|
||||
return;
|
||||
} else {
|
||||
SET(MARK_ISSET);
|
||||
|
||||
mark_beginx = strlen(current->data);
|
||||
mark_beginbuf = current;
|
||||
}
|
||||
}
|
||||
|
||||
if (ISSET(MARK_ISSET)) {
|
||||
cut_marked_segment();
|
||||
|
||||
placewewant = xplustabs();
|
||||
UNSET(MARK_ISSET);
|
||||
|
||||
/* If we just did a marked cut of part of a line, we should add
|
||||
* the first line of any cut done immediately afterward to the
|
||||
* end of this cut, as Pico does. */
|
||||
if (current == mark_beginbuf && current_x < strlen(current->data))
|
||||
concatenate_cut = TRUE;
|
||||
marked_cut = 1;
|
||||
edit_refresh();
|
||||
set_modified();
|
||||
return;
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
totlines--;
|
||||
totsize -= strlen(current->data) + 1;
|
||||
fileptr = current;
|
||||
current = current->next;
|
||||
current->prev = fileptr->prev;
|
||||
add_to_cutbuffer(fileptr, TRUE);
|
||||
#ifdef DEBUG
|
||||
dump_buffer(cutbuffer);
|
||||
#endif
|
||||
|
||||
if (fileptr == fileage)
|
||||
fileage = current;
|
||||
else
|
||||
current->prev->next = current;
|
||||
|
||||
if (fileptr == edittop)
|
||||
edittop = current;
|
||||
|
||||
renumber(current);
|
||||
current_x = 0;
|
||||
edit_refresh();
|
||||
set_modified();
|
||||
marked_cut = 0;
|
||||
#ifndef NANO_SMALL
|
||||
concatenate_cut = FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
void do_uncut_text(void)
|
||||
{
|
||||
filestruct *tmp = current;
|
||||
filestruct *newbuf = NULL;
|
||||
filestruct *newend = NULL;
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
check_statblank();
|
||||
if (cutbuffer == NULL || current == NULL)
|
||||
return; /* AIEEEEEEEEEEEE */
|
||||
|
||||
/* If we're uncutting a previously non-marked block, uncut to end if
|
||||
* we're not at the beginning of the line. If we are at the
|
||||
* beginning of the line, set placewewant to 0. Pico does both of
|
||||
* these. */
|
||||
if (marked_cut == 0) {
|
||||
if (current_x != 0)
|
||||
marked_cut = 2;
|
||||
else
|
||||
placewewant = 0;
|
||||
}
|
||||
|
||||
/* If we're going to uncut on the magicline, always make a new
|
||||
* magicline in advance, as Pico does. */
|
||||
if (current->next == NULL)
|
||||
new_magicline();
|
||||
|
||||
if (marked_cut == 0 || cutbuffer->next != NULL) {
|
||||
newbuf = copy_filestruct(cutbuffer);
|
||||
for (newend = newbuf; newend->next != NULL && newend != NULL;
|
||||
newend = newend->next)
|
||||
totlines++;
|
||||
}
|
||||
|
||||
/* Hook newbuf in at current. */
|
||||
if (marked_cut != 0) {
|
||||
filestruct *hold = current;
|
||||
|
||||
/* If there's only one line in the cutbuffer... */
|
||||
if (cutbuffer->next == NULL) {
|
||||
size_t buf_len = strlen(cutbuffer->data);
|
||||
size_t cur_len = strlen(current->data);
|
||||
|
||||
current->data = charealloc(current->data, cur_len + buf_len + 1);
|
||||
charmove(current->data + current_x + buf_len,
|
||||
current->data + current_x, cur_len - current_x + 1);
|
||||
strncpy(current->data + current_x, cutbuffer->data, buf_len);
|
||||
/* Use strncpy() to not copy the null terminator. */
|
||||
|
||||
current_x += buf_len;
|
||||
totsize += buf_len;
|
||||
|
||||
placewewant = xplustabs();
|
||||
} else { /* Yuck -- no kidding! */
|
||||
char *tmpstr, *tmpstr2;
|
||||
|
||||
tmp = current->next;
|
||||
|
||||
/* New beginning. */
|
||||
tmpstr = charalloc(current_x + strlen(newbuf->data) + 1);
|
||||
strncpy(tmpstr, current->data, current_x);
|
||||
strcpy(&tmpstr[current_x], newbuf->data);
|
||||
totsize += strlen(newbuf->data) + strlen(newend->data) + 1;
|
||||
|
||||
/* New end. */
|
||||
tmpstr2 = charalloc(strlen(newend->data) +
|
||||
strlen(¤t->data[current_x]) + 1);
|
||||
strcpy(tmpstr2, newend->data);
|
||||
strcat(tmpstr2, ¤t->data[current_x]);
|
||||
|
||||
free(current->data);
|
||||
current->data = tmpstr;
|
||||
current->next = newbuf->next;
|
||||
newbuf->next->prev = current;
|
||||
delete_node(newbuf);
|
||||
|
||||
current_x = strlen(newend->data);
|
||||
placewewant = xplustabs();
|
||||
free(newend->data);
|
||||
newend->data = tmpstr2;
|
||||
|
||||
newend->next = tmp;
|
||||
|
||||
/* If tmp isn't NULL, we're in the middle: update the
|
||||
* prev pointer. If it IS NULL, we're at the end; update
|
||||
* the filebot pointer. */
|
||||
if (tmp != NULL)
|
||||
tmp->prev = newend;
|
||||
else {
|
||||
filebot = newend;
|
||||
new_magicline();
|
||||
}
|
||||
|
||||
/* Now why don't we update the totsize also? */
|
||||
for (tmp = current->next; tmp != newend; tmp = tmp->next)
|
||||
totsize += strlen(tmp->data) + 1;
|
||||
|
||||
current = newend;
|
||||
}
|
||||
|
||||
/* If marked cut == 2, it means that we're doing a cut to end
|
||||
* and we don't want anything else on the line, so we have to
|
||||
* screw up all the work we just did and separate the line. */
|
||||
if (marked_cut == 2) {
|
||||
tmp = make_new_node(current);
|
||||
tmp->data = mallocstrcpy(NULL, current->data + current_x);
|
||||
splice_node(current, tmp, current->next);
|
||||
null_at(¤t->data, current_x);
|
||||
current = current->next;
|
||||
current_x = 0;
|
||||
placewewant = 0;
|
||||
|
||||
/* Extra line added; update stuff. */
|
||||
totlines++;
|
||||
totsize++;
|
||||
}
|
||||
/* Renumber from BEFORE where we pasted ;) */
|
||||
renumber(hold);
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_buffer(fileage);
|
||||
dump_buffer(cutbuffer);
|
||||
#endif
|
||||
set_modified();
|
||||
edit_refresh();
|
||||
return;
|
||||
}
|
||||
|
||||
if (current != fileage) {
|
||||
tmp = current->prev;
|
||||
tmp->next = newbuf;
|
||||
newbuf->prev = tmp;
|
||||
} else
|
||||
fileage = newbuf;
|
||||
totlines++; /* Unmarked uncuts don't split lines. */
|
||||
|
||||
/* This is so uncutting at the top of the buffer will work => */
|
||||
if (current_y == 0)
|
||||
edittop = newbuf;
|
||||
|
||||
/* Connect the end of the buffer to the filestruct. */
|
||||
newend->next = current;
|
||||
current->prev = newend;
|
||||
|
||||
/* Recalculate size *sigh* */
|
||||
for (tmp = newbuf; tmp != current; tmp = tmp->next)
|
||||
totsize += strlen(tmp->data) + 1;
|
||||
|
||||
renumber(newbuf);
|
||||
edit_refresh();
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_buffer_reverse();
|
||||
#endif
|
||||
|
||||
set_modified();
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
1199
src/global.c
Normal file
1199
src/global.c
Normal file
File diff suppressed because it is too large
Load Diff
288
src/move.c
Normal file
288
src/move.c
Normal file
@@ -0,0 +1,288 @@
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* move.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
void do_first_line(void)
|
||||
{
|
||||
size_t old_pww = placewewant;
|
||||
current = fileage;
|
||||
placewewant = 0;
|
||||
current_x = 0;
|
||||
if (edittop != fileage || need_vertical_update(old_pww))
|
||||
edit_update(current, TOP);
|
||||
}
|
||||
|
||||
void do_last_line(void)
|
||||
{
|
||||
size_t old_pww = placewewant;
|
||||
current = filebot;
|
||||
placewewant = 0;
|
||||
current_x = 0;
|
||||
if (edittop->lineno + (editwinrows / 2) != filebot->lineno ||
|
||||
need_vertical_update(old_pww))
|
||||
edit_update(current, CENTER);
|
||||
}
|
||||
|
||||
void do_home(void)
|
||||
{
|
||||
size_t old_pww = placewewant;
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(SMART_HOME)) {
|
||||
int old_current_x = current_x;
|
||||
|
||||
for (current_x = 0; isblank(current->data[current_x]) &&
|
||||
current->data[current_x] != '\0'; current_x++)
|
||||
;
|
||||
|
||||
if (current_x == old_current_x || current->data[current_x] == '\0')
|
||||
current_x = 0;
|
||||
|
||||
placewewant = xplustabs();
|
||||
} else {
|
||||
#endif
|
||||
current_x = 0;
|
||||
placewewant = 0;
|
||||
#ifndef NANO_SMALL
|
||||
}
|
||||
#endif
|
||||
check_statblank();
|
||||
if (need_horizontal_update(old_pww))
|
||||
update_line(current, current_x);
|
||||
}
|
||||
|
||||
void do_end(void)
|
||||
{
|
||||
size_t old_pww = placewewant;
|
||||
current_x = strlen(current->data);
|
||||
placewewant = xplustabs();
|
||||
check_statblank();
|
||||
if (need_horizontal_update(old_pww))
|
||||
update_line(current, current_x);
|
||||
}
|
||||
|
||||
void do_page_up(void)
|
||||
{
|
||||
size_t old_pww = placewewant;
|
||||
const filestruct *old_current = current;
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
|
||||
/* If the first line of the file is onscreen, move current up there
|
||||
* and put the cursor at the beginning of the line. */
|
||||
if (edittop == fileage) {
|
||||
current = fileage;
|
||||
placewewant = 0;
|
||||
} else {
|
||||
edit_scroll(UP, editwinrows - 2);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* If we're in smooth scrolling mode and there's at least one
|
||||
* page of text left, move the current line of the edit window
|
||||
* up a page. */
|
||||
if (ISSET(SMOOTHSCROLL) && current->lineno > editwinrows - 2) {
|
||||
int i;
|
||||
for (i = 0; i < editwinrows - 2; i++)
|
||||
current = current->prev;
|
||||
}
|
||||
/* If we're not in smooth scrolling mode or there isn't at least
|
||||
* one page of text left, put the cursor at the beginning of the
|
||||
* top line of the edit window, as Pico does. */
|
||||
else {
|
||||
#endif
|
||||
current = edittop;
|
||||
placewewant = 0;
|
||||
#ifndef NANO_SMALL
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Get the equivalent x-coordinate of the new line. */
|
||||
current_x = actual_x(current->data, placewewant);
|
||||
|
||||
/* Update all the lines that need to be updated. */
|
||||
edit_redraw(old_current, old_pww);
|
||||
|
||||
check_statblank();
|
||||
}
|
||||
|
||||
void do_page_down(void)
|
||||
{
|
||||
size_t old_pww = placewewant;
|
||||
const filestruct *old_current = current;
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
|
||||
/* If the last line of the file is onscreen, move current down
|
||||
* there and put the cursor at the beginning of the line. */
|
||||
if (edittop->lineno + editwinrows > filebot->lineno) {
|
||||
current = filebot;
|
||||
placewewant = 0;
|
||||
} else {
|
||||
edit_scroll(DOWN, editwinrows - 2);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* If we're in smooth scrolling mode and there's at least one
|
||||
* page of text left, move the current line of the edit window
|
||||
* down a page. */
|
||||
if (ISSET(SMOOTHSCROLL) && current->lineno + editwinrows - 2 <=
|
||||
filebot->lineno) {
|
||||
int i;
|
||||
for (i = 0; i < editwinrows - 2; i++)
|
||||
current = current->next;
|
||||
}
|
||||
/* If we're not in smooth scrolling mode or there isn't at least
|
||||
* one page of text left, put the cursor at the beginning of the
|
||||
* top line of the edit window, as Pico does. */
|
||||
else {
|
||||
#endif
|
||||
current = edittop;
|
||||
placewewant = 0;
|
||||
#ifndef NANO_SMALL
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Get the equivalent x-coordinate of the new line. */
|
||||
current_x = actual_x(current->data, placewewant);
|
||||
|
||||
/* Update all the lines that need to be updated. */
|
||||
edit_redraw(old_current, old_pww);
|
||||
|
||||
check_statblank();
|
||||
}
|
||||
|
||||
void do_up(void)
|
||||
{
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
check_statblank();
|
||||
|
||||
if (current->prev == NULL)
|
||||
return;
|
||||
|
||||
assert(current_y == current->lineno - edittop->lineno);
|
||||
current = current->prev;
|
||||
current_x = actual_x(current->data, placewewant);
|
||||
|
||||
/* If we're on the first row of the edit window, scroll up one line
|
||||
* if we're in smooth scrolling mode, or up half a page if we're
|
||||
* not. */
|
||||
if (current_y == 0)
|
||||
edit_scroll(UP,
|
||||
#ifndef NANO_SMALL
|
||||
ISSET(SMOOTHSCROLL) ? 1 :
|
||||
#endif
|
||||
editwinrows / 2);
|
||||
|
||||
/* Update the lines left alone by edit_scroll(): the line we were on
|
||||
* before and the line we're on now. The former needs to be redrawn
|
||||
* if we're not on the first page, and the latter needs to be
|
||||
* drawn. */
|
||||
if (need_vertical_update(0))
|
||||
update_line(current->next, 0);
|
||||
update_line(current, current_x);
|
||||
}
|
||||
|
||||
void do_down(void)
|
||||
{
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
check_statblank();
|
||||
|
||||
if (current->next == NULL)
|
||||
return;
|
||||
|
||||
assert(current_y == current->lineno - edittop->lineno);
|
||||
current = current->next;
|
||||
current_x = actual_x(current->data, placewewant);
|
||||
|
||||
/* If we're on the last row of the edit window, scroll down one line
|
||||
* if we're in smooth scrolling mode, or down half a page if we're
|
||||
* not. */
|
||||
if (current_y == editwinrows - 1)
|
||||
edit_scroll(DOWN,
|
||||
#ifndef NANO_SMALL
|
||||
ISSET(SMOOTHSCROLL) ? 1 :
|
||||
#endif
|
||||
editwinrows / 2);
|
||||
|
||||
/* Update the lines left alone by edit_scroll(): the line we were on
|
||||
* before and the line we're on now. The former needs to be redrawn
|
||||
* if we're not on the first page, and the latter needs to be
|
||||
* drawn. */
|
||||
if (need_vertical_update(0))
|
||||
update_line(current->prev, 0);
|
||||
update_line(current, current_x);
|
||||
}
|
||||
|
||||
void do_left(int allow_update)
|
||||
{
|
||||
size_t old_pww = placewewant;
|
||||
if (current_x > 0)
|
||||
current_x--;
|
||||
else if (current != fileage) {
|
||||
do_up();
|
||||
current_x = strlen(current->data);
|
||||
}
|
||||
placewewant = xplustabs();
|
||||
check_statblank();
|
||||
if (allow_update && need_horizontal_update(old_pww))
|
||||
update_line(current, current_x);
|
||||
}
|
||||
|
||||
void do_left_void(void)
|
||||
{
|
||||
do_left(TRUE);
|
||||
}
|
||||
|
||||
void do_right(int allow_update)
|
||||
{
|
||||
size_t old_pww = placewewant;
|
||||
assert(current_x <= strlen(current->data));
|
||||
|
||||
if (current->data[current_x] != '\0')
|
||||
current_x++;
|
||||
else if (current->next != NULL) {
|
||||
do_down();
|
||||
current_x = 0;
|
||||
}
|
||||
placewewant = xplustabs();
|
||||
check_statblank();
|
||||
if (allow_update && need_horizontal_update(old_pww))
|
||||
update_line(current, current_x);
|
||||
}
|
||||
|
||||
void do_right_void(void)
|
||||
{
|
||||
do_right(TRUE);
|
||||
}
|
||||
3635
src/nano.c
Normal file
3635
src/nano.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
||||
/**************************************************************************
|
||||
* nano.h *
|
||||
* *
|
||||
* Copyright (C) 1999-2003 Chris Allegretta *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* 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) *
|
||||
@@ -19,36 +19,51 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef NANO_H
|
||||
#define NANO_H 1
|
||||
|
||||
#ifdef __TANDEM
|
||||
/* Tandem NonStop Kernel */
|
||||
#include <floss.h>
|
||||
#define NANO_ROOT_UID 65535
|
||||
#else
|
||||
#define NANO_ROOT_UID 0
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#ifndef NANO_H
|
||||
#define NANO_H 1
|
||||
|
||||
/* Macros for the flags int... */
|
||||
/* Macros for the flags long... */
|
||||
#define SET(bit) flags |= bit
|
||||
#define UNSET(bit) flags &= ~bit
|
||||
#define ISSET(bit) (flags & bit)
|
||||
#define ISSET(bit) ((flags & bit) != 0)
|
||||
#define TOGGLE(bit) flags ^= bit
|
||||
|
||||
/* Define charalloc as a macro rather than duplicating code */
|
||||
#define charalloc(howmuch) (char *)nmalloc((howmuch) * sizeof(char))
|
||||
#define charealloc(ptr, howmuch) (char *)nrealloc(ptr, (howmuch) * sizeof(char))
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* For the backup file copy ... */
|
||||
# define COPYFILEBLOCKSIZE 1024
|
||||
#define charmove(dest, src, n) memmove(dest, src, (n) * sizeof(char))
|
||||
#ifdef BROKEN_REGEXEC
|
||||
#define regexec(preg, string, nmatch, pmatch, eflags) regexec_safe(preg, string, nmatch, pmatch, eflags)
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLANG /* Slang support enabled */
|
||||
#ifndef NANO_SMALL
|
||||
/* For the backup file copy ... */
|
||||
#define COPYFILEBLOCKSIZE 1024
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLANG
|
||||
/* Slang support enabled. */
|
||||
#include <slcurses.h>
|
||||
#define KEY_IC SL_KEY_IC
|
||||
/* Slang curses emulation brain damage, part 2: Slang doesn't define the
|
||||
* curses equivalents of the Insert or Delete keys. */
|
||||
#define KEY_DC SL_KEY_DELETE
|
||||
#define KEY_IC SL_KEY_IC
|
||||
#elif defined(HAVE_NCURSES_H)
|
||||
#include <ncurses.h>
|
||||
#else /* Uh oh */
|
||||
#include <curses.h>
|
||||
#else /* Uh oh. */
|
||||
#include <curses.h>
|
||||
#endif /* CURSES_H */
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
@@ -61,58 +76,78 @@
|
||||
# define _(string) (string)
|
||||
# define P_(singular, plural, number) (number == 1 ? singular : plural)
|
||||
#endif
|
||||
#define gettext_noop(string) (string)
|
||||
#define N_(string) gettext_noop(string)
|
||||
/* Mark a string that will be sent to gettext later. */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "config.h"
|
||||
|
||||
/* If no snprintf()/vsnprintf(), use the versions from glib. */
|
||||
#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
|
||||
#include <glib.h>
|
||||
# ifndef HAVE_SNPRINTF
|
||||
# define snprintf g_snprintf
|
||||
# define snprintf g_snprintf
|
||||
# endif
|
||||
# ifndef HAVE_VSNPRINTF
|
||||
# define vsnprintf g_vsnprintf
|
||||
# define vsnprintf g_vsnprintf
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_STRCASECMP) || !defined(HAVE_STRNCASECMP)
|
||||
# ifndef HAVE_STRCASECMP
|
||||
# define strcasecmp strcmp
|
||||
# endif
|
||||
# ifndef HAVE_STRNCASECMP
|
||||
# define strncasecmp strncmp
|
||||
# endif
|
||||
/* If no isblank(), strcasecmp(), strncasecmp(), strcasestr(),
|
||||
* strnlen(), getdelim(), or getline(), use the versions we have. */
|
||||
#ifndef HAVE_ISBLANK
|
||||
#define isblank is_blank_char
|
||||
#endif
|
||||
|
||||
/* HP-UX 10 & 11 do not seem to support KEY_HOME and KEY_END */
|
||||
#ifndef KEY_HOME
|
||||
#define KEY_HOME -1
|
||||
#endif /* KEY_HOME */
|
||||
#ifndef HAVE_STRCASECMP
|
||||
#define strcasecmp nstricmp
|
||||
#endif
|
||||
|
||||
#ifndef KEY_END
|
||||
#define KEY_END -1
|
||||
#endif /* KEY_END */
|
||||
#ifndef HAVE_STRNCASECMP
|
||||
#define strncasecmp nstrnicmp
|
||||
#endif
|
||||
|
||||
/* Snatch these out of the ncurses defs, so we can use them in search
|
||||
history regardless of whether we're using ncurses or not */
|
||||
#if !defined(KEY_UP) || !defined(KEY_DOWN)
|
||||
#define KEY_UP 0403
|
||||
#define KEY_DOWN 0402
|
||||
#endif /* !KEY_UP || !KEY_DOWN */
|
||||
#ifndef HAVE_STRCASESTR
|
||||
#define strcasestr nstristr
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRNLEN
|
||||
#define strnlen nstrnlen
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETDELIM
|
||||
#define getdelim ngetdelim
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETLINE
|
||||
#define getline ngetline
|
||||
#endif
|
||||
|
||||
/* Assume ERR is defined as -1. To avoid duplicate case values when
|
||||
* some key definitions are missing, we have to set all of these, and
|
||||
* all of the special sentinel values below, to different negative
|
||||
* values other than -1. */
|
||||
|
||||
#define VERMSG "GNU nano " VERSION
|
||||
|
||||
/* If we aren't using ncurses, turn the mouse support off, as it's
|
||||
* ncurses-specific. */
|
||||
#ifndef NCURSES_MOUSE_VERSION
|
||||
#define DISABLE_MOUSE 1
|
||||
#endif
|
||||
|
||||
#if defined(DISABLE_WRAPPING) && defined(DISABLE_JUSTIFY)
|
||||
#define DISABLE_WRAPJUSTIFY 1
|
||||
#endif
|
||||
|
||||
/* Structure types */
|
||||
/* Structure types. */
|
||||
typedef struct filestruct {
|
||||
char *data;
|
||||
struct filestruct *next; /* Next node */
|
||||
struct filestruct *prev; /* Previous node */
|
||||
int lineno; /* The line number */
|
||||
struct filestruct *next; /* Next node. */
|
||||
struct filestruct *prev; /* Previous node. */
|
||||
int lineno; /* The line number. */
|
||||
} filestruct;
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
@@ -121,49 +156,56 @@ typedef struct openfilestruct {
|
||||
#ifndef NANO_SMALL
|
||||
struct stat originalfilestat;
|
||||
#endif
|
||||
struct openfilestruct *next; /* Next node */
|
||||
struct openfilestruct *prev; /* Previous node */
|
||||
struct filestruct *fileage; /* Current file */
|
||||
struct filestruct *filebot; /* Current file's last line */
|
||||
struct openfilestruct *next; /* Next node. */
|
||||
struct openfilestruct *prev; /* Previous node. */
|
||||
struct filestruct *fileage; /* Current file. */
|
||||
struct filestruct *filebot; /* Current file's last line. */
|
||||
#ifndef NANO_SMALL
|
||||
struct filestruct *file_mark_beginbuf;
|
||||
/* Current file's beginning marked line */
|
||||
int file_mark_beginx; /* Current file's beginning marked line's
|
||||
x-coordinate position */
|
||||
/* Current file's beginning marked
|
||||
* line. */
|
||||
int file_mark_beginx; /* Current file's beginning marked
|
||||
* line's x-coordinate position. */
|
||||
#endif
|
||||
int file_current_x; /* Current file's x-coordinate position */
|
||||
int file_current_y; /* Current file's y-coordinate position */
|
||||
int file_flags; /* Current file's flags: modification
|
||||
status (and marking status, if
|
||||
available) */
|
||||
int file_placewewant; /* Current file's place we want */
|
||||
int file_totlines; /* Current file's total number of lines */
|
||||
long file_totsize; /* Current file's total size */
|
||||
int file_lineno; /* Current file's line number */
|
||||
int file_current_x; /* Current file's x-coordinate
|
||||
* position. */
|
||||
int file_current_y; /* Current file's y-coordinate
|
||||
* position. */
|
||||
long file_flags; /* Current file's flags: modification
|
||||
* status (and marking status, if
|
||||
* available). */
|
||||
size_t file_placewewant; /* Current file's place we want. */
|
||||
int file_totlines; /* Current file's total number of
|
||||
* lines. */
|
||||
long file_totsize; /* Current file's total size. */
|
||||
int file_lineno; /* Current file's line number. */
|
||||
} openfilestruct;
|
||||
#endif
|
||||
|
||||
typedef struct shortcut {
|
||||
int val; /* Actual sequence that generates the keystroke */
|
||||
int altval; /* Alt key # for this function, or 0 for none */
|
||||
int misc1; /* Other int functions we want bound */
|
||||
int misc2;
|
||||
int viewok; /* is this function legal in view mode? */
|
||||
int (*func) (void); /* Function to call when we catch this key */
|
||||
const char *desc; /* Description, e.g. "Page Up" */
|
||||
/* Key values that aren't used should be set to NANO_NO_KEY. */
|
||||
int ctrlval; /* Special sentinel key or control key we want
|
||||
* bound. */
|
||||
int metaval; /* Meta key we want bound. */
|
||||
int funcval; /* Function key we want bound. */
|
||||
int miscval; /* Other Meta key we want bound. */
|
||||
int viewok; /* Is this function legal in view mode? */
|
||||
void (*func)(void); /* Function to call when we catch this key. */
|
||||
const char *desc; /* Description, e.g. "Page Up". */
|
||||
#ifndef DISABLE_HELP
|
||||
const char *help; /* Help file entry text */
|
||||
const char *help; /* Help file entry text. */
|
||||
#endif
|
||||
struct shortcut *next;
|
||||
struct shortcut *next;
|
||||
} shortcut;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
typedef struct toggle {
|
||||
int val; /* Sequence to toggle the key. Should only need 1 */
|
||||
int val; /* Sequence to toggle the key. Should only need
|
||||
* one. */
|
||||
const char *desc; /* Description for when toggle is, uh, toggled,
|
||||
e.g. "Pico Messages"; we'll append Enabled or
|
||||
Disabled */
|
||||
int flag; /* What flag actually gets toggled */
|
||||
* e.g. "Cut to end"; we'll append Enabled or
|
||||
* Disabled. */
|
||||
long flag; /* What flag actually gets toggled. */
|
||||
struct toggle *next;
|
||||
} toggle;
|
||||
#endif /* !NANO_SMALL */
|
||||
@@ -171,7 +213,7 @@ typedef struct toggle {
|
||||
#ifdef ENABLE_NANORC
|
||||
typedef struct rcoption {
|
||||
const char *name;
|
||||
int flag;
|
||||
long flag;
|
||||
} rcoption;
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
@@ -208,8 +250,10 @@ typedef struct historytype {
|
||||
char *data;
|
||||
} historytype;
|
||||
typedef struct historyheadtype {
|
||||
struct historytype *next; /* keep *next and *prev members together */
|
||||
struct historytype *prev; /* and in same order as in historytype */
|
||||
struct historytype *next; /* Keep *next and *prev members
|
||||
* together. */
|
||||
struct historytype *prev; /* And in same order as in
|
||||
* historytype. */
|
||||
struct historytype *tail;
|
||||
struct historytype *current;
|
||||
int count;
|
||||
@@ -217,42 +261,41 @@ typedef struct historyheadtype {
|
||||
} historyheadtype;
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
/* Bitwise flags so we can save space (or more correctly, not waste it) */
|
||||
|
||||
/* Bitwise flags so we can save space (or more correctly, not waste
|
||||
* it). */
|
||||
#define MODIFIED (1<<0)
|
||||
#define KEEP_CUTBUFFER (1<<1)
|
||||
#define CASE_SENSITIVE (1<<2)
|
||||
#define MARK_ISSET (1<<3)
|
||||
#define CONSTUPDATE (1<<4)
|
||||
#define NO_HELP (1<<5)
|
||||
#define NOFOLLOW_SYMLINKS (1<<6)
|
||||
#define SUSPEND (1<<7)
|
||||
#define NO_WRAP (1<<8)
|
||||
#define AUTOINDENT (1<<9)
|
||||
#define SAMELINEWRAP (1<<10)
|
||||
#define VIEW_MODE (1<<11)
|
||||
#define USE_MOUSE (1<<12)
|
||||
#define USE_REGEXP (1<<13)
|
||||
#define REGEXP_COMPILED (1<<14)
|
||||
#define TEMP_OPT (1<<15)
|
||||
#define CUT_TO_END (1<<16)
|
||||
#define REVERSE_SEARCH (1<<17)
|
||||
#define MULTIBUFFER (1<<18)
|
||||
#define DOS_FILE (1<<19)
|
||||
#define MAC_FILE (1<<20)
|
||||
#define SMOOTHSCROLL (1<<21)
|
||||
#define DISABLE_CURPOS (1<<22) /* Damn, we still need it */
|
||||
#define ALT_KEYPAD (1<<23)
|
||||
#define NO_CONVERT (1<<24)
|
||||
#define BACKUP_FILE (1<<25)
|
||||
#define NO_RCFILE (1<<26)
|
||||
#define COLOR_SYNTAX (1<<27)
|
||||
#define PRESERVE (1<<28)
|
||||
#define HISTORY_CHANGED (1<<29)
|
||||
#define HISTORYLOG (1<<30)
|
||||
|
||||
/* Control key sequences, changing these would be very very bad */
|
||||
#define CASE_SENSITIVE (1<<1)
|
||||
#define MARK_ISSET (1<<2)
|
||||
#define CONSTUPDATE (1<<3)
|
||||
#define NO_HELP (1<<4)
|
||||
#define NOFOLLOW_SYMLINKS (1<<5)
|
||||
#define SUSPEND (1<<6)
|
||||
#define NO_WRAP (1<<7)
|
||||
#define AUTOINDENT (1<<8)
|
||||
#define VIEW_MODE (1<<9)
|
||||
#define USE_MOUSE (1<<10)
|
||||
#define USE_REGEXP (1<<11)
|
||||
#define TEMP_FILE (1<<12)
|
||||
#define CUT_TO_END (1<<13)
|
||||
#define REVERSE_SEARCH (1<<14)
|
||||
#define MULTIBUFFER (1<<15)
|
||||
#define DOS_FILE (1<<16)
|
||||
#define MAC_FILE (1<<17)
|
||||
#define SMOOTHSCROLL (1<<18)
|
||||
#define DISABLE_CURPOS (1<<19) /* Damn, we still need it. */
|
||||
#define REBIND_DELETE (1<<20)
|
||||
#define NO_CONVERT (1<<21)
|
||||
#define BACKUP_FILE (1<<22)
|
||||
#define NO_RCFILE (1<<23)
|
||||
#define COLOR_SYNTAX (1<<24)
|
||||
#define PRESERVE (1<<25)
|
||||
#define HISTORY_CHANGED (1<<26)
|
||||
#define HISTORYLOG (1<<27)
|
||||
#define RESTRICTED (1<<28)
|
||||
#define SMART_HOME (1<<29)
|
||||
#define WHITESPACE_DISPLAY (1<<30)
|
||||
|
||||
/* Control key sequences, changing these would be very very bad. */
|
||||
#define NANO_CONTROL_SPACE 0
|
||||
#define NANO_CONTROL_A 1
|
||||
#define NANO_CONTROL_B 2
|
||||
@@ -280,11 +323,12 @@ typedef struct historyheadtype {
|
||||
#define NANO_CONTROL_X 24
|
||||
#define NANO_CONTROL_Y 25
|
||||
#define NANO_CONTROL_Z 26
|
||||
|
||||
#define NANO_CONTROL_3 27
|
||||
#define NANO_CONTROL_4 28
|
||||
#define NANO_CONTROL_5 29
|
||||
#define NANO_CONTROL_6 30
|
||||
#define NANO_CONTROL_7 31
|
||||
#define NANO_CONTROL_8 127
|
||||
|
||||
#define NANO_ALT_A 'a'
|
||||
#define NANO_ALT_B 'b'
|
||||
@@ -316,16 +360,25 @@ typedef struct historyheadtype {
|
||||
#define NANO_ALT_COMMA ','
|
||||
#define NANO_ALT_LCARAT '<'
|
||||
#define NANO_ALT_RCARAT '>'
|
||||
#define NANO_ALT_BRACKET ']'
|
||||
#define NANO_ALT_RBRACKET ']'
|
||||
#define NANO_ALT_SPACE ' '
|
||||
|
||||
/* Some semi-changeable keybindings; don't play with unless you're sure you
|
||||
know what you're doing */
|
||||
/* Some semi-changeable keybindings; don't play with these unless you're
|
||||
* sure you know what you're doing. Assume ERR is defined as -1. */
|
||||
|
||||
/* No key at all. */
|
||||
#define NANO_NO_KEY -2
|
||||
|
||||
/* Special sentinel key used for search/replace history. */
|
||||
#define NANO_HISTORY_KEY -3
|
||||
|
||||
/* Normal keys. */
|
||||
#define NANO_XON_KEY NANO_CONTROL_Q
|
||||
#define NANO_XOFF_KEY NANO_CONTROL_S
|
||||
#define NANO_INSERTFILE_KEY NANO_CONTROL_R
|
||||
#define NANO_INSERTFILE_FKEY KEY_F(5)
|
||||
#define NANO_EXIT_KEY NANO_CONTROL_X
|
||||
#define NANO_EXIT_FKEY KEY_F(2)
|
||||
#define NANO_EXIT_KEY NANO_CONTROL_X
|
||||
#define NANO_EXIT_FKEY KEY_F(2)
|
||||
#define NANO_WRITEOUT_KEY NANO_CONTROL_O
|
||||
#define NANO_WRITEOUT_FKEY KEY_F(3)
|
||||
#define NANO_GOTO_KEY NANO_CONTROL_7
|
||||
@@ -335,6 +388,7 @@ know what you're doing */
|
||||
#define NANO_HELP_FKEY KEY_F(1)
|
||||
#define NANO_WHEREIS_KEY NANO_CONTROL_W
|
||||
#define NANO_WHEREIS_FKEY KEY_F(6)
|
||||
#define NANO_WHEREIS_NEXT_KEY NANO_ALT_W
|
||||
#define NANO_REPLACE_KEY NANO_CONTROL_4
|
||||
#define NANO_REPLACE_FKEY KEY_F(14)
|
||||
#define NANO_ALT_REPLACE_KEY NANO_ALT_R
|
||||
@@ -352,14 +406,17 @@ know what you're doing */
|
||||
#define NANO_SPELL_KEY NANO_CONTROL_T
|
||||
#define NANO_SPELL_FKEY KEY_F(12)
|
||||
#define NANO_FIRSTLINE_KEY NANO_PREVPAGE_KEY
|
||||
#define NANO_FIRSTLINE_FKEY NANO_PREVPAGE_FKEY
|
||||
#define NANO_LASTLINE_KEY NANO_NEXTPAGE_KEY
|
||||
#define NANO_LASTLINE_FKEY NANO_NEXTPAGE_FKEY
|
||||
#define NANO_CANCEL_KEY NANO_CONTROL_C
|
||||
#define NANO_REFRESH_KEY NANO_CONTROL_L
|
||||
#define NANO_JUSTIFY_KEY NANO_CONTROL_J
|
||||
#define NANO_JUSTIFY_FKEY KEY_F(4)
|
||||
#define NANO_UNJUSTIFY_KEY NANO_CONTROL_U
|
||||
#define NANO_UP_KEY NANO_CONTROL_P
|
||||
#define NANO_DOWN_KEY NANO_CONTROL_N
|
||||
#define NANO_UNJUSTIFY_KEY NANO_UNCUT_KEY /* Same key as uncut. */
|
||||
#define NANO_UNJUSTIFY_FKEY NANO_UNCUT_FKEY /* Same key as uncut. */
|
||||
#define NANO_PREVLINE_KEY NANO_CONTROL_P
|
||||
#define NANO_NEXTLINE_KEY NANO_CONTROL_N
|
||||
#define NANO_FORWARD_KEY NANO_CONTROL_F
|
||||
#define NANO_BACK_KEY NANO_CONTROL_B
|
||||
#define NANO_MARK_KEY NANO_CONTROL_6
|
||||
@@ -379,10 +436,14 @@ know what you're doing */
|
||||
#define NANO_OPENNEXT_KEY NANO_ALT_RCARAT
|
||||
#define NANO_OPENPREV_ALTKEY NANO_ALT_COMMA
|
||||
#define NANO_OPENNEXT_ALTKEY NANO_ALT_PERIOD
|
||||
#define NANO_BRACKET_KEY NANO_ALT_BRACKET
|
||||
#define NANO_BRACKET_KEY NANO_ALT_RBRACKET
|
||||
#define NANO_EXTCMD_KEY NANO_CONTROL_X
|
||||
#define NANO_NEXTWORD_KEY NANO_CONTROL_SPACE
|
||||
#define NANO_PREVWORD_KEY NANO_ALT_SPACE
|
||||
#define NANO_PARABEGIN_KEY NANO_CONTROL_W
|
||||
#define NANO_PARAEND_KEY NANO_CONTROL_O
|
||||
#define NANO_FULLJUSTIFY_KEY NANO_CONTROL_U
|
||||
#define NANO_VERBATIM_KEY NANO_ALT_V
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* Toggles do not exist with NANO_SMALL. */
|
||||
@@ -393,39 +454,45 @@ know what you're doing */
|
||||
#define TOGGLE_MOUSE_KEY NANO_ALT_M
|
||||
#define TOGGLE_CUTTOEND_KEY NANO_ALT_K
|
||||
#define TOGGLE_REGEXP_KEY NANO_ALT_R
|
||||
#define TOGGLE_WRAP_KEY NANO_ALT_W
|
||||
#define TOGGLE_WRAP_KEY NANO_ALT_L
|
||||
#define TOGGLE_BACKWARDS_KEY NANO_ALT_B
|
||||
#define TOGGLE_CASE_KEY NANO_ALT_C
|
||||
#define TOGGLE_LOAD_KEY NANO_ALT_F
|
||||
#define TOGGLE_MULTIBUFFER_KEY NANO_ALT_F
|
||||
#define TOGGLE_DOS_KEY NANO_ALT_D
|
||||
#define TOGGLE_MAC_KEY NANO_ALT_O
|
||||
#define TOGGLE_SMOOTH_KEY NANO_ALT_S
|
||||
#define TOGGLE_NOCONVERT_KEY NANO_ALT_N
|
||||
#define TOGGLE_BACKUP_KEY NANO_ALT_B
|
||||
#define TOGGLE_SYNTAX_KEY NANO_ALT_Y
|
||||
#define TOGGLE_SMARTHOME_KEY NANO_ALT_H
|
||||
#define TOGGLE_WHITESPACE_KEY NANO_ALT_P
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
#define MAIN_VISIBLE 12
|
||||
|
||||
#define VIEW 1
|
||||
#define NOVIEW 0
|
||||
#define VIEW TRUE
|
||||
#define NOVIEW FALSE
|
||||
|
||||
typedef enum {
|
||||
CENTER, TOP, NONE
|
||||
} topmidbotnone;
|
||||
UP, DOWN
|
||||
} updown;
|
||||
|
||||
/* Minimum editor window rows required for nano to work correctly */
|
||||
typedef enum {
|
||||
TOP, CENTER, NONE
|
||||
} topmidnone;
|
||||
|
||||
/* Minimum editor window rows required for nano to work correctly. */
|
||||
#define MIN_EDITOR_ROWS 3
|
||||
|
||||
/* Minimum editor window cols required for nano to work correctly */
|
||||
/* Minimum editor window cols required for nano to work correctly. */
|
||||
#define MIN_EDITOR_COLS 10
|
||||
|
||||
/* Default number of characters from end-of-line where text wrapping
|
||||
occurs */
|
||||
* occurs. */
|
||||
#define CHARS_FROM_EOL 8
|
||||
|
||||
/* Maximum number of search history strings saved, same value used for
|
||||
replace history */
|
||||
* replace history. */
|
||||
#define MAX_SEARCH_HISTORY 100
|
||||
|
||||
#endif /* !NANO_H */
|
||||
@@ -2,7 +2,7 @@
|
||||
/**************************************************************************
|
||||
* proto.h *
|
||||
* *
|
||||
* Copyright (C) 1999-2003 Chris Allegretta *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* 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) *
|
||||
@@ -19,35 +19,52 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
/* Externs */
|
||||
/* Externs. */
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_REGEX_H
|
||||
#include <regex.h>
|
||||
#endif
|
||||
|
||||
#include "nano.h"
|
||||
|
||||
extern int wrap_at;
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
extern ssize_t wrap_at;
|
||||
#endif
|
||||
extern int editwinrows;
|
||||
extern int current_x, current_y, totlines;
|
||||
extern int placewewant;
|
||||
extern size_t placewewant;
|
||||
#ifndef NANO_SMALL
|
||||
extern int mark_beginx;
|
||||
#endif
|
||||
extern long totsize;
|
||||
extern int temp_opt;
|
||||
extern int wrap_at, flags, tabsize;
|
||||
extern long flags;
|
||||
extern ssize_t tabsize;
|
||||
extern int search_last_line;
|
||||
extern int search_offscreen;
|
||||
extern int currslen;
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
extern char *quotestr;
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
extern char *whitespace;
|
||||
#endif
|
||||
|
||||
extern WINDOW *edit, *topwin, *bottomwin;
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
extern char *punct;
|
||||
extern char *brackets;
|
||||
extern char *quotestr;
|
||||
#ifdef HAVE_REGEX_H
|
||||
extern regex_t quotereg;
|
||||
extern int quoterc;
|
||||
extern char *quoteerr;
|
||||
#else
|
||||
extern size_t quotelen;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
extern char *backup_dir;
|
||||
#endif
|
||||
|
||||
extern WINDOW *topwin, *edit, *bottomwin;
|
||||
extern char *filename;
|
||||
extern struct stat originalfilestat;
|
||||
extern char *answer;
|
||||
@@ -67,7 +84,7 @@ extern char *alt_speller;
|
||||
|
||||
extern int resetstatuspos;
|
||||
extern struct stat fileinfo;
|
||||
extern filestruct *current, *fileage, *edittop, *editbot, *filebot;
|
||||
extern filestruct *current, *fileage, *edittop, *filebot;
|
||||
extern filestruct *cutbuffer;
|
||||
#ifndef NANO_SMALL
|
||||
extern filestruct *mark_beginbuf;
|
||||
@@ -101,17 +118,16 @@ extern shortcut *spell_list;
|
||||
extern shortcut *browser_list, *gotodir_list;
|
||||
#endif
|
||||
|
||||
#if !defined(DISABLE_BROWSER) || !defined(DISABLE_HELP) || (!defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION))
|
||||
#if !defined(DISABLE_BROWSER) || !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE)
|
||||
extern const shortcut *currshortcut;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
extern int use_regexp, regexp_compiled;
|
||||
extern regex_t search_regexp;
|
||||
extern regmatch_t regmatches[10];
|
||||
extern regmatch_t regmatches[10];
|
||||
#ifdef ENABLE_COLOR
|
||||
extern regex_t syntaxfile_regexp;
|
||||
extern regmatch_t synfilematches[1];
|
||||
extern regmatch_t synfilematches[1];
|
||||
#endif /* ENABLE_COLOR */
|
||||
#endif /* HAVE_REGEX_H */
|
||||
|
||||
@@ -124,9 +140,13 @@ extern historyheadtype search_history;
|
||||
extern historyheadtype replace_history;
|
||||
#endif
|
||||
|
||||
extern int curses_ended;
|
||||
extern bool curses_ended;
|
||||
|
||||
/* Functions we want available */
|
||||
#ifdef ENABLE_NANORC
|
||||
extern char *homedir;
|
||||
#endif
|
||||
|
||||
/* Functions we want available. */
|
||||
|
||||
/* Public functions in color.c */
|
||||
#ifdef ENABLE_COLOR
|
||||
@@ -136,34 +156,36 @@ void update_color(void);
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
/* Public functions in cut.c */
|
||||
void cutbuffer_reset(void);
|
||||
filestruct *get_cutbottom(void);
|
||||
void add_to_cutbuffer(filestruct *inptr);
|
||||
void cut_marked_segment(filestruct *top, size_t top_x, filestruct *bot,
|
||||
size_t bot_x, int destructive);
|
||||
int do_cut_text(void);
|
||||
int do_uncut_text(void);
|
||||
void add_to_cutbuffer(filestruct *inptr, bool allow_concat);
|
||||
void cut_marked_segment(void);
|
||||
void do_cut_text(void);
|
||||
void do_uncut_text(void);
|
||||
|
||||
/* Public functions in files.c */
|
||||
void load_file(int update);
|
||||
void new_file(void);
|
||||
filestruct *read_line(char *buf, filestruct *prev, int *line1ins, int len);
|
||||
int read_file(FILE *f, const char *filename, int quiet);
|
||||
int open_file(const char *filename, int insert, int quiet);
|
||||
filestruct *read_line(char *buf, filestruct *prev, int *line1ins, size_t
|
||||
len);
|
||||
void read_file(FILE *f, const char *filename, int quiet);
|
||||
bool open_file(const char *filename, int insert, int quiet);
|
||||
char *get_next_filename(const char *name);
|
||||
int do_insertfile(int loading_file);
|
||||
int do_insertfile_void(void);
|
||||
void do_insertfile(int loading_file);
|
||||
void do_insertfile_void(void);
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
openfilestruct *make_new_opennode(openfilestruct *prevnode);
|
||||
void splice_opennode(openfilestruct *begin, openfilestruct *newnode, openfilestruct *end);
|
||||
void splice_opennode(openfilestruct *begin, openfilestruct *newnode,
|
||||
openfilestruct *end);
|
||||
void unlink_opennode(const openfilestruct *fileptr);
|
||||
void delete_opennode(openfilestruct *fileptr);
|
||||
void free_openfilestruct(openfilestruct *src);
|
||||
int add_open_file(int update);
|
||||
int load_open_file(void);
|
||||
int open_prevfile(int closing_file);
|
||||
int open_prevfile_void(void);
|
||||
int open_nextfile(int closing_file);
|
||||
int open_nextfile_void(void);
|
||||
void add_open_file(int update);
|
||||
void load_open_file(void);
|
||||
void open_prevfile(int closing_file);
|
||||
void open_prevfile_void(void);
|
||||
void open_nextfile(int closing_file);
|
||||
void open_nextfile_void(void);
|
||||
int close_open_file(void);
|
||||
#endif
|
||||
#if !defined(DISABLE_SPELLER) || !defined(DISABLE_OPERATINGDIR)
|
||||
@@ -177,68 +199,85 @@ char *safe_tempnam(const char *dirname, const char *filename_prefix);
|
||||
void init_operating_dir(void);
|
||||
int check_operating_dir(const char *currpath, int allow_tabcomp);
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
void init_backup_dir(void);
|
||||
#endif
|
||||
int copy_file(FILE *inn, FILE *out);
|
||||
int write_file(const char *name, int tmp, int append, int nonamechange);
|
||||
int do_writeout(const char *path, int exiting, int append);
|
||||
int do_writeout_void(void);
|
||||
#ifndef NANO_SMALL
|
||||
int write_marked(const char *name, int tmp, int append);
|
||||
#endif
|
||||
int do_writeout(int exiting);
|
||||
void do_writeout_void(void);
|
||||
char *real_dir_from_tilde(const char *buf);
|
||||
#ifndef DISABLE_TABCOMP
|
||||
int append_slash_if_dir(char *buf, int *lastwastab, int *place);
|
||||
int append_slash_if_dir(char *buf, bool *lastwastab, int *place);
|
||||
char **username_tab_completion(char *buf, int *num_matches);
|
||||
char **cwd_tab_completion(char *buf, int *num_matches);
|
||||
char *input_tab(char *buf, int place, int *lastwastab, int *newplace, int *list);
|
||||
char *input_tab(char *buf, int place, bool *lastwastab, int *newplace,
|
||||
bool *list);
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
struct stat filestat(const char *path);
|
||||
int diralphasort(const void *va, const void *vb);
|
||||
void free_charptrarray(char **array, int len);
|
||||
const char *tail(const char *foo);
|
||||
#ifndef DISABLE_BROWSER
|
||||
int diralphasort(const void *va, const void *vb);
|
||||
void free_charptrarray(char **array, size_t len);
|
||||
void striponedir(char *foo);
|
||||
int readable_dir(const char *path);
|
||||
char **browser_init(const char *path, int *longest, int *numents);
|
||||
char *do_browser(const char *inpath);
|
||||
char *do_browse_from(const char *inpath);
|
||||
#endif
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
char *histfilename(void);
|
||||
void load_history(void);
|
||||
bool writehist(FILE *hist, historyheadtype *histhead);
|
||||
void save_history(void);
|
||||
#endif
|
||||
|
||||
/* Public functions in global.c */
|
||||
int length_of_list(const shortcut *s);
|
||||
void sc_init_one(shortcut **shortcutage, int key, const char *desc,
|
||||
#ifndef DISABLE_HELP
|
||||
const char *help,
|
||||
#endif
|
||||
int alt, int misc1, int misc2, int view, int (*func) (void));
|
||||
size_t length_of_list(const shortcut *s);
|
||||
#ifndef NANO_SMALL
|
||||
void toggle_init_one(int val, const char *desc, int flag);
|
||||
void toggle_init_one(int val, const char *desc, long flag);
|
||||
void toggle_init(void);
|
||||
#ifdef DEBUG
|
||||
void free_toggles(void);
|
||||
#endif
|
||||
#endif
|
||||
void free_shortcutage(shortcut **shortcutage);
|
||||
void sc_init_one(shortcut **shortcutage, int key, const char *desc,
|
||||
#ifndef DISABLE_HELP
|
||||
const char *help,
|
||||
#endif
|
||||
int metaval, int funcval, int miscval, int view, void
|
||||
(*func)(void));
|
||||
void shortcut_init(int unjustify);
|
||||
void free_shortcutage(shortcut **shortcutage);
|
||||
#ifdef DEBUG
|
||||
void thanks_for_all_the_fish(void);
|
||||
#endif
|
||||
|
||||
/* Public functions in move.c */
|
||||
int do_home(void);
|
||||
int do_end(void);
|
||||
void page_up(void);
|
||||
int do_page_up(void);
|
||||
int do_page_down(void);
|
||||
int do_up(void);
|
||||
int do_down(void);
|
||||
int do_left(void);
|
||||
int do_right(void);
|
||||
void do_first_line(void);
|
||||
void do_last_line(void);
|
||||
void do_home(void);
|
||||
void do_end(void);
|
||||
void do_page_up(void);
|
||||
void do_page_down(void);
|
||||
void do_up(void);
|
||||
void do_down(void);
|
||||
void do_left(int allow_update);
|
||||
void do_left_void(void);
|
||||
void do_right(int allow_update);
|
||||
void do_right_void(void);
|
||||
|
||||
/* Public functions in nano.c */
|
||||
RETSIGTYPE finish(int sigage);
|
||||
void finish(void);
|
||||
void die(const char *msg, ...);
|
||||
void die_save_file(const char *die_filename);
|
||||
void die_too_small(void);
|
||||
void print_view_warning(void);
|
||||
void global_init(int save_cutbuffer);
|
||||
void global_init(bool save_cutbuffer);
|
||||
void window_init(void);
|
||||
#if !defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION)
|
||||
#ifndef DISABLE_MOUSE
|
||||
void mouse_init(void);
|
||||
#endif
|
||||
#ifndef DISABLE_HELP
|
||||
@@ -246,98 +285,100 @@ void help_init(void);
|
||||
#endif
|
||||
filestruct *make_new_node(filestruct *prevnode);
|
||||
filestruct *copy_node(const filestruct *src);
|
||||
void splice_node(filestruct *begin, filestruct *newnode, filestruct *end);
|
||||
void splice_node(filestruct *begin, filestruct *newnode, filestruct
|
||||
*end);
|
||||
void unlink_node(const filestruct *fileptr);
|
||||
void delete_node(filestruct *fileptr);
|
||||
filestruct *copy_filestruct(const filestruct *src);
|
||||
void free_filestruct(filestruct *src);
|
||||
void renumber_all(void);
|
||||
void renumber(filestruct *fileptr);
|
||||
void print1opt(const char *shortflag, const char *longflag,
|
||||
const char *desc);
|
||||
void print1opt(const char *shortflag, const char *longflag, const char
|
||||
*desc);
|
||||
void usage(void);
|
||||
void version(void);
|
||||
void do_early_abort(void);
|
||||
int no_help(void);
|
||||
#if defined(DISABLE_JUSTIFY) || defined(DISABLE_SPELLER) || defined(DISABLE_HELP) || defined(NANO_SMALL)
|
||||
void nano_disabled_msg(void);
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
RETSIGTYPE cancel_fork(int signal);
|
||||
int open_pipe(const char *command);
|
||||
bool open_pipe(const char *command);
|
||||
#endif
|
||||
#ifndef DISABLE_MOUSE
|
||||
#ifdef NCURSES_MOUSE_VERSION
|
||||
void do_mouse(void);
|
||||
#endif
|
||||
#endif
|
||||
void do_char(char ch);
|
||||
int do_backspace(void);
|
||||
int do_delete(void);
|
||||
int do_tab(void);
|
||||
int do_enter(void);
|
||||
int do_next_word(void);
|
||||
int do_prev_word(void);
|
||||
int do_mark(void);
|
||||
void wrap_reset(void);
|
||||
void do_verbatim_input(void);
|
||||
void do_backspace(void);
|
||||
void do_delete(void);
|
||||
void do_tab(void);
|
||||
void do_enter(void);
|
||||
#ifndef NANO_SMALL
|
||||
void do_next_word(void);
|
||||
void do_prev_word(void);
|
||||
void do_mark(void);
|
||||
#endif
|
||||
#ifndef DISABLE_WRAPPING
|
||||
int do_wrap(filestruct *inptr);
|
||||
void wrap_reset(void);
|
||||
bool do_wrap(filestruct *inptr);
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
int do_int_spell_fix(const char *word);
|
||||
char *do_int_speller(char *tempfile_name);
|
||||
char *do_alt_speller(char *tempfile_name);
|
||||
bool do_int_spell_fix(const char *word);
|
||||
const char *do_int_speller(const char *tempfile_name);
|
||||
const char *do_alt_speller(char *tempfile_name);
|
||||
void do_spell(void);
|
||||
#endif
|
||||
int do_spell(void);
|
||||
#if !defined(DISABLE_WRAPPING) && !defined(NANO_SMALL) || !defined(DISABLE_JUSTIFY)
|
||||
#if !defined(NANO_SMALL) || !defined(DISABLE_JUSTIFY)
|
||||
size_t indent_length(const char *line);
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
int justify_format(int changes_allowed, filestruct *line, size_t skip);
|
||||
#ifdef HAVE_REGEX_H
|
||||
size_t quote_length(const char *line, const regex_t *qreg);
|
||||
#else
|
||||
void justify_format(filestruct *line, size_t skip);
|
||||
size_t quote_length(const char *line);
|
||||
#endif
|
||||
#ifdef HAVE_REGEX_H
|
||||
# define IFREG(a, b) a, b
|
||||
#else
|
||||
# define IFREG(a, b) a
|
||||
#endif
|
||||
int quotes_match(const char *a_line, size_t a_quote,
|
||||
IFREG(const char *b_line, const regex_t *qreg));
|
||||
size_t indents_match(const char *a_line, size_t a_indent,
|
||||
const char *b_line, size_t b_indent);
|
||||
filestruct *backup_lines(filestruct *first_line, size_t par_len,
|
||||
size_t quote_len);
|
||||
int breakable(const char *line, int goal);
|
||||
int break_line(const char *line, int goal, int force);
|
||||
bool quotes_match(const char *a_line, size_t a_quote, const char
|
||||
*b_line);
|
||||
bool indents_match(const char *a_line, size_t a_indent, const char
|
||||
*b_line, size_t b_indent);
|
||||
bool begpar(const filestruct *const foo);
|
||||
void do_para_begin(void);
|
||||
bool inpar(const char *str);
|
||||
void do_para_end(void);
|
||||
filestruct *backup_lines(filestruct *first_line, size_t par_len, size_t
|
||||
quote_len);
|
||||
bool breakable(const char *line, int goal);
|
||||
int break_line(const char *line, int goal, bool force);
|
||||
bool do_para_search(size_t *const quote, size_t *const par);
|
||||
void do_justify(bool full_justify);
|
||||
void do_justify_void(void);
|
||||
void do_full_justify(void);
|
||||
#endif /* !DISABLE_JUSTIFY */
|
||||
int do_justify(void);
|
||||
int do_exit(void);
|
||||
void do_exit(void);
|
||||
void signal_init(void);
|
||||
RETSIGTYPE handle_hupterm(int signal);
|
||||
RETSIGTYPE do_suspend(int signal);
|
||||
RETSIGTYPE do_cont(int signal);
|
||||
#ifndef NANO_SMALL
|
||||
void handle_sigwinch(int s);
|
||||
void allow_pending_sigwinch(bool allow);
|
||||
#endif
|
||||
void print_numlock_warning(void);
|
||||
#ifndef NANO_SMALL
|
||||
void do_toggle(const toggle *which);
|
||||
#endif
|
||||
int abcd(int input);
|
||||
void disable_signals(void);
|
||||
#ifndef NANO_SMALL
|
||||
void enable_signals(void);
|
||||
#endif
|
||||
void disable_flow_control(void);
|
||||
void enable_flow_control(void);
|
||||
void terminal_init(void);
|
||||
|
||||
/* Public functions in rcfile.c */
|
||||
#ifdef ENABLE_NANORC
|
||||
void rcfile_error(const char *msg, ...);
|
||||
void rcfile_msg(const char *msg, ...);
|
||||
char *parse_next_word(char *ptr);
|
||||
char *parse_argument(char *ptr);
|
||||
#ifdef ENABLE_COLOR
|
||||
int colortoint(const char *colorname, int *bright);
|
||||
char *parse_next_regex(char *ptr);
|
||||
int nregcomp(regex_t *preg, const char *regex, int flags);
|
||||
int nregcomp(regex_t *preg, const char *regex, int eflags);
|
||||
void parse_syntax(char *ptr);
|
||||
void parse_colors(char *ptr);
|
||||
#endif /* ENABLE_COLOR */
|
||||
@@ -354,129 +395,185 @@ void not_found_msg(const char *str);
|
||||
void search_abort(void);
|
||||
void search_init_globals(void);
|
||||
int search_init(int replacing);
|
||||
int is_whole_word(int curr_pos, const char *datastr, const char *searchword);
|
||||
filestruct *findnextstr(int quiet, int bracket_mode,
|
||||
const filestruct *begin, int beginx,
|
||||
const char *needle);
|
||||
int do_search(void);
|
||||
int is_whole_word(int curr_pos, const char *datastr, const char
|
||||
*searchword);
|
||||
int findnextstr(int can_display_wrap, int wholeword, const filestruct
|
||||
*begin, size_t beginx, const char *needle, int no_sameline);
|
||||
void do_search(void);
|
||||
#ifndef NANO_SMALL
|
||||
void do_research(void);
|
||||
#endif
|
||||
void replace_abort(void);
|
||||
#ifdef HAVE_REGEX_H
|
||||
int replace_regexp(char *string, int create_flag);
|
||||
#endif
|
||||
char *replace_line(void);
|
||||
int do_replace_loop(const char *prevanswer, const filestruct *begin,
|
||||
int *beginx, int wholewords, int *i);
|
||||
int do_replace(void);
|
||||
void goto_abort(void);
|
||||
int do_gotoline(int line, int save_pos);
|
||||
int do_gotoline_void(void);
|
||||
char *replace_line(const char *needle);
|
||||
int do_replace_loop(const char *needle, const filestruct *real_current,
|
||||
size_t *real_current_x, int wholewords);
|
||||
void do_replace(void);
|
||||
void do_gotoline(int line, bool save_pos);
|
||||
void do_gotoline_void(void);
|
||||
#if defined (ENABLE_MULTIBUFFER) || !defined (DISABLE_SPELLER)
|
||||
void do_gotopos(int line, int pos_x, int pos_y, int pos_placewewant);
|
||||
void do_gotopos(int line, int pos_x, int pos_y, size_t pos_pww);
|
||||
#endif
|
||||
int do_find_bracket(void);
|
||||
void do_find_bracket(void);
|
||||
#ifndef NANO_SMALL
|
||||
void history_init(void);
|
||||
historytype *find_node(historytype *h, char *s);
|
||||
historytype *find_node(historytype *h, const char *s);
|
||||
void remove_node(historytype *r);
|
||||
void insert_node(historytype *h, const char *s);
|
||||
void update_history(historyheadtype *h, char *s);
|
||||
void update_history(historyheadtype *h, const char *s);
|
||||
char *get_history_older(historyheadtype *h);
|
||||
char *get_history_newer(historyheadtype *h);
|
||||
char *get_history_completion(historyheadtype *h, char *s);
|
||||
#ifdef DEBUG
|
||||
void free_history(historyheadtype *h);
|
||||
#ifdef ENABLE_NANORC
|
||||
void load_history(void);
|
||||
void save_history(void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Public functions in utils.c */
|
||||
#ifdef HAVE_REGEX_H
|
||||
#ifdef BROKEN_REGEXEC
|
||||
int regexec_safe(const regex_t *preg, const char *string, size_t nmatch,
|
||||
regmatch_t pmatch[], int eflags);
|
||||
#endif
|
||||
int regexp_bol_or_eol(const regex_t *preg, const char *string);
|
||||
#endif
|
||||
#ifndef HAVE_ISBLANK
|
||||
int is_blank_char(int c);
|
||||
#endif
|
||||
int is_cntrl_char(int c);
|
||||
int num_of_digits(int n);
|
||||
bool parse_num(const char *str, ssize_t *val);
|
||||
void align(char **strp);
|
||||
void null_at(char **data, size_t index);
|
||||
void unsunder(char *str, size_t true_len);
|
||||
void sunder(char *str);
|
||||
#ifndef NANO_SMALL
|
||||
const char *revstrstr(const char *haystack, const char *needle,
|
||||
const char *rev_start);
|
||||
const char *revstristr(const char *haystack, const char *needle,
|
||||
const char *rev_start);
|
||||
#ifndef HAVE_STRCASECMP
|
||||
int nstricmp(const char *s1, const char *s2);
|
||||
#endif
|
||||
const char *stristr(const char *haystack, const char *needle);
|
||||
#ifndef HAVE_STRNCASECMP
|
||||
int nstrnicmp(const char *s1, const char *s2, size_t n);
|
||||
#endif
|
||||
#ifndef HAVE_STRCASESTR
|
||||
const char *nstristr(const char *haystack, const char *needle);
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
const char *revstrstr(const char *haystack, const char *needle, const
|
||||
char *rev_start);
|
||||
const char *revstristr(const char *haystack, const char *needle, const
|
||||
char *rev_start);
|
||||
#endif
|
||||
#ifndef HAVE_STRNLEN
|
||||
size_t nstrnlen(const char *s, size_t maxlen);
|
||||
#endif
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
#ifndef HAVE_GETLINE
|
||||
ssize_t ngetline(char **lineptr, size_t *n, FILE *stream);
|
||||
#endif
|
||||
#ifndef HAVE_GETDELIM
|
||||
ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream);
|
||||
#endif
|
||||
#endif /* !NANO_SMALL && ENABLE_NANORC */
|
||||
const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
const char *rev_start, int line_pos);
|
||||
const char *start);
|
||||
void nperror(const char *s);
|
||||
void *nmalloc(size_t howmuch);
|
||||
void *nrealloc(void *ptr, size_t howmuch);
|
||||
char *mallocstrcpy(char *dest, const char *src);
|
||||
void new_magicline(void);
|
||||
#ifndef NANO_SMALL
|
||||
void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
||||
**bot, size_t *bot_x);
|
||||
#endif
|
||||
#ifndef DISABLE_TABCOMP
|
||||
int check_wildcard_match(const char *text, const char *pattern);
|
||||
#endif
|
||||
|
||||
/* Public functions in winio.c */
|
||||
int do_first_line(void);
|
||||
int do_last_line(void);
|
||||
int xpt(const filestruct *fileptr, int index);
|
||||
#ifndef NANO_SMALL
|
||||
void reset_kbinput(void);
|
||||
#endif
|
||||
int get_kbinput(WINDOW *win, int *meta_key);
|
||||
int get_translated_kbinput(int kbinput, int *es
|
||||
#ifndef NANO_SMALL
|
||||
, int reset
|
||||
#endif
|
||||
);
|
||||
int get_ascii_kbinput(int kbinput, size_t ascii_digits
|
||||
#ifndef NANO_SMALL
|
||||
, int reset
|
||||
#endif
|
||||
);
|
||||
int get_control_kbinput(int kbinput);
|
||||
int get_escape_seq_kbinput(int *escape_seq, size_t es_len, int
|
||||
*ignore_seq);
|
||||
int get_escape_seq_abcd(int kbinput);
|
||||
int *get_verbatim_kbinput(WINDOW *win, int *v_kbinput, size_t *v_len,
|
||||
int allow_ascii);
|
||||
int get_untranslated_kbinput(int kbinput, size_t position, int
|
||||
allow_ascii
|
||||
#ifndef NANO_SMALL
|
||||
, int reset
|
||||
#endif
|
||||
);
|
||||
#ifndef DISABLE_MOUSE
|
||||
int get_mouseinput(int *mouse_x, int *mouse_y, int allow_shortcuts);
|
||||
#endif
|
||||
size_t xplustabs(void);
|
||||
size_t actual_x(const filestruct *fileptr, size_t xplus);
|
||||
size_t actual_x(const char *str, size_t xplus);
|
||||
size_t strnlenpt(const char *buf, size_t size);
|
||||
size_t strlenpt(const char *buf);
|
||||
void blank_bottombars(void);
|
||||
void blank_bottomwin(void);
|
||||
void blank_titlebar(void);
|
||||
void blank_edit(void);
|
||||
void blank_statusbar(void);
|
||||
void blank_statusbar_refresh(void);
|
||||
void check_statblank(void);
|
||||
void nanoget_repaint(const char *buf, const char *inputbuf, int x);
|
||||
void blank_bottombars(void);
|
||||
char *display_string(const char *buf, size_t start_col, size_t len);
|
||||
void nanoget_repaint(const char *buf, const char *inputbuf, size_t x);
|
||||
int nanogetstr(int allowtabs, const char *buf, const char *def,
|
||||
#ifndef NANO_SMALL
|
||||
historyheadtype *history_list,
|
||||
#endif
|
||||
const shortcut *s
|
||||
#ifndef DISABLE_TABCOMP
|
||||
, int *list
|
||||
, bool *list
|
||||
#endif
|
||||
);
|
||||
void set_modified(void);
|
||||
void titlebar(const char *path);
|
||||
void set_modified(void);
|
||||
void statusbar(const char *msg, ...);
|
||||
void bottombars(const shortcut *s);
|
||||
void onekey(const char *keystroke, const char *desc, int len);
|
||||
void onekey(const char *keystroke, const char *desc, size_t len);
|
||||
#ifndef NDEBUG
|
||||
int check_linenumbers(const filestruct *fileptr);
|
||||
#endif
|
||||
int get_page_start(int column);
|
||||
size_t get_page_start(size_t column);
|
||||
void reset_cursor(void);
|
||||
void add_marked_sameline(int begin, int end, filestruct *fileptr, int y,
|
||||
int virt_cur_x, int this_page);
|
||||
void edit_add(const filestruct *fileptr, int yval, int start
|
||||
#ifndef NANO_SMALL
|
||||
, int virt_mark_beginx, int virt_cur_x
|
||||
#endif
|
||||
);
|
||||
void update_line(filestruct *fileptr, int index);
|
||||
void update_cursor(void);
|
||||
void center_cursor(void);
|
||||
void edit_add(const filestruct *fileptr, const char *converted, int
|
||||
yval, size_t start);
|
||||
void update_line(const filestruct *fileptr, size_t index);
|
||||
int need_horizontal_update(size_t old_pww);
|
||||
int need_vertical_update(size_t old_pww);
|
||||
void edit_scroll(updown direction, int nlines);
|
||||
void edit_redraw(const filestruct *old_current, size_t old_pww);
|
||||
void edit_refresh(void);
|
||||
void edit_refresh_clearok(void);
|
||||
void edit_update(filestruct *fileptr, topmidbotnone location);
|
||||
int statusq(int tabs, const shortcut *s, const char *def,
|
||||
void edit_update(filestruct *fileptr, topmidnone location);
|
||||
int statusq(int allowtabs, const shortcut *s, const char *def,
|
||||
#ifndef NANO_SMALL
|
||||
historyheadtype *history_list,
|
||||
#endif
|
||||
const char *msg, ...);
|
||||
int do_yesno(int all, int leavecursor, const char *msg, ...);
|
||||
int total_refresh(void);
|
||||
int do_yesno(int all, const char *msg);
|
||||
void total_refresh(void);
|
||||
void display_main_list(void);
|
||||
void statusbar(const char *msg, ...);
|
||||
int do_cursorpos(int constant);
|
||||
int do_cursorpos_void(void);
|
||||
int line_len(const char *ptr);
|
||||
int do_help(void);
|
||||
int keypad_on(WINDOW *win, int newval);
|
||||
void do_cursorpos(int constant);
|
||||
void do_cursorpos_void(void);
|
||||
#ifndef DISABLE_HELP
|
||||
int help_line_len(const char *ptr);
|
||||
void do_help(void);
|
||||
#endif
|
||||
void do_replace_highlight(int highlight_flag, const char *word);
|
||||
void fix_editbot(void);
|
||||
#ifdef DEBUG
|
||||
void dump_buffer(const filestruct *inptr);
|
||||
void dump_buffer_reverse(void);
|
||||
@@ -2,7 +2,7 @@
|
||||
/**************************************************************************
|
||||
* rcfile.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2003 Chris Allegretta *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* 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) *
|
||||
@@ -27,10 +27,10 @@
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <pwd.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
@@ -41,6 +41,10 @@ const static rcoption rcopts[] = {
|
||||
#ifndef NANO_SMALL
|
||||
{"autoindent", AUTOINDENT},
|
||||
{"backup", BACKUP_FILE},
|
||||
{"backupdir", 0},
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
{"brackets", 0},
|
||||
#endif
|
||||
{"const", CONSTUPDATE},
|
||||
#ifndef NANO_SMALL
|
||||
@@ -49,8 +53,10 @@ const static rcoption rcopts[] = {
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
{"fill", 0},
|
||||
#endif
|
||||
{"keypad", ALT_KEYPAD},
|
||||
#if !defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION)
|
||||
#ifndef NANO_SMALL
|
||||
{"historylog", HISTORYLOG},
|
||||
#endif
|
||||
#ifndef DISABLE_MOUSE
|
||||
{"mouse", USE_MOUSE},
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
@@ -69,12 +75,15 @@ const static rcoption rcopts[] = {
|
||||
#endif
|
||||
{"preserve", PRESERVE},
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
{"punct", 0},
|
||||
{"quotestr", 0},
|
||||
#endif
|
||||
{"rebinddelete", REBIND_DELETE},
|
||||
#ifdef HAVE_REGEX_H
|
||||
{"regexp", USE_REGEXP},
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
{"smarthome", SMART_HOME},
|
||||
{"smooth", SMOOTHSCROLL},
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
@@ -82,15 +91,17 @@ const static rcoption rcopts[] = {
|
||||
#endif
|
||||
{"suspend", SUSPEND},
|
||||
{"tabsize", 0},
|
||||
{"tempfile", TEMP_OPT},
|
||||
{"tempfile", TEMP_FILE},
|
||||
{"view", VIEW_MODE},
|
||||
{"historylog", HISTORYLOG},
|
||||
#ifndef NANO_SMALL
|
||||
{"whitespace", 0},
|
||||
#endif
|
||||
{NULL, 0}
|
||||
};
|
||||
|
||||
static int errors = 0;
|
||||
static bool errors = FALSE;
|
||||
static int lineno = 0;
|
||||
static char *nanorc;
|
||||
static const char *nanorc;
|
||||
|
||||
/* We have an error in some part of the rcfile; put it on stderr and
|
||||
make the user hit return to continue starting up nano. */
|
||||
@@ -99,36 +110,22 @@ void rcfile_error(const char *msg, ...)
|
||||
va_list ap;
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
if (lineno > 0)
|
||||
if (lineno > 0) {
|
||||
errors = TRUE;
|
||||
fprintf(stderr, _("Error in %s on line %d: "), nanorc, lineno);
|
||||
|
||||
va_start(ap, msg);
|
||||
vfprintf(stderr, msg, ap);
|
||||
va_end(ap);
|
||||
fprintf(stderr, _("\nPress return to continue starting nano\n"));
|
||||
|
||||
while (getchar() != '\n');
|
||||
}
|
||||
|
||||
/* Just print the error (one of many, perhaps) but don't abort, yet. */
|
||||
void rcfile_msg(const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
if (!errors) {
|
||||
errors = 1;
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
va_start(ap, msg);
|
||||
vfprintf(stderr, msg, ap);
|
||||
vfprintf(stderr, _(msg), ap);
|
||||
va_end(ap);
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
/* Parse the next word from the string. Returns NULL if we hit EOL. */
|
||||
char *parse_next_word(char *ptr)
|
||||
{
|
||||
while (*ptr != ' ' && *ptr != '\t' && *ptr != '\n' && *ptr != '\0')
|
||||
while (!isblank(*ptr) && *ptr != '\n' && *ptr != '\0')
|
||||
ptr++;
|
||||
|
||||
if (*ptr == '\0')
|
||||
@@ -137,18 +134,19 @@ char *parse_next_word(char *ptr)
|
||||
/* Null terminate and advance ptr */
|
||||
*ptr++ = 0;
|
||||
|
||||
while (*ptr == ' ' || *ptr == '\t')
|
||||
while (isblank(*ptr))
|
||||
ptr++;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/* The keywords operatingdir, fill, tabsize, speller, and quotestr take
|
||||
* an argument when set. Among these, operatingdir, speller, and
|
||||
* quotestr have to allow tabs and spaces in the argument. Thus, if the
|
||||
* next word starts with a ", we say it ends with the last " of the line.
|
||||
* Otherwise, the word is interpreted as usual. That is so the arguments
|
||||
* can contain "s too. */
|
||||
/* The keywords operatingdir, backupdir, fill, tabsize, speller,
|
||||
* punct, brackets, quotestr, and whitespace take an argument when set.
|
||||
* Among these, operatingdir, backupdir, speller, punct, brackets,
|
||||
* quotestr, and whitespace have to allow tabs and spaces in the
|
||||
* argument. Thus, if the next word starts with a ", we say it ends
|
||||
* with the last " of the line. Otherwise, the word is interpreted as
|
||||
* usual. That is so the arguments can contain "s too. */
|
||||
char *parse_argument(char *ptr)
|
||||
{
|
||||
const char *ptr_bak = ptr;
|
||||
@@ -170,13 +168,13 @@ char *parse_argument(char *ptr)
|
||||
ptr = NULL;
|
||||
else
|
||||
*ptr++ = '\0';
|
||||
rcfile_error(_("argument %s has unterminated \""), ptr_bak);
|
||||
rcfile_error(N_("Argument %s has unterminated \""), ptr_bak);
|
||||
} else {
|
||||
*last_quote = '\0';
|
||||
ptr = last_quote + 1;
|
||||
}
|
||||
if (ptr != NULL)
|
||||
while (*ptr == ' ' || *ptr == '\t')
|
||||
while (isblank(*ptr))
|
||||
ptr++;
|
||||
return ptr;
|
||||
}
|
||||
@@ -190,33 +188,33 @@ int colortoint(const char *colorname, int *bright)
|
||||
if (colorname == NULL)
|
||||
return -1;
|
||||
|
||||
if (!strncasecmp(colorname, "bright", 6)) {
|
||||
if (strncasecmp(colorname, "bright", 6) == 0) {
|
||||
*bright = 1;
|
||||
colorname += 6;
|
||||
}
|
||||
|
||||
if (!strcasecmp(colorname, "green"))
|
||||
if (strcasecmp(colorname, "green") == 0)
|
||||
mcolor = COLOR_GREEN;
|
||||
else if (!strcasecmp(colorname, "red"))
|
||||
else if (strcasecmp(colorname, "red") == 0)
|
||||
mcolor = COLOR_RED;
|
||||
else if (!strcasecmp(colorname, "blue"))
|
||||
else if (strcasecmp(colorname, "blue") == 0)
|
||||
mcolor = COLOR_BLUE;
|
||||
else if (!strcasecmp(colorname, "white"))
|
||||
else if (strcasecmp(colorname, "white") == 0)
|
||||
mcolor = COLOR_WHITE;
|
||||
else if (!strcasecmp(colorname, "yellow"))
|
||||
else if (strcasecmp(colorname, "yellow") == 0)
|
||||
mcolor = COLOR_YELLOW;
|
||||
else if (!strcasecmp(colorname, "cyan"))
|
||||
else if (strcasecmp(colorname, "cyan") == 0)
|
||||
mcolor = COLOR_CYAN;
|
||||
else if (!strcasecmp(colorname, "magenta"))
|
||||
else if (strcasecmp(colorname, "magenta") == 0)
|
||||
mcolor = COLOR_MAGENTA;
|
||||
else if (!strcasecmp(colorname, "black"))
|
||||
else if (strcasecmp(colorname, "black") == 0)
|
||||
mcolor = COLOR_BLACK;
|
||||
else {
|
||||
rcfile_error(_("color %s not understood.\n"
|
||||
"Valid colors are \"green\", \"red\", \"blue\", \n"
|
||||
"\"white\", \"yellow\", \"cyan\", \"magenta\" and \n"
|
||||
"\"black\", with the optional prefix \"bright\".\n"),
|
||||
colorname);
|
||||
rcfile_error(N_("Color %s not understood.\n"
|
||||
"Valid colors are \"green\", \"red\", \"blue\", \n"
|
||||
"\"white\", \"yellow\", \"cyan\", \"magenta\" and \n"
|
||||
"\"black\", with the optional prefix \"bright\" \n"
|
||||
"for foreground colors."), colorname);
|
||||
mcolor = -1;
|
||||
}
|
||||
return mcolor;
|
||||
@@ -231,27 +229,27 @@ char *parse_next_regex(char *ptr)
|
||||
if (*ptr == '\0')
|
||||
return NULL;
|
||||
|
||||
/* Null terminate and advance ptr */
|
||||
/* Null terminate and advance ptr. */
|
||||
*ptr++ = '\0';
|
||||
|
||||
while (*ptr == ' ' || *ptr == '\t')
|
||||
while (isblank(*ptr))
|
||||
ptr++;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/* Compile the regular expression regex to preg. Returns FALSE on success,
|
||||
TRUE if the expression is invalid. */
|
||||
int nregcomp(regex_t *preg, const char *regex, int flags)
|
||||
/* Compile the regular expression regex to preg. Returns FALSE on
|
||||
* success, or TRUE if the expression is invalid. */
|
||||
int nregcomp(regex_t *preg, const char *regex, int eflags)
|
||||
{
|
||||
int rc = regcomp(preg, regex, REG_EXTENDED | flags);
|
||||
int rc = regcomp(preg, regex, REG_EXTENDED | eflags);
|
||||
|
||||
if (rc != 0) {
|
||||
size_t len = regerror(rc, preg, NULL, 0);
|
||||
char *str = charalloc(len);
|
||||
|
||||
regerror(rc, preg, str, len);
|
||||
rcfile_error(_("Bad regex \"%s\": %s"), regex, str);
|
||||
rcfile_error(N_("Bad regex \"%s\": %s"), regex, str);
|
||||
free(str);
|
||||
}
|
||||
return rc != 0;
|
||||
@@ -271,7 +269,7 @@ void parse_syntax(char *ptr)
|
||||
return;
|
||||
|
||||
if (*ptr != '"') {
|
||||
rcfile_error(_("regex strings must begin and end with a \" character\n"));
|
||||
rcfile_error(N_("Regex strings must begin and end with a \" character"));
|
||||
return;
|
||||
}
|
||||
ptr++;
|
||||
@@ -280,7 +278,7 @@ void parse_syntax(char *ptr)
|
||||
ptr = parse_next_regex(ptr);
|
||||
|
||||
if (ptr == NULL) {
|
||||
rcfile_error(_("Missing syntax name"));
|
||||
rcfile_error(N_("Missing syntax name"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -295,7 +293,7 @@ void parse_syntax(char *ptr)
|
||||
tmpsyntax->next = (syntaxtype *)nmalloc(sizeof(syntaxtype));
|
||||
tmpsyntax = tmpsyntax->next;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("Adding new syntax after 1st\n"));
|
||||
fprintf(stderr, "Adding new syntax after 1st\n");
|
||||
#endif
|
||||
}
|
||||
tmpsyntax->desc = mallocstrcpy(NULL, nameptr);
|
||||
@@ -303,7 +301,7 @@ void parse_syntax(char *ptr)
|
||||
tmpsyntax->extensions = NULL;
|
||||
tmpsyntax->next = NULL;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("Starting a new syntax type\n"));
|
||||
fprintf(stderr, "Starting a new syntax type\n");
|
||||
fprintf(stderr, "string val=%s\n", nameptr);
|
||||
#endif
|
||||
|
||||
@@ -323,7 +321,7 @@ void parse_syntax(char *ptr)
|
||||
ptr = parse_next_regex(ptr);
|
||||
|
||||
newext = (exttype *)nmalloc(sizeof(exttype));
|
||||
if (nregcomp(&newext->val, fileregptr, REG_NOSUB))
|
||||
if (nregcomp(&newext->val, fileregptr, REG_NOSUB) != 0)
|
||||
free(newext);
|
||||
else {
|
||||
if (endext == NULL)
|
||||
@@ -349,13 +347,19 @@ void parse_colors(char *ptr)
|
||||
ptr = parse_next_word(ptr);
|
||||
|
||||
if (ptr == NULL) {
|
||||
rcfile_error(_("Missing color name"));
|
||||
rcfile_error(N_("Missing color name"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (strstr(fgstr, ",")) {
|
||||
char *bgcolorname;
|
||||
strtok(fgstr, ",");
|
||||
bg = colortoint(strtok(NULL, ","), &bright);
|
||||
bgcolorname = strtok(NULL, ",");
|
||||
if (strncasecmp(bgcolorname, "bright", 6) == 0) {
|
||||
rcfile_error(N_("Background color %s cannot be bright"), bgcolorname);
|
||||
return;
|
||||
}
|
||||
bg = colortoint(bgcolorname, &bright);
|
||||
} else
|
||||
bg = -1;
|
||||
|
||||
@@ -366,7 +370,7 @@ void parse_colors(char *ptr)
|
||||
return;
|
||||
|
||||
if (syntaxes == NULL) {
|
||||
rcfile_error(_("Cannot add a color directive without a syntax line"));
|
||||
rcfile_error(N_("Cannot add a color directive without a syntax line"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -389,13 +393,13 @@ void parse_colors(char *ptr)
|
||||
if (*ptr == '\n' || *ptr == '\0')
|
||||
break;
|
||||
|
||||
if (!strncasecmp(ptr, "start=", 6)) {
|
||||
if (strncasecmp(ptr, "start=", 6) == 0) {
|
||||
ptr += 6;
|
||||
expectend = 1;
|
||||
}
|
||||
|
||||
if (*ptr != '"') {
|
||||
rcfile_error(_("regex strings must begin and end with a \" character\n"));
|
||||
rcfile_error(N_("Regex strings must begin and end with a \" character"));
|
||||
ptr = parse_next_regex(ptr);
|
||||
continue;
|
||||
}
|
||||
@@ -404,7 +408,7 @@ void parse_colors(char *ptr)
|
||||
newcolor = (colortype *)nmalloc(sizeof(colortype));
|
||||
fgstr = ptr;
|
||||
ptr = parse_next_regex(ptr);
|
||||
if (nregcomp(&newcolor->start, fgstr, 0)) {
|
||||
if (nregcomp(&newcolor->start, fgstr, 0) != 0) {
|
||||
free(newcolor);
|
||||
cancelled = 1;
|
||||
} else {
|
||||
@@ -417,32 +421,29 @@ void parse_colors(char *ptr)
|
||||
if (tmpsyntax->color == NULL) {
|
||||
tmpsyntax->color = newcolor;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("Starting a new colorstring for fg %d bg %d\n"),
|
||||
fg, bg);
|
||||
fprintf(stderr, "Starting a new colorstring for fg %d bg %d\n", fg, bg);
|
||||
#endif
|
||||
} else {
|
||||
for (tmpcolor = tmpsyntax->color; tmpcolor->next != NULL;
|
||||
tmpcolor = tmpcolor->next)
|
||||
;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("Adding new entry for fg %d bg %d\n"), fg, bg);
|
||||
fprintf(stderr, "Adding new entry for fg %d bg %d\n", fg, bg);
|
||||
#endif
|
||||
tmpcolor->next = newcolor;
|
||||
}
|
||||
}
|
||||
|
||||
if (expectend) {
|
||||
if (ptr == NULL || strncasecmp(ptr, "end=", 4)) {
|
||||
rcfile_error(_
|
||||
("\"start=\" requires a corresponding \"end=\""));
|
||||
if (ptr == NULL || strncasecmp(ptr, "end=", 4) != 0) {
|
||||
rcfile_error(N_("\"start=\" requires a corresponding \"end=\""));
|
||||
return;
|
||||
}
|
||||
|
||||
ptr += 4;
|
||||
|
||||
if (*ptr != '"') {
|
||||
rcfile_error(_
|
||||
("regex strings must begin and end with a \" character\n"));
|
||||
rcfile_error(N_("Regex strings must begin and end with a \" character"));
|
||||
continue;
|
||||
}
|
||||
ptr++;
|
||||
@@ -455,7 +456,7 @@ void parse_colors(char *ptr)
|
||||
if (cancelled)
|
||||
continue;
|
||||
newcolor->end = (regex_t *)nmalloc(sizeof(regex_t));
|
||||
if (nregcomp(newcolor->end, fgstr, 0)) {
|
||||
if (nregcomp(newcolor->end, fgstr, 0) != 0) {
|
||||
free(newcolor->end);
|
||||
newcolor->end = NULL;
|
||||
}
|
||||
@@ -469,13 +470,13 @@ void parse_colors(char *ptr)
|
||||
void parse_rcfile(FILE *rcstream)
|
||||
{
|
||||
char *buf, *ptr, *keyword, *option;
|
||||
int set = 0, i, j;
|
||||
int set = 0, i;
|
||||
|
||||
buf = charalloc(1024);
|
||||
while (fgets(buf, 1023, rcstream) != 0) {
|
||||
lineno++;
|
||||
ptr = buf;
|
||||
while (*ptr == ' ' || *ptr == '\t')
|
||||
while (isblank(*ptr))
|
||||
ptr++;
|
||||
|
||||
if (*ptr == '\n' || *ptr == '\0')
|
||||
@@ -483,7 +484,7 @@ void parse_rcfile(FILE *rcstream)
|
||||
|
||||
if (*ptr == '#') {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("%s: Read a comment\n"), "parse_rcfile()");
|
||||
fprintf(stderr, "%s: Read a comment\n", "parse_rcfile()");
|
||||
#endif
|
||||
continue; /* Skip past commented lines */
|
||||
}
|
||||
@@ -495,18 +496,18 @@ void parse_rcfile(FILE *rcstream)
|
||||
continue;
|
||||
|
||||
/* Else try to parse the keyword */
|
||||
if (!strcasecmp(keyword, "set"))
|
||||
if (strcasecmp(keyword, "set") == 0)
|
||||
set = 1;
|
||||
else if (!strcasecmp(keyword, "unset"))
|
||||
else if (strcasecmp(keyword, "unset") == 0)
|
||||
set = -1;
|
||||
#ifdef ENABLE_COLOR
|
||||
else if (!strcasecmp(keyword, "syntax"))
|
||||
else if (strcasecmp(keyword, "syntax") == 0)
|
||||
parse_syntax(ptr);
|
||||
else if (!strcasecmp(keyword, "color"))
|
||||
else if (strcasecmp(keyword, "color") == 0)
|
||||
parse_colors(ptr);
|
||||
#endif /* ENABLE_COLOR */
|
||||
else {
|
||||
rcfile_msg(_("command %s not understood"), keyword);
|
||||
rcfile_error(N_("Command %s not understood"), keyword);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -516,30 +517,36 @@ void parse_rcfile(FILE *rcstream)
|
||||
|
||||
if (set != 0) {
|
||||
for (i = 0; rcopts[i].name != NULL; i++) {
|
||||
if (!strcasecmp(option, rcopts[i].name)) {
|
||||
if (strcasecmp(option, rcopts[i].name) == 0) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("%s: Parsing option %s\n"),
|
||||
fprintf(stderr, "%s: Parsing option %s\n",
|
||||
"parse_rcfile()", rcopts[i].name);
|
||||
#endif
|
||||
if (set == 1) {
|
||||
if (!strcasecmp(rcopts[i].name, "tabsize")
|
||||
if (strcasecmp(rcopts[i].name, "tabsize") == 0
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
|| !strcasecmp(rcopts[i].name, "operatingdir")
|
||||
|| strcasecmp(rcopts[i].name, "operatingdir") == 0
|
||||
#endif
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
|| !strcasecmp(rcopts[i].name, "fill")
|
||||
|| strcasecmp(rcopts[i].name, "fill") == 0
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
|| strcasecmp(rcopts[i].name, "whitespace") == 0
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
|| !strcasecmp(rcopts[i].name, "quotestr")
|
||||
|| strcasecmp(rcopts[i].name, "punct") == 0
|
||||
|| strcasecmp(rcopts[i].name, "brackets") == 0
|
||||
|| strcasecmp(rcopts[i].name, "quotestr") == 0
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
|| strcasecmp(rcopts[i].name, "backupdir") == 0
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
|| !strcasecmp(rcopts[i].name, "speller")
|
||||
|| strcasecmp(rcopts[i].name, "speller") == 0
|
||||
#endif
|
||||
) {
|
||||
if (*ptr == '\n' || *ptr == '\0') {
|
||||
rcfile_error(_
|
||||
("option %s requires an argument"),
|
||||
rcopts[i].name);
|
||||
rcfile_error(N_("Option %s requires an argument"), rcopts[i].name);
|
||||
continue;
|
||||
}
|
||||
option = ptr;
|
||||
@@ -550,58 +557,74 @@ void parse_rcfile(FILE *rcstream)
|
||||
fprintf(stderr, "option = %s\n", option);
|
||||
#endif
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
if (!strcasecmp(rcopts[i].name, "operatingdir"))
|
||||
if (strcasecmp(rcopts[i].name, "operatingdir") == 0)
|
||||
operating_dir = mallocstrcpy(NULL, option);
|
||||
else
|
||||
#endif
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
if (!strcasecmp(rcopts[i].name, "fill")) {
|
||||
char *first_error;
|
||||
|
||||
/* Using strtol() instead of atoi() lets
|
||||
* us accept 0 while checking other
|
||||
* errors. */
|
||||
j = (int)strtol(option, &first_error, 10);
|
||||
if (errno == ERANGE || *option == '\0' || *first_error != '\0')
|
||||
rcfile_error(_("requested fill size %d invalid"),
|
||||
j);
|
||||
else
|
||||
wrap_at = j;
|
||||
if (strcasecmp(rcopts[i].name, "fill") == 0) {
|
||||
if (!parse_num(option, &wrap_at)) {
|
||||
rcfile_error(N_("Requested fill size %s invalid"), option);
|
||||
wrap_at = -CHARS_FROM_EOL;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
if (strcasecmp(rcopts[i].name, "whitespace") == 0) {
|
||||
size_t ws_len;
|
||||
whitespace = mallocstrcpy(NULL, option);
|
||||
ws_len = strlen(whitespace);
|
||||
if (ws_len != 2 || (ws_len == 2 && (is_cntrl_char(whitespace[0]) || is_cntrl_char(whitespace[1])))) {
|
||||
rcfile_error(N_("Two non-control characters required"));
|
||||
free(whitespace);
|
||||
whitespace = NULL;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
if (!strcasecmp(rcopts[i].name, "quotestr"))
|
||||
if (strcasecmp(rcopts[i].name, "punct") == 0) {
|
||||
punct = mallocstrcpy(NULL, option);
|
||||
if (strchr(punct, '\t') != NULL || strchr(punct, ' ') != NULL) {
|
||||
rcfile_error(N_("Non-tab and non-space characters required"));
|
||||
free(punct);
|
||||
punct = NULL;
|
||||
}
|
||||
} else if (strcasecmp(rcopts[i].name, "brackets") == 0) {
|
||||
brackets = mallocstrcpy(NULL, option);
|
||||
if (strchr(brackets, '\t') != NULL || strchr(brackets, ' ') != NULL) {
|
||||
rcfile_error(N_("Non-tab and non-space characters required"));
|
||||
free(brackets);
|
||||
brackets = NULL;
|
||||
}
|
||||
} else if (strcasecmp(rcopts[i].name, "quotestr") == 0)
|
||||
quotestr = mallocstrcpy(NULL, option);
|
||||
else
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
if (strcasecmp(rcopts[i].name, "backupdir") == 0)
|
||||
backup_dir = mallocstrcpy(NULL, option);
|
||||
else
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
if (!strcasecmp(rcopts[i].name, "speller"))
|
||||
if (strcasecmp(rcopts[i].name, "speller") == 0)
|
||||
alt_speller = mallocstrcpy(NULL, option);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
char *first_error;
|
||||
|
||||
/* Using strtol instead of atoi lets us
|
||||
* accept 0 while checking other
|
||||
* errors. */
|
||||
j = (int)strtol(option, &first_error, 10);
|
||||
if (errno == ERANGE || *option == '\0' || *first_error != '\0')
|
||||
rcfile_error(_("requested tab size %d invalid"),
|
||||
j);
|
||||
else
|
||||
tabsize = j;
|
||||
if (strcasecmp(rcopts[i].name, "tabsize") == 0) {
|
||||
if (!parse_num(option, &tabsize) || tabsize <= 0)
|
||||
rcfile_error(N_("Requested tab size %s invalid"), option);
|
||||
tabsize = -1;
|
||||
}
|
||||
} else
|
||||
SET(rcopts[i].flag);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("set flag %d!\n"),
|
||||
fprintf(stderr, "set flag %d!\n",
|
||||
rcopts[i].flag);
|
||||
#endif
|
||||
} else {
|
||||
UNSET(rcopts[i].flag);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("unset flag %d!\n"),
|
||||
fprintf(stderr, "unset flag %d!\n",
|
||||
rcopts[i].flag);
|
||||
#endif
|
||||
}
|
||||
@@ -610,8 +633,13 @@ void parse_rcfile(FILE *rcstream)
|
||||
}
|
||||
}
|
||||
free(buf);
|
||||
if (errors)
|
||||
rcfile_error(_("Errors found in .nanorc file"));
|
||||
|
||||
if (errors) {
|
||||
errors = FALSE;
|
||||
fprintf(stderr, _("\nPress Return to continue starting nano\n"));
|
||||
while (getchar() != '\n')
|
||||
;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -620,16 +648,13 @@ void parse_rcfile(FILE *rcstream)
|
||||
void do_rcfile(void)
|
||||
{
|
||||
FILE *rcstream;
|
||||
const struct passwd *userage;
|
||||
uid_t euid = geteuid();
|
||||
char *homenv = getenv("HOME");
|
||||
|
||||
#ifdef SYSCONFDIR
|
||||
assert(sizeof(SYSCONFDIR) == strlen(SYSCONFDIR) + 1);
|
||||
nanorc = charalloc(sizeof(SYSCONFDIR) + 7);
|
||||
sprintf(nanorc, "%s/nanorc", SYSCONFDIR);
|
||||
nanorc = SYSCONFDIR "/nanorc";
|
||||
/* Try to open system nanorc */
|
||||
if ((rcstream = fopen(nanorc, "r")) != NULL) {
|
||||
rcstream = fopen(nanorc, "r");
|
||||
if (rcstream != NULL) {
|
||||
/* Parse it! */
|
||||
parse_rcfile(rcstream);
|
||||
fclose(rcstream);
|
||||
@@ -638,46 +663,51 @@ void do_rcfile(void)
|
||||
|
||||
lineno = 0;
|
||||
|
||||
/* Rely on $HOME, fall back on getpwuid() */
|
||||
if (homenv != NULL) {
|
||||
nanorc = nrealloc(nanorc, strlen(homenv) + 10);
|
||||
sprintf(nanorc, "%s/.nanorc", homenv);
|
||||
} else {
|
||||
userage = getpwuid(euid);
|
||||
endpwent();
|
||||
{
|
||||
const char *homenv = getenv("HOME");
|
||||
|
||||
if (userage == NULL) {
|
||||
rcfile_error(_("I can't find my home directory! Wah!"));
|
||||
SET(NO_RCFILE);
|
||||
} else {
|
||||
nanorc = nrealloc(nanorc, strlen(userage->pw_dir) + 9);
|
||||
sprintf(nanorc, "%s/.nanorc", userage->pw_dir);
|
||||
/* Rely on $HOME, fall back on getpwuid() */
|
||||
if (homenv == NULL) {
|
||||
const struct passwd *userage = getpwuid(geteuid());
|
||||
|
||||
if (userage != NULL)
|
||||
homenv = userage->pw_dir;
|
||||
}
|
||||
homedir = mallocstrcpy(NULL, homenv);
|
||||
}
|
||||
|
||||
if (!ISSET(NO_RCFILE)) {
|
||||
if (homedir == NULL) {
|
||||
rcfile_error(N_("I can't find my home directory! Wah!"));
|
||||
SET(NO_RCFILE);
|
||||
} else {
|
||||
size_t homelen = strlen(homedir);
|
||||
char *nanorcf = charalloc(homelen + 9);
|
||||
|
||||
nanorc = nanorcf;
|
||||
strcpy(nanorcf, homedir);
|
||||
strcpy(nanorcf + homelen, "/.nanorc");
|
||||
|
||||
#if defined(DISABLE_ROOTWRAP) && !defined(DISABLE_WRAPPING)
|
||||
/* If we've already read $SYSCONFDIR/nanorc (if it's there), we're
|
||||
/* If we've already read SYSCONFDIR/nanorc (if it's there), we're
|
||||
root, and --disable-wrapping-as-root is used, turn wrapping off */
|
||||
if (euid == 0)
|
||||
if (geteuid() == NANO_ROOT_UID)
|
||||
SET(NO_WRAP);
|
||||
#endif
|
||||
if ((rcstream = fopen(nanorc, "r")) == NULL) {
|
||||
rcstream = fopen(nanorc, "r");
|
||||
if (rcstream == NULL) {
|
||||
/* Don't complain about the file not existing */
|
||||
if (errno != ENOENT) {
|
||||
rcfile_error(_("Unable to open ~/.nanorc file, %s"),
|
||||
strerror(errno));
|
||||
rcfile_error(N_("Error reading %s: %s"), nanorc, strerror(errno));
|
||||
SET(NO_RCFILE);
|
||||
}
|
||||
} else {
|
||||
parse_rcfile(rcstream);
|
||||
fclose(rcstream);
|
||||
}
|
||||
free(nanorcf);
|
||||
}
|
||||
lineno = 0;
|
||||
|
||||
free(nanorc);
|
||||
#ifdef ENABLE_COLOR
|
||||
set_colorpairs();
|
||||
#endif
|
||||
1110
src/search.c
Normal file
1110
src/search.c
Normal file
File diff suppressed because it is too large
Load Diff
550
src/utils.c
Normal file
550
src/utils.c
Normal file
@@ -0,0 +1,550 @@
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* utils.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
#ifdef BROKEN_REGEXEC
|
||||
#undef regexec
|
||||
int regexec_safe(const regex_t *preg, const char *string, size_t nmatch,
|
||||
regmatch_t pmatch[], int eflags)
|
||||
{
|
||||
if (string != NULL && *string != '\0')
|
||||
return regexec(preg, string, nmatch, pmatch, eflags);
|
||||
return REG_NOMATCH;
|
||||
}
|
||||
#define regexec(preg, string, nmatch, pmatch, eflags) regexec_safe(preg, string, nmatch, pmatch, eflags)
|
||||
#endif /* BROKEN_REGEXEC */
|
||||
|
||||
/* Assume that string will be found by regexec() if the REG_NOTBOL and
|
||||
* REG_NOTEOL glags are not set. */
|
||||
int regexp_bol_or_eol(const regex_t *preg, const char *string)
|
||||
{
|
||||
return (regexec(preg, string, 0, NULL, REG_NOTBOL | REG_NOTEOL) ==
|
||||
REG_NOMATCH);
|
||||
}
|
||||
#endif /* HAVE_REGEX_H */
|
||||
|
||||
#ifndef HAVE_ISBLANK
|
||||
/* This function is equivalent to isblank(). */
|
||||
int is_blank_char(int c)
|
||||
{
|
||||
return (c == '\t' || c == ' ');
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This function is equivalent to iscntrl(), except in that it also
|
||||
* handles control characters with their high bits set. */
|
||||
int is_cntrl_char(int c)
|
||||
{
|
||||
return (-128 <= c && c < -96) || (0 <= c && c < 32) ||
|
||||
(127 <= c && c < 160);
|
||||
}
|
||||
|
||||
int num_of_digits(int n)
|
||||
{
|
||||
int i = 1;
|
||||
|
||||
if (n < 0)
|
||||
n = -n;
|
||||
|
||||
while (n > 10) {
|
||||
n /= 10;
|
||||
i++;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
/* Read an int from str, and store it in *val (if val is not NULL). On
|
||||
* error, we return FALSE and don't change *val. Otherwise, we return
|
||||
* TRUE. */
|
||||
bool parse_num(const char *str, ssize_t *val)
|
||||
{
|
||||
char *first_error;
|
||||
ssize_t j;
|
||||
|
||||
assert(str != NULL);
|
||||
j = (ssize_t)strtol(str, &first_error, 10);
|
||||
if (errno == ERANGE || *str == '\0' || *first_error != '\0')
|
||||
return FALSE;
|
||||
if (val != NULL)
|
||||
*val = j;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Fix the memory allocation for a string. */
|
||||
void align(char **strp)
|
||||
{
|
||||
assert(strp != NULL);
|
||||
if (*strp != NULL)
|
||||
*strp = charealloc(*strp, strlen(*strp) + 1);
|
||||
}
|
||||
|
||||
/* Null a string at a certain index and align it. */
|
||||
void null_at(char **data, size_t index)
|
||||
{
|
||||
assert(data != NULL);
|
||||
*data = charealloc(*data, index + 1);
|
||||
(*data)[index] = '\0';
|
||||
}
|
||||
|
||||
/* For non-null-terminated lines. A line, by definition, shouldn't
|
||||
* normally have newlines in it, so encode its nulls as newlines. */
|
||||
void unsunder(char *str, size_t true_len)
|
||||
{
|
||||
assert(str != NULL);
|
||||
for (; true_len > 0; true_len--, str++) {
|
||||
if (*str == '\0')
|
||||
*str = '\n';
|
||||
}
|
||||
}
|
||||
|
||||
/* For non-null-terminated lines. A line, by definition, shouldn't
|
||||
* normally have newlines in it, so decode its newlines into nulls. */
|
||||
void sunder(char *str)
|
||||
{
|
||||
assert(str != NULL);
|
||||
for (; *str != '\0'; str++) {
|
||||
if (*str == '\n')
|
||||
*str = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef HAVE_STRCASECMP
|
||||
/* This function is equivalent to strcasecmp(). */
|
||||
int nstricmp(const char *s1, const char *s2)
|
||||
{
|
||||
assert(s1 != NULL && s2 != NULL);
|
||||
|
||||
for (; *s1 != '\0' && *s2 != '\0'; s1++, s2++) {
|
||||
if (tolower(*s1) != tolower(*s2))
|
||||
break;
|
||||
}
|
||||
|
||||
return (tolower(*s1) - tolower(*s2));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRNCASECMP
|
||||
/* This function is equivalent to strncasecmp(). */
|
||||
int nstrnicmp(const char *s1, const char *s2, size_t n)
|
||||
{
|
||||
assert(s1 != NULL && s2 != NULL);
|
||||
|
||||
for (; n > 0 && *s1 != '\0' && *s2 != '\0'; n--, s1++, s2++) {
|
||||
if (tolower(*s1) != tolower(*s2))
|
||||
break;
|
||||
}
|
||||
|
||||
if (n > 0)
|
||||
return (tolower(*s1) - tolower(*s2));
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRCASESTR
|
||||
/* This function is equivalent to strcasestr(). It was adapted from
|
||||
* mutt's mutt_stristr() function. */
|
||||
const char *nstristr(const char *haystack, const char *needle)
|
||||
{
|
||||
assert(haystack != NULL && needle != NULL);
|
||||
|
||||
for (; *haystack != '\0'; haystack++) {
|
||||
const char *p = haystack;
|
||||
const char *q = needle;
|
||||
|
||||
for (; tolower(*p) == tolower(*q) && *q != '\0'; p++, q++)
|
||||
;
|
||||
|
||||
if (*q == '\0')
|
||||
return haystack;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* None of this is needed if we're using NANO_SMALL! */
|
||||
#ifndef NANO_SMALL
|
||||
const char *revstrstr(const char *haystack, const char *needle, const
|
||||
char *rev_start)
|
||||
{
|
||||
for (; rev_start >= haystack; rev_start--) {
|
||||
const char *r, *q;
|
||||
|
||||
for (r = rev_start, q = needle ; *q == *r && *q != '\0'; r++, q++)
|
||||
;
|
||||
if (*q == '\0')
|
||||
return rev_start;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *revstristr(const char *haystack, const char *needle, const
|
||||
char *rev_start)
|
||||
{
|
||||
for (; rev_start >= haystack; rev_start--) {
|
||||
const char *r = rev_start, *q = needle;
|
||||
|
||||
for (; (tolower(*q) == tolower(*r)) && (*q != '\0') ; r++, q++)
|
||||
;
|
||||
if (*q == '\0')
|
||||
return rev_start;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
#ifndef HAVE_STRNLEN
|
||||
/* This function is equivalent to strnlen(). */
|
||||
size_t nstrnlen(const char *s, size_t maxlen)
|
||||
{
|
||||
size_t n = 0;
|
||||
|
||||
assert(s != NULL);
|
||||
|
||||
for (; maxlen > 0 && *s != '\0'; maxlen--, n++, s++)
|
||||
;
|
||||
|
||||
return n;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
#ifndef HAVE_GETLINE
|
||||
/* This function is equivalent to getline(). It was adapted from
|
||||
* GNU mailutils' getline() function. */
|
||||
ssize_t ngetline(char **lineptr, size_t *n, FILE *stream)
|
||||
{
|
||||
return getdelim(lineptr, n, '\n', stream);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETDELIM
|
||||
/* This function is equivalent to getdelim(). It was adapted from
|
||||
* GNU mailutils' getdelim() function. */
|
||||
ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream)
|
||||
{
|
||||
size_t indx = 0;
|
||||
int c;
|
||||
|
||||
/* Sanity checks. */
|
||||
if (lineptr == NULL || n == NULL || stream == NULL)
|
||||
return -1;
|
||||
|
||||
/* Allocate the line the first time. */
|
||||
if (*lineptr == NULL) {
|
||||
*lineptr = charalloc(128);
|
||||
*n = 128;
|
||||
}
|
||||
|
||||
while ((c = getc(stream)) != EOF) {
|
||||
/* Check if more memory is needed. */
|
||||
if (indx >= *n) {
|
||||
*lineptr = charealloc(*lineptr, *n + 128);
|
||||
*n += 128;
|
||||
}
|
||||
|
||||
/* Push the result in the line. */
|
||||
(*lineptr)[indx++] = (char)c;
|
||||
|
||||
/* Bail out. */
|
||||
if (c == delim)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Make room for the null character. */
|
||||
if (indx >= *n) {
|
||||
*lineptr = charealloc(*lineptr, *n + 128);
|
||||
*n += 128;
|
||||
}
|
||||
|
||||
/* Null terminate the buffer. */
|
||||
null_at(lineptr, indx++);
|
||||
*n = indx;
|
||||
|
||||
/* The last line may not have the delimiter, we have to return what
|
||||
* we got and the error will be seen on the next iteration. */
|
||||
return (c == EOF && (indx - 1) == 0) ? -1 : indx - 1;
|
||||
}
|
||||
#endif
|
||||
#endif /* !NANO_SMALL && ENABLE_NANORC */
|
||||
|
||||
/* If we are searching backwards, we will find the last match that
|
||||
* starts no later than start. Otherwise we find the first match
|
||||
* starting no earlier than start. If we are doing a regexp search, we
|
||||
* fill in the global variable regmatches with at most 9 subexpression
|
||||
* matches. Also, all .rm_so elements are relative to the start of the
|
||||
* whole match, so regmatches[0].rm_so == 0. */
|
||||
const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
const char *start)
|
||||
{
|
||||
/* start can be 1 character before the start or after the end of the
|
||||
* line. In either case, we just say there is no match found. */
|
||||
if ((start > haystack && *(start - 1) == '\0') || start < haystack)
|
||||
return NULL;
|
||||
assert(haystack != NULL && needle != NULL && start != NULL);
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (ISSET(USE_REGEXP)) {
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(REVERSE_SEARCH)) {
|
||||
if (regexec(&search_regexp, haystack, 1, regmatches, 0) == 0
|
||||
&& haystack + regmatches[0].rm_so <= start) {
|
||||
const char *retval = haystack + regmatches[0].rm_so;
|
||||
|
||||
/* Search forward until there is no more match. */
|
||||
while (regexec(&search_regexp, retval + 1, 1, regmatches,
|
||||
REG_NOTBOL) == 0 && retval + 1 +
|
||||
regmatches[0].rm_so <= start)
|
||||
retval += 1 + regmatches[0].rm_so;
|
||||
/* Finally, put the subexpression matches in global
|
||||
* variable regmatches. The REG_NOTBOL flag doesn't
|
||||
* matter now. */
|
||||
regexec(&search_regexp, retval, 10, regmatches, 0);
|
||||
return retval;
|
||||
}
|
||||
} else
|
||||
#endif /* !NANO_SMALL */
|
||||
if (regexec(&search_regexp, start, 10, regmatches,
|
||||
start > haystack ? REG_NOTBOL : 0) == 0) {
|
||||
const char *retval = start + regmatches[0].rm_so;
|
||||
|
||||
regexec(&search_regexp, retval, 10, regmatches, 0);
|
||||
return retval;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#endif /* HAVE_REGEX_H */
|
||||
#if !defined(DISABLE_SPELLER) || !defined(NANO_SMALL)
|
||||
if (ISSET(CASE_SENSITIVE)) {
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(REVERSE_SEARCH))
|
||||
return revstrstr(haystack, needle, start);
|
||||
else
|
||||
#endif
|
||||
return strstr(start, needle);
|
||||
}
|
||||
#endif /* !DISABLE_SPELLER || !NANO_SMALL */
|
||||
#ifndef NANO_SMALL
|
||||
else if (ISSET(REVERSE_SEARCH))
|
||||
return revstristr(haystack, needle, start);
|
||||
#endif
|
||||
return strcasestr(start, needle);
|
||||
}
|
||||
|
||||
/* This is a wrapper for the perror() function. The wrapper takes care
|
||||
* of ncurses, calls perror (which writes to stderr), then refreshes the
|
||||
* screen. Note that nperror() causes the window to flicker once. */
|
||||
void nperror(const char *s)
|
||||
{
|
||||
/* leave ncurses mode, go to the terminal */
|
||||
if (endwin() != ERR) {
|
||||
perror(s); /* print the error */
|
||||
total_refresh(); /* return to ncurses and repaint */
|
||||
}
|
||||
}
|
||||
|
||||
/* Thanks BG, many ppl have been asking for this... */
|
||||
void *nmalloc(size_t howmuch)
|
||||
{
|
||||
void *r = malloc(howmuch);
|
||||
|
||||
if (r == NULL && howmuch != 0)
|
||||
die(_("nano is out of memory!"));
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
void *nrealloc(void *ptr, size_t howmuch)
|
||||
{
|
||||
void *r = realloc(ptr, howmuch);
|
||||
|
||||
if (r == NULL && howmuch != 0)
|
||||
die(_("nano is out of memory!"));
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Copy one malloc()ed string to another pointer. Should be used as:
|
||||
* dest = mallocstrcpy(dest, src); */
|
||||
char *mallocstrcpy(char *dest, const char *src)
|
||||
{
|
||||
if (src == NULL)
|
||||
src = "";
|
||||
|
||||
if (src != dest)
|
||||
free(dest);
|
||||
|
||||
dest = charalloc(strlen(src) + 1);
|
||||
strcpy(dest, src);
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
/* Append a new magic-line to filebot. */
|
||||
void new_magicline(void)
|
||||
{
|
||||
filebot->next = (filestruct *)nmalloc(sizeof(filestruct));
|
||||
filebot->next->data = charalloc(1);
|
||||
filebot->next->data[0] = '\0';
|
||||
filebot->next->prev = filebot;
|
||||
filebot->next->next = NULL;
|
||||
filebot->next->lineno = filebot->lineno + 1;
|
||||
filebot = filebot->next;
|
||||
totlines++;
|
||||
totsize++;
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* Set top_x and bot_x to the top and bottom x-coordinates of the mark,
|
||||
* respectively, based on the locations of top and bot. */
|
||||
void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
||||
**bot, size_t *bot_x)
|
||||
{
|
||||
assert(top != NULL && top_x != NULL && bot != NULL && bot_x != NULL);
|
||||
if ((current->lineno == mark_beginbuf->lineno && current_x > mark_beginx)
|
||||
|| current->lineno > mark_beginbuf->lineno) {
|
||||
*top = mark_beginbuf;
|
||||
*top_x = mark_beginx;
|
||||
*bot = current;
|
||||
*bot_x = current_x;
|
||||
} else {
|
||||
*bot = mark_beginbuf;
|
||||
*bot_x = mark_beginx;
|
||||
*top = current;
|
||||
*top_x = current_x;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_TABCOMP
|
||||
/*
|
||||
* Routine to see if a text string is matched by a wildcard pattern.
|
||||
* Returns TRUE if the text is matched, or FALSE if it is not matched
|
||||
* or if the pattern is invalid.
|
||||
* * matches zero or more characters
|
||||
* ? matches a single character
|
||||
* [abc] matches 'a', 'b' or 'c'
|
||||
* \c quotes character c
|
||||
* Adapted from code written by Ingo Wilken, and
|
||||
* then taken from sash, Copyright (c) 1999 by David I. Bell
|
||||
* Permission is granted to use, distribute, or modify this source,
|
||||
* provided that this copyright notice remains intact.
|
||||
* Permission to distribute this code under the GPL has been granted.
|
||||
*/
|
||||
int check_wildcard_match(const char *text, const char *pattern)
|
||||
{
|
||||
const char *retrypat;
|
||||
const char *retrytext;
|
||||
int ch;
|
||||
int found;
|
||||
int len;
|
||||
|
||||
retrypat = NULL;
|
||||
retrytext = NULL;
|
||||
|
||||
while (*text != '\0' || *pattern != '\0') {
|
||||
ch = *pattern++;
|
||||
|
||||
switch (ch) {
|
||||
case '*':
|
||||
retrypat = pattern;
|
||||
retrytext = text;
|
||||
break;
|
||||
|
||||
case '[':
|
||||
found = FALSE;
|
||||
|
||||
while ((ch = *pattern++) != ']') {
|
||||
if (ch == '\\')
|
||||
ch = *pattern++;
|
||||
|
||||
if (ch == '\0')
|
||||
return FALSE;
|
||||
|
||||
if (*text == ch)
|
||||
found = TRUE;
|
||||
}
|
||||
len = strlen(text);
|
||||
if (!found && len != 0) {
|
||||
return FALSE;
|
||||
}
|
||||
if (found) {
|
||||
if (strlen(pattern) == 0 && len == 1) {
|
||||
return TRUE;
|
||||
}
|
||||
if (len != 0) {
|
||||
text++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* fall into next case */
|
||||
|
||||
case '?':
|
||||
if (*text++ == '\0')
|
||||
return FALSE;
|
||||
|
||||
break;
|
||||
|
||||
case '\\':
|
||||
ch = *pattern++;
|
||||
|
||||
if (ch == '\0')
|
||||
return FALSE;
|
||||
|
||||
/* fall into next case */
|
||||
|
||||
default:
|
||||
if (*text == ch) {
|
||||
if (*text != '\0')
|
||||
text++;
|
||||
break;
|
||||
}
|
||||
|
||||
if (*text != '\0') {
|
||||
pattern = retrypat;
|
||||
text = ++retrytext;
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (pattern == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
3343
src/winio.c
Normal file
3343
src/winio.c
Normal file
File diff suppressed because it is too large
Load Diff
361
utils.c
361
utils.c
@@ -1,361 +0,0 @@
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* utils.c *
|
||||
* *
|
||||
* Copyright (C) 1999-2003 Chris Allegretta *
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
int is_cntrl_char(int c)
|
||||
{
|
||||
return (-128 <= c && c < -96) || (0 <= c && c < 32) ||
|
||||
(127 <= c && c < 160);
|
||||
}
|
||||
|
||||
int num_of_digits(int n)
|
||||
{
|
||||
int i = 1;
|
||||
|
||||
if (n < 0)
|
||||
n = -n;
|
||||
|
||||
while (n > 10) {
|
||||
n /= 10;
|
||||
i++;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
/* Fix the memory allocation for a string. */
|
||||
void align(char **strp)
|
||||
{
|
||||
if (strp != NULL)
|
||||
*strp = nrealloc(*strp, strlen(*strp) + 1);
|
||||
}
|
||||
|
||||
/* Null a string at a certain index and align it. */
|
||||
void null_at(char **data, size_t index)
|
||||
{
|
||||
assert(data != NULL);
|
||||
*data = (char *)nrealloc(*data, sizeof(char) * (index + 1));
|
||||
(*data)[index] = '\0';
|
||||
}
|
||||
|
||||
/* For non-null-terminated lines. A line, by definition, shouldn't
|
||||
* normally have newlines in it, so encode its nulls as newlines. */
|
||||
void unsunder(char *str, size_t true_len)
|
||||
{
|
||||
assert(str != NULL);
|
||||
for(; true_len > 0; true_len--, str++)
|
||||
if (*str == '\0')
|
||||
*str = '\n';
|
||||
}
|
||||
|
||||
/* For non-null-terminated lines. A line, by definition, shouldn't
|
||||
* normally have newlines in it, so decode its newlines into nulls. */
|
||||
void sunder(char *str)
|
||||
{
|
||||
assert(str != NULL);
|
||||
for(; *str != '\0'; str++)
|
||||
if (*str == '\n')
|
||||
*str = '\0';
|
||||
}
|
||||
|
||||
/* None of this is needed if we're using NANO_SMALL! */
|
||||
#ifndef NANO_SMALL
|
||||
const char *revstrstr(const char *haystack, const char *needle,
|
||||
const char *rev_start)
|
||||
{
|
||||
for(; rev_start >= haystack ; rev_start--) {
|
||||
const char *r, *q;
|
||||
|
||||
for (r = rev_start, q = needle ; *q == *r && *q != '\0'; r++, q++)
|
||||
;
|
||||
if (*q == '\0')
|
||||
return rev_start;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *revstristr(const char *haystack, const char *needle,
|
||||
const char *rev_start)
|
||||
{
|
||||
for (; rev_start >= haystack; rev_start--) {
|
||||
const char *r = rev_start, *q = needle;
|
||||
|
||||
for (; (tolower(*q) == tolower(*r)) && (*q != '\0') ; r++, q++)
|
||||
;
|
||||
if (*q == '\0')
|
||||
return rev_start;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
/* This is now mutt's version (called mutt_stristr) because it doesn't
|
||||
* use memory allocation to do a simple search (yuck). */
|
||||
const char *stristr(const char *haystack, const char *needle)
|
||||
{
|
||||
const char *p, *q;
|
||||
|
||||
if (haystack == NULL)
|
||||
return NULL;
|
||||
if (needle == NULL)
|
||||
return haystack;
|
||||
|
||||
while (*(p = haystack) != '\0') {
|
||||
for (q = needle; *p != 0 && *q != 0 && tolower(*p) == tolower(*q); p++, q++)
|
||||
;
|
||||
if (*q == 0)
|
||||
return haystack;
|
||||
haystack++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* If we are searching backwards, we will find the last match
|
||||
* that starts no later than rev_start. If we are doing a regexp search,
|
||||
* then line_pos should be 0 if haystack starts at the beginning of a
|
||||
* line, and positive otherwise. In the regexp case, we fill in the
|
||||
* global variable regmatches with at most 9 subexpression matches. Also,
|
||||
* all .rm_so elements are relative to the start of the whole match, so
|
||||
* regmatches[0].rm_so == 0. */
|
||||
const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
const char *rev_start, int line_pos)
|
||||
{
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (ISSET(USE_REGEXP)) {
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(REVERSE_SEARCH)) {
|
||||
/* When doing a backwards search, haystack is a whole line. */
|
||||
if (!regexec(&search_regexp, haystack, 1, regmatches, 0) &&
|
||||
haystack + regmatches[0].rm_so <= rev_start) {
|
||||
const char *retval = haystack + regmatches[0].rm_so;
|
||||
|
||||
/* Search forward until there is no more match. */
|
||||
while (!regexec(&search_regexp, retval + 1, 1, regmatches,
|
||||
REG_NOTBOL) &&
|
||||
retval + 1 + regmatches[0].rm_so <= rev_start)
|
||||
retval += 1 + regmatches[0].rm_so;
|
||||
/* Finally, put the subexpression matches in global
|
||||
* variable regmatches. The REG_NOTBOL flag doesn't
|
||||
* matter now. */
|
||||
regexec(&search_regexp, retval, 10, regmatches, 0);
|
||||
return retval;
|
||||
}
|
||||
} else
|
||||
#endif /* !NANO_SMALL */
|
||||
if (!regexec(&search_regexp, haystack, 10, regmatches,
|
||||
line_pos > 0 ? REG_NOTBOL : 0)) {
|
||||
const char *retval = haystack + regmatches[0].rm_so;
|
||||
|
||||
regexec(&search_regexp, retval, 10, regmatches, 0);
|
||||
return retval;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#endif /* HAVE_REGEX_H */
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(CASE_SENSITIVE)) {
|
||||
if (ISSET(REVERSE_SEARCH))
|
||||
return revstrstr(haystack, needle, rev_start);
|
||||
else
|
||||
return strstr(haystack, needle);
|
||||
} else if (ISSET(REVERSE_SEARCH))
|
||||
return revstristr(haystack, needle, rev_start);
|
||||
#endif
|
||||
return stristr(haystack, needle);
|
||||
}
|
||||
|
||||
/* This is a wrapper for the perror function. The wrapper takes care of
|
||||
* ncurses, calls perror (which writes to STDERR), then refreshes the
|
||||
* screen. Note that nperror causes the window to flicker once. */
|
||||
void nperror(const char *s)
|
||||
{
|
||||
/* leave ncurses mode, go to the terminal */
|
||||
if (endwin() != ERR) {
|
||||
perror(s); /* print the error */
|
||||
total_refresh(); /* return to ncurses and repaint */
|
||||
}
|
||||
}
|
||||
|
||||
/* Thanks BG, many ppl have been asking for this... */
|
||||
void *nmalloc(size_t howmuch)
|
||||
{
|
||||
void *r = malloc(howmuch);
|
||||
|
||||
if (r == NULL && howmuch != 0)
|
||||
die(_("nano is out of memory!"));
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
void *nrealloc(void *ptr, size_t howmuch)
|
||||
{
|
||||
void *r = realloc(ptr, howmuch);
|
||||
|
||||
if (r == NULL && howmuch != 0)
|
||||
die(_("nano is out of memory!"));
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Copy one malloc()ed string to another pointer. Should be used as:
|
||||
* dest = mallocstrcpy(dest, src); */
|
||||
char *mallocstrcpy(char *dest, const char *src)
|
||||
{
|
||||
if (src == dest)
|
||||
return dest;
|
||||
|
||||
if (dest != NULL)
|
||||
free(dest);
|
||||
|
||||
if (src == NULL)
|
||||
return NULL;
|
||||
|
||||
dest = charalloc(strlen(src) + 1);
|
||||
strcpy(dest, src);
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
/* Append a new magic-line to filebot. */
|
||||
void new_magicline(void)
|
||||
{
|
||||
filebot->next = nmalloc(sizeof(filestruct));
|
||||
filebot->next->data = charalloc(1);
|
||||
filebot->next->data[0] = '\0';
|
||||
filebot->next->prev = filebot;
|
||||
filebot->next->next = NULL;
|
||||
filebot->next->lineno = filebot->lineno + 1;
|
||||
filebot = filebot->next;
|
||||
totlines++;
|
||||
totsize++;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_TABCOMP
|
||||
/*
|
||||
* Routine to see if a text string is matched by a wildcard pattern.
|
||||
* Returns TRUE if the text is matched, or FALSE if it is not matched
|
||||
* or if the pattern is invalid.
|
||||
* * matches zero or more characters
|
||||
* ? matches a single character
|
||||
* [abc] matches 'a', 'b' or 'c'
|
||||
* \c quotes character c
|
||||
* Adapted from code written by Ingo Wilken, and
|
||||
* then taken from sash, Copyright (c) 1999 by David I. Bell
|
||||
* Permission is granted to use, distribute, or modify this source,
|
||||
* provided that this copyright notice remains intact.
|
||||
* Permission to distribute this code under the GPL has been granted.
|
||||
*/
|
||||
int check_wildcard_match(const char *text, const char *pattern)
|
||||
{
|
||||
const char *retrypat;
|
||||
const char *retrytext;
|
||||
int ch;
|
||||
int found;
|
||||
int len;
|
||||
|
||||
retrypat = NULL;
|
||||
retrytext = NULL;
|
||||
|
||||
while (*text != '\0' || *pattern != '\0') {
|
||||
ch = *pattern++;
|
||||
|
||||
switch (ch) {
|
||||
case '*':
|
||||
retrypat = pattern;
|
||||
retrytext = text;
|
||||
break;
|
||||
|
||||
case '[':
|
||||
found = FALSE;
|
||||
|
||||
while ((ch = *pattern++) != ']') {
|
||||
if (ch == '\\')
|
||||
ch = *pattern++;
|
||||
|
||||
if (ch == '\0')
|
||||
return FALSE;
|
||||
|
||||
if (*text == ch)
|
||||
found = TRUE;
|
||||
}
|
||||
len = strlen(text);
|
||||
if (found == FALSE && len != 0) {
|
||||
return FALSE;
|
||||
}
|
||||
if (found == TRUE) {
|
||||
if (strlen(pattern) == 0 && len == 1) {
|
||||
return TRUE;
|
||||
}
|
||||
if (len != 0) {
|
||||
text++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* fall into next case */
|
||||
|
||||
case '?':
|
||||
if (*text++ == '\0')
|
||||
return FALSE;
|
||||
|
||||
break;
|
||||
|
||||
case '\\':
|
||||
ch = *pattern++;
|
||||
|
||||
if (ch == '\0')
|
||||
return FALSE;
|
||||
|
||||
/* fall into next case */
|
||||
|
||||
default:
|
||||
if (*text == ch) {
|
||||
if (*text != '\0')
|
||||
text++;
|
||||
break;
|
||||
}
|
||||
|
||||
if (*text != '\0') {
|
||||
pattern = retrypat;
|
||||
text = ++retrytext;
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (pattern == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user