Compare commits
103 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca7a21d358 | ||
|
|
71366cd21a | ||
|
|
6c5781ba10 | ||
|
|
c793c43e95 | ||
|
|
31c76660ed | ||
|
|
f26bca74d0 | ||
|
|
9fc5facab2 | ||
|
|
1cc29f626d | ||
|
|
d466ab7be0 | ||
|
|
ef601bbe08 | ||
|
|
aaabe1f865 | ||
|
|
ac0e63aa89 | ||
|
|
6da149adf9 | ||
|
|
3ebac1c886 | ||
|
|
42004f0831 | ||
|
|
47ddfaf44f | ||
|
|
44b52ca67b | ||
|
|
d25385b090 | ||
|
|
258ac42140 | ||
|
|
63a89d386b | ||
|
|
6e8ed7128e | ||
|
|
bf9a8cc23d | ||
|
|
5b1faac336 | ||
|
|
5bf51d3872 | ||
|
|
cbb0f8bde2 | ||
|
|
2c9752291d | ||
|
|
b5b89aeb93 | ||
|
|
022b96f941 | ||
|
|
442f2c5156 | ||
|
|
0468612b4d | ||
|
|
271e972ff0 | ||
|
|
a60e02c950 | ||
|
|
85b19e9110 | ||
|
|
24dd8d6532 | ||
|
|
24342437c7 | ||
|
|
e118acc068 | ||
|
|
7d97ce7baf | ||
|
|
b684805da7 | ||
|
|
7da4e9f28b | ||
|
|
7586495813 | ||
|
|
3b0d14444f | ||
|
|
ec58a99326 | ||
|
|
04d848e6d9 | ||
|
|
27eb13f0fa | ||
|
|
71844ba03a | ||
|
|
67574f483e | ||
|
|
0bd807782a | ||
|
|
1cc0b7fdca | ||
|
|
90594e268a | ||
|
|
0d1e8d66e4 | ||
|
|
92d2bab3ef | ||
|
|
f5deac3d0f | ||
|
|
31925e4517 | ||
|
|
e7a647c343 | ||
|
|
b46df990ad | ||
|
|
dd5328ccbb | ||
|
|
4d29be19c8 | ||
|
|
e364740aea | ||
|
|
86f8b3a163 | ||
|
|
105da33276 | ||
|
|
f754eaadd2 | ||
|
|
0ae0dcd580 | ||
|
|
9c371a24e3 | ||
|
|
462a1997e9 | ||
|
|
810632d666 | ||
|
|
69fbef6e76 | ||
|
|
bd9e7c3c36 | ||
|
|
a0e957bc0d | ||
|
|
f9b6c9b398 | ||
|
|
d7934d4c85 | ||
|
|
de8f833989 | ||
|
|
70e82f3084 | ||
|
|
35d90259ed | ||
|
|
07e97d61c0 | ||
|
|
71348eeb1f | ||
|
|
9e7efa3202 | ||
|
|
df3afdce0d | ||
|
|
66989d6ece | ||
|
|
7c44b68e05 | ||
|
|
ad1daccecc | ||
|
|
4aacee6627 | ||
|
|
629edad237 | ||
|
|
834a69d5a4 | ||
|
|
f45c18daa0 | ||
|
|
0b88ce08cb | ||
|
|
c9f147aba3 | ||
|
|
e7034c6087 | ||
|
|
90bd712c88 | ||
|
|
9c35eb0def | ||
|
|
92c9dd255c | ||
|
|
2a42af1d62 | ||
|
|
16e4168993 | ||
|
|
d0dbb40ef6 | ||
|
|
91d392cd2b | ||
|
|
b9bfc9bc4f | ||
|
|
2dc0f6b2bf | ||
|
|
44e73dfc96 | ||
|
|
9239d742d6 | ||
|
|
43932bd17b | ||
|
|
805c26d1a6 | ||
|
|
d746d90cc3 | ||
|
|
429a5518ea | ||
|
|
bf9da287a0 |
5
AUTHORS
5
AUTHORS
@@ -19,3 +19,8 @@ Robert Siemborski <rjs3@andrew.cmu.edu>
|
||||
* Miscellaneous cut, display, replace, and other bug fixes,
|
||||
original and new "magic line" code, read_line() function, new
|
||||
edit display routines.
|
||||
|
||||
Rocco Corsi <rocco.corsi@sympatico.ca>
|
||||
* Internal spelling code, many optimizations and bug fixes for
|
||||
findnextstr and search-related functions, various display and
|
||||
file handling fixes.
|
||||
|
||||
32
BUGS
32
BUGS
@@ -2,6 +2,9 @@
|
||||
certain col values. (9) [FIXED]
|
||||
- edit_refresh() and update_line() do not handle selecting text when the
|
||||
cursor is beyond COLS (10) [FIXED]
|
||||
- no way to do a replace with the empty string (11) [FIXED, yay!]
|
||||
- Spelling support is not elegant like pico's integration of the 'spell'
|
||||
program. Nano only uses ispell (for now) (12) [FIXED]
|
||||
- Moving to the end of a line when close to a multiple of COLS and at
|
||||
least COLS * 2 does not make the screen jump early like it would for
|
||||
if we were around COLS (bugs in edit_refresh, update_line) (13)
|
||||
@@ -11,6 +14,8 @@
|
||||
(14) [FIXED, mostly]
|
||||
- Doing a replacement of a substring of the replace string (e.g. replacing
|
||||
"ed" with "fred" causes an infinite loop. (15) [FIXED]
|
||||
- Cutting a file with marked text and both marker ends on the same line
|
||||
causes a random segfault (16) [FIXED]
|
||||
- Cutting more than one line resets the KEEP_CUTBUFFER flag in 0.9.3
|
||||
Error is in bitwise assignment (nano.h). (17) [FIXED]
|
||||
- The wrapping code does not work right for lines like the following:
|
||||
@@ -40,6 +45,8 @@
|
||||
until a pageup/down occurs (22)[FIXED]
|
||||
- In search/replace code there is too much refreshing in bottomwin (26)
|
||||
[FIXED]
|
||||
- In replace, there is no way to accept the default replace string. (27)
|
||||
[FIXED]
|
||||
- Using nano -t, user can not exit until a filename is given via ^O. (30)
|
||||
[FIXED]
|
||||
- Using -k cut text is not pasted properly. (34) [FIXED].
|
||||
@@ -55,19 +62,26 @@
|
||||
properly update the inverted text (39). [FIXED]
|
||||
- Searches for a string that only exist on one line multiple times will
|
||||
fail after finding the last occurance (discovered by Ken Tyler) (40). [FIXED]
|
||||
- Alt-Z is current broken to toggle suspend. I guess I still don't know
|
||||
signals very well =-) (41) [FIXED].
|
||||
- Unable to cut the entire file using the marker (discovered by Kev Tyler)
|
||||
(42). [FIXED]
|
||||
- The keypad does not work when nano runs in the Gnome terminal (43). [FIXED]
|
||||
- When reading in a file, if the file is a directory the contents of the
|
||||
file being edited are blown away (discovered by Chris Pimlot) (44). [FIXED]
|
||||
- in certain terms, nano will leave a "ghost" of screen upon exit
|
||||
when called from inside mutt (among other settings) (45). [FIXED]
|
||||
- In replace, hitting the Goto line shortcut key does nothing after a
|
||||
search string is entered (discovered by Rocco Corsi) (46) [FIXED].
|
||||
- When typing in a string in serahc or replace and hitting CASE_SENSITVE
|
||||
or the other search string, the current string edit is blown away in
|
||||
favor of the last stored search (47) [FIXED]
|
||||
|
||||
** Open BUGS **
|
||||
|
||||
- Marked cutting sometimes leaves a newline in the file unintelligently,
|
||||
such as when all of a line is selected but the mark doesn't proceed to
|
||||
the new line. (8) { Is this an issue? compare to pico 3.5 }
|
||||
- no way to do a replace with the empty string. (11)
|
||||
- Spelling support is not elegant like pico's integration of the 'spell'
|
||||
program. Nano only uses ispell (for now) (12)
|
||||
- Cutting a file with marked text and both marker ends on the same line
|
||||
causes a random segfault (16) [FIXED?]
|
||||
- In replace, there is no way to accept the default replace string. (27)
|
||||
- totsize problems still abound in do_justify (33)
|
||||
- Alt-Z is current broken to toggle suspend. I guess I still don't know
|
||||
signals very well =-) (41).
|
||||
- totsize problems still abound in do_justify (33).
|
||||
|
||||
$Id$
|
||||
|
||||
173
ChangeLog
173
ChangeLog
@@ -1,3 +1,175 @@
|
||||
nano 0.9.21 - 11/23/2000
|
||||
- AUTHORS
|
||||
- Added Rocco Corsi.
|
||||
- nano.c:
|
||||
main()
|
||||
- Changed check for argc == 1 to argv[optind] == NULL to decide
|
||||
whether or not to display "New File" in the statusbar.
|
||||
- search.c:
|
||||
findnextstr()
|
||||
- Fix curent_x increment bug by using another variable (Rocco Corsi).
|
||||
search_init()
|
||||
- Silly typo in our "one simple call" of statusq. Stopped
|
||||
previous search string from being displayed.
|
||||
do_replace()
|
||||
- Copy back the previous value of last_replace into answer if
|
||||
using PICO_MODE and answer == ""
|
||||
- winio.c:
|
||||
do_up()
|
||||
- Deleted first update_line() call, screws up display when marker is set.
|
||||
- nano.1, nano.1.html
|
||||
- Updated man page for new -p definition.
|
||||
|
||||
nano 0.9.20 - 11/18/2000
|
||||
- General
|
||||
- Ran source through indent -kr again. Make everything pretty.
|
||||
- Changed behavior of "search" and "replace" prompts to make all
|
||||
previous values editable. This change was made so that you can
|
||||
replace with the null string without needing a special key for it.
|
||||
changed code in search_init(), do_replace(), nanogetstr (see
|
||||
below).
|
||||
- Added some missing gettext calls here and there (Jordi).
|
||||
- Revamped nanogetsr() and calls to it to use variable length strings.
|
||||
MANY changes in nanogetstr(), many chances in search.c, new
|
||||
function mallocstrcpy which is sure to be a programmatic
|
||||
nightmare, changed last_search, last_replace, answer to
|
||||
pointers. New function not_found_msg in search.c for displaying
|
||||
truncated strings in satusbar when the string is not found
|
||||
(-pedantic fixes by Rocco Corsi). We disable this feature when
|
||||
using PICO_MODE (-p).
|
||||
- New spelling code by Rocco Corsi. New functions
|
||||
do_int_speller, do_alt_speller, changes to do_spell in nano.c,
|
||||
New functions search_init_globals and do_replace_loop, changes
|
||||
to search_init(), do_replace, findnextstr, moved last_search and
|
||||
last_replace back to nano.c (*shrug*).
|
||||
- New tab completion code. Used check_wildcard_match, input_tab,
|
||||
cwd_tab_completion, username_tab_completion from busybox,
|
||||
hacked them a lot, changes to nanogetstr(). nanogetstr() and
|
||||
statusq() now take an arg for whether or not to allow tab
|
||||
completion.
|
||||
- Fixed value being input in statusbar during a search or replace
|
||||
and CASE_SENSITIVE or the other search is called and the
|
||||
string being typed in is blown away. Reported by Ken Tyler.
|
||||
- Changed PICO_MSGS flag to PICO_MODE, changed help strings
|
||||
accordingly.
|
||||
- files.c:
|
||||
do_writeout()
|
||||
- Change strcpy to answer to mallocstrcpy.
|
||||
- global.c
|
||||
- New global replace_list_2, for 2nd half of the replace dialog
|
||||
("Replace with:"), has fewer options than first half because
|
||||
they were inapropriate.
|
||||
toggle_init()
|
||||
- Added #ifdef around toggle_regex_msg to get rid of compiler
|
||||
warning.
|
||||
|
||||
- nano.c:
|
||||
keypad_on()
|
||||
- New function, toggles turning the keypad on and off in edit and
|
||||
bottomwin(). Added call to this in finish(), fixes bug #45.
|
||||
- search.c
|
||||
findnexstr()
|
||||
- New arg for begin_x variable, basically a rewrite that
|
||||
makes a little more sense and isn't quite as messy (Rocco Corsi).
|
||||
- Update the line we're checking if not the whole screen, because
|
||||
it's quite possible the search team could exist somewhere way
|
||||
to the right on the same line, for example.
|
||||
replace_abort()
|
||||
- Add reset of placewewant, stops cursor from jumping when moving
|
||||
cursor after a replace.
|
||||
do_replace()
|
||||
- Added code for Gotoline key after entering the search term.
|
||||
Fixes bug #46.
|
||||
- Removed redundant code involving processing replacemenet string.
|
||||
Converted if statements to switch statements.
|
||||
- Optimizations by Rocco Corsi.
|
||||
- Removed code for deleted shortcuts from in replace_list_2.
|
||||
do_search()
|
||||
- Converted if statements to one switch statement.
|
||||
- winio.c
|
||||
nanogetstr()
|
||||
- Added check for 343 in while loop to get rid of getting "locked"
|
||||
into statusbar" bug in odd $TERMs like iris-ansi.
|
||||
- Changed check to return -2 on "enter" from answer == ""
|
||||
to answer == def.
|
||||
- Fixed fallthrough code because there was no break. Make much
|
||||
more sense now.
|
||||
- Added check for ASCII 54[124] when using PDCURSES, ignore them
|
||||
if noticed.
|
||||
nanoget_repaint()
|
||||
- New function, removes about 30 lines of duplicate code in
|
||||
nanogetstr().
|
||||
- Black magic code to make $ appear in prompt if we're past
|
||||
COLS.
|
||||
blank_edit()
|
||||
- Removed wrefresh() call, much less choppy now. If there's a need
|
||||
for a wrefresh after a specific call, let me know.
|
||||
- es.po:
|
||||
- Updated translation for 0.9.20 (Jordi).
|
||||
|
||||
nano 0.9.19 - 10/02/2000
|
||||
- General
|
||||
- Added PDCurses support under cygwin, which allows building
|
||||
a nice stand-alone nano.exe for those poor Windows users.
|
||||
Extra check in configure.in for initscr() in -lcurses (as
|
||||
PDcurses has no tgetent), some #ifdef PDCURSES statements
|
||||
in main().
|
||||
- Changed web site and email to new nano-editor.org domain.
|
||||
- nano.c
|
||||
- Added (int) casts to remove compile warnings with -Wall.
|
||||
main()
|
||||
- Added check for _POSIX_VDISABLE around term variable definition.
|
||||
- search.c
|
||||
- Added initializations for last_search and last_replace (Rocco Corsi)
|
||||
|
||||
nano 0.9.18 - 09/18/2000
|
||||
- General
|
||||
- Changed _POSIX_VERSION checks in regex code to HAVE_REGEX_H,
|
||||
added check for regex.h in configure.in.
|
||||
- configure.in:
|
||||
- Added default case for cross-compiling to get rid of annoying
|
||||
AC_TRY_RUN warning.
|
||||
- cut.c:
|
||||
do_cut_text()
|
||||
- Don't immediately abort if we're on filebot and the marker is
|
||||
set (fixes bug #42).
|
||||
- files.c:
|
||||
open_file()
|
||||
- Fix for bug #44 (Rocco Corsi).
|
||||
- global.c:
|
||||
shortcut_init()
|
||||
- Added in FKEYs that for some reason were left out. *boggle*
|
||||
- nano.c:
|
||||
main()
|
||||
- Added check for _POSIX_VDISABLE and use raw mode if not
|
||||
available, allows nano to work with cygwin.
|
||||
- Added gettext calls to enable/disable strings (Jordi).
|
||||
- Revamped a great deal of the F-key and keypad key handling,
|
||||
because we not longer use keypad() (see below).
|
||||
- Removed keypad() call because nano was not working with the
|
||||
keypad in many terms, which is very bad.
|
||||
- Made insert key call do_insertfile().
|
||||
do_toggle()
|
||||
- Rewrote function to allow NOHELP toggle to wotk on systems
|
||||
without a working resizewin(). New function window_init().
|
||||
mouse_init()
|
||||
- Add keypad only if mouse support is on, otherwise mouse doesn't
|
||||
work. I guess you have to choose between having the mouse and
|
||||
having a working keypad for the time being (thank god for Meta-m).
|
||||
- winio.c:
|
||||
total_refresh()
|
||||
- Added titlebar() call.
|
||||
onekey()
|
||||
- Off by one error fix fix ;-) (Rocco Corsi).
|
||||
|
||||
- search.c:
|
||||
findnextstr()
|
||||
- Reset starting at current for search instead of begin.
|
||||
- es.po:
|
||||
- Translated new strings and minor updates (Jordi).
|
||||
- de.po
|
||||
- Revised translations by floki@bigfoot.com
|
||||
|
||||
nano-0.9.17 - 09/04/2000
|
||||
- General
|
||||
- New shortcuts to toggle certain options that are normally only
|
||||
@@ -38,6 +210,7 @@ nano-0.9.17 - 09/04/2000
|
||||
lack of reversed text on searching with MARK_ISSET.
|
||||
onekey()
|
||||
- Off by one error fix (Rocco Corsi).
|
||||
|
||||
update_line()
|
||||
- Added check for binary data >= 1 and <= 26, and use ^+letter
|
||||
to display it. Should fix editing text files with binary
|
||||
|
||||
40
NEWS
40
NEWS
@@ -1,3 +1,43 @@
|
||||
11/23/2000 - Happy Thanksgiving! Nano 0.9.21 is our "last version was
|
||||
a big turkey" release. It fixes several bugs introduced
|
||||
by the previous version, as well as a few long-
|
||||
standing display bugs. All 0.9.20 users are strongly
|
||||
encouraged to upgrade to this release.
|
||||
|
||||
11/18/2000 - Nano 0.9.20 is finally out the door. Probably the biggest
|
||||
change is the brand new way nano displays previous search
|
||||
and replace strings (they are now editable!) This is a
|
||||
break from Pico's (inconsistent) interface, so if you
|
||||
don't like the new way, "Pico" mode (-p on the command
|
||||
line or Meta-P within nano) still works the "old"
|
||||
way.
|
||||
Other new features include being able to deal with
|
||||
search strings of any length, a new internal spell feature
|
||||
(courtesy of Mr. Rocco Corsi) and tab completion when
|
||||
reading in or writing out files! There's also the usual
|
||||
billion or so bug fixes. Feedback on this release is
|
||||
welcome because so much much has changed, especially with
|
||||
the previous string display in search and replace. Email
|
||||
-> nano@nano-editor.org <-. If you like something, don't
|
||||
like something, or just want to order a pizza, let us know!
|
||||
|
||||
10/02/2000 - Nano 0.9.19 is the "Chris is getting married in less than
|
||||
a week and needs a distraction" release. There are only
|
||||
a few actual code changes, mainly portability and compiler
|
||||
warning fixes. Nano now also supports PDCurses, which
|
||||
enables easily-built nano executables for Windows NT
|
||||
and 95/98 for the brave. The official nano site has
|
||||
changed (again) as well, check out www.nano-editor.org for
|
||||
all the latest nano schtuff.
|
||||
|
||||
09/18/2000 - Nano 0.9.18 is unleashed. It has some new keyboard
|
||||
handling code, cygwin support out of the box, and
|
||||
a more portable handler for the NOHELP toggle. There
|
||||
is also a fix for a somewhat serious bug whereby trying
|
||||
to insert a directory instead of a normal file would
|
||||
destroy the contents of the editor. A must-see. Four
|
||||
stars.
|
||||
|
||||
09/04/2000 - Nano 0.9.17, the Labor Day release, is released after a
|
||||
quiet spell (almost an entire month since last release!)
|
||||
New features include better (not yet perfect) binary
|
||||
|
||||
4
README
4
README
@@ -39,7 +39,7 @@ How to compile and install nano
|
||||
|
||||
Web Page
|
||||
|
||||
http://www.asty.org/nano
|
||||
http://www.nano-editor.org
|
||||
|
||||
Mailing List and Bug Reports
|
||||
|
||||
@@ -54,7 +54,7 @@ Mailing List and Bug Reports
|
||||
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@asty.org or directly to the development list.
|
||||
nano@nano-editor.org or directly to the development list.
|
||||
|
||||
Current Status
|
||||
|
||||
|
||||
9
TODO
9
TODO
@@ -2,7 +2,7 @@ TODO file (? means the feature may be implemented, but not definitely)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Current Version:
|
||||
- Implement Spelling [DONE, mostly...]
|
||||
- Implement Spelling [DONE]
|
||||
- Implement Help [DONE]
|
||||
- Internationalization [In progress, translators welcome!]
|
||||
- Allow nano to be resized in X. [DONE]
|
||||
@@ -11,7 +11,14 @@ Current Version:
|
||||
- Rewrite edit_refresh, if at all possible [DONE]
|
||||
- Implement justify function [DONE]
|
||||
- Cut to end of line [DONE]
|
||||
- Built-in speller command [needed for version 1.0] [DONE]
|
||||
- Better statusbar interaction (scrolling, tab completion for filename)
|
||||
[needed for version 1.0] [DONE]
|
||||
- Now do username completion [DONE].
|
||||
|
||||
Needed for version 1.0:
|
||||
- Unjustify command (^U after ^J)
|
||||
- Username completion (~user).
|
||||
|
||||
For Next Version:
|
||||
- Undo/Redo key?
|
||||
|
||||
@@ -154,6 +154,9 @@
|
||||
/* Define if you have the <nl_types.h> header file. */
|
||||
#undef HAVE_NL_TYPES_H
|
||||
|
||||
/* Define if you have the <regex.h> header file. */
|
||||
#undef HAVE_REGEX_H
|
||||
|
||||
/* Define if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
|
||||
241
configure
vendored
241
configure
vendored
@@ -710,7 +710,7 @@ fi
|
||||
|
||||
PACKAGE=nano
|
||||
|
||||
VERSION=0.9.16-cvs
|
||||
VERSION=0.9.21
|
||||
|
||||
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
|
||||
{ echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
|
||||
@@ -1225,7 +1225,7 @@ EOF
|
||||
|
||||
fi
|
||||
|
||||
for ac_hdr in fcntl.h unistd.h malloc.h termios.h termio.h limits.h getopt.h
|
||||
for ac_hdr in fcntl.h unistd.h malloc.h termios.h termio.h limits.h getopt.h regex.h
|
||||
do
|
||||
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
|
||||
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
|
||||
@@ -1330,7 +1330,7 @@ echo "configure:1330: checking for SLtt_initialize in -lslang" >&5
|
||||
_libs=$LIBS
|
||||
LIBS="$LIBS -lslang"
|
||||
if test "$cross_compiling" = yes; then
|
||||
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
|
||||
echo "configure: warning: *** Can not use slang when cross-compiling" 1>&2
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1337 "configure"
|
||||
@@ -1409,7 +1409,7 @@ fi
|
||||
echo "configure:1410: checking for SLtt_initialize in -lslang $tcap" >&5
|
||||
LIBS="$LIBS $tcap"
|
||||
if test "$cross_compiling" = yes; then
|
||||
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
|
||||
echo "configure: warning: *** Can not use slang when cross-compiling" 1>&2
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1416 "configure"
|
||||
@@ -1444,7 +1444,7 @@ else
|
||||
echo "configure:1445: checking for SLtt_initialize in -lslang $tcap -lm" >&5
|
||||
LIBS="$LIBS -lm"
|
||||
if test "$cross_compiling" = yes; then
|
||||
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
|
||||
echo "configure: warning: *** Can not use slang when cross-compiling" 1>&2
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1451 "configure"
|
||||
@@ -2174,10 +2174,55 @@ fi
|
||||
|
||||
fi
|
||||
|
||||
# Fallback for PDCurses and less useful curses libs...
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
echo $ac_n "checking for initscr in -lcurses""... $ac_c" 1>&6
|
||||
echo "configure:2182: checking for initscr in -lcurses" >&5
|
||||
ac_lib_var=`echo curses'_'initscr | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-lcurses $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2190 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
builtin and then its argument prototype would still apply. */
|
||||
char initscr();
|
||||
|
||||
int main() {
|
||||
initscr()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:2201: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||
else
|
||||
echo "configure: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=no"
|
||||
fi
|
||||
rm -f conftest*
|
||||
LIBS="$ac_save_LIBS"
|
||||
|
||||
fi
|
||||
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
|
||||
echo "$ac_t""yes" 1>&6
|
||||
CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses
|
||||
else
|
||||
echo "$ac_t""no" 1>&6
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6
|
||||
echo "configure:2181: checking for tgetent in -ltermcap" >&5
|
||||
echo "configure:2226: checking for tgetent in -ltermcap" >&5
|
||||
ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
@@ -2185,7 +2230,7 @@ else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-ltermcap $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2189 "configure"
|
||||
#line 2234 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
@@ -2196,7 +2241,7 @@ int main() {
|
||||
tgetent()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:2200: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:2245: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||
else
|
||||
@@ -2230,7 +2275,7 @@ fi
|
||||
|
||||
|
||||
echo $ac_n "checking for wresize in -l$CURSES_LIB_NAME""... $ac_c" 1>&6
|
||||
echo "configure:2234: checking for wresize in -l$CURSES_LIB_NAME" >&5
|
||||
echo "configure:2279: checking for wresize in -l$CURSES_LIB_NAME" >&5
|
||||
ac_lib_var=`echo $CURSES_LIB_NAME'_'wresize | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
@@ -2238,7 +2283,7 @@ else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-l$CURSES_LIB_NAME $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2242 "configure"
|
||||
#line 2287 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
@@ -2249,7 +2294,7 @@ int main() {
|
||||
wresize()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:2253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:2298: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||
else
|
||||
@@ -2297,7 +2342,7 @@ fi
|
||||
# Extract the first word of "ranlib", so it can be a program name with args.
|
||||
set dummy ranlib; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:2301: checking for $ac_word" >&5
|
||||
echo "configure:2346: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -2325,12 +2370,12 @@ else
|
||||
fi
|
||||
|
||||
echo $ac_n "checking for working const""... $ac_c" 1>&6
|
||||
echo "configure:2329: checking for working const" >&5
|
||||
echo "configure:2374: checking for working const" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2334 "configure"
|
||||
#line 2379 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
int main() {
|
||||
@@ -2379,7 +2424,7 @@ ccp = (char const *const *) p;
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:2383: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
if { (eval echo configure:2428: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
rm -rf conftest*
|
||||
ac_cv_c_const=yes
|
||||
else
|
||||
@@ -2400,21 +2445,21 @@ EOF
|
||||
fi
|
||||
|
||||
echo $ac_n "checking for inline""... $ac_c" 1>&6
|
||||
echo "configure:2404: checking for inline" >&5
|
||||
echo "configure:2449: checking for inline" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
ac_cv_c_inline=no
|
||||
for ac_kw in inline __inline__ __inline; do
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2411 "configure"
|
||||
#line 2456 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
int main() {
|
||||
} int $ac_kw foo() {
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:2418: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
if { (eval echo configure:2463: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
rm -rf conftest*
|
||||
ac_cv_c_inline=$ac_kw; break
|
||||
else
|
||||
@@ -2440,12 +2485,12 @@ EOF
|
||||
esac
|
||||
|
||||
echo $ac_n "checking for off_t""... $ac_c" 1>&6
|
||||
echo "configure:2444: checking for off_t" >&5
|
||||
echo "configure:2489: checking for off_t" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2449 "configure"
|
||||
#line 2494 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sys/types.h>
|
||||
#if STDC_HEADERS
|
||||
@@ -2473,12 +2518,12 @@ EOF
|
||||
fi
|
||||
|
||||
echo $ac_n "checking for size_t""... $ac_c" 1>&6
|
||||
echo "configure:2477: checking for size_t" >&5
|
||||
echo "configure:2522: checking for size_t" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2482 "configure"
|
||||
#line 2527 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sys/types.h>
|
||||
#if STDC_HEADERS
|
||||
@@ -2508,19 +2553,19 @@ fi
|
||||
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
|
||||
# for constant arguments. Useless!
|
||||
echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
|
||||
echo "configure:2512: checking for working alloca.h" >&5
|
||||
echo "configure:2557: checking for working alloca.h" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2517 "configure"
|
||||
#line 2562 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <alloca.h>
|
||||
int main() {
|
||||
void *p = alloca(2 * sizeof(int));
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:2524: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:2569: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
ac_cv_header_alloca_h=yes
|
||||
else
|
||||
@@ -2541,12 +2586,12 @@ EOF
|
||||
fi
|
||||
|
||||
echo $ac_n "checking for alloca""... $ac_c" 1>&6
|
||||
echo "configure:2545: checking for alloca" >&5
|
||||
echo "configure:2590: checking for alloca" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2550 "configure"
|
||||
#line 2595 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
@@ -2574,7 +2619,7 @@ int main() {
|
||||
char *p = (char *) alloca(1);
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:2578: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:2623: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
ac_cv_func_alloca_works=yes
|
||||
else
|
||||
@@ -2606,12 +2651,12 @@ EOF
|
||||
|
||||
|
||||
echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
|
||||
echo "configure:2610: checking whether alloca needs Cray hooks" >&5
|
||||
echo "configure:2655: checking whether alloca needs Cray hooks" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2615 "configure"
|
||||
#line 2660 "configure"
|
||||
#include "confdefs.h"
|
||||
#if defined(CRAY) && ! defined(CRAY2)
|
||||
webecray
|
||||
@@ -2636,12 +2681,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6
|
||||
if test $ac_cv_os_cray = yes; then
|
||||
for ac_func in _getb67 GETB67 getb67; do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
echo "configure:2640: checking for $ac_func" >&5
|
||||
echo "configure:2685: checking for $ac_func" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2645 "configure"
|
||||
#line 2690 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
@@ -2664,7 +2709,7 @@ $ac_func();
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:2668: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:2713: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_func_$ac_func=yes"
|
||||
else
|
||||
@@ -2691,7 +2736,7 @@ done
|
||||
fi
|
||||
|
||||
echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
|
||||
echo "configure:2695: checking stack direction for C alloca" >&5
|
||||
echo "configure:2740: checking stack direction for C alloca" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -2699,7 +2744,7 @@ else
|
||||
ac_cv_c_stack_direction=0
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2703 "configure"
|
||||
#line 2748 "configure"
|
||||
#include "confdefs.h"
|
||||
find_stack_direction ()
|
||||
{
|
||||
@@ -2718,7 +2763,7 @@ main ()
|
||||
exit (find_stack_direction() < 0);
|
||||
}
|
||||
EOF
|
||||
if { (eval echo configure:2722: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
|
||||
if { (eval echo configure:2767: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
|
||||
then
|
||||
ac_cv_c_stack_direction=1
|
||||
else
|
||||
@@ -2743,17 +2788,17 @@ for ac_hdr in unistd.h
|
||||
do
|
||||
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
|
||||
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
|
||||
echo "configure:2747: checking for $ac_hdr" >&5
|
||||
echo "configure:2792: checking for $ac_hdr" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2752 "configure"
|
||||
#line 2797 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <$ac_hdr>
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:2757: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
{ (eval echo configure:2802: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
||||
if test -z "$ac_err"; then
|
||||
rm -rf conftest*
|
||||
@@ -2782,12 +2827,12 @@ done
|
||||
for ac_func in getpagesize
|
||||
do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
echo "configure:2786: checking for $ac_func" >&5
|
||||
echo "configure:2831: checking for $ac_func" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2791 "configure"
|
||||
#line 2836 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
@@ -2810,7 +2855,7 @@ $ac_func();
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:2814: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:2859: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_func_$ac_func=yes"
|
||||
else
|
||||
@@ -2835,7 +2880,7 @@ fi
|
||||
done
|
||||
|
||||
echo $ac_n "checking for working mmap""... $ac_c" 1>&6
|
||||
echo "configure:2839: checking for working mmap" >&5
|
||||
echo "configure:2884: checking for working mmap" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -2843,7 +2888,7 @@ else
|
||||
ac_cv_func_mmap_fixed_mapped=no
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2847 "configure"
|
||||
#line 2892 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
/* Thanks to Mike Haertel and Jim Avera for this test.
|
||||
@@ -2986,7 +3031,7 @@ main()
|
||||
}
|
||||
|
||||
EOF
|
||||
if { (eval echo configure:2990: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
|
||||
if { (eval echo configure:3035: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
|
||||
then
|
||||
ac_cv_func_mmap_fixed_mapped=yes
|
||||
else
|
||||
@@ -3014,17 +3059,17 @@ unistd.h sys/param.h
|
||||
do
|
||||
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
|
||||
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
|
||||
echo "configure:3018: checking for $ac_hdr" >&5
|
||||
echo "configure:3063: checking for $ac_hdr" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 3023 "configure"
|
||||
#line 3068 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <$ac_hdr>
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:3028: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
{ (eval echo configure:3073: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
||||
if test -z "$ac_err"; then
|
||||
rm -rf conftest*
|
||||
@@ -3054,12 +3099,12 @@ done
|
||||
strdup __argz_count __argz_stringify __argz_next
|
||||
do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
echo "configure:3058: checking for $ac_func" >&5
|
||||
echo "configure:3103: checking for $ac_func" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 3063 "configure"
|
||||
#line 3108 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
@@ -3082,7 +3127,7 @@ $ac_func();
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:3086: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:3131: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_func_$ac_func=yes"
|
||||
else
|
||||
@@ -3111,12 +3156,12 @@ done
|
||||
for ac_func in stpcpy
|
||||
do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
echo "configure:3115: checking for $ac_func" >&5
|
||||
echo "configure:3160: checking for $ac_func" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 3120 "configure"
|
||||
#line 3165 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
@@ -3139,7 +3184,7 @@ $ac_func();
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:3143: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:3188: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_func_$ac_func=yes"
|
||||
else
|
||||
@@ -3173,19 +3218,19 @@ EOF
|
||||
|
||||
if test $ac_cv_header_locale_h = yes; then
|
||||
echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
|
||||
echo "configure:3177: checking for LC_MESSAGES" >&5
|
||||
echo "configure:3222: checking for LC_MESSAGES" >&5
|
||||
if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 3182 "configure"
|
||||
#line 3227 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <locale.h>
|
||||
int main() {
|
||||
return LC_MESSAGES
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:3189: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:3234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
am_cv_val_LC_MESSAGES=yes
|
||||
else
|
||||
@@ -3206,7 +3251,7 @@ EOF
|
||||
fi
|
||||
fi
|
||||
echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
|
||||
echo "configure:3210: checking whether NLS is requested" >&5
|
||||
echo "configure:3255: checking whether NLS is requested" >&5
|
||||
# Check whether --enable-nls or --disable-nls was given.
|
||||
if test "${enable_nls+set}" = set; then
|
||||
enableval="$enable_nls"
|
||||
@@ -3226,7 +3271,7 @@ fi
|
||||
EOF
|
||||
|
||||
echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6
|
||||
echo "configure:3230: checking whether included gettext is requested" >&5
|
||||
echo "configure:3275: checking whether included gettext is requested" >&5
|
||||
# Check whether --with-included-gettext or --without-included-gettext was given.
|
||||
if test "${with_included_gettext+set}" = set; then
|
||||
withval="$with_included_gettext"
|
||||
@@ -3245,17 +3290,17 @@ fi
|
||||
|
||||
ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'`
|
||||
echo $ac_n "checking for libintl.h""... $ac_c" 1>&6
|
||||
echo "configure:3249: checking for libintl.h" >&5
|
||||
echo "configure:3294: checking for libintl.h" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 3254 "configure"
|
||||
#line 3299 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <libintl.h>
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:3259: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
{ (eval echo configure:3304: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
||||
if test -z "$ac_err"; then
|
||||
rm -rf conftest*
|
||||
@@ -3272,19 +3317,19 @@ fi
|
||||
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
|
||||
echo "$ac_t""yes" 1>&6
|
||||
echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6
|
||||
echo "configure:3276: checking for gettext in libc" >&5
|
||||
echo "configure:3321: checking for gettext in libc" >&5
|
||||
if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 3281 "configure"
|
||||
#line 3326 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <libintl.h>
|
||||
int main() {
|
||||
return (int) gettext ("")
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:3288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:3333: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
gt_cv_func_gettext_libc=yes
|
||||
else
|
||||
@@ -3300,7 +3345,7 @@ echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6
|
||||
|
||||
if test "$gt_cv_func_gettext_libc" != "yes"; then
|
||||
echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6
|
||||
echo "configure:3304: checking for bindtextdomain in -lintl" >&5
|
||||
echo "configure:3349: checking for bindtextdomain in -lintl" >&5
|
||||
ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
@@ -3308,7 +3353,7 @@ else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-lintl $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 3312 "configure"
|
||||
#line 3357 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
@@ -3319,7 +3364,7 @@ int main() {
|
||||
bindtextdomain()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:3323: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:3368: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||
else
|
||||
@@ -3335,12 +3380,12 @@ fi
|
||||
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
|
||||
echo "$ac_t""yes" 1>&6
|
||||
echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6
|
||||
echo "configure:3339: checking for gettext in libintl" >&5
|
||||
echo "configure:3384: checking for gettext in libintl" >&5
|
||||
if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
echo $ac_n "checking for gettext in -lintl""... $ac_c" 1>&6
|
||||
echo "configure:3344: checking for gettext in -lintl" >&5
|
||||
echo "configure:3389: checking for gettext in -lintl" >&5
|
||||
ac_lib_var=`echo intl'_'gettext | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
@@ -3348,7 +3393,7 @@ else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-lintl $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 3352 "configure"
|
||||
#line 3397 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
@@ -3359,7 +3404,7 @@ int main() {
|
||||
gettext()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:3363: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:3408: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||
else
|
||||
@@ -3398,7 +3443,7 @@ EOF
|
||||
# Extract the first word of "msgfmt", so it can be a program name with args.
|
||||
set dummy msgfmt; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:3402: checking for $ac_word" >&5
|
||||
echo "configure:3447: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -3432,12 +3477,12 @@ fi
|
||||
for ac_func in dcgettext
|
||||
do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
echo "configure:3436: checking for $ac_func" >&5
|
||||
echo "configure:3481: checking for $ac_func" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 3441 "configure"
|
||||
#line 3486 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
@@ -3460,7 +3505,7 @@ $ac_func();
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:3464: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:3509: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_func_$ac_func=yes"
|
||||
else
|
||||
@@ -3487,7 +3532,7 @@ done
|
||||
# Extract the first word of "gmsgfmt", so it can be a program name with args.
|
||||
set dummy gmsgfmt; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:3491: checking for $ac_word" >&5
|
||||
echo "configure:3536: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -3523,7 +3568,7 @@ fi
|
||||
# Extract the first word of "xgettext", so it can be a program name with args.
|
||||
set dummy xgettext; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:3527: checking for $ac_word" >&5
|
||||
echo "configure:3572: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -3555,7 +3600,7 @@ else
|
||||
fi
|
||||
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 3559 "configure"
|
||||
#line 3604 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
int main() {
|
||||
@@ -3563,7 +3608,7 @@ extern int _nl_msg_cat_cntr;
|
||||
return _nl_msg_cat_cntr
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:3567: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:3612: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
CATOBJEXT=.gmo
|
||||
DATADIRNAME=share
|
||||
@@ -3586,7 +3631,7 @@ fi
|
||||
|
||||
if test "$CATOBJEXT" = "NONE"; then
|
||||
echo $ac_n "checking whether catgets can be used""... $ac_c" 1>&6
|
||||
echo "configure:3590: checking whether catgets can be used" >&5
|
||||
echo "configure:3635: checking whether catgets can be used" >&5
|
||||
# Check whether --with-catgets or --without-catgets was given.
|
||||
if test "${with_catgets+set}" = set; then
|
||||
withval="$with_catgets"
|
||||
@@ -3599,7 +3644,7 @@ fi
|
||||
|
||||
if test "$nls_cv_use_catgets" = "yes"; then
|
||||
echo $ac_n "checking for main in -li""... $ac_c" 1>&6
|
||||
echo "configure:3603: checking for main in -li" >&5
|
||||
echo "configure:3648: checking for main in -li" >&5
|
||||
ac_lib_var=`echo i'_'main | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
@@ -3607,14 +3652,14 @@ else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-li $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 3611 "configure"
|
||||
#line 3656 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
int main() {
|
||||
main()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:3618: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:3663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||
else
|
||||
@@ -3642,12 +3687,12 @@ else
|
||||
fi
|
||||
|
||||
echo $ac_n "checking for catgets""... $ac_c" 1>&6
|
||||
echo "configure:3646: checking for catgets" >&5
|
||||
echo "configure:3691: checking for catgets" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_func_catgets'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 3651 "configure"
|
||||
#line 3696 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char catgets(); below. */
|
||||
@@ -3670,7 +3715,7 @@ catgets();
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:3674: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:3719: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_func_catgets=yes"
|
||||
else
|
||||
@@ -3692,7 +3737,7 @@ EOF
|
||||
# Extract the first word of "gencat", so it can be a program name with args.
|
||||
set dummy gencat; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:3696: checking for $ac_word" >&5
|
||||
echo "configure:3741: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_path_GENCAT'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -3728,7 +3773,7 @@ fi
|
||||
# Extract the first word of "gmsgfmt", so it can be a program name with args.
|
||||
set dummy gmsgfmt; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:3732: checking for $ac_word" >&5
|
||||
echo "configure:3777: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -3765,7 +3810,7 @@ fi
|
||||
# Extract the first word of "msgfmt", so it can be a program name with args.
|
||||
set dummy msgfmt; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:3769: checking for $ac_word" >&5
|
||||
echo "configure:3814: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -3800,7 +3845,7 @@ fi
|
||||
# Extract the first word of "xgettext", so it can be a program name with args.
|
||||
set dummy xgettext; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:3804: checking for $ac_word" >&5
|
||||
echo "configure:3849: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -3858,7 +3903,7 @@ fi
|
||||
# Extract the first word of "msgfmt", so it can be a program name with args.
|
||||
set dummy msgfmt; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:3862: checking for $ac_word" >&5
|
||||
echo "configure:3907: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -3892,7 +3937,7 @@ fi
|
||||
# Extract the first word of "gmsgfmt", so it can be a program name with args.
|
||||
set dummy gmsgfmt; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:3896: checking for $ac_word" >&5
|
||||
echo "configure:3941: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -3928,7 +3973,7 @@ fi
|
||||
# Extract the first word of "xgettext", so it can be a program name with args.
|
||||
set dummy xgettext; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:3932: checking for $ac_word" >&5
|
||||
echo "configure:3977: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -4021,7 +4066,7 @@ fi
|
||||
LINGUAS=
|
||||
else
|
||||
echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6
|
||||
echo "configure:4025: checking for catalogs to be installed" >&5
|
||||
echo "configure:4070: checking for catalogs to be installed" >&5
|
||||
NEW_LINGUAS=
|
||||
for lang in ${LINGUAS=$ALL_LINGUAS}; do
|
||||
case "$ALL_LINGUAS" in
|
||||
@@ -4049,17 +4094,17 @@ echo "configure:4025: checking for catalogs to be installed" >&5
|
||||
if test "$CATOBJEXT" = ".cat"; then
|
||||
ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'`
|
||||
echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6
|
||||
echo "configure:4053: checking for linux/version.h" >&5
|
||||
echo "configure:4098: checking for linux/version.h" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 4058 "configure"
|
||||
#line 4103 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <linux/version.h>
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:4063: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
{ (eval echo configure:4108: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
||||
if test -z "$ac_err"; then
|
||||
rm -rf conftest*
|
||||
|
||||
15
configure.in
15
configure.in
@@ -1,7 +1,7 @@
|
||||
# $Id$
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(nano.c)
|
||||
AM_INIT_AUTOMAKE(nano, 0.9.16-cvs)
|
||||
AM_INIT_AUTOMAKE(nano, 0.9.21)
|
||||
AM_CONFIG_HEADER(config.h:config.h.in)
|
||||
ALL_LINGUAS="es de fr it id fi"
|
||||
|
||||
@@ -11,7 +11,7 @@ AC_ISC_POSIX
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(fcntl.h unistd.h malloc.h termios.h termio.h limits.h getopt.h)
|
||||
AC_CHECK_HEADERS(fcntl.h unistd.h malloc.h termios.h termio.h limits.h getopt.h regex.h)
|
||||
|
||||
dnl options
|
||||
AC_ARG_ENABLE(tiny,
|
||||
@@ -94,7 +94,10 @@ int main () { SLtt_initialize (NULL); return 0; }],
|
||||
CURSES_LIB="-lslang $tcap -lm"
|
||||
fi
|
||||
CURSES_LIB_NAME=slang],
|
||||
[AC_MSG_RESULT(no)])])]),
|
||||
[AC_MSG_RESULT(no)],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling])),
|
||||
AC_MSG_ERROR([
|
||||
*** The header file slcurses.h was not found. If you wish to use
|
||||
*** slang support this header file is required. Please either
|
||||
@@ -145,6 +148,12 @@ then
|
||||
AC_CHECK_LIB(curses, tgetent, CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses)
|
||||
fi
|
||||
|
||||
# Fallback for PDCurses and less useful curses libs...
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
AC_CHECK_LIB(curses, initscr, CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses)
|
||||
fi
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
AC_CHECK_LIB(termcap, tgetent, CURSES_LIB="-ltermcap" CURSES_LIB_NAME=termcap)
|
||||
|
||||
23
cut.c
23
cut.c
@@ -123,7 +123,7 @@ void cut_marked_segment(filestruct * top, int top_x, filestruct * bot,
|
||||
filebot = top;
|
||||
}
|
||||
}
|
||||
if (top->lineno < edittop->lineno)
|
||||
if (top->lineno < edittop->lineno)
|
||||
edit_update(top, CENTER);
|
||||
}
|
||||
#endif
|
||||
@@ -152,20 +152,17 @@ int do_cut_text(void)
|
||||
}
|
||||
|
||||
/* Must let cutbuffer get blown away first before we do this... */
|
||||
if (fileptr == filebot)
|
||||
if (fileptr == filebot && !ISSET(MARK_ISSET))
|
||||
return 0;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(CUT_TO_END) && !ISSET(MARK_ISSET)) {
|
||||
if (current_x == strlen(current->data))
|
||||
{
|
||||
if (current_x == strlen(current->data)) {
|
||||
do_delete();
|
||||
SET(KEEP_CUTBUFFER);
|
||||
marked_cut = 2;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
SET(MARK_ISSET);
|
||||
SET(KEEP_CUTBUFFER);
|
||||
|
||||
@@ -227,7 +224,7 @@ int do_cut_text(void)
|
||||
tmp = fileptr;
|
||||
fileage = fileptr;
|
||||
add_to_cutbuffer(fileptr->prev);
|
||||
totsize--; /* get the newline */
|
||||
totsize--; /* get the newline */
|
||||
totlines--;
|
||||
fileptr->prev = NULL;
|
||||
current = fileptr;
|
||||
@@ -247,10 +244,10 @@ int do_cut_text(void)
|
||||
(fileptr->next)->prev = fileptr->prev;
|
||||
current = fileptr->next;
|
||||
totlines--;
|
||||
totsize--; /* get the newline */
|
||||
} /* No longer an else here, because we never get here anymore...
|
||||
No need to cut the magic line, as it's empty */
|
||||
|
||||
totsize--; /* get the newline */
|
||||
}
|
||||
/* No longer an else here, because we never get here anymore...
|
||||
No need to cut the magic line, as it's empty */
|
||||
add_to_cutbuffer(fileptr);
|
||||
}
|
||||
|
||||
@@ -404,7 +401,7 @@ int do_uncut_text(void)
|
||||
|
||||
i = editbot->lineno;
|
||||
renumber(newbuf);
|
||||
if (i < newend->lineno)
|
||||
if (i < newend->lineno)
|
||||
edit_update(fileptr, CENTER);
|
||||
|
||||
dump_buffer_reverse(fileptr);
|
||||
|
||||
58
faq.html
58
faq.html
@@ -59,8 +59,11 @@ bucky/meta key doesn't seem to work! What can I do?</a></font>
|
||||
my window. How can I fix that?</a></font>
|
||||
<br><font color="#330000"><a href="#4.4">4.4. Why does nano show ^\ and
|
||||
^_ in the shortcut list instead of ^G and ^J?</a></font>
|
||||
<br><a href="#4.5">4.5 How do I make nano my default editor (in Pine, mutt,
|
||||
etc.)?</a></blockquote>
|
||||
<br><font color="#330000"><a href="#4.5">4.5. When I type in a
|
||||
search string, the string I last searched for is already in front of
|
||||
my cursor! !What happened?!</a></font>
|
||||
<br><a href="#4.6">4.6 How do I make nano my default editor (in Pine,
|
||||
mutt, etc.)?</a></blockquote>
|
||||
|
||||
<h2>
|
||||
<font color="#330000"><a href="#5">5. Internationalization</a></font></h2>
|
||||
@@ -118,7 +121,8 @@ will volunteer to maintain this FAQ someday, who knows...</font></blockquote>
|
||||
<a NAME="1.2"></a><font color="#330000">1.2. How do I contribute to it?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">Your best bet is to send it to the nano
|
||||
email address, <a href="mailto:nano@asty.org">nano@asty.org</a> and if
|
||||
email address, <a
|
||||
href="mailto:nano@nano-editor.org">nano@nano-editor.org</a> and if
|
||||
it is useful enough it will be included in future versions.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
@@ -183,7 +187,7 @@ nano was developed).</font></blockquote>
|
||||
of nano?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">The current version of nano *should*
|
||||
be 0.9.16. Of course you should always check the nano hompage to
|
||||
be 0.9.21. Of course you should always check the nano hompage to
|
||||
see what the latest and greatest version is.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
@@ -191,7 +195,7 @@ see what the latest and greatest version is.</font></blockquote>
|
||||
without having to download the program!</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">Jeez, demanding, aren't we?
|
||||
Okay, look <a href="http://www.asty.org/nano/dist/nano.1.html">here</a>.</font></blockquote>
|
||||
Okay, look <a href="http://www.nano-editor.org/dist/nano.1.html">here</a>.</font></blockquote>
|
||||
|
||||
<hr WIDTH="100%">
|
||||
<h1>
|
||||
@@ -205,13 +209,13 @@ nano.</font></h2>
|
||||
at the following fine web and ftp sites:</font>
|
||||
<ul>
|
||||
<li>
|
||||
<font color="#330000"><a href="http://www.asty.org/nano/dist">http://www.asty.org/nano/dist</a></font></li>
|
||||
<font color="#330000"><a href="http://www.nano-editor.org/dist">http://www.nano-editor.org/dist</a></font></li>
|
||||
|
||||
<li>
|
||||
<font color="#330000"><a href="http://www.ewtoo.org/~astyanax/nano/dist">http://www.ewtoo.org/~astyanax/nano/dist</a></font></li>
|
||||
|
||||
<li>
|
||||
<font color="#330000"><a href="ftp://ftp.asty.org/pub/nano">ftp://ftp.asty.org/pub/nano</a></font></li>
|
||||
<font color="#330000"><a href="ftp://ftp.nano-editor.org/pub/nano">ftp://ftp.nano-editor.org/pub/nano</a></font></li>
|
||||
|
||||
<li>
|
||||
<font color="#330000"><a href="ftp://nano.sourceforge.net/pub/nano/">ftp://nano.sourceforge.net/pub/nano</a></font></li>
|
||||
@@ -225,13 +229,13 @@ packages.</font></h2>
|
||||
<blockquote>
|
||||
<ul>
|
||||
<li>
|
||||
<font color="#330000"><a href="http://www.asty.org/nano/dist/RPMS">http://www.asty.org/nano/dist/RPMS</a></font></li>
|
||||
<font color="#330000"><a href="http://www.nano-editor.org/dist/RPMS">http://www.nano-editor.org/dist/RPMS</a></font></li>
|
||||
|
||||
<li>
|
||||
<font color="#330000"><a href="http://www.ewtoo.org/~astyanax/nano/dist/RPMS">http://www.ewtoo.org/~astyanax/nano/dist/RPMS</a></font></li>
|
||||
|
||||
<li>
|
||||
<font color="#330000"><a href="ftp://ftp.asty.org/pub/nano/RPMS">ftp://ftp.asty.org/pub/nano/RPMS</a></font></li>
|
||||
<font color="#330000"><a href="ftp://ftp.nano-editor.org/pub/nano/RPMS">ftp://ftp.nano-editor.org/pub/nano/RPMS</a></font></li>
|
||||
|
||||
<li>
|
||||
<font color="#330000"><a href="ftp://nano.sourceforge.net/pub/nano/RPMS">ftp://nano.sourceforge.net/pub/nano/RPMS</a></font></li>
|
||||
@@ -254,14 +258,14 @@ at:</font>
|
||||
current nano packages for:</font>
|
||||
<ul>
|
||||
<li>
|
||||
<font color="#330000"><a href="http://www.debian.org/Packages/frozen/editors/nano.html">frozen</a></font></li>
|
||||
<font color="#330000"><a href="http://www.debian.org/Packages/stable/editors/nano.html">stable</a></font></li>
|
||||
|
||||
<li>
|
||||
<font color="#330000"><a href="http://www.debian.org/Packages/unstable/editors/nano.html">unstable</a></font></li>
|
||||
</ul>
|
||||
<font color="#330000">Note that versions < 0.9.10 are probably not for
|
||||
those wanting to get serious work done, so until the frozen/stable distributions
|
||||
have an updated version of nano, you are best off using the one in unstable
|
||||
those wanting to get serious work done, so until the stable distribution
|
||||
has an updated version of nano, you are best off using the one in unstable
|
||||
for now.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
@@ -347,7 +351,7 @@ keystroke here>!</font></h2>
|
||||
<blockquote><font color="#330000">If you aren't trying some bizarre keystroke
|
||||
combination with some bizarre $TERM entry, chances are you have found a
|
||||
bug. You are welcome to submit it to the nano-devel list or
|
||||
to <a href="mailto:nano@asty.org">nano@asty.org</a>.</font></blockquote>
|
||||
to <a href="mailto:nano@nano-editor.org">nano@nano-editor.org</a>.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="4.3"></a><font color="#330000">4.3. Nano crashes when I resize
|
||||
@@ -368,8 +372,22 @@ shortcut list. If you use the <b>-p</b> option to nano you
|
||||
will get the same shortcuts at the bottom as Pico.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="4.5"></a>4.5 How do I make nano my default editor (in Pine, mutt,
|
||||
etc)?</h2>
|
||||
<a name="4.5"><font color="#330000">4.5. When I type in a search
|
||||
string, the string I last searched for is already in front of my
|
||||
cursor! !What happened?!</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">In nano version 0.9.21, 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).</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="4.6"></a>4.6. How do I make nano my default editor (in Pine,
|
||||
mutt, etc)?</h2>
|
||||
|
||||
<blockquote>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
|
||||
@@ -406,7 +424,7 @@ my language!</font></h2>
|
||||
language to write one =-). Just grab the <b>nano.pot</b> file from
|
||||
the latest and greatest nano distribution (it's in the <b>po/</b> directory)
|
||||
and translate each line into your native language on the <b>msgstr</b>
|
||||
line. Then send it to the nano devel list or <a href="mailto:nano@asty.org">nano@asty.org</a>.</font></blockquote>
|
||||
line. Then send it to the nano devel list or <a href="mailto:nano@nano-editor.org">nano@nano-editor.org</a>.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="5.2"></a><font color="#330000">5.2. I don't like the translation
|
||||
@@ -426,14 +444,14 @@ or the devel list.</font></blockquote>
|
||||
of Pico?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">There are many reasons to use nano instead
|
||||
of Pico, a more complete list can be found at the <a href="http://www.asty.org/nano">nano
|
||||
of Pico, a more complete list can be found at the <a href="http://www.nano-edior.org">nano
|
||||
homepage</a>.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="6.2"></a><font color="#330000">6.2. Why should I use Pico instead
|
||||
of nano?</font></h2>
|
||||
|
||||
<blockquote>Again, check out the <a href="http://www.asty.org/nano">nano
|
||||
<blockquote>Again, check out the <a href="http://www.nano-editor.org">nano
|
||||
homepage</a> for a good summary of reasons. It really is a matter
|
||||
of personal preference as to which editor you should use. If you're
|
||||
the type of person who likes using the original version of a program, then
|
||||
@@ -510,8 +528,8 @@ a given list:</font><font color="#330000"></font>
|
||||
team a big load of cash (or just a thank you).</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">That's fine. Send it <a href="mailto:nano-devel@lists.sourceforge.net">our
|
||||
way</a>! Better yet, fix a <a href="http://www.asty.org/nano/dist/BUGS">bug</a>
|
||||
in the program or implement a <a href="http://www.asty.org/nano/dist/TODO">cool
|
||||
way</a>! Better yet, fix a <a href="http://www.nano-editor.org/dist/BUGS">bug</a>
|
||||
in the program or implement a <a href="http://www.nano-editor.org/dist/TODO">cool
|
||||
feature</a> and send us that instead (though cash is fine too).</font></blockquote>
|
||||
|
||||
<h2>
|
||||
|
||||
344
files.c
344
files.c
@@ -27,6 +27,8 @@
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "proto.h"
|
||||
@@ -228,7 +230,8 @@ int open_file(char *filename, int insert, int quiet)
|
||||
} else { /* File is A-OK */
|
||||
if (S_ISDIR(fileinfo.st_mode)) {
|
||||
statusbar(_("File \"%s\" is a directory"), filename);
|
||||
new_file();
|
||||
if (!insert)
|
||||
new_file();
|
||||
return -1;
|
||||
}
|
||||
if (!quiet)
|
||||
@@ -244,7 +247,7 @@ int do_insertfile(void)
|
||||
int i;
|
||||
|
||||
wrap_reset();
|
||||
i = statusq(writefile_list, WRITEFILE_LIST_LEN, "",
|
||||
i = statusq(1, writefile_list, WRITEFILE_LIST_LEN, "",
|
||||
_("File to insert [from ./] "));
|
||||
if (i != -1) {
|
||||
|
||||
@@ -335,7 +338,7 @@ int write_file(char *name, int tmp)
|
||||
if (ISSET(TEMP_OPT)) {
|
||||
UNSET(TEMP_OPT);
|
||||
return do_writeout(1);
|
||||
}
|
||||
}
|
||||
statusbar(_("Could not open file for writing: %s"),
|
||||
strerror(errno));
|
||||
return -1;
|
||||
@@ -345,7 +348,8 @@ int write_file(char *name, int tmp)
|
||||
dump_buffer(fileage);
|
||||
while (fileptr != NULL && fileptr->next != NULL) {
|
||||
/* Next line is so we discount the "magic line" */
|
||||
if(filebot == fileptr && fileptr->data[0] == '\0') break;
|
||||
if (filebot == fileptr && fileptr->data[0] == '\0')
|
||||
break;
|
||||
|
||||
size = write(fd, fileptr->data, strlen(fileptr->data));
|
||||
if (size == -1) {
|
||||
@@ -442,17 +446,14 @@ int do_writeout(int exiting)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
strncpy(answer, filename, 132);
|
||||
answer = mallocstrcpy(answer, filename);
|
||||
|
||||
if ((exiting) && (ISSET(TEMP_OPT))) {
|
||||
if (filename[0])
|
||||
{
|
||||
if (filename[0]) {
|
||||
i = write_file(answer, 0);
|
||||
display_main_list();
|
||||
return i;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
UNSET(TEMP_OPT);
|
||||
do_exit();
|
||||
|
||||
@@ -462,7 +463,7 @@ int do_writeout(int exiting)
|
||||
}
|
||||
|
||||
while (1) {
|
||||
i = statusq(writefile_list, WRITEFILE_LIST_LEN, answer,
|
||||
i = statusq(1, writefile_list, WRITEFILE_LIST_LEN, answer,
|
||||
_("File Name to write"));
|
||||
|
||||
if (i != -1) {
|
||||
@@ -470,7 +471,7 @@ int do_writeout(int exiting)
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("filename is %s"), answer);
|
||||
#endif
|
||||
if (strncmp(answer, filename, 132)) {
|
||||
if (strcmp(answer, filename)) {
|
||||
struct stat st;
|
||||
if (!stat(answer, &st)) {
|
||||
i = do_yesno(0, 0, _("File exists, OVERWRITE ?"));
|
||||
@@ -495,3 +496,322 @@ int do_writeout_void(void)
|
||||
{
|
||||
return do_writeout(0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* These functions (username_tab_completion, cwd_tab_completion, and
|
||||
* input_tab were taken from busybox 0.46 (cmdedit.c). Here is the notice
|
||||
* from that file:
|
||||
*
|
||||
* Termios command line History and Editting, originally
|
||||
* intended for NetBSD sh (ash)
|
||||
* Copyright (c) 1999
|
||||
* Main code: Adam Rogoyski <rogoyski@cs.utexas.edu>
|
||||
* Etc: Dave Cinege <dcinege@psychosis.com>
|
||||
* Majorly adjusted/re-written for busybox:
|
||||
* Erik Andersen <andersee@debian.org>
|
||||
*
|
||||
* You may use this code as you wish, so long as the original author(s)
|
||||
* are attributed in any redistributions of the source code.
|
||||
* This code is 'as is' with no warranty.
|
||||
* This code may safely be consumed by a BSD or GPL license.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
char **username_tab_completion(char *buf, int *num_matches)
|
||||
{
|
||||
char **matches = (char **) NULL;
|
||||
*num_matches = 0;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "\nin username_tab_completion\n");
|
||||
#endif
|
||||
return (matches);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This was originally called exe_n_cwd_tab_completion, but we're not
|
||||
worried about executables, only filenames :> */
|
||||
|
||||
char **cwd_tab_completion(char *buf, int *num_matches)
|
||||
{
|
||||
char *dirName, *tmp = NULL, *tmp2 = NULL;
|
||||
char **matches = (char **) NULL;
|
||||
DIR *dir;
|
||||
struct dirent *next;
|
||||
|
||||
matches = nmalloc(BUFSIZ);
|
||||
|
||||
/* Stick a wildcard onto the buf, for later use */
|
||||
strcat(buf, "*");
|
||||
|
||||
/* Okie, if there's a / in the buffer, strip out the directory part */
|
||||
if (strcmp(buf, "") && strstr(buf, "/")) {
|
||||
dirName = malloc(strlen(buf) + 1);
|
||||
tmp = buf + strlen(buf);
|
||||
while (*tmp != '/' && tmp != buf)
|
||||
tmp--;
|
||||
|
||||
tmp++;
|
||||
|
||||
strncpy(dirName, buf, tmp - buf + 1);
|
||||
dirName[tmp - buf] = 0;
|
||||
|
||||
} else {
|
||||
if ((dirName = getcwd(NULL, 0)) == NULL)
|
||||
return matches;
|
||||
else
|
||||
tmp = buf;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "\nDir = %s\n", dirName);
|
||||
fprintf(stderr, "\nbuf = %s\n", buf);
|
||||
fprintf(stderr, "\ntmp = %s\n", tmp);
|
||||
#endif
|
||||
|
||||
dir = opendir(dirName);
|
||||
if (!dir) {
|
||||
/* Don't print an error, just shut up and return */
|
||||
*num_matches = 0;
|
||||
beep();
|
||||
return (matches);
|
||||
}
|
||||
while ((next = readdir(dir)) != NULL) {
|
||||
|
||||
/* Some quick sanity checks */
|
||||
if ((strcmp(next->d_name, "..") == 0)
|
||||
|| (strcmp(next->d_name, ".") == 0)) {
|
||||
continue;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Comparing \'%s\'\n", next->d_name);
|
||||
#endif
|
||||
/* See if this matches */
|
||||
if (check_wildcard_match(next->d_name, tmp) == TRUE) {
|
||||
|
||||
/* Cool, found a match. Add it to the list
|
||||
* This makes a lot more sense to me (Chris) this way...
|
||||
*/
|
||||
tmp2 = NULL;
|
||||
tmp2 = nmalloc(strlen(next->d_name) + 1);
|
||||
strcpy(tmp2, next->d_name);
|
||||
matches[*num_matches] = tmp2;
|
||||
++*num_matches;
|
||||
|
||||
/* If there's no more room, bail out */
|
||||
if (*num_matches == BUFSIZ)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return (matches);
|
||||
}
|
||||
|
||||
/* This function now has an arg which refers to how much the
|
||||
* statusbar (place) should be advanced, i.e. the new cursor pos.
|
||||
*/
|
||||
char *input_tab(char *buf, int place, int *lastWasTab, int *newplace)
|
||||
{
|
||||
/* Do TAB completion */
|
||||
static int num_matches = 0, match_matches = 0;
|
||||
static char **matches = (char **) NULL;
|
||||
int pos = place, i = 0, col = 0, editline = 0;
|
||||
int longestname = 0;
|
||||
char *foo;
|
||||
struct stat fileinfo;
|
||||
|
||||
if (*lastWasTab == FALSE) {
|
||||
char *tmp, *copyto, *matchBuf;
|
||||
|
||||
*lastWasTab = 1;
|
||||
|
||||
/* Make a local copy of the string -- up to the position of the
|
||||
cursor */
|
||||
matchBuf = (char *) calloc(strlen(buf) + 2, sizeof(char));
|
||||
|
||||
strncpy(matchBuf, buf, place);
|
||||
tmp = matchBuf;
|
||||
|
||||
/* skip any leading white space */
|
||||
while (*tmp && isspace((int) *tmp))
|
||||
++tmp;
|
||||
|
||||
/* Free up any memory already allocated */
|
||||
if (matches != NULL) {
|
||||
for (i = i; i < num_matches; i++)
|
||||
free(matches[i]);
|
||||
free(matches);
|
||||
matches = (char **) NULL;
|
||||
num_matches = 0;
|
||||
}
|
||||
|
||||
/* If the word starts with `~' and there is no slash in the word,
|
||||
* then try completing this word as a username. */
|
||||
|
||||
/* FIXME -- this check is broken!
|
||||
if (*tmp == '~' && !strchr(tmp, '/'))
|
||||
matches = username_tab_completion(tmp, &num_matches); */
|
||||
|
||||
/* Try to match everything in the current working directory that
|
||||
* matches. */
|
||||
if (!matches)
|
||||
matches = cwd_tab_completion(tmp, &num_matches);
|
||||
|
||||
/* Don't leak memory */
|
||||
free(matchBuf);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "%d matches found...\n", num_matches);
|
||||
#endif
|
||||
/* Did we find exactly one match? */
|
||||
switch (num_matches) {
|
||||
case 0:
|
||||
blank_edit();
|
||||
wrefresh(edit);
|
||||
break;
|
||||
case 1:
|
||||
|
||||
buf = nrealloc(buf, strlen(buf) + strlen(matches[0]) + 1);
|
||||
|
||||
if (strcmp(buf, "") && strstr(buf, "/")) {
|
||||
for (tmp = buf + strlen(buf); *tmp != '/' && tmp != buf;
|
||||
tmp--);
|
||||
tmp++;
|
||||
} else
|
||||
tmp = buf;
|
||||
|
||||
if (!strcmp(tmp, matches[0])) {
|
||||
|
||||
/* Is it a directory? */
|
||||
if (stat(buf, &fileinfo) == -1)
|
||||
break;
|
||||
else if (S_ISDIR(fileinfo.st_mode)) {
|
||||
|
||||
/* Tack on a slash */
|
||||
strncat(buf, "/", 1);
|
||||
*newplace += 1;
|
||||
/* now we start over with 0 tabs so far */
|
||||
*lastWasTab = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
copyto = tmp;
|
||||
for (pos = 0; *tmp == matches[0][pos] &&
|
||||
pos <= strlen(matches[0]); pos++)
|
||||
tmp++;
|
||||
|
||||
/* write out the matched name */
|
||||
strncpy(copyto, matches[0], strlen(matches[0]) + 1);
|
||||
*newplace += strlen(matches[0]) - pos;
|
||||
|
||||
if (stat(buf, &fileinfo) == -1)
|
||||
break;
|
||||
else if (S_ISDIR(fileinfo.st_mode)) {
|
||||
strncat(buf, "/", 1);
|
||||
*newplace += 1;
|
||||
/* now we start over again with # of tabs so far */
|
||||
*lastWasTab = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/* Check to see if all matches share a beginning, and if so
|
||||
tack it onto buf and then beep */
|
||||
|
||||
if (strcmp(buf, "") && strstr(buf, "/")) {
|
||||
for (tmp = buf + strlen(buf); *tmp != '/' && tmp != buf;
|
||||
tmp--);
|
||||
tmp++;
|
||||
} else
|
||||
tmp = buf;
|
||||
|
||||
for (pos = 0; *tmp == matches[0][pos] && *tmp != 0 &&
|
||||
pos <= strlen(matches[0]); pos++)
|
||||
tmp++;
|
||||
|
||||
while (1) {
|
||||
match_matches = 0;
|
||||
|
||||
for (i = 0; i < num_matches; i++) {
|
||||
if (matches[i][pos] == 0)
|
||||
break;
|
||||
else if (matches[i][pos] == matches[0][pos])
|
||||
match_matches++;
|
||||
}
|
||||
if (match_matches == num_matches &&
|
||||
(i == num_matches || matches[i] != 0)) {
|
||||
/* All the matches have the same character at pos+1,
|
||||
so paste it into buf... */
|
||||
buf = nrealloc(buf, strlen(buf) + 2);
|
||||
strncat(buf, matches[0] + pos, 1);
|
||||
*newplace += 1;
|
||||
pos++;
|
||||
} else {
|
||||
beep();
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* Ok -- the last char was a TAB. Since they
|
||||
* just hit TAB again, print a list of all the
|
||||
* available choices... */
|
||||
if (matches && num_matches > 0) {
|
||||
|
||||
/* Blank the edit window, and print the matches out there */
|
||||
blank_edit();
|
||||
wmove(edit, 0, 0);
|
||||
|
||||
editline = 0;
|
||||
|
||||
/* Figure out the length of the longest filename */
|
||||
for (i = 0; i < num_matches; i++)
|
||||
if (strlen(matches[i]) > longestname)
|
||||
longestname = strlen(matches[i]);
|
||||
|
||||
if (longestname > COLS - 1)
|
||||
longestname = COLS - 1;
|
||||
|
||||
foo = nmalloc(longestname + 5);
|
||||
|
||||
/* Print the list of matches */
|
||||
for (i = 0, col = 0; i < num_matches; i++) {
|
||||
|
||||
/* make each filename shown be the same length as the longest
|
||||
filename, with two spaces at the end */
|
||||
snprintf(foo, longestname + 1, matches[i]);
|
||||
while (strlen(foo) < longestname)
|
||||
strcat(foo, " ");
|
||||
|
||||
strcat(foo, " ");
|
||||
|
||||
/* Disable el cursor */
|
||||
curs_set(0);
|
||||
/* now, put the match on the screen */
|
||||
waddnstr(edit, foo, strlen(foo));
|
||||
col += strlen(foo);
|
||||
|
||||
/* And if the next match isn't going to fit on the
|
||||
line, move to the next one */
|
||||
if (col > (COLS - longestname) && matches[i + 1] != NULL) {
|
||||
editline++;
|
||||
wmove(edit, editline, 0);
|
||||
if (editline == editwinrows - 1) {
|
||||
waddstr(edit, _("(more)"));
|
||||
break;
|
||||
}
|
||||
col = 0;
|
||||
}
|
||||
}
|
||||
free(foo);
|
||||
wrefresh(edit);
|
||||
} else
|
||||
beep();
|
||||
|
||||
}
|
||||
|
||||
edit_refresh();
|
||||
curs_set(1);
|
||||
return buf;
|
||||
}
|
||||
|
||||
101
global.c
101
global.c
@@ -54,7 +54,7 @@ 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 */
|
||||
|
||||
char answer[132]; /* Answer str to many questions */
|
||||
char *answer = NULL; /* Answer str to many questions */
|
||||
int totlines = 0; /* Total number of lines in the file */
|
||||
int totsize = 0; /* Total number of bytes in the file */
|
||||
int placewewant = 0; /* The collum we'd like the cursor
|
||||
@@ -74,6 +74,7 @@ int mark_beginx; /* X value in the string to start */
|
||||
shortcut main_list[MAIN_LIST_LEN];
|
||||
shortcut whereis_list[WHEREIS_LIST_LEN];
|
||||
shortcut replace_list[REPLACE_LIST_LEN];
|
||||
shortcut replace_list_2[REPLACE_LIST_LEN]; /* 2nd half of replace dialog */
|
||||
shortcut goto_list[GOTO_LIST_LEN];
|
||||
shortcut writefile_list[WRITEFILE_LIST_LEN];
|
||||
shortcut help_list[HELP_LIST_LEN];
|
||||
@@ -82,9 +83,11 @@ toggle toggles[TOGGLE_LEN];
|
||||
|
||||
/* Regular expressions */
|
||||
|
||||
regex_t search_regexp; /* Global to store compiled search regexp */
|
||||
regmatch_t regmatches[10]; /* Match positions for parenthetical
|
||||
subexpressions, max of 10 */
|
||||
#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
|
||||
|
||||
/* Initialize a struct *without* our lovely braces =( */
|
||||
void sc_init_one(shortcut * s, int key, char *desc, char *help, int alt,
|
||||
@@ -113,36 +116,43 @@ void toggle_init(void)
|
||||
#ifndef NANO_SMALL
|
||||
char *toggle_const_msg, *toggle_autoindent_msg, *toggle_suspend_msg,
|
||||
*toggle_nohelp_msg, *toggle_picomode_msg, *toggle_mouse_msg,
|
||||
*toggle_cuttoend_msg, *toggle_regexp_msg, *toggle_wrap_msg;
|
||||
*toggle_cuttoend_msg, *toggle_wrap_msg;
|
||||
#ifdef HAVE_REGEX_H
|
||||
char *toggle_regexp_msg;
|
||||
#endif
|
||||
|
||||
toggle_const_msg = _("Constant cursor position");
|
||||
toggle_autoindent_msg = _("Auto indent");
|
||||
toggle_suspend_msg = _("Suspend");
|
||||
toggle_nohelp_msg = _("Help mode");
|
||||
toggle_picomode_msg = _("Pico messages");
|
||||
toggle_picomode_msg = _("Pico mode");
|
||||
toggle_mouse_msg = _("Mouse support");
|
||||
toggle_cuttoend_msg = _("Cut to end");
|
||||
toggle_regexp_msg = _("Regular expressions");
|
||||
#ifdef HAVE_REGEX_H
|
||||
toggle_regexp_msg = _("Regular expressions");
|
||||
#endif
|
||||
toggle_wrap_msg = _("Auto wrap");
|
||||
|
||||
toggle_init_one(&toggles[0], TOGGLE_CONST_KEY, toggle_const_msg,
|
||||
CONSTUPDATE);
|
||||
toggle_init_one(&toggles[1], TOGGLE_AUTOINDENT_KEY, toggle_autoindent_msg,
|
||||
AUTOINDENT);
|
||||
toggle_init_one(&toggles[2], TOGGLE_SUSPEND_KEY, toggle_suspend_msg,
|
||||
SUSPEND);
|
||||
toggle_init_one(&toggles[3], TOGGLE_NOHELP_KEY, toggle_nohelp_msg,
|
||||
NO_HELP);
|
||||
toggle_init_one(&toggles[4], TOGGLE_PICOMODE_KEY, toggle_picomode_msg,
|
||||
PICO_MSGS);
|
||||
toggle_init_one(&toggles[5], TOGGLE_WRAP_KEY, toggle_wrap_msg,
|
||||
NO_WRAP);
|
||||
toggle_init_one(&toggles[6], TOGGLE_MOUSE_KEY, toggle_mouse_msg,
|
||||
USE_MOUSE);
|
||||
toggle_init_one(&toggles[7], TOGGLE_CUTTOEND_KEY, toggle_cuttoend_msg,
|
||||
CUT_TO_END);
|
||||
toggle_init_one(&toggles[8], TOGGLE_REGEXP_KEY, toggle_regexp_msg,
|
||||
USE_REGEXP);
|
||||
toggle_init_one(&toggles[0], TOGGLE_CONST_KEY, toggle_const_msg,
|
||||
CONSTUPDATE);
|
||||
toggle_init_one(&toggles[1], TOGGLE_AUTOINDENT_KEY,
|
||||
toggle_autoindent_msg, AUTOINDENT);
|
||||
toggle_init_one(&toggles[2], TOGGLE_SUSPEND_KEY, toggle_suspend_msg,
|
||||
SUSPEND);
|
||||
toggle_init_one(&toggles[3], TOGGLE_NOHELP_KEY, toggle_nohelp_msg,
|
||||
NO_HELP);
|
||||
toggle_init_one(&toggles[4], TOGGLE_PICOMODE_KEY, toggle_picomode_msg,
|
||||
PICO_MODE);
|
||||
toggle_init_one(&toggles[5], TOGGLE_WRAP_KEY, toggle_wrap_msg,
|
||||
NO_WRAP);
|
||||
toggle_init_one(&toggles[6], TOGGLE_MOUSE_KEY, toggle_mouse_msg,
|
||||
USE_MOUSE);
|
||||
toggle_init_one(&toggles[7], TOGGLE_CUTTOEND_KEY, toggle_cuttoend_msg,
|
||||
CUT_TO_END);
|
||||
#ifdef HAVE_REGEX_H
|
||||
toggle_init_one(&toggles[8], TOGGLE_REGEXP_KEY, toggle_regexp_msg,
|
||||
USE_REGEXP);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -197,9 +207,9 @@ void shortcut_init(void)
|
||||
nano_cancel_msg = _("Cancel the current function");
|
||||
#endif
|
||||
|
||||
if (ISSET(PICO_MSGS))
|
||||
if (ISSET(PICO_MODE))
|
||||
sc_init_one(&main_list[0], NANO_HELP_KEY, _("Get Help"),
|
||||
nano_help_msg, 0, 0, 0, VIEW, do_help);
|
||||
nano_help_msg, 0, NANO_HELP_FKEY, 0, VIEW, do_help);
|
||||
else
|
||||
sc_init_one(&main_list[0], NANO_WRITEOUT_KEY, _("WriteOut"),
|
||||
nano_writeout_msg,
|
||||
@@ -208,7 +218,7 @@ void shortcut_init(void)
|
||||
sc_init_one(&main_list[1], NANO_EXIT_KEY, _("Exit"),
|
||||
nano_exit_msg, 0, NANO_EXIT_FKEY, 0, VIEW, do_exit);
|
||||
|
||||
if (ISSET(PICO_MSGS))
|
||||
if (ISSET(PICO_MODE))
|
||||
sc_init_one(&main_list[2], NANO_WRITEOUT_KEY, _("WriteOut"),
|
||||
nano_writeout_msg,
|
||||
0, NANO_WRITEOUT_FKEY, 0, NOVIEW, do_writeout_void);
|
||||
@@ -217,9 +227,10 @@ void shortcut_init(void)
|
||||
nano_goto_msg,
|
||||
NANO_ALT_G, NANO_GOTO_FKEY, 0, VIEW, do_gotoline_void);
|
||||
|
||||
if (ISSET(PICO_MSGS))
|
||||
if (ISSET(PICO_MODE))
|
||||
sc_init_one(&main_list[3], NANO_JUSTIFY_KEY, _("Justify"),
|
||||
nano_justify_msg, 0, 0, 0, NOVIEW, do_justify);
|
||||
nano_justify_msg, 0, NANO_JUSTIFY_FKEY, 0,
|
||||
NOVIEW, do_justify);
|
||||
else
|
||||
sc_init_one(&main_list[3], NANO_REPLACE_KEY, _("Replace"),
|
||||
nano_replace_msg,
|
||||
@@ -291,25 +302,26 @@ void shortcut_init(void)
|
||||
sc_init_one(&main_list[22], NANO_TAB_KEY, _("Tab"),
|
||||
nano_tab_msg, 0, 0, 0, NOVIEW, do_tab);
|
||||
|
||||
if (ISSET(PICO_MSGS))
|
||||
if (ISSET(PICO_MODE))
|
||||
sc_init_one(&main_list[23], NANO_REPLACE_KEY, _("Replace"),
|
||||
nano_replace_msg,
|
||||
NANO_ALT_R, NANO_REPLACE_FKEY, 0, NOVIEW, do_replace);
|
||||
else
|
||||
sc_init_one(&main_list[23], NANO_JUSTIFY_KEY, _("Justify"),
|
||||
nano_justify_msg, 0, 0, 0, NOVIEW, do_justify);
|
||||
nano_justify_msg, 0, NANO_JUSTIFY_FKEY, 0,
|
||||
NOVIEW, do_justify);
|
||||
|
||||
sc_init_one(&main_list[24], NANO_ENTER_KEY, _("Enter"),
|
||||
nano_enter_msg,
|
||||
0, KEY_ENTER, NANO_CONTROL_M, NOVIEW, do_enter_void);
|
||||
|
||||
if (ISSET(PICO_MSGS))
|
||||
if (ISSET(PICO_MODE))
|
||||
sc_init_one(&main_list[25], NANO_GOTO_KEY, _("Goto Line"),
|
||||
nano_goto_msg,
|
||||
NANO_ALT_G, NANO_GOTO_FKEY, 0, VIEW, do_gotoline_void);
|
||||
else
|
||||
sc_init_one(&main_list[25], NANO_HELP_KEY, _("Get Help"),
|
||||
nano_help_msg, 0, 0, 0, VIEW, do_help);
|
||||
nano_help_msg, 0, NANO_HELP_FKEY, 0, VIEW, do_help);
|
||||
|
||||
|
||||
sc_init_one(&whereis_list[0], NANO_FIRSTLINE_KEY, _("First Line"),
|
||||
@@ -325,8 +337,9 @@ void shortcut_init(void)
|
||||
sc_init_one(&whereis_list[3], NANO_OTHERSEARCH_KEY, _("Replace"),
|
||||
nano_replace_msg, 0, 0, 0, VIEW, do_replace);
|
||||
|
||||
sc_init_one(&whereis_list[4], NANO_FROMSEARCHTOGOTO_KEY, _("Goto Line"),
|
||||
nano_goto_msg, 0, 0, 0, VIEW, do_gotoline_void);
|
||||
sc_init_one(&whereis_list[4], NANO_FROMSEARCHTOGOTO_KEY,
|
||||
_("Goto Line"), nano_goto_msg, 0, 0, 0, VIEW,
|
||||
do_gotoline_void);
|
||||
|
||||
sc_init_one(&whereis_list[5], NANO_CANCEL_KEY, _("Cancel"),
|
||||
nano_cancel_msg, 0, 0, 0, VIEW, 0);
|
||||
@@ -344,13 +357,25 @@ void shortcut_init(void)
|
||||
sc_init_one(&replace_list[3], NANO_OTHERSEARCH_KEY, _("No Replace"),
|
||||
nano_whereis_msg, 0, 0, 0, VIEW, do_search);
|
||||
|
||||
sc_init_one(&replace_list[4], NANO_FROMSEARCHTOGOTO_KEY, _("Goto Line"),
|
||||
nano_goto_msg, 0, 0, 0, VIEW, do_gotoline_void);
|
||||
sc_init_one(&replace_list[4], NANO_FROMSEARCHTOGOTO_KEY,
|
||||
_("Goto Line"), nano_goto_msg, 0, 0, 0, VIEW,
|
||||
do_gotoline_void);
|
||||
|
||||
sc_init_one(&replace_list[5], NANO_CANCEL_KEY, _("Cancel"),
|
||||
nano_cancel_msg, 0, 0, 0, VIEW, 0);
|
||||
|
||||
|
||||
|
||||
sc_init_one(&replace_list_2[0], NANO_FIRSTLINE_KEY, _("First Line"),
|
||||
nano_firstline_msg, 0, 0, 0, VIEW, do_first_line);
|
||||
|
||||
sc_init_one(&replace_list_2[1], NANO_LASTLINE_KEY, _("Last Line"),
|
||||
nano_lastline_msg, 0, 0, 0, VIEW, do_last_line);
|
||||
|
||||
sc_init_one(&replace_list_2[2], NANO_CANCEL_KEY, _("Cancel"),
|
||||
nano_cancel_msg, 0, 0, 0, VIEW, 0);
|
||||
|
||||
|
||||
sc_init_one(&goto_list[0], NANO_FIRSTLINE_KEY, _("First Line"),
|
||||
nano_firstline_msg, 0, 0, 0, VIEW, &do_first_line);
|
||||
|
||||
|
||||
4
move.c
4
move.c
@@ -57,7 +57,7 @@ int page_down(void)
|
||||
|
||||
if (editbot != filebot || edittop == fileage) {
|
||||
current_y = 0;
|
||||
current = editbot;
|
||||
current = editbot;
|
||||
|
||||
if (current->prev != NULL)
|
||||
current = current->prev;
|
||||
@@ -168,8 +168,6 @@ int do_up(void)
|
||||
{
|
||||
wrap_reset();
|
||||
if (current->prev != NULL) {
|
||||
update_line(current, 0);
|
||||
|
||||
if (placewewant > 0)
|
||||
current_x = actual_x(current->prev, placewewant);
|
||||
|
||||
|
||||
6
nano.1
6
nano.1
@@ -70,7 +70,7 @@ a new file, do not follow it. Good for editing files in /tmp perhaps?
|
||||
Enable mouse support (if available for your system).
|
||||
.TP
|
||||
.B \-p (\-\-pico)
|
||||
Display the same shortcut lists as Pico does.
|
||||
Emulate Pico as closely as possible.
|
||||
.TP
|
||||
.B \-s (\-\-speller)
|
||||
Enable alternative spell checker command.
|
||||
@@ -94,13 +94,13 @@ Enable suspend ability.
|
||||
Places cursor at LINE on startup.
|
||||
.SH BUGS
|
||||
Please send any comments or bug reports to
|
||||
.B nano@asty.org.
|
||||
.B nano@nano-editor.org.
|
||||
The nano mailing list is available from
|
||||
.B nano-devel@lists.sourceforge.net.
|
||||
To subscribe, email to nano-devel-request@lists.sourceforge.net with a
|
||||
subject of "subscribe".
|
||||
.SH HOMEPAGE
|
||||
http://www.asty.org/nano
|
||||
http://www.nano-editor.org
|
||||
.SH AUTHOR
|
||||
Chris Allegretta <chrisa@asty.org>, et al. This manual page was
|
||||
originally written by Jordi Mallach <jordi@sindominio.net>, for the Debian
|
||||
|
||||
@@ -98,7 +98,7 @@ Enable mouse support (if available for your system).
|
||||
<DT><B>-p (--pico)</B>
|
||||
|
||||
<DD>
|
||||
Display the same shortcut lists as Pico does.
|
||||
Emulate Pico as closely as possible.
|
||||
<DT><B>-s (--speller)</B>
|
||||
|
||||
<DD>
|
||||
@@ -132,7 +132,7 @@ Places cursor at LINE on startup.
|
||||
<H2>BUGS</H2>
|
||||
|
||||
Please send any comments or bug reports to
|
||||
<B><A HREF="mailto:nano@asty.org">nano@asty.org</A>.</B>
|
||||
<B><A HREF="mailto:nano@nano-editor.org">nano@nano-editor.org</A>.</B>
|
||||
|
||||
The nano mailing list is available from
|
||||
<B><A HREF="mailto:nano-devel@lists.sourceforge.net">nano-devel@lists.sourceforge.net</A>.</B>
|
||||
@@ -142,7 +142,7 @@ subject of "subscribe".
|
||||
<A NAME="lbAG"> </A>
|
||||
<H2>HOMEPAGE</H2>
|
||||
|
||||
<A HREF="http://www.asty.org/nano">http://www.asty.org/nano</A>
|
||||
<A HREF="http://www.nano-editor.org">http://www.nano-editor.org</A>
|
||||
<A NAME="lbAH"> </A>
|
||||
<H2>AUTHOR</H2>
|
||||
|
||||
@@ -166,6 +166,6 @@ GNU/Linux system (but may be used by others).
|
||||
This document was created by
|
||||
<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
|
||||
using the manual pages.<BR>
|
||||
Time: 17:29:02 GMT, July 28, 2000
|
||||
Time: 21:33:46 GMT, November 19, 2000
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
7
nano.h
7
nano.h
@@ -98,7 +98,7 @@ typedef struct toggle {
|
||||
#define MARK_ISSET (1<<3)
|
||||
#define CONSTUPDATE (1<<4)
|
||||
#define NO_HELP (1<<5)
|
||||
#define PICO_MSGS (1<<6)
|
||||
#define PICO_MODE (1<<6)
|
||||
#define FOLLOW_SYMLINKS (1<<7)
|
||||
#define SUSPEND (1<<8)
|
||||
#define NO_WRAP (1<<9)
|
||||
@@ -240,15 +240,16 @@ know what you're doing */
|
||||
#define MAIN_VISIBLE 12
|
||||
#define WHEREIS_LIST_LEN 6
|
||||
#define REPLACE_LIST_LEN 6
|
||||
#define REPLACE_LIST_2_LEN 3
|
||||
#define GOTO_LIST_LEN 3
|
||||
#define WRITEFILE_LIST_LEN 1
|
||||
#define HELP_LIST_LEN 3
|
||||
#define SPELL_LIST_LEN 3
|
||||
|
||||
#ifndef SMALL_NANO
|
||||
#ifdef HAVE_REGEX_H
|
||||
#define TOGGLE_LEN 9
|
||||
#else
|
||||
#define TOGGLE_LEN 6
|
||||
#define TOGGLE_LEN 8
|
||||
#endif
|
||||
|
||||
#define VIEW 1
|
||||
|
||||
341
po/cat-id-tbl.c
341
po/cat-id-tbl.c
@@ -28,80 +28,81 @@ const struct _msg_ent _msg_tbl[] = {
|
||||
{"File Name to write", 19},
|
||||
{"filename is %s", 20},
|
||||
{"File exists, OVERWRITE ?", 21},
|
||||
{"Constant cursor position", 22},
|
||||
{"Auto indent", 23},
|
||||
{"Suspend", 24},
|
||||
{"Help mode", 25},
|
||||
{"Pico messages", 26},
|
||||
{"Mouse support", 27},
|
||||
{"Cut to end", 28},
|
||||
{"Regular expressions", 29},
|
||||
{"Auto wrap", 30},
|
||||
{"Invoke the help menu", 31},
|
||||
{"Write the current file to disk", 32},
|
||||
{"Exit from nano", 33},
|
||||
{"Goto a specific line number", 34},
|
||||
{"Justify the current paragraph", 35},
|
||||
{"Replace text within the editor", 36},
|
||||
{"Insert another file into the current one", 37},
|
||||
{"Search for text within the editor", 38},
|
||||
{"Move to the previous screen", 39},
|
||||
{"Move to the next screen", 40},
|
||||
{"Cut the current line and store it in the cutbuffer", 41},
|
||||
{"Uncut from the cutbuffer into the current line", 42},
|
||||
{"Show the posititon of the cursor", 43},
|
||||
{"Invoke the spell checker (if available)", 44},
|
||||
{"Move up one line", 45},
|
||||
{"Move down one line", 46},
|
||||
{"Move forward one character", 47},
|
||||
{"Move back one character", 48},
|
||||
{"Move to the beginning of the current line", 49},
|
||||
{"Move to the end of the current line", 50},
|
||||
{"Go to the first line of the file", 51},
|
||||
{"Go to the last line of the file", 52},
|
||||
{"Refresh (redraw) the current screen", 53},
|
||||
{"Mark text at the current cursor location", 54},
|
||||
{"Delete the character under the cursor", 55},
|
||||
{"Delete the character to the left of the cursor", 56},
|
||||
{"Insert a tab character", 57},
|
||||
{"Insert a carriage return at the cursor position", 58},
|
||||
{"Make the current search or replace case (in)sensitive", 59},
|
||||
{"Cancel the current function", 60},
|
||||
{"Get Help", 61},
|
||||
{"WriteOut", 62},
|
||||
{"Exit", 63},
|
||||
{"Goto Line", 64},
|
||||
{"Justify", 65},
|
||||
{"Replace", 66},
|
||||
{"Read File", 67},
|
||||
{"Where Is", 68},
|
||||
{"Prev Page", 69},
|
||||
{"Next Page", 70},
|
||||
{"Cut Text", 71},
|
||||
{"UnCut Txt", 72},
|
||||
{"Cur Pos", 73},
|
||||
{"To Spell", 74},
|
||||
{"Up", 75},
|
||||
{"Down", 76},
|
||||
{"Forward", 77},
|
||||
{"Back", 78},
|
||||
{"Home", 79},
|
||||
{"End", 80},
|
||||
{"Refresh", 81},
|
||||
{"Mark Text", 82},
|
||||
{"Delete", 83},
|
||||
{"Backspace", 84},
|
||||
{"Tab", 85},
|
||||
{"Enter", 86},
|
||||
{"First Line", 87},
|
||||
{"Last Line", 88},
|
||||
{"Case Sens", 89},
|
||||
{"Cancel", 90},
|
||||
{"No Replace", 91},
|
||||
{"(more)", 22},
|
||||
{"Constant cursor position", 23},
|
||||
{"Auto indent", 24},
|
||||
{"Suspend", 25},
|
||||
{"Help mode", 26},
|
||||
{"Pico mode", 27},
|
||||
{"Mouse support", 28},
|
||||
{"Cut to end", 29},
|
||||
{"Regular expressions", 30},
|
||||
{"Auto wrap", 31},
|
||||
{"Invoke the help menu", 32},
|
||||
{"Write the current file to disk", 33},
|
||||
{"Exit from nano", 34},
|
||||
{"Goto a specific line number", 35},
|
||||
{"Justify the current paragraph", 36},
|
||||
{"Replace text within the editor", 37},
|
||||
{"Insert another file into the current one", 38},
|
||||
{"Search for text within the editor", 39},
|
||||
{"Move to the previous screen", 40},
|
||||
{"Move to the next screen", 41},
|
||||
{"Cut the current line and store it in the cutbuffer", 42},
|
||||
{"Uncut from the cutbuffer into the current line", 43},
|
||||
{"Show the posititon of the cursor", 44},
|
||||
{"Invoke the spell checker (if available)", 45},
|
||||
{"Move up one line", 46},
|
||||
{"Move down one line", 47},
|
||||
{"Move forward one character", 48},
|
||||
{"Move back one character", 49},
|
||||
{"Move to the beginning of the current line", 50},
|
||||
{"Move to the end of the current line", 51},
|
||||
{"Go to the first line of the file", 52},
|
||||
{"Go to the last line of the file", 53},
|
||||
{"Refresh (redraw) the current screen", 54},
|
||||
{"Mark text at the current cursor location", 55},
|
||||
{"Delete the character under the cursor", 56},
|
||||
{"Delete the character to the left of the cursor", 57},
|
||||
{"Insert a tab character", 58},
|
||||
{"Insert a carriage return at the cursor position", 59},
|
||||
{"Make the current search or replace case (in)sensitive", 60},
|
||||
{"Cancel the current function", 61},
|
||||
{"Get Help", 62},
|
||||
{"WriteOut", 63},
|
||||
{"Exit", 64},
|
||||
{"Goto Line", 65},
|
||||
{"Justify", 66},
|
||||
{"Replace", 67},
|
||||
{"Read File", 68},
|
||||
{"Where Is", 69},
|
||||
{"Prev Page", 70},
|
||||
{"Next Page", 71},
|
||||
{"Cut Text", 72},
|
||||
{"UnCut Txt", 73},
|
||||
{"Cur Pos", 74},
|
||||
{"To Spell", 75},
|
||||
{"Up", 76},
|
||||
{"Down", 77},
|
||||
{"Forward", 78},
|
||||
{"Back", 79},
|
||||
{"Home", 80},
|
||||
{"End", 81},
|
||||
{"Refresh", 82},
|
||||
{"Mark Text", 83},
|
||||
{"Delete", 84},
|
||||
{"Backspace", 85},
|
||||
{"Tab", 86},
|
||||
{"Enter", 87},
|
||||
{"First Line", 88},
|
||||
{"Last Line", 89},
|
||||
{"Case Sens", 90},
|
||||
{"Cancel", 91},
|
||||
{"No Replace", 92},
|
||||
{"\
|
||||
\n\
|
||||
Buffer written to 'nano.save'\n", 92},
|
||||
{"Key illegal in VIEW mode", 93},
|
||||
Buffer written to 'nano.save'\n", 93},
|
||||
{"Key illegal in VIEW mode", 94},
|
||||
{"\
|
||||
nano help text\n\
|
||||
\n\
|
||||
@@ -119,66 +120,65 @@ Escape-key sequences are notated with the Meta (M) symbol and can be entered \
|
||||
using either the Esc, Alt or Meta key depending on your keyboard setup. The \
|
||||
following keystrokes are available in the main editor window. Optional keys \
|
||||
are shown in parentheses:\n\
|
||||
\n", 94},
|
||||
{"free_node(): free'd a node, YAY!\n", 95},
|
||||
{"free_node(): free'd last node.\n", 96},
|
||||
\n", 95},
|
||||
{"free_node(): free'd a node, YAY!\n", 96},
|
||||
{"free_node(): free'd last node.\n", 97},
|
||||
{"\
|
||||
Usage: nano [GNU long option] [option] +LINE <file>\n\
|
||||
\n", 97},
|
||||
{"Option\t\tLong option\t\tMeaning\n", 98},
|
||||
{" -T \t\t--tabsize=[num]\t\tSet width of a tab to num\n", 99},
|
||||
{" -R\t\t--regexp\t\tUse regular expressions for search\n", 100},
|
||||
{" -V \t\t--version\t\tPrint version information and exit\n", 101},
|
||||
{" -c \t\t--const\t\t\tConstantly show cursor position\n", 102},
|
||||
{" -h \t\t--help\t\t\tShow this message\n", 103},
|
||||
{" -k \t\t--cut\t\t\tLet ^K cut from cursor to end of line\n", 104},
|
||||
{" -i \t\t--autoindent\t\tAutomatically indent new lines\n", 105},
|
||||
{" -l \t\t--nofollow\t\tDon't follow symbolic links, overwrite.\n", 106},
|
||||
{" -m \t\t--mouse\t\t\tEnable mouse\n", 107},
|
||||
\n", 98},
|
||||
{"Option\t\tLong option\t\tMeaning\n", 99},
|
||||
{" -T \t\t--tabsize=[num]\t\tSet width of a tab to num\n", 100},
|
||||
{" -R\t\t--regexp\t\tUse regular expressions for search\n", 101},
|
||||
{" -V \t\t--version\t\tPrint version information and exit\n", 102},
|
||||
{" -c \t\t--const\t\t\tConstantly show cursor position\n", 103},
|
||||
{" -h \t\t--help\t\t\tShow this message\n", 104},
|
||||
{" -k \t\t--cut\t\t\tLet ^K cut from cursor to end of line\n", 105},
|
||||
{" -i \t\t--autoindent\t\tAutomatically indent new lines\n", 106},
|
||||
{" -l \t\t--nofollow\t\tDon't follow symbolic links, overwrite\n", 107},
|
||||
{" -m \t\t--mouse\t\t\tEnable mouse\n", 108},
|
||||
{"\
|
||||
-r [#cols] \t--fill=[#cols]\t\tSet fill cols to (wrap lines at) #cols\n", 108},
|
||||
{" -p\t \t--pico\t\t\tMake bottom 2 lines more Pico-like\n", 109},
|
||||
{" -s [prog] \t--speller=[prog]\tEnable alternate speller\n", 110},
|
||||
{" -t \t\t--tempfile\t\tAuto save on exit, don't prompt\n", 111},
|
||||
{" -v \t\t--view\t\t\tView (read only) mode\n", 112},
|
||||
{" -w \t\t--nowrap\t\tDon't wrap long lines\n", 113},
|
||||
{" -x \t\t--nohelp\t\tDon't show help window\n", 114},
|
||||
{" -z \t\t--suspend\t\tEnable suspend\n", 115},
|
||||
{" +LINE\t\t\t\t\tStart at line number LINE\n", 116},
|
||||
-r [#cols] \t--fill=[#cols]\t\tSet fill cols to (wrap lines at) #cols\n", 109},
|
||||
{" -p\t \t--pico\t\t\tEmulate Pico as closely as possible\n", 110},
|
||||
{" -s [prog] \t--speller=[prog]\tEnable alternate speller\n", 111},
|
||||
{" -t \t\t--tempfile\t\tAuto save on exit, don't prompt\n", 112},
|
||||
{" -v \t\t--view\t\t\tView (read only) mode\n", 113},
|
||||
{" -w \t\t--nowrap\t\tDon't wrap long lines\n", 114},
|
||||
{" -x \t\t--nohelp\t\tDon't show help window\n", 115},
|
||||
{" -z \t\t--suspend\t\tEnable suspend\n", 116},
|
||||
{" +LINE\t\t\t\t\tStart at line number LINE\n", 117},
|
||||
{"\
|
||||
Usage: nano [option] +LINE <file>\n\
|
||||
\n", 117},
|
||||
{"Option\t\tMeaning\n", 118},
|
||||
{" -T [num]\tSet width of a tab to num\n", 119},
|
||||
{" -R\t\tUse regular expressions for search\n", 120},
|
||||
{" -V \t\tPrint version information and exit\n", 121},
|
||||
{" -c \t\tConstantly show cursor position\n", 122},
|
||||
{" -h \t\tShow this message\n", 123},
|
||||
{" -k \t\tLet ^K cut from cursor to end of line\n", 124},
|
||||
{" -i \t\tAutomatically indent new lines\n", 125},
|
||||
{" -l \t\tDon't follow symbolic links, overwrite.\n", 126},
|
||||
{" -m \t\tEnable mouse\n", 127},
|
||||
{" -r [#cols] \tSet fill cols to (wrap lines at) #cols\n", 128},
|
||||
{" -s [prog] \tEnable alternate speller\n", 129},
|
||||
{" -p \t\tMake bottom 2 lines more Pico-like\n", 130},
|
||||
{" -t \t\tAuto save on exit, don't prompt\n", 131},
|
||||
{" -v \t\tView (read only) mode\n", 132},
|
||||
{" -w \t\tDon't wrap long lines\n", 133},
|
||||
{" -x \t\tDon't show help window\n", 134},
|
||||
{" -z \t\tEnable suspend\n", 135},
|
||||
{" +LINE\t\tStart at line number LINE\n", 136},
|
||||
{" nano version %s by Chris Allegretta (compiled %s, %s)\n", 137},
|
||||
{" Email: nano@asty.org\tWeb: http://www.asty.org/nano\n", 138},
|
||||
{"Mark Set", 139},
|
||||
{"Mark UNset", 140},
|
||||
{"check_wrap called with inptr->data=\"%s\"\n", 141},
|
||||
{"current->data now = \"%s\"\n", 142},
|
||||
{"After, data = \"%s\"\n", 143},
|
||||
{"Error deleting tempfile, ack!", 144},
|
||||
{"Could not create a temporary filename: %s", 145},
|
||||
{"Could not invoke spell program \"%s\"", 146},
|
||||
{"Could not invoke \"ispell\"", 147},
|
||||
{"Finished checking spelling", 148},
|
||||
\n", 118},
|
||||
{"Option\t\tMeaning\n", 119},
|
||||
{" -T [num]\tSet width of a tab to num\n", 120},
|
||||
{" -R\t\tUse regular expressions for search\n", 121},
|
||||
{" -V \t\tPrint version information and exit\n", 122},
|
||||
{" -c \t\tConstantly show cursor position\n", 123},
|
||||
{" -h \t\tShow this message\n", 124},
|
||||
{" -k \t\tLet ^K cut from cursor to end of line\n", 125},
|
||||
{" -i \t\tAutomatically indent new lines\n", 126},
|
||||
{" -l \t\tDon't follow symbolic links, overwrite\n", 127},
|
||||
{" -m \t\tEnable mouse\n", 128},
|
||||
{" -r [#cols] \tSet fill cols to (wrap lines at) #cols\n", 129},
|
||||
{" -s [prog] \tEnable alternate speller\n", 130},
|
||||
{" -p \t\tEmulate Pico as closely as possible\n", 131},
|
||||
{" -t \t\tAuto save on exit, don't prompt\n", 132},
|
||||
{" -v \t\tView (read only) mode\n", 133},
|
||||
{" -w \t\tDon't wrap long lines\n", 134},
|
||||
{" -x \t\tDon't show help window\n", 135},
|
||||
{" -z \t\tEnable suspend\n", 136},
|
||||
{" +LINE\t\tStart at line number LINE\n", 137},
|
||||
{" nano version %s by Chris Allegretta (compiled %s, %s)\n", 138},
|
||||
{" Email: nano@nano-editor.org\tWeb: http://www.nano-editor.org\n", 139},
|
||||
{"Mark Set", 140},
|
||||
{"Mark UNset", 141},
|
||||
{"check_wrap called with inptr->data=\"%s\"\n", 142},
|
||||
{"current->data now = \"%s\"\n", 143},
|
||||
{"After, data = \"%s\"\n", 144},
|
||||
{"Edit a replacement", 145},
|
||||
{"Could not create a temporary filename: %s", 146},
|
||||
{"Finished checking spelling", 147},
|
||||
{"Spell checking failed", 148},
|
||||
{"Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? ", 149},
|
||||
{"Cannot resize top win", 150},
|
||||
{"Cannot move top win", 151},
|
||||
@@ -186,44 +186,53 @@ Usage: nano [option] +LINE <file>\n\
|
||||
{"Cannot move edit win", 153},
|
||||
{"Cannot resize bottom win", 154},
|
||||
{"Cannot move bottom win", 155},
|
||||
{"Main: set up windows\n", 156},
|
||||
{"Main: bottom win\n", 157},
|
||||
{"Main: open file\n", 158},
|
||||
{"I got Alt-[-%c! (%d)\n", 159},
|
||||
{"I got Alt-%c! (%d)\n", 160},
|
||||
{"Case Sensitive Regexp Search%s%s", 161},
|
||||
{"Regexp Search%s%s", 162},
|
||||
{"Case Sensitive Search%s%s", 163},
|
||||
{"Search%s%s", 164},
|
||||
{" (to replace)", 165},
|
||||
{"Search Cancelled", 166},
|
||||
{"Search Wrapped", 167},
|
||||
{"Replaced %d occurences", 168},
|
||||
{"Replaced 1 occurence", 169},
|
||||
{"Replace Cancelled", 170},
|
||||
{"Replace with [%s]", 171},
|
||||
{"Replace with", 172},
|
||||
{"Replace this instance?", 173},
|
||||
{"Enter line number", 174},
|
||||
{"Aborted", 175},
|
||||
{"Come on, be reasonable", 176},
|
||||
{"Only %d lines available, skipping to last line", 177},
|
||||
{"actual_x_from_start for xplus=%d returned %d\n", 178},
|
||||
{"input '%c' (%d)\n", 179},
|
||||
{"New Buffer", 180},
|
||||
{" File: ...", 181},
|
||||
{"Modified", 182},
|
||||
{"Moved to (%d, %d) in edit buffer\n", 183},
|
||||
{"current->data = \"%s\"\n", 184},
|
||||
{"I got \"%s\"\n", 185},
|
||||
{"Yes", 186},
|
||||
{"All", 187},
|
||||
{"No", 188},
|
||||
{"do_cursorpos: linepct = %f, bytepct = %f\n", 189},
|
||||
{"line %d of %d (%.0f%%), character %d of %d (%.0f%%)", 190},
|
||||
{"Dumping file buffer to stderr...\n", 191},
|
||||
{"Dumping cutbuffer to stderr...\n", 192},
|
||||
{"Dumping a buffer to stderr...\n", 193},
|
||||
{"Justify Complete", 156},
|
||||
{"%s enable/disable", 157},
|
||||
{"enabled", 158},
|
||||
{"disabled", 159},
|
||||
{"Main: set up windows\n", 160},
|
||||
{"Main: bottom win\n", 161},
|
||||
{"Main: open file\n", 162},
|
||||
{"I got Alt-O-%c! (%d)\n", 163},
|
||||
{"I got Alt-[-1-%c! (%d)\n", 164},
|
||||
{"I got Alt-[-2-%c! (%d)\n", 165},
|
||||
{"I got Alt-[-%c! (%d)\n", 166},
|
||||
{"I got Alt-%c! (%d)\n", 167},
|
||||
{"Case Sensitive Regexp Search%s%s", 168},
|
||||
{"Regexp Search%s%s", 169},
|
||||
{"Case Sensitive Search%s%s", 170},
|
||||
{"Search%s%s", 171},
|
||||
{" (to replace)", 172},
|
||||
{"Search Cancelled", 173},
|
||||
{"\"%s...\" not found", 174},
|
||||
{"Search Wrapped", 175},
|
||||
{"Replaced %d occurences", 176},
|
||||
{"Replaced 1 occurence", 177},
|
||||
{"Replace Cancelled", 178},
|
||||
{"Replace this instance?", 179},
|
||||
{"Replace failed: unknown subexpression!", 180},
|
||||
{"Replace with [%s]", 181},
|
||||
{"Replace with", 182},
|
||||
{"Enter line number", 183},
|
||||
{"Aborted", 184},
|
||||
{"Come on, be reasonable", 185},
|
||||
{"Only %d lines available, skipping to last line", 186},
|
||||
{"actual_x_from_start for xplus=%d returned %d\n", 187},
|
||||
{"input '%c' (%d)\n", 188},
|
||||
{"New Buffer", 189},
|
||||
{" File: ...", 190},
|
||||
{"Modified", 191},
|
||||
{"Moved to (%d, %d) in edit buffer\n", 192},
|
||||
{"current->data = \"%s\"\n", 193},
|
||||
{"I got \"%s\"\n", 194},
|
||||
{"Yes", 195},
|
||||
{"All", 196},
|
||||
{"No", 197},
|
||||
{"do_cursorpos: linepct = %f, bytepct = %f\n", 198},
|
||||
{"line %d of %d (%.0f%%), character %d of %d (%.0f%%)", 199},
|
||||
{"Dumping file buffer to stderr...\n", 200},
|
||||
{"Dumping cutbuffer to stderr...\n", 201},
|
||||
{"Dumping a buffer to stderr...\n", 202},
|
||||
};
|
||||
|
||||
int _msg_tbl_length = 193;
|
||||
int _msg_tbl_length = 202;
|
||||
|
||||
486
po/nano.pot
486
po/nano.pot
File diff suppressed because it is too large
Load Diff
28
proto.h
28
proto.h
@@ -22,7 +22,11 @@
|
||||
/* Externs */
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
#include <regex.h>
|
||||
#endif
|
||||
|
||||
#include "nano.h"
|
||||
|
||||
extern int center_x, center_y, editwinrows;
|
||||
@@ -31,11 +35,14 @@ extern int placewewant;
|
||||
extern int mark_beginx, samelinewrap;
|
||||
extern int totsize, temp_opt;
|
||||
extern int fill, flags,tabsize;
|
||||
extern int search_last_line;
|
||||
|
||||
extern WINDOW *edit, *topwin, *bottomwin;
|
||||
extern char filename[PATH_MAX];
|
||||
extern char answer[132];
|
||||
extern char *answer;
|
||||
extern char *hblank, *help_text;
|
||||
extern char *last_search;
|
||||
extern char *last_replace;
|
||||
extern struct stat fileinfo;
|
||||
extern filestruct *current, *fileage, *edittop, *editbot, *filebot;
|
||||
extern filestruct *cutbuffer, *mark_beginbuf;
|
||||
@@ -43,10 +50,14 @@ extern shortcut *shortcut_list;
|
||||
extern shortcut main_list[MAIN_LIST_LEN], whereis_list[WHEREIS_LIST_LEN];
|
||||
extern shortcut replace_list[REPLACE_LIST_LEN], goto_list[GOTO_LIST_LEN];
|
||||
extern shortcut writefile_list[WRITEFILE_LIST_LEN], help_list[HELP_LIST_LEN];
|
||||
extern shortcut spell_list[SPELL_LIST_LEN];
|
||||
extern shortcut spell_list[SPELL_LIST_LEN], replace_list_2[REPLACE_LIST_LEN];
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
extern int use_regexp, regexp_compiled;
|
||||
extern regex_t search_regexp;
|
||||
extern regmatch_t regmatches[10];
|
||||
#endif
|
||||
|
||||
extern toggle toggles[TOGGLE_LEN];
|
||||
|
||||
/* Programs we want available */
|
||||
@@ -60,7 +71,7 @@ int xplustabs(void);
|
||||
int do_yesno(int all, int leavecursor, char *msg, ...);
|
||||
int actual_x(filestruct * fileptr, int xplus);
|
||||
int strlenpt(char *buf);
|
||||
int statusq(shortcut s[], int slen, char *def, char *msg, ...);
|
||||
int statusq(int allowtabs, shortcut s[], int slen, char *def, char *msg, ...);
|
||||
int write_file(char *name, int tmpfile);
|
||||
int do_cut_text(void);
|
||||
int do_uncut_text(void);
|
||||
@@ -69,12 +80,15 @@ int renumber_all(void);
|
||||
int open_file(char *filename, int insert, int quiet);
|
||||
int do_writeout(int exiting);
|
||||
int do_gotoline(long defline);
|
||||
int do_replace_loop(char *prevanswer, filestruct *begin, int *beginx,
|
||||
int wholewords, int *i);
|
||||
/* Now in move.c */
|
||||
int do_up(void);
|
||||
int do_down(void);
|
||||
int do_left(void);
|
||||
int do_right(void);
|
||||
|
||||
int check_wildcard_match(const char *text, const char *pattern);
|
||||
char *input_tab(char *buf, int place, int *lastWasTab, int *newplace);
|
||||
|
||||
void shortcut_init(void);
|
||||
void lowercase(char *src);
|
||||
@@ -99,6 +113,7 @@ void center_cursor(void);
|
||||
void bottombars(shortcut s[], int slen);
|
||||
void blank_statusbar_refresh(void);
|
||||
void *nmalloc (size_t howmuch);
|
||||
void *mallocstrcpy(void *dest, void *src);
|
||||
void wrap_reset(void);
|
||||
void display_main_list(void);
|
||||
void nano_small_msg(void);
|
||||
@@ -111,6 +126,9 @@ void new_magicline(void);
|
||||
void splice_node(filestruct *begin, filestruct *new, filestruct *end);
|
||||
void null_at(char *data, int index);
|
||||
void page_up_center(void);
|
||||
void blank_edit(void);
|
||||
void search_init_globals(void);
|
||||
void replace_abort(void);
|
||||
|
||||
int do_writeout_void(void), do_exit(void), do_gotoline_void(void);
|
||||
int do_insertfile(void), do_search(void), page_up(void), page_down(void);
|
||||
@@ -124,3 +142,5 @@ int do_replace(void), do_help(void), do_enter_void(void);
|
||||
filestruct *copy_node(filestruct * src);
|
||||
filestruct *copy_filestruct(filestruct * src);
|
||||
filestruct *make_new_node(filestruct * prevnode);
|
||||
filestruct *findnextstr(int quiet, filestruct * begin,
|
||||
int beginx, char *needle);
|
||||
|
||||
584
search.c
584
search.c
@@ -23,6 +23,7 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include "config.h"
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
@@ -34,12 +35,9 @@
|
||||
#define _(string) (string)
|
||||
#endif
|
||||
|
||||
static char last_search[132]; /* Last string we searched for */
|
||||
static char last_replace[132]; /* Last replacement string */
|
||||
|
||||
/* Regular expression helper functions */
|
||||
|
||||
#ifdef _POSIX_VERSION
|
||||
#ifdef HAVE_REGEX_H
|
||||
void regexp_init(const char *regexp)
|
||||
{
|
||||
regcomp(&search_regexp, regexp, ISSET(CASE_SENSITIVE) ? 0 : REG_ICASE);
|
||||
@@ -53,6 +51,18 @@ void regexp_cleanup()
|
||||
}
|
||||
#endif
|
||||
|
||||
void search_init_globals(void)
|
||||
{
|
||||
if (last_search == NULL) {
|
||||
last_search = nmalloc(1);
|
||||
last_search[0] = 0;
|
||||
}
|
||||
if (last_replace == NULL) {
|
||||
last_replace = nmalloc(1);
|
||||
last_replace[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Set up the system variables for a search or replace. Returns -1 on
|
||||
abort, 0 on success, and 1 on rerun calling program
|
||||
Return -2 to run opposite program (searchg -> replace, replace -> search)
|
||||
@@ -61,54 +71,93 @@ void regexp_cleanup()
|
||||
*/
|
||||
int search_init(int replacing)
|
||||
{
|
||||
int i;
|
||||
char buf[BUFSIZ];
|
||||
int i = 0;
|
||||
char *buf;
|
||||
char *prompt, *reprompt = "";
|
||||
|
||||
if (last_search[0]) {
|
||||
snprintf(buf, BUFSIZ, " [%s]", last_search);
|
||||
} else {
|
||||
buf[0] = '\0';
|
||||
static char *backupstring = NULL;
|
||||
|
||||
search_init_globals();
|
||||
|
||||
buf = nmalloc(strlen(last_search) + 5);
|
||||
buf[0] = 0;
|
||||
|
||||
|
||||
/* Okay, fun time. backupstring is our holder for what is being
|
||||
returned from the statusq call. Using answer for this would be tricky.
|
||||
Here, if we're using PICO_MODE, we only want nano to put the
|
||||
old string back up as editable if it's not the same as last_search.
|
||||
|
||||
Otherwise, if we don't already have a backupstring, set it to
|
||||
last_search. */
|
||||
|
||||
if (ISSET(PICO_MODE)) {
|
||||
if (backupstring == NULL || !strcmp(backupstring, last_search))
|
||||
backupstring = mallocstrcpy(backupstring, "");
|
||||
}
|
||||
else if (backupstring == NULL)
|
||||
backupstring = mallocstrcpy(backupstring, last_search);
|
||||
|
||||
/* If using Pico messages, we do things the old fashioned way... */
|
||||
if (ISSET(PICO_MODE)) {
|
||||
if (last_search[0]) {
|
||||
|
||||
/* We use COLS / 3 here because we need to see more on the line */
|
||||
if (strlen(last_search) > COLS / 3) {
|
||||
snprintf(buf, COLS / 3 + 3, " [%s", last_search);
|
||||
sprintf(&buf[COLS / 3 + 2], "...]");
|
||||
} else
|
||||
sprintf(buf, " [%s]", last_search);
|
||||
} else {
|
||||
buf[0] = '\0';
|
||||
}
|
||||
}
|
||||
else
|
||||
strcpy(buf, "");
|
||||
|
||||
if (ISSET(USE_REGEXP) && ISSET(CASE_SENSITIVE))
|
||||
prompt = _("Case Sensitive Regexp Search%s%s");
|
||||
prompt = _("Case Sensitive Regexp Search%s%s");
|
||||
else if (ISSET(USE_REGEXP))
|
||||
prompt = _("Regexp Search%s%s");
|
||||
else
|
||||
if (ISSET(CASE_SENSITIVE))
|
||||
prompt = _("Case Sensitive Search%s%s");
|
||||
prompt = _("Regexp Search%s%s");
|
||||
else if (ISSET(CASE_SENSITIVE))
|
||||
prompt = _("Case Sensitive Search%s%s");
|
||||
else
|
||||
prompt = _("Search%s%s");
|
||||
prompt = _("Search%s%s");
|
||||
|
||||
if (replacing)
|
||||
reprompt = _(" (to replace)");
|
||||
|
||||
i = statusq(replacing ? replace_list : whereis_list,
|
||||
replacing ? REPLACE_LIST_LEN : WHEREIS_LIST_LEN, "",
|
||||
prompt, reprompt, buf);
|
||||
|
||||
/* This is now one simple call. It just does a lot */
|
||||
i = statusq(0, replacing ? replace_list : whereis_list,
|
||||
replacing ? REPLACE_LIST_LEN : WHEREIS_LIST_LEN, backupstring,
|
||||
prompt, reprompt, buf);
|
||||
|
||||
/* Cancel any search, or just return with no previous search */
|
||||
if ((i == -1) || (i < 0 && !last_search[0])) {
|
||||
statusbar(_("Search Cancelled"));
|
||||
reset_cursor();
|
||||
free(backupstring);
|
||||
backupstring = NULL;
|
||||
return -1;
|
||||
} else if (i == -2) { /* Same string */
|
||||
strncpy(answer, last_search, 132);
|
||||
#ifdef _POSIX_VERSION
|
||||
if (ISSET(USE_REGEXP))
|
||||
regexp_init(answer);
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (ISSET(USE_REGEXP))
|
||||
regexp_init(answer);
|
||||
#else
|
||||
;
|
||||
#endif
|
||||
} else if (i == 0) { /* They entered something new */
|
||||
strncpy(last_search, answer, 132);
|
||||
#ifdef _POSIX_VERSION
|
||||
if (ISSET(USE_REGEXP))
|
||||
regexp_init(answer);
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (ISSET(USE_REGEXP))
|
||||
regexp_init(answer);
|
||||
#endif
|
||||
/* Blow away last_replace because they entered a new search
|
||||
string....uh, right? =) */
|
||||
free(backupstring);
|
||||
backupstring = NULL;
|
||||
last_replace[0] = '\0';
|
||||
} else if (i == NANO_CASE_KEY) { /* They want it case sensitive */
|
||||
free(backupstring);
|
||||
backupstring = NULL;
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
|
||||
if (ISSET(CASE_SENSITIVE))
|
||||
UNSET(CASE_SENSITIVE);
|
||||
else
|
||||
@@ -116,82 +165,112 @@ int search_init(int replacing)
|
||||
|
||||
return 1;
|
||||
} else if (i == NANO_OTHERSEARCH_KEY) {
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return -2; /* Call the opposite search function */
|
||||
} else if (i == NANO_FROMSEARCHTOGOTO_KEY) {
|
||||
free(backupstring);
|
||||
backupstring = NULL;
|
||||
do_gotoline_void();
|
||||
return -3;
|
||||
} else { /* First line key, etc. */
|
||||
do_early_abort();
|
||||
free(backupstring);
|
||||
backupstring = NULL;
|
||||
return -3;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
filestruct *findnextstr(int quiet, filestruct * begin, char *needle)
|
||||
void not_found_msg(char *str)
|
||||
{
|
||||
if (strlen(str) <= COLS / 2)
|
||||
statusbar(_("\"%s\" not found"), str);
|
||||
else {
|
||||
char *foo = NULL;
|
||||
|
||||
foo = mallocstrcpy(foo, str);
|
||||
foo[COLS / 2] = 0;
|
||||
statusbar(_("\"%s...\" not found"), foo);
|
||||
|
||||
free(foo);
|
||||
}
|
||||
}
|
||||
|
||||
filestruct *findnextstr(int quiet, filestruct * begin, int beginx,
|
||||
char *needle)
|
||||
{
|
||||
filestruct *fileptr;
|
||||
char *searchstr, *found = NULL, *tmp;
|
||||
int past_editbot = 0;
|
||||
int past_editbot = 0, current_x_find = current_x;
|
||||
|
||||
fileptr = begin;
|
||||
fileptr = current;
|
||||
|
||||
searchstr = ¤t->data[current_x + 1];
|
||||
/* Look for searchstr until EOF */
|
||||
while (fileptr != NULL &&
|
||||
(found = strstrwrapper(searchstr, needle)) == NULL) {
|
||||
current_x_find++;
|
||||
|
||||
/* Are we searching the last line? (i.e. the line where search started) */
|
||||
if ((fileptr == begin) && (current_x_find < beginx))
|
||||
search_last_line = 1;
|
||||
|
||||
/* Make sure we haven't passed the end of the string */
|
||||
if (strlen(fileptr->data) < current_x_find)
|
||||
current_x_find--;
|
||||
|
||||
searchstr = &fileptr->data[current_x_find];
|
||||
|
||||
/* Look for needle in searchstr */
|
||||
while ((found = strstrwrapper(searchstr, needle)) == NULL) {
|
||||
|
||||
/* finished processing file, get out */
|
||||
if (search_last_line) {
|
||||
if (!quiet)
|
||||
not_found_msg(needle);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fileptr = fileptr->next;
|
||||
|
||||
if (!past_editbot && (fileptr == editbot))
|
||||
past_editbot = 1;
|
||||
|
||||
if (fileptr == begin)
|
||||
return NULL;
|
||||
/* EOF reached, wrap around once */
|
||||
if (fileptr == NULL) {
|
||||
fileptr = fileage;
|
||||
|
||||
if (fileptr != NULL)
|
||||
searchstr = fileptr->data;
|
||||
}
|
||||
|
||||
/* If we're not at EOF, we found an instance */
|
||||
if (fileptr != NULL) {
|
||||
current = fileptr;
|
||||
current_x = 0;
|
||||
for (tmp = fileptr->data; tmp != found; tmp++)
|
||||
current_x++;
|
||||
|
||||
if (past_editbot)
|
||||
edit_update(current, CENTER);
|
||||
placewewant = xplustabs();
|
||||
reset_cursor();
|
||||
} else { /* We're at EOF, go back to the top, once */
|
||||
|
||||
fileptr = fileage;
|
||||
|
||||
while (fileptr != begin->next &&
|
||||
(found = strstrwrapper(fileptr->data, needle)) == NULL)
|
||||
fileptr = fileptr->next;
|
||||
|
||||
if (fileptr == begin->next) {
|
||||
if (!quiet)
|
||||
statusbar(_("\"%s\" not found"), needle);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
else { /* We found something */
|
||||
current = fileptr;
|
||||
current_x = 0;
|
||||
for (tmp = fileptr->data; tmp != found; tmp++)
|
||||
current_x++;
|
||||
|
||||
edit_update(current, CENTER);
|
||||
reset_cursor();
|
||||
past_editbot = 1;
|
||||
|
||||
if (!quiet)
|
||||
statusbar(_("Search Wrapped"));
|
||||
}
|
||||
}
|
||||
|
||||
/* Original start line reached */
|
||||
if (fileptr == begin)
|
||||
search_last_line = 1;
|
||||
|
||||
searchstr = fileptr->data;
|
||||
}
|
||||
|
||||
/* We found an instance */
|
||||
current = fileptr;
|
||||
current_x = 0;
|
||||
for (tmp = fileptr->data; tmp != found; tmp++)
|
||||
current_x++;
|
||||
|
||||
/* Ensure we haven't wrap around again! */
|
||||
if ((search_last_line) && (current_x >= beginx)) {
|
||||
if (!quiet)
|
||||
not_found_msg(needle);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (past_editbot)
|
||||
edit_update(fileptr, CENTER);
|
||||
else
|
||||
update_line(current, current_x);
|
||||
|
||||
placewewant = xplustabs();
|
||||
reset_cursor();
|
||||
|
||||
return fileptr;
|
||||
}
|
||||
|
||||
@@ -200,12 +279,12 @@ void search_abort(void)
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
display_main_list();
|
||||
wrefresh(bottomwin);
|
||||
if (ISSET(MARK_ISSET))
|
||||
if (ISSET(MARK_ISSET))
|
||||
edit_refresh_clearok();
|
||||
|
||||
#ifdef _POSIX_VERSION
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (ISSET(REGEXP_COMPILED))
|
||||
regexp_cleanup();
|
||||
regexp_cleanup();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -216,22 +295,41 @@ int do_search(void)
|
||||
filestruct *fileptr = current;
|
||||
|
||||
wrap_reset();
|
||||
if ((i = search_init(0)) == -1) {
|
||||
i = search_init(0);
|
||||
switch (i) {
|
||||
case -1:
|
||||
current = fileptr;
|
||||
search_abort();
|
||||
return 0;
|
||||
} else if (i == -3) {
|
||||
case -3:
|
||||
search_abort();
|
||||
return 0;
|
||||
} else if (i == -2) {
|
||||
case -2:
|
||||
do_replace();
|
||||
return 0;
|
||||
} else if (i == 1) {
|
||||
case 1:
|
||||
do_search();
|
||||
search_abort();
|
||||
return 1;
|
||||
}
|
||||
findnextstr(0, current, answer);
|
||||
|
||||
/* The sneaky user deleted the previous search string */
|
||||
if (!ISSET(PICO_MODE) && !strcmp(answer, "")) {
|
||||
statusbar(_("Search Cancelled"));
|
||||
search_abort();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* If answer is now == "", then PICO_MODE is set. So, copy
|
||||
last_search into answer... */
|
||||
|
||||
if (!strcmp(answer, ""))
|
||||
answer = mallocstrcpy(answer, last_search);
|
||||
else
|
||||
last_search = mallocstrcpy(last_search, answer);
|
||||
|
||||
search_last_line = 0;
|
||||
findnextstr(0, current, current_x, answer);
|
||||
search_abort();
|
||||
return 1;
|
||||
}
|
||||
@@ -250,9 +348,10 @@ void replace_abort(void)
|
||||
does something different later, we can change it back. For now
|
||||
it's just a waste to duplicat code */
|
||||
search_abort();
|
||||
placewewant = xplustabs();
|
||||
}
|
||||
|
||||
#ifdef _POSIX_VERSION
|
||||
#ifdef HAVE_REGEX_H
|
||||
int replace_regexp(char *string, int create_flag)
|
||||
{
|
||||
/* split personality here - if create_flag is null, just calculate
|
||||
@@ -261,8 +360,7 @@ int replace_regexp(char *string, int create_flag)
|
||||
|
||||
char *c;
|
||||
int new_size = strlen(current->data) + 1;
|
||||
int search_match_count = regmatches[0].rm_eo -
|
||||
regmatches[0].rm_so;
|
||||
int search_match_count = regmatches[0].rm_eo - regmatches[0].rm_so;
|
||||
|
||||
new_size -= search_match_count;
|
||||
|
||||
@@ -271,75 +369,74 @@ int replace_regexp(char *string, int create_flag)
|
||||
|
||||
c = last_replace;
|
||||
while (*c) {
|
||||
if (*c != '\\') {
|
||||
if (create_flag)
|
||||
*string++=*c;
|
||||
c++;
|
||||
new_size++;
|
||||
} else {
|
||||
int num = (int)*(c+1) - (int)'0';
|
||||
if (num >= 1 && num <= 9) {
|
||||
if (*c != '\\') {
|
||||
if (create_flag)
|
||||
*string++ = *c;
|
||||
c++;
|
||||
new_size++;
|
||||
} else {
|
||||
int num = (int) *(c + 1) - (int) '0';
|
||||
if (num >= 1 && num <= 9) {
|
||||
|
||||
int i = regmatches[num].rm_so;
|
||||
int i = regmatches[num].rm_so;
|
||||
|
||||
if (num > search_regexp.re_nsub) {
|
||||
/* Ugh, they specified a subexpression that doesn't
|
||||
exist. */
|
||||
return -1;
|
||||
}
|
||||
if (num > search_regexp.re_nsub) {
|
||||
/* Ugh, they specified a subexpression that doesn't
|
||||
exist. */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Skip over the replacement expression */
|
||||
c+=2;
|
||||
/* Skip over the replacement expression */
|
||||
c += 2;
|
||||
|
||||
/* But add the length of the subexpression to new_size */
|
||||
new_size += regmatches[num].rm_eo - regmatches[num].rm_so;
|
||||
/* But add the length of the subexpression to new_size */
|
||||
new_size += regmatches[num].rm_eo - regmatches[num].rm_so;
|
||||
|
||||
/* And if create_flag is set, append the result of the
|
||||
* subexpression match to the new line */
|
||||
while (create_flag && i < regmatches[num].rm_eo )
|
||||
*string++=*(current->data + i++);
|
||||
|
||||
} else {
|
||||
if (create_flag)
|
||||
*string++=*c;
|
||||
c++;
|
||||
new_size++;
|
||||
}
|
||||
}
|
||||
/* And if create_flag is set, append the result of the
|
||||
* subexpression match to the new line */
|
||||
while (create_flag && i < regmatches[num].rm_eo)
|
||||
*string++ = *(current->data + i++);
|
||||
|
||||
} else {
|
||||
if (create_flag)
|
||||
*string++ = *c;
|
||||
c++;
|
||||
new_size++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (create_flag)
|
||||
*string = 0;
|
||||
*string = 0;
|
||||
|
||||
return new_size;
|
||||
}
|
||||
#endif
|
||||
|
||||
char *replace_line()
|
||||
|
||||
char *replace_line(void)
|
||||
{
|
||||
char *copy, *tmp;
|
||||
int new_line_size;
|
||||
int search_match_count;
|
||||
|
||||
/* Calculate size of new line */
|
||||
#ifdef _POSIX_VERSION
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (ISSET(USE_REGEXP)) {
|
||||
search_match_count = regmatches[0].rm_eo -
|
||||
regmatches[0].rm_so;
|
||||
new_line_size = replace_regexp(NULL, 0);
|
||||
/* If they specified an invalid subexpression in the replace
|
||||
* text, return NULL indicating an error */
|
||||
if (new_line_size < 0)
|
||||
return NULL;
|
||||
search_match_count = regmatches[0].rm_eo - regmatches[0].rm_so;
|
||||
new_line_size = replace_regexp(NULL, 0);
|
||||
/* If they specified an invalid subexpression in the replace
|
||||
* text, return NULL indicating an error */
|
||||
if (new_line_size < 0)
|
||||
return NULL;
|
||||
} else {
|
||||
#else
|
||||
{
|
||||
#endif
|
||||
search_match_count = strlen(last_search);
|
||||
new_line_size = strlen(current->data) - strlen(last_search) +
|
||||
strlen(last_replace) + 1;
|
||||
search_match_count = strlen(last_search);
|
||||
new_line_size = strlen(current->data) - strlen(last_search) +
|
||||
strlen(last_replace) + 1;
|
||||
}
|
||||
|
||||
|
||||
/* Create buffer */
|
||||
copy = nmalloc(new_line_size);
|
||||
|
||||
@@ -349,10 +446,10 @@ char *replace_line()
|
||||
|
||||
/* Replacement Text */
|
||||
if (!ISSET(USE_REGEXP))
|
||||
strcat(copy, last_replace);
|
||||
#ifdef _POSIX_VERSION
|
||||
strcat(copy, last_replace);
|
||||
#ifdef HAVE_REGEX_H
|
||||
else
|
||||
(void)replace_regexp(copy + current_x, 1);
|
||||
(void) replace_regexp(copy + current_x, 1);
|
||||
#endif
|
||||
|
||||
/* The tail of the original line */
|
||||
@@ -368,109 +465,75 @@ char *replace_line()
|
||||
return copy;
|
||||
}
|
||||
|
||||
/* Replace a string */
|
||||
int do_replace(void)
|
||||
int do_replace_loop(char *prevanswer, filestruct *begin, int *beginx,
|
||||
int wholewords, int *i)
|
||||
{
|
||||
int i, replaceall = 0, numreplaced = 0, beginx;
|
||||
filestruct *fileptr, *begin;
|
||||
char *copy, prevanswer[132] = "";
|
||||
int replaceall = 0, numreplaced = 0;
|
||||
filestruct *fileptr;
|
||||
char *copy;
|
||||
|
||||
if ((i = search_init(1)) == -1) {
|
||||
switch (*i) {
|
||||
case -1: /* Aborted enter */
|
||||
if (strcmp(last_replace, ""))
|
||||
answer = mallocstrcpy(answer, last_replace);
|
||||
statusbar(_("Replace Cancelled"));
|
||||
replace_abort();
|
||||
return 0;
|
||||
} else if (i == 1) {
|
||||
do_replace();
|
||||
return 1;
|
||||
} else if (i == -2) {
|
||||
do_search();
|
||||
return 0;
|
||||
} else if (i == -3) {
|
||||
replace_abort();
|
||||
return 0;
|
||||
}
|
||||
strncpy(prevanswer, answer, 132);
|
||||
|
||||
if (strcmp(last_replace, "")) { /* There's a previous replace str */
|
||||
i = statusq(replace_list, REPLACE_LIST_LEN, "",
|
||||
_("Replace with [%s]"), last_replace);
|
||||
|
||||
if (i == -1) { /* Aborted enter */
|
||||
strncpy(answer, last_replace, 132);
|
||||
statusbar(_("Replace Cancelled"));
|
||||
replace_abort();
|
||||
return 0;
|
||||
} else if (i == 0) /* They actually entered something */
|
||||
strncpy(last_replace, answer, 132);
|
||||
else if (i == NANO_CASE_KEY) { /* They asked for case sensitivity */
|
||||
if (ISSET(CASE_SENSITIVE))
|
||||
UNSET(CASE_SENSITIVE);
|
||||
else
|
||||
SET(CASE_SENSITIVE);
|
||||
|
||||
do_replace();
|
||||
return 0;
|
||||
} else if (i != -2 ) { /* First page, last page, for example could get here */
|
||||
|
||||
case 0: /* They actually entered something */
|
||||
break;
|
||||
default:
|
||||
if (*i != -2) { /* First page, last page, for example
|
||||
could get here */
|
||||
do_early_abort();
|
||||
replace_abort();
|
||||
return 0;
|
||||
}
|
||||
} else { /* last_search is empty */
|
||||
|
||||
i = statusq(replace_list, REPLACE_LIST_LEN, "", _("Replace with"));
|
||||
if (i == -1) {
|
||||
statusbar(_("Replace Cancelled"));
|
||||
reset_cursor();
|
||||
replace_abort();
|
||||
return 0;
|
||||
} else if (i == 0) /* They entered something new */
|
||||
strncpy(last_replace, answer, 132);
|
||||
else if (i == NANO_CASE_KEY) { /* They want it case sensitive */
|
||||
if (ISSET(CASE_SENSITIVE))
|
||||
UNSET(CASE_SENSITIVE);
|
||||
else
|
||||
SET(CASE_SENSITIVE);
|
||||
|
||||
do_replace();
|
||||
return 1;
|
||||
} else { /* First line key, etc. */
|
||||
|
||||
do_early_abort();
|
||||
replace_abort();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* save where we are */
|
||||
begin = current;
|
||||
beginx = current_x;
|
||||
if (ISSET(PICO_MODE) && !strcmp(answer, ""))
|
||||
answer = mallocstrcpy(answer, last_replace);
|
||||
|
||||
last_replace = mallocstrcpy(last_replace, answer);
|
||||
while (1) {
|
||||
|
||||
if (replaceall)
|
||||
fileptr = findnextstr(1, begin, prevanswer);
|
||||
else
|
||||
fileptr = findnextstr(0, begin, prevanswer);
|
||||
/* Sweet optimization by Rocco here */
|
||||
fileptr = findnextstr(replaceall, begin, *beginx, prevanswer);
|
||||
|
||||
/* No more matches. Done! */
|
||||
if (!fileptr)
|
||||
break;
|
||||
|
||||
/* Make sure only wholewords are found */
|
||||
if (wholewords)
|
||||
{
|
||||
/* start of line or previous character not a letter */
|
||||
if ((current_x == 0) || (!isalpha((int) fileptr->data[current_x-1])))
|
||||
{
|
||||
/* end of line or next character not a letter */
|
||||
if (((current_x + strlen(prevanswer)) == strlen(fileptr->data))
|
||||
|| (!isalpha((int) fileptr->data[current_x + strlen(prevanswer)])))
|
||||
;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
/* If we're here, we've found the search string */
|
||||
if (!replaceall)
|
||||
i = do_yesno(1, 1, _("Replace this instance?"));
|
||||
*i = do_yesno(1, 1, _("Replace this instance?"));
|
||||
|
||||
if (i > 0 || replaceall) { /* Yes, replace it!!!! */
|
||||
if (i == 2)
|
||||
if (*i > 0 || replaceall) { /* Yes, replace it!!!! */
|
||||
if (*i == 2)
|
||||
replaceall = 1;
|
||||
|
||||
copy = replace_line();
|
||||
if (!copy) {
|
||||
statusbar("Replace failed: unknown subexpression!");
|
||||
replace_abort();
|
||||
copy = replace_line();
|
||||
if (!copy) {
|
||||
statusbar(_("Replace failed: unknown subexpression!"));
|
||||
replace_abort();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Cleanup */
|
||||
free(current->data);
|
||||
@@ -479,15 +542,98 @@ int do_replace(void)
|
||||
/* Stop bug where we replace a substring of the replacement text */
|
||||
current_x += strlen(last_replace) - 1;
|
||||
|
||||
/* Adjust the original cursor position - COULD BE IMPROVED */
|
||||
if (search_last_line) {
|
||||
*beginx += strlen(last_replace) - strlen(last_search);
|
||||
|
||||
/* For strings that cross the search start/end boundary */
|
||||
/* Don't go outside of allocated memory */
|
||||
if (*beginx < 1)
|
||||
*beginx = 1;
|
||||
}
|
||||
|
||||
edit_refresh();
|
||||
set_modified();
|
||||
numreplaced++;
|
||||
} else if (i == -1) /* Abort, else do nothing and continue loop */
|
||||
} else if (*i == -1) /* Abort, else do nothing and continue loop */
|
||||
break;
|
||||
}
|
||||
|
||||
return numreplaced;
|
||||
}
|
||||
|
||||
/* Replace a string */
|
||||
int do_replace(void)
|
||||
{
|
||||
int i, numreplaced, beginx;
|
||||
filestruct *begin;
|
||||
char *prevanswer = NULL, *buf = NULL;
|
||||
|
||||
i = search_init(1);
|
||||
switch (i) {
|
||||
case -1:
|
||||
statusbar(_("Replace Cancelled"));
|
||||
replace_abort();
|
||||
return 0;
|
||||
case 1:
|
||||
do_replace();
|
||||
return 1;
|
||||
case -2:
|
||||
do_search();
|
||||
return 0;
|
||||
case -3:
|
||||
replace_abort();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Again, there was a previous string but they deleted it and hit enter */
|
||||
if (!ISSET(PICO_MODE) && !strcmp(answer, "")) {
|
||||
statusbar(_("Replace Cancelled"));
|
||||
replace_abort();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* If answer is now == "", then PICO_MODE is set. So, copy
|
||||
last_search into answer (and prevanswer)... */
|
||||
if (!strcmp(answer, "")) {
|
||||
answer = mallocstrcpy(answer, last_search);
|
||||
prevanswer = mallocstrcpy(prevanswer, last_search);
|
||||
} else {
|
||||
last_search = mallocstrcpy(last_search, answer);
|
||||
prevanswer = mallocstrcpy(prevanswer, answer);
|
||||
}
|
||||
|
||||
if (ISSET(PICO_MODE)) {
|
||||
buf = nmalloc(strlen(last_replace) + 5);
|
||||
if (strcmp(last_replace, "")) {
|
||||
if (strlen(last_replace) > (COLS / 3)) {
|
||||
strncpy(buf, last_replace, COLS / 3);
|
||||
sprintf(&buf[COLS / 3 - 1], "...");
|
||||
} else
|
||||
sprintf(buf, "%s", last_replace);
|
||||
|
||||
i = statusq(0, replace_list_2, REPLACE_LIST_2_LEN, "",
|
||||
_("Replace with [%s]"), buf);
|
||||
}
|
||||
else
|
||||
i = statusq(0, replace_list_2, REPLACE_LIST_2_LEN, "",
|
||||
_("Replace with"));
|
||||
}
|
||||
else
|
||||
i = statusq(0, replace_list_2, REPLACE_LIST_2_LEN, last_replace,
|
||||
_("Replace with"));
|
||||
|
||||
/* save where we are */
|
||||
begin = current;
|
||||
beginx = current_x + 1;
|
||||
|
||||
search_last_line = 0;
|
||||
|
||||
numreplaced = do_replace_loop(prevanswer, begin, &beginx, FALSE, &i);
|
||||
|
||||
/* restore where we were */
|
||||
current = begin;
|
||||
current_x = beginx;
|
||||
current_x = beginx - 1;
|
||||
renumber_all();
|
||||
edit_update(current, CENTER);
|
||||
print_replaced(numreplaced);
|
||||
@@ -510,7 +656,7 @@ int do_gotoline(long defline)
|
||||
line = defline;
|
||||
else { /* Ask for it */
|
||||
|
||||
j = statusq(goto_list, GOTO_LIST_LEN, "", _("Enter line number"));
|
||||
j = statusq(0, goto_list, GOTO_LIST_LEN, "", _("Enter line number"));
|
||||
if (j == -1) {
|
||||
statusbar(_("Aborted"));
|
||||
goto_abort();
|
||||
|
||||
139
utils.c
139
utils.c
@@ -82,13 +82,13 @@ char *strcasestr(char *haystack, char *needle)
|
||||
|
||||
char *strstrwrapper(char *haystack, char *needle)
|
||||
{
|
||||
#ifdef _POSIX_VERSION
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (ISSET(USE_REGEXP)) {
|
||||
int result=regexec(&search_regexp, haystack, 10, regmatches, 0);
|
||||
if (!result)
|
||||
return haystack+regmatches[0].rm_so;
|
||||
return 0;
|
||||
}
|
||||
int result = regexec(&search_regexp, haystack, 10, regmatches, 0);
|
||||
if (!result)
|
||||
return haystack + regmatches[0].rm_so;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
if (ISSET(CASE_SENSITIVE))
|
||||
return strstr(haystack, needle);
|
||||
@@ -114,13 +114,36 @@ void *nrealloc(void *ptr, size_t howmuch)
|
||||
void *r;
|
||||
|
||||
if (!(r = realloc(ptr, howmuch)))
|
||||
die("nano: realloc: out of memory!");
|
||||
die(_("nano: realloc: out of memory!"));
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Copy one malloced string to another pointer.
|
||||
|
||||
Should be used as dest = mallocstrcpy(dest, src);
|
||||
*/
|
||||
void *mallocstrcpy(void *dest, void *src)
|
||||
{
|
||||
|
||||
if (dest != NULL)
|
||||
free(dest);
|
||||
|
||||
if (src == NULL) {
|
||||
dest = NULL;
|
||||
return(dest);
|
||||
}
|
||||
|
||||
dest = nmalloc(strlen(src) + 1);
|
||||
strcpy(dest, src);
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
|
||||
/* Append a new magic-line to filebot */
|
||||
void new_magicline(void) {
|
||||
void new_magicline(void)
|
||||
{
|
||||
filebot->next = nmalloc(sizeof(filestruct));
|
||||
filebot->next->data = nmalloc(1);
|
||||
filebot->next->data[0] = '\0';
|
||||
@@ -130,3 +153,103 @@ void new_magicline(void) {
|
||||
filebot = filebot->next;
|
||||
totlines++;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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 || *pattern) {
|
||||
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)
|
||||
text++;
|
||||
break;
|
||||
}
|
||||
|
||||
if (*text) {
|
||||
pattern = retryPat;
|
||||
text = ++retryText;
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (pattern == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
378
winio.c
378
winio.c
@@ -192,7 +192,6 @@ void blank_edit(void)
|
||||
int i;
|
||||
for (i = 0; i <= editwinrows - 1; i++)
|
||||
mvwaddstr(edit, i, 0, hblank);
|
||||
wrefresh(edit);
|
||||
}
|
||||
|
||||
|
||||
@@ -218,51 +217,89 @@ void check_statblank(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the input from the kb, this should only be called from statusq */
|
||||
int nanogetstr(char *buf, char *def, shortcut s[], int slen, int start_x)
|
||||
/* Repaint the statusbar when getting a character in nanogetstr */
|
||||
void nanoget_repaint(char *buf, char *inputbuf, int x)
|
||||
{
|
||||
int kbinput = 0, j = 0, x = 0, xend;
|
||||
int x_left = 0;
|
||||
char inputstr[132], inputbuf[132] = "";
|
||||
int len = strlen(buf);
|
||||
int wid = COLS - len;
|
||||
|
||||
blank_statusbar();
|
||||
mvwaddstr(bottomwin, 0, 0, buf);
|
||||
if (strlen(def) > 0)
|
||||
waddstr(bottomwin, def);
|
||||
wrefresh(bottomwin);
|
||||
if (x <= COLS - 1) {
|
||||
/* Black magic */
|
||||
buf[len - 1] = ' ';
|
||||
|
||||
mvwaddstr(bottomwin, 0, 0, buf);
|
||||
waddnstr(bottomwin, inputbuf, wid);
|
||||
wmove(bottomwin, 0, (x % COLS));
|
||||
}
|
||||
else {
|
||||
/* Black magic */
|
||||
buf[len - 1] = '$';
|
||||
|
||||
mvwaddstr(bottomwin, 0, 0, buf);
|
||||
waddnstr(bottomwin, &inputbuf[wid * ((x - len) / (wid))], wid);
|
||||
wmove(bottomwin, 0, ((x - len) % wid) + len);
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the input from the kb, this should only be called from statusq */
|
||||
int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
||||
int start_x)
|
||||
{
|
||||
int kbinput = 0, j = 0, x = 0, xend;
|
||||
int x_left = 0, inputlen, tabbed = 0, shift = 0;
|
||||
char *inputbuf;
|
||||
|
||||
inputbuf = nmalloc(strlen(def) + 1);
|
||||
inputbuf[0] = 0;
|
||||
|
||||
x_left = strlen(buf);
|
||||
x = strlen(def) + x_left;
|
||||
|
||||
/* Get the input! */
|
||||
if (strlen(def) > 0) {
|
||||
strcpy(answer, def);
|
||||
if (strlen(def) > 0)
|
||||
strcpy(inputbuf, def);
|
||||
}
|
||||
|
||||
nanoget_repaint(buf, inputbuf, x);
|
||||
|
||||
/* Make sure any editor screen updates are displayed before getting input */
|
||||
wrefresh(edit);
|
||||
|
||||
while ((kbinput = wgetch(bottomwin)) != 13) {
|
||||
for (j = 0; j <= slen - 1; j++) {
|
||||
if (kbinput == s[j].val) {
|
||||
strcpy(answer, "");
|
||||
|
||||
/* We shouldn't discard the answer it gave, just because
|
||||
we hit a keystroke, GEEZ! */
|
||||
answer = mallocstrcpy(answer, inputbuf);
|
||||
free(inputbuf);
|
||||
return s[j].val;
|
||||
}
|
||||
}
|
||||
xend = strlen(buf) + strlen(inputbuf);
|
||||
|
||||
if (kbinput != '\t')
|
||||
tabbed = 0;
|
||||
|
||||
switch (kbinput) {
|
||||
/* Stuff we want to equate with <enter>, ASCII 13 */
|
||||
case 343:
|
||||
ungetch(13); /* Enter on iris-ansi $TERM, sometimes */
|
||||
break;
|
||||
#ifdef PDCURSES
|
||||
/* Stuff we want to ignore with PDCURSES */
|
||||
case 541:
|
||||
case 542:
|
||||
case 544:
|
||||
break;
|
||||
#endif
|
||||
case KEY_HOME:
|
||||
x = x_left;
|
||||
blank_statusbar();
|
||||
mvwaddstr(bottomwin, 0, 0, buf);
|
||||
waddstr(bottomwin, inputbuf);
|
||||
wmove(bottomwin, 0, x);
|
||||
nanoget_repaint(buf, inputbuf, x);
|
||||
break;
|
||||
case KEY_END:
|
||||
x = x_left + strlen(inputbuf);
|
||||
blank_statusbar();
|
||||
mvwaddstr(bottomwin, 0, 0, buf);
|
||||
waddstr(bottomwin, inputbuf);
|
||||
wmove(bottomwin, 0, x);
|
||||
nanoget_repaint(buf, inputbuf, x);
|
||||
break;
|
||||
case KEY_RIGHT:
|
||||
|
||||
@@ -277,19 +314,13 @@ int nanogetstr(char *buf, char *def, shortcut s[], int slen, int start_x)
|
||||
strlen(inputbuf) - (x - x_left) - 1);
|
||||
inputbuf[strlen(inputbuf) - 1] = 0;
|
||||
}
|
||||
blank_statusbar();
|
||||
mvwaddstr(bottomwin, 0, 0, buf);
|
||||
waddstr(bottomwin, inputbuf);
|
||||
wmove(bottomwin, 0, x);
|
||||
nanoget_repaint(buf, inputbuf, x);
|
||||
break;
|
||||
case NANO_CONTROL_K:
|
||||
case NANO_CONTROL_U:
|
||||
*inputbuf = 0;
|
||||
x = x_left;
|
||||
blank_statusbar();
|
||||
mvwaddstr(bottomwin, 0, 0, buf);
|
||||
waddstr(bottomwin, inputbuf);
|
||||
wmove(bottomwin, 0, x);
|
||||
nanoget_repaint(buf, inputbuf, x);
|
||||
break;
|
||||
case KEY_BACKSPACE:
|
||||
case KEY_DC:
|
||||
@@ -305,9 +336,19 @@ int nanogetstr(char *buf, char *def, shortcut s[], int slen, int start_x)
|
||||
inputbuf[strlen(inputbuf) - 1] = 0;
|
||||
}
|
||||
}
|
||||
blank_statusbar();
|
||||
mvwaddstr(bottomwin, 0, 0, buf);
|
||||
waddstr(bottomwin, inputbuf);
|
||||
if (x > strlen(buf))
|
||||
x--;
|
||||
nanoget_repaint(buf, inputbuf, x);
|
||||
break;
|
||||
case NANO_CONTROL_I:
|
||||
if (allowtabs) {
|
||||
shift = 0;
|
||||
inputbuf = input_tab(inputbuf, (x - x_left),
|
||||
&tabbed, &shift);
|
||||
x += shift;
|
||||
nanoget_repaint(buf, inputbuf, x);
|
||||
}
|
||||
break;
|
||||
case KEY_LEFT:
|
||||
if (x > strlen(buf))
|
||||
x--;
|
||||
@@ -323,17 +364,11 @@ int nanogetstr(char *buf, char *def, shortcut s[], int slen, int start_x)
|
||||
switch (kbinput = wgetch(edit)) {
|
||||
case 70:
|
||||
x = x_left + strlen(inputbuf);
|
||||
blank_statusbar();
|
||||
mvwaddstr(bottomwin, 0, 0, buf);
|
||||
waddstr(bottomwin, inputbuf);
|
||||
wmove(bottomwin, 0, x);
|
||||
nanoget_repaint(buf, inputbuf, x);
|
||||
break;
|
||||
case 72:
|
||||
x = x_left;
|
||||
blank_statusbar();
|
||||
mvwaddstr(bottomwin, 0, 0, buf);
|
||||
waddstr(bottomwin, inputbuf);
|
||||
wmove(bottomwin, 0, x);
|
||||
nanoget_repaint(buf, inputbuf, x);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -351,10 +386,7 @@ int nanogetstr(char *buf, char *def, shortcut s[], int slen, int start_x)
|
||||
break;
|
||||
case 49:
|
||||
x = x_left;
|
||||
blank_statusbar();
|
||||
mvwaddstr(bottomwin, 0, 0, buf);
|
||||
waddstr(bottomwin, inputbuf);
|
||||
wmove(bottomwin, 0, x);
|
||||
nanoget_repaint(buf, inputbuf, x);
|
||||
goto skip_126;
|
||||
case 51:
|
||||
if (strlen(inputbuf) > 0
|
||||
@@ -364,17 +396,11 @@ int nanogetstr(char *buf, char *def, shortcut s[], int slen, int start_x)
|
||||
strlen(inputbuf) - (x - x_left) - 1);
|
||||
inputbuf[strlen(inputbuf) - 1] = 0;
|
||||
}
|
||||
blank_statusbar();
|
||||
mvwaddstr(bottomwin, 0, 0, buf);
|
||||
waddstr(bottomwin, inputbuf);
|
||||
wmove(bottomwin, 0, x);
|
||||
nanoget_repaint(buf, inputbuf, x);
|
||||
goto skip_126;
|
||||
case 52:
|
||||
x = x_left + strlen(inputbuf);
|
||||
blank_statusbar();
|
||||
mvwaddstr(bottomwin, 0, 0, buf);
|
||||
waddstr(bottomwin, inputbuf);
|
||||
wmove(bottomwin, 0, x);
|
||||
nanoget_repaint(buf, inputbuf, x);
|
||||
goto skip_126;
|
||||
skip_126:
|
||||
nodelay(edit, TRUE);
|
||||
@@ -385,27 +411,24 @@ int nanogetstr(char *buf, char *def, shortcut s[], int slen, int start_x)
|
||||
break;
|
||||
}
|
||||
}
|
||||
blank_statusbar();
|
||||
mvwaddstr(bottomwin, 0, 0, buf);
|
||||
waddstr(bottomwin, inputbuf);
|
||||
wmove(bottomwin, 0, x);
|
||||
nanoget_repaint(buf, inputbuf, x);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
if (kbinput < 32)
|
||||
break;
|
||||
strcpy(inputstr, inputbuf);
|
||||
inputstr[x - strlen(buf)] = kbinput;
|
||||
strcpy(&inputstr[x - strlen(buf) + 1],
|
||||
&inputbuf[x - strlen(buf)]);
|
||||
strcpy(inputbuf, inputstr);
|
||||
|
||||
inputlen = strlen(inputbuf);
|
||||
inputbuf = nrealloc(inputbuf, inputlen + 2);
|
||||
|
||||
memmove(&inputbuf[x - x_left + 1],
|
||||
&inputbuf[x - x_left],
|
||||
inputlen - (x - x_left) + 1);
|
||||
inputbuf[x - x_left] = kbinput;
|
||||
|
||||
x++;
|
||||
|
||||
mvwaddstr(bottomwin, 0, 0, buf);
|
||||
waddstr(bottomwin, inputbuf);
|
||||
wmove(bottomwin, 0, x);
|
||||
|
||||
nanoget_repaint(buf, inputbuf, x);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("input \'%c\' (%d)\n"), kbinput, kbinput);
|
||||
#endif
|
||||
@@ -413,9 +436,13 @@ int nanogetstr(char *buf, char *def, shortcut s[], int slen, int start_x)
|
||||
wrefresh(bottomwin);
|
||||
}
|
||||
|
||||
strncpy(answer, inputbuf, 132);
|
||||
answer = mallocstrcpy(answer, inputbuf);
|
||||
free(inputbuf);
|
||||
|
||||
if (!strcmp(answer, ""))
|
||||
/* Now that the text is editable instead of bracketed, we have to
|
||||
check for answer == def, instead of answer == "" */
|
||||
if (((ISSET(PICO_MODE)) && !strcmp(answer, "")) ||
|
||||
((!ISSET(PICO_MODE)) && !strcmp(answer, def)))
|
||||
return -2;
|
||||
else
|
||||
return 0;
|
||||
@@ -462,7 +489,7 @@ void onekey(char *keystroke, char *desc)
|
||||
{
|
||||
char description[80];
|
||||
|
||||
snprintf(description, 13, " %-11s", desc);
|
||||
snprintf(description, 12, " %-10s", desc);
|
||||
wattron(bottomwin, A_REVERSE);
|
||||
waddstr(bottomwin, keystroke);
|
||||
wattroff(bottomwin, A_REVERSE);
|
||||
@@ -625,110 +652,106 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
|
||||
#ifndef NANO_SMALL
|
||||
/* There are quite a few cases that could take place, we'll deal
|
||||
* with them each in turn */
|
||||
if (ISSET(MARK_ISSET)
|
||||
if (ISSET(MARK_ISSET)
|
||||
&& !((fileptr->lineno > mark_beginbuf->lineno
|
||||
&& fileptr->lineno > current->lineno)
|
||||
|| (fileptr->lineno < mark_beginbuf->lineno
|
||||
&& fileptr->lineno < current->lineno)))
|
||||
{
|
||||
/* If we get here we are on a line that is atleast
|
||||
* partially selected. The lineno checks above determined
|
||||
* that */
|
||||
if (fileptr != mark_beginbuf && fileptr != current) {
|
||||
/* We are on a completely marked line, paint it all
|
||||
* inverse */
|
||||
&& fileptr->lineno > current->lineno)
|
||||
|| (fileptr->lineno < mark_beginbuf->lineno
|
||||
&& fileptr->lineno < current->lineno))) {
|
||||
/* If we get here we are on a line that is atleast
|
||||
* partially selected. The lineno checks above determined
|
||||
* that */
|
||||
if (fileptr != mark_beginbuf && fileptr != current) {
|
||||
/* We are on a completely marked line, paint it all
|
||||
* inverse */
|
||||
wattron(edit, A_REVERSE);
|
||||
mvwaddnstr(edit, yval, 0, fileptr->data, COLS);
|
||||
wattroff(edit, A_REVERSE);
|
||||
} else if (fileptr == mark_beginbuf && fileptr == current) {
|
||||
/* Special case, we're still on the same line we started
|
||||
* marking -- so we call our helper function */
|
||||
if (virt_cur_x < virt_mark_beginx) {
|
||||
/* To the right of us is marked */
|
||||
add_marked_sameline(virt_cur_x, virt_mark_beginx,
|
||||
fileptr, yval, virt_cur_x, this_page);
|
||||
} else {
|
||||
/* To the left of us is marked */
|
||||
add_marked_sameline(virt_mark_beginx, virt_cur_x,
|
||||
fileptr, yval, virt_cur_x, this_page);
|
||||
}
|
||||
} else if (fileptr == mark_beginbuf) {
|
||||
/*
|
||||
* we're updating the line that was first marked
|
||||
* but we're not currently on it. So we want to
|
||||
* figur out which half to invert based on our
|
||||
* relative line numbers.
|
||||
*
|
||||
* i.e. If we're above the "beginbuf" line, we want to
|
||||
* mark the left side. Otherwise we're below, so we
|
||||
* mark the right
|
||||
*/
|
||||
int target;
|
||||
|
||||
if (mark_beginbuf->lineno > current->lineno)
|
||||
wattron(edit, A_REVERSE);
|
||||
mvwaddnstr(edit, yval, 0, fileptr->data, COLS);
|
||||
|
||||
target =
|
||||
(virt_mark_beginx <
|
||||
COLS - 1) ? virt_mark_beginx : COLS - 1;
|
||||
|
||||
mvwaddnstr(edit, yval, 0, fileptr->data, target);
|
||||
|
||||
if (mark_beginbuf->lineno < current->lineno)
|
||||
wattron(edit, A_REVERSE);
|
||||
else
|
||||
wattroff(edit, A_REVERSE);
|
||||
} else if (fileptr == mark_beginbuf && fileptr == current) {
|
||||
/* Special case, we're still on the same line we started
|
||||
* marking -- so we call our helper function */
|
||||
if (virt_cur_x < virt_mark_beginx) {
|
||||
/* To the right of us is marked */
|
||||
add_marked_sameline(virt_cur_x, virt_mark_beginx,
|
||||
fileptr, yval, virt_cur_x,
|
||||
this_page);
|
||||
} else {
|
||||
/* To the left of us is marked */
|
||||
add_marked_sameline(virt_mark_beginx, virt_cur_x,
|
||||
fileptr, yval, virt_cur_x,
|
||||
this_page);
|
||||
}
|
||||
} else if (fileptr == mark_beginbuf) {
|
||||
/*
|
||||
* we're updating the line that was first marked
|
||||
* but we're not currently on it. So we want to
|
||||
* figur out which half to invert based on our
|
||||
* relative line numbers.
|
||||
*
|
||||
* i.e. If we're above the "beginbuf" line, we want to
|
||||
* mark the left side. Otherwise we're below, so we
|
||||
* mark the right
|
||||
*/
|
||||
int target;
|
||||
|
||||
if (mark_beginbuf->lineno > current->lineno)
|
||||
wattron(edit, A_REVERSE);
|
||||
target = (COLS - 1) - virt_mark_beginx;
|
||||
if (target < 0)
|
||||
target = 0;
|
||||
|
||||
target =
|
||||
(virt_mark_beginx <
|
||||
COLS - 1) ? virt_mark_beginx : COLS - 1;
|
||||
mvwaddnstr(edit, yval, virt_mark_beginx,
|
||||
&fileptr->data[virt_mark_beginx], target);
|
||||
|
||||
mvwaddnstr(edit, yval, 0, fileptr->data, target);
|
||||
if (mark_beginbuf->lineno < current->lineno)
|
||||
wattroff(edit, A_REVERSE);
|
||||
|
||||
if (mark_beginbuf->lineno < current->lineno)
|
||||
wattron(edit, A_REVERSE);
|
||||
else
|
||||
wattroff(edit, A_REVERSE);
|
||||
} else if (fileptr == current) {
|
||||
/* we're on the cursors line, but it's not the first
|
||||
* one we marked. Similar to the previous logic. */
|
||||
int this_page_start = get_page_start_virtual(this_page),
|
||||
this_page_end = get_page_end_virtual(this_page);
|
||||
|
||||
target = (COLS - 1) - virt_mark_beginx;
|
||||
if (target < 0)
|
||||
target = 0;
|
||||
if (mark_beginbuf->lineno < current->lineno)
|
||||
wattron(edit, A_REVERSE);
|
||||
|
||||
mvwaddnstr(edit, yval, virt_mark_beginx,
|
||||
&fileptr->data[virt_mark_beginx], target);
|
||||
if (virt_cur_x > COLS - 2) {
|
||||
mvwaddnstr(edit, yval, 0,
|
||||
&fileptr->data[this_page_start],
|
||||
virt_cur_x - this_page_start);
|
||||
} else {
|
||||
mvwaddnstr(edit, yval, 0, fileptr->data, virt_cur_x);
|
||||
}
|
||||
|
||||
if (mark_beginbuf->lineno < current->lineno)
|
||||
wattroff(edit, A_REVERSE);
|
||||
if (mark_beginbuf->lineno > current->lineno)
|
||||
wattron(edit, A_REVERSE);
|
||||
else
|
||||
wattroff(edit, A_REVERSE);
|
||||
|
||||
} else if (fileptr == current) {
|
||||
/* we're on the cursors line, but it's not the first
|
||||
* one we marked. Similar to the previous logic. */
|
||||
int this_page_start = get_page_start_virtual(this_page),
|
||||
this_page_end = get_page_end_virtual(this_page);
|
||||
if (virt_cur_x > COLS - 2)
|
||||
mvwaddnstr(edit, yval, virt_cur_x - this_page_start,
|
||||
&fileptr->data[virt_cur_x],
|
||||
this_page_end - virt_cur_x);
|
||||
else
|
||||
mvwaddnstr(edit, yval, virt_cur_x,
|
||||
&fileptr->data[virt_cur_x], COLS - virt_cur_x);
|
||||
|
||||
if (mark_beginbuf->lineno < current->lineno)
|
||||
wattron(edit, A_REVERSE);
|
||||
|
||||
if (virt_cur_x > COLS - 2) {
|
||||
mvwaddnstr(edit, yval, 0,
|
||||
&fileptr->data[this_page_start],
|
||||
virt_cur_x - this_page_start);
|
||||
} else {
|
||||
mvwaddnstr(edit, yval, 0, fileptr->data, virt_cur_x);
|
||||
}
|
||||
|
||||
if (mark_beginbuf->lineno > current->lineno)
|
||||
wattron(edit, A_REVERSE);
|
||||
else
|
||||
wattroff(edit, A_REVERSE);
|
||||
|
||||
if (virt_cur_x > COLS - 2)
|
||||
mvwaddnstr(edit, yval, virt_cur_x - this_page_start,
|
||||
&fileptr->data[virt_cur_x],
|
||||
this_page_end - virt_cur_x);
|
||||
else
|
||||
mvwaddnstr(edit, yval, virt_cur_x,
|
||||
&fileptr->data[virt_cur_x],
|
||||
COLS - virt_cur_x);
|
||||
|
||||
if (mark_beginbuf->lineno > current->lineno)
|
||||
wattroff(edit, A_REVERSE);
|
||||
if (mark_beginbuf->lineno > current->lineno)
|
||||
wattroff(edit, A_REVERSE);
|
||||
}
|
||||
|
||||
} else
|
||||
#endif
|
||||
/* Just paint the string (no mark on this line) */
|
||||
/* Just paint the string (no mark on this line) */
|
||||
mvwaddnstr(edit, yval, 0, &fileptr->data[start],
|
||||
get_page_end_virtual(this_page) - start);
|
||||
}
|
||||
@@ -780,9 +803,8 @@ void update_line(filestruct * fileptr, int index)
|
||||
virt_cur_x--;
|
||||
if (i < mark_beginx)
|
||||
virt_mark_beginx--;
|
||||
}
|
||||
else if (realdata[i] >= 1 && realdata[i] <= 26) {
|
||||
/* Treat control characters as ^letter */
|
||||
} else if (realdata[i] >= 1 && realdata[i] <= 26) {
|
||||
/* Treat control characters as ^letter */
|
||||
fileptr->data[pos++] = '^';
|
||||
fileptr->data[pos++] = realdata[i] + 64;
|
||||
} else {
|
||||
@@ -848,12 +870,10 @@ void edit_refresh(void)
|
||||
}
|
||||
/* If noloop == 1, then we already did an edit_update without finishing
|
||||
this function. So we don't run edit_update again */
|
||||
if (!currentcheck && !noloop) /* Then current has run off the screen... */
|
||||
{
|
||||
if (!currentcheck && !noloop) { /* Then current has run off the screen... */
|
||||
edit_update(current, CENTER);
|
||||
noloop = 1;
|
||||
}
|
||||
else if (noloop)
|
||||
} else if (noloop)
|
||||
noloop = 0;
|
||||
|
||||
if (lines <= editwinrows - 1)
|
||||
@@ -890,8 +910,7 @@ void edit_update(filestruct * fileptr, int topmidbot)
|
||||
return;
|
||||
|
||||
temp = fileptr;
|
||||
if (topmidbot == 2)
|
||||
;
|
||||
if (topmidbot == 2);
|
||||
else if (topmidbot == 0)
|
||||
for (i = 0; i <= editwinrows - 1 && temp->prev != NULL; i++)
|
||||
temp = temp->prev;
|
||||
@@ -933,8 +952,10 @@ void update_cursor(void)
|
||||
* global. Returns -1 on aborted enter, -2 on a blank string, and 0
|
||||
* otherwise, the valid shortcut key caught, Def is any editable text we
|
||||
* want to put up by default.
|
||||
*
|
||||
* New arg tabs tells whether or not to allow tab completion.
|
||||
*/
|
||||
int statusq(shortcut s[], int slen, char *def, char *msg, ...)
|
||||
int statusq(int tabs, shortcut s[], int slen, char *def, char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char foo[133];
|
||||
@@ -948,7 +969,7 @@ int statusq(shortcut s[], int slen, char *def, char *msg, ...)
|
||||
strncat(foo, ": ", 132);
|
||||
|
||||
wattron(bottomwin, A_REVERSE);
|
||||
ret = nanogetstr(foo, def, s, slen, (strlen(foo) + 3));
|
||||
ret = nanogetstr(tabs, foo, def, s, slen, (strlen(foo) + 3));
|
||||
wattroff(bottomwin, A_REVERSE);
|
||||
|
||||
switch (ret) {
|
||||
@@ -962,7 +983,7 @@ int statusq(shortcut s[], int slen, char *def, char *msg, ...)
|
||||
case NANO_CANCEL_KEY:
|
||||
return -1;
|
||||
default:
|
||||
blank_statusbar_refresh();
|
||||
blank_statusbar();
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
@@ -1090,6 +1111,7 @@ int total_refresh(void)
|
||||
clearok(topwin, FALSE);
|
||||
clearok(bottomwin, FALSE);
|
||||
edit_refresh();
|
||||
titlebar();
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1193,7 +1215,8 @@ int do_help(void)
|
||||
for (i = 1; i < page; i++) {
|
||||
row = 0;
|
||||
j = 0;
|
||||
while (row < editwinrows && *ptr != '\0') {
|
||||
|
||||
while (row < editwinrows - 2 && *ptr != '\0') {
|
||||
if (*ptr == '\n' || j == COLS - 5) {
|
||||
j = 0;
|
||||
row++;
|
||||
@@ -1203,6 +1226,10 @@ int do_help(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (i > 1) {
|
||||
|
||||
}
|
||||
|
||||
i = 0;
|
||||
j = 0;
|
||||
while (i < editwinrows && *ptr != '\0') {
|
||||
@@ -1231,7 +1258,6 @@ int do_help(void)
|
||||
continue;
|
||||
}
|
||||
} while ((kbinput = wgetch(edit)) != NANO_EXIT_KEY);
|
||||
|
||||
if (no_help_flag) {
|
||||
werase(bottomwin);
|
||||
wrefresh(bottomwin);
|
||||
@@ -1289,10 +1315,10 @@ void dump_buffer_reverse(filestruct * inptr)
|
||||
}
|
||||
|
||||
/* Fix editbot based on the assumption that edittop is correct */
|
||||
void fix_editbot(void) {
|
||||
void fix_editbot(void)
|
||||
{
|
||||
int i;
|
||||
editbot = edittop;
|
||||
for(i = 0; (i <= editwinrows - 1) && (editbot->next != NULL)
|
||||
&& (editbot != filebot); i++, editbot = editbot->next);
|
||||
for (i = 0; (i <= editwinrows - 1) && (editbot->next != NULL)
|
||||
&& (editbot != filebot); i++, editbot = editbot->next);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user