This commit was generated by cvs2svn to compensate for changes in r2,
which included commits to RCS files with non-trunk default branches.
This commit is contained in:
parent
2919537783
commit
7f589bb064
340
COPYING
Normal file
340
COPYING
Normal file
@ -0,0 +1,340 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
5
ChangeLog
Normal file
5
ChangeLog
Normal file
@ -0,0 +1,5 @@
|
||||
Mon Jul 6 11:58:10 1998 Vebjorn Ljosa <ljosa@stud.ntnu.no>
|
||||
|
||||
* Initial version.
|
||||
|
||||
|
183
INSTALL
Normal file
183
INSTALL
Normal file
@ -0,0 +1,183 @@
|
||||
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.
|
||||
|
9
Makefile.am
Normal file
9
Makefile.am
Normal file
@ -0,0 +1,9 @@
|
||||
bin_PROGRAMS = mysql-dbadm mysql-useradm
|
||||
mysql_admutils_SOURCE = common.c mysql-admutils.h pwyacc.y pwlex.l pwfile.c
|
||||
mysql_dbadm_SOURCES = mysql-dbadm.c $(mysql_admutils_SOURCE)
|
||||
mysql_useradm_SOURCES = mysql-useradm.c $(mysql_admutils_SOURCE)
|
||||
BUILT_SOURCES = pwyacc.c pwyacc.h pwlex.c
|
||||
YFLAGS = -d
|
||||
INCLUDES = @MYSQL_INCLUDE@ -DSYSCONFDIR=\"$(sysconfdir)\"
|
||||
LDADD = @MYSQL_LIBS@ @LEXLIB@
|
||||
LDFLAGS = @MYSQL_LFLAGS@
|
354
Makefile.in
Normal file
354
Makefile.in
Normal file
@ -0,0 +1,354 @@
|
||||
# Makefile.in generated automatically by automake 1.3 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 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 = /bin/sh
|
||||
|
||||
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
|
||||
|
||||
DISTDIR =
|
||||
|
||||
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@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
LEX = @LEX@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MYSQL_INCLUDE = @MYSQL_INCLUDE@
|
||||
MYSQL_LFLAGS = @MYSQL_LFLAGS@
|
||||
MYSQL_LIBS = @MYSQL_LIBS@
|
||||
PACKAGE = @PACKAGE@
|
||||
SYSCONFDIR = @SYSCONFDIR@
|
||||
VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
|
||||
bin_PROGRAMS = mysql-dbadm mysql-useradm
|
||||
mysql_admutils_SOURCE = common.c mysql-admutils.h pwyacc.y pwlex.l pwfile.c
|
||||
mysql_dbadm_SOURCES = mysql-dbadm.c $(mysql_admutils_SOURCE)
|
||||
mysql_useradm_SOURCES = mysql-useradm.c $(mysql_admutils_SOURCE)
|
||||
BUILT_SOURCES = pwyacc.c pwyacc.h pwlex.c
|
||||
YFLAGS = -d
|
||||
INCLUDES = @MYSQL_INCLUDE@ -DSYSCONFDIR=\"$(sysconfdir)\"
|
||||
LDADD = @MYSQL_LIBS@ @LEXLIB@
|
||||
LDFLAGS = @MYSQL_LFLAGS@
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
|
||||
|
||||
DEFS = @DEFS@ -I. -I$(srcdir) -I.
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LIBS = @LIBS@
|
||||
mysql_dbadm_OBJECTS = mysql-dbadm.o common.o pwyacc.o pwlex.o pwfile.o
|
||||
mysql_dbadm_LDADD = $(LDADD)
|
||||
mysql_dbadm_DEPENDENCIES =
|
||||
mysql_dbadm_LDFLAGS =
|
||||
mysql_useradm_OBJECTS = mysql-useradm.o common.o pwyacc.o pwlex.o \
|
||||
pwfile.o
|
||||
mysql_useradm_LDADD = $(LDADD)
|
||||
mysql_useradm_DEPENDENCIES =
|
||||
mysql_useradm_LDFLAGS =
|
||||
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
|
||||
LEXLIB = @LEXLIB@
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
|
||||
LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
|
||||
Makefile.in NEWS acconfig.h aclocal.m4 config.h.in configure \
|
||||
configure.in install-sh missing mkinstalldirs pwlex.c pwyacc.c \
|
||||
stamp-h.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = gtar
|
||||
GZIP = --best
|
||||
SOURCES = $(mysql_dbadm_SOURCES) $(mysql_useradm_SOURCES)
|
||||
OBJECTS = $(mysql_dbadm_OBJECTS) $(mysql_useradm_OBJECTS)
|
||||
|
||||
all: Makefile $(PROGRAMS) config.h
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .S .c .l .o .s .y
|
||||
$(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
|
||||
$(SHELL) ./config.status --recheck
|
||||
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
|
||||
cd $(srcdir) && $(AUTOCONF)
|
||||
|
||||
config.h: stamp-h
|
||||
@:
|
||||
stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES= CONFIG_HEADERS=config.h \
|
||||
$(SHELL) ./config.status
|
||||
@echo timestamp > stamp-h
|
||||
$(srcdir)/config.h.in: $(srcdir)/stamp-h.in
|
||||
$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
|
||||
cd $(top_srcdir) && $(AUTOHEADER)
|
||||
@echo timestamp > $(srcdir)/stamp-h.in
|
||||
|
||||
mostlyclean-hdr:
|
||||
|
||||
clean-hdr:
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f config.h
|
||||
|
||||
maintainer-clean-hdr:
|
||||
|
||||
mostlyclean-binPROGRAMS:
|
||||
|
||||
clean-binPROGRAMS:
|
||||
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
|
||||
|
||||
distclean-binPROGRAMS:
|
||||
|
||||
maintainer-clean-binPROGRAMS:
|
||||
|
||||
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||
@list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
|
||||
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
uninstall-binPROGRAMS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||
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:
|
||||
|
||||
mysql-dbadm: $(mysql_dbadm_OBJECTS) $(mysql_dbadm_DEPENDENCIES)
|
||||
@rm -f mysql-dbadm
|
||||
$(LINK) $(mysql_dbadm_LDFLAGS) $(mysql_dbadm_OBJECTS) $(mysql_dbadm_LDADD) $(LIBS)
|
||||
|
||||
mysql-useradm: $(mysql_useradm_OBJECTS) $(mysql_useradm_DEPENDENCIES)
|
||||
@rm -f mysql-useradm
|
||||
$(LINK) $(mysql_useradm_LDFLAGS) $(mysql_useradm_OBJECTS) $(mysql_useradm_LDADD) $(LIBS)
|
||||
.y.c:
|
||||
$(YACC) $(YFLAGS) $< && mv y.tab.c $*.c
|
||||
if test -f y.tab.h; then \
|
||||
if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
|
||||
else :; fi
|
||||
pwyacc.h: pwyacc.c
|
||||
|
||||
.l.c:
|
||||
$(LEX) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP)
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS)
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
-rm -rf $(distdir)
|
||||
GZIP=$(GZIP) $(TAR) zxf $(distdir).tar.gz
|
||||
mkdir $(distdir)/=build
|
||||
mkdir $(distdir)/=inst
|
||||
dc_install_base=`cd $(distdir)/=inst && pwd`; \
|
||||
cd $(distdir)/=build \
|
||||
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
|
||||
&& $(MAKE) \
|
||||
&& $(MAKE) dvi \
|
||||
&& $(MAKE) check \
|
||||
&& $(MAKE) install \
|
||||
&& $(MAKE) installcheck \
|
||||
&& $(MAKE) dist
|
||||
-rm -rf $(distdir)
|
||||
@echo "========================"; \
|
||||
echo "$(distdir).tar.gz is ready for distribution"; \
|
||||
echo "========================"
|
||||
dist: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir)
|
||||
-rm -rf $(distdir)
|
||||
dist-all: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
GZIP=$(GZIP) $(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); \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
|
||||
info:
|
||||
dvi:
|
||||
check: all
|
||||
$(MAKE)
|
||||
installcheck:
|
||||
install-exec: install-binPROGRAMS
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install-data:
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install: install-exec install-data all
|
||||
@:
|
||||
|
||||
uninstall: uninstall-binPROGRAMS
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DATADIR)$(bindir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean: mostlyclean-hdr mostlyclean-binPROGRAMS \
|
||||
mostlyclean-compile mostlyclean-tags \
|
||||
mostlyclean-generic
|
||||
|
||||
clean: clean-hdr clean-binPROGRAMS clean-compile clean-tags \
|
||||
clean-generic mostlyclean
|
||||
|
||||
distclean: distclean-hdr distclean-binPROGRAMS distclean-compile \
|
||||
distclean-tags distclean-generic clean
|
||||
-rm -f config.status
|
||||
|
||||
maintainer-clean: maintainer-clean-hdr maintainer-clean-binPROGRAMS \
|
||||
maintainer-clean-compile maintainer-clean-tags \
|
||||
maintainer-clean-generic distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
-rm -f config.status
|
||||
|
||||
.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
|
||||
mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
|
||||
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
|
||||
mostlyclean-compile distclean-compile clean-compile \
|
||||
maintainer-clean-compile tags mostlyclean-tags distclean-tags \
|
||||
clean-tags maintainer-clean-tags distdir info dvi installcheck \
|
||||
install-exec install-data install uninstall all 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:
|
29
acconfig.h
Normal file
29
acconfig.h
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* acconfig.h
|
||||
*
|
||||
* @(#) $Header: /tmp/cvs/mysql-admutils/acconfig.h,v 1.1.1.1 2001-11-25 00:41:16 lkarsten Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/* Define the name of the package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define the version of the package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define if MySQL is installed */
|
||||
#undef HAVE_MYSQL
|
||||
|
||||
/* Define if you have the <math.h> header file. */
|
||||
#undef HAVE_MATH_H
|
||||
|
||||
/* Define if libmath is available */
|
||||
#undef HAVE_LIBM
|
||||
|
||||
/* Define if libnsl is available */
|
||||
#undef HAVE_LIBNSL
|
||||
|
||||
/* Define if libsocket is available */
|
||||
#undef HAVE_LIBSOCKET
|
||||
|
145
aclocal.m4
vendored
Normal file
145
aclocal.m4
vendored
Normal file
@ -0,0 +1,145 @@
|
||||
dnl aclocal.m4 generated automatically by aclocal 1.3
|
||||
|
||||
dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
dnl This Makefile.in 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.
|
||||
|
||||
# Like AC_CONFIG_HEADER, but automatically create stamp file.
|
||||
|
||||
AC_DEFUN(AM_CONFIG_HEADER,
|
||||
[AC_PREREQ([2.12])
|
||||
AC_CONFIG_HEADER([$1])
|
||||
dnl When config.status generates a header, we must update the stamp-h file.
|
||||
dnl This file resides in the same directory as the config header
|
||||
dnl that is generated. We must strip everything past the first ":",
|
||||
dnl and everything past the last "/".
|
||||
AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
|
||||
ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
|
||||
<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
|
||||
<<am_indx=1
|
||||
for am_file in <<$1>>; do
|
||||
case " <<$>>CONFIG_HEADERS " in
|
||||
*" <<$>>am_file "*<<)>>
|
||||
echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
|
||||
;;
|
||||
esac
|
||||
am_indx=`expr "<<$>>am_indx" + 1`
|
||||
done<<>>dnl>>)
|
||||
changequote([,]))])
|
||||
|
||||
# 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([AM_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")
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
|
||||
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])])
|
||||
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_PROG_INSTALL,
|
||||
[AC_REQUIRE([AC_PROG_INSTALL])
|
||||
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
|
||||
AC_SUBST(INSTALL_SCRIPT)dnl
|
||||
])
|
||||
|
||||
#
|
||||
# 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)])
|
||||
|
||||
|
||||
dnl AM_PROG_LEX
|
||||
dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
|
||||
AC_DEFUN(AM_PROG_LEX,
|
||||
[missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1)
|
||||
AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
|
||||
AC_PROG_LEX
|
||||
AC_DECL_YYTEXT])
|
||||
|
127
common.c
Normal file
127
common.c
Normal file
@ -0,0 +1,127 @@
|
||||
/*
|
||||
* @(#) $Header: /tmp/cvs/mysql-admutils/common.c,v 1.1.1.1 2001-11-25 00:41:16 lkarsten Exp $
|
||||
*
|
||||
* functions used by mysql-dbadm.c and mysql-useradm.c
|
||||
*
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <mysql.h>
|
||||
#include <assert.h>
|
||||
#include <pwd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include "mysql-admutils.h"
|
||||
|
||||
char *program_name;
|
||||
|
||||
static char *rcsheader = "@(#) " PACKAGE " " VERSION " ljosa@initio.no $Header: /tmp/cvs/mysql-admutils/common.c,v 1.1.1.1 2001-11-25 00:41:16 lkarsten Exp $";
|
||||
|
||||
|
||||
int
|
||||
version()
|
||||
{
|
||||
printf("%s %s\n", program_name, rcsheader);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
wrong_use(char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
if (format)
|
||||
{
|
||||
fprintf(stderr, "%s: ", program_name);
|
||||
va_start(ap, format);
|
||||
vfprintf(stderr, format, ap);
|
||||
va_end(ap);
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
fprintf(stderr, "Try `%s --help' for more information.\n", program_name);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* always returns 1. */
|
||||
int
|
||||
dberror(MYSQL *pmysql, char *format, ...)
|
||||
{
|
||||
char *errmsg;
|
||||
va_list ap;
|
||||
|
||||
fprintf(stderr, "%s: ", program_name);
|
||||
va_start(ap, format);
|
||||
vfprintf(stderr, format, ap);
|
||||
va_end(ap);
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
if (pmysql)
|
||||
{
|
||||
errmsg = mysql_error(pmysql);
|
||||
if ((errmsg) && (strcmp(errmsg, "") != 0))
|
||||
fprintf(stderr, "mysql: %s\n", errmsg);
|
||||
|
||||
mysql_close(pmysql);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* always returns 1. */
|
||||
int
|
||||
fatal_error(char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
fprintf(stderr, "%s: ", program_name);
|
||||
va_start(ap, format);
|
||||
vfprintf(stderr, format, ap);
|
||||
va_end(ap);
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* decides if the UNIX user is entitled to the MySQL database or MySQL user. */
|
||||
int
|
||||
owner(char *name)
|
||||
{
|
||||
struct passwd *p;
|
||||
|
||||
p = getpwuid(getuid());
|
||||
if (!p)
|
||||
{
|
||||
dberror(NULL, "Failed to look up your UNIX username.");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (strcmp(name, p->pw_name) == 0)
|
||||
return 1; /* OK */
|
||||
|
||||
if ((strncmp(name, p->pw_name, strlen(p->pw_name)) == 0) &&
|
||||
(*(name + strlen(p->pw_name)) == '_'))
|
||||
return 1; /* OK */
|
||||
|
||||
return 0; /* not owner if we get as far as this */
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
reload(MYSQL *pmysql)
|
||||
{
|
||||
return mysql_reload(pmysql);
|
||||
}
|
||||
|
||||
|
43
config.h.in
Normal file
43
config.h.in
Normal file
@ -0,0 +1,43 @@
|
||||
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* Define to empty if the keyword does not work. */
|
||||
#undef const
|
||||
|
||||
/* Define if you don't have vprintf but do have _doprnt. */
|
||||
#undef HAVE_DOPRNT
|
||||
|
||||
/* Define if you have the vprintf function. */
|
||||
#undef HAVE_VPRINTF
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||
#undef size_t
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define if lex declares yytext as a char * by default, not a char[]. */
|
||||
#undef YYTEXT_POINTER
|
||||
|
||||
/* Define the name of the package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define the version of the package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define if MySQL is installed */
|
||||
#undef HAVE_MYSQL
|
||||
|
||||
/* Define if libmath is available */
|
||||
#undef HAVE_LIBM
|
||||
|
||||
/* Define if libnsl is available */
|
||||
#undef HAVE_LIBNSL
|
||||
|
||||
/* Define if libsocket is available */
|
||||
#undef HAVE_LIBSOCKET
|
||||
|
||||
/* Define if you have the <errmsg.h> header file. */
|
||||
#undef HAVE_ERRMSG_H
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
98
configure.in
Normal file
98
configure.in
Normal file
@ -0,0 +1,98 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(mysql-dbadm.c)
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE(mysql-admutils, 0.3)
|
||||
AM_SANITY_CHECK
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_CPP
|
||||
AM_PROG_LEX
|
||||
AC_PROG_YACC
|
||||
|
||||
dnl Checks for libraries.
|
||||
AC_CHECK_LIB(c, floor, [:], [
|
||||
AC_CHECK_LIB(m, floor, [
|
||||
LIBS="$LIBS -lm"
|
||||
AC_DEFINE(HAVE_LIBM) ], []) ])
|
||||
AC_CHECK_LIB(mysqlclient, mysql_connect, [
|
||||
LIBS="$LIBS -lmysqlclient" ], [])
|
||||
AC_CHECK_LIB(c, gethostbyaddr, [:], [
|
||||
AC_CHECK_LIB(nsl, gethostbyaddr, [
|
||||
LIBS="$LIBS -lnsl"
|
||||
AC_DEFINE(HAVE_LIBNSL) ], []) ])
|
||||
AC_CHECK_LIB(c, socket, [:], [
|
||||
AC_CHECK_LIB(socket, socket, [
|
||||
LIBS="$LIBS -lsocket"
|
||||
AC_DEFINE(HAVE_LIBSOCKET) ], []) ])
|
||||
|
||||
AC_MSG_CHECKING(for MySQL support)
|
||||
AC_ARG_WITH(mysql,
|
||||
[ --with-mysql[=DIR] Include MySQL support. DIR is the MySQL base
|
||||
install directory, defaults to /usr/local.],
|
||||
[
|
||||
if test "$withval" != "no"; then
|
||||
if test "$withval" = "yes"; then
|
||||
MYSQL_INCDIR=/usr/local/include/mysql
|
||||
MYSQL_LIBDIR=/usr/local/lib/mysql
|
||||
else
|
||||
if test -f $withval/include/mysql/mysql.h; then
|
||||
MYSQL_INCDIR=$withval/include/mysql
|
||||
MYSQL_LIBDIR=$withval/lib/mysql
|
||||
elif test -f $withval/include/mysql.h; then
|
||||
MYSQL_INCDIR=$withval/include
|
||||
MYSQL_LIBDIR=$withval/lib
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_ERROR(Invalid MySQL directory - unable to find mysql.h under $withval)
|
||||
fi
|
||||
fi
|
||||
MYSQL_INCLUDE=-I$MYSQL_INCDIR
|
||||
MYSQL_LFLAGS="-L$MYSQL_LIBDIR -Wl,-rpath,$MYSQL_LIBDIR"
|
||||
MYSQL_LFLAGS="-L$MYSQL_LIBDIR"
|
||||
MYSQL_LIBS=-lmysqlclient
|
||||
|
||||
AC_DEFINE(HAVE_MYSQL)
|
||||
AC_MSG_RESULT(yes)
|
||||
|
||||
dnl check for errmsg.h, which isn't installed by some versions of 3.21
|
||||
old_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $MYSQL_INCLUDE"
|
||||
AC_CHECK_HEADERS(errmsg.h)
|
||||
CPPFLAGS="$old_CPPFLAGS"
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_RESULT("Giving up - You need to install MySQL somewhere"); exit
|
||||
])
|
||||
AC_SUBST(MYSQL_LIBS)
|
||||
AC_SUBST(MYSQL_LFLAGS)
|
||||
AC_SUBST(MYSQL_INCLUDE)
|
||||
|
||||
|
||||
AC_MSG_CHECKING([whether to enable -Wall -pedantic])
|
||||
AC_ARG_ENABLE(warnings,
|
||||
[ --enable-warnings Enable -Wall -pedantic if using gcc.],
|
||||
[ if test -n "$GCC"; then
|
||||
AC_MSG_RESULT(adding -Wall -pedantic to CFLAGS.)
|
||||
CFLAGS="$CFLAGS -Wall -pedantic"
|
||||
fi
|
||||
],AC_MSG_RESULT(no))
|
||||
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(unistd.h)
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
AC_TYPE_SIZE_T
|
||||
|
||||
dnl Checks for library functions.
|
||||
AC_FUNC_VPRINTF
|
||||
|
||||
AC_SUBST(SYSCONFDIR)
|
||||
|
||||
AC_OUTPUT(Makefile, [date > stamp-h])
|
250
install-sh
Normal file
250
install-sh
Normal file
@ -0,0 +1,250 @@
|
||||
#!/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=:
|
||||
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
|
134
missing
Normal file
134
missing
Normal file
@ -0,0 +1,134 @@
|
||||
#! /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 touch file \`y.tab.c'
|
||||
makeinfo touch the output file
|
||||
yacc touch file \`y.tab.c'"
|
||||
;;
|
||||
|
||||
-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."
|
||||
touch config.h.in
|
||||
;;
|
||||
|
||||
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$/touch \1.in/' \
|
||||
| sh
|
||||
;;
|
||||
|
||||
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."
|
||||
touch y.tab.c
|
||||
;;
|
||||
|
||||
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
Normal file
40
mkinstalldirs
Normal 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.1.1 2001-11-25 00:41:16 lkarsten 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" 1>&2
|
||||
|
||||
mkdir "$pathcomp" || lasterr=$?
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
errstatus=$lasterr
|
||||
fi
|
||||
fi
|
||||
|
||||
pathcomp="$pathcomp/"
|
||||
done
|
||||
done
|
||||
|
||||
exit $errstatus
|
||||
|
||||
# mkinstalldirs ends here
|
43
mysql-admutils.h
Normal file
43
mysql-admutils.h
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* @(#) $Header: /tmp/cvs/mysql-admutils/mysql-admutils.h,v 1.1.1.1 2001-11-25 00:41:16 lkarsten Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MYSQL_ADMUTILS_H
|
||||
#define MYSQL_ADMUTILS_H
|
||||
|
||||
extern char *program_name;
|
||||
|
||||
/* defined in pwfile.c */
|
||||
extern const char *db_server;
|
||||
extern const char *db_user;
|
||||
extern const char *db_passwd;
|
||||
extern const char *db_name;
|
||||
|
||||
extern int
|
||||
wrong_use(char *format, ...);
|
||||
|
||||
extern int
|
||||
fatal_error(char *format, ...);
|
||||
|
||||
extern int
|
||||
owner(char *name);
|
||||
|
||||
extern int
|
||||
version(void);
|
||||
|
||||
extern int
|
||||
read_config_file(void);
|
||||
|
||||
|
||||
#ifdef _mysql_h
|
||||
|
||||
extern int
|
||||
dberror(MYSQL *pmysql, char *format, ...);
|
||||
|
||||
extern int
|
||||
reload(MYSQL *pmysql);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* MYSQL_ADMUTILS_H */
|
425
mysql-dbadm.c
Normal file
425
mysql-dbadm.c
Normal file
@ -0,0 +1,425 @@
|
||||
/*
|
||||
* @(#) $Header: /tmp/cvs/mysql-admutils/mysql-dbadm.c,v 1.1.1.1 2001-11-25 00:41:16 lkarsten Exp $
|
||||
*
|
||||
* mysql-dbadm.c
|
||||
*
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <mysql.h>
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <pwd.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include "mysql-admutils.h"
|
||||
|
||||
char *
|
||||
strchr_whitespace(const char *s)
|
||||
{
|
||||
char *sp, *tab;
|
||||
sp = strchr(s, ' ');
|
||||
tab = strchr(s, '\t');
|
||||
if (sp == NULL)
|
||||
return tab;
|
||||
if (tab == NULL)
|
||||
return sp;
|
||||
return sp < tab ? sp : tab; /* if both are found, return the first one */
|
||||
}
|
||||
|
||||
char *
|
||||
strtok_whitespace(char *s)
|
||||
{
|
||||
static char *cp;
|
||||
char *r;
|
||||
|
||||
r = s ? s : cp;
|
||||
if (r == NULL)
|
||||
return NULL;
|
||||
cp = strchr_whitespace(r);
|
||||
if (cp == NULL)
|
||||
return r;
|
||||
while ((*cp == ' ') || (*cp == '\t'))
|
||||
{
|
||||
*cp++ = '\0';
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
valid_priv(const char *s)
|
||||
{
|
||||
#define ACCEPT(x) if (strcmp(s, x) == 0) return 1
|
||||
ACCEPT("Y");
|
||||
ACCEPT("N");
|
||||
ACCEPT("y");
|
||||
ACCEPT("n");
|
||||
#undef ACCEPT
|
||||
return 0; /* not a valid priv */
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
usage()
|
||||
{
|
||||
printf("Usage: %s COMMAND [DATABASE]...\n", program_name);
|
||||
printf("Create, drop og edit permission for the DATABASE(s),\n");
|
||||
printf("as determined by the COMMAND. Valid COMMANDs:\n");
|
||||
printf("\n");
|
||||
printf(" create create the DATABASE(s).\n");
|
||||
printf(" drop delete the DATABASE(s).\n");
|
||||
printf(" show give information about the DATABASE(s), or, if\n");
|
||||
printf(" none are given, all the ones you own.\n");
|
||||
printf(" editperm change permissions for the DATABASE(s). Your\n");
|
||||
printf(" favorite editor will be started, allowing you\n");
|
||||
printf(" to make changes to the permission table.\n");
|
||||
printf("\n");
|
||||
printf("Report bugs to ljosa@initio.no\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
create(MYSQL *pmysql, char *db)
|
||||
{
|
||||
if (mysql_create_db(pmysql, db))
|
||||
return dberror(pmysql, "Cannot create database '%s'.", db);
|
||||
|
||||
fprintf(stderr, "Database '%s' created.\n", db);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
drop(MYSQL *pmysql, char *db)
|
||||
{
|
||||
char query[1024];
|
||||
|
||||
sprintf(query, "delete from db where db = '%s'", db);
|
||||
if (mysql_query(pmysql, query))
|
||||
dberror(pmysql, "Failed to delete permissions for database '%s'.", db);
|
||||
|
||||
if (mysql_drop_db(pmysql, db))
|
||||
return dberror(pmysql, "Cannot drop database '%s'.", db);
|
||||
|
||||
fprintf(stderr, "Database '%s' dropped.\n", db);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* return a list of the user's databases */
|
||||
char **
|
||||
list(MYSQL *pmysql)
|
||||
{
|
||||
char *wild;
|
||||
MYSQL_RES *res;
|
||||
int rows;
|
||||
MYSQL_ROW row;
|
||||
char **dblist;
|
||||
int i;
|
||||
struct passwd *p;
|
||||
|
||||
p = getpwuid(getuid());
|
||||
if (!p)
|
||||
{
|
||||
dberror(NULL, "Failed to lookup your UNIX username.");
|
||||
exit(1);
|
||||
}
|
||||
wild = malloc(strlen(p->pw_name) + 3);
|
||||
sprintf(wild, "%s_%%", p->pw_name);
|
||||
|
||||
res = mysql_list_dbs(pmysql, wild);
|
||||
rows = mysql_num_rows(res);
|
||||
dblist = malloc((rows + 2) * sizeof(char *)); /* one for the username
|
||||
(might not be used)*/
|
||||
if (!dblist)
|
||||
{
|
||||
dberror(NULL, "Out of memory.\n");
|
||||
free(wild);
|
||||
return NULL;
|
||||
}
|
||||
for (i = 0; i < rows; i++)
|
||||
if ((row = mysql_fetch_row(res)))
|
||||
{
|
||||
dblist[i] = strdup(row[0]);
|
||||
}
|
||||
|
||||
res = mysql_list_dbs(pmysql, p->pw_name);
|
||||
rows = mysql_num_rows(res);
|
||||
if (rows == 1)
|
||||
dblist[i++] = strdup(p->pw_name);
|
||||
|
||||
dblist[i] = NULL;
|
||||
|
||||
return dblist;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
writeperm(FILE *f, MYSQL *pmysql, const char *db)
|
||||
{
|
||||
char query[1024];
|
||||
MYSQL_RES *res;
|
||||
int rows, i;
|
||||
MYSQL_ROW row;
|
||||
|
||||
sprintf(query, "select user,select_priv,insert_priv,update_priv,"
|
||||
"delete_priv,create_priv,drop_priv from db where db='%s'", db);
|
||||
|
||||
if (mysql_query(pmysql, query))
|
||||
return dberror(pmysql, "Query for permissions failed.");
|
||||
res = mysql_store_result(pmysql);
|
||||
rows = mysql_num_rows(res);
|
||||
fprintf(f, "# User "
|
||||
"Select Insert Update Delete Create Drop\n");
|
||||
fprintf(f, "# ---------------- "
|
||||
"------ ------ ------ ------ ------ ------\n");
|
||||
if (rows == 0)
|
||||
fprintf(f, "# (no permissions currently granted to any users)\n");
|
||||
else
|
||||
for (i = 0; i < rows; i++)
|
||||
{
|
||||
row = mysql_fetch_row(res);
|
||||
fprintf(f, " %-16s %-7s %-7s %-7s %-7s %-7s %s\n",
|
||||
row[0], row[1], row[2], row[3], row[4], row[5], row[6]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* show information about the database */
|
||||
int
|
||||
show(MYSQL *pmysql, const char *db)
|
||||
{
|
||||
printf("Database '%s':\n", db);
|
||||
|
||||
writeperm(stdout, pmysql, db);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#define MAX_GRANTS 1024
|
||||
|
||||
|
||||
int
|
||||
editperm(MYSQL *pmysql, const char *db)
|
||||
{
|
||||
char fn[] = "/tmp/mysql-dbadm.tmp.XXXXXX";
|
||||
FILE *f;
|
||||
char *editor;
|
||||
char cmd[1024]; /* shell command for editing the file */
|
||||
char line[1024]; /* buffer to hold one line */
|
||||
char *cp; /* used to interate through a line */
|
||||
char *user, *select_priv, *insert_priv, *update_priv, *delete_priv,
|
||||
*create_priv, *drop_priv;
|
||||
char query[1024]; /* used to build a query */
|
||||
char *queries[MAX_GRANTS]; /* insert queries */
|
||||
int lines; /* number of grant lines processed */
|
||||
int i; /* iterate through lines[] */
|
||||
|
||||
mktemp(fn);
|
||||
if (strcmp(fn, "") == 0)
|
||||
return dberror(NULL, "Cannot create a unique temporary file name.");
|
||||
|
||||
f = fopen(fn, "w");
|
||||
if (f == NULL)
|
||||
return dberror(NULL, "Failed to open temporary file %s.", fn);
|
||||
writeperm(f, pmysql, db);
|
||||
fclose(f);
|
||||
|
||||
editor = getenv("EDITOR");
|
||||
if (!editor)
|
||||
editor = "pico"; /* OK since editor won't be freed */
|
||||
strcpy(cmd, editor);
|
||||
strcat(cmd, " ");
|
||||
strcat(cmd, fn);
|
||||
if (system(cmd) == -1)
|
||||
{
|
||||
dberror(NULL, "Failed to execute '%s'\n", cmd);
|
||||
perror("system");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* parse */
|
||||
f = fopen(fn, "r");
|
||||
lines = 0;
|
||||
while (fgets(line, sizeof(line), f))
|
||||
{
|
||||
cp = strchr(line, '\n');
|
||||
if (cp)
|
||||
*cp = '\0';
|
||||
|
||||
cp = line;
|
||||
while (*cp && ((*cp == ' ') || (*cp == '\t'))) cp++;
|
||||
if (*cp == '\0') continue;
|
||||
if (*cp == '#') continue;
|
||||
if (*cp == '\n') continue;
|
||||
|
||||
#define STRTOK_WHITESPACE(res, start) \
|
||||
{ if (!(res = strtok_whitespace(start))) continue; }
|
||||
|
||||
STRTOK_WHITESPACE(user, cp);
|
||||
if (strlen(user) < 1)
|
||||
return dberror(NULL, "Invalid user '%s' in grant line %d.", user,
|
||||
lines + 1);
|
||||
if (strcmp(user, "%") == 0)
|
||||
*user = '\0'; /* ugly, but it works... */
|
||||
|
||||
#define CHECK_PRIV(PRIV) \
|
||||
if (!valid_priv(PRIV)) return dberror(NULL, "Invalid value '%s' " \
|
||||
"in grant line %d.", PRIV, lines + 1)
|
||||
|
||||
STRTOK_WHITESPACE(select_priv, NULL);
|
||||
CHECK_PRIV(select_priv);
|
||||
STRTOK_WHITESPACE(insert_priv, NULL);
|
||||
CHECK_PRIV(insert_priv);
|
||||
STRTOK_WHITESPACE(update_priv, NULL);
|
||||
CHECK_PRIV(update_priv);
|
||||
STRTOK_WHITESPACE(delete_priv, NULL);
|
||||
CHECK_PRIV(delete_priv);
|
||||
STRTOK_WHITESPACE(create_priv, NULL);
|
||||
CHECK_PRIV(create_priv);
|
||||
STRTOK_WHITESPACE(drop_priv, NULL);
|
||||
CHECK_PRIV(drop_priv);
|
||||
|
||||
#undef STRTOK_WHITESPACE
|
||||
#undef CHECK_PRIV
|
||||
|
||||
sprintf(query, "insert into db (host, db, user, select_priv, insert_priv, "
|
||||
"update_priv, delete_priv, create_priv, drop_priv) values "
|
||||
"('%%', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",
|
||||
db, user, select_priv, insert_priv, update_priv, delete_priv,
|
||||
create_priv, drop_priv);
|
||||
queries[lines] = strdup(query);
|
||||
lines++;
|
||||
if (lines >= MAX_GRANTS)
|
||||
{
|
||||
dberror(NULL, "Warning: Maximum of %d grants reached.\n",
|
||||
MAX_GRANTS);
|
||||
continue;
|
||||
}
|
||||
} /* while fgets ... */
|
||||
|
||||
unlink(fn);
|
||||
fclose(f);
|
||||
|
||||
/* now that we have checked the input for errors, we can safely
|
||||
delete the old grants from the database and insert the new ones. */
|
||||
|
||||
sprintf(query, "delete from db where db='%s'", db);
|
||||
if (mysql_query(pmysql, query))
|
||||
dberror(pmysql, "Failed to delete old grants for '%s'.", db);
|
||||
|
||||
for (i = 0; i < lines; i++)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
puts(queries[i]);
|
||||
putchar('\n');
|
||||
#endif
|
||||
if (mysql_query(pmysql, queries[i]))
|
||||
dberror(pmysql, "Failed to insert grant line %d.", i + 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
enum { c_create, c_drop, c_editperm, c_show } command;
|
||||
MYSQL mysql;
|
||||
char **dblist, **p;
|
||||
|
||||
program_name = argv[0];
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
if (strcmp(argv[i], "--help") == 0)
|
||||
return usage();
|
||||
for (i = 1; i < argc; i++)
|
||||
if (strcmp(argv[i], "--version") == 0)
|
||||
return version();
|
||||
|
||||
if (argc < 2)
|
||||
return wrong_use(NULL);
|
||||
|
||||
/* check that the supplied command is valid */
|
||||
|
||||
if (strcmp(argv[1], "create") == 0)
|
||||
command = c_create;
|
||||
else if (strcmp(argv[1], "drop") == 0)
|
||||
command = c_drop;
|
||||
else if (strcmp(argv[1], "editperm") == 0)
|
||||
command = c_editperm;
|
||||
else if (strcmp(argv[1], "show") == 0)
|
||||
command = c_show;
|
||||
else
|
||||
return wrong_use("unrecognized command"); /* XXX */
|
||||
|
||||
/* all other than show requires at lease one DATABASE argument. */
|
||||
if ((command != c_show) && (argc < 3))
|
||||
return wrong_use(NULL);
|
||||
|
||||
read_config_file();
|
||||
|
||||
/* connect to the database server and select the mysql database */
|
||||
if (!mysql_connect(&mysql, db_server, db_user, db_passwd))
|
||||
return dberror(&mysql, "Cannot connect to database server '%s'.",
|
||||
db_server);
|
||||
if (mysql_select_db(&mysql, db_name))
|
||||
return dberror(&mysql, "Cannot select database '%s'.", db_name);
|
||||
|
||||
if ((command == c_show) && (argc == 2))
|
||||
{
|
||||
dblist = list(&mysql);
|
||||
p = dblist;
|
||||
while (*p)
|
||||
{
|
||||
show(&mysql, *p);
|
||||
free(*p);
|
||||
p++;
|
||||
}
|
||||
free(dblist);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* for each supplied database name, perform the requested action */
|
||||
for (i = 2; i < argc; i++)
|
||||
{
|
||||
if (! owner(argv[i]))
|
||||
{
|
||||
dberror(NULL, "You are not the owner of '%s'. Skipping.",
|
||||
argv[i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (command)
|
||||
{
|
||||
case c_create:
|
||||
create(&mysql, argv[i]);
|
||||
break;
|
||||
case c_drop:
|
||||
drop(&mysql, argv[i]);
|
||||
break;
|
||||
case c_editperm:
|
||||
editperm(&mysql, argv[i]);
|
||||
break;
|
||||
case c_show:
|
||||
show(&mysql, argv[i]);
|
||||
break;
|
||||
default:
|
||||
return dberror(NULL, "This point should never be reached!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mysql_reload(&mysql);
|
||||
mysql_close(&mysql);
|
||||
|
||||
return 0;
|
||||
}
|
304
mysql-useradm.c
Normal file
304
mysql-useradm.c
Normal file
@ -0,0 +1,304 @@
|
||||
/*
|
||||
* @(#) $Header: /tmp/cvs/mysql-admutils/mysql-useradm.c,v 1.1.1.1 2001-11-25 00:41:16 lkarsten Exp $
|
||||
*
|
||||
* mysql-useradm.c
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <pwd.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <mysql.h>
|
||||
#include "mysql-admutils.h"
|
||||
|
||||
int
|
||||
usage()
|
||||
{
|
||||
printf("Usage: %s COMMAND [USER]...\n", program_name);
|
||||
printf("Create, delete or change password for the USER(s),\n");
|
||||
printf("as determined by the COMMAND. Valid COMMANDs:\n");
|
||||
printf("\n");
|
||||
printf(" create create the USER(s).\n");
|
||||
printf(" delete delete the USER(s).\n");
|
||||
printf(" passwd change the MySQL password for the USER(s). You\n");
|
||||
printf(" will be promptet for the old and the new password.\n");
|
||||
printf(" show give information about the USERS(s), or, if\n");
|
||||
printf(" none are given, all the users you have.\n");
|
||||
printf("\n");
|
||||
printf("Report bugs to ljosa@initio.no\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
is_password_set(MYSQL *pmysql, const char *user)
|
||||
{
|
||||
char query[1024];
|
||||
MYSQL_RES *res;
|
||||
int rows;
|
||||
MYSQL_ROW row;
|
||||
|
||||
sprintf(query, "select password from user where user = '%s'", user);
|
||||
if (mysql_query(pmysql, query))
|
||||
dberror(pmysql, "Failed to look up password for user '%s'.", user);
|
||||
res = mysql_store_result(pmysql);
|
||||
rows = mysql_num_rows(res);
|
||||
if (rows == 0)
|
||||
return -1;
|
||||
if (rows > 1)
|
||||
return dberror(NULL, "Query for password for user '%s' gave %d results!",
|
||||
rows);
|
||||
row = mysql_fetch_row(res);
|
||||
return (row[0] && (strlen(row[0]) > 0));
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
create(MYSQL *pmysql, const char *user)
|
||||
{
|
||||
char query[1024];
|
||||
|
||||
sprintf(query, "insert into user (host, user) values ('%%', '%s')", user);
|
||||
if (mysql_query(pmysql, query))
|
||||
return dberror(pmysql, "Failed to create user '%s'.", user);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
delete(MYSQL *pmysql, const char *user)
|
||||
{
|
||||
char query[1024];
|
||||
|
||||
sprintf(query, "delete from user where user = '%s'", user);
|
||||
if (mysql_query(pmysql, query))
|
||||
return dberror(pmysql, "Failed to delete user '%s'.", user);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
passwd(MYSQL *pmysql, const char *user)
|
||||
{
|
||||
char prompt[1024];
|
||||
char query[1024];
|
||||
char *password, *confirm_password;
|
||||
MYSQL_RES *res;
|
||||
int rows;
|
||||
MYSQL_ROW row;
|
||||
|
||||
if (is_password_set(pmysql, user))
|
||||
{
|
||||
sprintf(prompt, "(current) MySQL password for user '%s': ", user);
|
||||
password = getpass(prompt);
|
||||
sprintf(query, "select password = password('%s') from user "
|
||||
"where user = '%s'", password, user);
|
||||
if (mysql_query(pmysql, query))
|
||||
return dberror(pmysql, "Failed to check old password for user '%s'.",
|
||||
user);
|
||||
res = mysql_store_result(pmysql);
|
||||
rows = mysql_num_rows(res);
|
||||
if (rows == 0)
|
||||
return dberror(NULL, "Check for old password for user '%s' "
|
||||
"returned empty.", user);
|
||||
if (rows > 1)
|
||||
return dberror(NULL, "Check for old password for user '%s' "
|
||||
"returned more than one row!", user);
|
||||
row = mysql_fetch_row(res);
|
||||
if (strcmp(row[0], "1") != 0)
|
||||
{
|
||||
fprintf(stderr, "%s: Wrong password entered for user '%s'.\n",
|
||||
program_name, user);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
sprintf(prompt, "New MySQL password for user '%s': ", user);
|
||||
password = getpass(prompt);
|
||||
confirm_password = strdup(password);
|
||||
sprintf(prompt, "Retype new MySQL password for user '%s': ", user);
|
||||
password = getpass(prompt);
|
||||
if (strcmp(password, confirm_password) != 0)
|
||||
{
|
||||
free(confirm_password);
|
||||
return dberror(NULL, "Sorry, passwords do not match.");
|
||||
}
|
||||
free(confirm_password);
|
||||
|
||||
sprintf(query, "update user set password = password('%s') "
|
||||
"where user = '%s'", password, user);
|
||||
if (mysql_query(pmysql, query))
|
||||
return dberror(pmysql, "Failed to set new password for user '%s'.", user);
|
||||
if (mysql_affected_rows(pmysql) > 1)
|
||||
dberror(NULL, "%d rows affected by password update for user '%s'!",
|
||||
mysql_affected_rows(pmysql), user);
|
||||
|
||||
fprintf(stderr, "Password updated for user '%s'.\n", user);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
show(MYSQL *pmysql, const char *user)
|
||||
{
|
||||
switch (is_password_set(pmysql, user))
|
||||
{
|
||||
case -1:
|
||||
break;
|
||||
case 0:
|
||||
printf("User '%s': ", user);
|
||||
printf("no password set.\n");
|
||||
break;
|
||||
case 1:
|
||||
printf("User '%s': ", user);
|
||||
printf("password set.\n");
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* return a list of the user's databases */
|
||||
char **
|
||||
list(MYSQL *pmysql)
|
||||
{
|
||||
char query[1024];
|
||||
MYSQL_RES *res;
|
||||
int rows;
|
||||
MYSQL_ROW row;
|
||||
char **userlist;
|
||||
int i;
|
||||
struct passwd *p;
|
||||
|
||||
p = getpwuid(getuid());
|
||||
sprintf(query, "select user from user where user='%s' or user like '%s_%%'",
|
||||
p->pw_name, p->pw_name);
|
||||
|
||||
if (mysql_query(pmysql, query))
|
||||
{
|
||||
dberror(pmysql, "Failed to look up %s's users.", p->pw_name);
|
||||
return NULL;
|
||||
}
|
||||
res = mysql_store_result(pmysql);
|
||||
rows = mysql_num_rows(res);
|
||||
userlist = malloc((rows + 1) * sizeof(char *));
|
||||
if (!userlist)
|
||||
{
|
||||
dberror(NULL, "%s: Out of memory.\n", program_name);
|
||||
return NULL;
|
||||
}
|
||||
for (i = 0; i < rows; i++)
|
||||
if ((row = mysql_fetch_row(res)))
|
||||
{
|
||||
userlist[i] = strdup(row[0]);
|
||||
}
|
||||
|
||||
userlist[i] = NULL;
|
||||
|
||||
return userlist;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
enum { c_create, c_delete, c_passwd, c_show } command;
|
||||
MYSQL mysql;
|
||||
char **dblist, **p;
|
||||
|
||||
program_name = argv[0];
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
if (strcmp(argv[i], "--help") == 0)
|
||||
return usage();
|
||||
for (i = 1; i < argc; i++)
|
||||
if (strcmp(argv[i], "--version") == 0)
|
||||
return version();
|
||||
|
||||
if (argc < 2)
|
||||
return wrong_use(NULL);
|
||||
|
||||
/* check that the supplied command is valid */
|
||||
|
||||
if (strcmp(argv[1], "create") == 0)
|
||||
command = c_create;
|
||||
else if (strcmp(argv[1], "delete") == 0)
|
||||
command = c_delete;
|
||||
else if (strcmp(argv[1], "passwd") == 0)
|
||||
command = c_passwd;
|
||||
else if (strcmp(argv[1], "show") == 0)
|
||||
command = c_show;
|
||||
else
|
||||
return wrong_use("unrecognized command '%s'.", argv[1]); /* XXX */
|
||||
|
||||
/* all other than show requires at lease one USER argument. */
|
||||
if ((command != c_show) && (argc < 3))
|
||||
return wrong_use(NULL);
|
||||
|
||||
read_config_file();
|
||||
|
||||
/* connect to the database server and select the mysql database */
|
||||
if (!mysql_connect(&mysql, db_server, db_user, db_passwd))
|
||||
return dberror(&mysql, "Cannot connect to database server '%s'.",
|
||||
db_server);
|
||||
if (mysql_select_db(&mysql, db_name))
|
||||
return dberror(&mysql, "Cannot select database '%s'.", db_name);
|
||||
|
||||
if ((command == c_show) && (argc == 2))
|
||||
{
|
||||
dblist = list(&mysql);
|
||||
p = dblist;
|
||||
while (*p)
|
||||
{
|
||||
show(&mysql, *p);
|
||||
free(*p);
|
||||
p++;
|
||||
}
|
||||
free(dblist);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* for each supplied database name, perform the requested action */
|
||||
for (i = 2; i < argc; i++)
|
||||
{
|
||||
if (! owner(argv[i]))
|
||||
{
|
||||
dberror(NULL, "You are not the owner of '%s'. Skipping.",
|
||||
argv[i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (command)
|
||||
{
|
||||
case c_create:
|
||||
create(&mysql, argv[i]);
|
||||
break;
|
||||
case c_delete:
|
||||
delete(&mysql, argv[i]);
|
||||
break;
|
||||
case c_passwd:
|
||||
passwd(&mysql, argv[i]);
|
||||
break;
|
||||
case c_show:
|
||||
show(&mysql, argv[i]);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "This point should never be reached.\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
reload(&mysql);
|
||||
mysql_close(&mysql);
|
||||
|
||||
return 0;
|
||||
}
|
106
pwfile.c
Normal file
106
pwfile.c
Normal file
@ -0,0 +1,106 @@
|
||||
/*
|
||||
* @($) $Id: pwfile.c,v 1.1.1.1 2001-11-25 00:41:16 lkarsten Exp $
|
||||
*
|
||||
* functions for parsing the config file.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/resource.h>
|
||||
#include "mysql-admutils.h"
|
||||
#include "pwyacc.h"
|
||||
|
||||
/* the MySQL maximum */
|
||||
#define MAXPWCHARS 16
|
||||
|
||||
/* defaults for configurable values */
|
||||
const char* db_user = "root";
|
||||
const char* db_server = "localhost";
|
||||
const char* db_passwd = NULL;
|
||||
const char* db_name = "mysql";
|
||||
|
||||
extern int yyparse(void);
|
||||
extern FILE *yyin;
|
||||
|
||||
int config_line = 1;
|
||||
|
||||
static FILE *pwfile;
|
||||
static char *filename = SYSCONFDIR "/mysql-admutils.conf";
|
||||
|
||||
int
|
||||
read_config_file(void)
|
||||
{
|
||||
struct rlimit rlim;
|
||||
int rc; /* return code */
|
||||
|
||||
/* to stop the user from obtaining the password from a core dump. */
|
||||
if (getrlimit(RLIMIT_CORE, &rlim) == -1) {
|
||||
perror("getrlimit");
|
||||
exit(1);
|
||||
}
|
||||
rlim.rlim_max = 0;
|
||||
if (setrlimit(RLIMIT_CORE, &rlim) == -1) {
|
||||
perror("setrlimit");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
pwfile = fopen(filename, "r");
|
||||
if (!pwfile) {
|
||||
fatal_error("cannot open configuration file %s", filename);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* we don't need to be SUID anymore. */
|
||||
if (seteuid(getuid()) != 0)
|
||||
perror("seteuid");
|
||||
|
||||
yyin = pwfile;
|
||||
rc = yyparse();
|
||||
fclose(pwfile);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
yywrap(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
yyerror(const char *msg)
|
||||
{
|
||||
fprintf(stderr, "%s:%d: %s\n", filename, config_line, msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
config_set_string_var(int var, const char *value)
|
||||
{
|
||||
assert(value);
|
||||
switch (var) {
|
||||
case USER:
|
||||
db_user = value;
|
||||
break;
|
||||
case HOST:
|
||||
db_server = value;
|
||||
break;
|
||||
case PASSWORD:
|
||||
if (strlen(value) > MAXPWCHARS) {
|
||||
fprintf(stderr, "%s:%d: password is too long (%d chars > %d chars)\n",
|
||||
filename, config_line, strlen(value), MAXPWCHARS);
|
||||
fclose(pwfile);
|
||||
exit(1);
|
||||
}
|
||||
db_passwd = value;
|
||||
break;
|
||||
default:
|
||||
assert(!"We should never get here.");
|
||||
}
|
||||
return 0;
|
||||
}
|
47
pwlex.l
Normal file
47
pwlex.l
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* @(#) $Id: pwlex.l,v 1.1.1.1 2001-11-25 00:41:16 lkarsten Exp $
|
||||
*
|
||||
* lex source for the configuration file
|
||||
*
|
||||
*/
|
||||
|
||||
%{
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "pwyacc.h"
|
||||
|
||||
extern int config_line;
|
||||
extern int yylval;
|
||||
%}
|
||||
|
||||
%%
|
||||
|
||||
#.*\n config_line++;
|
||||
|
||||
set { yylval = SET; return(SET); }
|
||||
host { yylval = HOST; return(HOST); };
|
||||
user { yylval = USER; return(USER); };
|
||||
password { yylval = PASSWORD; return(PASSWORD); }
|
||||
|
||||
\"[^"]*\" {
|
||||
if (yytext[yyleng - 1] == '\\')
|
||||
yymore();
|
||||
else
|
||||
yytext[yyleng - 1] = '\0';
|
||||
yylval = (int)strdup(yytext + 1);
|
||||
return(STRING);
|
||||
};
|
||||
|
||||
; return(';');
|
||||
|
||||
[^ \t\n\;]* {
|
||||
yylval = (int)strdup(yytext);
|
||||
return(STRING);
|
||||
}
|
||||
|
||||
[ \t] ;
|
||||
|
||||
\n config_line++;
|
||||
|
||||
%%
|
||||
|
839
pwyacc.c
Normal file
839
pwyacc.c
Normal file
@ -0,0 +1,839 @@
|
||||
|
||||
/* A Bison parser, made from pwyacc.y
|
||||
by GNU Bison version 1.25
|
||||
*/
|
||||
|
||||
#define YYBISON 1 /* Identify Bison output. */
|
||||
|
||||
#define SET 258
|
||||
#define HOST 259
|
||||
#define USER 260
|
||||
#define PASSWORD 261
|
||||
#define STRING 262
|
||||
|
||||
#line 8 "pwyacc.y"
|
||||
|
||||
int yyerror(const char *msg);
|
||||
int yylex(void);
|
||||
int config_set_string_var(int var, const char *value);
|
||||
#ifndef YYSTYPE
|
||||
#define YYSTYPE int
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef __cplusplus
|
||||
#ifndef __STDC__
|
||||
#define const
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define YYFINAL 12
|
||||
#define YYFLAG -32768
|
||||
#define YYNTBASE 9
|
||||
|
||||
#define YYTRANSLATE(x) ((unsigned)(x) <= 262 ? yytranslate[x] : 12)
|
||||
|
||||
static const char yytranslate[] = { 0,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 8, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
|
||||
6, 7
|
||||
};
|
||||
|
||||
#if YYDEBUG != 0
|
||||
static const short yyprhs[] = { 0,
|
||||
0, 1, 4, 9, 11, 13
|
||||
};
|
||||
|
||||
static const short yyrhs[] = { -1,
|
||||
10, 9, 0, 3, 11, 7, 8, 0, 5, 0,
|
||||
6, 0, 4, 0
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#if YYDEBUG != 0
|
||||
static const short yyrline[] = { 0,
|
||||
18, 19, 21, 28, 28, 28
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
|
||||
|
||||
static const char * const yytname[] = { "$","error","$undefined.","SET","HOST",
|
||||
"USER","PASSWORD","STRING","';'","input","statement","variable", NULL
|
||||
};
|
||||
#endif
|
||||
|
||||
static const short yyr1[] = { 0,
|
||||
9, 9, 10, 11, 11, 11
|
||||
};
|
||||
|
||||
static const short yyr2[] = { 0,
|
||||
0, 2, 4, 1, 1, 1
|
||||
};
|
||||
|
||||
static const short yydefact[] = { 1,
|
||||
0, 1, 6, 4, 5, 0, 2, 0, 3, 0,
|
||||
0, 0
|
||||
};
|
||||
|
||||
static const short yydefgoto[] = { 7,
|
||||
2, 6
|
||||
};
|
||||
|
||||
static const short yypact[] = { 0,
|
||||
-4, 0,-32768,-32768,-32768, -3,-32768, -2,-32768, 5,
|
||||
7,-32768
|
||||
};
|
||||
|
||||
static const short yypgoto[] = { 8,
|
||||
-32768,-32768
|
||||
};
|
||||
|
||||
|
||||
#define YYLAST 8
|
||||
|
||||
|
||||
static const short yytable[] = { 3,
|
||||
4, 5, 1, 8, 11, 9, 12, 10
|
||||
};
|
||||
|
||||
static const short yycheck[] = { 4,
|
||||
5, 6, 3, 7, 0, 8, 0, 0
|
||||
};
|
||||
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
|
||||
#line 3 "/store/share/bison.simple"
|
||||
|
||||
/* Skeleton output parser for bison,
|
||||
Copyright (C) 1984, 1989, 1990 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* As a special exception, when this file is copied by Bison into a
|
||||
Bison output file, you may use that output file without restriction.
|
||||
This special exception was added by the Free Software Foundation
|
||||
in version 1.24 of Bison. */
|
||||
|
||||
#ifndef alloca
|
||||
#ifdef __GNUC__
|
||||
#define alloca __builtin_alloca
|
||||
#else /* not GNU C. */
|
||||
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
|
||||
#include <alloca.h>
|
||||
#else /* not sparc */
|
||||
#if defined (MSDOS) && !defined (__TURBOC__)
|
||||
#include <malloc.h>
|
||||
#else /* not MSDOS, or __TURBOC__ */
|
||||
#if defined(_AIX)
|
||||
#include <malloc.h>
|
||||
#pragma alloca
|
||||
#else /* not MSDOS, __TURBOC__, or _AIX */
|
||||
#ifdef __hpux
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
void *alloca (unsigned int);
|
||||
};
|
||||
#else /* not __cplusplus */
|
||||
void *alloca ();
|
||||
#endif /* not __cplusplus */
|
||||
#endif /* __hpux */
|
||||
#endif /* not _AIX */
|
||||
#endif /* not MSDOS, or __TURBOC__ */
|
||||
#endif /* not sparc. */
|
||||
#endif /* not GNU C. */
|
||||
#endif /* alloca not defined. */
|
||||
|
||||
/* This is the parser code that is written into each bison parser
|
||||
when the %semantic_parser declaration is not specified in the grammar.
|
||||
It was written by Richard Stallman by simplifying the hairy parser
|
||||
used when %semantic_parser is specified. */
|
||||
|
||||
/* Note: there must be only one dollar sign in this file.
|
||||
It is replaced by the list of actions, each action
|
||||
as one case of the switch. */
|
||||
|
||||
#define yyerrok (yyerrstatus = 0)
|
||||
#define yyclearin (yychar = YYEMPTY)
|
||||
#define YYEMPTY -2
|
||||
#define YYEOF 0
|
||||
#define YYACCEPT return(0)
|
||||
#define YYABORT return(1)
|
||||
#define YYERROR goto yyerrlab1
|
||||
/* Like YYERROR except do call yyerror.
|
||||
This remains here temporarily to ease the
|
||||
transition to the new meaning of YYERROR, for GCC.
|
||||
Once GCC version 2 has supplanted version 1, this can go. */
|
||||
#define YYFAIL goto yyerrlab
|
||||
#define YYRECOVERING() (!!yyerrstatus)
|
||||
#define YYBACKUP(token, value) \
|
||||
do \
|
||||
if (yychar == YYEMPTY && yylen == 1) \
|
||||
{ yychar = (token), yylval = (value); \
|
||||
yychar1 = YYTRANSLATE (yychar); \
|
||||
YYPOPSTACK; \
|
||||
goto yybackup; \
|
||||
} \
|
||||
else \
|
||||
{ yyerror ("syntax error: cannot back up"); YYERROR; } \
|
||||
while (0)
|
||||
|
||||
#define YYTERROR 1
|
||||
#define YYERRCODE 256
|
||||
|
||||
#ifndef YYPURE
|
||||
#define YYLEX yylex()
|
||||
#endif
|
||||
|
||||
#ifdef YYPURE
|
||||
#ifdef YYLSP_NEEDED
|
||||
#ifdef YYLEX_PARAM
|
||||
#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
|
||||
#else
|
||||
#define YYLEX yylex(&yylval, &yylloc)
|
||||
#endif
|
||||
#else /* not YYLSP_NEEDED */
|
||||
#ifdef YYLEX_PARAM
|
||||
#define YYLEX yylex(&yylval, YYLEX_PARAM)
|
||||
#else
|
||||
#define YYLEX yylex(&yylval)
|
||||
#endif
|
||||
#endif /* not YYLSP_NEEDED */
|
||||
#endif
|
||||
|
||||
/* If nonreentrant, generate the variables here */
|
||||
|
||||
#ifndef YYPURE
|
||||
|
||||
int yychar; /* the lookahead symbol */
|
||||
YYSTYPE yylval; /* the semantic value of the */
|
||||
/* lookahead symbol */
|
||||
|
||||
#ifdef YYLSP_NEEDED
|
||||
YYLTYPE yylloc; /* location data for the lookahead */
|
||||
/* symbol */
|
||||
#endif
|
||||
|
||||
int yynerrs; /* number of parse errors so far */
|
||||
#endif /* not YYPURE */
|
||||
|
||||
#if YYDEBUG != 0
|
||||
int yydebug; /* nonzero means print parse trace */
|
||||
/* Since this is uninitialized, it does not stop multiple parsers
|
||||
from coexisting. */
|
||||
#endif
|
||||
|
||||
/* YYINITDEPTH indicates the initial size of the parser's stacks */
|
||||
|
||||
#ifndef YYINITDEPTH
|
||||
#define YYINITDEPTH 200
|
||||
#endif
|
||||
|
||||
/* YYMAXDEPTH is the maximum size the stacks can grow to
|
||||
(effective only if the built-in stack extension method is used). */
|
||||
|
||||
#if YYMAXDEPTH == 0
|
||||
#undef YYMAXDEPTH
|
||||
#endif
|
||||
|
||||
#ifndef YYMAXDEPTH
|
||||
#define YYMAXDEPTH 10000
|
||||
#endif
|
||||
|
||||
/* Prevent warning if -Wstrict-prototypes. */
|
||||
#ifdef __GNUC__
|
||||
int yyparse (void);
|
||||
#endif
|
||||
|
||||
#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
|
||||
#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
|
||||
#else /* not GNU C or C++ */
|
||||
#ifndef __cplusplus
|
||||
|
||||
/* This is the most reliable way to avoid incompatibilities
|
||||
in available built-in functions on various systems. */
|
||||
static void
|
||||
__yy_memcpy (to, from, count)
|
||||
char *to;
|
||||
char *from;
|
||||
int count;
|
||||
{
|
||||
register char *f = from;
|
||||
register char *t = to;
|
||||
register int i = count;
|
||||
|
||||
while (i-- > 0)
|
||||
*t++ = *f++;
|
||||
}
|
||||
|
||||
#else /* __cplusplus */
|
||||
|
||||
/* This is the most reliable way to avoid incompatibilities
|
||||
in available built-in functions on various systems. */
|
||||
static void
|
||||
__yy_memcpy (char *to, char *from, int count)
|
||||
{
|
||||
register char *f = from;
|
||||
register char *t = to;
|
||||
register int i = count;
|
||||
|
||||
while (i-- > 0)
|
||||
*t++ = *f++;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#line 196 "/store/share/bison.simple"
|
||||
|
||||
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
|
||||
into yyparse. The argument should have type void *.
|
||||
It should actually point to an object.
|
||||
Grammar actions can access the variable by casting it
|
||||
to the proper pointer type. */
|
||||
|
||||
#ifdef YYPARSE_PARAM
|
||||
#ifdef __cplusplus
|
||||
#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
|
||||
#define YYPARSE_PARAM_DECL
|
||||
#else /* not __cplusplus */
|
||||
#define YYPARSE_PARAM_ARG YYPARSE_PARAM
|
||||
#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
|
||||
#endif /* not __cplusplus */
|
||||
#else /* not YYPARSE_PARAM */
|
||||
#define YYPARSE_PARAM_ARG
|
||||
#define YYPARSE_PARAM_DECL
|
||||
#endif /* not YYPARSE_PARAM */
|
||||
|
||||
int
|
||||
yyparse(YYPARSE_PARAM_ARG)
|
||||
YYPARSE_PARAM_DECL
|
||||
{
|
||||
register int yystate;
|
||||
register int yyn;
|
||||
register short *yyssp;
|
||||
register YYSTYPE *yyvsp;
|
||||
int yyerrstatus; /* number of tokens to shift before error messages enabled */
|
||||
int yychar1 = 0; /* lookahead token as an internal (translated) token number */
|
||||
|
||||
short yyssa[YYINITDEPTH]; /* the state stack */
|
||||
YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
|
||||
|
||||
short *yyss = yyssa; /* refer to the stacks thru separate pointers */
|
||||
YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
|
||||
|
||||
#ifdef YYLSP_NEEDED
|
||||
YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
|
||||
YYLTYPE *yyls = yylsa;
|
||||
YYLTYPE *yylsp;
|
||||
|
||||
#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
|
||||
#else
|
||||
#define YYPOPSTACK (yyvsp--, yyssp--)
|
||||
#endif
|
||||
|
||||
int yystacksize = YYINITDEPTH;
|
||||
|
||||
#ifdef YYPURE
|
||||
int yychar;
|
||||
YYSTYPE yylval;
|
||||
int yynerrs;
|
||||
#ifdef YYLSP_NEEDED
|
||||
YYLTYPE yylloc;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
YYSTYPE yyval; /* the variable used to return */
|
||||
/* semantic values from the action */
|
||||
/* routines */
|
||||
|
||||
int yylen;
|
||||
|
||||
#if YYDEBUG != 0
|
||||
if (yydebug)
|
||||
fprintf(stderr, "Starting parse\n");
|
||||
#endif
|
||||
|
||||
yystate = 0;
|
||||
yyerrstatus = 0;
|
||||
yynerrs = 0;
|
||||
yychar = YYEMPTY; /* Cause a token to be read. */
|
||||
|
||||
/* Initialize stack pointers.
|
||||
Waste one element of value and location stack
|
||||
so that they stay on the same level as the state stack.
|
||||
The wasted elements are never initialized. */
|
||||
|
||||
yyssp = yyss - 1;
|
||||
yyvsp = yyvs;
|
||||
#ifdef YYLSP_NEEDED
|
||||
yylsp = yyls;
|
||||
#endif
|
||||
|
||||
/* Push a new state, which is found in yystate . */
|
||||
/* In all cases, when you get here, the value and location stacks
|
||||
have just been pushed. so pushing a state here evens the stacks. */
|
||||
yynewstate:
|
||||
|
||||
*++yyssp = yystate;
|
||||
|
||||
if (yyssp >= yyss + yystacksize - 1)
|
||||
{
|
||||
/* Give user a chance to reallocate the stack */
|
||||
/* Use copies of these so that the &'s don't force the real ones into memory. */
|
||||
YYSTYPE *yyvs1 = yyvs;
|
||||
short *yyss1 = yyss;
|
||||
#ifdef YYLSP_NEEDED
|
||||
YYLTYPE *yyls1 = yyls;
|
||||
#endif
|
||||
|
||||
/* Get the current used size of the three stacks, in elements. */
|
||||
int size = yyssp - yyss + 1;
|
||||
|
||||
#ifdef yyoverflow
|
||||
/* Each stack pointer address is followed by the size of
|
||||
the data in use in that stack, in bytes. */
|
||||
#ifdef YYLSP_NEEDED
|
||||
/* This used to be a conditional around just the two extra args,
|
||||
but that might be undefined if yyoverflow is a macro. */
|
||||
yyoverflow("parser stack overflow",
|
||||
&yyss1, size * sizeof (*yyssp),
|
||||
&yyvs1, size * sizeof (*yyvsp),
|
||||
&yyls1, size * sizeof (*yylsp),
|
||||
&yystacksize);
|
||||
#else
|
||||
yyoverflow("parser stack overflow",
|
||||
&yyss1, size * sizeof (*yyssp),
|
||||
&yyvs1, size * sizeof (*yyvsp),
|
||||
&yystacksize);
|
||||
#endif
|
||||
|
||||
yyss = yyss1; yyvs = yyvs1;
|
||||
#ifdef YYLSP_NEEDED
|
||||
yyls = yyls1;
|
||||
#endif
|
||||
#else /* no yyoverflow */
|
||||
/* Extend the stack our own way. */
|
||||
if (yystacksize >= YYMAXDEPTH)
|
||||
{
|
||||
yyerror("parser stack overflow");
|
||||
return 2;
|
||||
}
|
||||
yystacksize *= 2;
|
||||
if (yystacksize > YYMAXDEPTH)
|
||||
yystacksize = YYMAXDEPTH;
|
||||
yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
|
||||
__yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
|
||||
yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
|
||||
__yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
|
||||
#ifdef YYLSP_NEEDED
|
||||
yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
|
||||
__yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
|
||||
#endif
|
||||
#endif /* no yyoverflow */
|
||||
|
||||
yyssp = yyss + size - 1;
|
||||
yyvsp = yyvs + size - 1;
|
||||
#ifdef YYLSP_NEEDED
|
||||
yylsp = yyls + size - 1;
|
||||
#endif
|
||||
|
||||
#if YYDEBUG != 0
|
||||
if (yydebug)
|
||||
fprintf(stderr, "Stack size increased to %d\n", yystacksize);
|
||||
#endif
|
||||
|
||||
if (yyssp >= yyss + yystacksize - 1)
|
||||
YYABORT;
|
||||
}
|
||||
|
||||
#if YYDEBUG != 0
|
||||
if (yydebug)
|
||||
fprintf(stderr, "Entering state %d\n", yystate);
|
||||
#endif
|
||||
|
||||
goto yybackup;
|
||||
yybackup:
|
||||
|
||||
/* Do appropriate processing given the current state. */
|
||||
/* Read a lookahead token if we need one and don't already have one. */
|
||||
/* yyresume: */
|
||||
|
||||
/* First try to decide what to do without reference to lookahead token. */
|
||||
|
||||
yyn = yypact[yystate];
|
||||
if (yyn == YYFLAG)
|
||||
goto yydefault;
|
||||
|
||||
/* Not known => get a lookahead token if don't already have one. */
|
||||
|
||||
/* yychar is either YYEMPTY or YYEOF
|
||||
or a valid token in external form. */
|
||||
|
||||
if (yychar == YYEMPTY)
|
||||
{
|
||||
#if YYDEBUG != 0
|
||||
if (yydebug)
|
||||
fprintf(stderr, "Reading a token: ");
|
||||
#endif
|
||||
yychar = YYLEX;
|
||||
}
|
||||
|
||||
/* Convert token to internal form (in yychar1) for indexing tables with */
|
||||
|
||||
if (yychar <= 0) /* This means end of input. */
|
||||
{
|
||||
yychar1 = 0;
|
||||
yychar = YYEOF; /* Don't call YYLEX any more */
|
||||
|
||||
#if YYDEBUG != 0
|
||||
if (yydebug)
|
||||
fprintf(stderr, "Now at end of input.\n");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
yychar1 = YYTRANSLATE(yychar);
|
||||
|
||||
#if YYDEBUG != 0
|
||||
if (yydebug)
|
||||
{
|
||||
fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
|
||||
/* Give the individual parser a way to print the precise meaning
|
||||
of a token, for further debugging info. */
|
||||
#ifdef YYPRINT
|
||||
YYPRINT (stderr, yychar, yylval);
|
||||
#endif
|
||||
fprintf (stderr, ")\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
yyn += yychar1;
|
||||
if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
|
||||
goto yydefault;
|
||||
|
||||
yyn = yytable[yyn];
|
||||
|
||||
/* yyn is what to do for this token type in this state.
|
||||
Negative => reduce, -yyn is rule number.
|
||||
Positive => shift, yyn is new state.
|
||||
New state is final state => don't bother to shift,
|
||||
just return success.
|
||||
0, or most negative number => error. */
|
||||
|
||||
if (yyn < 0)
|
||||
{
|
||||
if (yyn == YYFLAG)
|
||||
goto yyerrlab;
|
||||
yyn = -yyn;
|
||||
goto yyreduce;
|
||||
}
|
||||
else if (yyn == 0)
|
||||
goto yyerrlab;
|
||||
|
||||
if (yyn == YYFINAL)
|
||||
YYACCEPT;
|
||||
|
||||
/* Shift the lookahead token. */
|
||||
|
||||
#if YYDEBUG != 0
|
||||
if (yydebug)
|
||||
fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
|
||||
#endif
|
||||
|
||||
/* Discard the token being shifted unless it is eof. */
|
||||
if (yychar != YYEOF)
|
||||
yychar = YYEMPTY;
|
||||
|
||||
*++yyvsp = yylval;
|
||||
#ifdef YYLSP_NEEDED
|
||||
*++yylsp = yylloc;
|
||||
#endif
|
||||
|
||||
/* count tokens shifted since error; after three, turn off error status. */
|
||||
if (yyerrstatus) yyerrstatus--;
|
||||
|
||||
yystate = yyn;
|
||||
goto yynewstate;
|
||||
|
||||
/* Do the default action for the current state. */
|
||||
yydefault:
|
||||
|
||||
yyn = yydefact[yystate];
|
||||
if (yyn == 0)
|
||||
goto yyerrlab;
|
||||
|
||||
/* Do a reduction. yyn is the number of a rule to reduce with. */
|
||||
yyreduce:
|
||||
yylen = yyr2[yyn];
|
||||
if (yylen > 0)
|
||||
yyval = yyvsp[1-yylen]; /* implement default value of the action */
|
||||
|
||||
#if YYDEBUG != 0
|
||||
if (yydebug)
|
||||
{
|
||||
int i;
|
||||
|
||||
fprintf (stderr, "Reducing via rule %d (line %d), ",
|
||||
yyn, yyrline[yyn]);
|
||||
|
||||
/* Print the symbols being reduced, and their result. */
|
||||
for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
|
||||
fprintf (stderr, "%s ", yytname[yyrhs[i]]);
|
||||
fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
switch (yyn) {
|
||||
|
||||
case 3:
|
||||
#line 22 "pwyacc.y"
|
||||
{
|
||||
yyval = config_set_string_var(yyvsp[-2], (const char *)yyvsp[-1]);
|
||||
;
|
||||
break;}
|
||||
case 6:
|
||||
#line 29 "pwyacc.y"
|
||||
{ yyval = yyvsp[0]; ;
|
||||
break;}
|
||||
}
|
||||
/* the action file gets copied in in place of this dollarsign */
|
||||
#line 498 "/store/share/bison.simple"
|
||||
|
||||
yyvsp -= yylen;
|
||||
yyssp -= yylen;
|
||||
#ifdef YYLSP_NEEDED
|
||||
yylsp -= yylen;
|
||||
#endif
|
||||
|
||||
#if YYDEBUG != 0
|
||||
if (yydebug)
|
||||
{
|
||||
short *ssp1 = yyss - 1;
|
||||
fprintf (stderr, "state stack now");
|
||||
while (ssp1 != yyssp)
|
||||
fprintf (stderr, " %d", *++ssp1);
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
*++yyvsp = yyval;
|
||||
|
||||
#ifdef YYLSP_NEEDED
|
||||
yylsp++;
|
||||
if (yylen == 0)
|
||||
{
|
||||
yylsp->first_line = yylloc.first_line;
|
||||
yylsp->first_column = yylloc.first_column;
|
||||
yylsp->last_line = (yylsp-1)->last_line;
|
||||
yylsp->last_column = (yylsp-1)->last_column;
|
||||
yylsp->text = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
yylsp->last_line = (yylsp+yylen-1)->last_line;
|
||||
yylsp->last_column = (yylsp+yylen-1)->last_column;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Now "shift" the result of the reduction.
|
||||
Determine what state that goes to,
|
||||
based on the state we popped back to
|
||||
and the rule number reduced by. */
|
||||
|
||||
yyn = yyr1[yyn];
|
||||
|
||||
yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
|
||||
if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
|
||||
yystate = yytable[yystate];
|
||||
else
|
||||
yystate = yydefgoto[yyn - YYNTBASE];
|
||||
|
||||
goto yynewstate;
|
||||
|
||||
yyerrlab: /* here on detecting error */
|
||||
|
||||
if (! yyerrstatus)
|
||||
/* If not already recovering from an error, report this error. */
|
||||
{
|
||||
++yynerrs;
|
||||
|
||||
#ifdef YYERROR_VERBOSE
|
||||
yyn = yypact[yystate];
|
||||
|
||||
if (yyn > YYFLAG && yyn < YYLAST)
|
||||
{
|
||||
int size = 0;
|
||||
char *msg;
|
||||
int x, count;
|
||||
|
||||
count = 0;
|
||||
/* Start X at -yyn if nec to avoid negative indexes in yycheck. */
|
||||
for (x = (yyn < 0 ? -yyn : 0);
|
||||
x < (sizeof(yytname) / sizeof(char *)); x++)
|
||||
if (yycheck[x + yyn] == x)
|
||||
size += strlen(yytname[x]) + 15, count++;
|
||||
msg = (char *) malloc(size + 15);
|
||||
if (msg != 0)
|
||||
{
|
||||
strcpy(msg, "parse error");
|
||||
|
||||
if (count < 5)
|
||||
{
|
||||
count = 0;
|
||||
for (x = (yyn < 0 ? -yyn : 0);
|
||||
x < (sizeof(yytname) / sizeof(char *)); x++)
|
||||
if (yycheck[x + yyn] == x)
|
||||
{
|
||||
strcat(msg, count == 0 ? ", expecting `" : " or `");
|
||||
strcat(msg, yytname[x]);
|
||||
strcat(msg, "'");
|
||||
count++;
|
||||
}
|
||||
}
|
||||
yyerror(msg);
|
||||
free(msg);
|
||||
}
|
||||
else
|
||||
yyerror ("parse error; also virtual memory exceeded");
|
||||
}
|
||||
else
|
||||
#endif /* YYERROR_VERBOSE */
|
||||
yyerror("parse error");
|
||||
}
|
||||
|
||||
goto yyerrlab1;
|
||||
yyerrlab1: /* here on error raised explicitly by an action */
|
||||
|
||||
if (yyerrstatus == 3)
|
||||
{
|
||||
/* if just tried and failed to reuse lookahead token after an error, discard it. */
|
||||
|
||||
/* return failure if at end of input */
|
||||
if (yychar == YYEOF)
|
||||
YYABORT;
|
||||
|
||||
#if YYDEBUG != 0
|
||||
if (yydebug)
|
||||
fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
|
||||
#endif
|
||||
|
||||
yychar = YYEMPTY;
|
||||
}
|
||||
|
||||
/* Else will try to reuse lookahead token
|
||||
after shifting the error token. */
|
||||
|
||||
yyerrstatus = 3; /* Each real token shifted decrements this */
|
||||
|
||||
goto yyerrhandle;
|
||||
|
||||
yyerrdefault: /* current state does not do anything special for the error token. */
|
||||
|
||||
#if 0
|
||||
/* This is wrong; only states that explicitly want error tokens
|
||||
should shift them. */
|
||||
yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
|
||||
if (yyn) goto yydefault;
|
||||
#endif
|
||||
|
||||
yyerrpop: /* pop the current state because it cannot handle the error token */
|
||||
|
||||
if (yyssp == yyss) YYABORT;
|
||||
yyvsp--;
|
||||
yystate = *--yyssp;
|
||||
#ifdef YYLSP_NEEDED
|
||||
yylsp--;
|
||||
#endif
|
||||
|
||||
#if YYDEBUG != 0
|
||||
if (yydebug)
|
||||
{
|
||||
short *ssp1 = yyss - 1;
|
||||
fprintf (stderr, "Error: state stack now");
|
||||
while (ssp1 != yyssp)
|
||||
fprintf (stderr, " %d", *++ssp1);
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
yyerrhandle:
|
||||
|
||||
yyn = yypact[yystate];
|
||||
if (yyn == YYFLAG)
|
||||
goto yyerrdefault;
|
||||
|
||||
yyn += YYTERROR;
|
||||
if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
|
||||
goto yyerrdefault;
|
||||
|
||||
yyn = yytable[yyn];
|
||||
if (yyn < 0)
|
||||
{
|
||||
if (yyn == YYFLAG)
|
||||
goto yyerrpop;
|
||||
yyn = -yyn;
|
||||
goto yyreduce;
|
||||
}
|
||||
else if (yyn == 0)
|
||||
goto yyerrpop;
|
||||
|
||||
if (yyn == YYFINAL)
|
||||
YYACCEPT;
|
||||
|
||||
#if YYDEBUG != 0
|
||||
if (yydebug)
|
||||
fprintf(stderr, "Shifting error token, ");
|
||||
#endif
|
||||
|
||||
*++yyvsp = yylval;
|
||||
#ifdef YYLSP_NEEDED
|
||||
*++yylsp = yylloc;
|
||||
#endif
|
||||
|
||||
yystate = yyn;
|
||||
goto yynewstate;
|
||||
}
|
||||
#line 32 "pwyacc.y"
|
||||
|
||||
|
33
pwyacc.y
Normal file
33
pwyacc.y
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* @(#) $Id: pwyacc.y,v 1.1.1.1 2001-11-25 00:41:16 lkarsten Exp $
|
||||
*
|
||||
* yacc source for parsing the configuration file
|
||||
*
|
||||
*/
|
||||
|
||||
%{
|
||||
int yyerror(const char *msg);
|
||||
int yylex(void);
|
||||
int config_set_string_var(int var, const char *value);
|
||||
%}
|
||||
|
||||
%token SET HOST USER PASSWORD STRING
|
||||
|
||||
%%
|
||||
|
||||
input: ;
|
||||
input: statement input ;
|
||||
|
||||
statement: SET variable STRING ';'
|
||||
{
|
||||
$$ = config_set_string_var($2, (const char *)$3);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
variable: USER | PASSWORD | HOST
|
||||
{ $$ = $1; }
|
||||
;
|
||||
|
||||
%%
|
||||
|
1
stamp-h.in
Normal file
1
stamp-h.in
Normal file
@ -0,0 +1 @@
|
||||
timestamp
|
Loading…
Reference in New Issue
Block a user