mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-02-19 10:01:05 +00:00
Remove uneeded dependencies
This commit is contained in:
parent
5d4cceec63
commit
90a9fc3a66
38 changed files with 0 additions and 21530 deletions
Binary file not shown.
|
@ -1,6 +0,0 @@
|
|||
Bjoern Giesler <giesler@ira.uka.de>
|
||||
|
||||
GNU automake / autoconf support by Alfredo Kojima <kojima@inf.ufrgs.br>
|
||||
|
||||
flex/bison parser written for the GNUstep base library; unfortunately I
|
||||
don't know by whom
|
|
@ -1,481 +0,0 @@
|
|||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the library GPL. It is
|
||||
numbered 2 because it goes with version 2 of the ordinary GPL.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Library General Public License, applies to some
|
||||
specially designated Free Software Foundation software, and to any
|
||||
other libraries whose authors decide to use it. You can use it for
|
||||
your libraries, 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 library, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link a program with the library, you must provide
|
||||
complete object files to the recipients so that they can relink them
|
||||
with the library, after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
Our method of protecting your rights has two steps: (1) copyright
|
||||
the library, and (2) offer you this license which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
Also, for each distributor's protection, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
library. If the library is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original
|
||||
version, 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 companies distributing free
|
||||
software will individually obtain patent licenses, thus in effect
|
||||
transforming the program into proprietary software. To prevent this,
|
||||
we have made it clear that any patent must be licensed for everyone's
|
||||
free use or not licensed at all.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary
|
||||
GNU General Public License, which was designed for utility programs. This
|
||||
license, the GNU Library General Public License, applies to certain
|
||||
designated libraries. This license is quite different from the ordinary
|
||||
one; be sure to read it in full, and don't assume that anything in it is
|
||||
the same as in the ordinary license.
|
||||
|
||||
The reason we have a separate public license for some libraries is that
|
||||
they blur the distinction we usually make between modifying or adding to a
|
||||
program and simply using it. Linking a program with a library, without
|
||||
changing the library, is in some sense simply using the library, and is
|
||||
analogous to running a utility program or application program. However, in
|
||||
a textual and legal sense, the linked executable is a combined work, a
|
||||
derivative of the original library, and the ordinary General Public License
|
||||
treats it as such.
|
||||
|
||||
Because of this blurred distinction, using the ordinary General
|
||||
Public License for libraries did not effectively promote software
|
||||
sharing, because most developers did not use the libraries. We
|
||||
concluded that weaker conditions might promote sharing better.
|
||||
|
||||
However, unrestricted linking of non-free programs would deprive the
|
||||
users of those programs of all benefit from the free status of the
|
||||
libraries themselves. This Library General Public License is intended to
|
||||
permit developers of non-free programs to use free libraries, while
|
||||
preserving your freedom as a user of such programs to change the free
|
||||
libraries that are incorporated in them. (We have not seen how to achieve
|
||||
this as regards changes in header files, but we have achieved it as regards
|
||||
changes in the actual functions of the Library.) The hope is that this
|
||||
will lead to faster development of free libraries.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, while the latter only
|
||||
works together with the library.
|
||||
|
||||
Note that it is possible for a library to be covered by the ordinary
|
||||
General Public License rather than by this special one.
|
||||
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library which
|
||||
contains a notice placed by the copyright holder or other authorized
|
||||
party saying it may be distributed under the terms of this Library
|
||||
General Public License (also called "this License"). Each licensee is
|
||||
addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, 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 library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete 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 distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
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 Library or any portion
|
||||
of it, thus forming a work based on the Library, 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) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
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 Library, 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 Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you 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.
|
||||
|
||||
If distribution of 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 satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also compile or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
c) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
d) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. 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.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library 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.
|
||||
|
||||
9. 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 Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
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.
|
||||
|
||||
11. 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 Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library 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 Library.
|
||||
|
||||
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.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library 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.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Library 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 Library
|
||||
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 Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
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
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "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
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. 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 LIBRARY 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
|
||||
LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. 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 library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
|
@ -1,481 +0,0 @@
|
|||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the library GPL. It is
|
||||
numbered 2 because it goes with version 2 of the ordinary GPL.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Library General Public License, applies to some
|
||||
specially designated Free Software Foundation software, and to any
|
||||
other libraries whose authors decide to use it. You can use it for
|
||||
your libraries, 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 library, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link a program with the library, you must provide
|
||||
complete object files to the recipients so that they can relink them
|
||||
with the library, after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
Our method of protecting your rights has two steps: (1) copyright
|
||||
the library, and (2) offer you this license which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
Also, for each distributor's protection, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
library. If the library is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original
|
||||
version, 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 companies distributing free
|
||||
software will individually obtain patent licenses, thus in effect
|
||||
transforming the program into proprietary software. To prevent this,
|
||||
we have made it clear that any patent must be licensed for everyone's
|
||||
free use or not licensed at all.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary
|
||||
GNU General Public License, which was designed for utility programs. This
|
||||
license, the GNU Library General Public License, applies to certain
|
||||
designated libraries. This license is quite different from the ordinary
|
||||
one; be sure to read it in full, and don't assume that anything in it is
|
||||
the same as in the ordinary license.
|
||||
|
||||
The reason we have a separate public license for some libraries is that
|
||||
they blur the distinction we usually make between modifying or adding to a
|
||||
program and simply using it. Linking a program with a library, without
|
||||
changing the library, is in some sense simply using the library, and is
|
||||
analogous to running a utility program or application program. However, in
|
||||
a textual and legal sense, the linked executable is a combined work, a
|
||||
derivative of the original library, and the ordinary General Public License
|
||||
treats it as such.
|
||||
|
||||
Because of this blurred distinction, using the ordinary General
|
||||
Public License for libraries did not effectively promote software
|
||||
sharing, because most developers did not use the libraries. We
|
||||
concluded that weaker conditions might promote sharing better.
|
||||
|
||||
However, unrestricted linking of non-free programs would deprive the
|
||||
users of those programs of all benefit from the free status of the
|
||||
libraries themselves. This Library General Public License is intended to
|
||||
permit developers of non-free programs to use free libraries, while
|
||||
preserving your freedom as a user of such programs to change the free
|
||||
libraries that are incorporated in them. (We have not seen how to achieve
|
||||
this as regards changes in header files, but we have achieved it as regards
|
||||
changes in the actual functions of the Library.) The hope is that this
|
||||
will lead to faster development of free libraries.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, while the latter only
|
||||
works together with the library.
|
||||
|
||||
Note that it is possible for a library to be covered by the ordinary
|
||||
General Public License rather than by this special one.
|
||||
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library which
|
||||
contains a notice placed by the copyright holder or other authorized
|
||||
party saying it may be distributed under the terms of this Library
|
||||
General Public License (also called "this License"). Each licensee is
|
||||
addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, 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 library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete 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 distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
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 Library or any portion
|
||||
of it, thus forming a work based on the Library, 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) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
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 Library, 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 Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you 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.
|
||||
|
||||
If distribution of 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 satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also compile or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
c) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
d) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. 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.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library 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.
|
||||
|
||||
9. 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 Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
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.
|
||||
|
||||
11. 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 Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library 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 Library.
|
||||
|
||||
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.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library 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.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Library 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 Library
|
||||
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 Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
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
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "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
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. 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 LIBRARY 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
|
||||
LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. 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 library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
|
@ -1,231 +0,0 @@
|
|||
13 Jan 2000 - Dan
|
||||
- Fixed a memory leak related to insertion/removal of objects
|
||||
in dictionaries/arrays.
|
||||
- Fixed a crashing issue related to file synchronization.
|
||||
- Updated the code to not call memcpy if the source pointer is NULL
|
||||
10 Oct 1999 - Dan
|
||||
- Fixed incorrect behaviour of the synchronize functions when there
|
||||
was no file to synchronize with
|
||||
- Fixed mem leak in synchronize code (for dictionaries).
|
||||
|
||||
05 Oct 1999 - Dan
|
||||
- Fixed compilation problems for FreeBSD and Solaris
|
||||
- gsdd and defaults no longer build (they are useless at this point)
|
||||
- fixed proplist parsing problem in filehandling.c
|
||||
|
||||
04/Oct/1999 - Dan
|
||||
- Fixed some flaws in the logic of PLSynchronize()
|
||||
- Renamed PLSynchronize() to PLDeepSynchronize(). kept PLSynchronize()
|
||||
as an alias for backward compatibility.
|
||||
- Added PLShallowSynchronize() for non-recursize synchronization.
|
||||
|
||||
Sat Sep 4 23:11:07 1999 Timur Bakeyev <mc@bat.ru>
|
||||
|
||||
* (defaults|gsdd)/.cvsignore: We really don't want Makefile.in.
|
||||
|
||||
Sun Aug 29 00:46:08 1999 Timur Bakeyev <mc@bat.ru>
|
||||
|
||||
* filehandling.c: Random checks against if passed proplist_t is NULL.
|
||||
For example, attempt to PLSetUnchaneged() on a null pointer crashed
|
||||
WM badly. Probably, I add to much checks, but it's better than nothing.
|
||||
|
||||
* filehandling.c (PLSave): Changed set of fwrite()'s to one fprintf().
|
||||
It seems, this is a bit more portable.
|
||||
|
||||
Fri Aug 27 03:19:40 1999 Timur Bakeyev <mc@bat.ru>
|
||||
|
||||
* (.|gsdd|defaults)/Makefile.am - fixed problems, when srcdir!=builddir,
|
||||
seems, again (see R. Nelson 19990101). Remove several targets, that
|
||||
provided by default. Add top directory to targets - so, no need to
|
||||
call make -f ../Makefile.
|
||||
|
||||
* Accidently update libtool to 1.3.3 version.
|
||||
|
||||
* Added proplist.c, proplist_y.c, */Makefile.in to the ignore list.
|
||||
|
||||
08/Aug/1999 - Dan
|
||||
|
||||
* Fixed some problems in the configure script, when looking for
|
||||
gethostbyname() and socket().
|
||||
|
||||
|
||||
07/Aug/1999 - Dan
|
||||
|
||||
* Fixed memory leak in PLSynchronize()
|
||||
|
||||
* Fixed a bug that caused proplists get with PLGetProplistWithPath()
|
||||
and PLGetProplistWithDescription() to be marked as 'changed' immediately
|
||||
after read even if not changed, and thus making PLSynchronize() do the
|
||||
wrong thing.
|
||||
|
||||
* Fixed a bug in PLSynchronize() that cause a data of type Dictionary
|
||||
to be incorrectly synchronized. (There are still incorrect assumptions
|
||||
about arrays that need to be fixed - see BUGS and comments in
|
||||
filehandling.c)
|
||||
|
||||
|
||||
1999-01-01 Raffaele Sena <raff@aromatic.com> via Russell Nelson <nelson@crynwr.com>
|
||||
|
||||
* Fix for build directory different from package top directory.
|
||||
|
||||
1998-12-11 Jeff Garzik <jgarzik@pobox.com>
|
||||
|
||||
* proplist_y.c, proplist_y.y:
|
||||
Reverted cast until full solution available.
|
||||
|
||||
1998-12-10 Jeff Garzik <jgarzik@pobox.com>
|
||||
|
||||
* proplist.c proplist.l: removed duplicate #include
|
||||
* proplist_y.c, proplist_y.y: ptr-to-int cast for 64-bitness
|
||||
* util.h: include string.h to avoid strlen warning
|
||||
|
||||
20/08/1998 - Alfredo
|
||||
|
||||
o Added patch related to file locking.
|
||||
|
||||
|
||||
13/08/1998 - Alfredo
|
||||
|
||||
o Fixed bug in PLGetStringDescription(). The special case of empty strings
|
||||
was not being handled, causing libPL to not be able to read proplists
|
||||
that it wrote itself,like:
|
||||
(elem1, elem2, , elem4)
|
||||
where the 3rd element is an empty string ("").
|
||||
|
||||
o Fixed bug in PLDeepCopy(). The copied element that was appended to the array
|
||||
was being released.
|
||||
|
||||
22/07/1998 - Alfredo
|
||||
|
||||
o Fixed crashing bug with bad proplist files
|
||||
|
||||
|
||||
Sun Jul 19 11:40:57 EST 1998 Alfredo
|
||||
|
||||
o Integradted patch that fixed unescape character code in strings.
|
||||
|
||||
|
||||
|
||||
25/01/99 - Alfredo K. Kojima <kojima@windowmaker.org>
|
||||
|
||||
* merged GNOME changes with Window Maker libPropList
|
||||
|
||||
|
||||
2/10/1998 - Alfredo
|
||||
|
||||
* fixed bug in unescstr()
|
||||
|
||||
1998-08-24 Miguel de Icaza <miguel@nuclecu.unam.mx>
|
||||
|
||||
* filehandling.c (PLGetProplistWithPath): Do not abort if file
|
||||
system does not support locks.
|
||||
|
||||
1998-08-23 Nat Friedman <ndf@retrans.mit.edu>
|
||||
|
||||
* getting.c (PLGetStringDescription): Quote zero-length strings or
|
||||
they will cause parse errors when loaded
|
||||
|
||||
20/08/1998 - Alfredo
|
||||
|
||||
o Added patch related to file locking.
|
||||
|
||||
|
||||
13/08/1998 - Alfredo
|
||||
|
||||
o Fixed bug in PLDeepCopy(). The copied element that was appended to the array
|
||||
was being released.
|
||||
|
||||
22/07/1998 - Alfredo
|
||||
|
||||
o Fixed crashing bug with bad proplist files
|
||||
|
||||
|
||||
Sun Jul 19 11:40:57 EST 1998 Alfredo
|
||||
|
||||
o Integradted patch that fixed unescape character code in strings.
|
||||
Patch submited by Shigeru Miyata <miyata@kusm.kyoto-u.ac.jp>
|
||||
|
||||
|
||||
Tue Nov 25 14:48:58 MET 1997 Bjoern Giesler <giesler@ira.uka.de>
|
||||
|
||||
o Integrated patches submitted by:
|
||||
|
||||
Brian Martin <brian@goober.wireless.ucsc.edu>
|
||||
+ output of config file errors w/file name and line number
|
||||
information
|
||||
Jehan Bing <jbing@enssat.fr>
|
||||
+ bug fix for machines where sizeof(void *) != sizeof(int)
|
||||
|
||||
o New release 0.7.2
|
||||
|
||||
??? ??? ?? ??:??:?? EST 1997 Alfredo Kojima <kojima@inf.ufrgs.br>
|
||||
|
||||
o bogus documentation on PLSetFilename()/PLGetFilename()
|
||||
|
||||
o Sys5 portability: flock changed to fcntl
|
||||
|
||||
o removed -p pl and -Ppl options for bison and flex for compatibility
|
||||
|
||||
|
||||
Fri Sep 26 20:42:38 EST 1997 Alfredo Kojima <kojima@inf.ufrgs.br>
|
||||
|
||||
o defined YYERROR_VERBOSE
|
||||
|
||||
Sat Aug 16 23:47:34 EST 1997 Alfredo Kojima <kojima@inf.ufrgs.br>
|
||||
|
||||
o string size passed to scanner was causing segfault in filehandling.c
|
||||
|
||||
o value returned from PLGetDictionaryEntry() was being released in
|
||||
gsdd/Commands.c
|
||||
|
||||
o gsdd/Main.c:CheckChange_multiple() was not checking if return value
|
||||
of PL functions is NULL, which caused segfaults
|
||||
|
||||
|
||||
Fri Aug 8 14:16:01 EDT 1997
|
||||
|
||||
o Changed memory-management routines to OPENSTEP-style retain/release
|
||||
mechanism.
|
||||
|
||||
o gsdd reads libFoundation-style multiple-file defaults now.
|
||||
|
||||
o Fixed all the memory leaks (I hope).
|
||||
|
||||
o Added test/memtest.c, defines for memory debugging in plconf.h and
|
||||
tools/findleak.tcl to evaluate debugging output.
|
||||
|
||||
o Alfredo Kojima added automake/autoconf support
|
||||
|
||||
o New release 0.7.1
|
||||
|
||||
Fri Jul 25 18:24:00 EDT 1997
|
||||
|
||||
o Tuned the proplist.y file to be more forgiving on syntax errors. Due
|
||||
to the way synchronizing works, a line containing a syntax error is
|
||||
unfortunately "synchronized away", i.e. vanishes. Fix that.
|
||||
|
||||
Fri Jul 11 15:50:21 EDT 1997
|
||||
|
||||
o Added authentication.
|
||||
|
||||
o Added "shared" target.
|
||||
|
||||
Fri Jul 11 10:12:37 EDT 1997
|
||||
|
||||
o New release 0.5
|
||||
|
||||
o Added source code for the gsdd daemon
|
||||
|
||||
o Fixed a few bugs
|
||||
|
||||
o Added INSTALL file
|
||||
|
||||
Mon Jul 7 15:59:11 EDT 1997
|
||||
|
||||
o Fixed a bug in handling of variable argument lists
|
||||
|
||||
o Added source code for the defaults program
|
||||
|
||||
o Fixed a few bugs
|
||||
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
|
||||
o Edit plconf.h to suit your needs.
|
||||
|
||||
o Type "configure", "make" and "make install".
|
||||
|
||||
o If there was an error, mail giesler@ira.uka.de
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
|
||||
AUTOMAKE_OPTIONS = no-dependencies
|
||||
|
||||
lib_LTLIBRARIES = libPropList.la
|
||||
|
||||
#SUBDIRS= . gsdd defaults
|
||||
|
||||
include_HEADERS = proplist.h
|
||||
|
||||
EXTRA_DIST = proplist_y.h types.c
|
||||
|
||||
DISTCLEANFILES = proplist.c proplist_y.c
|
||||
|
||||
INCLUDES = -DDAEMON_PATH=\"${bindir}/gsdd\"
|
||||
|
||||
libPropList_la_SOURCES = \
|
||||
comparing.c \
|
||||
plconf.h \
|
||||
daemon.c \
|
||||
filehandling.c \
|
||||
getting.c \
|
||||
modifying.c \
|
||||
proplist.h \
|
||||
proplistP.h \
|
||||
memhandling.c \
|
||||
util.c \
|
||||
proplist_y.y \
|
||||
proplist.l \
|
||||
util.h
|
||||
|
||||
|
||||
libPropList_la_LDFLAGS = -version-info 2:2:2
|
||||
|
||||
YACC = @YACC@ -d
|
||||
|
||||
BUILT_SOURCES = proplist_y.c proplist_y.h proplist.c
|
||||
|
|
@ -1,403 +0,0 @@
|
|||
# Makefile.in generated automatically by automake 1.4 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = .
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AS = @AS@
|
||||
CC = @CC@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
LEX = @LEX@
|
||||
LIBCRYPT = @LIBCRYPT@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
VERSION = @VERSION@
|
||||
XTRALIBS = @XTRALIBS@
|
||||
|
||||
AUTOMAKE_OPTIONS = no-dependencies
|
||||
|
||||
lib_LTLIBRARIES = libPropList.la
|
||||
|
||||
#SUBDIRS= . gsdd defaults
|
||||
|
||||
include_HEADERS = proplist.h
|
||||
|
||||
EXTRA_DIST = proplist_y.h types.c
|
||||
|
||||
DISTCLEANFILES = proplist.c proplist_y.c
|
||||
|
||||
INCLUDES = -DDAEMON_PATH=\"${bindir}/gsdd\"
|
||||
|
||||
libPropList_la_SOURCES = comparing.c plconf.h daemon.c filehandling.c getting.c modifying.c proplist.h proplistP.h memhandling.c util.c proplist_y.y proplist.l util.h
|
||||
|
||||
|
||||
libPropList_la_LDFLAGS = -version-info 2:2:2
|
||||
|
||||
YACC = @YACC@ -d
|
||||
|
||||
BUILT_SOURCES = proplist_y.c proplist_y.h proplist.c
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_CLEAN_FILES =
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
|
||||
|
||||
DEFS = @DEFS@ -I. -I$(srcdir)
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
libPropList_la_LIBADD =
|
||||
libPropList_la_OBJECTS = comparing.lo daemon.lo filehandling.lo \
|
||||
getting.lo modifying.lo memhandling.lo util.lo proplist_y.lo \
|
||||
proplist.lo
|
||||
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
|
||||
LEXLIB = @LEXLIB@
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
HEADERS = $(include_HEADERS)
|
||||
|
||||
DIST_COMMON = README AUTHORS COPYING COPYING.LIB ChangeLog INSTALL \
|
||||
Makefile.am Makefile.in NEWS TODO aclocal.m4 config.guess config.sub \
|
||||
configure configure.in install-sh ltconfig ltmain.sh missing \
|
||||
mkinstalldirs proplist.c proplist_y.c
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP_ENV = --best
|
||||
SOURCES = $(libPropList_la_SOURCES)
|
||||
OBJECTS = $(libPropList_la_OBJECTS)
|
||||
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .S .c .l .lo .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 $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
|
||||
cd $(srcdir) && $(AUTOCONF)
|
||||
|
||||
mostlyclean-libLTLIBRARIES:
|
||||
|
||||
clean-libLTLIBRARIES:
|
||||
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
||||
|
||||
distclean-libLTLIBRARIES:
|
||||
|
||||
maintainer-clean-libLTLIBRARIES:
|
||||
|
||||
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \
|
||||
$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
uninstall-libLTLIBRARIES:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
|
||||
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:
|
||||
|
||||
.c.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
.s.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
.S.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
|
||||
maintainer-clean-libtool:
|
||||
|
||||
libPropList.la: $(libPropList_la_OBJECTS) $(libPropList_la_DEPENDENCIES)
|
||||
$(LINK) -rpath $(libdir) $(libPropList_la_LDFLAGS) $(libPropList_la_OBJECTS) $(libPropList_la_LIBADD) $(LIBS)
|
||||
.l.c:
|
||||
$(LEX) $(AM_LFLAGS) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@
|
||||
.y.c:
|
||||
$(YACC) $(AM_YFLAGS) $(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
|
||||
proplist_y.h: proplist_y.c
|
||||
|
||||
|
||||
install-includeHEADERS: $(include_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(includedir)
|
||||
@list='$(include_HEADERS)'; for p in $$list; do \
|
||||
if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
|
||||
echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \
|
||||
$(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \
|
||||
done
|
||||
|
||||
uninstall-includeHEADERS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(include_HEADERS)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(includedir)/$$p; \
|
||||
done
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $$unique $(LISP)
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(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)$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
-rm -rf $(distdir)
|
||||
GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
|
||||
mkdir $(distdir)/=build
|
||||
mkdir $(distdir)/=inst
|
||||
dc_install_base=`cd $(distdir)/=inst && pwd`; \
|
||||
cd $(distdir)/=build \
|
||||
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist
|
||||
-rm -rf $(distdir)
|
||||
@banner="$(distdir).tar.gz is ready for distribution"; \
|
||||
dashes=`echo "$$banner" | sed s/./=/g`; \
|
||||
echo "$$dashes"; \
|
||||
echo "$$banner"; \
|
||||
echo "$$dashes"
|
||||
dist: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
|
||||
-rm -rf $(distdir)
|
||||
dist-all: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
|
||||
-rm -rf $(distdir)
|
||||
distdir: $(DISTFILES)
|
||||
-rm -rf $(distdir)
|
||||
mkdir $(distdir)
|
||||
-chmod 777 $(distdir)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
info-am:
|
||||
info: info-am
|
||||
dvi-am:
|
||||
dvi: dvi-am
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-am
|
||||
install-exec-am: install-libLTLIBRARIES
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am: install-includeHEADERS
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am: uninstall-libLTLIBRARIES uninstall-includeHEADERS
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "proplistlproplist_yhproplist_yc$(BUILT_SOURCES)" || rm -f proplistl proplist_yh proplist_yc $(BUILT_SOURCES)
|
||||
mostlyclean-am: mostlyclean-libLTLIBRARIES mostlyclean-compile \
|
||||
mostlyclean-libtool mostlyclean-tags \
|
||||
mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
clean-am: clean-libLTLIBRARIES clean-compile clean-libtool clean-tags \
|
||||
clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-am
|
||||
|
||||
distclean-am: distclean-libLTLIBRARIES distclean-compile \
|
||||
distclean-libtool distclean-tags distclean-generic \
|
||||
clean-am
|
||||
-rm -f libtool
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f config.status
|
||||
|
||||
maintainer-clean-am: maintainer-clean-libLTLIBRARIES \
|
||||
maintainer-clean-compile maintainer-clean-libtool \
|
||||
maintainer-clean-tags maintainer-clean-generic \
|
||||
distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f config.status
|
||||
|
||||
.PHONY: mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \
|
||||
clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \
|
||||
uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \
|
||||
distclean-compile clean-compile maintainer-clean-compile \
|
||||
mostlyclean-libtool distclean-libtool clean-libtool \
|
||||
maintainer-clean-libtool uninstall-includeHEADERS \
|
||||
install-includeHEADERS tags mostlyclean-tags distclean-tags clean-tags \
|
||||
maintainer-clean-tags distdir info-am info dvi-am dvi check check-am \
|
||||
installcheck-am installcheck install-exec-am install-exec \
|
||||
install-data-am install-data install-am install uninstall-am uninstall \
|
||||
all-redirect all-am all installdirs 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:
|
|
@ -1,16 +0,0 @@
|
|||
New features in 0.7.1:
|
||||
|
||||
o Fixed all the memory leaks (I hope). This should make gsdd usable
|
||||
with WindowMaker, etc.
|
||||
|
||||
New features in version 0.7:
|
||||
|
||||
o Changed memory management to OPENSTEP-style Retain / Release mechanism
|
||||
|
||||
o Implemented libFoundation's multiple-file approach (~/GNUstep/Defaults as
|
||||
directory containing domains as single files)
|
||||
|
||||
o GNU automake / autoconf support added, thanks to Alfredo Kojima
|
||||
|
||||
o Fixed a number of memory leaks and bugs
|
||||
|
|
@ -1,373 +0,0 @@
|
|||
|
||||
README for the libPropList library
|
||||
|
||||
(c) Bjoern Giesler, July 1997
|
||||
|
||||
|
||||
Abstract
|
||||
========
|
||||
========
|
||||
|
||||
This file documents the libPropList library, hereafter referred to as
|
||||
PL. The library uses an opaque data type to represent a tree structure
|
||||
made of strings, data blocks, arrays and dictionaries (key-value pair
|
||||
lists). This structure can be manipulated, written out to and read in
|
||||
from a file, and synchronized with the contents of a file.
|
||||
The purpose of PL is to closely mimick the behaviour of the property
|
||||
lists used in GNUstep/OPENSTEP (there formed with the NSString,
|
||||
NSData, NSArray and NSDictionary classes) and to be compatible with
|
||||
it. PL enables programs that use configuration or preference files to
|
||||
make these compatible with GNUstep/OPENSTEP's user defaults handling
|
||||
mechanism, without needing to use Objective-C or GNUstep/OPENSTEP
|
||||
themselves.
|
||||
|
||||
The source code of PL contains several parts of the GNUstep base
|
||||
library's source code (especially the parts that read and write string
|
||||
descriptions and files). The GNUstep base library is covered by the
|
||||
GNU Library Public License. The source code for the GNUstep base library
|
||||
can be found at ftp://prep.ai.mit.edu/pub/gnu/gnustep. PL itself is
|
||||
covered by the GNU Library Public License, as well. For more
|
||||
information, read the file COPYING.LIB.
|
||||
|
||||
|
||||
|
||||
|
||||
The proplist_t data type
|
||||
========================
|
||||
========================
|
||||
|
||||
The proplist_t data type is deliberately opaque (it is typedef'ed as a
|
||||
pointer to void). It should not be accessed other than with the
|
||||
library's commands.
|
||||
|
||||
|
||||
The retain / release mechanism
|
||||
==============================
|
||||
==============================
|
||||
|
||||
The idea for this has been shamelessly nicked from OPENSTEP. Every
|
||||
object maintains a retain count, which is set to 1 when the object is
|
||||
created, increased every time it is retained (e.g. inserted in an
|
||||
object or array) and decreased every time it is released. The purpose
|
||||
of this is easier and more efficient memory handling. A few short
|
||||
examples:
|
||||
|
||||
proplist_t key, value, dict;
|
||||
key = PLMakeString("foo"); value = PLMakeString("bar");
|
||||
|
||||
/* insert into array. key and value are retained */
|
||||
dict = PLMakeDictionaryFromEntries(key, value, NULL);
|
||||
/* release key and value (not needed here anymore) */
|
||||
PLRelease(key); PLRelease(value);
|
||||
|
||||
Releasing key and value after they have been inserted into dict makes
|
||||
sure that when dict is released, key and value are destroyed.
|
||||
If you want an object to stick around even after what brought it to
|
||||
you has been destroyed, you can use something like
|
||||
|
||||
void SomeFunction(proplist_t array)
|
||||
{
|
||||
static proplist_t permanent =
|
||||
PLRetain(PLGetArrayElement(array, 0));
|
||||
...
|
||||
}
|
||||
|
||||
This makes sure that even after array has been released, the object
|
||||
that permanent points to is retained. Once you don't need permanent
|
||||
any more, you can release it, and it's physically destroyed (unless
|
||||
it's retained somewhere else).
|
||||
|
||||
|
||||
The library functions
|
||||
=====================
|
||||
=====================
|
||||
|
||||
|
||||
|
||||
File handling
|
||||
=============
|
||||
|
||||
The routines described in this section are used to access disk files,
|
||||
i.e. getting property lists stored in files, saving and synchronizing
|
||||
them. The tilde notation (~/foo => $HOME/foo) is supported for file
|
||||
names.
|
||||
|
||||
proplist_t PLGetProplistWithPath(const char *filename)
|
||||
------------------------------------------------
|
||||
Returns a property list read in from the specified file, or NULL if
|
||||
there was an error. All the elements of the returned property list
|
||||
have their filename reference set to the specified file.
|
||||
|
||||
If filename is NULL or the empty string, the name of the file is set to
|
||||
$GNUSTEP_USER_PATH/$GNUSTEP_DEFAULTS_FILE, with GNUSTEP_USER_PATH
|
||||
defaulting to "~/GNUstep" and GNUSTEP_DEFAULTS_FILE defaulting to
|
||||
"Defaults", if the environment variables aren't set.
|
||||
|
||||
If filename contains a tilde as its first character, the tilde is
|
||||
replaced with the user's home directory.
|
||||
|
||||
BOOL PLSynchronize(proplist_t pl)
|
||||
---------------------------------
|
||||
Synchronizes the property list with the file associated with
|
||||
it. Returns YES if successful, NO if not.
|
||||
|
||||
BOOL PLSave(proplist_t pl, BOOL atomically)
|
||||
-------------------------------------------
|
||||
Saves the property list in the file associated with it. If atomically
|
||||
is YES, the function uses a temporary file to save the property list
|
||||
into, then uses the rename() system call to move that file to the
|
||||
final file. Returns YES if successful, NO if not.
|
||||
|
||||
proplist_t PLSetFilename(proplist_t pl, proplist_t filename)
|
||||
-------------------------------------------------------
|
||||
Sets the filename property of every element in the property list to
|
||||
the string specified in filename. Returns the changed property list.
|
||||
|
||||
proplist_t PLGetFilename(proplist_t pl)
|
||||
---------------------------------------
|
||||
Returns the property list's filename property.
|
||||
|
||||
|
||||
|
||||
Talking to gsdd
|
||||
===============
|
||||
|
||||
The routines described in this section are used to talk to the GNUstep
|
||||
Defaults Daemon, gsdd. If that daemon is not already running, the
|
||||
library will try to start it.
|
||||
|
||||
proplist_t PLGetDomainNames()
|
||||
-----------------------------
|
||||
Returns an array containing all registered domain names.
|
||||
|
||||
proplist_t PLGetDomain(proplist_t name)
|
||||
---------------------------------------
|
||||
Returns a property list representing the domain specified by name.
|
||||
|
||||
proplist_t PLSetDomain(proplist_t name, proplist_t value, BOOL kickme)
|
||||
----------------------------------------------------------------------
|
||||
Sets the specified value for the specified domain. If kickme is NO, a
|
||||
callback the application registered for this domain will not be
|
||||
called.
|
||||
|
||||
proplist_t PLDeleteDomain(proplist_t name, BOOL kickme)
|
||||
-------------------------------------------------------
|
||||
Deletes the specified domain. See above for the value of kickme.
|
||||
|
||||
proplist_t PLRegister(proplist_t name, plcallback_t callback)
|
||||
-------------------------------------------------------------
|
||||
Registers callback to be called whenever the domain associated with
|
||||
name is changed.
|
||||
|
||||
NOTE: The library only knows about a single callback. The reason for
|
||||
this is that the daemon cannot tell a certain process which domain has
|
||||
changed; it only registers that a process wants to be told if a
|
||||
certain domain has changed (by sending it a signal). Therefore, you
|
||||
have to specify the same callback on each call to PLRegister.
|
||||
|
||||
proplist_t PLUnregister(proplist_t name)
|
||||
----------------------------------------
|
||||
Unregister name; i.e. the callback will no longer be called if the
|
||||
domain associated with name is changed.
|
||||
|
||||
|
||||
|
||||
Property list handling functions
|
||||
================================
|
||||
|
||||
The routines in this section allow manipulation of property lists, and
|
||||
converting between ASCII representations of property lists and the
|
||||
lists themselves.
|
||||
|
||||
proplist_t PLGetProplistWithDescription(const char *description)
|
||||
----------------------------------------------------------------
|
||||
Returns a property list by parsing description, or NULL if there was
|
||||
an error. description has to be in GNUstep/OPENSTEP property list
|
||||
format.
|
||||
|
||||
BOOL PLIsString(proplist_t pl)
|
||||
BOOL PLIsData(proplist_t pl)
|
||||
BOOL PLIsArray(proplist_t pl)
|
||||
BOOL PLIsDictionary(proplist_t pl)
|
||||
BOOL PLIsSimple(proplist_t pl)
|
||||
BOOL PLIsCompound(proplist_t pl)
|
||||
--------------------------------
|
||||
All these functions return YES if pl is of the respective type, NO if
|
||||
it isn't. PLIsSimple returns YES if pl is a string or data object,
|
||||
PLIsCompound returns YES if pl is an array or dictionary object.
|
||||
|
||||
|
||||
unsigned char *PLGetStringDescription(proplist_t pl)
|
||||
----------------------------------------------------
|
||||
Returns a description of pl (which must be a string) in
|
||||
GNUstep/OPENSTEP format. The difference between this function's output
|
||||
and that returned by PLGetString is that this function's output is
|
||||
surrounded by quotes if the string contains whitespace or any special
|
||||
character. The string returned by this function is allocated by the
|
||||
library; it is the user's responsibility to free it.
|
||||
|
||||
unsigned char *PLGetString(proplist_t pl)
|
||||
-----------------------------------------
|
||||
Returns the string contents of pl (which must be a string). This
|
||||
function returns a reference to pl's contents; do not free it!
|
||||
|
||||
unsigned char *PLGetDataDescription(proplist_t pl)
|
||||
--------------------------------------------------
|
||||
Returns a description of pl (which must be a data object) in
|
||||
GNUstep/OPENSTEP format. It is the user's responsibility to free the
|
||||
returned string.
|
||||
|
||||
unsigned int PLGetDataLength(proplist_t pl)
|
||||
-------------------------------------------
|
||||
Returns the number of bytes contained in pl (which must be a data
|
||||
object).
|
||||
|
||||
unsigned char *PLGetDataBytes(proplist_t pl)
|
||||
--------------------------------------------
|
||||
Returns a reference to the contents of pl (which must be a data
|
||||
object). Do not free the memory associated with the returned value,
|
||||
and keep in mind that it is not a string (i.e. it may contain NUL
|
||||
bytes.
|
||||
|
||||
|
||||
unsigned char *PLGetDescriptionIndent(proplist_t pl, unsigned int level)
|
||||
------------------------------------------------------------------------
|
||||
Returns a pretty-printed description of the property list in
|
||||
GNUstep property list format. You probably want to call it with
|
||||
level==0, but YMMV. Free the returned string after you're done.
|
||||
|
||||
unsigned char *PLGetDescription(proplist_t pl)
|
||||
----------------------------------------------
|
||||
Returns a compact description of the property list in GNUstep
|
||||
format. Free the returned string after you're done.
|
||||
|
||||
|
||||
unsigned int PLGetNumberOfElements(proplist_t pl)
|
||||
-------------------------------------------------
|
||||
Returns the number of elements contained in pl. This is always 0 if pl
|
||||
is a string or data object. If pl is a dictionary, its number of keys
|
||||
== its number of values == the returned number.
|
||||
|
||||
proplist_t PLGetArrayElement(proplist_t pl, unsigned int index)
|
||||
---------------------------------------------------------------
|
||||
Returns the array element at index, or NULL if index is out of
|
||||
bounds. The returned value is a reference; do not destroy it before
|
||||
having removed it from the array!
|
||||
|
||||
proplist_t PLGetAllDictionaryKeys(proplist_t pl)
|
||||
------------------------------------------------
|
||||
Returns an array containing all the keys of pl (which must be a
|
||||
dictionary). The array returned is newly created for this purpose.
|
||||
|
||||
proplist_t PLGetDictionaryEntry(proplist_t pl, proplist_t key)
|
||||
--------------------------------------------------------------
|
||||
Returns the dictionary entry associated with key, or NULL if key isn't
|
||||
in the dictionary. The returned value is a reference to a dictionary
|
||||
value; do not destroy it!
|
||||
|
||||
|
||||
proplist_t PLGetContainer(proplist_t pl)
|
||||
----------------------------------------
|
||||
Returns pl's container (i.e. the array or dictionary of which pl is an
|
||||
element), or NULL if pl is at top level.
|
||||
|
||||
|
||||
proplist_t PLMakeString(unsigned char *bytes)
|
||||
---------------------------------------------
|
||||
Returns a newly created string object. The passed string is copied for
|
||||
this purpose, i.e. you can free it after this call.
|
||||
|
||||
proplist_t PLMakeData(unsigned char *data, unsigned int length)
|
||||
---------------------------------------------------------------
|
||||
Returns a newly created data object. The passed data is copied.
|
||||
|
||||
proplist_t PLMakeArrayFromElements(proplist_t pl, ...)
|
||||
------------------------------------------------------
|
||||
Returns a newly created array object. The passed arguments (all of
|
||||
type proplist_t) must be NULL-terminated. If the first argument is
|
||||
NULL, an empty array is returned. None of the passed property lists
|
||||
are copied, so do not free them!
|
||||
|
||||
proplist_t PLInsertArrayElement(proplist_t array, proplist_t pl,
|
||||
unsigned int index)
|
||||
----------------------------------------------------------------
|
||||
Inserts pl into array at the specified index. Returns array if
|
||||
successful, NULL if index is out of bounds. pl is not copied.
|
||||
|
||||
proplist_t PLRemoveArrayElement(proplist_t array, unsigned int index)
|
||||
---------------------------------------------------------------------
|
||||
Removes the element at the specified index from the array. Returns
|
||||
array if successful, NULL if index is out of bounds. The removed
|
||||
element is not destroyed.
|
||||
|
||||
proplist_t PLAppendArrayElement(proplist_t array, proplist_t pl)
|
||||
----------------------------------------------------------------
|
||||
Appends pl as the last element of array. Returns array. pl is not
|
||||
copied.
|
||||
|
||||
proplist_t PLMakeDictionaryFromEntries(proplist_t key, proplist_t value,
|
||||
...)
|
||||
------------------------------------------------------------------------
|
||||
Returns a newly created dictionary object. The arguments must have the
|
||||
form key1, value1, ..., keyn, valuen, NULL. None of the arguments are
|
||||
copied. NOTE: all the dictionary functions use PLIsEqual() for the key
|
||||
comparison.
|
||||
|
||||
proplist_t PLInsertDictionaryEntry(proplist_t dict, proplist_t key,
|
||||
proplist_t value)
|
||||
-------------------------------------------------------------------
|
||||
Inserts value as the new value for key into dict. key and value are
|
||||
retained, i.e. you can release them afterwards.
|
||||
|
||||
proplist_t PLRemoveDictionaryEntry(proplist_t dict, proplist_t key)
|
||||
-------------------------------------------------------------------
|
||||
Removes key and its associated value from dict, and releases both.
|
||||
|
||||
proplist_t PLMergeDictionaries(proplist_t dest, proplist_t source)
|
||||
------------------------------------------------------------------
|
||||
Merges source into dest. It does so by PLDeepCopy()ing every key-value
|
||||
pair in source. Be careful about this function, because it might throw
|
||||
out references by calling PLInsertDictionaryEntry(), which can create
|
||||
a memory hole if you don't retain references.
|
||||
|
||||
|
||||
void PLRelease(proplist_t pl)
|
||||
-----------------------------
|
||||
Releases pl and all its contents. Only actually destroys them if they
|
||||
aren't retained somewhere else.
|
||||
|
||||
proplist_t PLShallowCopy(proplist_t pl)
|
||||
---------------------------------------
|
||||
Copies pl. If pl is a string or data object, its contents are copied
|
||||
as well. If pl is a dictionary or array object, only pl itself, but
|
||||
not its contents, is copied. Returns the copy.
|
||||
|
||||
proplist_t PLDeepCopy(proplist_t pl)
|
||||
------------------------------------
|
||||
Copies pl and all its contents. Returns the copy.
|
||||
|
||||
|
||||
BOOL PLIsEqual(proplist_t pl1, proplist_t pl2)
|
||||
----------------------------------------------
|
||||
Returns YES if pl1 (i.e. all its contents) is equal to pl2. You can
|
||||
specify a comparison function that compares strings (in case you do
|
||||
not want to do case-sensitive comparison, etc.) with
|
||||
PLSetStringCmpHook().
|
||||
|
||||
void PLSetStringCmpHook(BOOL(*fn)(proplist_t, proplist_t))
|
||||
----------------------------------------------------------
|
||||
Sets the hook that is called upon string comparison to fn. Both
|
||||
arguments supplied to fn are strings. fn must return YES if both
|
||||
strings are equal, or NO if they aren't. The default function does
|
||||
case-sensitive comparison; you can reset libPropList to use the
|
||||
default function by passing NULL as an argument.
|
||||
NOTE: This is to change soon to a strcmp()-compatible comparing
|
||||
function, to optimize searching.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
|
||||
o Clean up the code. It's messy. (This is urgent.)
|
||||
|
||||
o Library still needs some testing.
|
||||
|
||||
o Use Sun secure RPC?
|
||||
|
||||
o Write manual pages for defaults(1), PropertyList(5) and gsdd(8)
|
||||
|
||||
o replace #define BOOL with #ifndef Bool #define Bool
|
||||
BOOL is already typedefed in Xmd.h (so we can't even check if it is
|
||||
already defined)
|
|
@ -1,525 +0,0 @@
|
|||
dnl aclocal.m4 generated automatically by aclocal 1.4
|
||||
|
||||
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl This program is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
dnl PARTICULAR PURPOSE.
|
||||
|
||||
# Do all the work for Automake. This macro actually does too much --
|
||||
# some checks are only needed if your package does certain things.
|
||||
# But this isn't really a big deal.
|
||||
|
||||
# serial 1
|
||||
|
||||
dnl Usage:
|
||||
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
|
||||
|
||||
AC_DEFUN(AM_INIT_AUTOMAKE,
|
||||
[AC_REQUIRE([AC_PROG_INSTALL])
|
||||
PACKAGE=[$1]
|
||||
AC_SUBST(PACKAGE)
|
||||
VERSION=[$2]
|
||||
AC_SUBST(VERSION)
|
||||
dnl test to see if srcdir already configured
|
||||
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
|
||||
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
|
||||
fi
|
||||
ifelse([$3],,
|
||||
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
|
||||
AC_REQUIRE([AM_SANITY_CHECK])
|
||||
AC_REQUIRE([AC_ARG_PROGRAM])
|
||||
dnl FIXME This is truly gross.
|
||||
missing_dir=`cd $ac_aux_dir && pwd`
|
||||
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
|
||||
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
|
||||
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
|
||||
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
|
||||
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
|
||||
AC_REQUIRE([AC_PROG_MAKE_SET])])
|
||||
|
||||
#
|
||||
# Check to make sure that the build environment is sane.
|
||||
#
|
||||
|
||||
AC_DEFUN(AM_SANITY_CHECK,
|
||||
[AC_MSG_CHECKING([whether build environment is sane])
|
||||
# Just in case
|
||||
sleep 1
|
||||
echo timestamp > conftestfile
|
||||
# Do `set' in a subshell so we don't clobber the current shell's
|
||||
# arguments. Must try -L first in case configure is actually a
|
||||
# symlink; some systems play weird games with the mod time of symlinks
|
||||
# (eg FreeBSD returns the mod time of the symlink's containing
|
||||
# directory).
|
||||
if (
|
||||
set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
|
||||
if test "[$]*" = "X"; then
|
||||
# -L didn't work.
|
||||
set X `ls -t $srcdir/configure conftestfile`
|
||||
fi
|
||||
if test "[$]*" != "X $srcdir/configure conftestfile" \
|
||||
&& test "[$]*" != "X conftestfile $srcdir/configure"; then
|
||||
|
||||
# If neither matched, then we have a broken ls. This can happen
|
||||
# if, for instance, CONFIG_SHELL is bash and it inherits a
|
||||
# broken ls alias from the environment. This has actually
|
||||
# happened. Such a system could not be considered "sane".
|
||||
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
|
||||
alias in your environment])
|
||||
fi
|
||||
|
||||
test "[$]2" = conftestfile
|
||||
)
|
||||
then
|
||||
# Ok.
|
||||
:
|
||||
else
|
||||
AC_MSG_ERROR([newly created file is older than distributed files!
|
||||
Check your system clock])
|
||||
fi
|
||||
rm -f conftest*
|
||||
AC_MSG_RESULT(yes)])
|
||||
|
||||
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
|
||||
dnl The program must properly implement --version.
|
||||
AC_DEFUN(AM_MISSING_PROG,
|
||||
[AC_MSG_CHECKING(for working $2)
|
||||
# Run test in a subshell; some versions of sh will print an error if
|
||||
# an executable is not found, even if stderr is redirected.
|
||||
# Redirect stdin to placate older versions of autoconf. Sigh.
|
||||
if ($2 --version) < /dev/null > /dev/null 2>&1; then
|
||||
$1=$2
|
||||
AC_MSG_RESULT(found)
|
||||
else
|
||||
$1="$3/missing $2"
|
||||
AC_MSG_RESULT(missing)
|
||||
fi
|
||||
AC_SUBST($1)])
|
||||
|
||||
|
||||
# serial 40 AC_PROG_LIBTOOL
|
||||
AC_DEFUN(AC_PROG_LIBTOOL,
|
||||
[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
|
||||
|
||||
# Save cache, so that ltconfig can load it
|
||||
AC_CACHE_SAVE
|
||||
|
||||
# Actually configure libtool. ac_aux_dir is where install-sh is found.
|
||||
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
|
||||
LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
|
||||
LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
|
||||
DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
|
||||
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
|
||||
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
|
||||
|| AC_MSG_ERROR([libtool configure failed])
|
||||
|
||||
# Reload cache, that may have been modified by ltconfig
|
||||
AC_CACHE_LOAD
|
||||
|
||||
# This can be used to rebuild libtool when needed
|
||||
LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
|
||||
|
||||
# Always use our own libtool.
|
||||
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
|
||||
AC_SUBST(LIBTOOL)dnl
|
||||
|
||||
# Redirect the config.log output again, so that the ltconfig log is not
|
||||
# clobbered by the next message.
|
||||
exec 5>>./config.log
|
||||
])
|
||||
|
||||
AC_DEFUN(AC_LIBTOOL_SETUP,
|
||||
[AC_PREREQ(2.13)dnl
|
||||
AC_REQUIRE([AC_ENABLE_SHARED])dnl
|
||||
AC_REQUIRE([AC_ENABLE_STATIC])dnl
|
||||
AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_PROG_LD])dnl
|
||||
AC_REQUIRE([AC_PROG_NM])dnl
|
||||
AC_REQUIRE([AC_PROG_LN_S])dnl
|
||||
dnl
|
||||
|
||||
case "$target" in
|
||||
NONE) lt_target="$host" ;;
|
||||
*) lt_target="$target" ;;
|
||||
esac
|
||||
|
||||
# Check for any special flags to pass to ltconfig.
|
||||
libtool_flags="--cache-file=$cache_file"
|
||||
test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
|
||||
test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
|
||||
test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
|
||||
test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
|
||||
test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
|
||||
[libtool_flags="$libtool_flags --enable-dlopen"])
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
|
||||
[libtool_flags="$libtool_flags --enable-win32-dll"])
|
||||
AC_ARG_ENABLE(libtool-lock,
|
||||
[ --disable-libtool-lock avoid locking (might break parallel builds)])
|
||||
test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
|
||||
test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
|
||||
|
||||
# Some flags need to be propagated to the compiler or linker for good
|
||||
# libtool support.
|
||||
case "$lt_target" in
|
||||
*-*-irix6*)
|
||||
# Find out which ABI we are using.
|
||||
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
|
||||
if AC_TRY_EVAL(ac_compile); then
|
||||
case "`/usr/bin/file conftest.o`" in
|
||||
*32-bit*)
|
||||
LD="${LD-ld} -32"
|
||||
;;
|
||||
*N32*)
|
||||
LD="${LD-ld} -n32"
|
||||
;;
|
||||
*64-bit*)
|
||||
LD="${LD-ld} -64"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
rm -rf conftest*
|
||||
;;
|
||||
|
||||
*-*-sco3.2v5*)
|
||||
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
|
||||
SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -belf"
|
||||
AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
|
||||
[AC_LANG_SAVE
|
||||
AC_LANG_C
|
||||
AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
|
||||
AC_LANG_RESTORE])
|
||||
if test x"$lt_cv_cc_needs_belf" != x"yes"; then
|
||||
# this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
|
||||
CFLAGS="$SAVE_CFLAGS"
|
||||
fi
|
||||
;;
|
||||
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
|
||||
[*-*-cygwin* | *-*-mingw*)
|
||||
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
||||
AC_CHECK_TOOL(AS, as, false)
|
||||
AC_CHECK_TOOL(OBJDUMP, objdump, false)
|
||||
;;
|
||||
])
|
||||
esac
|
||||
])
|
||||
|
||||
# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
|
||||
AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
|
||||
|
||||
# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
|
||||
AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
|
||||
|
||||
# AC_ENABLE_SHARED - implement the --enable-shared flag
|
||||
# Usage: AC_ENABLE_SHARED[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AC_ENABLE_SHARED, [dnl
|
||||
define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(shared,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_shared=yes ;;
|
||||
no) enable_shared=no ;;
|
||||
*)
|
||||
enable_shared=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_shared=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
|
||||
AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_SHARED(no)])
|
||||
|
||||
# AC_ENABLE_STATIC - implement the --enable-static flag
|
||||
# Usage: AC_ENABLE_STATIC[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AC_ENABLE_STATIC, [dnl
|
||||
define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(static,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_static=yes ;;
|
||||
no) enable_static=no ;;
|
||||
*)
|
||||
enable_static=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_static=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AC_DISABLE_STATIC - set the default static flag to --disable-static
|
||||
AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_STATIC(no)])
|
||||
|
||||
|
||||
# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
|
||||
# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
|
||||
define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(fast-install,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_fast_install=yes ;;
|
||||
no) enable_fast_install=no ;;
|
||||
*)
|
||||
enable_fast_install=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_fast_install=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
|
||||
AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_FAST_INSTALL(no)])
|
||||
|
||||
# AC_PROG_LD - find the path to the GNU or non-GNU linker
|
||||
AC_DEFUN(AC_PROG_LD,
|
||||
[AC_ARG_WITH(gnu-ld,
|
||||
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
|
||||
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
|
||||
ac_prog=ld
|
||||
if test "$ac_cv_prog_gcc" = yes; then
|
||||
# Check if gcc -print-prog-name=ld gives a path.
|
||||
AC_MSG_CHECKING([for ld used by GCC])
|
||||
ac_prog=`($CC -print-prog-name=ld) 2>&5`
|
||||
case "$ac_prog" in
|
||||
# Accept absolute paths.
|
||||
changequote(,)dnl
|
||||
[\\/]* | [A-Za-z]:[\\/]*)
|
||||
re_direlt='/[^/][^/]*/\.\./'
|
||||
changequote([,])dnl
|
||||
# Canonicalize the path of ld
|
||||
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
|
||||
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
|
||||
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
|
||||
done
|
||||
test -z "$LD" && LD="$ac_prog"
|
||||
;;
|
||||
"")
|
||||
# If it fails, then pretend we aren't using GCC.
|
||||
ac_prog=ld
|
||||
;;
|
||||
*)
|
||||
# If it is relative, then search for the first ld in PATH.
|
||||
with_gnu_ld=unknown
|
||||
;;
|
||||
esac
|
||||
elif test "$with_gnu_ld" = yes; then
|
||||
AC_MSG_CHECKING([for GNU ld])
|
||||
else
|
||||
AC_MSG_CHECKING([for non-GNU ld])
|
||||
fi
|
||||
AC_CACHE_VAL(ac_cv_path_LD,
|
||||
[if test -z "$LD"; then
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
|
||||
for ac_dir in $PATH; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
|
||||
ac_cv_path_LD="$ac_dir/$ac_prog"
|
||||
# Check to see if the program is GNU ld. I'd rather use --version,
|
||||
# but apparently some GNU ld's only accept -v.
|
||||
# Break only if it was the GNU/non-GNU ld that we prefer.
|
||||
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
|
||||
test "$with_gnu_ld" != no && break
|
||||
else
|
||||
test "$with_gnu_ld" != yes && break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
else
|
||||
ac_cv_path_LD="$LD" # Let the user override the test with a path.
|
||||
fi])
|
||||
LD="$ac_cv_path_LD"
|
||||
if test -n "$LD"; then
|
||||
AC_MSG_RESULT($LD)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
|
||||
AC_PROG_LD_GNU
|
||||
])
|
||||
|
||||
AC_DEFUN(AC_PROG_LD_GNU,
|
||||
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
|
||||
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
|
||||
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
|
||||
ac_cv_prog_gnu_ld=yes
|
||||
else
|
||||
ac_cv_prog_gnu_ld=no
|
||||
fi])
|
||||
])
|
||||
|
||||
# AC_PROG_NM - find the path to a BSD-compatible name lister
|
||||
AC_DEFUN(AC_PROG_NM,
|
||||
[AC_MSG_CHECKING([for BSD-compatible nm])
|
||||
AC_CACHE_VAL(ac_cv_path_NM,
|
||||
[if test -n "$NM"; then
|
||||
# Let the user override the test.
|
||||
ac_cv_path_NM="$NM"
|
||||
else
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
|
||||
for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
|
||||
# Check to see if the nm accepts a BSD-compat flag.
|
||||
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
|
||||
# nm: unknown option "B" ignored
|
||||
if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
||||
ac_cv_path_NM="$ac_dir/nm -B"
|
||||
break
|
||||
elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
||||
ac_cv_path_NM="$ac_dir/nm -p"
|
||||
break
|
||||
else
|
||||
ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
|
||||
continue # so that we can try to find one that supports BSD flags
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
|
||||
fi])
|
||||
NM="$ac_cv_path_NM"
|
||||
AC_MSG_RESULT([$NM])
|
||||
])
|
||||
|
||||
# AC_CHECK_LIBM - check for math library
|
||||
AC_DEFUN(AC_CHECK_LIBM,
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
LIBM=
|
||||
case "$lt_target" in
|
||||
*-*-beos* | *-*-cygwin*)
|
||||
# These system don't have libm
|
||||
;;
|
||||
*-ncr-sysv4.3*)
|
||||
AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
|
||||
AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
|
||||
;;
|
||||
*)
|
||||
AC_CHECK_LIB(m, main, LIBM="-lm")
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
|
||||
# the libltdl convenience library, adds --enable-ltdl-convenience to
|
||||
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
|
||||
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
|
||||
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
|
||||
# '${top_builddir}/' (note the single quotes!) if your package is not
|
||||
# flat, and, if you're not using automake, define top_builddir as
|
||||
# appropriate in the Makefiles.
|
||||
AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
case "$enable_ltdl_convenience" in
|
||||
no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
|
||||
"") enable_ltdl_convenience=yes
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
|
||||
esac
|
||||
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
|
||||
INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
|
||||
])
|
||||
|
||||
# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
|
||||
# the libltdl installable library, and adds --enable-ltdl-install to
|
||||
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
|
||||
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
|
||||
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
|
||||
# '${top_builddir}/' (note the single quotes!) if your package is not
|
||||
# flat, and, if you're not using automake, define top_builddir as
|
||||
# appropriate in the Makefiles.
|
||||
# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
|
||||
AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_CHECK_LIB(ltdl, main,
|
||||
[test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
|
||||
[if test x"$enable_ltdl_install" = xno; then
|
||||
AC_MSG_WARN([libltdl not installed, but installation disabled])
|
||||
else
|
||||
enable_ltdl_install=yes
|
||||
fi
|
||||
])
|
||||
if test x"$enable_ltdl_install" = x"yes"; then
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-install"
|
||||
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
|
||||
INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
|
||||
else
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
|
||||
LIBLTDL="-lltdl"
|
||||
INCLTDL=
|
||||
fi
|
||||
])
|
||||
|
||||
dnl old names
|
||||
AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
|
||||
AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
|
||||
AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
|
||||
AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
|
||||
AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
|
||||
AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
|
||||
AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
|
||||
|
||||
dnl This is just to silence aclocal about the macro not being used
|
||||
ifelse([AC_DISABLE_FAST_INSTALL])dnl
|
||||
|
||||
|
||||
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])
|
||||
|
|
@ -1,120 +0,0 @@
|
|||
/* comparing.c: This is -*- c -*-
|
||||
|
||||
This file implements the PLIs... functions
|
||||
|
||||
*/
|
||||
|
||||
#include "proplistP.h"
|
||||
|
||||
/* forward prototype */
|
||||
BOOL PLStrCmp(proplist_t pl1, proplist_t pl2);
|
||||
|
||||
BOOL (*plStrCmp)(proplist_t, proplist_t) = &PLStrCmp;
|
||||
|
||||
void PLSetStringCmpHook(BOOL(*fn)(proplist_t, proplist_t))
|
||||
{
|
||||
if(!fn)
|
||||
plStrCmp = &PLStrCmp;
|
||||
else
|
||||
plStrCmp = fn;
|
||||
}
|
||||
|
||||
BOOL PLStrCmp(proplist_t pl1, proplist_t pl2)
|
||||
{
|
||||
plptr_t int1, int2;
|
||||
|
||||
int1 = pl1; int2 = pl2;
|
||||
if(!strcmp(int1->t.str.string, int2->t.str.string))
|
||||
return YES;
|
||||
else
|
||||
return NO;
|
||||
}
|
||||
|
||||
BOOL PLIsString(proplist_t pl)
|
||||
{
|
||||
if(((plptr_t)pl)->type == PLSTRING)
|
||||
return YES;
|
||||
return NO;
|
||||
}
|
||||
|
||||
BOOL PLIsData(proplist_t pl)
|
||||
{
|
||||
if(((plptr_t)pl)->type == PLDATA)
|
||||
return YES;
|
||||
return NO;
|
||||
}
|
||||
|
||||
BOOL PLIsArray(proplist_t pl)
|
||||
{
|
||||
if(((plptr_t)pl)->type == PLARRAY)
|
||||
return YES;
|
||||
return NO;
|
||||
}
|
||||
|
||||
BOOL PLIsDictionary(proplist_t pl)
|
||||
{
|
||||
if(((plptr_t)pl)->type == PLDICTIONARY)
|
||||
return YES;
|
||||
return NO;
|
||||
}
|
||||
|
||||
BOOL PLIsSimple(proplist_t pl)
|
||||
{
|
||||
if(PLIsString(pl)||PLIsData(pl))
|
||||
return YES;
|
||||
return NO;
|
||||
}
|
||||
|
||||
BOOL PLIsCompound(proplist_t pl)
|
||||
{
|
||||
if(PLIsArray(pl)||PLIsDictionary(pl))
|
||||
return YES;
|
||||
return NO;
|
||||
}
|
||||
|
||||
BOOL PLIsEqual(proplist_t pl1, proplist_t pl2)
|
||||
{
|
||||
plptr_t int1, int2;
|
||||
int i;
|
||||
|
||||
int1 = pl1; int2 = pl2;
|
||||
|
||||
if((int1->type != int2->type))
|
||||
return NO;
|
||||
|
||||
switch(int1->type)
|
||||
{
|
||||
case PLSTRING:
|
||||
return (*plStrCmp)(pl1, pl2);
|
||||
case PLDATA:
|
||||
if(int1->t.data.length != int2->t.data.length)
|
||||
return NO;
|
||||
if(memcmp(int1->t.data.data, int2->t.data.data, int1->t.data.length)!=0)
|
||||
return NO;
|
||||
return YES;
|
||||
case PLARRAY:
|
||||
if(int1->t.array.number != int2->t.array.number)
|
||||
return NO;
|
||||
for(i=0;i<int1->t.array.number;i++)
|
||||
if(!PLIsEqual(int1->t.array.elements[i],
|
||||
int2->t.array.elements[i]))
|
||||
return NO;
|
||||
return YES;
|
||||
case PLDICTIONARY:
|
||||
if(int1->t.dict.number != int2->t.dict.number)
|
||||
return NO;
|
||||
for(i=0;i<int1->t.dict.number;i++)
|
||||
if(!PLIsEqual(int1->t.dict.keys[i],
|
||||
int2->t.dict.keys[i]) ||
|
||||
!PLIsEqual(int1->t.dict.values[i],
|
||||
int2->t.dict.values[i]))
|
||||
return NO;
|
||||
return YES;
|
||||
default:
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,63 +0,0 @@
|
|||
dnl
|
||||
dnl libPropList autoconf input.
|
||||
dnl
|
||||
dnl Process with:
|
||||
dnl aclocal
|
||||
dnl autoheader
|
||||
dnl autoconf
|
||||
dnl libtoolize --force --automake
|
||||
dnl automake -a --gnu --include-deps
|
||||
dnl
|
||||
dnl
|
||||
|
||||
AC_INIT(proplist.l)
|
||||
|
||||
AM_INIT_AUTOMAKE(libPropList, 0.10.1)
|
||||
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_PROG_CC
|
||||
|
||||
|
||||
dnl ARGH!! This is a pain. Automake will cause configure to abort if
|
||||
dnl lex is not in the system, even though lex is not required by us.
|
||||
dnl And if we use AC_PROG_LEX it will complain.
|
||||
AM_PROG_LEX
|
||||
AC_PROG_YACC
|
||||
AC_PROG_MAKE_SET
|
||||
#AC_PROG_RANLIB
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(fcntl.h sys/file.h sys/time.h unistd.h crypt.h)
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
AC_TYPE_PID_T
|
||||
AC_TYPE_SIZE_T
|
||||
AC_HEADER_TIME
|
||||
|
||||
dnl Checks for library functions.
|
||||
AC_FUNC_MEMCMP
|
||||
AC_TYPE_SIGNAL
|
||||
|
||||
AC_CHECK_FUNCS(gethostname gettimeofday mkdir rmdir select strstr)
|
||||
|
||||
AC_CHECK_FUNC(socket,,
|
||||
AC_CHECK_LIB(socket, socket, XTRALIBS="$XTRALIBS -lsocket",))
|
||||
|
||||
AC_CHECK_FUNC(gethostbyname,,
|
||||
AC_CHECK_LIB(gethostbyname, nsl, XTRALIBS="$XTRALIBS -lnsl",))
|
||||
|
||||
AC_CHECK_FUNC(crypt,,
|
||||
AC_CHECK_LIB(crypt, crypt, LIBCRYPT="-lcrypt", LIBCRYPT=""))
|
||||
|
||||
dnl AC_CHECK_LIB(crypt, crypt, LIBCRYPT="-lcrypt", LIBCRYPT="")
|
||||
|
||||
|
||||
dnl AC_SUBST(LIBSOCK)
|
||||
AC_SUBST(LIBCRYPT)
|
||||
AC_SUBST(XTRALIBS)
|
||||
|
||||
AC_OUTPUT(Makefile)
|
|
@ -1,330 +0,0 @@
|
|||
/* daemon.c: This is -*- c -*-
|
||||
|
||||
Implements the functions used in talking to the user-defaults daemon
|
||||
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "proplist.h"
|
||||
#include "plconf.h"
|
||||
#include "util.h"
|
||||
|
||||
#define GIVEUP(x, y) { char buf[255]; \
|
||||
fprintf(stderr, "libPropList: %s:\n", x); \
|
||||
sprintf(buf, "libPropList: %s", y); \
|
||||
perror(buf); \
|
||||
fprintf(stderr, "libPropList: Giving up.\n"); \
|
||||
exit(1); }
|
||||
|
||||
static int sock;
|
||||
static pid_t mypid, childpid;
|
||||
static plcallback_t cb;
|
||||
static char password[255];
|
||||
|
||||
BOOL initialized = NO;
|
||||
|
||||
void sighandler(int sig)
|
||||
{
|
||||
#if 0
|
||||
signal(sig, sighandler);
|
||||
#else
|
||||
/* in Linux, signals are reset to their default behaviour after raised.
|
||||
* Since it is quite common that libPL raises many HUPs quickly... */
|
||||
struct sigaction sig_action;
|
||||
|
||||
sig_action.sa_handler = sighandler;
|
||||
sigemptyset(&sig_action.sa_mask);
|
||||
sigaction(SIGHUP, &sig_action, NULL);
|
||||
|
||||
#endif
|
||||
if(cb)
|
||||
(*cb)();
|
||||
}
|
||||
|
||||
int start_daemon(void)
|
||||
{
|
||||
char *daemonpath;
|
||||
|
||||
daemonpath = ManglePath(DAEMON);
|
||||
|
||||
if((childpid = fork()) < 0)
|
||||
return -1;
|
||||
|
||||
if(childpid==0)
|
||||
{
|
||||
/* execute daemon */
|
||||
if(execvp(daemonpath, NULL) < 0)
|
||||
{
|
||||
fprintf(stderr, "libPropList: Couldn't start daemon %s:\n", DAEMON);
|
||||
perror("libPropList: start_daemon");
|
||||
fprintf(stderr, "libPropList: Giving up.\n");
|
||||
kill(mypid, SIGTERM);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
free(daemonpath);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void initialize(void)
|
||||
{
|
||||
struct stat file_stat;
|
||||
FILE *pidfile;
|
||||
char *pidfilename;
|
||||
char buf[255];
|
||||
int portno;
|
||||
pid_t pid;
|
||||
int i;
|
||||
|
||||
mypid = getpid();
|
||||
pidfilename = ManglePath(PIDFILE);
|
||||
|
||||
if(stat(pidfilename, &file_stat) < 0) {
|
||||
if(start_daemon() < 0)
|
||||
{
|
||||
fprintf(stderr, "libPropList: Could not start daemon %s:\n", DAEMON);
|
||||
perror("libPropList: start_daemon");
|
||||
fprintf(stderr, "libPropList: Giving up.\n");
|
||||
exit(1);
|
||||
}
|
||||
else /* start_daemon succeeded */
|
||||
if(stat(pidfilename, &file_stat) < 0)
|
||||
{
|
||||
i=0;
|
||||
while(i<TIMEOUT)
|
||||
{
|
||||
sleep(1);
|
||||
i++;
|
||||
if(stat(pidfilename, &file_stat) == 0) /* success */
|
||||
goto gotit;
|
||||
}
|
||||
fprintf(stderr, "libPropList: Could not start daemon %s: Timeout. Giving up.\n", DAEMON);
|
||||
kill(childpid, SIGTERM);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
gotit:
|
||||
|
||||
pidfile = fopen(pidfilename, "r");
|
||||
if(!pidfile)
|
||||
{
|
||||
GIVEUP("Could not open PID file.", "fopen");
|
||||
kill(childpid, SIGTERM);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fscanf(pidfile, "%d %d %s", &pid, &portno, password);
|
||||
|
||||
sock = GetClientSocket(portno);
|
||||
if(sock<0)
|
||||
GIVEUP("Couldn't initiate connection", "GetClientSocket");
|
||||
|
||||
sprintf(buf, "auth %s\n", password);
|
||||
if(!(WriteString(sock, buf)))
|
||||
GIVEUP("Couldn't authorize myself!", "auth");
|
||||
|
||||
initialized = YES;
|
||||
free(pidfilename);
|
||||
}
|
||||
|
||||
proplist_t PLGetDomainNames()
|
||||
{
|
||||
char *desc;
|
||||
proplist_t arr;
|
||||
|
||||
if(!initialized) initialize();
|
||||
|
||||
if(!(WriteString(sock, "list\n")))
|
||||
return NULL;
|
||||
|
||||
if(!(desc = ReadStringAnySize(sock)))
|
||||
return NULL;
|
||||
|
||||
arr = PLGetProplistWithDescription(desc);
|
||||
|
||||
MyFree(__FILE__, __LINE__, desc);
|
||||
|
||||
return arr;
|
||||
}
|
||||
|
||||
proplist_t PLGetDomain(proplist_t name)
|
||||
{
|
||||
char *desc, *str;
|
||||
proplist_t domain;
|
||||
|
||||
if(!initialized) initialize();
|
||||
|
||||
desc = PLGetDescription(name);
|
||||
str = (char *)MyMalloc(__FILE__, __LINE__, strlen(desc)+6);
|
||||
|
||||
sprintf(str, "get %s\n", desc);
|
||||
|
||||
MyFree(__FILE__, __LINE__, desc);
|
||||
|
||||
if(!(WriteString(sock, str)))
|
||||
{
|
||||
MyFree(__FILE__, __LINE__, str);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MyFree(__FILE__, __LINE__, str);
|
||||
|
||||
if(!(desc = ReadStringAnySize(sock)))
|
||||
return NULL;
|
||||
|
||||
if(!strcmp(desc, "nil"))
|
||||
{
|
||||
MyFree(__FILE__, __LINE__, desc);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
domain = PLGetProplistWithDescription(desc);
|
||||
|
||||
MyFree(__FILE__, __LINE__, desc);
|
||||
|
||||
return domain;
|
||||
}
|
||||
|
||||
proplist_t PLSetDomain(proplist_t name, proplist_t value,
|
||||
BOOL kickme)
|
||||
{
|
||||
char *name_desc, *value_desc;
|
||||
char *str;
|
||||
|
||||
if(!initialized) initialize();
|
||||
|
||||
name_desc = PLGetDescription(name);
|
||||
value_desc = PLGetDescription(value);
|
||||
str = (char *)MyMalloc(__FILE__, __LINE__, strlen(name_desc)+strlen(value_desc)+50);
|
||||
|
||||
if(kickme)
|
||||
sprintf(str, "set %s %s\n", name_desc, value_desc);
|
||||
|
||||
else
|
||||
sprintf(str, "set-nonotify %d %s %s\n", mypid, name_desc,
|
||||
value_desc);
|
||||
|
||||
MyFree(__FILE__, __LINE__, name_desc);
|
||||
MyFree(__FILE__, __LINE__, value_desc);
|
||||
|
||||
if(!(WriteString(sock, str)))
|
||||
{
|
||||
MyFree(__FILE__, __LINE__, str);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MyFree(__FILE__, __LINE__, str);
|
||||
|
||||
return(value);
|
||||
}
|
||||
|
||||
proplist_t PLDeleteDomain(proplist_t name, BOOL kickme)
|
||||
{
|
||||
char *name_desc;
|
||||
char *str;
|
||||
|
||||
if(!initialized) initialize();
|
||||
|
||||
name_desc = PLGetDescription(name);
|
||||
str = (char *)MyMalloc(__FILE__, __LINE__, strlen(name_desc)+50);
|
||||
|
||||
if(kickme)
|
||||
sprintf(str, "remove %s\n", name_desc);
|
||||
|
||||
else
|
||||
sprintf(str, "remove-nonotify %d %s\n", mypid, name_desc);
|
||||
|
||||
MyFree(__FILE__, __LINE__, name_desc);
|
||||
|
||||
if(!(WriteString(sock, str)))
|
||||
{
|
||||
MyFree(__FILE__, __LINE__, str);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MyFree(__FILE__, __LINE__, str);
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
proplist_t PLRegister(proplist_t name, plcallback_t callback)
|
||||
{
|
||||
char *str, *desc;
|
||||
|
||||
if(!initialized) initialize();
|
||||
|
||||
cb = callback;
|
||||
|
||||
signal(SIGNAL, &sighandler);
|
||||
|
||||
if(name)
|
||||
{
|
||||
desc = PLGetDescription(name);
|
||||
|
||||
str = (char *)MyMalloc(__FILE__, __LINE__, strlen(desc)+50);
|
||||
sprintf(str, "register %d %s\n", mypid, desc);
|
||||
MyFree(__FILE__, __LINE__, desc);
|
||||
}
|
||||
else
|
||||
{
|
||||
str = (char *)MyMalloc(__FILE__, __LINE__, 50);
|
||||
sprintf(str, "register %d\n", mypid);
|
||||
}
|
||||
|
||||
if(!(WriteString(sock, str)))
|
||||
{
|
||||
MyFree(__FILE__, __LINE__, str);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MyFree(__FILE__, __LINE__, str);
|
||||
|
||||
return(name);
|
||||
}
|
||||
|
||||
proplist_t PLUnregister(proplist_t name)
|
||||
{
|
||||
char *str, *desc;
|
||||
|
||||
if(!initialized) initialize();
|
||||
|
||||
signal(SIGNAL, &sighandler);
|
||||
|
||||
if(name)
|
||||
{
|
||||
desc = PLGetDescription(name);
|
||||
|
||||
str = (char *)MyMalloc(__FILE__, __LINE__, strlen(desc)+50);
|
||||
sprintf(str, "unregister %d %s\n", mypid, desc);
|
||||
MyFree(__FILE__, __LINE__, desc);
|
||||
}
|
||||
else
|
||||
{
|
||||
str = (char *)MyMalloc(__FILE__, __LINE__, 50);
|
||||
sprintf(str, "unregister %d\n", mypid);
|
||||
cb = NULL;
|
||||
signal(SIGNAL, SIG_DFL);
|
||||
}
|
||||
|
||||
if(!(WriteString(sock, str)))
|
||||
{
|
||||
MyFree(__FILE__, __LINE__, str);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MyFree(__FILE__, __LINE__, str);
|
||||
|
||||
return(name);
|
||||
}
|
|
@ -1,593 +0,0 @@
|
|||
/* filehandling.c: This is -*- c -*-
|
||||
|
||||
This file contains the implementation of the file handling
|
||||
functions
|
||||
|
||||
*/
|
||||
|
||||
#include "proplistP.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define pl_scan_string(c) yy_scan_string(c)
|
||||
#define plparse() yyparse()
|
||||
#define pl_delete_buffer(b) yy_delete_buffer(b)
|
||||
|
||||
extern void *pl_scan_string(const char *c);
|
||||
extern void *plparse();
|
||||
extern void pl_delete_buffer(void *buf);
|
||||
|
||||
proplist_t PLSetUnchanged(proplist_t pl);
|
||||
|
||||
/* declared in proplist.l (lex.pl.c) */
|
||||
extern int pl_line_count;
|
||||
|
||||
proplist_t parse_result;
|
||||
char *pl_curr_file = NULL;
|
||||
|
||||
|
||||
proplist_t PLGetProplistWithDescription(const char *description)
|
||||
{
|
||||
void *bufstate;
|
||||
proplist_t obj = NULL;
|
||||
|
||||
pl_line_count = 1;
|
||||
|
||||
bufstate = (void *)pl_scan_string(description);
|
||||
if (plparse() != 0)
|
||||
obj = parse_result; /* What was returned? */
|
||||
pl_delete_buffer(bufstate);
|
||||
|
||||
if(obj)
|
||||
PLSetUnchanged(obj);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
proplist_t PLGetProplistWithPath(const char *filename)
|
||||
{
|
||||
char *str;
|
||||
proplist_t pl, filename_pl;
|
||||
int fd;
|
||||
struct stat fstat_buf;
|
||||
char *actual_filename;
|
||||
#ifdef headache
|
||||
struct flock flk;
|
||||
int got_lock;
|
||||
#endif
|
||||
|
||||
if((!filename)||(strlen(filename)==0)) /* Refers to GNUstep defaults file */
|
||||
actual_filename = MakeDefaultsFilename();
|
||||
else
|
||||
actual_filename = ManglePath(filename);
|
||||
|
||||
if((fd = open(actual_filename, O_RDONLY))<0)
|
||||
{
|
||||
free(actual_filename);
|
||||
return NULL;
|
||||
}
|
||||
#if 0
|
||||
if((flock(fd, LOCK_EX))<0)
|
||||
#endif
|
||||
#ifdef headache
|
||||
flk.l_type = F_RDLCK;
|
||||
flk.l_start = 0;
|
||||
flk.l_whence = SEEK_SET;
|
||||
flk.l_len = 0;
|
||||
if (fcntl(fd, F_SETLK, &flk)<0)
|
||||
{
|
||||
if (errno != ENOLCK)
|
||||
{
|
||||
close(fd);
|
||||
free(actual_filename);
|
||||
return NULL;
|
||||
}
|
||||
got_lock = 0;
|
||||
} else
|
||||
got_lock = 1;
|
||||
#endif /* headache */
|
||||
if(fstat(fd, &fstat_buf)<0)
|
||||
{
|
||||
close(fd);
|
||||
free(actual_filename);
|
||||
return NULL;
|
||||
}
|
||||
str = (char *)MyMalloc(__FILE__, __LINE__, sizeof(char)*(fstat_buf.st_size+32));
|
||||
if(read(fd, str, fstat_buf.st_size) != fstat_buf.st_size)
|
||||
{
|
||||
close(fd);
|
||||
MyFree(__FILE__, __LINE__, str);
|
||||
#if 0
|
||||
flock(fd, LOCK_UN);
|
||||
#endif
|
||||
#ifdef headache
|
||||
flk.l_type = F_UNLCK;
|
||||
fcntl(fd, F_SETLK, &flk);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
str[fstat_buf.st_size] = '\0';
|
||||
#ifdef headache
|
||||
flk.l_type = F_UNLCK;
|
||||
#if 0
|
||||
if((flock(fd, LOCK_UN))<0)
|
||||
#endif
|
||||
if (got_lock && fcntl(fd, F_SETLK, &flk)<0)
|
||||
{
|
||||
close(fd);
|
||||
MyFree(__FILE__, __LINE__, str);
|
||||
fprintf(stderr, "PLGetPropListWithPath(): Couldn't unlock file!\n");
|
||||
return NULL;
|
||||
}
|
||||
#endif /* headache */
|
||||
close(fd);
|
||||
|
||||
pl_curr_file = (char *)filename;
|
||||
|
||||
pl = PLGetProplistWithDescription(str);
|
||||
MyFree(__FILE__, __LINE__, str);
|
||||
|
||||
pl_curr_file = NULL;
|
||||
|
||||
if(pl)
|
||||
{
|
||||
filename_pl = PLMakeString(actual_filename);
|
||||
PLSetFilename(pl, filename_pl);
|
||||
PLRelease(filename_pl);
|
||||
MyFree(__FILE__, __LINE__, actual_filename);
|
||||
return pl;
|
||||
}
|
||||
else
|
||||
{
|
||||
MyFree(__FILE__, __LINE__, actual_filename);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
proplist_t PLSetUnchanged(proplist_t pl)
|
||||
{
|
||||
plptr_t internal = (plptr_t)pl;
|
||||
int i;
|
||||
|
||||
/* Just to be sure */
|
||||
if(internal == NULL)
|
||||
return NULL;
|
||||
|
||||
switch(internal->type)
|
||||
{
|
||||
case PLARRAY:
|
||||
for(i=0; i<internal->t.array.number; i++)
|
||||
PLSetUnchanged(internal->t.array.elements[i]);
|
||||
break;
|
||||
case PLDICTIONARY:
|
||||
for(i=0; i<internal->t.dict.number; i++)
|
||||
{
|
||||
PLSetUnchanged(internal->t.dict.keys[i]);
|
||||
PLSetUnchanged(internal->t.dict.values[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
internal->changed = NO;
|
||||
return pl;
|
||||
}
|
||||
|
||||
|
||||
proplist_t PLSynchronize2(proplist_t pl1, proplist_t pl2, BOOL recurse)
|
||||
/* pl1 is the proplist changed in the program, pl2 the one that comes
|
||||
from the outside */
|
||||
{
|
||||
plptr_t int1, int2, tmp_v1, tmp_v2, tmp_k, tmp;
|
||||
proplist_t arr1, arr2, aux1, aux2, auxk;
|
||||
int i;
|
||||
int num1, num2, num;
|
||||
int changed1;
|
||||
int tmpnum;
|
||||
|
||||
int1 = (plptr_t)pl1; int2 = (plptr_t)pl2;
|
||||
|
||||
/* Just to be sure */
|
||||
if(int1 == NULL)
|
||||
return NULL;
|
||||
|
||||
if (int1->type != int2->type)
|
||||
{ /* FIXME */
|
||||
puts("ERROR: DIFFERENT TYPE OBJECTS BEING SYNC'ED");
|
||||
return pl1;
|
||||
}
|
||||
|
||||
changed1 = int1->changed;
|
||||
|
||||
switch(int1->type)
|
||||
{
|
||||
case PLSTRING:
|
||||
if(int1->changed)
|
||||
{
|
||||
MyFree(__FILE__, __LINE__, int2->t.str.string);
|
||||
int2->t.str.string =
|
||||
(char *)MyMalloc(__FILE__, __LINE__, strlen(int1->t.str.string));
|
||||
strcpy(int2->t.str.string, int1->t.str.string);
|
||||
}
|
||||
else if(!PLIsEqual(int1, int2))
|
||||
{
|
||||
MyFree(__FILE__, __LINE__, int1->t.str.string);
|
||||
int1->t.str.string =
|
||||
(char *)MyMalloc(__FILE__, __LINE__, strlen(int2->t.str.string));
|
||||
strcpy(int1->t.str.string, int2->t.str.string);
|
||||
}
|
||||
PLSetUnchanged(pl1);
|
||||
break;
|
||||
|
||||
case PLDATA:
|
||||
if(int1->changed)
|
||||
{
|
||||
MyFree(__FILE__, __LINE__, int2->t.data.data);
|
||||
int2->t.data.data =
|
||||
(unsigned char *)MyMalloc(__FILE__, __LINE__, int1->t.data.length);
|
||||
memcpy(int2->t.data.data, int1->t.data.data,
|
||||
int1->t.data.length);
|
||||
}
|
||||
else if(!PLIsEqual(int1, int2))
|
||||
{
|
||||
MyFree(__FILE__, __LINE__, int1->t.data.data);
|
||||
int1->t.data.data =
|
||||
(unsigned char *)MyMalloc(__FILE__, __LINE__, int2->t.data.length);
|
||||
memcpy(int1->t.data.data, int2->t.data.data,
|
||||
int2->t.data.length);
|
||||
}
|
||||
PLSetUnchanged(pl1);
|
||||
break;
|
||||
|
||||
case PLARRAY:
|
||||
/* if the list from the file has more elements than the local
|
||||
array, append all to the local one. if it has less, check
|
||||
which ones are changed by us and append those to the remote
|
||||
one, remove the others from the local one. After that, the
|
||||
numbers of elements are equal; check for changed ones and
|
||||
synchronize them */
|
||||
num1 = PLGetNumberOfElements(pl1);
|
||||
num2 = PLGetNumberOfElements(pl2);
|
||||
if(num1<num2)
|
||||
for(i=num1; i<num2; i++)
|
||||
{
|
||||
if(changed1)
|
||||
PLRemoveArrayElement(pl2, i);
|
||||
else
|
||||
{
|
||||
aux2 = PLDeepCopy(PLGetArrayElement(pl2, i));
|
||||
PLAppendArrayElement(pl1, aux2);
|
||||
PLRelease(aux2);
|
||||
PLSetUnchanged(PLGetArrayElement(pl1, i));
|
||||
int1->changed = 0;
|
||||
}
|
||||
}
|
||||
else if(num1>num2)
|
||||
for(i=num2; i<num1; i++)
|
||||
{
|
||||
tmp = PLGetArrayElement(pl1, i);
|
||||
if(tmp->changed)
|
||||
{
|
||||
aux1 = PLDeepCopy(tmp);
|
||||
PLAppendArrayElement(pl2, aux1);
|
||||
PLRelease(aux1);
|
||||
tmpnum = PLGetNumberOfElements(pl2)-1;
|
||||
PLSetUnchanged(PLGetArrayElement(pl2, tmpnum));
|
||||
}
|
||||
else
|
||||
PLRemoveArrayElement(pl1, i);
|
||||
}
|
||||
|
||||
num = PLGetNumberOfElements(pl1);
|
||||
for(i=0; i<num; i++) {
|
||||
if (recurse) {
|
||||
PLSynchronize2(PLGetArrayElement(pl1, i),
|
||||
PLGetArrayElement(pl2, i), YES);
|
||||
} else {
|
||||
tmp_v1 = PLGetArrayElement(pl1, i);
|
||||
if(tmp_v1->changed) {
|
||||
PLRemoveArrayElement(pl2, i);
|
||||
aux1 = PLDeepCopy(tmp_v1);
|
||||
PLInsertArrayElement(pl2, aux1, i);
|
||||
PLRelease(aux1);
|
||||
PLSetUnchanged(PLGetArrayElement(pl2, i));
|
||||
} else {
|
||||
PLRemoveArrayElement(pl1, i);
|
||||
aux2 = PLDeepCopy(PLGetArrayElement(pl2, i));
|
||||
PLInsertArrayElement(pl1, aux2, i);
|
||||
PLRelease(aux2);
|
||||
PLSetUnchanged(PLGetArrayElement(pl1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case PLDICTIONARY:
|
||||
arr1 = PLGetAllDictionaryKeys(pl1);
|
||||
arr2 = PLGetAllDictionaryKeys(pl2);
|
||||
num1 = PLGetNumberOfElements(arr1);
|
||||
num2 = PLGetNumberOfElements(arr2);
|
||||
|
||||
/* first check for entries that are in pl2 but not pl1 */
|
||||
for(i=0; i<num2; i++)
|
||||
{
|
||||
tmp_k = PLGetArrayElement(arr2, i);
|
||||
tmp_v2 = PLGetDictionaryEntry(pl2, tmp_k);
|
||||
auxk = PLDeepCopy(tmp_k);
|
||||
aux2 = PLDeepCopy(tmp_v2);
|
||||
if(!(tmp_v1 = PLGetDictionaryEntry(pl1, tmp_k))) {
|
||||
/* Entry is only in the file copy */
|
||||
/* have we changed anything in the current
|
||||
container? If yes, remove this entry. If no,
|
||||
leave it where it is */
|
||||
if(changed1) {
|
||||
PLRemoveDictionaryEntry(pl2, tmp_k);
|
||||
} else {
|
||||
PLInsertDictionaryEntry(pl1, auxk, aux2);
|
||||
int1->changed = 0;
|
||||
}
|
||||
} else if (recurse) {
|
||||
/* Entry present in both pl1 & pl2 */
|
||||
PLSynchronize2(tmp_v1, tmp_v2, YES);
|
||||
} else {
|
||||
/* Entry present in both pl1 & pl2, but no recursion */
|
||||
if (tmp_v1->changed) {
|
||||
aux1 = PLDeepCopy(tmp_v1);
|
||||
PLInsertDictionaryEntry(pl2, auxk, aux1);
|
||||
PLRelease(aux1);
|
||||
} else {
|
||||
PLInsertDictionaryEntry(pl1, auxk, aux2);
|
||||
int1->changed = 0;
|
||||
}
|
||||
}
|
||||
PLRelease(auxk);
|
||||
PLRelease(aux2);
|
||||
}
|
||||
/* Now, check for entries that aren't in pl2 (only entries unique in
|
||||
* pl1 must be handled here!!!). The entries that are in both, were
|
||||
* handled in the for() loop above. Don't handle them again. -Dan */
|
||||
for(i=0; i<num1; i++)
|
||||
{
|
||||
tmp_k = PLGetArrayElement(arr1, i);
|
||||
tmp_v1 = PLGetDictionaryEntry(pl1, tmp_k);
|
||||
auxk = PLDeepCopy(tmp_k);
|
||||
aux1 = PLDeepCopy(tmp_v1);
|
||||
if(!(tmp_v2 = PLGetDictionaryEntry(pl2, tmp_k))) {
|
||||
if(tmp_v1->changed)
|
||||
PLInsertDictionaryEntry(pl2, auxk, aux1);
|
||||
else
|
||||
PLRemoveDictionaryEntry(pl1, tmp_k);
|
||||
}
|
||||
PLRelease(auxk);
|
||||
PLRelease(aux1);
|
||||
}
|
||||
PLRelease(arr1);
|
||||
PLRelease(arr2);
|
||||
break;
|
||||
}
|
||||
|
||||
PLSetUnchanged(pl1);
|
||||
PLSetUnchanged(pl2);
|
||||
return pl1;
|
||||
}
|
||||
|
||||
|
||||
BOOL PLDeepSynchronize(proplist_t pl)
|
||||
{
|
||||
char lockfilename[255];
|
||||
proplist_t fromFile;
|
||||
plptr_t internal, fF_internal;
|
||||
BOOL state;
|
||||
|
||||
if(!PLGetFilename(pl))
|
||||
return NO;
|
||||
|
||||
sprintf(lockfilename, "%s.lock", PLGetString(PLGetFilename(pl)));
|
||||
|
||||
if((mkdir(lockfilename, 0755))<0)
|
||||
return NO;
|
||||
if(!(fromFile = PLGetProplistWithPath(PLGetString(PLGetFilename(pl))))) {
|
||||
state = PLSave(pl, YES);
|
||||
rmdir(lockfilename);
|
||||
return state;
|
||||
}
|
||||
|
||||
internal = (plptr_t)pl;
|
||||
fF_internal = (plptr_t)fromFile;
|
||||
|
||||
internal = PLSynchronize2(internal, fF_internal, YES);
|
||||
|
||||
state = PLSave(fF_internal, YES);
|
||||
|
||||
PLRelease(fF_internal);
|
||||
rmdir(lockfilename);
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
BOOL PLShallowSynchronize(proplist_t pl)
|
||||
{
|
||||
char lockfilename[255];
|
||||
proplist_t fromFile;
|
||||
plptr_t internal, fF_internal;
|
||||
BOOL state;
|
||||
|
||||
if(!PLGetFilename(pl))
|
||||
return NO;
|
||||
|
||||
sprintf(lockfilename, "%s.lock", PLGetString(PLGetFilename(pl)));
|
||||
|
||||
if((mkdir(lockfilename, 0755))<0)
|
||||
return NO;
|
||||
if(!(fromFile = PLGetProplistWithPath(PLGetString(PLGetFilename(pl))))) {
|
||||
state = PLSave(pl, YES);
|
||||
rmdir(lockfilename);
|
||||
return state;
|
||||
}
|
||||
|
||||
internal = (plptr_t)pl;
|
||||
fF_internal = (plptr_t)fromFile;
|
||||
|
||||
internal = PLSynchronize2(internal, fF_internal, NO);
|
||||
|
||||
state = PLSave(fF_internal, YES);
|
||||
|
||||
PLRelease(fF_internal);
|
||||
rmdir(lockfilename);
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
BOOL PLSave(proplist_t pl, BOOL atomically)
|
||||
{
|
||||
const char *theFileName;
|
||||
const char *theRealFileName = NULL;
|
||||
char tmp_fileName[255];
|
||||
char tmp_realFileName[255];
|
||||
char dirname[255];
|
||||
char *tmp_dirname, *tmp2_dirname;
|
||||
char *basename, *tmp_basename;
|
||||
FILE *theFile;
|
||||
int c;
|
||||
char *desc = NULL;
|
||||
|
||||
theRealFileName = PLGetString(PLGetFilename(pl));
|
||||
if(!theRealFileName) return NO;
|
||||
|
||||
if (atomically)
|
||||
{
|
||||
theFileName = tmpnam(NULL);
|
||||
strcpy(tmp_fileName, theFileName);
|
||||
|
||||
if((tmp_basename=strtok(tmp_fileName, "/")))
|
||||
do
|
||||
basename=tmp_basename;
|
||||
while((tmp_basename=strtok(NULL, "/")));
|
||||
else
|
||||
basename=(char *)theFileName;
|
||||
|
||||
strcpy(tmp_realFileName, theRealFileName);
|
||||
dirname[0]='\0';
|
||||
|
||||
if((tmp_dirname=strtok(tmp_realFileName, "/")))
|
||||
{
|
||||
if(theRealFileName[0]=='/')
|
||||
strcat(dirname, "/");
|
||||
tmp2_dirname = strtok(NULL, "/");
|
||||
while((tmp2_dirname))
|
||||
{
|
||||
strcat(dirname, tmp_dirname);
|
||||
strcat(dirname, "/");
|
||||
tmp_dirname = tmp2_dirname;
|
||||
tmp2_dirname = strtok(NULL, "/");
|
||||
}
|
||||
}
|
||||
|
||||
theFileName = strcat(dirname, basename);
|
||||
}
|
||||
else
|
||||
{
|
||||
theFileName = theRealFileName;
|
||||
}
|
||||
|
||||
/* Open the file (whether temp or real) for writing. */
|
||||
theFile = fopen(theFileName, "w");
|
||||
|
||||
if (theFile == NULL) /* Something went wrong; we weren't
|
||||
* even able to open the file. */
|
||||
goto failure;
|
||||
|
||||
/* Pretty-print the description. I assume this is what we want? */
|
||||
desc = PLGetDescriptionIndent(pl, 0);
|
||||
|
||||
/* And put a new line at the EOF */
|
||||
c = fprintf(theFile, "%s\n", desc);
|
||||
|
||||
/* "c" should be strlen(desc)+1 */
|
||||
if (c <= strlen(desc)) /* We failed to write everything for
|
||||
* some reason. */
|
||||
goto failure;
|
||||
|
||||
/* We're done, so close everything up. */
|
||||
c = fclose(theFile);
|
||||
|
||||
if (c != 0) /* I can't imagine what went wrong
|
||||
* closing the file, but we got here,
|
||||
* so we need to deal with it. */
|
||||
goto failure;
|
||||
|
||||
/* If we used a temporary file, we still need to rename() it be the
|
||||
* real file. Am I forgetting anything here? */
|
||||
if (atomically)
|
||||
{
|
||||
c = rename(theFileName, theRealFileName);
|
||||
|
||||
if (c != 0) /* Many things could go wrong, I
|
||||
* guess. */
|
||||
goto failure;
|
||||
}
|
||||
|
||||
/* success: */
|
||||
MyFree(__FILE__, __LINE__, desc);
|
||||
return YES;
|
||||
|
||||
/* Just in case the failure action needs to be changed. */
|
||||
failure:
|
||||
if(desc)
|
||||
MyFree(__FILE__, __LINE__, desc);
|
||||
return NO;
|
||||
|
||||
}
|
||||
|
||||
proplist_t PLSetFilename(proplist_t pl, proplist_t filename)
|
||||
{
|
||||
int i;
|
||||
plptr_t current;
|
||||
|
||||
/* Just to be sure */
|
||||
if(pl == NULL)
|
||||
return NULL;
|
||||
|
||||
((plptr_t)pl)->filename = filename;
|
||||
PLRetain(filename);
|
||||
|
||||
switch(((plptr_t)pl)->type)
|
||||
{
|
||||
case PLARRAY:
|
||||
for(i=0;i<PLGetNumberOfElements(pl);i++)
|
||||
{
|
||||
current = (plptr_t)PLGetArrayElement(pl, i);
|
||||
PLSetFilename(current, filename);
|
||||
}
|
||||
break;
|
||||
case PLDICTIONARY:
|
||||
for(i=0;i<PLGetNumberOfElements(pl); i++)
|
||||
{
|
||||
current = (plptr_t)(((plptr_t)pl)->t.dict.keys[i]);
|
||||
PLSetFilename(current, filename);
|
||||
current = (plptr_t)(((plptr_t)pl)->t.dict.values[i]);
|
||||
PLSetFilename(current, filename);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return pl;
|
||||
}
|
||||
|
||||
proplist_t PLGetFilename(proplist_t pl)
|
||||
{
|
||||
plptr_t internal = (plptr_t)pl;
|
||||
|
||||
if(internal && internal->filename)
|
||||
return internal->filename;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -1,381 +0,0 @@
|
|||
/* getting.c: This is -*- c -*-
|
||||
|
||||
This file implements the PLGet... functions
|
||||
|
||||
*/
|
||||
|
||||
#include "proplistP.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
char *PLGetStringDescription(proplist_t pl)
|
||||
{
|
||||
/* taken from NSString.m */
|
||||
|
||||
const char *src;
|
||||
char *dest;
|
||||
char *src_ptr,*dest_ptr;
|
||||
int len,quote;
|
||||
unsigned char ch;
|
||||
plptr_t internal;
|
||||
|
||||
internal = (plptr_t)pl;
|
||||
src = internal->t.str.string;
|
||||
|
||||
/* special case */
|
||||
if (strlen(src)==0)
|
||||
{
|
||||
dest = (char*) MyMalloc(__FILE__, __LINE__, 3);
|
||||
strcpy(dest, "\"\"");
|
||||
return dest;
|
||||
}
|
||||
|
||||
/* FIXME: Really should make this work with unichars. */
|
||||
|
||||
#define inrange(ch,min,max) ((ch)>=(min) && (ch)<=(max))
|
||||
#define noquote(ch) (inrange(ch,'a','z') || inrange(ch,'A','Z') || inrange(ch,'0','9') || ((ch)=='_') || ((ch)=='.') || ((ch)=='$'))
|
||||
#define charesc(ch) (inrange(ch,07,014) || ((ch)=='\"') || ((ch)=='\\'))
|
||||
#define numesc(ch) (((ch)<=06) || inrange(ch,015,037) || ((ch)>0176))
|
||||
|
||||
for (src_ptr = (char*)src, len=0,quote=0;
|
||||
(ch=*src_ptr);
|
||||
src_ptr++, len++)
|
||||
{
|
||||
if (!noquote(ch))
|
||||
{
|
||||
quote=1;
|
||||
if (charesc(ch))
|
||||
len++;
|
||||
else if (numesc(ch))
|
||||
len+=3;
|
||||
}
|
||||
}
|
||||
|
||||
/* Zero-length strings must be quoted or they will trigger parse
|
||||
errors. */
|
||||
if (*src == '\0')
|
||||
quote = 1;
|
||||
|
||||
if (quote)
|
||||
len+=2;
|
||||
|
||||
dest = (char*) MyMalloc(__FILE__, __LINE__, len+1);
|
||||
|
||||
src_ptr = (char*) src;
|
||||
dest_ptr = dest;
|
||||
if (quote)
|
||||
*(dest_ptr++) = '\"';
|
||||
for (; (ch=*src_ptr); src_ptr++,dest_ptr++)
|
||||
{
|
||||
if (charesc(ch))
|
||||
{
|
||||
*(dest_ptr++) = '\\';
|
||||
switch (ch)
|
||||
{
|
||||
case '\a': *dest_ptr = 'a'; break;
|
||||
case '\b': *dest_ptr = 'b'; break;
|
||||
case '\t': *dest_ptr = 't'; break;
|
||||
case '\n': *dest_ptr = 'n'; break;
|
||||
case '\v': *dest_ptr = 'v'; break;
|
||||
case '\f': *dest_ptr = 'f'; break;
|
||||
default: *dest_ptr = ch; /* " or \ */
|
||||
}
|
||||
}
|
||||
else if (numesc(ch))
|
||||
{
|
||||
*(dest_ptr++) = '\\';
|
||||
*(dest_ptr++) = '0' + ((ch>>6)&07);
|
||||
*(dest_ptr++) = '0' + ((ch>>3)&07);
|
||||
*dest_ptr = '0' + (ch&07);
|
||||
}
|
||||
else
|
||||
{ /* copy literally */
|
||||
*dest_ptr = ch;
|
||||
}
|
||||
}
|
||||
if (quote)
|
||||
*(dest_ptr++) = '\"';
|
||||
*dest_ptr = '\0';
|
||||
|
||||
return dest;
|
||||
#undef inrange
|
||||
#undef noquote
|
||||
#undef charesc
|
||||
#undef numesc
|
||||
}
|
||||
|
||||
char *PLGetString(proplist_t pl)
|
||||
{
|
||||
/* char *retstr = (char *)MyMalloc(__FILE__, __LINE__, strlen(((plptr_t)pl)->t.str.string)+1);
|
||||
strcpy(retstr, ((plptr_t)pl)->t.str.string);
|
||||
return retstr; */
|
||||
return ((plptr_t)pl)->t.str.string;
|
||||
}
|
||||
|
||||
|
||||
char *PLGetDataDescription(proplist_t pl)
|
||||
{
|
||||
/* taken from NSData.m */
|
||||
|
||||
plptr_t internal;
|
||||
int length;
|
||||
char *retstr;
|
||||
int i, j;
|
||||
|
||||
internal = (plptr_t)pl;
|
||||
|
||||
#define num2char(num) ((num) < 0xa ? ((num)+'0') : ((num)+0x57))
|
||||
length = internal->t.data.length;
|
||||
retstr = (char *)MyMalloc(__FILE__, __LINE__, 2*length+length/4+3);
|
||||
retstr[0]='<';
|
||||
for(i=0,j=1; i<length; i++,j++)
|
||||
{
|
||||
retstr[j++]=num2char((internal->t.data.data[i]>>4) & 0x0f);
|
||||
retstr[j]=num2char(internal->t.data.data[i] & 0x0f);
|
||||
if((i&0x3)==3 && i!=length-1)
|
||||
/* if we've just finished a 32-bit int, print a space */
|
||||
retstr[++j]=' ';
|
||||
}
|
||||
retstr[j++]='>';
|
||||
retstr[j]='\0';
|
||||
return retstr;
|
||||
#undef num2char
|
||||
}
|
||||
|
||||
unsigned int PLGetDataLength(proplist_t pl)
|
||||
{
|
||||
plptr_t internal = (plptr_t)pl;
|
||||
|
||||
return internal->t.data.length;
|
||||
}
|
||||
|
||||
unsigned char *PLGetDataBytes(proplist_t pl)
|
||||
{
|
||||
plptr_t internal = (plptr_t)pl;
|
||||
|
||||
return internal->t.data.data;
|
||||
}
|
||||
|
||||
|
||||
char *PLGetDescriptionIndent(proplist_t pl, unsigned int level)
|
||||
{
|
||||
int i;
|
||||
char *retstr;
|
||||
char *tmpstr, *tmpstr2;
|
||||
char *kdesc, *vdesc;
|
||||
plptr_t internal;
|
||||
|
||||
retstr = PLGetDescription(pl);
|
||||
if((2*(level+1)+strlen(retstr))<=75)
|
||||
return retstr;
|
||||
|
||||
MyFree(__FILE__, __LINE__, retstr);
|
||||
|
||||
internal = (plptr_t)pl;
|
||||
switch(internal->type)
|
||||
{
|
||||
case PLSTRING:
|
||||
return PLGetStringDescription(pl);
|
||||
break;
|
||||
|
||||
case PLDATA:
|
||||
return PLGetDataDescription(pl);
|
||||
break;
|
||||
|
||||
case PLARRAY:
|
||||
retstr = (char *)MyMalloc(__FILE__, __LINE__, 3);
|
||||
sprintf(retstr, "(\n");
|
||||
if(internal->t.array.number>0)
|
||||
{
|
||||
tmpstr=PLGetDescriptionIndent(internal->t.array.elements[0],
|
||||
level+1);
|
||||
tmpstr2=(char *)MyMalloc(__FILE__, __LINE__, 2*(level+1)+strlen(retstr)+strlen(tmpstr)+1);
|
||||
sprintf(tmpstr2, "%s%*s%s", retstr, 2*(level+1), "", tmpstr);
|
||||
MyFree(__FILE__, __LINE__, tmpstr);
|
||||
MyFree(__FILE__, __LINE__, retstr);
|
||||
retstr=tmpstr2;
|
||||
}
|
||||
for(i=1;i<internal->t.array.number;i++)
|
||||
{
|
||||
tmpstr=PLGetDescriptionIndent(internal->t.array.elements[i],
|
||||
level+1);
|
||||
tmpstr2=(char *)MyMalloc(__FILE__, __LINE__, 2*(level+1)+strlen(retstr)+strlen(tmpstr)+3);
|
||||
sprintf(tmpstr2, "%s,\n%*s%s", retstr, 2*(level+1), "", tmpstr);
|
||||
MyFree(__FILE__, __LINE__, tmpstr);
|
||||
MyFree(__FILE__, __LINE__, retstr);
|
||||
retstr=tmpstr2;
|
||||
}
|
||||
tmpstr=(char *)MyMalloc(__FILE__, __LINE__, strlen(retstr)+2*level+3);
|
||||
sprintf(tmpstr, "%s\n%*s)", retstr, 2*level, "");
|
||||
MyFree(__FILE__, __LINE__, retstr);
|
||||
retstr=tmpstr;
|
||||
break;
|
||||
|
||||
case PLDICTIONARY:
|
||||
retstr = (char *)MyMalloc(__FILE__, __LINE__, 3);
|
||||
sprintf(retstr, "{\n");
|
||||
for(i=0;i<internal->t.dict.number;i++)
|
||||
{
|
||||
kdesc = PLGetDescriptionIndent(internal->t.dict.keys[i],
|
||||
level+1);
|
||||
vdesc = PLGetDescriptionIndent(internal->t.dict.values[i],
|
||||
level+1);
|
||||
|
||||
tmpstr=(char *)MyMalloc(__FILE__, __LINE__, 2*(level+1)+strlen(retstr)+
|
||||
strlen(kdesc)+strlen(vdesc)+6);
|
||||
sprintf(tmpstr, "%s%*s%s = %s;\n", retstr, 2*(level+1), "",
|
||||
kdesc, vdesc);
|
||||
MyFree(__FILE__, __LINE__, kdesc);
|
||||
MyFree(__FILE__, __LINE__, vdesc);
|
||||
MyFree(__FILE__, __LINE__, retstr);
|
||||
retstr=tmpstr;
|
||||
}
|
||||
tmpstr=(char *)MyMalloc(__FILE__, __LINE__, strlen(retstr)+2*level+2);
|
||||
sprintf(tmpstr, "%s%*s}", retstr, 2*level, "");
|
||||
MyFree(__FILE__, __LINE__, retstr);
|
||||
retstr=tmpstr;
|
||||
}
|
||||
|
||||
return retstr;
|
||||
}
|
||||
|
||||
char *PLGetDescription(proplist_t pl)
|
||||
{
|
||||
int i;
|
||||
char *retstr = NULL;
|
||||
char *tmpstr, *tmpstr2;
|
||||
plptr_t internal;
|
||||
|
||||
internal = (plptr_t)pl;
|
||||
switch(internal->type)
|
||||
{
|
||||
case PLSTRING:
|
||||
return PLGetStringDescription(pl);
|
||||
break;
|
||||
|
||||
case PLDATA:
|
||||
return PLGetDataDescription(pl);
|
||||
break;
|
||||
|
||||
case PLARRAY:
|
||||
retstr = (char *)MyMalloc(__FILE__, __LINE__, 2);
|
||||
sprintf(retstr, "(");
|
||||
if(internal->t.array.number>0)
|
||||
{
|
||||
tmpstr=PLGetDescription(internal->t.array.elements[0]);
|
||||
tmpstr2=(char *)MyMalloc(__FILE__, __LINE__, strlen(retstr)+strlen(tmpstr)+1);
|
||||
sprintf(tmpstr2, "%s%s", retstr, tmpstr);
|
||||
MyFree(__FILE__, __LINE__, tmpstr);
|
||||
MyFree(__FILE__, __LINE__, retstr);
|
||||
retstr=tmpstr2;
|
||||
}
|
||||
for(i=1;i<internal->t.array.number;i++)
|
||||
{
|
||||
tmpstr=PLGetDescription(internal->t.array.elements[i]);
|
||||
tmpstr2=(char *)MyMalloc(__FILE__, __LINE__, strlen(retstr)+strlen(tmpstr)+3);
|
||||
sprintf(tmpstr2, "%s, %s", retstr, tmpstr);
|
||||
MyFree(__FILE__, __LINE__, tmpstr);
|
||||
MyFree(__FILE__, __LINE__, retstr);
|
||||
retstr=tmpstr2;
|
||||
}
|
||||
tmpstr=(char *)MyMalloc(__FILE__, __LINE__, strlen(retstr)+2);
|
||||
sprintf(tmpstr, "%s)", retstr);
|
||||
MyFree(__FILE__, __LINE__, retstr);
|
||||
retstr=tmpstr;
|
||||
break;
|
||||
|
||||
case PLDICTIONARY:
|
||||
retstr = (char *)MyMalloc(__FILE__, __LINE__, 2);
|
||||
sprintf(retstr, "{");
|
||||
for(i=0;i<internal->t.dict.number;i++)
|
||||
{
|
||||
tmpstr=PLGetDescription(internal->t.dict.keys[i]);
|
||||
tmpstr2=(char *)MyMalloc(__FILE__, __LINE__, strlen(retstr)+strlen(tmpstr)+4);
|
||||
sprintf(tmpstr2, "%s%s = ", retstr, tmpstr);
|
||||
MyFree(__FILE__, __LINE__, tmpstr);
|
||||
MyFree(__FILE__, __LINE__, retstr);
|
||||
retstr=tmpstr2;
|
||||
tmpstr=PLGetDescription(internal->t.dict.values[i]);
|
||||
tmpstr2=(char *)MyMalloc(__FILE__, __LINE__, strlen(retstr)+strlen(tmpstr)+2);
|
||||
sprintf(tmpstr2, "%s%s;", retstr, tmpstr);
|
||||
MyFree(__FILE__, __LINE__, tmpstr);
|
||||
MyFree(__FILE__, __LINE__, retstr);
|
||||
retstr=tmpstr2;
|
||||
}
|
||||
tmpstr=(char *)MyMalloc(__FILE__, __LINE__, strlen(retstr)+2);
|
||||
sprintf(tmpstr, "%s}", retstr);
|
||||
MyFree(__FILE__, __LINE__, retstr);
|
||||
retstr=tmpstr;
|
||||
}
|
||||
|
||||
return retstr;
|
||||
}
|
||||
|
||||
unsigned int PLGetNumberOfElements(proplist_t pl)
|
||||
{
|
||||
plptr_t internal;
|
||||
|
||||
if(!PLIsCompound(pl)) return 0;
|
||||
|
||||
internal = (plptr_t)pl;
|
||||
switch(internal->type)
|
||||
{
|
||||
case PLARRAY:
|
||||
return internal->t.array.number;
|
||||
case PLDICTIONARY:
|
||||
return internal->t.dict.number;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
proplist_t PLGetArrayElement(proplist_t pl, unsigned int index)
|
||||
{
|
||||
plptr_t internal;
|
||||
|
||||
internal = (plptr_t)pl;
|
||||
if(index>internal->t.array.number-1)
|
||||
return NULL;
|
||||
return internal->t.array.elements[index];
|
||||
}
|
||||
|
||||
proplist_t PLGetAllDictionaryKeys(proplist_t pl)
|
||||
{
|
||||
plptr_t internal;
|
||||
proplist_t ret;
|
||||
int i;
|
||||
|
||||
internal = (plptr_t)pl;
|
||||
|
||||
ret = PLMakeArrayFromElements(NULL);
|
||||
for(i=0;i<internal->t.dict.number;i++)
|
||||
PLAppendArrayElement(ret, internal->t.dict.keys[i]);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
proplist_t PLGetDictionaryEntry(proplist_t pl, proplist_t key)
|
||||
{
|
||||
int i;
|
||||
plptr_t internal;
|
||||
|
||||
internal = (plptr_t)pl;
|
||||
if(!internal) return NULL;
|
||||
if(internal->type != PLDICTIONARY)
|
||||
return NULL;
|
||||
|
||||
for(i=0;i<internal->t.dict.number;i++)
|
||||
if(PLIsEqual(internal->t.dict.keys[i], key))
|
||||
return internal->t.dict.values[i];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
proplist_t PLGetContainer(proplist_t pl)
|
||||
{
|
||||
plptr_t internal = (plptr_t)pl;
|
||||
return internal->container;
|
||||
}
|
||||
|
|
@ -1,251 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||
#
|
||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||
# documentation for any purpose is hereby granted without fee, provided that
|
||||
# the above copyright notice appear in all copies and that both that
|
||||
# copyright notice and this permission notice appear in supporting
|
||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||
# publicity pertaining to distribution of the software without specific,
|
||||
# written prior permission. M.I.T. makes no representations about the
|
||||
# suitability of this software for any purpose. It is provided "as is"
|
||||
# without express or implied warranty.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch. It can only install one file at a time, a restriction
|
||||
# shared with many OS's install programs.
|
||||
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
transformbasename=""
|
||||
transform_arg=""
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
# this colon is to work around a 386BSD /bin/sh bug
|
||||
:
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
chmodcmd=""
|
||||
else
|
||||
instcmd=mkdir
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f $src -o -d $src ]
|
||||
then
|
||||
true
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d $dst ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
else
|
||||
true
|
||||
fi
|
||||
fi
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
oIFS="${IFS}"
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
|
||||
pathcomp=''
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
shift
|
||||
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp &&
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
|
||||
fi &&
|
||||
|
||||
|
||||
exit 0
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,210 +0,0 @@
|
|||
/* memhandling.c: This is -*- c -*-
|
||||
|
||||
This file contains destroying / copying / retaining functions.
|
||||
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
/* for SunOS */
|
||||
#ifndef NULL
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
|
||||
#include "proplist.h"
|
||||
#include "proplistP.h"
|
||||
#include "util.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
unsigned long num_objects;
|
||||
#endif
|
||||
|
||||
|
||||
void PLRelease(proplist_t pl)
|
||||
{
|
||||
plptr_t internal;
|
||||
int i;
|
||||
|
||||
internal = (plptr_t)pl;
|
||||
internal->retain_count--;
|
||||
#ifdef DEBUG
|
||||
num_objects--;
|
||||
printf("Releasing object %s\n", PLGetDescription(pl));
|
||||
printf("\t(count: %ld, num_objects: %ld)\n", internal->retain_count,
|
||||
num_objects);
|
||||
#endif
|
||||
|
||||
switch(internal->type)
|
||||
{
|
||||
case PLSTRING:
|
||||
if(!internal->retain_count)
|
||||
{
|
||||
if(internal->t.str.string)
|
||||
MyFree(__FILE__, __LINE__, internal->t.str.string);
|
||||
if(internal->filename)
|
||||
PLRelease(internal->filename);
|
||||
MyFree(__FILE__, __LINE__, pl);
|
||||
}
|
||||
break;
|
||||
case PLDATA:
|
||||
if(!internal->retain_count)
|
||||
{
|
||||
if(internal->t.data.data)
|
||||
MyFree(__FILE__, __LINE__, internal->t.data.data);
|
||||
if(internal->filename)
|
||||
PLRelease(internal->filename);
|
||||
MyFree(__FILE__, __LINE__, pl);
|
||||
}
|
||||
break;
|
||||
case PLARRAY:
|
||||
for(i=0;i<internal->t.array.number;i++)
|
||||
PLRelease(internal->t.array.elements[i]);
|
||||
if(!internal->retain_count)
|
||||
{
|
||||
if(internal->t.array.elements)
|
||||
MyFree(__FILE__, __LINE__, internal->t.array.elements);
|
||||
if(internal->filename)
|
||||
PLRelease(internal->filename);
|
||||
MyFree(__FILE__, __LINE__, pl);
|
||||
}
|
||||
break;
|
||||
case PLDICTIONARY:
|
||||
for(i=0;i<internal->t.dict.number;i++)
|
||||
{
|
||||
PLRelease(internal->t.dict.keys[i]);
|
||||
PLRelease(internal->t.dict.values[i]);
|
||||
}
|
||||
if(!internal->retain_count)
|
||||
{
|
||||
if(internal->t.dict.keys)
|
||||
MyFree(__FILE__, __LINE__, internal->t.dict.keys);
|
||||
if(internal->t.dict.values)
|
||||
MyFree(__FILE__, __LINE__, internal->t.dict.values);
|
||||
if(internal->filename)
|
||||
PLRelease(internal->filename);
|
||||
MyFree(__FILE__, __LINE__, pl);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
proplist_t PLShallowCopy(proplist_t pl)
|
||||
{
|
||||
plptr_t internal;
|
||||
proplist_t ret;
|
||||
int i;
|
||||
proplist_t allkeys, key, value;
|
||||
|
||||
internal = (plptr_t)pl;
|
||||
|
||||
switch(internal->type)
|
||||
{
|
||||
case PLSTRING:
|
||||
case PLDATA:
|
||||
return PLDeepCopy(pl);
|
||||
case PLARRAY:
|
||||
ret = PLMakeArrayFromElements(NULL);
|
||||
for(i=0; i<PLGetNumberOfElements(pl); i++)
|
||||
PLAppendArrayElement(ret, PLGetArrayElement(pl, i));
|
||||
return ret;
|
||||
case PLDICTIONARY:
|
||||
ret = PLMakeDictionaryFromEntries(NULL, NULL);
|
||||
allkeys = PLGetAllDictionaryKeys(pl);
|
||||
for(i=0; i<PLGetNumberOfElements(allkeys); i++)
|
||||
{
|
||||
key = PLGetArrayElement(allkeys, i);
|
||||
value = PLGetDictionaryEntry(pl, key);
|
||||
PLInsertDictionaryEntry(ret, key, value);
|
||||
}
|
||||
PLRelease(allkeys);
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
proplist_t PLDeepCopy(proplist_t pl)
|
||||
{
|
||||
plptr_t internal;
|
||||
proplist_t ret;
|
||||
int i;
|
||||
|
||||
internal = (plptr_t)pl;
|
||||
|
||||
switch(internal->type)
|
||||
{
|
||||
case PLSTRING:
|
||||
ret = PLMakeString(internal->t.str.string);
|
||||
if(internal->filename)
|
||||
PLSetFilename(ret, internal->filename);
|
||||
return ret;
|
||||
case PLDATA:
|
||||
ret = PLMakeData(internal->t.data.data,
|
||||
internal->t.data.length);
|
||||
if(internal->filename)
|
||||
PLSetFilename(ret, internal->filename);
|
||||
return ret;
|
||||
case PLARRAY:
|
||||
ret = PLMakeArrayFromElements(NULL);
|
||||
for(i=0;i<internal->t.array.number;i++)
|
||||
{
|
||||
proplist_t el = PLDeepCopy(internal->t.array.elements[i]);
|
||||
PLAppendArrayElement(ret, el);
|
||||
/* PLRelease(el); */
|
||||
}
|
||||
if(internal->filename)
|
||||
PLSetFilename(ret, internal->filename);
|
||||
return ret;
|
||||
case PLDICTIONARY:
|
||||
ret = PLMakeDictionaryFromEntries(NULL, NULL);
|
||||
for(i=0;i<internal->t.dict.number;i++)
|
||||
{
|
||||
proplist_t key, value;
|
||||
key = PLDeepCopy(internal->t.dict.keys[i]);
|
||||
value = PLDeepCopy(internal->t.dict.values[i]);
|
||||
PLInsertDictionaryEntry(ret, key, value);
|
||||
PLRelease(key); PLRelease(value);
|
||||
}
|
||||
if(internal->filename)
|
||||
PLSetFilename(ret, internal->filename);
|
||||
return ret;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
proplist_t PLRetain(proplist_t pl)
|
||||
{
|
||||
plptr_t internal = (plptr_t)pl;
|
||||
int i;
|
||||
|
||||
internal->retain_count++;
|
||||
|
||||
#ifdef DEBUG
|
||||
num_objects++;
|
||||
printf("Retaining object %s\n", PLGetDescription(pl));
|
||||
printf("\t(count: %ld, num_objects: %ld)\n", internal->retain_count, num_objects);
|
||||
#endif
|
||||
|
||||
switch(internal->type)
|
||||
{
|
||||
case PLSTRING:
|
||||
case PLDATA:
|
||||
return pl;
|
||||
case PLARRAY:
|
||||
for(i=0; i<internal->t.array.number; i++)
|
||||
PLRetain(internal->t.array.elements[i]);
|
||||
return pl;
|
||||
case PLDICTIONARY:
|
||||
for(i=0; i<internal->t.dict.number; i++)
|
||||
{
|
||||
PLRetain(internal->t.dict.keys[i]);
|
||||
PLRetain(internal->t.dict.values[i]);
|
||||
}
|
||||
return pl;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
|
@ -1,134 +0,0 @@
|
|||
#! /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
|
|
@ -1,40 +0,0 @@
|
|||
#! /bin/sh
|
||||
# mkinstalldirs --- make directory hierarchy
|
||||
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
|
||||
# Created: 1993-05-16
|
||||
# Public domain
|
||||
|
||||
# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
|
||||
|
||||
errstatus=0
|
||||
|
||||
for file
|
||||
do
|
||||
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
|
||||
shift
|
||||
|
||||
pathcomp=
|
||||
for d
|
||||
do
|
||||
pathcomp="$pathcomp$d"
|
||||
case "$pathcomp" in
|
||||
-* ) pathcomp=./$pathcomp ;;
|
||||
esac
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
echo "mkdir $pathcomp"
|
||||
|
||||
mkdir "$pathcomp" || lasterr=$?
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
errstatus=$lasterr
|
||||
fi
|
||||
fi
|
||||
|
||||
pathcomp="$pathcomp/"
|
||||
done
|
||||
done
|
||||
|
||||
exit $errstatus
|
||||
|
||||
# mkinstalldirs ends here
|
|
@ -1,497 +0,0 @@
|
|||
/* modifying.c: This is -*- c -*- */
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "proplistP.h"
|
||||
#include "util.h"
|
||||
#include "plconf.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
extern unsigned long num_objects;
|
||||
#endif
|
||||
|
||||
proplist_t PLMakeString(char *bytes)
|
||||
{
|
||||
plptr_t internal = (plptr_t)MyMalloc(__FILE__, __LINE__, sizeof(plint_t));
|
||||
internal->type = PLSTRING;
|
||||
internal->filename = NULL;
|
||||
internal->container = NULL;
|
||||
internal->changed = YES;
|
||||
internal->retain_count = 1;
|
||||
|
||||
if(!bytes)
|
||||
internal->t.str.string = NULL;
|
||||
else
|
||||
{
|
||||
internal->t.str.string = (char *)MyMalloc(__FILE__, __LINE__, strlen(bytes)+1);
|
||||
strcpy(internal->t.str.string, bytes);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
num_objects++;
|
||||
printf("Created string %s\n", internal->t.str.string);
|
||||
printf("\t(count: %ld, num_objects: %ld)\n", internal->retain_count,
|
||||
num_objects);
|
||||
#endif
|
||||
|
||||
return (proplist_t)internal;
|
||||
}
|
||||
|
||||
proplist_t PLMakeData(unsigned char *data, unsigned int length)
|
||||
{
|
||||
plptr_t internal = (plptr_t)MyMalloc(__FILE__, __LINE__, sizeof(plint_t));
|
||||
internal->type = PLDATA;
|
||||
internal->filename = NULL;
|
||||
internal->container = NULL;
|
||||
internal->changed = YES;
|
||||
internal->retain_count = 1;
|
||||
if(!length)
|
||||
internal->t.data.data = NULL;
|
||||
else
|
||||
{
|
||||
internal->t.data.data = (unsigned char *)MyMalloc(__FILE__, __LINE__, length);
|
||||
memcpy(internal->t.data.data, data, length);
|
||||
}
|
||||
internal->t.data.length = length;
|
||||
#ifdef DEBUG
|
||||
num_objects++;
|
||||
printf("Created data %s\n", PLGetDescription((proplist_t)internal));
|
||||
printf("\t(count: %ld, num_objects: %ld)\n", internal->retain_count,
|
||||
num_objects);
|
||||
#endif
|
||||
return (proplist_t)internal;
|
||||
}
|
||||
|
||||
proplist_t PLMakeArrayFromElements(proplist_t pl, ...)
|
||||
{
|
||||
va_list ap;
|
||||
plptr_t internal = (plptr_t)MyMalloc(__FILE__, __LINE__, sizeof(plint_t));
|
||||
proplist_t current;
|
||||
proplist_t *tmplist;
|
||||
int i;
|
||||
|
||||
internal->type = PLARRAY;
|
||||
internal->filename = NULL;
|
||||
internal->container = NULL;
|
||||
internal->changed = YES;
|
||||
internal->retain_count = 1;
|
||||
internal->t.array.elements = NULL;
|
||||
internal->t.array.number = 0;
|
||||
|
||||
va_start(ap, pl);
|
||||
current = pl;
|
||||
if(!current) /* empty array */
|
||||
{
|
||||
va_end(ap);
|
||||
#ifdef DEBUG
|
||||
num_objects++;
|
||||
printf("Created array %s\n", PLGetDescription((proplist_t)internal));
|
||||
printf("\t(count: %ld, num_objects: %ld)\n",
|
||||
internal->retain_count, num_objects);
|
||||
#endif
|
||||
return (proplist_t)internal;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
PLRetain(current);
|
||||
tmplist = (proplist_t *)MyMalloc(__FILE__, __LINE__, (internal->t.array.number+1)*
|
||||
sizeof(proplist_t));
|
||||
if (internal->t.array.number > 0) {
|
||||
memcpy(tmplist, internal->t.array.elements,
|
||||
internal->t.array.number*sizeof(proplist_t));
|
||||
}
|
||||
tmplist[internal->t.array.number] = current;
|
||||
if(internal->t.array.number > 0)
|
||||
MyFree(__FILE__, __LINE__, internal->t.array.elements);
|
||||
internal->t.array.elements = tmplist;
|
||||
internal->t.array.number++;
|
||||
} while((current = va_arg(ap, proplist_t)));
|
||||
|
||||
va_end(ap);
|
||||
for(i=0;i<internal->t.array.number;i++)
|
||||
{
|
||||
((plptr_t)internal->t.array.elements[i])->container =
|
||||
(proplist_t)internal;
|
||||
((plptr_t)internal->t.array.elements[i])->changed = YES;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
num_objects++;
|
||||
printf("Created array %s\n", PLGetDescription((proplist_t)internal));
|
||||
printf("\t(count: %ld, num_objects: %ld)\n", internal->retain_count,
|
||||
num_objects);
|
||||
#endif
|
||||
return (proplist_t) internal;
|
||||
}
|
||||
|
||||
proplist_t PLInsertArrayElement(proplist_t array, proplist_t pl,
|
||||
unsigned int index)
|
||||
{
|
||||
proplist_t *tmplist;
|
||||
plptr_t internal, tmp;
|
||||
int n;
|
||||
|
||||
internal = (plptr_t)array;
|
||||
|
||||
if(index>internal->t.array.number) return NULL;
|
||||
|
||||
tmplist = (proplist_t *)MyMalloc(__FILE__, __LINE__, (internal->t.array.number+1)*
|
||||
sizeof(proplist_t));
|
||||
if (internal->t.array.number > 0 && index > 0)
|
||||
memcpy(tmplist, internal->t.array.elements, index*sizeof(proplist_t));
|
||||
tmplist[index] = pl;
|
||||
if (internal->t.array.number > index) {
|
||||
memcpy(&(tmplist[index+1]), &(internal->t.array.elements[index]),
|
||||
(internal->t.array.number-index)*sizeof(proplist_t));
|
||||
}
|
||||
if(internal->t.array.number > 0)
|
||||
MyFree(__FILE__, __LINE__, internal->t.array.elements);
|
||||
internal->t.array.elements = tmplist;
|
||||
internal->t.array.number++;
|
||||
|
||||
((plptr_t)internal->t.array.elements[index])->container =
|
||||
(proplist_t)internal;
|
||||
if(internal->filename)
|
||||
PLSetFilename(internal->t.array.elements[index], internal->filename);
|
||||
|
||||
/* We need to retain as many times as the array is already retained
|
||||
* because else if one of the retainers releases the array, we lose
|
||||
* the element and may crash trying to access already free'd memory
|
||||
* from other places where the array is retained. -Dan
|
||||
*/
|
||||
n = internal->retain_count;
|
||||
while (n>0) {
|
||||
PLRetain(pl);
|
||||
n--;
|
||||
}
|
||||
|
||||
internal->changed = YES;
|
||||
|
||||
/*((plptr_t)pl)->changed = YES;*/
|
||||
|
||||
tmp = internal;
|
||||
while((tmp = tmp->container))
|
||||
tmp->changed = YES;
|
||||
|
||||
return (proplist_t) internal;
|
||||
}
|
||||
|
||||
proplist_t PLRemoveArrayElement(proplist_t array, unsigned int index)
|
||||
{
|
||||
proplist_t *tmplist;
|
||||
plptr_t internal, tmp;
|
||||
int n;
|
||||
|
||||
internal = (plptr_t)array;
|
||||
if(index>(internal->t.array.number-1)) return NULL;
|
||||
|
||||
/* This needs to be released as many times as the container array is
|
||||
* retained because else we will lose references to the element and
|
||||
* will leak memory. -Dan
|
||||
*/
|
||||
n = internal->retain_count;
|
||||
while (n > 0) {
|
||||
PLRelease(internal->t.array.elements[index]);
|
||||
n--;
|
||||
}
|
||||
|
||||
if(internal->t.array.number > 1)
|
||||
{
|
||||
tmplist = (proplist_t *)MyMalloc(__FILE__, __LINE__, (internal->t.array.number-1)*
|
||||
sizeof(proplist_t));
|
||||
memcpy(tmplist, internal->t.array.elements, index*sizeof(proplist_t));
|
||||
memcpy(&(tmplist[index]), &(internal->t.array.elements[index+1]),
|
||||
(internal->t.array.number-index-1)*sizeof(proplist_t));
|
||||
}
|
||||
else
|
||||
tmplist = NULL;
|
||||
MyFree(__FILE__, __LINE__, internal->t.array.elements);
|
||||
internal->t.array.elements = tmplist;
|
||||
internal->t.array.number--;
|
||||
|
||||
internal->changed = YES;
|
||||
|
||||
tmp = internal;
|
||||
while((tmp = tmp->container))
|
||||
tmp->changed = YES;
|
||||
|
||||
return (proplist_t) internal;
|
||||
}
|
||||
|
||||
proplist_t PLAppendArrayElement(proplist_t array, proplist_t pl)
|
||||
{
|
||||
return PLInsertArrayElement(array, pl, ((plptr_t)array)->t.array.number);
|
||||
}
|
||||
|
||||
proplist_t PLMakeDictionaryFromEntries(proplist_t key, proplist_t value,
|
||||
...)
|
||||
{
|
||||
va_list ap;
|
||||
plptr_t internal;
|
||||
proplist_t current_key, current_value;
|
||||
proplist_t *tmp_klist, *tmp_vlist;
|
||||
|
||||
internal = (plptr_t)MyMalloc(__FILE__, __LINE__, sizeof(plint_t));
|
||||
|
||||
internal->type = PLDICTIONARY;
|
||||
internal->filename = NULL;
|
||||
internal->container = NULL;
|
||||
internal->changed = YES;
|
||||
internal->retain_count = 1;
|
||||
internal->t.dict.keys = NULL;
|
||||
internal->t.dict.values = NULL;
|
||||
internal->t.dict.number = 0;
|
||||
|
||||
current_key = key; current_value = value;
|
||||
|
||||
if(!key || !value)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
num_objects++;
|
||||
printf("Created dict %s\n", PLGetDescription((proplist_t)internal));
|
||||
printf("\t(count: %ld, num_objects: %ld)\n",
|
||||
internal->retain_count, num_objects);
|
||||
#endif
|
||||
return internal;
|
||||
}
|
||||
|
||||
va_start(ap, value);
|
||||
|
||||
do
|
||||
{
|
||||
tmp_klist = (proplist_t *)MyMalloc(__FILE__, __LINE__, (internal->t.dict.number+1)*
|
||||
sizeof(proplist_t));
|
||||
tmp_vlist = (proplist_t *)MyMalloc(__FILE__, __LINE__, (internal->t.dict.number+1)*
|
||||
sizeof(proplist_t));
|
||||
if (internal->t.dict.number > 0) {
|
||||
memcpy(tmp_klist, internal->t.dict.keys,
|
||||
internal->t.dict.number*sizeof(proplist_t));
|
||||
memcpy(tmp_vlist, internal->t.dict.values,
|
||||
internal->t.dict.number*sizeof(proplist_t));
|
||||
}
|
||||
tmp_klist[internal->t.dict.number] = current_key;
|
||||
((plptr_t)current_key)->container = internal;
|
||||
tmp_vlist[internal->t.dict.number] = current_value;
|
||||
((plptr_t)current_value)->container = internal;
|
||||
|
||||
if(internal->t.dict.number)
|
||||
{
|
||||
MyFree(__FILE__, __LINE__, internal->t.dict.keys);
|
||||
MyFree(__FILE__, __LINE__, internal->t.dict.values);
|
||||
}
|
||||
internal->t.dict.keys = tmp_klist;
|
||||
internal->t.dict.values = tmp_vlist;
|
||||
|
||||
((plptr_t)current_key)->changed = YES;
|
||||
((plptr_t)current_value)->changed = YES;
|
||||
PLRetain(current_key); PLRetain(current_value);
|
||||
|
||||
internal->t.dict.number++;
|
||||
|
||||
current_key = va_arg(ap, proplist_t);
|
||||
if(!current_key)
|
||||
{
|
||||
va_end(ap);
|
||||
#ifdef DEBUG
|
||||
num_objects++;
|
||||
printf("Created dict %s\n", PLGetDescription((proplist_t)internal));
|
||||
printf("\t(count: %ld, num_objects: %ld)\n",
|
||||
internal->retain_count, num_objects);
|
||||
#endif
|
||||
return internal;
|
||||
}
|
||||
current_value = va_arg(ap, proplist_t);
|
||||
if(!current_value)
|
||||
{
|
||||
va_end(ap);
|
||||
#ifdef DEBUG
|
||||
num_objects++;
|
||||
printf("Created dict %s\n", PLGetDescription((proplist_t)internal));
|
||||
printf("\t(count: %ld, num_objects: %ld)\n",
|
||||
internal->retain_count, num_objects);
|
||||
#endif
|
||||
return internal;
|
||||
}
|
||||
} while(1);
|
||||
}
|
||||
|
||||
proplist_t PLInsertDictionaryEntry(proplist_t dict, proplist_t key,
|
||||
proplist_t value)
|
||||
{
|
||||
plptr_t internal, tmp;
|
||||
proplist_t *tmp_klist, *tmp_vlist;
|
||||
int n;
|
||||
|
||||
if(!key || !value) return NULL;
|
||||
|
||||
if(PLGetDictionaryEntry(dict, key))
|
||||
PLRemoveDictionaryEntry(dict, key);
|
||||
|
||||
internal = (plptr_t)dict;
|
||||
|
||||
tmp_klist = (proplist_t *) MyMalloc(__FILE__, __LINE__,
|
||||
(internal->t.dict.number+1)*
|
||||
sizeof(proplist_t));
|
||||
tmp_vlist = (proplist_t *) MyMalloc(__FILE__, __LINE__,
|
||||
(internal->t.dict.number+1)*
|
||||
sizeof(proplist_t));
|
||||
if (internal->t.dict.number > 0) {
|
||||
memcpy(tmp_klist, internal->t.dict.keys,
|
||||
internal->t.dict.number*sizeof(proplist_t));
|
||||
memcpy(tmp_vlist, internal->t.dict.values,
|
||||
internal->t.dict.number*sizeof(proplist_t));
|
||||
}
|
||||
tmp_klist[internal->t.dict.number] = key;
|
||||
tmp_vlist[internal->t.dict.number] = value;
|
||||
|
||||
if(internal->t.dict.number)
|
||||
{
|
||||
MyFree(__FILE__, __LINE__, internal->t.dict.keys);
|
||||
MyFree(__FILE__, __LINE__, internal->t.dict.values);
|
||||
}
|
||||
internal->t.dict.keys = tmp_klist;
|
||||
internal->t.dict.values = tmp_vlist;
|
||||
|
||||
/* This is a total mess. a proplist item can have only one container,
|
||||
* but it can be inserted in many places (dictionaries or arrays).
|
||||
* Each time is inserted in another place its container changes accordingly.
|
||||
* But if its last container is released, accessing it from the other
|
||||
* places will cause an invalid memory pointer and very likely a crash, when
|
||||
* the while((tmp = tmp->container)) stuff is done below.
|
||||
* The only way to avoid this is to PLDeepCopy the object not to use the
|
||||
* retain mechanism with all the consequences, making the advantadges of
|
||||
* retaining be lost. -Dan
|
||||
*
|
||||
* Here is an example to make things clearer:
|
||||
* we have 2 dictionaries dict1 and dict2, and our object obj
|
||||
* PLInsertDictionaryEntry(dict1, key, obj);
|
||||
* obj->container = dict1
|
||||
* obj->retain_count = 1
|
||||
* PLInsertDictionaryEntry(dict2, key, obj);
|
||||
* obj->container = dict2
|
||||
* obj->retain_count = 2
|
||||
* PLRelease(dict2);
|
||||
* obj->container = dict2 !!!
|
||||
* obj->retain_count = 1
|
||||
*
|
||||
* Now if obj is a dict itself and you try to do something like:
|
||||
* PLInsertDictionaryEntry(obj, key1, value1);
|
||||
* it will crash when tmp->container will read the old released dict2
|
||||
* in the while() below.
|
||||
* Also trying to synchronize dict1 can have the same result.
|
||||
*
|
||||
* Note that obj is a valid object at this point since it was retained
|
||||
* and still exist.
|
||||
*
|
||||
*/
|
||||
((plptr_t)key)->container = internal;
|
||||
((plptr_t)value)->container = internal;
|
||||
|
||||
internal->t.dict.number++;
|
||||
|
||||
if(internal->filename)
|
||||
{
|
||||
PLSetFilename(key, internal->filename);
|
||||
PLSetFilename(value, internal->filename);
|
||||
}
|
||||
|
||||
internal->changed = YES;
|
||||
|
||||
/* here will be the problem noted above */
|
||||
tmp = internal;
|
||||
while((tmp = tmp->container))
|
||||
tmp->changed = YES;
|
||||
|
||||
|
||||
/* We need to retain as many times as the dict is already retained
|
||||
* because else if one of the retainers releases the dict, we lose
|
||||
* the key and value and may crash trying to access already free'd
|
||||
* memory from other places where the dict is retained. -Dan
|
||||
*/
|
||||
n = internal->retain_count;
|
||||
while (n > 0) {
|
||||
PLRetain(key);
|
||||
PLRetain(value);
|
||||
n--;
|
||||
}
|
||||
|
||||
return (proplist_t) internal;
|
||||
}
|
||||
|
||||
proplist_t PLRemoveDictionaryEntry(proplist_t dict, proplist_t key)
|
||||
{
|
||||
plptr_t internal, tmp;
|
||||
proplist_t *tmp_klist, *tmp_vlist;
|
||||
int i, n;
|
||||
|
||||
if(!PLGetDictionaryEntry(dict, key)) return NULL;
|
||||
|
||||
internal = (plptr_t)dict;
|
||||
|
||||
i=0;
|
||||
while(!PLIsEqual(internal->t.dict.keys[i], key))
|
||||
i++;
|
||||
|
||||
/* This needs to be released as many times as the container dict is
|
||||
* retained because else we will lose references to the key and value
|
||||
* and will leak memory. -Dan
|
||||
*/
|
||||
n = internal->retain_count;
|
||||
while (n > 0) {
|
||||
PLRelease(internal->t.dict.keys[i]);
|
||||
PLRelease(internal->t.dict.values[i]);
|
||||
n--;
|
||||
}
|
||||
|
||||
if(internal->t.dict.number > 1)
|
||||
{
|
||||
tmp_klist = (proplist_t *)MyMalloc(__FILE__, __LINE__, (internal->t.dict.number-1)*
|
||||
sizeof(proplist_t));
|
||||
tmp_vlist = (proplist_t *)MyMalloc(__FILE__, __LINE__, (internal->t.dict.number-1)*
|
||||
sizeof(proplist_t));
|
||||
memcpy(tmp_klist, internal->t.dict.keys, i*sizeof(proplist_t));
|
||||
memcpy(&(tmp_klist[i]), &(internal->t.dict.keys[i+1]),
|
||||
(internal->t.dict.number-i-1)*sizeof(proplist_t));
|
||||
memcpy(tmp_vlist, internal->t.dict.values, i*sizeof(proplist_t));
|
||||
memcpy(&(tmp_vlist[i]), &(internal->t.dict.values[i+1]),
|
||||
(internal->t.dict.number-i-1)*sizeof(proplist_t));
|
||||
|
||||
MyFree(__FILE__, __LINE__, internal->t.dict.keys);
|
||||
MyFree(__FILE__, __LINE__, internal->t.dict.values);
|
||||
internal->t.dict.keys = tmp_klist;
|
||||
internal->t.dict.values = tmp_vlist;
|
||||
}
|
||||
else
|
||||
{
|
||||
MyFree(__FILE__, __LINE__, internal->t.dict.keys);
|
||||
MyFree(__FILE__, __LINE__, internal->t.dict.values);
|
||||
internal->t.dict.keys = NULL;
|
||||
internal->t.dict.values = NULL;
|
||||
}
|
||||
|
||||
internal->t.dict.number--;
|
||||
internal->changed = YES;
|
||||
|
||||
tmp = internal;
|
||||
while((tmp = tmp->container))
|
||||
tmp->changed = YES;
|
||||
|
||||
return internal;
|
||||
}
|
||||
|
||||
proplist_t PLMergeDictionaries(proplist_t dest, proplist_t source)
|
||||
{
|
||||
plptr_t int_source;
|
||||
int i;
|
||||
|
||||
int_source = (plptr_t)source;
|
||||
for(i=0;i<int_source->t.dict.number;i++)
|
||||
PLInsertDictionaryEntry(dest, int_source->t.dict.keys[i],
|
||||
int_source->t.dict.values[i]);
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
/* plconf.h:
|
||||
|
||||
Contains configuration values for libPropList, and gsdd.
|
||||
|
||||
*/
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
/* define MEMDEBUG if you think gsdd and / or proplist has a memory
|
||||
leak. The output this generates is VERY verbose (a line for every
|
||||
malloc / free), so you may want to pipe it into a file and run it
|
||||
through tools/findleak.tcl. */
|
||||
/*#define MEMDEBUG*/
|
||||
|
||||
/* define DEBUG if you think something's wrong with the retain /
|
||||
release stuff. This, too, generates very verbose output. */
|
||||
/* #define DEBUG */
|
||||
|
||||
/* The file the defaults are actually stored in. If USEMULTIPLEFILES
|
||||
is defined, this can either be an ASCII file or a directory
|
||||
containing multiple ASCII files. */
|
||||
#define DEFAULTSFILE "~/GNUstep/Defaults"
|
||||
|
||||
/* The file gsdd stores its process id and the port it's listening on
|
||||
in. Tilde notation is supported. If this file is present, the
|
||||
library (and gsdd) will assume that there is a daemon present. */
|
||||
#define PIDFILE "~/GNUstep/.AppInfo/gsdd.pid"
|
||||
|
||||
/* The name of the gsdd binary. The library needs this to start the
|
||||
daemon if it isn't present. Tilde notation is supported. */
|
||||
#define DAEMON DAEMON_PATH
|
||||
|
||||
/* Port numbers. gsdd will try to bind to a port between MINPORT and
|
||||
MAXPORT. */
|
||||
#define MINPORT 5000
|
||||
#define MAXPORT 5100
|
||||
|
||||
/* The time the daemon has to start up (i.e. create PIDFILE). */
|
||||
#define TIMEOUT 2
|
||||
|
||||
/* The signal sent to processes requesting to be kicked on domain
|
||||
change. The library handles this signal. */
|
||||
#define SIGNAL SIGHUP
|
||||
|
||||
#endif /* CONFIG_H */
|
File diff suppressed because it is too large
Load diff
|
@ -1,184 +0,0 @@
|
|||
/* proplist.h: This is -*- c -*-
|
||||
|
||||
Copyright (c) 1997 Bjoern Giesler <giesler@ira.uka.de>
|
||||
libPropList and this file are subject to the GNU Library Public License
|
||||
(LPL). You should have received a copy of that license; it's in the
|
||||
file COPYING.LIB.
|
||||
|
||||
Interface declaration for the property-list handling library. This
|
||||
library allows plain C programs to use (read and write)
|
||||
GNUstep-style property lists. It defines the opaque data type
|
||||
proplist_t. An element of type proplist_t can be a string, an
|
||||
array, a dictionary or a data object.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PROPLIST_H
|
||||
#define PROPLIST_H
|
||||
|
||||
|
||||
/* Version number: 0.10.1
|
||||
* Use 2 digits for each number in version - like 00.10.01 but without
|
||||
* decimal dots and leading zeros
|
||||
*/
|
||||
#define PROPLIST_VERSION 1001
|
||||
|
||||
|
||||
|
||||
#ifndef BOOL
|
||||
#define BOOL int
|
||||
#endif /* !def BOOL */
|
||||
#ifndef YES
|
||||
#define YES 1
|
||||
#define NO 0
|
||||
#endif /* !def YES */
|
||||
|
||||
typedef void *proplist_t;
|
||||
|
||||
typedef void (*plcallback_t)(void);
|
||||
|
||||
|
||||
/*
|
||||
* Vanilla file-handling stuff
|
||||
*/
|
||||
|
||||
/* Return a pointer to a proplist structure if successful, NULL otherwise */
|
||||
proplist_t PLGetProplistWithDescription(const char *description);
|
||||
|
||||
/* Return a pointer to a proplist structure if successful, NULL otherwise */
|
||||
proplist_t PLGetProplistWithPath(const char *filename);
|
||||
|
||||
/* Recursively synchronize the proplist with the file: Returns NO on error */
|
||||
BOOL PLDeepSynchronize(proplist_t pl);
|
||||
|
||||
/* Add this for backward compatibility */
|
||||
#define PLSynchronize(pl) PLDeepSynchronize((pl))
|
||||
|
||||
/* Non-recursively synchronize the proplist with the file: Returns NO on error */
|
||||
BOOL PLShallowSynchronize(proplist_t pl);
|
||||
|
||||
/* Write out to a file. Uses temporary file if atomically==YES. Returns
|
||||
NO on error */
|
||||
BOOL PLSave(proplist_t pl, BOOL atomically);
|
||||
|
||||
/* Get the file name for the property list */
|
||||
proplist_t PLSetFilename(proplist_t pl, proplist_t filename);
|
||||
|
||||
/* Get the file name, or NULL if there isn't any */
|
||||
proplist_t PLGetFilename(proplist_t pl);
|
||||
|
||||
/*
|
||||
* Talking to the daemon
|
||||
*/
|
||||
|
||||
/* Get an array containing all registered domain names. */
|
||||
proplist_t PLGetDomainNames();
|
||||
|
||||
/* Get the named domain from the daemon. If callback is non-NULL, it
|
||||
specifies a function to be called whenever the domain is changed. */
|
||||
proplist_t PLGetDomain(proplist_t name);
|
||||
|
||||
/* Set the specified domain. If kickme is NO, a callback function the
|
||||
program has registered for this domain will not be called. */
|
||||
proplist_t PLSetDomain(proplist_t name, proplist_t value,
|
||||
BOOL kickme);
|
||||
|
||||
/* See above. */
|
||||
proplist_t PLDeleteDomain(proplist_t name, BOOL kickme);
|
||||
|
||||
/* Returns the specified domain, and registers callback to be called
|
||||
whenever domain is changed. Returns name. */
|
||||
proplist_t PLRegister(proplist_t name, plcallback_t callback);
|
||||
|
||||
/* Unregisters callback entries for name, or all callback entries if
|
||||
name is NULL. Returns name. */
|
||||
proplist_t PLUnregister(proplist_t name);
|
||||
|
||||
/*
|
||||
* Test if the proplist is of a certain type
|
||||
*/
|
||||
BOOL PLIsString(proplist_t pl);
|
||||
BOOL PLIsData(proplist_t pl);
|
||||
BOOL PLIsArray(proplist_t pl);
|
||||
BOOL PLIsDictionary(proplist_t pl);
|
||||
BOOL PLIsSimple(proplist_t pl); /* YES if pl is string or data */
|
||||
BOOL PLIsCompound(proplist_t pl); /* YES if pl is array or dictionary */
|
||||
|
||||
/* Returns a reference. Don't free it! */
|
||||
char *PLGetString(proplist_t pl);
|
||||
|
||||
/*
|
||||
* Values of simple types. Note that all these return copies; free the
|
||||
* return value after you're done.
|
||||
*/
|
||||
char *PLGetStringDescription(proplist_t pl);
|
||||
char *PLGetDataDescription(proplist_t pl);
|
||||
unsigned int PLGetDataLength(proplist_t pl);
|
||||
unsigned char *PLGetDataBytes(proplist_t pl);
|
||||
|
||||
/*
|
||||
* The description in proplist format. Free the return value.
|
||||
*/
|
||||
char *PLGetDescriptionIndent(proplist_t pl, unsigned int level);
|
||||
char *PLGetDescription(proplist_t pl);
|
||||
|
||||
|
||||
/*
|
||||
* Descending into compound types. None of these return copies.
|
||||
*/
|
||||
unsigned int PLGetNumberOfElements(proplist_t pl);
|
||||
proplist_t PLGetArrayElement(proplist_t pl, unsigned int index);
|
||||
proplist_t PLGetAllDictionaryKeys(proplist_t pl); /* returns an array */
|
||||
proplist_t PLGetDictionaryEntry(proplist_t pl, proplist_t key);
|
||||
|
||||
/*
|
||||
* Getting the container
|
||||
*/
|
||||
proplist_t PLGetContainer(proplist_t pl);
|
||||
|
||||
/*
|
||||
* Creating simple types
|
||||
*/
|
||||
proplist_t PLMakeString(char *bytes);
|
||||
proplist_t PLMakeData(unsigned char *data, unsigned int length);
|
||||
|
||||
/*
|
||||
* Creating/Changing compound types
|
||||
*/
|
||||
/* Make an array from the given elements. List must be NULL-terminated. */
|
||||
proplist_t PLMakeArrayFromElements(proplist_t pl, ...);
|
||||
/* returns NULL if index out of bounds */
|
||||
proplist_t PLInsertArrayElement(proplist_t array, proplist_t pl,
|
||||
unsigned int index);
|
||||
proplist_t PLRemoveArrayElement(proplist_t array,
|
||||
unsigned int index);
|
||||
proplist_t PLAppendArrayElement(proplist_t array, proplist_t pl);
|
||||
|
||||
proplist_t PLMakeDictionaryFromEntries(proplist_t key, proplist_t value,
|
||||
...);
|
||||
proplist_t PLInsertDictionaryEntry(proplist_t dict, proplist_t key,
|
||||
proplist_t value);
|
||||
proplist_t PLRemoveDictionaryEntry(proplist_t dict, proplist_t key);
|
||||
/* Changes only dest. Copies entries from source. */
|
||||
proplist_t PLMergeDictionaries(proplist_t dest, proplist_t source);
|
||||
|
||||
/*
|
||||
* Destroying and Copying
|
||||
*/
|
||||
|
||||
proplist_t PLShallowCopy(proplist_t pl);
|
||||
proplist_t PLDeepCopy(proplist_t pl);
|
||||
void PLRelease(proplist_t pl);
|
||||
proplist_t PLRetain(proplist_t pl);
|
||||
|
||||
/*
|
||||
* Comparing
|
||||
*/
|
||||
|
||||
BOOL PLIsEqual(proplist_t pl1, proplist_t pl2);
|
||||
void PLSetStringCmpHook(BOOL(*fn)(proplist_t, proplist_t));
|
||||
|
||||
|
||||
#endif /* !def PROPLIST_H */
|
||||
|
||||
|
|
@ -1,177 +0,0 @@
|
|||
/* proplist.l - for parsing NSString property lists -*- c -*- */
|
||||
|
||||
/* definition section */
|
||||
|
||||
/* literal block */
|
||||
%{
|
||||
#include "proplist.h"
|
||||
#include "proplist_y.h"
|
||||
#include "util.h"
|
||||
#include "util.h"
|
||||
|
||||
|
||||
#ifdef yywrap
|
||||
#undef yywrap
|
||||
#endif
|
||||
|
||||
int yywrap(void) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
#define return_data(str) yylval.obj = str2data(str); return DATA
|
||||
|
||||
char * unescstr(char * src);
|
||||
proplist_t str2data(char * str);
|
||||
|
||||
extern char plinput[];
|
||||
extern char *plinputptr;
|
||||
extern char *plinputlim;
|
||||
int pl_line_count = 1;
|
||||
|
||||
|
||||
static int level;
|
||||
%}
|
||||
|
||||
/* pattern definitions */
|
||||
ws [ \t\r]
|
||||
nl \n
|
||||
wsnl [ \t\r\n]
|
||||
hexdigit [0-9A-Fa-f]
|
||||
hexbyte {hexdigit}{2}
|
||||
hexword {hexbyte}{4}
|
||||
hexnum {hexbyte}{1,3}
|
||||
qstring [^"]*\"
|
||||
noquote [$./0-9A-Z_a-z]
|
||||
unqstring {noquote}+
|
||||
hexdata \<{ws}*({hexword}{ws}*)*{hexnum}{0,1}{ws}*\>
|
||||
/* exclusive states */
|
||||
%x QUOTE COMMENT LINE_COMMENT
|
||||
|
||||
/* rules section */
|
||||
%%
|
||||
|
||||
"/*" {++level; BEGIN COMMENT;}
|
||||
"//" {BEGIN LINE_COMMENT;}
|
||||
|
||||
<QUOTE>{qstring} {
|
||||
if(yyleng==1) {
|
||||
BEGIN INITIAL;
|
||||
yylval.obj = PLMakeString("");
|
||||
return STRING;
|
||||
}
|
||||
if(yytext[yyleng-2] == '\\') {
|
||||
yymore();
|
||||
} else {
|
||||
char *unesc;
|
||||
BEGIN INITIAL;
|
||||
unesc = unescstr(yytext);
|
||||
yylval.obj = PLMakeString(unesc);
|
||||
MyFree(__FILE__, __LINE__, unesc);
|
||||
return STRING;
|
||||
}
|
||||
}
|
||||
|
||||
<COMMENT>"*/" {if(!--level) BEGIN INITIAL;}
|
||||
<COMMENT>. ;
|
||||
<COMMENT><<EOF>> {return 0;}
|
||||
|
||||
<LINE_COMMENT>\n {BEGIN INITIAL; pl_line_count++;}
|
||||
<LINE_COMMENT>. ;
|
||||
|
||||
{unqstring} {yylval.obj = PLMakeString(yytext); return STRING;}
|
||||
|
||||
{hexdata} {return_data(yytext);}
|
||||
|
||||
\" {BEGIN QUOTE;}
|
||||
|
||||
{ws}+ ;
|
||||
{nl}+ {pl_line_count += yyleng;} /* skip whitespace */
|
||||
|
||||
<<EOF>> {return 0;}
|
||||
|
||||
. {return yytext[0];} /* return unmatched characters
|
||||
literally*/
|
||||
%%
|
||||
|
||||
/* C code section */
|
||||
#define inrange(ch,min,max) ((ch)>=(min) && (ch)<=(max))
|
||||
#define char2num(ch) \
|
||||
inrange(ch,'0','9') \
|
||||
? ((ch)-0x30) \
|
||||
: (inrange(ch,'a','f') \
|
||||
? ((ch)-0x57) : ((ch)-0x37))
|
||||
|
||||
proplist_t
|
||||
str2data (char *str)
|
||||
{
|
||||
unsigned char *buf, *str_ptr, *buf_ptr;
|
||||
char ch;
|
||||
int len;
|
||||
proplist_t data;
|
||||
|
||||
buf=(unsigned char *)MyMalloc(__FILE__, __LINE__, strlen(str));
|
||||
|
||||
for (str_ptr=(unsigned char *)str+1, buf_ptr=buf,len=0;
|
||||
(ch = *str_ptr) != '>';
|
||||
str_ptr++)
|
||||
{
|
||||
if(ch==' ' || ch=='\n' || ch=='\t' || ch=='\r')
|
||||
continue; /* ignore whitespace */
|
||||
*buf_ptr = (char2num(ch))<<4;
|
||||
ch = *++str_ptr;
|
||||
*buf_ptr |= char2num(ch);
|
||||
len++; buf_ptr++;
|
||||
}
|
||||
|
||||
data = PLMakeData(buf,len);
|
||||
MyFree(__FILE__, __LINE__, buf);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
char *
|
||||
unescstr (char *src)
|
||||
{
|
||||
char *dest=(char*) MyMalloc (__FILE__, __LINE__, strlen(src));
|
||||
char *src_ptr, *dest_ptr;
|
||||
char ch;
|
||||
|
||||
/* blow away that terminating quote for good measure */
|
||||
src[strlen(src)-1] = '\0';
|
||||
|
||||
for (src_ptr=src,dest_ptr=dest;
|
||||
*src_ptr;
|
||||
src_ptr++, dest_ptr++)
|
||||
{
|
||||
if(*src_ptr != '\\')
|
||||
*dest_ptr = *src_ptr;
|
||||
else
|
||||
{
|
||||
ch = *(++src_ptr);
|
||||
if((ch>='0') && (ch<='3')) /* assume next 2 chars are octal too */
|
||||
{
|
||||
*dest_ptr = ((ch & 07) << 6);
|
||||
*dest_ptr |= ((*(++src_ptr)&07)<<3);
|
||||
*dest_ptr |= (*(++src_ptr))&07;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(ch)
|
||||
{
|
||||
case 'a' : *dest_ptr = '\a'; break;
|
||||
case 'b' : *dest_ptr = '\b'; break;
|
||||
case 't' : *dest_ptr = '\t'; break;
|
||||
case 'r' : *dest_ptr = '\r'; break;
|
||||
case 'n' : *dest_ptr = '\n'; break;
|
||||
case 'v' : *dest_ptr = '\v'; break;
|
||||
case 'f' : *dest_ptr = '\f'; break;
|
||||
default : *dest_ptr = *src_ptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*dest_ptr = '\0'; /* terminate dest */
|
||||
|
||||
return dest;
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
/* proplistP.h: This is -*- c -*-
|
||||
|
||||
This file contains private definitions for libPropList. DO NOT USE
|
||||
THEM YOURSELF! proplist.h should have all that you need.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PROPLISTP_H
|
||||
#define PROPLISTP_H
|
||||
|
||||
#include "proplist.h"
|
||||
|
||||
typedef struct {
|
||||
char *string;
|
||||
} plString;
|
||||
|
||||
typedef struct {
|
||||
unsigned char *data;
|
||||
unsigned int length;
|
||||
} plData;
|
||||
|
||||
typedef struct {
|
||||
proplist_t *elements;
|
||||
unsigned int number;
|
||||
} plArray;
|
||||
|
||||
typedef struct {
|
||||
proplist_t *keys;
|
||||
proplist_t *values;
|
||||
unsigned int number;
|
||||
} plDictionary;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char type;
|
||||
proplist_t filename;
|
||||
proplist_t container;
|
||||
BOOL changed;
|
||||
unsigned long retain_count;
|
||||
union {
|
||||
plString str;
|
||||
plData data;
|
||||
plArray array;
|
||||
plDictionary dict;
|
||||
} t;
|
||||
} plint_t, *plptr_t;
|
||||
|
||||
#define PLSTRING 0
|
||||
#define PLDATA 1
|
||||
#define PLARRAY 2
|
||||
#define PLDICTIONARY 3
|
||||
|
||||
#endif /* !def PROPLISTP_H */
|
||||
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -1,11 +0,0 @@
|
|||
typedef union {
|
||||
proplist_t obj;
|
||||
} YYSTYPE;
|
||||
#define STRING 257
|
||||
#define DATA 258
|
||||
#define ERROR 259
|
||||
#define YYERROR_VERBOSE 260
|
||||
#define YYDEBUG 261
|
||||
|
||||
|
||||
extern YYSTYPE yylval;
|
|
@ -1,159 +0,0 @@
|
|||
/* definition section */
|
||||
|
||||
/* literal block */
|
||||
%{
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "proplist.h"
|
||||
|
||||
/* declarations for the following symbols is in filehandling.c */
|
||||
extern int pl_line_count;
|
||||
extern char *pl_curr_file;
|
||||
extern proplist_t parse_result;
|
||||
|
||||
%}
|
||||
|
||||
|
||||
/* token declarations */
|
||||
%token <obj> STRING DATA ERROR YYERROR_VERBOSE YYDEBUG
|
||||
|
||||
%union {
|
||||
proplist_t obj;
|
||||
}
|
||||
|
||||
%type <obj> root object array objlist dictionary keyval_list keyval_pair
|
||||
|
||||
/* rules section */
|
||||
%%
|
||||
root: object
|
||||
{
|
||||
/* want an object, followed by nothing else (<<EOF>>) */
|
||||
parse_result = $1;
|
||||
return (int)$1;
|
||||
}
|
||||
| error
|
||||
{
|
||||
parse_result = (proplist_t)NULL;
|
||||
return (int)NULL;
|
||||
}
|
||||
| ERROR
|
||||
{
|
||||
parse_result = (proplist_t)NULL;
|
||||
return (int)NULL;
|
||||
}
|
||||
;
|
||||
|
||||
object: STRING
|
||||
| DATA
|
||||
| array
|
||||
| dictionary
|
||||
| error
|
||||
{
|
||||
return (int)NULL;
|
||||
}
|
||||
;
|
||||
|
||||
array: '(' objlist ')'
|
||||
{$$ = $2;}
|
||||
| '(' ')'
|
||||
{$$ = PLMakeArrayFromElements(NULL);}
|
||||
| error
|
||||
{ return (int)NULL; }
|
||||
;
|
||||
objlist: objlist ',' object
|
||||
{
|
||||
if($1)
|
||||
{
|
||||
if ($3)
|
||||
{
|
||||
$$ = PLAppendArrayElement($1,$3);
|
||||
PLRelease($3);
|
||||
}
|
||||
else
|
||||
$$ = $1;
|
||||
}
|
||||
else if ($3)
|
||||
{
|
||||
$$ = PLMakeArrayFromElements($3, NULL);
|
||||
PLRelease($3);
|
||||
}
|
||||
else
|
||||
$$ = NULL;
|
||||
}
|
||||
| object
|
||||
{
|
||||
$$ = PLMakeArrayFromElements($1,
|
||||
NULL);
|
||||
PLRelease($1);
|
||||
}
|
||||
| error
|
||||
{
|
||||
$$ = NULL;
|
||||
}
|
||||
;
|
||||
|
||||
dictionary: '{' keyval_list '}'
|
||||
{$$ = $2;}
|
||||
| '{' '}'
|
||||
{$$ =
|
||||
PLMakeDictionaryFromEntries(NULL,
|
||||
NULL);}
|
||||
| error
|
||||
{
|
||||
$$ = NULL;
|
||||
}
|
||||
;
|
||||
keyval_list: keyval_list keyval_pair
|
||||
{
|
||||
if($1)
|
||||
{
|
||||
$$ = $1;
|
||||
if($2)
|
||||
{
|
||||
PLMergeDictionaries($$, $2);
|
||||
PLRelease($2);
|
||||
}
|
||||
}
|
||||
else if($2)
|
||||
$$ = $2;
|
||||
else
|
||||
$$ = NULL;
|
||||
}
|
||||
| keyval_pair
|
||||
| error
|
||||
{
|
||||
$$ = NULL;
|
||||
}
|
||||
;
|
||||
keyval_pair: STRING '=' object ';'
|
||||
{
|
||||
if (($1) && ($3))
|
||||
{
|
||||
$$ = PLMakeDictionaryFromEntries($1, $3,
|
||||
NULL);
|
||||
PLRelease($1); PLRelease($3);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($1)
|
||||
PLRelease($1);
|
||||
if ($3)
|
||||
PLRelease($3);
|
||||
$$ = NULL;
|
||||
}
|
||||
}
|
||||
| error
|
||||
{
|
||||
$$ = NULL;
|
||||
}
|
||||
;
|
||||
%%
|
||||
|
||||
/* C code section */
|
||||
int yyerror(char *s)
|
||||
{
|
||||
fprintf(stderr, "%s:line %d: %s\n", pl_curr_file, pl_line_count, s);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
/* types.c: This is -*- c -*-
|
||||
|
||||
This file contains routines for setting up the elementary
|
||||
(i.e. simple) types string and data. */
|
||||
|
||||
#include "proplistP.h"
|
||||
#include "util.h"
|
||||
|
||||
proplist_t PLMakeString(unsigned char *bytes)
|
||||
{
|
||||
plptr_t internal = MyMalloc(__FILE__, __LINE__, sizeof(plint_t));
|
||||
internal->type = PLSTRING;
|
||||
internal->filename = NULL;
|
||||
internal->container = NULL;
|
||||
internal->str.string = bytes;
|
||||
return (proplist_t)internal;
|
||||
}
|
||||
|
||||
proplist_t PLMakeData(unsigned char *data, unsigned int length)
|
||||
{
|
||||
plptr_t internal = MyMalloc(__FILE__, __LINE__, sizeof(plint_t));
|
||||
internal->type = PLDATA;
|
||||
internal->filename = NULL;
|
||||
internal->container = NULL;
|
||||
internal->data.data = data;
|
||||
internal->data.length = length;
|
||||
return (proplist_t)internal;
|
||||
}
|
||||
|
|
@ -1,339 +0,0 @@
|
|||
/* util.c:
|
||||
|
||||
Miscellaneous stuff
|
||||
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include "proplist.h"
|
||||
|
||||
#include "plconf.h"
|
||||
|
||||
#include "util.h"
|
||||
|
||||
/*
|
||||
* handling sockets
|
||||
*/
|
||||
|
||||
int GetServerSocket(int from, int to, int *actual)
|
||||
{
|
||||
int sock;
|
||||
struct protoent *pent;
|
||||
char hostname[256];
|
||||
struct hostent *localhost;
|
||||
struct sockaddr_in saddr;
|
||||
int current;
|
||||
|
||||
if(!(pent = getprotobyname("tcp")))
|
||||
return -1;
|
||||
|
||||
if((sock = socket(AF_INET, SOCK_STREAM, pent->p_proto)) < 0)
|
||||
return -1;
|
||||
|
||||
if((gethostname(hostname, 255)) < 0)
|
||||
return -1;
|
||||
|
||||
if(!(localhost = gethostbyname(hostname)))
|
||||
return -1;
|
||||
|
||||
*actual = 0;
|
||||
current = from;
|
||||
|
||||
saddr.sin_family = AF_INET;
|
||||
bcopy((char *)localhost->h_addr, (char *)&(saddr.sin_addr),
|
||||
localhost->h_length);
|
||||
|
||||
while(current <= to)
|
||||
{
|
||||
saddr.sin_port = htons(current);
|
||||
|
||||
if((bind(sock, (struct sockaddr *)&saddr,
|
||||
sizeof(struct sockaddr_in))) == 0)
|
||||
{
|
||||
if((listen(sock, 5)) < 0)
|
||||
return -1;
|
||||
else
|
||||
{
|
||||
*actual = current;
|
||||
return sock;
|
||||
}
|
||||
}
|
||||
else /* bind() failed */
|
||||
current++;
|
||||
}
|
||||
/* gone through all allowed ports, still no bind */
|
||||
return -1;
|
||||
}
|
||||
|
||||
int GetClientSocket(int portno)
|
||||
{
|
||||
int sock;
|
||||
struct protoent *pent;
|
||||
char hostname[256];
|
||||
struct hostent *localhost;
|
||||
struct sockaddr_in saddr;
|
||||
|
||||
if(!(pent = getprotobyname("tcp")))
|
||||
return -1;
|
||||
|
||||
if((sock = socket(AF_INET, SOCK_STREAM, pent->p_proto)) < 0)
|
||||
return -1;
|
||||
|
||||
if((gethostname(hostname, 255)) < 0)
|
||||
return -1;
|
||||
|
||||
if(!(localhost = gethostbyname(hostname)))
|
||||
return -1;
|
||||
|
||||
saddr.sin_family = AF_INET;
|
||||
saddr.sin_port = htons(portno);
|
||||
bcopy((char *)localhost->h_addr, (char *)&(saddr.sin_addr),
|
||||
localhost->h_length);
|
||||
|
||||
if((connect(sock, (struct sockaddr *)&saddr,
|
||||
sizeof(struct sockaddr_in))) < 0)
|
||||
return -1;
|
||||
|
||||
return sock;
|
||||
}
|
||||
|
||||
BOOL WriteString(int sock, char *str)
|
||||
{
|
||||
int bytes, bytes_remaining;
|
||||
|
||||
bytes_remaining = strlen(str);
|
||||
|
||||
while(bytes_remaining)
|
||||
{
|
||||
bytes = write(sock, str, bytes_remaining);
|
||||
if(bytes<0)
|
||||
return NO;
|
||||
bytes_remaining -= bytes;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
BOOL ReadString(int sock, char *str, size_t count)
|
||||
{
|
||||
int bytes;
|
||||
|
||||
bytes = read(sock, str, count-1);
|
||||
if(bytes<=0)
|
||||
return NO;
|
||||
|
||||
str[bytes] = '\0';
|
||||
return YES;
|
||||
}
|
||||
|
||||
char *ReadStringAnySize(int sock)
|
||||
{
|
||||
int bytes, cur_index, cur_length;
|
||||
char *str, *tmp;
|
||||
char c;
|
||||
|
||||
cur_index=0;
|
||||
cur_length = 256;
|
||||
str = (char *)MyMalloc(__FILE__, __LINE__, cur_length);
|
||||
|
||||
while((bytes = read(sock, &c, 1)))
|
||||
{
|
||||
if(bytes<0)
|
||||
{
|
||||
MyFree(__FILE__, __LINE__, str);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(c=='\n')
|
||||
{
|
||||
str[cur_index] = '\0';
|
||||
return str;
|
||||
}
|
||||
|
||||
str[cur_index++]=c;
|
||||
|
||||
if(cur_index==cur_length-1)
|
||||
{
|
||||
cur_length+=256;
|
||||
str[cur_index] = '\0';
|
||||
tmp = (char *)MyMalloc(__FILE__, __LINE__, cur_length);
|
||||
strcpy(tmp, str);
|
||||
MyFree(__FILE__, __LINE__, str);
|
||||
str = tmp;
|
||||
}
|
||||
}
|
||||
MyFree(__FILE__, __LINE__, str);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *ManglePath(const char *path)
|
||||
{
|
||||
char *home;
|
||||
char *ret;
|
||||
|
||||
if(!path) return 0;
|
||||
|
||||
if(path[0] == '~')
|
||||
{
|
||||
home = getenv("HOME");
|
||||
ret = (char *)MyMalloc(__FILE__, __LINE__, strlen(home)+strlen(path)+1);
|
||||
sprintf(ret, "%s/%s", home, &(path[1]));
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = (char *)MyMalloc(__FILE__, __LINE__, strlen(path)+1);
|
||||
strcpy(ret, path);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
char *MakeDefaultsFilename()
|
||||
{
|
||||
char *env;
|
||||
char actual_filename[255];
|
||||
|
||||
env = (char *)getenv("GNUSTEP_USER_PATH");
|
||||
if(!env)
|
||||
{
|
||||
env = (char *)getenv("HOME");
|
||||
if(!env) /* No HOME --- can this happen? */
|
||||
sprintf(actual_filename, "/GNUstep");
|
||||
else
|
||||
sprintf(actual_filename, "%s/GNUstep", env);
|
||||
}
|
||||
else
|
||||
sprintf(actual_filename, env);
|
||||
|
||||
sprintf(&(actual_filename[strlen(actual_filename)]), "/");
|
||||
|
||||
env = (char *)getenv("GNUSTEP_DEFAULTS_FILE");
|
||||
if(!env)
|
||||
sprintf(&(actual_filename[strlen(actual_filename)]), "Defaults");
|
||||
else
|
||||
sprintf(&(actual_filename[strlen(actual_filename)]), env);
|
||||
|
||||
return ManglePath(actual_filename);
|
||||
}
|
||||
|
||||
BOOL LockFile(char *name)
|
||||
{
|
||||
char *lockfilename;
|
||||
|
||||
lockfilename = MyMalloc(__FILE__, __LINE__, strlen(name)+6);
|
||||
sprintf(lockfilename, "%s.lock", name);
|
||||
|
||||
if((mkdir(lockfilename, 0755)) < 0)
|
||||
{
|
||||
if(errno != EEXIST)
|
||||
{
|
||||
MyFree(__FILE__, __LINE__, lockfilename);
|
||||
return NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
sleep(2);
|
||||
if((mkdir(lockfilename, 0755)) < 0)
|
||||
{
|
||||
MyFree(__FILE__, __LINE__, lockfilename);
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
}
|
||||
MyFree(__FILE__, __LINE__, lockfilename);
|
||||
return YES;
|
||||
}
|
||||
|
||||
BOOL UnlockFile(char *filename)
|
||||
{
|
||||
char *lockfilename;
|
||||
|
||||
lockfilename = MyMalloc(__FILE__, __LINE__, strlen(filename)+6);
|
||||
sprintf(lockfilename, "%s.lock", filename);
|
||||
|
||||
if(rmdir(lockfilename) < 0)
|
||||
{
|
||||
MyFree(__FILE__, __LINE__, lockfilename);
|
||||
if(errno==ENOENT) return YES;
|
||||
else return NO;
|
||||
}
|
||||
|
||||
MyFree(__FILE__, __LINE__, lockfilename);
|
||||
return YES;
|
||||
}
|
||||
|
||||
BOOL StatDomain(char *filename, proplist_t key, struct stat *buf)
|
||||
{
|
||||
char *actualFilename;
|
||||
|
||||
actualFilename = MyMalloc(__FILE__, __LINE__, strlen(filename) +
|
||||
strlen(PLGetString(key)) + 2);
|
||||
sprintf(actualFilename, "%s/%s", filename, PLGetString(key));
|
||||
|
||||
if(stat(actualFilename, buf)<0)
|
||||
{
|
||||
MyFree(__FILE__, __LINE__, actualFilename);
|
||||
return NO;
|
||||
}
|
||||
MyFree(__FILE__, __LINE__, actualFilename);
|
||||
return YES;
|
||||
}
|
||||
|
||||
BOOL DeleteDomain(char *filename, proplist_t key)
|
||||
{
|
||||
char *actualFilename;
|
||||
|
||||
actualFilename = MyMalloc(__FILE__, __LINE__, strlen(filename) +
|
||||
strlen(PLGetString(key)) + 2);
|
||||
sprintf(actualFilename, "%s/%s", filename, PLGetString(key));
|
||||
|
||||
if(unlink(actualFilename)<0)
|
||||
{
|
||||
MyFree(__FILE__, __LINE__, actualFilename);
|
||||
return NO;
|
||||
}
|
||||
MyFree(__FILE__, __LINE__, actualFilename);
|
||||
return YES;
|
||||
}
|
||||
|
||||
proplist_t ReadDomain(char *filename, proplist_t key)
|
||||
{
|
||||
char *actualFilename;
|
||||
proplist_t retval;
|
||||
|
||||
actualFilename = MyMalloc(__FILE__, __LINE__, strlen(filename) +
|
||||
strlen(PLGetString(key)) + 2);
|
||||
sprintf(actualFilename, "%s/%s", filename, PLGetString(key));
|
||||
|
||||
retval = PLGetProplistWithPath(actualFilename);
|
||||
|
||||
MyFree(__FILE__, __LINE__, actualFilename);
|
||||
return retval;
|
||||
}
|
||||
|
||||
void *MyMalloc(char *file, int line, size_t size)
|
||||
{
|
||||
void *retval = malloc(size);
|
||||
#ifdef MEMDEBUG
|
||||
printf("Allocating %d bytes of memory at address 0x%x (%s:%d)\n", size, retval, file, line);
|
||||
#endif
|
||||
return retval;
|
||||
}
|
||||
|
||||
void MyFree(char *file, int line, void *mem)
|
||||
{
|
||||
#ifdef MEMDEBUG
|
||||
printf("Freeing memory at address 0x%x (%s:%d)\n", mem, file, line);
|
||||
#endif
|
||||
free(mem);
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
#ifndef UTIL_H
|
||||
#define UTIL_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
|
||||
/* socket comm routines */
|
||||
int GetServerSocket(int from, int to, int *actual);
|
||||
int GetClientSocket(int portno);
|
||||
BOOL WriteString(int sock, char *str);
|
||||
BOOL ReadString(int sock, char *str, size_t count);
|
||||
char *ReadStringAnySize(int sock);
|
||||
|
||||
/* returns newly allocated string made from path by substituting "~"
|
||||
with getenv("HOME") */
|
||||
char *ManglePath(const char *path);
|
||||
|
||||
/* returns newly allocated name of the defaults file constructed from
|
||||
GNUSTEP_USER_PATH and GNUSTEP_DEFAULTS_FILE, or ~/GNUstep/Defaults,
|
||||
if not present. */
|
||||
char *MakeDefaultsFilename();
|
||||
|
||||
/* Tries to lock filename by creating a directory called
|
||||
"filename.lock"; if that exists, sleeps two seconds, then tries
|
||||
again. Returns NO if unsuccessful, YES otherwise. */
|
||||
BOOL LockFile(char *filename);
|
||||
|
||||
/* Unlocks the file by removing the dir created by LockFile. */
|
||||
BOOL UnlockFile(char *filename);
|
||||
|
||||
/* Returns YES if file is stat()-able, NO if it isn't */
|
||||
BOOL StatDomain(char *filename, proplist_t key, struct stat *buf);
|
||||
|
||||
/* Removes the domain file from disk. Returns YES if successful, NO
|
||||
otherwise. */
|
||||
BOOL DeleteDomain(char *filename, proplist_t key);
|
||||
|
||||
proplist_t ReadDomain(char *filename, proplist_t key);
|
||||
|
||||
void *MyMalloc(char *file, int line, size_t size);
|
||||
|
||||
void MyFree(char *file, int line, void *mem);
|
||||
#endif /* UTIL_H */
|
Loading…
Reference in a new issue