Commit a2ea193b authored by Chris Allegretta's avatar Chris Allegretta
Browse files

Initial revision

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
parents
Showing with 2923 additions and 0 deletions
+2923 -0
Notes on the Free Translation Project
*************************************
Free software is going international! The Free Translation Project
is a way to get maintainers of free software, translators, and users all
together, so that will gradually become able to speak many languages.
A few packages already provide translations for their messages.
If you found this `ABOUT-NLS' file inside a distribution, you may
assume that the distributed package does use GNU `gettext' internally,
itself available at your nearest GNU archive site. But you do *not*
need to install GNU `gettext' prior to configuring, installing or using
this package with messages translated.
Installers will find here some useful hints. These notes also
explain how users should proceed for getting the programs to use the
available translations. They tell how people wanting to contribute and
work at translations should contact the appropriate team.
When reporting bugs in the `intl/' directory or bugs which may be
related to internationalization, you should tell about the version of
`gettext' which is used. The information can be found in the
`intl/VERSION' file, in internationalized packages.
One advise in advance
=====================
If you want to exploit the full power of internationalization, you
should configure it using
./configure --with-included-gettext
to force usage of internationalizing routines provided within this
package, despite the existence of internationalizing capabilities in the
operating system where this package is being installed. So far, only
the `gettext' implementation in the GNU C library version 2 provides as
many features (such as locale alias or message inheritance) as the
implementation here. It is also not possible to offer this additional
functionality on top of a `catgets' implementation. Future versions of
GNU `gettext' will very likely convey even more functionality. So it
might be a good idea to change to GNU `gettext' as soon as possible.
So you need not provide this option if you are using GNU libc 2 or
you have installed a recent copy of the GNU gettext package with the
included `libintl'.
INSTALL Matters
===============
Some packages are "localizable" when properly installed; the
programs they contain can be made to speak your own native language.
Most such packages use GNU `gettext'. Other packages have their own
ways to internationalization, predating GNU `gettext'.
By default, this package will be installed to allow translation of
messages. It will automatically detect whether the system provides
usable `catgets' (if using this is selected by the installer) or
`gettext' functions. If neither is available, the GNU `gettext' own
library will be used. This library is wholly contained within this
package, usually in the `intl/' subdirectory, so prior installation of
the GNU `gettext' package is *not* required. Installers may use
special options at configuration time for changing the default
behaviour. The commands:
./configure --with-included-gettext
./configure --with-catgets
./configure --disable-nls
will respectively bypass any pre-existing `catgets' or `gettext' to use
the internationalizing routines provided within this package, enable
the use of the `catgets' functions (if found on the locale system), or
else, *totally* disable translation of messages.
When you already have GNU `gettext' installed on your system and run
configure without an option for your new package, `configure' will
probably detect the previously built and installed `libintl.a' file and
will decide to use this. This might be not what is desirable. You
should use the more recent version of the GNU `gettext' library. I.e.
if the file `intl/VERSION' shows that the library which comes with this
package is more recent, you should use
./configure --with-included-gettext
to prevent auto-detection.
By default the configuration process will not test for the `catgets'
function and therefore they will not be used. The reasons are already
given above: the emulation on top of `catgets' cannot provide all the
extensions provided by the GNU `gettext' library. If you nevertheless
want to use the `catgets' functions use
./configure --with-catgets
to enable the test for `catgets' (this causes no harm if `catgets' is
not available on your system). If you really select this option we
would like to hear about the reasons because we cannot think of any
good one ourself.
Internationalized packages have usually many `po/LL.po' files, where
LL gives an ISO 639 two-letter code identifying the language. Unless
translations have been forbidden at `configure' time by using the
`--disable-nls' switch, all available translations are installed
together with the package. However, the environment variable `LINGUAS'
may be set, prior to configuration, to limit the installed set.
`LINGUAS' should then contain a space separated list of two-letter
codes, stating which languages are allowed.
Using This Package
==================
As a user, if your language has been installed for this package, you
only have to set the `LANG' environment variable to the appropriate
ISO 639 `LL' two-letter code prior to using the programs in the
package. For example, let's suppose that you speak German. At the
shell prompt, merely execute `setenv LANG de' (in `csh'),
`export LANG; LANG=de' (in `sh') or `export LANG=de' (in `bash'). This
can be done from your `.login' or `.profile' file, once and for all.
An operating system might already offer message localization for
many of its programs, while other programs have been installed locally
with the full capabilities of GNU `gettext'. Just using `gettext'
extended syntax for `LANG' would break proper localization of already
available operating system programs. In this case, users should set
both `LANGUAGE' and `LANG' variables in their environment, as programs
using GNU `gettext' give preference to `LANGUAGE'. For example, some
Swedish users would rather read translations in German than English for
when Swedish is not available. This is easily accomplished by setting
`LANGUAGE' to `sv:de' while leaving `LANG' to `sv'.
Translating Teams
=================
For the Free Translation Project to be a success, we need interested
people who like their own language and write it well, and who are also
able to synergize with other translators speaking the same language.
Each translation team has its own mailing list, courtesy of Linux
International. You may reach your translation team at the address
`LL@li.org', replacing LL by the two-letter ISO 639 code for your
language. Language codes are *not* the same as the country codes given
in ISO 3166. The following translation teams exist, as of December
1997:
Chinese `zh', Czech `cs', Danish `da', Dutch `nl', English `en',
Esperanto `eo', Finnish `fi', French `fr', German `de', Hungarian
`hu', Irish `ga', Italian `it', Indonesian `id', Japanese `ja',
Korean `ko', Latin `la', Norwegian `no', Persian `fa', Polish
`pl', Portuguese `pt', Russian `ru', Slovenian `sl', Spanish `es',
Swedish `sv', and Turkish `tr'.
For example, you may reach the Chinese translation team by writing to
`zh@li.org'.
If you'd like to volunteer to *work* at translating messages, you
should become a member of the translating team for your own language.
The subscribing address is *not* the same as the list itself, it has
`-request' appended. For example, speakers of Swedish can send a
message to `sv-request@li.org', having this message body:
subscribe
Keep in mind that team members are expected to participate
*actively* in translations, or at solving translational difficulties,
rather than merely lurking around. If your team does not exist yet and
you want to start one, or if you are unsure about what to do or how to
get started, please write to `translation@iro.umontreal.ca' to reach the
coordinator for all translator teams.
The English team is special. It works at improving and uniformizing
the terminology in use. Proven linguistic skill are praised more than
programming skill, here.
Available Packages
==================
Languages are not equally supported in all packages. The following
matrix shows the current state of internationalization, as of December
1997. The matrix shows, in regard of each package, for which languages
PO files have been submitted to translation coordination.
Ready PO files cs da de en es fi fr it ja ko nl no pl pt ru sl sv
.----------------------------------------------------.
bash | [] [] [] | 3
bison | [] [] [] | 3
clisp | [] [] [] [] | 4
cpio | [] [] [] [] [] [] | 6
diffutils | [] [] [] [] [] | 5
enscript | [] [] [] [] [] [] | 6
fileutils | [] [] [] [] [] [] [] [] [] [] | 10
findutils | [] [] [] [] [] [] [] [] [] | 9
flex | [] [] [] [] | 4
gcal | [] [] [] [] [] | 5
gettext | [] [] [] [] [] [] [] [] [] [] [] | 12
grep | [] [] [] [] [] [] [] [] [] [] | 10
hello | [] [] [] [] [] [] [] [] [] [] [] | 11
id-utils | [] [] [] | 3
indent | [] [] [] [] [] | 5
libc | [] [] [] [] [] [] [] | 7
m4 | [] [] [] [] [] [] | 6
make | [] [] [] [] [] [] | 6
music | [] [] | 2
ptx | [] [] [] [] [] [] [] [] | 8
recode | [] [] [] [] [] [] [] [] [] | 9
sh-utils | [] [] [] [] [] [] [] [] | 8
sharutils | [] [] [] [] [] [] | 6
tar | [] [] [] [] [] [] [] [] [] [] [] | 11
texinfo | [] [] [] | 3
textutils | [] [] [] [] [] [] [] [] [] | 9
wdiff | [] [] [] [] [] [] [] [] | 8
`----------------------------------------------------'
17 languages cs da de en es fi fr it ja ko nl no pl pt ru sl sv
27 packages 6 4 25 1 18 1 26 2 1 12 20 9 19 7 4 7 17 179
Some counters in the preceding matrix are higher than the number of
visible blocks let us expect. This is because a few extra PO files are
used for implementing regional variants of languages, or language
dialects.
For a PO file in the matrix above to be effective, the package to
which it applies should also have been internationalized and
distributed as such by its maintainer. There might be an observable
lag between the mere existence a PO file and its wide availability in a
distribution.
If December 1997 seems to be old, you may fetch a more recent copy
of this `ABOUT-NLS' file on most GNU archive sites.
This file lists people who have made significant contribution to the nano
editor. Please see the ChangeLog for specific changes by author.
-------------------------------------------------------------------------
Chris Allegretta <chrisa@asty.org>
* Main program author and maintainer
Jordi Mallach <jordi@sindominio.net>
* Debian package maintainer, fellow bug squasher.
* Internationalization support head, es.po maintainer.
Adam Rogoyski <rogoyski@cs.utexas.edu>
* New write_file() function, read_file() optimization, mouse
support, resize support, nohelp (-x) option, justify function,
follow symlink option and bugfixes, and much more.
- Marked cutting sometimes leaves a newline in the file unintelligently,
such as when all of a line is selected but the mark doesn't proceed to
the new line. (8)
{ I know I posted this, but is it really a bug, Pico 3.5 seems to behave
in the same way. I must be scatterbrained or something.
- Rob Siemborski }
- Certains are not lined up properly when there are tabs in them at
certain col values. (9) [FIXED]
- edit_refresh() and update_line() do not handle selecting text when the
cursor is beyond COLS (10)
- no way to do a replace with the empty string. (11)
- Spelling support is not elegant like pico's integration of the 'spell'
program. Nano only uses ispell (for now) (12)
- 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
(14) [FIXED, mostly]
- Doing a replacement of a substring of the replace string (e.g. replacing
"ed" with "fred" causes an infinite loop. (15) [FIXED]
- Cutting a file with marked text and both marker ends on the same line
causes a random segfault (16)
- 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:
* *
Error is in do_wrap, must be rewritten (18).
- Wrapping a line with autoindent mode sometimes causes a segfault (19).
- 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]
- When inserting files, the display sometimes fails to display properly
until a pageup/down occurs (22).
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
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 of the License, 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
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
This diff is collapsed.
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.
bin_PROGRAMS = nano
nano_SOURCES = cut.c \
global.c \
nano.c \
nano.h \
proto.h \
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
SUBDIRS = po intl
localedir = $(datadir)/locale
INCLUDES = -Iintl -DLOCALEDIR=\"$(localedir)\" -I@includedir@
# Makefile.in generated automatically by automake 1.4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
CURSES_LIB = @CURSES_LIB@
DATADIRNAME = @DATADIRNAME@
GENCAT = @GENCAT@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_CONFIG = @GLIB_CONFIG@
GLIB_LIBS = @GLIB_LIBS@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GT_NO = @GT_NO@
GT_YES = @GT_YES@
INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
INSTOBJEXT = @INSTOBJEXT@
INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
PACKAGE = @PACKAGE@
POFILES = @POFILES@
POSUB = @POSUB@
RANLIB = @RANLIB@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
l = @l@
bin_PROGRAMS = nano
nano_SOURCES = cut.c global.c nano.c nano.h proto.h 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
SUBDIRS = po intl
localedir = $(datadir)/locale
INCLUDES = -Iintl -DLOCALEDIR=\"$(localedir)\" -I@includedir@
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
PROGRAMS = $(bin_PROGRAMS)
DEFS = @DEFS@ -I. -I$(srcdir) -I.
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
nano_OBJECTS = cut.o global.o nano.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 $@
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
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
SOURCES = $(nano_SOURCES)
OBJECTS = $(nano_OBJECTS)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .S .c .o .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
$(ACLOCAL_M4): configure.in
cd $(srcdir) && $(ACLOCAL)
config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
cd $(srcdir) && $(AUTOCONF)
config.h: stamp-h
@if test ! -f $@; then \
rm -f stamp-h; \
$(MAKE) stamp-h; \
else :; fi
stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES= CONFIG_HEADERS=config.h:config.h.in \
$(SHELL) ./config.status
@echo timestamp > stamp-h 2> /dev/null
$(srcdir)/config.h.in: $(srcdir)/stamp-h.in
@if test ! -f $@; then \
rm -f $(srcdir)/stamp-h.in; \
$(MAKE) $(srcdir)/stamp-h.in; \
else :; fi
$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
cd $(top_srcdir) && $(AUTOHEADER)
@echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null
mostlyclean-hdr:
clean-hdr:
distclean-hdr:
-rm -f config.h
maintainer-clean-hdr:
mostlyclean-binPROGRAMS:
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
distclean-binPROGRAMS:
maintainer-clean-binPROGRAMS:
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(bindir)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
list='$(bin_PROGRAMS)'; for p in $$list; do \
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
done
.c.o:
$(COMPILE) -c $<
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
mostlyclean-compile:
-rm -f *.o core *.core
clean-compile:
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
nano: $(nano_OBJECTS) $(nano_DEPENDENCIES)
@rm -f nano
$(LINK) $(nano_LDFLAGS) $(nano_OBJECTS) $(nano_LDADD) $(LIBS)
install-man1:
$(mkinstalldirs) $(DESTDIR)$(man1dir)
@list='$(man1_MANS)'; \
l2='$(man_MANS)'; for i in $$l2; do \
case "$$i" in \
*.1*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
else file=$$i; fi; \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \
$(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \
done
uninstall-man1:
@list='$(man1_MANS)'; \
l2='$(man_MANS)'; for i in $$l2; do \
case "$$i" in \
*.1*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \
rm -f $(DESTDIR)$(man1dir)/$$inst; \
done
install-man: $(MANS)
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-man1
uninstall-man:
@$(NORMAL_UNINSTALL)
$(MAKE) $(AM_MAKEFLAGS) uninstall-man1
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
@SET_MAKE@
all-recursive install-data-recursive install-exec-recursive \
installdirs-recursive install-recursive uninstall-recursive \
check-recursive installcheck-recursive info-recursive dvi-recursive:
@set fnord $(MAKEFLAGS); amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@set fnord $(MAKEFLAGS); amf=$$2; \
dot_seen=no; \
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
rev="$$subdir $$rev"; \
test "$$subdir" = "." && dot_seen=yes; \
done; \
test "$$dot_seen" = "no" && rev=". $$rev"; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
-rm -rf $(distdir)
GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
mkdir $(distdir)/=build
mkdir $(distdir)/=inst
dc_install_base=`cd $(distdir)/=inst && pwd`; \
cd $(distdir)/=build \
&& ../configure --with-included-gettext --srcdir=.. --prefix=$$dc_install_base \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) dist
-rm -rf $(distdir)
@banner="$(distdir).tar.gz is ready for distribution"; \
dashes=`echo "$$banner" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
echo "$$dashes"
dist: distdir
-chmod -R a+r $(distdir)
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
-rm -rf $(distdir)
dist-all: distdir
-chmod -R a+r $(distdir)
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
-rm -rf $(distdir)
distdir: $(DISTFILES)
-rm -rf $(distdir)
mkdir $(distdir)
-chmod 777 $(distdir)
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
for subdir in $(SUBDIRS); do \
if test "$$subdir" = .; then :; else \
test -d $(distdir)/$$subdir \
|| mkdir $(distdir)/$$subdir \
|| exit 1; \
chmod 777 $(distdir)/$$subdir; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
|| exit 1; \
fi; \
done
info-am:
info: info-recursive
dvi-am:
dvi: dvi-recursive
check-am: all-am
check: check-recursive
installcheck-am:
installcheck: installcheck-recursive
all-recursive-am: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
install-exec-am: install-binPROGRAMS
install-exec: install-exec-recursive
install-data-am: install-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: uninstall-recursive
all-am: Makefile $(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
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-hdr mostlyclean-binPROGRAMS \
mostlyclean-compile mostlyclean-tags \
mostlyclean-generic
mostlyclean: mostlyclean-recursive
clean-am: clean-hdr clean-binPROGRAMS clean-compile clean-tags \
clean-generic mostlyclean-am
clean: clean-recursive
distclean-am: distclean-hdr distclean-binPROGRAMS distclean-compile \
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
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-recursive
-rm -f config.status
.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile install-man1 uninstall-man1 install-man \
uninstall-man install-data-recursive uninstall-data-recursive \
install-exec-recursive uninstall-exec-recursive installdirs-recursive \
uninstalldirs-recursive all-recursive check-recursive \
installcheck-recursive info-recursive dvi-recursive \
mostlyclean-recursive distclean-recursive clean-recursive \
maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
dvi-am dvi check check-am installcheck-am installcheck all-recursive-am \
install-exec-am install-exec install-data-am install-data install-am \
install uninstall-am uninstall all-redirect all-am all installdirs-am \
installdirs mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
05/31/2000 - Nano 0.9.9 introduces much better working i18n support,
more portability, and a ton of bugfixes. While
nano is not likely anywhere near 1.0 in terms of
code quality, it gets a quantum leap closer with this
release.
05/18/2000 - Nano 0.9.8 (the 'what broke now?' release) should fix
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
are also the obligatory display fixes and speedups. Have
fun with it.
05/14/2000 - Nano 0.9.7 (the Mother's Day release) continues in the long
line of display fixes, and also fixes the broken symlink
behavior (i.e. symlinks weren't being followed by
default). Hopefully all major bugs can be worked out soon
and we can have a 1.0 release before the end of the year,
but who knows.
05/08/2000 - Nano 0.9.6 cleans up a lot of the display bugs that 0.9.5
uncovered. There are improvements (and some remaining
segfaults) in the wrapping code, and even more
display optimizations. I would still say 0.9.4 or 0.9.2
are the most stable versions of nano to date, but this one
may not be too bad =-)
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
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
the most stable version recently, so use that if you're
not particularly concerned with being on the bleeding
edge.
04/25/2000 - Nano 0.9.4 fixes some problems in 0.9.3 with the last
line code and related segfaults. It also now has
much better handling for 8-bit characters. The
--enable-tiny code also produces a smaller executable.
04/19/2000 - Nano 0.9.3 is officially the "Micro$oft" release. It
underscores the recent problem of bugfixes introducing
more bugs than they fix. The most important change
to this version of nano is the removal of the "magic
line". You will no longer see a blank line at the end of
the file. If you want a new line at the end of your file,
you'll have to hit enter to get one.
NOTE: THIS BREAKS COMPATIBILITY WITH PICO. Unfortunately,
this feature has been causing many many problems with nano
so it is being removed for the time being, and perhaps
indefinitely.
Other new stuff includes a --emable-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.
04/15/2000 - Nano 0.9.2 just fixes the serious segfault problem if
nano is invoked any way other than using the absolute
path. The bug was in the new code for checking whether
nano is invoked as pico.
04/14/2000 - 0.9.1 has some more Pico compatibility built-in. The
option to switch to/from Search and Search/Replace
(^T) is now available, and nano now displays the
more Pico-like shortcut list when invoked as 'pico'
(i.e. if pico is a symlink to nano). There is an
important change to the handling of symbolic links
as well. Now, nano does the "correct" thing and
automatically writes to the object of the symlink,
rather than replace the symlink with the updated file.
This behavior is still available with the --nofollow
or -l flags.
Other new things include a fix for the infamous
"recursive replace" bug, and more bugfixes in the wrapping
code.
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,
as there was a stupid mistake in the update_line
call. Silly me =)
03/22/2000 - Nano 0.8.9 is basically just a bugfix release of 0.8.8
to reflect the current stagnant status of the project.
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
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.
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
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
this version, and it's likely I didn't even apply the i18n
stuff properly, so *it* may not even work.
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
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
yours to take care of and keep up to date.
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
fixes some other wrapping problems, so here you go.
There may be another relase 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
of a page has ceased, thankfully. I'm also moving next
weekend, so don't be shocked if you don't see a new
version of nano next week =-)
02/11/2000 - Okay, here we go again. Aside from a few minor fixes and
some under-the-hood changes, you won't notice much
different in this version of nano. I haven't gotten much
feedback on the help feature, is it simply amazing or does
no one care? Write and let me know! =)
02/08/2000 - Nano 0.8.3 marks the first time in a long time that there has
been more than three days since the last release. New
features include an initial help mode (YAY!), hopefully
much more support for i18n out of the box, and a flag
for more Pico compatibility in the shortcut lists
displayed. This release also marks the new nano
distribution site, http://www.asty.org/nano and email
address nano@asty.org for bugs, etc.
02/02/2000 - Okay, I hate to go back on what I said in the last release,
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,
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
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
hesitate to send bug reports, as long as you're sure the
fault lies with nano =-).
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
his patches. I removed the broken do_spell behavior with
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
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
can specify another spelling program with -s or --speller.
01/17/00 - Nano 0.7.7 is officially the 'way too much stuff changed this
release' release. It's the busy time at work for me, so
please don't get offended if your patch doesn't get
included in the next immediate version of nano. I'm sure
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),
new -x and -c flags (see nano -h for help), long command
line flag support, and the usual array of bugfixes.
01/15/00 - Nano 0.7.6 is officially the 'lightning' release. It now loads
large files much faster than previous versions, and is
even much faster than Pico or vi in some rather
rudimentary tests. Many thanks to Adam Rogoyski for the
read_byte patch!
01/09/00 - As of this version (0.7.4), TIP has officially been renamed
to nano. The new homepage is at
http://faculty.plattsburgh.edu/astyanax/nano. Please
update your bookmarks, tell your friends, and all that
jazz.
The nano editor (Nano's ANOther editor) by Chris Allegretta
Manifesto
Nano is the editor formerly known as TIP (TIP Isn't Pico).
The nano project was started because of three main problems with the
wonderfully easy-to-use and friendly Pico text editor:
- It's license is not the GNU GPL, and hence some Linux
distributions, including Debian (my favorite) don't always
include it/don't include binaries. This is not necessarily a
problem, but an issue nonetheless.
- Until recently, it had no ability to go to a line # from within
the editor. There was the +number command line option, but who wants
to exit a file to go to a specific line number? When I want to go to
a line, since I have to exit anyway, I just call up vi temporarily.
- No search and replace feature. Well, apparently there is a flag
that lets you do a search and replace (-b in newer versions) but,
well, I still dont like it.
nano aims to solve these problems by emulating the functionality of
Pico as closely as possible while adressing the problems above and
perhaps providing other extra functionality.
How to compile and install nano
Download the nano source code, then:
tar zxvf nano-x.y.z.tar.gz
cd nano-x.y.z
./configure
make
make install
It's that simple. Use --prefix to override the default installation
directory of /usr/local.
Web Page
http://www.asty.org/nano
Mailing List and Bug Reports
SourceForge hosts all the nano-related mailing-lists.
+ nano-announce@lists.sourceforge.net is a very low traffic list
used to announce new Nano versions or other important information
about the project.
+ nano-devel@lists.sourceforge.net is the list used by the people
that make Nano and a general development discussion list, with
moderate traffic.
To subscribe, send email to nano-<name>-request@lists.sourceforge.net
with a subject of "subscribe", where <name> is the list you want to
subscribe to.
For general bug reports, send a description of the problem to
nano@asty.org or directly to the development list.
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.
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)
TODO file (? means the feature may be implemented, but not definitely)
-----------------------------------------------------------------------------
- Implement Spelling [DONE, mostly...]
- Implement Help [DONE]
- Internationalization [In progress, translators welcome!]
- Allow nano to be resized in X. [DONE]
- Color syntax highlighting? (certainly seems like there's a demand for it.)
- On page up/down, put the cursor on the first line (like Pico), not the
center line [DONE]
- Undo/Redo key?
- single line scroll up/down?
- Rewrite edit_refresh, if at all possible [In progress]
- Implement justify function [DONE]
/* Define this if you have the wresize function in your ncurses-type library */
#undef HAVE_WRESIZE
/* 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
/* Define to use the slang wrappers for curses instead of native curses */
#undef USE_SLANG
This diff is collapsed.
/* config.h.in. Generated automatically from configure.in by autoheader. */
/* Define if using alloca.c. */
#undef C_ALLOCA
/* Define to empty if the keyword does not work. */
#undef const
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
This function is required for alloca.c support on those systems. */
#undef CRAY_STACKSEG_END
/* Define if you have alloca, as a function or macro. */
#undef HAVE_ALLOCA
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
#undef HAVE_ALLOCA_H
/* Define if you don't have vprintf but do have _doprnt. */
#undef HAVE_DOPRNT
/* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP
/* Define if you have the vprintf function. */
#undef HAVE_VPRINTF
/* Define as __inline if that's what the C compiler calls it. */
#undef inline
/* Define to `long' if <sys/types.h> doesn't define. */
#undef off_t
/* Define 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
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown
*/
#undef STACK_DIRECTION
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define this if you have the wresize function in your ncurses-type library */
#undef HAVE_WRESIZE
/* Define this if you have 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
/* Define to use the slang wrappers for curses instead of native curses */
#undef USE_SLANG
/* Define if you have the __argz_count function. */
#undef HAVE___ARGZ_COUNT
/* Define if you have the __argz_next function. */
#undef HAVE___ARGZ_NEXT
/* Define if you have the __argz_stringify function. */
#undef HAVE___ARGZ_STRINGIFY
/* Define if you have the dcgettext function. */
#undef HAVE_DCGETTEXT
/* Define if you have the getcwd function. */
#undef HAVE_GETCWD
/* Define if you have the getopt_long function. */
#undef HAVE_GETOPT_LONG
/* Define if you have the getpagesize function. */
#undef HAVE_GETPAGESIZE
/* Define if you have the munmap function. */
#undef HAVE_MUNMAP
/* Define if you have the putenv function. */
#undef HAVE_PUTENV
/* Define if you have the setenv function. */
#undef HAVE_SETENV
/* Define if you have the setlocale function. */
#undef HAVE_SETLOCALE
/* Define if you have the snprintf function. */
#undef HAVE_SNPRINTF
/* Define if you have the stpcpy function. */
#undef HAVE_STPCPY
/* Define if you have the strcasecmp function. */
#undef HAVE_STRCASECMP
/* Define if you have the strchr function. */
#undef HAVE_STRCHR
/* Define if you have the strdup function. */
#undef HAVE_STRDUP
/* Define if you have the vsnprintf function. */
#undef HAVE_VSNPRINTF
/* Define if you have the <argz.h> header file. */
#undef HAVE_ARGZ_H
/* Define if you have the <curses.h> header file. */
#undef HAVE_CURSES_H
/* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define if you have the <getopt.h> header file. */
#undef HAVE_GETOPT_H
/* Define if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* Define if you have the <ncurses.h> header file. */
#undef HAVE_NCURSES_H
/* Define if you have the <nl_types.h> header file. */
#undef HAVE_NL_TYPES_H
/* Define if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define if you have the <termio.h> header file. */
#undef HAVE_TERMIO_H
/* Define if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if you have the i library (-li). */
#undef HAVE_LIBI
/* Name of package */
#undef PACKAGE
/* Version number of package */
#undef VERSION
This diff is collapsed.
dnl Process this file with autoconf to produce a configure script.
AC_INIT(nano.c)
AM_INIT_AUTOMAKE(nano, 0.9.10)
AM_CONFIG_HEADER(config.h:config.h.in)
ALL_LINGUAS="es de fr it"
dnl Checks for programs.
AC_PROG_CC
AC_ISC_POSIX
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h unistd.h malloc.h termios.h termio.h limits.h getopt.h)
dnl options
AC_ARG_ENABLE(tiny,
[ --enable-tiny Disables 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
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],
[ case "$with_slang" in
yes)
AC_MSG_RESULT(yes)
AC_CHECK_HEADER(slcurses.h,
AC_CHECK_LIB(slang, SLcurses_newwin,
[AC_DEFINE(USE_SLANG) slang_support=yes
CURSES_LIB="-lslang" CURSES_LIB_NAME=slang]),
AC_MSG_ERROR([
*** The header file slcurses.h was not found. If you wish to use
*** slang support this header file is required. Please either
*** install a version of slang that includes the slcurses.h file or
*** do not call the configure script with --with-slang
]))
;;
no)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_RESULT(yes)
# Needed for AC_CHECK_HEADERS and AC_CHECK_LIB to look at
# alternate readline path
_ldflags=${LDFLAGS}
_cppflags=${CPPFLAGS}
# Add additional search path
LDFLAGS="-L$with_slang/lib $LDFLAGS"
CPPFLAGS="-I$with_slang/include $CPPFLAGS"
AC_CHECK_HEADER(slcurses.h,
AC_CHECK_LIB(slang, SLcurses_newwin,
[AC_DEFINE(USE_SLANG) slang_support=yes
CURSES_LIB="-L${with_slang}/lib -lslang"
CURSES_LIB_NAME=slang],
AC_MSG_ERROR([
*** The slang library was not found or the version you have installed
*** is incorrect.
])),
AC_MSG_ERROR([
*** The header file slcurses.h was not found. If you wish to use
*** slang support this header file is required. Please either
*** install a version of slang that includes the slcurses.h file or
*** do not call the configure script with --with-slang
]))
LDFLAGS=${_ldflags}
;;
esac])
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([
*** snprintf() and/or vsnprintf() not found. GLIB not found either.
*** You need both snprintf() and vsnprintf(). Alternatively you can
*** install the GLIB library which can be found at ftp://ftp.gtk.org/.]),
glib)
glib_cflags=`$GLIB_CONFIG --cflags glib`
glib_libs=`$GLIB_CONFIG --libs glib`
fi
dnl Checks for typedefs, structures, and compiler characteristics.
dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(getopt_long)
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)
fi
if eval "test x$CURSES_LIB_NAME = x"
then
AC_CHECK_LIB(curses, tgetent, 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)
fi
if eval "test x$CURSES_LIB_NAME = x"
then
AC_MSG_WARN([
*** No termcap lib available, consider getting the official ncurses
*** 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")
fi
AC_CHECK_LIB($CURSES_LIB_NAME, wresize, AC_DEFINE(HAVE_WRESIZE))
dnl Parse any configure options
LIBS="$LIBS $CURSES_LIB"
AC_ARG_ENABLE(debug, [ --enable-debug Enable debugging (def disabled)],)
AC_SUBST(CURSES_LIB)
if test "x$glib_cflags" != "x"
then
CFLAGS="$CFLAGS $glib_cflags"
fi
if test "x$glib_libs" != "x"
then
LDFLAGS="$LDFLAGS $glib_libs"
fi
dnl i18n stuff - pretty incomplete for now
AM_GNU_GETTEXT
AC_OUTPUT([Makefile intl/Makefile po/Makefile.in])
/**************************************************************************
* cut.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 "config.h"
#include "proto.h"
#include "nano.h"
#ifndef NANO_SMALL
#include <libintl.h>
#define _(string) gettext(string)
#else
#define _(string) (string)
#endif
static int marked_cut; /* Is the cutbuffer from a mark */
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) + 1;
tmp = cutbuffer;
if (cutbuffer == NULL) {
cutbuffer = inptr;
inptr->prev = NULL;
} else {
cutbottom->next = inptr;
inptr->prev = cutbottom;
}
inptr->next = NULL;
cutbottom = inptr;
}
#ifndef NANO_SMALL
void cut_marked_segment(filestruct * top, int top_x, filestruct * bot,
int bot_x)
{
filestruct *tmp, *next;
char *tmpstr;
/* Set up the beginning of the cutbuffer */
tmp = copy_node(top);
tmpstr = nmalloc(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);
strncpy(tmpstr, top->data, top_x);
free(top->data);
top->data = tmpstr;
do {
next = tmp->next;
add_to_cutbuffer(tmp);
totlines--;
tmp = next;
}
while (next != bot && next != NULL);
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;
bot->data[bot_x] = 0;
align(&bot->data);
next = bot->next;
/* 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 */
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;
}
}
if (top->lineno < edittop->lineno)
edit_update(top);
}
#endif
int do_cut_text(void)
{
filestruct *tmp, *fileptr = current;
#ifndef NANO_SMALL
char *tmpstr;
int newsize;
#endif
if (fileptr == NULL || fileptr->data == NULL)
return 0;
tmp = fileptr->next;
if (!ISSET(KEEP_CUTBUFFER) || ISSET(MARK_ISSET)) {
free_filestruct(cutbuffer);
cutbuffer = NULL;
#ifdef DEBUG
fprintf(stderr, _("Blew away cutbuffer =)\n"));
#endif
}
#ifndef NANO_SMALL
if (ISSET(MARK_ISSET)) {
if (current->lineno == mark_beginbuf->lineno) {
tmp = copy_node(current);
newsize = abs(strlen(&current->data[mark_beginx]) -
strlen(&current->data[current_x]));
tmpstr = nmalloc(newsize);
if (current_x < mark_beginx) {
strncpy(tmpstr, &current->data[current_x], newsize);
memmove(&current->data[current_x],
&current->data[mark_beginx],
strlen(&current->data[mark_beginx] - newsize));
} else {
strncpy(tmpstr, &current->data[mark_beginx], newsize);
memmove(&current->data[mark_beginx],
&current->data[current_x],
strlen(&current->data[current_x] - newsize));
current_x = mark_beginx;
update_cursor();
}
tmpstr[newsize] = 0;
tmp->data = tmpstr;
add_to_cutbuffer(tmp);
dump_buffer(cutbuffer);
align(&current->data);
} else if (current->lineno < mark_beginbuf->lineno)
cut_marked_segment(current, current_x, mark_beginbuf,
mark_beginx);
else
cut_marked_segment(mark_beginbuf, mark_beginx, current,
current_x);
placewewant = xplustabs();
UNSET(MARK_ISSET);
marked_cut = 1;
set_modified();
edit_update_top(edittop);
return 1;
#else
if (0) {
#endif
} else if (fileptr == fileage) {
/* we're cutting the first line */
if (fileptr->next != NULL) {
fileptr = fileptr->next;
tmp = fileptr;
fileage = fileptr;
add_to_cutbuffer(fileptr->prev);
totlines--;
fileptr->prev = NULL;
edit_update(fileage);
current = fileptr;
} else {
add_to_cutbuffer(fileptr);
totlines--;
fileage = make_new_node(NULL);
fileage->data = nmalloc(1);
strcpy(fileage->data, "");
current = fileage;
}
} else {
if (fileptr->prev != NULL)
fileptr->prev->next = fileptr->next;
if (fileptr->next != NULL) {
(fileptr->next)->prev = fileptr->prev;
current = fileptr->next;
totlines--;
} else {
/* we're deleteing the last line
and replacing it with a dummy line,
so totlines is the same */
tmp = fileptr->prev;
tmp->next = make_new_node(tmp);
tmp = tmp->next;
tmp->data = nmalloc(1);
strcpy(tmp->data, "");
current = tmp;
filebot = tmp;
}
add_to_cutbuffer(fileptr);
}
if (fileptr == edittop)
edittop = current;
edit_refresh();
dump_buffer(cutbuffer);
reset_cursor();
set_modified();
marked_cut = 0;
current_x = 0;
placewewant = 0;
update_cursor();
renumber(tmp);
SET(KEEP_CUTBUFFER);
return 1;
}
int do_uncut_text(void)
{
filestruct *tmp = current, *fileptr = current, *newbuf, *newend;
#ifndef NANO_SMALL
char *tmpstr, *tmpstr2;
#endif
int i;
wrap_reset();
if (cutbuffer == NULL || fileptr == NULL)
return 0; /* AIEEEEEEEEEEEE */
newbuf = copy_filestruct(cutbuffer);
for (newend = newbuf; newend->next != NULL && newend != NULL;
newend = newend->next) {
totlines++;
}
/* Hook newbuf into fileptr */
#ifndef NANO_SMALL
if (marked_cut == 1) {
/* If there's only one line in the cutbuffer */
if (cutbuffer->next == NULL) {
tmpstr =
nmalloc(strlen(current->data) + strlen(cutbuffer->data) +
1);
strncpy(tmpstr, current->data, current_x);
strcpy(&tmpstr[current_x], cutbuffer->data);
strcat(tmpstr, &current->data[current_x]);
free(current->data);
current->data = tmpstr;
current_x += strlen(cutbuffer->data);
totsize += strlen(cutbuffer->data);
placewewant = xplustabs();
update_cursor();
renumber(current);
} else { /* yuck -- no kidding! */
tmp = current->next;
/* New beginning */
tmpstr = nmalloc(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) +
strlen(&current->data[current_x]) + 1);
strcpy(tmpstr2, newend->data);
strcat(tmpstr2, &current->data[current_x]);
free(current->data);
current->data = tmpstr;
current->next = newbuf->next;
newbuf->next->prev = current;
delete_node(newbuf);
current_x = strlen(newend->data);
placewewant = xplustabs();
free(newend->data);
newend->data = tmpstr2;
newend->next = tmp;
/* If tmp isn't null, we're in the middle: update the
* prev pointer. If it IS null, we're at the end, update
* the filebot pointer */
if (tmp != NULL)
tmp->prev = newend;
else
filebot = newend;
/* Now why don't we update the totsize also */
for (tmp = current->next; tmp != newend; tmp = tmp->next)
totsize += strlen(tmp->data) + 1;
i = editbot->lineno;
renumber(current);
current = newend;
if (i <= newend->lineno)
edit_update(current);
}
dump_buffer(fileage);
dump_buffer(cutbuffer);
set_modified();
edit_refresh();
return 0;
#else
if (0) {
#endif
} else if (fileptr != fileage) {
tmp = fileptr->prev;
tmp->next = newbuf;
newbuf->prev = tmp;
totlines++; /* Unmarked uncuts don't split lines */
} else {
fileage = newbuf;
totlines++; /* Unmarked uncuts don't split lines */
}
/* This is so uncutting at the top of the buffer will work => */
if (current_y == 0)
edittop = newbuf;
/* Connect the end of the buffer to the filestruct */
newend->next = fileptr;
fileptr->prev = newend;
/* recalculate size *sigh* */
for (tmp = newbuf; tmp != fileptr; tmp = tmp->next)
totsize += strlen(tmp->data) + 1;
i = editbot->lineno;
renumber(newbuf);
if (i < newend->lineno)
edit_update(fileptr);
dump_buffer_reverse(fileptr);
set_modified();
UNSET(KEEP_CUTBUFFER);
edit_refresh();
return 1;
}
/**************************************************************************
* global.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 <sys/stat.h>
#include "config.h"
#include "nano.h"
#include "proto.h"
#ifndef NANO_SMALL
#include <libintl.h>
#define _(string) gettext(string)
#else
#define _(string) (string)
#endif
/*
* Global variables
*/
int flags = 0; /* Our new flag containig many options */
int center_x = 0, center_y = 0; /* Center of screen */
WINDOW *edit; /* The file portion of the editor */
WINDOW *topwin; /* Top line of screen */
WINDOW *bottomwin; /* Bottom buffer */
char *filename; /* Name of the file */
int editwinrows = 0; /* How many rows long is the edit
window? */
filestruct *current; /* Current buffer pointer */
int current_x = 0, current_y = 0; /* Current position of X and Y in
the editor - relative to edit
window (0,0) */
filestruct *fileage = NULL; /* Our file buffer */
filestruct *edittop = NULL; /* Pointer to the top of the edit
buffer with respect to the
file struct */
filestruct *editbot = NULL; /* Same for the bottom */
filestruct *filebot = NULL; /* Last node in the file struct */
filestruct *cutbuffer = NULL; /* A place to store cut text */
char *answer; /* 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
to jump to when we go to the
next or previous line */
char *hblank; /* A horizontal blank line */
char *help_text; /* The text in the help window */
/* More stuff for the marker select */
filestruct *mark_beginbuf; /* the begin marker buffer */
int mark_beginx; /* X value in the string to start */
shortcut main_list[MAIN_LIST_LEN];
shortcut whereis_list[WHEREIS_LIST_LEN];
shortcut replace_list[REPLACE_LIST_LEN];
shortcut goto_list[GOTO_LIST_LEN];
shortcut writefile_list[WRITEFILE_LIST_LEN];
shortcut help_list[HELP_LIST_LEN];
shortcut spell_list[SPELL_LIST_LEN];
/* Initialize a struct *without* our lovely braces =( */
void sc_init_one(shortcut * s, int key, char *desc, char *help, int alt,
int misc1, int misc2, int view, int (*func) (void))
{
s->val = key;
s->desc = desc;
s->help = help;
s->altval = alt;
s->misc1 = misc1;
s->misc2 = misc2;
s->viewok = view;
s->func = func;
}
void shortcut_init(void)
{
char *nano_help_msg = "", *nano_writeout_msg = "", *nano_exit_msg = "",
*nano_goto_msg = "", *nano_justify_msg = "", *nano_replace_msg =
"", *nano_insert_msg = "", *nano_whereis_msg =
"", *nano_prevpage_msg = "", *nano_nextpage_msg =
"", *nano_cut_msg = "", *nano_uncut_msg = "", *nano_cursorpos_msg =
"", *nano_spell_msg = "", *nano_up_msg = "", *nano_down_msg =
"", *nano_forward_msg = "", *nano_back_msg = "", *nano_home_msg =
"", *nano_end_msg = "", *nano_firstline_msg =
"", *nano_lastline_msg = "", *nano_refresh_msg =
"", *nano_mark_msg = "", *nano_delete_msg =
"", *nano_backspace_msg = "", *nano_tab_msg =
"", *nano_enter_msg = "", *nano_case_msg =
"", *nano_cancel_msg = "";
#ifndef NANO_SMALL
nano_help_msg = _("Invoke the help menu");
nano_writeout_msg = _("Write the current file to disk");
nano_exit_msg = _("Exit from nano");
nano_goto_msg = _("Goto a specific line number");
nano_justify_msg = _("Justify the current paragraph");
nano_replace_msg = _("Replace text within the editor");
nano_insert_msg = _("Insert another file into the current one");
nano_whereis_msg = _("Search for text within the editor");
nano_prevpage_msg = _("Move to the previous screen");
nano_nextpage_msg = _("Move to the next screen");
nano_cut_msg = _("Cut the current line and store it in the cutbuffer");
nano_uncut_msg = _("Uncut from the cutbuffer into the current line");
nano_cursorpos_msg = _("Show the posititon of the cursor");
nano_spell_msg = _("Invoke the spell checker (if available)");
nano_up_msg = _("Move up one line");
nano_down_msg = _("Move down one line");
nano_forward_msg = _("Move forward one character");
nano_back_msg = _("Move back one character");
nano_home_msg = _("Move to the beginning of the current line");
nano_end_msg = _("Move to the end of the current line");
nano_firstline_msg = _("Go to the first line of the file");
nano_lastline_msg = _("Go to the last line of the file");
nano_refresh_msg = _("Refresh (redraw) the current screen");
nano_mark_msg = _("Mark text at the current cursor location");
nano_delete_msg = _("Delete the character under the cursor");
nano_backspace_msg =
_("Delete the character to the left of the cursor");
nano_tab_msg = _("Insert a tab character");
nano_enter_msg = _("Insert a carriage return at the cursor position");
nano_case_msg =
_("Make the current search or replace case (in)sensitive");
nano_cancel_msg = _("Cancel the current function");
#endif
if (ISSET(PICO_MSGS))
sc_init_one(&main_list[0], NANO_HELP_KEY, _("Get Help"),
nano_help_msg, 0, 0, 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"),
nano_exit_msg, 0, NANO_EXIT_FKEY, 0, VIEW, do_exit);
if (ISSET(PICO_MSGS))
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_MSGS))
sc_init_one(&main_list[3], NANO_JUSTIFY_KEY, _("Justify"),
nano_justify_msg, 0, 0, 0, NOVIEW, do_justify);
else
sc_init_one(&main_list[3], 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);
sc_init_one(&main_list[6], NANO_PREVPAGE_KEY, _("Prev Page"),
nano_prevpage_msg,
0, NANO_PREVPAGE_FKEY, KEY_PPAGE, VIEW, page_up);
sc_init_one(&main_list[7], NANO_NEXTPAGE_KEY, _("Next Page"),
nano_nextpage_msg,
0, NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, page_down);
sc_init_one(&main_list[8], NANO_CUT_KEY, _("Cut Text"),
nano_cut_msg, 0, NANO_CUT_FKEY, 0, NOVIEW, do_cut_text);
sc_init_one(&main_list[9], NANO_UNCUT_KEY, _("UnCut Txt"),
nano_uncut_msg,
0, NANO_UNCUT_FKEY, 0, NOVIEW, do_uncut_text);
sc_init_one(&main_list[10], NANO_CURSORPOS_KEY, _("Cur Pos"),
nano_cursorpos_msg,
0, NANO_CURSORPOS_FKEY, 0, VIEW, do_cursorpos);
sc_init_one(&main_list[11], NANO_SPELL_KEY, _("To Spell"),
nano_spell_msg, 0, NANO_SPELL_FKEY, 0, NOVIEW, do_spell);
sc_init_one(&main_list[12], NANO_UP_KEY, _("Up"),
nano_up_msg, 0, KEY_UP, 0, VIEW, do_up);
sc_init_one(&main_list[13], NANO_DOWN_KEY, _("Down"),
nano_down_msg, 0, KEY_DOWN, 0, VIEW, do_down);
sc_init_one(&main_list[14], NANO_FORWARD_KEY, _("Forward"),
nano_forward_msg, 0, KEY_RIGHT, 0, VIEW, do_right);
sc_init_one(&main_list[15], NANO_BACK_KEY, _("Back"),
nano_back_msg, 0, KEY_LEFT, 0, VIEW, do_left);
sc_init_one(&main_list[16], NANO_HOME_KEY, _("Home"),
nano_home_msg, 0, KEY_HOME, 362, VIEW, do_home);
sc_init_one(&main_list[17], NANO_END_KEY, _("End"),
nano_end_msg, 0, KEY_END, 385, VIEW, do_end);
sc_init_one(&main_list[18], NANO_REFRESH_KEY, _("Refresh"),
nano_refresh_msg, 0, 0, 0, VIEW, total_refresh);
sc_init_one(&main_list[19], NANO_MARK_KEY, _("Mark Text"),
nano_mark_msg, 0, 0, 0, NOVIEW, do_mark);
sc_init_one(&main_list[20], NANO_DELETE_KEY, _("Delete"),
nano_delete_msg, 0, KEY_DC,
NANO_CONTROL_D, NOVIEW, do_delete);
sc_init_one(&main_list[21], NANO_BACKSPACE_KEY, _("Backspace"),
nano_backspace_msg, 0,
KEY_BACKSPACE, 127, NOVIEW, do_backspace);
sc_init_one(&main_list[22], NANO_TAB_KEY, _("Tab"),
nano_tab_msg, 0, 0, 0, NOVIEW, do_tab);
if (ISSET(PICO_MSGS))
sc_init_one(&main_list[23], NANO_REPLACE_KEY, _("Replace"),
nano_replace_msg,
NANO_ALT_R, NANO_REPLACE_FKEY, 0, NOVIEW, do_replace);
else
sc_init_one(&main_list[23], NANO_JUSTIFY_KEY, _("Justify"),
nano_justify_msg, 0, 0, 0, NOVIEW, do_justify);
sc_init_one(&main_list[24], NANO_ENTER_KEY, _("Enter"),
nano_enter_msg,
0, KEY_ENTER, NANO_CONTROL_M, NOVIEW, do_enter_void);
if (ISSET(PICO_MSGS))
sc_init_one(&main_list[25], NANO_GOTO_KEY, _("Goto Line"),
nano_goto_msg,
NANO_ALT_G, NANO_GOTO_FKEY, 0, VIEW, do_gotoline_void);
else
sc_init_one(&main_list[25], NANO_HELP_KEY, _("Get Help"),
nano_help_msg, 0, 0, 0, VIEW, do_help);
sc_init_one(&whereis_list[0], NANO_FIRSTLINE_KEY, _("First Line"),
nano_firstline_msg, 0, 0, 0, VIEW, do_first_line);
sc_init_one(&whereis_list[1], NANO_LASTLINE_KEY, _("Last Line"),
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, _("To Replace"),
nano_replace_msg, 0, 0, 0, VIEW, do_replace);
sc_init_one(&whereis_list[4], NANO_CANCEL_KEY, _("Cancel"),
nano_cancel_msg, 0, 0, 0, VIEW, 0);
sc_init_one(&replace_list[0], NANO_FIRSTLINE_KEY, _("First Line"),
nano_firstline_msg, 0, 0, 0, VIEW, do_first_line);
sc_init_one(&replace_list[1], NANO_LASTLINE_KEY, _("Last Line"),
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, _("To Search"),
nano_whereis_msg, 0, 0, 0, VIEW, do_search);
sc_init_one(&replace_list[4], NANO_CANCEL_KEY, _("Cancel"),
nano_cancel_msg, 0, 0, 0, VIEW, 0);
sc_init_one(&goto_list[0], NANO_FIRSTLINE_KEY, _("First Line"),
nano_firstline_msg, 0, 0, 0, VIEW, &do_first_line);
sc_init_one(&goto_list[1], NANO_LASTLINE_KEY, _("Last Line"),
nano_lastline_msg, 0, 0, 0, VIEW, &do_last_line);
sc_init_one(&goto_list[2], NANO_CANCEL_KEY, _("Cancel"),
nano_cancel_msg, 0, 0, 0, VIEW, 0);
sc_init_one(&help_list[0], NANO_PREVPAGE_KEY, _("Prev Page"),
nano_prevpage_msg,
0, NANO_PREVPAGE_FKEY, KEY_PPAGE, VIEW, page_up);
sc_init_one(&help_list[1], NANO_NEXTPAGE_KEY, _("Next Page"),
nano_nextpage_msg,
0, NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, page_down);
sc_init_one(&help_list[2], NANO_EXIT_KEY, _("Exit"),
nano_exit_msg, 0, NANO_EXIT_FKEY, 0, VIEW, do_exit);
sc_init_one(&writefile_list[0], NANO_CANCEL_KEY, _("Cancel"),
nano_cancel_msg, 0, 0, 0, VIEW, 0);
sc_init_one(&writefile_list[0], NANO_CANCEL_KEY, _("Cancel"),
nano_cancel_msg, 0, 0, 0, VIEW, 0);
sc_init_one(&spell_list[0], NANO_HELP_KEY, _("Get Help"),
nano_help_msg, 0, 0, 0, VIEW, do_help);
sc_init_one(&spell_list[1], NANO_CANCEL_KEY, _("Cancel"),
nano_cancel_msg, 0, 0, 0, VIEW, 0);
}
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
chmodcmd=""
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment