Compare commits
140 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7bf2509a70 | ||
|
|
9c23a44907 | ||
|
|
7dd7768bb6 | ||
|
|
df59ae64e9 | ||
|
|
b439622d3a | ||
|
|
8083827088 | ||
|
|
db4c08e8f9 | ||
|
|
2fa11b836d | ||
|
|
86c9676f7a | ||
|
|
81cbfad086 | ||
|
|
2084acc37d | ||
|
|
3795e5fc76 | ||
|
|
08893e08e3 | ||
|
|
feebeb90ea | ||
|
|
9b8b370132 | ||
|
|
8c9c572309 | ||
|
|
33088740da | ||
|
|
1fa00797ef | ||
|
|
6859079638 | ||
|
|
773623c066 | ||
|
|
0567bfe14c | ||
|
|
8c8d370470 | ||
|
|
22ec59a073 | ||
|
|
f3e80adbe4 | ||
|
|
7bf7274d9f | ||
|
|
7b409bd6b6 | ||
|
|
dc57bbab7a | ||
|
|
6d0aa9f3b7 | ||
|
|
e59fc829d8 | ||
|
|
a1a6a7fda6 | ||
|
|
107864058b | ||
|
|
2cd72b6aa2 | ||
|
|
3a24f3f780 | ||
|
|
347c184b6f | ||
|
|
48ebb81fb2 | ||
|
|
abf22a8fb2 | ||
|
|
e7ee63f271 | ||
|
|
fa0c6963ce | ||
|
|
878ced39bf | ||
|
|
b3655b4c5e | ||
|
|
fac011a5e1 | ||
|
|
9f4e583e52 | ||
|
|
beead28619 | ||
|
|
eb94b9edcd | ||
|
|
76e291beee | ||
|
|
ab23fbd019 | ||
|
|
26f4603a89 | ||
|
|
2476ebd31b | ||
|
|
482d165ab5 | ||
|
|
02a24525c5 | ||
|
|
cdcac1ccc2 | ||
|
|
633dab0340 | ||
|
|
14a0e55bc9 | ||
|
|
8fd15e2672 | ||
|
|
19aad376ef | ||
|
|
c17aa63200 | ||
|
|
9a39789cb6 | ||
|
|
03260b40fa | ||
|
|
58a3353307 | ||
|
|
4c6438be6f | ||
|
|
780f3205f1 | ||
|
|
8a9863736b | ||
|
|
cdbabfd4fc | ||
|
|
7d589ca5fa | ||
|
|
ca1a82ecab | ||
|
|
f57b886bed | ||
|
|
22262441c7 | ||
|
|
b97bedafe8 | ||
|
|
31b2b81e53 | ||
|
|
5e4b1085b4 | ||
|
|
b516d8e3f3 | ||
|
|
66c33b8731 | ||
|
|
dc2ca88718 | ||
|
|
a2d849bcd4 | ||
|
|
14b0accd81 | ||
|
|
b26cb39296 | ||
|
|
e10f389e9c | ||
|
|
ad3f478452 | ||
|
|
59121a9aaf | ||
|
|
92f5fdc230 | ||
|
|
386e0518b5 | ||
|
|
1c27d3e875 | ||
|
|
7fdbd05b41 | ||
|
|
d948edc4f3 | ||
|
|
222a0863fa | ||
|
|
1e36fd8f69 | ||
|
|
f727da88b0 | ||
|
|
73889487f0 | ||
|
|
200b27e33e | ||
|
|
10398ade49 | ||
|
|
1b3381bee8 | ||
|
|
2bef18210a | ||
|
|
352801cf4c | ||
|
|
c1917e7b66 | ||
|
|
acf4b16b72 | ||
|
|
475f96d0b3 | ||
|
|
a951f21c59 | ||
|
|
26a86e350c | ||
|
|
9519eb0c88 | ||
|
|
759d3523fc | ||
|
|
56214c6aef | ||
|
|
5050d35e87 | ||
|
|
ecc1933c14 | ||
|
|
c1968a0795 | ||
|
|
99e30e1bee | ||
|
|
ce78c1eb88 | ||
|
|
beb5497530 | ||
|
|
96bd4e4ed8 | ||
|
|
8d990b5e8b | ||
|
|
6f6aba0350 | ||
|
|
3e3ae94084 | ||
|
|
0319176f2d | ||
|
|
960a8635bc | ||
|
|
995177f2d9 | ||
|
|
8fa1e28681 | ||
|
|
7004c289f8 | ||
|
|
6414b40d3d | ||
|
|
91841895e0 | ||
|
|
5d25f06e3b | ||
|
|
128e95ffdc | ||
|
|
e09cd1d4d1 | ||
|
|
e1f1452eb5 | ||
|
|
b6c89eed9f | ||
|
|
0357c4d552 | ||
|
|
68532c37ef | ||
|
|
ff98983602 | ||
|
|
6c49b3f32c | ||
|
|
4d69d4313f | ||
|
|
90bbdd3c40 | ||
|
|
d1625cdfe6 | ||
|
|
c6c35eafc8 | ||
|
|
b1aaa27c10 | ||
|
|
2cde0a24d4 | ||
|
|
7dd1869713 | ||
|
|
96eef7332b | ||
|
|
9b3c7e8be7 | ||
|
|
c2acb81782 | ||
|
|
c1049aced1 | ||
|
|
372b1a0939 | ||
|
|
47a2686e41 |
@@ -1,10 +1,14 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
aclocal.m4
|
||||
confdefs.h
|
||||
config.cache
|
||||
config.h
|
||||
config.h.in
|
||||
config.log
|
||||
config.status
|
||||
configure
|
||||
nano
|
||||
nano.info
|
||||
stamp-h
|
||||
stamp-h1
|
||||
|
||||
11
BUGS
11
BUGS
@@ -117,7 +117,16 @@
|
||||
- Blank lines are not kept when cutting with -k (discovered by Rocco)
|
||||
(61) [FIXED].
|
||||
- Nano will not suspend properly inside of mutt (62) [FIXED].
|
||||
|
||||
- When switching from Pico mode to normal mode, the previous search is
|
||||
not displayed until cancelling the search (63) [FIXED].
|
||||
- If you change search options but don't change the search string in
|
||||
normal mode, hitting enter causes the search/replace to abort (64)
|
||||
(Jordi Mallach) [FIXED].
|
||||
- Cutting one line of text causes the screen to recenter the line
|
||||
(reported and fixed by David Lawrence Ramsey) (65) [FIXED].
|
||||
- When cutting marked text including the bottom of the file, a new
|
||||
"magic line" is not created" (reported by David Lawrence
|
||||
Ramsey, fixed by David Lawrence Ramsey & Chris) (66) [FIXED].
|
||||
|
||||
** Open BUGS **
|
||||
|
||||
|
||||
213
ChangeLog
213
ChangeLog
@@ -1,3 +1,216 @@
|
||||
nano-1.1.4 - 12/11/2001
|
||||
- General
|
||||
- Preliminary syntax highlighting support. New functions
|
||||
colortoint() and parse_color() in rcfile.c, new code in
|
||||
edit_add() in winio.c to actually do the highlighting. It's
|
||||
not even close to pretty yet :P
|
||||
- Many int/long alignments (David Lawrence Ramsey).
|
||||
- files.c:
|
||||
- Fixes for tab completion and screen refresh (David Lawrence
|
||||
Ramsey).
|
||||
add_open_file()
|
||||
- Get rid of unsetting MARK_ISSET because otherwise writing
|
||||
marked text will automatically unset the marker with
|
||||
multibuffer enabled.
|
||||
- global.c:
|
||||
- Define currshortcut and currslen when either DISABLE_MOUSE
|
||||
or DISABLE_HELP or DISABLE_BROWSER is not defined (Silvan
|
||||
Minghetti).
|
||||
- nano.c:
|
||||
main()
|
||||
- Add Esc-[-[IGL] keys for FreeBSD Console (PgUp,PgDn,Insert).
|
||||
- Added better Hurd support for function keys (Alt-V,U,9,@,F).
|
||||
signal_init()
|
||||
- do SIG_IGN for the SIGTSTP sigaction regardless of whether
|
||||
we have _POSIX_VDISABLE or not (more Hurd fixes)
|
||||
help_init()
|
||||
- Typo fixes and additions to the new help texts.
|
||||
do_curpos()
|
||||
- Now takes arg for constant updating to always show the cursor
|
||||
position (David Lawrence Ramsey).
|
||||
do_wrap()
|
||||
- Many fixes (David Lawrence Ramsey).
|
||||
do_spell()
|
||||
- Dont prompt for replace if we don't change the word in
|
||||
question (Rocco Corsi).
|
||||
- po/de.po:
|
||||
- German translation updates (Karl Eichwalder).
|
||||
- po/ru.po:
|
||||
- Russian translation updates (Sergey A. Ribalchenko).
|
||||
- po/sv.po:
|
||||
- Swedish translation updates (Christian Rose).
|
||||
- po/da.po:
|
||||
- Danish translation updates (Keld Simonse).
|
||||
- po/es.po:
|
||||
- Spanish translation updates (Jordi).
|
||||
- po/fr.po:
|
||||
- French translation updates (Michel Robitaille).
|
||||
- m4/gettext.m4:
|
||||
- diff against mutt 1.2.5's gettext.m4.
|
||||
|
||||
nano-1.1.3 - 10/26/2001
|
||||
- General
|
||||
- Finally wrote function-specific help mode. Changes to
|
||||
nano.c:help_init() and winio.c:do_help(). Changed
|
||||
currshortcut and currslen #ifdefs to depend on both
|
||||
DISABLE_HELP and DISABLE_MOUSE being defined to not
|
||||
include. Changed all the shortcuts and lengths.
|
||||
- Fixed null_at to ACTUALLY DO SOMETHING with its arg. Again,
|
||||
this was causing nasty errors if the call to nrealloc moved
|
||||
where the data was located.
|
||||
- Changed header comments to say "version 2" instead of "version
|
||||
1" as the COPYING file is actually version 2 of the GPL (bug
|
||||
noticed by Jordi Mallach).
|
||||
- cut.c:
|
||||
do_cut_text()
|
||||
- Check to see whether marked text is contained within edit
|
||||
window and if so only do an edit_refresh (variable dontupdate
|
||||
replaces cuttingpartialline).
|
||||
do_uncut_text()
|
||||
- Similar display fixes (David Lawrence Ramsey).
|
||||
- faq.html
|
||||
- Removed nano-editor.org FTP site address [deprecated] and added
|
||||
the GNU one.
|
||||
- files.c:
|
||||
- Added status messages for converted DOS and Mac files.
|
||||
People should know that their file wasnt normally formatted.
|
||||
load_file()
|
||||
- Status message when trying to load an already loaded file with multiple
|
||||
buffers (David Lawrence Ramsey).
|
||||
read_file()
|
||||
- Get rid of useless linetemp variable and name num_lines int
|
||||
(David Lawrence Ramsey).
|
||||
- nano.c:
|
||||
- New function do_prev_word, similar to do_next_word. Hard coded as
|
||||
Alt-space, as next word is hard coded as control-space. Fixed
|
||||
goofy logic setting x pos to value of last line when hitting the
|
||||
beginning of first line, prog should simply abort. Added
|
||||
the #ifdefs around the code in main().
|
||||
- nano.h:
|
||||
- Additional #define, SMALL_TOO to determine how long
|
||||
MAIN_LIST_LEN is. We need this because of the find matching
|
||||
bracket code.
|
||||
main()
|
||||
- Moved #ifndef NANO_SMALL down past the case 0: line so
|
||||
control-space doesn't insert a \0 (ack!)
|
||||
- rcfile.c:
|
||||
- Fix incorrect number of rc options (David Lawrence Ramsey).
|
||||
- po/sv.po:
|
||||
- Updated Swedish translation (Christian Rose).
|
||||
- po/da.po:
|
||||
- Updated Danish translation (Keld Simonsen).
|
||||
- po/es.po:
|
||||
- Style updates to Spanish translation (Santiago Vila).
|
||||
- po/ru.po, uk.po:
|
||||
- Updated Russian and Ukrainian translation (Sergey A. Ribalchenko).
|
||||
|
||||
nano-1.1.2 - 10/03/2001
|
||||
- General
|
||||
- Added BUGS #63 & 64. Fixes in search_init() and nanogetstr(),
|
||||
new flag CLEAR_BACKUPSTRING because there's no easy way to
|
||||
clear the backupstring without making it global (messy), so we
|
||||
use a flag instead (just as messy?)
|
||||
- --enable-tiny now leaves out the Auto Indent code, do you really
|
||||
need that on a bootdisk? =-)
|
||||
- New flag -o, --operatingdir, similar to Pico's -o mode. New
|
||||
function check_operating_dir(), changes to load_file (arg),
|
||||
open_file_dup_search (arg), new function do_gotopos for -F
|
||||
(David Lawrence Ramsey).
|
||||
- Code to read/write dos formatted files. Massive amounts of
|
||||
new code in read_line and write_file. New cmdline flag
|
||||
(-D --dos) to automatically write the file in DOS format,
|
||||
regardless of the original format.
|
||||
- Mac file writing supported too. Flag -M, --mac. Toggle
|
||||
Meta-O (MacOS? OS-X? =-)
|
||||
- New smooth scroll code by Ken Tyler. New flag -S, --smooth,
|
||||
changes to page_up() and page_down(). Many fixes to paging by
|
||||
David Lawrence Ramsey.
|
||||
- Bracket (brace, parens, etc) matching code by Ken Tyler.
|
||||
New functions do_find_bracket(), changes to findnextstr(),
|
||||
command is Meta-] (hope you dont mind since I already sold off
|
||||
Meta-O to the MacOS file code Ken...) Fixes to bracket_msg
|
||||
by DLR.
|
||||
- Call do_gotopos from do_alt_spell() to keep position
|
||||
consistent when invoking alt speller (DLR).
|
||||
- Readded DISABLE_CURPOS because in certain instances (like
|
||||
all the "Search Wrapped" lines) the cursor position will
|
||||
be different yet we don't want the cursor position displayed.
|
||||
- Take control-space out of -tiny build, unneeded.
|
||||
- cut.c:
|
||||
cut_marked_segment()
|
||||
- Add magic line when cutting a selection including filebot
|
||||
(discovered by DLR, fixed by DLR & Chris, fixes BUG #66).
|
||||
do_cut_text()
|
||||
- Don't recenter the line when cutting one line (DLR) (Bug #65).
|
||||
- faq.html:
|
||||
- Notes about the Free Translation Project.
|
||||
- Debian additions.
|
||||
- files.c:
|
||||
do_writeout()
|
||||
- Expanded strings to not use %s and ?: to determine
|
||||
write/append string to be nice to translators.
|
||||
new_file()
|
||||
- Initialize totsize (DLR).
|
||||
- nano.c:
|
||||
main()
|
||||
- Added var constcheck as a CRC-like check of whether cursor
|
||||
pos has changed and if so update the pos with -c.
|
||||
- Many tweaks and changes from numerics to char equivs
|
||||
(David Lawrence Ramsey).
|
||||
- Fix the KEY_IC being undefined when using slang.
|
||||
do_mouse()
|
||||
- Send 27 when the menu item clicked is an alt key seq... The
|
||||
lines aren't lined up since the menu width changed though,
|
||||
this breakage depends on whether the new widths will be kept
|
||||
or not (FEEDBACK!!)
|
||||
- Change k based on currslen to allow the new widths in
|
||||
bottombars().
|
||||
do_wrap()
|
||||
- Fixes for Pico incompatibility in cases 2b and 2c.
|
||||
(David Lawrence Ramsey).
|
||||
global_init()
|
||||
- New arg save_cutbuffer, allows cutbuffer to not be lost when
|
||||
using multibuffer.
|
||||
- nano.1:
|
||||
- Added new features, fixed some typos (Jordi).
|
||||
- nano.texi:
|
||||
- Corrected the Mouse Toggle section, noticed by Daniel Bonniot.
|
||||
- Added many command line options, toggles and other additions
|
||||
(Jordi).
|
||||
- rcfile.c:
|
||||
- NUM_RCOPTS fix (DLR).
|
||||
- Add tabsize support to rc file (Nathan Heagy).
|
||||
- Fix incorrect argument in fill and tabsize error message
|
||||
(Nathan Heagy)
|
||||
- search.c:
|
||||
- Changed search prompt to "Search" followed by a list of
|
||||
bracketed, free-standing modifiers that do not imply a grammar,
|
||||
and the (to replace) string separately. Hopefully this resolves
|
||||
the i18n problems that this provoked.
|
||||
findnextstr()
|
||||
- Various fixes that need testing (Ken Tyler).
|
||||
- winio.c:
|
||||
- Add David Lawrence Ramsey to credits.
|
||||
bottombars()
|
||||
- Spread out the menu items, feedback definitely needed on this.
|
||||
nanogetstr()
|
||||
- More key fixes (David Lawrence Ramsey)
|
||||
- Don't be clever and wasteful, just repaint every iteration.
|
||||
- po/nl.po:
|
||||
- New Dutch translation, by Guus Sliepen <guus@nl.linux.org>.
|
||||
- po/ca.po, po/es.po:
|
||||
- Updated Catalan and Spanish translation (Jordi).
|
||||
- po/gl.po:
|
||||
- Updated Galician translation (Jacobo Tarrío).
|
||||
- po/da.po:
|
||||
- New Danish translation, by Keld Simonsen <keld@dkuug.dk>.
|
||||
- po/sv.po:
|
||||
- Updated Swedish translation (Christian Rose).
|
||||
- po/it.po:
|
||||
- Updated Italian translation (Marco Colombo).
|
||||
- po/fi.po:
|
||||
- Updated Finnish translation (Pauli Virtanen).
|
||||
|
||||
nano-1.1.1 - 07/28/2001
|
||||
- General
|
||||
- Reverted included gettext from 0.10.38 to 0.10.35 in intl/ dir.
|
||||
|
||||
647
Makefile.in
647
Makefile.in
@@ -1,647 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.4 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = .
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
CATALOGS = @CATALOGS@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
CC = @CC@
|
||||
CURSES_LIB = @CURSES_LIB@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
GENCAT = @GENCAT@
|
||||
GLIB_CFLAGS = @GLIB_CFLAGS@
|
||||
GLIB_CONFIG = @GLIB_CONFIG@
|
||||
GLIB_LIBS = @GLIB_LIBS@
|
||||
GMOFILES = @GMOFILES@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GNU_LOCALE_DIR = @GNU_LOCALE_DIR@
|
||||
GT_NO = @GT_NO@
|
||||
GT_YES = @GT_YES@
|
||||
INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
|
||||
INSTOBJEXT = @INSTOBJEXT@
|
||||
INTLDEPS = @INTLDEPS@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
LOCALE_DIR = @LOCALE_DIR@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
PACKAGE = @PACKAGE@
|
||||
POFILES = @POFILES@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
l = @l@
|
||||
|
||||
AUTOMAKE_OPTIONS = gnu no-dependencies
|
||||
M4DIR = $(srcdir)/m4
|
||||
ACLOCAL_AMFLAGS = -I $(M4DIR)
|
||||
ACINCLUDE_INPUTS = $(M4DIR)/gettext.m4 $(M4DIR)/largefile.m4 $(M4DIR)/lcmessage.m4 $(M4DIR)/progtest.m4
|
||||
|
||||
|
||||
bin_PROGRAMS = nano
|
||||
nano_SOURCES = color.c cut.c files.c global.c move.c nano.c nano.h proto.h rcfile.c search.c utils.c winio.c
|
||||
|
||||
|
||||
man_MANS = nano.1
|
||||
nano_LDADD = @GLIB_LIBS@ @INTLLIBS@
|
||||
|
||||
info_TEXINFOS = nano.texi
|
||||
MAKEINFO = makeinfo --no-split
|
||||
|
||||
EXTRA_DIST = ABOUT-NLS AUTHORS BUGS COPYING ChangeLog INSTALL NEWS README THANKS TODO install-sh missing mkinstalldirs nano.1 nano.1.html faq.html nanorc.sample $(ACINCLUDE_INPUTS)
|
||||
|
||||
|
||||
SUBDIRS = po intl
|
||||
|
||||
localedir = @LOCALE_DIR@
|
||||
INCLUDES = -Iintl -DLOCALEDIR=\"$(localedir)\" -I@includedir@
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
|
||||
|
||||
DEFS = @DEFS@ -I. -I$(srcdir) -I.
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
nano_OBJECTS = color.o cut.o files.o global.o move.o nano.o rcfile.o \
|
||||
search.o utils.o winio.o
|
||||
nano_DEPENDENCIES =
|
||||
nano_LDFLAGS =
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
TEXI2DVI = texi2dvi
|
||||
INFO_DEPS = nano.info
|
||||
DVIS = nano.dvi
|
||||
TEXINFOS = nano.texi
|
||||
man1dir = $(mandir)/man1
|
||||
MANS = $(man_MANS)
|
||||
|
||||
NROFF = nroff
|
||||
DIST_COMMON = README ./stamp-h.in ABOUT-NLS AUTHORS COPYING ChangeLog \
|
||||
INSTALL Makefile.am Makefile.in NEWS THANKS TODO acconfig.h aclocal.m4 \
|
||||
config.guess config.h.in config.sub configure configure.in install-sh \
|
||||
missing mkinstalldirs texinfo.tex
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP_ENV = --best
|
||||
SOURCES = $(nano_SOURCES)
|
||||
OBJECTS = $(nano_OBJECTS)
|
||||
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .S .c .dvi .info .o .ps .s .texi .texinfo .txi
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
$(ACLOCAL_M4): configure.in
|
||||
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
|
||||
config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
|
||||
cd $(srcdir) && $(AUTOCONF)
|
||||
|
||||
config.h: stamp-h
|
||||
@if test ! -f $@; then \
|
||||
rm -f stamp-h; \
|
||||
$(MAKE) stamp-h; \
|
||||
else :; fi
|
||||
stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES= CONFIG_HEADERS=config.h:config.h.in \
|
||||
$(SHELL) ./config.status
|
||||
@echo timestamp > stamp-h 2> /dev/null
|
||||
$(srcdir)/config.h.in: $(srcdir)/stamp-h.in
|
||||
@if test ! -f $@; then \
|
||||
rm -f $(srcdir)/stamp-h.in; \
|
||||
$(MAKE) $(srcdir)/stamp-h.in; \
|
||||
else :; fi
|
||||
$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
|
||||
cd $(top_srcdir) && $(AUTOHEADER)
|
||||
@echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null
|
||||
|
||||
mostlyclean-hdr:
|
||||
|
||||
clean-hdr:
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f config.h
|
||||
|
||||
maintainer-clean-hdr:
|
||||
|
||||
mostlyclean-binPROGRAMS:
|
||||
|
||||
clean-binPROGRAMS:
|
||||
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
|
||||
|
||||
distclean-binPROGRAMS:
|
||||
|
||||
maintainer-clean-binPROGRAMS:
|
||||
|
||||
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||
@list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
|
||||
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
uninstall-binPROGRAMS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
|
||||
done
|
||||
|
||||
.c.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.s.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.S.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.o core *.core
|
||||
|
||||
clean-compile:
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
maintainer-clean-compile:
|
||||
|
||||
nano: $(nano_OBJECTS) $(nano_DEPENDENCIES)
|
||||
@rm -f nano
|
||||
$(LINK) $(nano_LDFLAGS) $(nano_OBJECTS) $(nano_LDADD) $(LIBS)
|
||||
|
||||
nano.info: nano.texi
|
||||
nano.dvi: nano.texi
|
||||
|
||||
|
||||
DVIPS = dvips
|
||||
|
||||
.texi.info:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.texi.dvi:
|
||||
TEXINPUTS=.:$$TEXINPUTS \
|
||||
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
|
||||
|
||||
.texi:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.texinfo.info:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.texinfo:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.texinfo.dvi:
|
||||
TEXINPUTS=.:$$TEXINPUTS \
|
||||
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
|
||||
|
||||
.txi.info:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.txi.dvi:
|
||||
TEXINPUTS=.:$$TEXINPUTS \
|
||||
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
|
||||
|
||||
.txi:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
.dvi.ps:
|
||||
$(DVIPS) $< -o $@
|
||||
|
||||
install-info-am: $(INFO_DEPS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(infodir)
|
||||
@list='$(INFO_DEPS)'; \
|
||||
for file in $$list; do \
|
||||
d=$(srcdir); \
|
||||
for ifile in `cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \
|
||||
if test -f $$d/$$ifile; then \
|
||||
echo " $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile"; \
|
||||
$(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile; \
|
||||
else : ; fi; \
|
||||
done; \
|
||||
done
|
||||
@$(POST_INSTALL)
|
||||
@if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
|
||||
list='$(INFO_DEPS)'; \
|
||||
for file in $$list; do \
|
||||
echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file";\
|
||||
install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file || :;\
|
||||
done; \
|
||||
else : ; fi
|
||||
|
||||
uninstall-info:
|
||||
$(PRE_UNINSTALL)
|
||||
@if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
|
||||
ii=yes; \
|
||||
else ii=; fi; \
|
||||
list='$(INFO_DEPS)'; \
|
||||
for file in $$list; do \
|
||||
test -z "$ii" \
|
||||
|| install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \
|
||||
done
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(INFO_DEPS)'; \
|
||||
for file in $$list; do \
|
||||
(cd $(DESTDIR)$(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \
|
||||
done
|
||||
|
||||
dist-info: $(INFO_DEPS)
|
||||
list='$(INFO_DEPS)'; \
|
||||
for base in $$list; do \
|
||||
d=$(srcdir); \
|
||||
for file in `cd $$d && eval echo $$base*`; do \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done; \
|
||||
done
|
||||
|
||||
mostlyclean-aminfo:
|
||||
-rm -f nano.aux nano.cp nano.cps nano.dvi nano.fn nano.fns nano.ky \
|
||||
nano.kys nano.ps nano.log nano.pg nano.toc nano.tp nano.tps \
|
||||
nano.vr nano.vrs nano.op nano.tr nano.cv nano.cn
|
||||
|
||||
clean-aminfo:
|
||||
|
||||
distclean-aminfo:
|
||||
|
||||
maintainer-clean-aminfo:
|
||||
cd $(srcdir) && for i in $(INFO_DEPS); do \
|
||||
rm -f $$i; \
|
||||
if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then \
|
||||
rm -f $$i-[0-9]*; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
install-man1:
|
||||
$(mkinstalldirs) $(DESTDIR)$(man1dir)
|
||||
@list='$(man1_MANS)'; \
|
||||
l2='$(man_MANS)'; for i in $$l2; do \
|
||||
case "$$i" in \
|
||||
*.1*) list="$$list $$i" ;; \
|
||||
esac; \
|
||||
done; \
|
||||
for i in $$list; do \
|
||||
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
|
||||
else file=$$i; fi; \
|
||||
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
|
||||
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
|
||||
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
|
||||
echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \
|
||||
$(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \
|
||||
done
|
||||
|
||||
uninstall-man1:
|
||||
@list='$(man1_MANS)'; \
|
||||
l2='$(man_MANS)'; for i in $$l2; do \
|
||||
case "$$i" in \
|
||||
*.1*) list="$$list $$i" ;; \
|
||||
esac; \
|
||||
done; \
|
||||
for i in $$list; do \
|
||||
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
|
||||
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
|
||||
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
|
||||
echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \
|
||||
rm -f $(DESTDIR)$(man1dir)/$$inst; \
|
||||
done
|
||||
install-man: $(MANS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(MAKE) $(AM_MAKEFLAGS) install-man1
|
||||
uninstall-man:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
$(MAKE) $(AM_MAKEFLAGS) uninstall-man1
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
all-recursive install-data-recursive install-exec-recursive \
|
||||
installdirs-recursive install-recursive uninstall-recursive \
|
||||
check-recursive installcheck-recursive info-recursive dvi-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
mostlyclean-recursive clean-recursive distclean-recursive \
|
||||
maintainer-clean-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
dot_seen=no; \
|
||||
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
rev="$$subdir $$rev"; \
|
||||
test "$$subdir" = "." && dot_seen=yes; \
|
||||
done; \
|
||||
test "$$dot_seen" = "no" && rev=". $$rev"; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
for subdir in $$rev; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||
done
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $$unique $(LISP)
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS)
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
-rm -rf $(distdir)
|
||||
GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
|
||||
mkdir $(distdir)/=build
|
||||
mkdir $(distdir)/=inst
|
||||
dc_install_base=`cd $(distdir)/=inst && pwd`; \
|
||||
cd $(distdir)/=build \
|
||||
&& ../configure --with-included-gettext --srcdir=.. --prefix=$$dc_install_base \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist
|
||||
-rm -rf $(distdir)
|
||||
@banner="$(distdir).tar.gz is ready for distribution"; \
|
||||
dashes=`echo "$$banner" | sed s/./=/g`; \
|
||||
echo "$$dashes"; \
|
||||
echo "$$banner"; \
|
||||
echo "$$dashes"
|
||||
dist: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
|
||||
-rm -rf $(distdir)
|
||||
dist-all: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
|
||||
-rm -rf $(distdir)
|
||||
distdir: $(DISTFILES)
|
||||
-rm -rf $(distdir)
|
||||
mkdir $(distdir)
|
||||
-chmod 777 $(distdir)
|
||||
$(mkinstalldirs) $(distdir)/$(M4DIR)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
for subdir in $(SUBDIRS); do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -d $(distdir)/$$subdir \
|
||||
|| mkdir $(distdir)/$$subdir \
|
||||
|| exit 1; \
|
||||
chmod 777 $(distdir)/$$subdir; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
$(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info
|
||||
info-am: $(INFO_DEPS)
|
||||
info: info-recursive
|
||||
dvi-am: $(DVIS)
|
||||
dvi: dvi-recursive
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
installcheck-am:
|
||||
installcheck: installcheck-recursive
|
||||
all-recursive-am: config.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||
|
||||
install-exec-am: install-binPROGRAMS
|
||||
install-exec: install-exec-recursive
|
||||
|
||||
install-data-am: install-info-am install-man
|
||||
install-data: install-data-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-recursive
|
||||
uninstall-am: uninstall-binPROGRAMS uninstall-info uninstall-man
|
||||
uninstall: uninstall-recursive
|
||||
all-am: Makefile $(INFO_DEPS) $(PROGRAMS) $(MANS) config.h
|
||||
all-redirect: all-recursive-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(infodir) \
|
||||
$(DESTDIR)$(mandir)/man1
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
mostlyclean-am: mostlyclean-hdr mostlyclean-binPROGRAMS \
|
||||
mostlyclean-compile mostlyclean-aminfo mostlyclean-tags \
|
||||
mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
clean-am: clean-hdr clean-binPROGRAMS clean-compile clean-aminfo \
|
||||
clean-tags clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-recursive
|
||||
|
||||
distclean-am: distclean-hdr distclean-binPROGRAMS distclean-compile \
|
||||
distclean-aminfo distclean-tags distclean-generic \
|
||||
clean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f config.status
|
||||
|
||||
maintainer-clean-am: maintainer-clean-hdr maintainer-clean-binPROGRAMS \
|
||||
maintainer-clean-compile maintainer-clean-aminfo \
|
||||
maintainer-clean-tags maintainer-clean-generic \
|
||||
distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f config.status
|
||||
|
||||
.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
|
||||
mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
|
||||
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
|
||||
mostlyclean-compile distclean-compile clean-compile \
|
||||
maintainer-clean-compile install-info-am uninstall-info \
|
||||
mostlyclean-aminfo distclean-aminfo clean-aminfo \
|
||||
maintainer-clean-aminfo install-man1 uninstall-man1 install-man \
|
||||
uninstall-man install-data-recursive uninstall-data-recursive \
|
||||
install-exec-recursive uninstall-exec-recursive installdirs-recursive \
|
||||
uninstalldirs-recursive all-recursive check-recursive \
|
||||
installcheck-recursive info-recursive dvi-recursive \
|
||||
mostlyclean-recursive distclean-recursive clean-recursive \
|
||||
maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
|
||||
distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
|
||||
dvi-am dvi check check-am installcheck-am installcheck all-recursive-am \
|
||||
install-exec-am install-exec install-data-am install-data install-am \
|
||||
install uninstall-am uninstall all-redirect all-am all installdirs-am \
|
||||
installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
$(srcdir)/acinclude.m4: $(ACINCLUDE_INPUTS)
|
||||
cat $(ACINCLUDE_INPUTS) > $@
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
45
NEWS
45
NEWS
@@ -1,3 +1,48 @@
|
||||
12/11/2001 - GNU nano 1.1.4 is released. This release contains
|
||||
rudimentary color syntax support (but it's still
|
||||
broken), compatibility fixes for the Hurd and FreeBSD,
|
||||
spell checker and wrapping fixes, and more. It seems
|
||||
that the amount of interest in the code is inversely
|
||||
proportional to the amount of time since last release,
|
||||
so it's time to show the world all the changes since
|
||||
1.1.3 ;) Have fun with it!
|
||||
|
||||
10/26/2001 - GNU nano 1.1.3 is released. As far as new features go,
|
||||
the help system is now available for all functions in the
|
||||
editor. Also, nano will also now print a message on
|
||||
the status bar when it automatically converts a file from
|
||||
Mac or DOS format, and trying to load a file that
|
||||
has already been loaded in multibuffer mode will now also
|
||||
cause an error message. There is now a "goto previous
|
||||
word" which you can use by hitting Meta-Space Bar.
|
||||
As for fixes, a SEVERE bug in the
|
||||
null_at code which discarded the memory address of
|
||||
reallocated memory has been fixed. This is probably
|
||||
the biggest bug fix in well over the last year of
|
||||
development. There are also some display fixes for when
|
||||
the screen shouldn't center itself on cut or uncut text.
|
||||
Also, the comments in the header files incorectly said
|
||||
that nano was distributed under version 1 of the GPL when
|
||||
the accompanying license was the GPLv2.
|
||||
If you're using nano-1.1, it is highly
|
||||
recommeneded you upgrade to this release. If using 1.0,
|
||||
wait for version 1.0.6 which should be available early
|
||||
next week. Enjoy!
|
||||
|
||||
10/03/2001 - GNU nano 1.1.2 is out there. Many new features in this
|
||||
release, including support for auto-converting from
|
||||
DOS and Mac formatted files, as well as toggles for
|
||||
writing out files in these formats. Pico's -o flag has
|
||||
been implemented, as has some new smooth scrolling code
|
||||
(which can be used in place of the default jerky scrolling
|
||||
behavior). Also, there is now a "find matching
|
||||
bracket/brace/etc" feature (Meta-]). The .nanorc file
|
||||
now accepts setting the tabsize, and the help text at the
|
||||
bottom of the editor is now better spaced out in the
|
||||
search/replace prompts. There are also the usual helping
|
||||
of bugfixes, translation updates and, surely a bug or two.
|
||||
You better get ready!
|
||||
|
||||
07/28/2001 - GNU nano 1.1.1 is released. Our second 1.1 unstable release
|
||||
features many bugfixes from the initial release, in
|
||||
particular fixs for the multibuffer code, and various
|
||||
|
||||
10
README
10
README
@@ -55,7 +55,7 @@ Current Status
|
||||
|
||||
This is the 1.1 or unstable branch of nano. New features
|
||||
will be added and things will be changed around and basically
|
||||
stabiliity is not guaranteed. If this is not what you're
|
||||
stability is not guaranteed. If this is not what you're
|
||||
interested in, please use the latest 1.0.x release of nano.
|
||||
|
||||
New features in this branch include:
|
||||
@@ -71,6 +71,14 @@ Current Status
|
||||
shortcuts and files in browser, search toggles that are Pico
|
||||
extensions moved to Meta keys so as to not interfere with Pico
|
||||
control sequences.
|
||||
+ Smooth scrolling through files, instead of the jerky half-page
|
||||
down, half-page up method. This is available by using the
|
||||
-S or --smooth switch, or the Meta-S toggle.
|
||||
+ Better non-*nix file support. GNU nano now automatically
|
||||
converts files from DOS format or Mac format to standard file
|
||||
format. It can also write files in either format by using the
|
||||
appropriate command line (-D, --dos or -M, --mac) or toggle
|
||||
(Meta-D, Meta-O).
|
||||
|
||||
Chris Allegretta (chrisa@asty.org)
|
||||
|
||||
|
||||
10
THANKS
10
THANKS
@@ -2,16 +2,24 @@ The following people have helped GNU nano in some way or another.
|
||||
If we missed you here, let us now!
|
||||
|
||||
Marco Colombo <magicdice@inwind.it> Italian Translator
|
||||
Karl Eichwalder <keichwa@gmx.net> German Translator
|
||||
Tedi Heriyanto <tedi_h@gmx.net> Indonesian Translator
|
||||
Václav Haisman <V.Haisman@sh.cvut.cz> Czech Translator
|
||||
Szabolcs Horvath <horvaths@fi.inf.elte.hu> Hungarian Translator
|
||||
Szabolcs Horvath <horvaths@janus.gimsz.sulinet.hu>
|
||||
Hungarian Translator
|
||||
Eivind Kjørstad <ekj@vestdata.no> Norwegian (Bokmål) Translator
|
||||
Florian König <floki@bigfoot.com> German Translator
|
||||
Clement Laforet <clem_laf@wanadoo.fr> French Translator
|
||||
Sergey A. Ribalchenko <fisher@obu.ck.ua> Russian, Ukrainian Translator
|
||||
Michel Robitaille <robitail@IRO.UMontreal.CA> French Translator
|
||||
Christian Rose <menthos@menthos.com> Swedish Translator
|
||||
Keld Simonsen <keld@dkuug.dk> Danish Translator
|
||||
Guus Sliepen <guus@nl.linux.org> Dutch Translator
|
||||
Pierre Tane <tanep@bigfoot.com> French Translator
|
||||
Jacobo Tarrío <jtarrio@trasno.net> Galician Translator
|
||||
Miquel Vidal <miquel@sindominio.net> Catalan Translator
|
||||
Pauli Virtanen <pauli.virtanen@saunalahti.fi> Finnish Translator
|
||||
|
||||
Jim Knoble <jmknoble@pobox.com> Pico compat for browser
|
||||
Thomas Dickey <dickey@herndon4.his.com> Curses help and advice
|
||||
Ryan Krebs <fluffy@highwire.stanford.edu> Many bug fixes and testing
|
||||
|
||||
@@ -54,7 +54,10 @@
|
||||
/* Define this to disable the mouse functions */
|
||||
#undef DISABLE_MOUSE
|
||||
|
||||
/* Define this to load files upon inserting them, and allow switching between them; this is disabled if NANO_SMALL is defined */
|
||||
/* Define this to disable setting of the operating directory (chroot of sorts) */
|
||||
#undef DISABLE_OPERATINGDIR
|
||||
|
||||
/* Define this to enable multiple file buffers; this is disabled if NANO_SMALL is defined */
|
||||
#undef ENABLE_MULTIBUFFER
|
||||
|
||||
/* Define this to use the .nanorc file */
|
||||
@@ -66,3 +69,5 @@
|
||||
/* Define this to have syntax hilighting, requires ENABLE_NANORC too! */
|
||||
#undef ENABLE_COLOR
|
||||
|
||||
/* Define this to enable undoing....something */
|
||||
#undef ENABLE_UNDO
|
||||
|
||||
884
aclocal.m4
vendored
884
aclocal.m4
vendored
@@ -1,884 +0,0 @@
|
||||
dnl aclocal.m4 generated automatically by aclocal 1.4
|
||||
|
||||
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl This program is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
dnl PARTICULAR PURPOSE.
|
||||
|
||||
# Do all the work for Automake. This macro actually does too much --
|
||||
# some checks are only needed if your package does certain things.
|
||||
# But this isn't really a big deal.
|
||||
|
||||
# serial 1
|
||||
|
||||
dnl Usage:
|
||||
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
|
||||
|
||||
AC_DEFUN(AM_INIT_AUTOMAKE,
|
||||
[AC_REQUIRE([AC_PROG_INSTALL])
|
||||
PACKAGE=[$1]
|
||||
AC_SUBST(PACKAGE)
|
||||
VERSION=[$2]
|
||||
AC_SUBST(VERSION)
|
||||
dnl test to see if srcdir already configured
|
||||
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
|
||||
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
|
||||
fi
|
||||
ifelse([$3],,
|
||||
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
|
||||
AC_REQUIRE([AM_SANITY_CHECK])
|
||||
AC_REQUIRE([AC_ARG_PROGRAM])
|
||||
dnl FIXME This is truly gross.
|
||||
missing_dir=`cd $ac_aux_dir && pwd`
|
||||
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
|
||||
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
|
||||
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
|
||||
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
|
||||
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
|
||||
AC_REQUIRE([AC_PROG_MAKE_SET])])
|
||||
|
||||
#
|
||||
# Check to make sure that the build environment is sane.
|
||||
#
|
||||
|
||||
AC_DEFUN(AM_SANITY_CHECK,
|
||||
[AC_MSG_CHECKING([whether build environment is sane])
|
||||
# Just in case
|
||||
sleep 1
|
||||
echo timestamp > conftestfile
|
||||
# Do `set' in a subshell so we don't clobber the current shell's
|
||||
# arguments. Must try -L first in case configure is actually a
|
||||
# symlink; some systems play weird games with the mod time of symlinks
|
||||
# (eg FreeBSD returns the mod time of the symlink's containing
|
||||
# directory).
|
||||
if (
|
||||
set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
|
||||
if test "[$]*" = "X"; then
|
||||
# -L didn't work.
|
||||
set X `ls -t $srcdir/configure conftestfile`
|
||||
fi
|
||||
if test "[$]*" != "X $srcdir/configure conftestfile" \
|
||||
&& test "[$]*" != "X conftestfile $srcdir/configure"; then
|
||||
|
||||
# If neither matched, then we have a broken ls. This can happen
|
||||
# if, for instance, CONFIG_SHELL is bash and it inherits a
|
||||
# broken ls alias from the environment. This has actually
|
||||
# happened. Such a system could not be considered "sane".
|
||||
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
|
||||
alias in your environment])
|
||||
fi
|
||||
|
||||
test "[$]2" = conftestfile
|
||||
)
|
||||
then
|
||||
# Ok.
|
||||
:
|
||||
else
|
||||
AC_MSG_ERROR([newly created file is older than distributed files!
|
||||
Check your system clock])
|
||||
fi
|
||||
rm -f conftest*
|
||||
AC_MSG_RESULT(yes)])
|
||||
|
||||
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
|
||||
dnl The program must properly implement --version.
|
||||
AC_DEFUN(AM_MISSING_PROG,
|
||||
[AC_MSG_CHECKING(for working $2)
|
||||
# Run test in a subshell; some versions of sh will print an error if
|
||||
# an executable is not found, even if stderr is redirected.
|
||||
# Redirect stdin to placate older versions of autoconf. Sigh.
|
||||
if ($2 --version) < /dev/null > /dev/null 2>&1; then
|
||||
$1=$2
|
||||
AC_MSG_RESULT(found)
|
||||
else
|
||||
$1="$3/missing $2"
|
||||
AC_MSG_RESULT(missing)
|
||||
fi
|
||||
AC_SUBST($1)])
|
||||
|
||||
# Like AC_CONFIG_HEADER, but automatically create stamp file.
|
||||
|
||||
AC_DEFUN(AM_CONFIG_HEADER,
|
||||
[AC_PREREQ([2.12])
|
||||
AC_CONFIG_HEADER([$1])
|
||||
dnl When config.status generates a header, we must update the stamp-h file.
|
||||
dnl This file resides in the same directory as the config header
|
||||
dnl that is generated. We must strip everything past the first ":",
|
||||
dnl and everything past the last "/".
|
||||
AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
|
||||
ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
|
||||
<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
|
||||
<<am_indx=1
|
||||
for am_file in <<$1>>; do
|
||||
case " <<$>>CONFIG_HEADERS " in
|
||||
*" <<$>>am_file "*<<)>>
|
||||
echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
|
||||
;;
|
||||
esac
|
||||
am_indx=`expr "<<$>>am_indx" + 1`
|
||||
done<<>>dnl>>)
|
||||
changequote([,]))])
|
||||
|
||||
#serial 1
|
||||
# This test replaces the one in autoconf.
|
||||
# Currently this macro should have the same name as the autoconf macro
|
||||
# because gettext's gettext.m4 (distributed in the automake package)
|
||||
# still uses it. Otherwise, the use in gettext.m4 makes autoheader
|
||||
# give these diagnostics:
|
||||
# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
|
||||
# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
|
||||
|
||||
undefine([AC_ISC_POSIX])
|
||||
|
||||
AC_DEFUN([AC_ISC_POSIX],
|
||||
[
|
||||
dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
|
||||
AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
|
||||
]
|
||||
)
|
||||
|
||||
#serial 19
|
||||
|
||||
dnl By default, many hosts won't let programs access large files;
|
||||
dnl one must use special compiler options to get large-file access to work.
|
||||
dnl For more details about this brain damage please see:
|
||||
dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
|
||||
|
||||
dnl Written by Paul Eggert <eggert@twinsun.com>.
|
||||
|
||||
dnl Internal subroutine of AC_SYS_LARGEFILE.
|
||||
dnl AC_SYS_LARGEFILE_TEST_INCLUDES
|
||||
AC_DEFUN(AC_SYS_LARGEFILE_TEST_INCLUDES,
|
||||
[[#include <sys/types.h>
|
||||
/* Check that off_t can represent 2**63 - 1 correctly.
|
||||
We can't simply "#define LARGE_OFF_T 9223372036854775807",
|
||||
since some C++ compilers masquerading as C compilers
|
||||
incorrectly reject 9223372036854775807. */
|
||||
# define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
|
||||
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
|
||||
&& LARGE_OFF_T % 2147483647 == 1)
|
||||
? 1 : -1];
|
||||
]])
|
||||
|
||||
dnl Internal subroutine of AC_SYS_LARGEFILE.
|
||||
dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR, COMMENT, INCLUDES, FUNCTION-BODY)
|
||||
AC_DEFUN(AC_SYS_LARGEFILE_MACRO_VALUE,
|
||||
[AC_CACHE_CHECK([for $1 value needed for large files], $3,
|
||||
[$3=no
|
||||
AC_TRY_COMPILE([$5],
|
||||
[$6],
|
||||
,
|
||||
[AC_TRY_COMPILE([#define $1 $2]
|
||||
[$5]
|
||||
,
|
||||
[$6],
|
||||
[$3=$2])])])
|
||||
if test "[$]$3" != no; then
|
||||
AC_DEFINE_UNQUOTED([$1], [$]$3, [$4])
|
||||
fi])
|
||||
|
||||
AC_DEFUN(NANO_AC_SYS_LARGEFILE,
|
||||
[AC_REQUIRE([AC_PROG_CC])
|
||||
AC_ARG_ENABLE(largefile,
|
||||
[ --disable-largefile omit support for large files])
|
||||
if test "$enable_largefile" != no; then
|
||||
|
||||
AC_CACHE_CHECK([for special C compiler options needed for large files],
|
||||
ac_cv_sys_largefile_CC,
|
||||
[ac_cv_sys_largefile_CC=no
|
||||
if test "$GCC" != yes; then
|
||||
# IRIX 6.2 and later do not support large files by default,
|
||||
# so use the C compiler's -n32 option if that helps.
|
||||
AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, , ,
|
||||
[ac_save_CC="$CC"
|
||||
CC="$CC -n32"
|
||||
AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, ,
|
||||
ac_cv_sys_largefile_CC=' -n32')
|
||||
CC="$ac_save_CC"])
|
||||
fi])
|
||||
if test "$ac_cv_sys_largefile_CC" != no; then
|
||||
CC="$CC$ac_cv_sys_largefile_CC"
|
||||
fi
|
||||
|
||||
AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
|
||||
ac_cv_sys_file_offset_bits,
|
||||
[Number of bits in a file offset, on hosts where this is settable.],
|
||||
AC_SYS_LARGEFILE_TEST_INCLUDES)
|
||||
AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
|
||||
ac_cv_sys_large_files,
|
||||
[Define for large files, on AIX-style hosts.],
|
||||
AC_SYS_LARGEFILE_TEST_INCLUDES)
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN(AC_FUNC_FSEEKO,
|
||||
[AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, 1,
|
||||
ac_cv_sys_largefile_source,
|
||||
[Define to make fseeko visible on some hosts (e.g. glibc 2.2).],
|
||||
[#include <stdio.h>], [return !fseeko;])
|
||||
# We used to try defining _XOPEN_SOURCE=500 too, to work around a bug
|
||||
# in glibc 2.1.3, but that breaks too many other things.
|
||||
# If you want fseeko and ftello with glibc, upgrade to a fixed glibc.
|
||||
|
||||
AC_CACHE_CHECK([for fseeko], ac_cv_func_fseeko,
|
||||
[ac_cv_func_fseeko=no
|
||||
AC_TRY_LINK([#include <stdio.h>],
|
||||
[return fseeko && fseeko (stdin, 0, 0);],
|
||||
[ac_cv_func_fseeko=yes])])
|
||||
if test $ac_cv_func_fseeko != no; then
|
||||
AC_DEFINE(HAVE_FSEEKO, 1,
|
||||
[Define if fseeko (and presumably ftello) exists and is declared.])
|
||||
fi])
|
||||
|
||||
# Configure paths for GLIB
|
||||
# Owen Taylor 97-11-3
|
||||
|
||||
dnl AM_PATH_GLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
|
||||
dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if "gmodule" or
|
||||
dnl gthread is specified in MODULES, pass to glib-config
|
||||
dnl
|
||||
AC_DEFUN(AM_PATH_GLIB,
|
||||
[dnl
|
||||
dnl Get the cflags and libraries from the glib-config script
|
||||
dnl
|
||||
AC_ARG_WITH(glib-prefix,[ --with-glib-prefix=PFX Prefix where GLIB is installed (optional)],
|
||||
glib_config_prefix="$withval", glib_config_prefix="")
|
||||
AC_ARG_WITH(glib-exec-prefix,[ --with-glib-exec-prefix=PFX Exec prefix where GLIB is installed (optional)],
|
||||
glib_config_exec_prefix="$withval", glib_config_exec_prefix="")
|
||||
AC_ARG_ENABLE(glibtest, [ --disable-glibtest Do not try to compile and run a test GLIB program],
|
||||
, enable_glibtest=yes)
|
||||
|
||||
if test x$glib_config_exec_prefix != x ; then
|
||||
glib_config_args="$glib_config_args --exec-prefix=$glib_config_exec_prefix"
|
||||
if test x${GLIB_CONFIG+set} != xset ; then
|
||||
GLIB_CONFIG=$glib_config_exec_prefix/bin/glib-config
|
||||
fi
|
||||
fi
|
||||
if test x$glib_config_prefix != x ; then
|
||||
glib_config_args="$glib_config_args --prefix=$glib_config_prefix"
|
||||
if test x${GLIB_CONFIG+set} != xset ; then
|
||||
GLIB_CONFIG=$glib_config_prefix/bin/glib-config
|
||||
fi
|
||||
fi
|
||||
|
||||
for module in . $4
|
||||
do
|
||||
case "$module" in
|
||||
gmodule)
|
||||
glib_config_args="$glib_config_args gmodule"
|
||||
;;
|
||||
gthread)
|
||||
glib_config_args="$glib_config_args gthread"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
AC_PATH_PROG(GLIB_CONFIG, glib-config, no)
|
||||
min_glib_version=ifelse([$1], ,0.99.7,$1)
|
||||
AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
|
||||
no_glib=""
|
||||
if test "$GLIB_CONFIG" = "no" ; then
|
||||
no_glib=yes
|
||||
else
|
||||
GLIB_CFLAGS=`$GLIB_CONFIG $glib_config_args --cflags`
|
||||
GLIB_LIBS=`$GLIB_CONFIG $glib_config_args --libs`
|
||||
glib_config_major_version=`$GLIB_CONFIG $glib_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
glib_config_minor_version=`$GLIB_CONFIG $glib_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
glib_config_micro_version=`$GLIB_CONFIG $glib_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
if test "x$enable_glibtest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $GLIB_CFLAGS"
|
||||
LIBS="$GLIB_LIBS $LIBS"
|
||||
dnl
|
||||
dnl Now check if the installed GLIB is sufficiently new. (Also sanity
|
||||
dnl checks the results of glib-config to some extent
|
||||
dnl
|
||||
rm -f conf.glibtest
|
||||
AC_TRY_RUN([
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
int major, minor, micro;
|
||||
char *tmp_version;
|
||||
|
||||
system ("touch conf.glibtest");
|
||||
|
||||
/* HP/UX 9 (%@#!) writes to sscanf strings */
|
||||
tmp_version = g_strdup("$min_glib_version");
|
||||
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
|
||||
printf("%s, bad version string\n", "$min_glib_version");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ((glib_major_version != $glib_config_major_version) ||
|
||||
(glib_minor_version != $glib_config_minor_version) ||
|
||||
(glib_micro_version != $glib_config_micro_version))
|
||||
{
|
||||
printf("\n*** 'glib-config --version' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
|
||||
$glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
|
||||
glib_major_version, glib_minor_version, glib_micro_version);
|
||||
printf ("*** was found! If glib-config was correct, then it is best\n");
|
||||
printf ("*** to remove the old version of GLIB. You may also be able to fix the error\n");
|
||||
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
|
||||
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
|
||||
printf("*** required on your system.\n");
|
||||
printf("*** If glib-config was wrong, set the environment variable GLIB_CONFIG\n");
|
||||
printf("*** to point to the correct copy of glib-config, and remove the file config.cache\n");
|
||||
printf("*** before re-running configure\n");
|
||||
}
|
||||
else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
|
||||
(glib_minor_version != GLIB_MINOR_VERSION) ||
|
||||
(glib_micro_version != GLIB_MICRO_VERSION))
|
||||
{
|
||||
printf("*** GLIB header files (version %d.%d.%d) do not match\n",
|
||||
GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
|
||||
printf("*** library (version %d.%d.%d)\n",
|
||||
glib_major_version, glib_minor_version, glib_micro_version);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((glib_major_version > major) ||
|
||||
((glib_major_version == major) && (glib_minor_version > minor)) ||
|
||||
((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n",
|
||||
glib_major_version, glib_minor_version, glib_micro_version);
|
||||
printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n",
|
||||
major, minor, micro);
|
||||
printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
|
||||
printf("***\n");
|
||||
printf("*** If you have already installed a sufficiently new version, this error\n");
|
||||
printf("*** probably means that the wrong copy of the glib-config shell script is\n");
|
||||
printf("*** being found. The easiest way to fix this is to remove the old version\n");
|
||||
printf("*** of GLIB, but you can also set the GLIB_CONFIG environment to point to the\n");
|
||||
printf("*** correct copy of glib-config. (In this case, you will have to\n");
|
||||
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
|
||||
printf("*** so that the correct libraries are found at run-time))\n");
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
if test "x$no_glib" = x ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test "$GLIB_CONFIG" = "no" ; then
|
||||
echo "*** The glib-config script installed by GLIB could not be found"
|
||||
echo "*** If GLIB was installed in PREFIX, make sure PREFIX/bin is in"
|
||||
echo "*** your path, or set the GLIB_CONFIG environment variable to the"
|
||||
echo "*** full path to glib-config."
|
||||
else
|
||||
if test -f conf.glibtest ; then
|
||||
:
|
||||
else
|
||||
echo "*** Could not run GLIB test program, checking why..."
|
||||
CFLAGS="$CFLAGS $GLIB_CFLAGS"
|
||||
LIBS="$LIBS $GLIB_LIBS"
|
||||
AC_TRY_LINK([
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
|
||||
[ echo "*** The test program compiled, but did not run. This usually means"
|
||||
echo "*** that the run-time linker is not finding GLIB or finding the wrong"
|
||||
echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
|
||||
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
|
||||
echo "*** to the installed location Also, make sure you have run ldconfig if that"
|
||||
echo "*** is required on your system"
|
||||
echo "***"
|
||||
echo "*** If you have an old version installed, it is best to remove it, although"
|
||||
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
|
||||
echo "***"
|
||||
echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
|
||||
echo "*** came with the system with the command"
|
||||
echo "***"
|
||||
echo "*** rpm --erase --nodeps gtk gtk-devel" ],
|
||||
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||
echo "*** exact error that occured. This usually means GLIB was incorrectly installed"
|
||||
echo "*** or that you have moved GLIB since it was installed. In the latter case, you"
|
||||
echo "*** may want to edit the glib-config script: $GLIB_CONFIG" ])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
GLIB_CFLAGS=""
|
||||
GLIB_LIBS=""
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
AC_SUBST(GLIB_CFLAGS)
|
||||
AC_SUBST(GLIB_LIBS)
|
||||
rm -f conf.glibtest
|
||||
])
|
||||
|
||||
# Macro to add for using GNU gettext.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||
#
|
||||
# This file can be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU Public License
|
||||
# but which still want to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code is *not* freely available.
|
||||
|
||||
# serial 108
|
||||
|
||||
AC_PREREQ(2.13) dnl Minimum Autoconf version required.
|
||||
|
||||
AC_DEFUN(NANO_AM_WITH_NLS,
|
||||
[AC_MSG_CHECKING([whether NLS is requested])
|
||||
dnl Default is enabled NLS
|
||||
AC_ARG_ENABLE(nls,
|
||||
[ --disable-nls do not use Native Language Support],
|
||||
USE_NLS=$enableval, USE_NLS=yes)
|
||||
AC_MSG_RESULT($USE_NLS)
|
||||
AC_SUBST(USE_NLS)
|
||||
|
||||
USE_INCLUDED_LIBINTL=no
|
||||
|
||||
AC_ARG_WITH(locale-dir,
|
||||
[ --with-locale-dir=DIR specify locale directory],
|
||||
LOCALE_DIR=$withval)
|
||||
test -z "$LOCALE_DIR" && LOCALE_DIR='$(datadir)/locale'
|
||||
AC_SUBST(LOCALE_DIR)
|
||||
|
||||
AC_ARG_WITH(gnu-locale-dir,
|
||||
[ --with-gnu-locale-dir=DIR specify GNU locale directory],
|
||||
GNU_LOCALE_DIR=$withval)
|
||||
test -z "$GNU_LOCALE_DIR" && GNU_LOCALE_DIR='$(prefix)/share/locale'
|
||||
AC_SUBST(GNU_LOCALE_DIR)
|
||||
|
||||
dnl If we use NLS figure out what method
|
||||
if test "$USE_NLS" = "yes"; then
|
||||
AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if NLS is requested.])
|
||||
AC_MSG_CHECKING([whether included gettext is requested])
|
||||
AC_ARG_WITH(included-gettext,
|
||||
[ --with-included-gettext use the GNU gettext library included here],
|
||||
nls_cv_force_use_gnu_gettext=$withval,
|
||||
nls_cv_force_use_gnu_gettext=no)
|
||||
AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
|
||||
|
||||
nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
|
||||
if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
|
||||
dnl User does not insist on using GNU NLS library. Figure out what
|
||||
dnl to use. If gettext or catgets are available (in this order) we
|
||||
dnl use this. Else we have to fall back to GNU NLS library.
|
||||
dnl catgets is only used if permitted by option --with-catgets.
|
||||
nls_cv_header_intl=
|
||||
nls_cv_header_libgt=
|
||||
CATOBJEXT=NONE
|
||||
|
||||
AC_CHECK_HEADER(libintl.h,
|
||||
[AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
|
||||
[AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
|
||||
gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
|
||||
|
||||
if test "$gt_cv_func_gettext_libc" != "yes"; then
|
||||
AC_CHECK_LIB(intl, bindtextdomain,
|
||||
[AC_CHECK_LIB(intl, gettext)])
|
||||
fi
|
||||
|
||||
if test "$gt_cv_func_gettext_libc" = "yes" \
|
||||
|| test "$ac_cv_lib_intl_gettext" = "yes"; then
|
||||
AC_DEFINE(HAVE_GETTEXT, 1,
|
||||
[Define to 1 if you have gettext and don't want to use GNU gettext.])
|
||||
NANO_AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
|
||||
if test "$MSGFMT" != "no"; then
|
||||
AC_CHECK_FUNCS(dcgettext)
|
||||
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
|
||||
NANO_AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||
AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
|
||||
return _nl_msg_cat_cntr],
|
||||
[CATOBJEXT=.gmo
|
||||
DATADIRNAME=share],
|
||||
[CATOBJEXT=.mo
|
||||
DATADIRNAME=lib])
|
||||
INSTOBJEXT=.mo
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
if test "$CATOBJEXT" = "NONE"; then
|
||||
AC_MSG_CHECKING([whether catgets can be used])
|
||||
AC_ARG_WITH(catgets,
|
||||
[ --with-catgets use catgets functions if available],
|
||||
nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
|
||||
AC_MSG_RESULT($nls_cv_use_catgets)
|
||||
|
||||
if test "$nls_cv_use_catgets" = "yes"; then
|
||||
dnl No gettext in C library. Try catgets next.
|
||||
AC_CHECK_LIB(i, main)
|
||||
AC_CHECK_FUNC(catgets,
|
||||
[AC_DEFINE(HAVE_CATGETS, 1,
|
||||
[Define as 1 if you have catgets and don't want to use GNU gettext.])
|
||||
INTLOBJS="\$(CATOBJS)"
|
||||
AC_PATH_PROG(GENCAT, gencat, no)dnl
|
||||
if test "$GENCAT" != "no"; then
|
||||
AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
|
||||
if test "$GMSGFMT" = "no"; then
|
||||
NANO_AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
|
||||
fi
|
||||
NANO_AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||
USE_INCLUDED_LIBINTL=yes
|
||||
CATOBJEXT=.cat
|
||||
INSTOBJEXT=.cat
|
||||
DATADIRNAME=lib
|
||||
INTLDEPS='$(top_builddir)/intl/libintl.a'
|
||||
INTLLIBS=$INTLDEPS
|
||||
LIBS=`echo $LIBS | sed -e 's/-lintl//'`
|
||||
nls_cv_header_intl=intl/libintl.h
|
||||
nls_cv_header_libgt=intl/libgettext.h
|
||||
fi])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$CATOBJEXT" = "NONE"; then
|
||||
dnl Neither gettext nor catgets in included in the C library.
|
||||
dnl Fall back on GNU gettext library.
|
||||
nls_cv_use_gnu_gettext=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$nls_cv_use_gnu_gettext" = "yes"; then
|
||||
dnl Mark actions used to generate GNU NLS library.
|
||||
INTLOBJS="\$(GETTOBJS)"
|
||||
NANO_AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
|
||||
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
|
||||
NANO_AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||
AC_SUBST(MSGFMT)
|
||||
USE_INCLUDED_LIBINTL=yes
|
||||
CATOBJEXT=.gmo
|
||||
INSTOBJEXT=.mo
|
||||
DATADIRNAME=share
|
||||
INTLDEPS='$(top_builddir)/intl/libintl.a'
|
||||
INTLLIBS=$INTLDEPS
|
||||
LIBS=`echo $LIBS | sed -e 's/-lintl//'`
|
||||
nls_cv_header_intl=intl/libintl.h
|
||||
nls_cv_header_libgt=intl/libgettext.h
|
||||
fi
|
||||
|
||||
dnl Test whether we really found GNU xgettext.
|
||||
if test "$XGETTEXT" != ":"; then
|
||||
dnl If it is no GNU xgettext we define it as : so that the
|
||||
dnl Makefiles still can work.
|
||||
if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
|
||||
: ;
|
||||
else
|
||||
AC_MSG_RESULT(
|
||||
[found xgettext program is not GNU xgettext; ignore it])
|
||||
XGETTEXT=":"
|
||||
fi
|
||||
fi
|
||||
|
||||
# We need to process the po/ directory.
|
||||
POSUB=po
|
||||
else
|
||||
DATADIRNAME=share
|
||||
nls_cv_header_intl=intl/libintl.h
|
||||
nls_cv_header_libgt=intl/libgettext.h
|
||||
fi
|
||||
if test -z "$nls_cv_header_intl"; then
|
||||
# Clean out junk possibly left behind by a previous configuration.
|
||||
rm -f intl/libintl.h
|
||||
fi
|
||||
AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
|
||||
AC_OUTPUT_COMMANDS(
|
||||
[case "$CONFIG_FILES" in *po/Makefile.in*)
|
||||
sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
|
||||
esac])
|
||||
|
||||
|
||||
# If this is used in GNU gettext we have to set USE_NLS to `yes'
|
||||
# because some of the sources are only built for this goal.
|
||||
if test "$PACKAGE" = gettext; then
|
||||
USE_NLS=yes
|
||||
USE_INCLUDED_LIBINTL=yes
|
||||
fi
|
||||
|
||||
dnl These rules are solely for the distribution goal. While doing this
|
||||
dnl we only have to keep exactly one list of the available catalogs
|
||||
dnl in configure.in.
|
||||
for lang in $ALL_LINGUAS; do
|
||||
GMOFILES="$GMOFILES $lang.gmo"
|
||||
POFILES="$POFILES $lang.po"
|
||||
done
|
||||
|
||||
dnl Make all variables we use known to autoconf.
|
||||
AC_SUBST(USE_INCLUDED_LIBINTL)
|
||||
AC_SUBST(CATALOGS)
|
||||
AC_SUBST(CATOBJEXT)
|
||||
AC_SUBST(DATADIRNAME)
|
||||
AC_SUBST(GMOFILES)
|
||||
AC_SUBST(INSTOBJEXT)
|
||||
AC_SUBST(INTLDEPS)
|
||||
AC_SUBST(INTLLIBS)
|
||||
AC_SUBST(INTLOBJS)
|
||||
AC_SUBST(POFILES)
|
||||
AC_SUBST(POSUB)
|
||||
])
|
||||
|
||||
AC_DEFUN(NANO_AM_GNU_GETTEXT,
|
||||
[AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
AC_REQUIRE([AC_ISC_POSIX])dnl
|
||||
AC_REQUIRE([AC_HEADER_STDC])dnl
|
||||
AC_REQUIRE([AC_C_CONST])dnl
|
||||
AC_REQUIRE([AC_C_INLINE])dnl
|
||||
AC_REQUIRE([AC_TYPE_OFF_T])dnl
|
||||
AC_REQUIRE([AC_TYPE_SIZE_T])dnl
|
||||
AC_REQUIRE([AC_FUNC_ALLOCA])dnl
|
||||
AC_REQUIRE([AC_FUNC_MMAP])dnl
|
||||
|
||||
AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
|
||||
unistd.h sys/param.h])
|
||||
AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
|
||||
strdup __argz_count __argz_stringify __argz_next])
|
||||
|
||||
if test "${ac_cv_func_stpcpy+set}" != "set"; then
|
||||
AC_CHECK_FUNCS(stpcpy)
|
||||
fi
|
||||
if test "${ac_cv_func_stpcpy}" = "yes"; then
|
||||
AC_DEFINE(HAVE_STPCPY, 1, [Define to 1 if you have the stpcpy function.])
|
||||
fi
|
||||
|
||||
NANO_AM_LC_MESSAGES
|
||||
NANO_AM_WITH_NLS
|
||||
|
||||
if test "x$CATOBJEXT" != "x"; then
|
||||
if test "x$ALL_LINGUAS" = "x"; then
|
||||
LINGUAS=
|
||||
else
|
||||
AC_MSG_CHECKING(for catalogs to be installed)
|
||||
NEW_LINGUAS=
|
||||
for lang in ${LINGUAS=$ALL_LINGUAS}; do
|
||||
case "$ALL_LINGUAS" in
|
||||
*$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
|
||||
esac
|
||||
done
|
||||
LINGUAS=$NEW_LINGUAS
|
||||
AC_MSG_RESULT($LINGUAS)
|
||||
fi
|
||||
|
||||
dnl Construct list of names of catalog files to be constructed.
|
||||
if test -n "$LINGUAS"; then
|
||||
for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl The reference to <locale.h> in the installed <libintl.h> file
|
||||
dnl must be resolved because we cannot expect the users of this
|
||||
dnl to define HAVE_LOCALE_H.
|
||||
if test $ac_cv_header_locale_h = yes; then
|
||||
INCLUDE_LOCALE_H="#include <locale.h>"
|
||||
else
|
||||
INCLUDE_LOCALE_H="\
|
||||
/* The system does not provide the header <locale.h>. Take care yourself. */"
|
||||
fi
|
||||
AC_SUBST(INCLUDE_LOCALE_H)
|
||||
|
||||
dnl Determine which catalog format we have (if any is needed)
|
||||
dnl For now we know about two different formats:
|
||||
dnl Linux libc-5 and the normal X/Open format
|
||||
test -d intl || mkdir intl
|
||||
if test "$CATOBJEXT" = ".cat"; then
|
||||
AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
|
||||
|
||||
dnl Transform the SED scripts while copying because some dumb SEDs
|
||||
dnl cannot handle comments.
|
||||
sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
|
||||
fi
|
||||
dnl po2tbl.sed is always needed.
|
||||
sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
|
||||
$srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
|
||||
|
||||
dnl In the intl/Makefile.in we have a special dependency which makes
|
||||
dnl only sense for gettext. We comment this out for non-gettext
|
||||
dnl packages.
|
||||
if test "$PACKAGE" = "gettext"; then
|
||||
GT_NO="#NO#"
|
||||
GT_YES=
|
||||
else
|
||||
GT_NO=
|
||||
GT_YES="#YES#"
|
||||
fi
|
||||
AC_SUBST(GT_NO)
|
||||
AC_SUBST(GT_YES)
|
||||
|
||||
dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
|
||||
dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
|
||||
dnl Try to locate is.
|
||||
MKINSTALLDIRS=
|
||||
if test -n "$ac_aux_dir"; then
|
||||
MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
|
||||
fi
|
||||
if test -z "$MKINSTALLDIRS"; then
|
||||
MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
|
||||
fi
|
||||
AC_SUBST(MKINSTALLDIRS)
|
||||
|
||||
dnl *** For now the libtool support in intl/Makefile is not for real.
|
||||
l=
|
||||
AC_SUBST(l)
|
||||
|
||||
dnl Generate list of files to be processed by xgettext which will
|
||||
dnl be included in po/Makefile.
|
||||
test -d po || mkdir po
|
||||
case "$srcdir" in
|
||||
.)
|
||||
posrcprefix="../" ;;
|
||||
/* | [[A-Za-z]]:*)
|
||||
posrcprefix="$srcdir/" ;;
|
||||
*)
|
||||
posrcprefix="../$srcdir/" ;;
|
||||
esac
|
||||
rm -f po/POTFILES
|
||||
sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
|
||||
< $srcdir/po/POTFILES.in > po/POTFILES
|
||||
])
|
||||
|
||||
# Search path for a program which passes the given test.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||
#
|
||||
# This file can be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU Public License
|
||||
# but which still want to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code is *not* freely available.
|
||||
|
||||
# serial 1
|
||||
|
||||
dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
|
||||
dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
|
||||
AC_DEFUN(NANO_AM_PATH_PROG_WITH_TEST,
|
||||
[# Extract the first word of "$2", so it can be a program name with args.
|
||||
set dummy $2; ac_word=[$]2
|
||||
AC_MSG_CHECKING([for $ac_word])
|
||||
AC_CACHE_VAL(ac_cv_path_$1,
|
||||
[case "[$]$1" in
|
||||
/*)
|
||||
ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in ifelse([$5], , $PATH, [$5]); do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/$ac_word; then
|
||||
if [$3]; then
|
||||
ac_cv_path_$1="$ac_dir/$ac_word"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
dnl If no 4th arg is given, leave the cache variable unset,
|
||||
dnl so AC_PATH_PROGS will keep looking.
|
||||
ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
|
||||
])dnl
|
||||
;;
|
||||
esac])dnl
|
||||
$1="$ac_cv_path_$1"
|
||||
if test -n "[$]$1"; then
|
||||
AC_MSG_RESULT([$]$1)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
AC_SUBST($1)dnl
|
||||
])
|
||||
|
||||
# Search path for a program which passes the given test.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||
#
|
||||
# This file can be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU General Public License
|
||||
# but which still want to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code is *not* freely available.
|
||||
|
||||
# serial 1
|
||||
|
||||
dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
|
||||
dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
|
||||
AC_DEFUN([AM_PATH_PROG_WITH_TEST],
|
||||
[# Extract the first word of "$2", so it can be a program name with args.
|
||||
set dummy $2; ac_word=[$]2
|
||||
AC_MSG_CHECKING([for $ac_word])
|
||||
AC_CACHE_VAL(ac_cv_path_$1,
|
||||
[case "[$]$1" in
|
||||
/*)
|
||||
ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in ifelse([$5], , $PATH, [$5]); do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/$ac_word; then
|
||||
if [$3]; then
|
||||
ac_cv_path_$1="$ac_dir/$ac_word"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
dnl If no 4th arg is given, leave the cache variable unset,
|
||||
dnl so AC_PATH_PROGS will keep looking.
|
||||
ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
|
||||
])dnl
|
||||
;;
|
||||
esac])dnl
|
||||
$1="$ac_cv_path_$1"
|
||||
if test -n "[$]$1"; then
|
||||
AC_MSG_RESULT([$]$1)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
AC_SUBST($1)dnl
|
||||
])
|
||||
|
||||
# Check whether LC_MESSAGES is available in <locale.h>.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||
#
|
||||
# This file can be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU Public License
|
||||
# but which still want to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code is *not* freely available.
|
||||
|
||||
# serial 2
|
||||
|
||||
AC_PREREQ(2.13) dnl Minimum Autoconf version required.
|
||||
|
||||
AC_DEFUN(NANO_AM_LC_MESSAGES,
|
||||
[if test $ac_cv_header_locale_h = yes; then
|
||||
AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
|
||||
[AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
|
||||
am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
|
||||
if test $am_cv_val_LC_MESSAGES = yes; then
|
||||
AC_DEFINE(HAVE_LC_MESSAGES, 1,
|
||||
[Define if your locale.h file contains LC_MESSAGES.])
|
||||
fi
|
||||
fi])
|
||||
|
||||
7
autogen.sh
Executable file
7
autogen.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
# Generate configure & friends for CVS users.
|
||||
|
||||
aclocal -I ./m4
|
||||
automake --add-missing
|
||||
autoheader
|
||||
autoconf
|
||||
67
color.c
67
color.c
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 1999 Chris Allegretta *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 1, or (at your option) *
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
* any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
@@ -98,14 +98,73 @@ void colorinit_one(int colortoset, short fg, short bg, int bold)
|
||||
|
||||
int do_colorinit(void)
|
||||
{
|
||||
int i;
|
||||
colortype *tmpcolor = NULL, *beforenow = NULL;
|
||||
int defok = 0;
|
||||
|
||||
if (has_colors()) {
|
||||
start_color();
|
||||
/* Add in colors, if available */
|
||||
|
||||
#ifdef HAVE_USE_DEFAULT_COLORS
|
||||
/* Use if at all possible for transparent terminals =-) */
|
||||
use_default_colors();
|
||||
if (use_default_colors() != ERR) {
|
||||
defok = 1;
|
||||
#endif
|
||||
/* Some defaults values to play with */
|
||||
|
||||
i = 1;
|
||||
for (tmpcolor = colorstrings; tmpcolor != NULL;
|
||||
tmpcolor = tmpcolor->next) {
|
||||
|
||||
for (beforenow = colorstrings; beforenow != NULL
|
||||
&& beforenow != tmpcolor &&
|
||||
(beforenow->fg != tmpcolor->fg || beforenow->bg != tmpcolor->bg
|
||||
|| beforenow->bright != tmpcolor->bright);
|
||||
beforenow = beforenow->next)
|
||||
;
|
||||
|
||||
if (beforenow != NULL && beforenow != tmpcolor) {
|
||||
tmpcolor->pairnum = beforenow->pairnum;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (defok && tmpcolor->bg == -1)
|
||||
init_pair(i, tmpcolor->fg, -1);
|
||||
else if (tmpcolor->bg == -1)
|
||||
init_pair(i, tmpcolor->fg, COLOR_BLACK);
|
||||
else /* They picked a fg and bg color */
|
||||
init_pair(i, tmpcolor->fg, tmpcolor->bg);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Running init_pair with fg = %d and bg = %d\n", tmpcolor->fg, tmpcolor->bg);
|
||||
#endif
|
||||
|
||||
tmpcolor->pairnum = i;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if (use_default_colors() != ERR) {
|
||||
init_pair(COLOR_BLACK, -1, -1);
|
||||
init_pair(COLOR_GREEN, COLOR_GREEN, -1);
|
||||
init_pair(COLOR_WHITE, COLOR_WHITE, -1);
|
||||
init_pair(COLOR_RED, COLOR_RED, -1);
|
||||
init_pair(COLOR_CYAN, COLOR_CYAN, -1);
|
||||
init_pair(COLOR_MAGENTA, COLOR_MAGENTA, -1);
|
||||
init_pair(COLOR_BLUE, COLOR_BLUE, -1);
|
||||
init_pair(COLOR_YELLOW, COLOR_YELLOW, -1);
|
||||
|
||||
} else {
|
||||
init_pair(COLOR_BLACK, COLOR_BLACK, COLOR_BLACK);
|
||||
init_pair(COLOR_GREEN, COLOR_GREEN, COLOR_BLACK);
|
||||
init_pair(COLOR_WHITE, COLOR_WHITE, COLOR_BLACK);
|
||||
init_pair(COLOR_RED, COLOR_RED, COLOR_BLACK);
|
||||
init_pair(COLOR_CYAN, COLOR_CYAN, COLOR_BLACK);
|
||||
init_pair(COLOR_MAGENTA, COLOR_MAGENTA, COLOR_BLACK);
|
||||
init_pair(COLOR_BLUE, COLOR_BLUE, COLOR_BLACK);
|
||||
init_pair(COLOR_YELLOW, COLOR_YELLOW, COLOR_BLACK);
|
||||
}
|
||||
*/
|
||||
|
||||
/* Okay I'll be nice and comment these out for the commit =)
|
||||
colorinit_one(COLOR_TITLEBAR, COLOR_GREEN, COLOR_BLUE, 1);
|
||||
|
||||
231
config.h.in
231
config.h.in
@@ -1,231 +0,0 @@
|
||||
/* config.h.in. Generated automatically from configure.in by autoheader 2.13. */
|
||||
|
||||
/* Define if using alloca.c. */
|
||||
#undef C_ALLOCA
|
||||
|
||||
/* Define to empty if the keyword does not work. */
|
||||
#undef const
|
||||
|
||||
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
|
||||
This function is required for alloca.c support on those systems. */
|
||||
#undef CRAY_STACKSEG_END
|
||||
|
||||
/* Define if you have alloca, as a function or macro. */
|
||||
#undef HAVE_ALLOCA
|
||||
|
||||
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
|
||||
#undef HAVE_ALLOCA_H
|
||||
|
||||
/* Define if you don't have vprintf but do have _doprnt. */
|
||||
#undef HAVE_DOPRNT
|
||||
|
||||
/* Define if you have a working `mmap' system call. */
|
||||
#undef HAVE_MMAP
|
||||
|
||||
/* Define if you have the vprintf function. */
|
||||
#undef HAVE_VPRINTF
|
||||
|
||||
/* Define as __inline if that's what the C compiler calls it. */
|
||||
#undef inline
|
||||
|
||||
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||
#undef off_t
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||
#undef size_t
|
||||
|
||||
/* If using the C implementation of alloca, define if you know the
|
||||
direction of stack growth for your system; otherwise it will be
|
||||
automatically deduced at run-time.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown
|
||||
*/
|
||||
#undef STACK_DIRECTION
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define this if you have the wresize function in your ncurses-type library */
|
||||
#undef HAVE_WRESIZE
|
||||
|
||||
/* Define this if you have the resizeterm function in your ncurses-type library */
|
||||
#undef HAVE_RESIZETERM
|
||||
|
||||
/* Define this if your curses lib has the _use_keypad flag */
|
||||
#undef HAVE_USEKEYPAD
|
||||
|
||||
/* Define this to make the nano executable as small as possible */
|
||||
#undef NANO_SMALL
|
||||
|
||||
/* Define to use the slang wrappers for curses instead of native curses */
|
||||
#undef USE_SLANG
|
||||
|
||||
/* Define this to enable the extra stuff */
|
||||
#undef NANO_EXTRA
|
||||
|
||||
/* Define to disable the tab completion code Chris worked so hard on! */
|
||||
#undef DISABLE_TABCOMP
|
||||
|
||||
/* Define this to disable the justify routine */
|
||||
#undef DISABLE_JUSTIFY
|
||||
|
||||
/* Define this to disable the use(full|less) spelling functions */
|
||||
#undef DISABLE_SPELLER
|
||||
|
||||
/* Define this to disable the ^G help menu */
|
||||
#undef DISABLE_HELP
|
||||
|
||||
/* Define this to disable the built-in (crappy) file browser */
|
||||
#undef DISABLE_BROWSER
|
||||
|
||||
/* Define this to disable any and all text wrapping */
|
||||
#undef DISABLE_WRAPPING
|
||||
|
||||
/* Define this to disable the mouse functions */
|
||||
#undef DISABLE_MOUSE
|
||||
|
||||
/* Define this to load files upon inserting them, and allow switching between them; this is disabled if NANO_SMALL is defined */
|
||||
#undef ENABLE_MULTIBUFFER
|
||||
|
||||
/* Define this to use the .nanorc file */
|
||||
#undef ENABLE_NANORC
|
||||
|
||||
/* Define this if your curses library has the use_default_colors command */
|
||||
#undef HAVE_USE_DEFAULT_COLORS
|
||||
|
||||
/* Define this to have syntax hilighting, requires ENABLE_NANORC too! */
|
||||
#undef ENABLE_COLOR
|
||||
|
||||
/* Define if you have the __argz_count function. */
|
||||
#undef HAVE___ARGZ_COUNT
|
||||
|
||||
/* Define if you have the __argz_next function. */
|
||||
#undef HAVE___ARGZ_NEXT
|
||||
|
||||
/* Define if you have the __argz_stringify function. */
|
||||
#undef HAVE___ARGZ_STRINGIFY
|
||||
|
||||
/* Define if you have the dcgettext function. */
|
||||
#undef HAVE_DCGETTEXT
|
||||
|
||||
/* Define if you have the getcwd function. */
|
||||
#undef HAVE_GETCWD
|
||||
|
||||
/* Define if you have the getopt_long function. */
|
||||
#undef HAVE_GETOPT_LONG
|
||||
|
||||
/* Define if you have the getpagesize function. */
|
||||
#undef HAVE_GETPAGESIZE
|
||||
|
||||
/* Define if you have the munmap function. */
|
||||
#undef HAVE_MUNMAP
|
||||
|
||||
/* Define if you have the putenv function. */
|
||||
#undef HAVE_PUTENV
|
||||
|
||||
/* Define if you have the setenv function. */
|
||||
#undef HAVE_SETENV
|
||||
|
||||
/* Define if you have the setlocale function. */
|
||||
#undef HAVE_SETLOCALE
|
||||
|
||||
/* Define if you have the snprintf function. */
|
||||
#undef HAVE_SNPRINTF
|
||||
|
||||
/* Define if you have the stpcpy function. */
|
||||
#undef HAVE_STPCPY
|
||||
|
||||
/* Define if you have the strcasecmp function. */
|
||||
#undef HAVE_STRCASECMP
|
||||
|
||||
/* Define if you have the strchr function. */
|
||||
#undef HAVE_STRCHR
|
||||
|
||||
/* Define if you have the strdup function. */
|
||||
#undef HAVE_STRDUP
|
||||
|
||||
/* Define if you have the vsnprintf function. */
|
||||
#undef HAVE_VSNPRINTF
|
||||
|
||||
/* Define if you have the <argz.h> header file. */
|
||||
#undef HAVE_ARGZ_H
|
||||
|
||||
/* Define if you have the <curses.h> header file. */
|
||||
#undef HAVE_CURSES_H
|
||||
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define if you have the <getopt.h> header file. */
|
||||
#undef HAVE_GETOPT_H
|
||||
|
||||
/* Define if you have the <limits.h> header file. */
|
||||
#undef HAVE_LIMITS_H
|
||||
|
||||
/* Define if you have the <locale.h> header file. */
|
||||
#undef HAVE_LOCALE_H
|
||||
|
||||
/* Define if you have the <malloc.h> header file. */
|
||||
#undef HAVE_MALLOC_H
|
||||
|
||||
/* Define if you have the <ncurses.h> header file. */
|
||||
#undef HAVE_NCURSES_H
|
||||
|
||||
/* 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
|
||||
|
||||
/* Define if you have the <sys/param.h> header file. */
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
|
||||
/* Define if you have the <termio.h> header file. */
|
||||
#undef HAVE_TERMIO_H
|
||||
|
||||
/* Define if you have the <termios.h> header file. */
|
||||
#undef HAVE_TERMIOS_H
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define if you have the i library (-li). */
|
||||
#undef HAVE_LIBI
|
||||
|
||||
/* Define if you have the intl library (-lintl). */
|
||||
#undef HAVE_LIBINTL
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||
#undef _FILE_OFFSET_BITS
|
||||
|
||||
/* Define for large files, on AIX-style hosts. */
|
||||
#undef _LARGE_FILES
|
||||
|
||||
/* Define to 1 if you have the stpcpy function. */
|
||||
#undef HAVE_STPCPY
|
||||
|
||||
/* Define if your locale.h file contains LC_MESSAGES. */
|
||||
#undef HAVE_LC_MESSAGES
|
||||
|
||||
/* Define to 1 if NLS is requested. */
|
||||
#undef ENABLE_NLS
|
||||
|
||||
/* Define to 1 if you have gettext and don't want to use GNU gettext. */
|
||||
#undef HAVE_GETTEXT
|
||||
|
||||
/* Define as 1 if you have catgets and don't want to use GNU gettext. */
|
||||
#undef HAVE_CATGETS
|
||||
|
||||
20
configure.in
20
configure.in
@@ -1,9 +1,9 @@
|
||||
# $Id$
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(nano.c)
|
||||
AM_INIT_AUTOMAKE(nano, 1.1.1)
|
||||
AM_INIT_AUTOMAKE(nano, 1.1.4)
|
||||
AM_CONFIG_HEADER(config.h:config.h.in)
|
||||
ALL_LINGUAS="es de fr it id fi hu ca cs gl uk ru sv no"
|
||||
ALL_LINGUAS="es de fr it id fi hu ca cs gl uk ru sv no nl da"
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_PROG_CC
|
||||
@@ -26,6 +26,7 @@ AC_ARG_ENABLE(tiny,
|
||||
AC_DEFINE(DISABLE_JUSTIFY)
|
||||
AC_DEFINE(DISABLE_BROWSER)
|
||||
AC_DEFINE(DISABLE_MOUSE)
|
||||
AC_DEFINE(DISABLE_OPERATINGDIR)
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(extra,
|
||||
@@ -33,10 +34,17 @@ AC_ARG_ENABLE(extra,
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(NANO_EXTRA) extra_support=yes
|
||||
AC_DEFINE(ENABLE_MULTIBUFFER) multibuffer_support=yes
|
||||
AC_DEFINE(ENABLE_UNDO) undo_support=yes
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(undo,
|
||||
[ --enable-undo Enable undo support],
|
||||
[if test x$enableval = xyes && test x$tiny_support != xyes; then
|
||||
AC_DEFINE(ENABLE_UNDO) undo_support=yes
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(multibuffer,
|
||||
[ --enable-multibuffer Enable use of file loading on insertion, and switching between loaded files; this is disabled if --enable-tiny is used],
|
||||
[ --enable-multibuffer Enable multiple file buffers; this is disabled if --enable-tiny is used],
|
||||
[if test x$enableval = xyes && test x$tiny_support != xyes; then
|
||||
AC_DEFINE(ENABLE_MULTIBUFFER) multibuffer_support=yes
|
||||
fi])
|
||||
@@ -103,6 +111,12 @@ AC_ARG_ENABLE(mouse,
|
||||
AC_DEFINE(DISABLE_MOUSE)
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(operatingdir,
|
||||
[ --disable-operatingdir Disable setting of operating directory (chroot of sorts)],
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_OPERATINGDIR)
|
||||
fi])
|
||||
|
||||
AC_MSG_CHECKING([whether to use slang])
|
||||
CURSES_LIB_NAME=""
|
||||
AC_ARG_WITH(slang,
|
||||
|
||||
50
cut.c
50
cut.c
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 1999 Chris Allegretta *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 1, or (at your option) *
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
* any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
@@ -141,7 +141,7 @@ void cut_marked_segment(filestruct * top, int top_x, filestruct * bot,
|
||||
/* Now, paste bot[bot_x] into top[top_x] */
|
||||
if (destructive) {
|
||||
|
||||
tmpstr = charalloc(strlen(top->data) + strlen(&bot->data[bot_x]));
|
||||
tmpstr = charalloc(top_x + strlen(&bot->data[bot_x]) + 1);
|
||||
strncpy(tmpstr, top->data, top_x);
|
||||
strcpy(&tmpstr[top_x], &bot->data[bot_x]);
|
||||
free(top->data);
|
||||
@@ -157,7 +157,7 @@ void cut_marked_segment(filestruct * top, int top_x, filestruct * bot,
|
||||
screwed somewhere. Not doing this causes update_line to annihilate
|
||||
the last line copied into the cutbuffer when the mark is set ?!?!? */
|
||||
botcopy = copy_node(bot);
|
||||
null_at(botcopy->data, bot_x);
|
||||
null_at(&botcopy->data, bot_x);
|
||||
next = botcopy->next;
|
||||
add_to_cutbuffer(botcopy);
|
||||
|
||||
@@ -180,11 +180,14 @@ void cut_marked_segment(filestruct * top, int top_x, filestruct * bot,
|
||||
filebot = next;
|
||||
} else {
|
||||
filebot = top;
|
||||
if (top_x > 0)
|
||||
new_magicline();
|
||||
}
|
||||
}
|
||||
if (top->lineno < edittop->lineno)
|
||||
edit_update(top, CENTER);
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -192,6 +195,7 @@ int do_cut_text(void)
|
||||
{
|
||||
filestruct *tmp, *fileptr = current;
|
||||
#ifndef NANO_SMALL
|
||||
int dontupdate = 0;
|
||||
int cuttingtoend = 0;
|
||||
#endif
|
||||
|
||||
@@ -249,22 +253,40 @@ int do_cut_text(void)
|
||||
cuttingtoend = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (ISSET(MARK_ISSET)) {
|
||||
if (current->lineno <= mark_beginbuf->lineno)
|
||||
if (current->lineno <= mark_beginbuf->lineno) {
|
||||
/* Don't do_update and move the screen position if the marked
|
||||
area lies entirely within the screen buffer */
|
||||
if (current->lineno == mark_beginbuf->lineno
|
||||
|| (current->lineno >= edittop->lineno
|
||||
&& mark_beginbuf->lineno <= editbot->lineno))
|
||||
dontupdate = 1;
|
||||
|
||||
cut_marked_segment(current, current_x, mark_beginbuf,
|
||||
mark_beginx, 1);
|
||||
else
|
||||
}
|
||||
else {
|
||||
/* Same as above, easier logic since we know it's a multi-line
|
||||
cut and mark_beginbuf is before current */
|
||||
if (mark_beginbuf->lineno >= edittop->lineno
|
||||
&& current->lineno <= editbot->lineno)
|
||||
dontupdate = 1;
|
||||
|
||||
cut_marked_segment(mark_beginbuf, mark_beginx, current,
|
||||
current_x, 1);
|
||||
}
|
||||
|
||||
|
||||
placewewant = xplustabs();
|
||||
UNSET(MARK_ISSET);
|
||||
|
||||
marked_cut = 1;
|
||||
set_modified();
|
||||
if (cuttingtoend)
|
||||
if (dontupdate || cuttingtoend) {
|
||||
fix_editbot();
|
||||
edit_refresh();
|
||||
else
|
||||
} else
|
||||
edit_update(current, CENTER);
|
||||
|
||||
return 1;
|
||||
@@ -411,8 +433,12 @@ int do_uncut_text(void)
|
||||
i = editbot->lineno;
|
||||
|
||||
current = newend;
|
||||
if (i <= newend->lineno)
|
||||
if (i < newend->lineno) {
|
||||
edit_update(current, CENTER);
|
||||
}
|
||||
else {
|
||||
edit_refresh();
|
||||
}
|
||||
}
|
||||
|
||||
/* If marked cut == 2, that means that we're doing a cut to end
|
||||
@@ -425,7 +451,7 @@ int do_uncut_text(void)
|
||||
tmp->data = charalloc(strlen(¤t->data[current_x]) + 1);
|
||||
strcpy(tmp->data, ¤t->data[current_x]);
|
||||
splice_node(current, tmp, current->next);
|
||||
null_at(current->data, current_x);
|
||||
null_at(¤t->data, current_x);
|
||||
current = current->next;
|
||||
current_x = 0;
|
||||
placewewant = 0;
|
||||
@@ -470,8 +496,12 @@ int do_uncut_text(void)
|
||||
|
||||
i = editbot->lineno;
|
||||
renumber(newbuf);
|
||||
if (i < newend->lineno)
|
||||
if (i < newend->lineno) {
|
||||
edit_update(fileptr, CENTER);
|
||||
}
|
||||
else {
|
||||
edit_refresh();
|
||||
}
|
||||
|
||||
dump_buffer_reverse(fileptr);
|
||||
|
||||
|
||||
109
faq.html
109
faq.html
@@ -203,7 +203,7 @@ nano was developed).</font></blockquote>
|
||||
of nano?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">The current version of nano *should*
|
||||
be 1.1.1. Of course you should always check the nano hompage to
|
||||
be 1.1.4. Of course you should always check the nano hompage to
|
||||
see what the latest and greatest version is.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
@@ -229,12 +229,9 @@ at the following fine web and ftp sites:</font>
|
||||
|
||||
<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.nano-editor.org/pub/nano">ftp://ftp.nano-editor.org/pub/nano</a></font></li>
|
||||
<font color="#330000"><a href="ftp://ftp.gnu.org/pub/gnu/nano">ftp://ftp.gnu.org/pub/gnu/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>
|
||||
</ul>
|
||||
</blockquote>
|
||||
|
||||
@@ -250,11 +247,6 @@ packages.</font></h2>
|
||||
<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.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>
|
||||
</ul>
|
||||
<font color="#330000">Additionally, check out the Redhat contribs section
|
||||
at:</font>
|
||||
@@ -276,9 +268,15 @@ current nano packages for:</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/testing/editors/nano.html">testing</a></font></li>
|
||||
|
||||
<li>
|
||||
<font color="#330000"><a href="http://www.debian.org/Packages/unstable/editors/nano.html">unstable</a></font></li>
|
||||
</ul>
|
||||
<p><font color="#330000">You can also have a look at the</font>
|
||||
<font color="#330000"><a href="ftp://ftp.debian.org/debian/pool/main/n/nano/">Package Pool</a> to see all the available binary and source packages.</font></p>
|
||||
|
||||
<font color="#330000">Note that versions < 0.9.10 are probably not for
|
||||
those wanting to get serious work done, so if you are using Debian 2.2, check
|
||||
that you have updated to 2.2r3, which comes with nano 0.9.23. If you're
|
||||
@@ -372,6 +370,7 @@ list:
|
||||
<b>--disable-browser</b> Disables mini file browser
|
||||
<b>--disable-wrapping</b> Disables all wrapping of text (and -w flag)
|
||||
<b>--disable-mouse</b> Disables mouse support (and -m flag)
|
||||
<b>--disable-operatingdir</b> Disable setting of operating directory
|
||||
</pre><br>
|
||||
There's also the <b>--enable-tiny</b> option which disables everything
|
||||
above, as well as some larger chunks of the program (like the marker code
|
||||
@@ -381,7 +380,7 @@ disable internationalization and save a few K to a few dozen K depending
|
||||
on if you have locale support on your system. And finally there's always
|
||||
good old <b>strip</b> to strip all debugging code and code that exists in
|
||||
libraries on your system.
|
||||
<p>If, in the other hand, you can't live with bells and whistles, you could
|
||||
<p>If, in the other hand, you can't live without bells and whistles, you could
|
||||
try:
|
||||
<pre>
|
||||
<b>--enable-extra</b> Enable extra functions, including easter eggs
|
||||
@@ -394,29 +393,33 @@ try:
|
||||
<a NAME="3.7"></a><font color="#330000">
|
||||
3.7. Tell me more about this multibuffer stuff!</font></h2>
|
||||
|
||||
<blockquote><font color="#330000"> To use multiple file buffers, you must be using nano 1.1.1
|
||||
or newer, and you must have configured nano with <b>--enable-multibuffer</b> or
|
||||
<b>--enable-extra</b> (use nano -V to check). Then when you want to enable inserting a file
|
||||
into its own buffer instead of into the current file, just hit <b>Meta-F</b>, then insert the
|
||||
file as normal with <b>^R</b>. If you always want files to be loaded into their own buffers,
|
||||
<blockquote><font color="#330000"> To use multiple file buffers, you must
|
||||
be using nano 1.1.4 or newer, and you must have configured nano with
|
||||
<b>--enable-multibuffer</b> or <b>--enable-extra</b> (use nano -V to check).
|
||||
Then when you want to enable inserting a file into its own buffer instead of
|
||||
into the current file, just hit <b>Meta-F</b>, then insert the file as normal
|
||||
with <b>^R</b>. If you always want files to be loaded into their own buffers,
|
||||
use the <b>--multibuffer</b> or <b>-F</b> flag when you invoke nano. <P>
|
||||
|
||||
You can move between the buffers you have open with the <b>Meta-<</b> and <b>Meta-></b>
|
||||
keys, or more easily with <b>Meta-,</b> and <b>Meta-.</b> (clear as mud, right? =-).
|
||||
When you have more than one file buffer open, the ^X shortcut will say "Close", instead of the
|
||||
normal "Exit" when only one buffer is open.
|
||||
You can move between the buffers you have open with the <b>Meta-<</b> and
|
||||
<b>Meta-></b> keys, or more easily with <b>Meta-,</b> and <b>Meta-.</b>
|
||||
(clear as mud, right? =-). When you have more than one file buffer open,
|
||||
the ^X shortcut will say "Close", instead of the normal "Exit" when only one
|
||||
buffer is open.
|
||||
</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="3.8"></a><font color="#330000">
|
||||
3.8. How do I make a .nanorc file that nano will read when I start it?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000"> It's not hard at all! But, your version of nano must have
|
||||
beem compiled with <b>--enable-nanorc</b>, and again must be version 1.1.1 or newer (use nano
|
||||
-V to check your version and compiled features). Then simply copy the <b>nanorc.sample</b>
|
||||
that came with the nano source or your nano package (most likely in /usr/doc/nano) to .nanorc
|
||||
in your home directory. If you didn't get one, the syntax is simple. Flags are turned on and
|
||||
off by using the word <b>set</b> and the getopt_long flag for the feature, for example "set
|
||||
<blockquote><font color="#330000"> It's not hard at all! But, your version
|
||||
of nano must have beem compiled with <b>--enable-nanorc</b>, and again must
|
||||
be version 1.1.4 or newer (use nano -V to check your version and compiled
|
||||
features). Then simply copy the <b>nanorc.sample</b>
|
||||
that came with the nano source or your nano package (most likely in
|
||||
/usr/doc/nano) to .nanorc in your home directory. If you didn't get one,
|
||||
the syntax is simple. Flags are turned on and off by using the word
|
||||
<b>set</b> and the getopt_long flag for the feature, for example "set
|
||||
pico" or "set nowrap". </font></blockquote> <hr WIDTH="100%">
|
||||
|
||||
<h1><a NAME="4"></a><font color="#330000">4. Running</font></h1>
|
||||
@@ -500,7 +503,7 @@ 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
|
||||
you use bash:
|
||||
you use bash (or <b>.zshrc</b> if you believe in zsh):
|
||||
<p><b>export EDITOR=/usr/local/bin/nano</b>
|
||||
<p>or if you use tcsh put this in your <b>.cshrc</b> file:
|
||||
<p><b>setenv EDITOR /usr/local/bin/nano</b>
|
||||
@@ -529,20 +532,32 @@ this in your <b>.muttrc</b>:
|
||||
<a NAME="5.1"></a><font color="#330000">5.1. There's no translation for
|
||||
my language!</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">So, uh, get someone who speaks your native
|
||||
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 <a href="mailto:nano-devel@lists.sourceforge.net">nano-devel</a> list or <a href="mailto:nano@nano-editor.org">nano@nano-editor.org</a>.</font></blockquote>
|
||||
<blockquote><font color="#330000">On June of 2001, GNU nano entered the
|
||||
<a href="www.iro.umontreal.ca/contrib/po/HTML">Free Translation Project</a>
|
||||
and since then, translations should be managed from there.
|
||||
<p>If there isn't a translation for your language, you could ask
|
||||
<a href="http://www.iro.umontreal.ca/contrib/po/HTML/teams.html">your language
|
||||
team</a> to tranlate nano, or better still, join your team and do it yourself.
|
||||
Joining a team is easy. You just need to ask the
|
||||
<a href="mailto:translation@iro.umontreal.ca">TP coordinator</a> to add you
|
||||
to your team, and send a <a href="http://www.iro.umontreal.ca/contrib/po/HTML/disclaim.html">translation disclaimer to the FSF</a> (this is necessary as
|
||||
nano is an official GNU package, but it does <strong>not</strong> mean that
|
||||
you transfer the rights of your work to the FSF, it's just so the FSF can
|
||||
legaly manage them).</p>
|
||||
<p>In any case, translating nano is very easy. 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. When you're done, you should
|
||||
send it to the TP's central po repository.
|
||||
|
||||
<h2>
|
||||
<a NAME="5.2"></a><font color="#330000">5.2. I don't like the translation
|
||||
for <x> in my language. How can I fix it?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">The best way would probably be to e-mail
|
||||
the person listed in the <b><your_language>.po</b> file with your suggested
|
||||
corrections and they can in turn forward it to the nano email address,
|
||||
or the devel list.</font></blockquote>
|
||||
the person listed in the <code>Last-Translator:</code> field in
|
||||
<b><your_language>.po</b> file with your suggested corrections and
|
||||
they can make the changes reach the nano devel list.</font></blockquote>
|
||||
|
||||
<hr WIDTH="100%">
|
||||
<h1>
|
||||
@@ -663,10 +678,28 @@ to your resume.</font></blockquote>
|
||||
<blockquote><font color="#330000">Re-read Section </font><a href="#7.4">7.4</a><font color="#330000">
|
||||
and you should know the answer.</font></blockquote>
|
||||
|
||||
<h1>
|
||||
<a NAME="8"></a>8. ChangeLog</h1>
|
||||
<h2>
|
||||
<a NAME="8"></a><font color="#330000">8. ChangeLog</font>
|
||||
</h2>
|
||||
|
||||
<blockquote>06/31/2000 - Initial framework.</blockquote>
|
||||
<blockquote>2001/10/02 - Update for Free Translation Project.</blockquote>
|
||||
<blockquote>2001/10/02 - Assorted fixes, Debian additions.</blockquote>
|
||||
<blockquote>2001/06/30 - Silly typo fix.</blockquote>
|
||||
<blockquote>2001/05/05 - Spelling fixes by David Lawrence Ramsey.</blockquote>
|
||||
<blockquote>2001/05/02 - Misc fixes.</blockquote>
|
||||
<blockquote>2001/03/26 - Typo fix in an URL.</blockquote>
|
||||
<blockquote>2001/02/17 - Advocacy updates.</blockquote>
|
||||
<blockquote>2001/02/15 - Added GNU notes for 0.9.99pre3.</blockquote>
|
||||
<blockquote>2001/02/06 - Typo fixes.</blockquote>
|
||||
<blockquote>2001/01/14 - Added note about numlock glitch.</blockquote>
|
||||
<blockquote>2001/01/10 - Linux --> GNU/Linux.</blockquote>
|
||||
<blockquote>2001/01/09 - Added "making exe smaller section.</blockquote>
|
||||
<blockquote>2000/12/19 - Typo and assorted error fixes.</blockquote>
|
||||
<blockquote>2000/11/28 - Added blurb about make install-strip.</blockquote>
|
||||
<blockquote>2000/11/19 - Changed Debian frozen to stable.</blockquote>
|
||||
<blockquote>2000/11/18 - Previous string display (4.5).</blockquote>
|
||||
<blockquote>2000/09/27 - Moved addresses to nano-editor.org.</blockquote>
|
||||
<blockquote>2000/06/31 - Initial framework.</blockquote>
|
||||
<P>
|
||||
$Id$
|
||||
</body>
|
||||
|
||||
484
files.c
484
files.c
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 1999 Chris Allegretta *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 1, or (at your option) *
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
* any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
@@ -43,18 +43,29 @@
|
||||
#define _(string) (string)
|
||||
#endif
|
||||
|
||||
/* statics for here */
|
||||
#ifndef NANO_SMALL
|
||||
static int fileformat = 0; /* 0 = *nix, 1 = DOS, 2 = Mac */
|
||||
#endif
|
||||
|
||||
/* Load file into edit buffer - takes data from file struct */
|
||||
void load_file(void)
|
||||
void load_file(int quiet)
|
||||
{
|
||||
current = fileage;
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
/* add a new entry to the open_files structure, and check for
|
||||
duplicate entries; if a duplicate entry was found, reload the
|
||||
currently open file (it may have been changed during duplicate
|
||||
handling) */
|
||||
if (add_open_file(0, 1) == 2)
|
||||
/* if quiet is zero, add a new entry to the open_files structure, and
|
||||
do duplicate checking; otherwise, update the current entry and
|
||||
don't do duplicate checking (the latter is needed in the case of
|
||||
the alternate spell checker); if a duplicate entry was found,
|
||||
reload the currently open file (it may have been changed during
|
||||
duplicate handling) */
|
||||
if (quiet != 0)
|
||||
quiet = 1;
|
||||
if (add_open_file(quiet, 1 - quiet) == 2) {
|
||||
load_open_file();
|
||||
statusbar(_("File already loaded"));
|
||||
}
|
||||
#endif
|
||||
|
||||
wmove(edit, current_y, current_x);
|
||||
@@ -74,13 +85,14 @@ void new_file(void)
|
||||
editbot = fileage;
|
||||
current = fileage;
|
||||
totlines = 1;
|
||||
totsize = 0;
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
/* if there aren't any entries in open_files, create the entry for
|
||||
this new file, and, of course, don't bother checking for
|
||||
duplicates; without this, if nano is started without a filename on
|
||||
the command line, a new file with no name will be created, but it
|
||||
will be given no open_files entry, leading to problems later on */
|
||||
the command line, a new file will be created, but it will be given
|
||||
no open_files entry, leading to problems later on */
|
||||
if (!open_files)
|
||||
add_open_file(0, 0);
|
||||
#endif
|
||||
@@ -120,6 +132,17 @@ filestruct *read_line(char *buf, filestruct * prev, int *line1ins)
|
||||
fileptr->data = charalloc(strlen(buf) + 2);
|
||||
strcpy(fileptr->data, buf);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* If it's a DOS file (CRLF), strip out the CR part*/
|
||||
if (buf[strlen(buf) - 1] == '\r') {
|
||||
fileptr->data[strlen(buf) - 1] = 0;
|
||||
totsize--;
|
||||
|
||||
if (!fileformat)
|
||||
fileformat = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (*line1ins) {
|
||||
/* Special case, insert with cursor on 1st line. */
|
||||
fileptr->prev = NULL;
|
||||
@@ -149,9 +172,10 @@ filestruct *read_line(char *buf, filestruct * prev, int *line1ins)
|
||||
}
|
||||
|
||||
|
||||
int read_file(int fd, char *filename)
|
||||
int read_file(int fd, char *filename, int quiet)
|
||||
{
|
||||
long size, num_lines = 0, linetemp = 0;
|
||||
long size;
|
||||
int num_lines = 0;
|
||||
char input[2]; /* buffer */
|
||||
char *buf;
|
||||
long i = 0, bufx = 128;
|
||||
@@ -172,12 +196,22 @@ int read_file(int fd, char *filename)
|
||||
input[1] = 0;
|
||||
/* Read the entire file into file struct */
|
||||
while ((size = read_byte(fd, filename, input)) > 0) {
|
||||
linetemp = 0;
|
||||
|
||||
if (input[0] == '\n') {
|
||||
fileptr = read_line(buf, fileptr, &line1ins);
|
||||
num_lines++;
|
||||
buf[0] = 0;
|
||||
i = 0;
|
||||
#ifndef NANO_SMALL
|
||||
/* If it's a Mac file (no LF just a CR), handle it! */
|
||||
} else if (i > 0 && buf[i-1] == '\r') {
|
||||
fileformat = 2;
|
||||
fileptr = read_line(buf, fileptr, &line1ins);
|
||||
num_lines++;
|
||||
buf[0] = input[0];
|
||||
buf[1] = 0;
|
||||
i = 1;
|
||||
#endif
|
||||
} else {
|
||||
/* Now we allocate a bigger buffer 128 characters at a time.
|
||||
If we allocate a lot of space for one line, we may indeed
|
||||
@@ -220,9 +254,18 @@ int read_file(int fd, char *filename)
|
||||
totsize--;
|
||||
|
||||
/* Update the edit buffer */
|
||||
load_file();
|
||||
load_file(quiet);
|
||||
}
|
||||
statusbar(_("Read %d lines"), num_lines);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
if (fileformat == 2)
|
||||
statusbar(_("Read %d lines (Converted Mac format)"), num_lines);
|
||||
else if (fileformat == 1)
|
||||
statusbar(_("Read %d lines (Converted DOS format)"), num_lines);
|
||||
else
|
||||
#endif
|
||||
statusbar(_("Read %d lines"), num_lines);
|
||||
|
||||
totlines += num_lines;
|
||||
|
||||
free(buf);
|
||||
@@ -262,13 +305,14 @@ int open_file(char *filename, int insert, int quiet)
|
||||
/* Don't open character or block files. Sorry, /dev/sndstat! */
|
||||
statusbar(_("File \"%s\" is a device file"), filename);
|
||||
|
||||
|
||||
if (!insert)
|
||||
new_file();
|
||||
return -1;
|
||||
}
|
||||
if (!quiet)
|
||||
statusbar(_("Reading File"));
|
||||
read_file(fd, filename);
|
||||
read_file(fd, filename, quiet);
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -281,7 +325,7 @@ int do_insertfile(int loading_file)
|
||||
|
||||
wrap_reset();
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
#if !defined(DISABLE_BROWSER) || !defined(DISABLE_MOUSE)
|
||||
currshortcut = insertfile_list;
|
||||
currslen = INSERTFILE_LIST_LEN;
|
||||
#endif
|
||||
@@ -304,7 +348,7 @@ int do_insertfile(int loading_file)
|
||||
if (i == NANO_TOFILES_KEY) {
|
||||
|
||||
char *tmp = do_browse_from(realname);
|
||||
#ifndef DISABLE_MOUSE
|
||||
#if !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE)
|
||||
currshortcut = insertfile_list;
|
||||
currslen = INSERTFILE_LIST_LEN;
|
||||
#endif
|
||||
@@ -319,6 +363,15 @@ int do_insertfile(int loading_file)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
if (operating_dir) {
|
||||
if (check_operating_dir(realname, 0)) {
|
||||
statusbar(_("Can't insert file from outside of %s"), operating_dir);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (loading_file) {
|
||||
|
||||
@@ -327,7 +380,7 @@ int do_insertfile(int loading_file)
|
||||
that could create them are taken care of elsewhere) */
|
||||
add_open_file(1, 0);
|
||||
|
||||
free_filestruct(current);
|
||||
free_filestruct(fileage);
|
||||
new_file();
|
||||
UNSET(MODIFIED);
|
||||
}
|
||||
@@ -346,7 +399,7 @@ int do_insertfile(int loading_file)
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (loading_file)
|
||||
load_file();
|
||||
load_file(0);
|
||||
else
|
||||
#endif
|
||||
|
||||
@@ -408,7 +461,7 @@ int add_open_file(int update, int dup_fix)
|
||||
{
|
||||
filestruct *tmp;
|
||||
|
||||
if (!current || !filename)
|
||||
if (!fileage || !current || !filename)
|
||||
return 1;
|
||||
|
||||
/* first, if duplicate checking is allowed, do it */
|
||||
@@ -424,8 +477,8 @@ int add_open_file(int update, int dup_fix)
|
||||
open_files = make_new_node(NULL);
|
||||
|
||||
/* if open_files->file is NULL at the nrealloc() below, we get a
|
||||
segfault */
|
||||
open_files->file = open_files;
|
||||
segfault
|
||||
open_files->file = open_files; */
|
||||
}
|
||||
|
||||
else if (!update) {
|
||||
@@ -442,8 +495,8 @@ int add_open_file(int update, int dup_fix)
|
||||
open_files = open_files->next;
|
||||
|
||||
/* if open_files->file is NULL at the nrealloc() below, we get a
|
||||
segfault */
|
||||
open_files->file = open_files;
|
||||
segfault
|
||||
open_files->file = open_files; */
|
||||
}
|
||||
|
||||
/* save current filename */
|
||||
@@ -470,14 +523,10 @@ int add_open_file(int update, int dup_fix)
|
||||
/* save current line number */
|
||||
open_files->lineno = current->lineno;
|
||||
|
||||
/* save current filestruct */
|
||||
open_files->file = nrealloc(open_files->file, sizeof(filestruct));
|
||||
while (current->prev)
|
||||
current = current->prev;
|
||||
open_files->file = copy_filestruct(current);
|
||||
do_gotoline(open_files->lineno, 1);
|
||||
placewewant = open_files->file_placewewant;
|
||||
update_line(current, current_x);
|
||||
/* save current filestruct and restore full file position afterward */
|
||||
open_files->file = nmalloc(sizeof(filestruct));
|
||||
open_files->file = copy_filestruct(fileage);
|
||||
do_gotopos(open_files->lineno, open_files->file_current_x, open_files->file_current_y, open_files->file_placewewant);
|
||||
|
||||
/* save current modification status */
|
||||
open_files->file_modified = ISSET(MODIFIED);
|
||||
@@ -525,13 +574,18 @@ int load_open_file(void)
|
||||
totlines = open_files->file_totlines;
|
||||
totsize = open_files->file_totsize;
|
||||
|
||||
/* since do_gotoline() resets the x-coordinate but not the
|
||||
y-coordinate, set all coordinates up this way */
|
||||
current_y = open_files->file_current_y;
|
||||
do_gotoline(open_files->lineno, 1);
|
||||
current_x = open_files->file_current_x;
|
||||
placewewant = open_files->file_placewewant;
|
||||
update_line(current, current_x);
|
||||
/* Unset the marker because nano can't (yet) handle marked text flipping between
|
||||
open files */
|
||||
UNSET(MARK_ISSET);
|
||||
|
||||
/* restore full file position: line number, x-coordinate, y-
|
||||
coordinate, place we want */
|
||||
do_gotopos(open_files->lineno, open_files->file_current_x, open_files->file_current_y, open_files->file_placewewant);
|
||||
|
||||
/* restore the bottom of the file */
|
||||
filebot = current;
|
||||
while (filebot->next)
|
||||
filebot = filebot->next;
|
||||
|
||||
/* set up modification status and update the titlebar */
|
||||
if (open_files->file_modified)
|
||||
@@ -541,9 +595,11 @@ int load_open_file(void)
|
||||
clearok(topwin, FALSE);
|
||||
titlebar(NULL);
|
||||
|
||||
/* if we're constantly displaying the cursor position, update it */
|
||||
/* if we're constantly displaying the cursor position, update it (and do so
|
||||
unconditionally, in the rare case that the character count is the same
|
||||
but the line count isn't) */
|
||||
if (ISSET(CONSTUPDATE))
|
||||
do_cursorpos();
|
||||
do_cursorpos(0);
|
||||
|
||||
/* now we're done */
|
||||
return 0;
|
||||
@@ -556,7 +612,7 @@ int load_open_file(void)
|
||||
*
|
||||
* Note: This should only be called inside open_file_dup_fix().
|
||||
*/
|
||||
filestruct *open_file_dup_search(void)
|
||||
filestruct *open_file_dup_search(int update)
|
||||
{
|
||||
filestruct *tmp;
|
||||
char *path;
|
||||
@@ -582,9 +638,18 @@ filestruct *open_file_dup_search(void)
|
||||
|
||||
if (!strcmp(tmp->file_path, path)) {
|
||||
|
||||
/* if it's not the current entry, we've found a duplicate */
|
||||
if (tmp != open_files)
|
||||
if (!update)
|
||||
/* if we're making a new entry and there's an entry with
|
||||
the same full path, we've found a duplicate */
|
||||
return tmp;
|
||||
else {
|
||||
|
||||
/* if we're updating an existing entry and there's an
|
||||
entry with the same full path that isn't the current
|
||||
entry, we've found a duplicate */
|
||||
if (tmp != open_files)
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
|
||||
/* go to the next entry */
|
||||
@@ -602,7 +667,7 @@ filestruct *open_file_dup_search(void)
|
||||
*/
|
||||
int open_file_dup_fix(int update)
|
||||
{
|
||||
filestruct *tmp = open_file_dup_search();
|
||||
filestruct *tmp = open_file_dup_search(update);
|
||||
|
||||
if (!tmp)
|
||||
return 0;
|
||||
@@ -766,17 +831,25 @@ int close_open_file(void)
|
||||
display_main_list();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (ENABLE_MULTIBUFFER) || !defined (DISABLE_OPERATINGDIR)
|
||||
/*
|
||||
* When passed "[relative path][filename]" in origpath, return "[full
|
||||
* path][filename]" on success, or NULL on error.
|
||||
* When passed "[relative path]" or "[relative path][filename]" in
|
||||
* origpath, return "[full path]" or "[full path][filename]" on success,
|
||||
* or NULL on error. This is still done if the file doesn't exist but
|
||||
* the relative path does (since the file could exist in memory but not
|
||||
* yet on disk); it is not done if the relative path doesn't exist (since
|
||||
* the first call to chdir() will fail then).
|
||||
*/
|
||||
char *get_full_path(const char *origpath)
|
||||
char *get_full_path(char *origpath)
|
||||
{
|
||||
char *newpath = NULL, *last_slash, *d_here, *d_there, *d_there_file;
|
||||
int last_slash_index;
|
||||
char *newpath = NULL, *last_slash, *d_here, *d_there, *d_there_file, tmp;
|
||||
int path_only, last_slash_index;
|
||||
struct stat fileinfo;
|
||||
|
||||
/* first, get the current directory */
|
||||
/* first, get the current directory, and tack a slash onto the end of
|
||||
it, unless it turns out to be "/", in which case leave it alone */
|
||||
|
||||
#ifdef PATH_MAX
|
||||
d_here = getcwd(NULL, PATH_MAX + 1);
|
||||
@@ -787,14 +860,44 @@ char *get_full_path(const char *origpath)
|
||||
if (d_here) {
|
||||
|
||||
align(&d_here);
|
||||
if (strcmp(d_here, "/")) {
|
||||
d_here = nrealloc(d_here, strlen(d_here) + 2);
|
||||
strcat(d_here, "/");
|
||||
}
|
||||
|
||||
/* get the filename (with path included) and save it in both
|
||||
d_there and d_there_file */
|
||||
/* stat origpath; if stat() fails, assume that origpath refers to
|
||||
a new file that hasn't been saved to disk yet (i. e. set
|
||||
path_only to 0); if stat() succeeds, set path_only to 0 if
|
||||
origpath doesn't refer to a directory, or to 1 if it does */
|
||||
path_only = stat(origpath, &fileinfo);
|
||||
if (path_only == -1)
|
||||
path_only = 0;
|
||||
else {
|
||||
if (S_ISDIR(fileinfo.st_mode))
|
||||
path_only = 1;
|
||||
else
|
||||
path_only = 0;
|
||||
}
|
||||
|
||||
/* save the value of origpath in both d_there and d_there_file */
|
||||
d_there = charalloc(strlen(origpath) + 1);
|
||||
d_there_file = charalloc(strlen(origpath) + 1);
|
||||
strcpy(d_there, origpath);
|
||||
strcpy(d_there_file, origpath);
|
||||
|
||||
/* if we have a path but no filename, tack slashes onto the ends
|
||||
of both d_there and d_there_file, if they don't end in slashes
|
||||
already */
|
||||
if (path_only) {
|
||||
tmp = d_there[strlen(d_there) - 1];
|
||||
if (tmp != '/') {
|
||||
d_there = nrealloc(d_there, strlen(d_there) + 2);
|
||||
strcat(d_there, "/");
|
||||
d_there_file = nrealloc(d_there_file, strlen(d_there_file) + 2);
|
||||
strcat(d_there_file, "/");
|
||||
}
|
||||
}
|
||||
|
||||
/* search for the last slash in d_there */
|
||||
last_slash = strrchr(d_there, '/');
|
||||
|
||||
@@ -807,19 +910,27 @@ char *get_full_path(const char *origpath)
|
||||
|
||||
else {
|
||||
|
||||
/* otherwise, remove all non-path elements from d_there */
|
||||
/* otherwise, remove all non-path elements from d_there
|
||||
(i. e. everything after the last slash) */
|
||||
last_slash_index = strlen(d_there) - strlen(last_slash);
|
||||
null_at(d_there, last_slash_index);
|
||||
null_at(&d_there, last_slash_index + 1);
|
||||
|
||||
/* and remove all non-file elements from d_there_file */
|
||||
last_slash++;
|
||||
d_there_file = nrealloc(d_there_file, strlen(last_slash) + 1);
|
||||
strcpy(d_there_file, last_slash);
|
||||
/* and remove all non-file elements from d_there_file (i. e.
|
||||
everything before and including the last slash); if we
|
||||
have a path but no filename, don't do anything */
|
||||
if (!path_only) {
|
||||
last_slash = strrchr(d_there_file, '/');
|
||||
last_slash++;
|
||||
strcpy(d_there_file, last_slash);
|
||||
align(&d_there_file);
|
||||
}
|
||||
|
||||
/* now go to the path specified in d_there */
|
||||
if (chdir(d_there) != -1) {
|
||||
|
||||
/* get the full pathname, and save it back in d_there */
|
||||
/* get the full pathname, and save it back in d_there,
|
||||
tacking a slash on the end if we have a path but no
|
||||
filename; if the saving fails, get out */
|
||||
|
||||
free(d_there);
|
||||
|
||||
@@ -830,6 +941,17 @@ char *get_full_path(const char *origpath)
|
||||
#endif
|
||||
|
||||
align(&d_there);
|
||||
if (d_there) {
|
||||
|
||||
/* add a slash to d_there, unless it's "/", in which
|
||||
case we don't need it */
|
||||
if (strcmp(d_there, "/")) {
|
||||
d_there = nrealloc(d_there, strlen(d_there) + 2);
|
||||
strcat(d_there, "/");
|
||||
}
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* finally, go back to where we were before, d_here (no error
|
||||
@@ -840,11 +962,17 @@ char *get_full_path(const char *origpath)
|
||||
|
||||
/* all data is set up; fill in newpath */
|
||||
|
||||
/* newpath = d_there + "/" + d_there_file */
|
||||
newpath = charalloc(strlen(d_there) + strlen(d_there_file) + 2);
|
||||
strcpy(newpath, d_there);
|
||||
strcat(newpath, "/");
|
||||
strcat(newpath, d_there_file);
|
||||
/* if we have a path and a filename, newpath = d_there +
|
||||
d_there_file; otherwise, newpath = d_there */
|
||||
if (!path_only) {
|
||||
newpath = charalloc(strlen(d_there) + strlen(d_there_file) + 1);
|
||||
strcpy(newpath, d_there);
|
||||
strcat(newpath, d_there_file);
|
||||
}
|
||||
else {
|
||||
newpath = charalloc(strlen(d_there) + 1);
|
||||
strcpy(newpath, d_there);
|
||||
}
|
||||
|
||||
/* finally, clean up */
|
||||
free(d_there_file);
|
||||
@@ -854,6 +982,80 @@ char *get_full_path(const char *origpath)
|
||||
|
||||
return newpath;
|
||||
}
|
||||
#endif /* ENABLE_MULTIBUFFER || !DISABLE_OPERATINGDIR */
|
||||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
/*
|
||||
* Check to see if we're inside the operating directory. Return 0 if we
|
||||
* are, or 1 otherwise. If allow_tabcomp is nonzero, allow incomplete
|
||||
* names that would be matches for the operating directory, so that tab
|
||||
* completion will work.
|
||||
*/
|
||||
int check_operating_dir(char *currpath, int allow_tabcomp)
|
||||
{
|
||||
/* this is static so that we only need to get it the first time this
|
||||
function is called; also, a relative operating directory path will
|
||||
only be handled properly if this is done */
|
||||
static char *full_operating_dir = NULL;
|
||||
|
||||
char *fullpath, *whereami1, *whereami2 = NULL;
|
||||
|
||||
/* if no operating directory is set, don't bother doing anything */
|
||||
if (!operating_dir)
|
||||
return 0;
|
||||
|
||||
/* if the operating directory is "/", that's the same as having no
|
||||
operating directory, so discard it and get out */
|
||||
if (!strcmp(operating_dir, "/")) {
|
||||
operating_dir = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* get the full operating (if we don't have it already) and current
|
||||
directories, and then search the current for the operating (for
|
||||
normal usage) and the operating for the current (for tab
|
||||
completion, if we're allowing it); if the current directory's path
|
||||
doesn't exist, assume we're outside the operating directory */
|
||||
if (!full_operating_dir) {
|
||||
full_operating_dir = get_full_path(operating_dir);
|
||||
|
||||
/* if get_full_path() failed, discard the operating directory */
|
||||
if (!full_operating_dir) {
|
||||
operating_dir = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* if the full operating directory is "/", that's the same as
|
||||
having no operating directory, so discard it and get out */
|
||||
if (!strcmp(full_operating_dir, "/")) {
|
||||
free(full_operating_dir);
|
||||
operating_dir = NULL;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
fullpath = get_full_path(currpath);
|
||||
if (!fullpath)
|
||||
return 1;
|
||||
|
||||
whereami1 = strstr(fullpath, full_operating_dir);
|
||||
if (allow_tabcomp)
|
||||
whereami2 = strstr(full_operating_dir, fullpath);
|
||||
|
||||
/* if both searches failed, we're outside the operating directory */
|
||||
if (!whereami1 && !whereami2)
|
||||
return 1;
|
||||
|
||||
/* check the search results; if the full operating directory path is
|
||||
not at the beginning of the full current path (for normal usage)
|
||||
and vice versa (for tab completion, if we're allowing it), we're
|
||||
outside the operating directory */
|
||||
if (whereami1 != fullpath && whereami2 != full_operating_dir)
|
||||
return 1;
|
||||
|
||||
/* otherwise, we're still inside it */
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -898,6 +1100,18 @@ int write_file(char *name, int tmp, int append, int nonamechange)
|
||||
realname = mallocstrcpy(realname, name);
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
if (!tmp && operating_dir) {
|
||||
/* if we're writing a temporary file, we're going outside the
|
||||
operating directory, so skip the operating directory test */
|
||||
if (check_operating_dir(realname, 0)) {
|
||||
statusbar(_("Can't write outside of %s"), operating_dir);
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Save the state of file at the end of the symlink (if there is one) */
|
||||
realexists = stat(realname, &st);
|
||||
|
||||
@@ -966,7 +1180,13 @@ int write_file(char *name, int tmp, int append, int nonamechange)
|
||||
fprintf(stderr, _("Wrote >%s\n"), fileptr->data);
|
||||
#endif
|
||||
}
|
||||
write(fd, "\n", 1);
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(DOS_FILE) || ISSET(MAC_FILE))
|
||||
write(fd, "\r", 1);
|
||||
|
||||
if (!ISSET(MAC_FILE))
|
||||
#endif
|
||||
write(fd, "\n", 1);
|
||||
|
||||
fileptr = fileptr->next;
|
||||
lineswritten++;
|
||||
@@ -979,12 +1199,27 @@ int write_file(char *name, int tmp, int append, int nonamechange)
|
||||
strerror(errno));
|
||||
return -1;
|
||||
} else if (size > 0) {
|
||||
size = write(fd, "\n", 1);
|
||||
lineswritten++;
|
||||
if (size == -1) {
|
||||
statusbar(_("Could not open file for writing: %s"),
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(DOS_FILE) || ISSET(MAC_FILE)) {
|
||||
size = write(fd, "\r", 1);
|
||||
lineswritten++;
|
||||
if (size == -1) {
|
||||
statusbar(_("Could not open file for writing: %s"),
|
||||
strerror(errno));
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ISSET(MAC_FILE))
|
||||
#endif
|
||||
{
|
||||
size = write(fd, "\n", 1);
|
||||
lineswritten++;
|
||||
if (size == -1) {
|
||||
statusbar(_("Could not open file for writing: %s"),
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1057,7 +1292,7 @@ int do_writeout(char *path, int exiting, int append)
|
||||
static int did_cred = 0;
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
#if !defined(DISABLE_BROWSER) || !defined(DISABLE_MOUSE)
|
||||
currshortcut = writefile_list;
|
||||
currslen = WRITEFILE_LIST_LEN;
|
||||
#endif
|
||||
@@ -1079,14 +1314,27 @@ int do_writeout(char *path, int exiting, int append)
|
||||
}
|
||||
|
||||
while (1) {
|
||||
|
||||
/* Be nice to the translation folks */
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(MARK_ISSET) && !exiting)
|
||||
i = statusq(1, writefile_list, WRITEFILE_LIST_LEN, "",
|
||||
_("%s Selection to File"), append ? _("Append") : _("Write"));
|
||||
else
|
||||
if (ISSET(MARK_ISSET) && !exiting) {
|
||||
if (append)
|
||||
i = statusq(1, writefile_list, WRITEFILE_LIST_LEN, "",
|
||||
_("Append Selection to File"));
|
||||
else
|
||||
i = statusq(1, writefile_list, WRITEFILE_LIST_LEN, "",
|
||||
_("Write Selection to File"));
|
||||
} else
|
||||
#endif
|
||||
i = statusq(1, writefile_list, WRITEFILE_LIST_LEN, answer,
|
||||
_("File Name to %s"), append ? _("Append") : _("Write"));
|
||||
{
|
||||
if (append)
|
||||
i = statusq(1, writefile_list, WRITEFILE_LIST_LEN, answer,
|
||||
_("File Name to Append"));
|
||||
else
|
||||
i = statusq(1, writefile_list, WRITEFILE_LIST_LEN, answer,
|
||||
_("File Name to Write"));
|
||||
|
||||
}
|
||||
|
||||
if (i != -1) {
|
||||
|
||||
@@ -1095,7 +1343,7 @@ int do_writeout(char *path, int exiting, int append)
|
||||
|
||||
char *tmp = do_browse_from(answer);
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
#if !defined(DISABLE_BROWSER) || !defined(DISABLE_MOUSE)
|
||||
currshortcut = writefile_list;
|
||||
currslen = WRITEFILE_LIST_LEN;
|
||||
#endif
|
||||
@@ -1325,6 +1573,16 @@ char **username_tab_completion(char *buf, int *num_matches)
|
||||
* This makes a lot more sense to me (Chris) this way...
|
||||
*/
|
||||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
/* ...unless the match exists outside the operating
|
||||
directory, in which case just go to the next match */
|
||||
|
||||
if (operating_dir) {
|
||||
if (check_operating_dir(userdata->pw_dir, 1))
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
matchline = charalloc(strlen(userdata->pw_name) + 2);
|
||||
sprintf(matchline, "~%s", userdata->pw_name);
|
||||
matches[*num_matches] = matchline;
|
||||
@@ -1415,6 +1673,27 @@ char **cwd_tab_completion(char *buf, int *num_matches)
|
||||
/* Cool, found a match. Add it to the list
|
||||
* This makes a lot more sense to me (Chris) this way...
|
||||
*/
|
||||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
/* ...unless the match exists outside the operating
|
||||
directory, in which case just go to the next match; to
|
||||
properly do operating directory checking, we have to add the
|
||||
directory name to the beginning of the proposed match
|
||||
before we check it */
|
||||
|
||||
if (operating_dir) {
|
||||
tmp2 = charalloc(strlen(dirName) + strlen(next->d_name) + 2);
|
||||
strcpy(tmp2, dirName);
|
||||
strcat(tmp2, "/");
|
||||
strcat(tmp2, next->d_name);
|
||||
if (check_operating_dir(tmp2, 1)) {
|
||||
free(tmp2);
|
||||
continue;
|
||||
}
|
||||
free(tmp2);
|
||||
}
|
||||
#endif
|
||||
|
||||
tmp2 = NULL;
|
||||
tmp2 = charalloc(strlen(next->d_name) + 1);
|
||||
strcpy(tmp2, next->d_name);
|
||||
@@ -1433,7 +1712,7 @@ char **cwd_tab_completion(char *buf, int *num_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)
|
||||
char *input_tab(char *buf, int place, int *lastWasTab, int *newplace, int *list)
|
||||
{
|
||||
/* Do TAB completion */
|
||||
static int num_matches = 0, match_matches = 0;
|
||||
@@ -1442,6 +1721,8 @@ char *input_tab(char *buf, int place, int *lastWasTab, int *newplace)
|
||||
int longestname = 0, is_dir = 0;
|
||||
char *foo;
|
||||
|
||||
*list = 0;
|
||||
|
||||
if (*lastWasTab == FALSE) {
|
||||
char *tmp, *copyto, *matchBuf;
|
||||
|
||||
@@ -1518,6 +1799,13 @@ char *input_tab(char *buf, int place, int *lastWasTab, int *newplace)
|
||||
strncpy(copyto, matches[0], strlen(matches[0]) + 1);
|
||||
*newplace += strlen(matches[0]) - pos;
|
||||
|
||||
/* if an exact match is typed in and Tab is pressed,
|
||||
*newplace will now be negative; in that case, make it
|
||||
zero, so that the cursor will stay where it is instead of
|
||||
moving backward */
|
||||
if (*newplace < 0)
|
||||
*newplace = 0;
|
||||
|
||||
/* Is it a directory? */
|
||||
append_slash_if_dir(buf, lastWasTab, newplace);
|
||||
|
||||
@@ -1565,7 +1853,7 @@ char *input_tab(char *buf, int place, int *lastWasTab, int *newplace)
|
||||
/* 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) {
|
||||
if (matches && num_matches > 1) {
|
||||
|
||||
/* Blank the edit window, and print the matches out there */
|
||||
blank_edit();
|
||||
@@ -1614,12 +1902,16 @@ char *input_tab(char *buf, int place, int *lastWasTab, int *newplace)
|
||||
}
|
||||
free(foo);
|
||||
wrefresh(edit);
|
||||
*list = 1;
|
||||
} else
|
||||
beep();
|
||||
|
||||
}
|
||||
|
||||
edit_refresh();
|
||||
/* Only refresh the edit window if we don't have a list of filename
|
||||
matches on it */
|
||||
if (*list == 0)
|
||||
edit_refresh();
|
||||
curs_set(1);
|
||||
return buf;
|
||||
}
|
||||
@@ -1801,7 +2093,7 @@ char *do_browser(char *inpath)
|
||||
|
||||
blank_statusbar_refresh();
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
#if !defined DISABLE_HELP || !defined(DISABLE_MOUSE)
|
||||
currshortcut = browser_list;
|
||||
currslen = BROWSER_LIST_LEN;
|
||||
#endif
|
||||
@@ -1912,6 +2204,10 @@ char *do_browser(char *inpath)
|
||||
else
|
||||
selected = numents - 1;
|
||||
break;
|
||||
case NANO_HELP_KEY:
|
||||
case NANO_HELP_FKEY:
|
||||
do_help();
|
||||
break;
|
||||
case KEY_ENTER:
|
||||
case NANO_ENTER_KEY:
|
||||
case 's': /* More Pico compatibility */
|
||||
@@ -1925,6 +2221,19 @@ char *do_browser(char *inpath)
|
||||
|
||||
path = mallocstrcpy(path, filelist[selected]);
|
||||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
/* Note: The case of the user's being completely outside the
|
||||
operating directory is handled elsewhere, before this
|
||||
point */
|
||||
if (operating_dir) {
|
||||
if (check_operating_dir(path, 0)) {
|
||||
statusbar(_("Can't visit parent in restricted mode"));
|
||||
beep();
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
st = filestat(path);
|
||||
if (S_ISDIR(st.st_mode)) {
|
||||
if ((test_dir = opendir(path)) == NULL) {
|
||||
@@ -1961,6 +2270,15 @@ char *do_browser(char *inpath)
|
||||
bottombars(browser_list, BROWSER_LIST_LEN);
|
||||
curs_set(0);
|
||||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
if (operating_dir) {
|
||||
if (check_operating_dir(answer, 0)) {
|
||||
statusbar(_("Can't go outside of %s in restricted mode"), operating_dir);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (j < 0) {
|
||||
statusbar(_("Goto Cancelled"));
|
||||
break;
|
||||
|
||||
171
global.c
171
global.c
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 1999 Chris Allegretta *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 1, or (at your option) *
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
* any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
@@ -60,7 +60,7 @@ filestruct *open_files = NULL; /* The list of open files */
|
||||
|
||||
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 */
|
||||
long totsize = 0; /* Total number of bytes in the file */
|
||||
int placewewant = 0; /* The column we'd like the cursor
|
||||
to jump to when we go to the
|
||||
next or previous line */
|
||||
@@ -75,6 +75,11 @@ char *help_text; /* The text in the help window */
|
||||
filestruct *mark_beginbuf; /* the begin marker buffer */
|
||||
int mark_beginx; /* X value in the string to start */
|
||||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
char *operating_dir = NULL; /* Operating directory, which we can't go
|
||||
higher than */
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_SPELLER
|
||||
char *alt_speller; /* Alternative spell command */
|
||||
#endif
|
||||
@@ -95,9 +100,10 @@ shortcut browser_list[BROWSER_LIST_LEN];
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
colorstruct colors[NUM_NCOLORS];
|
||||
colortype *colorstrings = NULL;
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
#if !defined(DISABLE_BROWSER) || !defined(DISABLE_MOUSE) || !defined (DISABLE_HELP)
|
||||
shortcut *currshortcut = main_list; /* Current shortcut list we're using */
|
||||
int currslen = MAIN_VISIBLE; /* Length of current shortcut list */
|
||||
#endif
|
||||
@@ -146,7 +152,8 @@ void toggle_init(void)
|
||||
char *toggle_const_msg, *toggle_autoindent_msg, *toggle_suspend_msg,
|
||||
*toggle_nohelp_msg, *toggle_picomode_msg, *toggle_mouse_msg,
|
||||
*toggle_cuttoend_msg, *toggle_wrap_msg, *toggle_case_msg,
|
||||
*toggle_backwards_msg;
|
||||
*toggle_backwards_msg, *toggle_dos_msg, *toggle_mac_msg,
|
||||
*toggle_smooth_msg;
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
char *toggle_load_msg, *nano_openprev_msg, *nano_opennext_msg;
|
||||
@@ -156,6 +163,7 @@ void toggle_init(void)
|
||||
char *toggle_regexp_msg;
|
||||
#endif
|
||||
|
||||
|
||||
toggle_const_msg = _("Constant cursor position");
|
||||
toggle_autoindent_msg = _("Auto indent");
|
||||
toggle_suspend_msg = _("Suspend");
|
||||
@@ -163,8 +171,12 @@ void toggle_init(void)
|
||||
toggle_picomode_msg = _("Pico mode");
|
||||
toggle_mouse_msg = _("Mouse support");
|
||||
toggle_cuttoend_msg = _("Cut to end");
|
||||
toggle_backwards_msg = _("Backwards Search");
|
||||
toggle_case_msg = _("Case Sensitive Search");
|
||||
toggle_backwards_msg = _("Backwards search");
|
||||
toggle_case_msg = _("Case sensitive search");
|
||||
toggle_dos_msg = _("Writing file in DOS format");
|
||||
toggle_mac_msg = _("Writing file in Mac format");
|
||||
toggle_smooth_msg = _("Smooth scrolling");
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
toggle_regexp_msg = _("Regular expressions");
|
||||
#endif
|
||||
@@ -196,13 +208,19 @@ void toggle_init(void)
|
||||
REVERSE_SEARCH, 0);
|
||||
toggle_init_one(&toggles[9], TOGGLE_CASE_KEY, toggle_case_msg,
|
||||
CASE_SENSITIVE, 0);
|
||||
toggle_init_one(&toggles[10], TOGGLE_DOS_KEY, toggle_dos_msg,
|
||||
DOS_FILE, 0);
|
||||
toggle_init_one(&toggles[11], TOGGLE_MAC_KEY, toggle_mac_msg,
|
||||
MAC_FILE, 0);
|
||||
toggle_init_one(&toggles[12], TOGGLE_SMOOTH_KEY, toggle_smooth_msg,
|
||||
SMOOTHSCROLL, 0);
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
toggle_init_one(&toggles[10], TOGGLE_LOAD_KEY, toggle_load_msg,
|
||||
toggle_init_one(&toggles[13], TOGGLE_LOAD_KEY, toggle_load_msg,
|
||||
MULTIBUFFER, 0);
|
||||
toggle_init_one(&toggles[11], NANO_OPENPREV_KEY, nano_openprev_msg,
|
||||
toggle_init_one(&toggles[14], NANO_OPENPREV_KEY, nano_openprev_msg,
|
||||
0, '<');
|
||||
toggle_init_one(&toggles[12], NANO_OPENNEXT_KEY, nano_opennext_msg,
|
||||
toggle_init_one(&toggles[15], NANO_OPENNEXT_KEY, nano_opennext_msg,
|
||||
0, '>');
|
||||
#endif
|
||||
|
||||
@@ -231,7 +249,10 @@ void shortcut_init(int unjustify)
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
char *nano_tofiles_msg = "", *nano_gotodir_msg = "", *nano_case_msg =
|
||||
"", *nano_reverse_msg = "", *nano_regexp_msg = "";
|
||||
"", *nano_reverse_msg = "";
|
||||
#ifdef HAVE_REGEX_H
|
||||
char *nano_regexp_msg = "", *nano_bracket_msg = "";
|
||||
#endif
|
||||
|
||||
nano_help_msg = _("Invoke the help menu");
|
||||
nano_writeout_msg = _("Write the current file to disk");
|
||||
@@ -275,8 +296,11 @@ void shortcut_init(int unjustify)
|
||||
nano_gotodir_msg = _("Goto Directory");
|
||||
nano_cancel_msg = _("Cancel the current function");
|
||||
nano_append_msg = _("Append to the current file");
|
||||
nano_reverse_msg = _("Search Backwards");
|
||||
nano_regexp_msg = _("Use Regular Expressions");
|
||||
nano_reverse_msg = _("Search backwards");
|
||||
#ifdef HAVE_REGEX_H
|
||||
nano_regexp_msg = _("Use Regular expressions");
|
||||
nano_bracket_msg = _("Find other bracket");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
sc_init_one(&main_list[0], NANO_HELP_KEY, _("Get Help"),
|
||||
@@ -320,11 +344,11 @@ void shortcut_init(int unjustify)
|
||||
|
||||
sc_init_one(&main_list[6], NANO_PREVPAGE_KEY, _("Prev Page"),
|
||||
nano_prevpage_msg,
|
||||
0, NANO_PREVPAGE_FKEY, KEY_PPAGE, VIEW, page_up);
|
||||
0, NANO_PREVPAGE_FKEY, KEY_PPAGE, VIEW, do_page_up);
|
||||
|
||||
sc_init_one(&main_list[7], NANO_NEXTPAGE_KEY, _("Next Page"),
|
||||
nano_nextpage_msg,
|
||||
0, NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, page_down);
|
||||
0, NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, do_page_down);
|
||||
|
||||
sc_init_one(&main_list[8], NANO_CUT_KEY, _("Cut Text"),
|
||||
nano_cut_msg, 0, NANO_CUT_FKEY, 0, NOVIEW, do_cut_text);
|
||||
@@ -339,7 +363,7 @@ void shortcut_init(int unjustify)
|
||||
|
||||
sc_init_one(&main_list[10], NANO_CURSORPOS_KEY, _("Cur Pos"),
|
||||
nano_cursorpos_msg,
|
||||
0, NANO_CURSORPOS_FKEY, 0, VIEW, do_cursorpos);
|
||||
0, NANO_CURSORPOS_FKEY, 0, VIEW, do_cursorpos_void);
|
||||
|
||||
sc_init_one(&main_list[11], NANO_SPELL_KEY, _("To Spell"),
|
||||
nano_spell_msg, 0, NANO_SPELL_FKEY, 0, NOVIEW, do_spell);
|
||||
@@ -397,138 +421,171 @@ void shortcut_init(int unjustify)
|
||||
nano_goto_msg,
|
||||
NANO_ALT_G, NANO_GOTO_FKEY, 0, VIEW, do_gotoline_void);
|
||||
|
||||
#if (!defined NANO_SMALL) && (defined HAVE_REGEX_H)
|
||||
sc_init_one(&main_list[26], -9, _("Find Other Bracket"),
|
||||
nano_bracket_msg,
|
||||
NANO_BRACKET_KEY, 0, 0, VIEW, do_find_bracket);
|
||||
#endif
|
||||
|
||||
|
||||
sc_init_one(&whereis_list[0], NANO_FIRSTLINE_KEY, _("First Line"),
|
||||
sc_init_one(&whereis_list[0], NANO_HELP_KEY,
|
||||
_("Get Help"), nano_help_msg, 0, 0, 0, VIEW, do_help);
|
||||
|
||||
sc_init_one(&whereis_list[1], NANO_CANCEL_KEY,
|
||||
_("Cancel"), nano_cancel_msg, 0, 0, 0, VIEW, 0);
|
||||
|
||||
sc_init_one(&whereis_list[2], NANO_FIRSTLINE_KEY, _("First Line"),
|
||||
nano_firstline_msg, 0, 0, 0, VIEW, do_first_line);
|
||||
|
||||
sc_init_one(&whereis_list[1], NANO_LASTLINE_KEY, _("Last Line"),
|
||||
sc_init_one(&whereis_list[3], NANO_LASTLINE_KEY, _("Last Line"),
|
||||
nano_lastline_msg, 0, 0, 0, VIEW, do_last_line);
|
||||
|
||||
sc_init_one(&whereis_list[2], NANO_OTHERSEARCH_KEY, _("Replace"),
|
||||
sc_init_one(&whereis_list[4], NANO_OTHERSEARCH_KEY, _("Replace"),
|
||||
nano_replace_msg, 0, 0, 0, VIEW, do_replace);
|
||||
|
||||
sc_init_one(&whereis_list[3], NANO_FROMSEARCHTOGOTO_KEY,
|
||||
sc_init_one(&whereis_list[5], NANO_FROMSEARCHTOGOTO_KEY,
|
||||
_("Goto Line"), nano_goto_msg, 0, 0, 0, VIEW,
|
||||
do_gotoline_void);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
sc_init_one(&whereis_list[4], TOGGLE_CASE_KEY, _("Case Sens"),
|
||||
sc_init_one(&whereis_list[6], TOGGLE_CASE_KEY, _("Case Sens"),
|
||||
nano_case_msg, 0, 0, 0, VIEW, 0);
|
||||
|
||||
sc_init_one(&whereis_list[5], TOGGLE_BACKWARDS_KEY, _("Backward"),
|
||||
sc_init_one(&whereis_list[7], TOGGLE_BACKWARDS_KEY, _("Direction"),
|
||||
nano_reverse_msg, 0, 0, 0, VIEW, 0);
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
sc_init_one(&whereis_list[REPLACE_LIST_LEN - 2], TOGGLE_REGEXP_KEY,
|
||||
sc_init_one(&whereis_list[REPLACE_LIST_LEN - 1], TOGGLE_REGEXP_KEY,
|
||||
_("Regexp"), nano_regexp_msg, 0, 0, 0, VIEW, 0);
|
||||
#endif
|
||||
#endif /* NANO_SMALL */
|
||||
|
||||
sc_init_one(&whereis_list[REPLACE_LIST_LEN - 1], NANO_CANCEL_KEY,
|
||||
|
||||
sc_init_one(&replace_list[0], NANO_HELP_KEY,
|
||||
_("Get Help"), nano_help_msg, 0, 0, 0, VIEW, do_help);
|
||||
|
||||
sc_init_one(&replace_list[1], NANO_CANCEL_KEY,
|
||||
_("Cancel"), nano_cancel_msg, 0, 0, 0, VIEW, 0);
|
||||
|
||||
|
||||
sc_init_one(&replace_list[0], NANO_FIRSTLINE_KEY, _("First Line"),
|
||||
sc_init_one(&replace_list[2], NANO_FIRSTLINE_KEY, _("First Line"),
|
||||
nano_firstline_msg, 0, 0, 0, VIEW, do_first_line);
|
||||
|
||||
sc_init_one(&replace_list[1], NANO_LASTLINE_KEY, _("Last Line"),
|
||||
sc_init_one(&replace_list[3], NANO_LASTLINE_KEY, _("Last Line"),
|
||||
nano_lastline_msg, 0, 0, 0, VIEW, do_last_line);
|
||||
|
||||
sc_init_one(&replace_list[2], NANO_OTHERSEARCH_KEY, _("No Replace"),
|
||||
sc_init_one(&replace_list[4], NANO_OTHERSEARCH_KEY, _("No Replace"),
|
||||
nano_whereis_msg, 0, 0, 0, VIEW, do_search);
|
||||
|
||||
sc_init_one(&replace_list[3], NANO_FROMSEARCHTOGOTO_KEY,
|
||||
sc_init_one(&replace_list[5], NANO_FROMSEARCHTOGOTO_KEY,
|
||||
_("Goto Line"), nano_goto_msg, 0, 0, 0, VIEW,
|
||||
do_gotoline_void);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
sc_init_one(&replace_list[4], TOGGLE_CASE_KEY, _("Case Sens"),
|
||||
sc_init_one(&replace_list[6], TOGGLE_CASE_KEY, _("Case Sens"),
|
||||
nano_case_msg, 0, 0, 0, VIEW, 0);
|
||||
|
||||
sc_init_one(&replace_list[5], TOGGLE_BACKWARDS_KEY, _("Backward"),
|
||||
sc_init_one(&replace_list[7], TOGGLE_BACKWARDS_KEY, _("Direction"),
|
||||
nano_reverse_msg, 0, 0, 0, VIEW, 0);
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
sc_init_one(&replace_list[REPLACE_LIST_LEN - 2], TOGGLE_REGEXP_KEY,
|
||||
sc_init_one(&replace_list[REPLACE_LIST_LEN - 1], TOGGLE_REGEXP_KEY,
|
||||
_("Regexp"), nano_regexp_msg, 0, 0, 0, VIEW, 0);
|
||||
#endif
|
||||
#endif /* NANO_SMALL */
|
||||
|
||||
sc_init_one(&replace_list[REPLACE_LIST_LEN - 1], NANO_CANCEL_KEY,
|
||||
|
||||
sc_init_one(&replace_list_2[0], NANO_HELP_KEY,
|
||||
_("Get Help"), nano_help_msg, 0, 0, 0, VIEW, do_help);
|
||||
|
||||
sc_init_one(&replace_list_2[1], NANO_CANCEL_KEY,
|
||||
_("Cancel"), nano_cancel_msg, 0, 0, 0, VIEW, 0);
|
||||
|
||||
|
||||
sc_init_one(&replace_list_2[0], NANO_FIRSTLINE_KEY, _("First Line"),
|
||||
sc_init_one(&replace_list_2[2], 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"),
|
||||
sc_init_one(&replace_list_2[3], 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"),
|
||||
|
||||
sc_init_one(&goto_list[0], NANO_HELP_KEY,
|
||||
_("Get Help"), nano_help_msg, 0, 0, 0, VIEW, do_help);
|
||||
|
||||
sc_init_one(&goto_list[1], NANO_CANCEL_KEY, _("Cancel"),
|
||||
nano_cancel_msg, 0, 0, 0, VIEW, 0);
|
||||
|
||||
|
||||
sc_init_one(&goto_list[0], NANO_FIRSTLINE_KEY, _("First Line"),
|
||||
sc_init_one(&goto_list[2], NANO_FIRSTLINE_KEY, _("First Line"),
|
||||
nano_firstline_msg, 0, 0, 0, VIEW, &do_first_line);
|
||||
|
||||
sc_init_one(&goto_list[1], NANO_LASTLINE_KEY, _("Last Line"),
|
||||
sc_init_one(&goto_list[3], NANO_LASTLINE_KEY, _("Last Line"),
|
||||
nano_lastline_msg, 0, 0, 0, VIEW, &do_last_line);
|
||||
|
||||
sc_init_one(&goto_list[2], NANO_CANCEL_KEY, _("Cancel"),
|
||||
nano_cancel_msg, 0, 0, 0, VIEW, 0);
|
||||
|
||||
|
||||
sc_init_one(&help_list[0], NANO_PREVPAGE_KEY, _("Prev Page"),
|
||||
nano_prevpage_msg,
|
||||
0, NANO_PREVPAGE_FKEY, KEY_PPAGE, VIEW, page_up);
|
||||
0, NANO_PREVPAGE_FKEY, KEY_PPAGE, VIEW, do_page_up);
|
||||
|
||||
sc_init_one(&help_list[1], NANO_NEXTPAGE_KEY, _("Next Page"),
|
||||
nano_nextpage_msg,
|
||||
0, NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, page_down);
|
||||
0, NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, do_page_down);
|
||||
|
||||
sc_init_one(&help_list[2], NANO_EXIT_KEY, _("Exit"),
|
||||
nano_exit_msg, 0, NANO_EXIT_FKEY, 0, VIEW, do_exit);
|
||||
|
||||
|
||||
sc_init_one(&writefile_list[0], NANO_HELP_KEY,
|
||||
_("Get Help"), nano_help_msg, 0, 0, 0, VIEW, do_help);
|
||||
|
||||
sc_init_one(&writefile_list[1], NANO_CANCEL_KEY, _("Cancel"),
|
||||
nano_cancel_msg, 0, 0, 0, VIEW, 0);
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
sc_init_one(&writefile_list[0], NANO_TOFILES_KEY, _("To Files"),
|
||||
sc_init_one(&writefile_list[2], NANO_TOFILES_KEY, _("To Files"),
|
||||
nano_tofiles_msg, 0, 0, 0, NOVIEW, 0);
|
||||
#endif
|
||||
|
||||
sc_init_one(&writefile_list[WRITEFILE_LIST_LEN - 2], NANO_APPEND_KEY, _("Append"),
|
||||
sc_init_one(&writefile_list[WRITEFILE_LIST_LEN - 1], NANO_APPEND_KEY, _("Append"),
|
||||
nano_append_msg, 0, 0, 0, NOVIEW, 0);
|
||||
|
||||
sc_init_one(&writefile_list[WRITEFILE_LIST_LEN - 1], NANO_CANCEL_KEY, _("Cancel"),
|
||||
sc_init_one(&insertfile_list[0], NANO_HELP_KEY,
|
||||
_("Get Help"), nano_help_msg, 0, 0, 0, VIEW, do_help);
|
||||
|
||||
sc_init_one(&insertfile_list[1], NANO_CANCEL_KEY, _("Cancel"),
|
||||
nano_cancel_msg, 0, 0, 0, VIEW, 0);
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
sc_init_one(&insertfile_list[0], NANO_TOFILES_KEY, _("To Files"),
|
||||
sc_init_one(&insertfile_list[2], NANO_TOFILES_KEY, _("To Files"),
|
||||
nano_tofiles_msg, 0, 0, 0, NOVIEW, 0);
|
||||
#endif
|
||||
|
||||
sc_init_one(&insertfile_list[INSERTFILE_LIST_LEN - 1], NANO_CANCEL_KEY, _("Cancel"),
|
||||
sc_init_one(&spell_list[0], NANO_HELP_KEY,
|
||||
_("Get Help"), nano_help_msg, 0, 0, 0, VIEW, do_help);
|
||||
|
||||
sc_init_one(&spell_list[1], NANO_CANCEL_KEY, _("Cancel"),
|
||||
nano_cancel_msg, 0, 0, 0, VIEW, 0);
|
||||
|
||||
sc_init_one(&spell_list[0], NANO_CANCEL_KEY, _("Cancel"),
|
||||
nano_cancel_msg, 0, 0, 0, VIEW, 0);
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
sc_init_one(&browser_list[0], NANO_PREVPAGE_KEY, _("Prev Page"),
|
||||
sc_init_one(&browser_list[0], NANO_HELP_KEY,
|
||||
_("Get Help"), nano_help_msg, 0, 0, 0, VIEW, do_help);
|
||||
|
||||
sc_init_one(&browser_list[1], NANO_EXIT_KEY, _("Exit"),
|
||||
nano_exit_msg, 0, NANO_EXIT_FKEY, 0, VIEW, 0);
|
||||
|
||||
sc_init_one(&browser_list[2], NANO_PREVPAGE_KEY, _("Prev Page"),
|
||||
nano_prevpage_msg,
|
||||
0, NANO_PREVPAGE_FKEY, KEY_PPAGE, VIEW, 0);
|
||||
|
||||
sc_init_one(&browser_list[1], NANO_NEXTPAGE_KEY, _("Next Page"),
|
||||
sc_init_one(&browser_list[3], NANO_NEXTPAGE_KEY, _("Next Page"),
|
||||
nano_nextpage_msg,
|
||||
0, NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, 0);
|
||||
|
||||
sc_init_one(&browser_list[2], NANO_GOTO_KEY, _("Goto"),
|
||||
sc_init_one(&browser_list[4], NANO_GOTO_KEY, _("Goto"),
|
||||
nano_gotodir_msg, 0, NANO_GOTO_FKEY, 0, VIEW, 0);
|
||||
|
||||
sc_init_one(&browser_list[3], NANO_EXIT_KEY, _("Exit"),
|
||||
nano_exit_msg, 0, NANO_EXIT_FKEY, 0, VIEW, 0);
|
||||
sc_init_one(&gotodir_list[0], NANO_HELP_KEY,
|
||||
_("Get Help"), nano_help_msg, 0, 0, 0, VIEW, do_help);
|
||||
|
||||
sc_init_one(&gotodir_list[0], NANO_CANCEL_KEY, _("Cancel"),
|
||||
sc_init_one(&gotodir_list[1], NANO_CANCEL_KEY, _("Cancel"),
|
||||
nano_cancel_msg, 0, 0, 0, VIEW, 0);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -21,21 +21,9 @@ AC_DEFUN(NANO_AM_WITH_NLS,
|
||||
|
||||
USE_INCLUDED_LIBINTL=no
|
||||
|
||||
AC_ARG_WITH(locale-dir,
|
||||
[ --with-locale-dir=DIR specify locale directory],
|
||||
LOCALE_DIR=$withval)
|
||||
test -z "$LOCALE_DIR" && LOCALE_DIR='$(datadir)/locale'
|
||||
AC_SUBST(LOCALE_DIR)
|
||||
|
||||
AC_ARG_WITH(gnu-locale-dir,
|
||||
[ --with-gnu-locale-dir=DIR specify GNU locale directory],
|
||||
GNU_LOCALE_DIR=$withval)
|
||||
test -z "$GNU_LOCALE_DIR" && GNU_LOCALE_DIR='$(prefix)/share/locale'
|
||||
AC_SUBST(GNU_LOCALE_DIR)
|
||||
|
||||
dnl If we use NLS figure out what method
|
||||
if test "$USE_NLS" = "yes"; then
|
||||
AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if NLS is requested.])
|
||||
AC_DEFINE(ENABLE_NLS)
|
||||
AC_MSG_CHECKING([whether included gettext is requested])
|
||||
AC_ARG_WITH(included-gettext,
|
||||
[ --with-included-gettext use the GNU gettext library included here],
|
||||
@@ -60,13 +48,18 @@ AC_DEFUN(NANO_AM_WITH_NLS,
|
||||
|
||||
if test "$gt_cv_func_gettext_libc" != "yes"; then
|
||||
AC_CHECK_LIB(intl, bindtextdomain,
|
||||
[AC_CHECK_LIB(intl, gettext)])
|
||||
[AC_CHECK_LIB(intl, gettext,
|
||||
gt_cv_func_gettext_libintl=yes,
|
||||
gt_cv_func_gettext_libintl=no)])
|
||||
fi
|
||||
|
||||
if test "$gt_cv_func_gettext_libintl" = yes; then
|
||||
LIBS="$LIBS -lintl"
|
||||
fi
|
||||
|
||||
if test "$gt_cv_func_gettext_libc" = "yes" \
|
||||
|| test "$ac_cv_lib_intl_gettext" = "yes"; then
|
||||
AC_DEFINE(HAVE_GETTEXT, 1,
|
||||
[Define to 1 if you have gettext and don't want to use GNU gettext.])
|
||||
|| test "$gt_cv_func_gettext_libintl" = "yes"; then
|
||||
AC_DEFINE(HAVE_GETTEXT)
|
||||
NANO_AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
|
||||
if test "$MSGFMT" != "no"; then
|
||||
|
||||
46
move.c
46
move.c
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 1999 Chris Allegretta *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 1, or (at your option) *
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
* any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
@@ -34,20 +34,24 @@
|
||||
#define _(string) (string)
|
||||
#endif
|
||||
|
||||
void page_down_center(void)
|
||||
void page_down(void)
|
||||
{
|
||||
if (editbot != filebot) {
|
||||
edit_update(editbot->next, CENTER);
|
||||
center_cursor();
|
||||
if (!ISSET(SMOOTHSCROLL)) {
|
||||
if (editbot != filebot) {
|
||||
edit_update(editbot->next, CENTER);
|
||||
center_cursor();
|
||||
} else {
|
||||
while (current != filebot)
|
||||
current = current->next;
|
||||
edit_update(current, CENTER);
|
||||
}
|
||||
} else {
|
||||
while (current != filebot)
|
||||
current = current->next;
|
||||
edit_update(current, CENTER);
|
||||
edit_update(editbot, NONE);
|
||||
}
|
||||
update_cursor();
|
||||
}
|
||||
|
||||
int page_down(void)
|
||||
int do_page_down(void)
|
||||
{
|
||||
wrap_reset();
|
||||
current_x = 0;
|
||||
@@ -124,7 +128,7 @@ int do_down(void)
|
||||
if (current_y < editwinrows - 1 && current != editbot)
|
||||
current_y++;
|
||||
else
|
||||
page_down_center();
|
||||
page_down();
|
||||
|
||||
update_cursor();
|
||||
update_line(current->prev, 0);
|
||||
@@ -134,11 +138,23 @@ int do_down(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
void page_up_center(void)
|
||||
void page_up(void)
|
||||
{
|
||||
if (edittop != fileage) {
|
||||
edit_update(edittop, CENTER);
|
||||
center_cursor();
|
||||
if (!ISSET(SMOOTHSCROLL)) {
|
||||
edit_update(edittop, CENTER);
|
||||
/* Now that we've updated the edit window, edittop might be
|
||||
at the top of the file; if so, just move the cursor up one
|
||||
line and don't center it. */
|
||||
if (edittop != fileage)
|
||||
center_cursor();
|
||||
else {
|
||||
current = current->prev;
|
||||
reset_cursor();
|
||||
}
|
||||
} else {
|
||||
edit_update(edittop->prev, NONE);
|
||||
}
|
||||
} else
|
||||
current_y = 0;
|
||||
|
||||
@@ -146,7 +162,7 @@ void page_up_center(void)
|
||||
|
||||
}
|
||||
|
||||
int page_up(void)
|
||||
int do_page_up(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -184,7 +200,7 @@ int do_up(void)
|
||||
if (current_y > 0)
|
||||
current_y--;
|
||||
else
|
||||
page_up_center();
|
||||
page_up();
|
||||
|
||||
update_cursor();
|
||||
update_line(current->next, 0);
|
||||
|
||||
43
nano.1
43
nano.1
@@ -5,10 +5,8 @@
|
||||
.\" This is free documentation, see the latest version of the GNU General
|
||||
.\" Public License for copying conditions. There is NO warranty.
|
||||
.\"
|
||||
.\" First parameter, NAME, should be all caps
|
||||
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
||||
.\" other parameters are allowed: see man(7), man(1)
|
||||
.TH NANO 1 "April 30, 2001"
|
||||
.\" $Id$
|
||||
.TH NANO 1 "October 3, 2001"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.SH NAME
|
||||
@@ -33,25 +31,35 @@ also implements some missing (or disabled by default) features in Pico,
|
||||
such as "search and replace" and "goto line number".
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-D (\-\-dos)
|
||||
Write file in DOS format.
|
||||
.TP
|
||||
.B \-F (\-\-multibuffer)
|
||||
Enable multiple file buffers (if available).
|
||||
.TP
|
||||
.B \-T (\-\-tabsize)
|
||||
Set the size (width) of a tab.
|
||||
.B \-M (\-\-mac)
|
||||
Write file in Mac format.
|
||||
.TP
|
||||
.B \-R (\-\-regexp)
|
||||
Enable regular expression matching for search strings, as well as
|
||||
\\n subexpression replacement for replace strings, if available.
|
||||
.TP
|
||||
.B \-S (\-\-smooth)
|
||||
Enable smooth scrolling. Text will scroll line-by-line, instead of the
|
||||
usual chunk-by-chunk behaviour.
|
||||
.TP
|
||||
.B \-T [num] (\-\-tabsize=[num])
|
||||
Set the size (width) of a tab.
|
||||
.TP
|
||||
.B \-V (\-\-version)
|
||||
Show the current version number and author.
|
||||
.TP
|
||||
.B \-h (\-\-help)
|
||||
Display a summary of command line options.
|
||||
.TP
|
||||
.B \-c (\-\-const)
|
||||
Constantly show the cursor position.
|
||||
.TP
|
||||
.B \-h (\-\-help)
|
||||
Display a summary of command line options.
|
||||
.TP
|
||||
.B \-i (\-\-autoindent)
|
||||
Indent new lines to the previous line's indentation. Useful when editing
|
||||
source code.
|
||||
@@ -66,18 +74,21 @@ a new file, do not follow it. Good for editing files in /tmp, perhaps?
|
||||
.B \-m (\-\-mouse)
|
||||
Enable mouse support (if available for your system).
|
||||
.TP
|
||||
.B \-o [dir] (\-\-operatingdir=[dir])
|
||||
Set operating directory. Makes nano set up something similar to a chroot.
|
||||
.TP
|
||||
.B \-p (\-\-pico)
|
||||
Emulate Pico as closely as possible. This affects both the "shortcut list"
|
||||
at the bottom of the screen, as well as the display and entry of previous
|
||||
search and replace strings.
|
||||
.TP
|
||||
.B \-r (\-\-fill)
|
||||
.B \-r [#cols] (\-\-fill=[#cols])
|
||||
Wrap lines at column #cols. By default, this is the width of the screen,
|
||||
less eight. If this value is negative, wrapping will occur at #cols from
|
||||
the right of the screen, allowing it to vary along with the screen width
|
||||
if the screen is resized.
|
||||
.TP
|
||||
.B \-s (\-\-speller)
|
||||
.B \-s [prog] (\-\-speller=[prog])
|
||||
Enable alternative spell checker command.
|
||||
.TP
|
||||
.B \-t (\-\-tempfile)
|
||||
@@ -95,7 +106,7 @@ Disable help screen at bottom of editor.
|
||||
.B \-z (\-\-suspend)
|
||||
Enable suspend ability.
|
||||
.TP
|
||||
.B \-b, \-e, \-f
|
||||
.B \-a, \-b, \-e, \-f, \-g, \-j
|
||||
Ignored, for compatibility with Pico.
|
||||
.TP
|
||||
.B \+LINE
|
||||
@@ -105,8 +116,9 @@ Nano will try to dump the buffer into an emergency file in some cases.
|
||||
Mainly, this will happen if Nano receives a SIGHUP or runs out of
|
||||
memory, when it will write the buffer into a file named "nano.save" if the
|
||||
buffer didn't have a name already, or will add a ".save" suffix to the
|
||||
current filename. Nano will \fBnot\fP write this file if a previous one
|
||||
exists in the current directory.
|
||||
current filename. In multibuffer mode, nano will write all the open buffers to
|
||||
the respective emergency files. Nano will \fBnot\fP write this file if a
|
||||
previous one exists in the current directory.
|
||||
.SH BUGS
|
||||
Please send any comments or bug reports to
|
||||
.br
|
||||
@@ -120,7 +132,8 @@ subject of "subscribe".
|
||||
.SH HOMEPAGE
|
||||
http://www.nano-editor.org
|
||||
.SH AUTHOR
|
||||
Chris Allegretta <chrisa@asty.org>, et al (see AUTHORS for details).
|
||||
Chris Allegretta <chrisa@asty.org>, et al (see AUTHORS and THANKS for
|
||||
details).
|
||||
This manual page was originally written by Jordi Mallach
|
||||
<jordi@sindominio.net>, for the Debian GNU/Linux system (but may be
|
||||
used by others).
|
||||
|
||||
47
nano.1.html
47
nano.1.html
@@ -3,7 +3,7 @@ Content-type: text/html
|
||||
<HTML><HEAD><TITLE>Manpage of NANO</TITLE>
|
||||
</HEAD><BODY>
|
||||
<H1>NANO</H1>
|
||||
Section: User Commands (1)<BR>Updated: April 30, 2001<BR><A HREF="#index">Index</A>
|
||||
Section: User Commands (1)<BR>Updated: October 3, 2001<BR><A HREF="#index">Index</A>
|
||||
<A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
||||
|
||||
|
||||
@@ -44,31 +44,44 @@ such as "search and replace" and "goto line number".
|
||||
<H2>OPTIONS</H2>
|
||||
|
||||
<DL COMPACT>
|
||||
<DT><B>-D (--dos)</B>
|
||||
|
||||
<DD>
|
||||
Write file in DOS format.
|
||||
<DT><B>-F (--multibuffer)</B>
|
||||
|
||||
<DD>
|
||||
Enable multiple file buffers (if available).
|
||||
<DT><B>-T (--tabsize)</B>
|
||||
<DT><B>-M (--mac)</B>
|
||||
|
||||
<DD>
|
||||
Set the size (width) of a tab.
|
||||
Write file in Mac format.
|
||||
<DT><B>-R (--regexp)</B>
|
||||
|
||||
<DD>
|
||||
Enable regular expression matching for search strings, as well as
|
||||
\n subexpression replacement for replace strings, if available.
|
||||
<DT><B>-S (--smooth)</B>
|
||||
|
||||
<DD>
|
||||
Enable smooth scrolling. Text will scroll line-by-line, instead of the
|
||||
usual chunk-by-chunk behaviour.
|
||||
<DT><B>-T [num] (--tabsize=[num])</B>
|
||||
|
||||
<DD>
|
||||
Set the size (width) of a tab.
|
||||
<DT><B>-V (--version)</B>
|
||||
|
||||
<DD>
|
||||
Show the current version number and author.
|
||||
<DT><B>-h (--help)</B>
|
||||
|
||||
<DD>
|
||||
Display a summary of command line options.
|
||||
<DT><B>-c (--const)</B>
|
||||
|
||||
<DD>
|
||||
Constantly show the cursor position.
|
||||
<DT><B>-h (--help)</B>
|
||||
|
||||
<DD>
|
||||
Display a summary of command line options.
|
||||
<DT><B>-i (--autoindent)</B>
|
||||
|
||||
<DD>
|
||||
@@ -87,20 +100,24 @@ a new file, do not follow it. Good for editing files in /tmp, perhaps?
|
||||
|
||||
<DD>
|
||||
Enable mouse support (if available for your system).
|
||||
<DT><B>-o [dir] (--operatingdir=[dir])</B>
|
||||
|
||||
<DD>
|
||||
Set operating directory. Makes nano set up something similar to a chroot.
|
||||
<DT><B>-p (--pico)</B>
|
||||
|
||||
<DD>
|
||||
Emulate Pico as closely as possible. This affects both the "shortcut list"
|
||||
at the bottom of the screen, as well as the display and entry of previous
|
||||
search and replace strings.
|
||||
<DT><B>-r (--fill)</B>
|
||||
<DT><B>-r [#cols] (--fill=[#cols])</B>
|
||||
|
||||
<DD>
|
||||
Wrap lines at column #cols. By default, this is the width of the screen,
|
||||
less eight. If this value is negative, wrapping will occur at #cols from
|
||||
the right of the screen, allowing it to vary along with the screen width
|
||||
if the screen is resized.
|
||||
<DT><B>-s (--speller)</B>
|
||||
<DT><B>-s [prog] (--speller=[prog])</B>
|
||||
|
||||
<DD>
|
||||
Enable alternative spell checker command.
|
||||
@@ -124,7 +141,7 @@ Disable help screen at bottom of editor.
|
||||
|
||||
<DD>
|
||||
Enable suspend ability.
|
||||
<DT><B>-b, -e, -f</B>
|
||||
<DT><B>-a, -b, -e, -f, -g, -j</B>
|
||||
|
||||
<DD>
|
||||
Ignored, for compatibility with Pico.
|
||||
@@ -140,8 +157,9 @@ Nano will try to dump the buffer into an emergency file in some cases.
|
||||
Mainly, this will happen if Nano receives a SIGHUP or runs out of
|
||||
memory, when it will write the buffer into a file named "nano.save" if the
|
||||
buffer didn't have a name already, or will add a ".save" suffix to the
|
||||
current filename. Nano will <B>not</B> write this file if a previous one
|
||||
exists in the current directory.
|
||||
current filename. In multibuffer mode, nano will write all the open buffers to
|
||||
the respective emergency files. Nano will <B>not</B> write this file if a
|
||||
previous one exists in the current directory.
|
||||
<A NAME="lbAG"> </A>
|
||||
<H2>BUGS</H2>
|
||||
|
||||
@@ -166,7 +184,8 @@ subject of "subscribe".
|
||||
<A NAME="lbAI"> </A>
|
||||
<H2>AUTHOR</H2>
|
||||
|
||||
Chris Allegretta <<A HREF="mailto:chrisa@asty.org">chrisa@asty.org</A>>, et al (see AUTHORS for details).
|
||||
Chris Allegretta <<A HREF="mailto:chrisa@asty.org">chrisa@asty.org</A>>, et al (see AUTHORS and THANKS for
|
||||
details).
|
||||
This manual page was originally written by Jordi Mallach
|
||||
<<A HREF="mailto:jordi@sindominio.net">jordi@sindominio.net</A>>, for the Debian GNU/Linux system (but may be
|
||||
used by others).
|
||||
@@ -188,6 +207,6 @@ used by others).
|
||||
This document was created by
|
||||
<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
|
||||
using the manual pages.<BR>
|
||||
Time: 03:54:23 GMT, July 15, 2001
|
||||
Time: 01:18:43 GMT, October 04, 2001
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
74
nano.h
74
nano.h
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 1999 Chris Allegretta *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 1, or (at your option) *
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
* any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
@@ -82,10 +82,10 @@ typedef struct filestruct {
|
||||
char *file_path; /* Current file's full path location */
|
||||
int file_placewewant; /* Current file's place we want */
|
||||
int file_totlines; /* Current file's total number of lines */
|
||||
int file_totsize; /* Current file's total size */
|
||||
long file_totsize; /* Current file's total size */
|
||||
#endif
|
||||
|
||||
long lineno; /* The line number */
|
||||
int lineno; /* The line number */
|
||||
} filestruct;
|
||||
|
||||
typedef struct shortcut {
|
||||
@@ -117,6 +117,27 @@ typedef struct rcoption {
|
||||
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
|
||||
#define COLORSTRNUM 16
|
||||
|
||||
typedef struct colorstr {
|
||||
char *val;
|
||||
struct colorstr *next;
|
||||
} colorstr;
|
||||
|
||||
typedef struct colortype {
|
||||
int fg;
|
||||
int bg;
|
||||
int bright;
|
||||
int pairnum;
|
||||
colorstr *str;
|
||||
struct colortype *next;
|
||||
} colortype;
|
||||
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
|
||||
/* Bitwise flags so we can save space (or more correctly, not waste it) */
|
||||
|
||||
#define MODIFIED (1<<0)
|
||||
@@ -137,9 +158,13 @@ typedef struct rcoption {
|
||||
#define REGEXP_COMPILED (1<<15)
|
||||
#define TEMP_OPT (1<<16)
|
||||
#define CUT_TO_END (1<<17)
|
||||
#define DISABLE_CURPOS (1<<18)
|
||||
#define REVERSE_SEARCH (1<<19)
|
||||
#define MULTIBUFFER (1<<20)
|
||||
#define REVERSE_SEARCH (1<<18)
|
||||
#define MULTIBUFFER (1<<19)
|
||||
#define CLEAR_BACKUPSTRING (1<<20)
|
||||
#define DOS_FILE (1<<21)
|
||||
#define MAC_FILE (1<<22)
|
||||
#define SMOOTHSCROLL (1<<23)
|
||||
#define DISABLE_CURPOS (1<<24) /* Damn, we still need it */
|
||||
|
||||
/* Control key sequences, changing these would be very very bad */
|
||||
|
||||
@@ -203,6 +228,7 @@ typedef struct rcoption {
|
||||
#define NANO_ALT_Z 'z'
|
||||
#define NANO_ALT_LCARAT ','
|
||||
#define NANO_ALT_RCARAT '.'
|
||||
#define NANO_ALT_BRACKET ']'
|
||||
|
||||
/* Some semi-changeable keybindings; don't play with unless you're sure you
|
||||
know what you're doing */
|
||||
@@ -260,6 +286,7 @@ know what you're doing */
|
||||
#define NANO_APPEND_KEY NANO_ALT_A
|
||||
#define NANO_OPENPREV_KEY NANO_ALT_LCARAT
|
||||
#define NANO_OPENNEXT_KEY NANO_ALT_RCARAT
|
||||
#define NANO_BRACKET_KEY NANO_ALT_BRACKET
|
||||
|
||||
#define TOGGLE_CONST_KEY NANO_ALT_C
|
||||
#define TOGGLE_AUTOINDENT_KEY NANO_ALT_I
|
||||
@@ -273,14 +300,23 @@ know what you're doing */
|
||||
#define TOGGLE_BACKWARDS_KEY NANO_ALT_B
|
||||
#define TOGGLE_CASE_KEY NANO_ALT_A
|
||||
#define TOGGLE_LOAD_KEY NANO_ALT_F
|
||||
#define TOGGLE_DOS_KEY NANO_ALT_D
|
||||
#define TOGGLE_MAC_KEY NANO_ALT_O
|
||||
#define TOGGLE_SMOOTH_KEY NANO_ALT_S
|
||||
|
||||
/* Toggle stuff, these static lengths need to go away RSN */
|
||||
|
||||
#ifndef HAVE_REGEX_H
|
||||
#define NO_REGEX 1
|
||||
#define SMALL_TOO 0
|
||||
#else
|
||||
#define NO_REGEX 0
|
||||
#endif
|
||||
#ifdef NANO_SMALL
|
||||
#define SMALL_TOO 1
|
||||
#else
|
||||
#define SMALL_TOO 0
|
||||
#endif /* NANO_SMALL */
|
||||
#endif /* HAVE_REGEX_H */
|
||||
|
||||
#ifdef DISABLE_BROWSER
|
||||
#define NO_BROWSER 1
|
||||
@@ -304,21 +340,19 @@ know what you're doing */
|
||||
#define MULTI_TOGGLES 0
|
||||
#endif
|
||||
|
||||
#define WHEREIS_LIST_LEN (8 - NO_REGEX - NO_TOGGLES)
|
||||
#define REPLACE_LIST_LEN (8 - NO_REGEX - NO_TOGGLES)
|
||||
#define TOGGLE_LEN (11 - NO_REGEX + MULTI_TOGGLES)
|
||||
#define WRITEFILE_LIST_LEN (3 - NO_BROWSER)
|
||||
#define INSERTFILE_LIST_LEN (2 - NO_BROWSER)
|
||||
#define BROWSER_LIST_LEN 4
|
||||
#define MAIN_LIST_LEN 26
|
||||
#define WHEREIS_LIST_LEN (9 - NO_REGEX - NO_TOGGLES)
|
||||
#define REPLACE_LIST_LEN (9 - NO_REGEX - NO_TOGGLES)
|
||||
#define TOGGLE_LEN (14 - NO_REGEX + MULTI_TOGGLES)
|
||||
#define WRITEFILE_LIST_LEN (4 - NO_BROWSER)
|
||||
#define INSERTFILE_LIST_LEN (3 - NO_BROWSER)
|
||||
#define BROWSER_LIST_LEN 5
|
||||
#define MAIN_LIST_LEN (27 - NO_REGEX - SMALL_TOO)
|
||||
#define MAIN_VISIBLE 12
|
||||
#define REPLACE_LIST_2_LEN 3
|
||||
#define GOTO_LIST_LEN 3
|
||||
#define GOTODIR_LIST_LEN 1
|
||||
#define REPLACE_LIST_2_LEN 4
|
||||
#define GOTO_LIST_LEN 4
|
||||
#define GOTODIR_LIST_LEN 2
|
||||
#define HELP_LIST_LEN 3
|
||||
#define SPELL_LIST_LEN 1
|
||||
|
||||
|
||||
#define SPELL_LIST_LEN 2
|
||||
|
||||
|
||||
#define VIEW 1
|
||||
|
||||
411
nano.info
411
nano.info
@@ -1,411 +0,0 @@
|
||||
This is nano.info, produced by makeinfo version 4.0b from nano.texi.
|
||||
|
||||
INFO-DIR-SECTION Editors
|
||||
START-INFO-DIR-ENTRY
|
||||
* Nano: (nano). Small and friendly text editor.
|
||||
END-INFO-DIR-ENTRY
|
||||
|
||||
|
||||
File: nano.info, Node: Top, Next: Introduction, Prev: (dir), Up: (dir)
|
||||
|
||||
This manual documents GNU nano, a small and friendly text editor.
|
||||
|
||||
* Menu:
|
||||
|
||||
* Introduction::
|
||||
* Editor Basics::
|
||||
* Online Help::
|
||||
* Feature Toggles::
|
||||
* The File Browser::
|
||||
* Pico Compatibility::
|
||||
* Building and Configure Options::
|
||||
|
||||
|
||||
File: nano.info, Node: Introduction, Next: Editor Basics, Prev: Top, Up: Top
|
||||
|
||||
Introduction
|
||||
************
|
||||
|
||||
GNU `nano' is a small and friendly text editor. Besides basic text
|
||||
editing, `nano' offers many extra features like an interactive search
|
||||
and replace, goto line number, auto-indentation, feature toggles,
|
||||
internationalization support, and filename tab completion.
|
||||
|
||||
* Menu:
|
||||
|
||||
* Overview::
|
||||
* Command Line Options::
|
||||
|
||||
|
||||
File: nano.info, Node: Overview, Next: Command Line Options, Prev: Introduction, Up: Introduction
|
||||
|
||||
Overview
|
||||
========
|
||||
|
||||
`nano' [GNU long option] [option] +LINE [ FILE ... ]
|
||||
|
||||
The original goal for `nano' was a complete bug-for-bug compatible
|
||||
emulation of Pico, but consistency is now a slightly higher priority.
|
||||
There is a flag to implement (nearly) complete Pico emulation, (option
|
||||
-p or GNU long option -pico). This can also be toggled from within
|
||||
`nano' by typing Meta-P. *Note Pico Compatibility::, for more info.
|
||||
|
||||
Email bug reports to <nano@nano-editor.org>.
|
||||
|
||||
|
||||
File: nano.info, Node: Command Line Options, Prev: Overview, Up: Introduction
|
||||
|
||||
Command Line Options
|
||||
====================
|
||||
|
||||
`nano' takes the following options from the command line:
|
||||
`-T [num, --tabsize=[num]'
|
||||
Set the displayed tab length to [num] columns.
|
||||
|
||||
`-R, --regexp'
|
||||
Turns on regular expression search and search/replace.
|
||||
|
||||
`-V, --version'
|
||||
Print the version number and copyright and quit.
|
||||
|
||||
`-c, --const'
|
||||
Constantly display the cursor position and line number on the
|
||||
statusbar.
|
||||
|
||||
`-h, --help'
|
||||
Print the usage and exit.
|
||||
|
||||
`-i, --autoindent'
|
||||
Automatically indent new lines to the same number of spaces and
|
||||
tabs as the previous line.
|
||||
|
||||
`-k, --cut'
|
||||
Makes ^K cut from the current cursor position to the end of the
|
||||
current line.
|
||||
|
||||
`-l, --nofollow'
|
||||
When writing files, if the given file is a symbolic link it is
|
||||
removed and a new file is created.
|
||||
|
||||
`-m, --mouse'
|
||||
Enables the use of the mouse to select text (currently only useful
|
||||
for running under the X window system).
|
||||
|
||||
`-p, --pico'
|
||||
Emulate Pico as closely as possible, sacrificing consistency for
|
||||
correct emulation. *Note Pico Compatibility::, for more info.
|
||||
|
||||
`-r [#cols], --fill=[#cols].'
|
||||
Wrap lines at column #cols. By default this is the width of the
|
||||
screen, less eight. If this value is negative, wrapping will occur
|
||||
at #cols from the right of the screen, allowing it to vary along
|
||||
with the screen width if the screen is resized.
|
||||
|
||||
`-s [prog], --speller=[prog]'
|
||||
Invoke [prog] as the spell checker. By default, `nano' uses its
|
||||
own interactive spell checker that requires the `spell' program be
|
||||
installed on your system.
|
||||
|
||||
`-t, --tempfile'
|
||||
Do not ask whether or not to save the current contents of the file
|
||||
when exiting, assume yes. This is most useful when using `nano'
|
||||
as the composer of a mailer program.
|
||||
|
||||
`-x, --nohelp'
|
||||
In Expert Mode, the Shortcut Lists will not appear at the bottom
|
||||
of the screen. This affects the location of the statusbar as
|
||||
well, as in Expert Mode it is located at the very bottom of the
|
||||
editor.
|
||||
|
||||
Note: When accessing the help system, Expert Mode is temporarily
|
||||
disabled to display the help system navigation keys.
|
||||
|
||||
`-v, --view'
|
||||
Do not allow the contents of the file to be altered. Note that
|
||||
this flag should NOT be used in place of correct file permissions
|
||||
to implement a read-only file.
|
||||
|
||||
`-w, --nowrap'
|
||||
Do not wrap long lines at any length. This option overrides any
|
||||
value for -r.
|
||||
|
||||
`-z, --suspend'
|
||||
Enable suspend ability of `nano' using the system's suspend
|
||||
keystroke (usually ^Z).
|
||||
|
||||
`+LINE'
|
||||
Start at line number LINE instead of the default of line 1.
|
||||
|
||||
|
||||
File: nano.info, Node: Editor Basics, Next: Online Help, Prev: Introduction, Up: Top
|
||||
|
||||
Editor Basics
|
||||
*************
|
||||
|
||||
* Menu:
|
||||
|
||||
* Entering Text::
|
||||
* Special Functions::
|
||||
* The Titlebar::
|
||||
* The Statusbar::
|
||||
* Shortcut Lists::
|
||||
|
||||
|
||||
File: nano.info, Node: Entering Text, Next: Special Functions, Prev: Editor Basics, Up: Editor Basics
|
||||
|
||||
Entering Text
|
||||
=============
|
||||
|
||||
All key sequences in `nano' are entered using the keyboard. `nano'
|
||||
is a "modeless" editor, all keys with the exception of Control and Meta
|
||||
key sequences will enter text into the file being edited.
|
||||
|
||||
|
||||
File: nano.info, Node: Special Functions, Next: The Titlebar, Prev: Entering Text, Up: Editor Basics
|
||||
|
||||
Special Functions
|
||||
=================
|
||||
|
||||
Special functions use the Control key (displayed in the help and
|
||||
shortcut lists as ^) or the Meta key (displayed as M).
|
||||
|
||||
* Control key sequences are entered by holding down the Control key
|
||||
and pressing the desired letter.
|
||||
|
||||
* Meta key sequences can be entered in a number of possible ways:
|
||||
Pressing the Escape key, then releasing it and pressing the
|
||||
desired key, or holding down the Alt key while pressing the desired
|
||||
key. This varies from keyboard to keyboard, and certain commercial
|
||||
operating systems "swallow" the Alt key so that it never reaches
|
||||
the application. If your operating system does this, you should
|
||||
use the Escape key to generate Meta key sequences.
|
||||
|
||||
|
||||
File: nano.info, Node: The Titlebar, Next: The Statusbar, Prev: Special Functions, Up: Editor Basics
|
||||
|
||||
The Titlebar
|
||||
============
|
||||
|
||||
The titlebar is the line displayed at the top of the editor. There
|
||||
are three sections: left, center and right. The section on the left
|
||||
displays the version of `nano' being used. The center section displays
|
||||
the current file name, or "New Buffer" if the file has not yet been
|
||||
named. The section on the right will display "Modified" if the file
|
||||
has been modified since it was last saved or opened.
|
||||
|
||||
Special modes: When nano is in "File browser" mode, the center
|
||||
section will display the current directory instead of the filename.
|
||||
*Note The File Browser::.
|
||||
|
||||
|
||||
File: nano.info, Node: The Statusbar, Next: Shortcut Lists, Prev: The Titlebar, Up: Editor Basics
|
||||
|
||||
The Statusbar
|
||||
=============
|
||||
|
||||
The statusbar is located three lines from the bottom of the screen
|
||||
(or the bottom line in Expert Mode. *Note Expert Mode::, for more info.
|
||||
|
||||
The Statusbar shows important and informational messages. Any error
|
||||
messages that occur from using the editor will appear on the statusbar.
|
||||
Any questions that are asked of the user will be asked on the statusbar,
|
||||
and any user input (search strings, file names, etc) will be input on
|
||||
the statusbar.
|
||||
|
||||
|
||||
File: nano.info, Node: Shortcut Lists, Prev: The Statusbar, Up: Editor Basics
|
||||
|
||||
Shortcut Lists
|
||||
==============
|
||||
|
||||
The Shortcut Lists are the two lines at the bottom of the screen
|
||||
which show some of the more commonly used functions in the editor. The
|
||||
exact functions which are displayed depend on whether Pico
|
||||
Compatibility Mode mode is enabled. *Note Pico Compatibility::, for
|
||||
more info.
|
||||
|
||||
|
||||
File: nano.info, Node: Online Help, Next: Feature Toggles, Prev: Editor Basics, Up: Top
|
||||
|
||||
Online Help
|
||||
***********
|
||||
|
||||
The online help system in `nano' is available by pressing ^G. It is
|
||||
fairly self explanatory, documenting the various parts of the editor
|
||||
and available keystrokes. Navigation is via the ^Y (Page Up) and ^V
|
||||
(Page Down) keys. ^X exits the help system.
|
||||
|
||||
|
||||
File: nano.info, Node: Feature Toggles, Next: The File Browser, Prev: Online Help, Up: Top
|
||||
|
||||
Feature Toggles
|
||||
***************
|
||||
|
||||
Toggles allow you to change certain aspects of the editor that would
|
||||
normally be done via command line flags. They are invoked via certain
|
||||
Meta key sequenced. *Note Special Functions::, for more info. The
|
||||
following toggles are available:
|
||||
|
||||
`Constant Update Toggle (Meta-C)'
|
||||
toggles the -c (-const) command line flag.
|
||||
|
||||
`Regular Expressions Toggle (Meta-E)'
|
||||
toggles the -R (-regexp) command line flag.
|
||||
|
||||
`AutoIndent Toggle (Meta-I)'
|
||||
toggles the -i (-autoindent) command line flag.
|
||||
|
||||
`Cut To End Toggle (Meta-K)'
|
||||
toggles the -k (-cut) command line flag.
|
||||
|
||||
`Cut To End Toggle (Meta-M)'
|
||||
toggles the -m (-mouse) command line flag.
|
||||
|
||||
`Pico Mode Toggle (Meta-P)'
|
||||
toggles the -p (-pico) command line flag. *Note Pico
|
||||
Compatibility::, for more info.
|
||||
|
||||
`AutoWrap Toggle (Meta-W)'
|
||||
toggles the -w (-nowrap) command line flag.
|
||||
|
||||
`Expert/Nohelp Toggle (Meta-X)'
|
||||
toggles the -x (-nohelp) command line flag.
|
||||
|
||||
`Suspend Toggle (Meta-Z)'
|
||||
toggles the -z (-suspend) command line flag.
|
||||
|
||||
|
||||
File: nano.info, Node: The File Browser, Next: Pico Compatibility, Prev: Feature Toggles, Up: Top
|
||||
|
||||
The File Browser
|
||||
****************
|
||||
|
||||
When reading or writing files, pressing ^T will invoke the file
|
||||
browser. Here, one can navigate directories in a graphical manner in
|
||||
order to find the desired file.
|
||||
|
||||
Basic movement in the file browser is accomplished with he arrow keys
|
||||
and page up/down. The behavior of the enter (or 's') key varies by what
|
||||
is currently selected. If the currently selected object is a directory,
|
||||
the file browser will enter and display the contents of the directory.
|
||||
If the object is a file, this filename and path are copied to the
|
||||
statusbar and the file browser is exited.
|
||||
|
||||
|
||||
File: nano.info, Node: Pico Compatibility, Next: Building and Configure Options, Prev: The File Browser, Up: Top
|
||||
|
||||
Pico Compatibility
|
||||
******************
|
||||
|
||||
Nano does not completely emulate Pico by default. The following
|
||||
differences apply to the default mode and Pico Compatibility mode:
|
||||
|
||||
`Displayed Shortcuts'
|
||||
By default, the following shortcuts are displayed in the Shortcut
|
||||
Lists:
|
||||
|
||||
^G ^O ^\ ^Y ^K ^C
|
||||
^X ^R ^W ^V ^U ^T
|
||||
|
||||
Related functions are listed above or below each other by default.
|
||||
The Justify function is not listed, instead the "Replace"
|
||||
function is displayed. Also, he "Read File" and "WriteOut"
|
||||
functions are aligned for consistency.
|
||||
|
||||
In Pico Compatibility mode, the default Pico shortcuts are
|
||||
displayed:
|
||||
|
||||
^G ^O ^R ^Y ^K ^C
|
||||
^X ^J ^W ^V ^U ^T
|
||||
|
||||
`Previous String Text'
|
||||
By default, previously entered string for a function (search
|
||||
string, file name) will be placed on the statusbar, and is
|
||||
editable. This is done so there is consistency across all
|
||||
functions. For example: even if there is a previous replace
|
||||
string, it can always be deleted if one wishes to perform an empty
|
||||
string replace.
|
||||
|
||||
In Pico Compatibility Mode, the previously entered text in a
|
||||
search or replace will appear in brackets, and is not editable.
|
||||
It is not a simple matter to do an empty string replace when a
|
||||
previous replace string exists, for example. When writing a file,
|
||||
the previous filename will be displayed in the editable text
|
||||
portion of the editor.
|
||||
|
||||
`Interactive Replace and Spell Checker'
|
||||
It is worth noting that the `nano' replace function is interactive,
|
||||
i.e. it does not stop after one search string is found and
|
||||
automatically replace it. The `nano' implementation will stop at
|
||||
each search string found and query whether to replace this
|
||||
instance or not. The internal spell checker operates similarly.
|
||||
Note that these is no way to force these functions to behave in
|
||||
the Pico fashion.
|
||||
|
||||
|
||||
File: nano.info, Node: Building and Configure Options, Prev: Pico Compatibility, Up: Top
|
||||
|
||||
Building and Configure Options
|
||||
******************************
|
||||
|
||||
Building nano from source is fairly straightforward if you are
|
||||
familiar with compiling programs with autoconf support:
|
||||
|
||||
tar xvfz nano-x.y.z.tar.gz (where x.y.z is the version of nano) cd
|
||||
nano-x.y.z/ ./configure make make install
|
||||
|
||||
if you are looking to optimize nano for size, you may want to
|
||||
consider the following command line options:
|
||||
|
||||
`--disable-tabcomp'
|
||||
Disable the tab completion code when reading or writing files.
|
||||
|
||||
`--disable-justify'
|
||||
Disable the justify (^J)/unjustify (^U) functions in the editor.
|
||||
|
||||
`--disable-speller'
|
||||
Disables spell checker ability.
|
||||
|
||||
`--disable-help'
|
||||
Disables the help function (^G). Disabling this option makes the
|
||||
binary much smaller, but makes it difficult for new users to learn
|
||||
more than very basic things about using the editor.
|
||||
|
||||
`--disable-browser'
|
||||
Disables the mini file browser (^O) when reading or writing files.
|
||||
|
||||
`--enable-tiny'
|
||||
This options disables all the above. It also disables some of the
|
||||
larger internals of the editor, like the marker code (^^) and the
|
||||
cut to line (-k) option which it depends on to work properly. It
|
||||
also disables the function toggles and mouse support.
|
||||
|
||||
`--disable-wrapping'
|
||||
Disables all word wrapping in the editor. This also eliminates the
|
||||
-w command line flag, as nonwrapping is then the default behavior.
|
||||
|
||||
`--disable-mouse'
|
||||
Disables all mouse functionality. This also disables the -m
|
||||
commands line flag which enables the mouse functions.
|
||||
|
||||
|
||||
|
||||
Tag Table:
|
||||
Node: Top200
|
||||
Node: Introduction508
|
||||
Node: Overview934
|
||||
Node: Command Line Options1514
|
||||
Ref: Expert Mode3406
|
||||
Node: Editor Basics4249
|
||||
Node: Entering Text4474
|
||||
Node: Special Functions4814
|
||||
Node: The Titlebar5669
|
||||
Node: The Statusbar6367
|
||||
Node: Shortcut Lists6948
|
||||
Node: Online Help7341
|
||||
Node: Feature Toggles7717
|
||||
Node: The File Browser8860
|
||||
Node: Pico Compatibility9569
|
||||
Node: Building and Configure Options11611
|
||||
|
||||
End Tag Table
|
||||
67
nano.texi
67
nano.texi
@@ -8,8 +8,8 @@
|
||||
@c Run `makeinfo' rather than `texinfo-format-buffer'.
|
||||
@smallbook
|
||||
@set EDITION 0.1
|
||||
@set VERSION 1.1.1
|
||||
@set UPDATED 12 Feb 2001
|
||||
@set VERSION 1.1.4
|
||||
@set UPDATED 3 Oct 2001
|
||||
|
||||
@dircategory Editors
|
||||
@direntry
|
||||
@@ -23,7 +23,7 @@
|
||||
@titlepage
|
||||
@title GNU @code{nano}
|
||||
@subtitle a small and friendly text editor.
|
||||
@subtitle version 1.1.1
|
||||
@subtitle version 1.1.4
|
||||
|
||||
@author Chris Allegretta
|
||||
@page
|
||||
@@ -108,12 +108,24 @@ Email bug reports to @email{nano@@nano-editor.org}.
|
||||
@code{nano} takes the following options from the command line:
|
||||
@table @code
|
||||
|
||||
@item -T [num, --tabsize=[num]
|
||||
Set the displayed tab length to [num] columns.
|
||||
@item -D, --dos
|
||||
Write file in DOS format.
|
||||
|
||||
@item -F, --multibuffer
|
||||
Enable multiple file buffers.
|
||||
|
||||
@item -M, --mac
|
||||
Write file in Mac format.
|
||||
|
||||
@item -R, --regexp
|
||||
Turns on regular expression search and search/replace.
|
||||
|
||||
@item -S, --smooth
|
||||
Enables smooth scrolling.
|
||||
|
||||
@item -T [num], --tabsize=[num]
|
||||
Set the displayed tab length to [num] columns.
|
||||
|
||||
@item -V, --version
|
||||
Print the version number and copyright and quit.
|
||||
|
||||
@@ -139,6 +151,9 @@ and a new file is created.
|
||||
Enables the use of the mouse to select text (currently only useful for
|
||||
running under the X window system).
|
||||
|
||||
@item -o [dir], --operatingdir=[dir]
|
||||
Set operating directory. Makes nano set up something similar to a chroot.
|
||||
|
||||
@item -p, --pico
|
||||
Emulate Pico as closely as possible, sacrificing consistency for correct
|
||||
emulation. @xref{Pico Compatibility}, for more info.
|
||||
@@ -181,6 +196,9 @@ Do not wrap long lines at any length. This option overrides any value for
|
||||
Enable suspend ability of @code{nano} using the system's suspend
|
||||
keystroke (usually ^Z).
|
||||
|
||||
@item -a, -b, -e, -f, -g, -j
|
||||
Ignored, for compatibility with Pico.
|
||||
|
||||
@item +LINE
|
||||
Start at line number LINE instead of the default of line 1.
|
||||
@end table
|
||||
@@ -277,25 +295,43 @@ The following toggles are available:
|
||||
|
||||
@table @code
|
||||
|
||||
@item Case Sensitive Search Toggle (Meta-A)
|
||||
toggles case sensistive searching functionality on/off.
|
||||
|
||||
@item Backwards Search Toggle (Meta-B)
|
||||
toggles backwards searching fuctionality on/off.
|
||||
|
||||
@item Constant Update Toggle (Meta-C)
|
||||
toggles the -c (--const) command line flag.
|
||||
|
||||
@item DOS Format Toggle (Meta-D)
|
||||
toggles the -D (--dos) command line flag.
|
||||
|
||||
@item Regular Expressions Toggle (Meta-E)
|
||||
toggles the -R (--regexp) command line flag.
|
||||
|
||||
@item Multiple Files Toggle (Meta-F)
|
||||
toggles the -F (--multibuffer) command line flag.
|
||||
|
||||
@item AutoIndent Toggle (Meta-I)
|
||||
toggles the -i (--autoindent) command line flag.
|
||||
|
||||
@item Cut To End Toggle (Meta-K)
|
||||
toggles the -k (--cut) command line flag.
|
||||
|
||||
@item Cut To End Toggle (Meta-M)
|
||||
@item Mouse Toggle (Meta-M)
|
||||
toggles the -m (--mouse) command line flag.
|
||||
|
||||
@item Mac Format Toggle (Meta-O)
|
||||
toggles the -M (--mac) command line flag.
|
||||
|
||||
@item Pico Mode Toggle (Meta-P)
|
||||
toggles the -p (--pico) command line flag.
|
||||
@xref{Pico Compatibility}, for more info.
|
||||
|
||||
@item Smooth Scrolling Toggle (Meta-S)
|
||||
toggles the -s (--smooth) command line flag.
|
||||
|
||||
@item AutoWrap Toggle (Meta-W)
|
||||
toggles the -w (--nowrap) command line flag.
|
||||
|
||||
@@ -305,6 +341,13 @@ toggles the -x (--nohelp) command line flag.
|
||||
@item Suspend Toggle (Meta-Z)
|
||||
toggles the -z (--suspend) command line flag.
|
||||
|
||||
@item Open Previous File Toggle (Meta-<)
|
||||
changes buffer to previously loaded file.
|
||||
|
||||
@item Open Next File Toggle (Meta->)
|
||||
changes buffer to next loaded file.
|
||||
|
||||
|
||||
@end table
|
||||
|
||||
@node The File Browser, Pico Compatibility, Feature Toggles, Top
|
||||
@@ -415,6 +458,18 @@ Disables all word wrapping in the editor. This also eliminates the
|
||||
Disables all mouse functionality. This also disables the -m commands line
|
||||
flag which enables the mouse functions.
|
||||
|
||||
@item --disable-operatingdir
|
||||
Disables setting of operating directory. This also disables the -o command
|
||||
line flag.
|
||||
|
||||
@item --disable-nls
|
||||
Disables Native Language support. This will make the available GNU nano
|
||||
translations unusable.
|
||||
|
||||
@item --with-slang
|
||||
Compiling GNU nano with Slang is supported, and will make the binary notably
|
||||
smaller than if compiled with ncurses or other curses libraries.
|
||||
|
||||
@end table
|
||||
|
||||
@contents
|
||||
|
||||
@@ -17,12 +17,18 @@
|
||||
# Don't follow symlinks when writing files
|
||||
# set nofollow
|
||||
|
||||
# Set operating directory (chroot of sorts)
|
||||
# set operatingdir "~"
|
||||
|
||||
# Use Pico Compatibility mode for the shortcut lists and search text
|
||||
# set pico
|
||||
|
||||
# Use this value instead of the default
|
||||
# set fill -8
|
||||
|
||||
# Use this tab size instead of the default
|
||||
# set tabsize 8
|
||||
|
||||
# Use this spelling checker instead of the default one
|
||||
# set speller aspell
|
||||
|
||||
@@ -41,8 +47,34 @@
|
||||
# Allow nano to be suspended with ^Z
|
||||
# set suspend
|
||||
|
||||
# Use smooth scrolling as the default
|
||||
# set smooth
|
||||
|
||||
# Allow multiple file buffers (using ^R inserts into separate buffer)
|
||||
# You must have configured with --enable-multibuffer or --enable-extra for
|
||||
# this to work
|
||||
#
|
||||
# set multibuffer
|
||||
|
||||
#
|
||||
# Color setup
|
||||
# Format: color foreground,background regex [regex...]
|
||||
#
|
||||
# Legal colors are: white, black, red, blue, green, yellow, purple, cyan
|
||||
# You may use the prefix "bright" to mean a stronger color highlight
|
||||
#
|
||||
# If your system supports transparency, not specifying a background
|
||||
# color will use a transparent color. If you don't want this, be sure
|
||||
# to set the background color to black or white.
|
||||
#
|
||||
#color brightred float\ char\ int\ void\ NULL [A-Z_]\{2,\} static
|
||||
#color brightred [\ ]struct ^struct if\ while[\ \n\(] do[\ \n\(] else[\ \n] case\ switch\ break;
|
||||
#color brightcyan #define #include #ifn*def #endif #elif #else
|
||||
|
||||
# You will in general want your comments and strings to come last, because
|
||||
# syntax highlighting rules will be applied in the order they are read in
|
||||
|
||||
#color brightyellow <.*> ".*"
|
||||
#color brightblue /\*.**/
|
||||
# multi-line comment hack
|
||||
#color brightblue /\*.* [^\/][^\*]*\*\/ ^.*\*+*\**$ ^\ *\*\{1,\}\/$ \/\/.*
|
||||
|
||||
48
proto.h
48
proto.h
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 1999 Chris Allegretta *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 1, or (at your option) *
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
* any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
@@ -33,7 +33,8 @@ extern int editwinrows;
|
||||
extern int current_x, current_y, posible_max, totlines;
|
||||
extern int placewewant;
|
||||
extern int mark_beginx, samelinewrap;
|
||||
extern int totsize, temp_opt;
|
||||
extern long totsize;
|
||||
extern int temp_opt;
|
||||
extern int fill, wrap_at, flags,tabsize;
|
||||
extern int search_last_line;
|
||||
extern int currslen;
|
||||
@@ -44,6 +45,9 @@ extern char *answer;
|
||||
extern char *hblank, *help_text;
|
||||
extern char *last_search;
|
||||
extern char *last_replace;
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
extern char *operating_dir;
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
extern char *alt_speller;
|
||||
#endif
|
||||
@@ -55,6 +59,10 @@ extern filestruct *cutbuffer, *mark_beginbuf;
|
||||
extern filestruct *open_files;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
colortype *colorstrings;
|
||||
#endif
|
||||
|
||||
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];
|
||||
@@ -100,10 +108,20 @@ int do_insertfile(int loading_file);
|
||||
int add_open_file(int update, int dup_fix);
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
int check_operating_dir(char *currpath, int allow_tabcomp);
|
||||
#endif
|
||||
|
||||
int do_writeout(char *path, int exiting, int append);
|
||||
int do_gotoline(long line, int save_pos);
|
||||
int do_gotoline(int line, int save_pos);
|
||||
int do_replace_loop(char *prevanswer, filestruct *begin, int *beginx,
|
||||
int wholewords, int *i);
|
||||
int do_find_bracket(void);
|
||||
|
||||
#if defined (ENABLE_MULTIBUFFER) || !defined (DISABLE_SPELLER)
|
||||
void do_gotopos(int line, int pos_x, int pos_y, int pos_placewewant);
|
||||
#endif
|
||||
|
||||
/* Now in move.c */
|
||||
int do_up(void);
|
||||
int do_down(void);
|
||||
@@ -111,7 +129,7 @@ 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);
|
||||
char *input_tab(char *buf, int place, int *lastWasTab, int *newplace, int *list);
|
||||
char *real_dir_from_tilde(char *buf);
|
||||
|
||||
void shortcut_init(int unjustify);
|
||||
@@ -151,8 +169,8 @@ void die_save_file(char *die_filename);
|
||||
void new_file(void);
|
||||
void new_magicline(void);
|
||||
void splice_node(filestruct *begin, filestruct *newnode, filestruct *end);
|
||||
void null_at(char *data, int index);
|
||||
void page_up_center(void);
|
||||
void null_at(char **data, int index);
|
||||
void page_up(void);
|
||||
void blank_edit(void);
|
||||
void search_init_globals(void);
|
||||
void replace_abort(void);
|
||||
@@ -182,8 +200,8 @@ int do_insertfile_void(void), do_search(void);
|
||||
int load_open_file(void), close_open_file(void);
|
||||
#endif
|
||||
|
||||
int page_up(void), page_down(void);
|
||||
int do_cursorpos(void), do_spell(void);
|
||||
int do_page_up(void), do_page_down(void);
|
||||
int do_cursorpos(int constant), do_cursorpos_void(void), do_spell(void);
|
||||
int do_up(void), do_down (void), do_right(void), do_left (void);
|
||||
int do_home(void), do_end(void), total_refresh(void), do_mark(void);
|
||||
int do_delete(void), do_backspace(void), do_tab(void), do_justify(void);
|
||||
@@ -198,8 +216,8 @@ int open_prevfile(int closing_file), open_nextfile(int closing_file);
|
||||
|
||||
char *charalloc (size_t howmuch);
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
char *get_full_path(const char *origpath);
|
||||
#if defined (ENABLE_MULTIBUFFER) || !defined (ENABLE_OPERATINGDIR)
|
||||
char *get_full_path(char *origpath);
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
@@ -221,9 +239,15 @@ RETSIGTYPE main_loop (int junk);
|
||||
filestruct *copy_node(filestruct * src);
|
||||
filestruct *copy_filestruct(filestruct * src);
|
||||
filestruct *make_new_node(filestruct * prevnode);
|
||||
filestruct *findnextstr(int quiet, filestruct * begin,
|
||||
filestruct *findnextstr(int quiet, int bracket_mode, filestruct * begin,
|
||||
int beginx, char *needle);
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
filestruct *open_file_dup_search(void);
|
||||
filestruct *open_file_dup_search(int update);
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_HELP
|
||||
void help_init(void);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
179
rcfile.c
179
rcfile.c
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 1999 Chris Allegretta *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 1, or (at your option) *
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
* any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
@@ -39,7 +39,12 @@
|
||||
#define _(string) (string)
|
||||
#endif
|
||||
|
||||
#define NUM_RCOPTS 15
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
#define NUM_RCOPTS 18
|
||||
#else
|
||||
#define NUM_RCOPTS 17
|
||||
#endif
|
||||
|
||||
/* Static stuff for the nanorc file */
|
||||
rcoption rcopts[NUM_RCOPTS] =
|
||||
{
|
||||
@@ -49,7 +54,9 @@ rcoption rcopts[NUM_RCOPTS] =
|
||||
{"cut", CUT_TO_END},
|
||||
{"nofollow", FOLLOW_SYMLINKS},
|
||||
{"mouse", USE_MOUSE},
|
||||
{"operatingdir", 0},
|
||||
{"pico", PICO_MODE},
|
||||
{"tabsize", 0},
|
||||
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
{"fill", 0},
|
||||
@@ -61,7 +68,8 @@ rcoption rcopts[NUM_RCOPTS] =
|
||||
{"nowrap", NO_WRAP},
|
||||
{"nohelp", NO_HELP},
|
||||
{"suspend", SUSPEND},
|
||||
{"multibuffer", MULTIBUFFER}};
|
||||
{"multibuffer", MULTIBUFFER},
|
||||
{"smooth", SMOOTHSCROLL}};
|
||||
|
||||
/* We have an error in some part of the rcfile; put it on stderr and
|
||||
make the user hit return to continue starting up nano */
|
||||
@@ -99,18 +107,157 @@ void rcfile_msg(int *errors, char *msg, ...)
|
||||
/* Parse the next word from the string. Returns NULL if we hit EOL */
|
||||
char *parse_next_word(char *ptr)
|
||||
{
|
||||
while (*ptr != ' ' && *ptr != '\n' && ptr != '\0')
|
||||
while (*ptr != ' ' && *ptr != '\t' && *ptr != '\n' && ptr != '\0')
|
||||
ptr++;
|
||||
|
||||
if (*ptr == '\0')
|
||||
if (*ptr == '\0' || *ptr == '\n')
|
||||
return NULL;
|
||||
|
||||
|
||||
/* Null terminate and advance ptr */
|
||||
*ptr++ = 0;
|
||||
|
||||
while ((*ptr == ' ' || *ptr == '\t') && *ptr != '\0')
|
||||
ptr++;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
int colortoint(char *colorname, int *bright, char *filename, int *lineno)
|
||||
{
|
||||
int mcolor = 0;
|
||||
|
||||
if (colorname == NULL)
|
||||
return -1;
|
||||
|
||||
if (strcasestr(colorname, "bright")) {
|
||||
*bright = 1;
|
||||
colorname += 6;
|
||||
}
|
||||
|
||||
if (!strcasecmp(colorname, "green"))
|
||||
mcolor += COLOR_GREEN;
|
||||
else if (!strcasecmp(colorname, "red"))
|
||||
mcolor += COLOR_RED;
|
||||
else if (!strcasecmp(colorname, "blue"))
|
||||
mcolor += COLOR_BLUE;
|
||||
else if (!strcasecmp(colorname, "white"))
|
||||
mcolor += COLOR_WHITE;
|
||||
else if (!strcasecmp(colorname, "yellow"))
|
||||
mcolor += COLOR_YELLOW;
|
||||
else if (!strcasecmp(colorname, "cyan"))
|
||||
mcolor += COLOR_CYAN;
|
||||
else if (!strcasecmp(colorname, "magenta"))
|
||||
mcolor += COLOR_MAGENTA;
|
||||
else if (!strcasecmp(colorname, "black"))
|
||||
mcolor += COLOR_BLACK;
|
||||
else {
|
||||
printf("Error in %s on line %d: color %s not understood.\n",
|
||||
filename, *lineno, colorname);
|
||||
printf("Valid colors are \"green\", \"red\", \"blue\", "
|
||||
"\"white\", \"yellow\", \"cyan\", \"magenta\" and "
|
||||
"\"black\", with the optional prefix \"bright\".\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return mcolor;
|
||||
}
|
||||
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
/* Parse the color stuff into the colorstrings array */
|
||||
void parse_colors(FILE *rcstream, char *filename, int *lineno, char *buf, char *ptr)
|
||||
{
|
||||
int i = 0, fg, bg, bright = 0;
|
||||
char prev = '\\';
|
||||
char *tmp = NULL, *beginning, *fgstr, *bgstr;
|
||||
colortype *tmpcolor = NULL;
|
||||
|
||||
fgstr = ptr;
|
||||
ptr = parse_next_word(ptr);
|
||||
|
||||
if (ptr == NULL) {
|
||||
printf("Error in %s on line %d: Missing color name.\n",
|
||||
filename, *lineno);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (strstr(fgstr, ",")) {
|
||||
strtok(fgstr, ",");
|
||||
bgstr = strtok(NULL, ",");
|
||||
} else
|
||||
bgstr = NULL;
|
||||
|
||||
fg = colortoint(fgstr, &bright, filename, lineno);
|
||||
bg = colortoint(bgstr, &bright, filename, lineno);
|
||||
|
||||
/* Now the fun part, start adding regexps to individual strings
|
||||
in the colorstrings array, woo! */
|
||||
|
||||
i = 0;
|
||||
beginning = ptr;
|
||||
while (*ptr != '\0') {
|
||||
switch (*ptr) {
|
||||
case '\n':
|
||||
*ptr = ' ';
|
||||
/* i++; */
|
||||
case ' ':
|
||||
if (prev != '\\') {
|
||||
/* This is the end of the regex, uh I guess.
|
||||
Add it to the colorstrings array for this color */
|
||||
|
||||
tmp = NULL;
|
||||
tmp = charalloc(i + 1);
|
||||
strncpy(tmp, beginning, i);
|
||||
tmp[i] = '\0';
|
||||
|
||||
ptr = parse_next_word(ptr);
|
||||
if (ptr == NULL)
|
||||
return;
|
||||
|
||||
if (colorstrings == NULL) {
|
||||
colorstrings = nmalloc(sizeof(colortype));
|
||||
colorstrings->fg = fg;
|
||||
colorstrings->bg = bg;
|
||||
colorstrings->bright = bright;
|
||||
colorstrings->str = NULL;
|
||||
colorstrings->str = nmalloc(sizeof(colorstr));
|
||||
colorstrings->str->val = tmp;
|
||||
colorstrings->str->next = NULL;
|
||||
colorstrings->next = NULL;
|
||||
} else {
|
||||
for (tmpcolor = colorstrings; tmpcolor->next != NULL;
|
||||
tmpcolor = tmpcolor->next)
|
||||
;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Adding new entry for fg %d bg %d\n", fg, bg);
|
||||
#endif
|
||||
|
||||
tmpcolor->next = nmalloc(sizeof(colortype));
|
||||
tmpcolor->next->fg = fg;
|
||||
tmpcolor->next->bg = bg;
|
||||
tmpcolor->next->bright = bright;
|
||||
tmpcolor->next->str = nmalloc(sizeof(colorstr));
|
||||
tmpcolor->next->str->val = tmp;
|
||||
tmpcolor->next->str->next = NULL;
|
||||
tmpcolor->next->next = NULL;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
beginning = ptr;
|
||||
break;
|
||||
}
|
||||
/* Else drop through to the default case */
|
||||
default:
|
||||
i++;
|
||||
prev = *ptr;
|
||||
ptr++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
/* Parse the RC file, once it has been opened successfully */
|
||||
void parse_rcfile(FILE *rcstream, char *filename)
|
||||
{
|
||||
@@ -147,6 +294,10 @@ void parse_rcfile(FILE *rcstream, char *filename)
|
||||
set = 1;
|
||||
else if (!strcasecmp(keyword, "unset"))
|
||||
set = -1;
|
||||
#ifdef ENABLE_COLOR
|
||||
else if (!strcasecmp(keyword, "color"))
|
||||
parse_colors(rcstream, filename, &lineno, buf, ptr);
|
||||
#endif /* ENABLE_COLOR */
|
||||
else {
|
||||
rcfile_msg(&errors, _("Error in %s on line %d: command %s not understood"),
|
||||
filename, lineno, keyword);
|
||||
@@ -166,6 +317,8 @@ void parse_rcfile(FILE *rcstream, char *filename)
|
||||
#endif
|
||||
if (set == 1 || rcopts[i].flag == FOLLOW_SYMLINKS) {
|
||||
if (
|
||||
!strcasecmp(rcopts[i].name, "operatingdir") ||
|
||||
!strcasecmp(rcopts[i].name, "tabsize") ||
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
!strcasecmp(rcopts[i].name, "fill") ||
|
||||
#endif
|
||||
@@ -189,13 +342,20 @@ void parse_rcfile(FILE *rcstream, char *filename)
|
||||
if ((i = atoi(option)) < MIN_FILL_LENGTH) {
|
||||
rcfile_msg(&errors,
|
||||
_("Error in %s on line %d: requested fill size %d too small"),
|
||||
filename, lineno, option);
|
||||
filename, lineno, i);
|
||||
}
|
||||
else
|
||||
fill = i;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
} else if (!strcasecmp(rcopts[i].name, "tabsize")) {
|
||||
if ((i = atoi(option)) <= 0) {
|
||||
rcfile_msg(&errors,
|
||||
_("Error in %s on line %d: requested tab size %d too small"),
|
||||
filename, lineno, i);
|
||||
} else {
|
||||
tabsize = i;
|
||||
}
|
||||
} else {
|
||||
#ifndef DISABLE_SPELLER
|
||||
alt_speller = charalloc(strlen(option) + 1);
|
||||
strcpy(alt_speller, option);
|
||||
@@ -231,6 +391,7 @@ void do_rcfile(void)
|
||||
struct stat fileinfo;
|
||||
FILE *rcstream;
|
||||
|
||||
|
||||
if (getenv("HOME") == NULL)
|
||||
return;
|
||||
|
||||
|
||||
224
search.c
224
search.c
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2000 Chris Allegretta *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 1, or (at your option) *
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
* any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
@@ -74,7 +74,6 @@ int search_init(int replacing)
|
||||
{
|
||||
int i = 0;
|
||||
char *buf;
|
||||
char *prompt;
|
||||
static char *backupstring = NULL;
|
||||
#ifndef NANO_SMALL
|
||||
int j;
|
||||
@@ -85,6 +84,15 @@ int search_init(int replacing)
|
||||
buf = charalloc(strlen(last_search) + 5);
|
||||
buf[0] = 0;
|
||||
|
||||
|
||||
/* Clear the backupstring if we've changed from Pico mode to regular
|
||||
mode */
|
||||
if (ISSET(CLEAR_BACKUPSTRING)) {
|
||||
free(backupstring);
|
||||
backupstring = NULL;
|
||||
UNSET(CLEAR_BACKUPSTRING);
|
||||
}
|
||||
|
||||
/* 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
|
||||
@@ -117,19 +125,24 @@ int search_init(int replacing)
|
||||
else
|
||||
strcpy(buf, "");
|
||||
|
||||
/* Instead of having a million if statements here to determine
|
||||
the prompt, we instead just have a hundred "? :" calls in
|
||||
the statusq call. I hope no one ever has to modify this :-) */
|
||||
prompt = "%s%s%s%s%s%s";
|
||||
|
||||
/* 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,
|
||||
ISSET(CASE_SENSITIVE) ? _("Case Sensitive ") : "",
|
||||
ISSET(USE_REGEXP) ? _("Regexp ") : "",
|
||||
"%s%s%s%s%s%s",
|
||||
_("Search"),
|
||||
ISSET(REVERSE_SEARCH) ? _(" Backwards") : "",
|
||||
|
||||
/* This string is just a modifier for the search prompt,
|
||||
no grammar is implied */
|
||||
ISSET(CASE_SENSITIVE) ? _(" [Case Sensitive]") : "",
|
||||
|
||||
/* This string is just a modifier for the search prompt,
|
||||
no grammar is implied */
|
||||
ISSET(USE_REGEXP) ? _(" [Regexp]") : "",
|
||||
|
||||
/* This string is just a modifier for the search prompt,
|
||||
no grammar is implied */
|
||||
ISSET(REVERSE_SEARCH) ? _(" [Backwards]") : "",
|
||||
|
||||
replacing ? _(" (to replace)") : "",
|
||||
buf);
|
||||
|
||||
@@ -183,17 +196,6 @@ int search_init(int replacing)
|
||||
case NANO_OTHERSEARCH_KEY:
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return -2; /* Call the opposite search function */
|
||||
/*
|
||||
} else if (i == NANO_REVERSESEARCH_KEY) {
|
||||
free(backupstring);
|
||||
backupstring = NULL;
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
|
||||
TOGGLE(REVERSE_SEARCH);
|
||||
|
||||
return 1;
|
||||
} else if (i == NANO_FROMSEARCHTOGOTO_KEY) {
|
||||
*/
|
||||
case NANO_FROMSEARCHTOGOTO_KEY:
|
||||
free(backupstring);
|
||||
backupstring = NULL;
|
||||
@@ -224,23 +226,27 @@ void not_found_msg(char *str)
|
||||
}
|
||||
}
|
||||
|
||||
filestruct *findnextstr(int quiet, filestruct * begin, int beginx,
|
||||
int past_editbuff; /* search is now looking through lines not displayed */
|
||||
|
||||
filestruct *findnextstr(int quiet, int bracket_mode, filestruct * begin, int beginx,
|
||||
char *needle)
|
||||
{
|
||||
filestruct *fileptr;
|
||||
char *searchstr, *rev_start = NULL, *found = NULL;
|
||||
int past_editbot = 0, current_x_find;
|
||||
int current_x_find = 0;
|
||||
|
||||
fileptr = current;
|
||||
|
||||
past_editbuff = 0;
|
||||
|
||||
if (!ISSET(REVERSE_SEARCH)) { /* forward search */
|
||||
|
||||
current_x_find = current_x + 1;
|
||||
|
||||
/* Are we now back to the line where the search started) */
|
||||
if ((fileptr == begin) && (current_x_find < beginx))
|
||||
#if 0
|
||||
/* Are we now back to the place where the search started) */
|
||||
if ((fileptr == begin) && (beginx > current_x_find))
|
||||
search_last_line = 1;
|
||||
|
||||
#endif
|
||||
/* Make sure we haven't passed the end of the string */
|
||||
if (strlen(fileptr->data) < current_x_find)
|
||||
current_x_find--;
|
||||
@@ -259,15 +265,19 @@ filestruct *findnextstr(int quiet, filestruct * begin, int beginx,
|
||||
|
||||
fileptr = fileptr->next;
|
||||
|
||||
if (!past_editbot && (fileptr == editbot))
|
||||
past_editbot = 1;
|
||||
if (fileptr == editbot)
|
||||
past_editbuff = 1;
|
||||
|
||||
/* EOF reached ?, wrap around once */
|
||||
if (fileptr == NULL) {
|
||||
if (bracket_mode) /* don't wrap if looking for bracket match */
|
||||
return NULL;
|
||||
fileptr = fileage;
|
||||
past_editbot = 1;
|
||||
if (!quiet)
|
||||
statusbar(_("Search Wrapped"));
|
||||
past_editbuff = 1;
|
||||
if (!quiet) {
|
||||
statusbar(_("Search Wrapped"));
|
||||
SET(DISABLE_CURPOS);
|
||||
}
|
||||
}
|
||||
|
||||
/* Original start line reached */
|
||||
@@ -279,24 +289,26 @@ filestruct *findnextstr(int quiet, filestruct * begin, int beginx,
|
||||
|
||||
/* We found an instance */
|
||||
current_x_find = found - fileptr->data;
|
||||
|
||||
#if 1
|
||||
/* Ensure we haven't wrapped around again! */
|
||||
if ((search_last_line) && (current_x_find >= beginx)) {
|
||||
if (!quiet)
|
||||
not_found_msg(needle);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
} else { /* reverse search */
|
||||
#endif
|
||||
}
|
||||
#ifndef NANO_SMALL
|
||||
else { /* reverse search */
|
||||
|
||||
current_x_find = current_x - 1;
|
||||
|
||||
/* Are we now back to the line where the search started) */
|
||||
/* Are we now back to the place where the search started) */
|
||||
if ((fileptr == begin) && (current_x_find > beginx))
|
||||
search_last_line = 1;
|
||||
|
||||
/* Make sure we haven't passed the begining of the string */
|
||||
#if 0 /* Is this required here ? */
|
||||
#if 1 /* Is this required here ? */
|
||||
if (!(&fileptr->data[current_x_find] - fileptr->data))
|
||||
current_x_find++;
|
||||
#endif
|
||||
@@ -315,15 +327,19 @@ filestruct *findnextstr(int quiet, filestruct * begin, int beginx,
|
||||
|
||||
fileptr = fileptr->prev;
|
||||
|
||||
/* ? */ if (!past_editbot && (fileptr == edittop->prev))
|
||||
past_editbot = 1;
|
||||
if (fileptr == edittop->prev)
|
||||
past_editbuff = 1;
|
||||
|
||||
/* SOF reached ?, wrap around once */
|
||||
/* ? */ if (fileptr == NULL) {
|
||||
if (bracket_mode)
|
||||
return NULL;
|
||||
fileptr = filebot;
|
||||
past_editbot = 1;
|
||||
if (!quiet)
|
||||
past_editbuff = 1;
|
||||
if (!quiet) {
|
||||
statusbar(_("Search Wrapped"));
|
||||
SET(DISABLE_CURPOS);
|
||||
}
|
||||
}
|
||||
|
||||
/* Original start line reached */
|
||||
@@ -336,26 +352,30 @@ filestruct *findnextstr(int quiet, filestruct * begin, int beginx,
|
||||
|
||||
/* We found an instance */
|
||||
current_x_find = found - fileptr->data;
|
||||
|
||||
#if 1
|
||||
/* Ensure we haven't wrapped around again! */
|
||||
if ((search_last_line) && (current_x_find < beginx)) {
|
||||
if (!quiet)
|
||||
not_found_msg(needle);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif /* NANO_SMALL */
|
||||
|
||||
/* Set globals now that we are sure we found something */
|
||||
current = fileptr;
|
||||
current_x = current_x_find;
|
||||
|
||||
if (past_editbot)
|
||||
edit_update(fileptr, CENTER);
|
||||
else
|
||||
update_line(current, current_x);
|
||||
if (!bracket_mode) {
|
||||
if (past_editbuff)
|
||||
edit_update(fileptr, CENTER);
|
||||
else
|
||||
update_line(current, current_x);
|
||||
|
||||
placewewant = xplustabs();
|
||||
reset_cursor();
|
||||
placewewant = xplustabs();
|
||||
reset_cursor();
|
||||
}
|
||||
|
||||
return fileptr;
|
||||
}
|
||||
@@ -415,7 +435,7 @@ int do_search(void)
|
||||
last_search = mallocstrcpy(last_search, answer);
|
||||
|
||||
search_last_line = 0;
|
||||
findnextstr(0, current, current_x, answer);
|
||||
findnextstr(FALSE, FALSE, current, current_x, answer);
|
||||
search_abort();
|
||||
return 1;
|
||||
}
|
||||
@@ -584,7 +604,7 @@ int do_replace_loop(char *prevanswer, filestruct *begin, int *beginx,
|
||||
while (1) {
|
||||
|
||||
/* Sweet optimization by Rocco here */
|
||||
fileptr = findnextstr(replaceall, begin, *beginx, prevanswer);
|
||||
fileptr = findnextstr(replaceall, FALSE, begin, *beginx, prevanswer);
|
||||
|
||||
/* No more matches. Done! */
|
||||
if (!fileptr)
|
||||
@@ -631,8 +651,10 @@ int do_replace_loop(char *prevanswer, filestruct *begin, int *beginx,
|
||||
}
|
||||
|
||||
/* Cleanup */
|
||||
totsize -= strlen(current->data);
|
||||
free(current->data);
|
||||
current->data = copy;
|
||||
totsize += strlen(current->data);
|
||||
|
||||
/* Stop bug where we replace a substring of the replacement text */
|
||||
current_x += strlen(last_replace) - 1;
|
||||
@@ -748,13 +770,13 @@ void goto_abort(void)
|
||||
display_main_list();
|
||||
}
|
||||
|
||||
int do_gotoline(long line, int save_pos)
|
||||
int do_gotoline(int line, int save_pos)
|
||||
{
|
||||
long i = 1;
|
||||
int i = 1;
|
||||
|
||||
if (line <= 0) { /* Ask for it */
|
||||
|
||||
long j = 0;
|
||||
int j = 0;
|
||||
|
||||
j = statusq(0, goto_list, GOTO_LIST_LEN, "", _("Enter line number"));
|
||||
if (j != 0) {
|
||||
@@ -793,3 +815,97 @@ int do_gotoline_void(void)
|
||||
{
|
||||
return do_gotoline(0, 0);
|
||||
}
|
||||
|
||||
#if (defined ENABLE_MULTIBUFFER || !defined DISABLE_SPELLER)
|
||||
void do_gotopos(int line, int pos_x, int pos_y, int pos_placewewant)
|
||||
{
|
||||
|
||||
/* since do_gotoline() resets the x-coordinate but not the
|
||||
y-coordinate, set the coordinates up this way */
|
||||
current_y = pos_y;
|
||||
do_gotoline(line, 1);
|
||||
|
||||
/* recalculate the x-coordinate and place we want, just in case their
|
||||
values are insane; if they aren't, they won't be changed by this */
|
||||
current_x = pos_x;
|
||||
pos_placewewant = xplustabs();
|
||||
pos_x = actual_x(current, pos_placewewant);
|
||||
|
||||
/* set the rest of the coordinates up */
|
||||
current_x = pos_x;
|
||||
placewewant = pos_placewewant;
|
||||
update_line(current, pos_x);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(NANO_SMALL) && defined(HAVE_REGEX_H)
|
||||
|
||||
int do_find_bracket(void)
|
||||
{
|
||||
char ch_under_cursor, wanted_ch;
|
||||
char *pos, *brackets = "([{<>}])";
|
||||
char regexp_pat[] = "[ ]";
|
||||
int offset, have_past_editbuff = 0, flagsave, current_x_save, count = 1;
|
||||
filestruct *current_save;
|
||||
|
||||
ch_under_cursor = current->data[current_x];
|
||||
|
||||
if ((!(pos = strchr(brackets, ch_under_cursor))) || (!((offset = pos - brackets) < 8))) {
|
||||
statusbar(_("Not a bracket"));
|
||||
return 1;
|
||||
}
|
||||
|
||||
blank_statusbar_refresh();
|
||||
|
||||
wanted_ch = *(brackets + ((strlen(brackets) - (offset + 1))));
|
||||
|
||||
current_x_save = current_x;
|
||||
current_save = current;
|
||||
flagsave = flags;
|
||||
SET(USE_REGEXP);
|
||||
|
||||
/* apparent near redundancy with regexp_pat[] here is needed, [][] works, [[]] doesn't */
|
||||
|
||||
if (offset < (strlen(brackets) / 2)) { /* on a left bracket */
|
||||
regexp_pat[1] = wanted_ch;
|
||||
regexp_pat[2] = ch_under_cursor;
|
||||
UNSET(REVERSE_SEARCH);
|
||||
} else { /* on a right bracket */
|
||||
regexp_pat[1] = ch_under_cursor;
|
||||
regexp_pat[2] = wanted_ch;
|
||||
SET(REVERSE_SEARCH);
|
||||
}
|
||||
|
||||
regexp_init(regexp_pat);
|
||||
|
||||
while (1) {
|
||||
search_last_line = 0;
|
||||
if (findnextstr(1, 1, current, current_x, regexp_pat)) {
|
||||
have_past_editbuff |= past_editbuff;
|
||||
if (current->data[current_x] == ch_under_cursor) /* found identical bracket */
|
||||
count++;
|
||||
else { /* found complementary bracket */
|
||||
if (!(--count)) {
|
||||
if (have_past_editbuff)
|
||||
edit_update(current, CENTER);
|
||||
else
|
||||
update_line(current, current_x);
|
||||
placewewant = xplustabs();
|
||||
reset_cursor();
|
||||
break ;
|
||||
}
|
||||
}
|
||||
} else { /* didn't find either left or right bracket */
|
||||
statusbar(_("No matching bracket"));
|
||||
current_x = current_x_save;
|
||||
current = current_save;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ISSET(REGEXP_COMPILED))
|
||||
regexp_cleanup();
|
||||
flags = flagsave;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
10
utils.c
10
utils.c
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 1999 Chris Allegretta *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 1, or (at your option) *
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
* any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
@@ -74,7 +74,6 @@ char *revstrcasestr(char *haystack, char *needle, char *rev_start)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif /* NANO_SMALL */
|
||||
|
||||
/* This is now mutt's version (called mutt_stristr) because it doesn't
|
||||
use memory allocation to do a simple search (yuck). */
|
||||
@@ -96,6 +95,7 @@ char *strcasestr(char *haystack, char *needle)
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#endif /* NANO_SMALL */
|
||||
|
||||
char *strstrwrapper(char *haystack, char *needle, char *rev_start)
|
||||
{
|
||||
@@ -130,22 +130,22 @@ char *strstrwrapper(char *haystack, char *needle, char *rev_start)
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
if (ISSET(CASE_SENSITIVE)) {
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(CASE_SENSITIVE)) {
|
||||
if (ISSET(REVERSE_SEARCH))
|
||||
return revstrstr(haystack, needle, rev_start);
|
||||
else
|
||||
#endif
|
||||
return strstr(haystack,needle);
|
||||
|
||||
} else {
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(REVERSE_SEARCH))
|
||||
return revstrcasestr(haystack, needle, rev_start);
|
||||
else
|
||||
#endif
|
||||
return strcasestr(haystack, needle);
|
||||
#ifndef NANO_SMALL
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Thanks BG, many ppl have been asking for this... */
|
||||
|
||||
308
winio.c
308
winio.c
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 1999 Chris Allegretta *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 1, or (at your option) *
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
* any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
@@ -229,6 +229,8 @@ void nanoget_repaint(char *buf, char *inputbuf, int x)
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_on(bottomwin, COLOR_STATUSBAR);
|
||||
#else
|
||||
wattron(bottomwin, A_REVERSE);
|
||||
#endif
|
||||
blank_statusbar();
|
||||
|
||||
@@ -251,12 +253,14 @@ void nanoget_repaint(char *buf, char *inputbuf, int x)
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_off(bottomwin, COLOR_STATUSBAR);
|
||||
#else
|
||||
wattroff(bottomwin, A_REVERSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* 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 start_x, int list)
|
||||
{
|
||||
int kbinput = 0, j = 0, x = 0, xend;
|
||||
int x_left = 0, inputlen, tabbed = 0;
|
||||
@@ -271,7 +275,7 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
||||
x_left = strlen(buf);
|
||||
x = strlen(def) + x_left;
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
#if !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE)
|
||||
currshortcut = s;
|
||||
currslen = slen;
|
||||
#endif
|
||||
@@ -293,6 +297,15 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
||||
|
||||
if (kbinput == s[j].val && kbinput < 32) {
|
||||
|
||||
#ifndef DISABLE_HELP
|
||||
/* Have to do this here, it would be too late to do it in statusq */
|
||||
if (kbinput == NANO_HELP_KEY
|
||||
|| kbinput == NANO_HELP_FKEY) {
|
||||
do_help();
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* We shouldn't discard the answer it gave, just because
|
||||
we hit a keystroke, GEEZ! */
|
||||
answer = mallocstrcpy(answer, inputbuf);
|
||||
@@ -330,12 +343,10 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
||||
case NANO_HOME_KEY:
|
||||
case KEY_HOME:
|
||||
x = x_left;
|
||||
nanoget_repaint(buf, inputbuf, x);
|
||||
break;
|
||||
case NANO_END_KEY:
|
||||
case KEY_END:
|
||||
x = x_left + strlen(inputbuf);
|
||||
nanoget_repaint(buf, inputbuf, x);
|
||||
break;
|
||||
case KEY_RIGHT:
|
||||
case NANO_FORWARD_KEY:
|
||||
@@ -351,16 +362,13 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
||||
strlen(inputbuf) - (x - x_left) - 1);
|
||||
inputbuf[strlen(inputbuf) - 1] = 0;
|
||||
}
|
||||
nanoget_repaint(buf, inputbuf, x);
|
||||
break;
|
||||
case NANO_CONTROL_K:
|
||||
case NANO_CONTROL_U:
|
||||
*inputbuf = 0;
|
||||
x = x_left;
|
||||
nanoget_repaint(buf, inputbuf, x);
|
||||
break;
|
||||
case KEY_BACKSPACE:
|
||||
case KEY_DC:
|
||||
case 127:
|
||||
case NANO_CONTROL_H:
|
||||
if (strlen(inputbuf) > 0) {
|
||||
@@ -375,18 +383,16 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
||||
}
|
||||
if (x > strlen(buf))
|
||||
x--;
|
||||
nanoget_repaint(buf, inputbuf, x);
|
||||
break;
|
||||
#ifndef DISABLE_TABCOMP
|
||||
case NANO_CONTROL_I:
|
||||
if (allowtabs) {
|
||||
shift = 0;
|
||||
inputbuf = input_tab(inputbuf, (x - x_left),
|
||||
&tabbed, &shift);
|
||||
&tabbed, &shift, &list);
|
||||
x += shift;
|
||||
if (x - x_left > strlen(inputbuf))
|
||||
x = strlen(inputbuf) + x_left;
|
||||
nanoget_repaint(buf, inputbuf, x);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
@@ -400,21 +406,22 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
||||
case KEY_DOWN:
|
||||
break;
|
||||
|
||||
case KEY_DC:
|
||||
goto do_deletekey;
|
||||
|
||||
case 27:
|
||||
switch (kbinput = wgetch(edit)) {
|
||||
case 79:
|
||||
case 'O':
|
||||
switch (kbinput = wgetch(edit)) {
|
||||
case 70:
|
||||
case 'F':
|
||||
x = x_left + strlen(inputbuf);
|
||||
nanoget_repaint(buf, inputbuf, x);
|
||||
break;
|
||||
case 72:
|
||||
case 'H':
|
||||
x = x_left;
|
||||
nanoget_repaint(buf, inputbuf, x);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 91:
|
||||
case '[':
|
||||
switch (kbinput = wgetch(edit)) {
|
||||
case 'C':
|
||||
if (x < xend)
|
||||
@@ -426,11 +433,12 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
||||
x--;
|
||||
wmove(bottomwin, 0, x);
|
||||
break;
|
||||
case 49:
|
||||
case '1':
|
||||
case '7':
|
||||
x = x_left;
|
||||
nanoget_repaint(buf, inputbuf, x);
|
||||
goto skip_126;
|
||||
case 51:
|
||||
goto skip_tilde;
|
||||
case '3':
|
||||
do_deletekey:
|
||||
if (strlen(inputbuf) > 0
|
||||
&& (x - x_left) != strlen(inputbuf)) {
|
||||
memmove(inputbuf + (x - x_left),
|
||||
@@ -438,16 +446,15 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
||||
strlen(inputbuf) - (x - x_left) - 1);
|
||||
inputbuf[strlen(inputbuf) - 1] = 0;
|
||||
}
|
||||
nanoget_repaint(buf, inputbuf, x);
|
||||
goto skip_126;
|
||||
case 52:
|
||||
goto skip_tilde;
|
||||
case '4':
|
||||
case '8':
|
||||
x = x_left + strlen(inputbuf);
|
||||
nanoget_repaint(buf, inputbuf, x);
|
||||
goto skip_126;
|
||||
skip_126:
|
||||
goto skip_tilde;
|
||||
skip_tilde:
|
||||
nodelay(edit, TRUE);
|
||||
kbinput = wgetch(edit);
|
||||
if (kbinput == 126 || kbinput == ERR)
|
||||
if (kbinput == '~' || kbinput == ERR)
|
||||
kbinput = -1;
|
||||
nodelay(edit, FALSE);
|
||||
break;
|
||||
@@ -470,7 +477,6 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
||||
}
|
||||
|
||||
}
|
||||
nanoget_repaint(buf, inputbuf, x);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -488,21 +494,19 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
||||
|
||||
x++;
|
||||
|
||||
nanoget_repaint(buf, inputbuf, x);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("input \'%c\' (%d)\n"), kbinput, kbinput);
|
||||
#endif
|
||||
}
|
||||
nanoget_repaint(buf, inputbuf, x);
|
||||
wrefresh(bottomwin);
|
||||
}
|
||||
|
||||
answer = mallocstrcpy(answer, inputbuf);
|
||||
free(inputbuf);
|
||||
|
||||
/* 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)))
|
||||
/* In pico mode, just check for a blank answer here */
|
||||
if (((ISSET(PICO_MODE)) && !strcmp(answer, "")))
|
||||
return -2;
|
||||
else
|
||||
return 0;
|
||||
@@ -602,7 +606,11 @@ void bottombars(shortcut s[], int slen)
|
||||
#endif
|
||||
|
||||
/* Determine how many extra spaces are needed to fill the bottom of the screen */
|
||||
k = COLS / 6 - 13;
|
||||
if (slen < 2)
|
||||
k = COLS / 6 - 13;
|
||||
else
|
||||
k = COLS / ((slen + (slen %2)) / 2) - 13;
|
||||
|
||||
|
||||
clear_bottomwin();
|
||||
wmove(bottomwin, 1, 0);
|
||||
@@ -733,9 +741,6 @@ void add_marked_sameline(int begin, int end, filestruct * fileptr, int y,
|
||||
sel_data_len = end - begin;
|
||||
post_data_len = this_page_end - end;
|
||||
|
||||
/* Paint this line! */
|
||||
mvwaddnstr(edit, y, 0, &fileptr->data[this_page_start], pre_data_len);
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_on(edit, COLOR_MARKER);
|
||||
#else
|
||||
@@ -751,8 +756,6 @@ void add_marked_sameline(int begin, int end, filestruct * fileptr, int y,
|
||||
wattroff(edit, A_REVERSE);
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
mvwaddnstr(edit, y, end - this_page_start,
|
||||
&fileptr->data[end], post_data_len);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -764,11 +767,69 @@ void add_marked_sameline(int begin, int end, filestruct * fileptr, int y,
|
||||
void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
|
||||
int virt_mark_beginx, int this_page)
|
||||
{
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
colortype *tmpcolor = NULL;
|
||||
colorstr *tmpstr = NULL;
|
||||
int k, paintlen;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Just paint the string in any case (we'll add color or reverse on
|
||||
just the text that needs it */
|
||||
mvwaddnstr(edit, yval, 0, &fileptr->data[start],
|
||||
get_page_end_virtual(this_page) - start + 1);
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
if (colorstrings != NULL)
|
||||
for (tmpcolor = colorstrings; tmpcolor != NULL; tmpcolor = tmpcolor->next) {
|
||||
for (tmpstr = tmpcolor->str; tmpstr != NULL; tmpstr = tmpstr->next) {
|
||||
|
||||
k = start;
|
||||
regcomp(&search_regexp, tmpstr->val, 0);
|
||||
while (!regexec(&search_regexp, &fileptr->data[k], 1,
|
||||
regmatches, 0)) {
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Match! (%d chars) \"%s\"\n",
|
||||
regmatches[0].rm_eo - regmatches[0].rm_so,
|
||||
&fileptr->data[k + regmatches[0].rm_so]);
|
||||
#endif
|
||||
if (regmatches[0].rm_so < COLS - 1) {
|
||||
if (tmpcolor->bright)
|
||||
wattron(edit, A_BOLD);
|
||||
wattron(edit, COLOR_PAIR(tmpcolor->pairnum));
|
||||
|
||||
if (regmatches[0].rm_eo - regmatches[0].rm_so
|
||||
+ k <= COLS)
|
||||
paintlen = regmatches[0].rm_eo - regmatches[0].rm_so;
|
||||
else
|
||||
paintlen = COLS - (regmatches[0].rm_eo
|
||||
- regmatches[0].rm_so);
|
||||
|
||||
mvwaddnstr(edit, yval, regmatches[0].rm_so + k,
|
||||
&fileptr->data[k + regmatches[0].rm_so],
|
||||
paintlen);
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (tmpcolor->bright)
|
||||
wattroff(edit, A_BOLD);
|
||||
wattroff(edit, COLOR_PAIR(tmpcolor->pairnum));
|
||||
|
||||
k += regmatches[0].rm_eo;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* ENABLE_COLOR */
|
||||
#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)
|
||||
&& !((fileptr->lineno > mark_beginbuf->lineno
|
||||
if (ISSET(MARK_ISSET) &&
|
||||
!((fileptr->lineno > mark_beginbuf->lineno
|
||||
&& fileptr->lineno > current->lineno)
|
||||
|| (fileptr->lineno < mark_beginbuf->lineno
|
||||
&& fileptr->lineno < current->lineno))) {
|
||||
@@ -823,23 +884,11 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
|
||||
#else
|
||||
wattron(edit, A_REVERSE);
|
||||
#endif /* ENABLE_COLOR */
|
||||
}
|
||||
|
||||
target =
|
||||
(virt_mark_beginx <
|
||||
COLS - 1) ? virt_mark_beginx : COLS - 1;
|
||||
target =
|
||||
(virt_mark_beginx < COLS - 1) ? virt_mark_beginx : COLS - 1;
|
||||
|
||||
mvwaddnstr(edit, yval, 0, fileptr->data, target);
|
||||
|
||||
if (mark_beginbuf->lineno < current->lineno) {
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_on(edit, COLOR_MARKER);
|
||||
#else
|
||||
wattron(edit, A_REVERSE);
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
} else {
|
||||
mvwaddnstr(edit, yval, 0, fileptr->data, target);
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_off(edit, COLOR_MARKER);
|
||||
@@ -847,16 +896,23 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
|
||||
wattroff(edit, A_REVERSE);
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
|
||||
}
|
||||
|
||||
target = (COLS - 1) - virt_mark_beginx;
|
||||
if (target < 0)
|
||||
target = 0;
|
||||
|
||||
mvwaddnstr(edit, yval, virt_mark_beginx,
|
||||
&fileptr->data[virt_mark_beginx], target);
|
||||
|
||||
if (mark_beginbuf->lineno < current->lineno) {
|
||||
#ifdef ENABLE_COLOR
|
||||
color_on(edit, COLOR_MARKER);
|
||||
#else
|
||||
wattron(edit, A_REVERSE);
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
target = (COLS - 1) - virt_mark_beginx;
|
||||
|
||||
if (target < 0)
|
||||
target = 0;
|
||||
|
||||
mvwaddnstr(edit, yval, virt_mark_beginx,
|
||||
&fileptr->data[virt_mark_beginx], target);
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_off(edit, COLOR_MARKER);
|
||||
@@ -880,14 +936,19 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
|
||||
wattron(edit, A_REVERSE);
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
}
|
||||
|
||||
if (virt_cur_x > COLS - 2) {
|
||||
mvwaddnstr(edit, yval, 0,
|
||||
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);
|
||||
} else
|
||||
mvwaddnstr(edit, yval, 0, fileptr->data, virt_cur_x);
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_off(edit, COLOR_MARKER);
|
||||
#else
|
||||
wattroff(edit, A_REVERSE);
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
}
|
||||
|
||||
if (mark_beginbuf->lineno > current->lineno) {
|
||||
@@ -898,26 +959,14 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
|
||||
wattron(edit, A_REVERSE);
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
} else {
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_off(edit, COLOR_MARKER);
|
||||
#else
|
||||
wattroff(edit, A_REVERSE);
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
}
|
||||
|
||||
if (virt_cur_x > COLS - 2)
|
||||
mvwaddnstr(edit, yval, virt_cur_x - this_page_start,
|
||||
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,
|
||||
else
|
||||
mvwaddnstr(edit, yval, virt_cur_x,
|
||||
&fileptr->data[virt_cur_x], COLS - virt_cur_x);
|
||||
|
||||
if (mark_beginbuf->lineno > current->lineno) {
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_off(edit, COLOR_MARKER);
|
||||
#else
|
||||
@@ -926,12 +975,9 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} else
|
||||
}
|
||||
#endif
|
||||
/* Just paint the string (no mark on this line) */
|
||||
mvwaddnstr(edit, yval, 0, &fileptr->data[start],
|
||||
get_page_end_virtual(this_page) - start + 1);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -981,7 +1027,7 @@ 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) {
|
||||
} else if (realdata[i] < 32) {
|
||||
/* Treat control characters as ^letter */
|
||||
fileptr->data[pos++] = '^';
|
||||
fileptr->data[pos++] = realdata[i] + 64;
|
||||
@@ -1063,6 +1109,10 @@ void edit_refresh(void)
|
||||
editbot = hold;
|
||||
else
|
||||
editbot = temp;
|
||||
|
||||
/* What the hell are we expecting to update the screen if this isn't
|
||||
here? luck?? */
|
||||
wrefresh(edit);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1142,6 +1192,10 @@ int statusq(int tabs, shortcut s[], int slen, char *def, char *msg, ...)
|
||||
char foo[133];
|
||||
int ret;
|
||||
|
||||
#ifndef DISABLE_TABCOMP
|
||||
int list;
|
||||
#endif
|
||||
|
||||
bottombars(s, slen);
|
||||
|
||||
va_start(ap, msg);
|
||||
@@ -1156,7 +1210,13 @@ int statusq(int tabs, shortcut s[], int slen, char *def, char *msg, ...)
|
||||
#endif
|
||||
|
||||
|
||||
ret = nanogetstr(tabs, foo, def, s, slen, (strlen(foo) + 3));
|
||||
#ifndef DISABLE_TABCOMP
|
||||
ret = nanogetstr(tabs, foo, def, s, slen, (strlen(foo) + 3), list);
|
||||
#else
|
||||
/* if we've disabled tab completion, the value of list won't be
|
||||
used at all, so it's safe to use 0 (NULL) as a placeholder */
|
||||
ret = nanogetstr(tabs, foo, def, s, slen, (strlen(foo) + 3), 0);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_off(bottomwin, COLOR_STATUSBAR);
|
||||
@@ -1174,6 +1234,13 @@ int statusq(int tabs, shortcut s[], int slen, char *def, char *msg, ...)
|
||||
do_last_line();
|
||||
break;
|
||||
case NANO_CANCEL_KEY:
|
||||
#ifndef DISABLE_TABCOMP
|
||||
/* if we've done tab completion, there might be a list of
|
||||
filename matches on the edit window at this point; make sure
|
||||
they're cleared off */
|
||||
if (list)
|
||||
edit_refresh();
|
||||
#endif
|
||||
return -1;
|
||||
default:
|
||||
blank_statusbar();
|
||||
@@ -1409,11 +1476,12 @@ void previous_line(void)
|
||||
current_y--;
|
||||
}
|
||||
|
||||
int do_cursorpos(void)
|
||||
int do_cursorpos(int constant)
|
||||
{
|
||||
filestruct *fileptr;
|
||||
float linepct = 0.0, bytepct = 0.0;
|
||||
int i = 0;
|
||||
long i = 0;
|
||||
static long old_i = -1, old_totsize = -1;
|
||||
|
||||
if (current == NULL || fileage == NULL)
|
||||
return 0;
|
||||
@@ -1427,6 +1495,12 @@ int do_cursorpos(void)
|
||||
|
||||
i += current_x;
|
||||
|
||||
if (old_i == -1)
|
||||
old_i = i;
|
||||
|
||||
if (old_totsize == -1)
|
||||
old_totsize = totsize;
|
||||
|
||||
if (totlines > 0)
|
||||
linepct = 100 * current->lineno / totlines;
|
||||
|
||||
@@ -1438,29 +1512,50 @@ int do_cursorpos(void)
|
||||
linepct, bytepct);
|
||||
#endif
|
||||
|
||||
statusbar(_("line %d of %d (%.0f%%), character %d of %d (%.0f%%)"),
|
||||
current->lineno, totlines, linepct, i, totsize, bytepct);
|
||||
/* if constant is zero, display the position on the statusbar
|
||||
unconditionally; otherwise, only display the position when the
|
||||
character values have changed */
|
||||
if (!constant || (old_i != i || old_totsize != totsize)) {
|
||||
statusbar(_("line %d of %d (%.0f%%), character %ld of %ld (%.0f%%)"),
|
||||
current->lineno, totlines, linepct, i, totsize, bytepct);
|
||||
}
|
||||
|
||||
old_i = i;
|
||||
old_totsize = totsize;
|
||||
|
||||
reset_cursor();
|
||||
return 1;
|
||||
}
|
||||
|
||||
int do_cursorpos_void(void)
|
||||
{
|
||||
return do_cursorpos(0);
|
||||
}
|
||||
|
||||
/* Our broken, non-shortcut list compliant help function.
|
||||
But, hey, it's better than nothing, and it's dynamic! */
|
||||
int do_help(void)
|
||||
{
|
||||
#ifndef DISABLE_HELP
|
||||
char *ptr = help_text, *end;
|
||||
char *ptr, *end;
|
||||
int i, j, row = 0, page = 1, kbinput = 0, no_more = 0, kp, kp2;
|
||||
int no_help_flag = 0;
|
||||
shortcut *oldshortcut;
|
||||
int oldslen;
|
||||
|
||||
blank_edit();
|
||||
curs_set(0);
|
||||
wattroff(bottomwin, A_REVERSE);
|
||||
blank_statusbar();
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
help_init();
|
||||
ptr = help_text;
|
||||
|
||||
oldshortcut = currshortcut;
|
||||
oldslen = currslen;
|
||||
|
||||
currshortcut = help_list;
|
||||
currslen = HELP_LIST_LEN;
|
||||
#endif
|
||||
|
||||
kp = keypad_on(edit, 1);
|
||||
kp2 = keypad_on(bottomwin, 1);
|
||||
@@ -1555,13 +1650,17 @@ int do_help(void)
|
||||
} while ((kbinput = wgetch(edit)) != NANO_EXIT_KEY &&
|
||||
kbinput != NANO_EXIT_FKEY);
|
||||
|
||||
currshortcut = oldshortcut;
|
||||
currslen = oldslen;
|
||||
|
||||
if (no_help_flag) {
|
||||
blank_bottombars();
|
||||
wrefresh(bottomwin);
|
||||
SET(NO_HELP);
|
||||
window_init();
|
||||
}
|
||||
display_main_list();
|
||||
else
|
||||
bottombars(currshortcut, currslen);
|
||||
|
||||
curs_set(1);
|
||||
edit_refresh();
|
||||
@@ -1590,7 +1689,7 @@ void dump_buffer(filestruct * inptr)
|
||||
|
||||
fileptr = inptr;
|
||||
while (fileptr != NULL) {
|
||||
fprintf(stderr, "(%ld) %s\n", fileptr->lineno, fileptr->data);
|
||||
fprintf(stderr, "(%d) %s\n", fileptr->lineno, fileptr->data);
|
||||
fflush(stderr);
|
||||
fileptr = fileptr->next;
|
||||
}
|
||||
@@ -1604,7 +1703,7 @@ void dump_buffer_reverse(filestruct * inptr)
|
||||
|
||||
fileptr = filebot;
|
||||
while (fileptr != NULL) {
|
||||
fprintf(stderr, "(%ld) %s\n", fileptr->lineno, fileptr->data);
|
||||
fprintf(stderr, "(%d) %s\n", fileptr->lineno, fileptr->data);
|
||||
fflush(stderr);
|
||||
fileptr = fileptr->prev;
|
||||
}
|
||||
@@ -1655,7 +1754,7 @@ void do_replace_highlight(int highlight_flag, char *word)
|
||||
}
|
||||
|
||||
#ifdef NANO_EXTRA
|
||||
#define CREDIT_LEN 47
|
||||
#define CREDIT_LEN 48
|
||||
void do_credits(void)
|
||||
{
|
||||
int i, j = 0, k, place = 0, start_x;
|
||||
@@ -1694,6 +1793,7 @@ void do_credits(void)
|
||||
"Joshua Jensen",
|
||||
"Ryan Krebs",
|
||||
"Albert Chin",
|
||||
"David Lawrence Ramsey",
|
||||
"",
|
||||
specialthx,
|
||||
"Plattsburgh State University",
|
||||
|
||||
Reference in New Issue
Block a user