Initial files

This commit is contained in:
joachimschmidt557 2019-02-26 13:01:51 +01:00
commit 2c61b6ba6c
62 changed files with 14808 additions and 0 deletions

226
ABOUT-NLS Normal file
View file

@ -0,0 +1,226 @@
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.

0
AUTHORS Normal file
View file

339
COPYING Normal file
View file

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, 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
Appendix: 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., 675 Mass Ave, Cambridge, MA 02139, 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.

0
ChangeLog Normal file
View file

182
INSTALL Normal file
View file

@ -0,0 +1,182 @@
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.

19
Makefile.am Normal file
View file

@ -0,0 +1,19 @@
sbin_PROGRAMS = nparted
SUBDIRS = po intl
nparted_SOURCES = edit_partition.c \
add_partition.c \
copy_partition.c \
del_partition.c \
exception_manager.c \
exception_manager.h \
main.c \
nparted.c \
nparted.h \
utils.c
#nparted_LDFLAGS= --static
nparted_LDADD =@INTLLIBS@
INCLUDES = $(npartedincludedir) @INTLINCS@

422
Makefile.in Normal file
View file

@ -0,0 +1,422 @@
# 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@
DATADIRNAME = @DATADIRNAME@
GENCAT = @GENCAT@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GT_NO = @GT_NO@
GT_YES = @GT_YES@
INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
INSTOBJEXT = @INSTOBJEXT@
INTLDEPS = @INTLDEPS@
INTLINCS = @INTLINCS@
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@
sbin_PROGRAMS = nparted
SUBDIRS = po intl
nparted_SOURCES = edit_partition.c add_partition.c copy_partition.c del_partition.c exception_manager.c exception_manager.h main.c nparted.c nparted.h utils.c
#nparted_LDFLAGS= --static
nparted_LDADD = @INTLLIBS@
INCLUDES = $(npartedincludedir) @INTLINCS@
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES =
PROGRAMS = $(sbin_PROGRAMS)
DEFS = @DEFS@ -I. -I$(srcdir)
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
nparted_OBJECTS = edit_partition.o add_partition.o copy_partition.o \
del_partition.o exception_manager.o main.o nparted.o utils.o
nparted_DEPENDENCIES =
nparted_LDFLAGS =
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = README ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL \
Makefile.am Makefile.in NEWS TODO aclocal.m4 configure configure.in \
install-sh missing mkinstalldirs
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = gtar
GZIP_ENV = --best
SOURCES = $(nparted_SOURCES)
OBJECTS = $(nparted_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)
mostlyclean-sbinPROGRAMS:
clean-sbinPROGRAMS:
-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
distclean-sbinPROGRAMS:
maintainer-clean-sbinPROGRAMS:
install-sbinPROGRAMS: $(sbin_PROGRAMS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(sbindir)
@list='$(sbin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
else :; fi; \
done
uninstall-sbinPROGRAMS:
@$(NORMAL_UNINSTALL)
list='$(sbin_PROGRAMS)'; for p in $$list; do \
rm -f $(DESTDIR)$(sbindir)/`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:
nparted: $(nparted_OBJECTS) $(nparted_DEPENDENCIES)
@rm -f nparted
$(LINK) $(nparted_LDFLAGS) $(nparted_OBJECTS) $(nparted_LDADD) $(LIBS)
# 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) $(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)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$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 $$d/$$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
install-exec-am: install-sbinPROGRAMS
install-exec: install-exec-recursive
install-data-am:
install-data: install-data-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-recursive
uninstall-am: uninstall-sbinPROGRAMS
uninstall: uninstall-recursive
all-am: Makefile $(PROGRAMS)
all-redirect: all-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs: installdirs-recursive
installdirs-am:
$(mkinstalldirs) $(DESTDIR)$(sbindir)
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-sbinPROGRAMS mostlyclean-compile \
mostlyclean-tags mostlyclean-generic
mostlyclean: mostlyclean-recursive
clean-am: clean-sbinPROGRAMS clean-compile clean-tags clean-generic \
mostlyclean-am
clean: clean-recursive
distclean-am: distclean-sbinPROGRAMS distclean-compile distclean-tags \
distclean-generic clean-am
distclean: distclean-recursive
-rm -f config.status
maintainer-clean-am: maintainer-clean-sbinPROGRAMS \
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-sbinPROGRAMS distclean-sbinPROGRAMS \
clean-sbinPROGRAMS maintainer-clean-sbinPROGRAMS uninstall-sbinPROGRAMS \
install-sbinPROGRAMS mostlyclean-compile distclean-compile \
clean-compile maintainer-clean-compile 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 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:

0
NEWS Normal file
View file

22
README Normal file
View file

@ -0,0 +1,22 @@
Esto es una versión muy muy beta, creo que se puede probar sin riesgo
para los discos en los cuales no se realiza ninguna operación.
Instalacion:
Para Instalar nparted, se necesita tener las fuetnes compiladas de
libparted del CVS en el mismo directorio que nparted. Si no es asi
se necesitara libparted-2.4-pre3 o mayor, y realizar la siguiente
modificacion en Makefile.am
- npartedincludedir = -I$(top_srcdir)/../libparted/include
- LIBS= -L$(top_srcdir)/../libparted/.libs
+ npartedincludedir = -I/path/alos/includes #si estan en los standard
# no hace falta
+ LIBS= -L/path/ala/libreria #si estan en los standards no es necesario
Luego ejecutar automake, autoconf
Compilacion:
Lo tipico : ./configure && make

22
TODO Normal file
View file

@ -0,0 +1,22 @@
* Ver lo de que la primera partición empieze en el sector 64, es esto
cierto? o es solo para los ides?
* Permitir trabajar con sectores en vez de cilindros para afinar más
las particiones.
* Crear la pantalla de resize, no parece muy difícil, a ver si en
unos pocos días está hecha.
oct 26 2000: ya está más o menos funcional, y lo mejor de todo
es que parece que funciona ;-)
* Crear la pantalla de copiar particiones, y mover particiones
* Para las operaciones no implementadas de sistemas de ficheros, como
el mkreiserfs, pues permitir el uso de programas externos para
crearla. No es muy difícil, pero el problema es como enterarse
si la libparted los soporta o no, ya que la libparted lanza una
excepción y nada más, y en el valor devuelto no sabemos porqué
falló. Supongo que navegando por las estructuras se puede saber
pero esto es muy dependiente de las versiones de la libparted
ya que pueden variar muhco de una otra, ya varía algún API
de una 1.4-pre1 a la 1.4-pre2 imaginemos lo que variará a la 1.5

488
aclocal.m4 vendored Normal file
View file

@ -0,0 +1,488 @@
dnl aclocal.m4 generated automatically by aclocal 1.4
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
dnl PARTICULAR PURPOSE.
# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.
# But this isn't really a big deal.
# serial 1
dnl Usage:
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
AC_DEFUN(AM_INIT_AUTOMAKE,
[AC_REQUIRE([AC_PROG_INSTALL])
PACKAGE=[$1]
AC_SUBST(PACKAGE)
VERSION=[$2]
AC_SUBST(VERSION)
dnl test to see if srcdir already configured
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
ifelse([$3],,
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
AC_REQUIRE([AM_SANITY_CHECK])
AC_REQUIRE([AC_ARG_PROGRAM])
dnl FIXME This is truly gross.
missing_dir=`cd $ac_aux_dir && pwd`
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
AC_REQUIRE([AC_PROG_MAKE_SET])])
#
# Check to make sure that the build environment is sane.
#
AC_DEFUN(AM_SANITY_CHECK,
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftestfile
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
if test "[$]*" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftestfile`
fi
if test "[$]*" != "X $srcdir/configure conftestfile" \
&& test "[$]*" != "X conftestfile $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
test "[$]2" = conftestfile
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
rm -f conftest*
AC_MSG_RESULT(yes)])
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
dnl The program must properly implement --version.
AC_DEFUN(AM_MISSING_PROG,
[AC_MSG_CHECKING(for working $2)
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
if ($2 --version) < /dev/null > /dev/null 2>&1; then
$1=$2
AC_MSG_RESULT(found)
else
$1="$3/missing $2"
AC_MSG_RESULT(missing)
fi
AC_SUBST($1)])
# Macro to add for using GNU gettext.
# Ulrich Drepper <drepper@cygnus.com>, 1995.
#
# This file can be copied and used freely without restrictions. It can
# be used in projects which are not available under the GNU Public License
# but which still want to provide support for the GNU gettext functionality.
# Please note that the actual code is *not* freely available.
# serial 5
AC_DEFUN(AM_WITH_NLS,
[AC_MSG_CHECKING([whether NLS is requested])
dnl Default is enabled NLS
AC_ARG_ENABLE(nls,
[ --disable-nls do not use Native Language Support],
USE_NLS=$enableval, USE_NLS=yes)
AC_MSG_RESULT($USE_NLS)
AC_SUBST(USE_NLS)
USE_INCLUDED_LIBINTL=no
dnl If we use NLS figure out what method
if test "$USE_NLS" = "yes"; then
AC_DEFINE(ENABLE_NLS)
AC_MSG_CHECKING([whether included gettext is requested])
AC_ARG_WITH(included-gettext,
[ --with-included-gettext use the GNU gettext library included here],
nls_cv_force_use_gnu_gettext=$withval,
nls_cv_force_use_gnu_gettext=no)
AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
dnl User does not insist on using GNU NLS library. Figure out what
dnl to use. If gettext or catgets are available (in this order) we
dnl use this. Else we have to fall back to GNU NLS library.
dnl catgets is only used if permitted by option --with-catgets.
nls_cv_header_intl=
nls_cv_header_libgt=
CATOBJEXT=NONE
AC_CHECK_HEADER(libintl.h,
[AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
[AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
if test "$gt_cv_func_gettext_libc" != "yes"; then
AC_CHECK_LIB(intl, bindtextdomain,
[AC_CACHE_CHECK([for gettext in libintl],
gt_cv_func_gettext_libintl,
[AC_CHECK_LIB(intl, gettext,
gt_cv_func_gettext_libintl=yes,
gt_cv_func_gettext_libintl=no)],
gt_cv_func_gettext_libintl=no)])
fi
if test "$gt_cv_func_gettext_libc" = "yes" \
|| test "$gt_cv_func_gettext_libintl" = "yes"; then
AC_DEFINE(HAVE_GETTEXT)
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
if test "$MSGFMT" != "no"; then
AC_CHECK_FUNCS(dcgettext)
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
return _nl_msg_cat_cntr],
[CATOBJEXT=.gmo
DATADIRNAME=share],
[CATOBJEXT=.mo
DATADIRNAME=lib])
INSTOBJEXT=.mo
fi
fi
])
if test "$CATOBJEXT" = "NONE"; then
AC_MSG_CHECKING([whether catgets can be used])
AC_ARG_WITH(catgets,
[ --with-catgets use catgets functions if available],
nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
AC_MSG_RESULT($nls_cv_use_catgets)
if test "$nls_cv_use_catgets" = "yes"; then
dnl No gettext in C library. Try catgets next.
AC_CHECK_LIB(i, main)
AC_CHECK_FUNC(catgets,
[AC_DEFINE(HAVE_CATGETS)
INTLOBJS="\$(CATOBJS)"
AC_PATH_PROG(GENCAT, gencat, no)dnl
if test "$GENCAT" != "no"; then
AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
if test "$GMSGFMT" = "no"; then
AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
fi
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
USE_INCLUDED_LIBINTL=yes
CATOBJEXT=.cat
INSTOBJEXT=.cat
DATADIRNAME=lib
INTLDEPS='$(top_builddir)/intl/libintl.a'
INTLLIBS=$INTLDEPS
LIBS=`echo $LIBS | sed -e 's/-lintl//'`
nls_cv_header_intl=intl/libintl.h
nls_cv_header_libgt=intl/libgettext.h
fi])
fi
fi
if test "$CATOBJEXT" = "NONE"; then
dnl Neither gettext nor catgets in included in the C library.
dnl Fall back on GNU gettext library.
nls_cv_use_gnu_gettext=yes
fi
fi
if test "$nls_cv_use_gnu_gettext" = "yes"; then
dnl Mark actions used to generate GNU NLS library.
INTLOBJS="\$(GETTOBJS)"
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
AC_SUBST(MSGFMT)
USE_INCLUDED_LIBINTL=yes
CATOBJEXT=.gmo
INSTOBJEXT=.mo
DATADIRNAME=share
INTLDEPS='$(top_builddir)/intl/libintl.a'
INTLLIBS=$INTLDEPS
LIBS=`echo $LIBS | sed -e 's/-lintl//'`
nls_cv_header_intl=intl/libintl.h
nls_cv_header_libgt=intl/libgettext.h
fi
dnl Test whether we really found GNU xgettext.
if test "$XGETTEXT" != ":"; then
dnl If it is no GNU xgettext we define it as : so that the
dnl Makefiles still can work.
if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
: ;
else
AC_MSG_RESULT(
[found xgettext program is not GNU xgettext; ignore it])
XGETTEXT=":"
fi
fi
# We need to process the po/ directory.
POSUB=po
else
DATADIRNAME=share
nls_cv_header_intl=intl/libintl.h
nls_cv_header_libgt=intl/libgettext.h
fi
AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
AC_OUTPUT_COMMANDS(
[case "$CONFIG_FILES" in *po/Makefile.in*)
sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
esac])
# If this is used in GNU gettext we have to set USE_NLS to `yes'
# because some of the sources are only built for this goal.
if test "$PACKAGE" = gettext; then
USE_NLS=yes
USE_INCLUDED_LIBINTL=yes
fi
dnl These rules are solely for the distribution goal. While doing this
dnl we only have to keep exactly one list of the available catalogs
dnl in configure.in.
for lang in $ALL_LINGUAS; do
GMOFILES="$GMOFILES $lang.gmo"
POFILES="$POFILES $lang.po"
done
dnl Make all variables we use known to autoconf.
AC_SUBST(USE_INCLUDED_LIBINTL)
AC_SUBST(CATALOGS)
AC_SUBST(CATOBJEXT)
AC_SUBST(DATADIRNAME)
AC_SUBST(GMOFILES)
AC_SUBST(INSTOBJEXT)
AC_SUBST(INTLDEPS)
AC_SUBST(INTLLIBS)
AC_SUBST(INTLOBJS)
AC_SUBST(POFILES)
AC_SUBST(POSUB)
])
AC_DEFUN(AM_GNU_GETTEXT,
[AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_RANLIB])dnl
AC_REQUIRE([AC_ISC_POSIX])dnl
AC_REQUIRE([AC_HEADER_STDC])dnl
AC_REQUIRE([AC_C_CONST])dnl
AC_REQUIRE([AC_C_INLINE])dnl
AC_REQUIRE([AC_TYPE_OFF_T])dnl
AC_REQUIRE([AC_TYPE_SIZE_T])dnl
AC_REQUIRE([AC_FUNC_ALLOCA])dnl
AC_REQUIRE([AC_FUNC_MMAP])dnl
AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
unistd.h sys/param.h])
AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
strdup __argz_count __argz_stringify __argz_next])
if test "${ac_cv_func_stpcpy+set}" != "set"; then
AC_CHECK_FUNCS(stpcpy)
fi
if test "${ac_cv_func_stpcpy}" = "yes"; then
AC_DEFINE(HAVE_STPCPY)
fi
AM_LC_MESSAGES
AM_WITH_NLS
if test "x$CATOBJEXT" != "x"; then
if test "x$ALL_LINGUAS" = "x"; then
LINGUAS=
else
AC_MSG_CHECKING(for catalogs to be installed)
NEW_LINGUAS=
for lang in ${LINGUAS=$ALL_LINGUAS}; do
case "$ALL_LINGUAS" in
*$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
esac
done
LINGUAS=$NEW_LINGUAS
AC_MSG_RESULT($LINGUAS)
fi
dnl Construct list of names of catalog files to be constructed.
if test -n "$LINGUAS"; then
for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
fi
fi
dnl The reference to <locale.h> in the installed <libintl.h> file
dnl must be resolved because we cannot expect the users of this
dnl to define HAVE_LOCALE_H.
if test $ac_cv_header_locale_h = yes; then
INCLUDE_LOCALE_H="#include <locale.h>"
else
INCLUDE_LOCALE_H="\
/* The system does not provide the header <locale.h>. Take care yourself. */"
fi
AC_SUBST(INCLUDE_LOCALE_H)
dnl Determine which catalog format we have (if any is needed)
dnl For now we know about two different formats:
dnl Linux libc-5 and the normal X/Open format
test -d intl || mkdir intl
if test "$CATOBJEXT" = ".cat"; then
AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
dnl Transform the SED scripts while copying because some dumb SEDs
dnl cannot handle comments.
sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
fi
dnl po2tbl.sed is always needed.
sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
$srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
dnl In the intl/Makefile.in we have a special dependency which makes
dnl only sense for gettext. We comment this out for non-gettext
dnl packages.
if test "$PACKAGE" = "gettext"; then
GT_NO="#NO#"
GT_YES=
else
GT_NO=
GT_YES="#YES#"
fi
AC_SUBST(GT_NO)
AC_SUBST(GT_YES)
dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
dnl Try to locate is.
MKINSTALLDIRS=
if test -n "$ac_aux_dir"; then
MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
fi
if test -z "$MKINSTALLDIRS"; then
MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
fi
AC_SUBST(MKINSTALLDIRS)
dnl *** For now the libtool support in intl/Makefile is not for real.
l=
AC_SUBST(l)
dnl Generate list of files to be processed by xgettext which will
dnl be included in po/Makefile.
test -d po || mkdir po
if test "x$srcdir" != "x."; then
if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
posrcprefix="$srcdir/"
else
posrcprefix="../$srcdir/"
fi
else
posrcprefix="../"
fi
rm -f po/POTFILES
sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
< $srcdir/po/POTFILES.in > po/POTFILES
])
# Search path for a program which passes the given test.
# Ulrich Drepper <drepper@cygnus.com>, 1996.
#
# This file can be copied and used freely without restrictions. It can
# be used in projects which are not available under the GNU Public License
# but which still want to provide support for the GNU gettext functionality.
# Please note that the actual code is *not* freely available.
# serial 1
dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
AC_DEFUN(AM_PATH_PROG_WITH_TEST,
[# Extract the first word of "$2", so it can be a program name with args.
set dummy $2; ac_word=[$]2
AC_MSG_CHECKING([for $ac_word])
AC_CACHE_VAL(ac_cv_path_$1,
[case "[$]$1" in
/*)
ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
;;
*)
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
for ac_dir in ifelse([$5], , $PATH, [$5]); do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
if [$3]; then
ac_cv_path_$1="$ac_dir/$ac_word"
break
fi
fi
done
IFS="$ac_save_ifs"
dnl If no 4th arg is given, leave the cache variable unset,
dnl so AC_PATH_PROGS will keep looking.
ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
])dnl
;;
esac])dnl
$1="$ac_cv_path_$1"
if test -n "[$]$1"; then
AC_MSG_RESULT([$]$1)
else
AC_MSG_RESULT(no)
fi
AC_SUBST($1)dnl
])
# Check whether LC_MESSAGES is available in <locale.h>.
# Ulrich Drepper <drepper@cygnus.com>, 1995.
#
# This file can be copied and used freely without restrictions. It can
# be used in projects which are not available under the GNU Public License
# but which still want to provide support for the GNU gettext functionality.
# Please note that the actual code is *not* freely available.
# serial 1
AC_DEFUN(AM_LC_MESSAGES,
[if test $ac_cv_header_locale_h = yes; then
AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
[AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
if test $am_cv_val_LC_MESSAGES = yes; then
AC_DEFINE(HAVE_LC_MESSAGES)
fi
fi])

408
add_partition.c Normal file
View file

@ -0,0 +1,408 @@
/*
nparted - a frontend to libparted for manipulating disk partitions
thinked to dbootstrap
Copyright (C) 1998-2000 Mario Teijeiro Otero Esteve Fernández
Jaime Villate La Espiral
Mario Teijeiro Otero <asimovi@teleline.es>
Esteve Fernández < esteve@crosswinds.net >
Jaime Villate <villate@fe.up.pt>
La Espiral http://www.laespiral.org
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
*/
#include "nparted.h"
int do_list_free (PedDevice *dev, newtComponent free_list)
{
PedDisk *disk;
PedPartition *part;
strech *list_strech,*p,*new,*extend,*walk;
disk=ped_disk_open(dev);
if(!disk) goto error;
part=NULL;
p=list_strech=extend=NULL;
while ( (part=ped_disk_next_partition(disk,part))!=NULL){
if(part->type==PED_PARTITION_FREESPACE){
#ifdef DEBUG_NPARTED
sprintf(ptrb,"mirando particion free (%Ld,%Ld) ",
part->geom.start,part->geom.end);
ped_exception_throw(PED_EXCEPTION_ERROR,
PED_EXCEPTION_OK,
ptrb);
ped_exception_catch();
#endif
if ( part->geom.start==part->geom.end) continue;
new=(strech*)NP_malloc(sizeof(strech));
new->start=part->geom.start;
new->end=part->geom.end;
new->next=NULL;
if(list_strech==NULL){
list_strech=new;
p=new;
}else{
p->next=new;
p=new;
}
}
/* esto ya es un poco más chungo,hay que sacar a pelo los trozos
* libres elinando del pedazo de la particion extendida los trozos
* que ya son particiones lógicas*/
if(part->type==PED_PARTITION_EXTENDED &&part->num!=-1){
if (extend!=NULL){
ped_exception_throw(PED_EXCEPTION_ERROR,
PED_EXCEPTION_OK,
_("Can't have two parts extended in one disk"));
ped_exception_catch();
goto error_disk_close;
}
extend=(strech*)NP_malloc(sizeof(strech));
extend->start=part->geom.start+63;/*Por ser extendida los primeros
63 sectores son ocupados*/
extend->end=part->geom.end;
extend->next=NULL;
if(list_strech==NULL){
list_strech=extend;
p=extend;
}else{
p->next=extend;
p=extend;
}
}
/* Eliminamos estos trozos de la particion extendida, primero buscamos
* el trozo al cual pertencemos y lo dividimos en dos( antes y despues
* de la partición lógica, suponemos que libparted nos las da ordenadas*/
if(part->type==PED_PARTITION_LOGICAL){
walk=extend;
while (walk!=NULL){
#ifdef DEBUG_NPARTED
sprintf(ptrb,"miando si (%Ld,%Ld) está dentro de (%Ld,%Ld)",
part->geom.start,part->geom.end,walk->start,walk->end);
ped_exception_throw(PED_EXCEPTION_ERROR,
PED_EXCEPTION_OK,
ptrb);
ped_exception_catch();
#endif
if (BETWEEN(part->geom.start,walk->start,walk->end) ){
#ifdef DEBUG_NPARTED
ped_exception_throw(PED_EXCEPTION_ERROR,
PED_EXCEPTION_OK,
"Si estaba");
ped_exception_catch();
#endif
new=(strech*)NP_malloc(sizeof(strech));
new->start=part->geom.end+64;
new->end=walk->end;
walk->end=part->geom.start-1;
/* introucimos en la lista general */
new->next=walk->next;
walk->next=new;
if(new->next==NULL)
p=new;
break;
}
walk=walk->next;
}
}
}
p=list_strech;
while(p){
if(p->start<p->end){
sprintf(ptrb,"%Ld<=>%Ld",SEC2CIL(dev,p->start),SEC2CIL(dev,p->end));
newtListboxAppendEntry(free_list,ptrb,p);
}
new =p;
p=p->next;
}
/* Ya tenemos en list_strech la lista de todos los huecos libres */
ped_disk_close(disk);
return 1;
error_disk_close:
ped_disk_close(disk);
error:
return 0;
}
static int grow_strech(PedDevice *dev,strech *tramo){
PedPartition *part;
PedDisk *disk=ped_disk_open(dev);
disk=ped_disk_open(dev);
if(!disk) goto error;
part=NULL;
part=ped_disk_get_partition_by_sector(disk, tramo->start);
if (part!=NULL){
tramo->end=part->geom.end;
ped_disk_close(disk);
return 1;
}
ped_disk_close(disk);
return 0;
error:
return 0;
}
static int check_strech(PedDevice *dev, strech *tramo){
PedPartition *part;
PedDisk *disk;
disk=ped_disk_open(dev);
if(!disk) goto error;
part=NULL;
part=ped_disk_get_partition_by_sector(disk, tramo->start);
if (part==NULL) goto error_close_disk;
if (part->type!=PED_PARTITION_LOGICAL&&part->type!=PED_PARTITION_PRIMARY){
part=ped_disk_get_partition_by_sector(disk, tramo->end);
if (part->type!=PED_PARTITION_LOGICAL&&part->type!=PED_PARTITION_PRIMARY){
ped_disk_close(disk);
return 1;
}
}
error_close_disk:
ped_disk_close(disk);
return 0;
error:
return 0;
}
int add_partition ( PedDevice *dev ){
newtComponent form,grow,inicio,fin, tam,fs,sel_fs,free_list,ok,cancel,ans,dofs,sel_ptype,ptype;
char fs_type[20];
PedSector tamano;
strech *ptramo,*tramo,p;
char part_type;
int ret,salir=0;
/* ******************************************************************** *
* INTERFAZ *
* ******************************************************************** */
tramo=&p;
sprintf(ptrb,_("Adding a part to %s"),dev->path);
newtCenteredWindow(mainwin_size.width, mainwin_size.height, ptrb);
form=newtForm(NULL,NULL,0);
free_list=newtListbox(5,3,10,NEWT_FLAG_SCROLL|NEWT_FLAG_RETURNEXIT);
newtListboxSetWidth(free_list,27);
do_list_free(dev, free_list);
grow=newtCheckbox(mainwin_size.width-42,2,_("Growable"),' ',NULL,NULL);
dofs=newtCheckbox(mainwin_size.width-42,4,_("Do fyle sistem"),' ',NULL,NULL);
sel_ptype=newtCompactButton(mainwin_size.width-42,8,_("Select partition type"));
ptype=newtLabel(mainwin_size.width-15,8,"Primary");
part_type='p';
inicio=newtEntry(mainwin_size.width-15,2,NULL,10,NULL,NEWT_ENTRY_SCROLL
|NEWT_FLAG_RETURNEXIT);
fin=newtEntry(mainwin_size.width-15,4,NULL,10,NULL,NEWT_ENTRY_SCROLL
|NEWT_FLAG_RETURNEXIT);
tam=newtEntry(mainwin_size.width-15,6,NULL,10,NULL,NEWT_ENTRY_SCROLL
|NEWT_FLAG_RETURNEXIT);
sel_fs=newtCompactButton(mainwin_size.width-42,10,_("Select file system"));
fs=newtLabel(mainwin_size.width-15,10,"ext2");
ok=newtButton(5,16,_("Create"));
cancel=newtButton(mainwin_size.width-30,16,_("Cancel"));
newtFormAddComponents(form,
free_list, newtLabel(6,2,_("free strechs")),
grow,dofs,
inicio, newtLabel(mainwin_size.width-23,2,_("Start")),
newtLabel(mainwin_size.width-5,2,_(" Cil.")),
fin, newtLabel(mainwin_size.width-23,4,_("End")),
newtLabel(mainwin_size.width-5,4,_(" Cil.")),
newtLabel(mainwin_size.width-5,4,_(" Cil.")),
tam, newtLabel(mainwin_size.width-23,6,_("Size")),
newtLabel(mainwin_size.width-5,6,_(" Mb")),
fs,sel_fs,ok,cancel,sel_ptype,ptype,NULL);
strcpy(fs_type,"ext2");
/* ************************************************************ *
* PROCESS *
* ************************************************************ */
do{
ans=newtRunForm(form);
if(ans==sel_ptype){
part_type=select_partition_type();
switch (part_type){
case 'p': newtLabelSetText(ptype,_("Primary"));
break;
case 'e': newtLabelSetText(ptype,_("Extend"));
break;
case 'l': newtLabelSetText(ptype,_("Logic"));
break;
}
}
if(ans==sel_fs){
char *aux;
aux=select_file_system();
if(aux!=NULL){
strcpy(fs_type,aux);
newtLabelSetText(fs,fs_type);
}
}
if(ans==ok){
tramo->start=is_sector_valid(newtEntryGetValue(inicio));
tramo->end=is_sector_valid(newtEntryGetValue(fin));
if (tramo->start==-1||tramo->end==-1){
ped_exception_throw(PED_EXCEPTION_ERROR,
PED_EXCEPTION_OK,
_("a number is needed"));
ped_exception_catch();
newtEntrySet(fin,"",1);
newtEntrySet(inicio,"",1);
newtEntrySet(tam,"",1);
continue;
}
tramo->start=CIL2SEC(dev,tramo->start);
if (tramo->start<64) tramo->start=64;
tramo->end=CIL2SEC(dev,tramo->end+1)-1;
/* No nos podemos ir fuera del disco */
if (tramo->end>=dev->length-1) tramo->end=dev->length-1;
if (newtCheckboxGetValue(grow)=='*'){
grow_strech(dev,tramo);
}
/* Miramos si el tramo pedido está disponible */
if(!check_strech(dev,tramo)){
ped_exception_throw(PED_EXCEPTION_ERROR,
PED_EXCEPTION_OK,
_("Out limits"));
ped_exception_catch();
newtEntrySet(fin,"",1);
newtEntrySet(inicio,"",1);
newtEntrySet(tam,"",1);
continue;
}
if (part_type=='e'&& newtCheckboxGetValue(dofs)=='*'){
ped_exception_throw(PED_EXCEPTION_ERROR,
PED_EXCEPTION_OK,
_("I can't do filesystem on a extended partition"));
ped_exception_catch();
continue;
}
/* Pedimos confirmacion*/
sprintf(ptrb,_("Are you sure create in %s a %c partition of type %s from %Ld to %Ld?")
,dev->path,part_type,fs_type,tramo->start, tramo->end);
if(ped_exception_throw(PED_EXCEPTION_INFORMATION,
PED_EXCEPTION_YES|PED_EXCEPTION_NO,
ptrb)==PED_EXCEPTION_NO){
ped_exception_catch();
continue;
}
/*Creamos la partición */
if (newtCheckboxGetValue(dofs)=='*'){
ret=do_mkpartfs(&dev,part_type,fs_type,
tramo->start, tramo->end);
if (!ret) goto error;
salir=1;
} else{
ret=do_mkpart(&dev,part_type,fs_type,
tramo->start, tramo->end);
if (!ret) goto error;
salir=1;
}
}
if(ans==cancel){
salir=1;
}
if(ans==free_list){
ptramo=newtListboxGetCurrent(free_list);
sprintf(ptrb,"%Ld",SEC2CIL(dev,ptramo->start));
newtEntrySet(inicio,ptrb,1);
sprintf(ptrb,"%Ld",SEC2CIL(dev,ptramo->end));
newtEntrySet(fin,ptrb,1);
sprintf(ptrb,"%d", (int)SEC2MB(ptramo->end - ptramo->start+1));
newtEntrySet(tam,ptrb,1);
}
if(ans==inicio||ans==fin){
tramo->start=is_sector_valid(newtEntryGetValue(inicio));
tramo->end=is_sector_valid(newtEntryGetValue(fin));
if (tramo->start==-1||tramo->end==-1){
ped_exception_throw(PED_EXCEPTION_ERROR,
PED_EXCEPTION_OK,
_("a number is needed"));
ped_exception_catch();
newtEntrySet(fin,"",1);
newtEntrySet(inicio,"",1);
newtEntrySet(tam,"",1);
}else{
tramo->start=CIL2SEC(dev,tramo->start);
if (tramo->start<64) tramo->start=64;
tramo->end=CIL2SEC(dev,tramo->end+1)-1;
if(!check_strech(dev,tramo)){
ped_exception_throw(PED_EXCEPTION_ERROR,
PED_EXCEPTION_OK,
_("Out limits"));
ped_exception_catch();
newtEntrySet(fin,"",1);
newtEntrySet(inicio,"",1);
newtEntrySet(tam,"",1);
}else{
sprintf(ptrb,"%d", (int)SEC2MB((tramo->end-tramo->start+1)));
newtEntrySet(tam,ptrb,1);
}
}
}
if(ans==tam){
tramo->start=is_sector_valid(newtEntryGetValue(inicio));
tamano=is_sector_valid(newtEntryGetValue(tam));
if (tramo->start==-1|| tamano==-1){
ped_exception_throw(PED_EXCEPTION_ERROR,
PED_EXCEPTION_OK,
_("a number is needed"));
ped_exception_catch();
}else{
tramo->start=CIL2SEC(dev,tramo->start);
if (tramo->start<64) tramo->start=64;
tramo->end=MB2SEC(tamano)+tramo->start;
if(!check_strech(dev,tramo)){
ped_exception_throw(PED_EXCEPTION_ERROR,
PED_EXCEPTION_OK,
_("Out limits"));
ped_exception_catch();
newtEntrySet(fin,"",1);
newtEntrySet(inicio,"",1);
newtEntrySet(tam,"",1);
}else{
sprintf(ptrb,"%d", (int)SEC2CIL(dev,tramo->end));
newtEntrySet(fin,ptrb,1);
}
}
}
newtListboxClear(free_list);
do_list_free(dev, free_list);
}while(!salir);
error:
newtFormDestroy(form);
newtPopWindow();
return 0;
}

5
confdefs.h Normal file
View file

@ -0,0 +1,5 @@
#define PACKAGE "nparted"
#define VERSION "0.1"
#define HAVE_LIBNEWT 1
#define HAVE_LIBUUID 1

0
config.cache Normal file
View file

41
config.log Normal file
View file

@ -0,0 +1,41 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
configure:562: checking for a BSD compatible install
configure:615: checking whether build environment is sane
configure:672: checking whether make sets ${MAKE}
configure:718: checking for working aclocal
configure:731: checking for working autoconf
configure:744: checking for working automake
configure:757: checking for working autoheader
configure:770: checking for working makeinfo
configure:789: checking for gcc
configure:902: checking whether the C compiler (gcc ) works
configure:918: gcc -o conftest conftest.c 1>&5
configure:915:1: warning: return type defaults to 'int' [-Wimplicit-int]
main(){return(0);}
^~~~
configure:944: checking whether the C compiler (gcc ) is a cross-compiler
configure:949: checking whether we are using GNU C
configure:958: gcc -E conftest.c
configure:977: checking whether gcc accepts -g
configure:1010: checking for newtInit in -lnewt
configure:1029: gcc -o conftest -g -O2 conftest.c -lnewt 1>&5
configure:1061: checking for uuid_generate in -luuid
configure:1080: gcc -o conftest -g -O2 conftest.c -luuid -lnewt 1>&5
configure:1112: checking for ped_init in -lparted
configure:1131: gcc -o conftest -g -O2 conftest.c -lparted -luuid -lnewt 1>&5
/home/linuxbrew/.linuxbrew/bin/ld: /tmp/cc00UG3u.o: in function `main':
/home/joachim/nparted-0.1/configure:1127: undefined reference to `ped_init'
collect2: error: ld returned 1 exit status
configure: failed program was:
#line 1120 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char ped_init();
int main() {
ped_init()
; return 0; }

3863
configure vendored Executable file

File diff suppressed because it is too large Load diff

89
configure.in Normal file
View file

@ -0,0 +1,89 @@
AC_INIT(nparted.h)
AM_INIT_AUTOMAKE(nparted,0.1)
#AM_CONFIG_HEADER(config.h)
dnl Checks for programs.
AC_PROG_CC
dnl Checks for libraries.
dnl Replace `main' with a function in -lnewt:
AC_CHECK_LIB(newt, newtInit,,
AC_MSG_ERROR(
GNU nparted requires libnewt
)
exit
)
AC_CHECK_LIB(uuid, uuid_generate,,
AC_MSG_ERROR(
GNU nparted requires libuuid
)
exit
)
dnl Replace `main' with a function in -lparted:
AC_CHECK_LIB(parted, ped_init,,
AC_MSG_ERROR(
GNU nparted requires libparted
)
exit
)
dnl Checks for i18n
ALL_LINGUAS="es es_ES"
AM_GNU_GETTEXT
CFLAGS="$CFLAGS -DLOCALEDIR=\"\\\"$datadir/locale\\\"\""
if test "$USE_INCLUDED_LIBINTL" = "yes"; then
AC_MSG_ERROR(
GNU nparted requires gettext to be intsalled for compilation -
if native language suppor is desired. Either disable native language
suppor with:
$ ./configure --disable-nls
)
exit
fi
AC_SUBST(INTLINCS)
dnl Checks for header files.
AC_HEADER_STDC
dnl quizás no haga falta
AC_CHECK_HEADER(uuid/uuid.h,,
AC_MSG_ERROR(
You need libuuid includes
)
exit
)
AC_CHECK_HEADER(parted/parted.h,,
AC_MSG_ERROR(
You need libparted includes
)
exit
)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
dnl Checks for library functions.
if test x$USE_NLS = xyes; then
AC_CHECK_HEADERS(wctype.h, ,
AC_MSG_ERROR(
One or more of the header files that are required for
native language support (wctype.h) could not be found. Either get a newer
version of GNU libc and its headers - which can be obtained from:
ftp.gnu.org/gnu/glibc
Or disable native language support with the --disable-nls option
)
exit
)
fi
CFLAGS="$CFLAGS -W -Wall"
AC_OUTPUT(Makefile po/Makefile.in intl/Makefile )

33
copy_partition.c Normal file
View file

@ -0,0 +1,33 @@
/*
nparted - a frontend to libparted for manipulating disk partitions
thinked to dbootstrap
Copyright (C) 1998-2000 Mario Teijeiro Otero Esteve Fernández
Jaime Villate La Espiral
Mario Teijeiro Otero <asimovi@teleline.es>
Esteve Fernández < esteve@crosswinds.net >
Jaime Villate <villate@fe.up.pt>
La Espiral http://www.laespiral.org
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
*/
#include "nparted.h"
int copy_partition ( PedDevice *dev, int npart )
{
return 1;
}

39
del_partition.c Normal file
View file

@ -0,0 +1,39 @@
/*
nparted - a frontend to libparted for manipulating disk partitions
thinked to dbootstrap
Copyright (C) 1998-2000 Mario Teijeiro Otero Esteve Fernández
Jaime Villate La Espiral
Mario Teijeiro Otero <asimovi@teleline.es>
Esteve Fernández < esteve@crosswinds.net >
Jaime Villate <villate@fe.up.pt>
La Espiral http://www.laespiral.org
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
*/
#include "nparted.h"
int del_partition( PedDevice *dev, int npart)
{
sprintf (ptrb,_("Are you sure that you del %s%-2d partition?"),
dev->path, npart);
if(ped_exception_throw (PED_EXCEPTION_INFORMATION,
PED_EXCEPTION_OK|PED_EXCEPTION_CANCEL,
ptrb)==PED_EXCEPTION_OK){
return do_rm(&dev,npart);
}
return 1;
}

366
edit_partition.c Normal file
View file

@ -0,0 +1,366 @@
/*
*
nparted - a frontend to libparted for manipulating disk partitions
thought to dbootstrap
Copyright (C) 1998-2000 Mario Teijeiro Otero Esteve Fernández
Jaime Villate La Espiral
Mario Teijeiro Otero <asimovi@teleline.es>
Esteve Fernández < esteve@crosswinds.net >
Jaime Villate <villate@fe.up.pt>
La Espiral http://www.laespiral.org
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
*/
/* Codigo a realizar cuando se edita una partición */
#include "nparted.h"
/* Joder que función tan grande, me parece que hay que particionarla
* valga la redundancia */
typedef struct _edit edit;
struct _edit{
newtComponent form,ok,cancel,grow,max,now,start,end,tamano,
start_now, start_min, end_now, end_max, tamano_now,
tamano_max, new,start_new,end_new,tamano_new,
sel_file_system, file_system,progress;
struct newtExitStruct toexit;
};
int init_form(edit *form,char *title){
newtCenteredWindow(mainwin_size.width,mainwin_size.height,title);
form->form=newtForm(NULL,NULL,0);
form->start= newtLabel( 1, 3,_("Start") );
form->end= newtLabel( 1, 5,_("End") );
form->tamano= newtLabel( 1, 7,_("Tamano") );
form->now= newtLabel(14, 1,_("Now") );
form->start_now= newtLabel(12, 3,"");
form->end_now= newtLabel(12, 5,"");
form->tamano_now= newtLabel(12, 7,"");
form->max= newtLabel(34, 1,_("Max."));
form->start_min= newtLabel(32, 3,"");
form->end_max= newtLabel(32, 5,"");
form->tamano_max= newtLabel(32, 7,"");
form->progress= newtScale(2, 14, mainwin_size.width-5,100);
form->new= newtLabel(52, 1,_("New geom"));
form->start_new= newtEntry(52, 3,NULL,10,NULL,NEWT_ENTRY_SCROLL
|NEWT_FLAG_RETURNEXIT);
form->end_new= newtEntry(52, 5,NULL,10,NULL,NEWT_ENTRY_SCROLL
|NEWT_FLAG_RETURNEXIT);
form->tamano_new= newtEntry(52, 7,NULL,10,NULL,NEWT_ENTRY_SCROLL
|NEWT_FLAG_RETURNEXIT);
form->grow=newtCheckbox(5,10,_("Grow too much posibble"),' ',NULL,NULL);
form->file_system=newtLabel(50,10,_("Without Filesystem"));
form->sel_file_system=newtButton(38,9,_("Select"));
form->ok=newtButton(10,mainwin_size.height-4,_("OK"));
form->cancel=newtButton(mainwin_size.width-20,mainwin_size.height-4,_("CANCEL"));
newtFormAddComponents(form->form,
form->now,form->max,form->start,form->start_now,form->start_min,
form->end,form->end_now,form->end_max,
form->tamano,form->tamano_now,form->tamano_max,
form->grow, form->ok,form->cancel,
form->new,form->start_new,form->end_new,form->tamano_new,
form->sel_file_system,form->file_system,form->progress,NULL);
newtFormAddHotKey(form->form,NEWT_KEY_LEFT);
newtFormAddHotKey(form->form,NEWT_KEY_RIGHT);
newtFormAddHotKey(form->form,NEWT_KEY_PGDN);
newtFormAddHotKey(form->form,NEWT_KEY_PGUP);
newtFormAddHotKey(form->form,(int)'');
/* Al parecer no se puede añadir keys a componentes, solo
a forms, si no da segment fault */
// newtFormAddHotKey(form->grow,(int)' ');
return 1;
}
typedef struct _disk_info disk_info;
struct _disk_info{
PedDevice *dev;
PedDisk *disk;
PedPartition *part;
PedGeometry* geom; /* Max geometry to grow*/
PedFileSystemType * fs_type;
PedConstraint* constraint;
int fs_name_changed;
};
int init_disk_info(disk_info *disk,PedDevice *dev,int npart)
{
if (dev==NULL){
ped_exception_throw(PED_EXCEPTION_ERROR,
PED_EXCEPTION_OK,
_("Device not valid"));
return 0;
}
disk->dev=dev;
disk->disk=ped_disk_open(disk->dev);
disk->constraint=ped_constraint_any(disk->disk);
disk->part=ped_disk_get_partition(disk->disk,npart);
disk->fs_name_changed=0;
if (disk->disk==NULL) goto error;
if (disk->part==NULL){
ped_exception_throw(PED_EXCEPTION_ERROR,
PED_EXCEPTION_OK,
_("Partition not valid"));
goto error_disk_close;
}
disk->fs_type=ped_file_system_probe(&(disk->part->geom));
disk->geom=ped_disk_get_max_partition_geometry(disk->disk, disk->part,disk->constraint);
if (disk->geom==NULL){
ped_exception_throw(PED_EXCEPTION_ERROR,
PED_EXCEPTION_OK,
_("I can't get de max partition's geometry"));
goto error_disk_close;
}
return 1;
error_disk_close:
ped_disk_close(disk->disk);
error:
return 0;
}
int fill_form(edit *form, disk_info *disk,strech *new_size)
{
if (disk->fs_type!=NULL && !disk->fs_name_changed){
newtLabelSetText(form->file_system,disk->fs_type->name);
}
sprintf(ptrb,"%d",(int)SEC2CIL(disk->dev,disk->part->geom.start));
newtLabelSetText(form->start_now,ptrb);
sprintf(ptrb,"%d",(int)SEC2CIL(disk->dev,disk->part->geom.end));
newtLabelSetText(form->end_now,ptrb);
sprintf(ptrb,"%d Mb", (int)SEC2MB((disk->part->geom.end-disk->part->geom.start+1)));
newtLabelSetText(form->tamano_now,ptrb);
sprintf(ptrb,"%d",(int)SEC2CIL(disk->dev,disk->geom->start));
newtLabelSetText(form->start_min,ptrb);
sprintf(ptrb,"%d",(int)SEC2CIL(disk->dev,disk->geom->end));
newtLabelSetText(form->end_max,ptrb);
sprintf(ptrb,"%d Mb", (int)SEC2MB((disk->geom->end-disk->geom->start+1)));
newtLabelSetText(form->tamano_max,ptrb);
newtScaleSet(form->progress,(100* (new_size->end))/disk->geom->end);
return 0;
}
int run_form(edit *form, disk_info *disk, int npart)
{
newtComponent answer;
char fs_name[256];
strech new_size;
int change_geom=0;
long tam;
int key;
new_size.start=disk->part->geom.start;
new_size.end=disk->part->geom.end;
answer=NULL;
strcpy(fs_name,"Without Filesystem");
do{
fill_form(form, disk,&new_size);
newtFormRun(form->form,&(form->toexit));
key=-1;
if(form->toexit.reason==NEWT_EXIT_COMPONENT)
answer=form->toexit.u.co;
else
key=form->toexit.u.key;
if (key==(int)' '){
new_size.end=disk->geom->end;
new_size.start=disk->geom->start;
if(new_size.end<disk->geom->start) new_size.end=disk->geom->start;
sprintf(ptrb,"%d",(int)SEC2CIL(disk->dev,new_size.end));
newtEntrySet(form->end_new,ptrb,1);
sprintf(ptrb,"%d",(int)SEC2CIL(disk->dev,new_size.start));
newtEntrySet(form->start_new,ptrb,1);
sprintf(ptrb,"%d", (int)SEC2MB( (new_size.end- new_size.start)));
newtEntrySet(form->tamano_new,ptrb,1);
}
if(answer==form->sel_file_system){
char *aux;
if(ped_exception_throw(PED_EXCEPTION_INFORMATION,
PED_EXCEPTION_OK|PED_EXCEPTION_CANCEL,
_("Change the file system will destroy any data")
)==PED_EXCEPTION_OK){
aux=select_file_system();
if(aux!=NULL){
strcpy(fs_name,aux);
newtLabelSetText(form->file_system,fs_name);
disk->fs_name_changed=1;
}
}
ped_exception_catch();
}
if(answer==form->start_new||answer==form->end_new){
change_geom=1;
new_size.start=is_sector_valid(newtEntryGetValue(form->start_new));
new_size.end=is_sector_valid(newtEntryGetValue(form->end_new));
if (new_size.start==-1||new_size.end==-1){
ped_exception_throw(PED_EXCEPTION_ERROR,
PED_EXCEPTION_OK,
_("a number is needed"));
ped_exception_catch();
newtEntrySet(form->end_new,"",1);
newtEntrySet(form->start_new,"",1);
newtEntrySet(form->tamano_new,"",1);
}else{
new_size.start=CIL2SEC(disk->dev,new_size.start);
if(new_size.start<64) new_size.start=64;
new_size.end=CIL2SEC(disk->dev,new_size.end+1)-1;
sprintf(ptrb,"%d", (int)SEC2MB( (new_size.end-
new_size.start)));
newtEntrySet(form->tamano_new,ptrb,1);
}
}
if (answer==form->tamano_new){
change_geom=1;
new_size.start=is_sector_valid(newtEntryGetValue(form->start_new));
tam=is_sector_valid(newtEntryGetValue(form->tamano_new));
if(new_size.start==-1||tam==-1){
ped_exception_throw(PED_EXCEPTION_ERROR,
PED_EXCEPTION_OK,
_("a number is needed"));
ped_exception_catch();
}else{
if(new_size.start==0) new_size.start=disk->part->geom.start;
new_size.end=MB2SEC((tam))+new_size.start;
sprintf(ptrb,"%d",(int)SEC2CIL(disk->dev,new_size.end));
newtEntrySet(form->end_new,ptrb,1);
sprintf(ptrb,"%d",(int)SEC2CIL(disk->dev,new_size.start));
newtEntrySet(form->start_new,ptrb,1);
}
}
if(answer==form->ok){
if (newtCheckboxGetValue(form->grow)=='*'){
new_size.start=disk->geom->start;
new_size.end=disk->geom->end;
change_geom=1;
}
if(ped_exception_throw(PED_EXCEPTION_INFORMATION,
PED_EXCEPTION_OK|PED_EXCEPTION_CANCEL,
_("Are you soure?")
)==PED_EXCEPTION_OK)
if(change_geom){
do_resize(&(disk->dev),npart,new_size.start,new_size.end);
}
if(strcmp(fs_name,"Without Filesystem"))
do_mkfs(&(disk->dev),npart,fs_name);
}
if(key==NEWT_KEY_PGDN){
new_size.end-=CIL2SEC(disk->dev,2);
if(new_size.end<disk->geom->start) new_size.end=disk->geom->start;
sprintf(ptrb,"%d",(int)SEC2CIL(disk->dev,new_size.end));
newtEntrySet(form->end_new,ptrb,1);
sprintf(ptrb,"%d",(int)SEC2CIL(disk->dev,new_size.start));
newtEntrySet(form->start_new,ptrb,1);
sprintf(ptrb,"%d", (int)SEC2MB( (new_size.end- new_size.start)));
newtEntrySet(form->tamano_new,ptrb,1);
}if(key==NEWT_KEY_PGUP){
new_size.end+=CIL2SEC(disk->dev,2);
if(new_size.end>disk->geom->end) new_size.end=disk->geom->end;
sprintf(ptrb,"%d",(int)SEC2CIL(disk->dev,new_size.end));
newtEntrySet(form->end_new,ptrb,1);
sprintf(ptrb,"%d",(int)SEC2CIL(disk->dev,new_size.start));
newtEntrySet(form->start_new,ptrb,1);
sprintf(ptrb,"%d", (int)SEC2MB( (new_size.end- new_size.start)));
newtEntrySet(form->tamano_new,ptrb,1);
}if(key==NEWT_KEY_LEFT){
new_size.end-=50;
if(new_size.end<disk->geom->start) new_size.end=disk->geom->start;
sprintf(ptrb,"%d",(int)SEC2CIL(disk->dev,new_size.end));
newtEntrySet(form->end_new,ptrb,1);
sprintf(ptrb,"%d",(int)SEC2CIL(disk->dev,new_size.start));
newtEntrySet(form->start_new,ptrb,1);
sprintf(ptrb,"%d", (int)SEC2MB( (new_size.end- new_size.start)));
newtEntrySet(form->tamano_new,ptrb,1);
}if(key==NEWT_KEY_RIGHT){
new_size.end+=50;
if(new_size.end>disk->geom->end) new_size.end=disk->geom->end;
sprintf(ptrb,"%d",(int)SEC2CIL(disk->dev,new_size.end));
newtEntrySet(form->end_new,ptrb,1);
sprintf(ptrb,"%d",(int)SEC2CIL(disk->dev,new_size.start));
newtEntrySet(form->start_new,ptrb,1);
sprintf(ptrb,"%d", (int)SEC2MB( (new_size.end- new_size.start)));
newtEntrySet(form->tamano_new,ptrb,1);
}
newtScaleSet(form->progress,(100*new_size.end)/disk->geom->end );
}while(key!=(int)'' && answer!=form->cancel && answer!=form->ok);
return 1;
}
int finalize_form(edit *form){
newtFormDestroy(form->form);
newtPopWindow();
return 1;
}
int finalize_disk(disk_info *disk)
{
ped_disk_close(disk->disk);
return 1;
}
int edit_partition (PedDevice *dev,int npart)
{
edit *form;
disk_info *disk;
form=(edit*)NP_malloc(sizeof(edit));
disk=(disk_info*)NP_malloc(sizeof(disk_info));
if(!init_disk_info(disk,dev,npart)){
/* La excepción se lanza desde dentro de init_disk_info*/
return 0;
}
sprintf(ptrb,_("Editing %s%d"),dev->path,npart);
/* Cuando se da a init_form por segunda vez da fallo */
init_form(form,ptrb);
/* Get some information */
run_form(form, disk,npart);
finalize_form(form);
finalize_disk(disk);
free(form);
free(disk);
return 1;
}

161
exception_manager.c Normal file
View file

@ -0,0 +1,161 @@
/*
nparted - a frontend to libparted for manipulating disk partitions
thinked to dbootstrap
Copyright (C) 1998-2000 Mario Teijeiro Otero Esteve Fernández
Jaime Villate La Espiral
Mario Teijeiro Otero <asimovi@teleline.es>
Esteve Fernández < esteve@crosswinds.net >
Jaime Villate <villate@fe.up.pt>
La Espiral http://www.laespiral.org
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
*/
#include <newt.h>
#include "nparted.h"
#include "exception_manager.h"
#undef _(A)
#define _(A) (A)
static char *names_exception_types[]={
_("You don't have seen this,report me"),
_("Information message"),
_("!!!----WARNING----!!!"),
_("!!!----ERROR----!!!"),
_("!!!----FATAL ERROR ----!!!"),
_("You has found a bug, please report me"),
_("Feature yet implemented"),
};
static button_option options[]={
{1, {_("FIX"),} , {PED_EXCEPTION_FIX,},{} },
{1, {_("YES"),}, {PED_EXCEPTION_YES,},{} },
{1, {_("NO"),}, {PED_EXCEPTION_NO,},{} },
{1, {_("OK"),}, {PED_EXCEPTION_OK,},{} },
{1, {_("RETRY"),}, {PED_EXCEPTION_RETRY,},{} },
{1, {_("IGNORE"),}, {PED_EXCEPTION_IGNORE,},{} },
{1, {_("CANCEL"),}, {PED_EXCEPTION_CANCEL,},{} },
{2, {_("OK"),_("CANCEL"),}, {PED_EXCEPTION_OK,PED_EXCEPTION_CANCEL,},{} },
{2, {_("YES"),_("NO"),}, {PED_EXCEPTION_YES,PED_EXCEPTION_NO,},{} },
{3, {_("YES"),_("NO"),_("CANCEL"),},{PED_EXCEPTION_YES,PED_EXCEPTION_NO,PED_EXCEPTION_CANCEL,},{}},
{2, {_("IGNORE"),_("CANCEL"),}, {PED_EXCEPTION_IGNORE,PED_EXCEPTION_CANCEL,},{} },
{2, {_("RETRY"),_("CANCEL"),}, {PED_EXCEPTION_RETRY,PED_EXCEPTION_CANCEL,},{} },
{3,{_("RETRY"),_("IGNORE"),_("CANCEL"),},{PED_EXCEPTION_RETRY,PED_EXCEPTION_IGNORE,PED_EXCEPTION_CANCEL,},{}}
};
/*PedExceptionOption*/int do_message_window(const char *title, char* message, button_option *list_buttons)
{
newtComponent form,text,button;
int i,x,y, size_button;
if (message==NULL){
text=newtTextboxReflowed(1,1,"Has encontrado un bug",54,5,5,0);
}else{
text=newtTextboxReflowed(1,1,message,54,5,5,0);
}
if (title==NULL){
newtCenteredWindow(60,newtTextboxGetNumLines(text)+7,_("Warning"));
}else{
newtCenteredWindow(60,newtTextboxGetNumLines(text)+7,title);
}
form=newtForm(NULL, NULL, 0);
newtFormAddComponent(form,text);
x=60/(list_buttons->num+1); /*separacion entre botones*/
y=newtTextboxGetNumLines(text)+2;
if (list_buttons==NULL) list_buttons=&options[3];
for (i=0; i<list_buttons->num; i++){
size_button=strlen(list_buttons->label[i])+5;
list_buttons->button[i]= newtButton(x*(i+1)-size_button/2,y,
list_buttons->label[i]);
newtFormAddComponent(form,list_buttons->button[i]);
}
button=newtRunForm(form);
for ( i =0; i <list_buttons->num; i++){
if (list_buttons->button[i]==button)
break;
}
/*En button tenemos el boton que hizo que saliésemos de la
* pantalla*/
newtFormDestroy(form);
newtPopWindow();
if (i<list_buttons->num)
return list_buttons->op2ret[i];
else
return PED_EXCEPTION_UNHANDLED;
}
/* Cuando Ped lanza una excepción, ésta puede ser de varios tipos
* PED_EXCEPTION_NO_FEATURE
* PED_EXCEPTION_INFORMATION -> info general
* PED_EXCEPTION_WARNING
* PED_EXCEPTION_ERROR
* PED_EXCEPTION_FATAL
* PED_EXCEPTION_BUG
* y ésta exceptión puede esperar los siguientes tipos de respuesta:
* UNHANDLED -> significa que la excepción on fue manejada
* FIX -> algo que todavía hay que implementar
* YES ->
* NO ->
* OK ->
* RETRY
* IGNORE
* CANCEL
* todos estas opciones están en exception como una ó lógica.
* Así solo tenemos que mostrar el mensaje y una cantidad de respuestas
* a esperar por el usuario.
*/
PedExceptionOption exception_handler( PedException* exception)
{
button_option *list_button;
switch (exception->options){
case PED_EXCEPTION_FIX:
list_button=&options[0];break;
case PED_EXCEPTION_YES:
list_button=&options[1];break;
case PED_EXCEPTION_NO:
list_button=&options[2];break;
case PED_EXCEPTION_OK:
list_button=&options[3];break;
case PED_EXCEPTION_RETRY:
list_button=&options[4];break;
case PED_EXCEPTION_IGNORE:
list_button=&options[5];break;
case PED_EXCEPTION_CANCEL:
list_button=&options[6];break;
case PED_EXCEPTION_OK_CANCEL:
list_button=&options[7];break;
case PED_EXCEPTION_YES_NO:
list_button=&options[8];break;
case PED_EXCEPTION_YES_NO_CANCEL:
list_button=&options[9];break;
case PED_EXCEPTION_IGNORE_CANCEL:
list_button=&options[10];break;
case PED_EXCEPTION_RETRY_CANCEL:
list_button=&options[11];break;
case PED_EXCEPTION_RETRY_IGNORE_CANCEL:
list_button=&options[12];break;
default:
list_button=&options[3];break;
}
return do_message_window(names_exception_types[exception->type],
exception->message,list_button);
}

59
exception_manager.h Normal file
View file

@ -0,0 +1,59 @@
/*
nparted - a frontend to libparted for manipulating disk partitions
thinked to dbootstrap
Copyright (C) 2000 Mario Teijeiro, Otero ,Esteve Fernández
Jaime Villate, La Espiral
Mario Teijeiro Otero <asimovi@teleline.es>
Esteve Fernández < esteve@crosswinds.net >
Jaime Villate <villate@fe.up.pt>
La Espiral http://www.laespiral.org
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
*/
#ifndef EXCEPTION_MANAGER_
#define EXCEPTION_MANAGER_
#include <parted/parted.h>
/*
#ifdef HAVE_NLS
# define _(strint) (gettext(string))
# ifdef HAVE_LIBINTL_H
# include <libintl.h>
# endif
#else
# define _(string) (string)
#endif
*/
#include <stdlib.h>
#include <parted/parted.h>
#include <newt.h>
typedef struct _button_option button_option;
#define MAX_OPTIONS 5
struct _button_option{
int num; /* Numero de botones */
char* label[MAX_OPTIONS];/* etiquetas de cada botón*/
/*PedExceptionOption*/int op2ret[MAX_OPTIONS];
newtComponent button[MAX_OPTIONS];/* botón que representa */
};
/* Saca una notificación, pregunta etc..., con los botones en list_buttons,
* que es la estructura de arriba, devuelve el valor de op2ret */
/*PedExceptionOption*/int do_message_window(const char *title,
char* message, button_option *list_buttons);
PedExceptionOption exception_handler( PedException* exception);
#endif

251
install-sh Executable file
View file

@ -0,0 +1,251 @@
#!/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

1086
intl/ChangeLog Normal file

File diff suppressed because it is too large Load diff

214
intl/Makefile.in Normal file
View file

@ -0,0 +1,214 @@
# Makefile for directory with message catalog handling in GNU NLS Utilities.
# Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
PACKAGE = @PACKAGE@
VERSION = @VERSION@
SHELL = /bin/sh
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = ..
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
transform = @program_transform_name@
libdir = $(exec_prefix)/lib
includedir = $(prefix)/include
datadir = $(prefix)/@DATADIRNAME@
localedir = $(datadir)/locale
gnulocaledir = $(prefix)/share/locale
gettextsrcdir = @datadir@/gettext/intl
aliaspath = $(localedir):.
subdir = intl
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
MKINSTALLDIRS = @MKINSTALLDIRS@
l = @l@
AR = ar
CC = @CC@
LIBTOOL = @LIBTOOL@
RANLIB = @RANLIB@
DEFS = -DLOCALEDIR=\"$(localedir)\" -DGNULOCALEDIR=\"$(gnulocaledir)\" \
-DLOCALE_ALIAS_PATH=\"$(aliaspath)\" @DEFS@
CPPFLAGS = @CPPFLAGS@
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
HEADERS = $(COMHDRS) libgettext.h loadinfo.h
COMHDRS = gettext.h gettextP.h hash-string.h
SOURCES = $(COMSRCS) intl-compat.c cat-compat.c
COMSRCS = bindtextdom.c dcgettext.c dgettext.c gettext.c \
finddomain.c loadmsgcat.c localealias.c textdomain.c l10nflist.c \
explodename.c
OBJECTS = @INTLOBJS@ bindtextdom.$lo dcgettext.$lo dgettext.$lo gettext.$lo \
finddomain.$lo loadmsgcat.$lo localealias.$lo textdomain.$lo l10nflist.$lo \
explodename.$lo
CATOBJS = cat-compat.$lo ../po/cat-id-tbl.$lo
GETTOBJS = intl-compat.$lo
DISTFILES.common = ChangeLog Makefile.in linux-msg.sed po2tbl.sed.in \
xopen-msg.sed $(HEADERS) $(SOURCES)
DISTFILES.normal = VERSION
DISTFILES.gettext = libintl.glibc intlh.inst.in
.SUFFIXES:
.SUFFIXES: .c .o .lo
.c.o:
$(COMPILE) $<
.c.lo:
$(LIBTOOL) --mode=compile $(COMPILE) $<
INCLUDES = -I.. -I. -I$(top_srcdir)/intl -I$(top_srcdir)/lib
all: all-@USE_INCLUDED_LIBINTL@
all-yes: libintl.$la intlh.inst
all-no:
libintl.a: $(OBJECTS)
rm -f $@
$(AR) cru $@ $(OBJECTS)
$(RANLIB) $@
libintl.la: $(OBJECTS)
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ $(OBJECTS) \
-version-info 1:0 -rpath $(libdir)
../po/cat-id-tbl.$lo: ../po/cat-id-tbl.c $(top_srcdir)/po/$(PACKAGE).pot
cd ../po && $(MAKE) cat-id-tbl.$lo
check: all
# This installation goal is only used in GNU gettext. Packages which
# only use the library should use install instead.
# We must not install the libintl.h/libintl.a files if we are on a
# system which has the gettext() function in its C library or in a
# separate library or use the catgets interface. A special case is
# where configure found a previously installed GNU gettext library.
# If you want to use the one which comes with this version of the
# package, you have to use `configure --with-included-gettext'.
install: install-exec install-data
install-exec: all
if test "$(PACKAGE)" = "gettext" \
&& test '@INTLOBJS@' = '$(GETTOBJS)'; then \
if test -r $(MKINSTALLDIRS); then \
$(MKINSTALLDIRS) $(libdir) $(includedir); \
else \
$(top_srcdir)/mkinstalldirs $(libdir) $(includedir); \
fi; \
$(INSTALL_DATA) intlh.inst $(includedir)/libintl.h; \
$(INSTALL_DATA) libintl.a $(libdir)/libintl.a; \
else \
: ; \
fi
install-data: all
if test "$(PACKAGE)" = "gettext"; then \
if test -r $(MKINSTALLDIRS); then \
$(MKINSTALLDIRS) $(gettextsrcdir); \
else \
$(top_srcdir)/mkinstalldirs $(gettextsrcdir); \
fi; \
$(INSTALL_DATA) VERSION $(gettextsrcdir)/VERSION; \
dists="$(DISTFILES.common)"; \
for file in $$dists; do \
$(INSTALL_DATA) $(srcdir)/$$file $(gettextsrcdir)/$$file; \
done; \
else \
: ; \
fi
# Define this as empty until I found a useful application.
installcheck:
uninstall:
dists="$(DISTFILES.common)"; \
for file in $$dists; do \
rm -f $(gettextsrcdir)/$$file; \
done
info dvi:
$(OBJECTS): ../config.h libgettext.h
bindtextdom.$lo finddomain.$lo loadmsgcat.$lo: gettextP.h gettext.h loadinfo.h
dcgettext.$lo: gettextP.h gettext.h hash-string.h loadinfo.h
tags: TAGS
TAGS: $(HEADERS) $(SOURCES)
here=`pwd`; cd $(srcdir) && etags -o $$here/TAGS $(HEADERS) $(SOURCES)
id: ID
ID: $(HEADERS) $(SOURCES)
here=`pwd`; cd $(srcdir) && mkid -f$$here/ID $(HEADERS) $(SOURCES)
mostlyclean:
rm -f *.a *.o *.lo core core.*
clean: mostlyclean
distclean: clean
rm -f Makefile ID TAGS po2msg.sed po2tbl.sed
maintainer-clean: distclean
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
# GNU gettext needs not contain the file `VERSION' but contains some
# other files which should not be distributed in other packages.
distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
dist distdir: Makefile $(DISTFILES)
if test "$(PACKAGE)" = gettext; then \
additional="$(DISTFILES.gettext)"; \
else \
additional="$(DISTFILES.normal)"; \
fi; \
for file in $(DISTFILES.common) $$additional; do \
ln $(srcdir)/$$file $(distdir) 2> /dev/null \
|| cp -p $(srcdir)/$$file $(distdir); \
done
dist-libc:
tar zcvf intl-glibc.tar.gz $(COMSRCS) $(COMHDRS) libintl.h.glibc
Makefile: Makefile.in ../config.status
cd .. \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
# The dependency for intlh.inst is different in gettext and all other
# packages. Because we cannot you GNU make features we have to solve
# the problem while rewriting Makefile.in.
@GT_YES@intlh.inst: intlh.inst.in ../config.status
@GT_YES@ cd .. \
@GT_YES@ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= \
@GT_YES@ $(SHELL) ./config.status
@GT_NO@.PHONY: intlh.inst
@GT_NO@intlh.inst:
# Tell versions [3.59,3.63) of GNU make not to export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

1
intl/VERSION Normal file
View file

@ -0,0 +1 @@
GNU gettext library from gettext-0.10.35

203
intl/bindtextdom.c Normal file
View file

@ -0,0 +1,203 @@
/* Implementation of the bindtextdomain(3) function
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#if defined STDC_HEADERS || defined _LIBC
# include <stdlib.h>
#else
# ifdef HAVE_MALLOC_H
# include <malloc.h>
# else
void free ();
# endif
#endif
#if defined HAVE_STRING_H || defined _LIBC
# include <string.h>
#else
# include <strings.h>
# ifndef memcpy
# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
# endif
#endif
#ifdef _LIBC
# include <libintl.h>
#else
# include "libgettext.h"
#endif
#include "gettext.h"
#include "gettextP.h"
/* @@ end of prolog @@ */
/* Contains the default location of the message catalogs. */
extern const char _nl_default_dirname[];
/* List with bindings of specific domains. */
extern struct binding *_nl_domain_bindings;
/* Names for the libintl functions are a problem. They must not clash
with existing names and they should follow ANSI C. But this source
code is also used in GNU C Library where the names have a __
prefix. So we have to make a difference here. */
#ifdef _LIBC
# define BINDTEXTDOMAIN __bindtextdomain
# ifndef strdup
# define strdup(str) __strdup (str)
# endif
#else
# define BINDTEXTDOMAIN bindtextdomain__
#endif
/* Specify that the DOMAINNAME message catalog will be found
in DIRNAME rather than in the system locale data base. */
char *
BINDTEXTDOMAIN (domainname, dirname)
const char *domainname;
const char *dirname;
{
struct binding *binding;
/* Some sanity checks. */
if (domainname == NULL || domainname[0] == '\0')
return NULL;
for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next)
{
int compare = strcmp (domainname, binding->domainname);
if (compare == 0)
/* We found it! */
break;
if (compare < 0)
{
/* It is not in the list. */
binding = NULL;
break;
}
}
if (dirname == NULL)
/* The current binding has be to returned. */
return binding == NULL ? (char *) _nl_default_dirname : binding->dirname;
if (binding != NULL)
{
/* The domain is already bound. If the new value and the old
one are equal we simply do nothing. Otherwise replace the
old binding. */
if (strcmp (dirname, binding->dirname) != 0)
{
char *new_dirname;
if (strcmp (dirname, _nl_default_dirname) == 0)
new_dirname = (char *) _nl_default_dirname;
else
{
#if defined _LIBC || defined HAVE_STRDUP
new_dirname = strdup (dirname);
if (new_dirname == NULL)
return NULL;
#else
size_t len = strlen (dirname) + 1;
new_dirname = (char *) malloc (len);
if (new_dirname == NULL)
return NULL;
memcpy (new_dirname, dirname, len);
#endif
}
if (binding->dirname != _nl_default_dirname)
free (binding->dirname);
binding->dirname = new_dirname;
}
}
else
{
/* We have to create a new binding. */
#if !defined _LIBC && !defined HAVE_STRDUP
size_t len;
#endif
struct binding *new_binding =
(struct binding *) malloc (sizeof (*new_binding));
if (new_binding == NULL)
return NULL;
#if defined _LIBC || defined HAVE_STRDUP
new_binding->domainname = strdup (domainname);
if (new_binding->domainname == NULL)
return NULL;
#else
len = strlen (domainname) + 1;
new_binding->domainname = (char *) malloc (len);
if (new_binding->domainname == NULL)
return NULL;
memcpy (new_binding->domainname, domainname, len);
#endif
if (strcmp (dirname, _nl_default_dirname) == 0)
new_binding->dirname = (char *) _nl_default_dirname;
else
{
#if defined _LIBC || defined HAVE_STRDUP
new_binding->dirname = strdup (dirname);
if (new_binding->dirname == NULL)
return NULL;
#else
len = strlen (dirname) + 1;
new_binding->dirname = (char *) malloc (len);
if (new_binding->dirname == NULL)
return NULL;
memcpy (new_binding->dirname, dirname, len);
#endif
}
/* Now enqueue it. */
if (_nl_domain_bindings == NULL
|| strcmp (domainname, _nl_domain_bindings->domainname) < 0)
{
new_binding->next = _nl_domain_bindings;
_nl_domain_bindings = new_binding;
}
else
{
binding = _nl_domain_bindings;
while (binding->next != NULL
&& strcmp (domainname, binding->next->domainname) > 0)
binding = binding->next;
new_binding->next = binding->next;
binding->next = new_binding;
}
binding = new_binding;
}
return binding->dirname;
}
#ifdef _LIBC
/* Alias for function name in GNU C Library. */
weak_alias (__bindtextdomain, bindtextdomain);
#endif

262
intl/cat-compat.c Normal file
View file

@ -0,0 +1,262 @@
/* Compatibility code for gettext-using-catgets interface.
Copyright (C) 1995, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#ifdef STDC_HEADERS
# include <stdlib.h>
# include <string.h>
#else
char *getenv ();
# ifdef HAVE_MALLOC_H
# include <malloc.h>
# endif
#endif
#ifdef HAVE_NL_TYPES_H
# include <nl_types.h>
#endif
#include "libgettext.h"
/* @@ end of prolog @@ */
/* XPG3 defines the result of `setlocale (category, NULL)' as:
``Directs `setlocale()' to query `category' and return the current
setting of `local'.''
However it does not specify the exact format. And even worse: POSIX
defines this not at all. So we can use this feature only on selected
system (e.g. those using GNU C Library). */
#ifdef _LIBC
# define HAVE_LOCALE_NULL
#endif
/* The catalog descriptor. */
static nl_catd catalog = (nl_catd) -1;
/* Name of the default catalog. */
static const char default_catalog_name[] = "messages";
/* Name of currently used catalog. */
static const char *catalog_name = default_catalog_name;
/* Get ID for given string. If not found return -1. */
static int msg_to_cat_id PARAMS ((const char *msg));
/* Substitution for systems lacking this function in their C library. */
#if !_LIBC && !HAVE_STPCPY
static char *stpcpy PARAMS ((char *dest, const char *src));
#endif
/* Set currently used domain/catalog. */
char *
textdomain (domainname)
const char *domainname;
{
nl_catd new_catalog;
char *new_name;
size_t new_name_len;
char *lang;
#if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES \
&& defined HAVE_LOCALE_NULL
lang = setlocale (LC_MESSAGES, NULL);
#else
lang = getenv ("LC_ALL");
if (lang == NULL || lang[0] == '\0')
{
lang = getenv ("LC_MESSAGES");
if (lang == NULL || lang[0] == '\0')
lang = getenv ("LANG");
}
#endif
if (lang == NULL || lang[0] == '\0')
lang = "C";
/* See whether name of currently used domain is asked. */
if (domainname == NULL)
return (char *) catalog_name;
if (domainname[0] == '\0')
domainname = default_catalog_name;
/* Compute length of added path element. */
new_name_len = sizeof (LOCALEDIR) - 1 + 1 + strlen (lang)
+ sizeof ("/LC_MESSAGES/") - 1 + sizeof (PACKAGE) - 1
+ sizeof (".cat");
new_name = (char *) malloc (new_name_len);
if (new_name == NULL)
return NULL;
strcpy (new_name, PACKAGE);
new_catalog = catopen (new_name, 0);
if (new_catalog == (nl_catd) -1)
{
/* NLSPATH search didn't work, try absolute path */
sprintf (new_name, "%s/%s/LC_MESSAGES/%s.cat", LOCALEDIR, lang,
PACKAGE);
new_catalog = catopen (new_name, 0);
if (new_catalog == (nl_catd) -1)
{
free (new_name);
return (char *) catalog_name;
}
}
/* Close old catalog. */
if (catalog != (nl_catd) -1)
catclose (catalog);
if (catalog_name != default_catalog_name)
free ((char *) catalog_name);
catalog = new_catalog;
catalog_name = new_name;
return (char *) catalog_name;
}
char *
bindtextdomain (domainname, dirname)
const char *domainname;
const char *dirname;
{
#if HAVE_SETENV || HAVE_PUTENV
char *old_val, *new_val, *cp;
size_t new_val_len;
/* This does not make much sense here but to be compatible do it. */
if (domainname == NULL)
return NULL;
/* Compute length of added path element. If we use setenv we don't need
the first byts for NLSPATH=, but why complicate the code for this
peanuts. */
new_val_len = sizeof ("NLSPATH=") - 1 + strlen (dirname)
+ sizeof ("/%L/LC_MESSAGES/%N.cat");
old_val = getenv ("NLSPATH");
if (old_val == NULL || old_val[0] == '\0')
{
old_val = NULL;
new_val_len += 1 + sizeof (LOCALEDIR) - 1
+ sizeof ("/%L/LC_MESSAGES/%N.cat");
}
else
new_val_len += strlen (old_val);
new_val = (char *) malloc (new_val_len);
if (new_val == NULL)
return NULL;
# if HAVE_SETENV
cp = new_val;
# else
cp = stpcpy (new_val, "NLSPATH=");
# endif
cp = stpcpy (cp, dirname);
cp = stpcpy (cp, "/%L/LC_MESSAGES/%N.cat:");
if (old_val == NULL)
{
# if __STDC__
stpcpy (cp, LOCALEDIR "/%L/LC_MESSAGES/%N.cat");
# else
cp = stpcpy (cp, LOCALEDIR);
stpcpy (cp, "/%L/LC_MESSAGES/%N.cat");
# endif
}
else
stpcpy (cp, old_val);
# if HAVE_SETENV
setenv ("NLSPATH", new_val, 1);
free (new_val);
# else
putenv (new_val);
/* Do *not* free the environment entry we just entered. It is used
from now on. */
# endif
#endif
return (char *) domainname;
}
#undef gettext
char *
gettext (msg)
const char *msg;
{
int msgid;
if (msg == NULL || catalog == (nl_catd) -1)
return (char *) msg;
/* Get the message from the catalog. We always use set number 1.
The message ID is computed by the function `msg_to_cat_id'
which works on the table generated by `po-to-tbl'. */
msgid = msg_to_cat_id (msg);
if (msgid == -1)
return (char *) msg;
return catgets (catalog, 1, msgid, (char *) msg);
}
/* Look through the table `_msg_tbl' which has `_msg_tbl_length' entries
for the one equal to msg. If it is found return the ID. In case when
the string is not found return -1. */
static int
msg_to_cat_id (msg)
const char *msg;
{
int cnt;
for (cnt = 0; cnt < _msg_tbl_length; ++cnt)
if (strcmp (msg, _msg_tbl[cnt]._msg) == 0)
return _msg_tbl[cnt]._msg_number;
return -1;
}
/* @@ begin of epilog @@ */
/* We don't want libintl.a to depend on any other library. So we
avoid the non-standard function stpcpy. In GNU C Library this
function is available, though. Also allow the symbol HAVE_STPCPY
to be defined. */
#if !_LIBC && !HAVE_STPCPY
static char *
stpcpy (dest, src)
char *dest;
const char *src;
{
while ((*dest++ = *src++) != '\0')
/* Do nothing. */ ;
return dest - 1;
}
#endif

624
intl/dcgettext.c Normal file
View file

@ -0,0 +1,624 @@
/* Implementation of the dcgettext(3) function.
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <sys/types.h>
#ifdef __GNUC__
# define alloca __builtin_alloca
# define HAVE_ALLOCA 1
#else
# if defined HAVE_ALLOCA_H || defined _LIBC
# include <alloca.h>
# else
# ifdef _AIX
#pragma alloca
# else
# ifndef alloca
char *alloca ();
# endif
# endif
# endif
#endif
#include <errno.h>
#ifndef errno
extern int errno;
#endif
#ifndef __set_errno
# define __set_errno(val) errno = (val)
#endif
#if defined STDC_HEADERS || defined _LIBC
# include <stdlib.h>
#else
char *getenv ();
# ifdef HAVE_MALLOC_H
# include <malloc.h>
# else
void free ();
# endif
#endif
#if defined HAVE_STRING_H || defined _LIBC
# ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
# endif
# include <string.h>
#else
# include <strings.h>
#endif
#if !HAVE_STRCHR && !defined _LIBC
# ifndef strchr
# define strchr index
# endif
#endif
#if defined HAVE_UNISTD_H || defined _LIBC
# include <unistd.h>
#endif
#include "gettext.h"
#include "gettextP.h"
#ifdef _LIBC
# include <libintl.h>
#else
# include "libgettext.h"
#endif
#include "hash-string.h"
/* @@ end of prolog @@ */
#ifdef _LIBC
/* Rename the non ANSI C functions. This is required by the standard
because some ANSI C functions will require linking with this object
file and the name space must not be polluted. */
# define getcwd __getcwd
# ifndef stpcpy
# define stpcpy __stpcpy
# endif
#else
# if !defined HAVE_GETCWD
char *getwd ();
# define getcwd(buf, max) getwd (buf)
# else
char *getcwd ();
# endif
# ifndef HAVE_STPCPY
static char *stpcpy PARAMS ((char *dest, const char *src));
# endif
#endif
/* Amount to increase buffer size by in each try. */
#define PATH_INCR 32
/* The following is from pathmax.h. */
/* Non-POSIX BSD systems might have gcc's limits.h, which doesn't define
PATH_MAX but might cause redefinition warnings when sys/param.h is
later included (as on MORE/BSD 4.3). */
#if defined(_POSIX_VERSION) || (defined(HAVE_LIMITS_H) && !defined(__GNUC__))
# include <limits.h>
#endif
#ifndef _POSIX_PATH_MAX
# define _POSIX_PATH_MAX 255
#endif
#if !defined(PATH_MAX) && defined(_PC_PATH_MAX)
# define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 : pathconf ("/", _PC_PATH_MAX))
#endif
/* Don't include sys/param.h if it already has been. */
#if defined(HAVE_SYS_PARAM_H) && !defined(PATH_MAX) && !defined(MAXPATHLEN)
# include <sys/param.h>
#endif
#if !defined(PATH_MAX) && defined(MAXPATHLEN)
# define PATH_MAX MAXPATHLEN
#endif
#ifndef PATH_MAX
# define PATH_MAX _POSIX_PATH_MAX
#endif
/* XPG3 defines the result of `setlocale (category, NULL)' as:
``Directs `setlocale()' to query `category' and return the current
setting of `local'.''
However it does not specify the exact format. And even worse: POSIX
defines this not at all. So we can use this feature only on selected
system (e.g. those using GNU C Library). */
#ifdef _LIBC
# define HAVE_LOCALE_NULL
#endif
/* Name of the default domain used for gettext(3) prior any call to
textdomain(3). The default value for this is "messages". */
const char _nl_default_default_domain[] = "messages";
/* Value used as the default domain for gettext(3). */
const char *_nl_current_default_domain = _nl_default_default_domain;
/* Contains the default location of the message catalogs. */
const char _nl_default_dirname[] = GNULOCALEDIR;
/* List with bindings of specific domains created by bindtextdomain()
calls. */
struct binding *_nl_domain_bindings;
/* Prototypes for local functions. */
static char *find_msg PARAMS ((struct loaded_l10nfile *domain_file,
const char *msgid)) internal_function;
static const char *category_to_name PARAMS ((int category)) internal_function;
static const char *guess_category_value PARAMS ((int category,
const char *categoryname))
internal_function;
/* For those loosing systems which don't have `alloca' we have to add
some additional code emulating it. */
#ifdef HAVE_ALLOCA
/* Nothing has to be done. */
# define ADD_BLOCK(list, address) /* nothing */
# define FREE_BLOCKS(list) /* nothing */
#else
struct block_list
{
void *address;
struct block_list *next;
};
# define ADD_BLOCK(list, addr) \
do { \
struct block_list *newp = (struct block_list *) malloc (sizeof (*newp)); \
/* If we cannot get a free block we cannot add the new element to \
the list. */ \
if (newp != NULL) { \
newp->address = (addr); \
newp->next = (list); \
(list) = newp; \
} \
} while (0)
# define FREE_BLOCKS(list) \
do { \
while (list != NULL) { \
struct block_list *old = list; \
list = list->next; \
free (old); \
} \
} while (0)
# undef alloca
# define alloca(size) (malloc (size))
#endif /* have alloca */
/* Names for the libintl functions are a problem. They must not clash
with existing names and they should follow ANSI C. But this source
code is also used in GNU C Library where the names have a __
prefix. So we have to make a difference here. */
#ifdef _LIBC
# define DCGETTEXT __dcgettext
#else
# define DCGETTEXT dcgettext__
#endif
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
locale. */
char *
DCGETTEXT (domainname, msgid, category)
const char *domainname;
const char *msgid;
int category;
{
#ifndef HAVE_ALLOCA
struct block_list *block_list = NULL;
#endif
struct loaded_l10nfile *domain;
struct binding *binding;
const char *categoryname;
const char *categoryvalue;
char *dirname, *xdomainname;
char *single_locale;
char *retval;
int saved_errno = errno;
/* If no real MSGID is given return NULL. */
if (msgid == NULL)
return NULL;
/* If DOMAINNAME is NULL, we are interested in the default domain. If
CATEGORY is not LC_MESSAGES this might not make much sense but the
defintion left this undefined. */
if (domainname == NULL)
domainname = _nl_current_default_domain;
/* First find matching binding. */
for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next)
{
int compare = strcmp (domainname, binding->domainname);
if (compare == 0)
/* We found it! */
break;
if (compare < 0)
{
/* It is not in the list. */
binding = NULL;
break;
}
}
if (binding == NULL)
dirname = (char *) _nl_default_dirname;
else if (binding->dirname[0] == '/')
dirname = binding->dirname;
else
{
/* We have a relative path. Make it absolute now. */
size_t dirname_len = strlen (binding->dirname) + 1;
size_t path_max;
char *ret;
path_max = (unsigned) PATH_MAX;
path_max += 2; /* The getcwd docs say to do this. */
dirname = (char *) alloca (path_max + dirname_len);
ADD_BLOCK (block_list, dirname);
__set_errno (0);
while ((ret = getcwd (dirname, path_max)) == NULL && errno == ERANGE)
{
path_max += PATH_INCR;
dirname = (char *) alloca (path_max + dirname_len);
ADD_BLOCK (block_list, dirname);
__set_errno (0);
}
if (ret == NULL)
{
/* We cannot get the current working directory. Don't signal an
error but simply return the default string. */
FREE_BLOCKS (block_list);
__set_errno (saved_errno);
return (char *) msgid;
}
stpcpy (stpcpy (strchr (dirname, '\0'), "/"), binding->dirname);
}
/* Now determine the symbolic name of CATEGORY and its value. */
categoryname = category_to_name (category);
categoryvalue = guess_category_value (category, categoryname);
xdomainname = (char *) alloca (strlen (categoryname)
+ strlen (domainname) + 5);
ADD_BLOCK (block_list, xdomainname);
stpcpy (stpcpy (stpcpy (stpcpy (xdomainname, categoryname), "/"),
domainname),
".mo");
/* Creating working area. */
single_locale = (char *) alloca (strlen (categoryvalue) + 1);
ADD_BLOCK (block_list, single_locale);
/* Search for the given string. This is a loop because we perhaps
got an ordered list of languages to consider for th translation. */
while (1)
{
/* Make CATEGORYVALUE point to the next element of the list. */
while (categoryvalue[0] != '\0' && categoryvalue[0] == ':')
++categoryvalue;
if (categoryvalue[0] == '\0')
{
/* The whole contents of CATEGORYVALUE has been searched but
no valid entry has been found. We solve this situation
by implicitly appending a "C" entry, i.e. no translation
will take place. */
single_locale[0] = 'C';
single_locale[1] = '\0';
}
else
{
char *cp = single_locale;
while (categoryvalue[0] != '\0' && categoryvalue[0] != ':')
*cp++ = *categoryvalue++;
*cp = '\0';
}
/* If the current locale value is C (or POSIX) we don't load a
domain. Return the MSGID. */
if (strcmp (single_locale, "C") == 0
|| strcmp (single_locale, "POSIX") == 0)
{
FREE_BLOCKS (block_list);
__set_errno (saved_errno);
return (char *) msgid;
}
/* Find structure describing the message catalog matching the
DOMAINNAME and CATEGORY. */
domain = _nl_find_domain (dirname, single_locale, xdomainname);
if (domain != NULL)
{
retval = find_msg (domain, msgid);
if (retval == NULL)
{
int cnt;
for (cnt = 0; domain->successor[cnt] != NULL; ++cnt)
{
retval = find_msg (domain->successor[cnt], msgid);
if (retval != NULL)
break;
}
}
if (retval != NULL)
{
FREE_BLOCKS (block_list);
__set_errno (saved_errno);
return retval;
}
}
}
/* NOTREACHED */
}
#ifdef _LIBC
/* Alias for function name in GNU C Library. */
weak_alias (__dcgettext, dcgettext);
#endif
static char *
internal_function
find_msg (domain_file, msgid)
struct loaded_l10nfile *domain_file;
const char *msgid;
{
size_t top, act, bottom;
struct loaded_domain *domain;
if (domain_file->decided == 0)
_nl_load_domain (domain_file);
if (domain_file->data == NULL)
return NULL;
domain = (struct loaded_domain *) domain_file->data;
/* Locate the MSGID and its translation. */
if (domain->hash_size > 2 && domain->hash_tab != NULL)
{
/* Use the hashing table. */
nls_uint32 len = strlen (msgid);
nls_uint32 hash_val = hash_string (msgid);
nls_uint32 idx = hash_val % domain->hash_size;
nls_uint32 incr = 1 + (hash_val % (domain->hash_size - 2));
nls_uint32 nstr = W (domain->must_swap, domain->hash_tab[idx]);
if (nstr == 0)
/* Hash table entry is empty. */
return NULL;
if (W (domain->must_swap, domain->orig_tab[nstr - 1].length) == len
&& strcmp (msgid,
domain->data + W (domain->must_swap,
domain->orig_tab[nstr - 1].offset)) == 0)
return (char *) domain->data + W (domain->must_swap,
domain->trans_tab[nstr - 1].offset);
while (1)
{
if (idx >= domain->hash_size - incr)
idx -= domain->hash_size - incr;
else
idx += incr;
nstr = W (domain->must_swap, domain->hash_tab[idx]);
if (nstr == 0)
/* Hash table entry is empty. */
return NULL;
if (W (domain->must_swap, domain->orig_tab[nstr - 1].length) == len
&& strcmp (msgid,
domain->data + W (domain->must_swap,
domain->orig_tab[nstr - 1].offset))
== 0)
return (char *) domain->data
+ W (domain->must_swap, domain->trans_tab[nstr - 1].offset);
}
/* NOTREACHED */
}
/* Now we try the default method: binary search in the sorted
array of messages. */
bottom = 0;
top = domain->nstrings;
while (bottom < top)
{
int cmp_val;
act = (bottom + top) / 2;
cmp_val = strcmp (msgid, domain->data
+ W (domain->must_swap,
domain->orig_tab[act].offset));
if (cmp_val < 0)
top = act;
else if (cmp_val > 0)
bottom = act + 1;
else
break;
}
/* If an translation is found return this. */
return bottom >= top ? NULL : (char *) domain->data
+ W (domain->must_swap,
domain->trans_tab[act].offset);
}
/* Return string representation of locale CATEGORY. */
static const char *
internal_function
category_to_name (category)
int category;
{
const char *retval;
switch (category)
{
#ifdef LC_COLLATE
case LC_COLLATE:
retval = "LC_COLLATE";
break;
#endif
#ifdef LC_CTYPE
case LC_CTYPE:
retval = "LC_CTYPE";
break;
#endif
#ifdef LC_MONETARY
case LC_MONETARY:
retval = "LC_MONETARY";
break;
#endif
#ifdef LC_NUMERIC
case LC_NUMERIC:
retval = "LC_NUMERIC";
break;
#endif
#ifdef LC_TIME
case LC_TIME:
retval = "LC_TIME";
break;
#endif
#ifdef LC_MESSAGES
case LC_MESSAGES:
retval = "LC_MESSAGES";
break;
#endif
#ifdef LC_RESPONSE
case LC_RESPONSE:
retval = "LC_RESPONSE";
break;
#endif
#ifdef LC_ALL
case LC_ALL:
/* This might not make sense but is perhaps better than any other
value. */
retval = "LC_ALL";
break;
#endif
default:
/* If you have a better idea for a default value let me know. */
retval = "LC_XXX";
}
return retval;
}
/* Guess value of current locale from value of the environment variables. */
static const char *
internal_function
guess_category_value (category, categoryname)
int category;
const char *categoryname;
{
const char *retval;
/* The highest priority value is the `LANGUAGE' environment
variable. This is a GNU extension. */
retval = getenv ("LANGUAGE");
if (retval != NULL && retval[0] != '\0')
return retval;
/* `LANGUAGE' is not set. So we have to proceed with the POSIX
methods of looking to `LC_ALL', `LC_xxx', and `LANG'. On some
systems this can be done by the `setlocale' function itself. */
#if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL
return setlocale (category, NULL);
#else
/* Setting of LC_ALL overwrites all other. */
retval = getenv ("LC_ALL");
if (retval != NULL && retval[0] != '\0')
return retval;
/* Next comes the name of the desired category. */
retval = getenv (categoryname);
if (retval != NULL && retval[0] != '\0')
return retval;
/* Last possibility is the LANG environment variable. */
retval = getenv ("LANG");
if (retval != NULL && retval[0] != '\0')
return retval;
/* We use C as the default domain. POSIX says this is implementation
defined. */
return "C";
#endif
}
/* @@ begin of epilog @@ */
/* We don't want libintl.a to depend on any other library. So we
avoid the non-standard function stpcpy. In GNU C Library this
function is available, though. Also allow the symbol HAVE_STPCPY
to be defined. */
#if !_LIBC && !HAVE_STPCPY
static char *
stpcpy (dest, src)
char *dest;
const char *src;
{
while ((*dest++ = *src++) != '\0')
/* Do nothing. */ ;
return dest - 1;
}
#endif
#ifdef _LIBC
/* If we want to free all resources we have to do some work at
program's end. */
static void __attribute__ ((unused))
free_mem (void)
{
struct binding *runp;
for (runp = _nl_domain_bindings; runp != NULL; runp = runp->next)
{
free (runp->domainname);
if (runp->dirname != _nl_default_dirname)
/* Yes, this is a pointer comparison. */
free (runp->dirname);
}
if (_nl_current_default_domain != _nl_default_default_domain)
/* Yes, again a pointer comparison. */
free ((char *) _nl_current_default_domain);
}
text_set_element (__libc_subfreeres, free_mem);
#endif

59
intl/dgettext.c Normal file
View file

@ -0,0 +1,59 @@
/* Implementation of the dgettext(3) function
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#if defined HAVE_LOCALE_H || defined _LIBC
# include <locale.h>
#endif
#ifdef _LIBC
# include <libintl.h>
#else
# include "libgettext.h"
#endif
/* @@ end of prolog @@ */
/* Names for the libintl functions are a problem. They must not clash
with existing names and they should follow ANSI C. But this source
code is also used in GNU C Library where the names have a __
prefix. So we have to make a difference here. */
#ifdef _LIBC
# define DGETTEXT __dgettext
# define DCGETTEXT __dcgettext
#else
# define DGETTEXT dgettext__
# define DCGETTEXT dcgettext__
#endif
/* Look up MSGID in the DOMAINNAME message catalog of the current
LC_MESSAGES locale. */
char *
DGETTEXT (domainname, msgid)
const char *domainname;
const char *msgid;
{
return DCGETTEXT (domainname, msgid, LC_MESSAGES);
}
#ifdef _LIBC
/* Alias for function name in GNU C Library. */
weak_alias (__dgettext, dgettext);
#endif

188
intl/explodename.c Normal file
View file

@ -0,0 +1,188 @@
/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#if defined STDC_HEADERS || defined _LIBC
# include <stdlib.h>
#endif
#if defined HAVE_STRING_H || defined _LIBC
# include <string.h>
#else
# include <strings.h>
#endif
#include <sys/types.h>
#include "loadinfo.h"
/* On some strange systems still no definition of NULL is found. Sigh! */
#ifndef NULL
# if defined __STDC__ && __STDC__
# define NULL ((void *) 0)
# else
# define NULL 0
# endif
#endif
/* @@ end of prolog @@ */
int
_nl_explode_name (name, language, modifier, territory, codeset,
normalized_codeset, special, sponsor, revision)
char *name;
const char **language;
const char **modifier;
const char **territory;
const char **codeset;
const char **normalized_codeset;
const char **special;
const char **sponsor;
const char **revision;
{
enum { undecided, xpg, cen } syntax;
char *cp;
int mask;
*modifier = NULL;
*territory = NULL;
*codeset = NULL;
*normalized_codeset = NULL;
*special = NULL;
*sponsor = NULL;
*revision = NULL;
/* Now we determine the single parts of the locale name. First
look for the language. Termination symbols are `_' and `@' if
we use XPG4 style, and `_', `+', and `,' if we use CEN syntax. */
mask = 0;
syntax = undecided;
*language = cp = name;
while (cp[0] != '\0' && cp[0] != '_' && cp[0] != '@'
&& cp[0] != '+' && cp[0] != ',')
++cp;
if (*language == cp)
/* This does not make sense: language has to be specified. Use
this entry as it is without exploding. Perhaps it is an alias. */
cp = strchr (*language, '\0');
else if (cp[0] == '_')
{
/* Next is the territory. */
cp[0] = '\0';
*territory = ++cp;
while (cp[0] != '\0' && cp[0] != '.' && cp[0] != '@'
&& cp[0] != '+' && cp[0] != ',' && cp[0] != '_')
++cp;
mask |= TERRITORY;
if (cp[0] == '.')
{
/* Next is the codeset. */
syntax = xpg;
cp[0] = '\0';
*codeset = ++cp;
while (cp[0] != '\0' && cp[0] != '@')
++cp;
mask |= XPG_CODESET;
if (*codeset != cp && (*codeset)[0] != '\0')
{
*normalized_codeset = _nl_normalize_codeset (*codeset,
cp - *codeset);
if (strcmp (*codeset, *normalized_codeset) == 0)
free ((char *) *normalized_codeset);
else
mask |= XPG_NORM_CODESET;
}
}
}
if (cp[0] == '@' || (syntax != xpg && cp[0] == '+'))
{
/* Next is the modifier. */
syntax = cp[0] == '@' ? xpg : cen;
cp[0] = '\0';
*modifier = ++cp;
while (syntax == cen && cp[0] != '\0' && cp[0] != '+'
&& cp[0] != ',' && cp[0] != '_')
++cp;
mask |= XPG_MODIFIER | CEN_AUDIENCE;
}
if (syntax != xpg && (cp[0] == '+' || cp[0] == ',' || cp[0] == '_'))
{
syntax = cen;
if (cp[0] == '+')
{
/* Next is special application (CEN syntax). */
cp[0] = '\0';
*special = ++cp;
while (cp[0] != '\0' && cp[0] != ',' && cp[0] != '_')
++cp;
mask |= CEN_SPECIAL;
}
if (cp[0] == ',')
{
/* Next is sponsor (CEN syntax). */
cp[0] = '\0';
*sponsor = ++cp;
while (cp[0] != '\0' && cp[0] != '_')
++cp;
mask |= CEN_SPONSOR;
}
if (cp[0] == '_')
{
/* Next is revision (CEN syntax). */
cp[0] = '\0';
*revision = ++cp;
mask |= CEN_REVISION;
}
}
/* For CEN syntax values it might be important to have the
separator character in the file name, not for XPG syntax. */
if (syntax == xpg)
{
if (*territory != NULL && (*territory)[0] == '\0')
mask &= ~TERRITORY;
if (*codeset != NULL && (*codeset)[0] == '\0')
mask &= ~XPG_CODESET;
if (*modifier != NULL && (*modifier)[0] == '\0')
mask &= ~XPG_MODIFIER;
}
return mask;
}

216
intl/finddomain.c Normal file
View file

@ -0,0 +1,216 @@
/* Handle list of needed message catalogs
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <sys/types.h>
#if defined STDC_HEADERS || defined _LIBC
# include <stdlib.h>
#else
# ifdef HAVE_MALLOC_H
# include <malloc.h>
# else
void free ();
# endif
#endif
#if defined HAVE_STRING_H || defined _LIBC
# include <string.h>
#else
# include <strings.h>
# ifndef memcpy
# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
# endif
#endif
#if !HAVE_STRCHR && !defined _LIBC
# ifndef strchr
# define strchr index
# endif
#endif
#if defined HAVE_UNISTD_H || defined _LIBC
# include <unistd.h>
#endif
#include "gettext.h"
#include "gettextP.h"
#ifdef _LIBC
# include <libintl.h>
#else
# include "libgettext.h"
#endif
/* @@ end of prolog @@ */
/* List of already loaded domains. */
static struct loaded_l10nfile *_nl_loaded_domains;
/* Return a data structure describing the message catalog described by
the DOMAINNAME and CATEGORY parameters with respect to the currently
established bindings. */
struct loaded_l10nfile *
internal_function
_nl_find_domain (dirname, locale, domainname)
const char *dirname;
char *locale;
const char *domainname;
{
struct loaded_l10nfile *retval;
const char *language;
const char *modifier;
const char *territory;
const char *codeset;
const char *normalized_codeset;
const char *special;
const char *sponsor;
const char *revision;
const char *alias_value;
int mask;
/* LOCALE can consist of up to four recognized parts for the XPG syntax:
language[_territory[.codeset]][@modifier]
and six parts for the CEN syntax:
language[_territory][+audience][+special][,[sponsor][_revision]]
Beside the first part all of them are allowed to be missing. If
the full specified locale is not found, the less specific one are
looked for. The various parts will be stripped off according to
the following order:
(1) revision
(2) sponsor
(3) special
(4) codeset
(5) normalized codeset
(6) territory
(7) audience/modifier
*/
/* If we have already tested for this locale entry there has to
be one data set in the list of loaded domains. */
retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname,
strlen (dirname) + 1, 0, locale, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, domainname, 0);
if (retval != NULL)
{
/* We know something about this locale. */
int cnt;
if (retval->decided == 0)
_nl_load_domain (retval);
if (retval->data != NULL)
return retval;
for (cnt = 0; retval->successor[cnt] != NULL; ++cnt)
{
if (retval->successor[cnt]->decided == 0)
_nl_load_domain (retval->successor[cnt]);
if (retval->successor[cnt]->data != NULL)
break;
}
return cnt >= 0 ? retval : NULL;
/* NOTREACHED */
}
/* See whether the locale value is an alias. If yes its value
*overwrites* the alias name. No test for the original value is
done. */
alias_value = _nl_expand_alias (locale);
if (alias_value != NULL)
{
#if defined _LIBC || defined HAVE_STRDUP
locale = strdup (alias_value);
if (locale == NULL)
return NULL;
#else
size_t len = strlen (alias_value) + 1;
locale = (char *) malloc (len);
if (locale == NULL)
return NULL;
memcpy (locale, alias_value, len);
#endif
}
/* Now we determine the single parts of the locale name. First
look for the language. Termination symbols are `_' and `@' if
we use XPG4 style, and `_', `+', and `,' if we use CEN syntax. */
mask = _nl_explode_name (locale, &language, &modifier, &territory,
&codeset, &normalized_codeset, &special,
&sponsor, &revision);
/* Create all possible locale entries which might be interested in
generalization. */
retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname,
strlen (dirname) + 1, mask, language, territory,
codeset, normalized_codeset, modifier, special,
sponsor, revision, domainname, 1);
if (retval == NULL)
/* This means we are out of core. */
return NULL;
if (retval->decided == 0)
_nl_load_domain (retval);
if (retval->data == NULL)
{
int cnt;
for (cnt = 0; retval->successor[cnt] != NULL; ++cnt)
{
if (retval->successor[cnt]->decided == 0)
_nl_load_domain (retval->successor[cnt]);
if (retval->successor[cnt]->data != NULL)
break;
}
}
/* The room for an alias was dynamically allocated. Free it now. */
if (alias_value != NULL)
free (locale);
return retval;
}
#ifdef _LIBC
static void __attribute__ ((unused))
free_mem (void)
{
struct loaded_l10nfile *runp = _nl_loaded_domains;
while (runp != NULL)
{
struct loaded_l10nfile *here = runp;
if (runp->data != NULL)
_nl_unload_domain ((struct loaded_domain *) runp->data);
runp = runp->next;
free (here);
}
}
text_set_element (__libc_subfreeres, free_mem);
#endif

70
intl/gettext.c Normal file
View file

@ -0,0 +1,70 @@
/* Implementation of gettext(3) function.
Copyright (C) 1995, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef _LIBC
# define __need_NULL
# include <stddef.h>
#else
# ifdef STDC_HEADERS
# include <stdlib.h> /* Just for NULL. */
# else
# ifdef HAVE_STRING_H
# include <string.h>
# else
# define NULL ((void *) 0)
# endif
# endif
#endif
#ifdef _LIBC
# include <libintl.h>
#else
# include "libgettext.h"
#endif
/* @@ end of prolog @@ */
/* Names for the libintl functions are a problem. They must not clash
with existing names and they should follow ANSI C. But this source
code is also used in GNU C Library where the names have a __
prefix. So we have to make a difference here. */
#ifdef _LIBC
# define GETTEXT __gettext
# define DGETTEXT __dgettext
#else
# define GETTEXT gettext__
# define DGETTEXT dgettext__
#endif
/* Look up MSGID in the current default message catalog for the current
LC_MESSAGES locale. If not found, returns MSGID itself (the default
text). */
char *
GETTEXT (msgid)
const char *msgid;
{
return DGETTEXT (NULL, msgid);
}
#ifdef _LIBC
/* Alias for function name in GNU C Library. */
weak_alias (__gettext, gettext);
#endif

105
intl/gettext.h Normal file
View file

@ -0,0 +1,105 @@
/* Internal header for GNU gettext internationalization functions.
Copyright (C) 1995, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef _GETTEXT_H
#define _GETTEXT_H 1
#include <stdio.h>
#if HAVE_LIMITS_H || _LIBC
# include <limits.h>
#endif
/* @@ end of prolog @@ */
/* The magic number of the GNU message catalog format. */
#define _MAGIC 0x950412de
#define _MAGIC_SWAPPED 0xde120495
/* Revision number of the currently used .mo (binary) file format. */
#define MO_REVISION_NUMBER 0
/* The following contortions are an attempt to use the C preprocessor
to determine an unsigned integral type that is 32 bits wide. An
alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
doing that would require that the configure script compile and *run*
the resulting executable. Locally running cross-compiled executables
is usually not possible. */
#if __STDC__
# define UINT_MAX_32_BITS 4294967295U
#else
# define UINT_MAX_32_BITS 0xFFFFFFFF
#endif
/* If UINT_MAX isn't defined, assume it's a 32-bit type.
This should be valid for all systems GNU cares about because
that doesn't include 16-bit systems, and only modern systems
(that certainly have <limits.h>) have 64+-bit integral types. */
#ifndef UINT_MAX
# define UINT_MAX UINT_MAX_32_BITS
#endif
#if UINT_MAX == UINT_MAX_32_BITS
typedef unsigned nls_uint32;
#else
# if USHRT_MAX == UINT_MAX_32_BITS
typedef unsigned short nls_uint32;
# else
# if ULONG_MAX == UINT_MAX_32_BITS
typedef unsigned long nls_uint32;
# else
/* The following line is intended to throw an error. Using #error is
not portable enough. */
"Cannot determine unsigned 32-bit data type."
# endif
# endif
#endif
/* Header for binary .mo file format. */
struct mo_file_header
{
/* The magic number. */
nls_uint32 magic;
/* The revision number of the file format. */
nls_uint32 revision;
/* The number of strings pairs. */
nls_uint32 nstrings;
/* Offset of table with start offsets of original strings. */
nls_uint32 orig_tab_offset;
/* Offset of table with start offsets of translation strings. */
nls_uint32 trans_tab_offset;
/* Size of hashing table. */
nls_uint32 hash_tab_size;
/* Offset of first hashing entry. */
nls_uint32 hash_tab_offset;
};
struct string_desc
{
/* Length of addressed string. */
nls_uint32 length;
/* Offset of string in file. */
nls_uint32 offset;
};
/* @@ begin of epilog @@ */
#endif /* gettext.h */

89
intl/gettextP.h Normal file
View file

@ -0,0 +1,89 @@
/* Header describing internals of gettext library
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef _GETTEXTP_H
#define _GETTEXTP_H
#include "loadinfo.h"
/* @@ end of prolog @@ */
#ifndef PARAMS
# if __STDC__
# define PARAMS(args) args
# else
# define PARAMS(args) ()
# endif
#endif
#ifndef internal_function
# define internal_function
#endif
#ifndef W
# define W(flag, data) ((flag) ? SWAP (data) : (data))
#endif
#ifdef _LIBC
# include <byteswap.h>
# define SWAP(i) bswap_32 (i)
#else
static nls_uint32 SWAP PARAMS ((nls_uint32 i));
static inline nls_uint32
SWAP (i)
nls_uint32 i;
{
return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24);
}
#endif
struct loaded_domain
{
const char *data;
int use_mmap;
size_t mmap_size;
int must_swap;
nls_uint32 nstrings;
struct string_desc *orig_tab;
struct string_desc *trans_tab;
nls_uint32 hash_size;
nls_uint32 *hash_tab;
};
struct binding
{
struct binding *next;
char *domainname;
char *dirname;
};
struct loaded_l10nfile *_nl_find_domain PARAMS ((const char *__dirname,
char *__locale,
const char *__domainname))
internal_function;
void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain))
internal_function;
void _nl_unload_domain PARAMS ((struct loaded_domain *__domain))
internal_function;
/* @@ begin of epilog @@ */
#endif /* gettextP.h */

59
intl/hash-string.h Normal file
View file

@ -0,0 +1,59 @@
/* Implements a string hashing function.
Copyright (C) 1995, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* @@ end of prolog @@ */
#ifndef PARAMS
# if __STDC__
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
#endif
/* We assume to have `unsigned long int' value with at least 32 bits. */
#define HASHWORDBITS 32
/* Defines the so called `hashpjw' function by P.J. Weinberger
[see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
1986, 1987 Bell Telephone Laboratories, Inc.] */
static unsigned long hash_string PARAMS ((const char *__str_param));
static inline unsigned long
hash_string (str_param)
const char *str_param;
{
unsigned long int hval, g;
const char *str = str_param;
/* Compute the hash value for the given string. */
hval = 0;
while (*str != '\0')
{
hval <<= 4;
hval += (unsigned long) *str++;
g = hval & ((unsigned long) 0xf << (HASHWORDBITS - 4));
if (g != 0)
{
hval ^= g >> (HASHWORDBITS - 8);
hval ^= g;
}
}
return hval;
}

76
intl/intl-compat.c Normal file
View file

@ -0,0 +1,76 @@
/* intl-compat.c - Stub functions to call gettext functions from GNU gettext
Library.
Copyright (C) 1995 Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "libgettext.h"
/* @@ end of prolog @@ */
#undef gettext
#undef dgettext
#undef dcgettext
#undef textdomain
#undef bindtextdomain
char *
bindtextdomain (domainname, dirname)
const char *domainname;
const char *dirname;
{
return bindtextdomain__ (domainname, dirname);
}
char *
dcgettext (domainname, msgid, category)
const char *domainname;
const char *msgid;
int category;
{
return dcgettext__ (domainname, msgid, category);
}
char *
dgettext (domainname, msgid)
const char *domainname;
const char *msgid;
{
return dgettext__ (domainname, msgid);
}
char *
gettext (msgid)
const char *msgid;
{
return gettext__ (msgid);
}
char *
textdomain (domainname)
const char *domainname;
{
return textdomain__ (domainname);
}

411
intl/l10nflist.c Normal file
View file

@ -0,0 +1,411 @@
/* Handle list of needed message catalogs
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#if defined HAVE_STRING_H || defined _LIBC
# ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
# endif
# include <string.h>
#else
# include <strings.h>
# ifndef memcpy
# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
# endif
#endif
#if !HAVE_STRCHR && !defined _LIBC
# ifndef strchr
# define strchr index
# endif
#endif
#if defined _LIBC || defined HAVE_ARGZ_H
# include <argz.h>
#endif
#include <ctype.h>
#include <sys/types.h>
#if defined STDC_HEADERS || defined _LIBC
# include <stdlib.h>
#endif
#include "loadinfo.h"
/* On some strange systems still no definition of NULL is found. Sigh! */
#ifndef NULL
# if defined __STDC__ && __STDC__
# define NULL ((void *) 0)
# else
# define NULL 0
# endif
#endif
/* @@ end of prolog @@ */
#ifdef _LIBC
/* Rename the non ANSI C functions. This is required by the standard
because some ANSI C functions will require linking with this object
file and the name space must not be polluted. */
# ifndef stpcpy
# define stpcpy(dest, src) __stpcpy(dest, src)
# endif
#else
# ifndef HAVE_STPCPY
static char *stpcpy PARAMS ((char *dest, const char *src));
# endif
#endif
/* Define function which are usually not available. */
#if !defined _LIBC && !defined HAVE___ARGZ_COUNT
/* Returns the number of strings in ARGZ. */
static size_t argz_count__ PARAMS ((const char *argz, size_t len));
static size_t
argz_count__ (argz, len)
const char *argz;
size_t len;
{
size_t count = 0;
while (len > 0)
{
size_t part_len = strlen (argz);
argz += part_len + 1;
len -= part_len + 1;
count++;
}
return count;
}
# undef __argz_count
# define __argz_count(argz, len) argz_count__ (argz, len)
#endif /* !_LIBC && !HAVE___ARGZ_COUNT */
#if !defined _LIBC && !defined HAVE___ARGZ_STRINGIFY
/* Make '\0' separated arg vector ARGZ printable by converting all the '\0's
except the last into the character SEP. */
static void argz_stringify__ PARAMS ((char *argz, size_t len, int sep));
static void
argz_stringify__ (argz, len, sep)
char *argz;
size_t len;
int sep;
{
while (len > 0)
{
size_t part_len = strlen (argz);
argz += part_len;
len -= part_len + 1;
if (len > 0)
*argz++ = sep;
}
}
# undef __argz_stringify
# define __argz_stringify(argz, len, sep) argz_stringify__ (argz, len, sep)
#endif /* !_LIBC && !HAVE___ARGZ_STRINGIFY */
#if !defined _LIBC && !defined HAVE___ARGZ_NEXT
static char *argz_next__ PARAMS ((char *argz, size_t argz_len,
const char *entry));
static char *
argz_next__ (argz, argz_len, entry)
char *argz;
size_t argz_len;
const char *entry;
{
if (entry)
{
if (entry < argz + argz_len)
entry = strchr (entry, '\0') + 1;
return entry >= argz + argz_len ? NULL : (char *) entry;
}
else
if (argz_len > 0)
return argz;
else
return 0;
}
# undef __argz_next
# define __argz_next(argz, len, entry) argz_next__ (argz, len, entry)
#endif /* !_LIBC && !HAVE___ARGZ_NEXT */
/* Return number of bits set in X. */
static int pop PARAMS ((int x));
static inline int
pop (x)
int x;
{
/* We assume that no more than 16 bits are used. */
x = ((x & ~0x5555) >> 1) + (x & 0x5555);
x = ((x & ~0x3333) >> 2) + (x & 0x3333);
x = ((x >> 4) + x) & 0x0f0f;
x = ((x >> 8) + x) & 0xff;
return x;
}
struct loaded_l10nfile *
_nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language,
territory, codeset, normalized_codeset, modifier, special,
sponsor, revision, filename, do_allocate)
struct loaded_l10nfile **l10nfile_list;
const char *dirlist;
size_t dirlist_len;
int mask;
const char *language;
const char *territory;
const char *codeset;
const char *normalized_codeset;
const char *modifier;
const char *special;
const char *sponsor;
const char *revision;
const char *filename;
int do_allocate;
{
char *abs_filename;
struct loaded_l10nfile *last = NULL;
struct loaded_l10nfile *retval;
char *cp;
size_t entries;
int cnt;
/* Allocate room for the full file name. */
abs_filename = (char *) malloc (dirlist_len
+ strlen (language)
+ ((mask & TERRITORY) != 0
? strlen (territory) + 1 : 0)
+ ((mask & XPG_CODESET) != 0
? strlen (codeset) + 1 : 0)
+ ((mask & XPG_NORM_CODESET) != 0
? strlen (normalized_codeset) + 1 : 0)
+ (((mask & XPG_MODIFIER) != 0
|| (mask & CEN_AUDIENCE) != 0)
? strlen (modifier) + 1 : 0)
+ ((mask & CEN_SPECIAL) != 0
? strlen (special) + 1 : 0)
+ (((mask & CEN_SPONSOR) != 0
|| (mask & CEN_REVISION) != 0)
? (1 + ((mask & CEN_SPONSOR) != 0
? strlen (sponsor) + 1 : 0)
+ ((mask & CEN_REVISION) != 0
? strlen (revision) + 1 : 0)) : 0)
+ 1 + strlen (filename) + 1);
if (abs_filename == NULL)
return NULL;
retval = NULL;
last = NULL;
/* Construct file name. */
memcpy (abs_filename, dirlist, dirlist_len);
__argz_stringify (abs_filename, dirlist_len, ':');
cp = abs_filename + (dirlist_len - 1);
*cp++ = '/';
cp = stpcpy (cp, language);
if ((mask & TERRITORY) != 0)
{
*cp++ = '_';
cp = stpcpy (cp, territory);
}
if ((mask & XPG_CODESET) != 0)
{
*cp++ = '.';
cp = stpcpy (cp, codeset);
}
if ((mask & XPG_NORM_CODESET) != 0)
{
*cp++ = '.';
cp = stpcpy (cp, normalized_codeset);
}
if ((mask & (XPG_MODIFIER | CEN_AUDIENCE)) != 0)
{
/* This component can be part of both syntaces but has different
leading characters. For CEN we use `+', else `@'. */
*cp++ = (mask & CEN_AUDIENCE) != 0 ? '+' : '@';
cp = stpcpy (cp, modifier);
}
if ((mask & CEN_SPECIAL) != 0)
{
*cp++ = '+';
cp = stpcpy (cp, special);
}
if ((mask & (CEN_SPONSOR | CEN_REVISION)) != 0)
{
*cp++ = ',';
if ((mask & CEN_SPONSOR) != 0)
cp = stpcpy (cp, sponsor);
if ((mask & CEN_REVISION) != 0)
{
*cp++ = '_';
cp = stpcpy (cp, revision);
}
}
*cp++ = '/';
stpcpy (cp, filename);
/* Look in list of already loaded domains whether it is already
available. */
last = NULL;
for (retval = *l10nfile_list; retval != NULL; retval = retval->next)
if (retval->filename != NULL)
{
int compare = strcmp (retval->filename, abs_filename);
if (compare == 0)
/* We found it! */
break;
if (compare < 0)
{
/* It's not in the list. */
retval = NULL;
break;
}
last = retval;
}
if (retval != NULL || do_allocate == 0)
{
free (abs_filename);
return retval;
}
retval = (struct loaded_l10nfile *)
malloc (sizeof (*retval) + (__argz_count (dirlist, dirlist_len)
* (1 << pop (mask))
* sizeof (struct loaded_l10nfile *)));
if (retval == NULL)
return NULL;
retval->filename = abs_filename;
retval->decided = (__argz_count (dirlist, dirlist_len) != 1
|| ((mask & XPG_CODESET) != 0
&& (mask & XPG_NORM_CODESET) != 0));
retval->data = NULL;
if (last == NULL)
{
retval->next = *l10nfile_list;
*l10nfile_list = retval;
}
else
{
retval->next = last->next;
last->next = retval;
}
entries = 0;
/* If the DIRLIST is a real list the RETVAL entry corresponds not to
a real file. So we have to use the DIRLIST separation mechanism
of the inner loop. */
cnt = __argz_count (dirlist, dirlist_len) == 1 ? mask - 1 : mask;
for (; cnt >= 0; --cnt)
if ((cnt & ~mask) == 0
&& ((cnt & CEN_SPECIFIC) == 0 || (cnt & XPG_SPECIFIC) == 0)
&& ((cnt & XPG_CODESET) == 0 || (cnt & XPG_NORM_CODESET) == 0))
{
/* Iterate over all elements of the DIRLIST. */
char *dir = NULL;
while ((dir = __argz_next ((char *) dirlist, dirlist_len, dir))
!= NULL)
retval->successor[entries++]
= _nl_make_l10nflist (l10nfile_list, dir, strlen (dir) + 1, cnt,
language, territory, codeset,
normalized_codeset, modifier, special,
sponsor, revision, filename, 1);
}
retval->successor[entries] = NULL;
return retval;
}
/* Normalize codeset name. There is no standard for the codeset
names. Normalization allows the user to use any of the common
names. */
const char *
_nl_normalize_codeset (codeset, name_len)
const unsigned char *codeset;
size_t name_len;
{
int len = 0;
int only_digit = 1;
char *retval;
char *wp;
size_t cnt;
for (cnt = 0; cnt < name_len; ++cnt)
if (isalnum (codeset[cnt]))
{
++len;
if (isalpha (codeset[cnt]))
only_digit = 0;
}
retval = (char *) malloc ((only_digit ? 3 : 0) + len + 1);
if (retval != NULL)
{
if (only_digit)
wp = stpcpy (retval, "iso");
else
wp = retval;
for (cnt = 0; cnt < name_len; ++cnt)
if (isalpha (codeset[cnt]))
*wp++ = tolower (codeset[cnt]);
else if (isdigit (codeset[cnt]))
*wp++ = codeset[cnt];
*wp = '\0';
}
return (const char *) retval;
}
/* @@ begin of epilog @@ */
/* We don't want libintl.a to depend on any other library. So we
avoid the non-standard function stpcpy. In GNU C Library this
function is available, though. Also allow the symbol HAVE_STPCPY
to be defined. */
#if !_LIBC && !HAVE_STPCPY
static char *
stpcpy (dest, src)
char *dest;
const char *src;
{
while ((*dest++ = *src++) != '\0')
/* Do nothing. */ ;
return dest - 1;
}
#endif

182
intl/libgettext.h Normal file
View file

@ -0,0 +1,182 @@
/* Message catalogs for internationalization.
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Because on some systems (e.g. Solaris) we sometimes have to include
the systems libintl.h as well as this file we have more complex
include protection above. But the systems header might perhaps also
define _LIBINTL_H and therefore we have to protect the definition here. */
#if !defined _LIBINTL_H || !defined _LIBGETTEXT_H
#ifndef _LIBINTL_H
# define _LIBINTL_H 1
#endif
#define _LIBGETTEXT_H 1
/* We define an additional symbol to signal that we use the GNU
implementation of gettext. */
#define __USE_GNU_GETTEXT 1
#include <sys/types.h>
#if HAVE_LOCALE_H
# include <locale.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* @@ end of prolog @@ */
#ifndef PARAMS
# if __STDC__ || defined __cplusplus
# define PARAMS(args) args
# else
# define PARAMS(args) ()
# endif
#endif
#ifndef NULL
# if !defined __cplusplus || defined __GNUC__
# define NULL ((void *) 0)
# else
# define NULL (0)
# endif
#endif
#if !HAVE_LC_MESSAGES
/* This value determines the behaviour of the gettext() and dgettext()
function. But some system does not have this defined. Define it
to a default value. */
# define LC_MESSAGES (-1)
#endif
/* Declarations for gettext-using-catgets interface. Derived from
Jim Meyering's libintl.h. */
struct _msg_ent
{
const char *_msg;
int _msg_number;
};
#if HAVE_CATGETS
/* These two variables are defined in the automatically by po-to-tbl.sed
generated file `cat-id-tbl.c'. */
extern const struct _msg_ent _msg_tbl[];
extern int _msg_tbl_length;
#endif
/* For automatical extraction of messages sometimes no real
translation is needed. Instead the string itself is the result. */
#define gettext_noop(Str) (Str)
/* Look up MSGID in the current default message catalog for the current
LC_MESSAGES locale. If not found, returns MSGID itself (the default
text). */
extern char *gettext PARAMS ((const char *__msgid));
extern char *gettext__ PARAMS ((const char *__msgid));
/* Look up MSGID in the DOMAINNAME message catalog for the current
LC_MESSAGES locale. */
extern char *dgettext PARAMS ((const char *__domainname, const char *__msgid));
extern char *dgettext__ PARAMS ((const char *__domainname,
const char *__msgid));
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
locale. */
extern char *dcgettext PARAMS ((const char *__domainname, const char *__msgid,
int __category));
extern char *dcgettext__ PARAMS ((const char *__domainname,
const char *__msgid, int __category));
/* Set the current default message catalog to DOMAINNAME.
If DOMAINNAME is null, return the current default.
If DOMAINNAME is "", reset to the default of "messages". */
extern char *textdomain PARAMS ((const char *__domainname));
extern char *textdomain__ PARAMS ((const char *__domainname));
/* Specify that the DOMAINNAME message catalog will be found
in DIRNAME rather than in the system locale data base. */
extern char *bindtextdomain PARAMS ((const char *__domainname,
const char *__dirname));
extern char *bindtextdomain__ PARAMS ((const char *__domainname,
const char *__dirname));
#if ENABLE_NLS
/* Solaris 2.3 has the gettext function but dcgettext is missing.
So we omit this optimization for Solaris 2.3. BTW, Solaris 2.4
has dcgettext. */
# if !HAVE_CATGETS && (!HAVE_GETTEXT || HAVE_DCGETTEXT)
# define gettext(Msgid) \
dgettext (NULL, Msgid)
# define dgettext(Domainname, Msgid) \
dcgettext (Domainname, Msgid, LC_MESSAGES)
# if defined __GNUC__ && __GNUC__ == 2 && __GNUC_MINOR__ >= 7
/* This global variable is defined in loadmsgcat.c. We need a sign,
whether a new catalog was loaded, which can be associated with all
translations. */
extern int _nl_msg_cat_cntr;
# define dcgettext(Domainname, Msgid, Category) \
(__extension__ \
({ \
char *__result; \
if (__builtin_constant_p (Msgid)) \
{ \
static char *__translation__; \
static int __catalog_counter__; \
if (! __translation__ || __catalog_counter__ != _nl_msg_cat_cntr) \
{ \
__translation__ = \
dcgettext__ (Domainname, Msgid, Category); \
__catalog_counter__ = _nl_msg_cat_cntr; \
} \
__result = __translation__; \
} \
else \
__result = dcgettext__ (Domainname, Msgid, Category); \
__result; \
}))
# endif
# endif
#else
# define gettext(Msgid) (Msgid)
# define dgettext(Domainname, Msgid) (Msgid)
# define dcgettext(Domainname, Msgid, Category) (Msgid)
# define textdomain(Domainname) ((char *) Domainname)
# define bindtextdomain(Domainname, Dirname) ((char *) Dirname)
#endif
/* @@ begin of epilog @@ */
#ifdef __cplusplus
}
#endif
#endif

100
intl/linux-msg.sed Normal file
View file

@ -0,0 +1,100 @@
# po2msg.sed - Convert Uniforum style .po file to Linux style .msg file
# Copyright (C) 1995 Free Software Foundation, Inc.
# Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#
# The first directive in the .msg should be the definition of the
# message set number. We use always set number 1.
#
1 {
i\
$set 1 # Automatically created by po2msg.sed
h
s/.*/0/
x
}
#
# Mitch's old catalog format does not allow comments.
#
# We copy the original message as a comment into the .msg file.
#
/^msgid/ {
s/msgid[ ]*"//
#
# This does not work now with the new format.
# /"$/! {
# s/\\$//
# s/$/ ... (more lines following)"/
# }
x
# The following nice solution is by
# Bruno <Haible@ma2s2.mathematik.uni-karlsruhe.de>
td
# Increment a decimal number in pattern space.
# First hide trailing `9' digits.
:d
s/9\(_*\)$/_\1/
td
# Assure at least one digit is available.
s/^\(_*\)$/0\1/
# Increment the last digit.
s/8\(_*\)$/9\1/
s/7\(_*\)$/8\1/
s/6\(_*\)$/7\1/
s/5\(_*\)$/6\1/
s/4\(_*\)$/5\1/
s/3\(_*\)$/4\1/
s/2\(_*\)$/3\1/
s/1\(_*\)$/2\1/
s/0\(_*\)$/1\1/
# Convert the hidden `9' digits to `0's.
s/_/0/g
x
G
s/\(.*\)"\n\([0-9]*\)/$ #\2 Original Message:(\1)/p
}
#
# The .msg file contains, other then the .po file, only the translations
# but each given a unique ID. Starting from 1 and incrementing by 1 for
# each message we assign them to the messages.
# It is important that the .po file used to generate the cat-id-tbl.c file
# (with po-to-tbl) is the same as the one used here. (At least the order
# of declarations must not be changed.)
#
/^msgstr/ {
s/msgstr[ ]*"\(.*\)"/# \1/
# Clear substitution flag.
tb
# Append the next line.
:b
N
# Look whether second part is continuation line.
s/\(.*\n\)"\(.*\)"/\1\2/
# Yes, then branch.
ta
P
D
# Note that D includes a jump to the start!!
# We found a continuation line. But before printing insert '\'.
:a
s/\(.*\)\(\n.*\)/\1\\\2/
P
# We cannot use D here.
s/.*\n\(.*\)/\1/
tb
}
d

76
intl/loadinfo.h Normal file
View file

@ -0,0 +1,76 @@
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef PARAMS
# if __STDC__
# define PARAMS(args) args
# else
# define PARAMS(args) ()
# endif
#endif
/* Encoding of locale name parts. */
#define CEN_REVISION 1
#define CEN_SPONSOR 2
#define CEN_SPECIAL 4
#define XPG_NORM_CODESET 8
#define XPG_CODESET 16
#define TERRITORY 32
#define CEN_AUDIENCE 64
#define XPG_MODIFIER 128
#define CEN_SPECIFIC (CEN_REVISION|CEN_SPONSOR|CEN_SPECIAL|CEN_AUDIENCE)
#define XPG_SPECIFIC (XPG_CODESET|XPG_NORM_CODESET|XPG_MODIFIER)
struct loaded_l10nfile
{
const char *filename;
int decided;
const void *data;
struct loaded_l10nfile *next;
struct loaded_l10nfile *successor[1];
};
extern const char *_nl_normalize_codeset PARAMS ((const unsigned char *codeset,
size_t name_len));
extern struct loaded_l10nfile *
_nl_make_l10nflist PARAMS ((struct loaded_l10nfile **l10nfile_list,
const char *dirlist, size_t dirlist_len, int mask,
const char *language, const char *territory,
const char *codeset,
const char *normalized_codeset,
const char *modifier, const char *special,
const char *sponsor, const char *revision,
const char *filename, int do_allocate));
extern const char *_nl_expand_alias PARAMS ((const char *name));
extern int _nl_explode_name PARAMS ((char *name, const char **language,
const char **modifier,
const char **territory,
const char **codeset,
const char **normalized_codeset,
const char **special,
const char **sponsor,
const char **revision));

222
intl/loadmsgcat.c Normal file
View file

@ -0,0 +1,222 @@
/* Load needed message catalogs.
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#if defined STDC_HEADERS || defined _LIBC
# include <stdlib.h>
#endif
#if defined HAVE_UNISTD_H || defined _LIBC
# include <unistd.h>
#endif
#if (defined HAVE_MMAP && defined HAVE_MUNMAP) || defined _LIBC
# include <sys/mman.h>
#endif
#include "gettext.h"
#include "gettextP.h"
/* @@ end of prolog @@ */
#ifdef _LIBC
/* Rename the non ISO C functions. This is required by the standard
because some ISO C functions will require linking with this object
file and the name space must not be polluted. */
# define open __open
# define close __close
# define read __read
# define mmap __mmap
# define munmap __munmap
#endif
/* We need a sign, whether a new catalog was loaded, which can be associated
with all translations. This is important if the translations are
cached by one of GCC's features. */
int _nl_msg_cat_cntr = 0;
/* Load the message catalogs specified by FILENAME. If it is no valid
message catalog do nothing. */
void
internal_function
_nl_load_domain (domain_file)
struct loaded_l10nfile *domain_file;
{
int fd;
size_t size;
struct stat st;
struct mo_file_header *data = (struct mo_file_header *) -1;
#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
|| defined _LIBC
int use_mmap = 0;
#endif
struct loaded_domain *domain;
domain_file->decided = 1;
domain_file->data = NULL;
/* If the record does not represent a valid locale the FILENAME
might be NULL. This can happen when according to the given
specification the locale file name is different for XPG and CEN
syntax. */
if (domain_file->filename == NULL)
return;
/* Try to open the addressed file. */
fd = open (domain_file->filename, O_RDONLY);
if (fd == -1)
return;
/* We must know about the size of the file. */
if (fstat (fd, &st) != 0
|| (size = (size_t) st.st_size) != st.st_size
|| size < sizeof (struct mo_file_header))
{
/* Something went wrong. */
close (fd);
return;
}
#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
|| defined _LIBC
/* Now we are ready to load the file. If mmap() is available we try
this first. If not available or it failed we try to load it. */
data = (struct mo_file_header *) mmap (NULL, size, PROT_READ,
MAP_PRIVATE, fd, 0);
if (data != (struct mo_file_header *) -1)
{
/* mmap() call was successful. */
close (fd);
use_mmap = 1;
}
#endif
/* If the data is not yet available (i.e. mmap'ed) we try to load
it manually. */
if (data == (struct mo_file_header *) -1)
{
size_t to_read;
char *read_ptr;
data = (struct mo_file_header *) malloc (size);
if (data == NULL)
return;
to_read = size;
read_ptr = (char *) data;
do
{
long int nb = (long int) read (fd, read_ptr, to_read);
if (nb == -1)
{
close (fd);
return;
}
read_ptr += nb;
to_read -= nb;
}
while (to_read > 0);
close (fd);
}
/* Using the magic number we can test whether it really is a message
catalog file. */
if (data->magic != _MAGIC && data->magic != _MAGIC_SWAPPED)
{
/* The magic number is wrong: not a message catalog file. */
#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
|| defined _LIBC
if (use_mmap)
munmap ((caddr_t) data, size);
else
#endif
free (data);
return;
}
domain_file->data
= (struct loaded_domain *) malloc (sizeof (struct loaded_domain));
if (domain_file->data == NULL)
return;
domain = (struct loaded_domain *) domain_file->data;
domain->data = (char *) data;
#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
|| defined _LIBC
domain->use_mmap = use_mmap;
#endif
domain->mmap_size = size;
domain->must_swap = data->magic != _MAGIC;
/* Fill in the information about the available tables. */
switch (W (domain->must_swap, data->revision))
{
case 0:
domain->nstrings = W (domain->must_swap, data->nstrings);
domain->orig_tab = (struct string_desc *)
((char *) data + W (domain->must_swap, data->orig_tab_offset));
domain->trans_tab = (struct string_desc *)
((char *) data + W (domain->must_swap, data->trans_tab_offset));
domain->hash_size = W (domain->must_swap, data->hash_tab_size);
domain->hash_tab = (nls_uint32 *)
((char *) data + W (domain->must_swap, data->hash_tab_offset));
break;
default:
/* This is an illegal revision. */
#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
|| defined _LIBC
if (use_mmap)
munmap ((caddr_t) data, size);
else
#endif
free (data);
free (domain);
domain_file->data = NULL;
return;
}
/* Show that one domain is changed. This might make some cached
translations invalid. */
++_nl_msg_cat_cntr;
}
#ifdef _LIBC
void
internal_function
_nl_unload_domain (domain)
struct loaded_domain *domain;
{
if (domain->use_mmap)
munmap ((caddr_t) domain->data, domain->mmap_size);
else
free ((void *) domain->data);
free (domain);
}
#endif

424
intl/localealias.c Normal file
View file

@ -0,0 +1,424 @@
/* Handle aliases for locale names.
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <ctype.h>
#include <stdio.h>
#include <sys/types.h>
#ifdef __GNUC__
# define alloca __builtin_alloca
# define HAVE_ALLOCA 1
#else
# if defined HAVE_ALLOCA_H || defined _LIBC
# include <alloca.h>
# else
# ifdef _AIX
#pragma alloca
# else
# ifndef alloca
char *alloca ();
# endif
# endif
# endif
#endif
#if defined STDC_HEADERS || defined _LIBC
# include <stdlib.h>
#else
char *getenv ();
# ifdef HAVE_MALLOC_H
# include <malloc.h>
# else
void free ();
# endif
#endif
#if defined HAVE_STRING_H || defined _LIBC
# ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
# endif
# include <string.h>
#else
# include <strings.h>
# ifndef memcpy
# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
# endif
#endif
#if !HAVE_STRCHR && !defined _LIBC
# ifndef strchr
# define strchr index
# endif
#endif
#include "gettext.h"
#include "gettextP.h"
/* @@ end of prolog @@ */
#ifdef _LIBC
/* Rename the non ANSI C functions. This is required by the standard
because some ANSI C functions will require linking with this object
file and the name space must not be polluted. */
# define strcasecmp __strcasecmp
# define mempcpy __mempcpy
# define HAVE_MEMPCPY 1
/* We need locking here since we can be called from different places. */
# include <bits/libc-lock.h>
__libc_lock_define_initialized (static, lock);
#endif
/* For those loosing systems which don't have `alloca' we have to add
some additional code emulating it. */
#ifdef HAVE_ALLOCA
/* Nothing has to be done. */
# define ADD_BLOCK(list, address) /* nothing */
# define FREE_BLOCKS(list) /* nothing */
#else
struct block_list
{
void *address;
struct block_list *next;
};
# define ADD_BLOCK(list, addr) \
do { \
struct block_list *newp = (struct block_list *) malloc (sizeof (*newp)); \
/* If we cannot get a free block we cannot add the new element to \
the list. */ \
if (newp != NULL) { \
newp->address = (addr); \
newp->next = (list); \
(list) = newp; \
} \
} while (0)
# define FREE_BLOCKS(list) \
do { \
while (list != NULL) { \
struct block_list *old = list; \
list = list->next; \
free (old); \
} \
} while (0)
# undef alloca
# define alloca(size) (malloc (size))
#endif /* have alloca */
struct alias_map
{
const char *alias;
const char *value;
};
static char *string_space = NULL;
static size_t string_space_act = 0;
static size_t string_space_max = 0;
static struct alias_map *map;
static size_t nmap = 0;
static size_t maxmap = 0;
/* Prototypes for local functions. */
static size_t read_alias_file PARAMS ((const char *fname, int fname_len))
internal_function;
static void extend_alias_table PARAMS ((void));
static int alias_compare PARAMS ((const struct alias_map *map1,
const struct alias_map *map2));
const char *
_nl_expand_alias (name)
const char *name;
{
static const char *locale_alias_path = LOCALE_ALIAS_PATH;
struct alias_map *retval;
const char *result = NULL;
size_t added;
#ifdef _LIBC
__libc_lock_lock (lock);
#endif
do
{
struct alias_map item;
item.alias = name;
if (nmap > 0)
retval = (struct alias_map *) bsearch (&item, map, nmap,
sizeof (struct alias_map),
(int (*) PARAMS ((const void *,
const void *))
) alias_compare);
else
retval = NULL;
/* We really found an alias. Return the value. */
if (retval != NULL)
{
result = retval->value;
break;
}
/* Perhaps we can find another alias file. */
added = 0;
while (added == 0 && locale_alias_path[0] != '\0')
{
const char *start;
while (locale_alias_path[0] == ':')
++locale_alias_path;
start = locale_alias_path;
while (locale_alias_path[0] != '\0' && locale_alias_path[0] != ':')
++locale_alias_path;
if (start < locale_alias_path)
added = read_alias_file (start, locale_alias_path - start);
}
}
while (added != 0);
#ifdef _LIBC
__libc_lock_unlock (lock);
#endif
return result;
}
static size_t
internal_function
read_alias_file (fname, fname_len)
const char *fname;
int fname_len;
{
#ifndef HAVE_ALLOCA
struct block_list *block_list = NULL;
#endif
FILE *fp;
char *full_fname;
size_t added;
static const char aliasfile[] = "/locale.alias";
full_fname = (char *) alloca (fname_len + sizeof aliasfile);
ADD_BLOCK (block_list, full_fname);
#ifdef HAVE_MEMPCPY
mempcpy (mempcpy (full_fname, fname, fname_len),
aliasfile, sizeof aliasfile);
#else
memcpy (full_fname, fname, fname_len);
memcpy (&full_fname[fname_len], aliasfile, sizeof aliasfile);
#endif
fp = fopen (full_fname, "r");
if (fp == NULL)
{
FREE_BLOCKS (block_list);
return 0;
}
added = 0;
while (!feof (fp))
{
/* It is a reasonable approach to use a fix buffer here because
a) we are only interested in the first two fields
b) these fields must be usable as file names and so must not
be that long
*/
unsigned char buf[BUFSIZ];
unsigned char *alias;
unsigned char *value;
unsigned char *cp;
if (fgets (buf, sizeof buf, fp) == NULL)
/* EOF reached. */
break;
/* Possibly not the whole line fits into the buffer. Ignore
the rest of the line. */
if (strchr (buf, '\n') == NULL)
{
char altbuf[BUFSIZ];
do
if (fgets (altbuf, sizeof altbuf, fp) == NULL)
/* Make sure the inner loop will be left. The outer loop
will exit at the `feof' test. */
break;
while (strchr (altbuf, '\n') == NULL);
}
cp = buf;
/* Ignore leading white space. */
while (isspace (cp[0]))
++cp;
/* A leading '#' signals a comment line. */
if (cp[0] != '\0' && cp[0] != '#')
{
alias = cp++;
while (cp[0] != '\0' && !isspace (cp[0]))
++cp;
/* Terminate alias name. */
if (cp[0] != '\0')
*cp++ = '\0';
/* Now look for the beginning of the value. */
while (isspace (cp[0]))
++cp;
if (cp[0] != '\0')
{
size_t alias_len;
size_t value_len;
value = cp++;
while (cp[0] != '\0' && !isspace (cp[0]))
++cp;
/* Terminate value. */
if (cp[0] == '\n')
{
/* This has to be done to make the following test
for the end of line possible. We are looking for
the terminating '\n' which do not overwrite here. */
*cp++ = '\0';
*cp = '\n';
}
else if (cp[0] != '\0')
*cp++ = '\0';
if (nmap >= maxmap)
extend_alias_table ();
alias_len = strlen (alias) + 1;
value_len = strlen (value) + 1;
if (string_space_act + alias_len + value_len > string_space_max)
{
/* Increase size of memory pool. */
size_t new_size = (string_space_max
+ (alias_len + value_len > 1024
? alias_len + value_len : 1024));
char *new_pool = (char *) realloc (string_space, new_size);
if (new_pool == NULL)
{
FREE_BLOCKS (block_list);
return added;
}
string_space = new_pool;
string_space_max = new_size;
}
map[nmap].alias = memcpy (&string_space[string_space_act],
alias, alias_len);
string_space_act += alias_len;
map[nmap].value = memcpy (&string_space[string_space_act],
value, value_len);
string_space_act += value_len;
++nmap;
++added;
}
}
}
/* Should we test for ferror()? I think we have to silently ignore
errors. --drepper */
fclose (fp);
if (added > 0)
qsort (map, nmap, sizeof (struct alias_map),
(int (*) PARAMS ((const void *, const void *))) alias_compare);
FREE_BLOCKS (block_list);
return added;
}
static void
extend_alias_table ()
{
size_t new_size;
struct alias_map *new_map;
new_size = maxmap == 0 ? 100 : 2 * maxmap;
new_map = (struct alias_map *) realloc (map, (new_size
* sizeof (struct alias_map)));
if (new_map == NULL)
/* Simply don't extend: we don't have any more core. */
return;
map = new_map;
maxmap = new_size;
}
#ifdef _LIBC
static void __attribute__ ((unused))
free_mem (void)
{
if (string_space != NULL)
free (string_space);
if (map != NULL)
free (map);
}
text_set_element (__libc_subfreeres, free_mem);
#endif
static int
alias_compare (map1, map2)
const struct alias_map *map1;
const struct alias_map *map2;
{
#if defined _LIBC || defined HAVE_STRCASECMP
return strcasecmp (map1->alias, map2->alias);
#else
const unsigned char *p1 = (const unsigned char *) map1->alias;
const unsigned char *p2 = (const unsigned char *) map2->alias;
unsigned char c1, c2;
if (p1 == p2)
return 0;
do
{
/* I know this seems to be odd but the tolower() function in
some systems libc cannot handle nonalpha characters. */
c1 = isupper (*p1) ? tolower (*p1) : *p1;
c2 = isupper (*p2) ? tolower (*p2) : *p2;
if (c1 == '\0')
break;
++p1;
++p2;
}
while (c1 == c2);
return c1 - c2;
#endif
}

102
intl/po2tbl.sed.in Normal file
View file

@ -0,0 +1,102 @@
# po2tbl.sed - Convert Uniforum style .po file to lookup table for catgets
# Copyright (C) 1995 Free Software Foundation, Inc.
# Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
1 {
i\
/* Automatically generated by po2tbl.sed from @PACKAGE NAME@.pot. */\
\
#if HAVE_CONFIG_H\
# include <config.h>\
#endif\
\
#include "libgettext.h"\
\
const struct _msg_ent _msg_tbl[] = {
h
s/.*/0/
x
}
#
# Write msgid entries in C array form.
#
/^msgid/ {
s/msgid[ ]*\(".*"\)/ {\1/
tb
# Append the next line
:b
N
# Look whether second part is continuation line.
s/\(.*\)"\(\n\)"\(.*"\)/\1\2\3/
# Yes, then branch.
ta
# Because we assume that the input file correctly formed the line
# just read cannot be again be a msgid line. So it's safe to ignore
# it.
s/\(.*\)\n.*/\1/
bc
# We found a continuation line. But before printing insert '\'.
:a
s/\(.*\)\(\n.*\)/\1\\\2/
P
# We cannot use D here.
s/.*\n\(.*\)/\1/
# Some buggy seds do not clear the `successful substitution since last ``t'''
# flag on `N', so we do a `t' here to clear it.
tb
# Not reached
:c
x
# The following nice solution is by
# Bruno <Haible@ma2s2.mathematik.uni-karlsruhe.de>
td
# Increment a decimal number in pattern space.
# First hide trailing `9' digits.
:d
s/9\(_*\)$/_\1/
td
# Assure at least one digit is available.
s/^\(_*\)$/0\1/
# Increment the last digit.
s/8\(_*\)$/9\1/
s/7\(_*\)$/8\1/
s/6\(_*\)$/7\1/
s/5\(_*\)$/6\1/
s/4\(_*\)$/5\1/
s/3\(_*\)$/4\1/
s/2\(_*\)$/3\1/
s/1\(_*\)$/2\1/
s/0\(_*\)$/1\1/
# Convert the hidden `9' digits to `0's.
s/_/0/g
x
G
s/\(.*\)\n\([0-9]*\)/\1, \2},/
s/\(.*\)"$/\1/
p
}
#
# Last line.
#
$ {
i\
};\
g
s/0*\(.*\)/int _msg_tbl_length = \1;/p
}
d

108
intl/textdomain.c Normal file
View file

@ -0,0 +1,108 @@
/* Implementation of the textdomain(3) function.
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#if defined STDC_HEADERS || defined _LIBC
# include <stdlib.h>
#endif
#if defined STDC_HEADERS || defined HAVE_STRING_H || defined _LIBC
# include <string.h>
#else
# include <strings.h>
# ifndef memcpy
# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
# endif
#endif
#ifdef _LIBC
# include <libintl.h>
#else
# include "libgettext.h"
#endif
/* @@ end of prolog @@ */
/* Name of the default text domain. */
extern const char _nl_default_default_domain[];
/* Default text domain in which entries for gettext(3) are to be found. */
extern const char *_nl_current_default_domain;
/* Names for the libintl functions are a problem. They must not clash
with existing names and they should follow ANSI C. But this source
code is also used in GNU C Library where the names have a __
prefix. So we have to make a difference here. */
#ifdef _LIBC
# define TEXTDOMAIN __textdomain
# ifndef strdup
# define strdup(str) __strdup (str)
# endif
#else
# define TEXTDOMAIN textdomain__
#endif
/* Set the current default message catalog to DOMAINNAME.
If DOMAINNAME is null, return the current default.
If DOMAINNAME is "", reset to the default of "messages". */
char *
TEXTDOMAIN (domainname)
const char *domainname;
{
char *old;
/* A NULL pointer requests the current setting. */
if (domainname == NULL)
return (char *) _nl_current_default_domain;
old = (char *) _nl_current_default_domain;
/* If domain name is the null string set to default domain "messages". */
if (domainname[0] == '\0'
|| strcmp (domainname, _nl_default_default_domain) == 0)
_nl_current_default_domain = _nl_default_default_domain;
else
{
/* If the following malloc fails `_nl_current_default_domain'
will be NULL. This value will be returned and so signals we
are out of core. */
#if defined _LIBC || defined HAVE_STRDUP
_nl_current_default_domain = strdup (domainname);
#else
size_t len = strlen (domainname) + 1;
char *cp = (char *) malloc (len);
if (cp != NULL)
memcpy (cp, domainname, len);
_nl_current_default_domain = cp;
#endif
}
if (old != _nl_default_default_domain)
free (old);
return (char *) _nl_current_default_domain;
}
#ifdef _LIBC
/* Alias for function name in GNU C Library. */
weak_alias (__textdomain, textdomain);
#endif

104
intl/xopen-msg.sed Normal file
View file

@ -0,0 +1,104 @@
# po2msg.sed - Convert Uniforum style .po file to X/Open style .msg file
# Copyright (C) 1995 Free Software Foundation, Inc.
# Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#
# The first directive in the .msg should be the definition of the
# message set number. We use always set number 1.
#
1 {
i\
$set 1 # Automatically created by po2msg.sed
h
s/.*/0/
x
}
#
# We copy all comments into the .msg file. Perhaps they can help.
#
/^#/ s/^#[ ]*/$ /p
#
# We copy the original message as a comment into the .msg file.
#
/^msgid/ {
# Does not work now
# /"$/! {
# s/\\$//
# s/$/ ... (more lines following)"/
# }
s/^msgid[ ]*"\(.*\)"$/$ Original Message: \1/
p
}
#
# The .msg file contains, other then the .po file, only the translations
# but each given a unique ID. Starting from 1 and incrementing by 1 for
# each message we assign them to the messages.
# It is important that the .po file used to generate the cat-id-tbl.c file
# (with po-to-tbl) is the same as the one used here. (At least the order
# of declarations must not be changed.)
#
/^msgstr/ {
s/msgstr[ ]*"\(.*\)"/\1/
x
# The following nice solution is by
# Bruno <Haible@ma2s2.mathematik.uni-karlsruhe.de>
td
# Increment a decimal number in pattern space.
# First hide trailing `9' digits.
:d
s/9\(_*\)$/_\1/
td
# Assure at least one digit is available.
s/^\(_*\)$/0\1/
# Increment the last digit.
s/8\(_*\)$/9\1/
s/7\(_*\)$/8\1/
s/6\(_*\)$/7\1/
s/5\(_*\)$/6\1/
s/4\(_*\)$/5\1/
s/3\(_*\)$/4\1/
s/2\(_*\)$/3\1/
s/1\(_*\)$/2\1/
s/0\(_*\)$/1\1/
# Convert the hidden `9' digits to `0's.
s/_/0/g
x
# Bring the line in the format `<number> <message>'
G
s/^[^\n]*$/& /
s/\(.*\)\n\([0-9]*\)/\2 \1/
# Clear flag from last substitution.
tb
# Append the next line.
:b
N
# Look whether second part is a continuation line.
s/\(.*\n\)"\(.*\)"/\1\2/
# Yes, then branch.
ta
P
D
# Note that `D' includes a jump to the start!!
# We found a continuation line. But before printing insert '\'.
:a
s/\(.*\)\(\n.*\)/\1\\\2/
P
# We cannot use the sed command `D' here
s/.*\n\(.*\)/\1/
tb
}
d

284
main.c Normal file
View file

@ -0,0 +1,284 @@
/*
nparted - a frontend to libparted for manipulating disk partitions
thinked to dbootstrap
Copyright (C) 1998-2000 Mario Teijeiro Otero Esteve Fernández
Jaime Villate La Espiral
Mario Teijeiro Otero <asimovi@teleline.es>
Esteve Fernández < esteve@crosswinds.net >
Jaime Villate <villate@fe.up.pt>
La Espiral http://www.laespiral.org
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
*/
/* Consideraciones, es mejor abrir y cerrar todos los disks y devices
* que se utilicen , no dejarlos abiertos y que se cierren cuando se
* salga. así es más fácil de que no se nos escape algúna estructura
* sin cerrar
*/
#include "nparted.h"
char ptrb[256];
size screen_size;
size mainwin_size;
typedef struct _itemlist itemlist;
struct _itemlist{
char dev[20]; /*Nombre del dispositivo al cual pertenece */
int part; /* Número de partición -1 si es un disco*/
};
void done_parted(void);
/* crea una lista de componentes con data un itemlist*/
int do_list_disks( newtComponent list )
{
PedDevice *dev;
PedPartition *part;
PedDisk *disk;
PedGeometry *geom;
PedFileSystemType *fs_type;
itemlist *item;
char fs_name[40];
int i;
long long tam,start,end;
dev=NULL;
for (i=0;(dev=ped_device_get_next(dev))!=NULL;i++){
tam=(dev->sector_size*dev->length)/(1024*1024);
sprintf(ptrb,"%s: %s-%s(%d-%d-%d %dB/sec) %LdMb",dev->path,
get_name_device_type(dev->type),
dev->model,dev->heads,dev->sectors,
dev->cylinders, dev->sector_size, tam);
item=(itemlist*)NP_malloc(sizeof(itemlist));
strcpy(item->dev,dev->path);
item->dev[8]='\0';
item->part=-1;
newtListboxAppendEntry(list,ptrb,item);
disk=ped_disk_open(dev);
part=NULL;
if (disk==NULL){
if(ped_exception_throw(PED_EXCEPTION_FATAL,
PED_EXCEPTION_IGNORE+
PED_EXCEPTION_CANCEL,
_("Device detected, but I can't open it"))==
PED_EXCEPTION_CANCEL){
done_parted();
exit (-1);
}else{
continue;
}
}
while((part=ped_disk_next_partition(disk,part))!=NULL){
if(part->num==-1){
if (part->type!=PED_PARTITION_FREESPACE)
continue;
}
geom=&(part->geom);
fs_type=ped_file_system_probe(geom);
if (fs_type!=NULL && fs_type->name!=NULL)
strcpy(fs_name,fs_type->name);
else
strcpy(fs_name,"");
tam=geom->length*dev->sector_size; //bytes
tam=tam/(1024*1024); //Mbytes
/* Tam-cilindro=head*sectors*sizeofsector*/
start=geom->start/(dev->heads*dev->sectors)+1;
end=geom->end/(dev->heads*dev->sectors)+1;
sprintf(ptrb," %s%-2d: %-8s Cil:(%Ld-%Ld) %LdMB %-8s",
dev->path, part->num,
ped_partition_type_get_name(part->type),
start,end,tam,fs_name);
item=(itemlist*)NP_malloc(sizeof(itemlist));
strcpy(item->dev,dev->path);
item->dev[8]='\0';
item->part=part->num;
newtListboxAppendEntry(list,ptrb,item);
}
ped_disk_close(disk);
}
if (i==0){
/*Ningún disco duro encontrado, Mejor lanzamos una
excepción diciendo que se no se encontró ningún
disco y que posiblemente sea porque no es superusuario
*/
ped_exception_throw(PED_EXCEPTION_FATAL,
PED_EXCEPTION_OK,
_("No device detected, Are you root? "));
// done_parted(); /* Pero esto que coño hace aquí,
// deben ser restos de primeras pruebas */
//exit(0);
return 0;
}
return 1;
}
/* Esta función debe volver cuando hay que salir del programa */
void do_main_window()
{
newtComponent formMain,list_disks,add,del,edit,copy,quit,ans;
struct newtExitStruct toexit;
itemlist *item;
int key;
mainwin_size.width=screen_size.width-5;
mainwin_size.height=screen_size.height-5;
newtCenteredWindow(mainwin_size.width, mainwin_size.height,
_("Select the disk or partition"));
formMain=newtForm(NULL,NULL,0);
list_disks=newtListbox(1,2,13,NEWT_FLAG_SCROLL);
newtListboxSetWidth(list_disks,62);
if (!do_list_disks(list_disks)) return;
add=newtButton (mainwin_size.width-10,2,_(" Add "));
del=newtButton(mainwin_size.width-10,7,_(" Del "));
edit=newtButton(mainwin_size.width-10,12,_(" Edit"));
copy=newtButton(5,16,_(" Copy"));
quit=newtButton(mainwin_size.width-30,16,_(" Quit"));
newtFormAddComponents(formMain,add,del,edit,copy,quit,list_disks,
NULL);
ans=NULL;
do{
newtFormRun(formMain,&toexit);
key=-1;
if (toexit.reason==NEWT_EXIT_COMPONENT)
ans=toexit.u.co;
else
key=toexit.u.key;
if(ans==edit){
item=(itemlist*)newtListboxGetCurrent(list_disks);
if((!item)&& (item->dev[0]!='/')){
ped_exception_throw(PED_EXCEPTION_FATAL,
PED_EXCEPTION_OK,
_("Intern error have ocurred"));
done_parted();
exit(-1);
}
if (item->part==-1){
ped_exception_throw(PED_EXCEPTION_INFORMATION,
PED_EXCEPTION_OK,
_("A Hard disk, can't edit, select a partition or add a new partition"));
ped_exception_catch();
}else{
edit_partition(ped_device_get(item->dev),
item->part);
}
}else
if (ans==add){
item=(itemlist*) newtListboxGetCurrent(list_disks);
add_partition(ped_device_get(item->dev));
}else
if (ans==del){
item=(itemlist*) newtListboxGetCurrent(list_disks);
if(item->part==-1){
ped_exception_throw(PED_EXCEPTION_INFORMATION,
PED_EXCEPTION_OK,
_("Can't del a hard disk, if you want del, remove it from equipment ;-)"));
ped_exception_catch();
}else{
del_partition(ped_device_get(item->dev),
item->part);
}
}else
if (ans==copy){
item=(itemlist*) newtListboxGetCurrent(list_disks);
if (item->part==-1){
ped_exception_throw(PED_EXCEPTION_INFORMATION,
PED_EXCEPTION_OK,
_("Please, select the partition to copy,I can't copy the whole disk"));
ped_exception_catch();
}else{
copy_partition(ped_device_get(item->dev),
item->part);
}
}
/* Después de cada operación volvemos a leer la lista
* de particiones, así que tenemos que actualizar list_disks
*/
if(ans!=quit){
/*FIXME:Borramos todas las entradas, quizas no libere el
* data de la lista, pero es poca memoria, quizas hay
* que eliminar entrada por entrada*/
newtListboxClear(list_disks)
/* Volvemos a leer la lista*/;
do_list_disks( list_disks );
}
}while(key!=NEWT_KEY_F1&&ans!=quit);
newtFormDestroy(formMain);
}
void init_parted (void )
{
ped_exception_set_handler(exception_handler);
ped_init();
ped_device_probe_all();
newtInit();
newtCls();
newtDrawRootText(0,0,_("Debian Instalation"));
#if defined(VERSION) && defined(PACKAGE)
sprintf(ptrb,_("%s v.%s"),PACKAGE,VERSION);
#else
sprintf(ptrb,_("NParted "));
#endif
newtDrawRootText(-25,-1,ptrb);
newtGetScreenSize(&screen_size.width, &screen_size.height);
}
void done_parted(void )
{
newtFinished();
ped_done();
}
#ifndef BOOTFLOPPIES
int main (void)
#else
int init_nparted(void)
#endif
{
init_parted();
do_main_window();
done_parted();
return 0;
}

190
missing Executable file
View file

@ -0,0 +1,190 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
case "$1" in
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing - GNU libit 0.0"
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
aclocal)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acinclude.m4' or \`configure.in'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`configure.in'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acconfig.h' or \`configure.in'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case "$f" in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if [ ! -f y.tab.h ]; then
echo >y.tab.h
fi
if [ ! -f y.tab.c ]; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if [ ! -f lex.yy.c ]; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
makeinfo)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
fi
touch $file
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and you do not seem to have it handy on your
system. You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequirements for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0

40
mkinstalldirs Executable file
View file

@ -0,0 +1,40 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
# $Id: mkinstalldirs,v 1.1 2000/10/15 21:55:07 emeteo Exp $
errstatus=0
for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d
do
pathcomp="$pathcomp$d"
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
fi
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# mkinstalldirs ends here

597
nparted.c Normal file
View file

@ -0,0 +1,597 @@
/*
parted - a frontend to libparted
Copyright (C) 1999-2000 Andrew Clausen, Lennert Buytenhek and Red Hat, Inc.
Andrew Clausen <clausen@gnu.org>
Lennert Buytenhek <buytenh@gnu.org>
Matt Wilson, Red Hat Inc. <msw@redhat.com>
Modificated for Mario Teijeiro Otero <asimovi@teleline.es> for nparted
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
*/
#include <nparted.h>
int do_check (PedDevice** dev, int npart)
{
PedDisk* disk;
PedFileSystem* fs;
PedPartition* part;
disk = ped_disk_open (*dev);
if (!disk)
goto error;
part = ped_disk_get_partition (disk, npart);
if (!part) {
ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
_("Partition doesn't exist."));
goto error_close_disk;
}
fs = ped_file_system_open (&part->geom);
if (!fs)
goto error_close_disk;
ped_file_system_check (fs);
ped_file_system_close (fs);
ped_disk_close (disk);
return 1;
error_close_disk:
ped_disk_close (disk);
error:
return 0;
}
int do_cp (PedDevice** dev,int npart_src, char* dev_dest,int npart_dest)
{
PedDisk* src_disk = NULL;
PedDisk* dst_disk = NULL;
PedDevice* dst_device;
PedPartition* src = NULL;
PedPartition* dst = NULL;
PedFileSystem* src_fs = NULL;
src_disk = ped_disk_open (*dev);
if (!src_disk)
goto error;
/* figure out source partition */
src = ped_disk_get_partition (src_disk, npart_src);
if (!src) {
ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
_("Source partition doesn't exist."));
goto error_close_disk;
}
if (src->type == PED_PARTITION_EXTENDED) {
ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
_("Can't copy extended partitions."));
goto error_close_disk;
}
/* figure out target partition */
dst_device = ped_device_get (dev_dest);
if (!dst_device)
goto error_close_disk;
dst_disk = ped_disk_open (dst_device);
dst = ped_disk_get_partition (dst_disk, npart_dest);
if (!dst) {
ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
_("Destination partition doesn't exist."));
goto error_close_disk;
}
if (ped_partition_is_busy (dst)) {
if (ped_exception_throw (
PED_EXCEPTION_WARNING,
PED_EXCEPTION_IGNORE_CANCEL,
_("Destination partition is being used."))
!= PED_EXCEPTION_IGNORE)
goto error_close_disk;
}
dst->type = src->type;
/* do the copy */
src_fs = ped_file_system_open (&src->geom);
if (!src_fs)
goto error_close_disk;
if (!ped_file_system_copy (src_fs, &dst->geom))
goto error_close_fs;
ped_file_system_close (src_fs);
if (dst_disk && src_disk != dst_disk)
ped_disk_close (dst_disk);
ped_disk_close (src_disk);
return 1;
error_close_fs:
ped_file_system_close (src_fs);
error_close_disk:
if (dst_disk && src_disk != dst_disk)
ped_disk_close (dst_disk);
ped_disk_close (src_disk);
error:
return 0;
}
int do_mklabel (PedDevice** dev,char *label)
{
PedDisk* disk;
PedDiskType* type;
ped_exception_fetch_all ();
disk = ped_disk_open (*dev);
if (!disk) ped_exception_catch ();
ped_exception_leave_all ();
if (disk) {
if (ped_disk_is_busy (disk)) {
if (ped_exception_throw (
PED_EXCEPTION_WARNING,
PED_EXCEPTION_IGNORE_CANCEL,
_("Partition(s) on %s are being used."),
disk->dev->path)
!= PED_EXCEPTION_IGNORE) {
ped_disk_close (disk);
return 0;
}
}
ped_disk_close (disk);
}
type = ped_disk_type_get (label);
if (!type)
goto error_syntax;
ped_disk_create (*dev, type);
return 1;
error_syntax:
return 0;
}
int do_mkfs (PedDevice** dev,int npart, char *fs_type)
{
PedDisk* disk;
PedPartition* part;
PedFileSystemType* type;
PedFileSystem* fs;
disk = ped_disk_open (*dev);
if (!disk)
goto error;
part = ped_disk_get_partition (disk, npart);
if (!part) {
ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
_("Partition doesn't exist."));
goto error_close_disk;
}
if (ped_partition_is_busy (part)) {
if (ped_exception_throw (
PED_EXCEPTION_WARNING,
PED_EXCEPTION_IGNORE_CANCEL,
_("Partition is being used."))
!= PED_EXCEPTION_IGNORE)
goto error_close_disk;
}
if (!fs_type)
goto error_close_disk;
type = ped_file_system_type_get (fs_type);
if (!type) {
ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
_("Unknown filesystem type."));
goto error_close_disk;
}
fs = ped_file_system_create (&part->geom, type);
if (!fs)
goto error;
ped_file_system_close (fs);
if (!ped_partition_set_system (part, type))
goto error_close_disk;
if (!ped_disk_write (disk))
goto error_close_disk;
ped_disk_close (disk);
return 1;
error_close_disk:
ped_disk_close (disk);
error:
return 0;
}
int do_mkpart (PedDevice** dev,char ptype,char *ftype,PedSector start,PedSector end)
{
PedDisk* disk;
PedPartition* part;
PedPartitionType part_type;
PedFileSystemType* fs_type;
PedConstraint* constraint;
disk = ped_disk_open (*dev);
if (!disk)
goto error;
constraint = ped_constraint_any (disk);
if (!constraint)
goto error_close_disk;
switch (ptype) {
case 'p': part_type = PED_PARTITION_PRIMARY; break;
case 'e': part_type = PED_PARTITION_EXTENDED; break;
case 'l': part_type = PED_PARTITION_LOGICAL; break;
default: goto error_destroy_constraint;
}
if (part_type == PED_PARTITION_EXTENDED) {
fs_type = NULL;
} else {
if (!ftype) {
goto error_destroy_constraint;
}
fs_type = ped_file_system_type_get (ftype);
if (!fs_type) {
ped_exception_throw (PED_EXCEPTION_ERROR,
PED_EXCEPTION_CANCEL,
_("Unknown file system type."));
goto error_destroy_constraint;
}
}
part = ped_partition_new (disk, part_type, fs_type, start, end);
if (!part)
goto error_destroy_constraint;
if (!ped_disk_add_partition (disk, part, constraint))
goto error_destroy_part;
/* FIXME: ped_partition_new() doesn't probe the file system for
* what type of partition should be created. So we do it here.
* Question: SHOULD we probe the file system on
* ped_partition_new()? It only makes sense if someone accidently
* delete their partition...
*/
ped_partition_set_system (part, fs_type);
ped_disk_write (disk);
ped_constraint_destroy (constraint);
ped_disk_close (disk);
return 1;
error_destroy_part:
ped_partition_destroy (part);
error_destroy_constraint:
ped_constraint_destroy (constraint);
error_close_disk:
ped_disk_close (disk);
error:
return 0;
}
/* FIXME - this is a mess */
int do_mkpartfs (PedDevice** dev,char ptype,char *ftype,PedSector start, PedSector end)
{
PedDisk* disk;
PedPartition* part;
PedPartitionType part_type;
PedFileSystemType* fs_type;
PedFileSystem* fs;
PedConstraint* constraint;
disk = ped_disk_open (*dev);
if (!disk)
goto error;
constraint = ped_constraint_any (disk);
if (!constraint)
goto error_close_disk;
switch (ptype) {
case 'p': part_type = PED_PARTITION_PRIMARY; break;
case 'l': part_type = PED_PARTITION_LOGICAL; break;
case 'e':
default: goto error_destroy_constraint;
}
if (part_type == PED_PARTITION_EXTENDED) {
fs_type = NULL;
} else {
if (!ftype) {
goto error_destroy_constraint;
}
fs_type = ped_file_system_type_get (ftype);
if (!fs_type) {
ped_exception_throw (PED_EXCEPTION_ERROR,
PED_EXCEPTION_CANCEL,
_("Unknown file system type."));
goto error_destroy_constraint;
}
}
part = ped_partition_new (disk, part_type, fs_type, start, end);
if (!part)
goto error_destroy_constraint;
if (!ped_disk_add_partition (disk, part, constraint))
goto error_destroy_part;
fs = ped_file_system_create (&part->geom, fs_type);
if (!fs)
goto error_remove_part;
ped_file_system_close (fs);
/* set the system AGAIN, because if it's FAT16 or FAT32 (or whatever) will
* be known now.
*/
ped_partition_set_system (part, fs_type);
ped_disk_write (disk);
ped_constraint_destroy (constraint);
ped_disk_close (disk);
return 1;
error_remove_part:
ped_disk_delete_partition (disk, part);
goto error_close_disk;
error_destroy_part:
ped_partition_destroy (part);
error_destroy_constraint:
ped_constraint_destroy (constraint);
error_close_disk:
ped_disk_close (disk);
error:
return 0;
}
int do_move (PedDevice** dev,int part_src,PedSector start, PedSector end)
{
PedDisk* disk = NULL;
PedPartition* part = NULL;
PedGeometry old_geom;
PedConstraint* constraint;
PedFileSystem* fs = NULL;
disk = ped_disk_open (*dev);
if (!disk)
goto error;
part = ped_disk_get_partition (disk, part_src);
if (!part) {
ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
_("Partition doesn't exist."));
goto error_close_disk;
}
if (part->type == PED_PARTITION_EXTENDED) {
ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
_("Can't move extended partitions."));
goto error_close_disk;
}
if (ped_partition_is_busy (part)) {
if (ped_exception_throw (
PED_EXCEPTION_WARNING,
PED_EXCEPTION_IGNORE_CANCEL,
_("Partition is being used."))
!= PED_EXCEPTION_IGNORE)
goto error_close_disk;
}
/* NOTE: this gets aligned by ped_disk_set_partition_geom() */
old_geom = part->geom;
constraint = ped_constraint_any (disk);
if (!constraint)
goto error_close_disk;
if (!ped_disk_set_partition_geom (disk, part, constraint, start, end)) {
ped_constraint_destroy (constraint);
goto error_close_disk;
}
if (ped_geometry_test_overlap (&old_geom, &part->geom)) {
ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
_("Can't move a partition onto itself. Try using "
"resize, perhaps?"));
goto error_close_disk;
}
/* do the move */
fs = ped_file_system_open (&old_geom);
if (!fs)
goto error_close_disk;
if (!ped_file_system_copy (fs, &part->geom))
goto error_close_fs;
ped_file_system_close (fs);
if (!ped_disk_write (disk))
goto error_close_disk;
ped_disk_close (disk);
return 1;
error_close_fs:
ped_file_system_close (fs);
error_close_disk:
ped_disk_close (disk);
error:
return 0;
}
int do_name (PedDevice** dev, int npart,char *name)
{
PedDisk* disk;
PedPartition* part;
disk = ped_disk_open (*dev);
if (!disk)
goto error;
part = ped_disk_get_partition (disk, npart);
if (!part) {
ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
_("Partition doesn't exist."));
goto error_close_disk;
}
if (!name) {
goto error_close_disk;
}
if (!ped_partition_set_name (part, name))
goto error_close_disk;
if (!ped_disk_write (disk))
goto error_close_disk;
ped_disk_close (disk);
return 1;
error_close_disk:
ped_disk_close (disk);
error:
return 0;
}
int do_resize (PedDevice** dev,int npart, PedSector start, PedSector end)
{
PedDisk* disk;
PedPartition* part;
PedFileSystem* fs;
PedFileSystemType* fs_type;
PedConstraint* constraint;
disk = ped_disk_open (*dev);
if (!disk)
goto error;
part = ped_disk_get_partition (disk, npart);
if (!part) {
ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
_("Partition doesn't exist."));
goto error_close_disk;
}
if (ped_partition_is_busy (part)) {
if (ped_exception_throw (
PED_EXCEPTION_WARNING,
PED_EXCEPTION_IGNORE_CANCEL,
_("Partition is being used."))
!= PED_EXCEPTION_IGNORE)
goto error_close_disk;
}
if (part->type == PED_PARTITION_EXTENDED) {
constraint = ped_constraint_any (disk);
if (!ped_disk_set_partition_geom (disk, part, constraint,
start, end))
goto error_destroy_constraint;
ped_partition_set_system (part, NULL);
} else {
fs = ped_file_system_open (&part->geom);
if (!fs)
goto error_close_disk;
fs_type = fs->type;
constraint = ped_file_system_get_resize_constraint (fs);
if (!ped_disk_set_partition_geom (disk, part, constraint,
start, end))
goto error_close_fs;
if (!ped_file_system_resize (fs, &part->geom))
goto error_close_fs;
ped_file_system_close (fs);
ped_partition_set_system (part, fs_type);
}
ped_disk_write (disk);
ped_constraint_destroy (constraint);
ped_disk_close (disk);
return 1;
error_close_fs:
ped_file_system_close (fs);
error_destroy_constraint:
ped_constraint_destroy (constraint);
error_close_disk:
ped_disk_close (disk);
error:
return 0;
}
int do_rm (PedDevice** dev, int npart)
{
PedDisk* disk;
PedPartition* part;
disk = ped_disk_open (*dev);
if (!disk)
goto error;
part = ped_disk_get_partition (disk, npart);
if (!part) {
ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
_("Partition doesn't exist."));
goto error_close_disk;
}
if (ped_partition_is_busy (part)) {
if (ped_exception_throw (
PED_EXCEPTION_WARNING,
PED_EXCEPTION_IGNORE_CANCEL,
_("Partition is being used."))
!= PED_EXCEPTION_IGNORE)
goto error_close_disk;
}
ped_disk_delete_partition (disk, part);
ped_disk_write (disk);
ped_disk_close (disk);
return 1;
error_close_disk:
ped_disk_close (disk);
error:
return 0;
}
int do_set (PedDevice** dev, int npart, char *flag_name,int state)
{
PedDisk* disk;
PedPartition* part;
PedPartitionFlag flag;
disk = ped_disk_open (*dev);
if (!disk)
goto error;
part = ped_disk_get_partition (disk, npart);
if (!part) {
ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
_("Partition doesn't exist."));
goto error_close_disk;
}
if (!flag_name)
goto error_help;
flag = ped_partition_flag_get_by_name (flag_name);
if (!flag)
goto error_help;
if (!ped_partition_set_flag (part, flag, state))
goto error_close_disk;
if (!ped_disk_write (disk))
goto error_close_disk;
ped_disk_close (disk);
return 1;
error_help:
error_close_disk:
ped_disk_close (disk);
error:
return 0;
}

99
nparted.h Normal file
View file

@ -0,0 +1,99 @@
/*
nparted - a frontend to libparted for manipulating disk partitions
thougth to dbootstrap
Copyright (C) 1998-2000 Mario Teijeiro Otero Esteve Fernández
Jaime Villate La Espiral
Mario Teijeiro Otero <asimovi@teleline.es>
Esteve Fernández < esteve@crosswinds.net >
Jaime Villate <villate@fe.up.pt>
La Espiral http://www.laespiral.org
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
*/
#ifndef _NPARTED_
#define _NPARTED_
/* Para cuando tenga soporte gettex con configure*/
//#include "config.h"
#ifdef ENABLE_NLS
# define _(string) (gettext(string))
//# ifdef HAVE_LIBINTL_H
# include <libintl.h>
//# endif
#else
# define _(string) (string)
#endif
#include <stdlib.h>
#include <parted/parted.h>
#include <newt.h>
#include "exception_manager.h"
typedef struct _size size;
struct _size{
int width;
int height;
};
typedef struct _strech strech;
struct _strech {
PedSector start;
PedSector end;
struct _strech *next;
};
/* Global buffer */
extern char ptrb[256];
extern size screen_size;
extern size mainwin_size;
/* Some functions utils */
void *NP_malloc (int size);
PedSector is_sector_valid(char *d);
char *get_name_device_type ( PedDeviceType type);
#define BETWEEN(A,B,C) ( ((A)>=(B))&& ((A)<=(C)) )
#define SEC2CIL(DEV,A) ( (A) / ( DEV->heads*DEV->sectors)+1 )
#define CIL2SEC(DEV,A) ( (A-1)*DEV->heads*DEV->sectors)
#define MB2SEC(A) ((A)*1024*1024/512)
#define SEC2MB(A) ((A)*512/(1024*1024))
/* functions with gui */
int edit_partition ( PedDevice *dev, int npart );
int copy_partition ( PedDevice *dev, int npart );
int del_partition( PedDevice *dev, int part);
int add_partition( PedDevice *dev);
char* select_file_system ( void );
char select_partition_type ( void );
/* Lib from programa parted */
int do_check (PedDevice** dev, int npart);
int do_cp (PedDevice** dev,int npart_src, char* dev_dest,
int npart_dest);
int do_mklabel (PedDevice** dev,char *label);
int do_mkfs (PedDevice** dev,int npart, char *fs_type);
int do_mkpart (PedDevice** dev,char ptype,char *ftype,
PedSector start,PedSector end);
int do_mkpartfs (PedDevice** dev,char ptype,char *ftype,
PedSector start, PedSector end);
int do_move (PedDevice** dev,int part_src,PedSector start, PedSector end);
int do_name (PedDevice** dev, int npart,char *name);
int do_resize (PedDevice** dev,int npart, PedSector start, PedSector end);
int do_rm (PedDevice** dev, int npart);
int do_set (PedDevice** dev, int npart, char *flag_name,int state);
#endif

0
po/ChangeLog Normal file
View file

248
po/Makefile.in.in Normal file
View file

@ -0,0 +1,248 @@
# Makefile for program source directory in GNU NLS utilities package.
# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
#
# This file file be copied and used freely without restrictions. It can
# be used in projects which are not available under the GNU Public License
# but which still want to provide support for the GNU gettext functionality.
# Please note that the actual code is *not* freely available.
PACKAGE = @PACKAGE@
VERSION = @VERSION@
SHELL = /bin/sh
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
datadir = $(prefix)/@DATADIRNAME@
localedir = $(datadir)/locale
gnulocaledir = $(prefix)/share/locale
gettextsrcdir = $(prefix)/share/gettext/po
subdir = po
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@
CC = @CC@
GENCAT = @GENCAT@
GMSGFMT = PATH=../src:$$PATH @GMSGFMT@
MSGFMT = @MSGFMT@
XGETTEXT = PATH=../src:$$PATH @XGETTEXT@
MSGMERGE = PATH=../src:$$PATH msgmerge
DEFS = @DEFS@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
INCLUDES = -I.. -I$(top_srcdir)/intl
COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
SOURCES = cat-id-tbl.c
POFILES = @POFILES@
GMOFILES = @GMOFILES@
DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
POTFILES = \
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
INSTOBJEXT = @INSTOBJEXT@
.SUFFIXES:
.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
.c.o:
$(COMPILE) $<
.po.pox:
$(MAKE) $(PACKAGE).pot
$(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
.po.mo:
$(MSGFMT) -o $@ $<
.po.gmo:
file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
&& rm -f $$file && $(GMSGFMT) -o $$file $<
.po.cat:
sed -f ../intl/po2msg.sed < $< > $*.msg \
&& rm -f $@ && $(GENCAT) $@ $*.msg
all: all-@USE_NLS@
all-yes: cat-id-tbl.c $(CATALOGS)
all-no:
$(srcdir)/$(PACKAGE).pot: $(POTFILES)
$(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
--add-comments --keyword=_ --keyword=N_ \
--files-from=$(srcdir)/POTFILES.in \
&& test ! -f $(PACKAGE).po \
|| ( rm -f $(srcdir)/$(PACKAGE).pot \
&& mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot )
$(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
$(srcdir)/stamp-cat-id: $(PACKAGE).pot
rm -f cat-id-tbl.tmp
sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
| sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
rm cat-id-tbl.tmp; \
else \
echo cat-id-tbl.c changed; \
rm -f $(srcdir)/cat-id-tbl.c; \
mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
fi
cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
install: install-exec install-data
install-exec:
install-data: install-data-@USE_NLS@
install-data-no: all
install-data-yes: all
if test -r "$(MKINSTALLDIRS)"; then \
$(MKINSTALLDIRS) $(datadir); \
else \
$(SHELL) $(top_srcdir)/mkinstalldirs $(datadir); \
fi
@catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
case "$$cat" in \
*.gmo) destdir=$(gnulocaledir);; \
*) destdir=$(localedir);; \
esac; \
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
dir=$$destdir/$$lang/LC_MESSAGES; \
if test -r "$(MKINSTALLDIRS)"; then \
$(MKINSTALLDIRS) $$dir; \
else \
$(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \
fi; \
if test -r $$cat; then \
$(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
else \
$(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
echo "installing $(srcdir)/$$cat as" \
"$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
fi; \
if test -r $$cat.m; then \
$(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
else \
if test -r $(srcdir)/$$cat.m ; then \
$(INSTALL_DATA) $(srcdir)/$$cat.m \
$$dir/$(PACKAGE)$(INSTOBJEXT).m; \
echo "installing $(srcdir)/$$cat as" \
"$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
else \
true; \
fi; \
fi; \
done
if test "$(PACKAGE)" = "gettext"; then \
if test -r "$(MKINSTALLDIRS)"; then \
$(MKINSTALLDIRS) $(gettextsrcdir); \
else \
$(SHELL) $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \
fi; \
$(INSTALL_DATA) $(srcdir)/Makefile.in.in \
$(gettextsrcdir)/Makefile.in.in; \
else \
: ; \
fi
# Define this as empty until I found a useful application.
installcheck:
uninstall:
catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
done
rm -f $(gettextsrcdir)/po-Makefile.in.in
check: all
cat-id-tbl.o: ../intl/libgettext.h
dvi info tags TAGS ID:
mostlyclean:
rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
rm -fr *.o
clean: mostlyclean
distclean: clean
rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
maintainer-clean: distclean
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
rm -f $(GMOFILES)
distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
dist distdir: update-po $(DISTFILES)
dists="$(DISTFILES)"; \
for file in $$dists; do \
ln $(srcdir)/$$file $(distdir) 2> /dev/null \
|| cp -p $(srcdir)/$$file $(distdir); \
done
update-po: Makefile
$(MAKE) $(PACKAGE).pot
PATH=`pwd`/../src:$$PATH; \
cd $(srcdir); \
catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
mv $$lang.po $$lang.old.po; \
echo "$$lang:"; \
if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
rm -f $$lang.old.po; \
else \
echo "msgmerge for $$cat failed!"; \
rm -f $$lang.po; \
mv $$lang.old.po $$lang.po; \
fi; \
done
POTFILES: POTFILES.in
( if test 'x$(srcdir)' != 'x.'; then \
posrcprefix='$(top_srcdir)/'; \
else \
posrcprefix="../"; \
fi; \
rm -f $@-t $@ \
&& (sed -e '/^#/d' -e '/^[ ]*$$/d' \
-e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
| sed -e '$$s/\\$$//') > $@-t \
&& chmod a-w $@-t \
&& mv $@-t $@ )
Makefile: Makefile.in.in ../config.status POTFILES
cd .. \
&& CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
$(SHELL) ./config.status
# Tell versions [3.59,3.63) of GNU make not to export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

9
po/POTFILES.in Normal file
View file

@ -0,0 +1,9 @@
add_partition.c
copy_partition.c
del_partition.c
edit_partition.c
exception_manager.c
main.c
nparted.c
utils.c

95
po/cat-id-tbl.c Normal file
View file

@ -0,0 +1,95 @@
/* Automatically generated by po2tbl.sed from nparted.pot. */
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include "libgettext.h"
const struct _msg_ent _msg_tbl[] = {
{"", 1},
{"Can't have two parts extended in one disk", 2},
{"Adding a part to %s", 3},
{"Growable", 4},
{"Do fyle sistem", 5},
{"Select partition type", 6},
{"Select file system", 7},
{"Create", 8},
{"Cancel", 9},
{"free strechs", 10},
{"Start", 11},
{" Cil.", 12},
{"End", 13},
{"Size", 14},
{" Mb", 15},
{"Primary", 16},
{"Extend", 17},
{"Logic", 18},
{"a number is needed", 19},
{"Out limits", 20},
{"I can't do filesystem on a extended partition", 21},
{"Are you sure create in %s a %c partition of type %s from %Ld to %Ld?", 22},
{"Are you sure that you del %s%-2d partition?", 23},
{"Tamano", 24},
{"Now", 25},
{"Max.", 26},
{"New geom", 27},
{"Grow too much posibble", 28},
{"Without Filesystem", 29},
{"Select", 30},
{"OK", 31},
{"CANCEL", 32},
{"Device not valid", 33},
{"Partition not valid", 34},
{"I can't get de max partition's geometry", 35},
{"Change the file system will destroy any data", 36},
{"Are you soure?", 37},
{"Editing %s%d", 38},
{"You don't have seen this,report me", 39},
{"Information message", 40},
{"!!!----WARNING----!!!", 41},
{"!!!----ERROR----!!!", 42},
{"!!!----FATAL ERROR ----!!!", 43},
{"You has found a bug, please report me", 44},
{"Feature yet implemented", 45},
{"FIX", 46},
{"YES", 47},
{"NO", 48},
{"RETRY", 49},
{"IGNORE", 50},
{"Warning", 51},
{"Device detected, but I can't open it", 52},
{"No device detected, Are you root? ", 53},
{"Select the disk or partition", 54},
{" Add ", 55},
{" Del ", 56},
{" Edit", 57},
{" Copy", 58},
{" Quit", 59},
{"Intern error have ocurred", 60},
{"A Hard disk, can't edit, select a partition or add a new partition", 61},
{"Can't del a hard disk, if you want del, remove it from equipment ;-)", 62},
{"Please, select the partition to copy,I can't copy the whole disk", 63},
{"Debian Instalation", 64},
{"%s v.%s", 65},
{"NParted ", 66},
{"Partition doesn't exist.", 67},
{"Source partition doesn't exist.", 68},
{"Can't copy extended partitions.", 69},
{"Destination partition doesn't exist.", 70},
{"Destination partition is being used.", 71},
{"Partition(s) on %s are being used.", 72},
{"Partition is being used.", 73},
{"Unknown filesystem type.", 74},
{"Unknown file system type.", 75},
{"Can't move extended partitions.", 76},
{"Can't move a partition onto itself. Try using resize, perhaps?", 77},
{"I can't malloc, abort", 78},
{"Please, select file system", 79},
{"primary", 80},
{"logical", 81},
{"extended", 82},
{"Please, select partition_type", 83},
};
int _msg_tbl_length = 83;

BIN
po/es.gmo Normal file

Binary file not shown.

365
po/es.po Normal file
View file

@ -0,0 +1,365 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Free Software Foundation, Inc.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2000-11-14 13:04+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: ENCODING\n"
#: add_partition.c:74
msgid "Can't have two parts extended in one disk"
msgstr "No puede haber dos particiones extendidas en un disco"
#: add_partition.c:206
#, c-format
msgid "Adding a part to %s"
msgstr "Añadiendo una particion a %s"
#: add_partition.c:213
msgid "Growable"
msgstr "Crecible"
#: add_partition.c:214
msgid "Do fyle sistem"
msgstr "Hacer sistema de ficheros"
#: add_partition.c:215
msgid "Select partition type"
msgstr "Seleccionar tipo partición"
#: add_partition.c:224
msgid "Select file system"
msgstr "Seleccionar sistema de ficheros"
#: add_partition.c:226
msgid "Create"
msgstr "Crear"
#: add_partition.c:227
msgid "Cancel"
msgstr "Cancelar"
#: add_partition.c:229
msgid "free strechs"
msgstr "Huecos libres"
#: add_partition.c:231 edit_partition.c:46
msgid "Start"
msgstr "Comienzo"
#: add_partition.c:232 add_partition.c:234 add_partition.c:235
msgid " Cil."
msgstr ""
#: add_partition.c:233 edit_partition.c:47
msgid "End"
msgstr "Fin"
#: add_partition.c:236
msgid "Size"
msgstr "Tamaño"
#: add_partition.c:237
msgid " Mb"
msgstr ""
#: add_partition.c:249
msgid "Primary"
msgstr "Primaria"
#: add_partition.c:251
msgid "Extend"
msgstr "Extendida"
#: add_partition.c:253
msgid "Logic"
msgstr "Lógica"
#: add_partition.c:271 add_partition.c:351 add_partition.c:380
#: edit_partition.c:235 edit_partition.c:256
msgid "a number is needed"
msgstr "Se neceista un número"
#: add_partition.c:293 add_partition.c:363 add_partition.c:389
msgid "Out limits"
msgstr "Fuera de límites"
#: add_partition.c:304
msgid "I can't do filesystem on a extended partition"
msgstr "No puedo hacer un sistema de ficheros en una partición extendida"
#. Pedimos confirmacion
#: add_partition.c:310
#, c-format
msgid "Are you sure create in %s a %c partition of type %s from %Ld to %Ld?"
msgstr ""
"¿Estás seguro que quieres crear en %s una particion %c del tipo %s desde %Ld "
"a %Ld?"
#: del_partition.c:30
#, c-format
msgid "Are you sure that you del %s%-2d partition?"
msgstr "¿Estás seguro de querer borrar la partición %s%-2d?"
#: edit_partition.c:48
msgid "Tamano"
msgstr "Tamaño"
#: edit_partition.c:50
msgid "Now"
msgstr "Ahora"
#: edit_partition.c:55
msgid "Max."
msgstr ""
#: edit_partition.c:62
msgid "New geom"
msgstr "Nueva geometría"
#: edit_partition.c:72
msgid "Grow too much posibble"
msgstr "Crecer lo máximo posible"
#: edit_partition.c:73
msgid "Without Filesystem"
msgstr "Sis sistema de ficheros"
#: edit_partition.c:74
msgid "Select"
msgstr "Seleccionar"
#: edit_partition.c:76 exception_manager.c:46 exception_manager.c:50
msgid "OK"
msgstr "ACEPTAR"
#: edit_partition.c:77 exception_manager.c:49 exception_manager.c:50
#: exception_manager.c:52 exception_manager.c:53 exception_manager.c:54
#: exception_manager.c:55
msgid "CANCEL"
msgstr "CANCELAR"
#: edit_partition.c:115
msgid "Device not valid"
msgstr "Dispositivo no válido"
#: edit_partition.c:128
msgid "Partition not valid"
msgstr "Partición no valida"
#: edit_partition.c:136
msgid "I can't get de max partition's geometry"
msgstr "No puede conseguir la geometría máxima de la partición"
#: edit_partition.c:217
msgid "Change the file system will destroy any data"
msgstr "El cambio del sistema de ficheros destruirá cualquier dato"
#: edit_partition.c:275
msgid "Are you soure?"
msgstr "¿Estás seguro?"
#: edit_partition.c:355
#, c-format
msgid "Editing %s%d"
msgstr "Editando %s%d"
#: exception_manager.c:34
msgid "You don't have seen this,report me"
msgstr "No tendrías que estar viendo esto, infórmanos"
#: exception_manager.c:35
msgid "Information message"
msgstr "Mensaje de información"
#: exception_manager.c:36
msgid "!!!----WARNING----!!!"
msgstr "¡¡¡----PELIGRO----!!!"
#: exception_manager.c:37
msgid "!!!----ERROR----!!!"
msgstr "¡¡¡----ERROR----!!!"
#: exception_manager.c:38
msgid "!!!----FATAL ERROR ----!!!"
msgstr "¡¡¡----ERROR FATAL ----!!!"
#: exception_manager.c:39
msgid "You has found a bug, please report me"
msgstr "Has encontrado un fallo, por favor informanos"
#: exception_manager.c:40
msgid "Feature yet implemented"
msgstr "Característica todavía no implementada"
#: exception_manager.c:43
msgid "FIX"
msgstr "FIJAR"
#: exception_manager.c:44 exception_manager.c:51 exception_manager.c:52
msgid "YES"
msgstr "SÍ"
#: exception_manager.c:45 exception_manager.c:51 exception_manager.c:52
msgid "NO"
msgstr ""
#: exception_manager.c:47 exception_manager.c:54 exception_manager.c:55
msgid "RETRY"
msgstr "REINTENTAR"
#: exception_manager.c:48 exception_manager.c:53 exception_manager.c:55
msgid "IGNORE"
msgstr "IGNORAR"
#: exception_manager.c:70
msgid "Warning"
msgstr "Peligro"
#: main.c:87
msgid "Device detected, but I can't open it"
msgstr "Dispositivo detectado, pero no puedo abrirlo"
#: main.c:137
msgid "No device detected, Are you root? "
msgstr "Ningún dispositivo detectado, ¿eres root?"
#: main.c:158
msgid "Select the disk or partition"
msgstr "Selecciona el disco o partición"
#: main.c:165
msgid " Add "
msgstr "Añadir"
#: main.c:166
msgid " Del "
msgstr "Borrar"
#: main.c:167
msgid " Edit"
msgstr "Editar"
#: main.c:168
msgid " Copy"
msgstr "Copiar"
#: main.c:169
msgid " Quit"
msgstr "Salir"
#: main.c:187
msgid "Intern error have ocurred"
msgstr "Un error interno ha ocurrido"
#: main.c:194
msgid "A Hard disk, can't edit, select a partition or add a new partition"
msgstr ""
"Un disco duro no se puede editar, selecciona una partición o añade una nueva "
"partición"
#: main.c:212
msgid "Can't del a hard disk, if you want del, remove it from equipment ;-)"
msgstr ""
"No puedo borrar un disco duro, si tu lo quieres borrar, quítalo del equipo "
";-)"
#: main.c:224
msgid "Please, select the partition to copy,I can't copy the whole disk"
msgstr ""
"Por favor, selecciona la partición a copiar, No puedo copiar un disco entero"
#: main.c:255
msgid "Debian Instalation"
msgstr "Instalación Debian"
#: main.c:257
#, c-format
msgid "%s v.%s"
msgstr ""
#: main.c:259
msgid "NParted "
msgstr ""
#: nparted.c:40 nparted.c:178 nparted.c:373 nparted.c:442 nparted.c:478
#: nparted.c:539 nparted.c:575
msgid "Partition doesn't exist."
msgstr "La partición no existe"
#: nparted.c:74
msgid "Source partition doesn't exist."
msgstr "Partición origen no existe"
#: nparted.c:79
msgid "Can't copy extended partitions."
msgstr "No puedo copiar particiones extendidas"
#: nparted.c:92
msgid "Destination partition doesn't exist."
msgstr "Partición destino no existe"
#: nparted.c:99
msgid "Destination partition is being used."
msgstr "Partición destino está siendo usada."
#: nparted.c:143
#, c-format
msgid "Partition(s) on %s are being used."
msgstr "Particiones en %s estás siendo usadas."
#: nparted.c:185 nparted.c:386 nparted.c:485 nparted.c:546
msgid "Partition is being used."
msgstr "Partición está siendo usada."
#: nparted.c:195
msgid "Unknown filesystem type."
msgstr "Desconocido tipo sistema de ficheros"
#: nparted.c:249 nparted.c:319
msgid "Unknown file system type."
msgstr "Desconocido tipo de sistema de ficheros."
#: nparted.c:378
msgid "Can't move extended partitions."
msgstr "No puedo mover particiones extendidas"
#: nparted.c:404
msgid "Can't move a partition onto itself. Try using resize, perhaps?"
msgstr ""
"No puedo mover una partición dentro de otra. Intenta cambiar el tamaño."
#: utils.c:62
msgid "I can't malloc, abort"
msgstr "No puedo reservar memoria, aborto"
#: utils.c:87
msgid "Please, select file system"
msgstr "Por favor, selecciona un sistema de ficheros"
#: utils.c:115
msgid "primary"
msgstr "primaria"
#: utils.c:116
msgid "logical"
msgstr "logica"
#: utils.c:117
msgid "extended"
msgstr "extendida"
#: utils.c:119
msgid "Please, select partition_type"
msgstr "Por favor, selecciona el tipo de partición"
#~ msgid "UNKNOWN"
#~ msgstr "DESCONOCIDO"

BIN
po/es_ES.gmo Normal file

Binary file not shown.

365
po/es_ES.po Normal file
View file

@ -0,0 +1,365 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Free Software Foundation, Inc.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2000-11-14 13:04+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: ENCODING\n"
#: add_partition.c:74
msgid "Can't have two parts extended in one disk"
msgstr "No puede haber dos particiones extendidas en un disco"
#: add_partition.c:206
#, c-format
msgid "Adding a part to %s"
msgstr "Añadiendo una particion a %s"
#: add_partition.c:213
msgid "Growable"
msgstr "Crecible"
#: add_partition.c:214
msgid "Do fyle sistem"
msgstr "Hacer sistema de ficheros"
#: add_partition.c:215
msgid "Select partition type"
msgstr "Seleccionar tipo partición"
#: add_partition.c:224
msgid "Select file system"
msgstr "Seleccionar sistema de ficheros"
#: add_partition.c:226
msgid "Create"
msgstr "Crear"
#: add_partition.c:227
msgid "Cancel"
msgstr "Cancelar"
#: add_partition.c:229
msgid "free strechs"
msgstr "Huecos libres"
#: add_partition.c:231 edit_partition.c:46
msgid "Start"
msgstr "Comienzo"
#: add_partition.c:232 add_partition.c:234 add_partition.c:235
msgid " Cil."
msgstr ""
#: add_partition.c:233 edit_partition.c:47
msgid "End"
msgstr "Fin"
#: add_partition.c:236
msgid "Size"
msgstr "Tamaño"
#: add_partition.c:237
msgid " Mb"
msgstr ""
#: add_partition.c:249
msgid "Primary"
msgstr "Primaria"
#: add_partition.c:251
msgid "Extend"
msgstr "Extendida"
#: add_partition.c:253
msgid "Logic"
msgstr "Lógica"
#: add_partition.c:271 add_partition.c:351 add_partition.c:380
#: edit_partition.c:235 edit_partition.c:256
msgid "a number is needed"
msgstr "Se neceista un número"
#: add_partition.c:293 add_partition.c:363 add_partition.c:389
msgid "Out limits"
msgstr "Fuera de límites"
#: add_partition.c:304
msgid "I can't do filesystem on a extended partition"
msgstr "No puedo hacer un sistema de ficheros en una partición extendida"
#. Pedimos confirmacion
#: add_partition.c:310
#, c-format
msgid "Are you sure create in %s a %c partition of type %s from %Ld to %Ld?"
msgstr ""
"¿Estás seguro que quieres crear en %s una particion %c del tipo %s desde %Ld "
"a %Ld?"
#: del_partition.c:30
#, c-format
msgid "Are you sure that you del %s%-2d partition?"
msgstr "¿Estás seguro de querer borrar la partición %s%-2d?"
#: edit_partition.c:48
msgid "Tamano"
msgstr "Tamaño"
#: edit_partition.c:50
msgid "Now"
msgstr "Ahora"
#: edit_partition.c:55
msgid "Max."
msgstr ""
#: edit_partition.c:62
msgid "New geom"
msgstr "Nueva geometría"
#: edit_partition.c:72
msgid "Grow too much posibble"
msgstr "Crecer lo máximo posible"
#: edit_partition.c:73
msgid "Without Filesystem"
msgstr "Sis sistema de ficheros"
#: edit_partition.c:74
msgid "Select"
msgstr "Seleccionar"
#: edit_partition.c:76 exception_manager.c:46 exception_manager.c:50
msgid "OK"
msgstr "ACEPTAR"
#: edit_partition.c:77 exception_manager.c:49 exception_manager.c:50
#: exception_manager.c:52 exception_manager.c:53 exception_manager.c:54
#: exception_manager.c:55
msgid "CANCEL"
msgstr "CANCELAR"
#: edit_partition.c:115
msgid "Device not valid"
msgstr "Dispositivo no válido"
#: edit_partition.c:128
msgid "Partition not valid"
msgstr "Partición no valida"
#: edit_partition.c:136
msgid "I can't get de max partition's geometry"
msgstr "No puede conseguir la geometría máxima de la partición"
#: edit_partition.c:217
msgid "Change the file system will destroy any data"
msgstr "El cambio del sistema de ficheros destruirá cualquier dato"
#: edit_partition.c:275
msgid "Are you soure?"
msgstr "¿Estás seguro?"
#: edit_partition.c:355
#, c-format
msgid "Editing %s%d"
msgstr "Editando %s%d"
#: exception_manager.c:34
msgid "You don't have seen this,report me"
msgstr "No tendrías que estar viendo esto, infórmanos"
#: exception_manager.c:35
msgid "Information message"
msgstr "Mensaje de información"
#: exception_manager.c:36
msgid "!!!----WARNING----!!!"
msgstr "¡¡¡----PELIGRO----!!!"
#: exception_manager.c:37
msgid "!!!----ERROR----!!!"
msgstr "¡¡¡----ERROR----!!!"
#: exception_manager.c:38
msgid "!!!----FATAL ERROR ----!!!"
msgstr "¡¡¡----ERROR FATAL ----!!!"
#: exception_manager.c:39
msgid "You has found a bug, please report me"
msgstr "Has encontrado un fallo, por favor informanos"
#: exception_manager.c:40
msgid "Feature yet implemented"
msgstr "Característica todavía no implementada"
#: exception_manager.c:43
msgid "FIX"
msgstr "FIJAR"
#: exception_manager.c:44 exception_manager.c:51 exception_manager.c:52
msgid "YES"
msgstr "SÍ"
#: exception_manager.c:45 exception_manager.c:51 exception_manager.c:52
msgid "NO"
msgstr ""
#: exception_manager.c:47 exception_manager.c:54 exception_manager.c:55
msgid "RETRY"
msgstr "REINTENTAR"
#: exception_manager.c:48 exception_manager.c:53 exception_manager.c:55
msgid "IGNORE"
msgstr "IGNORAR"
#: exception_manager.c:70
msgid "Warning"
msgstr "Peligro"
#: main.c:87
msgid "Device detected, but I can't open it"
msgstr "Dispositivo detectado, pero no puedo abrirlo"
#: main.c:137
msgid "No device detected, Are you root? "
msgstr "Ningún dispositivo detectado, ¿eres root?"
#: main.c:158
msgid "Select the disk or partition"
msgstr "Selecciona el disco o partición"
#: main.c:165
msgid " Add "
msgstr "Añadir"
#: main.c:166
msgid " Del "
msgstr "Borrar"
#: main.c:167
msgid " Edit"
msgstr "Editar"
#: main.c:168
msgid " Copy"
msgstr "Copiar"
#: main.c:169
msgid " Quit"
msgstr "Salir"
#: main.c:187
msgid "Intern error have ocurred"
msgstr "Un error interno ha ocurrido"
#: main.c:194
msgid "A Hard disk, can't edit, select a partition or add a new partition"
msgstr ""
"Un disco duro no se puede editar, selecciona una partición o añade una nueva "
"partición"
#: main.c:212
msgid "Can't del a hard disk, if you want del, remove it from equipment ;-)"
msgstr ""
"No puedo borrar un disco duro, si tu lo quieres borrar, quítalo del equipo "
";-)"
#: main.c:224
msgid "Please, select the partition to copy,I can't copy the whole disk"
msgstr ""
"Por favor, selecciona la partición a copiar, No puedo copiar un disco entero"
#: main.c:255
msgid "Debian Instalation"
msgstr "Instalación Debian"
#: main.c:257
#, c-format
msgid "%s v.%s"
msgstr ""
#: main.c:259
msgid "NParted "
msgstr ""
#: nparted.c:40 nparted.c:178 nparted.c:373 nparted.c:442 nparted.c:478
#: nparted.c:539 nparted.c:575
msgid "Partition doesn't exist."
msgstr "La partición no existe"
#: nparted.c:74
msgid "Source partition doesn't exist."
msgstr "Partición origen no existe"
#: nparted.c:79
msgid "Can't copy extended partitions."
msgstr "No puedo copiar particiones extendidas"
#: nparted.c:92
msgid "Destination partition doesn't exist."
msgstr "Partición destino no existe"
#: nparted.c:99
msgid "Destination partition is being used."
msgstr "Partición destino está siendo usada."
#: nparted.c:143
#, c-format
msgid "Partition(s) on %s are being used."
msgstr "Particiones en %s estás siendo usadas."
#: nparted.c:185 nparted.c:386 nparted.c:485 nparted.c:546
msgid "Partition is being used."
msgstr "Partición está siendo usada."
#: nparted.c:195
msgid "Unknown filesystem type."
msgstr "Desconocido tipo sistema de ficheros"
#: nparted.c:249 nparted.c:319
msgid "Unknown file system type."
msgstr "Desconocido tipo de sistema de ficheros."
#: nparted.c:378
msgid "Can't move extended partitions."
msgstr "No puedo mover particiones extendidas"
#: nparted.c:404
msgid "Can't move a partition onto itself. Try using resize, perhaps?"
msgstr ""
"No puedo mover una partición dentro de otra. Intenta cambiar el tamaño."
#: utils.c:62
msgid "I can't malloc, abort"
msgstr "No puedo reservar memoria, aborto"
#: utils.c:87
msgid "Please, select file system"
msgstr "Por favor, selecciona un sistema de ficheros"
#: utils.c:115
msgid "primary"
msgstr "primaria"
#: utils.c:116
msgid "logical"
msgstr "logica"
#: utils.c:117
msgid "extended"
msgstr "extendida"
#: utils.c:119
msgid "Please, select partition_type"
msgstr "Por favor, selecciona el tipo de partición"
#~ msgid "UNKNOWN"
#~ msgstr "DESCONOCIDO"

354
po/nparted.pot Normal file
View file

@ -0,0 +1,354 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Free Software Foundation, Inc.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2000-11-14 13:04+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: ENCODING\n"
#: add_partition.c:74
msgid "Can't have two parts extended in one disk"
msgstr ""
#: add_partition.c:206
#, c-format
msgid "Adding a part to %s"
msgstr ""
#: add_partition.c:213
msgid "Growable"
msgstr ""
#: add_partition.c:214
msgid "Do fyle sistem"
msgstr ""
#: add_partition.c:215
msgid "Select partition type"
msgstr ""
#: add_partition.c:224
msgid "Select file system"
msgstr ""
#: add_partition.c:226
msgid "Create"
msgstr ""
#: add_partition.c:227
msgid "Cancel"
msgstr ""
#: add_partition.c:229
msgid "free strechs"
msgstr ""
#: add_partition.c:231 edit_partition.c:46
msgid "Start"
msgstr ""
#: add_partition.c:232 add_partition.c:234 add_partition.c:235
msgid " Cil."
msgstr ""
#: add_partition.c:233 edit_partition.c:47
msgid "End"
msgstr ""
#: add_partition.c:236
msgid "Size"
msgstr ""
#: add_partition.c:237
msgid " Mb"
msgstr ""
#: add_partition.c:249
msgid "Primary"
msgstr ""
#: add_partition.c:251
msgid "Extend"
msgstr ""
#: add_partition.c:253
msgid "Logic"
msgstr ""
#: add_partition.c:271 add_partition.c:351 add_partition.c:380
#: edit_partition.c:235 edit_partition.c:256
msgid "a number is needed"
msgstr ""
#: add_partition.c:293 add_partition.c:363 add_partition.c:389
msgid "Out limits"
msgstr ""
#: add_partition.c:304
msgid "I can't do filesystem on a extended partition"
msgstr ""
#. Pedimos confirmacion
#: add_partition.c:310
#, c-format
msgid "Are you sure create in %s a %c partition of type %s from %Ld to %Ld?"
msgstr ""
#: del_partition.c:30
#, c-format
msgid "Are you sure that you del %s%-2d partition?"
msgstr ""
#: edit_partition.c:48
msgid "Tamano"
msgstr ""
#: edit_partition.c:50
msgid "Now"
msgstr ""
#: edit_partition.c:55
msgid "Max."
msgstr ""
#: edit_partition.c:62
msgid "New geom"
msgstr ""
#: edit_partition.c:72
msgid "Grow too much posibble"
msgstr ""
#: edit_partition.c:73
msgid "Without Filesystem"
msgstr ""
#: edit_partition.c:74
msgid "Select"
msgstr ""
#: edit_partition.c:76 exception_manager.c:46 exception_manager.c:50
msgid "OK"
msgstr ""
#: edit_partition.c:77 exception_manager.c:49 exception_manager.c:50
#: exception_manager.c:52 exception_manager.c:53 exception_manager.c:54
#: exception_manager.c:55
msgid "CANCEL"
msgstr ""
#: edit_partition.c:115
msgid "Device not valid"
msgstr ""
#: edit_partition.c:128
msgid "Partition not valid"
msgstr ""
#: edit_partition.c:136
msgid "I can't get de max partition's geometry"
msgstr ""
#: edit_partition.c:217
msgid "Change the file system will destroy any data"
msgstr ""
#: edit_partition.c:275
msgid "Are you soure?"
msgstr ""
#: edit_partition.c:355
#, c-format
msgid "Editing %s%d"
msgstr ""
#: exception_manager.c:34
msgid "You don't have seen this,report me"
msgstr ""
#: exception_manager.c:35
msgid "Information message"
msgstr ""
#: exception_manager.c:36
msgid "!!!----WARNING----!!!"
msgstr ""
#: exception_manager.c:37
msgid "!!!----ERROR----!!!"
msgstr ""
#: exception_manager.c:38
msgid "!!!----FATAL ERROR ----!!!"
msgstr ""
#: exception_manager.c:39
msgid "You has found a bug, please report me"
msgstr ""
#: exception_manager.c:40
msgid "Feature yet implemented"
msgstr ""
#: exception_manager.c:43
msgid "FIX"
msgstr ""
#: exception_manager.c:44 exception_manager.c:51 exception_manager.c:52
msgid "YES"
msgstr ""
#: exception_manager.c:45 exception_manager.c:51 exception_manager.c:52
msgid "NO"
msgstr ""
#: exception_manager.c:47 exception_manager.c:54 exception_manager.c:55
msgid "RETRY"
msgstr ""
#: exception_manager.c:48 exception_manager.c:53 exception_manager.c:55
msgid "IGNORE"
msgstr ""
#: exception_manager.c:70
msgid "Warning"
msgstr ""
#: main.c:87
msgid "Device detected, but I can't open it"
msgstr ""
#: main.c:137
msgid "No device detected, Are you root? "
msgstr ""
#: main.c:158
msgid "Select the disk or partition"
msgstr ""
#: main.c:165
msgid " Add "
msgstr ""
#: main.c:166
msgid " Del "
msgstr ""
#: main.c:167
msgid " Edit"
msgstr ""
#: main.c:168
msgid " Copy"
msgstr ""
#: main.c:169
msgid " Quit"
msgstr ""
#: main.c:187
msgid "Intern error have ocurred"
msgstr ""
#: main.c:194
msgid "A Hard disk, can't edit, select a partition or add a new partition"
msgstr ""
#: main.c:212
msgid "Can't del a hard disk, if you want del, remove it from equipment ;-)"
msgstr ""
#: main.c:224
msgid "Please, select the partition to copy,I can't copy the whole disk"
msgstr ""
#: main.c:255
msgid "Debian Instalation"
msgstr ""
#: main.c:257
#, c-format
msgid "%s v.%s"
msgstr ""
#: main.c:259
msgid "NParted "
msgstr ""
#: nparted.c:40 nparted.c:178 nparted.c:373 nparted.c:442 nparted.c:478
#: nparted.c:539 nparted.c:575
msgid "Partition doesn't exist."
msgstr ""
#: nparted.c:74
msgid "Source partition doesn't exist."
msgstr ""
#: nparted.c:79
msgid "Can't copy extended partitions."
msgstr ""
#: nparted.c:92
msgid "Destination partition doesn't exist."
msgstr ""
#: nparted.c:99
msgid "Destination partition is being used."
msgstr ""
#: nparted.c:143
#, c-format
msgid "Partition(s) on %s are being used."
msgstr ""
#: nparted.c:185 nparted.c:386 nparted.c:485 nparted.c:546
msgid "Partition is being used."
msgstr ""
#: nparted.c:195
msgid "Unknown filesystem type."
msgstr ""
#: nparted.c:249 nparted.c:319
msgid "Unknown file system type."
msgstr ""
#: nparted.c:378
msgid "Can't move extended partitions."
msgstr ""
#: nparted.c:404
msgid "Can't move a partition onto itself. Try using resize, perhaps?"
msgstr ""
#: utils.c:62
msgid "I can't malloc, abort"
msgstr ""
#: utils.c:87
msgid "Please, select file system"
msgstr ""
#: utils.c:115
msgid "primary"
msgstr ""
#: utils.c:116
msgid "logical"
msgstr ""
#: utils.c:117
msgid "extended"
msgstr ""
#: utils.c:119
msgid "Please, select partition_type"
msgstr ""

1
po/stamp-cat-id Normal file
View file

@ -0,0 +1 @@
timestamp

145
utils.c Normal file
View file

@ -0,0 +1,145 @@
/*
nparted - a frontend to libparted for manipulating disk partitions
thinked to dbootstrap
Copyright (C) 1998-2000 Mario Teijeiro Otero Esteve Fernández
Jaime Villate La Espiral
Mario Teijeiro Otero <asimovi@teleline.es>
Esteve Fernández < esteve@crosswinds.net >
Jaime Villate <villate@fe.up.pt>
La Espiral http://www.laespiral.org
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
*/
#include <nparted.h>
#include <ctype.h>
void i18n_initialize (void)
{
/* Si HAVE_NLS es definido, asumimos la existencia de
* tres funciones invocadas aquí */
#ifdef HAVE_NLS
/* Ponemos la localización actual */
setlocale(LC_MESSAGES,"");
bindtextdomain(PACKAGE,LOCALDIR);
textdomain(PACKAGE);
#endif
}
static char *device_type[]={"UNKNOWN","SCSI","IDE","DAC960","CPQARRAY"};
char *get_name_device_type ( PedDeviceType type){
switch (type){
case PED_DEVICE_UNKNOWN: return device_type[0];
case PED_DEVICE_SCSI:return device_type[1];
case PED_DEVICE_IDE:return device_type[2];
case PED_DEVICE_DAC960:return device_type[3];
case PED_DEVICE_CPQARRAY: return device_type[4];
}
return device_type[0];
}
/* FIXME: Mejor que salir directamente, llamar a las funciones
* para que cierren todos los dispositivos abiertos y esass cosas*/
void * NP_malloc(int size){
void *p;
p=malloc(size);
if(p==NULL){
ped_exception_throw(PED_EXCEPTION_FATAL,
PED_EXCEPTION_OK,_("I can't malloc, abort"));
ped_exception_catch();
exit(-1);
}
return p;
}
char* select_file_system ( void )
{
newtComponent list,form;
struct newtExitStruct toexit;
PedFileSystemType* fs_type;
char *type;
int i;
list=newtListbox(5,1,5,NEWT_FLAG_SCROLL|NEWT_FLAG_RETURNEXIT);
newtListboxSetWidth(list,20);
fs_type=NULL;
i=0;
while( (fs_type=ped_file_system_type_get_next (fs_type)) !=NULL){
if (!fs_type->name) break;
newtListboxAppendEntry(list,fs_type->name, fs_type->name);
i++;
}
newtCenteredWindow(30, 7,_("Please, select file system"));
form=newtForm(NULL,NULL,0);
newtFormAddComponents(form,list,NULL);
newtFormAddHotKey(form,(int)'');
newtFormRun(form,&toexit);
if (toexit.reason==NEWT_EXIT_COMPONENT)
type=(char*)newtListboxGetCurrent(list);
else
type=NULL;
newtFormDestroy(form);
newtPopWindow();
return type;
}
char select_partition_type (void)
{
newtComponent list,form;
struct newtExitStruct toexit;
char types[]={'p','l','e'};
char *type;
int i;
list=newtListbox(5,1,5,NEWT_FLAG_SCROLL|NEWT_FLAG_RETURNEXIT);
newtListboxSetWidth(list,20);
i=0;
newtListboxAppendEntry(list,_("primary"), &types[0]);
newtListboxAppendEntry(list,_("logical"), &types[1]);
newtListboxAppendEntry(list,_("extended"), &types[2]);
newtCenteredWindow(30, 7,_("Please, select partition_type"));
form=newtForm(NULL,NULL,0);
newtFormAddComponents(form,list,NULL);
newtFormAddHotKey(form,(int)'');
newtFormRun(form,&toexit);
if (toexit.reason==NEWT_EXIT_COMPONENT){
type=(char*)newtListboxGetCurrent(list);
newtFormDestroy(form);
newtPopWindow();
return *type;
}
newtFormDestroy(form);
newtPopWindow();
return '\0';
}
PedSector is_sector_valid(char *d){
char *p;
p=d;
while (*p!='\0' && (isdigit(*p)||isspace(*p)) ) p++;
if (*p=='\0'){
return strtol(d,&p,10);
}else{
return -1;
}
}