Compare commits
171 Commits
v0.9.99pre
...
v1.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a74860957 | ||
|
|
355fbe5770 | ||
|
|
a212acf100 | ||
|
|
9cf9e06003 | ||
|
|
802c6ef076 | ||
|
|
819e3db74d | ||
|
|
2d7893d086 | ||
|
|
240998b25f | ||
|
|
df7d8b2e57 | ||
|
|
b26ecb597e | ||
|
|
052f9d238e | ||
|
|
049149f1da | ||
|
|
a2c02e9c8d | ||
|
|
df20e83412 | ||
|
|
33db9bf473 | ||
|
|
1a8b296adf | ||
|
|
ac899e5f80 | ||
|
|
d173c15ce5 | ||
|
|
521e00d761 | ||
|
|
7fde37f006 | ||
|
|
34319a1ff7 | ||
|
|
efd2236319 | ||
|
|
500b5e3539 | ||
|
|
40f45c8689 | ||
|
|
68b3dfb431 | ||
|
|
658399aeb9 | ||
|
|
e4933a393a | ||
|
|
a75bc41faf | ||
|
|
1cde322359 | ||
|
|
cf785632ed | ||
|
|
3ba29535a3 | ||
|
|
0241d19e4c | ||
|
|
ecc3d7f39e | ||
|
|
d21195f882 | ||
|
|
34654ab41a | ||
|
|
de3d800e67 | ||
|
|
c4e1a131d3 | ||
|
|
cc197ef0ea | ||
|
|
43fee64400 | ||
|
|
b4d6ad0ef6 | ||
|
|
d46156258b | ||
|
|
6fe61499e8 | ||
|
|
9a46f3cf56 | ||
|
|
1e43a12b49 | ||
|
|
dd0491380a | ||
|
|
53ea9d162b | ||
|
|
3b41212d61 | ||
|
|
8d848afb89 | ||
|
|
88b091510b | ||
|
|
9fe015cca3 | ||
|
|
63ba2d63ff | ||
|
|
92b3bd2de6 | ||
|
|
611e98be29 | ||
|
|
5c27385a16 | ||
|
|
99afb85752 | ||
|
|
64bacd20b5 | ||
|
|
3bf6bf45b7 | ||
|
|
4cb991dda1 | ||
|
|
b10283c4e8 | ||
|
|
f3fde7c2fc | ||
|
|
5f07180e8a | ||
|
|
051fc6e05a | ||
|
|
88520c93be | ||
|
|
a9434800df | ||
|
|
4e18b8f9ce | ||
|
|
725490495c | ||
|
|
09898d99d4 | ||
|
|
0bafa91096 | ||
|
|
b0bce4b429 | ||
|
|
8ce2413feb | ||
|
|
465f1e305d | ||
|
|
3f8db49622 | ||
|
|
4be36bf1d4 | ||
|
|
9634571dd6 | ||
|
|
6cb4e885f2 | ||
|
|
6efda54a6c | ||
|
|
316e4d9a67 | ||
|
|
18d70f1478 | ||
|
|
5050aa6ae7 | ||
|
|
4dfaf93bcd | ||
|
|
7a50009b1f | ||
|
|
03bf98015d | ||
|
|
bf521fabaa | ||
|
|
2fe0ddeab4 | ||
|
|
1f0ab55e6d | ||
|
|
528310223b | ||
|
|
cbee08f335 | ||
|
|
cc0da8ab53 | ||
|
|
819d46ac71 | ||
|
|
b881d3ea57 | ||
|
|
8d8e01224b | ||
|
|
12f294c651 | ||
|
|
ea066c8413 | ||
|
|
84de552b28 | ||
|
|
235ab192af | ||
|
|
6b58acd377 | ||
|
|
ac840eb42b | ||
|
|
6e2853705a | ||
|
|
9afd119dd5 | ||
|
|
38068cd152 | ||
|
|
60c65424c3 | ||
|
|
90d307413b | ||
|
|
b2c4cbebab | ||
|
|
cef7fbb41a | ||
|
|
a0238ed022 | ||
|
|
1c9d7f9f5d | ||
|
|
1bacd2f8c7 | ||
|
|
0876dc9860 | ||
|
|
49805175e3 | ||
|
|
4bf831ff39 | ||
|
|
3948bae1e1 | ||
|
|
2071207e84 | ||
|
|
2bfbda0fd7 | ||
|
|
7ab3e8fed7 | ||
|
|
0a24b595a6 | ||
|
|
35dac58a61 | ||
|
|
10ae4f11e0 | ||
|
|
55493c2052 | ||
|
|
4aa302fe4a | ||
|
|
e31677362b | ||
|
|
a0323de1f7 | ||
|
|
0d471de448 | ||
|
|
e76f06ba1c | ||
|
|
565f7d5558 | ||
|
|
2af3904099 | ||
|
|
0b33d8864a | ||
|
|
74bb31b15a | ||
|
|
94a78b8fb3 | ||
|
|
1e9183fe31 | ||
|
|
46055b2543 | ||
|
|
53712748ec | ||
|
|
67b14b1467 | ||
|
|
203ce15247 | ||
|
|
5b387d7527 | ||
|
|
9c9c5dab4c | ||
|
|
a4a222d1d7 | ||
|
|
a18d7978e2 | ||
|
|
a7b2ed0cac | ||
|
|
78aac9113d | ||
|
|
f4a986465a | ||
|
|
a57fcb044c | ||
|
|
ea620fe88b | ||
|
|
0d9109acf6 | ||
|
|
2d6f1bc896 | ||
|
|
6aec0d6363 | ||
|
|
82b182986b | ||
|
|
8119765cbd | ||
|
|
618f5d788c | ||
|
|
4ce8e3b863 | ||
|
|
35ac99d0d4 | ||
|
|
c46dd8123c | ||
|
|
9560bb51ab | ||
|
|
882e145ebb | ||
|
|
fb9cffe268 | ||
|
|
8546fa016e | ||
|
|
7e7bcf8a46 | ||
|
|
4de7b95511 | ||
|
|
1bf501c236 | ||
|
|
af6414ac37 | ||
|
|
4ed131510e | ||
|
|
8bc03b6fdc | ||
|
|
b55999ebcb | ||
|
|
3362cae2f6 | ||
|
|
af7fc3dbc1 | ||
|
|
00ae5dfa27 | ||
|
|
d096f68966 | ||
|
|
09f39cbec6 | ||
|
|
a8785e0793 | ||
|
|
37388ee91e | ||
|
|
de48b41b61 | ||
|
|
7c1fee7868 |
82
BUGS
82
BUGS
@@ -6,20 +6,20 @@
|
||||
- edit_refresh() and update_line() do not handle selecting text when the
|
||||
cursor is beyond COLS (10) [FIXED]
|
||||
- no way to do a replace with the empty string (11) [FIXED, yay!]
|
||||
- Spelling support is not elegant like pico's integration of the 'spell'
|
||||
- Spelling support is not elegant like Pico's integration of the 'spell'
|
||||
program. Nano only uses ispell (for now) (12) [FIXED]
|
||||
- Moving to the end of a line when close to a multiple of COLS and at
|
||||
least COLS * 2 does not make the screen jump early like it would for
|
||||
if we were around COLS (bugs in edit_refresh, update_line) (13)
|
||||
[FIXED, mostly]
|
||||
- When at the very bottom of the edit window, do_wrap goes berzerk and
|
||||
puts the curor somewhere bad, subsequent keystrokes crash the program
|
||||
- When at the very bottom of the edit window, do_wrap goes berserk and
|
||||
puts the cursor somewhere bad; subsequent keystrokes crash the program
|
||||
(14) [FIXED, mostly]
|
||||
- Doing a replacement of a substring of the replace string (e.g. replacing
|
||||
"ed" with "fred" causes an infinite loop. (15) [FIXED]
|
||||
"ed" with "fred" causes an infinite loop). (15) [FIXED]
|
||||
- Cutting a file with marked text and both marker ends on the same line
|
||||
causes a random segfault (16) [FIXED]
|
||||
- Cutting more than one line resets the KEEP_CUTBUFFER flag in 0.9.3
|
||||
- Cutting more than one line resets the KEEP_CUTBUFFER flag in 0.9.3.
|
||||
Error is in bitwise assignment (nano.h). (17) [FIXED]
|
||||
- The wrapping code does not work right for lines like the following:
|
||||
* *
|
||||
@@ -27,9 +27,10 @@
|
||||
- Nano fails to follow symlinks, even though -l isn't being used (20).
|
||||
[Bug in global flag init, FIXED]
|
||||
- When using --help or --version, the SIGINT character gets lost. (21) [FIXED]
|
||||
- edit_refresh() and update_line() (and related functions), have
|
||||
trouble when a tab is the character that is the boundry at COLS (23) [FIXED]
|
||||
- there is an off-by-one error in keeping track of totsize. It is caused
|
||||
- edit_refresh() and update_line() (and related functions) have
|
||||
trouble when a tab is the character that is the boundary at COLS (23)
|
||||
[FIXED]
|
||||
- There is an off-by-one error in keeping track of totsize. It is caused
|
||||
by the fact that we count the newline at the end when we read in a file
|
||||
but we do not, in fact, display this newline. This should go away
|
||||
implicitly when the "Magic Line" returns, but it is noted here for
|
||||
@@ -41,50 +42,52 @@
|
||||
a dialog about not being able to write the file, and it will not let the
|
||||
user exit (29, discovered by Joshua Jensen) [FIXED]
|
||||
- Using nano -k, marked text is not cut properly. (31) [FIXED]
|
||||
- Invoking -t or -k has the effect of invoking both option. (32) [FIXED]
|
||||
- Invoking -t or -k has the effect of invoking both options. (32) [FIXED]
|
||||
- totsize becomes incorrect after word-wrapping (25) [FIXED]
|
||||
- Wrapping a line with autoindent mode sometimes causes a segfault (19)[FIXED]
|
||||
- Wrapping a line with autoindent mode sometimes causes a segfault (19)
|
||||
[FIXED]
|
||||
- When inserting files, the display sometimes fails to display properly
|
||||
until a pageup/down occurs (22)[FIXED]
|
||||
- In search/replace code there is too much refreshing in bottomwin (26)
|
||||
[FIXED]
|
||||
until a pageup/down occurs (22) [FIXED]
|
||||
- In search/replace code, there is too much refreshing in bottomwin (26)
|
||||
[FIXED]
|
||||
- In replace, there is no way to accept the default replace string. (27)
|
||||
[FIXED]
|
||||
[FIXED]
|
||||
- Using nano -t, user can not exit until a filename is given via ^O. (30)
|
||||
[FIXED]
|
||||
[FIXED]
|
||||
- totsize problems still abound in do_justify (33) [FIXED]
|
||||
- Using -k cut text is not pasted properly. (34) [FIXED].
|
||||
- Using -k pasted text is not updated properly if it goes beyond editbot. (35)
|
||||
[FIXED]
|
||||
- Doing a cut with -k can screw up the filestruct, fault is in cutting
|
||||
- Using -k, cut text is not pasted properly. (34) [FIXED].
|
||||
- Using -k, pasted text is not updated properly if it goes beyond editbot. (35)
|
||||
[FIXED]
|
||||
- Doing a cut with -k can screw up the filestruct; fault is in cutting
|
||||
code. (36) [FIXED]
|
||||
- Hitting enter on the magic line makes new lines, but they are not
|
||||
written out to disk when saved..... (37). [FIXED]
|
||||
- Page up and page down do not work the same way as Pico (# of lines). (38)
|
||||
[FIXED]
|
||||
- Page up and page down do not work the same way as in Pico (# of lines). (38)
|
||||
[FIXED]
|
||||
- When doing a search and the marker is set, the screen does not always
|
||||
properly update the inverted text (39). [FIXED]
|
||||
- Searches for a string that only exist on one line multiple times will
|
||||
fail after finding the last occurance (discovered by Ken Tyler) (40). [FIXED]
|
||||
- Alt-Z is current broken to toggle suspend. I guess I still don't know
|
||||
- Searches for a string that only exists on one line multiple times will
|
||||
fail after finding the last occurrence (discovered by Ken Tyler) (40).
|
||||
[FIXED]
|
||||
- Alt-Z is currently broken to toggle suspend. I guess I still don't know
|
||||
signals very well =-) (41) [FIXED].
|
||||
- Unable to cut the entire file using the marker (discovered by Kev Tyler)
|
||||
(42). [FIXED]
|
||||
- The keypad does not work when nano runs in the Gnome terminal (43). [FIXED]
|
||||
- When reading in a file, if the file is a directory the contents of the
|
||||
- When reading in a file, if the file is a directory, the contents of the
|
||||
file being edited are blown away (discovered by Chris Pimlot) (44). [FIXED]
|
||||
- in certain terms, nano will leave a "ghost" of screen upon exit
|
||||
when called from inside mutt (among other settings) (45). [FIXED]
|
||||
- In replace, hitting the Goto line shortcut key does nothing after a
|
||||
search string is entered (discovered by Rocco Corsi) (46) [FIXED].
|
||||
- When typing in a string in serahc or replace and hitting CASE_SENSITVE
|
||||
- When typing in a string in search or replace and hitting CASE_SENSITIVE
|
||||
or the other search string, the current string edit is blown away in
|
||||
favor of the last stored search (47) [FIXED]
|
||||
- If nano fails to open a file when it starts up,doing almost anything
|
||||
- If nano fails to open a file when it starts up, doing almost anything
|
||||
causes a segfault (discovered by Ben Roberts) (48). [FIXED]
|
||||
- In certain terminals, nano would not work properly with keypad().
|
||||
Turned out to be the silly timeout(0) call which is completely
|
||||
unneeded anyway. (49) [FIXED]
|
||||
Turned out to be the silly timeout(0) call, which is completely
|
||||
unneeded, anyway. (49) [FIXED]
|
||||
- With less than a page of text, doing a page down will move the
|
||||
current line to the top of the screen, which it shouldn't do. (50)
|
||||
[FIXED]
|
||||
@@ -94,6 +97,27 @@
|
||||
browser..) (52) [FIXED]
|
||||
- Alt speller argument (-s, --speller) does not take a string argument of
|
||||
more than one word. (53) [FIXED].
|
||||
- Cut to end cutting (-k) causes segfaults (try cutting "- Backup making
|
||||
(filename~)?" line in TODO file) (discovered by
|
||||
higuita@cadernoverde.com) (54) [FIXED].
|
||||
- When using autoindent (-i), wrapped text does not get autoindented
|
||||
(55, discovered by Mark Senior) [FIXED].
|
||||
- When using -R (regex) and -p (pico mode), subsequent searches after
|
||||
the first fail if no string is entered (56) [FIXED].
|
||||
- Page down on a file of editwinrows fails (again). Reported by Ryan
|
||||
Krebs (57) [FIXED].
|
||||
- File browser aborts on Solaris in qsort() call. (Reported by
|
||||
Matthias Andree) (58) [FIXED].
|
||||
- Can modify the current file in view mode with ^W^R (discovered by Rocco
|
||||
Corsi) (58) [FIXED].
|
||||
- When page up is used after two page down's, the screen doesn't update
|
||||
properly (discovered by David Lawrence Ramsey) (59) [FIXED].
|
||||
- On BSD systems, marked cutting sna paste often screws up the
|
||||
last line in the cutbuffer (discovered by Barry Pederson) (60) [FIXED]
|
||||
- Blank lines are not kept when cutting with -k (discovered by Rocco)
|
||||
(61) [FIXED].
|
||||
- Nano will not suspend properly inside of mutt (62) [FIXED].
|
||||
|
||||
|
||||
** Open BUGS **
|
||||
|
||||
|
||||
483
ChangeLog
483
ChangeLog
@@ -1,3 +1,302 @@
|
||||
nano-1.1.0 - 07/15/2001
|
||||
- General
|
||||
- New global variables currshortcut and currslen to support using
|
||||
the mouse with the shortcuts. Also supports clicking on files
|
||||
in browser. Added #ifdef DISABLE_MOUSE around this code also.
|
||||
- Changed mouse disabling code from depending on --enable-tiny
|
||||
to its own flag, --disable-mouse. The --tiny option defines
|
||||
this automatically, but now just mouse support can be disabled
|
||||
if desired.
|
||||
- File Browser supports the "Goto Directory"
|
||||
- Added rcfile.c source file. Only includes much of anything when
|
||||
--enable-nanorc is used. Tons of new funcs, most notably
|
||||
do_rcfile() called from nano.c:main(). Added much needed
|
||||
function ncalloc(), will have to go through source code later
|
||||
and change the aproproate calls which used nmalloc for lack of
|
||||
an apropriate calloc function *** FIXME ***
|
||||
- After "Alternate" spell checker is called, cursor is repositioned on
|
||||
the same line as before ^T was pressed.
|
||||
- Moved config.h up in all .c files #include list (Albert Chin).
|
||||
- Added config.guess and config.sub to distribution because,
|
||||
apparently, newer autoconf/automakes can't live without them.
|
||||
- Various spelling updates by David Lawrence Ramsey.
|
||||
- Changed all string allocations to charalloc(), new function
|
||||
designed to take nmalloc argument but call calloc based on
|
||||
(char *) size.
|
||||
- New macro DISABLE_WRAPJUSTIFY to easily check for both wrapping
|
||||
and justify being disabled. This allows us to compile out the
|
||||
-r flag if neither are set, and will also allow us to comment
|
||||
out -W when it is written.
|
||||
- Allow fill to take a negative value ot signify a "from right side"
|
||||
value. This allows the value to vary with the screen size yet
|
||||
still be correct. New static value wrap_at to minimize code
|
||||
inpact. Updated man page and info file.
|
||||
- Allow file appending. New shortcut list nano_insertfile_list (since
|
||||
insert and write routines can't share shortcut lists anymore),
|
||||
new args to do_writeout and write_file called append, and of source
|
||||
code changes to those functions.
|
||||
- Allow backwards searching. Drastic rewrite of the search prompt
|
||||
string by Chris. All other code by Ken Tyler. New globals
|
||||
nano_reverse_msg, new functions revstrstr and revstrcasestr,
|
||||
many changes to search functions. Not too big a code size
|
||||
increase!
|
||||
- Moved extension functions (Case Sensitive, Regexp, and Backwards
|
||||
Search, Append key in write file function) to Meta keys, as
|
||||
people are complaining loudly about nano not being control-key
|
||||
compatible with Pico, which is a Bag Thing (TM). Changes to
|
||||
shortcut_init, toggle_init, new toggles for backwards and regexp
|
||||
(and you can now toggle all search options including regexp at
|
||||
the Search: prompt!) Changes to nanogetstr to enable Meta
|
||||
keys to be grabbed, changes to onekey to print M-style shortcuts.
|
||||
- New macro TOGGLE which just toggles, no more silly checking
|
||||
ISSET and then using SET or UNSET when we want a simple toggle
|
||||
for a flag.
|
||||
- Added multiple buffer capability (God help us). New configure
|
||||
option --enable-multibuffer (-F), changes to do_insertfile(),
|
||||
do_insertfile_void(), toggle_init(), do_gotoline(), edit_update(),
|
||||
and write_file(), new functions add_open_file(),
|
||||
open_file_change_name(), load_open_file(), open_file_dup_search(),
|
||||
open_file_dup_fix(), open_prevfile(), open_nextfile(),
|
||||
close_open_file(), get_full_path(), die_save_file(), etc.
|
||||
(David Lawrence Ramsey).
|
||||
- Using --enable-extra automatically defines --enable-multibuffer
|
||||
changes to version() and configure.in.
|
||||
- Moved to gettext 0.10.38 at the last second, sure to break
|
||||
something, but at least I can run make distcheck!
|
||||
- Makefile.am:
|
||||
- Include ABOUT-NLS and the new THANKS files to the distributed list.
|
||||
- THANKS:
|
||||
- Initial, incomplete list of people to thank.
|
||||
- Added some more people.
|
||||
- configure.in:
|
||||
- New option, --enable-nanorc, which allows people to have a .nanorc
|
||||
initialization file and set options normally used on the command
|
||||
line, and color later on.
|
||||
- Added --enable-color option to allow color and syntax highlighting
|
||||
(stub as of now).
|
||||
- cut.c:
|
||||
add_to_cutbuffer()
|
||||
- Remove useless statements (Rocco).
|
||||
cut_marked_segment()
|
||||
- Add bizarre copy of bot node, else *BSD goes ballistic (fixes
|
||||
BUG #60).
|
||||
- Added 'destructive' argument. Allows the selected text to be
|
||||
added to the cutbuffer without changing the contents of the
|
||||
file. This allows writing selection to separate files.
|
||||
do_cut_text()
|
||||
- If the line is empty when using -k and wasn't already added,
|
||||
create a dummy line and add it to the cutbuffer (fixes bug #61)
|
||||
- Reset marked_cut if we blow away the cutbuffer.
|
||||
- Moved the case of current == mark_beginbuf into cut_marked
|
||||
segment, so do_writeout could call it when writing selection to
|
||||
file.
|
||||
do_uncut_text()
|
||||
- Reset cutbuffer even if we're uncutting marked or cut to end text!
|
||||
- faq.html:
|
||||
- Brought the FAQ up to date, many little changes (Jordi).
|
||||
- Added sections 3.7 and 3.8 for the multibuffer and nanorc support.
|
||||
- files.c:
|
||||
do_browser()
|
||||
- Minor fixes to the processing of SELECT function (Rocco)
|
||||
- Added the "Goto Directory" code (Rocco)
|
||||
- Don't shift the size of the file is it's less than 1K. Fixed
|
||||
files less than 1K being displayed as 0B (Rocco).
|
||||
- More Picoish keystrokes for the browser, ^P, ^N, etc, for up,
|
||||
down, etc, and add the consistent ^C to exit (Jim Knoble).
|
||||
do_writeout()
|
||||
- New code to allow writing selected text to a separate file.
|
||||
When this is done, the current state is prserved.
|
||||
write_file()
|
||||
- New arg, nonamechange, means whether or not to update the
|
||||
current filename after writing the file out.
|
||||
- Increment lineswritten when the very last line isn't null.
|
||||
Fixes off by one count when writing selection to file.
|
||||
- global.c:
|
||||
- Updated some of the lists for the "Goto Directory" code (Rocco)
|
||||
- move.c:
|
||||
page_up()
|
||||
- Rewritten with a loop to make screen updates work when
|
||||
mark is set (fixes bug #59).
|
||||
do_home(), do_end()
|
||||
- Don't keep cutbuffer.
|
||||
- nano.1:
|
||||
- Added the missing -r flag (Jordi).
|
||||
- nano.c:
|
||||
do_alt_speller()
|
||||
- Reposition cursor on same line as before ^T was called (Rocco)
|
||||
ABCD(), main()
|
||||
- Add Alt-whatever-[a-d] support as well as Alt-whatever-[A-D].
|
||||
main()
|
||||
- Code to silently process "-g" and "-j" (Rocco)
|
||||
- Added Alt-[-7,8 support for home/end keys (Jeff Teunissen).
|
||||
signal_init()
|
||||
- Reorder sigaction calls, use sigfillset() to stop SIGTSTP and
|
||||
SIGCONT from being interrupted, allows suspending nano
|
||||
to work more reliably, esp. with mutt, etc.
|
||||
do_suspend()
|
||||
- Don't try to play with the handler inside the handler. Just
|
||||
raise a SIGSTOP. We also now write the "use "fg"" message to
|
||||
stdout instead of stderr.
|
||||
- Added _POSIX_VDISABLE macro to fully ignore suspend keystroke.
|
||||
Eliminates the possibility that nano can be suspended when
|
||||
it's not supposed to be. Many many many thanks to Jordi and
|
||||
Tom Lear for helping out finding and fixing this bug!
|
||||
do_cont()
|
||||
- Now just does a refresh call instead of playing with the SIGTSTP
|
||||
handler.
|
||||
- nano.h:
|
||||
- Updated the BROWSER_LIST_LEN for the "Goto Directory" code (Rocco)
|
||||
- proto.h:
|
||||
- New shortcut list added: gotodir_list (Rocco).
|
||||
- search.c:
|
||||
do_gotoline()
|
||||
- Optimizations, remove "$" goes-to-last-line, less messages (Rocco)
|
||||
do_replace()
|
||||
- If we manage to make it in somehow with VIEW_MODE on, abort
|
||||
nicely (fixes BUG #59).
|
||||
- utils.c
|
||||
strcasestr()
|
||||
- Replaced by mutt's mutt_stristr function, because the thought
|
||||
of dynamically allocating memory and copying each line in a file
|
||||
to do a search or replace was causing me to lose sleep.
|
||||
- winio.c:
|
||||
actual_x()
|
||||
- Remove inline from function decl (Albert Chin).
|
||||
- po/POTFILES.in:
|
||||
- Added utils.c to the list.
|
||||
- po/es.po, po/ca.po:
|
||||
- Updated (Jordi).
|
||||
- po/gl.po:
|
||||
- Galician translation by Jacobo Tarrío.
|
||||
- po/uk.po, po/ru.po:
|
||||
- New Ukrainian and Russian translations by Sergey A. Ribalchenko
|
||||
<fisher@obu.ck.ua>, thanks!
|
||||
- po/id.po:
|
||||
- Updated Indonesian translation by Tedi Heriyanto.
|
||||
- po/it.po
|
||||
- Updated Italian translation by Marco Colombo.
|
||||
- po/no.po:
|
||||
- New Norwegian translation by Eivind Kjørstad <ekj@vestdata.no>.
|
||||
- po/sv.po:
|
||||
- New Swedish translation by Christian Rose <menthos@menthos.com>.
|
||||
|
||||
nano 1.1 tree forked here 04/07/2001
|
||||
|
||||
nano 1.0.1 - 04/06/2001
|
||||
- General:
|
||||
- added configure option --disable-wrapping. Does what it says,
|
||||
no wrapping or checks are done. Separate from --enable-tiny,
|
||||
some may want a bare-bones Pico clone that does wrap text.
|
||||
Affects configure, nano.c:do_char() and check_wrap() obviously,
|
||||
version(), and do_char().
|
||||
- aclocal.m4:
|
||||
- Minor patch for intl check (really this time) (Albert Chin)
|
||||
- faq.html:
|
||||
- Fixed typo in section 6.1 (discovered by Bob Farmer).
|
||||
- files.c:
|
||||
- fix two typos in comments, one in ChangeLog (Matthias Andree)
|
||||
diralphasort()
|
||||
- Stop abort on symlinks (Matthias Andree)
|
||||
- use strcasecmp to sort directory if available, pilot does that
|
||||
as well (Matthias Andree)
|
||||
filestat(), do_browse()
|
||||
- Changed lstat calls to stat, which fixes the browser not
|
||||
following links to directories. We only use lstat() when
|
||||
printing the details of the file, and if it is a link, then
|
||||
check via lstat() for link to a directory. If it is
|
||||
a directory, display (dir), else use the normal "--".
|
||||
do_browser()
|
||||
- Fix broken size suffix off-by-one errors (Matthias Andree)
|
||||
cwd_tab_completion(), do_browse_from()
|
||||
- Use PATH_MAX instead of 0 arg to getcwd (Matthias Andree).
|
||||
- Changed above to use PATH_MAX only when defined on the
|
||||
system, as the HURD e.g. does not support it.
|
||||
- intl/Makefile.in:
|
||||
distclean
|
||||
- added intl/libintl.h to the rm -f rule, should fix the unresolved
|
||||
gettext symbols problem (Jordi).
|
||||
|
||||
nano-1.0.0 - 03/22/2001
|
||||
- General
|
||||
- Added void to functions declared as () args, nano.c:do_mark()
|
||||
and search.c:regexp_cleanup(). (Christian Weisgerber).
|
||||
- Changed internal variables called "new" to "newnode" to avoid
|
||||
the "new" C++ reserved word, even though there is likely no way
|
||||
nano will EVER be compilable with a C++ compiler. (suggested by
|
||||
Rocco Corsi).
|
||||
- ca.po, es.po:
|
||||
- Final tweaks for Nano 1.0.
|
||||
- cs.po:
|
||||
- Czech translation from Vaclav Haisman.
|
||||
- nano.info:
|
||||
- Added dir entry (Albert Chin).
|
||||
- winio.c:
|
||||
statusq()
|
||||
- Added NANO_BACK_KEY and NANO_FORWARD_KEY cases for left and right.
|
||||
|
||||
1.0-test prerelease - 03/17/2001
|
||||
- nano.c:
|
||||
do_wrap()
|
||||
- Added case for autoindenting text causing new line (Adam).
|
||||
- Added SAMELINE case to above. Added checks to cases 1b and
|
||||
2b for placement of cursor.
|
||||
- move.c:
|
||||
page_down()
|
||||
- Check for totlines < editwinrows in check for superfluous
|
||||
edit update (fixed BUG #57).
|
||||
- search.c:
|
||||
print_replaced()
|
||||
- s/occurence/occurrence typos (Jordi).
|
||||
search_init()
|
||||
- If using Pico mode and regex and same answer is entered, use
|
||||
last_search string instead of answer (fixes BUG #56).
|
||||
- nano.texi:
|
||||
- Meta-Z correction and grammar in --enable-tiny desc (Neil Parks).
|
||||
|
||||
nano-0.9.99pre3 - 02/19/2001
|
||||
- General
|
||||
GNU compliance issues:
|
||||
- Reworked shortcut list, put "Get Help" into default list,
|
||||
removed "Goto Line", aligned "Read File" with "Write Out" and
|
||||
"Replace" with "Where is" for consistency.
|
||||
- Added texinfo manual nano.texi. Added texi options to
|
||||
Makefile.am.
|
||||
- configure.in:
|
||||
- Autoconf compatibility fixes (Pavel Roskin)
|
||||
- Added separate check for resizeterm().
|
||||
- ALL_LINGUAS: added hu and ca.
|
||||
- cut.c:
|
||||
do_cut_text()
|
||||
- marked text cut fixes (Rocco) (Fixes bug #54).
|
||||
- nano.c:
|
||||
do_delete()
|
||||
- Added check for current->next == fileptr, as we have a magic
|
||||
line code again, fixes silliness at the end of the last line
|
||||
before the magic line (reported by J.A. Neitzel).
|
||||
do_justify()
|
||||
- If the keystroke after the justify is not the unjustify key,
|
||||
blank the statusbar (bug reported by Neil Parks).
|
||||
main()
|
||||
- Added ENABLE_NLS check around gettext stuff.
|
||||
- winio.c:
|
||||
do_yesno()
|
||||
- Added localized yes, no and all strings to function and rewrote
|
||||
handler for the new format.
|
||||
- de.po:
|
||||
- Translation updates by Florian König.
|
||||
- fi.po:
|
||||
- Translation updates by Pauli Virtanen.
|
||||
- hu.po:
|
||||
- Hungarian translation by Horvath Szabolcs.
|
||||
- id.po:
|
||||
- Translation updates by Tedi Heriyanto.
|
||||
- es.po:
|
||||
- Translation updates and grammatical/typo fixes (Jordi).
|
||||
- ca.po:
|
||||
- Catalan translation by Jordi Mallach :)
|
||||
- Miquel Vidal <miquel@sindominio.net> went over it and corrected
|
||||
many typos and completed bits that remained untranslated by error.
|
||||
|
||||
nano-0.9.99pre2 - 01/31/2001
|
||||
General
|
||||
- Removed center_x and center_y globals. center_y was
|
||||
@@ -17,7 +316,8 @@ General
|
||||
- Rewritten using getpwent (suggested by Rocco).
|
||||
- Removed redundant conditional (Rocco).
|
||||
real_dir_from_tilde()
|
||||
- Rewritten using getpwent (suggested by Adam, much optimized by Rocco).
|
||||
- Rewritten using getpwent (suggested by Adam, much optimized by
|
||||
Rocco).
|
||||
- global.c:
|
||||
- Don't define toggles global or toggle_init_one if using --tiny.
|
||||
- nano.c:
|
||||
@@ -46,13 +346,13 @@ General
|
||||
- Various #ifdef & #ifndef cleanups. (Rocco)
|
||||
- Added message for when keypad goes awry. Added code in main and
|
||||
function print_numlock_warning() to notify user, and added an
|
||||
apropriate section in the faq to refer to this brokenness.
|
||||
appropriate section in the faq to refer to this brokenness.
|
||||
- Added macros in nano.h for magic values that might be unclear in
|
||||
nano.c:global_init(). (Rocco)
|
||||
- configure.in:
|
||||
- Fix for _use_keypad check breaking slang support (Christian
|
||||
Weisgerber).
|
||||
- Changed to automatically define the 5 DISABLE varibles when
|
||||
- Changed to automatically define the 5 DISABLE variables when
|
||||
NANO_SMALL (enable-tiny) is requested at configure.
|
||||
- faq.html:
|
||||
- Added some info on making the binary smaller with the configure
|
||||
@@ -85,7 +385,7 @@ General
|
||||
- When NANO_SMALL (enable-tiny) is defined, the 5 main DISABLE
|
||||
variables (SPELLER, HELP, JUSTIFY, BROWSER, TABCOMP) are not
|
||||
reported as enabled when Nano is called with -V (--version)
|
||||
command-line option. (Rocco)
|
||||
command line option. (Rocco)
|
||||
usage()
|
||||
- Alternate speller option no longer valid if DISABLE_SPELLER is
|
||||
active. (Rocco)
|
||||
@@ -110,8 +410,8 @@ General -
|
||||
- Keypad code has been changed slightly. Now checks for
|
||||
_use_keypad flag in window to see whether or not to turn
|
||||
the keypad() back off when finished (taken from aumix). Moved
|
||||
to winio.c where it should probably be anyway. New confgure
|
||||
check for _use_keypad in window sstruct. This will have to do
|
||||
to winio.c where it should probably be anyway. New configure
|
||||
check for _use_keypad in window struct. This will have to do
|
||||
for now.
|
||||
- Moved keypad() calls for PDCURSES from main() to window_init()
|
||||
so the keypad continues to work after a Meta-X, for example.
|
||||
@@ -132,7 +432,7 @@ General -
|
||||
do_browser()
|
||||
- Don't decrement longest by the length of path. Fixes crashes
|
||||
on entering various dirs (Rocco).
|
||||
- Don't ungetch() the exit key, unneeded, fixes inerting a file
|
||||
- Don't ungetch() the exit key, unneeded, fixes inserting a file
|
||||
causes exit code.
|
||||
- move.c:
|
||||
page_down()
|
||||
@@ -189,7 +489,7 @@ General
|
||||
- Added check for S_ISBLK and S_ISCHR, don't open device files!
|
||||
- nano.c:
|
||||
renumber()
|
||||
- Dont stupidly assign the value of prev->lineno if prev == NULL!
|
||||
- Don't stupidly assign the value of prev->lineno if prev == NULL!
|
||||
main()
|
||||
- Added code to check for Alt-Alt (27-27) keystrokes and set the
|
||||
next keystroke as a control sequence. New variable
|
||||
@@ -222,7 +522,7 @@ General
|
||||
"speller" for -s, so it should be --disable-speller.
|
||||
- files.c:
|
||||
write_file()
|
||||
- Added tmp check to TMP_OPT section (how apropriate).
|
||||
- Added tmp check to TMP_OPT section (how appropriate).
|
||||
- Added new consistency checking code from securityfocus
|
||||
article by Oliver Friedrichs, and use O_EXCL if tmp == 1.
|
||||
- We now run check on result of lstat(), not stat(), to be
|
||||
@@ -237,7 +537,7 @@ General
|
||||
edit_add()
|
||||
- Off by one display error (fix by Rocco Corsi).
|
||||
do_replace_highlight()
|
||||
- New code to handle being past COLS (Roco Corsi).
|
||||
- New code to handle being past COLS (Rocco Corsi).
|
||||
- Moved from search.c, as it's definitely a winio function now =)
|
||||
update_line()
|
||||
- More '$' display fixes (Rocco Corsi).
|
||||
@@ -252,15 +552,15 @@ nano 0.9.22 - 12/02/2000
|
||||
- Took out help from spell_list and changed SPELL_LIST_LEN to 1.
|
||||
Is using a spell checker THAT difficult? =-)
|
||||
- New function nano_disabled_msg(), to alert that certain
|
||||
functions have been disabled, similaer to nano_tiny feature.
|
||||
functions have been disabled, similar to nano_tiny feature.
|
||||
- New configure options:
|
||||
- Added configure argument --disable-tabcomp. Affects
|
||||
bottom of files.c and write_file, utils.c:check_wildcard_match()
|
||||
and winio.c:nanogettsr().
|
||||
and winio.c:nanogetstr().
|
||||
- New options --enable-extra. New code in nano.c:version() to
|
||||
print out various options from ./configure, function do_credits().
|
||||
- Added --disable-spell option for those who want to just disable
|
||||
the spell check feature. Affects the spellinf fucntions
|
||||
the spell check feature. Affects the spelling functions
|
||||
do_spell, do_int_speller and do_alt_speller.
|
||||
- Added --disable-justify to get rid of the justify function.
|
||||
Affects do_justify() (not surprisingly).
|
||||
@@ -276,8 +576,8 @@ nano 0.9.22 - 12/02/2000
|
||||
- global.c:
|
||||
shortcut_init()
|
||||
- Now takes an argument as to whether to display the unjustify
|
||||
shortcut or the normal uncut text one. Needed to accomodate
|
||||
the klugey unjustify code.
|
||||
shortcut or the normal uncut text one. Needed to accommodate
|
||||
the kludgey unjustify code.
|
||||
- nano.1, nano.1.html:
|
||||
- Updated date on pages because of -p changes.
|
||||
- Added "NOTES" section, where I explain what nano.save & friends
|
||||
@@ -313,11 +613,11 @@ nano 0.9.22 - 12/02/2000
|
||||
handle_sighup()
|
||||
- Now calls die instead of writing on its own and exiting normally.
|
||||
- search.c:
|
||||
do_replace_hilight()
|
||||
- New function, displays the currently selected word as hilighted
|
||||
do_replace_highlight()
|
||||
- New function, displays the currently selected word as highlighted
|
||||
in the spell check. Called from do_replace_loop (Rocco Corsi).
|
||||
- Added calls to curs_set(0) and (1) to diable the cursor when
|
||||
hilighting, looks much better.
|
||||
- Added calls to curs_set(0) and (1) to disable the cursor when
|
||||
highlighting, looks much better.
|
||||
- es.po:
|
||||
- Traditional Spanish strings updates.
|
||||
|
||||
@@ -330,7 +630,7 @@ nano 0.9.21 - 11/23/2000
|
||||
whether or not to display "New File" in the statusbar.
|
||||
- search.c:
|
||||
findnextstr()
|
||||
- Fix curent_x increment bug by using another variable (Rocco Corsi).
|
||||
- Fix current_x increment bug by using another variable (Rocco Corsi).
|
||||
search_init()
|
||||
- Silly typo in our "one simple call" of statusq. Stopped
|
||||
previous search string from being displayed.
|
||||
@@ -339,7 +639,8 @@ nano 0.9.21 - 11/23/2000
|
||||
using PICO_MODE and answer == ""
|
||||
- winio.c:
|
||||
do_up()
|
||||
- Deleted first update_line() call, screws up display when marker is set.
|
||||
- Deleted first update_line() call, screws up display when marker is
|
||||
set.
|
||||
- nano.1, nano.1.html
|
||||
- Updated man page for new -p definition.
|
||||
|
||||
@@ -352,12 +653,13 @@ nano 0.9.20 - 11/18/2000
|
||||
changed code in search_init(), do_replace(), nanogetstr (see
|
||||
below).
|
||||
- Added some missing gettext calls here and there (Jordi).
|
||||
- Revamped nanogetsr() and calls to it to use variable length strings.
|
||||
- Revamped nanogetstr() and calls to it to use variable length
|
||||
strings.
|
||||
MANY changes in nanogetstr(), many chances in search.c, new
|
||||
function mallocstrcpy which is sure to be a programmatic
|
||||
nightmare, changed last_search, last_replace, answer to
|
||||
pointers. New function not_found_msg in search.c for displaying
|
||||
truncated strings in satusbar when the string is not found
|
||||
truncated strings in statusbar when the string is not found
|
||||
(-pedantic fixes by Rocco Corsi). We disable this feature when
|
||||
using PICO_MODE (-p).
|
||||
- New spelling code by Rocco Corsi. New functions
|
||||
@@ -381,7 +683,7 @@ nano 0.9.20 - 11/18/2000
|
||||
- global.c
|
||||
- New global replace_list_2, for 2nd half of the replace dialog
|
||||
("Replace with:"), has fewer options than first half because
|
||||
they were inapropriate.
|
||||
they were inappropriate.
|
||||
toggle_init()
|
||||
- Added #ifdef around toggle_regex_msg to get rid of compiler
|
||||
warning.
|
||||
@@ -391,7 +693,7 @@ nano 0.9.20 - 11/18/2000
|
||||
- New function, toggles turning the keypad on and off in edit and
|
||||
bottomwin(). Added call to this in finish(), fixes bug #45.
|
||||
- search.c
|
||||
findnexstr()
|
||||
findnextstr()
|
||||
- New arg for begin_x variable, basically a rewrite that
|
||||
makes a little more sense and isn't quite as messy (Rocco Corsi).
|
||||
- Update the line we're checking if not the whole screen, because
|
||||
@@ -403,7 +705,7 @@ nano 0.9.20 - 11/18/2000
|
||||
do_replace()
|
||||
- Added code for Gotoline key after entering the search term.
|
||||
Fixes bug #46.
|
||||
- Removed redundant code involving processing replacemenet string.
|
||||
- Removed redundant code involving processing replacement string.
|
||||
Converted if statements to switch statements.
|
||||
- Optimizations by Rocco Corsi.
|
||||
- Removed code for deleted shortcuts from in replace_list_2.
|
||||
@@ -473,12 +775,12 @@ nano 0.9.18 - 09/18/2000
|
||||
keypad in many terms, which is very bad.
|
||||
- Made insert key call do_insertfile().
|
||||
do_toggle()
|
||||
- Rewrote function to allow NOHELP toggle to wotk on systems
|
||||
- Rewrote function to allow NOHELP toggle to work on systems
|
||||
without a working resizewin(). New function window_init().
|
||||
mouse_init()
|
||||
- Add keypad only if mouse support is on, otherwise mouse doesn't
|
||||
work. I guess you have to choose between having the mouse and
|
||||
having a working keypad for the time being (thank god for Meta-m).
|
||||
having a working keypad for the time being (thank god for Meta-M).
|
||||
- winio.c:
|
||||
total_refresh()
|
||||
- Added titlebar() call.
|
||||
@@ -504,7 +806,7 @@ nano-0.9.17 - 09/04/2000
|
||||
nano.c.
|
||||
- Changed from Alt-key symbol (@) which is completely nonstandard
|
||||
to the *nix "Meta" symbol (M-). Changed help_init to show
|
||||
the M-key usage and the help text to explain keys whcih generate
|
||||
the M-key usage and the help text to explain keys which generate
|
||||
Meta. Moved the toggle Meta keystrokes to the first column
|
||||
instead of the third as they are the primary keystrokes for the
|
||||
functions. Thanks Mini editor team :->
|
||||
@@ -588,7 +890,7 @@ nano-0.9.15 - 08/03/2000
|
||||
- Fixed typo (?) in check for inptr->next. Caused lots of
|
||||
grief for editing lines at filebot.
|
||||
main()
|
||||
- Removed now useless usrtabsize variable (Christian Weisgerber).
|
||||
- Removed now useless usertabsize variable (Christian Weisgerber).
|
||||
- search.c:
|
||||
replace_abort()
|
||||
- redundant, now just calls search abort until it does something
|
||||
@@ -650,8 +952,8 @@ nano-0.9.13 - 07/23/2000
|
||||
die():
|
||||
- More intelligent emergency-save filename selection (Rob)
|
||||
do_spell():
|
||||
- Changed exit semantincs a bit so that aspell wouldn't get
|
||||
all screwy (bug disovered by Joshua Jensen.
|
||||
- Changed exit semantics a bit so that aspell wouldn't get
|
||||
all screwy (bug discovered by Joshua Jensen.
|
||||
- files.c:
|
||||
read_file():
|
||||
- Added init of buf variable, hopefully this will stop the
|
||||
@@ -674,7 +976,7 @@ nano-0.9.13 - 07/23/2000
|
||||
the opposite function.
|
||||
- Fixed bug #28.
|
||||
findnextstr()
|
||||
- do not center string found if it is currently visable. (Adam)
|
||||
- do not center string found if it is currently visible. (Adam)
|
||||
- fr.po:
|
||||
- French update by Clement Laforet <clem_laf@wanadoo.fr>.
|
||||
- es.po:
|
||||
@@ -742,21 +1044,21 @@ nano-0.9.12 - 07/07/2000
|
||||
nano-0.9.11 - 06/20/2000
|
||||
- New flag "-T" or "--tabsize" to specify how to display tab widths.
|
||||
Affects main() in nano.c, strlenpt(), xpt() and actual_x() (et al) in
|
||||
winio.c, and nano.h. Many harcoded "8"s have been changed to the
|
||||
winio.c, and nano.h. Many hardcoded "8"s have been changed to the
|
||||
TABSIZE int. Added changes to nano.1 and nano.1.html.
|
||||
- id.po:
|
||||
- Indonesian translation by Tedi Heriyanto.
|
||||
- es.po:
|
||||
- Updated translation (Jordi Mallach).
|
||||
- winio.c
|
||||
- Rewrite of display functions to correct the display problems
|
||||
- Rewrite of display functions to correct the display problems
|
||||
we had been seeing. Affects: add_marked_sameline, edit_add,
|
||||
and many others. (Rob Siemborski)
|
||||
- totsize fixes (Rob Siemborski)
|
||||
total_refresh():
|
||||
- Cut dispaly_main_list call, as this function is only supposed to refresh
|
||||
what's already on the screen, not go through the process of adding the
|
||||
text again.
|
||||
- Cut display_main_list call, as this function is only supposed to
|
||||
refresh what's already on the screen, not go through the process
|
||||
of adding the text again.
|
||||
- cut.c:
|
||||
- totsize fixes (Rob Siemborski)
|
||||
- nano.c:
|
||||
@@ -766,13 +1068,14 @@ nano-0.9.11 - 06/20/2000
|
||||
- Removed all functions that were split into other files.
|
||||
Affects LOTS of funcs.
|
||||
do_enter():
|
||||
- Added reset of placewewant to end.
|
||||
- Added reset of placewewant to end.
|
||||
do_insertfile():
|
||||
- Fix display problem when using ctrl-r to load a file
|
||||
into the buffer (Rob Siemborski)
|
||||
handle_sigwinch():
|
||||
- Added titlebar(), edit_refresh() and display_main_list() calls because
|
||||
a resize wasn't picking up on possible different width correctly.
|
||||
- Added titlebar(), edit_refresh() and display_main_list() calls
|
||||
because a resize wasn't picking up on possible different width
|
||||
correctly.
|
||||
- utils.c:
|
||||
- Moved nmalloc() and nrealloc() here.
|
||||
- move.c:
|
||||
@@ -797,14 +1100,14 @@ nano-0.9.10 - 06/04/2000
|
||||
exit nano before it runs (--version, --help, etc).
|
||||
|
||||
nano-0.9.9 - 05/31/2000
|
||||
- Makeile.am:
|
||||
- Makefile.am:
|
||||
- Added proper lines for defining LOCALEDIR.
|
||||
- configure.in:
|
||||
- Spelling fixes (Jordi Mallach)
|
||||
- Removed CFLAGS changes for gcc, reduces portability according to
|
||||
some, and it certainly doesn't seem to decrease exe size.
|
||||
- es.po:
|
||||
- Spanish ranslation updates (Jordi Mallach)
|
||||
- Spanish translation updates (Jordi Mallach)
|
||||
- POTFILES.in:
|
||||
- Added global.c file, was screwing up translations (i.e. they
|
||||
weren't getting done).
|
||||
@@ -827,7 +1130,7 @@ nano-0.9.9 - 05/31/2000
|
||||
renumber(), renumber_all():
|
||||
- Removed totsize-- and totsize init in renumber_all.
|
||||
do_mouse():
|
||||
- Added edit_refresh() call to show hilight updates. Removed
|
||||
- Added edit_refresh() call to show highlight updates. Removed
|
||||
unnecessary wrefresh(edit).
|
||||
main():
|
||||
- Moved up locale calls so that translated --help messages would
|
||||
@@ -841,7 +1144,7 @@ nano-0.9.9 - 05/31/2000
|
||||
- malloc call changed to nmalloc (Rob Siemborski).
|
||||
- winio.c:
|
||||
total_refresh():
|
||||
- Completely rewrote function, not quite so braindamaged now.
|
||||
- Completely rewrote function, not quite so brain-damaged now.
|
||||
|
||||
nano-0.9.8 - 05/18/2000
|
||||
- nano.c:
|
||||
@@ -850,7 +1153,7 @@ nano-0.9.8 - 05/18/2000
|
||||
character (Adam Rogoyski). Removed raw()/noraw() calls so that
|
||||
nano gets input in 'normal' mode, which is the Right Way(tm) to
|
||||
do it. ^S, ^Z and ^Q now work properly as a result, as well as
|
||||
^C. New variable term, global bariable oldterm to save previous
|
||||
^C. New variable term, global variable oldterm to save previous
|
||||
term settings, and changes to finish() and die().
|
||||
- Added extra #ifdefs in getopt code, so that above code and
|
||||
flag init is run even if GETOPT_LONG is not #defined.
|
||||
@@ -864,8 +1167,8 @@ nano-0.9.8 - 05/18/2000
|
||||
loop.
|
||||
- global.c:
|
||||
shortcut_init():
|
||||
- Removed suspend sc_init call and suspend message because suspend is no
|
||||
longer needed in the shortcut list to work properly.
|
||||
- Removed suspend sc_init call and suspend message because suspend
|
||||
is no longer needed in the shortcut list to work properly.
|
||||
|
||||
nano-0.9.7 - 05/14/2000
|
||||
- nano.c:
|
||||
@@ -900,7 +1203,7 @@ nano-0.9.6 - 05/08/2000
|
||||
edit_update():
|
||||
- Removed yucky code that didn't work, this function now just
|
||||
computes edittop and editbot and calls edit_refresh() to do the
|
||||
rest, which removes a lot of dupliicate code..
|
||||
rest, which removes a lot of duplicate code..
|
||||
|
||||
nano-0.9.5 - 05/01/2000
|
||||
- Removed bytes from file struct because it was computationally wasteful.
|
||||
@@ -965,14 +1268,14 @@ nano-0.9.4 - 04/25/2000
|
||||
of do_down before setting current_x = 0 (discovered by Adam).
|
||||
do_justify():
|
||||
- Fixed segfault when reaching the last line (tried to assign
|
||||
currrent->next->data when current->next == NULL) (discovered
|
||||
current->next->data when current->next == NULL) (discovered
|
||||
by Adam).
|
||||
- utils.c:
|
||||
- Removed extra macro defs that are now in nano.h.
|
||||
- nano.h:
|
||||
- Changed macro SET() to use |= instead of ^=. Fixes bug in
|
||||
cut code when cutting more than one line, and cutbuffer gets
|
||||
blown away when it shouldnt.
|
||||
blown away when it shouldn't.
|
||||
|
||||
nano-0.9.3 - 04/29/2000
|
||||
- cut.c:
|
||||
@@ -987,28 +1290,29 @@ nano-0.9.3 - 04/29/2000
|
||||
- nano.c:
|
||||
do_backspace(), do_char():
|
||||
- Removed "magic line" code. It was basically causing more bugs
|
||||
than it was helping for the sake of compatibillity. This fixes
|
||||
than it was helping for the sake of compatibility. This fixes
|
||||
at least one known segfault condition.
|
||||
do_enter():
|
||||
- Added setting editbot to new node if the new node is the last
|
||||
node in the file.
|
||||
write_file():
|
||||
- Changed writing file bahavior. Now, if last line of the file
|
||||
has any data on it, we write a newline on it, else we dont.
|
||||
- Changed writing file behavior. Now, if last line of the file
|
||||
has any data on it, we write a newline on it, else we don't.
|
||||
- winio.c:
|
||||
add_marked_sameline():
|
||||
- New code that checks for whether the begin and end of the marker
|
||||
are on different lines. Missing previously.
|
||||
edit_add():
|
||||
- added some more checks for text length. Cleaned up some mvwaddnstrs that
|
||||
could be written more simply as waddnstrs.
|
||||
- added some more checks for text length. Cleaned up some
|
||||
mvwaddnstrs that could be written more simply as waddnstrs.
|
||||
edit_refresh():
|
||||
- Removed check for temp == filebot, it is now treated like any other line.
|
||||
Fixes a bug where selected text on the last line shows normally.
|
||||
- Removed check for temp == filebot, it is now treated like any other
|
||||
line. Fixes a bug where selected text on the last line shows
|
||||
normally.
|
||||
xpt():
|
||||
- Removed an extra computation for tabs variable that was incorrect.
|
||||
xplustabs():
|
||||
- Since xpt now actualy works, this func is now just a wrapper for
|
||||
- Since xpt now actually works, this func is now just a wrapper for
|
||||
xpt(current, current_x)
|
||||
- nano.1, nano.1.html:
|
||||
- Added -l option to man pages.
|
||||
@@ -1030,7 +1334,7 @@ nano-0.9.1 - 04/14/2000
|
||||
- Added pico compatibility for ^T when in search or switch to switch
|
||||
to the opposite function. Added one to REPLACE_LIST_LEN and
|
||||
WHEREIS_LIST_LEN in nano.h, new args to sc_init_one in global.c and
|
||||
new strings that will have to be gettex()ed. New argument 'replacing'
|
||||
new strings that will have to be gettext()ed. New argument 'replacing'
|
||||
to search_init(). Handlers in do_replace and do_search().
|
||||
- New write code, now follows symbolic links instead of replacing them
|
||||
with the new file. New option (-l, --nofollow) to enable the old
|
||||
@@ -1041,7 +1345,7 @@ nano-0.9.1 - 04/14/2000
|
||||
a segfault *sigh*.
|
||||
do_replace():
|
||||
- Incremented current_x by the length of the replacement
|
||||
text inside the main repalce loop. Fixes bug #15.
|
||||
text inside the main replace loop. Fixes bug #15.
|
||||
add_marked_sameline():
|
||||
- New function, handles marked text when start & end of marker is
|
||||
on one line, also supports most marked text when cursor > COLS.
|
||||
@@ -1059,7 +1363,7 @@ nano-0.9.0 - 04/07/2000
|
||||
- Removed inner loop code, now calls update_line() for each line
|
||||
in question, MUCH nicer.
|
||||
- xplustabs(), xpt():
|
||||
- Removed redundant increment of tabs when collumn no % 8 == 0.
|
||||
- Removed redundant increment of tabs when column no % 8 == 0.
|
||||
- Added check for data[i] < 32, most of such bits are 2 chars wide.
|
||||
- update_line():
|
||||
- Fixed a stupid call to strlenpt with col when we should have
|
||||
@@ -1077,7 +1381,7 @@ nano-0.8.8 - 03/12/2000
|
||||
New dirs po/ and intl/, changes to configure.in and Automake.am to
|
||||
support i18n.
|
||||
- nano.c:
|
||||
includes: Ddded sys/param.h and limits.h. (Adam Rogoyski).
|
||||
includes: Added sys/param.h and limits.h. (Adam Rogoyski).
|
||||
statics: Changed some things that were not necessarily static
|
||||
(Adam Rogoyski).
|
||||
nrealloc(): New function, similar to nmalloc(). Changed calls from
|
||||
@@ -1091,21 +1395,22 @@ nano-0.8.8 - 03/12/2000
|
||||
|
||||
nano-0.8.7 - 03/01/2000
|
||||
- main.c:
|
||||
do_wrap(): Better fix for segfaults, and fix for lisnes being wrapped
|
||||
do_wrap(): Better fix for segfaults, and fix for lines being wrapped
|
||||
to a single character on one line when no good place to
|
||||
break the line exists, and for wrapping lines longer than COLS.
|
||||
break the line exists, and for wrapping lines longer than
|
||||
COLS.
|
||||
- nano.1.html:
|
||||
Html version of man page, now included in dist. For
|
||||
the benefit of nano packages in Linux distributions.
|
||||
|
||||
nano-0.8.6 - 02/24/2000
|
||||
- gobal.c:
|
||||
- global.c:
|
||||
shortcut_init():
|
||||
Added shortcuts for goto_line and do_replace when using
|
||||
pico_msgs. Oops.
|
||||
- nano.c:
|
||||
statics: Changed fill back to 0 from 71 by default (Adam Rogoyski).
|
||||
do_wrap(): Added check for backing up past tabs, which we shouldnt do.
|
||||
do_wrap(): Added check for backing up past tabs, which we shouldn't do.
|
||||
Removed check for backing up past spaces first.
|
||||
main(): Added for loop to check for alt keys instead of hard list.
|
||||
do_enter(): Fix for bug #14, added call to reset_cursor and messed
|
||||
@@ -1127,7 +1432,7 @@ nano-0.8.5 - 02/18/2000
|
||||
- winio.c:
|
||||
edit_refresh():
|
||||
Temporary fix for selecting text when temp == current.
|
||||
edit_refresh() is now unmanagably complex, and must be
|
||||
edit_refresh() is now unmanageably complex, and must be
|
||||
revamped.
|
||||
check_statblank():
|
||||
Added check for constupdate, makes things less choppy
|
||||
@@ -1163,7 +1468,7 @@ nano-0.8.3 - 02/08/2000
|
||||
main():
|
||||
Removed case for ignoring char 126 (~). That's kind of
|
||||
important, we'll have to fix handling that sequence when
|
||||
pageing up/down on a terminal some other way... Revamped
|
||||
paging up/down on a terminal some other way... Revamped
|
||||
main switch loop in much snazzier fashion based on the
|
||||
shortcut list.
|
||||
- winio.c:
|
||||
@@ -1191,7 +1496,7 @@ nano-0.8.2 - 02/02/2000
|
||||
- Added initial mouse (-m, --mouse) support. New global variable
|
||||
use_mouse. (Adam Rogoyski)
|
||||
|
||||
- nano.c: Set intial value of fill to COLS - 8 rather than just 72
|
||||
- nano.c: Set initial value of fill to COLS - 8 rather than just 72
|
||||
regardless. (Adam Rogoyski).
|
||||
do_delete():
|
||||
Deleted call to do_backspace() when on the end of a line,
|
||||
@@ -1217,7 +1522,7 @@ do_goto():
|
||||
bottombars() with replace_list instead of goto_list.
|
||||
- nano.h:
|
||||
New char *help in shortcut structure for help
|
||||
feature. Added NANO_*_MSG and NANO_*_HELP #deifnes
|
||||
feature. Added NANO_*_MSG and NANO_*_HELP #defines
|
||||
for help function and i18n.
|
||||
- global.c:
|
||||
New functions shortcut_init (called in nano.c) and
|
||||
@@ -1249,7 +1554,7 @@ main():
|
||||
the buffer when we page up/down on a vt terminal.
|
||||
write_file():
|
||||
Fixes for umask (Adam Rogoyski). Renamed tmpfile
|
||||
variable to tmp. Documented the tmp opttion
|
||||
variable to tmp. Documented the tmp option
|
||||
better in the function comments. Fixed my
|
||||
stupidly commented out check for tmp on setting
|
||||
umask which I really like =>
|
||||
@@ -1262,7 +1567,8 @@ write_file():
|
||||
New checks for getopt_long, getopt.h, removed
|
||||
CFLAGS and LDFLAGS changes. Gonna have to run
|
||||
strip manually now =-) (Andy Kahn)
|
||||
Added check for HAVE_WRESIZE, new file acconfig.h (me).
|
||||
Added check for HAVE_WRESIZE, new file acconfig.h
|
||||
(me).
|
||||
|
||||
nano-0.7.9 - 01/24/2000
|
||||
- New autoindent feature. Command flag 'i' or '--autoindent'. New
|
||||
@@ -1287,7 +1593,7 @@ nano-0.7.9 - 01/24/2000
|
||||
|
||||
nano-0.7.8 - 01/23/2000
|
||||
- Stubbed justify function. Affects main() in nano.c and nano.h defines.
|
||||
- Added Fkey equivalents for Pico compatibilty. Affects nano.h defines
|
||||
- Added Fkey equivalents for Pico compatibility. Affects nano.h defines
|
||||
and main() in nano.c
|
||||
- Removed redundant reset_cursor() calls from the blank() routines.
|
||||
- nano.c:
|
||||
@@ -1366,7 +1672,7 @@ nano 0.7.6 - 01/15/2000
|
||||
0.7.3 Fixed a double blank_statusbar() when jumping to first and last
|
||||
lines. Took out unnecessary updates in load_file. Bug fix in
|
||||
do_left. Missing updates to totlines, fixed bug #7 (last line not
|
||||
having a newline at the end doesnt get read, bugfix in do_replace
|
||||
having a newline at the end doesn't get read, bugfix in do_replace
|
||||
with replace all, more/better comments (Robert Siemborski)
|
||||
0.7.2 Our first patch accepted into the source! configure fixes
|
||||
and optimizations (Erik Anderson). Added missing stdarg.h to winio.c.
|
||||
@@ -1407,35 +1713,36 @@ nano 0.7.6 - 01/15/2000
|
||||
0.6.1 Starting to implement wrapping toggle. Fix for unhandled control
|
||||
codes being entered into the buffer. Bug fix in actual_x; more
|
||||
> COLS - 1 functionality, especially on lines with TABs. Fixed being
|
||||
locked into cutbuffer when cutting more than one marked screen of text.
|
||||
locked into cutbuffer when cutting more than one marked screen of
|
||||
text.
|
||||
0.6.0 We have TABs!!! To do this, placewewant is now set to the actual
|
||||
width on the screen we want to be, not an index of current->data.
|
||||
New functions xplustabs and actual_x convert the actual place
|
||||
the cursor should be on the screen to and from the place in the
|
||||
string.
|
||||
0.5.5 Changed do_right to test do_down before setting current_x to 0,
|
||||
eliminiating the "looping" on the last line when holding the right
|
||||
eliminating the "looping" on the last line when holding the right
|
||||
arrow. Preliminary support for longer than COLS - 1 lines.
|
||||
Wrote do_delete.
|
||||
0.5.4 Fixed a big in total_update that wasn't repainting the screen properly.
|
||||
tipgetstr is much more messy but text is now more editable ;)
|
||||
Fixed crash on entering a new file, hopefully. Awful stub for tab
|
||||
handling, only in do_right() to save me some sanity.
|
||||
0.5.4 Fixed a bug in total_update that wasn't repainting the screen
|
||||
properly. tipgetstr is much more messy but text is now more
|
||||
editable ;) Fixed crash on entering a new file, hopefully. Awful
|
||||
stub for tab handling, only in do_right() to save me some sanity.
|
||||
0.5.3 Added check for malloc.h. Implementing uncut from marker slowly.
|
||||
Fixed a few bugs in do_uncut when not uncutting from marked text.
|
||||
I would not trust your data with the mark code right now, but then
|
||||
we're not at version 1.0 yet so dont trust anything ;)
|
||||
0.5.2 Added reset_cursor() before end of update_line so cursor doesnt
|
||||
I would not trust your data with the mark code right now, but then
|
||||
we're not at version 1.0 yet so dont trust anything ;)
|
||||
0.5.2 Added reset_cursor() before end of update_line so cursor doesn't
|
||||
jump after each keystroke entered. Select text stubbed. Fixed
|
||||
a bug in total_refresh(). Setting a mark will hilight properly,
|
||||
a bug in total_refresh(). Setting a mark will highlight properly,
|
||||
but does not actually affect what gets put in the cutbuffer (yet).
|
||||
0.5.1 Writing a file out causes modified to be set back to 0. Good.
|
||||
Set_modified function written. Cut and uncut text now set
|
||||
modified when called.
|
||||
0.5.0 Half way there! Implemented write out, save function seems
|
||||
stable. Changed statusbar blank routing to not refresh, a separte
|
||||
stable. Changed statusbar blank routing to not refresh, a separate
|
||||
program calls it and then refreshes. Made the program not clear
|
||||
the srceen on exit, just the bottom two lines (like Pico).
|
||||
the screen on exit, just the bottom two lines (like Pico).
|
||||
0.4.2 Implemented replace all in replace function. Crude exit function
|
||||
(asks yes or no if modified but does not write to file).
|
||||
0.4.1 Implementing search & replace. Fixed crash on deleting at top of
|
||||
@@ -1443,7 +1750,7 @@ nano 0.7.6 - 01/15/2000
|
||||
Implemented ^A and ^E (beginning and end of line).
|
||||
0.4.0 Split code into global.c and proto.h to allow for better multiple
|
||||
file handling. Added #defines for the majority of the shortcut
|
||||
kets in tip.h for easy modification.
|
||||
keys in tip.h for easy modification.
|
||||
0.3.1 Write edit_refresh which doesn't move the screen around, just
|
||||
updates what's there already. do_wrap() and do_enter() added.
|
||||
0.3.0 Preliminary cutbuffer (cut and uncut) support.
|
||||
|
||||
13
Makefile.am
13
Makefile.am
@@ -1,12 +1,14 @@
|
||||
## $Id$
|
||||
bin_PROGRAMS = nano
|
||||
nano_SOURCES = cut.c \
|
||||
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
|
||||
@@ -14,9 +16,12 @@ nano_SOURCES = cut.c \
|
||||
man_MANS = nano.1
|
||||
nano_LDADD = @INTLLIBS@
|
||||
|
||||
EXTRA_DIST = AUTHORS BUGS COPYING ChangeLog INSTALL NEWS README \
|
||||
TODO install-sh missing mkinstalldirs nano.1 nano.1.html \
|
||||
faq.html
|
||||
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
|
||||
|
||||
SUBDIRS = po intl
|
||||
|
||||
|
||||
185
Makefile.in
185
Makefile.in
@@ -57,25 +57,27 @@ POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@
|
||||
CATALOGS = @CATALOGS@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
CC = @CC@
|
||||
CURSES_LIB = @CURSES_LIB@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
GENCAT = @GENCAT@
|
||||
GLIBC21 = @GLIBC21@
|
||||
GLIB_CFLAGS = @GLIB_CFLAGS@
|
||||
GLIB_CONFIG = @GLIB_CONFIG@
|
||||
GLIB_LIBS = @GLIB_LIBS@
|
||||
GMOFILES = @GMOFILES@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GT_NO = @GT_NO@
|
||||
GT_YES = @GT_YES@
|
||||
INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
|
||||
INSTOBJEXT = @INSTOBJEXT@
|
||||
INTLDEPS = @INTLDEPS@
|
||||
INTLBISON = @INTLBISON@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@
|
||||
LIBICONV = @LIBICONV@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
PACKAGE = @PACKAGE@
|
||||
@@ -85,16 +87,18 @@ RANLIB = @RANLIB@
|
||||
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
l = @l@
|
||||
|
||||
bin_PROGRAMS = nano
|
||||
nano_SOURCES = cut.c files.c global.c move.c nano.c nano.h proto.h search.c utils.c winio.c
|
||||
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 = @INTLLIBS@
|
||||
|
||||
EXTRA_DIST = AUTHORS BUGS COPYING ChangeLog INSTALL NEWS README TODO install-sh missing mkinstalldirs nano.1 nano.1.html faq.html
|
||||
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
|
||||
|
||||
|
||||
SUBDIRS = po intl
|
||||
@@ -112,21 +116,26 @@ DEFS = @DEFS@ -I. -I$(srcdir) -I.
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
nano_OBJECTS = cut.o files.o global.o move.o nano.o search.o utils.o \
|
||||
winio.o
|
||||
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 TODO acconfig.h aclocal.m4 \
|
||||
config.h.in configure configure.in install-sh missing mkinstalldirs
|
||||
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)
|
||||
@@ -138,7 +147,7 @@ OBJECTS = $(nano_OBJECTS)
|
||||
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .S .c .o .s
|
||||
.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 --include-deps Makefile
|
||||
|
||||
@@ -230,6 +239,122 @@ 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)'; \
|
||||
@@ -399,7 +524,7 @@ distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
cp -pr $$/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
@@ -416,9 +541,10 @@ distdir: $(DISTFILES)
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
info-am:
|
||||
$(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info
|
||||
info-am: $(INFO_DEPS)
|
||||
info: info-recursive
|
||||
dvi-am:
|
||||
dvi-am: $(DVIS)
|
||||
dvi: dvi-recursive
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
@@ -430,21 +556,22 @@ all-recursive-am: config.h
|
||||
install-exec-am: install-binPROGRAMS
|
||||
install-exec: install-exec-recursive
|
||||
|
||||
install-data-am: install-man
|
||||
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-man
|
||||
uninstall-am: uninstall-binPROGRAMS uninstall-info uninstall-man
|
||||
uninstall: uninstall-recursive
|
||||
all-am: Makefile $(PROGRAMS) $(MANS) config.h
|
||||
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)$(mandir)/man1
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(infodir) \
|
||||
$(DESTDIR)$(mandir)/man1
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
@@ -457,25 +584,27 @@ distclean-generic:
|
||||
|
||||
maintainer-clean-generic:
|
||||
mostlyclean-am: mostlyclean-hdr mostlyclean-binPROGRAMS \
|
||||
mostlyclean-compile mostlyclean-tags \
|
||||
mostlyclean-compile mostlyclean-aminfo mostlyclean-tags \
|
||||
mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
clean-am: clean-hdr clean-binPROGRAMS clean-compile clean-tags \
|
||||
clean-generic mostlyclean-am
|
||||
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-tags distclean-generic clean-am
|
||||
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-tags \
|
||||
maintainer-clean-generic distclean-am
|
||||
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."
|
||||
|
||||
@@ -486,7 +615,9 @@ maintainer-clean: maintainer-clean-recursive
|
||||
mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
|
||||
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
|
||||
mostlyclean-compile distclean-compile clean-compile \
|
||||
maintainer-clean-compile install-man1 uninstall-man1 install-man \
|
||||
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 \
|
||||
|
||||
107
NEWS
107
NEWS
@@ -1,3 +1,46 @@
|
||||
07/15/2001 - GNU nano 1.1.0 is released. This is the first release
|
||||
in the 1.1.x unstable series of GNU nano. It
|
||||
incorporates all changes up to the 1.0.3 release,
|
||||
and also includes many many new features, including
|
||||
appending to as well as overwriting files, writing
|
||||
marked text to a separate file, dynamic wrap length,
|
||||
lots more compatibility with Pico, and new optional
|
||||
features like .nanorc file support and multiple file
|
||||
buffers! All in all, plenty of new stuff that's sure
|
||||
to introduce lots of bugs ;-) Have fun with it, but
|
||||
be careful, unstable means unstable.
|
||||
|
||||
04/06/2001 - GNU nano 1.0.1 is out there. The only new feature is a
|
||||
configure option for those who want to disable all
|
||||
word wrapping from nano, --disable-wrapping. Bug fixes
|
||||
this release include some bugs with autoconf and i18n,
|
||||
and several fixes in the file browser including a
|
||||
segfault on Solaris, symlinks to directories now work
|
||||
properly, and nano now sorts files case insensitively
|
||||
like pilot. Have fun with it.
|
||||
|
||||
03/22/2001 - GNU Nano 1.0 is released! The autoindent wrapping bug
|
||||
has been fixed, as well as strange bug when using Pico
|
||||
mode and regex search. There have also been some minor
|
||||
spelling and documentation updates. As stated on the
|
||||
website, there are currently no known bugs with nano, but
|
||||
some will pop up eventually and they will be addressed in
|
||||
subsequent releases. We hope you enjoy this first stable
|
||||
release of nano, and as always, feedback is welcome!
|
||||
nano@nano-editor.org.
|
||||
|
||||
02/19/2001 - Nano 0.9.99pre3 brings a lot of changes! The most important
|
||||
being that nano is now officially a GNU program. Some
|
||||
changes have been made for GNU compatibility (like the
|
||||
default list of shortcuts, "^G Get Help" is now Listed and
|
||||
"^_ Goto Line" is not). The Yes/No/All keys have
|
||||
finally been internationalized also. All in all, quite
|
||||
a few changes, considering nano is supposed to be in a code
|
||||
freeze. But there are the usual helping of bugfixes, a
|
||||
nasty bug when cutting text in -k mode and some
|
||||
compatibility issues with older ncurses libraries have also
|
||||
been fixed. All in all, a lot to see.
|
||||
|
||||
01/31/2001 - Nano 0.9.99pre2 is released. Not surprisingly, all that is
|
||||
new is bugfixes, bugfixes, bugfixes. There were a few
|
||||
cleanups in unneeded global variables and duplicate
|
||||
@@ -29,7 +72,7 @@
|
||||
tab completion in certain instances. Have fun and Happy
|
||||
New Year!
|
||||
|
||||
12/18/2000 - Nano 0.9.24 is released. This versions contains the last of
|
||||
12/18/2000 - Nano 0.9.24 is released. This version contains the last of
|
||||
the security fixes for writing files, as well as for a
|
||||
nasty segfault when nano is unable to open a file for
|
||||
reading, among other fixes. Nano also now cowardly
|
||||
@@ -43,7 +86,7 @@
|
||||
12/08/2000 - Nano 0.9.23 is the "race conditions bite" release. The
|
||||
main reason for this release is the less-than-optimal
|
||||
fix for the security issue in nano with following symbolic
|
||||
links. Hopefully this will fix the probelm permanently.
|
||||
links. Hopefully this will fix the problem permanently.
|
||||
The --nofollow option also works again for those who
|
||||
are real security nuts. There are also some display and
|
||||
search fixes, and the --disable-spell function was renamed
|
||||
@@ -83,10 +126,10 @@
|
||||
(courtesy of Mr. Rocco Corsi) and tab completion when
|
||||
reading in or writing out files! There's also the usual
|
||||
billion or so bug fixes. Feedback on this release is
|
||||
welcome because so much much has changed, especially with
|
||||
the previous string display in search and replace. Email
|
||||
-> nano@nano-editor.org <-. If you like something, don't
|
||||
like something, or just want to order a pizza, let us know!
|
||||
welcome because so much has changed, especially with the
|
||||
previous string display in search and replace. Email ->
|
||||
nano@nano-editor.org <-. If you like something, don't like
|
||||
something, or just want to order a pizza, let us know!
|
||||
|
||||
10/02/2000 - Nano 0.9.19 is the "Chris is getting married in less than
|
||||
a week and needs a distraction" release. There are only
|
||||
@@ -112,16 +155,16 @@
|
||||
flags (M-c, M-i, M-z, M-x, M-p, M-w, M-m, M-k and M-e for
|
||||
-c, -i, -x, -p, -w, -k, and -R).
|
||||
|
||||
08/09/2000 - Nano 0.9.16, after some struggling, is release. This release
|
||||
08/09/2000 - Nano 0.9.16, after some struggling, is released. This release
|
||||
should fix a few of the holes that 0.9.15 dug. The
|
||||
"cutting text on the first line" bug is fixed, as is the
|
||||
"cutting text on the last line" bug. Nice symmetry there
|
||||
huh? Also the --tabsize argument should now work as well
|
||||
as by using -T.
|
||||
|
||||
08/03/2000 - Nano 0.9.15 is the "I cant think of a release description"
|
||||
08/03/2000 - Nano 0.9.15 is the "I can't think of a release description"
|
||||
release. There are the usual gala of display bugfixes,
|
||||
a for the the nasty bug in -k mode that could create a
|
||||
a fix for the the nasty bug in -k mode that could create a
|
||||
loop in the file being edited, and some other code
|
||||
cleanup. Also, the -T option should now work regardless
|
||||
of the curses library used. Yay.
|
||||
@@ -130,7 +173,7 @@
|
||||
be skipped as a version number" release. One typo
|
||||
caused unending problems (calling nano with either -t or
|
||||
-k caused both flags to be used). The -k code is also now
|
||||
closer in functionality to Pico's -k mode, please
|
||||
closer in functionality to Pico's -k mode; please
|
||||
note that this code is not finished yet. Working on this
|
||||
code has made me realize that there is not enough
|
||||
abstraction in the code, and I will be working on that
|
||||
@@ -139,7 +182,7 @@
|
||||
|
||||
07/23/2000 - Nano 0.9.13 has a few new bits and bobs, most notably the
|
||||
-k option from Pico (cut to end of line). The majority
|
||||
of changes in this release are bugfixes however, including
|
||||
of changes in this release are bugfixes, however, including
|
||||
the usual display fixes and fixes for writing to symbolic
|
||||
links and un-writeable files. Barring any other major
|
||||
changes, this should be the feature set for nano 1.0,
|
||||
@@ -148,12 +191,12 @@
|
||||
07/07/2000 - Nano 0.9.12 (The "lucky day" release) is bursting with new
|
||||
features, bug fixes, and yummy fruit flavor. For
|
||||
changes, the alternate replace keystroke ^W^T is now
|
||||
^W^R to be compatible with later version of Pico.
|
||||
^W^R to be compatible with later versions of Pico.
|
||||
^W^T is now goto line, again for Pico compatibility.
|
||||
As for new features, the wonderful/hated magic line
|
||||
code has returned with a vengeance! Also, regular
|
||||
expression searches and replaces have been incorporated
|
||||
via the -R flag. And of course there are the usual
|
||||
via the -R flag. And, of course, there are the usual
|
||||
helping of display and other bug fixes to top it all
|
||||
off.
|
||||
|
||||
@@ -167,8 +210,8 @@
|
||||
this function just changes the way tabs LOOK in the
|
||||
editor, the tabs you input are still real tabs of normal
|
||||
width (usually 8 characters); nano just makes them look
|
||||
smaller or bigger whlie in the editor. New in the
|
||||
translation department is an indonesian translation (id).
|
||||
smaller or bigger while in the editor. New in the
|
||||
translation department is an Indonesian translation (id).
|
||||
|
||||
06/06/2000 - Nano 0.9.10 is primarily a bugfix for the loss of SIGINT when
|
||||
using "run and terminate" flags (for example, --help).
|
||||
@@ -187,7 +230,7 @@
|
||||
the resize crash people have been experiencing. It also
|
||||
offers a new input method that should allow nano to do
|
||||
things the right way (like ^S, ^Q, custom suspend keys)
|
||||
and hopefully wont break with non-US keyboards. There
|
||||
and hopefully won't break with non-US keyboards. There
|
||||
are also the obligatory display fixes and speedups. Have
|
||||
fun with it.
|
||||
|
||||
@@ -208,7 +251,7 @@
|
||||
05/01/2000 - Nano 0.9.5 attempts to speed up the display of text
|
||||
to be at least somewhat reasonable. Much
|
||||
code profiling has been done to reduce the
|
||||
rediculous number of redundant display updates. This
|
||||
ridiculous number of redundant display updates. This
|
||||
will probably expose a lot of bugs that can then be
|
||||
fixed, so this release is probably not for the faint
|
||||
of heart. For anyone curious, I would call nano 0.9.2
|
||||
@@ -234,7 +277,7 @@
|
||||
so it is being removed for the time being, and perhaps
|
||||
indefinitely.
|
||||
|
||||
Other new stuff includes a --emable-tiny option to make
|
||||
Other new stuff includes an --enable-tiny option to make
|
||||
nano ultra small (disabling i18n, detailed help and the
|
||||
marker and mouse code), and --with-slang to use the
|
||||
slang libraries instead of ncurses.
|
||||
@@ -261,7 +304,7 @@
|
||||
|
||||
04/07/2000 - Nano 0.9.0 has some updates, new language support and
|
||||
a much better refresh setup (It's still not great, but...)
|
||||
There should also be more stabillity editing long lines,
|
||||
There should also be more stability editing long lines,
|
||||
as there was a stupid mistake in the update_line
|
||||
call. Silly me =)
|
||||
|
||||
@@ -270,13 +313,13 @@
|
||||
Most things work, the rest doesn't doesn't work because
|
||||
(a) I can't fix it or I would have already done so, and
|
||||
(b) the amount of patches I'm receiving right now is quite
|
||||
negligible. Forrunately this release marks the first
|
||||
negligible. Fortunately, this release marks the first
|
||||
release since I have acquired ownership of the nano pages
|
||||
on SourceForge. Here's hoping SF will get us some more
|
||||
visibilitiy, translators and patches.
|
||||
visibility, translators and patches.
|
||||
|
||||
03/12/2000 - After a hiatus, I have finally moved (not unpacked though)
|
||||
to my new home into albany. Thus I should now have more
|
||||
to my new home into Albany. Thus I should now have more
|
||||
time to work on nano. Nano 0.8.8, the "dear god what
|
||||
broke this time?" release, incorporates patches for both
|
||||
i18n and many bugfixes. It is VERY likely something broke
|
||||
@@ -285,8 +328,8 @@
|
||||
|
||||
I would like to announce that I'm going to need
|
||||
translations soonish, so if you are fluent in other
|
||||
languages than english (or even better, if your native
|
||||
language is not english) and you would like to submit a
|
||||
languages than English (or even better, if your native
|
||||
language is not English) and you would like to submit a
|
||||
translation file to me, please feel free to do so. If you
|
||||
do, I will list your name and email in the AUTHORS file as
|
||||
the maintainer of the .po file, and from then on it is
|
||||
@@ -294,9 +337,9 @@
|
||||
|
||||
03/01/2000 - Well, to continue my trend of going back on my previous
|
||||
release's comments, nano 0.8.7 is released. The crashing
|
||||
behavior was still occuring, and this most recent fix also
|
||||
behavior was still occurring, and this most recent fix also
|
||||
fixes some other wrapping problems, so here you go.
|
||||
There may be another relase soon, there may not be, is
|
||||
There may be another release soon, there may not be, is
|
||||
that vague enough? =)
|
||||
|
||||
02/25/2000 - More minor bugfixes in 0.8.6, the bizarre behavior at the end
|
||||
@@ -323,11 +366,11 @@
|
||||
but I may be changing jobs very soon. I will release
|
||||
version 0.8.2 as is (no i18n, no help menu (yet). I
|
||||
expect things to settle down by the end of next week, and
|
||||
then I can try to start on the i18n support and help menu,
|
||||
then I can try to start on the i18n support and help menu;
|
||||
look for these new features in version 0.8.5 to 0.9.0.
|
||||
|
||||
01/28/2000 - Nano 0.8.1 marks our first official step toward
|
||||
internationaliation (i18n) and the help system (^G). I
|
||||
internationalization (i18n) and the help system (^G). I
|
||||
will be merging in Jordi's patches for initial i18n in the
|
||||
next version, and will implement the help system with
|
||||
i18n built into it shortly after that. Please don't
|
||||
@@ -336,14 +379,14 @@
|
||||
|
||||
01/25/2000 - Nano 0.8.0 is officially the 'let's try and be at least a
|
||||
little portable, mmmmkay?' release. There are many
|
||||
portability checks and fixes, many thanks to Andy Kahn for
|
||||
portability checks and fixes; many thanks to Andy Kahn for
|
||||
his patches. I removed the broken do_spell behavior with
|
||||
the 'spell' program, for now we only try to call 'ispell'
|
||||
the 'spell' program; for now, we only try to call 'ispell'
|
||||
until I write a better method to handle the output of the
|
||||
normal 'spell' command.
|
||||
|
||||
01/24/2000 - Nano 0.7.9 features many new features. Among them are a
|
||||
new autoindent feature (-i, --autoondent), tempfile
|
||||
new autoindent feature (-i, --autoindent), tempfile
|
||||
flag like Pico's -t flag (-t, --tempfile), and preliminary
|
||||
spelling program support. The spelling function tries
|
||||
to run 'spell' and then 'ispell' in that order, but you
|
||||
@@ -356,7 +399,7 @@
|
||||
all the changes in this release will cause a few bugs, so
|
||||
0.7.8 will primarily be about fixing those bugs.
|
||||
|
||||
Things added this release include resizeability (kinda),
|
||||
Things added this release include resizability (kinda),
|
||||
new -x and -c flags (see nano -h for help), long command
|
||||
line flag support, and the usual array of bugfixes.
|
||||
|
||||
|
||||
53
README
53
README
@@ -1,6 +1,6 @@
|
||||
|
||||
nano - a GPLed, enhanced clone of the Pico text editor.
|
||||
|
||||
GNU nano - an enhanced clone of the Pico text editor.
|
||||
|
||||
Overview
|
||||
|
||||
The nano project was started because of a few "problems" with the
|
||||
@@ -11,11 +11,14 @@ Overview
|
||||
redistribution. Because of this, Pine and Pico are not included with
|
||||
many GNU/Linux distributions. Also, other features (like goto line
|
||||
number or search and replace) were unavailable until recently or
|
||||
require a command-line flag. Yuck.
|
||||
require a command line flag. Yuck.
|
||||
|
||||
nano aims to solve these problems by emulating the functionality of
|
||||
Pico as closely as possible while adressing the problems above and
|
||||
Pico as closely as possible while addressing the problems above and
|
||||
perhaps providing other extra functionality.
|
||||
|
||||
The nano editor is now an official GNU package. For more information
|
||||
on GNU and the Free Software Foundation please see http://www.gnu.org.
|
||||
|
||||
How to compile and install nano
|
||||
|
||||
@@ -26,8 +29,8 @@ How to compile and install nano
|
||||
make
|
||||
make install
|
||||
|
||||
It's that simple. Use --prefix to override the default installation
|
||||
directory of /usr/local.
|
||||
It's that simple. Use --prefix with configure to override the
|
||||
default installation directory of /usr/local.
|
||||
|
||||
Web Page
|
||||
|
||||
@@ -50,27 +53,25 @@ Mailing List and Bug Reports
|
||||
|
||||
Current Status
|
||||
|
||||
nano is currently at version 0.9.x, and it will probably remain there
|
||||
for awhile. This reflects the adage that the last 10% of a project
|
||||
takes 90% of the time. Version 1.0 will be released when there are
|
||||
no unresolved bugs, and not before. I am also currently looking for
|
||||
patches for all things listed in the TODO file. If you have a
|
||||
comment or suggestion, please let me know, all help is appreciated.
|
||||
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
|
||||
interested in, please use the latest 1.0.x release of nano.
|
||||
|
||||
New features in this branch include:
|
||||
+ .nanorc file support (--enable-nanorc configure option,
|
||||
see sample.nanorc file)
|
||||
+ Negative -r value for "#cols from right", allows dynamic adjustment
|
||||
of wrap margin based on window size.
|
||||
+ Write marked text to separate file (^O after selecting with ^^).
|
||||
+ Append to file (Meta-A at write file menu).
|
||||
+ Multiple file buffers! (--enable-multibuffer configure option,
|
||||
--multibuffer, -F cmdline flag, Meta-F toggle, then ^R to load).
|
||||
+ Better compatibility with Pico. Mouse mode now supports clicking
|
||||
shortcuts and files in browser, search toggles that are Pico
|
||||
extensions moved to Meta keys so as to not interfere with Pico
|
||||
control sequences.
|
||||
|
||||
Warning: This program can and possibly will corrupt your data in
|
||||
its current form! It is beta software, so treat it as such!
|
||||
Thank you.
|
||||
|
||||
Note that the primary aim of nano is to emulate Pico while adding a
|
||||
few key "missing" features. I do NOT want just a GPL'ed Pico clone,
|
||||
nor do I want something that strays too far from the Pico design
|
||||
(simple and straightforward). If you don't like this, feel free to
|
||||
fork my code at any time, but please call your editor something
|
||||
else, believe it or not I struggled awhile before coming up with
|
||||
the name nano (and before that TIP), and it would be much easier for
|
||||
everyone if there weren't five versions of the same program. As you
|
||||
can guess, I'm not much of an emacs fan ;)
|
||||
|
||||
Chris Allegretta (chrisa@asty.org)
|
||||
|
||||
$Id$
|
||||
|
||||
30
THANKS
Normal file
30
THANKS
Normal file
@@ -0,0 +1,30 @@
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
Ken Tyler <kent@werple.net.au> Super bug tester and advice
|
||||
David Lawrence Ramsey <pooka_regent@sluggy.net> Patches galore
|
||||
Bill Soudan <wes0472@rit.edu> Regex code, etc
|
||||
Ben Armstrong <synrg@sanctuary.nslug.ns.ca> Negative -r value idea, code
|
||||
Jeremy Robichaud <robicj@yahoo.com> Beta tester
|
||||
Roy Lanek <lanek@ranahminang.net> Advice and advocacy
|
||||
Sven Guckes <guckes@math.fu-berlin.de> Advice and Advocacy
|
||||
Neil Parks <nparks@acsmail.com> Bug reports n fixes
|
||||
Chuck Mead <csm@MoonGroup.com> Feedback and RPM stuff
|
||||
Mike Melanson <melanson@pcisys.net> Bugs
|
||||
|
||||
|
||||
$Id$
|
||||
9
TODO
9
TODO
@@ -24,5 +24,14 @@ For Next Version:
|
||||
- Color syntax highlighting? (certainly seems like there's a demand for it.)
|
||||
- .nanorc ?????
|
||||
- Backup making (filename~)?
|
||||
- Search (etc) string history [1.1]
|
||||
- Implement Pico's -j and -g flags, as they are pretty easy to do.
|
||||
- Make mouse support work with clicking on the shortcuts (-m). Must
|
||||
make global variable pointing to current shortcut list to determine what
|
||||
keystroke to ungetch(). [DONE].
|
||||
- Implement -o (chroot of sorts)
|
||||
- Allow -r to take a negative argument, meaning right margin instead of
|
||||
left (allows resizing that way), formerly -W arg. [DONE]
|
||||
- UTF-8 support.
|
||||
|
||||
$Id$
|
||||
|
||||
22
acconfig.h
22
acconfig.h
@@ -3,6 +3,9 @@
|
||||
/* 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
|
||||
|
||||
@@ -44,3 +47,22 @@
|
||||
|
||||
/* 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
|
||||
|
||||
|
||||
530
aclocal.m4
vendored
530
aclocal.m4
vendored
@@ -125,6 +125,24 @@ for am_file in <<$1>>; do
|
||||
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"])
|
||||
]
|
||||
)
|
||||
|
||||
# Configure paths for GLIB
|
||||
# Owen Taylor 97-11-3
|
||||
|
||||
@@ -326,13 +344,41 @@ main ()
|
||||
# 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
|
||||
# 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 5
|
||||
# serial 9
|
||||
|
||||
AC_DEFUN(AM_WITH_NLS,
|
||||
dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]).
|
||||
dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library
|
||||
dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
|
||||
dnl depending on --{enable,disable}-{shared,static} and on the presence of
|
||||
dnl AM-DISABLE-SHARED). Otherwise, a static library
|
||||
dnl $(top_builddir)/intl/libintl.a will be created.
|
||||
dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
|
||||
dnl implementations (in libc or libintl) without the ngettext() function
|
||||
dnl will be ignored.
|
||||
dnl LIBDIR is used to find the intl libraries. If empty,
|
||||
dnl the value `$(top_builddir)/intl/' is used.
|
||||
dnl
|
||||
dnl The result of the configuration is one of three cases:
|
||||
dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
|
||||
dnl and used.
|
||||
dnl Catalog format: GNU --> install in $(datadir)
|
||||
dnl Catalog extension: .mo after installation, .gmo in source tree
|
||||
dnl 2) GNU gettext has been found in the system's C library.
|
||||
dnl Catalog format: GNU --> install in $(datadir)
|
||||
dnl Catalog extension: .mo after installation, .gmo in source tree
|
||||
dnl 3) No internationalization, always use English msgid.
|
||||
dnl Catalog format: none
|
||||
dnl Catalog extension: none
|
||||
dnl The use of .gmo is historical (it was needed to avoid overwriting the
|
||||
dnl GNU format catalogs when building on a platform with an X/Open gettext),
|
||||
dnl but we keep it in order not to force irrelevant filename changes on the
|
||||
dnl maintainers.
|
||||
dnl
|
||||
AC_DEFUN([AM_WITH_NLS],
|
||||
[AC_MSG_CHECKING([whether NLS is requested])
|
||||
dnl Default is enabled NLS
|
||||
AC_ARG_ENABLE(nls,
|
||||
@@ -341,11 +387,15 @@ AC_DEFUN(AM_WITH_NLS,
|
||||
AC_MSG_RESULT($USE_NLS)
|
||||
AC_SUBST(USE_NLS)
|
||||
|
||||
BUILD_INCLUDED_LIBINTL=no
|
||||
USE_INCLUDED_LIBINTL=no
|
||||
INTLLIBS=
|
||||
|
||||
dnl If we use NLS figure out what method
|
||||
if test "$USE_NLS" = "yes"; then
|
||||
AC_DEFINE(ENABLE_NLS)
|
||||
AC_DEFINE(ENABLE_NLS, 1,
|
||||
[Define to 1 if translation of program messages to the user's native language
|
||||
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],
|
||||
@@ -356,86 +406,74 @@ AC_DEFUN(AM_WITH_NLS,
|
||||
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=
|
||||
dnl to use. If GNU gettext is available we use this. Else we have
|
||||
dnl to fall back to GNU NLS library.
|
||||
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)])
|
||||
dnl Add a version number to the cache macros.
|
||||
define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc])
|
||||
define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl])
|
||||
|
||||
if test "$gt_cv_func_gettext_libc" != "yes"; then
|
||||
AC_CHECK_LIB(intl, bindtextdomain,
|
||||
[AC_CACHE_CHECK([for gettext in libintl],
|
||||
gt_cv_func_gettext_libintl,
|
||||
[AC_CHECK_LIB(intl, gettext,
|
||||
gt_cv_func_gettext_libintl=yes,
|
||||
gt_cv_func_gettext_libintl=no)],
|
||||
gt_cv_func_gettext_libintl=no)])
|
||||
AC_CHECK_HEADER(libintl.h,
|
||||
[AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
|
||||
[AC_TRY_LINK([#include <libintl.h>
|
||||
extern int _nl_msg_cat_cntr;],
|
||||
[bindtextdomain ("", "");
|
||||
return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
|
||||
gt_cv_func_gnugettext_libc=yes,
|
||||
gt_cv_func_gnugettext_libc=no)])
|
||||
|
||||
if test "$gt_cv_func_gnugettext_libc" != "yes"; then
|
||||
AC_CACHE_CHECK([for GNU gettext in libintl],
|
||||
gt_cv_func_gnugettext_libintl,
|
||||
[gt_save_LIBS="$LIBS"
|
||||
LIBS="$LIBS -lintl $LIBICONV"
|
||||
AC_TRY_LINK([#include <libintl.h>
|
||||
extern int _nl_msg_cat_cntr;],
|
||||
[bindtextdomain ("", "");
|
||||
return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
|
||||
gt_cv_func_gnugettext_libintl=yes,
|
||||
gt_cv_func_gnugettext_libintl=no)
|
||||
LIBS="$gt_save_LIBS"])
|
||||
fi
|
||||
|
||||
if test "$gt_cv_func_gettext_libc" = "yes" \
|
||||
|| test "$gt_cv_func_gettext_libintl" = "yes"; then
|
||||
AC_DEFINE(HAVE_GETTEXT)
|
||||
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)
|
||||
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
|
||||
dnl If an already present or preinstalled GNU gettext() is found,
|
||||
dnl use it. But if this macro is used in GNU gettext, and GNU
|
||||
dnl gettext is already preinstalled in libintl, we update this
|
||||
dnl libintl. (Cf. the install rule in intl/Makefile.in.)
|
||||
if test "$gt_cv_func_gnugettext_libc" = "yes" \
|
||||
|| { test "$gt_cv_func_gnugettext_libintl" = "yes" \
|
||||
&& test "$PACKAGE" != gettext; }; then
|
||||
AC_DEFINE(HAVE_GETTEXT, 1,
|
||||
[Define if the GNU gettext() function is already present or preinstalled.])
|
||||
|
||||
if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
|
||||
dnl If iconv() is in a separate libiconv library, then anyone
|
||||
dnl linking with libintl{.a,.so} also needs to link with
|
||||
dnl libiconv.
|
||||
INTLLIBS="-lintl $LIBICONV"
|
||||
fi
|
||||
|
||||
gt_save_LIBS="$LIBS"
|
||||
LIBS="$LIBS $INTLLIBS"
|
||||
AC_CHECK_FUNCS(dcgettext)
|
||||
LIBS="$gt_save_LIBS"
|
||||
|
||||
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_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
|
||||
fi
|
||||
|
||||
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||
|
||||
CATOBJEXT=.gmo
|
||||
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)
|
||||
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
|
||||
AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
|
||||
fi
|
||||
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 GNU gettext is not found in the C library.
|
||||
dnl Fall back on GNU gettext library.
|
||||
nls_cv_use_gnu_gettext=yes
|
||||
fi
|
||||
@@ -450,15 +488,11 @@ AC_DEFUN(AM_WITH_NLS,
|
||||
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||
AC_SUBST(MSGFMT)
|
||||
BUILD_INCLUDED_LIBINTL=yes
|
||||
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
|
||||
INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV"
|
||||
LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
|
||||
fi
|
||||
|
||||
dnl Test whether we really found GNU xgettext.
|
||||
@@ -474,25 +508,74 @@ AC_DEFUN(AM_WITH_NLS,
|
||||
fi
|
||||
fi
|
||||
|
||||
# We need to process the po/ directory.
|
||||
dnl 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
|
||||
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])
|
||||
[for ac_file in $CONFIG_FILES; do
|
||||
# Support "outfile[:infile[:infile...]]"
|
||||
case "$ac_file" in
|
||||
*:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
|
||||
esac
|
||||
# PO directories have a Makefile.in generated from Makefile.in.in.
|
||||
case "$ac_file" in */Makefile.in)
|
||||
# Adjust a relative srcdir.
|
||||
ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
|
||||
ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
|
||||
ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
|
||||
test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
|
||||
case "$ac_given_srcdir" in
|
||||
.) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
|
||||
/*) top_srcdir="$ac_given_srcdir" ;;
|
||||
*) top_srcdir="$ac_dots$ac_given_srcdir" ;;
|
||||
esac
|
||||
if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
|
||||
rm -f "$ac_dir/POTFILES"
|
||||
test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
|
||||
sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES"
|
||||
test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
|
||||
sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done])
|
||||
|
||||
|
||||
# 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.
|
||||
dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
|
||||
dnl to 'yes' because some of the testsuite requires it.
|
||||
if test "$PACKAGE" = gettext; then
|
||||
USE_NLS=yes
|
||||
USE_INCLUDED_LIBINTL=yes
|
||||
BUILD_INCLUDED_LIBINTL=yes
|
||||
fi
|
||||
|
||||
dnl intl/plural.c is generated from intl/plural.y. It requires bison,
|
||||
dnl because plural.y uses bison specific features. It requires at least
|
||||
dnl bison-1.26 because earlier versions generate a plural.c that doesn't
|
||||
dnl compile.
|
||||
dnl bison is only needed for the maintainer (who touches plural.y). But in
|
||||
dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
|
||||
dnl the rule in general Makefile. Now, some people carelessly touch the
|
||||
dnl files or have a broken "make" program, hence the plural.c rule will
|
||||
dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
|
||||
dnl present or too old.
|
||||
AC_CHECK_PROGS([INTLBISON], [bison])
|
||||
if test -z "$INTLBISON"; then
|
||||
ac_verc_fail=yes
|
||||
else
|
||||
dnl Found it, now check the version.
|
||||
AC_MSG_CHECKING([version of bison])
|
||||
changequote(<<,>>)dnl
|
||||
ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison .* \([0-9]*\.[0-9.]*\).*$/\1/p'`
|
||||
case $ac_prog_version in
|
||||
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
|
||||
1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
|
||||
changequote([,])dnl
|
||||
ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
|
||||
*) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
|
||||
esac
|
||||
AC_MSG_RESULT([$ac_prog_version])
|
||||
fi
|
||||
if test $ac_verc_fail = yes; then
|
||||
INTLBISON=:
|
||||
fi
|
||||
|
||||
dnl These rules are solely for the distribution goal. While doing this
|
||||
@@ -504,22 +587,38 @@ AC_DEFUN(AM_WITH_NLS,
|
||||
done
|
||||
|
||||
dnl Make all variables we use known to autoconf.
|
||||
AC_SUBST(BUILD_INCLUDED_LIBINTL)
|
||||
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)
|
||||
|
||||
dnl For backward compatibility. Some configure.ins may be using this.
|
||||
nls_cv_header_intl=
|
||||
nls_cv_header_libgt=
|
||||
|
||||
dnl For backward compatibility. Some Makefiles may be using this.
|
||||
DATADIRNAME=share
|
||||
AC_SUBST(DATADIRNAME)
|
||||
|
||||
dnl For backward compatibility. Some Makefiles may be using this.
|
||||
INSTOBJEXT=.mo
|
||||
AC_SUBST(INSTOBJEXT)
|
||||
|
||||
dnl For backward compatibility. Some Makefiles may be using this.
|
||||
GENCAT=gencat
|
||||
AC_SUBST(GENCAT)
|
||||
])
|
||||
|
||||
AC_DEFUN(AM_GNU_GETTEXT,
|
||||
dnl Usage: Just like AM_WITH_NLS, which see.
|
||||
AC_DEFUN([AM_GNU_GETTEXT],
|
||||
[AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
AC_REQUIRE([AC_ISC_POSIX])dnl
|
||||
AC_REQUIRE([AC_HEADER_STDC])dnl
|
||||
@@ -529,21 +628,18 @@ AC_DEFUN(AM_GNU_GETTEXT,
|
||||
AC_REQUIRE([AC_TYPE_SIZE_T])dnl
|
||||
AC_REQUIRE([AC_FUNC_ALLOCA])dnl
|
||||
AC_REQUIRE([AC_FUNC_MMAP])dnl
|
||||
AC_REQUIRE([jm_GLIBC21])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)
|
||||
fi
|
||||
AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
|
||||
stdlib.h string.h unistd.h sys/param.h])
|
||||
AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \
|
||||
getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \
|
||||
strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
|
||||
|
||||
AM_ICONV
|
||||
AM_LANGINFO_CODESET
|
||||
AM_LC_MESSAGES
|
||||
AM_WITH_NLS
|
||||
AM_WITH_NLS([$1],[$2],[$3])
|
||||
|
||||
if test "x$CATOBJEXT" != "x"; then
|
||||
if test "x$ALL_LINGUAS" = "x"; then
|
||||
@@ -551,10 +647,21 @@ strdup __argz_count __argz_stringify __argz_next])
|
||||
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
|
||||
for presentlang in $ALL_LINGUAS; do
|
||||
useit=no
|
||||
for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do
|
||||
# Use the presentlang catalog if desiredlang is
|
||||
# a. equal to presentlang, or
|
||||
# b. a variant of presentlang (because in this case,
|
||||
# presentlang can be used as a fallback for messages
|
||||
# which are not translated in the desiredlang catalog).
|
||||
case "$desiredlang" in
|
||||
"$presentlang"*) useit=yes;;
|
||||
esac
|
||||
done
|
||||
if test $useit = yes; then
|
||||
NEW_LINGUAS="$NEW_LINGUAS $presentlang"
|
||||
fi
|
||||
done
|
||||
LINGUAS=$NEW_LINGUAS
|
||||
AC_MSG_RESULT($LINGUAS)
|
||||
@@ -566,47 +673,8 @@ strdup __argz_count __argz_stringify __argz_next])
|
||||
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 find the mkinstalldirs script in another subdir but $(top_srcdir).
|
||||
dnl Try to locate is.
|
||||
MKINSTALLDIRS=
|
||||
if test -n "$ac_aux_dir"; then
|
||||
@@ -617,32 +685,16 @@ strdup __argz_count __argz_stringify __argz_next])
|
||||
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
|
||||
if test "x$srcdir" != "x."; then
|
||||
if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
|
||||
posrcprefix="$srcdir/"
|
||||
else
|
||||
posrcprefix="../$srcdir/"
|
||||
fi
|
||||
else
|
||||
posrcprefix="../"
|
||||
fi
|
||||
rm -f po/POTFILES
|
||||
sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
|
||||
< $srcdir/po/POTFILES.in > po/POTFILES
|
||||
dnl Enable libtool support if the surrounding package wishes it.
|
||||
INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])
|
||||
AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
|
||||
])
|
||||
|
||||
# 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
|
||||
# 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.
|
||||
|
||||
@@ -650,7 +702,7 @@ strdup __argz_count __argz_stringify __argz_next])
|
||||
|
||||
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,
|
||||
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])
|
||||
@@ -686,23 +738,139 @@ fi
|
||||
AC_SUBST($1)dnl
|
||||
])
|
||||
|
||||
#serial 2
|
||||
|
||||
# Test for the GNU C Library, version 2.1 or newer.
|
||||
# From Bruno Haible.
|
||||
|
||||
AC_DEFUN([jm_GLIBC21],
|
||||
[
|
||||
AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
|
||||
ac_cv_gnu_library_2_1,
|
||||
[AC_EGREP_CPP([Lucky GNU user],
|
||||
[
|
||||
#include <features.h>
|
||||
#ifdef __GNU_LIBRARY__
|
||||
#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
|
||||
Lucky GNU user
|
||||
#endif
|
||||
#endif
|
||||
],
|
||||
ac_cv_gnu_library_2_1=yes,
|
||||
ac_cv_gnu_library_2_1=no)
|
||||
]
|
||||
)
|
||||
AC_SUBST(GLIBC21)
|
||||
GLIBC21="$ac_cv_gnu_library_2_1"
|
||||
]
|
||||
)
|
||||
|
||||
#serial AM2
|
||||
|
||||
dnl From Bruno Haible.
|
||||
|
||||
AC_DEFUN([AM_ICONV],
|
||||
[
|
||||
dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
|
||||
dnl those with the standalone portable GNU libiconv installed).
|
||||
|
||||
AC_ARG_WITH([libiconv-prefix],
|
||||
[ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
|
||||
for dir in `echo "$withval" | tr : ' '`; do
|
||||
if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
|
||||
if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
|
||||
done
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
|
||||
am_cv_func_iconv="no, consider installing GNU libiconv"
|
||||
am_cv_lib_iconv=no
|
||||
AC_TRY_LINK([#include <stdlib.h>
|
||||
#include <iconv.h>],
|
||||
[iconv_t cd = iconv_open("","");
|
||||
iconv(cd,NULL,NULL,NULL,NULL);
|
||||
iconv_close(cd);],
|
||||
am_cv_func_iconv=yes)
|
||||
if test "$am_cv_func_iconv" != yes; then
|
||||
am_save_LIBS="$LIBS"
|
||||
LIBS="$LIBS -liconv"
|
||||
AC_TRY_LINK([#include <stdlib.h>
|
||||
#include <iconv.h>],
|
||||
[iconv_t cd = iconv_open("","");
|
||||
iconv(cd,NULL,NULL,NULL,NULL);
|
||||
iconv_close(cd);],
|
||||
am_cv_lib_iconv=yes
|
||||
am_cv_func_iconv=yes)
|
||||
LIBS="$am_save_LIBS"
|
||||
fi
|
||||
])
|
||||
if test "$am_cv_func_iconv" = yes; then
|
||||
AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
|
||||
AC_MSG_CHECKING([for iconv declaration])
|
||||
AC_CACHE_VAL(am_cv_proto_iconv, [
|
||||
AC_TRY_COMPILE([
|
||||
#include <stdlib.h>
|
||||
#include <iconv.h>
|
||||
extern
|
||||
#ifdef __cplusplus
|
||||
"C"
|
||||
#endif
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
|
||||
#else
|
||||
size_t iconv();
|
||||
#endif
|
||||
], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
|
||||
am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
|
||||
am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
|
||||
AC_MSG_RESULT([$]{ac_t:-
|
||||
}[$]am_cv_proto_iconv)
|
||||
AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
|
||||
[Define as const if the declaration of iconv() needs const.])
|
||||
fi
|
||||
LIBICONV=
|
||||
if test "$am_cv_lib_iconv" = yes; then
|
||||
LIBICONV="-liconv"
|
||||
fi
|
||||
AC_SUBST(LIBICONV)
|
||||
])
|
||||
|
||||
#serial AM1
|
||||
|
||||
dnl From Bruno Haible.
|
||||
|
||||
AC_DEFUN([AM_LANGINFO_CODESET],
|
||||
[
|
||||
AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
|
||||
[AC_TRY_LINK([#include <langinfo.h>],
|
||||
[char* cs = nl_langinfo(CODESET);],
|
||||
am_cv_langinfo_codeset=yes,
|
||||
am_cv_langinfo_codeset=no)
|
||||
])
|
||||
if test $am_cv_langinfo_codeset = yes; then
|
||||
AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
|
||||
[Define if you have <langinfo.h> and nl_langinfo(CODESET).])
|
||||
fi
|
||||
])
|
||||
|
||||
# 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
|
||||
# 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
|
||||
# serial 2
|
||||
|
||||
AC_DEFUN(AM_LC_MESSAGES,
|
||||
AC_DEFUN([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)
|
||||
AC_DEFINE(HAVE_LC_MESSAGES, 1,
|
||||
[Define if your <locale.h> file defines LC_MESSAGES.])
|
||||
fi
|
||||
fi])
|
||||
|
||||
|
||||
123
color.c
Normal file
123
color.c
Normal file
@@ -0,0 +1,123 @@
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* color.c *
|
||||
* *
|
||||
* 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) *
|
||||
* any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#include <libintl.h>
|
||||
#define _(string) gettext(string)
|
||||
#else
|
||||
#define _(string) (string)
|
||||
#endif
|
||||
|
||||
void color_on(WINDOW *win, int whatever)
|
||||
{
|
||||
/* Temporary fallback, if the color value hasn't been set,
|
||||
turn on hilighting */
|
||||
if (!colors[whatever - FIRST_COLORNUM].set) {
|
||||
wattron(win, A_REVERSE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (colors[whatever - FIRST_COLORNUM].bold)
|
||||
wattron(win, A_BOLD);
|
||||
|
||||
/* If the foreground color is black, we've switched fg and bg (see
|
||||
the comment in colorinit_one() about this) so turn on reverse so
|
||||
it looks like it's supposed to */
|
||||
if (colors[whatever - FIRST_COLORNUM].fg == COLOR_BLACK)
|
||||
wattron(win, A_REVERSE);
|
||||
|
||||
wattron(win, COLOR_PAIR(whatever));
|
||||
|
||||
}
|
||||
|
||||
void color_off(WINDOW *win, int whatever)
|
||||
{
|
||||
if (!colors[whatever - FIRST_COLORNUM].set) {
|
||||
wattroff(win, A_REVERSE);
|
||||
return;
|
||||
}
|
||||
|
||||
wattroff(win, COLOR_PAIR(whatever));
|
||||
|
||||
if (colors[whatever - FIRST_COLORNUM].fg == COLOR_BLACK)
|
||||
wattroff(win, A_REVERSE);
|
||||
|
||||
if (colors[whatever - FIRST_COLORNUM].bold)
|
||||
wattroff(win, A_BOLD);
|
||||
}
|
||||
|
||||
|
||||
void colorinit_one(int colortoset, short fg, short bg, int bold)
|
||||
{
|
||||
colors[colortoset - FIRST_COLORNUM].fg = fg;
|
||||
colors[colortoset - FIRST_COLORNUM].bg = bg;
|
||||
colors[colortoset - FIRST_COLORNUM].bold = bold;
|
||||
colors[colortoset - FIRST_COLORNUM].set = 1;
|
||||
|
||||
/* Okay, so if they want a black foreground, do a switch on the fg
|
||||
and bg, because specifying black as the foreground color gives
|
||||
this ugly grey color. Then in color_on we will turn A_REVERSE
|
||||
which is probably what they want it to look like... */
|
||||
if (fg == COLOR_BLACK)
|
||||
init_pair(colortoset, bg, fg);
|
||||
else
|
||||
init_pair(colortoset, fg, bg);
|
||||
}
|
||||
|
||||
int do_colorinit(void)
|
||||
{
|
||||
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();
|
||||
#endif
|
||||
/* Some defaults values to play with */
|
||||
|
||||
/* Okay I'll be nice and comment these out for the commit =)
|
||||
colorinit_one(COLOR_TITLEBAR, COLOR_GREEN, COLOR_BLUE, 1);
|
||||
colorinit_one(COLOR_BOTTOMBARS, COLOR_GREEN, COLOR_BLUE, 1);
|
||||
colorinit_one(COLOR_STATUSBAR, COLOR_BLACK, COLOR_CYAN, 0);
|
||||
colorinit_one(COLOR_TEXT, COLOR_WHITE, COLOR_BLACK, 0);
|
||||
colorinit_one(COLOR_MARKER, COLOR_BLACK, COLOR_CYAN, 0);
|
||||
*/
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
1183
config.guess
vendored
Normal file
1183
config.guess
vendored
Normal file
File diff suppressed because it is too large
Load Diff
96
config.h.in
96
config.h.in
@@ -1,4 +1,4 @@
|
||||
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
/* config.h.in. Generated automatically from configure.in by autoheader 2.13. */
|
||||
|
||||
/* Define if using alloca.c. */
|
||||
#undef C_ALLOCA
|
||||
@@ -31,9 +31,6 @@
|
||||
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||
#undef off_t
|
||||
|
||||
/* Define if you need to in order for stat and other things to work. */
|
||||
#undef _POSIX_SOURCE
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
@@ -55,24 +52,12 @@
|
||||
/* 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 if you have NLS */
|
||||
#undef ENABLE_NLS
|
||||
|
||||
/* Define this is you have the catgets command */
|
||||
#undef HAVE_CATGETS
|
||||
|
||||
/* Define this is you have GNU gettext */
|
||||
#undef HAVE_GETTEXT
|
||||
|
||||
/* Define this for HAVE_LC_MESSAGES */
|
||||
#undef HAVE_LC_MESSAGES
|
||||
|
||||
/* Define this if you have the stpcpy function (cool) */
|
||||
#undef HAVE_STPCPY
|
||||
|
||||
/* Define this to make the nano executable as small as possible */
|
||||
#undef NANO_SMALL
|
||||
|
||||
@@ -97,6 +82,24 @@
|
||||
/* 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
|
||||
|
||||
@@ -109,15 +112,36 @@
|
||||
/* Define if you have the dcgettext function. */
|
||||
#undef HAVE_DCGETTEXT
|
||||
|
||||
/* Define if you have the feof_unlocked function. */
|
||||
#undef HAVE_FEOF_UNLOCKED
|
||||
|
||||
/* Define if you have the fgets_unlocked function. */
|
||||
#undef HAVE_FGETS_UNLOCKED
|
||||
|
||||
/* Define if you have the getcwd function. */
|
||||
#undef HAVE_GETCWD
|
||||
|
||||
/* Define if you have the getegid function. */
|
||||
#undef HAVE_GETEGID
|
||||
|
||||
/* Define if you have the geteuid function. */
|
||||
#undef HAVE_GETEUID
|
||||
|
||||
/* Define if you have the getgid function. */
|
||||
#undef HAVE_GETGID
|
||||
|
||||
/* 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 getuid function. */
|
||||
#undef HAVE_GETUID
|
||||
|
||||
/* Define if you have the mempcpy function. */
|
||||
#undef HAVE_MEMPCPY
|
||||
|
||||
/* Define if you have the munmap function. */
|
||||
#undef HAVE_MUNMAP
|
||||
|
||||
@@ -145,6 +169,12 @@
|
||||
/* Define if you have the strdup function. */
|
||||
#undef HAVE_STRDUP
|
||||
|
||||
/* Define if you have the strtoul function. */
|
||||
#undef HAVE_STRTOUL
|
||||
|
||||
/* Define if you have the tsearch function. */
|
||||
#undef HAVE_TSEARCH
|
||||
|
||||
/* Define if you have the vsnprintf function. */
|
||||
#undef HAVE_VSNPRINTF
|
||||
|
||||
@@ -178,6 +208,12 @@
|
||||
/* Define if you have the <regex.h> header file. */
|
||||
#undef HAVE_REGEX_H
|
||||
|
||||
/* Define if you have the <stddef.h> header file. */
|
||||
#undef HAVE_STDDEF_H
|
||||
|
||||
/* Define if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
@@ -193,12 +229,28 @@
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define if you have the i library (-li). */
|
||||
#undef HAVE_LIBI
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define if you have the iconv() function. */
|
||||
#undef HAVE_ICONV
|
||||
|
||||
/* Define as const if the declaration of iconv() needs const. */
|
||||
#undef ICONV_CONST
|
||||
|
||||
/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
|
||||
#undef HAVE_LANGINFO_CODESET
|
||||
|
||||
/* Define if your <locale.h> file defines LC_MESSAGES. */
|
||||
#undef HAVE_LC_MESSAGES
|
||||
|
||||
/* Define to 1 if translation of program messages to the user's native language
|
||||
is requested. */
|
||||
#undef ENABLE_NLS
|
||||
|
||||
/* Define if the GNU gettext() function is already present or preinstalled. */
|
||||
#undef HAVE_GETTEXT
|
||||
|
||||
|
||||
1268
config.sub
vendored
Normal file
1268
config.sub
vendored
Normal file
File diff suppressed because it is too large
Load Diff
86
configure.in
86
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, 0.9.99pre2)
|
||||
AM_INIT_AUTOMAKE(nano, 1.1.0)
|
||||
AM_CONFIG_HEADER(config.h:config.h.in)
|
||||
ALL_LINGUAS="es de fr it id fi"
|
||||
ALL_LINGUAS="es de fr it id fi hu ca cs gl uk ru sv no"
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_PROG_CC
|
||||
@@ -15,7 +15,7 @@ AC_CHECK_HEADERS(fcntl.h unistd.h malloc.h termios.h termio.h limits.h getopt.h
|
||||
|
||||
dnl options
|
||||
AC_ARG_ENABLE(tiny,
|
||||
[ --enable-tiny Disables features for the sake of size
|
||||
[ --enable-tiny Disable features for the sake of size
|
||||
(currently disables detailed help and i18n)],
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(NANO_SMALL) tiny_support=yes
|
||||
@@ -24,16 +24,44 @@ AC_ARG_ENABLE(tiny,
|
||||
AC_DEFINE(DISABLE_HELP)
|
||||
AC_DEFINE(DISABLE_JUSTIFY)
|
||||
AC_DEFINE(DISABLE_BROWSER)
|
||||
AC_DEFINE(DISABLE_MOUSE)
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(extra,
|
||||
[ --enable-extra Enable extra (optional) functions, including easter eggs],
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(NANO_EXTRA) extra_support=yes
|
||||
AC_DEFINE(ENABLE_MULTIBUFFER) multibuffer_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],
|
||||
[if test x$enableval = xyes && test x$tiny_support != xyes; then
|
||||
AC_DEFINE(ENABLE_MULTIBUFFER) multibuffer_support=yes
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(nanorc,
|
||||
[ --enable-nanorc Enable use of .nanorc file],
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(ENABLE_NANORC) nanorc_support=yes
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(color,
|
||||
[ --enable-color Enable color and syntax highlighting],
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(ENABLE_NANORC) nanorc_support=yes
|
||||
AC_DEFINE(ENABLE_COLOR) color_support=yes
|
||||
AC_MSG_WARN([
|
||||
|
||||
***********************************************************************
|
||||
*** WARNING: Color support is currently BROKEN. Don't expect it to ***
|
||||
*** work AT ALL until more is implemented. ***
|
||||
***********************************************************************
|
||||
])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(tabcomp,
|
||||
[ --disable-tabcomp Disables tab completion code for a smaller binary],
|
||||
[ --disable-tabcomp Disable tab completion code for a smaller binary],
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_TABCOMP)
|
||||
fi])
|
||||
@@ -45,24 +73,36 @@ AC_ARG_ENABLE(justify,
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(speller,
|
||||
[ --disable-speller Disables spell checker function],
|
||||
[ --disable-speller Disable spell checker function],
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_SPELLER)
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(help,
|
||||
[ --disable-help Disables help function (^G)],
|
||||
[ --disable-help Disable help function (^G)],
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_HELP)
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(browser,
|
||||
[ --disable-browser Disables mini file browser],
|
||||
[ --disable-browser Disable mini file browser],
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_BROWSER)
|
||||
fi])
|
||||
|
||||
AC_MSG_CHECKING(whether to use slang)
|
||||
AC_ARG_ENABLE(wrapping,
|
||||
[ --disable-wrapping Disable all wrapping of text (and -w flag)],
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_WRAPPING)
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(mouse,
|
||||
[ --disable-mouse Disable mouse support (and -m flag)],
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_MOUSE)
|
||||
fi])
|
||||
|
||||
AC_MSG_CHECKING([whether to use slang])
|
||||
CURSES_LIB_NAME=""
|
||||
AC_ARG_WITH(slang,
|
||||
[ --with-slang[=DIR] Use the slang library instead of curses],
|
||||
@@ -80,7 +120,7 @@ AC_ARG_WITH(slang,
|
||||
fi
|
||||
|
||||
AC_CHECK_HEADER(slcurses.h,
|
||||
AC_MSG_CHECKING(for SLtt_initialize in -lslang)
|
||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang])
|
||||
_libs=$LIBS
|
||||
LIBS="$LIBS -lslang"
|
||||
AC_TRY_RUN([
|
||||
@@ -99,11 +139,11 @@ int main () { SLtt_initialize (NULL); return 0; }],
|
||||
AC_MSG_RESULT(no)
|
||||
# We might need the term library
|
||||
for termlib in ncurses curses termcap terminfo termlib; do
|
||||
AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"])
|
||||
AC_CHECK_LIB([${termlib}], tputs, [tcap="-l$termlib"])
|
||||
test -n "$tcap" && break
|
||||
done
|
||||
|
||||
AC_MSG_CHECKING(for SLtt_initialize in -lslang $tcap)
|
||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap])
|
||||
LIBS="$LIBS $tcap"
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
@@ -120,7 +160,7 @@ int main () { SLtt_initialize (NULL); return 0; }],
|
||||
CURSES_LIB_NAME=slang], [
|
||||
AC_MSG_RESULT(no)
|
||||
# We might need the math library
|
||||
AC_MSG_CHECKING(for SLtt_initialize in -lslang $tcap -lm)
|
||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap -lm])
|
||||
LIBS="$LIBS -lm"
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
@@ -152,17 +192,17 @@ AC_MSG_WARN([*** Can not use slang when cross-compiling])),
|
||||
LDFLAGS=${_ldflags}
|
||||
fi
|
||||
;;
|
||||
esac], AC_MSG_RESULT(no))
|
||||
esac], [AC_MSG_RESULT(no)])
|
||||
|
||||
dnl Checks for functions
|
||||
AC_CHECK_FUNCS(snprintf vsnprintf)
|
||||
if test "x$ac_cv_func_snprintf" = "xno" -o "xac_cv_func_vsnprintf" = "xno"
|
||||
then
|
||||
AM_PATH_GLIB(1.2.4,,
|
||||
AC_MSG_ERROR([
|
||||
[AC_MSG_ERROR([
|
||||
*** snprintf() and/or vsnprintf() not found. GLIB not found either.
|
||||
*** You need both snprintf() and vsnprintf(). Alternatively you can
|
||||
*** install the GLIB library which can be found at ftp://ftp.gtk.org/.]),
|
||||
*** install the GLIB library which can be found at ftp://ftp.gtk.org/.])],
|
||||
glib)
|
||||
glib_cflags=`$GLIB_CONFIG --cflags glib`
|
||||
glib_libs=`$GLIB_CONFIG --libs glib`
|
||||
@@ -181,23 +221,23 @@ dnl Checks for libraries.
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
AC_CHECK_HEADERS(curses.h ncurses.h)
|
||||
AC_CHECK_LIB(ncurses, tgetent,CURSES_LIB="-lncurses" CURSES_LIB_NAME=ncurses)
|
||||
AC_CHECK_LIB(ncurses, tgetent, [CURSES_LIB="-lncurses" CURSES_LIB_NAME=ncurses])
|
||||
fi
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
AC_CHECK_LIB(curses, tgetent, CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses)
|
||||
AC_CHECK_LIB(curses, tgetent, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses])
|
||||
fi
|
||||
|
||||
# Fallback for PDCurses and less useful curses libs...
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
AC_CHECK_LIB(curses, initscr, CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses)
|
||||
AC_CHECK_LIB(curses, initscr, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses])
|
||||
fi
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
AC_CHECK_LIB(termcap, tgetent, CURSES_LIB="-ltermcap" CURSES_LIB_NAME=termcap)
|
||||
AC_CHECK_LIB(termcap, tgetent, [CURSES_LIB="-ltermcap" CURSES_LIB_NAME=termcap])
|
||||
fi
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
@@ -207,15 +247,17 @@ then
|
||||
*** distribution from ftp://ftp.gnu.org/pub/gnu/ncurses if you get
|
||||
*** errors compiling nano.])
|
||||
else
|
||||
AC_MSG_RESULT("Using $CURSES_LIB_NAME as the termcap library")
|
||||
AC_MSG_RESULT([Using $CURSES_LIB_NAME as the termcap library])
|
||||
fi
|
||||
|
||||
|
||||
AC_CHECK_LIB([$CURSES_LIB_NAME], use_default_colors, [AC_DEFINE(HAVE_USE_DEFAULT_COLORS)])
|
||||
if test x$slang_support != xyes; then
|
||||
AC_CHECK_LIB($CURSES_LIB_NAME, wresize, AC_DEFINE(HAVE_WRESIZE))
|
||||
AC_CHECK_LIB([$CURSES_LIB_NAME], wresize, [AC_DEFINE(HAVE_WRESIZE)])
|
||||
AC_CHECK_LIB([$CURSES_LIB_NAME], resizeterm, [AC_DEFINE(HAVE_RESIZETERM)])
|
||||
|
||||
# Taken from aumix (can't tell form the variable name?)
|
||||
AC_CACHE_CHECK(for private member _use_keypad in WINDOW,
|
||||
AC_CACHE_CHECK([for private member _use_keypad in WINDOW],
|
||||
aumix_cv_struct_window_usekeypad,
|
||||
[AC_TRY_COMPILE([#ifdef HAVE_NCURSES_H
|
||||
#include <ncurses.h>
|
||||
|
||||
215
cut.c
215
cut.c
@@ -19,10 +19,11 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "config.h"
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
@@ -38,15 +39,12 @@ static filestruct *cutbottom = NULL; /* Pointer to end of cutbuffer */
|
||||
|
||||
void add_to_cutbuffer(filestruct * inptr)
|
||||
{
|
||||
filestruct *tmp;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("add_to_cutbuffer called with inptr->data = %s\n"),
|
||||
inptr->data);
|
||||
#endif
|
||||
|
||||
totsize -= strlen(inptr->data);
|
||||
tmp = cutbuffer;
|
||||
if (cutbuffer == NULL) {
|
||||
cutbuffer = inptr;
|
||||
inptr->prev = NULL;
|
||||
@@ -60,28 +58,76 @@ void add_to_cutbuffer(filestruct * inptr)
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* Cut a marked segment instead of a whole line. Only called from
|
||||
do_cut_text().
|
||||
destructive is whether to actually modify the file structure, if not then
|
||||
just copy the buffer into cutbuffer and don't pull it from the file */
|
||||
|
||||
void cut_marked_segment(filestruct * top, int top_x, filestruct * bot,
|
||||
int bot_x)
|
||||
int bot_x, int destructive)
|
||||
{
|
||||
filestruct *tmp, *next;
|
||||
filestruct *tmp, *next, *botcopy;
|
||||
char *tmpstr;
|
||||
int newsize;
|
||||
|
||||
/* Special case for cutting part of one line */
|
||||
if (top == bot) {
|
||||
int swap;
|
||||
|
||||
tmp = copy_node(top);
|
||||
newsize = abs(bot_x - top_x) + 1;
|
||||
tmpstr = charalloc(newsize + 1);
|
||||
|
||||
/* Make top_x always be before bot_x */
|
||||
if (top_x > bot_x) {
|
||||
swap = top_x;
|
||||
top_x = bot_x;
|
||||
bot_x = swap;
|
||||
}
|
||||
|
||||
strncpy(tmpstr, &top->data[top_x], newsize);
|
||||
|
||||
if (destructive) {
|
||||
memmove(&top->data[top_x], &top->data[bot_x],
|
||||
strlen(&top->data[bot_x]) + 1);
|
||||
align(&top->data);
|
||||
current_x = top_x;
|
||||
update_cursor();
|
||||
}
|
||||
tmpstr[newsize - 1] = 0;
|
||||
tmp->data = tmpstr;
|
||||
add_to_cutbuffer(tmp);
|
||||
dump_buffer(cutbuffer);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set up the beginning of the cutbuffer */
|
||||
tmp = copy_node(top);
|
||||
tmpstr = nmalloc(strlen(&top->data[top_x]) + 1);
|
||||
tmpstr = charalloc(strlen(&top->data[top_x]) + 1);
|
||||
strcpy(tmpstr, &top->data[top_x]);
|
||||
free(tmp->data);
|
||||
tmp->data = tmpstr;
|
||||
|
||||
/* Chop off the end of the first line */
|
||||
tmpstr = nmalloc(top_x + 1);
|
||||
tmpstr = charalloc(top_x + 1);
|
||||
strncpy(tmpstr, top->data, top_x);
|
||||
free(top->data);
|
||||
top->data = tmpstr;
|
||||
|
||||
if (destructive) {
|
||||
free(top->data);
|
||||
top->data = tmpstr;
|
||||
}
|
||||
|
||||
do {
|
||||
next = tmp->next;
|
||||
add_to_cutbuffer(tmp);
|
||||
if (destructive)
|
||||
add_to_cutbuffer(tmp);
|
||||
else {
|
||||
filestruct *tmpcopy = NULL;
|
||||
|
||||
tmpcopy = copy_node(tmp);
|
||||
add_to_cutbuffer(tmpcopy);
|
||||
}
|
||||
totlines--;
|
||||
totsize--; /* newline (add_to_cutbuffer doesn't count newlines) */
|
||||
tmp = next;
|
||||
@@ -91,40 +137,54 @@ void cut_marked_segment(filestruct * top, int top_x, filestruct * bot,
|
||||
dump_buffer(cutbuffer);
|
||||
if (next == NULL)
|
||||
return;
|
||||
|
||||
/* Now, paste bot[bot_x] into top[top_x] */
|
||||
tmpstr = nmalloc(strlen(top->data) + strlen(&bot->data[bot_x]));
|
||||
strncpy(tmpstr, top->data, top_x);
|
||||
strcpy(&tmpstr[top_x], &bot->data[bot_x]);
|
||||
free(top->data);
|
||||
top->data = tmpstr;
|
||||
if (destructive) {
|
||||
|
||||
null_at(bot->data, bot_x);
|
||||
next = bot->next;
|
||||
tmpstr = charalloc(strlen(top->data) + strlen(&bot->data[bot_x]));
|
||||
strncpy(tmpstr, top->data, top_x);
|
||||
strcpy(&tmpstr[top_x], &bot->data[bot_x]);
|
||||
free(top->data);
|
||||
top->data = tmpstr;
|
||||
|
||||
/* We explicitly don't decrement totlines here because we don't snarf
|
||||
* up a newline when we're grabbing the last line of the mark. For
|
||||
* the same reason we don't do an extra totsize decrement */
|
||||
|
||||
add_to_cutbuffer(bot);
|
||||
top->next = next;
|
||||
if (next != NULL)
|
||||
next->prev = top;
|
||||
|
||||
dump_buffer(cutbuffer);
|
||||
renumber(top);
|
||||
current = top;
|
||||
current_x = top_x;
|
||||
|
||||
/* If we're hitting the end of the buffer we should clean that up. */
|
||||
if (bot == filebot) {
|
||||
if (next != NULL) {
|
||||
filebot = next;
|
||||
} else {
|
||||
filebot = top;
|
||||
}
|
||||
/* We explicitly don't decrement totlines here because we don't snarf
|
||||
* up a newline when we're grabbing the last line of the mark. For
|
||||
* the same reason, we don't do an extra totsize decrement. */
|
||||
}
|
||||
|
||||
/* I honestly do not know why this is needed. After many hours of
|
||||
using gdb on an OpenBSD box, I can honestly say something is
|
||||
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);
|
||||
next = botcopy->next;
|
||||
add_to_cutbuffer(botcopy);
|
||||
|
||||
|
||||
if (destructive) {
|
||||
free(bot);
|
||||
|
||||
top->next = next;
|
||||
if (next != NULL)
|
||||
next->prev = top;
|
||||
|
||||
dump_buffer(cutbuffer);
|
||||
renumber(top);
|
||||
current = top;
|
||||
current_x = top_x;
|
||||
|
||||
/* If we're hitting the end of the buffer, we should clean that up. */
|
||||
if (bot == filebot) {
|
||||
if (next != NULL) {
|
||||
filebot = next;
|
||||
} else {
|
||||
filebot = top;
|
||||
}
|
||||
}
|
||||
if (top->lineno < edittop->lineno)
|
||||
edit_update(top, CENTER);
|
||||
}
|
||||
if (top->lineno < edittop->lineno)
|
||||
edit_update(top, CENTER);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -132,10 +192,10 @@ int do_cut_text(void)
|
||||
{
|
||||
filestruct *tmp, *fileptr = current;
|
||||
#ifndef NANO_SMALL
|
||||
char *tmpstr;
|
||||
int newsize, cuttingtoend = 0;
|
||||
int cuttingtoend = 0;
|
||||
#endif
|
||||
|
||||
|
||||
check_statblank();
|
||||
if (fileptr == NULL || fileptr->data == NULL)
|
||||
return 0;
|
||||
@@ -146,6 +206,7 @@ int do_cut_text(void)
|
||||
free_filestruct(cutbuffer);
|
||||
cutbuffer = NULL;
|
||||
|
||||
marked_cut = 0;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("Blew away cutbuffer =)\n"));
|
||||
#endif
|
||||
@@ -158,6 +219,23 @@ int do_cut_text(void)
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(CUT_TO_END) && !ISSET(MARK_ISSET)) {
|
||||
if (current_x == strlen(current->data)) {
|
||||
|
||||
/* If the line is empty and we didn't just cut a non-blank
|
||||
line, create a dummy line and add it to the cutbuffer */
|
||||
if (marked_cut != 1 && current->next != filebot) {
|
||||
|
||||
filestruct *junk;
|
||||
|
||||
junk = NULL;
|
||||
junk = make_new_node(current);
|
||||
junk->data = nmalloc(1 * sizeof (char));
|
||||
junk->data[0] = 0;
|
||||
|
||||
add_to_cutbuffer(junk);
|
||||
dump_buffer(cutbuffer);
|
||||
|
||||
}
|
||||
|
||||
do_delete();
|
||||
SET(KEEP_CUTBUFFER);
|
||||
marked_cut = 2;
|
||||
@@ -172,36 +250,12 @@ int do_cut_text(void)
|
||||
}
|
||||
}
|
||||
if (ISSET(MARK_ISSET)) {
|
||||
if (current->lineno == mark_beginbuf->lineno) {
|
||||
tmp = copy_node(current);
|
||||
newsize = abs(strlen(¤t->data[mark_beginx]) -
|
||||
strlen(¤t->data[current_x]));
|
||||
|
||||
tmpstr = nmalloc(newsize);
|
||||
if (current_x < mark_beginx) {
|
||||
strncpy(tmpstr, ¤t->data[current_x], newsize);
|
||||
memmove(¤t->data[current_x],
|
||||
¤t->data[mark_beginx],
|
||||
strlen(¤t->data[mark_beginx] - newsize));
|
||||
} else {
|
||||
strncpy(tmpstr, ¤t->data[mark_beginx], newsize);
|
||||
memmove(¤t->data[mark_beginx],
|
||||
¤t->data[current_x],
|
||||
strlen(¤t->data[current_x] - newsize));
|
||||
current_x = mark_beginx;
|
||||
update_cursor();
|
||||
}
|
||||
tmpstr[newsize] = 0;
|
||||
tmp->data = tmpstr;
|
||||
add_to_cutbuffer(tmp);
|
||||
dump_buffer(cutbuffer);
|
||||
align(¤t->data);
|
||||
} else if (current->lineno < mark_beginbuf->lineno)
|
||||
if (current->lineno <= mark_beginbuf->lineno)
|
||||
cut_marked_segment(current, current_x, mark_beginbuf,
|
||||
mark_beginx);
|
||||
mark_beginx, 1);
|
||||
else
|
||||
cut_marked_segment(mark_beginbuf, mark_beginx, current,
|
||||
current_x);
|
||||
current_x, 1);
|
||||
|
||||
placewewant = xplustabs();
|
||||
UNSET(MARK_ISSET);
|
||||
@@ -232,7 +286,7 @@ int do_cut_text(void)
|
||||
} else {
|
||||
add_to_cutbuffer(fileptr);
|
||||
fileage = make_new_node(NULL);
|
||||
fileage->data = nmalloc(1);
|
||||
fileage->data = charalloc(1);
|
||||
fileage->data[0] = '\0';
|
||||
current = fileage;
|
||||
}
|
||||
@@ -295,7 +349,7 @@ int do_uncut_text(void)
|
||||
/* If there's only one line in the cutbuffer */
|
||||
if (cutbuffer->next == NULL) {
|
||||
tmpstr =
|
||||
nmalloc(strlen(current->data) + strlen(cutbuffer->data) +
|
||||
charalloc(strlen(current->data) + strlen(cutbuffer->data) +
|
||||
1);
|
||||
strncpy(tmpstr, current->data, current_x);
|
||||
strcpy(&tmpstr[current_x], cutbuffer->data);
|
||||
@@ -304,19 +358,21 @@ int do_uncut_text(void)
|
||||
current->data = tmpstr;
|
||||
current_x += strlen(cutbuffer->data);
|
||||
totsize += strlen(cutbuffer->data);
|
||||
if (strlen(cutbuffer->data) == 0)
|
||||
totlines++;
|
||||
|
||||
placewewant = xplustabs();
|
||||
update_cursor();
|
||||
} else { /* yuck -- no kidding! */
|
||||
tmp = current->next;
|
||||
/* New beginning */
|
||||
tmpstr = nmalloc(current_x + strlen(newbuf->data) + 1);
|
||||
tmpstr = charalloc(current_x + strlen(newbuf->data) + 1);
|
||||
strncpy(tmpstr, current->data, current_x);
|
||||
strcpy(&tmpstr[current_x], newbuf->data);
|
||||
totsize += strlen(newbuf->data) + strlen(newend->data) + 1;
|
||||
|
||||
/* New end */
|
||||
tmpstr2 = nmalloc(strlen(newend->data) +
|
||||
tmpstr2 = charalloc(strlen(newend->data) +
|
||||
strlen(¤t->data[current_x]) + 1);
|
||||
strcpy(tmpstr2, newend->data);
|
||||
strcat(tmpstr2, ¤t->data[current_x]);
|
||||
@@ -335,7 +391,7 @@ int do_uncut_text(void)
|
||||
newend->next = tmp;
|
||||
|
||||
/* If tmp isn't null, we're in the middle: update the
|
||||
* prev pointer. If it IS null, we're at the end, update
|
||||
* prev pointer. If it IS null, we're at the end; update
|
||||
* the filebot pointer */
|
||||
|
||||
if (tmp != NULL)
|
||||
@@ -364,15 +420,19 @@ int do_uncut_text(void)
|
||||
screw up all the work we just did and separate the line. There
|
||||
must be a better way to do this, but not at 1AM on a work night. */
|
||||
|
||||
if (marked_cut == 2 && current_x != strlen(current->data)) {
|
||||
if (marked_cut == 2) {
|
||||
tmp = make_new_node(current);
|
||||
tmp->data = nmalloc(strlen(¤t->data[current_x]) + 1);
|
||||
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);
|
||||
current = current->next;
|
||||
current_x = 0;
|
||||
placewewant = 0;
|
||||
|
||||
/* Extra line added, update stuff */
|
||||
totlines++;
|
||||
totsize++;
|
||||
}
|
||||
/* Renumber from BEFORE where we pasted ;) */
|
||||
renumber(hold);
|
||||
@@ -381,6 +441,7 @@ int do_uncut_text(void)
|
||||
dump_buffer(cutbuffer);
|
||||
set_modified();
|
||||
edit_refresh();
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
return 0;
|
||||
#else
|
||||
if (0) {
|
||||
|
||||
165
faq.html
165
faq.html
@@ -1,6 +1,6 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<title>The nano editor FAQ</title>
|
||||
<title>The GNU nano editor FAQ</title>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.73 [en] (X11; U; Linux 2.2.16 i586) [Netscape]">
|
||||
@@ -17,18 +17,19 @@
|
||||
|
||||
<blockquote><font color="#330000"><a href="#1.1">1.1 About this FAQ.</a></font>
|
||||
<br><font color="#330000"><a href="#1.2">1.2. How do I contribute to it?</a></font>
|
||||
<br><font color="#330000"><a href="#1.3">1.3. What is nano?</a></font>
|
||||
<br><font color="#330000"><a href="#1.3">1.3. What is GNU nano?</a></font>
|
||||
<br><font color="#330000"><a href="#1.4">1.4. What is the history behind
|
||||
nano?</a></font>
|
||||
<br><font color="#330000"><a href="#1.5">1.5. Why the name change from
|
||||
TIP?</a></font>
|
||||
<br><font color="#330000"><a href="#1.6">1.6. What is the current version
|
||||
of nano?</a></font>
|
||||
<br><font color="#330000"><a href="#1.7">1.7. I want to read the man page
|
||||
<br><font color="#330000"><a href="#1.7">1.7. I want to read the manpage
|
||||
without having to download the program!</a></font></blockquote>
|
||||
|
||||
<h2>
|
||||
<font color="#330000"><a href="#2">2. Where to get nano</a></font></h2>
|
||||
<font color="#330000"><a href="#2">2. Where to get GNU
|
||||
nano</a></font></h2>
|
||||
|
||||
<blockquote><font color="#330000"><a href="#2.1">2.1. FTP and WWW sites
|
||||
that carry nano.</a></font>
|
||||
@@ -51,7 +52,11 @@ THE HECK DO I DO NOW?</a></font>
|
||||
<br><font color="#330000"><a href="#3.5">3.5. Nano should automatically
|
||||
run strip on the binary when installing it!</a></font>
|
||||
<br><font color="#330000"><a href="#3.6">3.6. How can I make the
|
||||
executable smaller? This is too bloated!</a></font></blockquote>
|
||||
executable smaller? This is too bloated!</a></font>
|
||||
<br><font color="#330000"><a href="#3.7">3.7. Tell me more about this
|
||||
multibuffer stuff!</a></font>
|
||||
<br><font color="#330000"><a href="#3.8">3.8. How do I make a .nanorc file
|
||||
that nano will read when I start it?</a></font></blockquote>
|
||||
|
||||
<h2>
|
||||
<font color="#330000"><a href="#4">4. Running</a></font></h2>
|
||||
@@ -62,11 +67,11 @@ bucky/meta key doesn't seem to work! What can I do?</a></font>
|
||||
<insert keystroke here>!</a></font>
|
||||
<br><font color="#330000"><a href="#4.3">4.3. Nano crashes when I resize
|
||||
my window. How can I fix that?</a></font>
|
||||
<br><font color="#330000"><a href="#4.4">4.4. Why does nano show ^\ and
|
||||
^_ in the shortcut list instead of ^G and ^J?</a></font>
|
||||
<br><font color="#330000"><a href="#4.4">4.4. Why does nano show ^\
|
||||
in the shortcut list instead of ^J?</a></font>
|
||||
<br><font color="#330000"><a href="#4.5">4.5. When I type in a
|
||||
search string, the string I last searched for is already in front of
|
||||
my cursor! !What happened?!</a></font>
|
||||
my cursor! What happened?!</a></font>
|
||||
<br><font color="#330000"><a href="#4.6">4.6. I get the message "NumLock
|
||||
glitch detected. Keypad will malfunction with NumLock off." What
|
||||
gives?</a></font>
|
||||
@@ -134,13 +139,13 @@ href="mailto:nano@nano-editor.org">nano@nano-editor.org</a> and if
|
||||
it is useful enough it will be included in future versions.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="1.3"></a><font color="#330000">1.3. What is nano?</font></h2>
|
||||
<a NAME="1.3"></a><font color="#330000">1.3. What is GNU nano?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">Nano is designed to be a free replacement
|
||||
for the Pico text editor, part of the PINE email suite from <a href="http://www.washington.edu/pine">The
|
||||
University of Washington</a>. It aims to "emulate Pico as closely
|
||||
as possible and perhaps include extra functionality WITHOUT breaking compatibility
|
||||
with Pico.</font></blockquote>
|
||||
<blockquote><font color="#330000">GNU Nano is designed to be a free
|
||||
replacement for the Pico text editor, part of the PINE email suite from <a
|
||||
href="http://www.washington.edu/pine">The University of
|
||||
Washington</a>. It aims to "emulate Pico as closely as possible and
|
||||
perhaps include extra functionality.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="1.4"></a><font color="#330000">1.4. What is the history behind
|
||||
@@ -155,8 +160,8 @@ to Unix flocked to Pico and Pine because of their well organized, easy
|
||||
to use interfaces. With the proliferation of GNU/Linux in the mid to
|
||||
late 90's, many University students became intimately familiar with the
|
||||
strengths (and weaknesses) of Pine and Pico.</font>
|
||||
<p><b><font color="#330000">Then came debian...</font></b>
|
||||
<p><font color="#330000">The <a href="http://www.debian.org">debian GNU/Linux</a>
|
||||
<p><b><font color="#330000">Then came Debian...</font></b>
|
||||
<p><font color="#330000">The <a href="http://www.debian.org">Debian GNU/Linux</a>
|
||||
distribution, known for its strict standards in distributing truly "free"
|
||||
software (i.e. had no restrictions on redistribution), would not include
|
||||
a binary package for Pine or Pico. Many people had a serious dilemma:
|
||||
@@ -166,9 +171,9 @@ sense of the word.</font>
|
||||
<p><b><font color="#330000">The event...</font></b>
|
||||
<p><font color="#330000">It was in late 1999 when Chris Allegretta (our
|
||||
hero) was yet again complaining to himself about the less-than-perfect
|
||||
license Pico was distributed under, the 10000 makefiles that came with
|
||||
license Pico was distributed under, the 1000 makefiles that came with
|
||||
it and how just a few small improvements could make it the Best Editor
|
||||
in the World (TM). Having been a convert from Slackware to debian,
|
||||
in the World (TM). Having been a convert from Slackware to Debian,
|
||||
he missed having a simple binary package that included Pine and Pico, and
|
||||
had grown tired of downloading them himself.</font>
|
||||
<p><font color="#330000">Finally something snapped inside and Chris coded
|
||||
@@ -176,8 +181,11 @@ and hacked like a madman for many hours straight one weekend to make a
|
||||
(barely usable) Pico clone, at the time called TIP (Tip Isn't Pico).
|
||||
The program could not be invoked without a filename, could not save files,
|
||||
had no help menu, spell checker, and so forth. But over time it improved,
|
||||
and with the help of a few great coders it matured to the almost stable
|
||||
state it is today.</font></blockquote>
|
||||
and with the help of a few great coders it matured to the (hopefully) stable
|
||||
state it is today.
|
||||
<p><font color="#330000">In February 2001, nano has been declared an
|
||||
official GNU program by Richard Stallman. Nano also reached it's first
|
||||
production release on March 22, 2001.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="1.5"></a><font color="#330000">1.5. Why the name change from TIP?</font></h2>
|
||||
@@ -195,7 +203,7 @@ nano was developed).</font></blockquote>
|
||||
of nano?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">The current version of nano *should*
|
||||
be 0.9.99pre2. Of course you should always check the nano hompage to
|
||||
be 1.1.0. Of course you should always check the nano hompage to
|
||||
see what the latest and greatest version is.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
@@ -207,7 +215,7 @@ Okay, look <a href="http://www.nano-editor.org/dist/nano.1.html">here</a>.</font
|
||||
|
||||
<hr WIDTH="100%">
|
||||
<h1>
|
||||
<a NAME="2"></a><font color="#330000">2. Where to get nano</font></h1>
|
||||
<a NAME="2"></a><font color="#330000">2. Where to get GNU nano</font></h1>
|
||||
|
||||
<h2>
|
||||
<a NAME="2.1"></a><font color="#330000">2.1. FTP and WWW sites that carry
|
||||
@@ -262,7 +270,7 @@ at:</font>
|
||||
<h2>
|
||||
<a NAME="2.3"></a><font color="#330000">2.3. Debian (.deb) packages.</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">For debian users, you can check out the
|
||||
<blockquote><font color="#330000">For Debian users, you can check out the
|
||||
current nano packages for:</font>
|
||||
<ul>
|
||||
<li>
|
||||
@@ -272,9 +280,9 @@ current nano packages for:</font>
|
||||
<font color="#330000"><a href="http://www.debian.org/Packages/unstable/editors/nano.html">unstable</a></font></li>
|
||||
</ul>
|
||||
<font color="#330000">Note that versions < 0.9.10 are probably not for
|
||||
those wanting to get serious work done, so until the stable distribution
|
||||
has an updated version of nano, you are best off using the one in unstable
|
||||
for now.</font></blockquote>
|
||||
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
|
||||
tracking unstable, you probably have the newest version already.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="2.4"></a><font color="#330000">2.4. By CVS (for the brave).</font></h2>
|
||||
@@ -362,8 +370,10 @@ list:
|
||||
<b>--disable-speller</b> Disables spell checker function
|
||||
<b>--disable-help</b> Disables help function (^G)
|
||||
<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)
|
||||
</pre><br>
|
||||
There's also the <b>--enable-tiny</b> option which disabled everything
|
||||
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
|
||||
that you use Control-^ to select with). Also, if you know you aren't
|
||||
going to be using other languages you can use <b>--disable-nls</b> to
|
||||
@@ -371,8 +381,45 @@ 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.
|
||||
</font></blockquote> <hr WIDTH="100%"> <h1>
|
||||
<a NAME="4"></a><font color="#330000">4. Running</font></h1>
|
||||
<p>If, in the other hand, you can't live with bells and whistles, you could
|
||||
try:
|
||||
<pre>
|
||||
<b>--enable-extra</b> Enable extra functions, including easter eggs
|
||||
<b>--enable-nanorc</b> Enable use of .nanorc file
|
||||
<b>--enable-color</b> Enables color and syntax highlighting
|
||||
<b>--enable-multibuffer</b> Enables having multiple file buffers open
|
||||
</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<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.0
|
||||
or newer, and you must have configured nano with <b>--enable-multibuffer</b> or
|
||||
<b>--enable-extra</b> (use nano -V to check). Then when you want to enable inserting a file
|
||||
into its own buffer instead of into the current file, just hit <b>Meta-F</b>, then insert the
|
||||
file as normal with <b>^R</b>. If you always want files to be loaded into their own buffers,
|
||||
use the <b>--multibuffer</b> or <b>-F</b> flag when you invoke nano. <P>
|
||||
|
||||
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.0 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>
|
||||
|
||||
<h2>
|
||||
<a NAME="4.1"></a><font color="#330000">4.1. Ack! My backspace/delete/enter/double
|
||||
@@ -390,7 +437,8 @@ keystroke here>!</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">If you aren't trying some bizarre keystroke
|
||||
combination with some bizarre $TERM entry, chances are you have found a
|
||||
bug. You are welcome to submit it to the nano-devel list or
|
||||
bug. You are welcome to submit it to the
|
||||
<a href="mailto:nano-devel@lists.sourceforge.net">nano-devel</a> list or
|
||||
to <a href="mailto:nano@nano-editor.org">nano@nano-editor.org</a>.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
@@ -402,19 +450,21 @@ please upgrade to a newer version (at least 0.9.9 would be great, 0.9.12
|
||||
is recommended).</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="4.4"></a><font color="#330000">4.4. Why does nano show ^\ and
|
||||
^_ in the shortcut list instead of ^G and ^J?</font></h2>
|
||||
<a NAME="4.4"></a><font color="#330000">4.4. Why does nano show ^\ in the
|
||||
shortcut list instead of ^J?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">The help (^G) and justify (^J) functions
|
||||
<blockquote><font color="#330000">The help (^G) and justify (^J) function
|
||||
were among the last to be written. To show the improvements that
|
||||
nano had over Pico (goto line # and replace), ^_ and ^\ were put on the
|
||||
shortcut list. If you use the <b>-p</b> option to nano you
|
||||
will get the same shortcuts at the bottom as Pico.</font></blockquote>
|
||||
shortcut list. Later, ^G came back in place of ^_ as it proved
|
||||
to be very valuable for new UNIX users. If you use the <b>-p</b> option to
|
||||
nano (or hit Meta-P) you will get the same shortcuts at the bottom as
|
||||
Pico.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a name="4.5"><font color="#330000">4.5. When I type in a search
|
||||
string, the string I last searched for is already in front of my
|
||||
cursor! !What happened?!</font></h2>
|
||||
cursor! What happened?!</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">In nano version 0.9.20, the default is
|
||||
to have a completely consistent user interface across all user input
|
||||
@@ -441,7 +491,7 @@ In a nutshell, if you want to be able to use the keypad with the arrow and
|
||||
page up/down functionality, you have to exit nano and reset your terminal
|
||||
(presumably with "reset" or "stty sane" or similar) and then run nano
|
||||
again with NumLock off. If you know an easier way to restore "normal
|
||||
mode", please mail <A href="nano@nano-editor.org">nano@nano-editor.org</A>.
|
||||
mode", please mail <A href="mailto:nano@nano-editor.org">nano@nano-editor.org</A>.
|
||||
<br> </blockquote>
|
||||
|
||||
<h2>
|
||||
@@ -483,7 +533,7 @@ my language!</font></h2>
|
||||
language to write one =-). Just grab the <b>nano.pot</b> file from
|
||||
the latest and greatest nano distribution (it's in the <b>po/</b> directory)
|
||||
and translate each line into your native language on the <b>msgstr</b>
|
||||
line. Then send it to the nano devel list or <a href="mailto:nano@nano-editor.org">nano@nano-editor.org</a>.</font></blockquote>
|
||||
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>
|
||||
|
||||
<h2>
|
||||
<a NAME="5.2"></a><font color="#330000">5.2. I don't like the translation
|
||||
@@ -503,7 +553,7 @@ or the devel list.</font></blockquote>
|
||||
of Pico?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">There are many reasons to use nano instead
|
||||
of Pico, a more complete list can be found at the <a href="http://www.nano-edior.org">nano
|
||||
of Pico, a more complete list can be found at the <a href="http://www.nano-editor.org">nano
|
||||
homepage</a>.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
@@ -516,34 +566,33 @@ of personal preference as to which editor you should use. If you're
|
||||
the type of person who likes using the original version of a program, then
|
||||
Pico is the editor for you. If you're looking for a few more
|
||||
features and a 'better' license as far as adding your own changes (sacrificing
|
||||
mailer integration and a little stability), nano is the way to go.</blockquote>
|
||||
mailer integration with Pine), nano is the way to go.
|
||||
</blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="6.3"></a><font color="#330000">6.3. What is so bad about the PINE
|
||||
license?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">Technically there is nothing "wrong"
|
||||
with the U of W license for Pine and Pico. However, it is not
|
||||
considered truly "free" according to the <a href="http://www.debian.org/social_contract#guidelines">Debian
|
||||
Free Software Guidelines</a>. The only real problem as far as I'm
|
||||
aware as that there are limitations on the redistribution of programs based
|
||||
on the Pine and Pico source. So at a real nitty gritty level,
|
||||
these programs are not considered Free Software. This is why Pico
|
||||
isn't distributed in binary form in debian, and hence one of the main reasons
|
||||
nano was started.</font></blockquote>
|
||||
<blockquote><font color="#330000">The U of W license for Pine and
|
||||
Pico is not considered truly Free Software according to both the Free
|
||||
Software Foundation and the the <a
|
||||
href="http://www.debian.org/social_contract#guidelines">Debian
|
||||
Free Software Guidelines</a>. The main problem regards the
|
||||
limitations on distributing derived works: according to UW, you can
|
||||
distribute their software, and you can modfify it, but you can not do
|
||||
both, i.e. distribute modified binaries.</blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="6.4"></a><font color="#330000">6.4. Okay, well what mail program
|
||||
should I use then?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">Well, there is nothing stopping you from
|
||||
using Pine with nano (or Pine with Pico for that matter). But if
|
||||
you want to use programs that are considered Free Software, you may want
|
||||
to look into <a href="http://www.mutt.org">mutt</a>. It is a full-screen,
|
||||
console based mail program that actually has a lot more flexibility than
|
||||
Pine, but has a keymap included in the distribution that allows you to
|
||||
use the same keystrokes as Pine would to send and receive mail. It's
|
||||
also licensed under the GPL.</font></blockquote>
|
||||
<blockquote><font color="#330000"> If you are looking to use a Free
|
||||
Software program similar to PINE and emacs is not your thing, you should
|
||||
definitely take a look at <a href="http://www.mutt.org">mutt</a>. It
|
||||
is a full-screen, console based mail program that actually has a lot more
|
||||
flexibility than Pine, but has a keymap included in the distribution that
|
||||
allows you to use the same keystrokes as Pine would to send and receive
|
||||
mail. It's also licensed under the GPL.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="6.5"></a><font color="#330000">6.5. Why doesn't UW simply change
|
||||
@@ -576,7 +625,7 @@ any changes in the past few years in a positive direction.</font></blockquote>
|
||||
hosted at <a href="http://www.sourceforge.net">SourceForge</a>, nano-announce
|
||||
and nano-devel. Nano-announce is a very low traffic list where new
|
||||
versions of nano are announced (surprise!) Nano-devel is a normally
|
||||
low, sometimes very high traffic list for dicussing the present and future
|
||||
low, sometimes high traffic list for discussing the present and future
|
||||
development of nano. Here are links to where you can sign up for
|
||||
a given list:</font><font color="#330000"></font>
|
||||
<p><font color="#330000">nano-announce - <a href="http://lists.sourceforge.net/mailman/listinfo/nano-announce">http://lists.sourceforge.net/mailman/listinfo/nano-announce</a></font>
|
||||
|
||||
198
global.c
198
global.c
@@ -19,8 +19,9 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include "config.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include "nano.h"
|
||||
#include "proto.h"
|
||||
|
||||
@@ -34,7 +35,7 @@
|
||||
/*
|
||||
* Global variables
|
||||
*/
|
||||
int flags = 0; /* Our new flag containig many options */
|
||||
int flags = 0; /* Our new flag containing many options */
|
||||
WINDOW *edit; /* The file portion of the editor */
|
||||
WINDOW *topwin; /* Top line of screen */
|
||||
WINDOW *bottomwin; /* Bottom buffer */
|
||||
@@ -53,10 +54,14 @@ filestruct *editbot = NULL; /* Same for the bottom */
|
||||
filestruct *filebot = NULL; /* Last node in the file struct */
|
||||
filestruct *cutbuffer = NULL; /* A place to store cut text */
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
filestruct *open_files = NULL; /* The list of open files */
|
||||
#endif
|
||||
|
||||
char *answer = NULL; /* Answer str to many questions */
|
||||
int totlines = 0; /* Total number of lines in the file */
|
||||
int totsize = 0; /* Total number of bytes in the file */
|
||||
int placewewant = 0; /* The collum we'd like the cursor
|
||||
int placewewant = 0; /* The column we'd like the cursor
|
||||
to jump to when we go to the
|
||||
next or previous line */
|
||||
|
||||
@@ -70,18 +75,33 @@ 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_SPELLER
|
||||
char *alt_speller; /* Alternative spell command */
|
||||
#endif
|
||||
|
||||
shortcut main_list[MAIN_LIST_LEN];
|
||||
shortcut whereis_list[WHEREIS_LIST_LEN];
|
||||
shortcut replace_list[REPLACE_LIST_LEN];
|
||||
shortcut replace_list_2[REPLACE_LIST_LEN]; /* 2nd half of replace dialog */
|
||||
shortcut goto_list[GOTO_LIST_LEN];
|
||||
shortcut gotodir_list[GOTODIR_LIST_LEN];
|
||||
shortcut writefile_list[WRITEFILE_LIST_LEN];
|
||||
shortcut insertfile_list[INSERTFILE_LIST_LEN];
|
||||
shortcut help_list[HELP_LIST_LEN];
|
||||
shortcut spell_list[SPELL_LIST_LEN];
|
||||
#ifndef DISABLE_BROWSER
|
||||
shortcut browser_list[BROWSER_LIST_LEN];
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
colorstruct colors[NUM_NCOLORS];
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
shortcut *currshortcut = main_list; /* Current shortcut list we're using */
|
||||
int currslen = MAIN_VISIBLE; /* Length of current shortcut list */
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
toggle toggles[TOGGLE_LEN];
|
||||
#endif
|
||||
@@ -110,11 +130,13 @@ void sc_init_one(shortcut * s, int key, char *desc, char *help, int alt,
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* Initialize the toggles in the same manner */
|
||||
void toggle_init_one(toggle * t, int val, char *desc, int flag)
|
||||
void toggle_init_one(toggle * t, int val, char *desc, int flag,
|
||||
char override_ch)
|
||||
{
|
||||
t->val = val;
|
||||
t->desc = desc;
|
||||
t->flag = flag;
|
||||
t->override_ch = override_ch;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -123,7 +145,13 @@ void toggle_init(void)
|
||||
#ifndef NANO_SMALL
|
||||
char *toggle_const_msg, *toggle_autoindent_msg, *toggle_suspend_msg,
|
||||
*toggle_nohelp_msg, *toggle_picomode_msg, *toggle_mouse_msg,
|
||||
*toggle_cuttoend_msg, *toggle_wrap_msg;
|
||||
*toggle_cuttoend_msg, *toggle_wrap_msg, *toggle_case_msg,
|
||||
*toggle_backwards_msg;
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
char *toggle_load_msg, *nano_openprev_msg, *nano_opennext_msg;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
char *toggle_regexp_msg;
|
||||
#endif
|
||||
@@ -135,30 +163,52 @@ 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");
|
||||
#ifdef HAVE_REGEX_H
|
||||
toggle_regexp_msg = _("Regular expressions");
|
||||
#endif
|
||||
toggle_wrap_msg = _("Auto wrap");
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
toggle_load_msg = _("Multiple file buffers");
|
||||
nano_openprev_msg = _("Open previously loaded file");
|
||||
nano_opennext_msg = _("Open next loaded file");
|
||||
#endif
|
||||
|
||||
toggle_init_one(&toggles[0], TOGGLE_CONST_KEY, toggle_const_msg,
|
||||
CONSTUPDATE);
|
||||
CONSTUPDATE, 0);
|
||||
toggle_init_one(&toggles[1], TOGGLE_AUTOINDENT_KEY,
|
||||
toggle_autoindent_msg, AUTOINDENT);
|
||||
toggle_autoindent_msg, AUTOINDENT, 0);
|
||||
toggle_init_one(&toggles[2], TOGGLE_SUSPEND_KEY, toggle_suspend_msg,
|
||||
SUSPEND);
|
||||
SUSPEND, 0);
|
||||
toggle_init_one(&toggles[3], TOGGLE_NOHELP_KEY, toggle_nohelp_msg,
|
||||
NO_HELP);
|
||||
NO_HELP, 0);
|
||||
toggle_init_one(&toggles[4], TOGGLE_PICOMODE_KEY, toggle_picomode_msg,
|
||||
PICO_MODE);
|
||||
PICO_MODE, 0);
|
||||
toggle_init_one(&toggles[5], TOGGLE_WRAP_KEY, toggle_wrap_msg,
|
||||
NO_WRAP);
|
||||
NO_WRAP, 0);
|
||||
toggle_init_one(&toggles[6], TOGGLE_MOUSE_KEY, toggle_mouse_msg,
|
||||
USE_MOUSE);
|
||||
USE_MOUSE, 0);
|
||||
toggle_init_one(&toggles[7], TOGGLE_CUTTOEND_KEY, toggle_cuttoend_msg,
|
||||
CUT_TO_END);
|
||||
CUT_TO_END, 0);
|
||||
toggle_init_one(&toggles[8], TOGGLE_BACKWARDS_KEY, toggle_backwards_msg,
|
||||
REVERSE_SEARCH, 0);
|
||||
toggle_init_one(&toggles[9], TOGGLE_CASE_KEY, toggle_case_msg,
|
||||
CASE_SENSITIVE, 0);
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
toggle_init_one(&toggles[10], TOGGLE_LOAD_KEY, toggle_load_msg,
|
||||
MULTIBUFFER, 0);
|
||||
toggle_init_one(&toggles[11], NANO_OPENPREV_KEY, nano_openprev_msg,
|
||||
0, '<');
|
||||
toggle_init_one(&toggles[12], NANO_OPENNEXT_KEY, nano_opennext_msg,
|
||||
0, '>');
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
toggle_init_one(&toggles[8], TOGGLE_REGEXP_KEY, toggle_regexp_msg,
|
||||
USE_REGEXP);
|
||||
toggle_init_one(&toggles[TOGGLE_LEN - 1], TOGGLE_REGEXP_KEY,
|
||||
toggle_regexp_msg, USE_REGEXP, 0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
@@ -177,14 +227,23 @@ void shortcut_init(int unjustify)
|
||||
"", *nano_mark_msg = "", *nano_delete_msg =
|
||||
"", *nano_backspace_msg = "", *nano_tab_msg =
|
||||
"", *nano_enter_msg = "", *nano_case_msg =
|
||||
"", *nano_cancel_msg = "", *nano_unjustify_msg = "";
|
||||
"", *nano_cancel_msg = "", *nano_unjustify_msg =
|
||||
"", *nano_append_msg = "", *nano_reverse_msg =
|
||||
"", *nano_regexp_msg = "";
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
char *nano_tofiles_msg = "";
|
||||
char *nano_gotodir_msg = "";
|
||||
|
||||
nano_help_msg = _("Invoke the help menu");
|
||||
nano_writeout_msg = _("Write the current file to disk");
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
nano_exit_msg = _("Close currently loaded file/Exit from nano");
|
||||
#else
|
||||
nano_exit_msg = _("Exit from nano");
|
||||
#endif
|
||||
|
||||
nano_goto_msg = _("Goto a specific line number");
|
||||
nano_justify_msg = _("Justify the current paragraph");
|
||||
nano_unjustify_msg = _("Unjustify after a justify");
|
||||
@@ -195,7 +254,7 @@ void shortcut_init(int unjustify)
|
||||
nano_nextpage_msg = _("Move to the next screen");
|
||||
nano_cut_msg = _("Cut the current line and store it in the cutbuffer");
|
||||
nano_uncut_msg = _("Uncut from the cutbuffer into the current line");
|
||||
nano_cursorpos_msg = _("Show the posititon of the cursor");
|
||||
nano_cursorpos_msg = _("Show the position of the cursor");
|
||||
nano_spell_msg = _("Invoke the spell checker (if available)");
|
||||
nano_up_msg = _("Move up one line");
|
||||
nano_down_msg = _("Move down one line");
|
||||
@@ -215,42 +274,48 @@ void shortcut_init(int unjustify)
|
||||
nano_case_msg =
|
||||
_("Make the current search or replace case (in)sensitive");
|
||||
nano_tofiles_msg = _("Go to file browser");
|
||||
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");
|
||||
#endif
|
||||
|
||||
if (ISSET(PICO_MODE))
|
||||
sc_init_one(&main_list[0], NANO_HELP_KEY, _("Get Help"),
|
||||
nano_help_msg, 0, NANO_HELP_FKEY, 0, VIEW, do_help);
|
||||
else
|
||||
sc_init_one(&main_list[0], NANO_WRITEOUT_KEY, _("WriteOut"),
|
||||
nano_writeout_msg,
|
||||
0, NANO_WRITEOUT_FKEY, 0, NOVIEW, do_writeout_void);
|
||||
|
||||
sc_init_one(&main_list[1], NANO_EXIT_KEY, _("Exit"),
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (open_files != NULL && (open_files->prev || open_files->next))
|
||||
sc_init_one(&main_list[1], NANO_EXIT_KEY, _("Close"),
|
||||
nano_exit_msg, 0, NANO_EXIT_FKEY, 0, VIEW, do_exit);
|
||||
else
|
||||
#endif
|
||||
sc_init_one(&main_list[1], NANO_EXIT_KEY, _("Exit"),
|
||||
nano_exit_msg, 0, NANO_EXIT_FKEY, 0, VIEW, do_exit);
|
||||
|
||||
if (ISSET(PICO_MODE))
|
||||
sc_init_one(&main_list[2], NANO_WRITEOUT_KEY, _("WriteOut"),
|
||||
sc_init_one(&main_list[2], NANO_WRITEOUT_KEY, _("WriteOut"),
|
||||
nano_writeout_msg,
|
||||
0, NANO_WRITEOUT_FKEY, 0, NOVIEW, do_writeout_void);
|
||||
else
|
||||
sc_init_one(&main_list[2], NANO_GOTO_KEY, _("Goto Line"),
|
||||
nano_goto_msg,
|
||||
NANO_ALT_G, NANO_GOTO_FKEY, 0, VIEW, do_gotoline_void);
|
||||
|
||||
if (ISSET(PICO_MODE))
|
||||
sc_init_one(&main_list[3], NANO_JUSTIFY_KEY, _("Justify"),
|
||||
nano_justify_msg, 0, NANO_JUSTIFY_FKEY, 0,
|
||||
NOVIEW, do_justify);
|
||||
else
|
||||
sc_init_one(&main_list[3], NANO_REPLACE_KEY, _("Replace"),
|
||||
sc_init_one(&main_list[3], NANO_INSERTFILE_KEY, _("Read File"),
|
||||
nano_insert_msg,
|
||||
0, NANO_INSERTFILE_FKEY, 0, NOVIEW, do_insertfile_void);
|
||||
|
||||
|
||||
if (ISSET(PICO_MODE))
|
||||
sc_init_one(&main_list[4], NANO_INSERTFILE_KEY, _("Read File"),
|
||||
nano_insert_msg,
|
||||
0, NANO_INSERTFILE_FKEY, 0, NOVIEW, do_insertfile_void);
|
||||
else
|
||||
sc_init_one(&main_list[4], NANO_REPLACE_KEY, _("Replace"),
|
||||
nano_replace_msg,
|
||||
NANO_ALT_R, NANO_REPLACE_FKEY, 0, NOVIEW, do_replace);
|
||||
|
||||
sc_init_one(&main_list[4], NANO_INSERTFILE_KEY, _("Read File"),
|
||||
nano_insert_msg,
|
||||
0, NANO_INSERTFILE_FKEY, 0, NOVIEW, do_insertfile);
|
||||
|
||||
sc_init_one(&main_list[5], NANO_WHEREIS_KEY, _("Where Is"),
|
||||
nano_whereis_msg,
|
||||
0, NANO_WHEREIS_FKEY, 0, VIEW, do_search);
|
||||
@@ -330,13 +395,10 @@ void shortcut_init(int unjustify)
|
||||
nano_enter_msg,
|
||||
0, KEY_ENTER, NANO_CONTROL_M, NOVIEW, do_enter_void);
|
||||
|
||||
if (ISSET(PICO_MODE))
|
||||
sc_init_one(&main_list[25], NANO_GOTO_KEY, _("Goto Line"),
|
||||
sc_init_one(&main_list[25], NANO_GOTO_KEY, _("Goto Line"),
|
||||
nano_goto_msg,
|
||||
NANO_ALT_G, NANO_GOTO_FKEY, 0, VIEW, do_gotoline_void);
|
||||
else
|
||||
sc_init_one(&main_list[25], NANO_HELP_KEY, _("Get Help"),
|
||||
nano_help_msg, 0, NANO_HELP_FKEY, 0, VIEW, do_help);
|
||||
|
||||
|
||||
|
||||
sc_init_one(&whereis_list[0], NANO_FIRSTLINE_KEY, _("First Line"),
|
||||
@@ -345,20 +407,26 @@ void shortcut_init(int unjustify)
|
||||
sc_init_one(&whereis_list[1], NANO_LASTLINE_KEY, _("Last Line"),
|
||||
nano_lastline_msg, 0, 0, 0, VIEW, do_last_line);
|
||||
|
||||
sc_init_one(&whereis_list[2], NANO_CASE_KEY, _("Case Sens"),
|
||||
nano_case_msg, 0, 0, 0, VIEW, 0);
|
||||
|
||||
|
||||
sc_init_one(&whereis_list[3], NANO_OTHERSEARCH_KEY, _("Replace"),
|
||||
sc_init_one(&whereis_list[2], NANO_OTHERSEARCH_KEY, _("Replace"),
|
||||
nano_replace_msg, 0, 0, 0, VIEW, do_replace);
|
||||
|
||||
sc_init_one(&whereis_list[4], NANO_FROMSEARCHTOGOTO_KEY,
|
||||
sc_init_one(&whereis_list[3], NANO_FROMSEARCHTOGOTO_KEY,
|
||||
_("Goto Line"), nano_goto_msg, 0, 0, 0, VIEW,
|
||||
do_gotoline_void);
|
||||
|
||||
sc_init_one(&whereis_list[5], NANO_CANCEL_KEY, _("Cancel"),
|
||||
sc_init_one(&whereis_list[4], NANO_CANCEL_KEY, _("Cancel"),
|
||||
nano_cancel_msg, 0, 0, 0, VIEW, 0);
|
||||
|
||||
sc_init_one(&whereis_list[5], TOGGLE_CASE_KEY, _("Case Sens"),
|
||||
nano_case_msg, 0, 0, 0, VIEW, 0);
|
||||
|
||||
sc_init_one(&whereis_list[6], TOGGLE_BACKWARDS_KEY, _("Backward"),
|
||||
nano_reverse_msg, 0, 0, 0, VIEW, 0);
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
sc_init_one(&whereis_list[7], TOGGLE_REGEXP_KEY, _("Regexp"),
|
||||
nano_regexp_msg, 0, 0, 0, VIEW, 0);
|
||||
#endif
|
||||
|
||||
sc_init_one(&replace_list[0], NANO_FIRSTLINE_KEY, _("First Line"),
|
||||
nano_firstline_msg, 0, 0, 0, VIEW, do_first_line);
|
||||
@@ -366,19 +434,26 @@ void shortcut_init(int unjustify)
|
||||
sc_init_one(&replace_list[1], NANO_LASTLINE_KEY, _("Last Line"),
|
||||
nano_lastline_msg, 0, 0, 0, VIEW, do_last_line);
|
||||
|
||||
sc_init_one(&replace_list[2], NANO_CASE_KEY, _("Case Sens"),
|
||||
nano_case_msg, 0, 0, 0, VIEW, 0);
|
||||
|
||||
sc_init_one(&replace_list[3], NANO_OTHERSEARCH_KEY, _("No Replace"),
|
||||
sc_init_one(&replace_list[2], NANO_OTHERSEARCH_KEY, _("No Replace"),
|
||||
nano_whereis_msg, 0, 0, 0, VIEW, do_search);
|
||||
|
||||
sc_init_one(&replace_list[4], NANO_FROMSEARCHTOGOTO_KEY,
|
||||
sc_init_one(&replace_list[3], NANO_FROMSEARCHTOGOTO_KEY,
|
||||
_("Goto Line"), nano_goto_msg, 0, 0, 0, VIEW,
|
||||
do_gotoline_void);
|
||||
|
||||
sc_init_one(&replace_list[5], NANO_CANCEL_KEY, _("Cancel"),
|
||||
sc_init_one(&replace_list[4], NANO_CANCEL_KEY, _("Cancel"),
|
||||
nano_cancel_msg, 0, 0, 0, VIEW, 0);
|
||||
|
||||
sc_init_one(&replace_list[5], TOGGLE_CASE_KEY, _("Case Sens"),
|
||||
nano_case_msg, 0, 0, 0, VIEW, 0);
|
||||
|
||||
sc_init_one(&replace_list[6], TOGGLE_BACKWARDS_KEY, _("Backward"),
|
||||
nano_reverse_msg, 0, 0, 0, VIEW, 0);
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
sc_init_one(&replace_list[7], TOGGLE_REGEXP_KEY, _("Regexp"),
|
||||
nano_regexp_msg, 0, 0, 0, VIEW, 0);
|
||||
#endif
|
||||
|
||||
|
||||
sc_init_one(&replace_list_2[0], NANO_FIRSTLINE_KEY, _("First Line"),
|
||||
@@ -418,9 +493,20 @@ void shortcut_init(int unjustify)
|
||||
nano_tofiles_msg, 0, 0, 0, NOVIEW, 0);
|
||||
#endif
|
||||
|
||||
sc_init_one(&writefile_list[WRITEFILE_LIST_LEN - 2], 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"),
|
||||
nano_cancel_msg, 0, 0, 0, VIEW, 0);
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
sc_init_one(&insertfile_list[0], 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"),
|
||||
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);
|
||||
|
||||
@@ -433,9 +519,15 @@ void shortcut_init(int unjustify)
|
||||
nano_nextpage_msg,
|
||||
0, NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, 0);
|
||||
|
||||
sc_init_one(&browser_list[2], NANO_EXIT_KEY, _("Exit"),
|
||||
sc_init_one(&browser_list[2], 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_CANCEL_KEY, _("Cancel"),
|
||||
nano_cancel_msg, 0, 0, 0, VIEW, 0);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
1086
intl/ChangeLog
1086
intl/ChangeLog
File diff suppressed because it is too large
Load Diff
234
intl/Makefile.in
234
intl/Makefile.in
@@ -1,5 +1,5 @@
|
||||
# Makefile for directory with message catalog handling in GNU NLS Utilities.
|
||||
# Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -28,75 +28,106 @@ VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
transform = @program_transform_name@
|
||||
libdir = $(exec_prefix)/lib
|
||||
includedir = $(prefix)/include
|
||||
datadir = $(prefix)/@DATADIRNAME@
|
||||
libdir = @libdir@
|
||||
includedir = @includedir@
|
||||
datadir = @datadir@
|
||||
localedir = $(datadir)/locale
|
||||
gnulocaledir = $(prefix)/share/locale
|
||||
gettextsrcdir = @datadir@/gettext/intl
|
||||
aliaspath = $(localedir):.
|
||||
gettextsrcdir = $(datadir)/gettext/intl
|
||||
aliaspath = $(localedir)
|
||||
subdir = intl
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
mkinstalldirs = $(SHELL) `case "$(MKINSTALLDIRS)" in /*) echo "$(MKINSTALLDIRS)" ;; *) echo "$(top_builddir)/$(MKINSTALLDIRS)" ;; esac`
|
||||
|
||||
l = @l@
|
||||
l = @INTL_LIBTOOL_SUFFIX_PREFIX@
|
||||
|
||||
AR = ar
|
||||
CC = @CC@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
RANLIB = @RANLIB@
|
||||
YACC = @INTLBISON@ -y -d
|
||||
YFLAGS = --name-prefix=__gettext
|
||||
|
||||
DEFS = -DLOCALEDIR=\"$(localedir)\" -DGNULOCALEDIR=\"$(gnulocaledir)\" \
|
||||
-DLOCALE_ALIAS_PATH=\"$(aliaspath)\" @DEFS@
|
||||
DEFS = -DLOCALEDIR=\"$(localedir)\" -DLOCALE_ALIAS_PATH=\"$(aliaspath)\" \
|
||||
-DLIBDIR=\"$(libdir)\" @DEFS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CFLAGS = @CFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
|
||||
COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
|
||||
|
||||
HEADERS = $(COMHDRS) libgettext.h loadinfo.h
|
||||
HEADERS = $(COMHDRS) libgnuintl.h libgettext.h loadinfo.h
|
||||
COMHDRS = gettext.h gettextP.h hash-string.h
|
||||
SOURCES = $(COMSRCS) intl-compat.c cat-compat.c
|
||||
SOURCES = $(COMSRCS) intl-compat.c
|
||||
COMSRCS = bindtextdom.c dcgettext.c dgettext.c gettext.c \
|
||||
finddomain.c loadmsgcat.c localealias.c textdomain.c l10nflist.c \
|
||||
explodename.c
|
||||
explodename.c dcigettext.c dcngettext.c dngettext.c ngettext.c plural.y \
|
||||
localcharset.c
|
||||
OBJECTS = @INTLOBJS@ bindtextdom.$lo dcgettext.$lo dgettext.$lo gettext.$lo \
|
||||
finddomain.$lo loadmsgcat.$lo localealias.$lo textdomain.$lo l10nflist.$lo \
|
||||
explodename.$lo
|
||||
CATOBJS = cat-compat.$lo ../po/cat-id-tbl.$lo
|
||||
explodename.$lo dcigettext.$lo dcngettext.$lo dngettext.$lo ngettext.$lo \
|
||||
plural.$lo localcharset.$lo
|
||||
GETTOBJS = intl-compat.$lo
|
||||
DISTFILES.common = ChangeLog Makefile.in linux-msg.sed po2tbl.sed.in \
|
||||
xopen-msg.sed $(HEADERS) $(SOURCES)
|
||||
DISTFILES.common = Makefile.in \
|
||||
config.charset locale.alias ref-add.sin ref-del.sin $(HEADERS) $(SOURCES)
|
||||
DISTFILES.generated = plural.c
|
||||
DISTFILES.normal = VERSION
|
||||
DISTFILES.gettext = libintl.glibc intlh.inst.in
|
||||
DISTFILES.gettext = libintl.glibc
|
||||
DISTFILES.obsolete = xopen-msg.sed linux-msg.sed po2tbl.sed.in cat-compat.c
|
||||
|
||||
# Libtool's library version information for libintl.
|
||||
# Before making a gettext release, the gettext maintainer must change this
|
||||
# according to the libtool documentation, section "Library interface versions".
|
||||
# Maintainers of other packages that include the intl directory must *not*
|
||||
# change these values.
|
||||
LTV_CURRENT=1
|
||||
LTV_REVISION=1
|
||||
LTV_AGE=0
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o .lo
|
||||
.SUFFIXES: .c .y .o .lo .sin .sed
|
||||
.c.o:
|
||||
$(COMPILE) $<
|
||||
.c.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) $<
|
||||
|
||||
INCLUDES = -I.. -I. -I$(top_srcdir)/intl -I$(top_srcdir)/lib
|
||||
.y.c:
|
||||
$(YACC) $(YFLAGS) --output $@ $<
|
||||
rm -f $*.h
|
||||
|
||||
.sin.sed:
|
||||
sed -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $< > t-$@
|
||||
mv t-$@ $@
|
||||
|
||||
INCLUDES = -I.. -I. -I$(top_srcdir)/intl
|
||||
|
||||
all: all-@USE_INCLUDED_LIBINTL@
|
||||
all-yes: libintl.$la libintl.h charset.alias ref-add.sed ref-del.sed
|
||||
all-no: all-no-@BUILD_INCLUDED_LIBINTL@
|
||||
all-no-yes: libgnuintl.$la
|
||||
all-no-no:
|
||||
|
||||
all-yes: libintl.$la intlh.inst
|
||||
all-no:
|
||||
|
||||
libintl.a: $(OBJECTS)
|
||||
libintl.a libgnuintl.a: $(OBJECTS)
|
||||
rm -f $@
|
||||
$(AR) cru $@ $(OBJECTS)
|
||||
$(RANLIB) $@
|
||||
|
||||
libintl.la: $(OBJECTS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ $(OBJECTS) \
|
||||
-version-info 1:0 -rpath $(libdir)
|
||||
libintl.la libgnuintl.la: $(OBJECTS)
|
||||
$(LIBTOOL) --mode=link \
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) $(LDFLAGS) -o $@ \
|
||||
$(OBJECTS) @LIBICONV@ \
|
||||
-version-info $(LTV_CURRENT):$(LTV_REVISION):$(LTV_AGE) \
|
||||
-rpath $(libdir) \
|
||||
-no-undefined
|
||||
|
||||
../po/cat-id-tbl.$lo: ../po/cat-id-tbl.c $(top_srcdir)/po/$(PACKAGE).pot
|
||||
cd ../po && $(MAKE) cat-id-tbl.$lo
|
||||
libintl.h: libgnuintl.h
|
||||
cp $(srcdir)/libgnuintl.h libintl.h
|
||||
|
||||
charset.alias: config.charset
|
||||
$(SHELL) $(srcdir)/config.charset '@host@' > t-$@
|
||||
mv t-$@ $@
|
||||
|
||||
check: all
|
||||
|
||||
@@ -104,36 +135,70 @@ check: all
|
||||
# only use the library should use install instead.
|
||||
|
||||
# We must not install the libintl.h/libintl.a files if we are on a
|
||||
# system which has the gettext() function in its C library or in a
|
||||
# separate library or use the catgets interface. A special case is
|
||||
# where configure found a previously installed GNU gettext library.
|
||||
# system which has the GNU gettext() function in its C library or in a
|
||||
# separate library.
|
||||
# If you want to use the one which comes with this version of the
|
||||
# package, you have to use `configure --with-included-gettext'.
|
||||
install: install-exec install-data
|
||||
install-exec: all
|
||||
if test "$(PACKAGE)" = "gettext" \
|
||||
&& test '@INTLOBJS@' = '$(GETTOBJS)'; then \
|
||||
if test -r $(MKINSTALLDIRS); then \
|
||||
$(MKINSTALLDIRS) $(libdir) $(includedir); \
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \
|
||||
$(INSTALL_DATA) libintl.h $(DESTDIR)$(includedir)/libintl.h; \
|
||||
$(LIBTOOL) --mode=install \
|
||||
$(INSTALL_DATA) libintl.$la $(DESTDIR)$(libdir)/libintl.$la; \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
if test '@USE_INCLUDED_LIBINTL@' = yes; then \
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir); \
|
||||
temp=$(DESTDIR)$(libdir)/t-charset.alias; \
|
||||
dest=$(DESTDIR)$(libdir)/charset.alias; \
|
||||
if test -f $(DESTDIR)$(libdir)/charset.alias; then \
|
||||
orig=$(DESTDIR)$(libdir)/charset.alias; \
|
||||
sed -f ref-add.sed $$orig > $$temp; \
|
||||
$(INSTALL_DATA) $$temp $$dest; \
|
||||
rm -f $$temp; \
|
||||
else \
|
||||
$(top_srcdir)/mkinstalldirs $(libdir) $(includedir); \
|
||||
if test @GLIBC21@ = no; then \
|
||||
orig=charset.alias; \
|
||||
sed -f ref-add.sed $$orig > $$temp; \
|
||||
$(INSTALL_DATA) $$temp $$dest; \
|
||||
rm -f $$temp; \
|
||||
fi; \
|
||||
fi; \
|
||||
$(INSTALL_DATA) intlh.inst $(includedir)/libintl.h; \
|
||||
$(INSTALL_DATA) libintl.a $(libdir)/libintl.a; \
|
||||
$(mkinstalldirs) $(DESTDIR)$(localedir); \
|
||||
test -f $(DESTDIR)$(localedir)/locale.alias \
|
||||
&& orig=$(DESTDIR)$(localedir)/locale.alias \
|
||||
|| orig=$(srcdir)/locale.alias; \
|
||||
temp=$(DESTDIR)$(localedir)/t-locale.alias; \
|
||||
dest=$(DESTDIR)$(localedir)/locale.alias; \
|
||||
sed -f ref-add.sed $$orig > $$temp; \
|
||||
$(INSTALL_DATA) $$temp $$dest; \
|
||||
rm -f $$temp; \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
install-data: all
|
||||
if test "$(PACKAGE)" = "gettext"; then \
|
||||
if test -r $(MKINSTALLDIRS); then \
|
||||
$(MKINSTALLDIRS) $(gettextsrcdir); \
|
||||
else \
|
||||
$(top_srcdir)/mkinstalldirs $(gettextsrcdir); \
|
||||
fi; \
|
||||
$(INSTALL_DATA) VERSION $(gettextsrcdir)/VERSION; \
|
||||
$(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
|
||||
$(INSTALL_DATA) VERSION $(DESTDIR)$(gettextsrcdir)/VERSION; \
|
||||
$(INSTALL_DATA) ChangeLog.inst $(DESTDIR)$(gettextsrcdir)/ChangeLog; \
|
||||
dists="$(DISTFILES.common)"; \
|
||||
for file in $$dists; do \
|
||||
$(INSTALL_DATA) $(srcdir)/$$file $(gettextsrcdir)/$$file; \
|
||||
$(INSTALL_DATA) $(srcdir)/$$file \
|
||||
$(DESTDIR)$(gettextsrcdir)/$$file; \
|
||||
done; \
|
||||
chmod a+x $(DESTDIR)$(gettextsrcdir)/config.charset; \
|
||||
dists="$(DISTFILES.generated)"; \
|
||||
for file in $$dists; do \
|
||||
if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
|
||||
$(INSTALL_DATA) $$dir/$$file \
|
||||
$(DESTDIR)$(gettextsrcdir)/$$file; \
|
||||
done; \
|
||||
dists="$(DISTFILES.obsolete)"; \
|
||||
for file in $$dists; do \
|
||||
rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
|
||||
done; \
|
||||
else \
|
||||
: ; \
|
||||
@@ -143,14 +208,51 @@ install-data: all
|
||||
installcheck:
|
||||
|
||||
uninstall:
|
||||
dists="$(DISTFILES.common)"; \
|
||||
for file in $$dists; do \
|
||||
rm -f $(gettextsrcdir)/$$file; \
|
||||
done
|
||||
if test "$(PACKAGE)" = "gettext" \
|
||||
&& test '@INTLOBJS@' = '$(GETTOBJS)'; then \
|
||||
rm -f $(DESTDIR)$(includedir)/libintl.h; \
|
||||
$(LIBTOOL) --mode=uninstall \
|
||||
rm -f $(DESTDIR)$(libdir)/libintl.$la; \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
if test '@USE_INCLUDED_LIBINTL@' = yes; then \
|
||||
if test -f $(DESTDIR)$(libdir)/charset.alias; then \
|
||||
temp=$(DESTDIR)$(libdir)/t-charset.alias; \
|
||||
dest=$(DESTDIR)$(libdir)/charset.alias; \
|
||||
sed -f ref-del.sed $$dest > $$temp; \
|
||||
if grep '^# Packages using this file: $$' $$temp > /dev/null; then \
|
||||
rm -f $$dest; \
|
||||
else \
|
||||
$(INSTALL_DATA) $$temp $$dest; \
|
||||
fi; \
|
||||
rm -f $$temp; \
|
||||
fi; \
|
||||
if test -f $(DESTDIR)$(localedir)/locale.alias; then \
|
||||
temp=$(DESTDIR)$(localedir)/t-locale.alias; \
|
||||
dest=$(DESTDIR)$(localedir)/locale.alias; \
|
||||
sed -f ref-del.sed $$dest > $$temp; \
|
||||
if grep '^# Packages using this file: $$' $$temp > /dev/null; then \
|
||||
rm -f $$dest; \
|
||||
else \
|
||||
$(INSTALL_DATA) $$temp $$dest; \
|
||||
fi; \
|
||||
rm -f $$temp; \
|
||||
fi; \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
if test "$(PACKAGE)" = "gettext"; then \
|
||||
for file in VERSION ChangeLog $(DISTFILES.common) $(DISTFILES.generated); do \
|
||||
rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
|
||||
done; \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
|
||||
info dvi:
|
||||
|
||||
$(OBJECTS): ../config.h libgettext.h
|
||||
$(OBJECTS): ../config.h libgnuintl.h
|
||||
bindtextdom.$lo finddomain.$lo loadmsgcat.$lo: gettextP.h gettext.h loadinfo.h
|
||||
dcgettext.$lo: gettextP.h gettext.h hash-string.h loadinfo.h
|
||||
|
||||
@@ -166,12 +268,19 @@ ID: $(HEADERS) $(SOURCES)
|
||||
|
||||
|
||||
mostlyclean:
|
||||
rm -f *.a *.o *.lo core core.*
|
||||
rm -f *.a *.la *.o *.lo core core.*
|
||||
rm -f libintl.h charset.alias ref-add.sed ref-del.sed
|
||||
rm -f -r .libs _libs
|
||||
|
||||
clean: mostlyclean
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile ID TAGS po2msg.sed po2tbl.sed
|
||||
rm -f Makefile ID TAGS
|
||||
if test "$(PACKAGE)" = gettext; then \
|
||||
rm -f ChangeLog.inst $(DISTFILES.normal); \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
|
||||
maintainer-clean: distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@@ -181,34 +290,23 @@ maintainer-clean: distclean
|
||||
# GNU gettext needs not contain the file `VERSION' but contains some
|
||||
# other files which should not be distributed in other packages.
|
||||
distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
dist distdir: Makefile $(DISTFILES)
|
||||
dist distdir: Makefile
|
||||
if test "$(PACKAGE)" = gettext; then \
|
||||
additional="$(DISTFILES.gettext)"; \
|
||||
else \
|
||||
additional="$(DISTFILES.normal)"; \
|
||||
fi; \
|
||||
for file in $(DISTFILES.common) $$additional; do \
|
||||
ln $(srcdir)/$$file $(distdir) 2> /dev/null \
|
||||
|| cp -p $(srcdir)/$$file $(distdir); \
|
||||
$(MAKE) $(DISTFILES.common) $(DISTFILES.generated) $$additional; \
|
||||
for file in ChangeLog $(DISTFILES.common) $(DISTFILES.generated) $$additional; do \
|
||||
if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
|
||||
ln $$dir/$$file $(distdir) 2> /dev/null \
|
||||
|| cp -p $$dir/$$file $(distdir); \
|
||||
done
|
||||
|
||||
dist-libc:
|
||||
tar zcvf intl-glibc.tar.gz $(COMSRCS) $(COMHDRS) libintl.h.glibc
|
||||
|
||||
Makefile: Makefile.in ../config.status
|
||||
cd .. \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
# The dependency for intlh.inst is different in gettext and all other
|
||||
# packages. Because we cannot you GNU make features we have to solve
|
||||
# the problem while rewriting Makefile.in.
|
||||
@GT_YES@intlh.inst: intlh.inst.in ../config.status
|
||||
@GT_YES@ cd .. \
|
||||
@GT_YES@ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= \
|
||||
@GT_YES@ $(SHELL) ./config.status
|
||||
@GT_NO@.PHONY: intlh.inst
|
||||
@GT_NO@intlh.inst:
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make not to export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
|
||||
@@ -1 +1 @@
|
||||
GNU gettext library from gettext-0.10.35
|
||||
GNU gettext library from gettext-0.10.38
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Implementation of the bindtextdomain(3) function
|
||||
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -19,33 +19,40 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if defined STDC_HEADERS || defined _LIBC
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# ifdef HAVE_MALLOC_H
|
||||
# include <malloc.h>
|
||||
# else
|
||||
void free ();
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined HAVE_STRING_H || defined _LIBC
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
# ifndef memcpy
|
||||
# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
|
||||
# endif
|
||||
#endif
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# include "libgettext.h"
|
||||
# include "libgnuintl.h"
|
||||
#endif
|
||||
#include "gettext.h"
|
||||
#include "gettextP.h"
|
||||
|
||||
#ifdef _LIBC
|
||||
/* We have to handle multi-threaded applications. */
|
||||
# include <bits/libc-lock.h>
|
||||
#else
|
||||
/* Provide dummy implementation if this is outside glibc. */
|
||||
# define __libc_rwlock_define(CLASS, NAME)
|
||||
# define __libc_rwlock_wrlock(NAME)
|
||||
# define __libc_rwlock_unlock(NAME)
|
||||
#endif
|
||||
|
||||
/* The internal variables in the standalone libintl.a must have different
|
||||
names than the internal variables in GNU libc, otherwise programs
|
||||
using libintl.a cannot be linked statically. */
|
||||
#if !defined _LIBC
|
||||
# define _nl_default_dirname _nl_default_dirname__
|
||||
# define _nl_domain_bindings _nl_domain_bindings__
|
||||
#endif
|
||||
|
||||
/* Some compilers, like SunOS4 cc, don't have offsetof in <stddef.h>. */
|
||||
#ifndef offsetof
|
||||
# define offsetof(type,ident) ((size_t)&(((type*)0)->ident))
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
/* Contains the default location of the message catalogs. */
|
||||
@@ -54,6 +61,9 @@ extern const char _nl_default_dirname[];
|
||||
/* List with bindings of specific domains. */
|
||||
extern struct binding *_nl_domain_bindings;
|
||||
|
||||
/* Lock variable to protect the global data in the gettext implementation. */
|
||||
__libc_rwlock_define (extern, _nl_state_lock)
|
||||
|
||||
|
||||
/* Names for the libintl functions are a problem. They must not clash
|
||||
with existing names and they should follow ANSI C. But this source
|
||||
@@ -61,25 +71,48 @@ extern struct binding *_nl_domain_bindings;
|
||||
prefix. So we have to make a difference here. */
|
||||
#ifdef _LIBC
|
||||
# define BINDTEXTDOMAIN __bindtextdomain
|
||||
# define BIND_TEXTDOMAIN_CODESET __bind_textdomain_codeset
|
||||
# ifndef strdup
|
||||
# define strdup(str) __strdup (str)
|
||||
# endif
|
||||
#else
|
||||
# define BINDTEXTDOMAIN bindtextdomain__
|
||||
# define BIND_TEXTDOMAIN_CODESET bind_textdomain_codeset__
|
||||
#endif
|
||||
|
||||
/* Specify that the DOMAINNAME message catalog will be found
|
||||
in DIRNAME rather than in the system locale data base. */
|
||||
char *
|
||||
BINDTEXTDOMAIN (domainname, dirname)
|
||||
/* Prototypes for local functions. */
|
||||
static void set_binding_values PARAMS ((const char *domainname,
|
||||
const char **dirnamep,
|
||||
const char **codesetp));
|
||||
|
||||
/* Specifies the directory name *DIRNAMEP and the output codeset *CODESETP
|
||||
to be used for the DOMAINNAME message catalog.
|
||||
If *DIRNAMEP or *CODESETP is NULL, the corresponding attribute is not
|
||||
modified, only the current value is returned.
|
||||
If DIRNAMEP or CODESETP is NULL, the corresponding attribute is neither
|
||||
modified nor returned. */
|
||||
static void
|
||||
set_binding_values (domainname, dirnamep, codesetp)
|
||||
const char *domainname;
|
||||
const char *dirname;
|
||||
const char **dirnamep;
|
||||
const char **codesetp;
|
||||
{
|
||||
struct binding *binding;
|
||||
int modified;
|
||||
|
||||
/* Some sanity checks. */
|
||||
if (domainname == NULL || domainname[0] == '\0')
|
||||
return NULL;
|
||||
{
|
||||
if (dirnamep)
|
||||
*dirnamep = NULL;
|
||||
if (codesetp)
|
||||
*codesetp = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
__libc_rwlock_wrlock (_nl_state_lock);
|
||||
|
||||
modified = 0;
|
||||
|
||||
for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next)
|
||||
{
|
||||
@@ -95,83 +128,173 @@ BINDTEXTDOMAIN (domainname, dirname)
|
||||
}
|
||||
}
|
||||
|
||||
if (dirname == NULL)
|
||||
/* The current binding has be to returned. */
|
||||
return binding == NULL ? (char *) _nl_default_dirname : binding->dirname;
|
||||
|
||||
if (binding != NULL)
|
||||
{
|
||||
/* The domain is already bound. If the new value and the old
|
||||
one are equal we simply do nothing. Otherwise replace the
|
||||
old binding. */
|
||||
if (strcmp (dirname, binding->dirname) != 0)
|
||||
if (dirnamep)
|
||||
{
|
||||
char *new_dirname;
|
||||
const char *dirname = *dirnamep;
|
||||
|
||||
if (strcmp (dirname, _nl_default_dirname) == 0)
|
||||
new_dirname = (char *) _nl_default_dirname;
|
||||
if (dirname == NULL)
|
||||
/* The current binding has be to returned. */
|
||||
*dirnamep = binding->dirname;
|
||||
else
|
||||
{
|
||||
/* The domain is already bound. If the new value and the old
|
||||
one are equal we simply do nothing. Otherwise replace the
|
||||
old binding. */
|
||||
char *result = binding->dirname;
|
||||
if (strcmp (dirname, result) != 0)
|
||||
{
|
||||
if (strcmp (dirname, _nl_default_dirname) == 0)
|
||||
result = (char *) _nl_default_dirname;
|
||||
else
|
||||
{
|
||||
#if defined _LIBC || defined HAVE_STRDUP
|
||||
new_dirname = strdup (dirname);
|
||||
if (new_dirname == NULL)
|
||||
return NULL;
|
||||
result = strdup (dirname);
|
||||
#else
|
||||
size_t len = strlen (dirname) + 1;
|
||||
new_dirname = (char *) malloc (len);
|
||||
if (new_dirname == NULL)
|
||||
return NULL;
|
||||
|
||||
memcpy (new_dirname, dirname, len);
|
||||
size_t len = strlen (dirname) + 1;
|
||||
result = (char *) malloc (len);
|
||||
if (__builtin_expect (result != NULL, 1))
|
||||
memcpy (result, dirname, len);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (__builtin_expect (result != NULL, 1))
|
||||
{
|
||||
if (binding->dirname != _nl_default_dirname)
|
||||
free (binding->dirname);
|
||||
|
||||
binding->dirname = result;
|
||||
modified = 1;
|
||||
}
|
||||
}
|
||||
*dirnamep = result;
|
||||
}
|
||||
|
||||
if (binding->dirname != _nl_default_dirname)
|
||||
free (binding->dirname);
|
||||
|
||||
binding->dirname = new_dirname;
|
||||
}
|
||||
|
||||
if (codesetp)
|
||||
{
|
||||
const char *codeset = *codesetp;
|
||||
|
||||
if (codeset == NULL)
|
||||
/* The current binding has be to returned. */
|
||||
*codesetp = binding->codeset;
|
||||
else
|
||||
{
|
||||
/* The domain is already bound. If the new value and the old
|
||||
one are equal we simply do nothing. Otherwise replace the
|
||||
old binding. */
|
||||
char *result = binding->codeset;
|
||||
if (result == NULL || strcmp (codeset, result) != 0)
|
||||
{
|
||||
#if defined _LIBC || defined HAVE_STRDUP
|
||||
result = strdup (codeset);
|
||||
#else
|
||||
size_t len = strlen (codeset) + 1;
|
||||
result = (char *) malloc (len);
|
||||
if (__builtin_expect (result != NULL, 1))
|
||||
memcpy (result, codeset, len);
|
||||
#endif
|
||||
|
||||
if (__builtin_expect (result != NULL, 1))
|
||||
{
|
||||
if (binding->codeset != NULL)
|
||||
free (binding->codeset);
|
||||
|
||||
binding->codeset = result;
|
||||
binding->codeset_cntr++;
|
||||
modified = 1;
|
||||
}
|
||||
}
|
||||
*codesetp = result;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((dirnamep == NULL || *dirnamep == NULL)
|
||||
&& (codesetp == NULL || *codesetp == NULL))
|
||||
{
|
||||
/* Simply return the default values. */
|
||||
if (dirnamep)
|
||||
*dirnamep = _nl_default_dirname;
|
||||
if (codesetp)
|
||||
*codesetp = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We have to create a new binding. */
|
||||
#if !defined _LIBC && !defined HAVE_STRDUP
|
||||
size_t len;
|
||||
#endif
|
||||
size_t len = strlen (domainname) + 1;
|
||||
struct binding *new_binding =
|
||||
(struct binding *) malloc (sizeof (*new_binding));
|
||||
(struct binding *) malloc (offsetof (struct binding, domainname) + len);
|
||||
|
||||
if (new_binding == NULL)
|
||||
return NULL;
|
||||
if (__builtin_expect (new_binding == NULL, 0))
|
||||
goto failed;
|
||||
|
||||
#if defined _LIBC || defined HAVE_STRDUP
|
||||
new_binding->domainname = strdup (domainname);
|
||||
if (new_binding->domainname == NULL)
|
||||
return NULL;
|
||||
#else
|
||||
len = strlen (domainname) + 1;
|
||||
new_binding->domainname = (char *) malloc (len);
|
||||
if (new_binding->domainname == NULL)
|
||||
return NULL;
|
||||
memcpy (new_binding->domainname, domainname, len);
|
||||
#endif
|
||||
|
||||
if (strcmp (dirname, _nl_default_dirname) == 0)
|
||||
new_binding->dirname = (char *) _nl_default_dirname;
|
||||
else
|
||||
if (dirnamep)
|
||||
{
|
||||
const char *dirname = *dirnamep;
|
||||
|
||||
if (dirname == NULL)
|
||||
/* The default value. */
|
||||
dirname = _nl_default_dirname;
|
||||
else
|
||||
{
|
||||
if (strcmp (dirname, _nl_default_dirname) == 0)
|
||||
dirname = _nl_default_dirname;
|
||||
else
|
||||
{
|
||||
char *result;
|
||||
#if defined _LIBC || defined HAVE_STRDUP
|
||||
new_binding->dirname = strdup (dirname);
|
||||
if (new_binding->dirname == NULL)
|
||||
return NULL;
|
||||
result = strdup (dirname);
|
||||
if (__builtin_expect (result == NULL, 0))
|
||||
goto failed_dirname;
|
||||
#else
|
||||
len = strlen (dirname) + 1;
|
||||
new_binding->dirname = (char *) malloc (len);
|
||||
if (new_binding->dirname == NULL)
|
||||
return NULL;
|
||||
memcpy (new_binding->dirname, dirname, len);
|
||||
size_t len = strlen (dirname) + 1;
|
||||
result = (char *) malloc (len);
|
||||
if (__builtin_expect (result == NULL, 0))
|
||||
goto failed_dirname;
|
||||
memcpy (result, dirname, len);
|
||||
#endif
|
||||
dirname = result;
|
||||
}
|
||||
}
|
||||
*dirnamep = dirname;
|
||||
new_binding->dirname = (char *) dirname;
|
||||
}
|
||||
else
|
||||
/* The default value. */
|
||||
new_binding->dirname = (char *) _nl_default_dirname;
|
||||
|
||||
new_binding->codeset_cntr = 0;
|
||||
|
||||
if (codesetp)
|
||||
{
|
||||
const char *codeset = *codesetp;
|
||||
|
||||
if (codeset != NULL)
|
||||
{
|
||||
char *result;
|
||||
|
||||
#if defined _LIBC || defined HAVE_STRDUP
|
||||
result = strdup (codeset);
|
||||
if (__builtin_expect (result == NULL, 0))
|
||||
goto failed_codeset;
|
||||
#else
|
||||
size_t len = strlen (codeset) + 1;
|
||||
result = (char *) malloc (len);
|
||||
if (__builtin_expect (result == NULL, 0))
|
||||
goto failed_codeset;
|
||||
memcpy (result, codeset, len);
|
||||
#endif
|
||||
codeset = result;
|
||||
new_binding->codeset_cntr++;
|
||||
}
|
||||
*codesetp = codeset;
|
||||
new_binding->codeset = (char *) codeset;
|
||||
}
|
||||
else
|
||||
new_binding->codeset = NULL;
|
||||
|
||||
/* Now enqueue it. */
|
||||
if (_nl_domain_bindings == NULL
|
||||
@@ -191,13 +314,55 @@ BINDTEXTDOMAIN (domainname, dirname)
|
||||
binding->next = new_binding;
|
||||
}
|
||||
|
||||
binding = new_binding;
|
||||
modified = 1;
|
||||
|
||||
/* Here we deal with memory allocation failures. */
|
||||
if (0)
|
||||
{
|
||||
failed_codeset:
|
||||
if (new_binding->dirname != _nl_default_dirname)
|
||||
free (new_binding->dirname);
|
||||
failed_dirname:
|
||||
free (new_binding);
|
||||
failed:
|
||||
if (dirnamep)
|
||||
*dirnamep = NULL;
|
||||
if (codesetp)
|
||||
*codesetp = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return binding->dirname;
|
||||
/* If we modified any binding, we flush the caches. */
|
||||
if (modified)
|
||||
++_nl_msg_cat_cntr;
|
||||
|
||||
__libc_rwlock_unlock (_nl_state_lock);
|
||||
}
|
||||
|
||||
/* Specify that the DOMAINNAME message catalog will be found
|
||||
in DIRNAME rather than in the system locale data base. */
|
||||
char *
|
||||
BINDTEXTDOMAIN (domainname, dirname)
|
||||
const char *domainname;
|
||||
const char *dirname;
|
||||
{
|
||||
set_binding_values (domainname, &dirname, NULL);
|
||||
return (char *) dirname;
|
||||
}
|
||||
|
||||
/* Specify the character encoding in which the messages from the
|
||||
DOMAINNAME message catalog will be returned. */
|
||||
char *
|
||||
BIND_TEXTDOMAIN_CODESET (domainname, codeset)
|
||||
const char *domainname;
|
||||
const char *codeset;
|
||||
{
|
||||
set_binding_values (domainname, NULL, &codeset);
|
||||
return (char *) codeset;
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Alias for function name in GNU C Library. */
|
||||
/* Aliases for function names in GNU C Library. */
|
||||
weak_alias (__bindtextdomain, bindtextdomain);
|
||||
weak_alias (__bind_textdomain_codeset, bind_textdomain_codeset);
|
||||
#endif
|
||||
|
||||
438
intl/config.charset
Executable file
438
intl/config.charset
Executable file
@@ -0,0 +1,438 @@
|
||||
#! /bin/sh
|
||||
# Output a system dependent table of character encoding aliases.
|
||||
#
|
||||
# Copyright (C) 2000-2001 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Library General Public License as published
|
||||
# by the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
# USA.
|
||||
#
|
||||
# The table consists of lines of the form
|
||||
# ALIAS CANONICAL
|
||||
#
|
||||
# ALIAS is the (system dependent) result of "nl_langinfo (CODESET)".
|
||||
# ALIAS is compared in a case sensitive way.
|
||||
#
|
||||
# CANONICAL is the GNU canonical name for this character encoding.
|
||||
# It must be an encoding supported by libiconv. Support by GNU libc is
|
||||
# also desirable. CANONICAL is case insensitive. Usually an upper case
|
||||
# MIME charset name is preferred.
|
||||
# The current list of GNU canonical charset names is as follows.
|
||||
#
|
||||
# name used by which systems a MIME name?
|
||||
# ASCII, ANSI_X3.4-1968 glibc solaris freebsd
|
||||
# ISO-8859-1 glibc aix hpux irix osf solaris freebsd yes
|
||||
# ISO-8859-2 glibc aix hpux irix osf solaris freebsd yes
|
||||
# ISO-8859-3 glibc yes
|
||||
# ISO-8859-4 osf solaris freebsd yes
|
||||
# ISO-8859-5 glibc aix hpux irix osf solaris freebsd yes
|
||||
# ISO-8859-6 glibc aix hpux solaris yes
|
||||
# ISO-8859-7 glibc aix hpux irix osf solaris yes
|
||||
# ISO-8859-8 glibc aix hpux osf solaris yes
|
||||
# ISO-8859-9 glibc aix hpux irix osf solaris yes
|
||||
# ISO-8859-13 glibc
|
||||
# ISO-8859-15 glibc aix osf solaris freebsd
|
||||
# KOI8-R glibc solaris freebsd yes
|
||||
# KOI8-U glibc freebsd yes
|
||||
# CP437 dos
|
||||
# CP775 dos
|
||||
# CP850 aix osf dos
|
||||
# CP852 dos
|
||||
# CP855 dos
|
||||
# CP856 aix
|
||||
# CP857 dos
|
||||
# CP861 dos
|
||||
# CP862 dos
|
||||
# CP864 dos
|
||||
# CP865 dos
|
||||
# CP866 freebsd dos
|
||||
# CP869 dos
|
||||
# CP874 win32 dos
|
||||
# CP922 aix
|
||||
# CP932 aix win32 dos
|
||||
# CP943 aix
|
||||
# CP949 osf win32 dos
|
||||
# CP950 win32 dos
|
||||
# CP1046 aix
|
||||
# CP1124 aix
|
||||
# CP1129 aix
|
||||
# CP1250 win32
|
||||
# CP1251 glibc win32
|
||||
# CP1252 aix win32
|
||||
# CP1253 win32
|
||||
# CP1254 win32
|
||||
# CP1255 win32
|
||||
# CP1256 win32
|
||||
# CP1257 win32
|
||||
# GB2312 glibc aix hpux irix solaris freebsd yes
|
||||
# EUC-JP glibc aix hpux irix osf solaris freebsd yes
|
||||
# EUC-KR glibc aix hpux irix osf solaris freebsd yes
|
||||
# EUC-TW glibc aix hpux irix osf solaris
|
||||
# BIG5 glibc aix hpux osf solaris freebsd yes
|
||||
# BIG5HKSCS glibc
|
||||
# GBK aix osf win32 dos
|
||||
# GB18030 glibc
|
||||
# SJIS hpux osf solaris freebsd
|
||||
# JOHAB glibc win32
|
||||
# TIS-620 glibc aix hpux osf solaris
|
||||
# VISCII glibc yes
|
||||
# HP-ROMAN8 hpux
|
||||
# HP-ARABIC8 hpux
|
||||
# HP-GREEK8 hpux
|
||||
# HP-HEBREW8 hpux
|
||||
# HP-TURKISH8 hpux
|
||||
# HP-KANA8 hpux
|
||||
# DEC-KANJI osf
|
||||
# DEC-HANYU osf
|
||||
# UTF-8 glibc aix hpux osf solaris yes
|
||||
#
|
||||
# Note: Names which are not marked as being a MIME name should not be used in
|
||||
# Internet protocols for information interchange (mail, news, etc.).
|
||||
#
|
||||
# Note: ASCII and ANSI_X3.4-1968 are synonymous canonical names. Applications
|
||||
# must understand both names and treat them as equivalent.
|
||||
#
|
||||
# The first argument passed to this file is the canonical host specification,
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||
# or
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
|
||||
host="$1"
|
||||
os=`echo "$host" | sed -e 's/^[^-]*-[^-]*-\(.*\)$/\1/'`
|
||||
echo "# This file contains a table of character encoding aliases,"
|
||||
echo "# suitable for operating system '${os}'."
|
||||
echo "# It was automatically generated from config.charset."
|
||||
# List of references, updated during installation:
|
||||
echo "# Packages using this file: "
|
||||
case "$os" in
|
||||
linux* | *-gnu*)
|
||||
# With glibc-2.1 or newer, we don't need any canonicalization,
|
||||
# because glibc has iconv and both glibc and libiconv support all
|
||||
# GNU canonical names directly. Therefore, the Makefile does not
|
||||
# need to install the alias file at all.
|
||||
# The following applies only to glibc-2.0.x and older libcs.
|
||||
echo "ISO_646.IRV:1983 ASCII"
|
||||
;;
|
||||
aix*)
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-6 ISO-8859-6"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-8 ISO-8859-8"
|
||||
echo "ISO8859-9 ISO-8859-9"
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
echo "IBM-850 CP850"
|
||||
echo "IBM-856 CP856"
|
||||
echo "IBM-921 ISO-8859-13"
|
||||
echo "IBM-922 CP922"
|
||||
echo "IBM-932 CP932"
|
||||
echo "IBM-943 CP943"
|
||||
echo "IBM-1046 CP1046"
|
||||
echo "IBM-1124 CP1124"
|
||||
echo "IBM-1129 CP1129"
|
||||
echo "IBM-1252 CP1252"
|
||||
echo "IBM-eucCN GB2312"
|
||||
echo "IBM-eucJP EUC-JP"
|
||||
echo "IBM-eucKR EUC-KR"
|
||||
echo "IBM-eucTW EUC-TW"
|
||||
echo "big5 BIG5"
|
||||
echo "GBK GBK"
|
||||
echo "TIS-620 TIS-620"
|
||||
echo "UTF-8 UTF-8"
|
||||
;;
|
||||
hpux*)
|
||||
echo "iso88591 ISO-8859-1"
|
||||
echo "iso88592 ISO-8859-2"
|
||||
echo "iso88595 ISO-8859-5"
|
||||
echo "iso88596 ISO-8859-6"
|
||||
echo "iso88597 ISO-8859-7"
|
||||
echo "iso88598 ISO-8859-8"
|
||||
echo "iso88599 ISO-8859-9"
|
||||
echo "iso885915 ISO-8859-15"
|
||||
echo "roman8 HP-ROMAN8"
|
||||
echo "arabic8 HP-ARABIC8"
|
||||
echo "greek8 HP-GREEK8"
|
||||
echo "hebrew8 HP-HEBREW8"
|
||||
echo "turkish8 HP-TURKISH8"
|
||||
echo "kana8 HP-KANA8"
|
||||
echo "tis620 TIS-620"
|
||||
echo "big5 BIG5"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "eucKR EUC-KR"
|
||||
echo "eucTW EUC-TW"
|
||||
echo "hp15CN GB2312"
|
||||
#echo "ccdc ?" # what is this?
|
||||
echo "SJIS SJIS"
|
||||
echo "utf8 UTF-8"
|
||||
;;
|
||||
irix*)
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-9 ISO-8859-9"
|
||||
echo "eucCN GB2312"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "eucKR EUC-KR"
|
||||
echo "eucTW EUC-TW"
|
||||
;;
|
||||
osf*)
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-4 ISO-8859-4"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-8 ISO-8859-8"
|
||||
echo "ISO8859-9 ISO-8859-9"
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
echo "cp850 CP850"
|
||||
echo "big5 BIG5"
|
||||
echo "dechanyu DEC-HANYU"
|
||||
echo "dechanzi GB2312"
|
||||
echo "deckanji DEC-KANJI"
|
||||
echo "deckorean EUC-KR"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "eucKR EUC-KR"
|
||||
echo "eucTW EUC-TW"
|
||||
echo "GBK GBK"
|
||||
echo "KSC5601 CP949"
|
||||
echo "sdeckanji EUC-JP"
|
||||
echo "SJIS SJIS"
|
||||
echo "TACTIS TIS-620"
|
||||
echo "UTF-8 UTF-8"
|
||||
;;
|
||||
solaris*)
|
||||
echo "646 ASCII"
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-4 ISO-8859-4"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-6 ISO-8859-6"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-8 ISO-8859-8"
|
||||
echo "ISO8859-9 ISO-8859-9"
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
echo "koi8-r KOI8-R"
|
||||
echo "BIG5 BIG5"
|
||||
echo "gb2312 GB2312"
|
||||
echo "cns11643 EUC-TW"
|
||||
echo "5601 EUC-KR"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "PCK SJIS"
|
||||
echo "TIS620.2533 TIS-620"
|
||||
#echo "sun_eu_greek ?" # what is this?
|
||||
echo "UTF-8 UTF-8"
|
||||
;;
|
||||
freebsd*)
|
||||
# FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore
|
||||
# localcharset.c falls back to using the full locale name
|
||||
# from the environment variables.
|
||||
echo "C ASCII"
|
||||
echo "US-ASCII ASCII"
|
||||
for l in la_LN lt_LN; do
|
||||
echo "$l.ASCII ASCII"
|
||||
done
|
||||
for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
|
||||
fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \
|
||||
lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do
|
||||
echo "$l.ISO_8859-1 ISO-8859-1"
|
||||
echo "$l.DIS_8859-15 ISO-8859-15"
|
||||
done
|
||||
for l in cs_CZ hr_HR hu_HU la_LN lt_LN pl_PL sl_SI; do
|
||||
echo "$l.ISO_8859-2 ISO-8859-2"
|
||||
done
|
||||
for l in la_LN lt_LT; do
|
||||
echo "$l.ISO_8859-4 ISO-8859-4"
|
||||
done
|
||||
for l in ru_RU ru_SU; do
|
||||
echo "$l.KOI8-R KOI8-R"
|
||||
echo "$l.ISO_8859-5 ISO-8859-5"
|
||||
echo "$l.CP866 CP866"
|
||||
done
|
||||
echo "uk_UA.KOI8-U KOI8-U"
|
||||
echo "zh_TW.BIG5 BIG5"
|
||||
echo "zh_TW.Big5 BIG5"
|
||||
echo "zh_CN.EUC GB2312"
|
||||
echo "ja_JP.EUC EUC-JP"
|
||||
echo "ja_JP.SJIS SJIS"
|
||||
echo "ja_JP.Shift_JIS SJIS"
|
||||
echo "ko_KR.EUC EUC-KR"
|
||||
;;
|
||||
beos*)
|
||||
# BeOS has a single locale, and it has UTF-8 encoding.
|
||||
echo "* UTF-8"
|
||||
;;
|
||||
msdosdjgpp*)
|
||||
# DJGPP 2.03 doesn't have nl_langinfo(CODESET); therefore
|
||||
# localcharset.c falls back to using the full locale name
|
||||
# from the environment variables.
|
||||
echo "#"
|
||||
echo "# The encodings given here may not all be correct."
|
||||
echo "# If you find that the encoding given for your language and"
|
||||
echo "# country is not the one your DOS machine actually uses, just"
|
||||
echo "# correct it in this file, and send a mail to"
|
||||
echo "# Juan Manuel Guerrero <st001906@hrz1.hrz.tu-darmstadt.de>"
|
||||
echo "# and Bruno Haible <haible@clisp.cons.org>."
|
||||
echo "#"
|
||||
echo "C ASCII"
|
||||
# ISO-8859-1 languages
|
||||
echo "ca CP850"
|
||||
echo "ca_ES CP850"
|
||||
echo "da CP865" # not CP850 ??
|
||||
echo "da_DK CP865" # not CP850 ??
|
||||
echo "de CP850"
|
||||
echo "de_AT CP850"
|
||||
echo "de_CH CP850"
|
||||
echo "de_DE CP850"
|
||||
echo "en CP850"
|
||||
echo "en_AU CP850" # not CP437 ??
|
||||
echo "en_CA CP850"
|
||||
echo "en_GB CP850"
|
||||
echo "en_NZ CP437"
|
||||
echo "en_US CP437"
|
||||
echo "en_ZA CP850" # not CP437 ??
|
||||
echo "es CP850"
|
||||
echo "es_AR CP850"
|
||||
echo "es_BO CP850"
|
||||
echo "es_CL CP850"
|
||||
echo "es_CO CP850"
|
||||
echo "es_CR CP850"
|
||||
echo "es_CU CP850"
|
||||
echo "es_DO CP850"
|
||||
echo "es_EC CP850"
|
||||
echo "es_ES CP850"
|
||||
echo "es_GT CP850"
|
||||
echo "es_HN CP850"
|
||||
echo "es_MX CP850"
|
||||
echo "es_NI CP850"
|
||||
echo "es_PA CP850"
|
||||
echo "es_PY CP850"
|
||||
echo "es_PE CP850"
|
||||
echo "es_SV CP850"
|
||||
echo "es_UY CP850"
|
||||
echo "es_VE CP850"
|
||||
echo "et CP850"
|
||||
echo "et_EE CP850"
|
||||
echo "eu CP850"
|
||||
echo "eu_ES CP850"
|
||||
echo "fi CP850"
|
||||
echo "fi_FI CP850"
|
||||
echo "fr CP850"
|
||||
echo "fr_BE CP850"
|
||||
echo "fr_CA CP850"
|
||||
echo "fr_CH CP850"
|
||||
echo "fr_FR CP850"
|
||||
echo "ga CP850"
|
||||
echo "ga_IE CP850"
|
||||
echo "gd CP850"
|
||||
echo "gd_GB CP850"
|
||||
echo "gl CP850"
|
||||
echo "gl_ES CP850"
|
||||
echo "id CP850" # not CP437 ??
|
||||
echo "id_ID CP850" # not CP437 ??
|
||||
echo "is CP861" # not CP850 ??
|
||||
echo "is_IS CP861" # not CP850 ??
|
||||
echo "it CP850"
|
||||
echo "it_CH CP850"
|
||||
echo "it_IT CP850"
|
||||
echo "lt CP775"
|
||||
echo "lt_LT CP775"
|
||||
echo "lv CP775"
|
||||
echo "lv_LV CP775"
|
||||
echo "nb CP865" # not CP850 ??
|
||||
echo "nb_NO CP865" # not CP850 ??
|
||||
echo "nl CP850"
|
||||
echo "nl_BE CP850"
|
||||
echo "nl_NL CP850"
|
||||
echo "nn CP865" # not CP850 ??
|
||||
echo "nn_NO CP865" # not CP850 ??
|
||||
echo "no CP865" # not CP850 ??
|
||||
echo "no_NO CP865" # not CP850 ??
|
||||
echo "pt CP850"
|
||||
echo "pt_BR CP850"
|
||||
echo "pt_PT CP850"
|
||||
echo "sv CP850"
|
||||
echo "sv_SE CP850"
|
||||
# ISO-8859-2 languages
|
||||
echo "cs CP852"
|
||||
echo "cs_CZ CP852"
|
||||
echo "hr CP852"
|
||||
echo "hr_HR CP852"
|
||||
echo "hu CP852"
|
||||
echo "hu_HU CP852"
|
||||
echo "pl CP852"
|
||||
echo "pl_PL CP852"
|
||||
echo "ro CP852"
|
||||
echo "ro_RO CP852"
|
||||
echo "sk CP852"
|
||||
echo "sk_SK CP852"
|
||||
echo "sl CP852"
|
||||
echo "sl_SI CP852"
|
||||
echo "sq CP852"
|
||||
echo "sq_AL CP852"
|
||||
echo "sr CP852" # CP852 or CP866 or CP855 ??
|
||||
echo "sr_YU CP852" # CP852 or CP866 or CP855 ??
|
||||
# ISO-8859-3 languages
|
||||
echo "mt CP850"
|
||||
echo "mt_MT CP850"
|
||||
# ISO-8859-5 languages
|
||||
echo "be CP866"
|
||||
echo "be_BE CP866"
|
||||
echo "bg CP866" # not CP855 ??
|
||||
echo "bg_BG CP866" # not CP855 ??
|
||||
echo "mk CP866" # not CP855 ??
|
||||
echo "mk_MK CP866" # not CP855 ??
|
||||
echo "ru KOI8-R" # not CP866 ??
|
||||
echo "ru_RU KOI8-R" # not CP866 ??
|
||||
# ISO-8859-6 languages
|
||||
echo "ar CP864"
|
||||
echo "ar_AE CP864"
|
||||
echo "ar_DZ CP864"
|
||||
echo "ar_EG CP864"
|
||||
echo "ar_IQ CP864"
|
||||
echo "ar_IR CP864"
|
||||
echo "ar_JO CP864"
|
||||
echo "ar_KW CP864"
|
||||
echo "ar_MA CP864"
|
||||
echo "ar_OM CP864"
|
||||
echo "ar_QA CP864"
|
||||
echo "ar_SA CP864"
|
||||
echo "ar_SY CP864"
|
||||
# ISO-8859-7 languages
|
||||
echo "el CP869"
|
||||
echo "el_GR CP869"
|
||||
# ISO-8859-8 languages
|
||||
echo "he CP862"
|
||||
echo "he_IL CP862"
|
||||
# ISO-8859-9 languages
|
||||
echo "tr CP857"
|
||||
echo "tr_TR CP857"
|
||||
# Japanese
|
||||
echo "ja CP932"
|
||||
echo "ja_JP CP932"
|
||||
# Chinese
|
||||
echo "zh_CN GBK"
|
||||
echo "zh_TW CP950" # not CP938 ??
|
||||
# Korean
|
||||
echo "kr CP949" # not CP934 ??
|
||||
echo "kr_KR CP949" # not CP934 ??
|
||||
# Thai
|
||||
echo "th CP874"
|
||||
echo "th_TH CP874"
|
||||
# Other
|
||||
echo "eo CP850"
|
||||
echo "eo_EO CP850"
|
||||
;;
|
||||
esac
|
||||
608
intl/dcgettext.c
608
intl/dcgettext.c
@@ -1,5 +1,5 @@
|
||||
/* Implementation of the dcgettext(3) function.
|
||||
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -19,220 +19,25 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined __GNUC__ && !defined C_ALLOCA
|
||||
# define alloca __builtin_alloca
|
||||
# define HAVE_ALLOCA 1
|
||||
#else
|
||||
# if (defined HAVE_ALLOCA_H || defined _LIBC) && !defined C_ALLOCA
|
||||
# include <alloca.h>
|
||||
# else
|
||||
# ifdef _AIX
|
||||
#pragma alloca
|
||||
# else
|
||||
# ifndef alloca
|
||||
char *alloca ();
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
#ifndef __set_errno
|
||||
# define __set_errno(val) errno = (val)
|
||||
#endif
|
||||
|
||||
#if defined STDC_HEADERS || defined _LIBC
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
char *getenv ();
|
||||
# ifdef HAVE_MALLOC_H
|
||||
# include <malloc.h>
|
||||
# else
|
||||
void free ();
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined HAVE_STRING_H || defined _LIBC
|
||||
# ifndef _GNU_SOURCE
|
||||
# define _GNU_SOURCE 1
|
||||
# endif
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#if !HAVE_STRCHR && !defined _LIBC
|
||||
# ifndef strchr
|
||||
# define strchr index
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined HAVE_UNISTD_H || defined _LIBC
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "gettext.h"
|
||||
#include "gettextP.h"
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# include "libgettext.h"
|
||||
# include "libgnuintl.h"
|
||||
#endif
|
||||
#include "hash-string.h"
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Rename the non ANSI C functions. This is required by the standard
|
||||
because some ANSI C functions will require linking with this object
|
||||
file and the name space must not be polluted. */
|
||||
# define getcwd __getcwd
|
||||
# ifndef stpcpy
|
||||
# define stpcpy __stpcpy
|
||||
# endif
|
||||
#else
|
||||
# if !defined HAVE_GETCWD
|
||||
char *getwd ();
|
||||
# define getcwd(buf, max) getwd (buf)
|
||||
# else
|
||||
char *getcwd ();
|
||||
# endif
|
||||
# ifndef HAVE_STPCPY
|
||||
static char *stpcpy PARAMS ((char *dest, const char *src));
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Amount to increase buffer size by in each try. */
|
||||
#define PATH_INCR 32
|
||||
|
||||
/* The following is from pathmax.h. */
|
||||
/* Non-POSIX BSD systems might have gcc's limits.h, which doesn't define
|
||||
PATH_MAX but might cause redefinition warnings when sys/param.h is
|
||||
later included (as on MORE/BSD 4.3). */
|
||||
#if defined(_POSIX_VERSION) || (defined(HAVE_LIMITS_H) && !defined(__GNUC__))
|
||||
# include <limits.h>
|
||||
#endif
|
||||
|
||||
#ifndef _POSIX_PATH_MAX
|
||||
# define _POSIX_PATH_MAX 255
|
||||
#endif
|
||||
|
||||
#if !defined(PATH_MAX) && defined(_PC_PATH_MAX)
|
||||
# define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 : pathconf ("/", _PC_PATH_MAX))
|
||||
#endif
|
||||
|
||||
/* Don't include sys/param.h if it already has been. */
|
||||
#if defined(HAVE_SYS_PARAM_H) && !defined(PATH_MAX) && !defined(MAXPATHLEN)
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#if !defined(PATH_MAX) && defined(MAXPATHLEN)
|
||||
# define PATH_MAX MAXPATHLEN
|
||||
#endif
|
||||
|
||||
#ifndef PATH_MAX
|
||||
# define PATH_MAX _POSIX_PATH_MAX
|
||||
#endif
|
||||
|
||||
/* XPG3 defines the result of `setlocale (category, NULL)' as:
|
||||
``Directs `setlocale()' to query `category' and return the current
|
||||
setting of `local'.''
|
||||
However it does not specify the exact format. And even worse: POSIX
|
||||
defines this not at all. So we can use this feature only on selected
|
||||
system (e.g. those using GNU C Library). */
|
||||
#ifdef _LIBC
|
||||
# define HAVE_LOCALE_NULL
|
||||
#endif
|
||||
|
||||
/* Name of the default domain used for gettext(3) prior any call to
|
||||
textdomain(3). The default value for this is "messages". */
|
||||
const char _nl_default_default_domain[] = "messages";
|
||||
|
||||
/* Value used as the default domain for gettext(3). */
|
||||
const char *_nl_current_default_domain = _nl_default_default_domain;
|
||||
|
||||
/* Contains the default location of the message catalogs. */
|
||||
const char _nl_default_dirname[] = GNULOCALEDIR;
|
||||
|
||||
/* List with bindings of specific domains created by bindtextdomain()
|
||||
calls. */
|
||||
struct binding *_nl_domain_bindings;
|
||||
|
||||
/* Prototypes for local functions. */
|
||||
static char *find_msg PARAMS ((struct loaded_l10nfile *domain_file,
|
||||
const char *msgid)) internal_function;
|
||||
static const char *category_to_name PARAMS ((int category)) internal_function;
|
||||
static const char *guess_category_value PARAMS ((int category,
|
||||
const char *categoryname))
|
||||
internal_function;
|
||||
|
||||
|
||||
/* For those loosing systems which don't have `alloca' we have to add
|
||||
some additional code emulating it. */
|
||||
#ifdef HAVE_ALLOCA
|
||||
/* Nothing has to be done. */
|
||||
# define ADD_BLOCK(list, address) /* nothing */
|
||||
# define FREE_BLOCKS(list) /* nothing */
|
||||
#else
|
||||
struct block_list
|
||||
{
|
||||
void *address;
|
||||
struct block_list *next;
|
||||
};
|
||||
# define ADD_BLOCK(list, addr) \
|
||||
do { \
|
||||
struct block_list *newp = (struct block_list *) malloc (sizeof (*newp)); \
|
||||
/* If we cannot get a free block we cannot add the new element to \
|
||||
the list. */ \
|
||||
if (newp != NULL) { \
|
||||
newp->address = (addr); \
|
||||
newp->next = (list); \
|
||||
(list) = newp; \
|
||||
} \
|
||||
} while (0)
|
||||
# define FREE_BLOCKS(list) \
|
||||
do { \
|
||||
while (list != NULL) { \
|
||||
struct block_list *old = list; \
|
||||
list = list->next; \
|
||||
free (old); \
|
||||
} \
|
||||
} while (0)
|
||||
# undef alloca
|
||||
# define alloca(size) (malloc (size))
|
||||
#endif /* have alloca */
|
||||
|
||||
|
||||
/* Names for the libintl functions are a problem. They must not clash
|
||||
with existing names and they should follow ANSI C. But this source
|
||||
code is also used in GNU C Library where the names have a __
|
||||
prefix. So we have to make a difference here. */
|
||||
#ifdef _LIBC
|
||||
# define DCGETTEXT __dcgettext
|
||||
# define DCIGETTEXT __dcigettext
|
||||
#else
|
||||
# define DCGETTEXT dcgettext__
|
||||
#endif
|
||||
|
||||
/* Checking whether the binaries runs SUID must be done and glibc provides
|
||||
easier methods therefore we make a difference here. */
|
||||
#ifdef _LIBC
|
||||
# define ENABLE_SECURE __libc_enable_secure
|
||||
# define DETERMINE_SECURE
|
||||
#else
|
||||
static int enable_secure;
|
||||
# define ENABLE_SECURE (enable_secure == 1)
|
||||
# define DETERMINE_SECURE \
|
||||
if (enable_secure == 0) \
|
||||
{ \
|
||||
if (getuid () != geteuid () || getgid () != getegid ()) \
|
||||
enable_secure = 1; \
|
||||
else \
|
||||
enable_secure = -1; \
|
||||
}
|
||||
# define DCIGETTEXT dcigettext__
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
|
||||
@@ -243,413 +48,10 @@ DCGETTEXT (domainname, msgid, category)
|
||||
const char *msgid;
|
||||
int category;
|
||||
{
|
||||
#ifndef HAVE_ALLOCA
|
||||
struct block_list *block_list = NULL;
|
||||
#endif
|
||||
struct loaded_l10nfile *domain;
|
||||
struct binding *binding;
|
||||
const char *categoryname;
|
||||
const char *categoryvalue;
|
||||
char *dirname, *xdomainname;
|
||||
char *single_locale;
|
||||
char *retval;
|
||||
int saved_errno = errno;
|
||||
|
||||
/* If no real MSGID is given return NULL. */
|
||||
if (msgid == NULL)
|
||||
return NULL;
|
||||
|
||||
/* See whether this is a SUID binary or not. */
|
||||
DETERMINE_SECURE;
|
||||
|
||||
/* If DOMAINNAME is NULL, we are interested in the default domain. If
|
||||
CATEGORY is not LC_MESSAGES this might not make much sense but the
|
||||
definition left this undefined. */
|
||||
if (domainname == NULL)
|
||||
domainname = _nl_current_default_domain;
|
||||
|
||||
/* First find matching binding. */
|
||||
for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next)
|
||||
{
|
||||
int compare = strcmp (domainname, binding->domainname);
|
||||
if (compare == 0)
|
||||
/* We found it! */
|
||||
break;
|
||||
if (compare < 0)
|
||||
{
|
||||
/* It is not in the list. */
|
||||
binding = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (binding == NULL)
|
||||
dirname = (char *) _nl_default_dirname;
|
||||
else if (binding->dirname[0] == '/')
|
||||
dirname = binding->dirname;
|
||||
else
|
||||
{
|
||||
/* We have a relative path. Make it absolute now. */
|
||||
size_t dirname_len = strlen (binding->dirname) + 1;
|
||||
size_t path_max;
|
||||
char *ret;
|
||||
|
||||
path_max = (unsigned int) PATH_MAX;
|
||||
path_max += 2; /* The getcwd docs say to do this. */
|
||||
|
||||
dirname = (char *) alloca (path_max + dirname_len);
|
||||
ADD_BLOCK (block_list, dirname);
|
||||
|
||||
__set_errno (0);
|
||||
while ((ret = getcwd (dirname, path_max)) == NULL && errno == ERANGE)
|
||||
{
|
||||
path_max += PATH_INCR;
|
||||
dirname = (char *) alloca (path_max + dirname_len);
|
||||
ADD_BLOCK (block_list, dirname);
|
||||
__set_errno (0);
|
||||
}
|
||||
|
||||
if (ret == NULL)
|
||||
{
|
||||
/* We cannot get the current working directory. Don't signal an
|
||||
error but simply return the default string. */
|
||||
FREE_BLOCKS (block_list);
|
||||
__set_errno (saved_errno);
|
||||
return (char *) msgid;
|
||||
}
|
||||
|
||||
stpcpy (stpcpy (strchr (dirname, '\0'), "/"), binding->dirname);
|
||||
}
|
||||
|
||||
/* Now determine the symbolic name of CATEGORY and its value. */
|
||||
categoryname = category_to_name (category);
|
||||
categoryvalue = guess_category_value (category, categoryname);
|
||||
|
||||
xdomainname = (char *) alloca (strlen (categoryname)
|
||||
+ strlen (domainname) + 5);
|
||||
ADD_BLOCK (block_list, xdomainname);
|
||||
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (xdomainname, categoryname), "/"),
|
||||
domainname),
|
||||
".mo");
|
||||
|
||||
/* Creating working area. */
|
||||
single_locale = (char *) alloca (strlen (categoryvalue) + 1);
|
||||
ADD_BLOCK (block_list, single_locale);
|
||||
|
||||
|
||||
/* Search for the given string. This is a loop because we perhaps
|
||||
got an ordered list of languages to consider for the translation. */
|
||||
while (1)
|
||||
{
|
||||
/* Make CATEGORYVALUE point to the next element of the list. */
|
||||
while (categoryvalue[0] != '\0' && categoryvalue[0] == ':')
|
||||
++categoryvalue;
|
||||
if (categoryvalue[0] == '\0')
|
||||
{
|
||||
/* The whole contents of CATEGORYVALUE has been searched but
|
||||
no valid entry has been found. We solve this situation
|
||||
by implicitly appending a "C" entry, i.e. no translation
|
||||
will take place. */
|
||||
single_locale[0] = 'C';
|
||||
single_locale[1] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
char *cp = single_locale;
|
||||
while (categoryvalue[0] != '\0' && categoryvalue[0] != ':')
|
||||
*cp++ = *categoryvalue++;
|
||||
*cp = '\0';
|
||||
|
||||
/* When this is a SUID binary we must not allow accessing files
|
||||
outside the dedicated directories. */
|
||||
if (ENABLE_SECURE
|
||||
&& (memchr (single_locale, '/',
|
||||
_nl_find_language (single_locale) - single_locale)
|
||||
!= NULL))
|
||||
/* Ingore this entry. */
|
||||
continue;
|
||||
}
|
||||
|
||||
/* If the current locale value is C (or POSIX) we don't load a
|
||||
domain. Return the MSGID. */
|
||||
if (strcmp (single_locale, "C") == 0
|
||||
|| strcmp (single_locale, "POSIX") == 0)
|
||||
{
|
||||
FREE_BLOCKS (block_list);
|
||||
__set_errno (saved_errno);
|
||||
return (char *) msgid;
|
||||
}
|
||||
|
||||
|
||||
/* Find structure describing the message catalog matching the
|
||||
DOMAINNAME and CATEGORY. */
|
||||
domain = _nl_find_domain (dirname, single_locale, xdomainname);
|
||||
|
||||
if (domain != NULL)
|
||||
{
|
||||
retval = find_msg (domain, msgid);
|
||||
|
||||
if (retval == NULL)
|
||||
{
|
||||
int cnt;
|
||||
|
||||
for (cnt = 0; domain->successor[cnt] != NULL; ++cnt)
|
||||
{
|
||||
retval = find_msg (domain->successor[cnt], msgid);
|
||||
|
||||
if (retval != NULL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (retval != NULL)
|
||||
{
|
||||
FREE_BLOCKS (block_list);
|
||||
__set_errno (saved_errno);
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* NOTREACHED */
|
||||
return DCIGETTEXT (domainname, msgid, NULL, 0, 0, category);
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Alias for function name in GNU C Library. */
|
||||
weak_alias (__dcgettext, dcgettext);
|
||||
#endif
|
||||
|
||||
|
||||
static char *
|
||||
internal_function
|
||||
find_msg (domain_file, msgid)
|
||||
struct loaded_l10nfile *domain_file;
|
||||
const char *msgid;
|
||||
{
|
||||
size_t act = 0;
|
||||
size_t top, bottom;
|
||||
struct loaded_domain *domain;
|
||||
|
||||
if (domain_file->decided == 0)
|
||||
_nl_load_domain (domain_file);
|
||||
|
||||
if (domain_file->data == NULL)
|
||||
return NULL;
|
||||
|
||||
domain = (struct loaded_domain *) domain_file->data;
|
||||
|
||||
/* Locate the MSGID and its translation. */
|
||||
if (domain->hash_size > 2 && domain->hash_tab != NULL)
|
||||
{
|
||||
/* Use the hashing table. */
|
||||
nls_uint32 len = strlen (msgid);
|
||||
nls_uint32 hash_val = hash_string (msgid);
|
||||
nls_uint32 idx = hash_val % domain->hash_size;
|
||||
nls_uint32 incr = 1 + (hash_val % (domain->hash_size - 2));
|
||||
nls_uint32 nstr = W (domain->must_swap, domain->hash_tab[idx]);
|
||||
|
||||
if (nstr == 0)
|
||||
/* Hash table entry is empty. */
|
||||
return NULL;
|
||||
|
||||
if (W (domain->must_swap, domain->orig_tab[nstr - 1].length) == len
|
||||
&& strcmp (msgid,
|
||||
domain->data + W (domain->must_swap,
|
||||
domain->orig_tab[nstr - 1].offset)) == 0)
|
||||
return (char *) domain->data + W (domain->must_swap,
|
||||
domain->trans_tab[nstr - 1].offset);
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (idx >= domain->hash_size - incr)
|
||||
idx -= domain->hash_size - incr;
|
||||
else
|
||||
idx += incr;
|
||||
|
||||
nstr = W (domain->must_swap, domain->hash_tab[idx]);
|
||||
if (nstr == 0)
|
||||
/* Hash table entry is empty. */
|
||||
return NULL;
|
||||
|
||||
if (W (domain->must_swap, domain->orig_tab[nstr - 1].length) == len
|
||||
&& strcmp (msgid,
|
||||
domain->data + W (domain->must_swap,
|
||||
domain->orig_tab[nstr - 1].offset))
|
||||
== 0)
|
||||
return (char *) domain->data
|
||||
+ W (domain->must_swap, domain->trans_tab[nstr - 1].offset);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
/* Now we try the default method: binary search in the sorted
|
||||
array of messages. */
|
||||
bottom = 0;
|
||||
top = domain->nstrings;
|
||||
while (bottom < top)
|
||||
{
|
||||
int cmp_val;
|
||||
|
||||
act = (bottom + top) / 2;
|
||||
cmp_val = strcmp (msgid, domain->data
|
||||
+ W (domain->must_swap,
|
||||
domain->orig_tab[act].offset));
|
||||
if (cmp_val < 0)
|
||||
top = act;
|
||||
else if (cmp_val > 0)
|
||||
bottom = act + 1;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
/* If an translation is found return this. */
|
||||
return bottom >= top ? NULL : (char *) domain->data
|
||||
+ W (domain->must_swap,
|
||||
domain->trans_tab[act].offset);
|
||||
}
|
||||
|
||||
|
||||
/* Return string representation of locale CATEGORY. */
|
||||
static const char *
|
||||
internal_function
|
||||
category_to_name (category)
|
||||
int category;
|
||||
{
|
||||
const char *retval;
|
||||
|
||||
switch (category)
|
||||
{
|
||||
#ifdef LC_COLLATE
|
||||
case LC_COLLATE:
|
||||
retval = "LC_COLLATE";
|
||||
break;
|
||||
#endif
|
||||
#ifdef LC_CTYPE
|
||||
case LC_CTYPE:
|
||||
retval = "LC_CTYPE";
|
||||
break;
|
||||
#endif
|
||||
#ifdef LC_MONETARY
|
||||
case LC_MONETARY:
|
||||
retval = "LC_MONETARY";
|
||||
break;
|
||||
#endif
|
||||
#ifdef LC_NUMERIC
|
||||
case LC_NUMERIC:
|
||||
retval = "LC_NUMERIC";
|
||||
break;
|
||||
#endif
|
||||
#ifdef LC_TIME
|
||||
case LC_TIME:
|
||||
retval = "LC_TIME";
|
||||
break;
|
||||
#endif
|
||||
#ifdef LC_MESSAGES
|
||||
case LC_MESSAGES:
|
||||
retval = "LC_MESSAGES";
|
||||
break;
|
||||
#endif
|
||||
#ifdef LC_RESPONSE
|
||||
case LC_RESPONSE:
|
||||
retval = "LC_RESPONSE";
|
||||
break;
|
||||
#endif
|
||||
#ifdef LC_ALL
|
||||
case LC_ALL:
|
||||
/* This might not make sense but is perhaps better than any other
|
||||
value. */
|
||||
retval = "LC_ALL";
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
/* If you have a better idea for a default value let me know. */
|
||||
retval = "LC_XXX";
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Guess value of current locale from value of the environment variables. */
|
||||
static const char *
|
||||
internal_function
|
||||
guess_category_value (category, categoryname)
|
||||
int category;
|
||||
const char *categoryname;
|
||||
{
|
||||
const char *retval;
|
||||
|
||||
/* The highest priority value is the `LANGUAGE' environment
|
||||
variable. This is a GNU extension. */
|
||||
retval = getenv ("LANGUAGE");
|
||||
if (retval != NULL && retval[0] != '\0')
|
||||
return retval;
|
||||
|
||||
/* `LANGUAGE' is not set. So we have to proceed with the POSIX
|
||||
methods of looking to `LC_ALL', `LC_xxx', and `LANG'. On some
|
||||
systems this can be done by the `setlocale' function itself. */
|
||||
#if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL
|
||||
return setlocale (category, NULL);
|
||||
#else
|
||||
/* Setting of LC_ALL overwrites all other. */
|
||||
retval = getenv ("LC_ALL");
|
||||
if (retval != NULL && retval[0] != '\0')
|
||||
return retval;
|
||||
|
||||
/* Next comes the name of the desired category. */
|
||||
retval = getenv (categoryname);
|
||||
if (retval != NULL && retval[0] != '\0')
|
||||
return retval;
|
||||
|
||||
/* Last possibility is the LANG environment variable. */
|
||||
retval = getenv ("LANG");
|
||||
if (retval != NULL && retval[0] != '\0')
|
||||
return retval;
|
||||
|
||||
/* We use C as the default domain. POSIX says this is implementation
|
||||
defined. */
|
||||
return "C";
|
||||
#endif
|
||||
}
|
||||
|
||||
/* @@ begin of epilog @@ */
|
||||
|
||||
/* We don't want libintl.a to depend on any other library. So we
|
||||
avoid the non-standard function stpcpy. In GNU C Library this
|
||||
function is available, though. Also allow the symbol HAVE_STPCPY
|
||||
to be defined. */
|
||||
#if !_LIBC && !HAVE_STPCPY
|
||||
static char *
|
||||
stpcpy (dest, src)
|
||||
char *dest;
|
||||
const char *src;
|
||||
{
|
||||
while ((*dest++ = *src++) != '\0')
|
||||
/* Do nothing. */ ;
|
||||
return dest - 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _LIBC
|
||||
/* If we want to free all resources we have to do some work at
|
||||
program's end. */
|
||||
static void __attribute__ ((unused))
|
||||
free_mem (void)
|
||||
{
|
||||
struct binding *runp;
|
||||
|
||||
for (runp = _nl_domain_bindings; runp != NULL; runp = runp->next)
|
||||
{
|
||||
free (runp->domainname);
|
||||
if (runp->dirname != _nl_default_dirname)
|
||||
/* Yes, this is a pointer comparison. */
|
||||
free (runp->dirname);
|
||||
}
|
||||
|
||||
if (_nl_current_default_domain != _nl_default_default_domain)
|
||||
/* Yes, again a pointer comparison. */
|
||||
free ((char *) _nl_current_default_domain);
|
||||
}
|
||||
|
||||
text_set_element (__libc_subfreeres, free_mem);
|
||||
#endif
|
||||
|
||||
1257
intl/dcigettext.c
Normal file
1257
intl/dcigettext.c
Normal file
File diff suppressed because it is too large
Load Diff
59
intl/dcngettext.c
Normal file
59
intl/dcngettext.c
Normal file
@@ -0,0 +1,59 @@
|
||||
/* Implementation of the dcngettext(3) function.
|
||||
Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "gettextP.h"
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# include "libgnuintl.h"
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
/* Names for the libintl functions are a problem. They must not clash
|
||||
with existing names and they should follow ANSI C. But this source
|
||||
code is also used in GNU C Library where the names have a __
|
||||
prefix. So we have to make a difference here. */
|
||||
#ifdef _LIBC
|
||||
# define DCNGETTEXT __dcngettext
|
||||
# define DCIGETTEXT __dcigettext
|
||||
#else
|
||||
# define DCNGETTEXT dcngettext__
|
||||
# define DCIGETTEXT dcigettext__
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
|
||||
locale. */
|
||||
char *
|
||||
DCNGETTEXT (domainname, msgid1, msgid2, n, category)
|
||||
const char *domainname;
|
||||
const char *msgid1;
|
||||
const char *msgid2;
|
||||
unsigned long int n;
|
||||
int category;
|
||||
{
|
||||
return DCIGETTEXT (domainname, msgid1, msgid2, 1, n, category);
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Alias for function name in GNU C Library. */
|
||||
weak_alias (__dcngettext, dcngettext);
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Implementation of the dgettext(3) function
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
/* Implementation of the dgettext(3) function.
|
||||
Copyright (C) 1995-1997, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -19,14 +19,13 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if defined HAVE_LOCALE_H || defined _LIBC
|
||||
# include <locale.h>
|
||||
#endif
|
||||
#include <locale.h>
|
||||
|
||||
#include "gettextP.h"
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# include "libgettext.h"
|
||||
# include "libgnuintl.h"
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
60
intl/dngettext.c
Normal file
60
intl/dngettext.c
Normal file
@@ -0,0 +1,60 @@
|
||||
/* Implementation of the dngettext(3) function.
|
||||
Copyright (C) 1995-1997, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
#include "gettextP.h"
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# include "libgnuintl.h"
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
/* Names for the libintl functions are a problem. They must not clash
|
||||
with existing names and they should follow ANSI C. But this source
|
||||
code is also used in GNU C Library where the names have a __
|
||||
prefix. So we have to make a difference here. */
|
||||
#ifdef _LIBC
|
||||
# define DNGETTEXT __dngettext
|
||||
# define DCNGETTEXT __dcngettext
|
||||
#else
|
||||
# define DNGETTEXT dngettext__
|
||||
# define DCNGETTEXT dcngettext__
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the DOMAINNAME message catalog of the current
|
||||
LC_MESSAGES locale and skip message according to the plural form. */
|
||||
char *
|
||||
DNGETTEXT (domainname, msgid1, msgid2, n)
|
||||
const char *domainname;
|
||||
const char *msgid1;
|
||||
const char *msgid2;
|
||||
unsigned long int n;
|
||||
{
|
||||
return DCNGETTEXT (domainname, msgid1, msgid2, n, LC_MESSAGES);
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Alias for function name in GNU C Library. */
|
||||
weak_alias (__dngettext, dngettext);
|
||||
#endif
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc.
|
||||
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -19,15 +19,8 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if defined STDC_HEADERS || defined _LIBC
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#if defined HAVE_STRING_H || defined _LIBC
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "loadinfo.h"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Handle list of needed message catalogs
|
||||
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
|
||||
Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
Written by Ulrich Drepper <drepper@gnu.org>, 1995.
|
||||
|
||||
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
|
||||
@@ -20,45 +20,20 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined STDC_HEADERS || defined _LIBC
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# ifdef HAVE_MALLOC_H
|
||||
# include <malloc.h>
|
||||
# else
|
||||
void free ();
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined HAVE_STRING_H || defined _LIBC
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
# ifndef memcpy
|
||||
# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
|
||||
# endif
|
||||
#endif
|
||||
#if !HAVE_STRCHR && !defined _LIBC
|
||||
# ifndef strchr
|
||||
# define strchr index
|
||||
# endif
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined HAVE_UNISTD_H || defined _LIBC
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "gettext.h"
|
||||
#include "gettextP.h"
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# include "libgettext.h"
|
||||
# include "libgnuintl.h"
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
@@ -71,10 +46,11 @@ static struct loaded_l10nfile *_nl_loaded_domains;
|
||||
established bindings. */
|
||||
struct loaded_l10nfile *
|
||||
internal_function
|
||||
_nl_find_domain (dirname, locale, domainname)
|
||||
_nl_find_domain (dirname, locale, domainname, domainbinding)
|
||||
const char *dirname;
|
||||
char *locale;
|
||||
const char *domainname;
|
||||
struct binding *domainbinding;
|
||||
{
|
||||
struct loaded_l10nfile *retval;
|
||||
const char *language;
|
||||
@@ -120,7 +96,7 @@ _nl_find_domain (dirname, locale, domainname)
|
||||
int cnt;
|
||||
|
||||
if (retval->decided == 0)
|
||||
_nl_load_domain (retval);
|
||||
_nl_load_domain (retval, domainbinding);
|
||||
|
||||
if (retval->data != NULL)
|
||||
return retval;
|
||||
@@ -128,7 +104,7 @@ _nl_find_domain (dirname, locale, domainname)
|
||||
for (cnt = 0; retval->successor[cnt] != NULL; ++cnt)
|
||||
{
|
||||
if (retval->successor[cnt]->decided == 0)
|
||||
_nl_load_domain (retval->successor[cnt]);
|
||||
_nl_load_domain (retval->successor[cnt], domainbinding);
|
||||
|
||||
if (retval->successor[cnt]->data != NULL)
|
||||
break;
|
||||
@@ -175,14 +151,14 @@ _nl_find_domain (dirname, locale, domainname)
|
||||
return NULL;
|
||||
|
||||
if (retval->decided == 0)
|
||||
_nl_load_domain (retval);
|
||||
_nl_load_domain (retval, domainbinding);
|
||||
if (retval->data == NULL)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; retval->successor[cnt] != NULL; ++cnt)
|
||||
{
|
||||
if (retval->successor[cnt]->decided == 0)
|
||||
_nl_load_domain (retval->successor[cnt]);
|
||||
_nl_load_domain (retval->successor[cnt], domainbinding);
|
||||
if (retval->successor[cnt]->data != NULL)
|
||||
break;
|
||||
}
|
||||
@@ -192,6 +168,10 @@ _nl_find_domain (dirname, locale, domainname)
|
||||
if (alias_value != NULL)
|
||||
free (locale);
|
||||
|
||||
/* The space for normalized_codeset is dynamically allocated. Free it. */
|
||||
if (mask & XPG_NORM_CODESET)
|
||||
free ((void *) normalized_codeset);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -208,6 +188,7 @@ free_mem (void)
|
||||
if (runp->data != NULL)
|
||||
_nl_unload_domain ((struct loaded_domain *) runp->data);
|
||||
runp = runp->next;
|
||||
free ((char *) here->filename);
|
||||
free (here);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Implementation of gettext(3) function.
|
||||
Copyright (C) 1995, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995, 1997, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -23,21 +23,14 @@
|
||||
# define __need_NULL
|
||||
# include <stddef.h>
|
||||
#else
|
||||
# ifdef STDC_HEADERS
|
||||
# include <stdlib.h> /* Just for NULL. */
|
||||
# else
|
||||
# ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
# else
|
||||
# define NULL ((void *) 0)
|
||||
# endif
|
||||
# endif
|
||||
# include <stdlib.h> /* Just for NULL. */
|
||||
#endif
|
||||
|
||||
#include "gettextP.h"
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# include "libgettext.h"
|
||||
# include "libgnuintl.h"
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
@@ -48,10 +41,10 @@
|
||||
prefix. So we have to make a difference here. */
|
||||
#ifdef _LIBC
|
||||
# define GETTEXT __gettext
|
||||
# define DGETTEXT __dgettext
|
||||
# define DCGETTEXT __dcgettext
|
||||
#else
|
||||
# define GETTEXT gettext__
|
||||
# define DGETTEXT dgettext__
|
||||
# define DCGETTEXT dcgettext__
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the current default message catalog for the current
|
||||
@@ -61,7 +54,7 @@ char *
|
||||
GETTEXT (msgid)
|
||||
const char *msgid;
|
||||
{
|
||||
return DGETTEXT (NULL, msgid);
|
||||
return DCGETTEXT (NULL, msgid, LC_MESSAGES);
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Internal header for GNU gettext internationalization functions.
|
||||
Copyright (C) 1995, 1997 Free Software Foundation, Inc.
|
||||
/* Description of GNU message catalog format: general file layout.
|
||||
Copyright (C) 1995, 1997, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -11,16 +11,13 @@
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _GETTEXT_H
|
||||
#define _GETTEXT_H 1
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#if HAVE_LIMITS_H || _LIBC
|
||||
# include <limits.h>
|
||||
#endif
|
||||
@@ -37,9 +34,8 @@
|
||||
/* The following contortions are an attempt to use the C preprocessor
|
||||
to determine an unsigned integral type that is 32 bits wide. An
|
||||
alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
|
||||
doing that would require that the configure script compile and *run*
|
||||
the resulting executable. Locally running cross-compiled executables
|
||||
is usually not possible. */
|
||||
as of version autoconf-2.13, the AC_CHECK_SIZEOF macro doesn't work
|
||||
when cross-compiling. */
|
||||
|
||||
#if __STDC__
|
||||
# define UINT_MAX_32_BITS 4294967295U
|
||||
|
||||
178
intl/gettextP.h
178
intl/gettextP.h
@@ -1,6 +1,6 @@
|
||||
/* Header describing internals of gettext library
|
||||
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
|
||||
/* Header describing internals of libintl library.
|
||||
Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
Written by Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||
|
||||
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
|
||||
@@ -19,8 +19,20 @@
|
||||
#ifndef _GETTEXTP_H
|
||||
#define _GETTEXTP_H
|
||||
|
||||
#include <stddef.h> /* Get size_t. */
|
||||
|
||||
#ifdef _LIBC
|
||||
# include "../iconv/gconv_int.h"
|
||||
#else
|
||||
# if HAVE_ICONV
|
||||
# include <iconv.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "loadinfo.h"
|
||||
|
||||
#include "gettext.h" /* Get nls_uint32. */
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
#ifndef PARAMS
|
||||
@@ -35,6 +47,12 @@
|
||||
# define internal_function
|
||||
#endif
|
||||
|
||||
/* Tell the compiler when a conditional or integer expression is
|
||||
almost always true or almost always false. */
|
||||
#ifndef HAVE_BUILTIN_EXPECT
|
||||
# define __builtin_expect(expr, val) (expr)
|
||||
#endif
|
||||
|
||||
#ifndef W
|
||||
# define W(flag, data) ((flag) ? SWAP (data) : (data))
|
||||
#endif
|
||||
@@ -44,8 +62,6 @@
|
||||
# include <byteswap.h>
|
||||
# define SWAP(i) bswap_32 (i)
|
||||
#else
|
||||
static nls_uint32 SWAP PARAMS ((nls_uint32 i));
|
||||
|
||||
static inline nls_uint32
|
||||
SWAP (i)
|
||||
nls_uint32 i;
|
||||
@@ -55,6 +71,52 @@ SWAP (i)
|
||||
#endif
|
||||
|
||||
|
||||
/* This is the representation of the expressions to determine the
|
||||
plural form. */
|
||||
struct expression
|
||||
{
|
||||
int nargs; /* Number of arguments. */
|
||||
enum operator
|
||||
{
|
||||
/* Without arguments: */
|
||||
var, /* The variable "n". */
|
||||
num, /* Decimal number. */
|
||||
/* Unary operators: */
|
||||
lnot, /* Logical NOT. */
|
||||
/* Binary operators: */
|
||||
mult, /* Multiplication. */
|
||||
divide, /* Division. */
|
||||
module, /* Module operation. */
|
||||
plus, /* Addition. */
|
||||
minus, /* Subtraction. */
|
||||
less_than, /* Comparison. */
|
||||
greater_than, /* Comparison. */
|
||||
less_or_equal, /* Comparison. */
|
||||
greater_or_equal, /* Comparison. */
|
||||
equal, /* Comparision for equality. */
|
||||
not_equal, /* Comparision for inequality. */
|
||||
land, /* Logical AND. */
|
||||
lor, /* Logical OR. */
|
||||
/* Ternary operators: */
|
||||
qmop /* Question mark operator. */
|
||||
} operation;
|
||||
union
|
||||
{
|
||||
unsigned long int num; /* Number value for `num'. */
|
||||
struct expression *args[3]; /* Up to three arguments. */
|
||||
} val;
|
||||
};
|
||||
|
||||
/* This is the data structure to pass information to the parser and get
|
||||
the result in a thread-safe way. */
|
||||
struct parse_args
|
||||
{
|
||||
const char *cp;
|
||||
struct expression *res;
|
||||
};
|
||||
|
||||
|
||||
/* The representation of an opened message catalog. */
|
||||
struct loaded_domain
|
||||
{
|
||||
const char *data;
|
||||
@@ -66,23 +128,123 @@ struct loaded_domain
|
||||
struct string_desc *trans_tab;
|
||||
nls_uint32 hash_size;
|
||||
nls_uint32 *hash_tab;
|
||||
int codeset_cntr;
|
||||
#ifdef _LIBC
|
||||
__gconv_t conv;
|
||||
#else
|
||||
# if HAVE_ICONV
|
||||
iconv_t conv;
|
||||
# endif
|
||||
#endif
|
||||
char **conv_tab;
|
||||
|
||||
struct expression *plural;
|
||||
unsigned long int nplurals;
|
||||
};
|
||||
|
||||
/* We want to allocate a string at the end of the struct. But ISO C
|
||||
doesn't allow zero sized arrays. */
|
||||
#ifdef __GNUC__
|
||||
# define ZERO 0
|
||||
#else
|
||||
# define ZERO 1
|
||||
#endif
|
||||
|
||||
/* A set of settings bound to a message domain. Used to store settings
|
||||
from bindtextdomain() and bind_textdomain_codeset(). */
|
||||
struct binding
|
||||
{
|
||||
struct binding *next;
|
||||
char *domainname;
|
||||
char *dirname;
|
||||
int codeset_cntr; /* Incremented each time codeset changes. */
|
||||
char *codeset;
|
||||
char domainname[ZERO];
|
||||
};
|
||||
|
||||
/* A counter which is incremented each time some previous translations
|
||||
become invalid.
|
||||
This variable is part of the external ABI of the GNU libintl. */
|
||||
extern int _nl_msg_cat_cntr;
|
||||
|
||||
struct loaded_l10nfile *_nl_find_domain PARAMS ((const char *__dirname,
|
||||
char *__locale,
|
||||
const char *__domainname))
|
||||
const char *__domainname,
|
||||
struct binding *__domainbinding))
|
||||
internal_function;
|
||||
void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain))
|
||||
void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain,
|
||||
struct binding *__domainbinding))
|
||||
internal_function;
|
||||
void _nl_unload_domain PARAMS ((struct loaded_domain *__domain))
|
||||
internal_function;
|
||||
const char *_nl_init_domain_conv PARAMS ((struct loaded_l10nfile *__domain_file,
|
||||
struct loaded_domain *__domain,
|
||||
struct binding *__domainbinding))
|
||||
internal_function;
|
||||
void _nl_free_domain_conv PARAMS ((struct loaded_domain *__domain))
|
||||
internal_function;
|
||||
|
||||
char *_nl_find_msg PARAMS ((struct loaded_l10nfile *domain_file,
|
||||
struct binding *domainbinding,
|
||||
const char *msgid, size_t *lengthp))
|
||||
internal_function;
|
||||
|
||||
#ifdef _LIBC
|
||||
extern char *__gettext PARAMS ((const char *__msgid));
|
||||
extern char *__dgettext PARAMS ((const char *__domainname,
|
||||
const char *__msgid));
|
||||
extern char *__dcgettext PARAMS ((const char *__domainname,
|
||||
const char *__msgid, int __category));
|
||||
extern char *__ngettext PARAMS ((const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n));
|
||||
extern char *__dngettext PARAMS ((const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int n));
|
||||
extern char *__dcngettext PARAMS ((const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n, int __category));
|
||||
extern char *__dcigettext PARAMS ((const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
int __plural, unsigned long int __n,
|
||||
int __category));
|
||||
extern char *__textdomain PARAMS ((const char *__domainname));
|
||||
extern char *__bindtextdomain PARAMS ((const char *__domainname,
|
||||
const char *__dirname));
|
||||
extern char *__bind_textdomain_codeset PARAMS ((const char *__domainname,
|
||||
const char *__codeset));
|
||||
#else
|
||||
extern char *gettext__ PARAMS ((const char *__msgid));
|
||||
extern char *dgettext__ PARAMS ((const char *__domainname,
|
||||
const char *__msgid));
|
||||
extern char *dcgettext__ PARAMS ((const char *__domainname,
|
||||
const char *__msgid, int __category));
|
||||
extern char *ngettext__ PARAMS ((const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n));
|
||||
extern char *dngettext__ PARAMS ((const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n));
|
||||
extern char *dcngettext__ PARAMS ((const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n, int __category));
|
||||
extern char *dcigettext__ PARAMS ((const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
int __plural, unsigned long int __n,
|
||||
int __category));
|
||||
extern char *textdomain__ PARAMS ((const char *__domainname));
|
||||
extern char *bindtextdomain__ PARAMS ((const char *__domainname,
|
||||
const char *__dirname));
|
||||
extern char *bind_textdomain_codeset__ PARAMS ((const char *__domainname,
|
||||
const char *__codeset));
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
extern void __gettext_free_exp PARAMS ((struct expression *exp))
|
||||
internal_function;
|
||||
extern int __gettextparse PARAMS ((void *arg));
|
||||
#else
|
||||
extern void gettext_free_exp__ PARAMS ((struct expression *exp))
|
||||
internal_function;
|
||||
extern int gettextparse__ PARAMS ((void *arg));
|
||||
#endif
|
||||
|
||||
/* @@ begin of epilog @@ */
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Implements a string hashing function.
|
||||
Copyright (C) 1995, 1997 Free Software Foundation, Inc.
|
||||
/* Description of GNU message catalog format: string hashing function.
|
||||
Copyright (C) 1995, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -11,10 +11,9 @@
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* intl-compat.c - Stub functions to call gettext functions from GNU gettext
|
||||
Library.
|
||||
Copyright (C) 1995 Software Foundation, Inc.
|
||||
Copyright (C) 1995, 2000, 2001 Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -20,24 +20,79 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "libgettext.h"
|
||||
#include "libgnuintl.h"
|
||||
#include "gettextP.h"
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
/* This file redirects the gettext functions (without prefix or suffix) to
|
||||
those defined in the included GNU gettext library (with "__" suffix).
|
||||
It is compiled into libintl when the included GNU gettext library is
|
||||
configured --with-included-gettext.
|
||||
|
||||
This redirection works also in the case that the system C library or
|
||||
the system libintl library contain gettext/textdomain/... functions.
|
||||
If it didn't, we would need to add preprocessor level redirections to
|
||||
libgnuintl.h of the following form:
|
||||
|
||||
# define gettext gettext__
|
||||
# define dgettext dgettext__
|
||||
# define dcgettext dcgettext__
|
||||
# define ngettext ngettext__
|
||||
# define dngettext dngettext__
|
||||
# define dcngettext dcngettext__
|
||||
# define textdomain textdomain__
|
||||
# define bindtextdomain bindtextdomain__
|
||||
# define bind_textdomain_codeset bind_textdomain_codeset__
|
||||
|
||||
How does this redirection work? There are two cases.
|
||||
A. When libintl.a is linked into an executable, it works because
|
||||
functions defined in the executable always override functions in
|
||||
the shared libraries.
|
||||
B. When libintl.so is used, it works because
|
||||
1. those systems defining gettext/textdomain/... in the C library
|
||||
(namely, Solaris 2.4 and newer, and GNU libc 2.0 and newer) are
|
||||
ELF systems and define these symbols as weak, thus explicitly
|
||||
letting other shared libraries override it.
|
||||
2. those systems defining gettext/textdomain/... in a standalone
|
||||
libintl.so library (namely, Solaris 2.3 and newer) have this
|
||||
shared library in /usr/lib, and the linker will search /usr/lib
|
||||
*after* the directory where the GNU gettext library is installed.
|
||||
|
||||
A third case, namely when libintl.a is linked into a shared library
|
||||
whose name is not libintl.so, is not supported. In this case, on
|
||||
Solaris, when -lintl precedes the linker option for the shared library
|
||||
containing GNU gettext, the system's gettext would indeed override
|
||||
the GNU gettext. Anyone doing this kind of stuff must be clever enough
|
||||
to 1. compile libintl.a with -fPIC, 2. remove -lintl from his linker
|
||||
command line. */
|
||||
|
||||
|
||||
#undef gettext
|
||||
#undef dgettext
|
||||
#undef dcgettext
|
||||
#undef ngettext
|
||||
#undef dngettext
|
||||
#undef dcngettext
|
||||
#undef textdomain
|
||||
#undef bindtextdomain
|
||||
#undef bind_textdomain_codeset
|
||||
|
||||
|
||||
char *
|
||||
bindtextdomain (domainname, dirname)
|
||||
const char *domainname;
|
||||
const char *dirname;
|
||||
gettext (msgid)
|
||||
const char *msgid;
|
||||
{
|
||||
return bindtextdomain__ (domainname, dirname);
|
||||
return gettext__ (msgid);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
dgettext (domainname, msgid)
|
||||
const char *domainname;
|
||||
const char *msgid;
|
||||
{
|
||||
return dgettext__ (domainname, msgid);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,19 +107,35 @@ dcgettext (domainname, msgid, category)
|
||||
|
||||
|
||||
char *
|
||||
dgettext (domainname, msgid)
|
||||
const char *domainname;
|
||||
const char *msgid;
|
||||
ngettext (msgid1, msgid2, n)
|
||||
const char *msgid1;
|
||||
const char *msgid2;
|
||||
unsigned long int n;
|
||||
{
|
||||
return dgettext__ (domainname, msgid);
|
||||
return ngettext__ (msgid1, msgid2, n);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
gettext (msgid)
|
||||
const char *msgid;
|
||||
dngettext (domainname, msgid1, msgid2, n)
|
||||
const char *domainname;
|
||||
const char *msgid1;
|
||||
const char *msgid2;
|
||||
unsigned long int n;
|
||||
{
|
||||
return gettext__ (msgid);
|
||||
return dngettext__ (domainname, msgid1, msgid2, n);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
dcngettext (domainname, msgid1, msgid2, n, category)
|
||||
const char *domainname;
|
||||
const char *msgid1;
|
||||
const char *msgid2;
|
||||
unsigned long int n;
|
||||
int category;
|
||||
{
|
||||
return dcngettext__ (domainname, msgid1, msgid2, n, category);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,3 +145,21 @@ textdomain (domainname)
|
||||
{
|
||||
return textdomain__ (domainname);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
bindtextdomain (domainname, dirname)
|
||||
const char *domainname;
|
||||
const char *dirname;
|
||||
{
|
||||
return bindtextdomain__ (domainname, dirname);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
bind_textdomain_codeset (domainname, codeset)
|
||||
const char *domainname;
|
||||
const char *codeset;
|
||||
{
|
||||
return bind_textdomain_codeset__ (domainname, codeset);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/* Handle list of needed message catalogs
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -16,22 +15,18 @@
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Tell glibc's <string.h> to provide a prototype for stpcpy().
|
||||
This must come before <config.h> because <config.h> may include
|
||||
<features.h>, and once <features.h> has been included, it's too late. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# define _GNU_SOURCE 1
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
|
||||
#if defined HAVE_STRING_H || defined _LIBC
|
||||
# ifndef _GNU_SOURCE
|
||||
# define _GNU_SOURCE 1
|
||||
# endif
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
# ifndef memcpy
|
||||
# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
|
||||
# endif
|
||||
#endif
|
||||
#include <string.h>
|
||||
#if !HAVE_STRCHR && !defined _LIBC
|
||||
# ifndef strchr
|
||||
# define strchr index
|
||||
@@ -43,10 +38,7 @@
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined STDC_HEADERS || defined _LIBC
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "loadinfo.h"
|
||||
|
||||
@@ -224,7 +216,7 @@ _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language,
|
||||
|
||||
/* Construct file name. */
|
||||
memcpy (abs_filename, dirlist, dirlist_len);
|
||||
__argz_stringify (abs_filename, dirlist_len, ':');
|
||||
__argz_stringify (abs_filename, dirlist_len, PATH_SEPARATOR);
|
||||
cp = abs_filename + (dirlist_len - 1);
|
||||
*cp++ = '/';
|
||||
cp = stpcpy (cp, language);
|
||||
@@ -349,7 +341,8 @@ _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language,
|
||||
|
||||
/* Normalize codeset name. There is no standard for the codeset
|
||||
names. Normalization allows the user to use any of the common
|
||||
names. */
|
||||
names. The return value is dynamically allocated and has to be
|
||||
freed by the caller. */
|
||||
const char *
|
||||
_nl_normalize_codeset (codeset, name_len)
|
||||
const char *codeset;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Message catalogs for internationalization.
|
||||
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
/* Convenience header for conditional use of GNU <libintl.h>.
|
||||
Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -15,168 +15,34 @@
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Because on some systems (e.g. Solaris) we sometimes have to include
|
||||
the systems libintl.h as well as this file we have more complex
|
||||
include protection above. But the systems header might perhaps also
|
||||
define _LIBINTL_H and therefore we have to protect the definition here. */
|
||||
|
||||
#if !defined _LIBINTL_H || !defined _LIBGETTEXT_H
|
||||
#ifndef _LIBINTL_H
|
||||
# define _LIBINTL_H 1
|
||||
#endif
|
||||
#define _LIBGETTEXT_H 1
|
||||
|
||||
/* We define an additional symbol to signal that we use the GNU
|
||||
implementation of gettext. */
|
||||
#define __USE_GNU_GETTEXT 1
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if HAVE_LOCALE_H
|
||||
# include <locale.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
#ifndef PARAMS
|
||||
# if __STDC__ || defined __cplusplus
|
||||
# define PARAMS(args) args
|
||||
# else
|
||||
# define PARAMS(args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
# if !defined __cplusplus || defined __GNUC__
|
||||
# define NULL ((void *) 0)
|
||||
# else
|
||||
# define NULL (0)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !HAVE_LC_MESSAGES
|
||||
/* This value determines the behaviour of the gettext() and dgettext()
|
||||
function. But some system does not have this defined. Define it
|
||||
to a default value. */
|
||||
# define LC_MESSAGES (-1)
|
||||
#endif
|
||||
|
||||
|
||||
/* Declarations for gettext-using-catgets interface. Derived from
|
||||
Jim Meyering's libintl.h. */
|
||||
struct _msg_ent
|
||||
{
|
||||
const char *_msg;
|
||||
int _msg_number;
|
||||
};
|
||||
|
||||
|
||||
#if HAVE_CATGETS
|
||||
/* These two variables are defined in the automatically by po-to-tbl.sed
|
||||
generated file `cat-id-tbl.c'. */
|
||||
extern const struct _msg_ent _msg_tbl[];
|
||||
extern int _msg_tbl_length;
|
||||
#endif
|
||||
|
||||
|
||||
/* For automatical extraction of messages sometimes no real
|
||||
translation is needed. Instead the string itself is the result. */
|
||||
#define gettext_noop(Str) (Str)
|
||||
|
||||
/* Look up MSGID in the current default message catalog for the current
|
||||
LC_MESSAGES locale. If not found, returns MSGID itself (the default
|
||||
text). */
|
||||
extern char *gettext PARAMS ((const char *__msgid));
|
||||
extern char *gettext__ PARAMS ((const char *__msgid));
|
||||
|
||||
/* Look up MSGID in the DOMAINNAME message catalog for the current
|
||||
LC_MESSAGES locale. */
|
||||
extern char *dgettext PARAMS ((const char *__domainname, const char *__msgid));
|
||||
extern char *dgettext__ PARAMS ((const char *__domainname,
|
||||
const char *__msgid));
|
||||
|
||||
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
|
||||
locale. */
|
||||
extern char *dcgettext PARAMS ((const char *__domainname, const char *__msgid,
|
||||
int __category));
|
||||
extern char *dcgettext__ PARAMS ((const char *__domainname,
|
||||
const char *__msgid, int __category));
|
||||
|
||||
|
||||
/* Set the current default message catalog to DOMAINNAME.
|
||||
If DOMAINNAME is null, return the current default.
|
||||
If DOMAINNAME is "", reset to the default of "messages". */
|
||||
extern char *textdomain PARAMS ((const char *__domainname));
|
||||
extern char *textdomain__ PARAMS ((const char *__domainname));
|
||||
|
||||
/* Specify that the DOMAINNAME message catalog will be found
|
||||
in DIRNAME rather than in the system locale data base. */
|
||||
extern char *bindtextdomain PARAMS ((const char *__domainname,
|
||||
const char *__dirname));
|
||||
extern char *bindtextdomain__ PARAMS ((const char *__domainname,
|
||||
const char *__dirname));
|
||||
#ifndef _LIBGETTEXT_H
|
||||
#define _LIBGETTEXT_H 1
|
||||
|
||||
/* NLS can be disabled through the configure --disable-nls option. */
|
||||
#if ENABLE_NLS
|
||||
|
||||
/* Solaris 2.3 has the gettext function but dcgettext is missing.
|
||||
So we omit this optimization for Solaris 2.3. BTW, Solaris 2.4
|
||||
has dcgettext. */
|
||||
# if !HAVE_CATGETS && (!HAVE_GETTEXT || HAVE_DCGETTEXT)
|
||||
|
||||
# define gettext(Msgid) \
|
||||
dgettext (NULL, Msgid)
|
||||
|
||||
# define dgettext(Domainname, Msgid) \
|
||||
dcgettext (Domainname, Msgid, LC_MESSAGES)
|
||||
|
||||
# if defined __GNUC__ && __GNUC__ == 2 && __GNUC_MINOR__ >= 7
|
||||
/* This global variable is defined in loadmsgcat.c. We need a sign,
|
||||
whether a new catalog was loaded, which can be associated with all
|
||||
translations. */
|
||||
extern int _nl_msg_cat_cntr;
|
||||
|
||||
# define dcgettext(Domainname, Msgid, Category) \
|
||||
(__extension__ \
|
||||
({ \
|
||||
char *__result; \
|
||||
if (__builtin_constant_p (Msgid)) \
|
||||
{ \
|
||||
static char *__translation__; \
|
||||
static int __catalog_counter__; \
|
||||
if (! __translation__ || __catalog_counter__ != _nl_msg_cat_cntr) \
|
||||
{ \
|
||||
__translation__ = \
|
||||
dcgettext__ (Domainname, Msgid, Category); \
|
||||
__catalog_counter__ = _nl_msg_cat_cntr; \
|
||||
} \
|
||||
__result = __translation__; \
|
||||
} \
|
||||
else \
|
||||
__result = dcgettext__ (Domainname, Msgid, Category); \
|
||||
__result; \
|
||||
}))
|
||||
# endif
|
||||
# endif
|
||||
/* Get declarations of GNU message catalog functions. */
|
||||
# include <libintl.h>
|
||||
|
||||
#else
|
||||
|
||||
# define gettext(Msgid) (Msgid)
|
||||
# define dgettext(Domainname, Msgid) (Msgid)
|
||||
# define dcgettext(Domainname, Msgid, Category) (Msgid)
|
||||
# define textdomain(Domainname) ((char *) Domainname)
|
||||
# define bindtextdomain(Domainname, Dirname) ((char *) Dirname)
|
||||
# define ngettext(Msgid1, Msgid2, N) \
|
||||
((N) == 1 ? (char *) (Msgid1) : (char *) (Msgid2))
|
||||
# define dngettext(Domainname, Msgid1, Msgid2, N) \
|
||||
((N) == 1 ? (char *) (Msgid1) : (char *) (Msgid2))
|
||||
# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
|
||||
((N) == 1 ? (char *) (Msgid1) : (char *) (Msgid2))
|
||||
# define textdomain(Domainname) ((char *) (Domainname))
|
||||
# define bindtextdomain(Domainname, Dirname) ((char *) (Dirname))
|
||||
# define bind_textdomain_codeset(Domainname, Codeset) ((char *) (Codeset))
|
||||
|
||||
#endif
|
||||
|
||||
/* @@ begin of epilog @@ */
|
||||
/* For automatical extraction of messages sometimes no real
|
||||
translation is needed. Instead the string itself is the result. */
|
||||
#define gettext_noop(Str) (Str)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /* _LIBGETTEXT_H */
|
||||
|
||||
127
intl/libgnuintl.h
Normal file
127
intl/libgnuintl.h
Normal file
@@ -0,0 +1,127 @@
|
||||
/* Message catalogs for internationalization.
|
||||
Copyright (C) 1995-1997, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _LIBINTL_H
|
||||
#define _LIBINTL_H 1
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
/* The LC_MESSAGES locale category is the category used by the functions
|
||||
gettext() and dgettext(). It is specified in POSIX, but not in ANSI C.
|
||||
On systems that don't define it, use an arbitrary value instead.
|
||||
On Solaris, <locale.h> defines __LOCALE_H then includes <libintl.h> (i.e.
|
||||
this file!) and then only defines LC_MESSAGES. To avoid a redefinition
|
||||
warning, don't define LC_MESSAGES in this case. */
|
||||
#if !defined LC_MESSAGES && !defined __LOCALE_H
|
||||
# define LC_MESSAGES 1729
|
||||
#endif
|
||||
|
||||
/* We define an additional symbol to signal that we use the GNU
|
||||
implementation of gettext. */
|
||||
#define __USE_GNU_GETTEXT 1
|
||||
|
||||
/* Resolve a platform specific conflict on DJGPP. GNU gettext takes
|
||||
precedence over _conio_gettext. */
|
||||
#ifdef __DJGPP__
|
||||
# undef gettext
|
||||
# define gettext gettext
|
||||
#endif
|
||||
|
||||
#ifndef PARAMS
|
||||
# if __STDC__ || defined __cplusplus
|
||||
# define PARAMS(args) args
|
||||
# else
|
||||
# define PARAMS(args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the current default message catalog for the current
|
||||
LC_MESSAGES locale. If not found, returns MSGID itself (the default
|
||||
text). */
|
||||
extern char *gettext PARAMS ((const char *__msgid));
|
||||
|
||||
/* Look up MSGID in the DOMAINNAME message catalog for the current
|
||||
LC_MESSAGES locale. */
|
||||
extern char *dgettext PARAMS ((const char *__domainname, const char *__msgid));
|
||||
|
||||
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
|
||||
locale. */
|
||||
extern char *dcgettext PARAMS ((const char *__domainname, const char *__msgid,
|
||||
int __category));
|
||||
|
||||
|
||||
/* Similar to `gettext' but select the plural form corresponding to the
|
||||
number N. */
|
||||
extern char *ngettext PARAMS ((const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n));
|
||||
|
||||
/* Similar to `dgettext' but select the plural form corresponding to the
|
||||
number N. */
|
||||
extern char *dngettext PARAMS ((const char *__domainname, const char *__msgid1,
|
||||
const char *__msgid2, unsigned long int __n));
|
||||
|
||||
/* Similar to `dcgettext' but select the plural form corresponding to the
|
||||
number N. */
|
||||
extern char *dcngettext PARAMS ((const char *__domainname, const char *__msgid1,
|
||||
const char *__msgid2, unsigned long int __n,
|
||||
int __category));
|
||||
|
||||
|
||||
/* Set the current default message catalog to DOMAINNAME.
|
||||
If DOMAINNAME is null, return the current default.
|
||||
If DOMAINNAME is "", reset to the default of "messages". */
|
||||
extern char *textdomain PARAMS ((const char *__domainname));
|
||||
|
||||
/* Specify that the DOMAINNAME message catalog will be found
|
||||
in DIRNAME rather than in the system locale data base. */
|
||||
extern char *bindtextdomain PARAMS ((const char *__domainname,
|
||||
const char *__dirname));
|
||||
|
||||
/* Specify the character encoding in which the messages from the
|
||||
DOMAINNAME message catalog will be returned. */
|
||||
extern char *bind_textdomain_codeset PARAMS ((const char *__domainname,
|
||||
const char *__codeset));
|
||||
|
||||
|
||||
/* Optimized version of the functions above. */
|
||||
#if defined __OPTIMIZED
|
||||
/* These are macros, but could also be inline functions. */
|
||||
|
||||
# define gettext(msgid) \
|
||||
dgettext (NULL, msgid)
|
||||
|
||||
# define dgettext(domainname, msgid) \
|
||||
dcgettext (domainname, msgid, LC_MESSAGES)
|
||||
|
||||
# define ngettext(msgid1, msgid2, n) \
|
||||
dngettext (NULL, msgid1, msgid2, n)
|
||||
|
||||
# define dngettext(domainname, msgid1, msgid2, n) \
|
||||
dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES)
|
||||
|
||||
#endif /* Optimizing. */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* libintl.h */
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _LOADINFO_H
|
||||
#define _LOADINFO_H 1
|
||||
|
||||
#ifndef PARAMS
|
||||
# if __STDC__
|
||||
# define PARAMS(args) args
|
||||
@@ -24,6 +27,25 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef internal_function
|
||||
# define internal_function
|
||||
#endif
|
||||
|
||||
/* Tell the compiler when a conditional or integer expression is
|
||||
almost always true or almost always false. */
|
||||
#ifndef HAVE_BUILTIN_EXPECT
|
||||
# define __builtin_expect(expr, val) (expr)
|
||||
#endif
|
||||
|
||||
/* Separator in PATH like lists of pathnames. */
|
||||
#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
|
||||
/* Win32, OS/2, DOS */
|
||||
# define PATH_SEPARATOR ';'
|
||||
#else
|
||||
/* Unix */
|
||||
# define PATH_SEPARATOR ':'
|
||||
#endif
|
||||
|
||||
/* Encoding of locale name parts. */
|
||||
#define CEN_REVISION 1
|
||||
#define CEN_SPONSOR 2
|
||||
@@ -50,6 +72,10 @@ struct loaded_l10nfile
|
||||
};
|
||||
|
||||
|
||||
/* Normalize codeset name. There is no standard for the codeset
|
||||
names. Normalization allows the user to use any of the common
|
||||
names. The return value is dynamically allocated and has to be
|
||||
freed by the caller. */
|
||||
extern const char *_nl_normalize_codeset PARAMS ((const char *codeset,
|
||||
size_t name_len));
|
||||
|
||||
@@ -66,6 +92,8 @@ _nl_make_l10nflist PARAMS ((struct loaded_l10nfile **l10nfile_list,
|
||||
|
||||
extern const char *_nl_expand_alias PARAMS ((const char *name));
|
||||
|
||||
/* normalized_codeset is dynamically allocated and has to be freed by
|
||||
the caller. */
|
||||
extern int _nl_explode_name PARAMS ((char *name, const char **language,
|
||||
const char **modifier,
|
||||
const char **territory,
|
||||
@@ -76,3 +104,5 @@ extern int _nl_explode_name PARAMS ((char *name, const char **language,
|
||||
const char **revision));
|
||||
|
||||
extern char *_nl_find_language PARAMS ((const char *name));
|
||||
|
||||
#endif /* loadinfo.h */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Load needed message catalogs.
|
||||
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -15,22 +15,52 @@
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Tell glibc's <string.h> to provide a prototype for mempcpy().
|
||||
This must come before <config.h> because <config.h> may include
|
||||
<features.h>, and once <features.h> has been included, it's too late. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# define _GNU_SOURCE 1
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#if defined STDC_HEADERS || defined _LIBC
|
||||
# include <stdlib.h>
|
||||
#ifdef __GNUC__
|
||||
# define alloca __builtin_alloca
|
||||
# define HAVE_ALLOCA 1
|
||||
#else
|
||||
# if defined HAVE_ALLOCA_H || defined _LIBC
|
||||
# include <alloca.h>
|
||||
# else
|
||||
# ifdef _AIX
|
||||
#pragma alloca
|
||||
# else
|
||||
# ifndef alloca
|
||||
char *alloca ();
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined HAVE_UNISTD_H || defined _LIBC
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
# include <langinfo.h>
|
||||
# include <locale.h>
|
||||
#endif
|
||||
|
||||
#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
|
||||
|| (defined _LIBC && defined _POSIX_MAPPED_FILES)
|
||||
# include <sys/mman.h>
|
||||
@@ -43,6 +73,10 @@
|
||||
#include "gettext.h"
|
||||
#include "gettextP.h"
|
||||
|
||||
#ifdef _LIBC
|
||||
# include "../locale/localeinfo.h"
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
#ifdef _LIBC
|
||||
@@ -56,29 +90,275 @@
|
||||
# define munmap __munmap
|
||||
#endif
|
||||
|
||||
/* Names for the libintl functions are a problem. They must not clash
|
||||
with existing names and they should follow ANSI C. But this source
|
||||
code is also used in GNU C Library where the names have a __
|
||||
prefix. So we have to make a difference here. */
|
||||
#ifdef _LIBC
|
||||
# define PLURAL_PARSE __gettextparse
|
||||
#else
|
||||
# define PLURAL_PARSE gettextparse__
|
||||
#endif
|
||||
|
||||
/* For those losing systems which don't have `alloca' we have to add
|
||||
some additional code emulating it. */
|
||||
#ifdef HAVE_ALLOCA
|
||||
# define freea(p) /* nothing */
|
||||
#else
|
||||
# define alloca(n) malloc (n)
|
||||
# define freea(p) free (p)
|
||||
#endif
|
||||
|
||||
/* For systems that distinguish between text and binary I/O.
|
||||
O_BINARY is usually declared in <fcntl.h>. */
|
||||
#if !defined O_BINARY && defined _O_BINARY
|
||||
/* For MSC-compatible compilers. */
|
||||
# define O_BINARY _O_BINARY
|
||||
# define O_TEXT _O_TEXT
|
||||
#endif
|
||||
#ifdef __BEOS__
|
||||
/* BeOS 5 has O_BINARY and O_TEXT, but they have no effect. */
|
||||
# undef O_BINARY
|
||||
# undef O_TEXT
|
||||
#endif
|
||||
/* On reasonable systems, binary I/O is the default. */
|
||||
#ifndef O_BINARY
|
||||
# define O_BINARY 0
|
||||
#endif
|
||||
|
||||
/* We need a sign, whether a new catalog was loaded, which can be associated
|
||||
with all translations. This is important if the translations are
|
||||
cached by one of GCC's features. */
|
||||
int _nl_msg_cat_cntr = 0;
|
||||
int _nl_msg_cat_cntr;
|
||||
|
||||
#if (defined __GNUC__ && !defined __APPLE_CC__) \
|
||||
|| (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
|
||||
|
||||
/* These structs are the constant expression for the germanic plural
|
||||
form determination. It represents the expression "n != 1". */
|
||||
static const struct expression plvar =
|
||||
{
|
||||
.nargs = 0,
|
||||
.operation = var,
|
||||
};
|
||||
static const struct expression plone =
|
||||
{
|
||||
.nargs = 0,
|
||||
.operation = num,
|
||||
.val =
|
||||
{
|
||||
.num = 1
|
||||
}
|
||||
};
|
||||
static struct expression germanic_plural =
|
||||
{
|
||||
.nargs = 2,
|
||||
.operation = not_equal,
|
||||
.val =
|
||||
{
|
||||
.args =
|
||||
{
|
||||
[0] = (struct expression *) &plvar,
|
||||
[1] = (struct expression *) &plone
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
# define INIT_GERMANIC_PLURAL()
|
||||
|
||||
#else
|
||||
|
||||
/* For compilers without support for ISO C 99 struct/union initializers:
|
||||
Initialization at run-time. */
|
||||
|
||||
static struct expression plvar;
|
||||
static struct expression plone;
|
||||
static struct expression germanic_plural;
|
||||
|
||||
static void
|
||||
init_germanic_plural ()
|
||||
{
|
||||
if (plone.val.num == 0)
|
||||
{
|
||||
plvar.nargs = 0;
|
||||
plvar.operation = var;
|
||||
|
||||
plone.nargs = 0;
|
||||
plone.operation = num;
|
||||
plone.val.num = 1;
|
||||
|
||||
germanic_plural.nargs = 2;
|
||||
germanic_plural.operation = not_equal;
|
||||
germanic_plural.val.args[0] = &plvar;
|
||||
germanic_plural.val.args[1] = &plone;
|
||||
}
|
||||
}
|
||||
|
||||
# define INIT_GERMANIC_PLURAL() init_germanic_plural ()
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* Initialize the codeset dependent parts of an opened message catalog.
|
||||
Return the header entry. */
|
||||
const char *
|
||||
internal_function
|
||||
_nl_init_domain_conv (domain_file, domain, domainbinding)
|
||||
struct loaded_l10nfile *domain_file;
|
||||
struct loaded_domain *domain;
|
||||
struct binding *domainbinding;
|
||||
{
|
||||
/* Find out about the character set the file is encoded with.
|
||||
This can be found (in textual form) in the entry "". If this
|
||||
entry does not exist or if this does not contain the `charset='
|
||||
information, we will assume the charset matches the one the
|
||||
current locale and we don't have to perform any conversion. */
|
||||
char *nullentry;
|
||||
size_t nullentrylen;
|
||||
|
||||
/* Preinitialize fields, to avoid recursion during _nl_find_msg. */
|
||||
domain->codeset_cntr =
|
||||
(domainbinding != NULL ? domainbinding->codeset_cntr : 0);
|
||||
#ifdef _LIBC
|
||||
domain->conv = (__gconv_t) -1;
|
||||
#else
|
||||
# if HAVE_ICONV
|
||||
domain->conv = (iconv_t) -1;
|
||||
# endif
|
||||
#endif
|
||||
domain->conv_tab = NULL;
|
||||
|
||||
/* Get the header entry. */
|
||||
nullentry = _nl_find_msg (domain_file, domainbinding, "", &nullentrylen);
|
||||
|
||||
if (nullentry != NULL)
|
||||
{
|
||||
#if defined _LIBC || HAVE_ICONV
|
||||
const char *charsetstr;
|
||||
|
||||
charsetstr = strstr (nullentry, "charset=");
|
||||
if (charsetstr != NULL)
|
||||
{
|
||||
size_t len;
|
||||
char *charset;
|
||||
const char *outcharset;
|
||||
|
||||
charsetstr += strlen ("charset=");
|
||||
len = strcspn (charsetstr, " \t\n");
|
||||
|
||||
charset = (char *) alloca (len + 1);
|
||||
# if defined _LIBC || HAVE_MEMPCPY
|
||||
*((char *) mempcpy (charset, charsetstr, len)) = '\0';
|
||||
# else
|
||||
memcpy (charset, charsetstr, len);
|
||||
charset[len] = '\0';
|
||||
# endif
|
||||
|
||||
/* The output charset should normally be determined by the
|
||||
locale. But sometimes the locale is not used or not correctly
|
||||
set up, so we provide a possibility for the user to override
|
||||
this. Moreover, the value specified through
|
||||
bind_textdomain_codeset overrides both. */
|
||||
if (domainbinding != NULL && domainbinding->codeset != NULL)
|
||||
outcharset = domainbinding->codeset;
|
||||
else
|
||||
{
|
||||
outcharset = getenv ("OUTPUT_CHARSET");
|
||||
if (outcharset == NULL || outcharset[0] == '\0')
|
||||
{
|
||||
# ifdef _LIBC
|
||||
outcharset = (*_nl_current[LC_CTYPE])->values[_NL_ITEM_INDEX (CODESET)].string;
|
||||
# else
|
||||
# if HAVE_ICONV
|
||||
extern const char *locale_charset (void);
|
||||
outcharset = locale_charset ();
|
||||
# endif
|
||||
# endif
|
||||
}
|
||||
}
|
||||
|
||||
# ifdef _LIBC
|
||||
/* We always want to use transliteration. */
|
||||
outcharset = norm_add_slashes (outcharset, "TRANSLIT");
|
||||
charset = norm_add_slashes (charset, NULL);
|
||||
if (__gconv_open (outcharset, charset, &domain->conv,
|
||||
GCONV_AVOID_NOCONV)
|
||||
!= __GCONV_OK)
|
||||
domain->conv = (__gconv_t) -1;
|
||||
# else
|
||||
# if HAVE_ICONV
|
||||
/* When using GNU libiconv, we want to use transliteration. */
|
||||
# if _LIBICONV_VERSION >= 0x0105
|
||||
len = strlen (outcharset);
|
||||
{
|
||||
char *tmp = (char *) alloca (len + 10 + 1);
|
||||
memcpy (tmp, outcharset, len);
|
||||
memcpy (tmp + len, "//TRANSLIT", 10 + 1);
|
||||
outcharset = tmp;
|
||||
}
|
||||
# endif
|
||||
domain->conv = iconv_open (outcharset, charset);
|
||||
# if _LIBICONV_VERSION >= 0x0105
|
||||
freea (outcharset);
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
freea (charset);
|
||||
}
|
||||
#endif /* _LIBC || HAVE_ICONV */
|
||||
}
|
||||
|
||||
return nullentry;
|
||||
}
|
||||
|
||||
/* Frees the codeset dependent parts of an opened message catalog. */
|
||||
void
|
||||
internal_function
|
||||
_nl_free_domain_conv (domain)
|
||||
struct loaded_domain *domain;
|
||||
{
|
||||
if (domain->conv_tab != NULL && domain->conv_tab != (char **) -1)
|
||||
free (domain->conv_tab);
|
||||
|
||||
#ifdef _LIBC
|
||||
if (domain->conv != (__gconv_t) -1)
|
||||
__gconv_close (domain->conv);
|
||||
#else
|
||||
# if HAVE_ICONV
|
||||
if (domain->conv != (iconv_t) -1)
|
||||
iconv_close (domain->conv);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Load the message catalogs specified by FILENAME. If it is no valid
|
||||
message catalog do nothing. */
|
||||
void
|
||||
internal_function
|
||||
_nl_load_domain (domain_file)
|
||||
_nl_load_domain (domain_file, domainbinding)
|
||||
struct loaded_l10nfile *domain_file;
|
||||
struct binding *domainbinding;
|
||||
{
|
||||
int fd;
|
||||
size_t size;
|
||||
#ifdef _LIBC
|
||||
struct stat64 st;
|
||||
#else
|
||||
struct stat st;
|
||||
#endif
|
||||
struct mo_file_header *data = (struct mo_file_header *) -1;
|
||||
int use_mmap = 0;
|
||||
struct loaded_domain *domain;
|
||||
const char *nullentry;
|
||||
|
||||
domain_file->decided = 1;
|
||||
domain_file->data = NULL;
|
||||
|
||||
/* Note that it would be useless to store domainbinding in domain_file
|
||||
because domainbinding might be == NULL now but != NULL later (after
|
||||
a call to bind_textdomain_codeset). */
|
||||
|
||||
/* If the record does not represent a valid locale the FILENAME
|
||||
might be NULL. This can happen when according to the given
|
||||
specification the locale file name is different for XPG and CEN
|
||||
@@ -87,14 +367,19 @@ _nl_load_domain (domain_file)
|
||||
return;
|
||||
|
||||
/* Try to open the addressed file. */
|
||||
fd = open (domain_file->filename, O_RDONLY);
|
||||
fd = open (domain_file->filename, O_RDONLY | O_BINARY);
|
||||
if (fd == -1)
|
||||
return;
|
||||
|
||||
/* We must know about the size of the file. */
|
||||
if (fstat (fd, &st) != 0
|
||||
|| (size = (size_t) st.st_size) != st.st_size
|
||||
|| size < sizeof (struct mo_file_header))
|
||||
if (
|
||||
#ifdef _LIBC
|
||||
__builtin_expect (fstat64 (fd, &st) != 0, 0)
|
||||
#else
|
||||
__builtin_expect (fstat (fd, &st) != 0, 0)
|
||||
#endif
|
||||
|| __builtin_expect ((size = (size_t) st.st_size) != st.st_size, 0)
|
||||
|| __builtin_expect (size < sizeof (struct mo_file_header), 0))
|
||||
{
|
||||
/* Something went wrong. */
|
||||
close (fd);
|
||||
@@ -107,7 +392,7 @@ _nl_load_domain (domain_file)
|
||||
data = (struct mo_file_header *) mmap (NULL, size, PROT_READ,
|
||||
MAP_PRIVATE, fd, 0);
|
||||
|
||||
if (data != (struct mo_file_header *) -1)
|
||||
if (__builtin_expect (data != (struct mo_file_header *) -1, 1))
|
||||
{
|
||||
/* mmap() call was successful. */
|
||||
close (fd);
|
||||
@@ -131,12 +416,15 @@ _nl_load_domain (domain_file)
|
||||
do
|
||||
{
|
||||
long int nb = (long int) read (fd, read_ptr, to_read);
|
||||
if (nb == -1)
|
||||
if (nb <= 0)
|
||||
{
|
||||
#ifdef EINTR
|
||||
if (nb == -1 && errno == EINTR)
|
||||
continue;
|
||||
#endif
|
||||
close (fd);
|
||||
return;
|
||||
}
|
||||
|
||||
read_ptr += nb;
|
||||
to_read -= nb;
|
||||
}
|
||||
@@ -147,7 +435,8 @@ _nl_load_domain (domain_file)
|
||||
|
||||
/* Using the magic number we can test whether it really is a message
|
||||
catalog file. */
|
||||
if (data->magic != _MAGIC && data->magic != _MAGIC_SWAPPED)
|
||||
if (__builtin_expect (data->magic != _MAGIC && data->magic != _MAGIC_SWAPPED,
|
||||
0))
|
||||
{
|
||||
/* The magic number is wrong: not a message catalog file. */
|
||||
#ifdef HAVE_MMAP
|
||||
@@ -159,12 +448,11 @@ _nl_load_domain (domain_file)
|
||||
return;
|
||||
}
|
||||
|
||||
domain_file->data
|
||||
= (struct loaded_domain *) malloc (sizeof (struct loaded_domain));
|
||||
if (domain_file->data == NULL)
|
||||
domain = (struct loaded_domain *) malloc (sizeof (struct loaded_domain));
|
||||
if (domain == NULL)
|
||||
return;
|
||||
domain_file->data = domain;
|
||||
|
||||
domain = (struct loaded_domain *) domain_file->data;
|
||||
domain->data = (char *) data;
|
||||
domain->use_mmap = use_mmap;
|
||||
domain->mmap_size = size;
|
||||
@@ -196,9 +484,62 @@ _nl_load_domain (domain_file)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Show that one domain is changed. This might make some cached
|
||||
translations invalid. */
|
||||
++_nl_msg_cat_cntr;
|
||||
/* Now initialize the character set converter from the character set
|
||||
the file is encoded with (found in the header entry) to the domain's
|
||||
specified character set or the locale's character set. */
|
||||
nullentry = _nl_init_domain_conv (domain_file, domain, domainbinding);
|
||||
|
||||
/* Also look for a plural specification. */
|
||||
if (nullentry != NULL)
|
||||
{
|
||||
const char *plural;
|
||||
const char *nplurals;
|
||||
|
||||
plural = strstr (nullentry, "plural=");
|
||||
nplurals = strstr (nullentry, "nplurals=");
|
||||
if (plural == NULL || nplurals == NULL)
|
||||
goto no_plural;
|
||||
else
|
||||
{
|
||||
/* First get the number. */
|
||||
char *endp;
|
||||
unsigned long int n;
|
||||
struct parse_args args;
|
||||
|
||||
nplurals += 9;
|
||||
while (*nplurals != '\0' && isspace (*nplurals))
|
||||
++nplurals;
|
||||
#if defined HAVE_STRTOUL || defined _LIBC
|
||||
n = strtoul (nplurals, &endp, 10);
|
||||
#else
|
||||
for (endp = nplurals, n = 0; *endp >= '0' && *endp <= '9'; endp++)
|
||||
n = n * 10 + (*endp - '0');
|
||||
#endif
|
||||
domain->nplurals = n;
|
||||
if (nplurals == endp)
|
||||
goto no_plural;
|
||||
|
||||
/* Due to the restrictions bison imposes onto the interface of the
|
||||
scanner function we have to put the input string and the result
|
||||
passed up from the parser into the same structure which address
|
||||
is passed down to the parser. */
|
||||
plural += 7;
|
||||
args.cp = plural;
|
||||
if (PLURAL_PARSE (&args) != 0)
|
||||
goto no_plural;
|
||||
domain->plural = args.res;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* By default we are using the Germanic form: singular form only
|
||||
for `one', the plural form otherwise. Yes, this is also what
|
||||
English is using since English is a Germanic language. */
|
||||
no_plural:
|
||||
INIT_GERMANIC_PLURAL ();
|
||||
domain->plural = &germanic_plural;
|
||||
domain->nplurals = 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -208,11 +549,16 @@ internal_function
|
||||
_nl_unload_domain (domain)
|
||||
struct loaded_domain *domain;
|
||||
{
|
||||
#ifdef _POSIX_MAPPED_FILES
|
||||
if (domain->plural != &germanic_plural)
|
||||
__gettext_free_exp (domain->plural);
|
||||
|
||||
_nl_free_domain_conv (domain);
|
||||
|
||||
# ifdef _POSIX_MAPPED_FILES
|
||||
if (domain->use_mmap)
|
||||
munmap ((caddr_t) domain->data, domain->mmap_size);
|
||||
else
|
||||
#endif /* _POSIX_MAPPED_FILES */
|
||||
# endif /* _POSIX_MAPPED_FILES */
|
||||
free ((void *) domain->data);
|
||||
|
||||
free (domain);
|
||||
|
||||
271
intl/localcharset.c
Normal file
271
intl/localcharset.c
Normal file
@@ -0,0 +1,271 @@
|
||||
/* Determine a canonical name for the current locale's character encoding.
|
||||
|
||||
Copyright (C) 2000-2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library General Public License as published
|
||||
by the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
/* Written by Bruno Haible <haible@clisp.cons.org>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STDDEF_H
|
||||
# include <stddef.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#if HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#if HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#if defined _WIN32 || defined __WIN32__
|
||||
# undef WIN32 /* avoid warning on mingw32 */
|
||||
# define WIN32
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
# if HAVE_LANGINFO_CODESET
|
||||
# include <langinfo.h>
|
||||
# else
|
||||
# if HAVE_SETLOCALE
|
||||
# include <locale.h>
|
||||
# endif
|
||||
# endif
|
||||
#else /* WIN32 */
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifndef DIRECTORY_SEPARATOR
|
||||
# define DIRECTORY_SEPARATOR '/'
|
||||
#endif
|
||||
|
||||
#ifndef ISSLASH
|
||||
# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
|
||||
#endif
|
||||
|
||||
/* The following static variable is declared 'volatile' to avoid a
|
||||
possible multithread problem in the function get_charset_aliases. If we
|
||||
are running in a threaded environment, and if two threads initialize
|
||||
'charset_aliases' simultaneously, both will produce the same value,
|
||||
and everything will be ok if the two assignments to 'charset_aliases'
|
||||
are atomic. But I don't know what will happen if the two assignments mix. */
|
||||
#if __STDC__ != 1
|
||||
# define volatile /* empty */
|
||||
#endif
|
||||
/* Pointer to the contents of the charset.alias file, if it has already been
|
||||
read, else NULL. Its format is:
|
||||
ALIAS_1 '\0' CANONICAL_1 '\0' ... ALIAS_n '\0' CANONICAL_n '\0' '\0' */
|
||||
static char * volatile charset_aliases;
|
||||
|
||||
/* Return a pointer to the contents of the charset.alias file. */
|
||||
static const char *
|
||||
get_charset_aliases ()
|
||||
{
|
||||
char *cp;
|
||||
|
||||
cp = charset_aliases;
|
||||
if (cp == NULL)
|
||||
{
|
||||
#ifndef WIN32
|
||||
FILE *fp;
|
||||
const char *dir = LIBDIR;
|
||||
const char *base = "charset.alias";
|
||||
char *file_name;
|
||||
|
||||
/* Concatenate dir and base into freshly allocated file_name. */
|
||||
{
|
||||
size_t dir_len = strlen (dir);
|
||||
size_t base_len = strlen (base);
|
||||
int add_slash = (dir_len > 0 && !ISSLASH (dir[dir_len - 1]));
|
||||
file_name = (char *) malloc (dir_len + add_slash + base_len + 1);
|
||||
if (file_name != NULL)
|
||||
{
|
||||
memcpy (file_name, dir, dir_len);
|
||||
if (add_slash)
|
||||
file_name[dir_len] = DIRECTORY_SEPARATOR;
|
||||
memcpy (file_name + dir_len + add_slash, base, base_len + 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (file_name == NULL || (fp = fopen (file_name, "r")) == NULL)
|
||||
/* Out of memory or file not found, treat it as empty. */
|
||||
cp = "";
|
||||
else
|
||||
{
|
||||
/* Parse the file's contents. */
|
||||
int c;
|
||||
char buf1[50+1];
|
||||
char buf2[50+1];
|
||||
char *res_ptr = NULL;
|
||||
size_t res_size = 0;
|
||||
size_t l1, l2;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
c = getc (fp);
|
||||
if (c == EOF)
|
||||
break;
|
||||
if (c == '\n' || c == ' ' || c == '\t')
|
||||
continue;
|
||||
if (c == '#')
|
||||
{
|
||||
/* Skip comment, to end of line. */
|
||||
do
|
||||
c = getc (fp);
|
||||
while (!(c == EOF || c == '\n'));
|
||||
if (c == EOF)
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
ungetc (c, fp);
|
||||
if (fscanf(fp, "%50s %50s", buf1, buf2) < 2)
|
||||
break;
|
||||
l1 = strlen (buf1);
|
||||
l2 = strlen (buf2);
|
||||
if (res_size == 0)
|
||||
{
|
||||
res_size = l1 + 1 + l2 + 1;
|
||||
res_ptr = malloc (res_size + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
res_size += l1 + 1 + l2 + 1;
|
||||
res_ptr = realloc (res_ptr, res_size + 1);
|
||||
}
|
||||
if (res_ptr == NULL)
|
||||
{
|
||||
/* Out of memory. */
|
||||
res_size = 0;
|
||||
break;
|
||||
}
|
||||
strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1);
|
||||
strcpy (res_ptr + res_size - (l2 + 1), buf2);
|
||||
}
|
||||
fclose (fp);
|
||||
if (res_size == 0)
|
||||
cp = "";
|
||||
else
|
||||
{
|
||||
*(res_ptr + res_size) = '\0';
|
||||
cp = res_ptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (file_name != NULL)
|
||||
free (file_name);
|
||||
|
||||
#else /* WIN32 */
|
||||
|
||||
/* To avoid the troubles of installing a separate file in the same
|
||||
directory as the DLL and of retrieving the DLL's directory at
|
||||
runtime, simply inline the aliases here. */
|
||||
|
||||
cp = "CP936" "\0" "GBK" "\0"
|
||||
"CP1361" "\0" "JOHAB" "\0";
|
||||
#endif
|
||||
|
||||
charset_aliases = cp;
|
||||
}
|
||||
|
||||
return cp;
|
||||
}
|
||||
|
||||
/* Determine the current locale's character encoding, and canonicalize it
|
||||
into one of the canonical names listed in config.charset.
|
||||
The result must not be freed; it is statically allocated.
|
||||
If the canonical name cannot be determined, the result is a non-canonical
|
||||
name. */
|
||||
|
||||
#ifdef STATIC
|
||||
STATIC
|
||||
#endif
|
||||
const char *
|
||||
locale_charset ()
|
||||
{
|
||||
const char *codeset;
|
||||
const char *aliases;
|
||||
|
||||
#ifndef WIN32
|
||||
|
||||
# if HAVE_LANGINFO_CODESET
|
||||
|
||||
/* Most systems support nl_langinfo (CODESET) nowadays. */
|
||||
codeset = nl_langinfo (CODESET);
|
||||
|
||||
# else
|
||||
|
||||
/* On old systems which lack it, use setlocale or getenv. */
|
||||
const char *locale = NULL;
|
||||
|
||||
/* But most old systems don't have a complete set of locales. Some
|
||||
(like SunOS 4 or DJGPP) have only the C locale. Therefore we don't
|
||||
use setlocale here; it would return "C" when it doesn't support the
|
||||
locale name the user has set. */
|
||||
# if HAVE_SETLOCALE && 0
|
||||
locale = setlocale (LC_CTYPE, NULL);
|
||||
# endif
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
{
|
||||
locale = getenv ("LC_ALL");
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
{
|
||||
locale = getenv ("LC_CTYPE");
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
locale = getenv ("LANG");
|
||||
}
|
||||
}
|
||||
|
||||
/* On some old systems, one used to set locale = "iso8859_1". On others,
|
||||
you set it to "language_COUNTRY.charset". In any case, we resolve it
|
||||
through the charset.alias file. */
|
||||
codeset = locale;
|
||||
|
||||
# endif
|
||||
|
||||
#else /* WIN32 */
|
||||
|
||||
static char buf[2 + 10 + 1];
|
||||
|
||||
/* Win32 has a function returning the locale's codepage as a number. */
|
||||
sprintf (buf, "CP%u", GetACP ());
|
||||
codeset = buf;
|
||||
|
||||
#endif
|
||||
|
||||
if (codeset == NULL)
|
||||
/* The canonical name cannot be determined. */
|
||||
codeset = "";
|
||||
|
||||
/* Resolve alias. */
|
||||
for (aliases = get_charset_aliases ();
|
||||
*aliases != '\0';
|
||||
aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)
|
||||
if (strcmp (codeset, aliases) == 0
|
||||
|| (aliases[0] == '*' && aliases[1] == '\0'))
|
||||
{
|
||||
codeset = aliases + strlen (aliases) + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
return codeset;
|
||||
}
|
||||
77
intl/locale.alias
Normal file
77
intl/locale.alias
Normal file
@@ -0,0 +1,77 @@
|
||||
# Locale name alias data base.
|
||||
# Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# The format of this file is the same as for the corresponding file of
|
||||
# the X Window System, which normally can be found in
|
||||
# /usr/lib/X11/locale/locale.alias
|
||||
# A single line contains two fields: an alias and a substitution value.
|
||||
# All entries are case independent.
|
||||
|
||||
# Note: This file is far from being complete. If you have a value for
|
||||
# your own site which you think might be useful for others too, share
|
||||
# it with the rest of us. Send it using the `glibcbug' script to
|
||||
# bugs@gnu.org.
|
||||
|
||||
# Packages using this file:
|
||||
|
||||
bokmal no_NO.ISO-8859-1
|
||||
bokmål no_NO.ISO-8859-1
|
||||
catalan ca_ES.ISO-8859-1
|
||||
croatian hr_HR.ISO-8859-2
|
||||
czech cs_CZ.ISO-8859-2
|
||||
danish da_DK.ISO-8859-1
|
||||
dansk da_DK.ISO-8859-1
|
||||
deutsch de_DE.ISO-8859-1
|
||||
dutch nl_NL.ISO-8859-1
|
||||
eesti et_EE.ISO-8859-1
|
||||
estonian et_EE.ISO-8859-1
|
||||
finnish fi_FI.ISO-8859-1
|
||||
français fr_FR.ISO-8859-1
|
||||
french fr_FR.ISO-8859-1
|
||||
galego gl_ES.ISO-8859-1
|
||||
galician gl_ES.ISO-8859-1
|
||||
german de_DE.ISO-8859-1
|
||||
greek el_GR.ISO-8859-7
|
||||
hebrew iw_IL.ISO-8859-8
|
||||
hrvatski hr_HR.ISO-8859-2
|
||||
hungarian hu_HU.ISO-8859-2
|
||||
icelandic is_IS.ISO-8859-1
|
||||
italian it_IT.ISO-8859-1
|
||||
japanese ja_JP.eucJP
|
||||
japanese.euc ja_JP.eucJP
|
||||
ja_JP ja_JP.eucJP
|
||||
ja_JP.ujis ja_JP.eucJP
|
||||
japanese.sjis ja_JP.SJIS
|
||||
korean ko_KR.eucKR
|
||||
korean.euc ko_KR.eucKR
|
||||
ko_KR ko_KR.eucKR
|
||||
lithuanian lt_LT.ISO-8859-13
|
||||
nb_NO no_NO.ISO-8859-1
|
||||
nb_NO.ISO-8859-1 no_NO.ISO-8859-1
|
||||
norwegian no_NO.ISO-8859-1
|
||||
nynorsk nn_NO.ISO-8859-1
|
||||
polish pl_PL.ISO-8859-2
|
||||
portuguese pt_PT.ISO-8859-1
|
||||
romanian ro_RO.ISO-8859-2
|
||||
russian ru_RU.ISO-8859-5
|
||||
slovak sk_SK.ISO-8859-2
|
||||
slovene sl_SI.ISO-8859-2
|
||||
slovenian sl_SI.ISO-8859-2
|
||||
spanish es_ES.ISO-8859-1
|
||||
swedish sv_SE.ISO-8859-1
|
||||
thai th_TH.TIS-620
|
||||
turkish tr_TR.ISO-8859-9
|
||||
@@ -1,6 +1,5 @@
|
||||
/* Handle aliases for locale names.
|
||||
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
|
||||
Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -16,6 +15,13 @@
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Tell glibc's <string.h> to provide a prototype for mempcpy().
|
||||
This must come before <config.h> because <config.h> may include
|
||||
<features.h>, and once <features.h> has been included, it's too late. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# define _GNU_SOURCE 1
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
@@ -41,35 +47,15 @@ char *alloca ();
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined STDC_HEADERS || defined _LIBC
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
char *getenv ();
|
||||
# ifdef HAVE_MALLOC_H
|
||||
# include <malloc.h>
|
||||
# else
|
||||
void free ();
|
||||
# endif
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined HAVE_STRING_H || defined _LIBC
|
||||
# ifndef _GNU_SOURCE
|
||||
# define _GNU_SOURCE 1
|
||||
# endif
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
# ifndef memcpy
|
||||
# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
|
||||
# endif
|
||||
#endif
|
||||
#include <string.h>
|
||||
#if !HAVE_STRCHR && !defined _LIBC
|
||||
# ifndef strchr
|
||||
# define strchr index
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "gettext.h"
|
||||
#include "gettextP.h"
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
@@ -95,40 +81,14 @@ __libc_lock_define_initialized (static, lock);
|
||||
# define internal_function
|
||||
#endif
|
||||
|
||||
/* For those loosing systems which don't have `alloca' we have to add
|
||||
/* For those losing systems which don't have `alloca' we have to add
|
||||
some additional code emulating it. */
|
||||
#ifdef HAVE_ALLOCA
|
||||
/* Nothing has to be done. */
|
||||
# define ADD_BLOCK(list, address) /* nothing */
|
||||
# define FREE_BLOCKS(list) /* nothing */
|
||||
# define freea(p) /* nothing */
|
||||
#else
|
||||
struct block_list
|
||||
{
|
||||
void *address;
|
||||
struct block_list *next;
|
||||
};
|
||||
# define ADD_BLOCK(list, addr) \
|
||||
do { \
|
||||
struct block_list *newp = (struct block_list *) malloc (sizeof (*newp)); \
|
||||
/* If we cannot get a free block we cannot add the new element to \
|
||||
the list. */ \
|
||||
if (newp != NULL) { \
|
||||
newp->address = (addr); \
|
||||
newp->next = (list); \
|
||||
(list) = newp; \
|
||||
} \
|
||||
} while (0)
|
||||
# define FREE_BLOCKS(list) \
|
||||
do { \
|
||||
while (list != NULL) { \
|
||||
struct block_list *old = list; \
|
||||
list = list->next; \
|
||||
free (old); \
|
||||
} \
|
||||
} while (0)
|
||||
# undef alloca
|
||||
# define alloca(size) (malloc (size))
|
||||
#endif /* have alloca */
|
||||
# define alloca(n) malloc (n)
|
||||
# define freea(p) free (p)
|
||||
#endif
|
||||
|
||||
#if defined _LIBC_REENTRANT || defined HAVE_FGETS_UNLOCKED
|
||||
# undef fgets
|
||||
@@ -147,18 +107,18 @@ struct alias_map
|
||||
};
|
||||
|
||||
|
||||
static char *string_space = NULL;
|
||||
static size_t string_space_act = 0;
|
||||
static size_t string_space_max = 0;
|
||||
static char *string_space;
|
||||
static size_t string_space_act;
|
||||
static size_t string_space_max;
|
||||
static struct alias_map *map;
|
||||
static size_t nmap = 0;
|
||||
static size_t maxmap = 0;
|
||||
static size_t nmap;
|
||||
static size_t maxmap;
|
||||
|
||||
|
||||
/* Prototypes for local functions. */
|
||||
static size_t read_alias_file PARAMS ((const char *fname, int fname_len))
|
||||
internal_function;
|
||||
static void extend_alias_table PARAMS ((void));
|
||||
static int extend_alias_table PARAMS ((void));
|
||||
static int alias_compare PARAMS ((const struct alias_map *map1,
|
||||
const struct alias_map *map2));
|
||||
|
||||
@@ -204,11 +164,12 @@ _nl_expand_alias (name)
|
||||
{
|
||||
const char *start;
|
||||
|
||||
while (locale_alias_path[0] == ':')
|
||||
while (locale_alias_path[0] == PATH_SEPARATOR)
|
||||
++locale_alias_path;
|
||||
start = locale_alias_path;
|
||||
|
||||
while (locale_alias_path[0] != '\0' && locale_alias_path[0] != ':')
|
||||
while (locale_alias_path[0] != '\0'
|
||||
&& locale_alias_path[0] != PATH_SEPARATOR)
|
||||
++locale_alias_path;
|
||||
|
||||
if (start < locale_alias_path)
|
||||
@@ -231,16 +192,12 @@ read_alias_file (fname, fname_len)
|
||||
const char *fname;
|
||||
int fname_len;
|
||||
{
|
||||
#ifndef HAVE_ALLOCA
|
||||
struct block_list *block_list = NULL;
|
||||
#endif
|
||||
FILE *fp;
|
||||
char *full_fname;
|
||||
size_t added;
|
||||
static const char aliasfile[] = "/locale.alias";
|
||||
|
||||
full_fname = (char *) alloca (fname_len + sizeof aliasfile);
|
||||
ADD_BLOCK (block_list, full_fname);
|
||||
#ifdef HAVE_MEMPCPY
|
||||
mempcpy (mempcpy (full_fname, fname, fname_len),
|
||||
aliasfile, sizeof aliasfile);
|
||||
@@ -250,11 +207,9 @@ read_alias_file (fname, fname_len)
|
||||
#endif
|
||||
|
||||
fp = fopen (full_fname, "r");
|
||||
freea (full_fname);
|
||||
if (fp == NULL)
|
||||
{
|
||||
FREE_BLOCKS (block_list);
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
|
||||
added = 0;
|
||||
while (!feof (fp))
|
||||
@@ -326,7 +281,8 @@ read_alias_file (fname, fname_len)
|
||||
*cp++ = '\0';
|
||||
|
||||
if (nmap >= maxmap)
|
||||
extend_alias_table ();
|
||||
if (__builtin_expect (extend_alias_table (), 0))
|
||||
return added;
|
||||
|
||||
alias_len = strlen (alias) + 1;
|
||||
value_len = strlen (value) + 1;
|
||||
@@ -339,10 +295,19 @@ read_alias_file (fname, fname_len)
|
||||
? alias_len + value_len : 1024));
|
||||
char *new_pool = (char *) realloc (string_space, new_size);
|
||||
if (new_pool == NULL)
|
||||
return added;
|
||||
|
||||
if (__builtin_expect (string_space != new_pool, 0))
|
||||
{
|
||||
FREE_BLOCKS (block_list);
|
||||
return added;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < nmap; i++)
|
||||
{
|
||||
map[i].alias += new_pool - string_space;
|
||||
map[i].value += new_pool - string_space;
|
||||
}
|
||||
}
|
||||
|
||||
string_space = new_pool;
|
||||
string_space_max = new_size;
|
||||
}
|
||||
@@ -369,12 +334,11 @@ read_alias_file (fname, fname_len)
|
||||
qsort (map, nmap, sizeof (struct alias_map),
|
||||
(int (*) PARAMS ((const void *, const void *))) alias_compare);
|
||||
|
||||
FREE_BLOCKS (block_list);
|
||||
return added;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
static int
|
||||
extend_alias_table ()
|
||||
{
|
||||
size_t new_size;
|
||||
@@ -385,10 +349,11 @@ extend_alias_table ()
|
||||
* sizeof (struct alias_map)));
|
||||
if (new_map == NULL)
|
||||
/* Simply don't extend: we don't have any more core. */
|
||||
return;
|
||||
return -1;
|
||||
|
||||
map = new_map;
|
||||
maxmap = new_size;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
67
intl/ngettext.c
Normal file
67
intl/ngettext.c
Normal file
@@ -0,0 +1,67 @@
|
||||
/* Implementation of ngettext(3) function.
|
||||
Copyright (C) 1995, 1997, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
# define __need_NULL
|
||||
# include <stddef.h>
|
||||
#else
|
||||
# include <stdlib.h> /* Just for NULL. */
|
||||
#endif
|
||||
|
||||
#include "gettextP.h"
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# include "libgnuintl.h"
|
||||
#endif
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
/* Names for the libintl functions are a problem. They must not clash
|
||||
with existing names and they should follow ANSI C. But this source
|
||||
code is also used in GNU C Library where the names have a __
|
||||
prefix. So we have to make a difference here. */
|
||||
#ifdef _LIBC
|
||||
# define NGETTEXT __ngettext
|
||||
# define DCNGETTEXT __dcngettext
|
||||
#else
|
||||
# define NGETTEXT ngettext__
|
||||
# define DCNGETTEXT dcngettext__
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the current default message catalog for the current
|
||||
LC_MESSAGES locale. If not found, returns MSGID itself (the default
|
||||
text). */
|
||||
char *
|
||||
NGETTEXT (msgid1, msgid2, n)
|
||||
const char *msgid1;
|
||||
const char *msgid2;
|
||||
unsigned long int n;
|
||||
{
|
||||
return DCNGETTEXT (NULL, msgid1, msgid2, n, LC_MESSAGES);
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Alias for function name in GNU C Library. */
|
||||
weak_alias (__ngettext, ngettext);
|
||||
#endif
|
||||
1325
intl/plural.c
Normal file
1325
intl/plural.c
Normal file
File diff suppressed because it is too large
Load Diff
412
intl/plural.y
Normal file
412
intl/plural.y
Normal file
@@ -0,0 +1,412 @@
|
||||
%{
|
||||
/* Expression parsing for plural form selection.
|
||||
Copyright (C) 2000, 2001 Free Software Foundation, Inc.
|
||||
Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* The bison generated parser uses alloca. AIX 3 forces us to put this
|
||||
declaration at the beginning of the file. The declaration in bison's
|
||||
skeleton file comes too late. This must come before <config.h>
|
||||
because <config.h> may include arbitrary system headers. */
|
||||
#if defined _AIX && !defined __GNUC__
|
||||
#pragma alloca
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "gettextP.h"
|
||||
|
||||
/* Names for the libintl functions are a problem. They must not clash
|
||||
with existing names and they should follow ANSI C. But this source
|
||||
code is also used in GNU C Library where the names have a __
|
||||
prefix. So we have to make a difference here. */
|
||||
#ifdef _LIBC
|
||||
# define FREE_EXPRESSION __gettext_free_exp
|
||||
#else
|
||||
# define FREE_EXPRESSION gettext_free_exp__
|
||||
# define __gettextparse gettextparse__
|
||||
#endif
|
||||
|
||||
#define YYLEX_PARAM &((struct parse_args *) arg)->cp
|
||||
#define YYPARSE_PARAM arg
|
||||
%}
|
||||
%pure_parser
|
||||
%expect 10
|
||||
|
||||
%union {
|
||||
unsigned long int num;
|
||||
enum operator op;
|
||||
struct expression *exp;
|
||||
}
|
||||
|
||||
%{
|
||||
/* Prototypes for local functions. */
|
||||
static struct expression *new_exp PARAMS ((int nargs, enum operator op,
|
||||
struct expression * const *args));
|
||||
static inline struct expression *new_exp_0 PARAMS ((enum operator op));
|
||||
static inline struct expression *new_exp_1 PARAMS ((enum operator op,
|
||||
struct expression *right));
|
||||
static struct expression *new_exp_2 PARAMS ((enum operator op,
|
||||
struct expression *left,
|
||||
struct expression *right));
|
||||
static inline struct expression *new_exp_3 PARAMS ((enum operator op,
|
||||
struct expression *bexp,
|
||||
struct expression *tbranch,
|
||||
struct expression *fbranch));
|
||||
static int yylex PARAMS ((YYSTYPE *lval, const char **pexp));
|
||||
static void yyerror PARAMS ((const char *str));
|
||||
|
||||
/* Allocation of expressions. */
|
||||
|
||||
static struct expression *
|
||||
new_exp (nargs, op, args)
|
||||
int nargs;
|
||||
enum operator op;
|
||||
struct expression * const *args;
|
||||
{
|
||||
int i;
|
||||
struct expression *newp;
|
||||
|
||||
/* If any of the argument could not be malloc'ed, just return NULL. */
|
||||
for (i = nargs - 1; i >= 0; i--)
|
||||
if (args[i] == NULL)
|
||||
goto fail;
|
||||
|
||||
/* Allocate a new expression. */
|
||||
newp = (struct expression *) malloc (sizeof (*newp));
|
||||
if (newp != NULL)
|
||||
{
|
||||
newp->nargs = nargs;
|
||||
newp->operation = op;
|
||||
for (i = nargs - 1; i >= 0; i--)
|
||||
newp->val.args[i] = args[i];
|
||||
return newp;
|
||||
}
|
||||
|
||||
fail:
|
||||
for (i = nargs - 1; i >= 0; i--)
|
||||
FREE_EXPRESSION (args[i]);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline struct expression *
|
||||
new_exp_0 (op)
|
||||
enum operator op;
|
||||
{
|
||||
return new_exp (0, op, NULL);
|
||||
}
|
||||
|
||||
static inline struct expression *
|
||||
new_exp_1 (op, right)
|
||||
enum operator op;
|
||||
struct expression *right;
|
||||
{
|
||||
struct expression *args[1];
|
||||
|
||||
args[0] = right;
|
||||
return new_exp (1, op, args);
|
||||
}
|
||||
|
||||
static struct expression *
|
||||
new_exp_2 (op, left, right)
|
||||
enum operator op;
|
||||
struct expression *left;
|
||||
struct expression *right;
|
||||
{
|
||||
struct expression *args[2];
|
||||
|
||||
args[0] = left;
|
||||
args[1] = right;
|
||||
return new_exp (2, op, args);
|
||||
}
|
||||
|
||||
static inline struct expression *
|
||||
new_exp_3 (op, bexp, tbranch, fbranch)
|
||||
enum operator op;
|
||||
struct expression *bexp;
|
||||
struct expression *tbranch;
|
||||
struct expression *fbranch;
|
||||
{
|
||||
struct expression *args[3];
|
||||
|
||||
args[0] = bexp;
|
||||
args[1] = tbranch;
|
||||
args[2] = fbranch;
|
||||
return new_exp (3, op, args);
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
/* This declares that all operators have the same associativity and the
|
||||
precedence order as in C. See [Harbison, Steele: C, A Reference Manual].
|
||||
There is no unary minus and no bitwise operators.
|
||||
Operators with the same syntactic behaviour have been merged into a single
|
||||
token, to save space in the array generated by bison. */
|
||||
%right '?' /* ? */
|
||||
%left '|' /* || */
|
||||
%left '&' /* && */
|
||||
%left EQUOP2 /* == != */
|
||||
%left CMPOP2 /* < > <= >= */
|
||||
%left ADDOP2 /* + - */
|
||||
%left MULOP2 /* * / % */
|
||||
%right '!' /* ! */
|
||||
|
||||
%token <op> EQUOP2 CMPOP2 ADDOP2 MULOP2
|
||||
%token <num> NUMBER
|
||||
%type <exp> exp
|
||||
|
||||
%%
|
||||
|
||||
start: exp
|
||||
{
|
||||
if ($1 == NULL)
|
||||
YYABORT;
|
||||
((struct parse_args *) arg)->res = $1;
|
||||
}
|
||||
;
|
||||
|
||||
exp: exp '?' exp ':' exp
|
||||
{
|
||||
$$ = new_exp_3 (qmop, $1, $3, $5);
|
||||
}
|
||||
| exp '|' exp
|
||||
{
|
||||
$$ = new_exp_2 (lor, $1, $3);
|
||||
}
|
||||
| exp '&' exp
|
||||
{
|
||||
$$ = new_exp_2 (land, $1, $3);
|
||||
}
|
||||
| exp EQUOP2 exp
|
||||
{
|
||||
$$ = new_exp_2 ($2, $1, $3);
|
||||
}
|
||||
| exp CMPOP2 exp
|
||||
{
|
||||
$$ = new_exp_2 ($2, $1, $3);
|
||||
}
|
||||
| exp ADDOP2 exp
|
||||
{
|
||||
$$ = new_exp_2 ($2, $1, $3);
|
||||
}
|
||||
| exp MULOP2 exp
|
||||
{
|
||||
$$ = new_exp_2 ($2, $1, $3);
|
||||
}
|
||||
| '!' exp
|
||||
{
|
||||
$$ = new_exp_1 (lnot, $2);
|
||||
}
|
||||
| 'n'
|
||||
{
|
||||
$$ = new_exp_0 (var);
|
||||
}
|
||||
| NUMBER
|
||||
{
|
||||
if (($$ = new_exp_0 (num)) != NULL)
|
||||
$$->val.num = $1;
|
||||
}
|
||||
| '(' exp ')'
|
||||
{
|
||||
$$ = $2;
|
||||
}
|
||||
;
|
||||
|
||||
%%
|
||||
|
||||
void
|
||||
internal_function
|
||||
FREE_EXPRESSION (exp)
|
||||
struct expression *exp;
|
||||
{
|
||||
if (exp == NULL)
|
||||
return;
|
||||
|
||||
/* Handle the recursive case. */
|
||||
switch (exp->nargs)
|
||||
{
|
||||
case 3:
|
||||
FREE_EXPRESSION (exp->val.args[2]);
|
||||
/* FALLTHROUGH */
|
||||
case 2:
|
||||
FREE_EXPRESSION (exp->val.args[1]);
|
||||
/* FALLTHROUGH */
|
||||
case 1:
|
||||
FREE_EXPRESSION (exp->val.args[0]);
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
free (exp);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
yylex (lval, pexp)
|
||||
YYSTYPE *lval;
|
||||
const char **pexp;
|
||||
{
|
||||
const char *exp = *pexp;
|
||||
int result;
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (exp[0] == '\0')
|
||||
{
|
||||
*pexp = exp;
|
||||
return YYEOF;
|
||||
}
|
||||
|
||||
if (exp[0] != ' ' && exp[0] != '\t')
|
||||
break;
|
||||
|
||||
++exp;
|
||||
}
|
||||
|
||||
result = *exp++;
|
||||
switch (result)
|
||||
{
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
{
|
||||
unsigned long int n = result - '0';
|
||||
while (exp[0] >= '0' && exp[0] <= '9')
|
||||
{
|
||||
n *= 10;
|
||||
n += exp[0] - '0';
|
||||
++exp;
|
||||
}
|
||||
lval->num = n;
|
||||
result = NUMBER;
|
||||
}
|
||||
break;
|
||||
|
||||
case '=':
|
||||
if (exp[0] == '=')
|
||||
{
|
||||
++exp;
|
||||
lval->op = equal;
|
||||
result = EQUOP2;
|
||||
}
|
||||
else
|
||||
result = YYERRCODE;
|
||||
break;
|
||||
|
||||
case '!':
|
||||
if (exp[0] == '=')
|
||||
{
|
||||
++exp;
|
||||
lval->op = not_equal;
|
||||
result = EQUOP2;
|
||||
}
|
||||
break;
|
||||
|
||||
case '&':
|
||||
case '|':
|
||||
if (exp[0] == result)
|
||||
++exp;
|
||||
else
|
||||
result = YYERRCODE;
|
||||
break;
|
||||
|
||||
case '<':
|
||||
if (exp[0] == '=')
|
||||
{
|
||||
++exp;
|
||||
lval->op = less_or_equal;
|
||||
}
|
||||
else
|
||||
lval->op = less_than;
|
||||
result = CMPOP2;
|
||||
break;
|
||||
|
||||
case '>':
|
||||
if (exp[0] == '=')
|
||||
{
|
||||
++exp;
|
||||
lval->op = greater_or_equal;
|
||||
}
|
||||
else
|
||||
lval->op = greater_than;
|
||||
result = CMPOP2;
|
||||
break;
|
||||
|
||||
case '*':
|
||||
lval->op = mult;
|
||||
result = MULOP2;
|
||||
break;
|
||||
|
||||
case '/':
|
||||
lval->op = divide;
|
||||
result = MULOP2;
|
||||
break;
|
||||
|
||||
case '%':
|
||||
lval->op = module;
|
||||
result = MULOP2;
|
||||
break;
|
||||
|
||||
case '+':
|
||||
lval->op = plus;
|
||||
result = ADDOP2;
|
||||
break;
|
||||
|
||||
case '-':
|
||||
lval->op = minus;
|
||||
result = ADDOP2;
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
case '?':
|
||||
case ':':
|
||||
case '(':
|
||||
case ')':
|
||||
/* Nothing, just return the character. */
|
||||
break;
|
||||
|
||||
case ';':
|
||||
case '\n':
|
||||
case '\0':
|
||||
/* Be safe and let the user call this function again. */
|
||||
--exp;
|
||||
result = YYEOF;
|
||||
break;
|
||||
|
||||
default:
|
||||
result = YYERRCODE;
|
||||
#if YYDEBUG != 0
|
||||
--exp;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
*pexp = exp;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
yyerror (str)
|
||||
const char *str;
|
||||
{
|
||||
/* Do nothing. We don't print error messages here. */
|
||||
}
|
||||
31
intl/ref-add.sin
Normal file
31
intl/ref-add.sin
Normal file
@@ -0,0 +1,31 @@
|
||||
# Add this package to a list of references stored in a text file.
|
||||
#
|
||||
# Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Library General Public License as published
|
||||
# by the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
# USA.
|
||||
#
|
||||
# Written by Bruno Haible <haible@clisp.cons.org>.
|
||||
#
|
||||
/^# Packages using this file: / {
|
||||
s/# Packages using this file://
|
||||
ta
|
||||
:a
|
||||
s/ @PACKAGE@ / @PACKAGE@ /
|
||||
tb
|
||||
s/ $/ @PACKAGE@ /
|
||||
:b
|
||||
s/^/# Packages using this file:/
|
||||
}
|
||||
26
intl/ref-del.sin
Normal file
26
intl/ref-del.sin
Normal file
@@ -0,0 +1,26 @@
|
||||
# Remove this package from a list of references stored in a text file.
|
||||
#
|
||||
# Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Library General Public License as published
|
||||
# by the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
# USA.
|
||||
#
|
||||
# Written by Bruno Haible <haible@clisp.cons.org>.
|
||||
#
|
||||
/^# Packages using this file: / {
|
||||
s/# Packages using this file://
|
||||
s/ @PACKAGE@ / /
|
||||
s/^/# Packages using this file:/
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
/* Implementation of the textdomain(3) function.
|
||||
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
|
||||
Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -20,23 +19,32 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if defined STDC_HEADERS || defined _LIBC
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#if defined STDC_HEADERS || defined HAVE_STRING_H || defined _LIBC
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
# ifndef memcpy
|
||||
# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
|
||||
# endif
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# include "libgettext.h"
|
||||
# include "libgnuintl.h"
|
||||
#endif
|
||||
#include "gettextP.h"
|
||||
|
||||
#ifdef _LIBC
|
||||
/* We have to handle multi-threaded applications. */
|
||||
# include <bits/libc-lock.h>
|
||||
#else
|
||||
/* Provide dummy implementation if this is outside glibc. */
|
||||
# define __libc_rwlock_define(CLASS, NAME)
|
||||
# define __libc_rwlock_wrlock(NAME)
|
||||
# define __libc_rwlock_unlock(NAME)
|
||||
#endif
|
||||
|
||||
/* The internal variables in the standalone libintl.a must have different
|
||||
names than the internal variables in GNU libc, otherwise programs
|
||||
using libintl.a cannot be linked statically. */
|
||||
#if !defined _LIBC
|
||||
# define _nl_default_default_domain _nl_default_default_domain__
|
||||
# define _nl_current_default_domain _nl_current_default_domain__
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
@@ -61,6 +69,9 @@ extern const char *_nl_current_default_domain;
|
||||
# define TEXTDOMAIN textdomain__
|
||||
#endif
|
||||
|
||||
/* Lock variable to protect the global data in the gettext implementation. */
|
||||
__libc_rwlock_define (extern, _nl_state_lock)
|
||||
|
||||
/* Set the current default message catalog to DOMAINNAME.
|
||||
If DOMAINNAME is null, return the current default.
|
||||
If DOMAINNAME is "", reset to the default of "messages". */
|
||||
@@ -68,38 +79,60 @@ char *
|
||||
TEXTDOMAIN (domainname)
|
||||
const char *domainname;
|
||||
{
|
||||
char *old;
|
||||
char *new_domain;
|
||||
char *old_domain;
|
||||
|
||||
/* A NULL pointer requests the current setting. */
|
||||
if (domainname == NULL)
|
||||
return (char *) _nl_current_default_domain;
|
||||
|
||||
old = (char *) _nl_current_default_domain;
|
||||
__libc_rwlock_wrlock (_nl_state_lock);
|
||||
|
||||
old_domain = (char *) _nl_current_default_domain;
|
||||
|
||||
/* If domain name is the null string set to default domain "messages". */
|
||||
if (domainname[0] == '\0'
|
||||
|| strcmp (domainname, _nl_default_default_domain) == 0)
|
||||
_nl_current_default_domain = _nl_default_default_domain;
|
||||
{
|
||||
_nl_current_default_domain = _nl_default_default_domain;
|
||||
new_domain = (char *) _nl_current_default_domain;
|
||||
}
|
||||
else if (strcmp (domainname, old_domain) == 0)
|
||||
/* This can happen and people will use it to signal that some
|
||||
environment variable changed. */
|
||||
new_domain = old_domain;
|
||||
else
|
||||
{
|
||||
/* If the following malloc fails `_nl_current_default_domain'
|
||||
will be NULL. This value will be returned and so signals we
|
||||
are out of core. */
|
||||
#if defined _LIBC || defined HAVE_STRDUP
|
||||
_nl_current_default_domain = strdup (domainname);
|
||||
new_domain = strdup (domainname);
|
||||
#else
|
||||
size_t len = strlen (domainname) + 1;
|
||||
char *cp = (char *) malloc (len);
|
||||
if (cp != NULL)
|
||||
memcpy (cp, domainname, len);
|
||||
_nl_current_default_domain = cp;
|
||||
new_domain = (char *) malloc (len);
|
||||
if (new_domain != NULL)
|
||||
memcpy (new_domain, domainname, len);
|
||||
#endif
|
||||
|
||||
if (new_domain != NULL)
|
||||
_nl_current_default_domain = new_domain;
|
||||
}
|
||||
|
||||
if (old != _nl_default_default_domain)
|
||||
free (old);
|
||||
/* We use this possibility to signal a change of the loaded catalogs
|
||||
since this is most likely the case and there is no other easy we
|
||||
to do it. Do it only when the call was successful. */
|
||||
if (new_domain != NULL)
|
||||
{
|
||||
++_nl_msg_cat_cntr;
|
||||
|
||||
return (char *) _nl_current_default_domain;
|
||||
if (old_domain != new_domain && old_domain != _nl_default_default_domain)
|
||||
free (old_domain);
|
||||
}
|
||||
|
||||
__libc_rwlock_unlock (_nl_state_lock);
|
||||
|
||||
return new_domain;
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
|
||||
22
move.c
22
move.c
@@ -19,10 +19,11 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "config.h"
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
@@ -55,9 +56,9 @@ int page_down(void)
|
||||
if (current == filebot)
|
||||
return 0;
|
||||
|
||||
/* AHEM, if we only have a screen or less of text, DONT do an
|
||||
/* AHEM, if we only have a screen or less of text, DON'T do an
|
||||
edit_update, just move the cursor to editbot! */
|
||||
if (edittop == fileage && editbot == filebot) {
|
||||
if (edittop == fileage && editbot == filebot && totlines < editwinrows) {
|
||||
current = editbot;
|
||||
reset_cursor();
|
||||
} else if (editbot != filebot || edittop == fileage) {
|
||||
@@ -85,6 +86,7 @@ int page_down(void)
|
||||
|
||||
int do_home(void)
|
||||
{
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
current_x = 0;
|
||||
placewewant = 0;
|
||||
update_line(current, current_x);
|
||||
@@ -93,6 +95,7 @@ int do_home(void)
|
||||
|
||||
int do_end(void)
|
||||
{
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
current_x = strlen(current->data);
|
||||
placewewant = xplustabs();
|
||||
update_line(current, current_x);
|
||||
@@ -145,7 +148,8 @@ void page_up_center(void)
|
||||
|
||||
int page_up(void)
|
||||
{
|
||||
filestruct *fileptr = edittop;
|
||||
int i;
|
||||
|
||||
wrap_reset();
|
||||
current_x = 0;
|
||||
placewewant = 0;
|
||||
@@ -154,13 +158,11 @@ int page_up(void)
|
||||
return 0;
|
||||
|
||||
current_y = 0;
|
||||
if (fileptr->next != NULL)
|
||||
fileptr = fileptr->next;
|
||||
if (fileptr->next != NULL)
|
||||
fileptr = fileptr->next;
|
||||
|
||||
current = edittop;
|
||||
edit_update(fileptr, BOTTOM);
|
||||
for (i = 0; i <= editwinrows - 3 && current->prev != NULL; i++)
|
||||
current = current->prev;
|
||||
|
||||
edit_update(current, TOP);
|
||||
update_cursor();
|
||||
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
|
||||
29
nano.1
29
nano.1
@@ -8,7 +8,7 @@
|
||||
.\" 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 "December 2, 2000"
|
||||
.TH NANO 1 "April 30, 2001"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.SH NAME
|
||||
@@ -23,7 +23,7 @@ This manual page documents briefly the
|
||||
command.
|
||||
.PP
|
||||
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
|
||||
.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
|
||||
.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
|
||||
.\" respectively.
|
||||
\fBnano\fP is a small, free and friendly editor which aims to replace
|
||||
Pico, the default editor included in the non-free Pine package. Rather
|
||||
@@ -33,6 +33,9 @@ also implements some missing (or disabled by default) features in Pico,
|
||||
such as "search and replace" and "goto line number".
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-F (\-\-multibuffer)
|
||||
Enable multiple file buffers (if available).
|
||||
.TP
|
||||
.B \-T (\-\-tabsize)
|
||||
Set the size (width) of a tab.
|
||||
.TP
|
||||
@@ -44,21 +47,21 @@ Enable regular expression matching for search strings, as well as
|
||||
Show the current version number and author.
|
||||
.TP
|
||||
.B \-h (\-\-help)
|
||||
Display a summary of commandline options.
|
||||
Display a summary of command line options.
|
||||
.TP
|
||||
.B \-c (\-\-const)
|
||||
Constantly show the cursor position.
|
||||
.TP
|
||||
.B \-k (\-\-cut)
|
||||
Enable cut from cursor to end of line with ^K.
|
||||
.TP
|
||||
.B \-i (\-\-autoindent)
|
||||
Indent new lines to the previous line's indentation. Useful when editing
|
||||
source code.
|
||||
.TP
|
||||
.B \-k (\-\-cut)
|
||||
Enable cut from cursor to end of line with ^K.
|
||||
.TP
|
||||
.B \-l (\-\-nofollow)
|
||||
If the file being edited is a symbolic link, replace the link with a
|
||||
a new file, do not follow it. Good for editing files in /tmp perhaps?
|
||||
a new file, do not follow it. Good for editing files in /tmp, perhaps?
|
||||
.TP
|
||||
.B \-m (\-\-mouse)
|
||||
Enable mouse support (if available for your system).
|
||||
@@ -68,11 +71,17 @@ 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)
|
||||
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)
|
||||
Enable alternative spell checker command.
|
||||
.TP
|
||||
.B \-t (\-\-tempfile)
|
||||
Always save changed buffer without prompting. Same as Pico -t option.
|
||||
Always save changed buffer without prompting. Same as Pico -t option.
|
||||
.TP
|
||||
.B \-v (\-\-view)
|
||||
View file (read only) mode.
|
||||
@@ -93,10 +102,10 @@ Ignored, for compatibility with Pico.
|
||||
Places cursor at LINE on startup.
|
||||
.SH NOTES
|
||||
Nano will try to dump the buffer into an emergency file in some cases.
|
||||
Mainly, this will happen if Nano recieves a SIGHUP or runs out of
|
||||
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 finename. Nano will \fBnot\fP write this file if a previous one
|
||||
current filename. 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
|
||||
|
||||
33
nano.1.html
33
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: December 2, 2000<BR><A HREF="#index">Index</A>
|
||||
Section: User Commands (1)<BR>Updated: April 30, 2001<BR><A HREF="#index">Index</A>
|
||||
<A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
||||
|
||||
|
||||
@@ -44,6 +44,10 @@ such as "search and replace" and "goto line number".
|
||||
<H2>OPTIONS</H2>
|
||||
|
||||
<DL COMPACT>
|
||||
<DT><B>-F (--multibuffer)</B>
|
||||
|
||||
<DD>
|
||||
Enable multiple file buffers (if available).
|
||||
<DT><B>-T (--tabsize)</B>
|
||||
|
||||
<DD>
|
||||
@@ -60,25 +64,25 @@ Show the current version number and author.
|
||||
<DT><B>-h (--help)</B>
|
||||
|
||||
<DD>
|
||||
Display a summary of commandline options.
|
||||
Display a summary of command line options.
|
||||
<DT><B>-c (--const)</B>
|
||||
|
||||
<DD>
|
||||
Constantly show the cursor position.
|
||||
<DT><B>-k (--cut)</B>
|
||||
|
||||
<DD>
|
||||
Enable cut from cursor to end of line with ^K.
|
||||
<DT><B>-i (--autoindent)</B>
|
||||
|
||||
<DD>
|
||||
Indent new lines to the previous line's indentation. Useful when editing
|
||||
source code.
|
||||
<DT><B>-k (--cut)</B>
|
||||
|
||||
<DD>
|
||||
Enable cut from cursor to end of line with ^K.
|
||||
<DT><B>-l (--nofollow)</B>
|
||||
|
||||
<DD>
|
||||
If the file being edited is a symbolic link, replace the link with a
|
||||
a new file, do not follow it. Good for editing files in /tmp perhaps?
|
||||
a new file, do not follow it. Good for editing files in /tmp, perhaps?
|
||||
<DT><B>-m (--mouse)</B>
|
||||
|
||||
<DD>
|
||||
@@ -89,6 +93,13 @@ Enable mouse support (if available for your system).
|
||||
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>
|
||||
|
||||
<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>
|
||||
|
||||
<DD>
|
||||
@@ -96,7 +107,7 @@ Enable alternative spell checker command.
|
||||
<DT><B>-t (--tempfile)</B>
|
||||
|
||||
<DD>
|
||||
Always save changed buffer without prompting. Same as Pico -t option.
|
||||
Always save changed buffer without prompting. Same as Pico -t option.
|
||||
<DT><B>-v (--view)</B>
|
||||
|
||||
<DD>
|
||||
@@ -126,10 +137,10 @@ Places cursor at LINE on startup.
|
||||
<H2>NOTES</H2>
|
||||
|
||||
Nano will try to dump the buffer into an emergency file in some cases.
|
||||
Mainly, this will happen if Nano recieves a SIGHUP or runs out of
|
||||
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 finename. Nano will <B>not</B> write this file if a previous one
|
||||
current filename. Nano will <B>not</B> write this file if a previous one
|
||||
exists in the current directory.
|
||||
<A NAME="lbAG"> </A>
|
||||
<H2>BUGS</H2>
|
||||
@@ -177,6 +188,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: 02:16:52 GMT, December 18, 2000
|
||||
Time: 03:54:23 GMT, July 15, 2001
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
109
nano.h
109
nano.h
@@ -34,6 +34,7 @@
|
||||
#define SET(bit) flags |= bit
|
||||
#define UNSET(bit) flags &= ~bit
|
||||
#define ISSET(bit) (flags & bit)
|
||||
#define TOGGLE(bit) flags ^= bit
|
||||
|
||||
|
||||
#ifdef USE_SLANG /* Slang support enabled */
|
||||
@@ -61,13 +62,29 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define VERMSG "nano " VERSION
|
||||
#define VERMSG "GNU nano " VERSION
|
||||
|
||||
#if defined(DISABLE_WRAPPING) && defined(DISABLE_JUSTIFY)
|
||||
#define DISABLE_WRAPJUSTIFY 1
|
||||
#endif
|
||||
|
||||
/* Structure types */
|
||||
typedef struct filestruct {
|
||||
char *data;
|
||||
struct filestruct *next; /* Next node */
|
||||
struct filestruct *prev; /* Previous node */
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
struct filestruct *file; /* Current file */
|
||||
int file_current_x; /* Current file's x-coordinate position */
|
||||
int file_current_y; /* Current file's y-coordinate position */
|
||||
int file_modified; /* Current file's modification status */
|
||||
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 */
|
||||
#endif
|
||||
|
||||
long lineno; /* The line number */
|
||||
} filestruct;
|
||||
|
||||
@@ -85,11 +102,21 @@ typedef struct shortcut {
|
||||
typedef struct toggle {
|
||||
int val; /* Sequence to toggle the key. Should only need 1 */
|
||||
char *desc; /* Description for when toggle is, uh, toggled,
|
||||
e.g. "Pico Messages", we'll append Enabled or
|
||||
e.g. "Pico Messages"; we'll append Enabled or
|
||||
Disabled */
|
||||
int flag; /* What flag actually gets toggled */
|
||||
char override_ch; /* The character to display on the help screen,
|
||||
if it isn't NULL */
|
||||
} toggle;
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
typedef struct rcoption {
|
||||
char *name;
|
||||
int flag;
|
||||
} rcoption;
|
||||
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
/* Bitwise flags so we can save space (or more correctly, not waste it) */
|
||||
|
||||
#define MODIFIED (1<<0)
|
||||
@@ -111,8 +138,10 @@ typedef struct toggle {
|
||||
#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)
|
||||
|
||||
/* Control key sequences, chaning these would be very very bad */
|
||||
/* Control key sequences, changing these would be very very bad */
|
||||
|
||||
#define NANO_CONTROL_A 1
|
||||
#define NANO_CONTROL_B 2
|
||||
@@ -172,8 +201,10 @@ typedef struct toggle {
|
||||
#define NANO_ALT_X 'x'
|
||||
#define NANO_ALT_Y 'y'
|
||||
#define NANO_ALT_Z 'z'
|
||||
#define NANO_ALT_LCARAT ','
|
||||
#define NANO_ALT_RCARAT '.'
|
||||
|
||||
/* Some semi-changeable keybindings, dont play with unless you're sure you
|
||||
/* Some semi-changeable keybindings; don't play with unless you're sure you
|
||||
know what you're doing */
|
||||
|
||||
#define NANO_INSERTFILE_KEY NANO_CONTROL_R
|
||||
@@ -208,7 +239,6 @@ know what you're doing */
|
||||
#define NANO_FIRSTLINE_KEY NANO_PREVPAGE_KEY
|
||||
#define NANO_LASTLINE_KEY NANO_NEXTPAGE_KEY
|
||||
#define NANO_CANCEL_KEY NANO_CONTROL_C
|
||||
#define NANO_CASE_KEY NANO_CONTROL_A
|
||||
#define NANO_REFRESH_KEY NANO_CONTROL_L
|
||||
#define NANO_JUSTIFY_KEY NANO_CONTROL_J
|
||||
#define NANO_JUSTIFY_FKEY KEY_F(4)
|
||||
@@ -227,6 +257,9 @@ know what you're doing */
|
||||
#define NANO_ENTER_KEY NANO_CONTROL_M
|
||||
#define NANO_FROMSEARCHTOGOTO_KEY NANO_CONTROL_T
|
||||
#define NANO_TOFILES_KEY NANO_CONTROL_T
|
||||
#define NANO_APPEND_KEY NANO_ALT_A
|
||||
#define NANO_OPENPREV_KEY NANO_ALT_LCARAT
|
||||
#define NANO_OPENNEXT_KEY NANO_ALT_RCARAT
|
||||
|
||||
#define TOGGLE_CONST_KEY NANO_ALT_C
|
||||
#define TOGGLE_AUTOINDENT_KEY NANO_ALT_I
|
||||
@@ -237,32 +270,55 @@ know what you're doing */
|
||||
#define TOGGLE_CUTTOEND_KEY NANO_ALT_K
|
||||
#define TOGGLE_REGEXP_KEY NANO_ALT_E
|
||||
#define TOGGLE_WRAP_KEY NANO_ALT_W
|
||||
#define TOGGLE_BACKWARDS_KEY NANO_ALT_B
|
||||
#define TOGGLE_CASE_KEY NANO_ALT_A
|
||||
#define TOGGLE_LOAD_KEY NANO_ALT_F
|
||||
|
||||
/* Toggle stuff, these static lengths need to go away RSN */
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
#define TOGGLE_LEN 14
|
||||
#else
|
||||
#define TOGGLE_LEN 11
|
||||
#endif
|
||||
|
||||
#define WHEREIS_LIST_LEN 8
|
||||
#define REPLACE_LIST_LEN 8
|
||||
#else
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
#define TOGGLE_LEN 13
|
||||
#else
|
||||
#define TOGGLE_LEN 10
|
||||
#endif
|
||||
|
||||
#define WHEREIS_LIST_LEN 7
|
||||
#define REPLACE_LIST_LEN 7
|
||||
#endif
|
||||
|
||||
#define MAIN_LIST_LEN 26
|
||||
#define MAIN_VISIBLE 12
|
||||
#define WHEREIS_LIST_LEN 6
|
||||
#define REPLACE_LIST_LEN 6
|
||||
#define REPLACE_LIST_2_LEN 3
|
||||
#define GOTO_LIST_LEN 3
|
||||
#define GOTODIR_LIST_LEN 1
|
||||
#define HELP_LIST_LEN 3
|
||||
#define SPELL_LIST_LEN 1
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
#define WRITEFILE_LIST_LEN 2
|
||||
#define BROWSER_LIST_LEN 3
|
||||
#define WRITEFILE_LIST_LEN 3
|
||||
#define INSERTFILE_LIST_LEN 2
|
||||
#define BROWSER_LIST_LEN 4
|
||||
#else
|
||||
#define WRITEFILE_LIST_LEN 1
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
#define TOGGLE_LEN 9
|
||||
#else
|
||||
#define TOGGLE_LEN 8
|
||||
#define WRITEFILE_LIST_LEN 3
|
||||
#define IMSERTFILE_LIST_LEN 1
|
||||
#endif
|
||||
|
||||
#define VIEW 1
|
||||
#define NOVIEW 0
|
||||
|
||||
#define NONE 3
|
||||
#define TOP 2
|
||||
#define CENTER 1
|
||||
#define BOTTOM 0
|
||||
@@ -276,4 +332,25 @@ know what you're doing */
|
||||
/* Minimum fill length (space available for text before wrapping occurs) */
|
||||
#define MIN_FILL_LENGTH 10
|
||||
|
||||
/* Color specific defines */
|
||||
#ifdef ENABLE_COLOR
|
||||
typedef struct colorstruct {
|
||||
int fg;
|
||||
int bg;
|
||||
int bold;
|
||||
int set;
|
||||
} colorstruct;
|
||||
|
||||
#define FIRST_COLORNUM 16
|
||||
|
||||
#define COLOR_TITLEBAR 16
|
||||
#define COLOR_BOTTOMBARS 17
|
||||
#define COLOR_STATUSBAR 18
|
||||
#define COLOR_TEXT 19
|
||||
#define COLOR_MARKER 20
|
||||
|
||||
#define NUM_NCOLORS 5
|
||||
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
#endif /* ifndef NANO_H */
|
||||
|
||||
411
nano.info
Normal file
411
nano.info
Normal file
@@ -0,0 +1,411 @@
|
||||
This is nano.info, produced by makeinfo version 4.0 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: Top199
|
||||
Node: Introduction507
|
||||
Node: Overview933
|
||||
Node: Command Line Options1513
|
||||
Ref: Expert Mode3405
|
||||
Node: Editor Basics4248
|
||||
Node: Entering Text4473
|
||||
Node: Special Functions4813
|
||||
Node: The Titlebar5668
|
||||
Node: The Statusbar6366
|
||||
Node: Shortcut Lists6947
|
||||
Node: Online Help7340
|
||||
Node: Feature Toggles7716
|
||||
Node: The File Browser8859
|
||||
Node: Pico Compatibility9568
|
||||
Node: Building and Configure Options11610
|
||||
|
||||
End Tag Table
|
||||
423
nano.texi
Normal file
423
nano.texi
Normal file
@@ -0,0 +1,423 @@
|
||||
\input texinfo @c -*-texinfo-*-
|
||||
@c %**start of header
|
||||
@setfilename nano.info
|
||||
@settitle nano Command Manual
|
||||
@c %**end of header
|
||||
|
||||
@c This file has the new style title page commands.
|
||||
@c Run `makeinfo' rather than `texinfo-format-buffer'.
|
||||
@smallbook
|
||||
@set EDITION 0.1
|
||||
@set VERSION 1.1.0
|
||||
@set UPDATED 12 Feb 2001
|
||||
|
||||
@dircategory Editors
|
||||
@direntry
|
||||
* Nano: (nano). Small and friendly text editor.
|
||||
@end direntry
|
||||
|
||||
@c tex
|
||||
@c \overfullrule=0pt
|
||||
@c end tex
|
||||
|
||||
@titlepage
|
||||
@title GNU @code{nano}
|
||||
@subtitle a small and friendly text editor.
|
||||
@subtitle version 1.1.0
|
||||
|
||||
@author Chris Allegretta
|
||||
@page
|
||||
|
||||
This manual documents GNU @code{nano}, a small and friendly text
|
||||
editor.
|
||||
|
||||
This manual is part of the GNU @code{nano} distribution.@*
|
||||
@sp4
|
||||
Copyright (C) 1999, 2000, 2001 Chris Allegretta.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
|
||||
@iftex
|
||||
Permission is granted to process this file through TeX and print the
|
||||
results, provided the printed document carries copying permission
|
||||
notice identical to this one except for the removal of this paragraph
|
||||
(this paragraph not being relevant to the printed manual).
|
||||
@end iftex
|
||||
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the entire
|
||||
resulting derived work is distributed under the terms of a permission
|
||||
notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this manual
|
||||
into another language, under the above conditions for modified versions,
|
||||
except that this permission notice may be stated in a translation approved
|
||||
by the Foundation.
|
||||
|
||||
You may contact the author by:
|
||||
e-mail: @email{chrisa@@asty.org}@*
|
||||
@end titlepage
|
||||
|
||||
@node Top, Introduction, (dir), (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::
|
||||
@end menu
|
||||
|
||||
@node Introduction, Editor Basics, Top, Top
|
||||
@chapter Introduction
|
||||
|
||||
GNU @code{nano} is a small and friendly text editor. Besides basic
|
||||
text editing, @code{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::
|
||||
@end menu
|
||||
|
||||
@node Overview, Command Line Options, Introduction, Introduction
|
||||
@section Overview
|
||||
|
||||
@code{nano} [GNU long option] [option] +LINE [ @var{ file ...} ]
|
||||
|
||||
The original goal for @code{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
|
||||
@code{nano} by typing Meta-P. @xref{Pico Compatibility}, for more
|
||||
info.
|
||||
|
||||
Email bug reports to @email{nano@@nano-editor.org}.
|
||||
|
||||
@node Command Line Options, , Overview, Introduction
|
||||
@section Command Line Options
|
||||
|
||||
@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 -R, --regexp
|
||||
Turns on regular expression search and search/replace.
|
||||
|
||||
@item -V, --version
|
||||
Print the version number and copyright and quit.
|
||||
|
||||
@item -c, --const
|
||||
Constantly display the cursor position and line number on the statusbar.
|
||||
|
||||
@item -h, --help
|
||||
Print the usage and exit.
|
||||
|
||||
@item -i, --autoindent
|
||||
Automatically indent new lines to the same number of spaces and tabs as
|
||||
the previous line.
|
||||
|
||||
@item -k, --cut
|
||||
Makes ^K cut from the current cursor position to the end of the current
|
||||
line.
|
||||
|
||||
@item -l, --nofollow
|
||||
When writing files, if the given file is a symbolic link it is removed
|
||||
and a new file is created.
|
||||
|
||||
@item -m, --mouse
|
||||
Enables the use of the mouse to select text (currently only useful for
|
||||
running under the X window system).
|
||||
|
||||
@item -p, --pico
|
||||
Emulate Pico as closely as possible, sacrificing consistency for correct
|
||||
emulation. @xref{Pico Compatibility}, for more info.
|
||||
|
||||
@item -r [#cols], --fill=[#cols].
|
||||
Wrap lines at column #cols. By default this is the width of the screen,
|
||||
less eight. If this value is negative, wrapping will occur at #cols from
|
||||
the right of the screen, allowing it to vary along with the screen width
|
||||
if the screen is resized.
|
||||
|
||||
@item -s [prog], --speller=[prog]
|
||||
Invoke [prog] as the spell checker. By default, @code{nano} uses its
|
||||
own interactive spell checker that requires the @code{spell} program be
|
||||
installed on your system.
|
||||
|
||||
@item -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 @code{nano} as the
|
||||
composer of a mailer program.
|
||||
|
||||
@anchor{Expert Mode}
|
||||
@item -x, --nohelp
|
||||
In Expert Mode, the Shortcut Lists will not appear at the bottom of the
|
||||
screen. This affects the location of the statusbar as well, as in Expert
|
||||
Mode it is located at the very bottom of the editor.
|
||||
|
||||
Note: When accessing the help system, Expert Mode is temporarily disabled
|
||||
to display the help system navigation keys.
|
||||
|
||||
@item -v, --view
|
||||
Do not allow the contents of the file to be altered. Note that this
|
||||
flag should NOT be used in place of correct file permissions to implement
|
||||
a read-only file.
|
||||
|
||||
@item -w, --nowrap
|
||||
Do not wrap long lines at any length. This option overrides any value for
|
||||
-r.
|
||||
|
||||
@item -z, --suspend
|
||||
Enable suspend ability of @code{nano} using the system's suspend
|
||||
keystroke (usually ^Z).
|
||||
|
||||
@item +LINE
|
||||
Start at line number LINE instead of the default of line 1.
|
||||
@end table
|
||||
|
||||
@node Editor Basics, Online Help, Introduction, Top
|
||||
@chapter Editor Basics
|
||||
@menu
|
||||
* Entering Text::
|
||||
* Special Functions::
|
||||
* The Titlebar::
|
||||
* The Statusbar::
|
||||
* Shortcut Lists::
|
||||
@end menu
|
||||
|
||||
@node Entering Text, Special Functions, Editor Basics, Editor Basics
|
||||
@section Entering Text
|
||||
|
||||
All key sequences in @code{nano} are entered using the keyboard.
|
||||
@code{nano} is a "modeless" editor, all keys with the exception of
|
||||
Control and Meta key sequences will enter text into the file being
|
||||
edited.
|
||||
|
||||
@node Special Functions, The Titlebar, Entering Text, Editor Basics
|
||||
@section Special Functions
|
||||
|
||||
Special functions use the Control key (displayed in the help and
|
||||
shortcut lists as ^) or the Meta key (displayed as M).
|
||||
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
Control key sequences are entered by holding down the Control key and
|
||||
pressing the desired letter.
|
||||
@item
|
||||
Meta key sequences can be entered in a number of
|
||||
possible ways: Pressing the Escape key, then releasing it and pressing
|
||||
the desired key, or holding down the Alt key while pressing the desired
|
||||
key. This varies from keyboard to keyboard, and certain commercial
|
||||
operating systems "swallow" the Alt key so that it never reaches the
|
||||
application. If your operating system does this, you should use the
|
||||
Escape key to generate Meta key sequences.
|
||||
@end itemize
|
||||
|
||||
@node The Titlebar, The Statusbar, Special Functions, Editor Basics
|
||||
@section The Titlebar
|
||||
|
||||
The titlebar is the line displayed at the top of the editor. There are
|
||||
three sections: left, center and right. The section on the left displays
|
||||
the version of @code{nano} being used. The center section displays the
|
||||
current file name, or "New Buffer" if the file has not yet been named.
|
||||
The section on the right will display "Modified" if the file has been
|
||||
modified since it was last saved or opened.
|
||||
|
||||
Special modes: When nano is in "File browser" mode, the center section
|
||||
will display the current directory instead of the filename.
|
||||
@xref{The File Browser}.
|
||||
|
||||
@node The Statusbar, Shortcut Lists, The Titlebar, Editor Basics
|
||||
@section The Statusbar
|
||||
|
||||
The statusbar is located three lines from the bottom of the screen (or the
|
||||
bottom line in Expert Mode. @xref{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.
|
||||
|
||||
@node Shortcut Lists, , The Statusbar, Editor Basics
|
||||
@section Shortcut Lists
|
||||
|
||||
The Shortcut Lists are the two lines at the bottom of the screen which show
|
||||
some of the more commonly used functions in the editor. The exact
|
||||
functions which are displayed depend on whether Pico Compatibility Mode mode
|
||||
is enabled. @xref{Pico Compatibility}, for more info.
|
||||
|
||||
@node Online Help, Feature Toggles, Editor Basics, Top
|
||||
@chapter Online Help
|
||||
|
||||
The online help system in @code{nano} is available by pressing ^G.
|
||||
It is fairly self explanatory, documenting the various parts of the
|
||||
editor and available keystrokes. Navigation is via the ^Y (Page Up)
|
||||
and ^V (Page Down) keys. ^X exits the help system.
|
||||
|
||||
|
||||
@node Feature Toggles, The File Browser, Online Help, Top
|
||||
@chapter Feature Toggles
|
||||
|
||||
Toggles allow you to change certain aspects of the editor that
|
||||
would normally be done via command line flags. They are invoked via
|
||||
certain Meta key sequenced. @xref{Special Functions}, for more info.
|
||||
The following toggles are available:
|
||||
|
||||
@table @code
|
||||
|
||||
@item Constant Update Toggle (Meta-C)
|
||||
toggles the -c (--const) command line flag.
|
||||
|
||||
@item Regular Expressions Toggle (Meta-E)
|
||||
toggles the -R (--regexp) 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)
|
||||
toggles the -m (--mouse) command line flag.
|
||||
|
||||
@item Pico Mode Toggle (Meta-P)
|
||||
toggles the -p (--pico) command line flag.
|
||||
@xref{Pico Compatibility}, for more info.
|
||||
|
||||
@item AutoWrap Toggle (Meta-W)
|
||||
toggles the -w (--nowrap) command line flag.
|
||||
|
||||
@item Expert/Nohelp Toggle (Meta-X)
|
||||
toggles the -x (--nohelp) command line flag.
|
||||
|
||||
@item Suspend Toggle (Meta-Z)
|
||||
toggles the -z (--suspend) command line flag.
|
||||
|
||||
@end table
|
||||
|
||||
@node The File Browser, Pico Compatibility, Feature Toggles, Top
|
||||
@chapter 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.
|
||||
|
||||
@node Pico Compatibility, Building and Configure Options, The File Browser, Top
|
||||
@chapter Pico Compatibility
|
||||
|
||||
Nano does not completely emulate Pico by default. The following differences
|
||||
apply to the default mode and Pico Compatibility mode:
|
||||
|
||||
@table @code
|
||||
@item 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
|
||||
|
||||
@item 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.
|
||||
|
||||
@item Interactive Replace and Spell Checker
|
||||
It is worth noting that the @code{nano} replace function is interactive,
|
||||
i.e. it does not stop after one search string is found and automatically
|
||||
replace it. The @code{nano} implementation will stop at each search
|
||||
string found and query whether to replace this instance or not. The
|
||||
internal spell checker operates similarly. Note that these is no way
|
||||
to force these functions to behave in the Pico fashion.
|
||||
@end table
|
||||
|
||||
@node Building and Configure Options, , Pico Compatibility, Top
|
||||
@chapter 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:
|
||||
|
||||
|
||||
@table @code
|
||||
|
||||
@item --disable-tabcomp
|
||||
Disable the tab completion code when reading or writing files.
|
||||
|
||||
@item --disable-justify
|
||||
Disable the justify (^J)/unjustify (^U) functions in the editor.
|
||||
|
||||
@item --disable-speller
|
||||
Disables spell checker ability.
|
||||
|
||||
@item --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.
|
||||
|
||||
@item --disable-browser
|
||||
Disables the mini file browser (^O) when reading or writing files.
|
||||
|
||||
@item --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.
|
||||
|
||||
@item --disable-wrapping
|
||||
Disables all word wrapping in the editor. This also eliminates the
|
||||
-w command line flag, as nonwrapping is then the default behavior.
|
||||
|
||||
@item --disable-mouse
|
||||
Disables all mouse functionality. This also disables the -m commands line
|
||||
flag which enables the mouse functions.
|
||||
|
||||
@end table
|
||||
|
||||
@contents
|
||||
@bye
|
||||
|
||||
|
||||
48
nanorc.sample
Normal file
48
nanorc.sample
Normal file
@@ -0,0 +1,48 @@
|
||||
# Sample initialization file for GNU nano
|
||||
# Please note that you must have configured nano with
|
||||
# --enable-nanorc for this file to be read!
|
||||
|
||||
# Use regular expressions by default
|
||||
# set regexp
|
||||
|
||||
# Constantly update the cursor position
|
||||
# set const
|
||||
|
||||
# Use cut to end of line with ^K by default
|
||||
# set cut
|
||||
|
||||
# Use Auto-indentation
|
||||
# set autoindent
|
||||
|
||||
# Don't follow symlinks when writing files
|
||||
# set nofollow
|
||||
|
||||
# Use Pico Compatibility mode for ths shortcut lists and search text
|
||||
# set pico
|
||||
|
||||
# Use this value instead of the default
|
||||
# set fill -8
|
||||
|
||||
# Use this spelling checker instead of the default one
|
||||
# set speller aspell
|
||||
|
||||
# Save automatically on exit, don't prompt
|
||||
# set tempfile
|
||||
|
||||
# Disallow file modification, why would you want this in an rc file? ;)
|
||||
# set view
|
||||
|
||||
# Don't wrap text at all
|
||||
# set nowrap
|
||||
|
||||
# Don't display the help lists at the bottom of the screen
|
||||
# set nohelp
|
||||
|
||||
# Allow nano to be suepended with ^Z
|
||||
# set suspend
|
||||
|
||||
# Load files upon inserting them, and allow switching between them
|
||||
# You must have configured with --enable-multibuffer or --enable-extra for
|
||||
# this to work
|
||||
#
|
||||
# set multibuffer
|
||||
@@ -4,4 +4,5 @@ POTFILES
|
||||
*.gmo
|
||||
*.pot
|
||||
cat-id*
|
||||
messages
|
||||
stamp-cat*
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
# $Id$
|
||||
# Makefile for program source directory in GNU NLS utilities package.
|
||||
# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
|
||||
# Copyright (C) 1995-1997, 2000, 2001 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
|
||||
#
|
||||
# This file file be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU Public License
|
||||
# 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.
|
||||
|
||||
PACKAGE = @PACKAGE@
|
||||
VERSION = @VERSION@
|
||||
|
||||
# These two variables depend on the location of this directory.
|
||||
subdir = po
|
||||
top_builddir = ..
|
||||
|
||||
SHELL = /bin/sh
|
||||
@SET_MAKE@
|
||||
|
||||
@@ -19,22 +22,20 @@ VPATH = @srcdir@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
datadir = $(prefix)/@DATADIRNAME@
|
||||
datadir = @datadir@
|
||||
localedir = $(datadir)/locale
|
||||
gnulocaledir = $(prefix)/share/locale
|
||||
gettextsrcdir = $(prefix)/share/gettext/po
|
||||
subdir = po
|
||||
gettextsrcdir = $(datadir)/gettext/po
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
mkinstalldirs = $(SHELL) `case "$(MKINSTALLDIRS)" in /*) echo "$(MKINSTALLDIRS)" ;; *) echo "$(top_builddir)/$(MKINSTALLDIRS)" ;; esac`
|
||||
|
||||
CC = @CC@
|
||||
GENCAT = @GENCAT@
|
||||
GMSGFMT = PATH=../src:$$PATH @GMSGFMT@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
MSGFMT = @MSGFMT@
|
||||
XGETTEXT = PATH=../src:$$PATH @XGETTEXT@
|
||||
MSGMERGE = PATH=../src:$$PATH msgmerge
|
||||
XGETTEXT = @XGETTEXT@
|
||||
MSGMERGE = msgmerge
|
||||
|
||||
DEFS = @DEFS@
|
||||
CFLAGS = @CFLAGS@
|
||||
@@ -44,20 +45,17 @@ INCLUDES = -I.. -I$(top_srcdir)/intl
|
||||
|
||||
COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
|
||||
|
||||
SOURCES = cat-id-tbl.c
|
||||
POFILES = @POFILES@
|
||||
GMOFILES = @GMOFILES@
|
||||
DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
|
||||
stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
|
||||
$(POFILES) $(GMOFILES)
|
||||
|
||||
POTFILES = \
|
||||
|
||||
CATALOGS = @CATALOGS@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
INSTOBJEXT = @INSTOBJEXT@
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
|
||||
.SUFFIXES: .c .o .po .pox .gmo .mo
|
||||
|
||||
.c.o:
|
||||
$(COMPILE) $<
|
||||
@@ -71,19 +69,19 @@ INSTOBJEXT = @INSTOBJEXT@
|
||||
|
||||
.po.gmo:
|
||||
file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
|
||||
&& rm -f $$file && $(GMSGFMT) -o $$file $<
|
||||
|
||||
.po.cat:
|
||||
sed -f ../intl/po2msg.sed < $< > $*.msg \
|
||||
&& rm -f $@ && $(GENCAT) $@ $*.msg
|
||||
&& rm -f $$file && $(GMSGFMT) --statistics -o $$file $<
|
||||
|
||||
|
||||
all: all-@USE_NLS@
|
||||
|
||||
all-yes: cat-id-tbl.c $(CATALOGS)
|
||||
all-yes: $(CATALOGS)
|
||||
all-no:
|
||||
|
||||
$(srcdir)/$(PACKAGE).pot: $(POTFILES)
|
||||
# Note: Target 'all' must not depend on target '$(srcdir)/$(PACKAGE).pot',
|
||||
# otherwise packages like GCC can not be built if only parts of the source
|
||||
# have been downloaded.
|
||||
|
||||
$(srcdir)/$(PACKAGE).pot: $(POTFILES) $(srcdir)/POTFILES.in
|
||||
$(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
|
||||
--add-comments --keyword=_ --keyword=N_ \
|
||||
--files-from=$(srcdir)/POTFILES.in \
|
||||
@@ -91,81 +89,35 @@ $(srcdir)/$(PACKAGE).pot: $(POTFILES)
|
||||
|| ( rm -f $(srcdir)/$(PACKAGE).pot \
|
||||
&& mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot )
|
||||
|
||||
$(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
|
||||
$(srcdir)/stamp-cat-id: $(PACKAGE).pot
|
||||
rm -f cat-id-tbl.tmp
|
||||
sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
|
||||
| sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
|
||||
if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
|
||||
rm cat-id-tbl.tmp; \
|
||||
else \
|
||||
echo cat-id-tbl.c changed; \
|
||||
rm -f $(srcdir)/cat-id-tbl.c; \
|
||||
mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
|
||||
fi
|
||||
cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
|
||||
|
||||
|
||||
install: install-exec install-data
|
||||
install-exec:
|
||||
install-data: install-data-@USE_NLS@
|
||||
install-data-no: all
|
||||
install-data-yes: all
|
||||
if test -r "$(MKINSTALLDIRS)"; then \
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
|
||||
else \
|
||||
$(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
|
||||
fi
|
||||
@catalogs='$(CATALOGS)'; \
|
||||
for cat in $$catalogs; do \
|
||||
cat=`basename $$cat`; \
|
||||
case "$$cat" in \
|
||||
*.gmo) destdir=$(gnulocaledir);; \
|
||||
*) destdir=$(localedir);; \
|
||||
esac; \
|
||||
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
|
||||
dir=$$destdir/$$lang/LC_MESSAGES; \
|
||||
if test -r "$(MKINSTALLDIRS)"; then \
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$$dir; \
|
||||
else \
|
||||
$(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$$dir; \
|
||||
fi; \
|
||||
if test -r $$cat; then \
|
||||
$(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(PACKAGE)$(INSTOBJEXT); \
|
||||
echo "installing $$cat as" \
|
||||
"$(DESTDIR)$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
|
||||
else \
|
||||
$(INSTALL_DATA) $(srcdir)/$$cat \
|
||||
$(DESTDIR)$$dir/$(PACKAGE)$(INSTOBJEXT); \
|
||||
echo "installing $(srcdir)/$$cat as" \
|
||||
"$(DESTDIR)$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
|
||||
fi; \
|
||||
if test -r $$cat.m; then \
|
||||
$(INSTALL_DATA) $$cat.m $(DESTDIR)$$dir/$(PACKAGE)$(INSTOBJEXT).m; \
|
||||
echo "installing $$cat.m as" \
|
||||
"$(DESTDIR)$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
|
||||
else \
|
||||
if test -r $(srcdir)/$$cat.m ; then \
|
||||
$(INSTALL_DATA) $(srcdir)/$$cat.m \
|
||||
$(DESTDIR)$$dir/$(PACKAGE)$(INSTOBJEXT).m; \
|
||||
echo "installing $(srcdir)/$$cat as" \
|
||||
"$(DESTDIR)$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
|
||||
else \
|
||||
true; \
|
||||
fi; \
|
||||
fi; \
|
||||
done
|
||||
if test "$(PACKAGE)" = "gettext"; then \
|
||||
if test -r "$(MKINSTALLDIRS)"; then \
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
|
||||
else \
|
||||
$(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
|
||||
fi; \
|
||||
$(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
|
||||
$(INSTALL_DATA) $(srcdir)/Makefile.in.in \
|
||||
$(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
install-data-no: all
|
||||
install-data-yes: all
|
||||
$(mkinstalldirs) $(DESTDIR)$(datadir)
|
||||
@catalogs='$(CATALOGS)'; \
|
||||
for cat in $$catalogs; do \
|
||||
cat=`basename $$cat`; \
|
||||
lang=`echo $$cat | sed 's/\.gmo$$//'`; \
|
||||
dir=$(localedir)/$$lang/LC_MESSAGES; \
|
||||
$(mkinstalldirs) $(DESTDIR)$$dir; \
|
||||
if test -r $$cat; then \
|
||||
$(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
|
||||
echo "installing $$cat as $(DESTDIR)$$dir/$(PACKAGE).mo"; \
|
||||
else \
|
||||
$(INSTALL_DATA) $(srcdir)/$$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
|
||||
echo "installing $(srcdir)/$$cat as" \
|
||||
"$(DESTDIR)$$dir/$(PACKAGE).mo"; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
# Define this as empty until I found a useful application.
|
||||
installcheck:
|
||||
@@ -174,76 +126,68 @@ uninstall:
|
||||
catalogs='$(CATALOGS)'; \
|
||||
for cat in $$catalogs; do \
|
||||
cat=`basename $$cat`; \
|
||||
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
|
||||
rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
|
||||
rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
|
||||
rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
|
||||
rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
|
||||
lang=`echo $$cat | sed 's/\.gmo$$//'`; \
|
||||
rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE).mo; \
|
||||
done
|
||||
rm -f $(gettextsrcdir)/po-Makefile.in.in
|
||||
if test "$(PACKAGE)" = "gettext"; then \
|
||||
rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
|
||||
check: all
|
||||
|
||||
cat-id-tbl.o: ../intl/libgettext.h
|
||||
|
||||
dvi info tags TAGS ID:
|
||||
|
||||
mostlyclean:
|
||||
rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
|
||||
rm -f core core.* *.pox $(PACKAGE).po *.new.po
|
||||
rm -fr *.o
|
||||
|
||||
clean: mostlyclean
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
|
||||
rm -f Makefile Makefile.in POTFILES *.mo
|
||||
|
||||
maintainer-clean: distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
rm -f $(GMOFILES)
|
||||
|
||||
distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
dist distdir: update-po $(DISTFILES)
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
dist distdir:
|
||||
$(MAKE) update-po
|
||||
@$(MAKE) dist2
|
||||
# This is a separate target because 'update-po' must be executed before.
|
||||
dist2: $(DISTFILES)
|
||||
dists="$(DISTFILES)"; \
|
||||
for file in $$dists; do \
|
||||
ln $(srcdir)/$$file $(distdir) 2> /dev/null \
|
||||
|| cp -p $(srcdir)/$$file $(distdir); \
|
||||
if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
|
||||
cp -p $$dir/$$file $(distdir); \
|
||||
done
|
||||
|
||||
update-po: Makefile
|
||||
$(MAKE) $(PACKAGE).pot
|
||||
PATH=`pwd`/../src:$$PATH; \
|
||||
if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; fi; \
|
||||
cd $(srcdir); \
|
||||
catalogs='$(CATALOGS)'; \
|
||||
catalogs='$(GMOFILES)'; \
|
||||
for cat in $$catalogs; do \
|
||||
cat=`basename $$cat`; \
|
||||
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
|
||||
mv $$lang.po $$lang.old.po; \
|
||||
lang=`echo $$cat | sed 's/\.gmo$$//'`; \
|
||||
echo "$$lang:"; \
|
||||
if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
|
||||
rm -f $$lang.old.po; \
|
||||
if $(MSGMERGE) $$lang.po $(PACKAGE).pot -o $$lang.new.po; then \
|
||||
mv -f $$lang.new.po $$lang.po; \
|
||||
else \
|
||||
echo "msgmerge for $$cat failed!"; \
|
||||
rm -f $$lang.po; \
|
||||
mv $$lang.old.po $$lang.po; \
|
||||
rm -f $$lang.new.po; \
|
||||
fi; \
|
||||
done
|
||||
$(MAKE) update-gmo
|
||||
|
||||
POTFILES: POTFILES.in
|
||||
( if test 'x$(srcdir)' != 'x.'; then \
|
||||
posrcprefix='$(top_srcdir)/'; \
|
||||
else \
|
||||
posrcprefix="../"; \
|
||||
fi; \
|
||||
rm -f $@-t $@ \
|
||||
&& (sed -e '/^#/d' -e '/^[ ]*$$/d' \
|
||||
-e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
|
||||
| sed -e '$$s/\\$$//') > $@-t \
|
||||
&& chmod a-w $@-t \
|
||||
&& mv $@-t $@ )
|
||||
update-gmo: Makefile $(GMOFILES)
|
||||
@:
|
||||
|
||||
Makefile: Makefile.in.in ../config.status POTFILES
|
||||
cd .. \
|
||||
Makefile: Makefile.in.in $(top_builddir)/config.status POTFILES.in
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
|
||||
$(SHELL) ./config.status
|
||||
|
||||
|
||||
@@ -7,7 +7,9 @@ files.c
|
||||
global.c
|
||||
move.c
|
||||
nano.c
|
||||
rcfile.c
|
||||
search.c
|
||||
utils.c
|
||||
winio.c
|
||||
|
||||
# Package header files
|
||||
|
||||
367
po/update.pl
Executable file
367
po/update.pl
Executable file
@@ -0,0 +1,367 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
#
|
||||
# GNOME PO Update Utility
|
||||
#
|
||||
# Copyright (C) 2000 Free Software Foundation.
|
||||
#
|
||||
# This script is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This script is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
# Authors: Kenneth Christiansen <kenneth@gnu.org>
|
||||
#
|
||||
|
||||
# NOTICE: Please remember to change the variable $PACKAGE to reflect
|
||||
# the package this script is used within.
|
||||
|
||||
$PACKAGE="nano";
|
||||
|
||||
use File::Basename;
|
||||
|
||||
# Declare global variables
|
||||
#-------------------------
|
||||
my $VERSION = "1.5beta5";
|
||||
my $LANG = $ARGV[0];
|
||||
|
||||
# Always print as the first thing
|
||||
#--------------------------------
|
||||
$| = 1;
|
||||
|
||||
# Figure out what package that is in use
|
||||
#---------------------------------------
|
||||
#open FILE, "../configure.in";
|
||||
# while (<FILE>) {
|
||||
# next if /^dnl/; #ignore comments
|
||||
# if ($_=~/AM_INIT_AUTOMAKE\((.*),(.*)\)/o){
|
||||
# $PACKAGE=$1;
|
||||
# last; #stop when found
|
||||
# }
|
||||
# if ($_=~/PACKAGE\((.*)\)/o){
|
||||
# $PACKAGE=$1;
|
||||
# last; #stop when found
|
||||
# }
|
||||
# }
|
||||
#close FILE;
|
||||
|
||||
|
||||
# Give error if script is run without an argument
|
||||
#------------------------------------------------
|
||||
if (! $LANG){
|
||||
print "update.pl: missing file arguments\n";
|
||||
print "Try `update.pl --help' for more information.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
# Use the supplied arguments
|
||||
#---------------------------
|
||||
if ($LANG=~/^-(.)*/){
|
||||
|
||||
if ("$LANG" eq "--version" || "$LANG" eq "-V"){
|
||||
&Version;
|
||||
}
|
||||
elsif ($LANG eq "--help" || "$LANG" eq "-H"){
|
||||
&Help;
|
||||
}
|
||||
elsif ($LANG eq "--dist" || "$LANG" eq "-D"){
|
||||
&Merging;
|
||||
}
|
||||
elsif ($LANG eq "--pot" || "$LANG" eq "-P"){
|
||||
|
||||
# Check for .headerlock file, so the Makefile
|
||||
# will not generate the header files twise
|
||||
#--------------------------------------------
|
||||
if (-e ".headerlock"){
|
||||
&GeneratePot;
|
||||
}else{
|
||||
&GenHeaders;
|
||||
&GeneratePot;}
|
||||
exit;
|
||||
}
|
||||
elsif ($LANG eq "--headers" || "$LANG" eq "-S"){
|
||||
&GenHeaders;
|
||||
exit;
|
||||
}
|
||||
elsif ($LANG eq "--maintain" || "$LANG" eq "-M"){
|
||||
&Maintain;
|
||||
}
|
||||
else {
|
||||
&InvalidOption;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
# Run standard procedure
|
||||
#-----------------------
|
||||
if(-s "$LANG.po"){
|
||||
&GenHeaders;
|
||||
&GeneratePot;
|
||||
&Merging;
|
||||
&Status;
|
||||
}
|
||||
|
||||
# Report error if the language file supplied
|
||||
# to the command line is non-existent
|
||||
#-------------------------------------------
|
||||
else {
|
||||
&NotExisting;
|
||||
}
|
||||
}
|
||||
|
||||
sub Version{
|
||||
|
||||
# Print version information
|
||||
#--------------------------
|
||||
print "GNOME PO Updater $VERSION\n";
|
||||
print "Written by Kenneth Christiansen <kenneth\@gnome.org>, 2000.\n\n";
|
||||
print "Copyright (C) 2000 Free Software Foundation, Inc.\n";
|
||||
print "This is free software; see the source for copying conditions. There is NO\n";
|
||||
print "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
sub Help{
|
||||
|
||||
# Print usage information
|
||||
#------------------------
|
||||
print "Usage: ./update.pl [OPTIONS] ...LANGCODE\n";
|
||||
print "Updates pot files and merge them with the translations.\n\n";
|
||||
print " -H, --help shows this help page\n";
|
||||
print " -P, --pot generate the pot file only\n";
|
||||
print " -S, --headers generate the XML headerfiles in POTFILES.in\n";
|
||||
print " -M, --maintain search for missing files in POTFILES.in\n";
|
||||
print " -V, --version shows the version\n";
|
||||
print "\nExamples of use:\n";
|
||||
print "update.sh --pot just creates a new pot file from the source\n";
|
||||
print "update.sh da created new pot file and updated the da.po file\n\n";
|
||||
print "Report bugs to <kenneth\@gnome.org>.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
sub Maintain{
|
||||
|
||||
# Search and fine, all translatable files
|
||||
# ---------------------------------------
|
||||
$i18nfiles="find ../ -print | egrep '.*\\.(c|y|cc|c++|h|gob)' ";
|
||||
|
||||
open(BUF2, "POTFILES.in") || die "update.pl: there's no POTFILES.in!!!\n";
|
||||
|
||||
print "Searching for missing _(\" \") entries...\n";
|
||||
|
||||
open(BUF1, "$i18nfiles|");
|
||||
|
||||
@buf1_1 = <BUF1>;
|
||||
@buf1_2 = <BUF2>;
|
||||
|
||||
# Check if we should ignore some found files, when
|
||||
# comparing with POTFILES.in
|
||||
#-------------------------------------------------
|
||||
if (-s ".potignore"){
|
||||
open FILE, ".potignore";
|
||||
while (<FILE>) {
|
||||
if ($_=~/^[^#]/o){
|
||||
push @bup, $_;
|
||||
}
|
||||
}
|
||||
print "Found .potignore: Ignoring files...\n";
|
||||
@buf1_2 = (@bup, @buf1_2);
|
||||
}
|
||||
|
||||
foreach my $file (@buf1_1){
|
||||
open FILE, "<$file";
|
||||
while (<FILE>) {
|
||||
if ($_=~/_\(\"/o){
|
||||
$file = unpack("x3 A*",$file) . "\n";
|
||||
push @buf2_1, $file;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@buf3_1 = sort (@buf2_1);
|
||||
@buf3_2 = sort (@buf1_2);
|
||||
|
||||
my %in2;
|
||||
foreach (@buf3_2) {
|
||||
$in2{$_} = 1;
|
||||
}
|
||||
|
||||
foreach (@buf3_1){
|
||||
if (!exists($in2{$_})){
|
||||
push @result, $_
|
||||
}
|
||||
}
|
||||
|
||||
# Save file with information about the files missing
|
||||
# if any, and give information about this proceedier
|
||||
#---------------------------------------------------
|
||||
if(@result){
|
||||
open OUT, ">missing";
|
||||
print OUT @result;
|
||||
print "\nHere is the result:\n\n", @result, "\n";
|
||||
print "The file \"missing\" has been placed in the current directory.\n";
|
||||
print "Files supposed to be ignored should be placed in \".potignore\"\n";
|
||||
}
|
||||
|
||||
# If there is nothing to complain about, notice the user
|
||||
#-------------------------------------------------------
|
||||
else{
|
||||
print "\nWell, it's all perfect! Congratulation!\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub InvalidOption{
|
||||
|
||||
# Handle invalid arguments
|
||||
#-------------------------
|
||||
print "update.pl: invalid option -- $LANG\n";
|
||||
print "Try `update.pl --help' for more information.\n";
|
||||
}
|
||||
|
||||
sub GenHeaders{
|
||||
|
||||
# Generate the .h header files, so we can allow glade and
|
||||
# xml translation support
|
||||
#--------------------------------------------------------
|
||||
if(-s "ui-extract.pl"){
|
||||
|
||||
print "Found ui-extract.pl script\nRunning ui-extract...\n";
|
||||
|
||||
open FILE, "<POTFILES.in";
|
||||
while (<FILE>) {
|
||||
|
||||
# Find .xml files in POTFILES.in and generate the
|
||||
# files with help from the ui-extract.pl script
|
||||
#--------------------------------------------------
|
||||
if ($_=~ /(.*)(\.xml)/o){
|
||||
$filename = "../$1.xml";
|
||||
$xmlfiles="perl \.\/ui-extract.pl --local $filename";
|
||||
system($xmlfiles);
|
||||
}
|
||||
|
||||
# Find .glade files in POTFILES.in and generate
|
||||
# the files with help from the ui-extract.pl script
|
||||
#--------------------------------------------------
|
||||
elsif ($_=~ /(.*)(\.glade)/o){
|
||||
$filename = "../$1.glade";
|
||||
$xmlfiles="perl \.\/ui-extract.pl --local $filename";
|
||||
system($xmlfiles);
|
||||
}
|
||||
}
|
||||
close FILE;
|
||||
|
||||
# Create .headerlock file, so the script will know
|
||||
# that we already passed this section. This is required
|
||||
# since the individual sections can be reaced at different
|
||||
# times by the Makefile
|
||||
#---------------------------------------------------------
|
||||
system("touch .headerlock");
|
||||
}
|
||||
}
|
||||
|
||||
sub GeneratePot{
|
||||
|
||||
# Generate the potfiles from the POTFILES.in file
|
||||
#------------------------------------------------
|
||||
|
||||
print "Building the $PACKAGE.pot...\n";
|
||||
|
||||
system ("mv POTFILES.in POTFILES.in.old");
|
||||
|
||||
open INFILE, "<POTFILES.in.old";
|
||||
open OUTFILE, ">POTFILES.in";
|
||||
while (<INFILE>) {
|
||||
if ($_ =~ /\.(glade|xml)$/) {
|
||||
s/\.glade$/\.glade\.h/;
|
||||
s/\.xml$/\.xml\.h/;
|
||||
$_ = basename($_);
|
||||
$_ = "po/tmp/$_\n";
|
||||
}
|
||||
print OUTFILE $_;
|
||||
}
|
||||
close OUTFILE;
|
||||
close INFILE;
|
||||
|
||||
$GETTEXT ="xgettext --default-domain\=$PACKAGE --directory\=\.\."
|
||||
." --add-comments --keyword\=\_ --keyword\=N\_"
|
||||
." --files-from\=\.\/POTFILES\.in ";
|
||||
$GTEST ="test \! -f $PACKAGE\.po \|\| \( rm -f \.\/$PACKAGE\.pot "
|
||||
."&& mv $PACKAGE\.po \.\/$PACKAGE\.pot \)";
|
||||
|
||||
system($GETTEXT);
|
||||
system($GTEST);
|
||||
print "Wrote $PACKAGE.pot\n";
|
||||
system("mv POTFILES.in.old POTFILES.in");
|
||||
|
||||
# If .headerlock file is found, it means that the potfiles
|
||||
# already has been generated. If so delete the generated
|
||||
# .h header files. The reason for this approach with a
|
||||
# file as a marker is due to that the Makefile runs the
|
||||
# scripts in turns
|
||||
#---------------------------------------------------------
|
||||
|
||||
if(-e ".headerlock"){
|
||||
unlink(".headerlock");
|
||||
|
||||
print "Removing generated header (.h) files...";
|
||||
system("rm ./tmp/ -rf");
|
||||
}
|
||||
print "done\n";
|
||||
}
|
||||
|
||||
sub Merging{
|
||||
|
||||
if ($ARGV[1]){
|
||||
$LANG = $ARGV[1];
|
||||
} else {
|
||||
$LANG = $ARGV[0];
|
||||
}
|
||||
|
||||
if ($ARGV[0] ne "--dist" && $ARGV[0] ne "-D") {
|
||||
print "Merging $LANG.po with $PACKAGE.pot...";
|
||||
}
|
||||
|
||||
$MERGE="cp $LANG.po $LANG.po.old && msgmerge $LANG.po.old $PACKAGE.pot -o $LANG.po";
|
||||
|
||||
system($MERGE);
|
||||
|
||||
if ($ARGV[0] ne "--dist" && $ARGV[0] ne "-D") {
|
||||
print "\n\n";
|
||||
}
|
||||
|
||||
# Remove the "messages" trash file generated
|
||||
# by gettext, aswell as the backup file
|
||||
#-------------------------------------------
|
||||
unlink "messages";
|
||||
unlink "$LANG.po.old";
|
||||
}
|
||||
|
||||
sub NotExisting{
|
||||
|
||||
# Report error if supplied language
|
||||
# file is non-existant
|
||||
#----------------------------------
|
||||
print "update.pl: sorry, $LANG.po does not exist!\n";
|
||||
print "Try `update.pl --help' for more information.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
sub Status{
|
||||
|
||||
# Print status information about the po file
|
||||
#-------------------------------------------
|
||||
$STATUS="msgfmt --statistics $LANG.po";
|
||||
|
||||
system($STATUS);
|
||||
print "\n";
|
||||
}
|
||||
82
proto.h
82
proto.h
@@ -34,8 +34,9 @@ extern int current_x, current_y, posible_max, totlines;
|
||||
extern int placewewant;
|
||||
extern int mark_beginx, samelinewrap;
|
||||
extern int totsize, temp_opt;
|
||||
extern int fill, flags,tabsize;
|
||||
extern int fill, wrap_at, flags,tabsize;
|
||||
extern int search_last_line;
|
||||
extern int currslen;
|
||||
|
||||
extern WINDOW *edit, *topwin, *bottomwin;
|
||||
extern char *filename;
|
||||
@@ -43,17 +44,27 @@ extern char *answer;
|
||||
extern char *hblank, *help_text;
|
||||
extern char *last_search;
|
||||
extern char *last_replace;
|
||||
#ifndef DISABLE_SPELLER
|
||||
extern char *alt_speller;
|
||||
#endif
|
||||
extern struct stat fileinfo;
|
||||
extern filestruct *current, *fileage, *edittop, *editbot, *filebot;
|
||||
extern filestruct *cutbuffer, *mark_beginbuf;
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
extern filestruct *open_files;
|
||||
#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];
|
||||
extern shortcut writefile_list[WRITEFILE_LIST_LEN], help_list[HELP_LIST_LEN];
|
||||
extern shortcut writefile_list[WRITEFILE_LIST_LEN], insertfile_list[INSERTFILE_LIST_LEN];
|
||||
extern shortcut spell_list[SPELL_LIST_LEN], replace_list_2[REPLACE_LIST_LEN];
|
||||
extern shortcut help_list[HELP_LIST_LEN];
|
||||
#ifndef DISABLE_BROWSER
|
||||
extern shortcut browser_list[BROWSER_LIST_LEN];
|
||||
extern shortcut browser_list[BROWSER_LIST_LEN], gotodir_list[GOTODIR_LIST_LEN];
|
||||
#endif
|
||||
extern shortcut *currshortcut;
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
extern int use_regexp, regexp_compiled;
|
||||
@@ -65,8 +76,10 @@ extern toggle toggles[TOGGLE_LEN];
|
||||
|
||||
/* Programs we want available */
|
||||
|
||||
char *revstrstr(char *haystack, char *needle, char *rev_start);
|
||||
char *strcasestr(char *haystack, char *needle);
|
||||
char *strstrwrapper(char *haystack, char *needle);
|
||||
char *revstrcasestr(char *haystack, char *needle, char *rev_start);
|
||||
char *strstrwrapper(char *haystack, char *needle, char *rev_start);
|
||||
int search_init(int replacing);
|
||||
int renumber(filestruct * fileptr);
|
||||
int free_filestruct(filestruct * src);
|
||||
@@ -75,14 +88,20 @@ int do_yesno(int all, int leavecursor, char *msg, ...);
|
||||
int actual_x(filestruct * fileptr, int xplus);
|
||||
int strlenpt(char *buf);
|
||||
int statusq(int allowtabs, shortcut s[], int slen, char *def, char *msg, ...);
|
||||
int write_file(char *name, int tmpfile);
|
||||
int write_file(char *name, int tmpfile, int append, int nonamechange);
|
||||
int do_cut_text(void);
|
||||
int do_uncut_text(void);
|
||||
int no_help(void);
|
||||
int renumber_all(void);
|
||||
int open_file(char *filename, int insert, int quiet);
|
||||
int do_writeout(char *path, int exiting);
|
||||
int do_gotoline(long defline);
|
||||
int do_insertfile(int loading_file);
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
int add_open_file(int update, int dup_fix);
|
||||
#endif
|
||||
|
||||
int do_writeout(char *path, int exiting, int append);
|
||||
int do_gotoline(long line, int save_pos);
|
||||
int do_replace_loop(char *prevanswer, filestruct *begin, int *beginx,
|
||||
int wholewords, int *i);
|
||||
/* Now in move.c */
|
||||
@@ -102,7 +121,7 @@ void check_wrap(filestruct * inptr, char ch);
|
||||
void dump_buffer(filestruct * inptr);
|
||||
void align(char **strp);
|
||||
void edit_refresh(void), edit_refresh_clearok(void);
|
||||
void edit_update(filestruct * fileptr, int topmidbot);
|
||||
void edit_update(filestruct * fileptr, int topmidbotnone);
|
||||
void update_cursor(void);
|
||||
void delete_node(filestruct * fileptr);
|
||||
void set_modified(void);
|
||||
@@ -128,9 +147,10 @@ void do_early_abort(void);
|
||||
void *nmalloc(size_t howmuch);
|
||||
void *nrealloc(void *ptr, size_t howmuch);
|
||||
void die(char *msg, ...);
|
||||
void die_save_file(char *die_filename);
|
||||
void new_file(void);
|
||||
void new_magicline(void);
|
||||
void splice_node(filestruct *begin, filestruct *new, filestruct *end);
|
||||
void splice_node(filestruct *begin, filestruct *newnode, filestruct *end);
|
||||
void null_at(char *data, int index);
|
||||
void page_up_center(void);
|
||||
void blank_edit(void);
|
||||
@@ -140,19 +160,47 @@ void add_to_cutbuffer(filestruct * inptr);
|
||||
void do_replace_highlight(int highlight_flag, char *word);
|
||||
void nano_disabled_msg(void);
|
||||
void window_init(void);
|
||||
void do_mouse(void);
|
||||
void print_view_warning(void);
|
||||
void unlink_node(filestruct * fileptr);
|
||||
void cut_marked_segment(filestruct * top, int top_x, filestruct * bot,
|
||||
int bot_x, int destructive);
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
void do_rcfile(void);
|
||||
#endif
|
||||
|
||||
#ifdef NANO_EXTRA
|
||||
void do_credits(void);
|
||||
#endif
|
||||
|
||||
|
||||
int do_writeout_void(void), do_exit(void), do_gotoline_void(void);
|
||||
int do_insertfile(void), do_search(void), page_up(void), page_down(void);
|
||||
int do_insertfile_void(void), do_search(void);
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
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_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);
|
||||
int do_first_line(void), do_last_line(void);
|
||||
int do_replace(void), do_help(void), do_enter_void(void);
|
||||
int keypad_on(WINDOW * win, int new);
|
||||
int keypad_on(WINDOW * win, int newval);
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
int open_file_dup_fix(int update);
|
||||
int open_prevfile(int closing_file), open_nextfile(int closing_file);
|
||||
#endif
|
||||
|
||||
char *charalloc (size_t howmuch);
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
char *get_full_path(const char *origpath);
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
char *do_browser(char *path);
|
||||
@@ -160,6 +208,14 @@ struct stat filestat(const char *path);
|
||||
char *do_browse_from(char *inpath);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
int do_colorinit(void);
|
||||
void color_on(WINDOW *win, int whatever);
|
||||
void color_off(WINDOW *win, int whatever);
|
||||
|
||||
extern colorstruct colors[NUM_NCOLORS];
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
RETSIGTYPE main_loop (int junk);
|
||||
|
||||
filestruct *copy_node(filestruct * src);
|
||||
@@ -167,3 +223,7 @@ filestruct *copy_filestruct(filestruct * src);
|
||||
filestruct *make_new_node(filestruct * prevnode);
|
||||
filestruct *findnextstr(int quiet, filestruct * begin,
|
||||
int beginx, char *needle);
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
filestruct *open_file_dup_search(void);
|
||||
#endif
|
||||
|
||||
261
rcfile.c
Normal file
261
rcfile.c
Normal file
@@ -0,0 +1,261 @@
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* rcfile.c *
|
||||
* *
|
||||
* 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) *
|
||||
* any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include "config.h"
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#include <libintl.h>
|
||||
#define _(string) gettext(string)
|
||||
#else
|
||||
#define _(string) (string)
|
||||
#endif
|
||||
|
||||
#define NUM_RCOPTS 15
|
||||
/* Static stuff for the nanorc file */
|
||||
rcoption rcopts[NUM_RCOPTS] =
|
||||
{
|
||||
{"regexp", USE_REGEXP},
|
||||
{"const", CONSTUPDATE},
|
||||
{"autoindent", AUTOINDENT},
|
||||
{"cut", CUT_TO_END},
|
||||
{"nofollow", FOLLOW_SYMLINKS},
|
||||
{"mouse", USE_MOUSE},
|
||||
{"pico", PICO_MODE},
|
||||
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
{"fill", 0},
|
||||
#endif
|
||||
|
||||
{"speller", 0},
|
||||
{"tempfile", TEMP_OPT},
|
||||
{"view", VIEW_MODE},
|
||||
{"nowrap", NO_WRAP},
|
||||
{"nohelp", NO_HELP},
|
||||
{"suspend", SUSPEND},
|
||||
{"loadoninsert", LOADONINSERT}};
|
||||
|
||||
/* 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 */
|
||||
void rcfile_error(char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
va_start(ap, msg);
|
||||
vfprintf(stderr, msg, ap);
|
||||
va_end(ap);
|
||||
fprintf(stderr, _("\nPress return to continue starting nano\n"));
|
||||
|
||||
while (getchar() != '\n')
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
/* Just print the error (one of many, perhaps) but don't abort, yet */
|
||||
void rcfile_msg(int *errors, char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
if (!*errors) {
|
||||
*errors = 1;
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
va_start(ap, msg);
|
||||
vfprintf(stderr, msg, ap);
|
||||
va_end(ap);
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
}
|
||||
|
||||
/* Parse the next word from the string. Returns NULL if we hit EOL */
|
||||
char *parse_next_word(char *ptr)
|
||||
{
|
||||
while (*ptr != ' ' && *ptr != '\n' && ptr != '\0')
|
||||
ptr++;
|
||||
|
||||
if (*ptr == '\0')
|
||||
return NULL;
|
||||
|
||||
/* Null terminate and advance ptr */
|
||||
*ptr++ = 0;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/* Parse the RC file, once it has been opened successfully */
|
||||
void parse_rcfile(FILE *rcstream, char *filename)
|
||||
{
|
||||
char *buf, *ptr, *keyword, *option;
|
||||
int set = 0, lineno = 0, i;
|
||||
int errors = 0;
|
||||
|
||||
buf = charalloc(1024);
|
||||
while (fgets(buf, 1023, rcstream) > 0) {
|
||||
lineno++;
|
||||
ptr = buf;
|
||||
while ((*ptr == ' ' || *ptr == '\t') &&
|
||||
(*ptr != '\n' && *ptr != '\0'))
|
||||
ptr++;
|
||||
|
||||
if (*ptr == '\n' || *ptr == '\0')
|
||||
continue;
|
||||
|
||||
if (*ptr == '#') {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("parse_rcfile: Read a comment\n"));
|
||||
#endif
|
||||
continue; /* Skip past commented lines */
|
||||
}
|
||||
|
||||
/* Else skip to the next space */
|
||||
keyword = ptr;
|
||||
ptr = parse_next_word(ptr);
|
||||
if (!ptr)
|
||||
continue;
|
||||
|
||||
/* Else try to parse the keyword */
|
||||
if (!strcasecmp(keyword, "set"))
|
||||
set = 1;
|
||||
else if (!strcasecmp(keyword, "unset"))
|
||||
set = -1;
|
||||
else {
|
||||
rcfile_msg(&errors, _("Error in %s on line %d: command %s not understood"),
|
||||
filename, lineno, keyword);
|
||||
continue;
|
||||
}
|
||||
|
||||
option = ptr;
|
||||
ptr = parse_next_word(ptr);
|
||||
/* We don't care if ptr == NULL, as it should if using proper syntax */
|
||||
|
||||
if (set != 0) {
|
||||
for (i = 0; i <= NUM_RCOPTS - 1; i++) {
|
||||
if (!strcasecmp(option, rcopts[i].name)) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("parse_rcfile: Parsing option %s\n"),
|
||||
rcopts[i].name);
|
||||
#endif
|
||||
if (set == 1 || rcopts[i].flag == FOLLOW_SYMLINKS) {
|
||||
if (
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
!strcasecmp(rcopts[i].name, "fill") ||
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
!strcasecmp(rcopts[i].name, "speller")
|
||||
#else
|
||||
0
|
||||
#endif
|
||||
) {
|
||||
|
||||
if (*ptr == '\n' || *ptr == '\0') {
|
||||
rcfile_msg(&errors, _("Error in %s on line %d: option %s requires an argument"),
|
||||
filename, lineno, rcopts[i].name);
|
||||
continue;
|
||||
}
|
||||
option = ptr;
|
||||
ptr = parse_next_word(ptr);
|
||||
if (!strcasecmp(rcopts[i].name, "fill")) {
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
|
||||
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);
|
||||
}
|
||||
else
|
||||
fill = i;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#ifndef DISABLE_SPELLER
|
||||
alt_speller = charalloc(strlen(option) + 1);
|
||||
strcpy(alt_speller, option);
|
||||
#endif
|
||||
}
|
||||
} else
|
||||
SET(rcopts[i].flag);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("set flag %d!\n"), rcopts[i].flag);
|
||||
#endif
|
||||
} else {
|
||||
UNSET(rcopts[i].flag);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("unset flag %d!\n"), rcopts[i].flag);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (errors)
|
||||
rcfile_error(_("Errors found in .nanorc file"));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* The main rc file function, tries to open the rc file */
|
||||
void do_rcfile(void)
|
||||
{
|
||||
char *nanorc;
|
||||
char *unable = _("Unable to open ~/.nanorc file, %s");
|
||||
struct stat fileinfo;
|
||||
FILE *rcstream;
|
||||
|
||||
if (getenv("HOME") == NULL)
|
||||
return;
|
||||
|
||||
nanorc = charalloc(strlen(getenv("HOME")) + 10);
|
||||
sprintf(nanorc, "%s/.nanorc", getenv("HOME"));
|
||||
|
||||
if (stat(nanorc, &fileinfo) == -1) {
|
||||
|
||||
/* Abort if the file doesn't exist and there's some other kind
|
||||
of error stat()ing it */
|
||||
if (errno != ENOENT)
|
||||
rcfile_error(unable, errno);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((rcstream = fopen(nanorc, "r")) == NULL) {
|
||||
rcfile_error(unable, strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
parse_rcfile(rcstream, nanorc);
|
||||
fclose(rcstream);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
307
search.c
307
search.c
@@ -19,12 +19,13 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include "config.h"
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
@@ -44,7 +45,7 @@ void regexp_init(const char *regexp)
|
||||
SET(REGEXP_COMPILED);
|
||||
}
|
||||
|
||||
void regexp_cleanup()
|
||||
void regexp_cleanup(void)
|
||||
{
|
||||
UNSET(REGEXP_COMPILED);
|
||||
regfree(&search_regexp);
|
||||
@@ -54,34 +55,33 @@ void regexp_cleanup()
|
||||
void search_init_globals(void)
|
||||
{
|
||||
if (last_search == NULL) {
|
||||
last_search = nmalloc(1);
|
||||
last_search = charalloc(1);
|
||||
last_search[0] = 0;
|
||||
}
|
||||
if (last_replace == NULL) {
|
||||
last_replace = nmalloc(1);
|
||||
last_replace = charalloc(1);
|
||||
last_replace[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Set up the system variables for a search or replace. Returns -1 on
|
||||
abort, 0 on success, and 1 on rerun calling program
|
||||
Return -2 to run opposite program (searchg -> replace, replace -> search)
|
||||
Return -2 to run opposite program (search -> replace, replace -> search)
|
||||
|
||||
replacing = 1 if we call from do_replace, 0 if called from do_search func.
|
||||
*/
|
||||
int search_init(int replacing)
|
||||
{
|
||||
int i = 0;
|
||||
int i = 0, j;
|
||||
char *buf;
|
||||
char *prompt, *reprompt = "";
|
||||
char *prompt;
|
||||
static char *backupstring = NULL;
|
||||
|
||||
search_init_globals();
|
||||
|
||||
buf = nmalloc(strlen(last_search) + 5);
|
||||
buf = charalloc(strlen(last_search) + 5);
|
||||
buf[0] = 0;
|
||||
|
||||
|
||||
/* Okay, fun time. backupstring is our holder for what is being
|
||||
returned from the statusq call. Using answer for this would be tricky.
|
||||
Here, if we're using PICO_MODE, we only want nano to put the
|
||||
@@ -114,22 +114,21 @@ int search_init(int replacing)
|
||||
else
|
||||
strcpy(buf, "");
|
||||
|
||||
if (ISSET(USE_REGEXP) && ISSET(CASE_SENSITIVE))
|
||||
prompt = _("Case Sensitive Regexp Search%s%s");
|
||||
else if (ISSET(USE_REGEXP))
|
||||
prompt = _("Regexp Search%s%s");
|
||||
else if (ISSET(CASE_SENSITIVE))
|
||||
prompt = _("Case Sensitive Search%s%s");
|
||||
else
|
||||
prompt = _("Search%s%s");
|
||||
|
||||
if (replacing)
|
||||
reprompt = _(" (to replace)");
|
||||
/* 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, reprompt, buf);
|
||||
prompt,
|
||||
ISSET(CASE_SENSITIVE) ? _("Case Sensitive ") : "",
|
||||
ISSET(USE_REGEXP) ? _("Regexp ") : "",
|
||||
_("Search"),
|
||||
ISSET(REVERSE_SEARCH) ? _(" Backwards") : "",
|
||||
replacing ? _(" (to replace)") : "",
|
||||
buf);
|
||||
|
||||
/* Cancel any search, or just return with no previous search */
|
||||
if ((i == -1) || (i < 0 && !last_search[0])) {
|
||||
@@ -138,14 +137,22 @@ int search_init(int replacing)
|
||||
free(backupstring);
|
||||
backupstring = NULL;
|
||||
return -1;
|
||||
} else if (i == -2) { /* Same string */
|
||||
} else
|
||||
switch (i) {
|
||||
|
||||
case -2: /* Same string */
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (ISSET(USE_REGEXP))
|
||||
regexp_init(answer);
|
||||
#else
|
||||
;
|
||||
if (ISSET(USE_REGEXP)) {
|
||||
|
||||
/* If we're in pico mode, answer is "", use last_search! */
|
||||
if (ISSET(PICO_MODE))
|
||||
regexp_init(last_search);
|
||||
else
|
||||
regexp_init(answer);
|
||||
}
|
||||
#endif
|
||||
} else if (i == 0) { /* They entered something new */
|
||||
break;
|
||||
case 0: /* They entered something new */
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (ISSET(USE_REGEXP))
|
||||
regexp_init(answer);
|
||||
@@ -153,26 +160,41 @@ int search_init(int replacing)
|
||||
free(backupstring);
|
||||
backupstring = NULL;
|
||||
last_replace[0] = '\0';
|
||||
} else if (i == NANO_CASE_KEY) { /* They want it case sensitive */
|
||||
break;
|
||||
case TOGGLE_CASE_KEY:
|
||||
case TOGGLE_BACKWARDS_KEY:
|
||||
#ifdef HAVE_REGEX_H
|
||||
case TOGGLE_REGEXP_KEY:
|
||||
#endif
|
||||
free(backupstring);
|
||||
backupstring = NULL;
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
|
||||
if (ISSET(CASE_SENSITIVE))
|
||||
UNSET(CASE_SENSITIVE);
|
||||
else
|
||||
SET(CASE_SENSITIVE);
|
||||
for (j = 0; j <= TOGGLE_LEN - 1; j++)
|
||||
if (i == toggles[j].val)
|
||||
TOGGLE(toggles[j].flag);
|
||||
|
||||
return 1;
|
||||
} else if (i == NANO_OTHERSEARCH_KEY) {
|
||||
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;
|
||||
do_gotoline_void();
|
||||
return -3;
|
||||
} else { /* First line key, etc. */
|
||||
default:
|
||||
do_early_abort();
|
||||
free(backupstring);
|
||||
backupstring = NULL;
|
||||
@@ -201,65 +223,121 @@ filestruct *findnextstr(int quiet, filestruct * begin, int beginx,
|
||||
char *needle)
|
||||
{
|
||||
filestruct *fileptr;
|
||||
char *searchstr, *found = NULL, *tmp;
|
||||
char *searchstr, *rev_start = NULL, *found = NULL;
|
||||
int past_editbot = 0, current_x_find;
|
||||
|
||||
fileptr = current;
|
||||
|
||||
current_x_find = current_x + 1;
|
||||
if (!ISSET(REVERSE_SEARCH)) { /* forward search */
|
||||
|
||||
/* Are we searching the last line? (i.e. the line where search started) */
|
||||
if ((fileptr == begin) && (current_x_find < beginx))
|
||||
search_last_line = 1;
|
||||
current_x_find = current_x + 1;
|
||||
|
||||
/* Make sure we haven't passed the end of the string */
|
||||
if (strlen(fileptr->data) < current_x_find)
|
||||
current_x_find--;
|
||||
/* Are we now back to the line where the search started) */
|
||||
if ((fileptr == begin) && (current_x_find < beginx))
|
||||
search_last_line = 1;
|
||||
|
||||
searchstr = &fileptr->data[current_x_find];
|
||||
/* Make sure we haven't passed the end of the string */
|
||||
if (strlen(fileptr->data) < current_x_find)
|
||||
current_x_find--;
|
||||
|
||||
/* Look for needle in searchstr */
|
||||
while ((found = strstrwrapper(searchstr, needle)) == NULL) {
|
||||
searchstr = &fileptr->data[current_x_find];
|
||||
|
||||
/* finished processing file, get out */
|
||||
if (search_last_line) {
|
||||
/* Look for needle in searchstr */
|
||||
while ((found = strstrwrapper(searchstr, needle, rev_start)) == NULL) {
|
||||
|
||||
/* finished processing file, get out */
|
||||
if (search_last_line) {
|
||||
if (!quiet)
|
||||
not_found_msg(needle);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fileptr = fileptr->next;
|
||||
|
||||
if (!past_editbot && (fileptr == editbot))
|
||||
past_editbot = 1;
|
||||
|
||||
/* EOF reached ?, wrap around once */
|
||||
if (fileptr == NULL) {
|
||||
fileptr = fileage;
|
||||
past_editbot = 1;
|
||||
if (!quiet)
|
||||
statusbar(_("Search Wrapped"));
|
||||
}
|
||||
|
||||
/* Original start line reached */
|
||||
if (fileptr == begin)
|
||||
search_last_line = 1;
|
||||
|
||||
searchstr = fileptr->data;
|
||||
}
|
||||
|
||||
/* We found an instance */
|
||||
current_x_find = found - fileptr->data;
|
||||
|
||||
/* Ensure we haven't wrapped around again! */
|
||||
if ((search_last_line) && (current_x_find >= beginx)) {
|
||||
if (!quiet)
|
||||
not_found_msg(needle);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fileptr = fileptr->next;
|
||||
} else { /* reverse search */
|
||||
|
||||
if (!past_editbot && (fileptr == editbot))
|
||||
past_editbot = 1;
|
||||
current_x_find = current_x - 1;
|
||||
|
||||
/* EOF reached, wrap around once */
|
||||
if (fileptr == NULL) {
|
||||
fileptr = fileage;
|
||||
|
||||
past_editbot = 1;
|
||||
|
||||
if (!quiet)
|
||||
statusbar(_("Search Wrapped"));
|
||||
}
|
||||
|
||||
/* Original start line reached */
|
||||
if (fileptr == begin)
|
||||
/* Are we now back to the line 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 (!(&fileptr->data[current_x_find] - fileptr->data))
|
||||
current_x_find++;
|
||||
#endif
|
||||
rev_start = &fileptr->data[current_x_find];
|
||||
searchstr = fileptr->data;
|
||||
}
|
||||
|
||||
/* We found an instance */
|
||||
current_x_find = 0;
|
||||
for (tmp = fileptr->data; tmp != found; tmp++)
|
||||
current_x_find++;
|
||||
/* Look for needle in searchstr */
|
||||
while ((found = strstrwrapper(searchstr, needle, rev_start)) == NULL) {
|
||||
|
||||
/* Ensure we haven't wrap around again! */
|
||||
if ((search_last_line) && (current_x_find >= beginx)) {
|
||||
if (!quiet)
|
||||
not_found_msg(needle);
|
||||
return NULL;
|
||||
/* finished processing file, get out */
|
||||
if (search_last_line) {
|
||||
if (!quiet)
|
||||
not_found_msg(needle);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fileptr = fileptr->prev;
|
||||
|
||||
/* ? */ if (!past_editbot && (fileptr == edittop->prev))
|
||||
past_editbot = 1;
|
||||
|
||||
/* SOF reached ?, wrap around once */
|
||||
/* ? */ if (fileptr == NULL) {
|
||||
fileptr = filebot;
|
||||
past_editbot = 1;
|
||||
if (!quiet)
|
||||
statusbar(_("Search Wrapped"));
|
||||
}
|
||||
|
||||
/* Original start line reached */
|
||||
if (fileptr == begin)
|
||||
search_last_line = 1;
|
||||
|
||||
searchstr = fileptr->data;
|
||||
rev_start = fileptr->data + strlen(fileptr->data);
|
||||
}
|
||||
|
||||
/* We found an instance */
|
||||
current_x_find = found - fileptr->data;
|
||||
|
||||
/* Ensure we haven't wrapped around again! */
|
||||
if ((search_last_line) && (current_x_find < beginx)) {
|
||||
if (!quiet)
|
||||
not_found_msg(needle);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Set globals now that we are sure we found something */
|
||||
@@ -340,16 +418,16 @@ int do_search(void)
|
||||
void print_replaced(int num)
|
||||
{
|
||||
if (num > 1)
|
||||
statusbar(_("Replaced %d occurences"), num);
|
||||
statusbar(_("Replaced %d occurrences"), num);
|
||||
else if (num == 1)
|
||||
statusbar(_("Replaced 1 occurence"));
|
||||
statusbar(_("Replaced 1 occurrence"));
|
||||
}
|
||||
|
||||
void replace_abort(void)
|
||||
{
|
||||
/* Identicle to search_abort, so we'll call it here. If it
|
||||
/* Identical to search_abort, so we'll call it here. If it
|
||||
does something different later, we can change it back. For now
|
||||
it's just a waste to duplicat code */
|
||||
it's just a waste to duplicate code */
|
||||
search_abort();
|
||||
placewewant = xplustabs();
|
||||
}
|
||||
@@ -428,7 +506,7 @@ char *replace_line(void)
|
||||
search_match_count = regmatches[0].rm_eo - regmatches[0].rm_so;
|
||||
new_line_size = replace_regexp(NULL, 0);
|
||||
/* If they specified an invalid subexpression in the replace
|
||||
* text, return NULL indicating an error */
|
||||
* text, return NULL, indicating an error */
|
||||
if (new_line_size < 0)
|
||||
return NULL;
|
||||
} else {
|
||||
@@ -441,7 +519,7 @@ char *replace_line(void)
|
||||
}
|
||||
|
||||
/* Create buffer */
|
||||
copy = nmalloc(new_line_size);
|
||||
copy = charalloc(new_line_size);
|
||||
|
||||
/* Head of Original Line */
|
||||
strncpy(copy, current->data, current_x);
|
||||
@@ -457,7 +535,7 @@ char *replace_line(void)
|
||||
|
||||
/* The tail of the original line */
|
||||
/* This may expose other bugs, because it no longer
|
||||
goes through each character on the string
|
||||
goes through each character in the string
|
||||
and tests for string goodness. But because
|
||||
we can assume the invariant that current->data
|
||||
is less than current_x + strlen(last_search) long,
|
||||
@@ -507,7 +585,7 @@ int do_replace_loop(char *prevanswer, filestruct *begin, int *beginx,
|
||||
if (!fileptr)
|
||||
break;
|
||||
|
||||
/* Make sure only wholewords are found */
|
||||
/* Make sure only whole words are found */
|
||||
if (wholewords)
|
||||
{
|
||||
/* start of line or previous character not a letter */
|
||||
@@ -581,6 +659,12 @@ int do_replace(void)
|
||||
filestruct *begin;
|
||||
char *prevanswer = NULL, *buf = NULL;
|
||||
|
||||
if (ISSET(VIEW_MODE)) {
|
||||
print_view_warning();
|
||||
replace_abort();
|
||||
return 0;
|
||||
}
|
||||
|
||||
i = search_init(1);
|
||||
switch (i) {
|
||||
case -1:
|
||||
@@ -598,7 +682,7 @@ int do_replace(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Again, there was a previous string but they deleted it and hit enter */
|
||||
/* Again, there was a previous string, but they deleted it and hit enter */
|
||||
if (!ISSET(PICO_MODE) && !strcmp(answer, "")) {
|
||||
statusbar(_("Replace Cancelled"));
|
||||
replace_abort();
|
||||
@@ -616,7 +700,7 @@ int do_replace(void)
|
||||
}
|
||||
|
||||
if (ISSET(PICO_MODE)) {
|
||||
buf = nmalloc(strlen(last_replace) + 5);
|
||||
buf = charalloc(strlen(last_replace) + 5);
|
||||
if (strcmp(last_replace, "")) {
|
||||
if (strlen(last_replace) > (COLS / 3)) {
|
||||
strncpy(buf, last_replace, COLS / 3);
|
||||
@@ -659,55 +743,42 @@ void goto_abort(void)
|
||||
display_main_list();
|
||||
}
|
||||
|
||||
int do_gotoline(long defline)
|
||||
int do_gotoline(long line, int save_pos)
|
||||
{
|
||||
long line, i = 1, j = 0;
|
||||
filestruct *fileptr;
|
||||
long i = 1;
|
||||
|
||||
if (defline > 0) /* We already know what line we want to go to */
|
||||
line = defline;
|
||||
else { /* Ask for it */
|
||||
if (line <= 0) { /* Ask for it */
|
||||
|
||||
long j = 0;
|
||||
|
||||
j = statusq(0, goto_list, GOTO_LIST_LEN, "", _("Enter line number"));
|
||||
if (j == -1) {
|
||||
if (j != 0) {
|
||||
statusbar(_("Aborted"));
|
||||
goto_abort();
|
||||
return 0;
|
||||
} else if (j != 0) {
|
||||
do_early_abort();
|
||||
}
|
||||
|
||||
line = atoi(answer);
|
||||
|
||||
/* Bounds check */
|
||||
if (line <= 0) {
|
||||
statusbar(_("Come on, be reasonable"));
|
||||
goto_abort();
|
||||
return 0;
|
||||
}
|
||||
if (!strcmp(answer, "$")) {
|
||||
current = filebot;
|
||||
current_x = 0;
|
||||
edit_update(current, CENTER);
|
||||
goto_abort();
|
||||
return 1;
|
||||
}
|
||||
line = atoi(answer);
|
||||
}
|
||||
|
||||
/* Bounds check */
|
||||
if (line <= 0) {
|
||||
statusbar(_("Come on, be reasonable"));
|
||||
goto_abort();
|
||||
return 0;
|
||||
}
|
||||
if (line > totlines) {
|
||||
statusbar(_("Only %d lines available, skipping to last line"),
|
||||
filebot->lineno);
|
||||
current = filebot;
|
||||
current_x = 0;
|
||||
edit_update(current, CENTER);
|
||||
} else {
|
||||
for (fileptr = fileage; fileptr != NULL && i < line; i++)
|
||||
fileptr = fileptr->next;
|
||||
for (current = fileage; ((current->next != NULL) && (i < line)); i++)
|
||||
current = current->next;
|
||||
|
||||
current = fileptr;
|
||||
current_x = 0;
|
||||
current_x = 0;
|
||||
|
||||
/* if save_pos is non-zero, don't change the cursor position when
|
||||
updating the edit window */
|
||||
if (save_pos)
|
||||
edit_update(current, NONE);
|
||||
else
|
||||
edit_update(current, CENTER);
|
||||
}
|
||||
|
||||
goto_abort();
|
||||
return 1;
|
||||
@@ -715,5 +786,5 @@ int do_gotoline(long defline)
|
||||
|
||||
int do_gotoline_void(void)
|
||||
{
|
||||
return do_gotoline(0);
|
||||
return do_gotoline(0, 0);
|
||||
}
|
||||
|
||||
5992
texinfo.tex
Normal file
5992
texinfo.tex
Normal file
File diff suppressed because it is too large
Load Diff
135
utils.c
135
utils.c
@@ -19,12 +19,13 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "nano.h"
|
||||
#include "proto.h"
|
||||
|
||||
@@ -46,54 +47,92 @@ void lowercase(char *src)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* I can't believe I have to write this function */
|
||||
char *strcasestr(char *haystack, char *needle)
|
||||
char *revstrstr(char *haystack, char *needle, char *rev_start)
|
||||
{
|
||||
char *localneedle, *localhaystack, *found, *tmp, *tmp2;
|
||||
char *p, *q, *r;
|
||||
|
||||
/* Make a copy of the search string and searcgh space */
|
||||
localneedle = nmalloc(strlen(needle) + 2);
|
||||
localhaystack = nmalloc(strlen(haystack) + 2);
|
||||
|
||||
strcpy(localneedle, needle);
|
||||
strcpy(localhaystack, haystack);
|
||||
|
||||
/* Make them lowercase */
|
||||
lowercase(localneedle);
|
||||
lowercase(localhaystack);
|
||||
|
||||
/* Look for the lowercased substring in the lowercased search space -
|
||||
return NULL if we didn't find anything */
|
||||
if ((found = strstr(localhaystack, localneedle)) == NULL) {
|
||||
free(localneedle);
|
||||
free(localhaystack);
|
||||
return NULL;
|
||||
for(p = rev_start ; p >= haystack ; --p) {
|
||||
for (r = p, q = needle ; (*q == *r) && (*q != '\0') ; r++, q++)
|
||||
;
|
||||
if (*q == '\0')
|
||||
return p;
|
||||
}
|
||||
/* Else return the pointer to the same place in the real search space */
|
||||
tmp2 = haystack;
|
||||
for (tmp = localhaystack; tmp != found; tmp++)
|
||||
tmp2++;
|
||||
|
||||
free(localneedle);
|
||||
free(localhaystack);
|
||||
return tmp2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *strstrwrapper(char *haystack, char *needle)
|
||||
char *revstrcasestr(char *haystack, char *needle, char *rev_start)
|
||||
{
|
||||
char *p, *q, *r;
|
||||
|
||||
for(p = rev_start ; p >= haystack ; --p) {
|
||||
for (r = p, q = needle ; (tolower(*q) == tolower(*r)) && (*q != '\0') ; r++, q++)
|
||||
;
|
||||
if (*q == '\0')
|
||||
return p;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* This is now mutt's version (called mutt_stristr) because it doesn't
|
||||
use memory allocation to do a simple search (yuck). */
|
||||
char *strcasestr(char *haystack, char *needle)
|
||||
{
|
||||
const char *p, *q;
|
||||
|
||||
if (!haystack)
|
||||
return NULL;
|
||||
if (!needle)
|
||||
return (haystack);
|
||||
|
||||
while (*(p = haystack)) {
|
||||
for (q = needle; *p && *q && tolower (*p) == tolower (*q); p++, q++)
|
||||
;
|
||||
if (!*q)
|
||||
return (haystack);
|
||||
haystack++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *strstrwrapper(char *haystack, char *needle, char *rev_start)
|
||||
{
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
|
||||
int result;
|
||||
char *i, *j;
|
||||
|
||||
if (ISSET(USE_REGEXP)) {
|
||||
int result = regexec(&search_regexp, haystack, 10, regmatches, 0);
|
||||
if (!result)
|
||||
return haystack + regmatches[0].rm_so;
|
||||
if (!ISSET(REVERSE_SEARCH)) {
|
||||
result = regexec(&search_regexp, haystack, 10, regmatches, 0);
|
||||
if (!result)
|
||||
return haystack + regmatches[0].rm_so;
|
||||
} else {
|
||||
/* do quick check first */
|
||||
if (!(regexec(&search_regexp, haystack, 10, regmatches, 0))) {
|
||||
/* there is a match */
|
||||
for(i = rev_start ; i >= haystack ; --i)
|
||||
if (!(result = regexec(&search_regexp, i, 10, regmatches, 0))) {
|
||||
j = i + regmatches[0].rm_so;
|
||||
if (j <= rev_start)
|
||||
return j;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
if (ISSET(CASE_SENSITIVE))
|
||||
return strstr(haystack, needle);
|
||||
else
|
||||
return strcasestr(haystack, needle);
|
||||
if (ISSET(CASE_SENSITIVE)) {
|
||||
if (!ISSET(REVERSE_SEARCH))
|
||||
return strstr(haystack,needle);
|
||||
else
|
||||
return revstrstr(haystack, needle, rev_start);
|
||||
} else {
|
||||
if (!ISSET(REVERSE_SEARCH))
|
||||
return strcasestr(haystack, needle);
|
||||
else
|
||||
return revstrcasestr(haystack, needle, rev_start);
|
||||
}
|
||||
}
|
||||
|
||||
/* Thanks BG, many ppl have been asking for this... */
|
||||
@@ -109,6 +148,20 @@ void *nmalloc(size_t howmuch)
|
||||
return r;
|
||||
}
|
||||
|
||||
/* We're going to need this too - Hopefully this will minimize
|
||||
the transition cost of moving to the apropriate function. */
|
||||
char *charalloc(size_t howmuch)
|
||||
{
|
||||
void *r;
|
||||
|
||||
/* Panic save? */
|
||||
|
||||
if (!(r = calloc(howmuch, sizeof (char))))
|
||||
die(_("nano: calloc: out of memory!"));
|
||||
|
||||
return (char *) r;
|
||||
}
|
||||
|
||||
void *nrealloc(void *ptr, size_t howmuch)
|
||||
{
|
||||
void *r;
|
||||
@@ -119,7 +172,7 @@ void *nrealloc(void *ptr, size_t howmuch)
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Copy one malloced string to another pointer.
|
||||
/* Copy one malloc()ed string to another pointer.
|
||||
|
||||
Should be used as dest = mallocstrcpy(dest, src);
|
||||
*/
|
||||
@@ -138,7 +191,7 @@ void *mallocstrcpy(char *dest, char *src)
|
||||
return(dest);
|
||||
}
|
||||
|
||||
dest = nmalloc(strlen(src) + 1);
|
||||
dest = charalloc(strlen(src) + 1);
|
||||
strcpy(dest, src);
|
||||
|
||||
return dest;
|
||||
@@ -149,7 +202,7 @@ void *mallocstrcpy(char *dest, char *src)
|
||||
void new_magicline(void)
|
||||
{
|
||||
filebot->next = nmalloc(sizeof(filestruct));
|
||||
filebot->next->data = nmalloc(1);
|
||||
filebot->next->data = charalloc(1);
|
||||
filebot->next->data[0] = '\0';
|
||||
filebot->next->prev = filebot;
|
||||
filebot->next->next = NULL;
|
||||
|
||||
442
winio.c
442
winio.c
@@ -19,11 +19,12 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include "config.h"
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
@@ -34,8 +35,10 @@
|
||||
#define _(string) (string)
|
||||
#endif
|
||||
|
||||
|
||||
/* winio.c statics */
|
||||
static int statblank = 0; /* Number of keystrokes left after
|
||||
we call statubar() before we
|
||||
we call statusbar(), before we
|
||||
actually blank the statusbar */
|
||||
|
||||
/* Local Function Prototypes for only winio.c */
|
||||
@@ -63,7 +66,7 @@ int do_last_line(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Like xplustabs, but for a specifc index of a speficific filestruct */
|
||||
/* Like xplustabs, but for a specific index of a specific filestruct */
|
||||
int xpt(filestruct * fileptr, int index)
|
||||
{
|
||||
int i, tabs = 0;
|
||||
@@ -79,7 +82,7 @@ int xpt(filestruct * fileptr, int index)
|
||||
else
|
||||
tabs += tabsize - (tabs % tabsize);
|
||||
} else if (fileptr->data[i] & 0x80)
|
||||
/* Make 8 bit chars only 1 collumn! */
|
||||
/* Make 8 bit chars only 1 column! */
|
||||
;
|
||||
else if (fileptr->data[i] < 32)
|
||||
tabs++;
|
||||
@@ -125,7 +128,7 @@ int actual_x_from_start(filestruct * fileptr, int xplus, int start)
|
||||
}
|
||||
|
||||
/* Opposite of xplustabs */
|
||||
inline int actual_x(filestruct * fileptr, int xplus)
|
||||
int actual_x(filestruct * fileptr, int xplus)
|
||||
{
|
||||
return actual_x_from_start(fileptr, xplus, 0);
|
||||
}
|
||||
@@ -146,7 +149,7 @@ int strlenpt(char *buf)
|
||||
else
|
||||
tabs += tabsize - (tabs % tabsize);
|
||||
} else if (buf[i] & 0x80)
|
||||
/* Make 8 bit chars only 1 collumn! */
|
||||
/* Make 8 bit chars only 1 column! */
|
||||
;
|
||||
else if (buf[i] < 32)
|
||||
tabs++;
|
||||
@@ -156,7 +159,7 @@ int strlenpt(char *buf)
|
||||
}
|
||||
|
||||
|
||||
/* resets current_y based on the position of current and puts the cursor at
|
||||
/* resets current_y, based on the position of current, and puts the cursor at
|
||||
(current_y, current_x) */
|
||||
void reset_cursor(void)
|
||||
{
|
||||
@@ -224,7 +227,11 @@ void nanoget_repaint(char *buf, char *inputbuf, int x)
|
||||
int len = strlen(buf);
|
||||
int wid = COLS - len;
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_on(bottomwin, COLOR_STATUSBAR);
|
||||
#endif
|
||||
blank_statusbar();
|
||||
|
||||
if (x <= COLS - 1) {
|
||||
/* Black magic */
|
||||
buf[len - 1] = ' ';
|
||||
@@ -241,9 +248,13 @@ void nanoget_repaint(char *buf, char *inputbuf, int x)
|
||||
waddnstr(bottomwin, &inputbuf[wid * ((x - len) / (wid))], wid);
|
||||
wmove(bottomwin, 0, ((x - len) % wid) + len);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_off(bottomwin, COLOR_STATUSBAR);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Get the input from the kb, this should only be called from statusq */
|
||||
/* 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)
|
||||
{
|
||||
@@ -254,12 +265,17 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
||||
int shift = 0;
|
||||
#endif
|
||||
|
||||
inputbuf = nmalloc(strlen(def) + 1);
|
||||
inputbuf = charalloc(strlen(def) + 1);
|
||||
inputbuf[0] = 0;
|
||||
|
||||
x_left = strlen(buf);
|
||||
x = strlen(def) + x_left;
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
currshortcut = s;
|
||||
currslen = slen;
|
||||
#endif
|
||||
|
||||
/* Get the input! */
|
||||
if (strlen(def) > 0)
|
||||
strcpy(inputbuf, def);
|
||||
@@ -271,7 +287,11 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
||||
|
||||
while ((kbinput = wgetch(bottomwin)) != 13) {
|
||||
for (j = 0; j <= slen - 1; j++) {
|
||||
if (kbinput == s[j].val) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("Aha! \'%c\' (%d)\n"), kbinput, kbinput);
|
||||
#endif
|
||||
|
||||
if (kbinput == s[j].val && kbinput < 32) {
|
||||
|
||||
/* We shouldn't discard the answer it gave, just because
|
||||
we hit a keystroke, GEEZ! */
|
||||
@@ -286,7 +306,8 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
||||
tabbed = 0;
|
||||
|
||||
switch (kbinput) {
|
||||
/* Stuff we want to equate with <enter>, ASCII 13 */
|
||||
|
||||
/* Stuff we want to equate with <enter>, ASCII 13 */
|
||||
case 343:
|
||||
ungetch(13); /* Enter on iris-ansi $TERM, sometimes */
|
||||
break;
|
||||
@@ -297,17 +318,27 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
||||
case 543: /* Right ctrl again */
|
||||
case 544:
|
||||
case 545: /* Right alt again */
|
||||
break;
|
||||
#endif
|
||||
break;
|
||||
#ifndef DISABLE_MOUSE
|
||||
#ifdef NCURSES_MOUSE_VERSION
|
||||
case KEY_MOUSE:
|
||||
do_mouse();
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
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:
|
||||
|
||||
if (x < xend)
|
||||
x++;
|
||||
@@ -360,6 +391,7 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
||||
break;
|
||||
#endif
|
||||
case KEY_LEFT:
|
||||
case NANO_BACK_KEY:
|
||||
if (x > strlen(buf))
|
||||
x--;
|
||||
wmove(bottomwin, 0, x);
|
||||
@@ -420,11 +452,29 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
||||
nodelay(edit, FALSE);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
for (j = 0; j <= slen - 1; j++) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("Aha! \'%c\' (%d)\n"), kbinput, kbinput);
|
||||
#endif
|
||||
if (kbinput == s[j].val || kbinput == s[j].val - 32) {
|
||||
|
||||
/* We hit an Alt key. Do like above. We don't
|
||||
just ungetch the letter and let it get caught
|
||||
above cause that screws the keypad... */
|
||||
answer = mallocstrcpy(answer, inputbuf);
|
||||
free(inputbuf);
|
||||
return s[j].val;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
nanoget_repaint(buf, inputbuf, x);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
if (kbinput < 32)
|
||||
break;
|
||||
|
||||
@@ -473,8 +523,15 @@ void titlebar(char *path)
|
||||
if (path == NULL)
|
||||
what = filename;
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_on(topwin, COLOR_TITLEBAR);
|
||||
mvwaddstr(topwin, 0, 0, hblank);
|
||||
#else
|
||||
horizbar(topwin, 0);
|
||||
wattron(topwin, A_REVERSE);
|
||||
#endif
|
||||
|
||||
|
||||
mvwaddstr(topwin, 0, 3, VERMSG);
|
||||
|
||||
space = COLS - strlen(VERMSG) - strlen(VERSION) - 21;
|
||||
@@ -500,7 +557,14 @@ void titlebar(char *path)
|
||||
}
|
||||
if (ISSET(MODIFIED))
|
||||
mvwaddstr(topwin, 0, COLS - 10, _("Modified"));
|
||||
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_off(topwin, COLOR_TITLEBAR);
|
||||
#else
|
||||
wattroff(topwin, A_REVERSE);
|
||||
#endif
|
||||
|
||||
wrefresh(topwin);
|
||||
reset_cursor();
|
||||
}
|
||||
@@ -509,7 +573,7 @@ void onekey(char *keystroke, char *desc)
|
||||
{
|
||||
char description[80];
|
||||
|
||||
snprintf(description, 12, " %-10s", desc);
|
||||
snprintf(description, 12 - (strlen(keystroke) - 2), " %-10s", desc);
|
||||
wattron(bottomwin, A_REVERSE);
|
||||
waddstr(bottomwin, keystroke);
|
||||
wattroff(bottomwin, A_REVERSE);
|
||||
@@ -533,13 +597,23 @@ void bottombars(shortcut s[], int slen)
|
||||
if (ISSET(NO_HELP))
|
||||
return;
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_on(bottomwin, COLOR_BOTTOMBARS);
|
||||
#endif
|
||||
|
||||
/* Determine how many extra spaces are needed to fill the bottom of the screen */
|
||||
k = COLS / 6 - 13;
|
||||
|
||||
clear_bottomwin();
|
||||
wmove(bottomwin, 1, 0);
|
||||
for (i = 0; i <= slen - 1; i += 2) {
|
||||
snprintf(keystr, 10, "^%c", s[i].val + 64);
|
||||
|
||||
for (i = 0; i <= slen - 2; i += 2) {
|
||||
|
||||
if (s[i].val < 97)
|
||||
snprintf(keystr, 10, "^%c", s[i].val + 64);
|
||||
else
|
||||
snprintf(keystr, 10, "M-%c", s[i].val - 32);
|
||||
|
||||
onekey(keystr, s[i].desc);
|
||||
|
||||
for (j = 0; j < k; j++)
|
||||
@@ -548,13 +622,22 @@ void bottombars(shortcut s[], int slen)
|
||||
|
||||
wmove(bottomwin, 2, 0);
|
||||
for (i = 1; i <= slen - 1; i += 2) {
|
||||
snprintf(keystr, 10, "^%c", s[i].val + 64);
|
||||
|
||||
if (s[i].val < 97)
|
||||
snprintf(keystr, 10, "^%c", s[i].val + 64);
|
||||
else
|
||||
snprintf(keystr, 10, "M-%c", s[i].val - 32);
|
||||
|
||||
onekey(keystr, s[i].desc);
|
||||
|
||||
for (j = 0; j < k; j++)
|
||||
waddch(bottomwin, ' ');
|
||||
}
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_off(bottomwin, COLOR_BOTTOMBARS);
|
||||
#endif
|
||||
|
||||
wrefresh(bottomwin);
|
||||
|
||||
}
|
||||
@@ -572,7 +655,7 @@ void set_modified(void)
|
||||
/* And so start the display update routines */
|
||||
/* Given a column, this returns the "page" it is on */
|
||||
/* "page" in the case of the display columns, means which set of 80 */
|
||||
/* characters is viewable (ie: page 1 shows from 1 to COLS) */
|
||||
/* characters is viewable (e.g.: page 1 shows from 1 to COLS) */
|
||||
inline int get_page_from_virtual(int virtual)
|
||||
{
|
||||
int page = 2;
|
||||
@@ -608,7 +691,7 @@ inline int get_page_end_virtual(int page)
|
||||
/* This takes care of the case where there is a mark that covers only */
|
||||
/* the current line. */
|
||||
|
||||
/* It expects a line with no tab characers (ie: the type that edit_add */
|
||||
/* It expects a line with no tab characters (i.e.: the type that edit_add */
|
||||
/* deals with */
|
||||
void add_marked_sameline(int begin, int end, filestruct * fileptr, int y,
|
||||
int virt_cur_x, int this_page)
|
||||
@@ -616,7 +699,7 @@ void add_marked_sameline(int begin, int end, filestruct * fileptr, int y,
|
||||
/*
|
||||
* The general idea is to break the line up into 3 sections: before
|
||||
* the mark, the mark, and after the mark. We then paint each in
|
||||
* turn (for those that are currently visible, of course
|
||||
* turn (for those that are currently visible, of course)
|
||||
*
|
||||
* 3 start points: 0 -> begin, begin->end, end->strlen(data)
|
||||
* in data : pre sel post
|
||||
@@ -628,7 +711,7 @@ void add_marked_sameline(int begin, int end, filestruct * fileptr, int y,
|
||||
int pre_data_len = begin, sel_data_len = end - begin, post_data_len = 0; /* Determined from the other two */
|
||||
|
||||
/* now fix the start locations & lengths according to the cursor's
|
||||
* position (ie: our page) */
|
||||
* position (i.e.: our page) */
|
||||
if (pre_data_len < this_page_start)
|
||||
pre_data_len = 0;
|
||||
else
|
||||
@@ -652,10 +735,22 @@ void add_marked_sameline(int begin, int end, filestruct * fileptr, int y,
|
||||
|
||||
/* Paint this line! */
|
||||
mvwaddnstr(edit, y, 0, &fileptr->data[this_page_start], pre_data_len);
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_on(edit, COLOR_MARKER);
|
||||
#else
|
||||
wattron(edit, A_REVERSE);
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
mvwaddnstr(edit, y, begin - this_page_start,
|
||||
&fileptr->data[begin], sel_data_len);
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_off(edit, COLOR_MARKER);
|
||||
#else
|
||||
wattroff(edit, A_REVERSE);
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
mvwaddnstr(edit, y, end - this_page_start,
|
||||
&fileptr->data[end], post_data_len);
|
||||
}
|
||||
@@ -670,22 +765,33 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
|
||||
int virt_mark_beginx, int this_page)
|
||||
{
|
||||
#ifndef NANO_SMALL
|
||||
/* There are quite a few cases that could take place, we'll deal
|
||||
/* 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
|
||||
&& fileptr->lineno > current->lineno)
|
||||
|| (fileptr->lineno < mark_beginbuf->lineno
|
||||
&& fileptr->lineno < current->lineno))) {
|
||||
/* If we get here we are on a line that is atleast
|
||||
/* If we get here we are on a line that is at least
|
||||
* partially selected. The lineno checks above determined
|
||||
* that */
|
||||
if (fileptr != mark_beginbuf && fileptr != current) {
|
||||
/* We are on a completely marked line, paint it all
|
||||
* inverse */
|
||||
#ifdef ENABLE_COLOR
|
||||
color_on(edit, COLOR_MARKER);
|
||||
#else
|
||||
wattron(edit, A_REVERSE);
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
mvwaddnstr(edit, yval, 0, fileptr->data, COLS);
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_off(edit, COLOR_MARKER);
|
||||
#else
|
||||
wattroff(edit, A_REVERSE);
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
} else if (fileptr == mark_beginbuf && fileptr == current) {
|
||||
/* Special case, we're still on the same line we started
|
||||
* marking -- so we call our helper function */
|
||||
@@ -700,19 +806,24 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
|
||||
}
|
||||
} else if (fileptr == mark_beginbuf) {
|
||||
/*
|
||||
* we're updating the line that was first marked
|
||||
* We're updating the line that was first marked,
|
||||
* but we're not currently on it. So we want to
|
||||
* figur out which half to invert based on our
|
||||
* figure out which half to invert based on our
|
||||
* relative line numbers.
|
||||
*
|
||||
* i.e. If we're above the "beginbuf" line, we want to
|
||||
* mark the left side. Otherwise we're below, so we
|
||||
* mark the right
|
||||
* I.e. if we're above the "beginbuf" line, we want to
|
||||
* mark the left side. Otherwise, we're below, so we
|
||||
* mark the right.
|
||||
*/
|
||||
int target;
|
||||
|
||||
if (mark_beginbuf->lineno > current->lineno)
|
||||
if (mark_beginbuf->lineno > current->lineno) {
|
||||
#ifdef ENABLE_COLOR
|
||||
color_on(edit, COLOR_MARKER);
|
||||
#else
|
||||
wattron(edit, A_REVERSE);
|
||||
#endif /* ENABLE_COLOR */
|
||||
}
|
||||
|
||||
target =
|
||||
(virt_mark_beginx <
|
||||
@@ -720,10 +831,23 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
|
||||
|
||||
mvwaddnstr(edit, yval, 0, fileptr->data, target);
|
||||
|
||||
if (mark_beginbuf->lineno < current->lineno)
|
||||
if (mark_beginbuf->lineno < current->lineno) {
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_on(edit, COLOR_MARKER);
|
||||
#else
|
||||
wattron(edit, A_REVERSE);
|
||||
else
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
} else {
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_off(edit, COLOR_MARKER);
|
||||
#else
|
||||
wattroff(edit, A_REVERSE);
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
}
|
||||
|
||||
target = (COLS - 1) - virt_mark_beginx;
|
||||
if (target < 0)
|
||||
@@ -732,17 +856,31 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
|
||||
mvwaddnstr(edit, yval, virt_mark_beginx,
|
||||
&fileptr->data[virt_mark_beginx], target);
|
||||
|
||||
if (mark_beginbuf->lineno < current->lineno)
|
||||
if (mark_beginbuf->lineno < current->lineno) {
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_off(edit, COLOR_MARKER);
|
||||
#else
|
||||
wattroff(edit, A_REVERSE);
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
}
|
||||
|
||||
} else if (fileptr == current) {
|
||||
/* we're on the cursors line, but it's not the first
|
||||
/* We're on the cursor's line, but it's not the first
|
||||
* one we marked. Similar to the previous logic. */
|
||||
int this_page_start = get_page_start_virtual(this_page),
|
||||
this_page_end = get_page_end_virtual(this_page);
|
||||
|
||||
if (mark_beginbuf->lineno < current->lineno)
|
||||
if (mark_beginbuf->lineno < current->lineno) {
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_on(edit, COLOR_MARKER);
|
||||
#else
|
||||
wattron(edit, A_REVERSE);
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
}
|
||||
|
||||
if (virt_cur_x > COLS - 2) {
|
||||
mvwaddnstr(edit, yval, 0,
|
||||
@@ -752,10 +890,23 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
|
||||
mvwaddnstr(edit, yval, 0, fileptr->data, virt_cur_x);
|
||||
}
|
||||
|
||||
if (mark_beginbuf->lineno > current->lineno)
|
||||
if (mark_beginbuf->lineno > current->lineno) {
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_on(edit, COLOR_MARKER);
|
||||
#else
|
||||
wattron(edit, A_REVERSE);
|
||||
else
|
||||
#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,
|
||||
@@ -765,8 +916,15 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
|
||||
mvwaddnstr(edit, yval, virt_cur_x,
|
||||
&fileptr->data[virt_cur_x], COLS - virt_cur_x);
|
||||
|
||||
if (mark_beginbuf->lineno > current->lineno)
|
||||
if (mark_beginbuf->lineno > current->lineno) {
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_off(edit, COLOR_MARKER);
|
||||
#else
|
||||
wattroff(edit, A_REVERSE);
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} else
|
||||
@@ -780,7 +938,7 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
|
||||
* Just update one line in the edit buffer. Basically a wrapper for
|
||||
* edit_add
|
||||
*
|
||||
* index gives is a place in the string to update starting from.
|
||||
* index gives us a place in the string to update starting from.
|
||||
* Likely args are current_x or 0.
|
||||
*/
|
||||
void update_line(filestruct * fileptr, int index)
|
||||
@@ -801,12 +959,12 @@ void update_line(filestruct * fileptr, int index)
|
||||
|
||||
mvwaddstr(edit, line, 0, hblank);
|
||||
|
||||
/* Next, convert all the tabs to spaces so everything else is easy */
|
||||
/* Next, convert all the tabs to spaces, so everything else is easy */
|
||||
index = xpt(fileptr, index);
|
||||
|
||||
realdata = fileptr->data;
|
||||
len = strlen(realdata);
|
||||
fileptr->data = nmalloc(xpt(fileptr, len) + 1);
|
||||
fileptr->data = charalloc(xpt(fileptr, len) + 1);
|
||||
|
||||
pos = 0;
|
||||
for (i = 0; i < len; i++) {
|
||||
@@ -837,7 +995,7 @@ void update_line(filestruct * fileptr, int index)
|
||||
/* Now, Paint the line */
|
||||
if (current == fileptr && index > COLS - 2) {
|
||||
/* This handles when the current line is beyond COLS */
|
||||
/* It requires figureing out what page we're at */
|
||||
/* It requires figuring out what page we're on */
|
||||
page = get_page_from_virtual(index);
|
||||
col = get_page_start_virtual(page);
|
||||
|
||||
@@ -908,7 +1066,7 @@ void edit_refresh(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* Same as above, but touch the window first so everything is redrawn.
|
||||
* Same as above, but touch the window first, so everything is redrawn.
|
||||
*/
|
||||
void edit_refresh_clearok(void)
|
||||
{
|
||||
@@ -918,10 +1076,10 @@ void edit_refresh_clearok(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* Nice generic routine to update the edit buffer given a pointer to the
|
||||
* Nice generic routine to update the edit buffer, given a pointer to the
|
||||
* file struct =)
|
||||
*/
|
||||
void edit_update(filestruct * fileptr, int topmidbot)
|
||||
void edit_update(filestruct * fileptr, int topmidbotnone)
|
||||
{
|
||||
int i = 0;
|
||||
filestruct *temp;
|
||||
@@ -930,8 +1088,11 @@ void edit_update(filestruct * fileptr, int topmidbot)
|
||||
return;
|
||||
|
||||
temp = fileptr;
|
||||
if (topmidbot == 2);
|
||||
else if (topmidbot == 0)
|
||||
if (topmidbotnone == TOP);
|
||||
else if (topmidbotnone == NONE)
|
||||
for (i = 0; i <= current_y - 1 && temp->prev != NULL; i++)
|
||||
temp = temp->prev;
|
||||
else if (topmidbotnone == BOTTOM)
|
||||
for (i = 0; i <= editwinrows - 1 && temp->prev != NULL; i++)
|
||||
temp = temp->prev;
|
||||
else
|
||||
@@ -944,7 +1105,7 @@ void edit_update(filestruct * fileptr, int topmidbot)
|
||||
edit_refresh();
|
||||
}
|
||||
|
||||
/* This function updates current based on where current_y is, reset_cursor
|
||||
/* This function updates current, based on where current_y is; reset_cursor
|
||||
does the opposite */
|
||||
void update_cursor(void)
|
||||
{
|
||||
@@ -970,7 +1131,7 @@ void update_cursor(void)
|
||||
/*
|
||||
* Ask a question on the statusbar. Answer will be stored in answer
|
||||
* global. Returns -1 on aborted enter, -2 on a blank string, and 0
|
||||
* otherwise, the valid shortcut key caught, Def is any editable text we
|
||||
* otherwise, the valid shortcut key caught. Def is any editable text we
|
||||
* want to put up by default.
|
||||
*
|
||||
* New arg tabs tells whether or not to allow tab completion.
|
||||
@@ -988,9 +1149,21 @@ int statusq(int tabs, shortcut s[], int slen, char *def, char *msg, ...)
|
||||
va_end(ap);
|
||||
strncat(foo, ": ", 132);
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_on(bottomwin, COLOR_STATUSBAR);
|
||||
#else
|
||||
wattron(bottomwin, A_REVERSE);
|
||||
#endif
|
||||
|
||||
|
||||
ret = nanogetstr(tabs, foo, def, s, slen, (strlen(foo) + 3));
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_off(bottomwin, COLOR_STATUSBAR);
|
||||
#else
|
||||
wattroff(bottomwin, A_REVERSE);
|
||||
#endif
|
||||
|
||||
|
||||
switch (ret) {
|
||||
|
||||
@@ -1021,30 +1194,70 @@ int do_yesno(int all, int leavecursor, char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char foo[133];
|
||||
int kbinput, ok = -1;
|
||||
int kbinput, ok = -1, i;
|
||||
char *yesstr; /* String of yes characters accepted */
|
||||
char *nostr; /* Same for no */
|
||||
char *allstr; /* And all, surprise! */
|
||||
char shortstr[5]; /* Temp string for above */
|
||||
#ifndef DISABLE_MOUSE
|
||||
#ifdef NCURSES_MOUSE_VERSION
|
||||
MEVENT mevent;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Yes, no and all are strings of any length. Each string consists of
|
||||
all characters accepted as a valid character for that value.
|
||||
The first value will be the one displayed in the shortcuts. */
|
||||
yesstr = _("Yy");
|
||||
nostr = _("Nn");
|
||||
allstr = _("Aa");
|
||||
|
||||
/* Write the bottom of the screen */
|
||||
clear_bottomwin();
|
||||
wattron(bottomwin, A_REVERSE);
|
||||
blank_statusbar_refresh();
|
||||
wattroff(bottomwin, A_REVERSE);
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_on(bottomwin, COLOR_BOTTOMBARS);
|
||||
#endif
|
||||
|
||||
/* Remove gettext call for keybindings until we clear the thing up */
|
||||
if (!ISSET(NO_HELP)) {
|
||||
wmove(bottomwin, 1, 0);
|
||||
onekey(" Y", _("Yes"));
|
||||
if (all)
|
||||
onekey(" A", _("All"));
|
||||
|
||||
snprintf(shortstr, 3, " %c", yesstr[0]);
|
||||
onekey(shortstr, _("Yes"));
|
||||
|
||||
if (all) {
|
||||
snprintf(shortstr, 3, " %c", allstr[0]);
|
||||
onekey(shortstr, _("All"));
|
||||
}
|
||||
wmove(bottomwin, 2, 0);
|
||||
onekey(" N", _("No"));
|
||||
|
||||
snprintf(shortstr, 3, " %c", nostr[0]);
|
||||
onekey(shortstr, _("No"));
|
||||
|
||||
onekey("^C", _("Cancel"));
|
||||
}
|
||||
va_start(ap, msg);
|
||||
vsnprintf(foo, 132, msg, ap);
|
||||
va_end(ap);
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_off(bottomwin, COLOR_BOTTOMBARS);
|
||||
color_on(bottomwin, COLOR_STATUSBAR);
|
||||
#else
|
||||
wattron(bottomwin, A_REVERSE);
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
blank_statusbar();
|
||||
mvwaddstr(bottomwin, 0, 0, foo);
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_off(bottomwin, COLOR_STATUSBAR);
|
||||
#else
|
||||
wattroff(bottomwin, A_REVERSE);
|
||||
#endif
|
||||
|
||||
wrefresh(bottomwin);
|
||||
|
||||
if (leavecursor == 1)
|
||||
@@ -1054,22 +1267,67 @@ int do_yesno(int all, int leavecursor, char *msg, ...)
|
||||
kbinput = wgetch(edit);
|
||||
|
||||
switch (kbinput) {
|
||||
case 'Y':
|
||||
case 'y':
|
||||
ok = 1;
|
||||
break;
|
||||
case 'N':
|
||||
case 'n':
|
||||
ok = 0;
|
||||
break;
|
||||
case 'A':
|
||||
case 'a':
|
||||
if (all)
|
||||
ok = 2;
|
||||
#ifndef DISABLE_MOUSE
|
||||
#ifdef NCURSES_MOUSE_VERSION
|
||||
case KEY_MOUSE:
|
||||
|
||||
/* Look ma! We get to duplicate lots of code from do_mouse!! */
|
||||
if (getmouse(&mevent) == ERR)
|
||||
break;
|
||||
if (!wenclose(bottomwin, mevent.y, mevent.x) || ISSET(NO_HELP))
|
||||
break;
|
||||
mevent.y -= editwinrows + 3;
|
||||
if (mevent.y < 0)
|
||||
break;
|
||||
else {
|
||||
|
||||
/* Rather than a bunch of if statements, set up a matrix
|
||||
of possible return keystrokes based on the x and y values */
|
||||
if (all) {
|
||||
char yesnosquare[2][2] = {
|
||||
{yesstr[0], allstr[0]},
|
||||
{nostr[0], NANO_CONTROL_C }};
|
||||
|
||||
ungetch(yesnosquare[mevent.y][mevent.x/(COLS/6)]);
|
||||
} else {
|
||||
char yesnosquare[2][2] = {
|
||||
{yesstr[0], '\0'},
|
||||
{nostr[0], NANO_CONTROL_C }};
|
||||
|
||||
ungetch(yesnosquare[mevent.y][mevent.x/(COLS/6)]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
case NANO_CONTROL_C:
|
||||
ok = -2;
|
||||
break;
|
||||
default:
|
||||
|
||||
/* Look for the kbinput in the yes, no and (optimally) all str */
|
||||
for (i = 0; yesstr[i] != 0 && yesstr[i] != kbinput; i++)
|
||||
;
|
||||
if (yesstr[i] != 0) {
|
||||
ok = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
for (i = 0; nostr[i] != 0 && nostr[i] != kbinput; i++)
|
||||
;
|
||||
if (nostr[i] != 0) {
|
||||
ok = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (all) {
|
||||
for (i = 0; allstr[i] != 0 && allstr[i] != kbinput; i++)
|
||||
;
|
||||
if (allstr[i] != 0) {
|
||||
ok = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1099,12 +1357,22 @@ void statusbar(char *msg, ...)
|
||||
|
||||
wmove(bottomwin, 0, start_x);
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_on(bottomwin, COLOR_STATUSBAR);
|
||||
#else
|
||||
wattron(bottomwin, A_REVERSE);
|
||||
#endif
|
||||
|
||||
waddstr(bottomwin, "[ ");
|
||||
waddstr(bottomwin, foo);
|
||||
waddstr(bottomwin, " ]");
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
color_off(bottomwin, COLOR_STATUSBAR);
|
||||
#else
|
||||
wattroff(bottomwin, A_REVERSE);
|
||||
#endif
|
||||
|
||||
wrefresh(bottomwin);
|
||||
|
||||
if (ISSET(CONSTUPDATE))
|
||||
@@ -1177,23 +1445,29 @@ int do_cursorpos(void)
|
||||
}
|
||||
|
||||
/* Our broken, non-shortcut list compliant help function.
|
||||
But hey, it's better than nothing, and it's dynamic! */
|
||||
But, hey, it's better than nothing, and it's dynamic! */
|
||||
int do_help(void)
|
||||
{
|
||||
#ifndef DISABLE_HELP
|
||||
char *ptr = help_text, *end;
|
||||
int i, j, row = 0, page = 1, kbinput = 0, no_more = 0, kp;
|
||||
int i, j, row = 0, page = 1, kbinput = 0, no_more = 0, kp, kp2;
|
||||
int no_help_flag = 0;
|
||||
|
||||
blank_edit();
|
||||
curs_set(0);
|
||||
blank_statusbar();
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
currshortcut = help_list;
|
||||
currslen = HELP_LIST_LEN;
|
||||
#endif
|
||||
|
||||
kp = keypad_on(edit, 1);
|
||||
kp2 = keypad_on(bottomwin, 1);
|
||||
|
||||
if (ISSET(NO_HELP)) {
|
||||
|
||||
/* Well if we're going to do this, we should at least
|
||||
/* Well, if we're going to do this, we should at least
|
||||
do it the right way */
|
||||
no_help_flag = 1;
|
||||
UNSET(NO_HELP);
|
||||
@@ -1206,6 +1480,13 @@ int do_help(void)
|
||||
do {
|
||||
ptr = help_text;
|
||||
switch (kbinput) {
|
||||
#ifndef DISABLE_MOUSE
|
||||
#ifdef NCURSES_MOUSE_VERSION
|
||||
case KEY_MOUSE:
|
||||
do_mouse();
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
case NANO_NEXTPAGE_KEY:
|
||||
case NANO_NEXTPAGE_FKEY:
|
||||
case KEY_NPAGE:
|
||||
@@ -1225,7 +1506,7 @@ int do_help(void)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Calculate where in the text we should be based on the page */
|
||||
/* Calculate where in the text we should be, based on the page */
|
||||
for (i = 1; i < page; i++) {
|
||||
row = 0;
|
||||
j = 0;
|
||||
@@ -1254,7 +1535,7 @@ int do_help(void)
|
||||
}
|
||||
if (j == COLS - 5) {
|
||||
|
||||
/* Don't print half a word if we've run of of space */
|
||||
/* Don't print half a word if we've run out of space */
|
||||
while (*end != ' ' && *end != '\0') {
|
||||
end--;
|
||||
j--;
|
||||
@@ -1285,6 +1566,7 @@ int do_help(void)
|
||||
curs_set(1);
|
||||
edit_refresh();
|
||||
kp = keypad_on(edit, kp);
|
||||
kp2 = keypad_on(bottomwin, kp2);
|
||||
|
||||
#elif defined(DISABLE_HELP)
|
||||
nano_disabled_msg();
|
||||
@@ -1329,7 +1611,7 @@ void dump_buffer_reverse(filestruct * inptr)
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
|
||||
/* Fix editbot based on the assumption that edittop is correct */
|
||||
/* Fix editbot, based on the assumption that edittop is correct */
|
||||
void fix_editbot(void)
|
||||
{
|
||||
int i;
|
||||
@@ -1347,7 +1629,7 @@ void do_replace_highlight(int highlight_flag, char *word)
|
||||
highlight_word = mallocstrcpy(highlight_word, ¤t->data[current_x]);
|
||||
highlight_word[strlen(word)] = '\0';
|
||||
|
||||
/* adjust output when word extends beyond screen*/
|
||||
/* adjust output when word extends beyond screen */
|
||||
|
||||
x = xplustabs();
|
||||
y = get_page_end_virtual(get_page_from_virtual(x)) + 1;
|
||||
@@ -1373,7 +1655,7 @@ void do_replace_highlight(int highlight_flag, char *word)
|
||||
}
|
||||
|
||||
#ifdef NANO_EXTRA
|
||||
#define CREDIT_LEN 45
|
||||
#define CREDIT_LEN 47
|
||||
void do_credits(void)
|
||||
{
|
||||
int i, j = 0, k, place = 0, start_x;
|
||||
@@ -1410,6 +1692,8 @@ void do_credits(void)
|
||||
"Erik Andersen",
|
||||
"Big Gaute",
|
||||
"Joshua Jensen",
|
||||
"Ryan Krebs",
|
||||
"Albert Chin",
|
||||
"",
|
||||
specialthx,
|
||||
"Plattsburgh State University",
|
||||
@@ -1471,18 +1755,18 @@ void do_credits(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
int keypad_on(WINDOW * win, int new)
|
||||
int keypad_on(WINDOW * win, int newval)
|
||||
{
|
||||
|
||||
/* This is taken right from aumix. Don't sue me */
|
||||
/* This is taken right from aumix. Don't sue me. */
|
||||
#ifdef HAVE_USEKEYPAD
|
||||
int old;
|
||||
|
||||
old = win->_use_keypad;
|
||||
keypad(win, new);
|
||||
keypad(win, newval);
|
||||
return old;
|
||||
#else
|
||||
keypad(win, new);
|
||||
keypad(win, newval);
|
||||
return 1;
|
||||
#endif /* HAVE_USEKEYPAD */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user