gtkmeat 0.5.4
This commit is contained in:
parent
96810d41e4
commit
8a4c4fb37a
21 changed files with 4355 additions and 0 deletions
3
AUTHORS
Normal file
3
AUTHORS
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
Authors
|
||||||
|
* Troy Engel <tengel@sonic.net> - Windows / *nix
|
||||||
|
|
||||||
6
BUGS
Normal file
6
BUGS
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
Crash
|
||||||
|
* none
|
||||||
|
|
||||||
|
Non-Crash
|
||||||
|
* recentnews.tmp not always deleted from home directory
|
||||||
|
|
||||||
340
COPYING
Normal file
340
COPYING
Normal file
|
|
@ -0,0 +1,340 @@
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||||
|
675 Mass Ave, Cambridge, MA 02139, USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Library General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
|
source code as you receive it, in any medium, provided that you
|
||||||
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
Appendix: How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) 19yy <name of author>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Library General
|
||||||
|
Public License instead of this License.
|
||||||
5
ChangeLog
Normal file
5
ChangeLog
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
Sun Jan 03 1999 Troy Engel <tengel@sonic.net>
|
||||||
|
* versioned to 0.5.4
|
||||||
|
* initial public release
|
||||||
|
* transmogrified from gtkSlash
|
||||||
|
|
||||||
16
INSTALL
Normal file
16
INSTALL
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
*nix
|
||||||
|
====
|
||||||
|
|
||||||
|
./configure
|
||||||
|
make
|
||||||
|
<su to root or whatever>
|
||||||
|
make install
|
||||||
|
|
||||||
|
Windows
|
||||||
|
=======
|
||||||
|
|
||||||
|
nmake /f makefile.vc6
|
||||||
|
|
||||||
|
|
||||||
|
If you have any problems, examine your makefile by hand.
|
||||||
|
|
||||||
4
Makefile.am
Normal file
4
Makefile.am
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
AUTOMAKE_OPTIONS=no-dependencies
|
||||||
|
bin_PROGRAMS = gtkmeat
|
||||||
|
gtkmeat_SOURCES = gtkmeat.c rcfuncs.c rcfuncs.h
|
||||||
|
EXTRA_DIST = BUGS Makefile.vc6 gtkmeatrc
|
||||||
301
Makefile.in
Normal file
301
Makefile.in
Normal file
|
|
@ -0,0 +1,301 @@
|
||||||
|
# Makefile.in generated automatically by automake 1.3 from Makefile.am
|
||||||
|
|
||||||
|
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||||
|
# This Makefile.in is free software; the Free Software Foundation
|
||||||
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
# with or without modifications, as long as this notice is preserved.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||||
|
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
# PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
|
||||||
|
SHELL = /bin/sh
|
||||||
|
|
||||||
|
srcdir = @srcdir@
|
||||||
|
top_srcdir = @top_srcdir@
|
||||||
|
VPATH = @srcdir@
|
||||||
|
prefix = @prefix@
|
||||||
|
exec_prefix = @exec_prefix@
|
||||||
|
|
||||||
|
bindir = @bindir@
|
||||||
|
sbindir = @sbindir@
|
||||||
|
libexecdir = @libexecdir@
|
||||||
|
datadir = @datadir@
|
||||||
|
sysconfdir = @sysconfdir@
|
||||||
|
sharedstatedir = @sharedstatedir@
|
||||||
|
localstatedir = @localstatedir@
|
||||||
|
libdir = @libdir@
|
||||||
|
infodir = @infodir@
|
||||||
|
mandir = @mandir@
|
||||||
|
includedir = @includedir@
|
||||||
|
oldincludedir = /usr/include
|
||||||
|
|
||||||
|
DISTDIR =
|
||||||
|
|
||||||
|
pkgdatadir = $(datadir)/@PACKAGE@
|
||||||
|
pkglibdir = $(libdir)/@PACKAGE@
|
||||||
|
pkgincludedir = $(includedir)/@PACKAGE@
|
||||||
|
|
||||||
|
top_builddir = .
|
||||||
|
|
||||||
|
ACLOCAL = @ACLOCAL@
|
||||||
|
AUTOCONF = @AUTOCONF@
|
||||||
|
AUTOMAKE = @AUTOMAKE@
|
||||||
|
AUTOHEADER = @AUTOHEADER@
|
||||||
|
|
||||||
|
INSTALL = @INSTALL@
|
||||||
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||||
|
INSTALL_DATA = @INSTALL_DATA@
|
||||||
|
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||||
|
transform = @program_transform_name@
|
||||||
|
|
||||||
|
NORMAL_INSTALL = :
|
||||||
|
PRE_INSTALL = :
|
||||||
|
POST_INSTALL = :
|
||||||
|
NORMAL_UNINSTALL = :
|
||||||
|
PRE_UNINSTALL = :
|
||||||
|
POST_UNINSTALL = :
|
||||||
|
CC = @CC@
|
||||||
|
GTKMEAT_VERSION = @GTKMEAT_VERSION@
|
||||||
|
GTK_CFLAGS = @GTK_CFLAGS@
|
||||||
|
GTK_CONFIG = @GTK_CONFIG@
|
||||||
|
GTK_LIBS = @GTK_LIBS@
|
||||||
|
MAKEINFO = @MAKEINFO@
|
||||||
|
PACKAGE = @PACKAGE@
|
||||||
|
VERSION = @VERSION@
|
||||||
|
|
||||||
|
AUTOMAKE_OPTIONS=no-dependencies
|
||||||
|
bin_PROGRAMS = gtkmeat
|
||||||
|
gtkmeat_SOURCES = gtkmeat.c rcfuncs.c rcfuncs.h
|
||||||
|
EXTRA_DIST = BUGS Makefile.vc6 gtkmeatrc
|
||||||
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
|
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||||
|
CONFIG_CLEAN_FILES =
|
||||||
|
PROGRAMS = $(bin_PROGRAMS)
|
||||||
|
|
||||||
|
|
||||||
|
DEFS = @DEFS@ -I. -I$(srcdir)
|
||||||
|
CPPFLAGS = @CPPFLAGS@
|
||||||
|
LDFLAGS = @LDFLAGS@
|
||||||
|
LIBS = @LIBS@
|
||||||
|
gtkmeat_OBJECTS = gtkmeat.o rcfuncs.o
|
||||||
|
gtkmeat_LDADD = $(LDADD)
|
||||||
|
gtkmeat_DEPENDENCIES =
|
||||||
|
gtkmeat_LDFLAGS =
|
||||||
|
CFLAGS = @CFLAGS@
|
||||||
|
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
|
||||||
|
LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@
|
||||||
|
DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
|
||||||
|
Makefile.in NEWS TODO aclocal.m4 configure configure.in install-sh \
|
||||||
|
missing mkinstalldirs
|
||||||
|
|
||||||
|
|
||||||
|
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
|
|
||||||
|
TAR = tar
|
||||||
|
GZIP = --best
|
||||||
|
SOURCES = $(gtkmeat_SOURCES)
|
||||||
|
OBJECTS = $(gtkmeat_OBJECTS)
|
||||||
|
|
||||||
|
all: Makefile $(PROGRAMS)
|
||||||
|
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .S .c .o .s
|
||||||
|
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||||
|
cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile
|
||||||
|
|
||||||
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||||
|
cd $(top_builddir) \
|
||||||
|
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||||
|
|
||||||
|
$(ACLOCAL_M4): configure.in
|
||||||
|
cd $(srcdir) && $(ACLOCAL)
|
||||||
|
|
||||||
|
config.status: $(srcdir)/configure
|
||||||
|
$(SHELL) ./config.status --recheck
|
||||||
|
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
|
||||||
|
cd $(srcdir) && $(AUTOCONF)
|
||||||
|
|
||||||
|
mostlyclean-binPROGRAMS:
|
||||||
|
|
||||||
|
clean-binPROGRAMS:
|
||||||
|
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
|
||||||
|
|
||||||
|
distclean-binPROGRAMS:
|
||||||
|
|
||||||
|
maintainer-clean-binPROGRAMS:
|
||||||
|
|
||||||
|
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||||
|
@$(NORMAL_INSTALL)
|
||||||
|
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||||
|
@list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||||
|
if test -f $$p; then \
|
||||||
|
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
|
||||||
|
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||||
|
else :; fi; \
|
||||||
|
done
|
||||||
|
|
||||||
|
uninstall-binPROGRAMS:
|
||||||
|
@$(NORMAL_UNINSTALL)
|
||||||
|
list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||||
|
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||||
|
done
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(COMPILE) -c $<
|
||||||
|
|
||||||
|
.s.o:
|
||||||
|
$(COMPILE) -c $<
|
||||||
|
|
||||||
|
.S.o:
|
||||||
|
$(COMPILE) -c $<
|
||||||
|
|
||||||
|
mostlyclean-compile:
|
||||||
|
-rm -f *.o core *.core
|
||||||
|
|
||||||
|
clean-compile:
|
||||||
|
|
||||||
|
distclean-compile:
|
||||||
|
-rm -f *.tab.c
|
||||||
|
|
||||||
|
maintainer-clean-compile:
|
||||||
|
|
||||||
|
gtkmeat: $(gtkmeat_OBJECTS) $(gtkmeat_DEPENDENCIES)
|
||||||
|
@rm -f gtkmeat
|
||||||
|
$(LINK) $(gtkmeat_LDFLAGS) $(gtkmeat_OBJECTS) $(gtkmeat_LDADD) $(LIBS)
|
||||||
|
|
||||||
|
tags: TAGS
|
||||||
|
|
||||||
|
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||||
|
here=`pwd` && cd $(srcdir) \
|
||||||
|
&& mkid -f$$here/ID $(SOURCES) $(HEADERS) $(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) $(TAR) zxf $(distdir).tar.gz
|
||||||
|
mkdir $(distdir)/=build
|
||||||
|
mkdir $(distdir)/=inst
|
||||||
|
dc_install_base=`cd $(distdir)/=inst && pwd`; \
|
||||||
|
cd $(distdir)/=build \
|
||||||
|
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
|
||||||
|
&& $(MAKE) \
|
||||||
|
&& $(MAKE) dvi \
|
||||||
|
&& $(MAKE) check \
|
||||||
|
&& $(MAKE) install \
|
||||||
|
&& $(MAKE) installcheck \
|
||||||
|
&& $(MAKE) dist
|
||||||
|
-rm -rf $(distdir)
|
||||||
|
@echo "========================"; \
|
||||||
|
echo "$(distdir).tar.gz is ready for distribution"; \
|
||||||
|
echo "========================"
|
||||||
|
dist: distdir
|
||||||
|
-chmod -R a+r $(distdir)
|
||||||
|
GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir)
|
||||||
|
-rm -rf $(distdir)
|
||||||
|
dist-all: distdir
|
||||||
|
-chmod -R a+r $(distdir)
|
||||||
|
GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir)
|
||||||
|
-rm -rf $(distdir)
|
||||||
|
distdir: $(DISTFILES)
|
||||||
|
-rm -rf $(distdir)
|
||||||
|
mkdir $(distdir)
|
||||||
|
-chmod 777 $(distdir)
|
||||||
|
@for file in $(DISTFILES); do \
|
||||||
|
d=$(srcdir); \
|
||||||
|
test -f $(distdir)/$$file \
|
||||||
|
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||||
|
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||||
|
done
|
||||||
|
info:
|
||||||
|
dvi:
|
||||||
|
check: all
|
||||||
|
$(MAKE)
|
||||||
|
installcheck:
|
||||||
|
install-exec: install-binPROGRAMS
|
||||||
|
@$(NORMAL_INSTALL)
|
||||||
|
|
||||||
|
install-data:
|
||||||
|
@$(NORMAL_INSTALL)
|
||||||
|
|
||||||
|
install: install-exec install-data all
|
||||||
|
@:
|
||||||
|
|
||||||
|
uninstall: uninstall-binPROGRAMS
|
||||||
|
|
||||||
|
install-strip:
|
||||||
|
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||||
|
installdirs:
|
||||||
|
$(mkinstalldirs) $(DATADIR)$(bindir)
|
||||||
|
|
||||||
|
|
||||||
|
mostlyclean-generic:
|
||||||
|
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||||
|
|
||||||
|
clean-generic:
|
||||||
|
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||||
|
|
||||||
|
distclean-generic:
|
||||||
|
-rm -f Makefile $(DISTCLEANFILES)
|
||||||
|
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||||
|
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||||
|
|
||||||
|
maintainer-clean-generic:
|
||||||
|
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||||
|
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||||
|
mostlyclean: mostlyclean-binPROGRAMS mostlyclean-compile \
|
||||||
|
mostlyclean-tags mostlyclean-generic
|
||||||
|
|
||||||
|
clean: clean-binPROGRAMS clean-compile clean-tags clean-generic \
|
||||||
|
mostlyclean
|
||||||
|
|
||||||
|
distclean: distclean-binPROGRAMS distclean-compile distclean-tags \
|
||||||
|
distclean-generic clean
|
||||||
|
-rm -f config.status
|
||||||
|
|
||||||
|
maintainer-clean: maintainer-clean-binPROGRAMS maintainer-clean-compile \
|
||||||
|
maintainer-clean-tags maintainer-clean-generic \
|
||||||
|
distclean
|
||||||
|
@echo "This command is intended for maintainers to use;"
|
||||||
|
@echo "it deletes files that may require special tools to rebuild."
|
||||||
|
-rm -f config.status
|
||||||
|
|
||||||
|
.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
|
||||||
|
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
|
||||||
|
mostlyclean-compile distclean-compile clean-compile \
|
||||||
|
maintainer-clean-compile tags mostlyclean-tags distclean-tags \
|
||||||
|
clean-tags maintainer-clean-tags distdir info dvi installcheck \
|
||||||
|
install-exec install-data install uninstall all installdirs \
|
||||||
|
mostlyclean-generic distclean-generic clean-generic \
|
||||||
|
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||||
|
|
||||||
|
|
||||||
|
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||||
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||||
|
.NOEXPORT:
|
||||||
64
Makefile.vc6
Normal file
64
Makefile.vc6
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
########################################################
|
||||||
|
## Makefile for building gtkMeat.exe with MSVC6
|
||||||
|
## Use: nmake -f makefile.vc6 [release | debug]
|
||||||
|
## (default is release)
|
||||||
|
##
|
||||||
|
## Comments to: Troy Engel <tengel@sonic.net>
|
||||||
|
|
||||||
|
## Adjust these to your machine:
|
||||||
|
|
||||||
|
# path to <glib.h>
|
||||||
|
GLIB = ..\glib
|
||||||
|
|
||||||
|
# path to <gtk/gtk.h>
|
||||||
|
GTK = ..\gtk-plus
|
||||||
|
|
||||||
|
# paths to .lib for gtk, gdk and glib
|
||||||
|
GLIBPATHR = ..\lib_release
|
||||||
|
GLIBPATHD = ..\lib_debug
|
||||||
|
|
||||||
|
########################################################
|
||||||
|
## Nothing more to do below this line!
|
||||||
|
|
||||||
|
## Release
|
||||||
|
CCR = cl.exe /ML /O2 /D "NDEBUG"
|
||||||
|
LINKR = link.exe /incremental:no /libpath:$(GLIBPATHR)
|
||||||
|
|
||||||
|
## Debug
|
||||||
|
CCD = cl.exe /MLd /Gm /ZI /Od /D "_DEBUG" /GZ
|
||||||
|
LINKD = link.exe /incremental:yes /debug /libpath:$(GLIBPATHD)
|
||||||
|
|
||||||
|
CFLAGS = /nologo /W3 /GX /D "WIN32" /D "_WINDOWS" /D "_MBCS" /YX /FD /c -I$(GLIB) -I$(GTK)
|
||||||
|
LFLAGS = /nologo /out:gtkmeat.exe /subsystem:windows /machine:I386
|
||||||
|
LINKLIBS = kernel32.lib glib-1.1.lib gdk-1.1.lib gtk-1.1.lib
|
||||||
|
|
||||||
|
all : release
|
||||||
|
|
||||||
|
release: gtkmeatr.obj rcfuncsr.obj
|
||||||
|
$(LINKR) $(LFLAGS) $(LINKLIBS) gtkmeat.obj rcfuncs.obj
|
||||||
|
|
||||||
|
debug: gtkmeatd.obj rcfuncsd.obj
|
||||||
|
$(LINKD) $(LFLAGS) $(LINKLIBS) gtkmeat.obj rcfuncs.obj
|
||||||
|
|
||||||
|
gtkmeatr.obj : gtkmeat.c
|
||||||
|
$(CCR) $(CFLAGS) gtkmeat.c
|
||||||
|
|
||||||
|
gtkmeatd.obj : gtkmeat.c
|
||||||
|
$(CCD) $(CFLAGS) gtkmeat.c
|
||||||
|
|
||||||
|
rcfuncsr.obj : rcfuncs.c
|
||||||
|
$(CCR) $(CFLAGS) rcfuncs.c
|
||||||
|
|
||||||
|
rcfuncsd.obj : rcfuncs.c
|
||||||
|
$(CCD) $(CFLAGS) rcfuncs.c
|
||||||
|
|
||||||
|
clean:
|
||||||
|
del gtkmeat.exe
|
||||||
|
del gtkmeat.obj
|
||||||
|
del rcfuncs.obj
|
||||||
|
del gtkmeat.pdb
|
||||||
|
del gtkmeat.ilk
|
||||||
|
del vc60.idb
|
||||||
|
del vc60.pdb
|
||||||
|
del vc60.pch
|
||||||
|
|
||||||
3
NEWS
Normal file
3
NEWS
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
Version 0.5.4
|
||||||
|
* initial public release
|
||||||
|
|
||||||
52
README
Normal file
52
README
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
gtkMeat - freshmeat new submissions ticker
|
||||||
|
(c) 1999 Troy Engel <tengel@sonic.net>
|
||||||
|
http://www.sonic.net/~tengel/gtkmeat/
|
||||||
|
-----------------------------------------
|
||||||
|
|
||||||
|
01/03/99, v0.5.4
|
||||||
|
|
||||||
|
|
||||||
|
General
|
||||||
|
-------
|
||||||
|
This program is based on original code from gtkSlash. It's
|
||||||
|
very simple - it reads the 'recentnews.txt' file from [fm] and
|
||||||
|
gives you a nice little display unit locally.
|
||||||
|
|
||||||
|
gtkMeat requires Gtk+ (http://www.gtk.org) and curl
|
||||||
|
(http://www.fts.frontec.se/~dast/curl/) for the display and
|
||||||
|
file retrieval, respectively. Additionally, if you want to
|
||||||
|
browse a news article from within gtkMeat you'll need some
|
||||||
|
sort of web browser. Currently it is working just fine with
|
||||||
|
Gtk 1.1.3 (Windows) Gtk 1.1.9 (*nix) and curl 5.3 (both).
|
||||||
|
|
||||||
|
If you are on Windows, the Gtk+ version which has been used is
|
||||||
|
from Tor Lillqvist; he also ports Gdk and GIMP. If you don't
|
||||||
|
have these libs, you'll probably need them to compile as I am
|
||||||
|
unaware of anyone else who's done the porting. You can find
|
||||||
|
all these at (http://user.sgic.fi/~tml/gimp/win32/).
|
||||||
|
|
||||||
|
|
||||||
|
Configuration
|
||||||
|
-------------
|
||||||
|
The program will read the file ~/.gtkmeatrc (*nix) or
|
||||||
|
~\_gtkmeatrc (Windows) upon startup. If this file isn't
|
||||||
|
found, it will look in /etc/gtkmeatrc (*nix) or
|
||||||
|
<WinDir>\gtkmeatrc instead. A sample of this file has been
|
||||||
|
included as gtkmeatrc, and is self-descriptive. Note: if
|
||||||
|
you want web-browsing capabilities, you have to check this
|
||||||
|
file and modify it accordingly - there is no default for the
|
||||||
|
web-browser or curl at this time. A GUI editor for this file
|
||||||
|
isn't done yet, maybe someday.
|
||||||
|
|
||||||
|
|
||||||
|
Reasons I did things
|
||||||
|
--------------------
|
||||||
|
Curl is used specifically here instead of internal routines
|
||||||
|
because of a fundamental reason: don't reinvent the wheel. :)
|
||||||
|
Curl handles all kinds of stuff I'm not interested in
|
||||||
|
(proxies, firewalls, weird ports and socket problems, etc)
|
||||||
|
and is already portable across all kinds of platforms. It
|
||||||
|
works great for me on Windows, so I hope it works great for
|
||||||
|
you. And, uh, I'm a contributing author of sorts. :) (only a
|
||||||
|
bugfix or two...)
|
||||||
|
|
||||||
4
TODO
Normal file
4
TODO
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
As of 0.5.4
|
||||||
|
* better startup (post refresh message instead of initial wait)
|
||||||
|
* GUI config editor like GIMP
|
||||||
|
|
||||||
299
aclocal.m4
vendored
Normal file
299
aclocal.m4
vendored
Normal file
|
|
@ -0,0 +1,299 @@
|
||||||
|
dnl aclocal.m4 generated automatically by aclocal 1.3
|
||||||
|
|
||||||
|
dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||||
|
dnl This Makefile.in is free software; the Free Software Foundation
|
||||||
|
dnl gives unlimited permission to copy and/or distribute it,
|
||||||
|
dnl with or without modifications, as long as this notice is preserved.
|
||||||
|
|
||||||
|
dnl This program is distributed in the hope that it will be useful,
|
||||||
|
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||||
|
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
dnl PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
# Do all the work for Automake. This macro actually does too much --
|
||||||
|
# some checks are only needed if your package does certain things.
|
||||||
|
# But this isn't really a big deal.
|
||||||
|
|
||||||
|
# serial 1
|
||||||
|
|
||||||
|
dnl Usage:
|
||||||
|
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
|
||||||
|
|
||||||
|
AC_DEFUN(AM_INIT_AUTOMAKE,
|
||||||
|
[AC_REQUIRE([AM_PROG_INSTALL])
|
||||||
|
PACKAGE=[$1]
|
||||||
|
AC_SUBST(PACKAGE)
|
||||||
|
VERSION=[$2]
|
||||||
|
AC_SUBST(VERSION)
|
||||||
|
dnl test to see if srcdir already configured
|
||||||
|
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
|
||||||
|
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
|
||||||
|
fi
|
||||||
|
ifelse([$3],,
|
||||||
|
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
|
||||||
|
AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
|
||||||
|
AC_REQUIRE([AM_SANITY_CHECK])
|
||||||
|
AC_REQUIRE([AC_ARG_PROGRAM])
|
||||||
|
dnl FIXME This is truly gross.
|
||||||
|
missing_dir=`cd $ac_aux_dir && pwd`
|
||||||
|
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
|
||||||
|
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
|
||||||
|
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
|
||||||
|
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
|
||||||
|
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
|
||||||
|
AC_REQUIRE([AC_PROG_MAKE_SET])])
|
||||||
|
|
||||||
|
|
||||||
|
# serial 1
|
||||||
|
|
||||||
|
AC_DEFUN(AM_PROG_INSTALL,
|
||||||
|
[AC_REQUIRE([AC_PROG_INSTALL])
|
||||||
|
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
|
||||||
|
AC_SUBST(INSTALL_SCRIPT)dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
#
|
||||||
|
# Check to make sure that the build environment is sane.
|
||||||
|
#
|
||||||
|
|
||||||
|
AC_DEFUN(AM_SANITY_CHECK,
|
||||||
|
[AC_MSG_CHECKING([whether build environment is sane])
|
||||||
|
# Just in case
|
||||||
|
sleep 1
|
||||||
|
echo timestamp > conftestfile
|
||||||
|
# Do `set' in a subshell so we don't clobber the current shell's
|
||||||
|
# arguments. Must try -L first in case configure is actually a
|
||||||
|
# symlink; some systems play weird games with the mod time of symlinks
|
||||||
|
# (eg FreeBSD returns the mod time of the symlink's containing
|
||||||
|
# directory).
|
||||||
|
if (
|
||||||
|
set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
|
||||||
|
if test "[$]*" = "X"; then
|
||||||
|
# -L didn't work.
|
||||||
|
set X `ls -t $srcdir/configure conftestfile`
|
||||||
|
fi
|
||||||
|
if test "[$]*" != "X $srcdir/configure conftestfile" \
|
||||||
|
&& test "[$]*" != "X conftestfile $srcdir/configure"; then
|
||||||
|
|
||||||
|
# If neither matched, then we have a broken ls. This can happen
|
||||||
|
# if, for instance, CONFIG_SHELL is bash and it inherits a
|
||||||
|
# broken ls alias from the environment. This has actually
|
||||||
|
# happened. Such a system could not be considered "sane".
|
||||||
|
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
|
||||||
|
alias in your environment])
|
||||||
|
fi
|
||||||
|
|
||||||
|
test "[$]2" = conftestfile
|
||||||
|
)
|
||||||
|
then
|
||||||
|
# Ok.
|
||||||
|
:
|
||||||
|
else
|
||||||
|
AC_MSG_ERROR([newly created file is older than distributed files!
|
||||||
|
Check your system clock])
|
||||||
|
fi
|
||||||
|
rm -f conftest*
|
||||||
|
AC_MSG_RESULT(yes)])
|
||||||
|
|
||||||
|
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
|
||||||
|
dnl The program must properly implement --version.
|
||||||
|
AC_DEFUN(AM_MISSING_PROG,
|
||||||
|
[AC_MSG_CHECKING(for working $2)
|
||||||
|
# Run test in a subshell; some versions of sh will print an error if
|
||||||
|
# an executable is not found, even if stderr is redirected.
|
||||||
|
# Redirect stdin to placate older versions of autoconf. Sigh.
|
||||||
|
if ($2 --version) < /dev/null > /dev/null 2>&1; then
|
||||||
|
$1=$2
|
||||||
|
AC_MSG_RESULT(found)
|
||||||
|
else
|
||||||
|
$1="$3/missing $2"
|
||||||
|
AC_MSG_RESULT(missing)
|
||||||
|
fi
|
||||||
|
AC_SUBST($1)])
|
||||||
|
|
||||||
|
# Configure paths for GTK+
|
||||||
|
# Owen Taylor 97-11-3
|
||||||
|
|
||||||
|
dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
|
||||||
|
dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
|
||||||
|
dnl
|
||||||
|
AC_DEFUN(AM_PATH_GTK,
|
||||||
|
[dnl
|
||||||
|
dnl Get the cflags and libraries from the gtk-config script
|
||||||
|
dnl
|
||||||
|
AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
|
||||||
|
gtk_config_prefix="$withval", gtk_config_prefix="")
|
||||||
|
AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
|
||||||
|
gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
|
||||||
|
AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
|
||||||
|
, enable_gtktest=yes)
|
||||||
|
|
||||||
|
if test x$gtk_config_exec_prefix != x ; then
|
||||||
|
gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
|
||||||
|
if test x${GTK_CONFIG+set} != xset ; then
|
||||||
|
GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if test x$gtk_config_prefix != x ; then
|
||||||
|
gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
|
||||||
|
if test x${GTK_CONFIG+set} != xset ; then
|
||||||
|
GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
|
||||||
|
min_gtk_version=ifelse([$1], ,0.99.7,$1)
|
||||||
|
AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
|
||||||
|
no_gtk=""
|
||||||
|
if test "$GTK_CONFIG" = "no" ; then
|
||||||
|
no_gtk=yes
|
||||||
|
else
|
||||||
|
GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
|
||||||
|
GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
|
||||||
|
gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
|
||||||
|
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||||
|
gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
|
||||||
|
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||||
|
gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
|
||||||
|
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||||
|
if test "x$enable_gtktest" = "xyes" ; then
|
||||||
|
ac_save_CFLAGS="$CFLAGS"
|
||||||
|
ac_save_LIBS="$LIBS"
|
||||||
|
CFLAGS="$CFLAGS $GTK_CFLAGS"
|
||||||
|
LIBS="$LIBS $GTK_LIBS"
|
||||||
|
dnl
|
||||||
|
dnl Now check if the installed GTK is sufficiently new. (Also sanity
|
||||||
|
dnl checks the results of gtk-config to some extent
|
||||||
|
dnl
|
||||||
|
rm -f conf.gtktest
|
||||||
|
AC_TRY_RUN([
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
int major, minor, micro;
|
||||||
|
char *tmp_version;
|
||||||
|
|
||||||
|
system ("touch conf.gtktest");
|
||||||
|
|
||||||
|
/* HP/UX 9 (%@#!) writes to sscanf strings */
|
||||||
|
tmp_version = g_strdup("$min_gtk_version");
|
||||||
|
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
|
||||||
|
printf("%s, bad version string\n", "$min_gtk_version");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((gtk_major_version != $gtk_config_major_version) ||
|
||||||
|
(gtk_minor_version != $gtk_config_minor_version) ||
|
||||||
|
(gtk_micro_version != $gtk_config_micro_version))
|
||||||
|
{
|
||||||
|
printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
|
||||||
|
$gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
|
||||||
|
gtk_major_version, gtk_minor_version, gtk_micro_version);
|
||||||
|
printf ("*** was found! If gtk-config was correct, then it is best\n");
|
||||||
|
printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
|
||||||
|
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
|
||||||
|
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
|
||||||
|
printf("*** required on your system.\n");
|
||||||
|
printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
|
||||||
|
printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
|
||||||
|
printf("*** before re-running configure\n");
|
||||||
|
}
|
||||||
|
#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
|
||||||
|
else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
|
||||||
|
(gtk_minor_version != GTK_MINOR_VERSION) ||
|
||||||
|
(gtk_micro_version != GTK_MICRO_VERSION))
|
||||||
|
{
|
||||||
|
printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
|
||||||
|
GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
|
||||||
|
printf("*** library (version %d.%d.%d)\n",
|
||||||
|
gtk_major_version, gtk_minor_version, gtk_micro_version);
|
||||||
|
}
|
||||||
|
#endif /* defined (GTK_MAJOR_VERSION) ... */
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((gtk_major_version > major) ||
|
||||||
|
((gtk_major_version == major) && (gtk_minor_version > minor)) ||
|
||||||
|
((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
|
||||||
|
gtk_major_version, gtk_minor_version, gtk_micro_version);
|
||||||
|
printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
|
||||||
|
major, minor, micro);
|
||||||
|
printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
|
||||||
|
printf("***\n");
|
||||||
|
printf("*** If you have already installed a sufficiently new version, this error\n");
|
||||||
|
printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
|
||||||
|
printf("*** being found. The easiest way to fix this is to remove the old version\n");
|
||||||
|
printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
|
||||||
|
printf("*** correct copy of gtk-config. (In this case, you will have to\n");
|
||||||
|
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
|
||||||
|
printf("*** so that the correct libraries are found at run-time))\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||||
|
CFLAGS="$ac_save_CFLAGS"
|
||||||
|
LIBS="$ac_save_LIBS"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if test "x$no_gtk" = x ; then
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
ifelse([$2], , :, [$2])
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
if test "$GTK_CONFIG" = "no" ; then
|
||||||
|
echo "*** The gtk-config script installed by GTK could not be found"
|
||||||
|
echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
|
||||||
|
echo "*** your path, or set the GTK_CONFIG environment variable to the"
|
||||||
|
echo "*** full path to gtk-config."
|
||||||
|
else
|
||||||
|
if test -f conf.gtktest ; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
echo "*** Could not run GTK test program, checking why..."
|
||||||
|
CFLAGS="$CFLAGS $GTK_CFLAGS"
|
||||||
|
LIBS="$LIBS $GTK_LIBS"
|
||||||
|
AC_TRY_LINK([
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
|
||||||
|
[ echo "*** The test program compiled, but did not run. This usually means"
|
||||||
|
echo "*** that the run-time linker is not finding GTK or finding the wrong"
|
||||||
|
echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
|
||||||
|
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
|
||||||
|
echo "*** to the installed location Also, make sure you have run ldconfig if that"
|
||||||
|
echo "*** is required on your system"
|
||||||
|
echo "***"
|
||||||
|
echo "*** If you have an old version installed, it is best to remove it, although"
|
||||||
|
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
|
||||||
|
echo "***"
|
||||||
|
echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
|
||||||
|
echo "*** came with the system with the command"
|
||||||
|
echo "***"
|
||||||
|
echo "*** rpm --erase --nodeps gtk gtk-devel" ],
|
||||||
|
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||||
|
echo "*** exact error that occured. This usually means GTK was incorrectly installed"
|
||||||
|
echo "*** or that you have moved GTK since it was installed. In the latter case, you"
|
||||||
|
echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
|
||||||
|
CFLAGS="$ac_save_CFLAGS"
|
||||||
|
LIBS="$ac_save_LIBS"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
GTK_CFLAGS=""
|
||||||
|
GTK_LIBS=""
|
||||||
|
ifelse([$3], , :, [$3])
|
||||||
|
fi
|
||||||
|
AC_SUBST(GTK_CFLAGS)
|
||||||
|
AC_SUBST(GTK_LIBS)
|
||||||
|
rm -f conf.gtktest
|
||||||
|
])
|
||||||
|
|
||||||
81
configure.in
Normal file
81
configure.in
Normal file
|
|
@ -0,0 +1,81 @@
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
|
dnl $Id$
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
AC_INIT(gtkmeat.c)
|
||||||
|
GTKMEAT_VERSION=0.5.4
|
||||||
|
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
dnl for automake:
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
AUTOMAKE_OPTIONS=no-dependencies
|
||||||
|
VERSION=$GTKMEAT_VERSION
|
||||||
|
PACKAGE=gtkmeat
|
||||||
|
|
||||||
|
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
dnl Initialize automake now
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
|
||||||
|
AC_SUBST(GTKMEAT_VERSION)
|
||||||
|
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
dnl checks for needed compilers
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
dnl CFLAGS=""
|
||||||
|
dnl if test x${CFLAGS+set} = xset ; then
|
||||||
|
dnl :
|
||||||
|
dnl else
|
||||||
|
dnl CFLAGS="-O2 -g"
|
||||||
|
dnl fi
|
||||||
|
|
||||||
|
AC_PROG_CC
|
||||||
|
dnl AC_PROG_CXX
|
||||||
|
dnl AC_PROG_RANLIB
|
||||||
|
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
dnl clean compiles
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
compiler_warnings=yes
|
||||||
|
AC_ARG_ENABLE(
|
||||||
|
warnings,
|
||||||
|
[ --disable-warnings turn OFF gcc compiler warnings (not recommended)],
|
||||||
|
[if test $enableval = no; then
|
||||||
|
compiler_warnings=no
|
||||||
|
fi]
|
||||||
|
)
|
||||||
|
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
dnl now some other stuff
|
||||||
|
dnl AC_CANONICAL_HOST ... needs config.guess
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
AM_SANITY_CHECK
|
||||||
|
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
dnl check for GTK
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
AM_PATH_GTK(1.1.2,
|
||||||
|
[LIBS="$LIBS $GTK_LIBS"
|
||||||
|
CFLAGS="$CFLAGS $GTK_CFLAGS"],
|
||||||
|
AC_MSG_ERROR(Cannot find GTK+: Is gtk-config in executable path?))
|
||||||
|
|
||||||
|
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
dnl enable GUI/console type checking
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
dnl checks for correctly defined types
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
AC_HEADER_STDC
|
||||||
|
AC_HEADER_SYS_WAIT
|
||||||
|
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
dnl checks for header files & functions
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
AC_CHECK_HEADERS(unistd.h)
|
||||||
|
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
dnl Makefiles to create:
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
AC_OUTPUT(Makefile)
|
||||||
504
gtkmeat.c
Normal file
504
gtkmeat.c
Normal file
|
|
@ -0,0 +1,504 @@
|
||||||
|
/* gtkMeat - freshmeat new submissions ticker
|
||||||
|
* (c) 1998 Troy Engel <tengel@sonic.net>
|
||||||
|
*
|
||||||
|
* Based on original code from gtkSlash
|
||||||
|
*
|
||||||
|
* This code is distributed under the terms of the GNU
|
||||||
|
* General Public License, etc etc. Use it, don't abuse it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* just what it says - good for layout development
|
||||||
|
* just remember to turn it off :P */
|
||||||
|
/* #define _LOCAL_TEST_MODE */
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#define DIR_CHAR "\\"
|
||||||
|
#define DOT_CHAR "_"
|
||||||
|
#else
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
#define DIR_CHAR "/"
|
||||||
|
#define DOT_CHAR "."
|
||||||
|
/* these two allow Win people to "hide" a cmdline
|
||||||
|
* app. Provided here just so it works (could be used
|
||||||
|
* for the same thing in 'startApp' on unix?)
|
||||||
|
*/
|
||||||
|
#define SW_SHOWDEFAULT 0
|
||||||
|
#define SW_HIDE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "rcfuncs.h"
|
||||||
|
|
||||||
|
#define MAX_BUFF 1024
|
||||||
|
#define APP_RC "gtkmeatrc"
|
||||||
|
|
||||||
|
#define MSG_TITLE "freshmeat New Submissions"
|
||||||
|
#define MSG_INIT "Initializing..."
|
||||||
|
#define MSG_LOAD "Loading recentnews.txt..."
|
||||||
|
#define MSG_LOAD_ERR "Error loading recentnews.txt!"
|
||||||
|
#define MSG_RETRIEVE "Retrieving latest recentnews.txt..."
|
||||||
|
#define MSG_RETR_ERR "Error retrieving recentnews.txt!"
|
||||||
|
#define MSG_LAUNCH "Launching web browser..."
|
||||||
|
#define MSG_LAUNCH_ERR "Error launching browser!"
|
||||||
|
#define MSG_IDLE "Status: Idle (gtkMeat 0.5.4)"
|
||||||
|
|
||||||
|
/* read from RC file */
|
||||||
|
gint refresh_timeout;
|
||||||
|
gchar browser_cmd[MAX_BUFF];
|
||||||
|
gchar new_browser_cmd[MAX_BUFF];
|
||||||
|
gchar curl_cmd[MAX_BUFF];
|
||||||
|
BOOL compact_mode;
|
||||||
|
gint num_fields;
|
||||||
|
|
||||||
|
/* some ugly global vars */
|
||||||
|
GtkWidget *status;
|
||||||
|
|
||||||
|
/* retrieves a line from a linefeed delimited textfile */
|
||||||
|
gchar *app_getLine(FILE *file) {
|
||||||
|
char *tmp, in;
|
||||||
|
int cnt = 0, retIn;
|
||||||
|
|
||||||
|
if (feof(file)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tmp = g_malloc(sizeof(char) * MAX_BUFF);
|
||||||
|
retIn = fread((void *) &in, sizeof(char), 1, file);
|
||||||
|
if (retIn != 1) {
|
||||||
|
g_free(tmp);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
while ((in != '\n') && (cnt < MAX_BUFF)) {
|
||||||
|
tmp[cnt] = in;
|
||||||
|
cnt++;
|
||||||
|
retIn = fread((void *) &in, sizeof(char), 1, file);
|
||||||
|
if (retIn != 1) {
|
||||||
|
g_free(tmp);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (cnt == MAX_BUFF) {
|
||||||
|
g_free(tmp);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
tmp[cnt] = '\0';
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* loads ultramode.txt into our clist */
|
||||||
|
BOOL app_loadFile(GtkWidget *list, const gchar *fname) {
|
||||||
|
gchar *line;
|
||||||
|
gchar *article[2], *link;
|
||||||
|
FILE *fHnd;
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
fHnd = fopen(fname, "rb");
|
||||||
|
if (!fHnd) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
line = app_getLine(fHnd);
|
||||||
|
if (!line) {
|
||||||
|
fclose(fHnd);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
gtk_clist_clear(GTK_CLIST(list));
|
||||||
|
gtk_clist_freeze(GTK_CLIST(list));
|
||||||
|
link = NULL;
|
||||||
|
rewind(fHnd);
|
||||||
|
while (line) {
|
||||||
|
for (i = 0 ; i<num_fields; i++) {
|
||||||
|
line = app_getLine(fHnd);
|
||||||
|
if (line) {
|
||||||
|
switch (i) {
|
||||||
|
case 0: /* title */
|
||||||
|
article[0] = line;
|
||||||
|
break;
|
||||||
|
case 1: /* date */
|
||||||
|
article[1] = line;
|
||||||
|
break;
|
||||||
|
case 2: /* link */
|
||||||
|
link = line;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (line) {
|
||||||
|
int index;
|
||||||
|
index = gtk_clist_append(GTK_CLIST(list), article);
|
||||||
|
gtk_clist_set_row_data(GTK_CLIST(list), index, link);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose(fHnd);
|
||||||
|
gtk_clist_thaw(GTK_CLIST(list));
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* launches a given app */
|
||||||
|
BOOL app_startApp(const gchar *cmd, BOOL bWait, WORD wShowState) {
|
||||||
|
#ifndef WIN32
|
||||||
|
char **args, *work, *twrk;
|
||||||
|
int cnt, len, scnt, pid, sta;
|
||||||
|
|
||||||
|
pid = fork();
|
||||||
|
if (pid == 0) {
|
||||||
|
/* if not waiting for return of app, fork() again to
|
||||||
|
* detach completely */
|
||||||
|
if (!bWait) {
|
||||||
|
pid = fork();
|
||||||
|
}
|
||||||
|
if (pid == 0) {
|
||||||
|
len = strlen(cmd);
|
||||||
|
scnt = 1;
|
||||||
|
for (cnt = 0; cnt < len; cnt++) {
|
||||||
|
if (cmd[cnt] == ' ') {
|
||||||
|
scnt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args = g_malloc(sizeof(char *) * (scnt + 1));
|
||||||
|
args[scnt] = NULL;
|
||||||
|
if (scnt == 1) {
|
||||||
|
args[0] = g_malloc(sizeof(char) * (len + 1));
|
||||||
|
strcpy(args[0], cmd);
|
||||||
|
} else {
|
||||||
|
work = g_malloc(sizeof(char) * (len + 1));
|
||||||
|
strcpy(work, cmd);
|
||||||
|
twrk = (char *) strsep(&work, " ");
|
||||||
|
args[0] = twrk;
|
||||||
|
cnt = 1;
|
||||||
|
while (twrk) {
|
||||||
|
twrk = (char *) strsep(&work, " ");
|
||||||
|
args[cnt] = twrk;
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
|
args[cnt] = work;
|
||||||
|
}
|
||||||
|
/* TODO: wait for curl to finish on unix */
|
||||||
|
execvp(args[0], args);
|
||||||
|
} else {
|
||||||
|
_exit(0);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (bWait) {
|
||||||
|
pid = wait(&sta);
|
||||||
|
return WIFEXITED(sta);
|
||||||
|
} else {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
#else /* Win32 */
|
||||||
|
STARTUPINFO startupinfo;
|
||||||
|
PROCESS_INFORMATION processinfo;
|
||||||
|
|
||||||
|
startupinfo.cb = sizeof (STARTUPINFO);
|
||||||
|
startupinfo.lpReserved = NULL;
|
||||||
|
startupinfo.lpDesktop = NULL;
|
||||||
|
startupinfo.lpTitle = NULL;
|
||||||
|
startupinfo.dwFlags = STARTF_USESHOWWINDOW;
|
||||||
|
startupinfo.wShowWindow = wShowState;
|
||||||
|
startupinfo.cbReserved2 = 0;
|
||||||
|
startupinfo.lpReserved2 = NULL;
|
||||||
|
|
||||||
|
if (!CreateProcess (NULL, (gchar *)cmd, NULL, NULL,
|
||||||
|
TRUE, NORMAL_PRIORITY_CLASS, NULL,
|
||||||
|
NULL, &startupinfo, &processinfo)) {
|
||||||
|
g_message ("CreateProcess failed\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
CloseHandle (processinfo.hThread);
|
||||||
|
if (bWait)
|
||||||
|
WaitForSingleObject(processinfo.hProcess, INFINITE);
|
||||||
|
return TRUE;
|
||||||
|
#endif /* WIN32 */
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL app_getFile(const gchar *fname) {
|
||||||
|
gchar cmd[MAX_BUFF];
|
||||||
|
sprintf(cmd, curl_cmd, fname);
|
||||||
|
if (!app_startApp(cmd, TRUE, SW_HIDE))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL app_isZeroByte(const gchar *fname) {
|
||||||
|
FILE *fHnd;
|
||||||
|
gint ch = 0;
|
||||||
|
fHnd = fopen(fname, "rb");
|
||||||
|
if (!fHnd) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
ch = fgetc(fHnd);
|
||||||
|
if (ch == EOF) {
|
||||||
|
fclose(fHnd);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
fclose(fHnd);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
gint app_timer_idle(gpointer data) {
|
||||||
|
gtk_label_set(GTK_LABEL(status), MSG_IDLE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
gint app_exit(GtkWidget *widget, GdkEvent *event, gpointer data) {
|
||||||
|
gtk_main_quit();
|
||||||
|
exit(0);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
gint app_timer_refresh(GtkWidget *list) {
|
||||||
|
gchar *home_env, *fname;
|
||||||
|
gint retval;
|
||||||
|
#ifdef WIN32
|
||||||
|
gchar mypath[MAX_BUFF];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
home_env = getenv("HOME");
|
||||||
|
#ifdef WIN32 /* no HOME dir */
|
||||||
|
if (home_env == NULL) {
|
||||||
|
gchar *cutme;
|
||||||
|
GetModuleFileName(NULL, mypath, sizeof(mypath));
|
||||||
|
cutme = strrchr(mypath, '\\');
|
||||||
|
mypath[cutme - mypath] = '\0';
|
||||||
|
home_env = mypath;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
fname = g_malloc(sizeof(char) * (strlen(home_env) + 15));
|
||||||
|
strcpy(fname, home_env);
|
||||||
|
strcat(fname, DIR_CHAR);
|
||||||
|
strcat(fname, "recentnews.tmp");
|
||||||
|
|
||||||
|
retval = TRUE;
|
||||||
|
#ifndef _LOCAL_TEST_MODE
|
||||||
|
remove(fname);
|
||||||
|
gtk_label_set(GTK_LABEL(status), MSG_RETRIEVE);
|
||||||
|
if (!app_getFile(fname) || app_isZeroByte(fname)) {
|
||||||
|
gtk_label_set(GTK_LABEL(status), MSG_RETR_ERR);
|
||||||
|
retval = FALSE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
gtk_label_set(GTK_LABEL(status), MSG_LOAD);
|
||||||
|
if (retval && !app_loadFile(list, fname)) {
|
||||||
|
gtk_label_set(GTK_LABEL(status), MSG_LOAD_ERR);
|
||||||
|
retval = FALSE;
|
||||||
|
}
|
||||||
|
#ifndef _LOCAL_TEST_MODE
|
||||||
|
remove(fname);
|
||||||
|
#endif
|
||||||
|
g_free(fname);
|
||||||
|
if (retval)
|
||||||
|
gtk_label_set(GTK_LABEL(status), MSG_IDLE);
|
||||||
|
else
|
||||||
|
gtk_timeout_add(1000*5, app_timer_idle, NULL);
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
gint app_refresh(GtkWidget *widget, GtkWidget *list) {
|
||||||
|
return app_timer_refresh(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* launch our article */
|
||||||
|
void app_article_browse(GtkWidget *widget, gpointer data) {
|
||||||
|
gint rerr;
|
||||||
|
struct stat buff;
|
||||||
|
gchar *url, *fname, *home;
|
||||||
|
gchar cmd[MAX_BUFF];
|
||||||
|
|
||||||
|
url = gtk_clist_get_row_data(GTK_CLIST(data), GTK_CLIST(data)->focus_row);
|
||||||
|
#ifndef WIN32
|
||||||
|
home = getenv("HOME");
|
||||||
|
fname = g_malloc(sizeof(gchar) * (strlen(home) + 16));
|
||||||
|
strcpy(fname, home);
|
||||||
|
strcat(fname, "/.netscape/lock");
|
||||||
|
rerr = lstat(fname, &buff);
|
||||||
|
if (rerr == -1) {
|
||||||
|
sprintf(cmd, new_browser_cmd, url);
|
||||||
|
} else {
|
||||||
|
sprintf(cmd, browser_cmd, url);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
sprintf(cmd, browser_cmd, url);
|
||||||
|
#endif /* WIN32 */
|
||||||
|
gtk_label_set(GTK_LABEL(status), MSG_LAUNCH);
|
||||||
|
if (!app_startApp(cmd, FALSE, SW_SHOWDEFAULT))
|
||||||
|
gtk_label_set(GTK_LABEL(status), MSG_LAUNCH_ERR);
|
||||||
|
gtk_timeout_add(1000*5, app_timer_idle, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* sorting */
|
||||||
|
void app_click_column(GtkCList *clist, gint column, gpointer data) {
|
||||||
|
if (column == clist->sort_column) {
|
||||||
|
clist->sort_type = (clist->sort_type == GTK_SORT_ASCENDING) ?
|
||||||
|
GTK_SORT_DESCENDING : GTK_SORT_ASCENDING;
|
||||||
|
} else {
|
||||||
|
gtk_clist_set_sort_column (clist, column);
|
||||||
|
}
|
||||||
|
gtk_clist_sort(clist);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL app_parse_rc() {
|
||||||
|
gchar *home_env, *fname;
|
||||||
|
gint retval;
|
||||||
|
|
||||||
|
home_env = getenv("HOME");
|
||||||
|
fname = g_malloc(sizeof(gchar) * (strlen(home_env) + 15));
|
||||||
|
strcpy(fname, home_env);
|
||||||
|
strcat(fname, DIR_CHAR);
|
||||||
|
strcat(fname, DOT_CHAR);
|
||||||
|
strcat(fname, APP_RC);
|
||||||
|
|
||||||
|
retval = RCInit(fname);
|
||||||
|
g_free(fname);
|
||||||
|
|
||||||
|
/* if no personal file, look for system */
|
||||||
|
if (!retval) {
|
||||||
|
#ifdef WIN32
|
||||||
|
gchar tmp[MAX_BUFF];
|
||||||
|
GetWindowsDirectory(tmp, sizeof(tmp));
|
||||||
|
fname = g_malloc(sizeof(gchar) * (sizeof(tmp) + 1 + sizeof(APP_RC)));
|
||||||
|
strcpy(fname, tmp);
|
||||||
|
#else
|
||||||
|
fname = g_malloc(sizeof(gchar) * (4 + 1 + strlen(APP_RC)));
|
||||||
|
strcpy(fname, "/etc");
|
||||||
|
#endif
|
||||||
|
strcat(fname, DIR_CHAR);
|
||||||
|
strcat(fname, APP_RC);
|
||||||
|
retval = RCInit(fname);
|
||||||
|
g_free(fname);
|
||||||
|
}
|
||||||
|
|
||||||
|
refresh_timeout = RCGetInt("timeout-refresh", 1800);
|
||||||
|
compact_mode = RCGetBool("compact-mode", FALSE);
|
||||||
|
num_fields = RCGetInt("num-fields", 3);
|
||||||
|
RCGetString("browser-cmd", browser_cmd, "", sizeof(browser_cmd));
|
||||||
|
RCGetString("new-browser-cmd", new_browser_cmd, "", sizeof(new_browser_cmd));
|
||||||
|
RCGetString("curl-cmd", curl_cmd, "", sizeof(curl_cmd));
|
||||||
|
|
||||||
|
RCShutDown();
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
void app_window() {
|
||||||
|
GtkWidget *window, *vbox, *clist, *scrolled_win, *hbox, *but;
|
||||||
|
gchar *titles[2] = {"Title", "Date"};
|
||||||
|
|
||||||
|
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||||
|
gtk_window_set_title(GTK_WINDOW(window), MSG_TITLE);
|
||||||
|
gtk_signal_connect(GTK_OBJECT(window), "destroy", (GtkSignalFunc) app_exit, NULL);
|
||||||
|
gtk_widget_set_usize(GTK_WIDGET(window), 420, 155);
|
||||||
|
gtk_window_set_policy(GTK_WINDOW (window), TRUE, TRUE, TRUE);
|
||||||
|
|
||||||
|
vbox = gtk_vbox_new(FALSE, 5);
|
||||||
|
gtk_container_border_width (GTK_CONTAINER(vbox), 5);
|
||||||
|
gtk_container_add(GTK_CONTAINER(window), vbox);
|
||||||
|
|
||||||
|
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
||||||
|
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_win),
|
||||||
|
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||||
|
gtk_box_pack_start(GTK_BOX(vbox), scrolled_win, TRUE, TRUE, 0);
|
||||||
|
|
||||||
|
clist = gtk_clist_new_with_titles(2, titles);
|
||||||
|
gtk_clist_set_selection_mode(GTK_CLIST(clist), GTK_SELECTION_BROWSE);
|
||||||
|
gtk_clist_set_column_width(GTK_CLIST(clist), 0, 220);
|
||||||
|
gtk_clist_set_column_width(GTK_CLIST(clist), 1, 50);
|
||||||
|
gtk_signal_connect(GTK_OBJECT (clist), "click_column",
|
||||||
|
(GtkSignalFunc)app_click_column, NULL);
|
||||||
|
gtk_container_add(GTK_CONTAINER(scrolled_win), clist);
|
||||||
|
gtk_widget_show(clist);
|
||||||
|
gtk_widget_show(scrolled_win);
|
||||||
|
|
||||||
|
if (!compact_mode) {
|
||||||
|
hbox = gtk_hbox_new(FALSE, 0);
|
||||||
|
but = gtk_button_new_with_label("Refresh");
|
||||||
|
gtk_widget_set_usize(GTK_WIDGET(but), 70, 24);
|
||||||
|
gtk_signal_connect(GTK_OBJECT(but), "clicked", (GtkSignalFunc) app_refresh, clist);
|
||||||
|
gtk_box_pack_start(GTK_BOX(hbox), but, FALSE, FALSE, 0);
|
||||||
|
gtk_widget_show(but);
|
||||||
|
|
||||||
|
but = gtk_button_new_with_label("Read");
|
||||||
|
gtk_widget_set_usize(GTK_WIDGET(but), 70, 24);
|
||||||
|
gtk_signal_connect(GTK_OBJECT(but), "clicked", (GtkSignalFunc) app_article_browse, (gpointer)clist);
|
||||||
|
gtk_box_pack_start(GTK_BOX(hbox), but, FALSE, FALSE, 0);
|
||||||
|
gtk_widget_show(but);
|
||||||
|
|
||||||
|
status = gtk_label_new(MSG_INIT);
|
||||||
|
gtk_box_pack_start(GTK_BOX(hbox), status, FALSE, FALSE, 10);
|
||||||
|
gtk_widget_show(status);
|
||||||
|
|
||||||
|
but = gtk_button_new_with_label("Quit");
|
||||||
|
gtk_widget_set_usize(GTK_WIDGET(but), 70, 24);
|
||||||
|
gtk_signal_connect(GTK_OBJECT(but), "clicked", (GtkSignalFunc) app_exit, NULL);
|
||||||
|
gtk_box_pack_end(GTK_BOX(hbox), but, FALSE, FALSE, 0);
|
||||||
|
gtk_widget_show(but);
|
||||||
|
|
||||||
|
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
|
||||||
|
gtk_widget_show(hbox);
|
||||||
|
} else {
|
||||||
|
gtk_clist_column_titles_hide(GTK_CLIST(clist));
|
||||||
|
gtk_signal_connect(GTK_OBJECT (clist), "select_row", (GtkSignalFunc) app_article_browse, (gpointer)clist);
|
||||||
|
status = gtk_label_new("");
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_timeout_add(1000*refresh_timeout, (GtkFunction) app_timer_refresh, clist);
|
||||||
|
|
||||||
|
gtk_widget_show(vbox);
|
||||||
|
gtk_widget_show(window);
|
||||||
|
|
||||||
|
app_refresh(NULL, clist);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nShowCmd) {
|
||||||
|
#else
|
||||||
|
void main(int argc, char **argv) {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
/* parse into a command line ala argv, argc */
|
||||||
|
char **argv, *work, *twrk;
|
||||||
|
int cnt, len, argc;
|
||||||
|
|
||||||
|
len = strlen(lpCmdLine);
|
||||||
|
argc = 0;
|
||||||
|
for (cnt = 0; cnt < len; cnt++) {
|
||||||
|
if (lpCmdLine[cnt] == ' ') {
|
||||||
|
argc++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
argv = g_malloc(sizeof(char *) * (argc + 1));
|
||||||
|
argv[argc] = NULL;
|
||||||
|
if (argc == 1) {
|
||||||
|
argv[0] = g_malloc(sizeof(char) * (len + 1));
|
||||||
|
strcpy(argv[0], lpCmdLine);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
work = g_malloc(sizeof(char) * (len + 1));
|
||||||
|
strcpy(work, lpCmdLine);
|
||||||
|
twrk = (char *) strtok(work, " ");
|
||||||
|
argv[0] = twrk;
|
||||||
|
cnt = 1;
|
||||||
|
while (twrk) {
|
||||||
|
twrk = (char *) strtok(NULL, " ");
|
||||||
|
argv[cnt] = twrk;
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
|
argv[cnt] = work;
|
||||||
|
}
|
||||||
|
#endif /* WIN32 */
|
||||||
|
|
||||||
|
gtk_init(&argc, &argv);
|
||||||
|
app_parse_rc();
|
||||||
|
app_window();
|
||||||
|
gtk_main();
|
||||||
|
}
|
||||||
37
gtkmeatrc
Normal file
37
gtkmeatrc
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
# Configuration file for gtkMeat
|
||||||
|
#
|
||||||
|
# System Wide:
|
||||||
|
# /etc/gtkmeatrc
|
||||||
|
# <windowsdir>\gtkmeatrc
|
||||||
|
#
|
||||||
|
# Per user:
|
||||||
|
# <HOME>/.gtkmeatrc
|
||||||
|
# <HOME>\_gtkmeatrc
|
||||||
|
|
||||||
|
# Number of seconds before a refresh is performed...
|
||||||
|
# Default: 1800
|
||||||
|
refresh-timeout 1800
|
||||||
|
|
||||||
|
# Netscape command, %s is replaced by the URL
|
||||||
|
# Default: none
|
||||||
|
#browser-cmd "D:\Netscape\Program\netscape.exe %s"
|
||||||
|
# Under *nix, we need two commands for netscape - one if the browser
|
||||||
|
# isn't running already, and one if it is
|
||||||
|
new-browser-cmd "/usr/bin/netscape %s"
|
||||||
|
browser-cmd "/usr/bin/netscape -remote openURL(%s, new_window)"
|
||||||
|
|
||||||
|
# Curl command, %s is replaced by ~/recentnews.tmp
|
||||||
|
# Default: none
|
||||||
|
#curl-cmd "C:\Util\curl.exe -s -o %s http://files.freshmeat.net/freshmeat/recentnews.txt"
|
||||||
|
curl-cmd "/usr/local/bin/curl -s -o %s http://files.freshmeat.net/freshmeat/recentnews.txt"
|
||||||
|
|
||||||
|
# If you'd like to run gtkmeat in "compact" mode (without
|
||||||
|
# the buttons on the bottom & the column titles, and
|
||||||
|
# launching an article upon a click on its row) set this
|
||||||
|
# variable to ON. Default: OFF
|
||||||
|
compact-mode OFF
|
||||||
|
|
||||||
|
# Number of fields in recentnews.txt. There are 3 fields per
|
||||||
|
# record as of 01/03/99.
|
||||||
|
# Default: 3
|
||||||
|
num-fields 3
|
||||||
250
install-sh
Executable file
250
install-sh
Executable file
|
|
@ -0,0 +1,250 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# install - install a program, script, or datafile
|
||||||
|
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||||
|
#
|
||||||
|
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||||
|
#
|
||||||
|
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||||
|
# documentation for any purpose is hereby granted without fee, provided that
|
||||||
|
# the above copyright notice appear in all copies and that both that
|
||||||
|
# copyright notice and this permission notice appear in supporting
|
||||||
|
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||||
|
# publicity pertaining to distribution of the software without specific,
|
||||||
|
# written prior permission. M.I.T. makes no representations about the
|
||||||
|
# suitability of this software for any purpose. It is provided "as is"
|
||||||
|
# without express or implied warranty.
|
||||||
|
#
|
||||||
|
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||||
|
# `make' implicit rules from creating a file called install from it
|
||||||
|
# when there is no Makefile.
|
||||||
|
#
|
||||||
|
# This script is compatible with the BSD install script, but was written
|
||||||
|
# from scratch. It can only install one file at a time, a restriction
|
||||||
|
# shared with many OS's install programs.
|
||||||
|
|
||||||
|
|
||||||
|
# set DOITPROG to echo to test this script
|
||||||
|
|
||||||
|
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||||
|
doit="${DOITPROG-}"
|
||||||
|
|
||||||
|
|
||||||
|
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||||
|
|
||||||
|
mvprog="${MVPROG-mv}"
|
||||||
|
cpprog="${CPPROG-cp}"
|
||||||
|
chmodprog="${CHMODPROG-chmod}"
|
||||||
|
chownprog="${CHOWNPROG-chown}"
|
||||||
|
chgrpprog="${CHGRPPROG-chgrp}"
|
||||||
|
stripprog="${STRIPPROG-strip}"
|
||||||
|
rmprog="${RMPROG-rm}"
|
||||||
|
mkdirprog="${MKDIRPROG-mkdir}"
|
||||||
|
|
||||||
|
transformbasename=""
|
||||||
|
transform_arg=""
|
||||||
|
instcmd="$mvprog"
|
||||||
|
chmodcmd="$chmodprog 0755"
|
||||||
|
chowncmd=""
|
||||||
|
chgrpcmd=""
|
||||||
|
stripcmd=""
|
||||||
|
rmcmd="$rmprog -f"
|
||||||
|
mvcmd="$mvprog"
|
||||||
|
src=""
|
||||||
|
dst=""
|
||||||
|
dir_arg=""
|
||||||
|
|
||||||
|
while [ x"$1" != x ]; do
|
||||||
|
case $1 in
|
||||||
|
-c) instcmd="$cpprog"
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-d) dir_arg=true
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-m) chmodcmd="$chmodprog $2"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-o) chowncmd="$chownprog $2"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-g) chgrpcmd="$chgrpprog $2"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-s) stripcmd="$stripprog"
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
*) if [ x"$src" = x ]
|
||||||
|
then
|
||||||
|
src=$1
|
||||||
|
else
|
||||||
|
# this colon is to work around a 386BSD /bin/sh bug
|
||||||
|
:
|
||||||
|
dst=$1
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ x"$src" = x ]
|
||||||
|
then
|
||||||
|
echo "install: no input file specified"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x"$dir_arg" != x ]; then
|
||||||
|
dst=$src
|
||||||
|
src=""
|
||||||
|
|
||||||
|
if [ -d $dst ]; then
|
||||||
|
instcmd=:
|
||||||
|
else
|
||||||
|
instcmd=mkdir
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
|
||||||
|
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||||
|
# might cause directories to be created, which would be especially bad
|
||||||
|
# if $src (and thus $dsttmp) contains '*'.
|
||||||
|
|
||||||
|
if [ -f $src -o -d $src ]
|
||||||
|
then
|
||||||
|
true
|
||||||
|
else
|
||||||
|
echo "install: $src does not exist"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x"$dst" = x ]
|
||||||
|
then
|
||||||
|
echo "install: no destination specified"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If destination is a directory, append the input filename; if your system
|
||||||
|
# does not like double slashes in filenames, you may need to add some logic
|
||||||
|
|
||||||
|
if [ -d $dst ]
|
||||||
|
then
|
||||||
|
dst="$dst"/`basename $src`
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
## this sed command emulates the dirname command
|
||||||
|
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||||
|
|
||||||
|
# Make sure that the destination directory exists.
|
||||||
|
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||||
|
|
||||||
|
# Skip lots of stat calls in the usual case.
|
||||||
|
if [ ! -d "$dstdir" ]; then
|
||||||
|
defaultIFS='
|
||||||
|
'
|
||||||
|
IFS="${IFS-${defaultIFS}}"
|
||||||
|
|
||||||
|
oIFS="${IFS}"
|
||||||
|
# Some sh's can't handle IFS=/ for some reason.
|
||||||
|
IFS='%'
|
||||||
|
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||||
|
IFS="${oIFS}"
|
||||||
|
|
||||||
|
pathcomp=''
|
||||||
|
|
||||||
|
while [ $# -ne 0 ] ; do
|
||||||
|
pathcomp="${pathcomp}${1}"
|
||||||
|
shift
|
||||||
|
|
||||||
|
if [ ! -d "${pathcomp}" ] ;
|
||||||
|
then
|
||||||
|
$mkdirprog "${pathcomp}"
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
pathcomp="${pathcomp}/"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x"$dir_arg" != x ]
|
||||||
|
then
|
||||||
|
$doit $instcmd $dst &&
|
||||||
|
|
||||||
|
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||||
|
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||||
|
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||||
|
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||||
|
else
|
||||||
|
|
||||||
|
# If we're going to rename the final executable, determine the name now.
|
||||||
|
|
||||||
|
if [ x"$transformarg" = x ]
|
||||||
|
then
|
||||||
|
dstfile=`basename $dst`
|
||||||
|
else
|
||||||
|
dstfile=`basename $dst $transformbasename |
|
||||||
|
sed $transformarg`$transformbasename
|
||||||
|
fi
|
||||||
|
|
||||||
|
# don't allow the sed command to completely eliminate the filename
|
||||||
|
|
||||||
|
if [ x"$dstfile" = x ]
|
||||||
|
then
|
||||||
|
dstfile=`basename $dst`
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make a temp file name in the proper directory.
|
||||||
|
|
||||||
|
dsttmp=$dstdir/#inst.$$#
|
||||||
|
|
||||||
|
# Move or copy the file name to the temp name
|
||||||
|
|
||||||
|
$doit $instcmd $src $dsttmp &&
|
||||||
|
|
||||||
|
trap "rm -f ${dsttmp}" 0 &&
|
||||||
|
|
||||||
|
# and set any options; do chmod last to preserve setuid bits
|
||||||
|
|
||||||
|
# If any of these fail, we abort the whole thing. If we want to
|
||||||
|
# ignore errors from any of these, just make sure not to ignore
|
||||||
|
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||||
|
|
||||||
|
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||||
|
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||||
|
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||||
|
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||||
|
|
||||||
|
# Now rename the file to the real destination.
|
||||||
|
|
||||||
|
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||||
|
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||||
|
|
||||||
|
fi &&
|
||||||
|
|
||||||
|
|
||||||
|
exit 0
|
||||||
188
missing
Executable file
188
missing
Executable file
|
|
@ -0,0 +1,188 @@
|
||||||
|
#! /bin/sh
|
||||||
|
# Common stub for a few missing GNU programs while installing.
|
||||||
|
# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
|
# 02111-1307, USA.
|
||||||
|
|
||||||
|
if test $# -eq 0; then
|
||||||
|
echo 1>&2 "Try \`$0 --help' for more information"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
|
||||||
|
-h|--h|--he|--hel|--help)
|
||||||
|
echo "\
|
||||||
|
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||||
|
|
||||||
|
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
|
||||||
|
error status if there is no known handling for PROGRAM.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help display this help and exit
|
||||||
|
-v, --version output version information and exit
|
||||||
|
|
||||||
|
Supported PROGRAM values:
|
||||||
|
aclocal touch file \`aclocal.m4'
|
||||||
|
autoconf touch file \`configure'
|
||||||
|
autoheader touch file \`config.h.in'
|
||||||
|
automake touch all \`Makefile.in' files
|
||||||
|
bison create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||||
|
flex create \`lex.yy.c', if possible, from existing .c
|
||||||
|
lex create \`lex.yy.c', if possible, from existing .c
|
||||||
|
makeinfo touch the output file
|
||||||
|
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
|
||||||
|
;;
|
||||||
|
|
||||||
|
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||||
|
echo "missing - GNU libit 0.0"
|
||||||
|
;;
|
||||||
|
|
||||||
|
-*)
|
||||||
|
echo 1>&2 "$0: Unknown \`$1' option"
|
||||||
|
echo 1>&2 "Try \`$0 --help' for more information"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
|
||||||
|
aclocal)
|
||||||
|
echo 1>&2 "\
|
||||||
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
|
you modified \`acinclude.m4' or \`configure.in'. You might want
|
||||||
|
to install the \`Automake' and \`Perl' packages. Grab them from
|
||||||
|
any GNU archive site."
|
||||||
|
touch aclocal.m4
|
||||||
|
;;
|
||||||
|
|
||||||
|
autoconf)
|
||||||
|
echo 1>&2 "\
|
||||||
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
|
you modified \`configure.in'. You might want to install the
|
||||||
|
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
|
||||||
|
archive site."
|
||||||
|
touch configure
|
||||||
|
;;
|
||||||
|
|
||||||
|
autoheader)
|
||||||
|
echo 1>&2 "\
|
||||||
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
|
you modified \`acconfig.h' or \`configure.in'. You might want
|
||||||
|
to install the \`Autoconf' and \`GNU m4' packages. Grab them
|
||||||
|
from any GNU archive site."
|
||||||
|
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER([^):]*:\([^)]*\)).*/\1/p' configure.in`
|
||||||
|
if test -z "$files"; then
|
||||||
|
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^):]*\)).*/\1/p' configure.in`
|
||||||
|
test -z "$files" || files="$files.in"
|
||||||
|
else
|
||||||
|
files=`echo "$files" | sed -e 's/:/ /g'`
|
||||||
|
fi
|
||||||
|
test -z "$files" && files="config.h.in"
|
||||||
|
touch $files
|
||||||
|
;;
|
||||||
|
|
||||||
|
automake)
|
||||||
|
echo 1>&2 "\
|
||||||
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
|
you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
|
||||||
|
You might want to install the \`Automake' and \`Perl' packages.
|
||||||
|
Grab them from any GNU archive site."
|
||||||
|
find . -type f -name Makefile.am -print \
|
||||||
|
| sed 's/^\(.*\).am$/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."
|
||||||
|
rm -f y.tab.c y.tab.h
|
||||||
|
if [ $# -ne 1 ]; then
|
||||||
|
eval LASTARG="\${$#}"
|
||||||
|
case "$LASTARG" in
|
||||||
|
*.y)
|
||||||
|
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
||||||
|
if [ -f "$SRCFILE" ]; then
|
||||||
|
cp "$SRCFILE" y.tab.c
|
||||||
|
fi
|
||||||
|
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
||||||
|
if [ -f "$SRCFILE" ]; then
|
||||||
|
cp "$SRCFILE" y.tab.h
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
if [ ! -f y.tab.h ]; then
|
||||||
|
echo >y.tab.h
|
||||||
|
fi
|
||||||
|
if [ ! -f y.tab.c ]; then
|
||||||
|
echo 'main() { return 0; }' >y.tab.c
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
lex|flex)
|
||||||
|
echo 1>&2 "\
|
||||||
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
|
you modified a \`.l' file. You may need the \`Flex' package
|
||||||
|
in order for those modifications to take effect. You can get
|
||||||
|
\`Flex' from any GNU archive site."
|
||||||
|
rm -f lex.yy.c
|
||||||
|
if [ $# -ne 1 ]; then
|
||||||
|
eval LASTARG="\${$#}"
|
||||||
|
case "$LASTARG" in
|
||||||
|
*.l)
|
||||||
|
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
||||||
|
if [ -f "$SRCFILE" ]; then
|
||||||
|
cp "$SRCFILE" lex.yy.c
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
if [ ! -f lex.yy.c ]; then
|
||||||
|
echo 'main() { return 0; }' >lex.yy.c
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
makeinfo)
|
||||||
|
echo 1>&2 "\
|
||||||
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
|
you modified a \`.texi' or \`.texinfo' file, or any other file
|
||||||
|
indirectly affecting the aspect of the manual. The spurious
|
||||||
|
call might also be the consequence of using a buggy \`make' (AIX,
|
||||||
|
DU, IRIX). You might want to install the \`Texinfo' package or
|
||||||
|
the \`GNU make' package. Grab either from any GNU archive site."
|
||||||
|
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||||
|
if test -z "$file"; then
|
||||||
|
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
||||||
|
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
|
||||||
|
fi
|
||||||
|
touch $file
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo 1>&2 "\
|
||||||
|
WARNING: \`$1' is needed, and you do not seem to have it handy on your
|
||||||
|
system. You might have modified some files without having the
|
||||||
|
proper tools for further handling them. Check the \`README' file,
|
||||||
|
it often tells you about the needed prerequirements for installing
|
||||||
|
this package. You may also peek at any GNU archive site, in case
|
||||||
|
some other package would contain this missing \`$1' program."
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
||||||
40
mkinstalldirs
Executable file
40
mkinstalldirs
Executable file
|
|
@ -0,0 +1,40 @@
|
||||||
|
#! /bin/sh
|
||||||
|
# mkinstalldirs --- make directory hierarchy
|
||||||
|
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
|
||||||
|
# Created: 1993-05-16
|
||||||
|
# Public domain
|
||||||
|
|
||||||
|
# $Id: mkinstalldirs,v 1.10 1996/05/03 07:37:52 friedman Exp $
|
||||||
|
|
||||||
|
errstatus=0
|
||||||
|
|
||||||
|
for file
|
||||||
|
do
|
||||||
|
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
|
||||||
|
shift
|
||||||
|
|
||||||
|
pathcomp=
|
||||||
|
for d
|
||||||
|
do
|
||||||
|
pathcomp="$pathcomp$d"
|
||||||
|
case "$pathcomp" in
|
||||||
|
-* ) pathcomp=./$pathcomp ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if test ! -d "$pathcomp"; then
|
||||||
|
echo "mkdir $pathcomp" 1>&2
|
||||||
|
|
||||||
|
mkdir "$pathcomp" || lasterr=$?
|
||||||
|
|
||||||
|
if test ! -d "$pathcomp"; then
|
||||||
|
errstatus=$lasterr
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
pathcomp="$pathcomp/"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
exit $errstatus
|
||||||
|
|
||||||
|
# mkinstalldirs ends here
|
||||||
336
rcfuncs.c
Normal file
336
rcfuncs.c
Normal file
|
|
@ -0,0 +1,336 @@
|
||||||
|
/*
|
||||||
|
* rcfuncs - routines to parse generic RC files
|
||||||
|
* tengel@sonic.net
|
||||||
|
*
|
||||||
|
* This is taken from the LiteStep Shell Source code
|
||||||
|
* (http://www.litestep.net) and modified a bunch to meet
|
||||||
|
* our RC needs along with using gdk. It is released under
|
||||||
|
* the GPL and any litestep licensing restrictions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <gdk/gdk.h>
|
||||||
|
#ifdef WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "rcfuncs.h"
|
||||||
|
|
||||||
|
#ifndef MAX_BUFF
|
||||||
|
#define MAX_BUFF 1024
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static gchar **RCBuffer = NULL;
|
||||||
|
static gint RCLen = 0;
|
||||||
|
|
||||||
|
FILE* RCOpen(const gchar *szFile)
|
||||||
|
{
|
||||||
|
FILE *f = NULL;
|
||||||
|
|
||||||
|
if (!szFile)
|
||||||
|
return f;
|
||||||
|
|
||||||
|
/* make sure to open in text mode; in MS ANSI C,
|
||||||
|
* this will map our \n and \r\n for us. Valid
|
||||||
|
* in unix? */
|
||||||
|
f = fopen(szFile, "rt");
|
||||||
|
if (f)
|
||||||
|
fseek(f, 0, SEEK_SET);
|
||||||
|
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL RCClose(FILE *f)
|
||||||
|
{
|
||||||
|
if (f)
|
||||||
|
fclose (f);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Parses szString, splitting it up into tokens. Pays
|
||||||
|
* attention to single and double quotes. */
|
||||||
|
gint RCTokenize(const gchar *szString, gchar **lpszBuffers, DWORD dwNumBuffers, gchar *szExtraParameters)
|
||||||
|
{
|
||||||
|
gint index = 0;
|
||||||
|
gchar quoteChar = 0;
|
||||||
|
gchar buffer[MAX_BUFF];
|
||||||
|
gchar output[MAX_BUFF];
|
||||||
|
gchar *pOutput = NULL;
|
||||||
|
DWORD dwBufferCount = 0;
|
||||||
|
|
||||||
|
strcpy(buffer, szString);
|
||||||
|
pOutput = output;
|
||||||
|
|
||||||
|
while (buffer[index] && dwBufferCount < dwNumBuffers) {
|
||||||
|
BOOL skipWhitespace = FALSE;
|
||||||
|
|
||||||
|
switch (buffer[index]) {
|
||||||
|
case '"':
|
||||||
|
case '\'':
|
||||||
|
{
|
||||||
|
if (!quoteChar) {
|
||||||
|
quoteChar = buffer[index];
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
if (quoteChar == buffer[index]) {
|
||||||
|
quoteChar = 0;
|
||||||
|
strcpy (*lpszBuffers, output);
|
||||||
|
lpszBuffers++;
|
||||||
|
dwBufferCount++;
|
||||||
|
|
||||||
|
if (dwBufferCount < dwNumBuffers)
|
||||||
|
(*lpszBuffers)[0] = '\0';
|
||||||
|
|
||||||
|
pOutput = output;
|
||||||
|
*pOutput = '\0';
|
||||||
|
skipWhitespace = TRUE;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
*pOutput++ = buffer[index];
|
||||||
|
*pOutput = '\0';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case ' ':
|
||||||
|
case '\t':
|
||||||
|
{
|
||||||
|
if (!quoteChar) {
|
||||||
|
if (strlen (output)) {
|
||||||
|
strcpy (*lpszBuffers, output);
|
||||||
|
lpszBuffers++;
|
||||||
|
dwBufferCount++;
|
||||||
|
|
||||||
|
if (dwBufferCount < dwNumBuffers)
|
||||||
|
(*lpszBuffers)[0] = '\0';
|
||||||
|
|
||||||
|
pOutput = output;
|
||||||
|
*pOutput = '\0';
|
||||||
|
skipWhitespace = TRUE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
*pOutput++ = buffer[index];
|
||||||
|
*pOutput = '\0';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
*pOutput++ = buffer[index];
|
||||||
|
*pOutput = '\0';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
index++;
|
||||||
|
if (skipWhitespace) {
|
||||||
|
while(isspace(buffer[index])) {
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strlen (output)) {
|
||||||
|
if (dwBufferCount < dwNumBuffers) {
|
||||||
|
dwBufferCount++;
|
||||||
|
strcat(*lpszBuffers, output);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (szExtraParameters && dwBufferCount == dwNumBuffers)
|
||||||
|
strcpy (szExtraParameters, buffer + index);
|
||||||
|
|
||||||
|
return dwBufferCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
gchar* RCFindLine(const gchar *lpKeyName)
|
||||||
|
{
|
||||||
|
gint i;
|
||||||
|
gint l = strlen(lpKeyName);
|
||||||
|
|
||||||
|
for (i = 0; i < RCLen; i++) {
|
||||||
|
#ifdef WIN32
|
||||||
|
if (!strnicmp(RCBuffer[i], lpKeyName, l))
|
||||||
|
#else
|
||||||
|
if (!strncasecmp(RCBuffer[i], lpKeyName, l))
|
||||||
|
#endif
|
||||||
|
return RCBuffer[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return (gchar *) 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
gint RCGetInt(const gchar *lpKeyName, gint nDefault)
|
||||||
|
{
|
||||||
|
gint val = nDefault;
|
||||||
|
gchar *line = NULL;
|
||||||
|
gchar token1[MAX_BUFF], token2[MAX_BUFF];
|
||||||
|
gchar *tokens[2];
|
||||||
|
|
||||||
|
tokens[0] = token1;
|
||||||
|
tokens[1] = token2;
|
||||||
|
line = RCFindLine(lpKeyName);
|
||||||
|
if (line) {
|
||||||
|
gint count = 0;
|
||||||
|
token1[0] = token2[0] = '\0';
|
||||||
|
count = RCTokenize(line, tokens, 2, NULL);
|
||||||
|
if (count < 2)
|
||||||
|
return val;
|
||||||
|
val = atoi(token2);
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL RCGetBool(const gchar *lpKeyName, BOOL ifFound)
|
||||||
|
{
|
||||||
|
gchar token1[MAX_BUFF], token2[MAX_BUFF];
|
||||||
|
gchar *tokens[2];
|
||||||
|
gchar *line = NULL;
|
||||||
|
|
||||||
|
tokens[0] = token1;
|
||||||
|
tokens[1] = token2;
|
||||||
|
line = RCFindLine(lpKeyName);
|
||||||
|
if (line) {
|
||||||
|
gint count = 0;
|
||||||
|
token1[0] = token2[0] = '\0';
|
||||||
|
count = RCTokenize (line, tokens, 2, NULL);
|
||||||
|
if (count < 2)
|
||||||
|
return ifFound;
|
||||||
|
#ifdef WIN32
|
||||||
|
if (strnicmp (token2, "OFF", 3) == 0)
|
||||||
|
#else
|
||||||
|
if (strncasecmp (token2, "OFF", 3) == 0)
|
||||||
|
#endif
|
||||||
|
return FALSE;
|
||||||
|
else
|
||||||
|
return TRUE; /* ON */
|
||||||
|
}
|
||||||
|
return (ifFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL RCGetString(const gchar *lpKeyName, gchar *value, const gchar *defStr, gint maxLen)
|
||||||
|
{
|
||||||
|
gchar token1[MAX_BUFF], token2[MAX_BUFF];
|
||||||
|
gchar *tokens[2];
|
||||||
|
gchar *line = NULL;
|
||||||
|
|
||||||
|
tokens[0] = token1;
|
||||||
|
tokens[1] = token2;
|
||||||
|
strncpy(value, defStr, maxLen);
|
||||||
|
line = RCFindLine(lpKeyName);
|
||||||
|
if (line) {
|
||||||
|
gint count = 0;
|
||||||
|
token1[0] = token2[0] = '\0';
|
||||||
|
count = RCTokenize (line, tokens, 2, NULL);
|
||||||
|
if (count < 2)
|
||||||
|
return FALSE;
|
||||||
|
RCVarExpansion(value, token2);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RCVarExpansion(gchar *buffer, const gchar *value)
|
||||||
|
{
|
||||||
|
gint i=0, j=0;
|
||||||
|
gchar *startDollar, *endDollar;
|
||||||
|
gchar *string1;
|
||||||
|
gchar buf[255];
|
||||||
|
gchar buf2[255];
|
||||||
|
|
||||||
|
strcpy(buffer, value);
|
||||||
|
if ((startDollar = strchr(value, '$'))) {
|
||||||
|
if ((endDollar = strchr(&startDollar[1], '$'))) {
|
||||||
|
i = strlen(startDollar) - strlen(endDollar) - 1;
|
||||||
|
j = strlen(value) - strlen(startDollar);
|
||||||
|
string1 = startDollar;
|
||||||
|
string1++;
|
||||||
|
strncpy(buf, string1, i);
|
||||||
|
buf[i]='\0';
|
||||||
|
|
||||||
|
RCGetString(buf, buf2, buf, 255);
|
||||||
|
if (value != startDollar) {
|
||||||
|
strncpy(buffer, value, j);
|
||||||
|
buffer[j] = '\0';
|
||||||
|
} else {
|
||||||
|
strcpy(buffer, "");
|
||||||
|
}
|
||||||
|
strcat(buffer, buf2);
|
||||||
|
strcat(buffer, ++endDollar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL RCReadNextLine (FILE *f, gchar *szBuffer, DWORD dwLength)
|
||||||
|
{
|
||||||
|
while (f && !feof (f)) {
|
||||||
|
gint length;
|
||||||
|
|
||||||
|
if (!fgets(szBuffer, dwLength, f))
|
||||||
|
break;
|
||||||
|
|
||||||
|
length = strlen(szBuffer);
|
||||||
|
|
||||||
|
// Skip any leading and trailing whitespace
|
||||||
|
while (length && isspace(szBuffer[0])) {
|
||||||
|
length--;
|
||||||
|
strcpy(szBuffer, szBuffer + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (length && isspace(szBuffer[length-1]))
|
||||||
|
szBuffer[--length] = '\0';
|
||||||
|
|
||||||
|
if (length && szBuffer[0] != '#')
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL RCInit(const gchar *szPath)
|
||||||
|
{
|
||||||
|
FILE* rc;
|
||||||
|
gchar buffer[MAX_BUFF];
|
||||||
|
|
||||||
|
if (RCLen)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
rc = RCOpen(szPath);
|
||||||
|
if (!(rc))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
while (RCReadNextLine(rc, buffer, sizeof (buffer))) {
|
||||||
|
gchar *temp;
|
||||||
|
|
||||||
|
if (buffer[0] == '*')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
temp = g_malloc(strlen(buffer) + 1);
|
||||||
|
strcpy(temp, buffer);
|
||||||
|
|
||||||
|
if (!RCBuffer)
|
||||||
|
RCBuffer = g_malloc((RCLen + 1) * sizeof(gchar *));
|
||||||
|
else
|
||||||
|
RCBuffer = g_realloc(RCBuffer, (RCLen + 1) * sizeof(gchar *));
|
||||||
|
|
||||||
|
RCBuffer[RCLen++] = temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
return RCClose(rc);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RCShutDown(void)
|
||||||
|
{
|
||||||
|
gint loop;
|
||||||
|
|
||||||
|
for (loop = 0; loop < RCLen; ++loop)
|
||||||
|
g_free(RCBuffer[loop]);
|
||||||
|
|
||||||
|
if (RCBuffer) {
|
||||||
|
g_free(RCBuffer);
|
||||||
|
RCBuffer = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
RCLen = 0;
|
||||||
|
}
|
||||||
32
rcfuncs.h
Normal file
32
rcfuncs.h
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
#ifndef _RCFUNCS_H_
|
||||||
|
#define _RCFUNCS_H_
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#ifndef WIN32
|
||||||
|
typedef gboolean BOOL;
|
||||||
|
typedef guint DWORD;
|
||||||
|
typedef gushort WORD;
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
FILE* RCOpen(const gchar *szFile);
|
||||||
|
BOOL RCClose(FILE *f);
|
||||||
|
gint RCTokenize(const gchar *szString, gchar **lpszBuffers, DWORD dwNumBuffers, gchar *szExtraParameters);
|
||||||
|
gchar* RCFindLine(const gchar *lpKeyName);
|
||||||
|
gint RCGetInt(const gchar *lpKeyName, gint nDefault);
|
||||||
|
BOOL RCGetBool(const gchar *lpKeyName, BOOL ifFound);
|
||||||
|
BOOL RCGetString(const gchar *lpKeyName, gchar *value, const gchar *defStr, gint maxLen);
|
||||||
|
void RCVarExpansion(gchar *buffer, const gchar *value);
|
||||||
|
BOOL RCReadNextLine (FILE *f, gchar *szBuffer, DWORD dwLength);
|
||||||
|
BOOL RCInit(const gchar *szPath);
|
||||||
|
void RCShutDown(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
};
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#endif /* _RCFUNCS_H_ */
|
||||||
Reference in a new issue