From: Art Cancro Date: Sun, 4 Nov 2007 04:08:41 +0000 (+0000) Subject: Removed rss2ctdl from svn trunk, as this utility is now obsolete. X-Git-Tag: v7.86~2850 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=6516b82ea919f29a929a66c65ae8e5defaf976f9;p=citadel.git Removed rss2ctdl from svn trunk, as this utility is now obsolete. --- diff --git a/rss2ctdl/COPYING.txt b/rss2ctdl/COPYING.txt deleted file mode 100644 index 94a045322..000000000 --- a/rss2ctdl/COPYING.txt +++ /dev/null @@ -1,621 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. 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 -them 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 prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. 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. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey 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; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If 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 convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU 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 that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - 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. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -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. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS diff --git a/rss2ctdl/Makefile b/rss2ctdl/Makefile deleted file mode 100644 index b646fc830..000000000 --- a/rss2ctdl/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -CC=gcc -OBJFILES=zlib_interface.o os-support.o io-internal.o md5.o digcalc.o \ - net-support.o conversions.o xmlparse.o netio.o \ - main.o parsedate.o rdf_parsedate.o -CFLAGS=`xml2-config --cflags` -LDFLAGS=`xml2-config --libs` - -rss2ctdl: $(OBJFILES) - $(CC) $(CFLAGS) $(OBJFILES) $(LDFLAGS) -o rss2ctdl - -clean: - rm -f *.o rss2ctdl diff --git a/rss2ctdl/README.txt b/rss2ctdl/README.txt deleted file mode 100644 index 3e3faa63d..000000000 --- a/rss2ctdl/README.txt +++ /dev/null @@ -1,39 +0,0 @@ - RSS2CTDL -- an RSS to Citadel gateway - -Main program (c)2004 by Art Cancro -RSS parser (c)2003-2004 by Oliver Feiler - and Rene Puls - -RSS2CTDL is an RSS-to-Citadel gateway. It allows you to pull external RSS -feeds into Citadel rooms. Feed URL's are polled whenever you run the program. -Each item is converted to a Citadel message and submitted into the network -queue. The message-ID is derived from a unique hash of the GUID tag of -each item. If there is no GUID tag (which, unfortunately, is the case for -the vast majority of feeds) then we hash the title/description/link tags -instead. We then dump it all into the queue and let the loopzapper handle -the dupes. - -We are distributing RSS2CTDL as a standalone utility, only as a temporary -measure. Eventually it will be bundled with the Citadel server, and it will -be invoked by the main server process. At that time, this standalone -distribution will be discontinued. - -RSS2CTDL requires the "libxml2" library, which is probably already installed -on your host system. If not, get it from http://www.xmlsoft.org - -Here's how to make it work: - -1. Run "make" to build the program. - (There is no "configure" and there is no "make install" either. The - makefile will produce an "rss2ctdl" binary, which is all you need.) -2. Edit the "do_feeds.sh" script to your liking. Tell it the feeds you - want to receive, and the rooms you want to deposit them into. -3. Create those rooms if they do not already exist. -4. Configure your crontab to run do_feeds.sh every half hour. (You can go - more or less often if you wish, but once every half hour seems to be the - frequency generally agreed upon in the community to be optimal.) - -Do be aware that rss2ctdl must have write access to $CTDL/network/spoolin -in order to submit its messages into the Citadel spool. In practice, this -generally means that it should be run by the crontab of the user under which -the Citadel service is running ... or by root if you wish. diff --git a/rss2ctdl/config.h b/rss2ctdl/config.h deleted file mode 100644 index e5a0bac16..000000000 --- a/rss2ctdl/config.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * $Id$ - * - * Copyright 2003 Oliver Feiler - * - * config.h - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef CONFIG_H -#define CONFIG_H - -#include -#include "netio.h" - -/* Set your charset here. ISO-8859-1 is default. */ -#ifndef TARGET_CHARSET -#define TARGET_CHARSET "ISO-8859-1" -#endif - -struct feed { - char *feedurl; /* Non hashified URL */ - char *feed; /* Raw XML */ - int content_length; - char *title; - char *link; - char *description; - char *lastmodified; /* Content of header as sent by the server. */ - int lasthttpstatus; - char *content_type; - netio_error_type netio_error; /* See netio.h */ - int connectresult; /* Socket errno */ - char *cookies; /* Login cookies for this feed. */ - char *authinfo; /* HTTP authinfo string. */ - char *servauth; /* Server supplied authorization header. */ - struct newsitem *items; - int problem; /* Set if there was a problem - * downloading the feed. */ - char *original; /* Original feed title. */ -}; - -struct newsitem { - struct newsdata *data; - struct newsitem *next_ptr, *prev_ptr; /* Pointer to next/prev item in double linked list */ -}; - -struct newsdata { - struct feed *parent; - int readstatus; /* 0: unread, 1: read */ - char *title; - char *link; - char *guid; /* Not always present */ - char *description; - time_t date; /* not always present */ -}; - -extern struct feed *first_ptr; - -#ifdef LOCALEPATH -# include -# include -#endif - -#ifdef LOCALEPATH -# define _(String) gettext (String) -#else -# define _(String) (String)s -# define ngettext(Singular, Plural, n) (Plural) -#endif - -#endif diff --git a/rss2ctdl/conversions.c b/rss2ctdl/conversions.c deleted file mode 100644 index 62e01c6cb..000000000 --- a/rss2ctdl/conversions.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - * $Id$ - * - * Copyright 2003-2004 Oliver Feiler and - * Rene Puls - * - * conversions.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "setup.h" -#include "conversions.h" -#include "config.h" - -extern struct entity *first_entity; - - -char *base64encode(char const *inbuf, unsigned int inbuf_size) { - static unsigned char const alphabet[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - - char *outbuf = NULL; - unsigned int inbuf_pos = 0; - unsigned int outbuf_pos = 0; - unsigned int outbuf_size = 0; - int bits = 0; - int char_count = 0; - - outbuf = malloc(1); - - while (inbuf_pos < inbuf_size) { - - bits |= *inbuf; - char_count++; - - if (char_count == 3) { - outbuf = realloc(outbuf, outbuf_size+4); - outbuf_size += 4; - outbuf[outbuf_pos+0] = alphabet[bits >> 18]; - outbuf[outbuf_pos+1] = alphabet[(bits >> 12) & 0x3f]; - outbuf[outbuf_pos+2] = alphabet[(bits >> 6) & 0x3f]; - outbuf[outbuf_pos+3] = alphabet[bits & 0x3f]; - outbuf_pos += 4; - bits = 0; - char_count = 0; - } - - inbuf++; - inbuf_pos++; - bits <<= 8; - } - - if (char_count > 0) { - bits <<= 16 - (8 * char_count); - outbuf = realloc(outbuf, outbuf_size+4); - outbuf_size += 4; - outbuf[outbuf_pos+0] = alphabet[bits >> 18]; - outbuf[outbuf_pos+1] = alphabet[(bits >> 12) & 0x3f]; - if (char_count == 1) { - outbuf[outbuf_pos+2] = '='; - outbuf[outbuf_pos+3] = '='; - } else { - outbuf[outbuf_pos+2] = alphabet[(bits >> 6) & 0x3f]; - outbuf[outbuf_pos+3] = '='; - } - outbuf_pos += 4; - } - - outbuf = realloc(outbuf, outbuf_size+1); - outbuf[outbuf_pos] = 0; - - return outbuf; -} - -/* Returns NULL on invalid input */ -char* decodechunked(char * chunked, unsigned int *inputlen) { - char *orig = chunked, *dest = chunked; - unsigned long chunklen; - - /* We can reuse the same buffer to dechunkify it: - * the data size will never increase. */ - while((chunklen = strtoul(orig, &orig, 16))) { - /* process one more chunk: */ - /* skip chunk-extension part */ - while(*orig && (*orig != '\r')) - orig++; - /* skip '\r\n' after chunk length */ - orig += 2; - if(( chunklen > (chunked + *inputlen - orig))) - /* insane chunk length. Well... */ - return NULL; - memmove(dest, orig, chunklen); - dest += chunklen; - orig += chunklen; - /* and go to the next chunk */ - } - *dest = '\0'; - *inputlen = dest - chunked; - - return chunked; -} - -/* Remove leading whitspaces, newlines, tabs. - * This function should be safe for working on UTF-8 strings. - * tidyness: 0 = only suck chars from beginning of string - * 1 = extreme, vacuum everything along the string. - */ -void CleanupString (char * string, int tidyness) { - int len, i; - - /* If we are passed a NULL pointer, leave it alone and return. */ - if (string == NULL) - return; - - len = strlen(string); - - while ((string[0] == '\n' || string [0] == ' ' || string [0] == '\t') && - (len > 0)) { - /* len=strlen(string) does not include \0 of string. - But since we copy from *string+1 \0 gets included. - Delicate code. Think twice before it ends in buffer overflows. */ - memmove (string, string+1, len); - len--; - } - - len = strlen(string); - /* Eat newlines and tabs along the whole string. */ - if (tidyness == 1) { - for (i = 0; i < len; i++) { - if ((string[i] == '\t') || (string[i] == '\n')) - string[i] = ' '; - } - } -} diff --git a/rss2ctdl/conversions.h b/rss2ctdl/conversions.h deleted file mode 100644 index a281625c9..000000000 --- a/rss2ctdl/conversions.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * $Id$ - * - * Copyright 2003-2004 Oliver Feiler and - * Rene Puls - * - * conversions.h - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef CONVERSIONS_H -#define CONVERSIONS_H - -char *base64encode(char const *inbuf, unsigned int inbuf_size); -char* decodechunked(char * chunked, unsigned int *inputlen); -void CleanupString (char * string, int tidyness); - -#endif diff --git a/rss2ctdl/debian/README.Debian b/rss2ctdl/debian/README.Debian deleted file mode 100644 index a4d378216..000000000 --- a/rss2ctdl/debian/README.Debian +++ /dev/null @@ -1,6 +0,0 @@ -rss2ctdl for Debian -------------------- - - - - -- Wilfried Goesgens , Tue, 26 Jul 2005 10:41:35 +0200 diff --git a/rss2ctdl/debian/changelog b/rss2ctdl/debian/changelog deleted file mode 100644 index 30ff27bd8..000000000 --- a/rss2ctdl/debian/changelog +++ /dev/null @@ -1,6 +0,0 @@ -rss2ctdl (0.1-1) unstable; urgency=low - - * Initial release Closes: #nnnn (nnnn is the bug number of your ITP) - - -- Wilfried Goesgens Tue, 26 Jul 2005 10:41:35 +0200 - diff --git a/rss2ctdl/debian/citadel-rss2ctdl.cron.d b/rss2ctdl/debian/citadel-rss2ctdl.cron.d deleted file mode 100644 index bd4930bc6..000000000 --- a/rss2ctdl/debian/citadel-rss2ctdl.cron.d +++ /dev/null @@ -1,11 +0,0 @@ -# -# citadel-rss2ctdl cron. -# -# this should run every half hour. (You can go -# more or less often if you wish, but once every -# half hour seems to be the frequency generally -# agreed upon in the community to be optimal.) -# -# m h dom mon dow user command -0 0-23/2 * * * citadel /usr/sbin/feeds.cron - diff --git a/rss2ctdl/debian/citadel-rss2ctdl.postinst b/rss2ctdl/debian/citadel-rss2ctdl.postinst deleted file mode 100644 index dd7fdd4fe..000000000 --- a/rss2ctdl/debian/citadel-rss2ctdl.postinst +++ /dev/null @@ -1,83 +0,0 @@ -#! /bin/sh -# postinst.skeleton -# Skeleton maintainer script showing all the possible cases. -# Written by Charles Briscoe-Smith, March-June 1998. Public Domain. - -# Abort if any command returns an error value -set -e - -# This script is called as the last step of the installation of the -# package. All the package's files are in place, dpkg has already done -# its automatic conffile handling, and all the packages we depend of -# are already fully installed and configured. - -# The following idempotent stuff doesn't generally need protecting -# against being run in the abort-* cases. - -#### Install info files into the dir file -###: install-info --quiet --section "section pattern" "Section Title" \ -###: --description="Name of the document" /usr/info/foo.info -### -#### Create stub directories under /usr/local -###: if test ! -d /usr/local/lib/foo; then -###: if test ! -d /usr/local/lib; then -###: if mkdir /usr/local/lib; then -###: chown root.staff /usr/local/lib || true -###: chmod 2775 /usr/local/lib || true -###: fi -###: fi -###: if mkdir /usr/local/lib/foo; then -###: chown root.staff /usr/local/lib/foo || true -###: chmod 2775 /usr/local/lib/foo || true -###: fi -###: fi -### -#### Ensure the menu system is updated -###: [ ! -x /usr/bin/update-menus ] || /usr/bin/update-menus -### -#### Arrange for a daemon to be started at system boot time -###: update-rc.d foo default >/dev/null -### -case "$1" in - configure) - # Configure this package. If the package must prompt the user for - # information, do it here. - - echo "Add your favorite RSS-Feeds to /etc/citadel/rssfeeds" - mkdir -p /etc/citadel - ucf /usr/share/doc/citadel-rss2ctdl/examples/config/rssfeeds /etc/citadel/rssfeeds - ;; - abort-upgrade) - # Back out of an attempt to upgrade this package FROM THIS VERSION - # to version $2. Undo the effects of "prerm upgrade $2". - #: - - ;; - abort-remove) - ###if test "$2" != in-favour; then - ### echo "$0: undocumented call to \`postinst $*'" 1>&2 - ### exit 0 - ###fi - #### Back out of an attempt to remove this package, which was due to - #### a conflict with package $3 (version $4). Undo the effects of - #### "prerm remove in-favour $3 $4". - ###: - - ;; - abort-deconfigure) - ###if test "$2" != in-favour -o "$5" != removing; then - ### echo "$0: undocumented call to \`postinst $*'" 1>&2 - ### exit 0 - ###fi - #### Back out of an attempt to deconfigure this package, which was - #### due to package $6 (version $7) which we depend on being removed - #### to make way for package $3 (version $4). Undo the effects of - #### "prerm deconfigure in-favour $3 $4 removing $6 $7". - ###: - - ;; - *) echo "$0: didn't understand being called with \`$1'" 1>&2 - exit 0;; -esac - -exit 0 diff --git a/rss2ctdl/debian/citadel-rss2ctdl.postrm b/rss2ctdl/debian/citadel-rss2ctdl.postrm deleted file mode 100644 index f5d86f3cb..000000000 --- a/rss2ctdl/debian/citadel-rss2ctdl.postrm +++ /dev/null @@ -1,96 +0,0 @@ -#! /bin/sh -# postrm.skeleton -# Skeleton maintainer script showing all the possible cases. -# Written by Charles Briscoe-Smith, March-June 1998. Public Domain. - -# Abort if any command returns an error value -set -e - -# This script is called twice during the removal of the package; once -# after the removal of the package's files from the system, and as -# the final step in the removal of this package, after the package's -# conffiles have been removed. - -# Ensure the menu system is updated -: [ ! -x /usr/bin/update-menus ] || /usr/bin/update-menus - -case "$1" in - remove) - # This package is being removed, but its configuration has not yet - # been purged. - - - # Remove diversion - #: dpkg-divert --package foo --remove --rename \ - #: --divert /usr/bin/other.real /usr/bin/other - - # ldconfig is NOT needed during removal of a library, only during - # installation - - ;; - purge) - # This package has previously been removed and is now having - # its configuration purged from the system. - # remove the gunzipped setup executable. - ucf --purge "/etc/citadel/rssfeeds" - rm -f "/etc/citadel/rssfeeds" - ### TODO: remove citadel from inittab! - ;; - disappear) - if test "$2" != overwriter; then - echo "$0: undocumented call to \`postrm $*'" 1>&2 - exit 0 - fi - # This package has been completely overwritten by package $3 - # (version $4). All our files are already gone from the system. - # This is a special case: neither "prerm remove" nor "postrm remove" - # have been called, because dpkg didn't know that this package would - # disappear until this stage. - : - - ;; - upgrade) - # About to upgrade FROM THIS VERSION to version $2 of this package. - # "prerm upgrade" has been called for this version, and "preinst - # upgrade" has been called for the new version. Last chance to - # clean up. - : - - ;; - failed-upgrade) - # About to upgrade from version $2 of this package TO THIS VERSION. - # "prerm upgrade" has been called for the old version, and "preinst - # upgrade" has been called for this version. This is only used if - # the previous version's "postrm upgrade" couldn't handle it and - # returned non-zero. (Fix old postrm bugs here.) - : - - ;; - abort-install) - # Back out of an attempt to install this package. Undo the effects of - # "preinst install...". There are two sub-cases. - : - - if test "${2+set}" = set; then - # When the install was attempted, version $2's configuration - # files were still on the system. Undo the effects of "preinst - # install $2". - : - - else - # We were being installed from scratch. Undo the effects of - # "preinst install". - : - - fi ;; - abort-upgrade) - # Back out of an attempt to upgrade this package from version $2 - # TO THIS VERSION. Undo the effects of "preinst upgrade $2". - : - - ;; - *) echo "$0: didn't understand being called with \`$1'" 1>&2 - exit 0;; -esac - -exit 0 diff --git a/rss2ctdl/debian/citadel-rss2ctdl.substvars b/rss2ctdl/debian/citadel-rss2ctdl.substvars deleted file mode 100644 index 13858db93..000000000 --- a/rss2ctdl/debian/citadel-rss2ctdl.substvars +++ /dev/null @@ -1 +0,0 @@ -shlibs:Depends=libc6 (>= 2.3.2.ds1-21), libxml2 (>= 2.6.20), zlib1g (>= 1:1.2.1) diff --git a/rss2ctdl/debian/compat b/rss2ctdl/debian/compat deleted file mode 100644 index b8626c4cf..000000000 --- a/rss2ctdl/debian/compat +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/rss2ctdl/debian/conffiles.ex b/rss2ctdl/debian/conffiles.ex deleted file mode 100644 index 7775022d4..000000000 --- a/rss2ctdl/debian/conffiles.ex +++ /dev/null @@ -1,7 +0,0 @@ -# -# If you want to use this conffile, remove all comments and put files that -# you want dpkg to process here using their absolute pathnames. -# See the policy manual -# -# for example: -# /etc/rss2ctdl/rss2ctdl.conf diff --git a/rss2ctdl/debian/control b/rss2ctdl/debian/control deleted file mode 100644 index c160ad625..000000000 --- a/rss2ctdl/debian/control +++ /dev/null @@ -1,19 +0,0 @@ -Source: rss2ctdl -Section: unknown -Priority: optional -Maintainer: Wilfried Goesgens -Build-Depends: debhelper (>= 4.0.0), libxml2-dev -Standards-Version: 3.6.1 - -Package: citadel-rss2ctdl -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, citadel-client, libxml2 -Description: feed your citadel with rss feeds - RSS2CTDL is an RSS-to-Citadel gateway. It allows you to pull external RSS - feeds into Citadel rooms. Feed URL's are polled whenever you run the program. - Each item is converted to a Citadel message and submitted into the network - queue. The message-ID is derived from a unique hash of the GUID tag of - each item. If there is no GUID tag (which, unfortunately, is the case for - the vast majority of feeds) then we hash the title/description/link tags - instead. We then dump it all into the queue and let the loopzapper handle - the dupes. diff --git a/rss2ctdl/debian/copyright b/rss2ctdl/debian/copyright deleted file mode 100644 index fa214302e..000000000 --- a/rss2ctdl/debian/copyright +++ /dev/null @@ -1,10 +0,0 @@ -This package was debianized by Wilfried Goesgens on -Tue, 26 Jul 2005 10:41:35 +0200. - -It was downloaded from - -Copyright Holder: - -License: - - diff --git a/rss2ctdl/debian/cron.d.ex b/rss2ctdl/debian/cron.d.ex deleted file mode 100644 index 4147f9434..000000000 --- a/rss2ctdl/debian/cron.d.ex +++ /dev/null @@ -1,4 +0,0 @@ -# -# Regular cron jobs for the rss2ctdl package -# -0 4 * * * root rss2ctdl_maintenance diff --git a/rss2ctdl/debian/dirs b/rss2ctdl/debian/dirs deleted file mode 100644 index ca882bbb7..000000000 --- a/rss2ctdl/debian/dirs +++ /dev/null @@ -1,2 +0,0 @@ -usr/bin -usr/sbin diff --git a/rss2ctdl/debian/docs b/rss2ctdl/debian/docs deleted file mode 100644 index 6e9fe653f..000000000 --- a/rss2ctdl/debian/docs +++ /dev/null @@ -1,3 +0,0 @@ -COPYING.txt -README.txt -README.txt diff --git a/rss2ctdl/debian/emacsen-install.ex b/rss2ctdl/debian/emacsen-install.ex deleted file mode 100644 index 04f50e90f..000000000 --- a/rss2ctdl/debian/emacsen-install.ex +++ /dev/null @@ -1,45 +0,0 @@ -#! /bin/sh -e -# /usr/lib/emacsen-common/packages/install/rss2ctdl - -# Written by Jim Van Zandt , borrowing heavily -# from the install scripts for gettext by Santiago Vila -# and octave by Dirk Eddelbuettel . - -FLAVOR=$1 -PACKAGE=rss2ctdl - -if [ ${FLAVOR} = emacs ]; then exit 0; fi - -echo install/${PACKAGE}: Handling install for emacsen flavor ${FLAVOR} - -#FLAVORTEST=`echo $FLAVOR | cut -c-6` -#if [ ${FLAVORTEST} = xemacs ] ; then -# SITEFLAG="-no-site-file" -#else -# SITEFLAG="--no-site-file" -#fi -FLAGS="${SITEFLAG} -q -batch -l path.el -f batch-byte-compile" - -ELDIR=/usr/share/emacs/site-lisp/${PACKAGE} -ELCDIR=/usr/share/${FLAVOR}/site-lisp/${PACKAGE} - -# Install-info-altdir does not actually exist. -# Maybe somebody will write it. -if test -x /usr/sbin/install-info-altdir; then - echo install/${PACKAGE}: install Info links for ${FLAVOR} - install-info-altdir --quiet --section "" "" --dirname=${FLAVOR} /usr/info/${PACKAGE}.info.gz -fi - -install -m 755 -d ${ELCDIR} -cd ${ELDIR} -FILES=`echo *.el` -cp ${FILES} ${ELCDIR} -cd ${ELCDIR} - -cat << EOF > path.el -(setq load-path (cons "." load-path) byte-compile-warnings nil) -EOF -${FLAVOR} ${FLAGS} ${FILES} -rm -f *.el path.el - -exit 0 diff --git a/rss2ctdl/debian/emacsen-remove.ex b/rss2ctdl/debian/emacsen-remove.ex deleted file mode 100644 index 82a824102..000000000 --- a/rss2ctdl/debian/emacsen-remove.ex +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -e -# /usr/lib/emacsen-common/packages/remove/rss2ctdl - -FLAVOR=$1 -PACKAGE=rss2ctdl - -if [ ${FLAVOR} != emacs ]; then - if test -x /usr/sbin/install-info-altdir; then - echo remove/${PACKAGE}: removing Info links for ${FLAVOR} - install-info-altdir --quiet --remove --dirname=${FLAVOR} /usr/info/rss2ctdl.info.gz - fi - - echo remove/${PACKAGE}: purging byte-compiled files for ${FLAVOR} - rm -rf /usr/share/${FLAVOR}/site-lisp/${PACKAGE} -fi diff --git a/rss2ctdl/debian/emacsen-startup.ex b/rss2ctdl/debian/emacsen-startup.ex deleted file mode 100644 index f42325d92..000000000 --- a/rss2ctdl/debian/emacsen-startup.ex +++ /dev/null @@ -1,19 +0,0 @@ -;; -*-emacs-lisp-*- -;; -;; Emacs startup file for the Debian rss2ctdl package -;; -;; Originally contributed by Nils Naumann -;; Modified by Dirk Eddelbuettel -;; Adapted for dh-make by Jim Van Zandt - -;; The rss2ctdl package follows the Debian/GNU Linux 'emacsen' policy and -;; byte-compiles its elisp files for each 'emacs flavor' (emacs19, -;; xemacs19, emacs20, xemacs20...). The compiled code is then -;; installed in a subdirectory of the respective site-lisp directory. -;; We have to add this to the load-path: -(let ((package-dir (concat "/usr/share/" - (symbol-name flavor) - "/site-lisp/rss2ctdl"))) - (when (file-directory-p package-dir) - (setq load-path (cons package-dir load-path)))) - diff --git a/rss2ctdl/debian/files b/rss2ctdl/debian/files deleted file mode 100644 index 0ba5a3b28..000000000 --- a/rss2ctdl/debian/files +++ /dev/null @@ -1 +0,0 @@ -citadel-rss2ctdl_0.1-1_i386.deb unknown optional diff --git a/rss2ctdl/debian/init.d.ex b/rss2ctdl/debian/init.d.ex deleted file mode 100644 index 6bf56253c..000000000 --- a/rss2ctdl/debian/init.d.ex +++ /dev/null @@ -1,74 +0,0 @@ -#! /bin/sh -# -# skeleton example file to build /etc/init.d/ scripts. -# This file should be used to construct scripts for /etc/init.d. -# -# Written by Miquel van Smoorenburg . -# Modified for Debian -# by Ian Murdock . -# -# Version: @(#)skeleton 1.9 26-Feb-2001 miquels@cistron.nl -# - -PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -DAEMON=/usr/sbin/rss2ctdl -NAME=rss2ctdl -DESC=rss2ctdl - -test -x $DAEMON || exit 0 - -# Include rss2ctdl defaults if available -if [ -f /etc/default/rss2ctdl ] ; then - . /etc/default/rss2ctdl -fi - -set -e - -case "$1" in - start) - echo -n "Starting $DESC: " - start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \ - --exec $DAEMON -- $DAEMON_OPTS - echo "$NAME." - ;; - stop) - echo -n "Stopping $DESC: " - start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \ - --exec $DAEMON - echo "$NAME." - ;; - #reload) - # - # If the daemon can reload its config files on the fly - # for example by sending it SIGHUP, do it here. - # - # If the daemon responds to changes in its config file - # directly anyway, make this a do-nothing entry. - # - # echo "Reloading $DESC configuration files." - # start-stop-daemon --stop --signal 1 --quiet --pidfile \ - # /var/run/$NAME.pid --exec $DAEMON - #;; - restart|force-reload) - # - # If the "reload" option is implemented, move the "force-reload" - # option to the "reload" entry above. If not, "force-reload" is - # just the same as "restart". - # - echo -n "Restarting $DESC: " - start-stop-daemon --stop --quiet --pidfile \ - /var/run/$NAME.pid --exec $DAEMON - sleep 1 - start-stop-daemon --start --quiet --pidfile \ - /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS - echo "$NAME." - ;; - *) - N=/etc/init.d/$NAME - # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 - echo "Usage: $N {start|stop|restart|force-reload}" >&2 - exit 1 - ;; -esac - -exit 0 diff --git a/rss2ctdl/debian/manpage.1.ex b/rss2ctdl/debian/manpage.1.ex deleted file mode 100644 index c541bd628..000000000 --- a/rss2ctdl/debian/manpage.1.ex +++ /dev/null @@ -1,59 +0,0 @@ -.\" Hey, EMACS: -*- nroff -*- -.\" First parameter, NAME, should be all caps -.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection -.\" other parameters are allowed: see man(7), man(1) -.TH RSS2CTDL SECTION "July 26, 2005" -.\" Please adjust this date whenever revising the manpage. -.\" -.\" Some roff macros, for reference: -.\" .nh disable hyphenation -.\" .hy enable hyphenation -.\" .ad l left justify -.\" .ad b justify to both left and right margins -.\" .nf disable filling -.\" .fi enable filling -.\" .br insert line break -.\" .sp insert n+1 empty lines -.\" for manpage-specific macros, see man(7) -.SH NAME -rss2ctdl \- program to do something -.SH SYNOPSIS -.B rss2ctdl -.RI [ options ] " files" ... -.br -.B bar -.RI [ options ] " files" ... -.SH DESCRIPTION -This manual page documents briefly the -.B rss2ctdl -and -.B bar -commands. -.PP -.\" TeX users may be more comfortable with the \fB\fP and -.\" \fI\fP escape sequences to invode bold face and italics, -.\" respectively. -\fBrss2ctdl\fP is a program that... -.SH OPTIONS -These programs follow the usual GNU command line syntax, with long -options starting with two dashes (`-'). -A summary of options is included below. -For a complete description, see the Info files. -.TP -.B \-h, \-\-help -Show summary of options. -.TP -.B \-v, \-\-version -Show version of program. -.SH SEE ALSO -.BR bar (1), -.BR baz (1). -.br -The programs are documented fully by -.IR "The Rise and Fall of a Fooish Bar" , -available via the Info system. -.SH AUTHOR -rss2ctdl was written by . -.PP -This manual page was written by Wilfried Goesgens , -for the Debian project (but may be used by others). diff --git a/rss2ctdl/debian/manpage.sgml.ex b/rss2ctdl/debian/manpage.sgml.ex deleted file mode 100644 index 5542239cc..000000000 --- a/rss2ctdl/debian/manpage.sgml.ex +++ /dev/null @@ -1,156 +0,0 @@ - manpage.1'. You may view - the manual page with: `docbook-to-man manpage.sgml | nroff -man | - less'. A typical entry in a Makefile or Makefile.am is: - -manpage.1: manpage.sgml - docbook-to-man $< > $@ - - - The docbook-to-man binary is found in the docbook-to-man package. - Please remember that if you create the nroff version in one of the - debian/rules file targets (such as build), you will need to include - docbook-to-man in your Build-Depends control field. - - --> - - - FIRSTNAME"> - SURNAME"> - - July 26, 2005"> - - SECTION"> - willi@jordy.home.net"> - - RSS2CTDL"> - - - Debian"> - GNU"> - GPL"> -]> - - - -
- &dhemail; -
- - &dhfirstname; - &dhsurname; - - - 2003 - &dhusername; - - &dhdate; -
- - &dhucpackage; - - &dhsection; - - - &dhpackage; - - program to do something - - - - &dhpackage; - - - - - - - - DESCRIPTION - - This manual page documents briefly the - &dhpackage; and bar - commands. - - This manual page was written for the &debian; distribution - because the original program does not have a manual page. - Instead, it has documentation in the &gnu; - Info format; see below. - - &dhpackage; is a program that... - - - - OPTIONS - - These programs follow the usual &gnu; command line syntax, - with long options starting with two dashes (`-'). A summary of - options is included below. For a complete description, see the - Info files. - - - - - - - - Show summary of options. - - - - - - - - Show version of program. - - - - - - SEE ALSO - - bar (1), baz (1). - - The programs are documented fully by The Rise and - Fall of a Fooish Bar available via the - Info system. - - - AUTHOR - - This manual page was written by &dhusername; &dhemail; for - the &debian; system (but may be used by others). Permission is - granted to copy, distribute and/or modify this document under - the terms of the &gnu; General Public License, Version 2 any - later version published by the Free Software Foundation. - - - On Debian systems, the complete text of the GNU General Public - License can be found in /usr/share/common-licenses/GPL. - - - -
- - - - diff --git a/rss2ctdl/debian/manpage.xml.ex b/rss2ctdl/debian/manpage.xml.ex deleted file mode 100644 index d03b29c56..000000000 --- a/rss2ctdl/debian/manpage.xml.ex +++ /dev/null @@ -1,148 +0,0 @@ - -.
will be generated. You may view the -manual page with: nroff -man .
| less'. A -typical entry in a Makefile or Makefile.am is: - -DB2MAN=/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/\ -manpages/docbook.xsl -XP=xsltproc -''-nonet - -manpage.1: manpage.dbk - $(XP) $(DB2MAN) $< - -The xsltproc binary is found in the xsltproc package. The -XSL files are in docbook-xsl. Please remember that if you -create the nroff version in one of the debian/rules file -targets (such as build), you will need to include xsltproc -and docbook-xsl in your Build-Depends control field. - ---> - - - FIRSTNAME"> - SURNAME"> - - July 26, 2005"> - - SECTION"> - willi@jordy.home.net"> - - RSS2CTDL"> - - - Debian"> - GNU"> - GPL"> -]> - - - -
- &dhemail; -
- - &dhfirstname; - &dhsurname; - - - 2003 - &dhusername; - - &dhdate; -
- - &dhucpackage; - - &dhsection; - - - &dhpackage; - - program to do something - - - - &dhpackage; - - - - - - - - DESCRIPTION - - This manual page documents briefly the - &dhpackage; and bar - commands. - - This manual page was written for the &debian; distribution - because the original program does not have a manual page. - Instead, it has documentation in the &gnu; - Info format; see below. - - &dhpackage; is a program that... - - - - OPTIONS - - These programs follow the usual &gnu; command line syntax, - with long options starting with two dashes (`-'). A summary of - options is included below. For a complete description, see the - Info files. - - - - - - - - Show summary of options. - - - - - - - - Show version of program. - - - - - - SEE ALSO - - bar (1), baz (1). - - The programs are documented fully by The Rise and - Fall of a Fooish Bar available via the - Info system. - - - AUTHOR - - This manual page was written by &dhusername; &dhemail; for - the &debian; system (but may be used by others). Permission is - granted to copy, distribute and/or modify this document under - the terms of the &gnu; General Public License, Version 2 any - later version published by the Free Software Foundation. - - - On Debian systems, the complete text of the GNU General Public - License can be found in /usr/share/common-licenses/GPL. - - - -
- diff --git a/rss2ctdl/debian/menu.ex b/rss2ctdl/debian/menu.ex deleted file mode 100644 index 02d9b1a6f..000000000 --- a/rss2ctdl/debian/menu.ex +++ /dev/null @@ -1,2 +0,0 @@ -?package(rss2ctdl):needs="X11|text|vc|wm" section="Apps/see-menu-manual"\ - title="rss2ctdl" command="/usr/bin/rss2ctdl" diff --git a/rss2ctdl/debian/postinst.ex b/rss2ctdl/debian/postinst.ex deleted file mode 100644 index b721bf29c..000000000 --- a/rss2ctdl/debian/postinst.ex +++ /dev/null @@ -1,42 +0,0 @@ -#! /bin/sh -# postinst script for rss2ctdl -# -# see: dh_installdeb(1) - -set -e - -# summary of how this script can be called: -# * `configure' -# * `abort-upgrade' -# * `abort-remove' `in-favour' -# -# * `abort-deconfigure' `in-favour' -# `removing' -# -# for details, see http://www.debian.org/doc/debian-policy/ or -# the debian-policy package -# - -case "$1" in - configure) - - ;; - - abort-upgrade|abort-remove|abort-deconfigure) - - ;; - - *) - echo "postinst called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 - - diff --git a/rss2ctdl/debian/postrm.ex b/rss2ctdl/debian/postrm.ex deleted file mode 100644 index 0580b3d0c..000000000 --- a/rss2ctdl/debian/postrm.ex +++ /dev/null @@ -1,38 +0,0 @@ -#! /bin/sh -# postrm script for rss2ctdl -# -# see: dh_installdeb(1) - -set -e - -# summary of how this script can be called: -# * `remove' -# * `purge' -# * `upgrade' -# * `failed-upgrade' -# * `abort-install' -# * `abort-install' -# * `abort-upgrade' -# * `disappear' overwrit>r> -# for details, see http://www.debian.org/doc/debian-policy/ or -# the debian-policy package - - -case "$1" in - purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) - - - ;; - - *) - echo "postrm called with unknown argument \`$1'" >&2 - exit 1 - -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 diff --git a/rss2ctdl/debian/preinst.ex b/rss2ctdl/debian/preinst.ex deleted file mode 100644 index 336acef5d..000000000 --- a/rss2ctdl/debian/preinst.ex +++ /dev/null @@ -1,38 +0,0 @@ -#! /bin/sh -# preinst script for rss2ctdl -# -# see: dh_installdeb(1) - -set -e - -# summary of how this script can be called: -# * `install' -# * `install' -# * `upgrade' -# * `abort-upgrade' -# -# for details, see http://www.debian.org/doc/debian-policy/ or -# the debian-policy package - - -case "$1" in - install|upgrade) - ;; - - abort-upgrade) - ;; - - *) - echo "preinst called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 - - diff --git a/rss2ctdl/debian/prerm.ex b/rss2ctdl/debian/prerm.ex deleted file mode 100644 index 2be567d24..000000000 --- a/rss2ctdl/debian/prerm.ex +++ /dev/null @@ -1,38 +0,0 @@ -#! /bin/sh -# prerm script for rss2ctdl -# -# see: dh_installdeb(1) - -set -e - -# summary of how this script can be called: -# * `remove' -# * `upgrade' -# * `failed-upgrade' -# * `remove' `in-favour' -# * `deconfigure' `in-favour' -# `removing' -# -# for details, see http://www.debian.org/doc/debian-policy/ or -# the debian-policy package - - -case "$1" in - remove|upgrade|deconfigure) - ;; - failed-upgrade) - ;; - *) - echo "prerm called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 - - diff --git a/rss2ctdl/debian/rss2ctdl-default.ex b/rss2ctdl/debian/rss2ctdl-default.ex deleted file mode 100644 index 68665c6b7..000000000 --- a/rss2ctdl/debian/rss2ctdl-default.ex +++ /dev/null @@ -1,10 +0,0 @@ -# Defaults for rss2ctdl initscript -# sourced by /etc/init.d/rss2ctdl -# installed at /etc/default/rss2ctdl by the maintainer scripts - -# -# This is a POSIX shell fragment -# - -# Additional options that are passed to the Daemon. -DAEMON_OPTS="" diff --git a/rss2ctdl/debian/rss2ctdl.doc-base.EX b/rss2ctdl/debian/rss2ctdl.doc-base.EX deleted file mode 100644 index 614169da6..000000000 --- a/rss2ctdl/debian/rss2ctdl.doc-base.EX +++ /dev/null @@ -1,22 +0,0 @@ -Document: rss2ctdl -Title: Debian rss2ctdl Manual -Author: -Abstract: This manual describes what rss2ctdl is - and how it can be used to - manage online manuals on Debian systems. -Section: unknown - -Format: debiandoc-sgml -Files: /usr/share/doc/rss2ctdl/rss2ctdl.sgml.gz - -Format: postscript -Files: /usr/share/doc/rss2ctdl/rss2ctdl.ps.gz - -Format: text -Files: /usr/share/doc/rss2ctdl/rss2ctdl.text.gz - -Format: HTML -Index: /usr/share/doc/rss2ctdl/html/index.html -Files: /usr/share/doc/rss2ctdl/html/*.html - - diff --git a/rss2ctdl/debian/rules b/rss2ctdl/debian/rules deleted file mode 100755 index 561720f3e..000000000 --- a/rss2ctdl/debian/rules +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - - - - -CFLAGS = -Wall -g - -ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) - CFLAGS += -O0 -else - CFLAGS += -O2 -endif - -configure: configure-stamp -configure-stamp: - dh_testdir - # Add here commands to configure the package. - - touch configure-stamp - - -build: build-stamp - -build-stamp: configure-stamp - dh_testdir - - # Add here commands to compile the package. - $(MAKE) - #docbook-to-man debian/rss2ctdl.sgml > rss2ctdl.1 - - - touch build-stamp - -clean: - dh_testdir - dh_testroot - rm -f build-stamp configure-stamp - - # Add here commands to clean up after the build process. - -$(MAKE) clean - - dh_clean - -install: build - dh_testdir - dh_testroot - dh_clean -k - mkdir -p $(CURDIR)/debian/citadel-rss2ctdl/usr/sbin - mkdir -p $(CURDIR)/debian/citadel-rss2ctdl/usr/share/doc/citadel-rss2ctdl/examples/config - cp $(CURDIR)/rss2ctdl $(CURDIR)/debian/citadel-rss2ctdl/usr/sbin/ - cp $(CURDIR)/feeds.cron $(CURDIR)/debian/citadel-rss2ctdl/usr/sbin/ - cp $(CURDIR)/rssfeeds $(CURDIR)/debian/citadel-rss2ctdl/usr/share/doc/citadel-rss2ctdl/examples/config - dh_installdirs - - # Add here commands to install the package into debian/rss2ctdl. - - - -# Build architecture-independent files here. -binary-indep: build install -# We have nothing to do by default. - -# Build architecture-dependent files here. -binary-arch: build install - dh_testdir - dh_testroot - dh_installchangelogs - dh_installdocs - dh_installexamples -# dh_install -# dh_installmenu -# dh_installdebconf -# dh_installlogrotate -# dh_installemacsen -# dh_installpam -# dh_installmime -# dh_installinit - dh_installcron -# dh_installinfo - dh_installman - dh_link - dh_strip - dh_compress - dh_fixperms -# dh_perl -# dh_python -# dh_makeshlibs - dh_installdeb - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/rss2ctdl/debian/watch.ex b/rss2ctdl/debian/watch.ex deleted file mode 100644 index 0f7902d3d..000000000 --- a/rss2ctdl/debian/watch.ex +++ /dev/null @@ -1,22 +0,0 @@ -# Example watch control file for uscan -# Rename this file to "watch" and then you can run the "uscan" command -# to check for upstream updates and more. -# See uscan(1) for format - -# Compulsory line, this is a version 3 file -version=3 - -# Uncomment to examine a Webpage -# -#http://www.example.com/downloads.php rss2ctdl-(.*)\.tar\.gz - -# Uncomment to examine a Webserver directory -#http://www.example.com/pub/rss2ctdl-(.*)\.tar\.gz - -# Uncommment to examine a FTP server -#ftp://ftp.example.com/pub/rss2ctdl-(.*)\.tar\.gz debian uupdate - -# Uncomment to use Roland's hack for sourceforge based projects - YMMV! -#http://people.debian.org/~lolando/sfdlr.php?project=rss2ctdl rss2ctdl-([\d.]*).tar.gz - - diff --git a/rss2ctdl/digcalc.c b/rss2ctdl/digcalc.c deleted file mode 100644 index 4114c0626..000000000 --- a/rss2ctdl/digcalc.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * $Id$ - * - * Copyright 2003-2004 Oliver Feiler - * - * digcalc.c - * - * This is the sample implementation from RFC 2617. - * The code has been modified to work with Colin Plumb's - * MD5 implementation rather than using RSA's. - */ - -#include "md5.h" - -#include -#include "digcalc.h" - -void CvtHex( - IN HASH Bin, - OUT HASHHEX Hex - ) -{ - unsigned short i; - unsigned char j; - - for (i = 0; i < HASHLEN; i++) { - j = (Bin[i] >> 4) & 0xf; - if (j <= 9) - Hex[i*2] = (j + '0'); - else - Hex[i*2] = (j + 'a' - 10); - j = Bin[i] & 0xf; - if (j <= 9) - Hex[i*2+1] = (j + '0'); - else - Hex[i*2+1] = (j + 'a' - 10); - }; - Hex[HASHHEXLEN] = '\0'; -}; - -/* calculate H(A1) as per spec */ -void DigestCalcHA1( - IN char * pszAlg, - IN char * pszUserName, - IN char * pszRealm, - IN char * pszPassword, - IN char * pszNonce, - IN char * pszCNonce, - OUT HASHHEX SessionKey - ) -{ - struct MD5Context Md5Ctx; - HASH HA1; - - MD5Init(&Md5Ctx); - MD5Update(&Md5Ctx, pszUserName, strlen(pszUserName)); - MD5Update(&Md5Ctx, ":", 1); - MD5Update(&Md5Ctx, pszRealm, strlen(pszRealm)); - MD5Update(&Md5Ctx, ":", 1); - MD5Update(&Md5Ctx, pszPassword, strlen(pszPassword)); - MD5Final(HA1, &Md5Ctx); - if (strcmp(pszAlg, "md5-sess") == 0) { - - MD5Init(&Md5Ctx); - MD5Update(&Md5Ctx, HA1, HASHLEN); - MD5Update(&Md5Ctx, ":", 1); - MD5Update(&Md5Ctx, pszNonce, strlen(pszNonce)); - MD5Update(&Md5Ctx, ":", 1); - MD5Update(&Md5Ctx, pszCNonce, strlen(pszCNonce)); - MD5Final(HA1, &Md5Ctx); - }; - CvtHex(HA1, SessionKey); -}; - -/* calculate request-digest/response-digest as per HTTP Digest spec */ -void DigestCalcResponse( - IN HASHHEX HA1, /* H(A1) */ - IN char * pszNonce, /* nonce from server */ - IN char * pszNonceCount, /* 8 hex digits */ - IN char * pszCNonce, /* client nonce */ - IN char * pszQop, /* qop-value: "", "auth", "auth-int" */ - IN char * pszMethod, /* method from the request */ - IN char * pszDigestUri, /* requested URL */ - IN HASHHEX HEntity, /* H(entity body) if qop="auth-int" */ - OUT HASHHEX Response /* request-digest or response-digest */ - ) -{ - struct MD5Context Md5Ctx; - HASH HA2; - HASH RespHash; - HASHHEX HA2Hex; - - /* calculate H(A2) */ - MD5Init(&Md5Ctx); - MD5Update(&Md5Ctx, pszMethod, strlen(pszMethod)); - MD5Update(&Md5Ctx, ":", 1); - MD5Update(&Md5Ctx, pszDigestUri, strlen(pszDigestUri)); - if (strcmp(pszQop, "auth-int") == 0) { - MD5Update(&Md5Ctx, ":", 1); - MD5Update(&Md5Ctx, HEntity, HASHHEXLEN); - }; - MD5Final(HA2, &Md5Ctx); - CvtHex(HA2, HA2Hex); - - /* calculate response */ - MD5Init(&Md5Ctx); - MD5Update(&Md5Ctx, HA1, HASHHEXLEN); - MD5Update(&Md5Ctx, ":", 1); - MD5Update(&Md5Ctx, pszNonce, strlen(pszNonce)); - MD5Update(&Md5Ctx, ":", 1); - if (*pszQop) { - - MD5Update(&Md5Ctx, pszNonceCount, strlen(pszNonceCount)); - MD5Update(&Md5Ctx, ":", 1); - MD5Update(&Md5Ctx, pszCNonce, strlen(pszCNonce)); - MD5Update(&Md5Ctx, ":", 1); - MD5Update(&Md5Ctx, pszQop, strlen(pszQop)); - MD5Update(&Md5Ctx, ":", 1); - }; - MD5Update(&Md5Ctx, HA2Hex, HASHHEXLEN); - MD5Final(RespHash, &Md5Ctx); - CvtHex(RespHash, Response); -}; diff --git a/rss2ctdl/digcalc.h b/rss2ctdl/digcalc.h deleted file mode 100644 index 225163945..000000000 --- a/rss2ctdl/digcalc.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * $Id$ - * - * Copyright 2003-2004 Oliver Feiler - * - * digcalc.h - * - * This is the sample implementation from RFC 2617. - * The code has been modified to work with Colin Plumb's - * MD5 implementation rather than using RSA's. - */ - -#define HASHLEN 16 -typedef char HASH[HASHLEN]; -#define HASHHEXLEN 32 -typedef char HASHHEX[HASHHEXLEN+1]; -#define IN -#define OUT - -void CvtHex( - IN HASH Bin, - OUT HASHHEX Hex - ); - -/* calculate H(A1) as per HTTP Digest spec */ -void DigestCalcHA1( - IN char * pszAlg, - IN char * pszUserName, - IN char * pszRealm, - IN char * pszPassword, - IN char * pszNonce, - IN char * pszCNonce, - OUT HASHHEX SessionKey - ); - -/* calculate request-digest/response-digest as per HTTP Digest spec */ -void DigestCalcResponse( - IN HASHHEX HA1, /* H(A1) */ - IN char * pszNonce, /* nonce from server */ - IN char * pszNonceCount, /* 8 hex digits */ - IN char * pszCNonce, /* client nonce */ - IN char * pszQop, /* qop-value: "", "auth", "auth-int" */ - IN char * pszMethod, /* method from the request */ - IN char * pszDigestUri, /* requested URL */ - IN HASHHEX HEntity, /* H(entity body) if qop="auth-int" */ - OUT HASHHEX Response /* request-digest or response-digest */ - ); diff --git a/rss2ctdl/do_feeds.sh-EXAMPLE b/rss2ctdl/do_feeds.sh-EXAMPLE deleted file mode 100755 index cbdb5dea2..000000000 --- a/rss2ctdl/do_feeds.sh-EXAMPLE +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -# Example RSS feed suck-o-matic script. -# -# This script is UNSUPPORTED. It is part of a technology preview for -# functionality which will eventually ship as part of the Citadel system. - -# Paths to the RSS2CTDL binary and to the Citadel directory -PROG=/usr/local/rss2ctdl/rss2ctdl -CTDL=/usr/local/citadel - -# Do one of these for each feed. You need the URL of the feed, the name -# of the room to dump it into, and a domain name to stamp onto messages -# and message ID's. -# -$PROG http://lxer.com/module/newswire/headlines.rss LXer lxer.com $CTDL -$PROG http://slashdot.org/index.rss Slashdot slashdot.org $CTDL -$PROG http://www.groklaw.net/backend/GrokLaw.rdf Groklaw groklaw.net $CTDL -$PROG http://www.ioerror.us/feed/rss2/ Lizard ioerror.us $CTDL diff --git a/rss2ctdl/feeds.cron b/rss2ctdl/feeds.cron deleted file mode 100755 index 3ab4b0f3f..000000000 --- a/rss2ctdl/feeds.cron +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -CITADEL_SPOOL=/var/spool/citadel/ -RSSFEEDER=/usr/sbin/rss2ctdl -FEEDFILE=/etc/citadel/rssfeeds -for i in `cat $FEEDFILE |grep -v "^#"`; do - remotedomain=`echo $i |sed "s:.*;::"` - room=`echo $i |sed "s:.*;\(.*\);.*:\1:"` - remoteurl=`echo $i |sed "s:;.*::"` - $RSSFEEDER "$remoteurl" "$room" "$remotedomain" "$CITADEL_SPOOL" -done \ No newline at end of file diff --git a/rss2ctdl/io-internal.c b/rss2ctdl/io-internal.c deleted file mode 100644 index 7d9cb21a9..000000000 --- a/rss2ctdl/io-internal.c +++ /dev/null @@ -1,195 +0,0 @@ -/* - * $Id$ - * - * Copyright 2003-2004 Oliver Feiler - * - * io-internal.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "config.h" - -#include "main.h" -#include "conversions.h" -#include "netio.h" -#include "xmlparse.h" -#include "io-internal.h" - -extern char *browser; - -void GetHTTPErrorString (char * errorstring, int size, int httpstatus) { - switch (httpstatus) { - case 400: - snprintf(errorstring, size, "Bad request"); - break; - case 402: - snprintf(errorstring, size, "Payment required"); - break; - case 403: - snprintf(errorstring, size, "Access denied"); - break; - case 500: - snprintf(errorstring, size, "Internal server error"); - break; - case 501: - snprintf(errorstring, size, "Not implemented"); - break; - case 502: - case 503: - snprintf(errorstring, size, "Service unavailable"); - break; - default: - sprintf(errorstring, "HTTP %d!", httpstatus); - } -} - -void PrintUpdateError (int suppressoutput, struct feed * cur_ptr) { - netio_error_type err; - char errstr[256]; - char httperrstr[64]; - - err = cur_ptr->netio_error; - - if (!suppressoutput) { - switch (err) { - case NET_ERR_OK: - break; - case NET_ERR_URL_INVALID: - fprintf(stderr, "%s: Invalid URL!\n", cur_ptr->title); - break; - case NET_ERR_SOCK_ERR: - fprintf(stderr, "%s: Couldn't create network socket!\n", cur_ptr->title); - break; - case NET_ERR_HOST_NOT_FOUND: - fprintf(stderr, "%s: Can't resolve host!\n", cur_ptr->title); - break; - case NET_ERR_CONN_REFUSED: - fprintf(stderr, "%s: Connection refused!\n", cur_ptr->title); - break; - case NET_ERR_CONN_FAILED: - fprintf(stderr, "%s: Couldn't connect to server: %s\n", - cur_ptr->title, - (strerror(cur_ptr->connectresult) ? strerror(cur_ptr->connectresult) : "(null)")); - break; - case NET_ERR_TIMEOUT: - fprintf(stderr, "%s: Connection timed out.\n", cur_ptr->title); - break; - case NET_ERR_UNKNOWN: - break; - case NET_ERR_REDIRECT_COUNT_ERR: - fprintf(stderr, "%s: Too many HTTP redirects encountered! Giving up.\n", cur_ptr->title); - break; - case NET_ERR_REDIRECT_ERR: - fprintf(stderr, "%s: Server sent an invalid redirect!\n", cur_ptr->title); - break; - case NET_ERR_HTTP_410: - case NET_ERR_HTTP_404: - fprintf(stderr, "%s: This feed no longer exists. Please unsubscribe!\n", cur_ptr->title); - break; - case NET_ERR_HTTP_NON_200: - GetHTTPErrorString(httperrstr, sizeof(httperrstr), cur_ptr->lasthttpstatus); - fprintf(stderr, "%s: Could not download feed: %s\n", cur_ptr->title, httperrstr); - break; - case NET_ERR_HTTP_PROTO_ERR: - fprintf(stderr, "%s: Error in server reply.\n", cur_ptr->title); - break; - case NET_ERR_AUTH_FAILED: - fprintf(stderr, "%s: Authentication failed!\n", cur_ptr->title); - break; - case NET_ERR_AUTH_NO_AUTHINFO: - fprintf(stderr, "%s: URL does not contain authentication information!\n", cur_ptr->title); - break; - case NET_ERR_AUTH_GEN_AUTH_ERR: - fprintf(stderr, "%s: Could not generate authentication information!\n", cur_ptr->title); - break; - case NET_ERR_AUTH_UNSUPPORTED: - fprintf(stderr, "%s: Unsupported authentication method requested by server!\n", cur_ptr->title); - break; - case NET_ERR_GZIP_ERR: - fprintf(stderr, "%s: Error decompressing server reply!\n", cur_ptr->title); - break; - default: - break; - } - /* Must be inside if(!suppressoutput) statement! */ - } -} - - -/* Update given feed from server. - * Reload XML document and replace in memory cur_ptr->feed with it. - */ -int UpdateFeed (struct feed * cur_ptr) { - char *tmpname; - char *freeme; - - if (cur_ptr == NULL) { - return 1; - } - - /* Need to work on a copy of ->feedurl, because DownloadFeed() changes the pointer. */ - tmpname = strdup (cur_ptr->feedurl); - freeme = tmpname; /* Need to make a copy, otherwise we cannot free all RAM. */ - free (cur_ptr->feed); - - cur_ptr->feed = DownloadFeed (tmpname, cur_ptr, 0); - free (freeme); - - /* Set title and link structure to something. - * To the feedurl in this case so the program show something - * as placeholder instead of crash. */ - if (cur_ptr->title == NULL) - cur_ptr->title = strdup (cur_ptr->feedurl); - if (cur_ptr->link == NULL) - cur_ptr->link = strdup (cur_ptr->feedurl); - - /* If the download function returns a NULL pointer return from here. */ - if (cur_ptr->feed == NULL) { - if (cur_ptr->problem == 1) - PrintUpdateError (0, cur_ptr); - return 1; - } - - /* If there is no feed, return. */ - if (cur_ptr->feed == NULL) - return 1; - - if ((DeXML (cur_ptr)) != 0) { - fprintf(stderr, "Invalid XML! Cannot parse this feed!\n"); - - /* Activate feed problem flag. */ - cur_ptr->problem = 1; - return 1; - } - - /* We don't need these anymore. Free the raw XML to save some memory. */ - free (cur_ptr->feed); - cur_ptr->feed = NULL; - - return 0; -} - - diff --git a/rss2ctdl/io-internal.h b/rss2ctdl/io-internal.h deleted file mode 100644 index fd7f2c727..000000000 --- a/rss2ctdl/io-internal.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * $Id$ - * - * Copyright 2003-2004 Oliver Feiler - * - * io-internal.h - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef IO_INTERNAL_H -#define IO_INTERNAL_H - -int UpdateFeed (struct feed * cur_ptr); - -#endif diff --git a/rss2ctdl/main.c b/rss2ctdl/main.c deleted file mode 100644 index d763942ef..000000000 --- a/rss2ctdl/main.c +++ /dev/null @@ -1,211 +0,0 @@ -/* - * $Id$ - * - * rss2ctdl -- a utility to pull RSS feeds into Citadel rooms. - * - * Main program is (c)2004 by Art Cancro - * RSS parser is (c)2003-2004 by Oliver Feiler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "config.h" -#include "main.h" -#include "io-internal.h" -#include "conversions.h" -#include "md5.h" -#include "digcalc.h" - -struct feed *first_ptr = NULL; -struct entity *first_entity = NULL; - -/* - * If you want to use a proxy server, you can hack the following two lines. - */ -char *proxyname = ""; -unsigned short proxyport = 0; - -/* - * Main function of program. - */ -int main (int argc, char *argv[]) { - struct feed *new_ptr; - char *url; - char tmp[512]; - struct newsitem *itemptr; - FILE *fp; - char md5msgid[256]; - MD5_CTX md5context; - HASHHEX md5context_hex; - -#ifdef LOCALEPATH - setlocale (LC_ALL, ""); - bindtextdomain ("rss2ctdl", LOCALEPATH); - textdomain ("rss2ctdl"); -#endif - - if (argc != 5) { - fprintf(stderr, - "%s: usage:\n %s \n", - argv[0], argv[0]); - exit(1); - } - - /* Init the pRNG. See about.c for usages of rand() ;) */ - srand(time(0)); - - url = strdup(argv[1]); - CleanupString(url, 0); - - /* Support that stupid feed:// "protocol" */ - if (strncasecmp (url, "feed://", 7) == 0) - memcpy (url, "http", 4); - - /* If URL does not start with the procotol specification, - assume http:// - -> tmp[512] -> we can "only" use max 504 chars from url ("http://" == 7). */ - if ((strncasecmp (url, "http://", 7) != 0) && - (strncasecmp (url, "https://", 8) != 0)) { - if (strlen (url) < 504) { - strcpy (tmp, "http://"); - strncat (tmp, url, 504); - free (url); - url = strdup (tmp); - } else { - free (url); - return 2; - } - } - - new_ptr = malloc (sizeof(struct feed)); - new_ptr->feedurl = strdup(url); - new_ptr->feed = NULL; - new_ptr->content_length = 0; - new_ptr->title = NULL; - new_ptr->link = NULL; - new_ptr->description = NULL; - new_ptr->lastmodified = NULL; - new_ptr->lasthttpstatus = 0; - new_ptr->content_type = NULL; - new_ptr->netio_error = NET_ERR_OK; - new_ptr->connectresult = 0; - new_ptr->cookies = NULL; - new_ptr->authinfo = NULL; - new_ptr->servauth = NULL; - new_ptr->items = NULL; - new_ptr->problem = 0; - new_ptr->original = NULL; - - /* Don't need url text anymore. */ - free (url); - - /* Download new feed and DeXMLize it. */ - if ((UpdateFeed (new_ptr)) != 0) { - exit(1); - } - - sprintf(tmp, "%s/network/spoolin/rssfeed.%08lx.%04x", argv[4], time(NULL), getpid()); - fp = fopen(tmp, "w"); - if (fp == NULL) { - fprintf(stderr, "%s: cannot open %s: %s\n", - argv[0], tmp, strerror(errno)); - exit(errno); - } - - for (itemptr = new_ptr->items; itemptr != NULL; itemptr = itemptr->next_ptr) { - - /* Reject items more than 6 days old, because the loopzapper only keeps 7 days - * worth of data. - */ - if ( (itemptr->data->date != 0L) && (time(NULL) - itemptr->data->date >= 518400L) ) { - fprintf(stderr, "REJECTED: %s\n", itemptr->data->title); - } - - if ( (itemptr->data->date == 0L) || (time(NULL) - itemptr->data->date < 518400L) ) { - - fprintf(stderr, "ACCEPTED: %s\n", itemptr->data->title); - fprintf(fp, "%c", 255); /* Start of message */ - fprintf(fp, "A"); /* Non-anonymous */ - fprintf(fp, "%c", 4); /* MIME */ - fprintf(fp, "Prss%c", 0); /* path */ - - /* The message ID will be an MD5 hash of the GUID. - * If there is no GUID present, we construct a message ID based - * on an MD5 hash of each item. Citadel's loopzapper will automatically - * reject items with message ID's which have already been submitted. - */ - MD5Init(&md5context); - if (itemptr->data->guid != NULL) { - MD5Update(&md5context, itemptr->data->guid, strlen(itemptr->data->guid)); - } - else { - if (itemptr->data->title != NULL) { - MD5Update(&md5context, itemptr->data->title, strlen(itemptr->data->title)); - } - //if (itemptr->data->description != NULL) { - //MD5Update(&md5context, itemptr->data->description, strlen(itemptr->data->description)); - //} - if (itemptr->data->link != NULL) { - MD5Update(&md5context, itemptr->data->link, strlen(itemptr->data->link)); - } - } - MD5Final(md5msgid, &md5context); - CvtHex(md5msgid, md5context_hex); - - fprintf(fp, "I%s@%s%c", md5context_hex, argv[3], 0); /* ID */ - - fprintf(fp, "T%ld%c", time(NULL), 0); /* time */ - fprintf(fp, "Arss%c", 0); /* author */ - fprintf(fp, "O%s%c", argv[2], 0); /* room */ - fprintf(fp, "C%s%c", argv[2], 0); /* room */ - fprintf(fp, "N%s%c", argv[3], 0); /* orig node */ - if (itemptr->data->guid != NULL) { - fprintf(fp, "E%s%c", itemptr->data->guid, 0); /* guid=euid*/ - } - if (itemptr->data->title != NULL) { - fprintf(fp, "U%s%c", itemptr->data->title, 0); /* subject */ - } - - fprintf(fp, "M"); /* msg text */ - fprintf(fp, "Content-type: text/html\r\n\r\n"); - fprintf(fp, "\r\n"); - fprintf(fp, "%s\n", itemptr->data->description); - if (itemptr->data->link != NULL) { - fprintf(fp, "

\r\n"); - fprintf(fp, "%s\n", - itemptr->data->link, - itemptr->data->link); - } - fprintf(fp, "\r\n"); - fprintf(fp, "%c", 0); - } - } - - fclose(fp); - - /* Be lazy and let the operating system free all the memory. */ - return(0); -} diff --git a/rss2ctdl/main.h b/rss2ctdl/main.h deleted file mode 100644 index a5440f4b5..000000000 --- a/rss2ctdl/main.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * $Id$ - * - * Copyright 2003-2004 Oliver Feiler - * - * main.h - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef MAIN_H -#define MAIN_H - -#include "config.h" - -#endif diff --git a/rss2ctdl/md5.c b/rss2ctdl/md5.c deleted file mode 100644 index 676881210..000000000 --- a/rss2ctdl/md5.c +++ /dev/null @@ -1,270 +0,0 @@ -/* - * $Id$ - * - * Copyright 2003-2004 Oliver Feiler - * - * md5.c - * - * This code has been slightly modified from its original. - * The endian check via evaluating endian.h has been - * replaced with the code in void byteReverse(). - */ - -/* - * This code implements the MD5 message-digest algorithm. - * The algorithm is due to Ron Rivest. This code was - * written by Colin Plumb in 1993, no copyright is claimed. - * This code is in the public domain; do with it what you wish. - * - * Equivalent code is available from RSA Data Security, Inc. - * This code has been tested against that, and is equivalent, - * except that you don't need to include two pages of legalese - * with every copy. - * - * To compute the message digest of a chunk of bytes, declare an - * MD5Context structure, pass it to MD5Init, call MD5Update as - * needed on buffers full of bytes, and then call MD5Final, which - * will fill a supplied 16-byte array with the digest. - */ - -#include /* for memcpy() */ -#include "md5.h" - -void byteReverse(unsigned char *buf, unsigned longs); - -static int endian_check = -1; - -/* - * Note: this code is harmless on little-endian machines. - */ -void byteReverse(unsigned char *buf, unsigned longs) -{ - uint32 t; - static uint32 d = 0xdeadbeef; - unsigned char *b = (unsigned char *) &d; - - if (endian_check == -1) { - if (b[0] == 0xde) - endian_check = 1; - else - endian_check = 0; - } - - if (endian_check == 0) - return; - - do { - t = (uint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 | - ((unsigned) buf[1] << 8 | buf[0]); - *(uint32 *) buf = t; - buf += 4; - } while (--longs); -} - -/* - * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious - * initialization constants. - */ -void MD5Init(struct MD5Context *ctx) -{ - ctx->buf[0] = 0x67452301; - ctx->buf[1] = 0xefcdab89; - ctx->buf[2] = 0x98badcfe; - ctx->buf[3] = 0x10325476; - - ctx->bits[0] = 0; - ctx->bits[1] = 0; -} - -/* - * Update context to reflect the concatenation of another buffer full - * of bytes. - */ -void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len) -{ - uint32 t; - - /* Update bitcount */ - - t = ctx->bits[0]; - if ((ctx->bits[0] = t + ((uint32) len << 3)) < t) - ctx->bits[1]++; /* Carry from low to high */ - ctx->bits[1] += len >> 29; - - t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */ - - /* Handle any leading odd-sized chunks */ - - if (t) { - unsigned char *p = (unsigned char *) ctx->in + t; - - t = 64 - t; - if (len < t) { - memcpy(p, buf, len); - return; - } - memcpy(p, buf, t); - byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (uint32 *) ctx->in); - buf += t; - len -= t; - } - /* Process data in 64-byte chunks */ - - while (len >= 64) { - memcpy(ctx->in, buf, 64); - byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (uint32 *) ctx->in); - buf += 64; - len -= 64; - } - - /* Handle any remaining bytes of data. */ - - memcpy(ctx->in, buf, len); -} - -/* - * Final wrapup - pad to 64-byte boundary with the bit pattern - * 1 0* (64-bit count of bits processed, MSB-first) - */ -void MD5Final(unsigned char digest[16], struct MD5Context *ctx) -{ - unsigned count; - unsigned char *p; - - /* Compute number of bytes mod 64 */ - count = (ctx->bits[0] >> 3) & 0x3F; - - /* Set the first char of padding to 0x80. This is safe since there is - always at least one byte free */ - p = ctx->in + count; - *p++ = 0x80; - - /* Bytes of padding needed to make 64 bytes */ - count = 64 - 1 - count; - - /* Pad out to 56 mod 64 */ - if (count < 8) { - /* Two lots of padding: Pad the first block to 64 bytes */ - memset(p, 0, count); - byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (uint32 *) ctx->in); - - /* Now fill the next block with 56 bytes */ - memset(ctx->in, 0, 56); - } else { - /* Pad block to 56 bytes */ - memset(p, 0, count - 8); - } - byteReverse(ctx->in, 14); - - /* Append length in bits and transform */ - ((uint32 *) ctx->in)[14] = ctx->bits[0]; - ((uint32 *) ctx->in)[15] = ctx->bits[1]; - - MD5Transform(ctx->buf, (uint32 *) ctx->in); - byteReverse((unsigned char *) ctx->buf, 4); - memcpy(digest, ctx->buf, 16); - memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ -} - -/* The four core functions - F1 is optimized somewhat */ - -/* #define F1(x, y, z) (x & y | ~x & z) */ -#define F1(x, y, z) (z ^ (x & (y ^ z))) -#define F2(x, y, z) F1(z, x, y) -#define F3(x, y, z) (x ^ y ^ z) -#define F4(x, y, z) (y ^ (x | ~z)) - -/* This is the central step in the MD5 algorithm. */ -#define MD5STEP(f, w, x, y, z, data, s) \ - ( w += f(x, y, z) + data, w = w<>(32-s), w += x ) - -/* - * The core of the MD5 algorithm, this alters an existing MD5 hash to - * reflect the addition of 16 longwords of new data. MD5Update blocks - * the data and converts bytes into longwords for this routine. - */ -void MD5Transform(uint32 buf[4], uint32 const in[16]) -{ - register uint32 a, b, c, d; - - a = buf[0]; - b = buf[1]; - c = buf[2]; - d = buf[3]; - - MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); - MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); - MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); - MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); - MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); - MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); - MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); - MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); - MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); - MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); - MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); - MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); - MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); - MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); - MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); - MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); - - MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); - MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); - MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); - MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); - MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); - MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); - MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); - MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); - MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); - MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); - MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); - MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); - MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); - MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); - MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); - MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); - - MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); - MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); - MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); - MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); - MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); - MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); - MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); - MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); - MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); - MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); - MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); - MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); - MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); - MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); - MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); - MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); - - MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); - MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); - MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); - MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); - MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); - MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); - MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); - MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); - MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); - MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); - MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); - MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); - MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); - MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); - MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); - MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); - - buf[0] += a; - buf[1] += b; - buf[2] += c; - buf[3] += d; -} diff --git a/rss2ctdl/md5.h b/rss2ctdl/md5.h deleted file mode 100644 index 5003e6d09..000000000 --- a/rss2ctdl/md5.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * $Id$ - * - * Copyright 2003-2004 Oliver Feiler - * - * md5.h - * - * This code has been slightly modified from its original. - * The endian check via evaluating endian.h has been - * replaced with the code in void byteReverse(). - */ - -/* - * This code implements the MD5 message-digest algorithm. - * The algorithm is due to Ron Rivest. This code was - * written by Colin Plumb in 1993, no copyright is claimed. - * This code is in the public domain; do with it what you wish. - * - * Equivalent code is available from RSA Data Security, Inc. - * This code has been tested against that, and is equivalent, - * except that you don't need to include two pages of legalese - * with every copy. - * - * To compute the message digest of a chunk of bytes, declare an - * MD5Context structure, pass it to MD5Init, call MD5Update as - * needed on buffers full of bytes, and then call MD5Final, which - * will fill a supplied 16-byte array with the digest. - */ - -#ifndef MD5_H -#define MD5_H - -#ifdef __alpha -typedef unsigned int uint32; -#else -typedef unsigned long uint32; -#endif - -struct MD5Context { - uint32 buf[4]; - uint32 bits[2]; - unsigned char in[64]; -}; - -void MD5Init(struct MD5Context *context); -void MD5Update(struct MD5Context *context, unsigned char const *buf, - unsigned len); -void MD5Final(unsigned char digest[16], struct MD5Context *context); -void MD5Transform(uint32 buf[4], uint32 const in[16]); - -/* - * This is needed to make RSAREF happy on some MS-DOS compilers. - */ -typedef struct MD5Context MD5_CTX; - -#endif /* !MD5_H */ diff --git a/rss2ctdl/net-support.c b/rss2ctdl/net-support.c deleted file mode 100644 index 907f25077..000000000 --- a/rss2ctdl/net-support.c +++ /dev/null @@ -1,282 +0,0 @@ -/* - * $Id$ - * - * Copyright 2003-2004 Oliver Feiler - * - * net-support.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include -#include -#include - -#include "config.h" -#include "conversions.h" - -#include "digcalc.h" - -char * ConstructBasicAuth (char * username, char * password) { - int len; - char * authinfo; - char * authstring; - char * tmpstr; - - /* Create base64 authinfo. - - RFC 2617. Basic HTTP authentication. - Authorization: Basic username:password[base64 encoded] */ - - /* Construct the cleartext authstring. */ - len = strlen(username) + 1 + strlen(password) + 1; - authstring = malloc (len); - snprintf (authstring, len, "%s:%s", username, password); - - tmpstr = base64encode (authstring, len-1); - - /* "Authorization: Basic " + base64str + \r\n\0 */ - len = 21 + strlen(tmpstr) + 3; - authinfo = malloc (len); - snprintf (authinfo, len, "Authorization: Basic %s\r\n", tmpstr); - - free (tmpstr); - free (authstring); - - return authinfo; -} - -char * GetRandomBytes (void) { - char * randomness = NULL; - char raw[8]; - int i; - FILE * devrandom; - - devrandom = fopen ("/dev/random", "r"); - if (devrandom == NULL) { - /* Use rand() if we don't have access to /dev/random. */ - for (i = 0; i <= 7; i++) { - raw[i] = 1+(float)rand() / (float)RAND_MAX * 255; - } - } else { - fread (raw, 8, 1, devrandom); - fclose (devrandom); - } - - randomness = malloc (17); - snprintf (randomness, 17, "%hhx%hhx%hhx%hhx%hhx%hhx%hhx%hhx", - raw[0], raw[1], raw[2], raw[3], raw[4], raw[5], raw[6], raw[7]); - - return randomness; -} - -char * ConstructDigestAuth (char * username, char * password, char * url, char * authdata) { - char * authinfo; /* Authorization header as sent to the server. */ - char * token; - int len; - char * realm = NULL; /* Variables for the overcomplicated and annoying HTTP digest algo. */ - char * qop = NULL; - char * nonce = NULL; - char * opaque = NULL; - char * cnonce; - char szNonceCount[9] = "00000001"; /* Can be always 1 if we never use the same cnonce twice. */ - HASHHEX HA1; - HASHHEX HA2 = ""; - HASHHEX Response; - - cnonce = GetRandomBytes(); - - while (1) { - token = strsep (&authdata, ", "); - - if (token == NULL) - break; - - if (strncasecmp (token, "realm", 5) == 0) { - len = strlen(token)-8; - memmove (token, token+7, len); - token[len] = '\0'; - realm = strdup (token); - } else if (strncasecmp (token, "qop", 3) == 0) { - len = strlen(token)-6; - memmove (token, token+5, len); - token[len] = '\0'; - qop = strdup (token); - } else if (strncasecmp (token, "nonce", 5) == 0) { - len = strlen(token)-8; - memmove (token, token+7, len); - token[len] = '\0'; - nonce = strdup (token); - } else if (strncasecmp (token, "opaque", 6) == 0) { - len = strlen(token)-9; - memmove (token, token+8, len); - token[len] = '\0'; - opaque = strdup (token); - } - } - - DigestCalcHA1 ("md5", username, realm, password, nonce, cnonce, HA1); - DigestCalcResponse(HA1, nonce, szNonceCount, cnonce, "auth", "GET", url, HA2, Response); - - /* Determine length of Authorize header. - * - * Authorization: Digest username="(username)", realm="(realm)", - * nonce="(nonce)", uri="(url)", algorithm=MD5, response="(Response)", - * qop=(auth), nc=(szNonceCount), cnonce="deadbeef" - */ - if (opaque == NULL) - len = 32 + strlen(username) + 10 + strlen(realm) + 10 + strlen(nonce) + 8 + strlen(url) + 28 + strlen(Response) + 16 + strlen(szNonceCount) + 10 + strlen(cnonce) + 4 ; - else - len = 32 + strlen(username) + 10 + strlen(realm) + 10 + strlen(nonce) + 8 + strlen(url) + 28 + strlen(Response) + 16 + strlen(szNonceCount) + 10 + strlen(cnonce) + 10 + strlen(opaque) + 4; - - authinfo = malloc (len); - - if (opaque == NULL) { - snprintf (authinfo, len, "Authorization: Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", algorithm=MD5, response=\"%s\", qop=auth, nc=%s, cnonce=\"%s\"\r\n", - username, realm, nonce, url, Response, szNonceCount, cnonce); - } else { - snprintf (authinfo, len, "Authorization: Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", algorithm=MD5, response=\"%s\", qop=auth, nc=%s, cnonce=\"%s\", opaque=\"%s\"\r\n", - username, realm, nonce, url, Response, szNonceCount, cnonce, opaque); - } - - free (realm); - free (qop); - free (nonce); - free (cnonce); - free (opaque); - - return authinfo; -} - - -/* -Authorization: Digest username="(username)", realm="(realm)", -nonce="(nonce)", uri="(url)", algorithm=MD5, response="(Response)", -qop=(auth), nc=(szNonceCount), cnonce="deadbeef" -*/ -int NetSupportAuth (struct feed * cur_ptr, char * authdata, char * url, char * netbuf) { - char * header; - char * tmpstr; - char * freeme; - char * username = NULL; - char * password = NULL; - char * authtype = NULL; - - /* Reset cur_ptr->authinfo. */ - free (cur_ptr->authinfo); - cur_ptr->authinfo = NULL; - - /* Catch invalid authdata. */ - if (authdata == NULL) { - return 1; - } else if (strchr (authdata, ':') == NULL){ - /* No authinfo found in URL. This should not happen. */ - return 1; - } - - tmpstr = strdup (authdata); - freeme = tmpstr; - - strsep (&tmpstr, ":"); - username = strdup (freeme); - password = strdup (tmpstr); - - /* Free allocated string in tmpstr. */ - free (freeme); - - /* Extract requested auth type from webserver reply. */ - header = strdup (netbuf); - freeme = header; - strsep (&header, " "); - authtype = header; - - /* Catch invalid server replies. authtype should contain at least _something_. */ - if (authtype == NULL) { - free (freeme); - free (username); - free (password); - return -1; - } - - strsep (&header, " "); - /* header now contains: - Basic auth: realm - Digest auth: realm + a lot of other stuff somehow needed by digest auth. */ - - /* Determine auth type the server requests. */ - if (strncasecmp (authtype, "Basic", 5) == 0) { - /* Basic auth. */ - cur_ptr->authinfo = ConstructBasicAuth (username, password); - } else if (strncasecmp (authtype, "Digest", 6) == 0) { - /* Digest auth. */ - cur_ptr->authinfo = ConstructDigestAuth (username, password, url, header); - } else { - /* Unkown auth type. */ - free (freeme); - free (username); - free (password); - return -1; - } - - free (username); - free (password); - free (freeme); - - if (cur_ptr->authinfo == NULL) { - return 2; - } - - return 0; -} - -/* HTTP header may only contain ASCII characters. - * - * Ensure that we don't hit the terminating \0 in a string - * with the for loop. - * The function also ensures that there is no NULL byte in the string. - * If given binary data return at once if we read beyond - * the boundary of sizeof(header). - */ -int checkValidHTTPHeader (const unsigned char * header, int size) { - int i, len; - - len = strlen(header); - if (len > size) - return -1; - - for (i = 0; i < len; i++) { - if (((header[i] < 32) || (header[i] > 127)) && - (header[i] != '\r') && (header[i] != '\n')) - return -1; - } - return 0; -} - -int checkValidHTTPURL (const unsigned char * url) { - int i, len; - - if (strncasecmp(url, "http://", 7) != 0) - return -1; - - len = strlen(url); - - for (i = 0; i < len; i++) { - if ((url[i] < 32) || (url[i] > 126)) - return -1; - } - - return 0; -} - diff --git a/rss2ctdl/net-support.h b/rss2ctdl/net-support.h deleted file mode 100644 index a0ba70b6b..000000000 --- a/rss2ctdl/net-support.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * $Id$ - * - * Copyright 2003-2004 Oliver Feiler - * - * net-support.h - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef NET_SUPPORT_H -#define NET_SUPPORT_H - -int NetSupportAuth (struct feed * cur_ptr, char * authdata, char * url, char * netbuf); -int checkValidHTTPHeader (const unsigned char * header, int size); -int checkValidHTTPURL (const unsigned char * url); - -#endif diff --git a/rss2ctdl/netio.c b/rss2ctdl/netio.c deleted file mode 100644 index 347854d09..000000000 --- a/rss2ctdl/netio.c +++ /dev/null @@ -1,905 +0,0 @@ -/* - * $Id$ - * - * Copyright 2003-2004 Oliver Feiler - * - * netio.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * 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 - * - */ - -/* OS X needs this, otherwise socklen_t is not defined. */ -#ifdef __APPLE__ -# define _BSD_SOCKLEN_T_ -#endif - -/* BeOS does not define socklen_t. Using uint as suggested by port creator. */ -#ifdef __BEOS__ -# define socklen_t unsigned int -#endif - -#include -#include -#include -#include -#include -#include -//#include -#include -#include -#include -#include -#include -#include -#include - -#include "config.h" -#include "main.h" -#include "conversions.h" -#include "net-support.h" -#include "io-internal.h" -#include "zlib_interface.h" - -static int const MAX_HTTP_REDIRECTS = 10; /* Maximum number of redirects we will follow. */ -static int const NET_TIMEOUT = 20; /* Global network timeout in sec */ -static int const NET_READ = 1; -static int const NET_WRITE = 2; - -extern char *proxyname; /* Hostname of proxyserver. */ -extern unsigned short proxyport; /* Port on proxyserver to use. */ - -/* Masquerade as Firefox on Linux to increase the share of both in web server statistics. */ -/* char *useragent = "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0"; */ -/* On second thought, let's be honest about this. */ -char *useragent = "Citadel RSS Service/0.1 (multiple subscribers) (+http://www.citadel.org/)"; - -/* Waits NET_TIMEOUT seconds for the socket to return data. - * - * Returns - * - * 0 Socket is ready - * -1 Error occured (netio_error is set) - */ -int NetPoll (struct feed * cur_ptr, int * my_socket, int rw) { - fd_set rfdsr; - fd_set rfdsw; - struct timeval tv; - int retval; /* FD_ISSET + assert == Heisenbug? */ - - /* Set global network timeout */ - tv.tv_sec = NET_TIMEOUT; - tv.tv_usec = 0; - - FD_ZERO(&rfdsr); - FD_ZERO(&rfdsw); - - if (rw == NET_READ) { - FD_SET(*my_socket, &rfdsr); - if (select (*my_socket+1, &rfdsr, NULL, NULL, &tv) == 0) { - /* Timed out */ - cur_ptr->netio_error = NET_ERR_TIMEOUT; - return -1; - } - retval = FD_ISSET (*my_socket, &rfdsr); - assert (retval); - if (!retval) { - /* Wtf? */ - cur_ptr->netio_error = NET_ERR_UNKNOWN; - return -1; - } - } else if (rw == NET_WRITE) { - FD_SET(*my_socket, &rfdsw); - if (select (*my_socket+1, NULL, &rfdsw, NULL, &tv) == 0) { - /* Timed out */ - cur_ptr->netio_error = NET_ERR_TIMEOUT; - return -1; - } - retval = FD_ISSET (*my_socket, &rfdsw); - assert (retval); - if (!retval) { - /* Wtf? */ - cur_ptr->netio_error = NET_ERR_UNKNOWN; - return -1; - } - } else { - cur_ptr->netio_error = NET_ERR_UNKNOWN; - return -1; - } - - return 0; -} - - -/* Connect network sockets. - * - * Returns - * - * 0 Connected - * -1 Error occured (netio_error is set) - */ -int NetConnect (int * my_socket, char * host, struct feed * cur_ptr, int httpproto, int suppressoutput) { - char tmp[512]; - struct sockaddr_in address; - struct hostent *remotehost; - socklen_t len; - char *realhost; - unsigned short port; - - realhost = strdup(host); - if (sscanf (host, "%[^:]:%hd", realhost, &port) != 2) { - port = 80; - } - - /* Create a inet stream TCP socket. */ - *my_socket = socket (AF_INET, SOCK_STREAM, 0); - if (*my_socket == -1) { - cur_ptr->netio_error = NET_ERR_SOCK_ERR; - return -1; - } - - /* If proxyport is 0 we didn't execute the if http_proxy statement in main - so there is no proxy. On any other value of proxyport do proxyrequests instead. */ - if (proxyport == 0) { - /* Lookup remote IP. */ - remotehost = gethostbyname (realhost); - if (remotehost == NULL) { - close (*my_socket); - free (realhost); - cur_ptr->netio_error = NET_ERR_HOST_NOT_FOUND; - return -1; - } - - /* Set the remote address. */ - address.sin_family = AF_INET; - address.sin_port = htons(port); - memcpy (&address.sin_addr.s_addr, remotehost->h_addr_list[0], remotehost->h_length); - - /* Connect socket. */ - cur_ptr->connectresult = connect (*my_socket, (struct sockaddr *) &address, sizeof(address)); - - /* Check if we're already connected. - BSDs will return 0 on connect even in nonblock if connect was fast enough. */ - if (cur_ptr->connectresult != 0) { - /* If errno is not EINPROGRESS, the connect went wrong. */ - if (errno != EINPROGRESS) { - close (*my_socket); - free (realhost); - cur_ptr->netio_error = NET_ERR_CONN_REFUSED; - return -1; - } - - if ((NetPoll (cur_ptr, my_socket, NET_WRITE)) == -1) { - close (*my_socket); - free (realhost); - return -1; - } - - /* We get errno of connect back via getsockopt SO_ERROR (into connectresult). */ - len = sizeof(cur_ptr->connectresult); - getsockopt(*my_socket, SOL_SOCKET, SO_ERROR, &cur_ptr->connectresult, &len); - - if (cur_ptr->connectresult != 0) { - close (*my_socket); - free (realhost); - cur_ptr->netio_error = NET_ERR_CONN_FAILED; /* ->strerror(cur_ptr->connectresult) */ - return -1; - } - } - } else { - /* Lookup proxyserver IP. */ - remotehost = gethostbyname (proxyname); - if (remotehost == NULL) { - close (*my_socket); - free (realhost); - cur_ptr->netio_error = NET_ERR_HOST_NOT_FOUND; - return -1; - } - - /* Set the remote address. */ - address.sin_family = AF_INET; - address.sin_port = htons(proxyport); - memcpy (&address.sin_addr.s_addr, remotehost->h_addr_list[0], remotehost->h_length); - - /* Connect socket. */ - cur_ptr->connectresult = connect (*my_socket, (struct sockaddr *) &address, sizeof(address)); - - /* Check if we're already connected. - BSDs will return 0 on connect even in nonblock if connect was fast enough. */ - if (cur_ptr->connectresult != 0) { - if (errno != EINPROGRESS) { - close (*my_socket); - free (realhost); - cur_ptr->netio_error = NET_ERR_CONN_REFUSED; - return -1; - } - - if ((NetPoll (cur_ptr, my_socket, NET_WRITE)) == -1) { - close (*my_socket); - free (realhost); - return -1; - } - - len = sizeof(cur_ptr->connectresult); - getsockopt(*my_socket, SOL_SOCKET, SO_ERROR, &cur_ptr->connectresult, &len); - - if (cur_ptr->connectresult != 0) { - close (*my_socket); - free (realhost); - cur_ptr->netio_error = NET_ERR_CONN_FAILED; /* ->strerror(cur_ptr->connectresult) */ - return -1; - } - } - } - - free (realhost); - return 0; -} - - -/* - * Main network function. - * (Now with a useful function description *g*) - * - * This function returns the HTTP request's body (deflating gzip encoded data - * if needed). - * Updates passed feed struct with values gathered from webserver. - * Handles all redirection and HTTP status decoding. - * Returns NULL pointer if no data was received and sets netio_error. - */ -char * NetIO (int * my_socket, char * host, char * url, struct feed * cur_ptr, char * authdata, int httpproto, int suppressoutput) { - char netbuf[4096]; /* Network read buffer. */ - char *body; /* XML body. */ - unsigned int length; - FILE *stream; /* Stream socket. */ - int chunked = 0; /* Content-Encoding: chunked received? */ - int redirectcount; /* Number of HTTP redirects followed. */ - char httpstatus[4]; /* HTTP status sent by server. */ - char servreply[128]; /* First line of server reply */ - char *tmpstatus; - char *savestart; /* Save start position of pointers. */ - char *tmphost; /* Pointers needed to strsep operation. */ - char *newhost; /* New hostname if we need to redirect. */ - char *newurl; /* New document name ". */ - char *newlocation; - char *tmpstring; /* Temp pointers. */ - char *freeme, *freeme2; - char *redirecttarget; - int retval; - int handled; - int tmphttpstatus; - int inflate = 0; /* Whether feed data needs decompressed with zlib. */ - int len; - char * inflatedbody; - int quirksmode = 0; /* IIS operation mode. */ - int authfailed = 0; /* Avoid repeating failed auth requests endlessly. */ - - - if (!suppressoutput) { - if (cur_ptr->title == NULL) - fprintf(stderr, "Downloading http://%s%s\n", host, url); - else - fprintf(stderr, "Downloading %s\n", cur_ptr->title); - - } - - redirectcount = 0; - - /* Goto label to redirect reconnect. */ - tryagain: - - /* Reconstruct digest authinfo for every request so we don't reuse - the same nonce value for more than one request. - This happens one superflous time on 303 redirects. */ - if ((cur_ptr->authinfo != NULL) && (cur_ptr->servauth != NULL)) { - if (strstr (cur_ptr->authinfo, " Digest ") != NULL) { - NetSupportAuth(cur_ptr, authdata, url, cur_ptr->servauth); - } - } - - /* Open socket. */ - stream = fdopen (*my_socket, "r+"); - if (stream == NULL) { - /* This is a serious non-continueable OS error as it will probably not - go away if we retry. - - BeOS will stupidly return SUCCESS here making this code silently fail on BeOS. */ - cur_ptr->netio_error = NET_ERR_SOCK_ERR; - return NULL; - } - - /* Again is proxyport == 0, non proxy mode, otherwise make proxy requests. */ - if (proxyport == 0) { - /* Request URL from HTTP server. */ - if (cur_ptr->lastmodified != NULL) { - fprintf(stream, - "GET %s HTTP/1.0\r\nAccept-Encoding: gzip\r\nUser-Agent: %s\r\nConnection: close\r\nHost: %s\r\nIf-Modified-Since: %s\r\n%s%s\r\n", - url, - useragent, - host, - cur_ptr->lastmodified, - (cur_ptr->authinfo ? cur_ptr->authinfo : ""), - (cur_ptr->cookies ? cur_ptr->cookies : "")); - } else { - fprintf(stream, - "GET %s HTTP/1.0\r\nAccept-Encoding: gzip\r\nUser-Agent: %s\r\nConnection: close\r\nHost: %s\r\n%s%s\r\n", - url, - useragent, - host, - (cur_ptr->authinfo ? cur_ptr->authinfo : ""), - (cur_ptr->cookies ? cur_ptr->cookies : "")); - } - fflush(stream); /* We love Solaris, don't we? */ - } else { - /* Request URL from HTTP server. */ - if (cur_ptr->lastmodified != NULL) { - fprintf(stream, - "GET http://%s%s HTTP/1.0\r\nAccept-Encoding: gzip\r\nUser-Agent: %s\r\nConnection: close\r\nHost: %s\r\nIf-Modified-Since: %s\r\n%s%s\r\n", - host, - url, - useragent, - host, - cur_ptr->lastmodified, - (cur_ptr->authinfo ? cur_ptr->authinfo : ""), - (cur_ptr->cookies ? cur_ptr->cookies : "")); - } else { - fprintf(stream, - "GET http://%s%s HTTP/1.0\r\nAccept-Encoding: gzip\r\nUser-Agent: %s\r\nConnection: close\r\nHost: %s\r\n%s%s\r\n", - host, - url, - useragent, - host, - (cur_ptr->authinfo ? cur_ptr->authinfo : ""), - (cur_ptr->cookies ? cur_ptr->cookies : "")); - } - fflush(stream); /* We love Solaris, don't we? */ - } - - if ((NetPoll (cur_ptr, my_socket, NET_READ)) == -1) { - fclose (stream); - return NULL; - } - - if ((fgets (servreply, sizeof(servreply), stream)) == NULL) { - fclose (stream); - return NULL; - } - if (checkValidHTTPHeader(servreply, sizeof(servreply)) != 0) { - cur_ptr->netio_error = NET_ERR_HTTP_PROTO_ERR; - fclose (stream); - return NULL; - } - - tmpstatus = strdup(servreply); - savestart = tmpstatus; - - memset (httpstatus, 0, 4); /* Nullify string so valgrind shuts up. */ - /* Set pointer to char after first space. - HTTP/1.0 200 OK - ^ - Copy three bytes into httpstatus. */ - strsep (&tmpstatus, " "); - if (tmpstatus == NULL) { - cur_ptr->netio_error = NET_ERR_HTTP_PROTO_ERR; - fclose (stream); - free (savestart); /* Probably more leaks when doing auth and abort here. */ - return NULL; - } - strncpy (httpstatus, tmpstatus, 3); - free (savestart); - - cur_ptr->lasthttpstatus = atoi (httpstatus); - - /* If the redirectloop was run newhost and newurl were allocated. - We need to free them here. */ - if ((redirectcount > 0) && (authdata == NULL)) { - free (host); - free (url); - } - - tmphttpstatus = cur_ptr->lasthttpstatus; - handled = 1; - /* Check HTTP server response and handle redirects. */ - do { - switch (tmphttpstatus) { - case 200: /* OK */ - /* Received good status from server, clear problem field. */ - cur_ptr->netio_error = NET_ERR_OK; - cur_ptr->problem = 0; - break; - case 300: /* Multiple choice and everything 300 not handled is fatal. */ - cur_ptr->netio_error = NET_ERR_HTTP_NON_200; - fclose (stream); - return NULL; - case 301: - /* Permanent redirect. Change feed->feedurl to new location. - Done some way down when we have extracted the new url. */ - case 302: /* Found */ - case 303: /* See Other */ - case 307: /* Temp redirect. This is HTTP/1.1 */ - redirectcount++; - - /* Give up if we reach MAX_HTTP_REDIRECTS to avoid loops. */ - if (redirectcount > MAX_HTTP_REDIRECTS) { - cur_ptr->netio_error = NET_ERR_REDIRECT_COUNT_ERR; - fclose (stream); - return NULL; - } - - while (!feof(stream)) { - if ((fgets (netbuf, sizeof(netbuf), stream)) == NULL) { - /* Something bad happened. Server sent stupid stuff. */ - cur_ptr->netio_error = NET_ERR_HTTP_PROTO_ERR; - fclose (stream); - return NULL; - } - - if (checkValidHTTPHeader(netbuf, sizeof(netbuf)) != 0) { - cur_ptr->netio_error = NET_ERR_HTTP_PROTO_ERR; - fclose (stream); - return NULL; - } - - /* Split netbuf into hostname and trailing url. - Place hostname in *newhost and tail into *newurl. - Close old connection and reconnect to server. - - Do not touch any of the following code! :P */ - if (strncasecmp (netbuf, "Location", 8) == 0) { - redirecttarget = strdup (netbuf); - freeme = redirecttarget; - - /* Remove trailing \r\n from line. */ - redirecttarget[strlen(redirecttarget)-2] = 0; - - /* In theory pointer should now be after the space char - after the word "Location:" */ - strsep (&redirecttarget, " "); - - if (redirecttarget == NULL) { - cur_ptr->problem = 1; - cur_ptr->netio_error = NET_ERR_REDIRECT_ERR; - free (freeme); - fclose (stream); - return NULL; - } - - /* Location must start with "http", otherwise switch on quirksmode. */ - if (strncmp(redirecttarget, "http", 4) != 0) - quirksmode = 1; - - /* If the Location header is invalid we need to construct - a correct one here before proceeding with the program. - This makes headers like - "Location: fuck-the-protocol.rdf" work. - In violalation of RFC1945, RFC2616. */ - if (quirksmode) { - len = 7 + strlen(host) + strlen(redirecttarget) + 3; - newlocation = malloc(len); - memset (newlocation, 0, len); - strcat (newlocation, "http://"); - strcat (newlocation, host); - if (redirecttarget[0] != '/') - strcat (newlocation, "/"); - strcat (newlocation, redirecttarget); - } else - newlocation = strdup (redirecttarget); - - /* This also frees redirecttarget. */ - free (freeme); - - /* Change cur_ptr->feedurl on 301. */ - if (cur_ptr->lasthttpstatus == 301) { - /* Check for valid redirection URL */ - if (checkValidHTTPURL(newlocation) != 0) { - cur_ptr->problem = 1; - cur_ptr->netio_error = NET_ERR_REDIRECT_ERR; - fclose (stream); - return NULL; - } - if (!suppressoutput) { - fprintf(stderr, "URL points to permanent redirect, updating with new location...\n"); - } - free (cur_ptr->feedurl); - if (authdata == NULL) - cur_ptr->feedurl = strdup (newlocation); - else { - /* Include authdata in newly constructed URL. */ - len = strlen(authdata) + strlen(newlocation) + 2; - cur_ptr->feedurl = malloc (len); - newurl = strdup(newlocation); - freeme2 = newurl; - strsep (&newurl, "/"); - strsep (&newurl, "/"); - snprintf (cur_ptr->feedurl, len, "http://%s@%s", authdata, newurl); - free (freeme2); - } - } - - freeme = newlocation; - strsep (&newlocation, "/"); - strsep (&newlocation, "/"); - tmphost = newlocation; - /* The following line \0-terminates tmphost in overwriting the first - / after the hostname. */ - strsep (&newlocation, "/"); - - /* newlocation must now be the absolute path on newhost. - If not we've been redirected to somewhere totally stupid - (oh yeah, no offsite linking, go to our fucking front page). - Say goodbye to the webserver in this case. In fact, we don't - even say goodbye, but just drop the connection. */ - if (newlocation == NULL) { - cur_ptr->netio_error = NET_ERR_REDIRECT_ERR; - fclose (stream); - return NULL; - } - - newhost = strdup (tmphost); - newlocation--; - newlocation[0] = '/'; - newurl = strdup (newlocation); - - free (freeme); - - /* Close connection. */ - fclose (stream); - - /* Reconnect to server. */ - if ((NetConnect (my_socket, newhost, cur_ptr, httpproto, suppressoutput)) != 0) { - return NULL; - } - - host = newhost; - url = newurl; - - goto tryagain; - } - } - break; - case 304: - /* Not modified received. We can close stream and return from here. - Not very friendly though. :) */ - fclose (stream); - /* Received good status from server, clear problem field. */ - cur_ptr->netio_error = NET_ERR_OK; - cur_ptr->problem = 0; - - /* This should be freed everywhere where we return - and current feed uses auth. */ - if ((redirectcount > 0) && (authdata != NULL)) { - free (host); - free (url); - } - return NULL; - case 401: - /* Authorization. - Parse rest of header and rerequest URL from server using auth mechanism - requested in WWW-Authenticate header field. (Basic or Digest) */ - break; - case 404: - cur_ptr->netio_error = NET_ERR_HTTP_404; - fclose (stream); - return NULL; - case 410: /* The feed is gone. Politely remind the user to unsubscribe. */ - cur_ptr->netio_error = NET_ERR_HTTP_410; - fclose (stream); - return NULL; - case 400: - cur_ptr->netio_error = NET_ERR_HTTP_NON_200; - fclose (stream); - return NULL; - default: - /* unknown error codes have to be treated like the base class */ - if (handled) { - /* first pass, modify error code to base class */ - handled = 0; - tmphttpstatus -= tmphttpstatus % 100; - } else { - /* second pass, give up on unknown error base class */ - cur_ptr->netio_error = NET_ERR_HTTP_NON_200; - fclose (stream); - return NULL; - } - } - } while(!handled); - - /* Read rest of HTTP header and parse what we need. */ - while (!feof(stream)) { - if ((NetPoll (cur_ptr, my_socket, NET_READ)) == -1) { - fclose (stream); - return NULL; - } - - if ((fgets (netbuf, sizeof(netbuf), stream)) == NULL) - break; - - if (checkValidHTTPHeader(netbuf, sizeof(netbuf)) != 0) { - cur_ptr->netio_error = NET_ERR_HTTP_PROTO_ERR; - fclose (stream); - return NULL; - } - - if (strncasecmp (netbuf, "Transfer-Encoding", 17) == 0) { - /* Chunked transfer encoding. HTTP/1.1 extension. - http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6.1 */ - if (strstr (netbuf, "chunked") != NULL) - chunked = 1; - } - /* Get last modified date. This is only relevant on HTTP 200. */ - if ((strncasecmp (netbuf, "Last-Modified", 13) == 0) && - (cur_ptr->lasthttpstatus == 200)) { - tmpstring = strdup(netbuf); - freeme = tmpstring; - strsep (&tmpstring, " "); - if (tmpstring == NULL) - free (freeme); - else { - free(cur_ptr->lastmodified); - cur_ptr->lastmodified = strdup(tmpstring); - if (cur_ptr->lastmodified[strlen(cur_ptr->lastmodified)-1] == '\n') - cur_ptr->lastmodified[strlen(cur_ptr->lastmodified)-1] = '\0'; - if (cur_ptr->lastmodified[strlen(cur_ptr->lastmodified)-1] == '\r') - cur_ptr->lastmodified[strlen(cur_ptr->lastmodified)-1] = '\0'; - free(freeme); - } - } - if (strncasecmp (netbuf, "Content-Encoding", 16) == 0) { - if (strstr (netbuf, "gzip") != NULL) - inflate = 1; - } - if (strncasecmp (netbuf, "Content-Type", 12) == 0) { - tmpstring = strdup(netbuf); - freeme = tmpstring; - strsep(&tmpstring, " "); - if (tmpstring == NULL) - free (freeme); - else { - freeme2 = NULL; - freeme2 = strstr(tmpstring, ";"); - if (freeme2 != NULL) - freeme2[0] = '\0'; - free(cur_ptr->content_type); - cur_ptr->content_type = strdup(tmpstring); - if (cur_ptr->content_type[strlen(cur_ptr->content_type)-1] == '\n') - cur_ptr->content_type[strlen(cur_ptr->content_type)-1] = '\0'; - if (cur_ptr->content_type[strlen(cur_ptr->content_type)-1] == '\r') - cur_ptr->content_type[strlen(cur_ptr->content_type)-1] = '\0'; - free(freeme); - } - } - /* HTTP authentication - * - * RFC 2617 */ - if ((strncasecmp (netbuf, "WWW-Authenticate", 16) == 0) && - (cur_ptr->lasthttpstatus == 401)) { - if (authfailed) { - /* Don't repeat authrequest if it already failed before! */ - cur_ptr->netio_error = NET_ERR_AUTH_FAILED; - fclose (stream); - return NULL; - } - - /* Remove trailing \r\n from line. */ - if (netbuf[strlen(netbuf)-1] == '\n') - netbuf[strlen(netbuf)-1] = '\0'; - if (netbuf[strlen(netbuf)-1] == '\r') - netbuf[strlen(netbuf)-1] = '\0'; - - authfailed++; - - /* Make a copy of the WWW-Authenticate header. We use it to - reconstruct a new auth reply on every loop. */ - free (cur_ptr->servauth); - - cur_ptr->servauth = strdup (netbuf); - - /* Load authinfo into cur_ptr->authinfo. */ - retval = NetSupportAuth(cur_ptr, authdata, url, netbuf); - - switch (retval) { - case 1: - cur_ptr->netio_error = NET_ERR_AUTH_NO_AUTHINFO; - fclose (stream); - return NULL; - break; - case 2: - cur_ptr->netio_error = NET_ERR_AUTH_GEN_AUTH_ERR; - fclose (stream); - return NULL; - break; - case -1: - cur_ptr->netio_error = NET_ERR_AUTH_UNSUPPORTED; - fclose (stream); - return NULL; - break; - default: - break; - } - - /* Close current connection and reconnect to server. */ - fclose (stream); - if ((NetConnect (my_socket, host, cur_ptr, httpproto, suppressoutput)) != 0) { - return NULL; - } - - /* Now that we have an authinfo, repeat the current request. */ - goto tryagain; - } - /* This seems to be optional and probably not worth the effort since we - don't issue a lot of consecutive requests. */ - /*if ((strncasecmp (netbuf, "Authentication-Info", 19) == 0) || - (cur_ptr->lasthttpstatus == 200)) { - - }*/ - - /* HTTP RFC 2616, Section 19.3 Tolerant Applications. - Accept CRLF and LF line ends in the header field. */ - if ((strcmp(netbuf, "\r\n") == 0) || (strcmp(netbuf, "\n") == 0)) - break; - } - - /* If the redirectloop was run newhost and newurl were allocated. - We need to free them here. - But _after_ the authentication code since it needs these values! */ - if ((redirectcount > 0) && (authdata != NULL)) { - free (host); - free (url); - } - - /********************** - * End of HTTP header * - **********************/ - - /* Init pointer so strncat works. - Workaround class hack. */ - body = malloc(1); - body[0] = '\0'; - - length = 0; - - /* Read stream until EOF and return it to parent. */ - while (!feof(stream)) { - if ((NetPoll (cur_ptr, my_socket, NET_READ)) == -1) { - fclose (stream); - return NULL; - } - - /* Since we handle binary data if we read compressed input we - need to use fread instead of fgets after reading the header. */ - retval = fread (netbuf, 1, sizeof(netbuf), stream); - if (retval == 0) - break; - body = realloc (body, length+retval); - memcpy (body+length, netbuf, retval); - length += retval; - if (retval != 4096) - break; - } - body = realloc(body, length+1); - body[length] = '\0'; - - cur_ptr->content_length = length; - - /* Close connection. */ - fclose (stream); - - if (chunked) { - if (decodechunked(body, &length) == NULL) { - free (body); - cur_ptr->netio_error = NET_ERR_HTTP_PROTO_ERR; - return NULL; - } - } - - /* If inflate==1 we need to decompress the content.. */ - if (inflate == 1) { - /* gzipinflate */ - /*inflatedbody = gzip_uncompress (body, length, &cur_ptr->content_length); - if (inflatedbody == NULL) { - free (body); - cur_ptr->netio_error = NET_ERR_GZIP_ERR; - return NULL; - }*/ - if (jg_gzip_uncompress (body, length, (void **)&inflatedbody, &cur_ptr->content_length) != 0) { - free (body); - cur_ptr->netio_error = NET_ERR_GZIP_ERR; - return NULL; - } - - /* Copy uncompressed data back to body. */ - free (body); - body = inflatedbody; - } - - return body; -} - -/* Returns allocated string with body of webserver reply. - Various status info put into struct feed *cur_ptr. - Set suppressoutput=1 to disable diagnostic output. */ -char *DownloadFeed(char *url, struct feed *cur_ptr, int suppressoutput) { - int my_socket = 0; - int url_fixup = 0; - char *host; /* Needs to freed. */ - char *tmphost; - char *freeme; - char *returndata; - char *authdata = NULL; - char *tmpstr; - int httpproto = 0; /* 0: http; 1: https */ - - if (checkValidHTTPURL(url) != 0) { - cur_ptr->problem = 1; - cur_ptr->netio_error = NET_ERR_HTTP_PROTO_ERR; - return NULL; - } - /* strstr will match _any_ substring. Not good, use strncasecmp with length 5! */ - if (strncasecmp (url, "https", 5) == 0) - httpproto = 1; - else - httpproto = 0; - - strsep (&url, "/"); - strsep (&url, "/"); - tmphost = url; - strsep (&url, "/"); - if (url == NULL) { - /* Assume "/" is input is exhausted. */ - url = strdup("/"); - url_fixup = 1; - } - - /* If tmphost contains an '@', extract username and pwd. */ - if (strchr (tmphost, '@') != NULL) { - tmpstr = tmphost; - strsep (&tmphost, "@"); - authdata = strdup (tmpstr); - } - - host = strdup (tmphost); - - /* netio() might change pointer of host to something else if redirect - loop is executed. Make a copy so we can correctly free everything. */ - freeme = host; - /* Only run if url was != NULL above. */ - if (!url_fixup) { - url--; - url[0] = '/'; - if (url[strlen(url)-1] == '\n') { - url[strlen(url)-1] = '\0'; - } - } - - if ((NetConnect (&my_socket, host, cur_ptr, httpproto, suppressoutput)) != 0) { - free (freeme); - free (authdata); - if (url_fixup) - free(url); - cur_ptr->problem = 1; - return NULL; - } - returndata = NetIO (&my_socket, host, url, cur_ptr, authdata, httpproto, suppressoutput); - if ((returndata == NULL) && (cur_ptr->netio_error != NET_ERR_OK)) { - cur_ptr->problem = 1; - } - - /* url will be freed in the calling function. */ - free (freeme); /* This is *host. */ - free (authdata); - if (url_fixup) - free(url); - - return returndata; -} diff --git a/rss2ctdl/netio.h b/rss2ctdl/netio.h deleted file mode 100644 index 2ef3638e7..000000000 --- a/rss2ctdl/netio.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * $Id$ - * - * Copyright 2003-2004 Oliver Feiler - * - * netio.h - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef NETIO_H -#define NETIO_H - -struct feed; - -char *DownloadFeed (char *url, struct feed *cur_ptr, int suppressoutput); - -typedef enum { - NET_ERR_OK, - /* Init errors */ - NET_ERR_URL_INVALID, - /* Connect errors */ - NET_ERR_SOCK_ERR, - NET_ERR_HOST_NOT_FOUND, - NET_ERR_CONN_REFUSED, - NET_ERR_CONN_FAILED, - NET_ERR_TIMEOUT, - NET_ERR_UNKNOWN, - /* Transfer errors */ - NET_ERR_REDIRECT_COUNT_ERR, - NET_ERR_REDIRECT_ERR, - NET_ERR_HTTP_410, - NET_ERR_HTTP_404, - NET_ERR_HTTP_NON_200, - NET_ERR_HTTP_PROTO_ERR, - NET_ERR_AUTH_FAILED, - NET_ERR_AUTH_NO_AUTHINFO, - NET_ERR_AUTH_GEN_AUTH_ERR, - NET_ERR_AUTH_UNSUPPORTED, - NET_ERR_GZIP_ERR -} netio_error_type; - -#endif diff --git a/rss2ctdl/os-support.c b/rss2ctdl/os-support.c deleted file mode 100644 index 808aeb5de..000000000 --- a/rss2ctdl/os-support.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * $Id$ - * - * Copyright 2003-2004 Oliver Feiler - * - * os-support.c - * - * Library support functions. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include -#include -#include -#include -#include - -#include "main.h" - -/****************************************************************************** - * This is a replacement for strsep which is not portable (missing on Solaris). - * - * http://www.winehq.com/hypermail/wine-patches/2001/11/0024.html - * - * The following function was written by François Gouget. - */ -#ifdef SUN -char* strsep(char** str, const char* delims) -{ - char* token; - - if (*str==NULL) { - /* No more tokens */ - return NULL; - } - - token=*str; - while (**str!='\0') { - if (strchr(delims,**str)!=NULL) { - **str='\0'; - (*str)++; - return token; - } - (*str)++; - } - /* There is no other token */ - *str=NULL; - return token; -} -#endif - -/* strcasestr stolen from: http://www.unixpapa.com/incnote/string.html */ -char *s_strcasestr(char *a, char *b) { - size_t l; - char f[3]; - int lena = strlen(a); - int lenb = strlen(b); - - snprintf(f, sizeof(f), "%c%c", tolower(*b), toupper(*b)); - for (l = strcspn(a, f); l != lena; l += strcspn(a + l + 1, f) + 1) - if (strncasecmp(a + l, b, lenb) == 0) - return(a + l); - return(NULL); -} - - -/* Private malloc wrapper. Aborts program execution if malloc fails. */ -void * s_malloc (size_t size) { - void *newmem; - - newmem = malloc (size); - - if (newmem == NULL) { - fprintf(stderr, "Error allocating memory: %s\n", strerror(errno)); - abort(); - } - - return newmem; -} diff --git a/rss2ctdl/os-support.h b/rss2ctdl/os-support.h deleted file mode 100644 index 270583fb9..000000000 --- a/rss2ctdl/os-support.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * $Id$ - * - * Copyright 2003-2004 Oliver Feiler - * - * os-support.h - * - * Library support functions. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef OS_SUPPORT_H -#define OS_SUPPORT_H - -#ifdef SUN -char* strsep(char** str, const char* delims); -#endif - -char *s_strcasestr(char *a, char *b); -void * s_malloc (size_t size); - -#endif diff --git a/rss2ctdl/parsedate.c b/rss2ctdl/parsedate.c deleted file mode 100644 index cb1e3633f..000000000 --- a/rss2ctdl/parsedate.c +++ /dev/null @@ -1,2060 +0,0 @@ -/* A Bison parser, made by GNU Bison 1.875. */ - -/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ - -/* Written by Richard Stallman by simplifying the original so called - ``semantic'' parser. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 0 - -/* Using locations. */ -#define YYLSP_NEEDED 0 - - - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - tDAY = 258, - tDAYZONE = 259, - tMERIDIAN = 260, - tMONTH = 261, - tMONTH_UNIT = 262, - tSEC_UNIT = 263, - tSNUMBER = 264, - tUNUMBER = 265, - tZONE = 266 - }; -#endif -#define tDAY 258 -#define tDAYZONE 259 -#define tMERIDIAN 260 -#define tMONTH 261 -#define tMONTH_UNIT 262 -#define tSEC_UNIT 263 -#define tSNUMBER 264 -#define tUNUMBER 265 -#define tZONE 266 - - - - -/* Copy the first part of user declarations. */ - -/* $Revision$ -** -** Originally written by Steven M. Bellovin while -** at the University of North Carolina at Chapel Hill. Later tweaked by -** a couple of people on Usenet. Completely overhauled by Rich $alz -** and Jim Berets in August, 1990. -** Further revised (removed obsolete constructs and cleaned up timezone -** names) in August, 1991, by Rich. Paul Eggert -** helped in September, 1992. Art Cancro cleaned -** it up for ANSI C in December, 1999. -** -** This grammar has six shift/reduce conflicts. -** -** This code is in the public domain and has no copyright. -*/ -/* SUPPRESS 530 *//* Empty body for statement */ -/* SUPPRESS 593 on yyerrlab *//* Label was not used */ -/* SUPPRESS 593 on yynewstate *//* Label was not used */ -/* SUPPRESS 595 on yypvt *//* Automatic variable may be used before set */ - - - -#include -#include -#include -#include -#include -#include - -#include "parsedate.h" - -int date_lex(void); - -#define yyparse date_parse -#define yylex date_lex -#define yyerror date_error - - - /* See the LeapYears table in Convert. */ -#define EPOCH 1970 -#define END_OF_TIME 2038 - /* Constants for general time calculations. */ -#define DST_OFFSET 1 -#define SECSPERDAY (24L * 60L * 60L) - /* Readability for TABLE stuff. */ -#define HOUR(x) (x * 60) - -#define LPAREN '(' -#define RPAREN ')' -#define IS7BIT(x) ((unsigned int)(x) < 0200) - -#define SIZEOF(array) ((int)(sizeof array / sizeof array[0])) -#define ENDOF(array) (&array[SIZEOF(array)]) - - -/* -** An entry in the lexical lookup table. -*/ -typedef struct _TABLE { - char *name; - int type; - time_t value; -} TABLE; - -/* -** Daylight-savings mode: on, off, or not yet known. -*/ -typedef enum _DSTMODE { - DSTon, DSToff, DSTmaybe -} DSTMODE; - -/* -** Meridian: am, pm, or 24-hour style. -*/ -typedef enum _MERIDIAN { - MERam, MERpm, MER24 -} MERIDIAN; - - -/* -** Global variables. We could get rid of most of them by using a yacc -** union, but this is more efficient. (This routine predates the -** yacc %union construct.) -*/ -static char *yyInput; -static DSTMODE yyDSTmode; -static int yyHaveDate; -static int yyHaveRel; -static int yyHaveTime; -static time_t yyTimezone; -static time_t yyDay; -static time_t yyHour; -static time_t yyMinutes; -static time_t yyMonth; -static time_t yySeconds; -static time_t yyYear; -static MERIDIAN yyMeridian; -static time_t yyRelMonth; -static time_t yyRelSeconds; - - -static void date_error(char *); - - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -typedef union YYSTYPE { - time_t Number; - enum _MERIDIAN Meridian; -} YYSTYPE; -/* Line 191 of yacc.c. */ -#line 230 "y.tab.c" -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 -#endif - - - -/* Copy the second part of user declarations. */ - - -/* Line 214 of yacc.c. */ -#line 242 "y.tab.c" - -#if ! defined (yyoverflow) || YYERROR_VERBOSE - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# if YYSTACK_USE_ALLOCA -# define YYSTACK_ALLOC alloca -# else -# ifndef YYSTACK_USE_ALLOCA -# if defined (alloca) || defined (_ALLOCA_H) -# define YYSTACK_ALLOC alloca -# else -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# else -# if defined (__STDC__) || defined (__cplusplus) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# endif -# define YYSTACK_ALLOC malloc -# define YYSTACK_FREE free -# endif -#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ - - -#if (! defined (yyoverflow) \ - && (! defined (__cplusplus) \ - || (YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - short yyss; - YYSTYPE yyvs; - }; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAXIMUM) - -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - register YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (0) -# endif -# endif - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (0) - -#endif - -#if defined (__STDC__) || defined (__cplusplus) - typedef signed char yysigned_char; -#else - typedef short yysigned_char; -#endif - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 2 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 40 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 15 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 9 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 30 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 44 - -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 266 - -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const unsigned char yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 14, 2, 2, 13, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 12, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11 -}; - -#if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const unsigned char yyprhs[] = -{ - 0, 0, 3, 4, 7, 9, 12, 14, 16, 19, - 24, 29, 36, 43, 45, 47, 50, 52, 54, 58, - 64, 67, 72, 75, 79, 85, 88, 91, 94, 97, - 98 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yysigned_char yyrhs[] = -{ - 16, 0, -1, -1, 16, 17, -1, 18, -1, 18, - 19, -1, 21, -1, 22, -1, 10, 23, -1, 10, - 12, 10, 23, -1, 10, 12, 10, 20, -1, 10, - 12, 10, 12, 10, 23, -1, 10, 12, 10, 12, - 10, 20, -1, 11, -1, 4, -1, 11, 20, -1, - 20, -1, 9, -1, 10, 13, 10, -1, 10, 13, - 10, 13, 10, -1, 6, 10, -1, 6, 10, 14, - 10, -1, 10, 6, -1, 10, 6, 10, -1, 3, - 14, 10, 6, 10, -1, 9, 8, -1, 10, 8, - -1, 9, 7, -1, 10, 7, -1, -1, 5, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const unsigned short yyrline[] = -{ - 0, 143, 143, 144, 147, 156, 160, 163, 168, 180, - 186, 193, 199, 209, 213, 217, 225, 231, 252, 256, - 268, 272, 277, 281, 286, 293, 296, 299, 302, 307, - 310 -}; -#endif - -#if YYDEBUG || YYERROR_VERBOSE -/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - "$end", "error", "$undefined", "tDAY", "tDAYZONE", "tMERIDIAN", "tMONTH", - "tMONTH_UNIT", "tSEC_UNIT", "tSNUMBER", "tUNUMBER", "tZONE", "':'", - "'/'", "','", "$accept", "spec", "item", "time", "zone", "numzone", - "date", "rel", "o_merid", 0 -}; -#endif - -# ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ -static const unsigned short yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 58, 47, 44 -}; -# endif - -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const unsigned char yyr1[] = -{ - 0, 15, 16, 16, 17, 17, 17, 17, 18, 18, - 18, 18, 18, 19, 19, 19, 19, 20, 21, 21, - 21, 21, 21, 21, 21, 22, 22, 22, 22, 23, - 23 -}; - -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const unsigned char yyr2[] = -{ - 0, 2, 0, 2, 1, 2, 1, 1, 2, 4, - 4, 6, 6, 1, 1, 2, 1, 1, 3, 5, - 2, 4, 2, 3, 5, 2, 2, 2, 2, 0, - 1 -}; - -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const unsigned char yydefact[] = -{ - 2, 0, 1, 0, 0, 0, 29, 3, 4, 6, - 7, 0, 20, 27, 25, 30, 22, 28, 26, 0, - 0, 8, 14, 17, 13, 5, 16, 0, 0, 23, - 29, 18, 15, 0, 21, 0, 10, 9, 0, 24, - 29, 19, 12, 11 -}; - -/* YYDEFGOTO[NTERM-NUM]. */ -static const yysigned_char yydefgoto[] = -{ - -1, 1, 7, 8, 25, 26, 9, 10, 21 -}; - -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -29 -static const yysigned_char yypact[] = -{ - -29, 1, -29, -11, 11, 20, 12, -29, 4, -29, - -29, 13, 16, -29, -29, -29, 21, -29, -29, 22, - 23, -29, -29, -29, 5, -29, -29, 28, 25, -29, - 17, 24, -29, 26, -29, 29, -29, -29, 30, -29, - 0, -29, -29, -29 -}; - -/* YYPGOTO[NTERM-NUM]. */ -static const yysigned_char yypgoto[] = -{ - -29, -29, -29, -29, -29, -24, -29, -29, -28 -}; - -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -1 -static const unsigned char yytable[] = -{ - 32, 2, 37, 11, 3, 15, 36, 4, 22, 23, - 5, 6, 43, 23, 23, 24, 42, 15, 16, 17, - 18, 12, 15, 27, 19, 20, 23, 13, 14, 35, - 28, 29, 30, 31, 33, 34, 39, 38, 0, 40, - 41 -}; - -static const yysigned_char yycheck[] = -{ - 24, 0, 30, 14, 3, 5, 30, 6, 4, 9, - 9, 10, 40, 9, 9, 11, 40, 5, 6, 7, - 8, 10, 5, 10, 12, 13, 9, 7, 8, 12, - 14, 10, 10, 10, 6, 10, 10, 13, -1, 10, - 10 -}; - -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const unsigned char yystos[] = -{ - 0, 16, 0, 3, 6, 9, 10, 17, 18, 21, - 22, 14, 10, 7, 8, 5, 6, 7, 8, 12, - 13, 23, 4, 9, 11, 19, 20, 10, 14, 10, - 10, 10, 20, 6, 10, 12, 20, 23, 13, 10, - 10, 10, 20, 23 -}; - -#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) -# define YYSIZE_T __SIZE_TYPE__ -#endif -#if ! defined (YYSIZE_T) && defined (size_t) -# define YYSIZE_T size_t -#endif -#if ! defined (YYSIZE_T) -# if defined (__STDC__) || defined (__cplusplus) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# endif -#endif -#if ! defined (YYSIZE_T) -# define YYSIZE_T unsigned int -#endif - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrlab1 - - -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ - -#define YYFAIL goto yyerrlab - -#define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror ("syntax error: cannot back up");\ - YYERROR; \ - } \ -while (0) - -#define YYTERROR 1 -#define YYERRCODE 256 - -/* YYLLOC_DEFAULT -- Compute the default location (before the actions - are run). */ - -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - Current.first_line = Rhs[1].first_line; \ - Current.first_column = Rhs[1].first_column; \ - Current.last_line = Rhs[N].last_line; \ - Current.last_column = Rhs[N].last_column; -#endif - -/* YYLEX -- calling `yylex' with the right arguments. */ - -#ifdef YYLEX_PARAM -# define YYLEX yylex (YYLEX_PARAM) -#else -# define YYLEX yylex () -#endif - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (0) - -# define YYDSYMPRINT(Args) \ -do { \ - if (yydebug) \ - yysymprint Args; \ -} while (0) - -# define YYDSYMPRINTF(Title, Token, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yysymprint (stderr, \ - Token, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (0) - -/*------------------------------------------------------------------. -| yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (cinluded). | -`------------------------------------------------------------------*/ - -#if defined (__STDC__) || defined (__cplusplus) -static void -yy_stack_print (short *bottom, short *top) -#else -static void -yy_stack_print (bottom, top) - short *bottom; - short *top; -#endif -{ - YYFPRINTF (stderr, "Stack now"); - for (/* Nothing. */; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); - YYFPRINTF (stderr, "\n"); -} - -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (0) - - -/*------------------------------------------------. -| Report that the YYRULE is going to be reduced. | -`------------------------------------------------*/ - -#if defined (__STDC__) || defined (__cplusplus) -static void -yy_reduce_print (int yyrule) -#else -static void -yy_reduce_print (yyrule) - int yyrule; -#endif -{ - int yyi; - unsigned int yylineno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", - yyrule - 1, yylineno); - /* Print the symbols being reduced, and their result. */ - for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) - YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); - YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); -} - -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (Rule); \ -} while (0) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YYDSYMPRINT(Args) -# define YYDSYMPRINTF(Title, Token, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) -#endif /* !YYDEBUG */ - - -/* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH -# define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ - -#if YYMAXDEPTH == 0 -# undef YYMAXDEPTH -#endif - -#ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 -#endif - - - -#if YYERROR_VERBOSE - -# ifndef yystrlen -# if defined (__GLIBC__) && defined (_STRING_H) -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -static YYSIZE_T -# if defined (__STDC__) || defined (__cplusplus) -yystrlen (const char *yystr) -# else -yystrlen (yystr) - const char *yystr; -# endif -{ - register const char *yys = yystr; - - while (*yys++ != '\0') - continue; - - return yys - yystr - 1; -} -# endif -# endif - -# ifndef yystpcpy -# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -static char * -# if defined (__STDC__) || defined (__cplusplus) -yystpcpy (char *yydest, const char *yysrc) -# else -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -# endif -{ - register char *yyd = yydest; - register const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -#endif /* !YYERROR_VERBOSE */ - - - -#if YYDEBUG -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -#if defined (__STDC__) || defined (__cplusplus) -static void -yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) -#else -static void -yysymprint (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE *yyvaluep; -#endif -{ - /* Pacify ``unused variable'' warnings. */ - (void) yyvaluep; - - if (yytype < YYNTOKENS) - { - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); -# ifdef YYPRINT - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif - } - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - - switch (yytype) - { - default: - break; - } - YYFPRINTF (yyoutput, ")"); -} - -#endif /* ! YYDEBUG */ -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -#if defined (__STDC__) || defined (__cplusplus) -static void -yydestruct (int yytype, YYSTYPE *yyvaluep) -#else -static void -yydestruct (yytype, yyvaluep) - int yytype; - YYSTYPE *yyvaluep; -#endif -{ - /* Pacify ``unused variable'' warnings. */ - (void) yyvaluep; - - switch (yytype) - { - - default: - break; - } -} - - -/* Prevent warnings from -Wmissing-prototypes. */ - -#ifdef YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) -int yyparse (void *YYPARSE_PARAM); -# else -int yyparse (); -# endif -#else /* ! YYPARSE_PARAM */ -#if defined (__STDC__) || defined (__cplusplus) -int yyparse (void); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ - - - -/* The lookahead symbol. */ -int yychar; - -/* The semantic value of the lookahead symbol. */ -YYSTYPE yylval; - -/* Number of syntax errors so far. */ -int yynerrs; - - - -/*----------. -| yyparse. | -`----------*/ - -#ifdef YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) -int yyparse (void *YYPARSE_PARAM) -# else -int yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -# endif -#else /* ! YYPARSE_PARAM */ -#if defined (__STDC__) || defined (__cplusplus) -int -yyparse (void) -#else -int -yyparse () - -#endif -#endif -{ - - register int yystate; - register int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Lookahead token as an internal (translated) token number. */ - int yytoken = 0; - - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - short yyssa[YYINITDEPTH]; - short *yyss = yyssa; - register short *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - register YYSTYPE *yyvsp; - - - -#define YYPOPSTACK (yyvsp--, yyssp--) - - YYSIZE_T yystacksize = YYINITDEPTH; - - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - - - /* When reducing, the number of symbols on the RHS of the reduced - rule. */ - int yylen; - - YYDPRINTF ((stderr, "Starting parse\n")); - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - - yyssp = yyss; - yyvsp = yyvs; - - goto yysetstate; - -/*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | -`------------------------------------------------------------*/ - yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. - */ - yyssp++; - - yysetstate: - *yyssp = yystate; - - if (yyss + yystacksize - 1 <= yyssp) - { - /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; - -#ifdef yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; - - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow ("parser stack overflow", - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; - } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyoverflowlab; -# else - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyoverflowlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; - - { - short *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyoverflowlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif -#endif /* no yyoverflow */ - - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - - - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); - - if (yyss + yystacksize - 1 <= yyssp) - YYABORT; - } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - - goto yybackup; - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: - -/* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ -/* yyresume: */ - - /* First try to decide what to do without reference to lookahead token. */ - - yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; - } - - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE (yychar); - YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); - } - - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) - goto yydefault; - yyn = yytable[yyn]; - if (yyn <= 0) - { - if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - - if (yyn == YYFINAL) - YYACCEPT; - - /* Shift the lookahead token. */ - YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); - - /* Discard the token being shifted unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; - - *++yyvsp = yylval; - - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - yystate = yyn; - goto yynewstate; - - -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ -yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - goto yyreduce; - - -/*-----------------------------. -| yyreduce -- Do a reduction. | -`-----------------------------*/ -yyreduce: - /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. - - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; - - - YY_REDUCE_PRINT (yyn); - switch (yyn) - { - case 4: - { - yyHaveTime++; -#ifdef lint - /* I am compulsive about lint natterings... */ - if (yyHaveTime == -1) { - YYERROR; - } -#endif /* lint */ - } - break; - - case 5: - { - yyHaveTime++; - yyTimezone = yyvsp[0].Number; - } - break; - - case 6: - { - yyHaveDate++; - } - break; - - case 7: - { - yyHaveRel = 1; - } - break; - - case 8: - { - if (yyvsp[-1].Number < 100) { - yyHour = yyvsp[-1].Number; - yyMinutes = 0; - } - else { - yyHour = yyvsp[-1].Number / 100; - yyMinutes = yyvsp[-1].Number % 100; - } - yySeconds = 0; - yyMeridian = yyvsp[0].Meridian; - } - break; - - case 9: - { - yyHour = yyvsp[-3].Number; - yyMinutes = yyvsp[-1].Number; - yySeconds = 0; - yyMeridian = yyvsp[0].Meridian; - } - break; - - case 10: - { - yyHour = yyvsp[-3].Number; - yyMinutes = yyvsp[-1].Number; - yyTimezone = yyvsp[0].Number; - yyMeridian = MER24; - yyDSTmode = DSToff; - } - break; - - case 11: - { - yyHour = yyvsp[-5].Number; - yyMinutes = yyvsp[-3].Number; - yySeconds = yyvsp[-1].Number; - yyMeridian = yyvsp[0].Meridian; - } - break; - - case 12: - { - yyHour = yyvsp[-5].Number; - yyMinutes = yyvsp[-3].Number; - yySeconds = yyvsp[-1].Number; - yyTimezone = yyvsp[0].Number; - yyMeridian = MER24; - yyDSTmode = DSToff; - } - break; - - case 13: - { - yyval.Number = yyvsp[0].Number; - yyDSTmode = DSToff; - } - break; - - case 14: - { - yyval.Number = yyvsp[0].Number; - yyDSTmode = DSTon; - } - break; - - case 15: - { - /* Only allow "GMT+300" and "GMT-0800" */ - if (yyvsp[-1].Number != 0) { - YYABORT; - } - yyval.Number = yyvsp[0].Number; - yyDSTmode = DSToff; - } - break; - - case 16: - { - yyval.Number = yyvsp[0].Number; - yyDSTmode = DSToff; - } - break; - - case 17: - { - int i; - - /* Unix and GMT and numeric timezones -- a little confusing. */ - if (yyvsp[0].Number < 0) { - /* Don't work with negative modulus. */ - yyvsp[0].Number = -yyvsp[0].Number; - if (yyvsp[0].Number > 9999 || (i = yyvsp[0].Number % 100) >= 60) { - YYABORT; - } - yyval.Number = (yyvsp[0].Number / 100) * 60 + i; - } - else { - if (yyvsp[0].Number > 9999 || (i = yyvsp[0].Number % 100) >= 60) { - YYABORT; - } - yyval.Number = -((yyvsp[0].Number / 100) * 60 + i); - } - } - break; - - case 18: - { - yyMonth = yyvsp[-2].Number; - yyDay = yyvsp[0].Number; - } - break; - - case 19: - { - if (yyvsp[-4].Number > 100) { - yyYear = yyvsp[-4].Number; - yyMonth = yyvsp[-2].Number; - yyDay = yyvsp[0].Number; - } - else { - yyMonth = yyvsp[-4].Number; - yyDay = yyvsp[-2].Number; - yyYear = yyvsp[0].Number; - } - } - break; - - case 20: - { - yyMonth = yyvsp[-1].Number; - yyDay = yyvsp[0].Number; - } - break; - - case 21: - { - yyMonth = yyvsp[-3].Number; - yyDay = yyvsp[-2].Number; - yyYear = yyvsp[0].Number; - } - break; - - case 22: - { - yyDay = yyvsp[-1].Number; - yyMonth = yyvsp[0].Number; - } - break; - - case 23: - { - yyDay = yyvsp[-2].Number; - yyMonth = yyvsp[-1].Number; - yyYear = yyvsp[0].Number; - } - break; - - case 24: - { - yyDay = yyvsp[-2].Number; - yyMonth = yyvsp[-1].Number; - yyYear = yyvsp[0].Number; - } - break; - - case 25: - { - yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number; - } - break; - - case 26: - { - yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number; - } - break; - - case 27: - { - yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number; - } - break; - - case 28: - { - yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number; - } - break; - - case 29: - { - yyval.Meridian = MER24; - } - break; - - case 30: - { - yyval.Meridian = yyvsp[0].Meridian; - } - break; - - - } - -/* Line 999 of yacc.c. */ -#line 1410 "y.tab.c" - - yyvsp -= yylen; - yyssp -= yylen; - - - YY_STACK_PRINT (yyss, yyssp); - - *++yyvsp = yyval; - - - /* Now `shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; - - goto yynewstate; - - -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ -yyerrlab: - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { - ++yynerrs; -#if YYERROR_VERBOSE - yyn = yypact[yystate]; - - if (YYPACT_NINF < yyn && yyn < YYLAST) - { - YYSIZE_T yysize = 0; - int yytype = YYTRANSLATE (yychar); - char *yymsg; - int yyx, yycount; - - yycount = 0; - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - for (yyx = yyn < 0 ? -yyn : 0; - yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - yysize += yystrlen (yytname[yyx]) + 15, yycount++; - yysize += yystrlen ("syntax error, unexpected ") + 1; - yysize += yystrlen (yytname[yytype]); - yymsg = (char *) YYSTACK_ALLOC (yysize); - if (yymsg != 0) - { - char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); - yyp = yystpcpy (yyp, yytname[yytype]); - - if (yycount < 5) - { - yycount = 0; - for (yyx = yyn < 0 ? -yyn : 0; - yyx < (int) (sizeof (yytname) / sizeof (char *)); - yyx++) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - const char *yyq = ! yycount ? ", expecting " : " or "; - yyp = yystpcpy (yyp, yyq); - yyp = yystpcpy (yyp, yytname[yyx]); - yycount++; - } - } - yyerror (yymsg); - YYSTACK_FREE (yymsg); - } - else - yyerror ("syntax error; also virtual memory exhausted"); - } - else -#endif /* YYERROR_VERBOSE */ - yyerror ("syntax error"); - } - - - - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ - - /* Return failure if at end of input. */ - if (yychar == YYEOF) - { - /* Pop the error token. */ - YYPOPSTACK; - /* Pop the rest of the stack. */ - while (yyss < yyssp) - { - YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); - yydestruct (yystos[*yyssp], yyvsp); - YYPOPSTACK; - } - YYABORT; - } - - YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); - yydestruct (yytoken, &yylval); - yychar = YYEMPTY; - - } - - /* Else will try to reuse lookahead token after shifting the error - token. */ - goto yyerrlab1; - - -/*----------------------------------------------------. -| yyerrlab1 -- error raised explicitly by an action. | -`----------------------------------------------------*/ -yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) - { - yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } - - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; - - YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); - yydestruct (yystos[yystate], yyvsp); - yyvsp--; - yystate = *--yyssp; - - YY_STACK_PRINT (yyss, yyssp); - } - - if (yyn == YYFINAL) - YYACCEPT; - - YYDPRINTF ((stderr, "Shifting error token, ")); - - *++yyvsp = yylval; - - - yystate = yyn; - goto yynewstate; - - -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - -#ifndef yyoverflow -/*----------------------------------------------. -| yyoverflowlab -- parser overflow comes here. | -`----------------------------------------------*/ -yyoverflowlab: - yyerror ("parser stack overflow"); - yyresult = 2; - /* Fall through. */ -#endif - -yyreturn: -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); -#endif - return yyresult; -} - - - - -/* Month and day table. */ -static TABLE MonthDayTable[] = { - { "january", tMONTH, 1 }, - { "february", tMONTH, 2 }, - { "march", tMONTH, 3 }, - { "april", tMONTH, 4 }, - { "may", tMONTH, 5 }, - { "june", tMONTH, 6 }, - { "july", tMONTH, 7 }, - { "august", tMONTH, 8 }, - { "september", tMONTH, 9 }, - { "october", tMONTH, 10 }, - { "november", tMONTH, 11 }, - { "december", tMONTH, 12 }, - /* The value of the day isn't used... */ - { "sunday", tDAY, 0 }, - { "monday", tDAY, 0 }, - { "tuesday", tDAY, 0 }, - { "wednesday", tDAY, 0 }, - { "thursday", tDAY, 0 }, - { "friday", tDAY, 0 }, - { "saturday", tDAY, 0 }, -}; - -/* Time units table. */ -static TABLE UnitsTable[] = { - { "year", tMONTH_UNIT, 12 }, - { "month", tMONTH_UNIT, 1 }, - { "week", tSEC_UNIT, 7L * 24 * 60 * 60 }, - { "day", tSEC_UNIT, 1L * 24 * 60 * 60 }, - { "hour", tSEC_UNIT, 60 * 60 }, - { "minute", tSEC_UNIT, 60 }, - { "min", tSEC_UNIT, 60 }, - { "second", tSEC_UNIT, 1 }, - { "sec", tSEC_UNIT, 1 }, -}; - -/* Timezone table. */ -static TABLE TimezoneTable[] = { - { "gmt", tZONE, HOUR( 0) }, /* Greenwich Mean */ - { "ut", tZONE, HOUR( 0) }, /* Universal */ - { "utc", tZONE, HOUR( 0) }, /* Universal Coordinated */ - { "cut", tZONE, HOUR( 0) }, /* Coordinated Universal */ - { "z", tZONE, HOUR( 0) }, /* Greenwich Mean */ - { "wet", tZONE, HOUR( 0) }, /* Western European */ - { "bst", tDAYZONE, HOUR( 0) }, /* British Summer */ - { "nst", tZONE, HOUR(3)+30 }, /* Newfoundland Standard */ - { "ndt", tDAYZONE, HOUR(3)+30 }, /* Newfoundland Daylight */ - { "ast", tZONE, HOUR( 4) }, /* Atlantic Standard */ - { "adt", tDAYZONE, HOUR( 4) }, /* Atlantic Daylight */ - { "est", tZONE, HOUR( 5) }, /* Eastern Standard */ - { "edt", tDAYZONE, HOUR( 5) }, /* Eastern Daylight */ - { "cst", tZONE, HOUR( 6) }, /* Central Standard */ - { "cdt", tDAYZONE, HOUR( 6) }, /* Central Daylight */ - { "mst", tZONE, HOUR( 7) }, /* Mountain Standard */ - { "mdt", tDAYZONE, HOUR( 7) }, /* Mountain Daylight */ - { "pst", tZONE, HOUR( 8) }, /* Pacific Standard */ - { "pdt", tDAYZONE, HOUR( 8) }, /* Pacific Daylight */ - { "yst", tZONE, HOUR( 9) }, /* Yukon Standard */ - { "ydt", tDAYZONE, HOUR( 9) }, /* Yukon Daylight */ - { "akst", tZONE, HOUR( 9) }, /* Alaska Standard */ - { "akdt", tDAYZONE, HOUR( 9) }, /* Alaska Daylight */ - { "hst", tZONE, HOUR(10) }, /* Hawaii Standard */ - { "hast", tZONE, HOUR(10) }, /* Hawaii-Aleutian Standard */ - { "hadt", tDAYZONE, HOUR(10) }, /* Hawaii-Aleutian Daylight */ - { "ces", tDAYZONE, -HOUR(1) }, /* Central European Summer */ - { "cest", tDAYZONE, -HOUR(1) }, /* Central European Summer */ - { "mez", tZONE, -HOUR(1) }, /* Middle European */ - { "mezt", tDAYZONE, -HOUR(1) }, /* Middle European Summer */ - { "cet", tZONE, -HOUR(1) }, /* Central European */ - { "met", tZONE, -HOUR(1) }, /* Middle European */ - { "eet", tZONE, -HOUR(2) }, /* Eastern Europe */ - { "msk", tZONE, -HOUR(3) }, /* Moscow Winter */ - { "msd", tDAYZONE, -HOUR(3) }, /* Moscow Summer */ - { "wast", tZONE, -HOUR(8) }, /* West Australian Standard */ - { "wadt", tDAYZONE, -HOUR(8) }, /* West Australian Daylight */ - { "hkt", tZONE, -HOUR(8) }, /* Hong Kong */ - { "cct", tZONE, -HOUR(8) }, /* China Coast */ - { "jst", tZONE, -HOUR(9) }, /* Japan Standard */ - { "kst", tZONE, -HOUR(9) }, /* Korean Standard */ - { "kdt", tZONE, -HOUR(9) }, /* Korean Daylight */ - { "cast", tZONE, -(HOUR(9)+30) }, /* Central Australian Standard */ - { "cadt", tDAYZONE, -(HOUR(9)+30) }, /* Central Australian Daylight */ - { "east", tZONE, -HOUR(10) }, /* Eastern Australian Standard */ - { "eadt", tDAYZONE, -HOUR(10) }, /* Eastern Australian Daylight */ - { "nzst", tZONE, -HOUR(12) }, /* New Zealand Standard */ - { "nzdt", tDAYZONE, -HOUR(12) }, /* New Zealand Daylight */ - - /* For completeness we include the following entries. */ -#if 0 - - /* Duplicate names. Either they conflict with a zone listed above - * (which is either more likely to be seen or just been in circulation - * longer), or they conflict with another zone in this section and - * we could not reasonably choose one over the other. */ - { "fst", tZONE, HOUR( 2) }, /* Fernando De Noronha Standard */ - { "fdt", tDAYZONE, HOUR( 2) }, /* Fernando De Noronha Daylight */ - { "bst", tZONE, HOUR( 3) }, /* Brazil Standard */ - { "est", tZONE, HOUR( 3) }, /* Eastern Standard (Brazil) */ - { "edt", tDAYZONE, HOUR( 3) }, /* Eastern Daylight (Brazil) */ - { "wst", tZONE, HOUR( 4) }, /* Western Standard (Brazil) */ - { "wdt", tDAYZONE, HOUR( 4) }, /* Western Daylight (Brazil) */ - { "cst", tZONE, HOUR( 5) }, /* Chile Standard */ - { "cdt", tDAYZONE, HOUR( 5) }, /* Chile Daylight */ - { "ast", tZONE, HOUR( 5) }, /* Acre Standard */ - { "adt", tDAYZONE, HOUR( 5) }, /* Acre Daylight */ - { "cst", tZONE, HOUR( 5) }, /* Cuba Standard */ - { "cdt", tDAYZONE, HOUR( 5) }, /* Cuba Daylight */ - { "est", tZONE, HOUR( 6) }, /* Easter Island Standard */ - { "edt", tDAYZONE, HOUR( 6) }, /* Easter Island Daylight */ - { "sst", tZONE, HOUR(11) }, /* Samoa Standard */ - { "ist", tZONE, -HOUR(2) }, /* Israel Standard */ - { "idt", tDAYZONE, -HOUR(2) }, /* Israel Daylight */ - { "idt", tDAYZONE, -(HOUR(3)+30) }, /* Iran Daylight */ - { "ist", tZONE, -(HOUR(3)+30) }, /* Iran Standard */ - { "cst", tZONE, -HOUR(8) }, /* China Standard */ - { "cdt", tDAYZONE, -HOUR(8) }, /* China Daylight */ - { "sst", tZONE, -HOUR(8) }, /* Singapore Standard */ - - /* Dubious (e.g., not in Olson's TIMEZONE package) or obsolete. */ - { "gst", tZONE, HOUR( 3) }, /* Greenland Standard */ - { "wat", tZONE, -HOUR(1) }, /* West Africa */ - { "at", tZONE, HOUR( 2) }, /* Azores */ - { "gst", tZONE, -HOUR(10) }, /* Guam Standard */ - { "nft", tZONE, HOUR(3)+30 }, /* Newfoundland */ - { "idlw", tZONE, HOUR(12) }, /* International Date Line West */ - { "mewt", tZONE, -HOUR(1) }, /* Middle European Winter */ - { "mest", tDAYZONE, -HOUR(1) }, /* Middle European Summer */ - { "swt", tZONE, -HOUR(1) }, /* Swedish Winter */ - { "sst", tDAYZONE, -HOUR(1) }, /* Swedish Summer */ - { "fwt", tZONE, -HOUR(1) }, /* French Winter */ - { "fst", tDAYZONE, -HOUR(1) }, /* French Summer */ - { "bt", tZONE, -HOUR(3) }, /* Baghdad */ - { "it", tZONE, -(HOUR(3)+30) }, /* Iran */ - { "zp4", tZONE, -HOUR(4) }, /* USSR Zone 3 */ - { "zp5", tZONE, -HOUR(5) }, /* USSR Zone 4 */ - { "ist", tZONE, -(HOUR(5)+30) }, /* Indian Standard */ - { "zp6", tZONE, -HOUR(6) }, /* USSR Zone 5 */ - { "nst", tZONE, -HOUR(7) }, /* North Sumatra */ - { "sst", tZONE, -HOUR(7) }, /* South Sumatra */ - { "jt", tZONE, -(HOUR(7)+30) }, /* Java (3pm in Cronusland!) */ - { "nzt", tZONE, -HOUR(12) }, /* New Zealand */ - { "idle", tZONE, -HOUR(12) }, /* International Date Line East */ - { "cat", tZONE, HOUR(10) }, /* -- expired 1967 */ - { "nt", tZONE, HOUR(11) }, /* -- expired 1967 */ - { "ahst", tZONE, HOUR(10) }, /* -- expired 1983 */ - { "hdt", tDAYZONE, HOUR(10) }, /* -- expired 1986 */ -#endif /* 0 */ -}; - - -/* ARGSUSED */ -static void -date_error(char *s) -{ - /* NOTREACHED */ -} - - -static time_t -ToSeconds(time_t Hours, time_t Minutes, time_t Seconds, MERIDIAN Meridian) -{ - if (Minutes < 0 || Minutes > 59 || Seconds < 0 || Seconds > 61) - return -1; - if (Meridian == MER24) { - if (Hours < 0 || Hours > 23) - return -1; - } - else { - if (Hours < 1 || Hours > 12) - return -1; - if (Hours == 12) - Hours = 0; - if (Meridian == MERpm) - Hours += 12; - } - return (Hours * 60L + Minutes) * 60L + Seconds; -} - - -static time_t -Convert(time_t Month, time_t Day, time_t Year, - time_t Hours, time_t Minutes, time_t Seconds, - MERIDIAN Meridian, DSTMODE dst) -{ - static int DaysNormal[13] = { - 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 - }; - static int DaysLeap[13] = { - 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 - }; - static int LeapYears[] = { - 1972, 1976, 1980, 1984, 1988, 1992, 1996, - 2000, 2004, 2008, 2012, 2016, 2020, 2024, 2028, 2032, 2036 - }; - register int *yp; - register int *mp; - register time_t Julian; - register int i; - time_t tod; - - if (Year < 0) - Year = -Year; - if (Year < 100) - Year += 1900; - if (Year < EPOCH) - Year += 100; - for (mp = DaysNormal, yp = LeapYears; yp < ENDOF(LeapYears); yp++) - if (Year == *yp) { - mp = DaysLeap; - break; - } - if (Year < EPOCH || Year > END_OF_TIME - || Month < 1 || Month > 12 - /* NOSTRICT *//* conversion from long may lose accuracy */ - || Day < 1 || Day > mp[(int)Month]) - return -1; - - Julian = Day - 1 + (Year - EPOCH) * 365; - for (yp = LeapYears; yp < ENDOF(LeapYears); yp++, Julian++) - if (Year <= *yp) - break; - for (i = 1; i < Month; i++) - Julian += *++mp; - Julian *= SECSPERDAY; - Julian += yyTimezone * 60L; - if ((tod = ToSeconds(Hours, Minutes, Seconds, Meridian)) < 0) - return -1; - Julian += tod; - tod = Julian; - if (dst == DSTon || (dst == DSTmaybe && localtime(&tod)->tm_isdst)) - Julian -= DST_OFFSET * 60L * 60L; - return Julian; -} - - -static time_t -DSTcorrect(time_t Start, time_t Future) -{ - time_t StartDay; - time_t FutureDay; - - StartDay = (localtime(&Start)->tm_hour + 1) % 24; - FutureDay = (localtime(&Future)->tm_hour + 1) % 24; - return (Future - Start) + (StartDay - FutureDay) * DST_OFFSET * 60L * 60L; -} - - -static time_t -RelativeMonth(time_t Start, time_t RelMonth) -{ - struct tm *tm; - time_t Month; - time_t Year; - - tm = localtime(&Start); - Month = 12 * tm->tm_year + tm->tm_mon + RelMonth; - Year = Month / 12; - Month = Month % 12 + 1; - return DSTcorrect(Start, - Convert(Month, (time_t)tm->tm_mday, Year, - (time_t)tm->tm_hour, (time_t)tm->tm_min, (time_t)tm->tm_sec, - MER24, DSTmaybe)); -} - - -static int -LookupWord(char *buff, register int length) -{ - register char *p; - register char *q; - register TABLE *tp; - register int c; - - p = buff; - c = p[0]; - - /* See if we have an abbreviation for a month. */ - if (length == 3 || (length == 4 && p[3] == '.')) - for (tp = MonthDayTable; tp < ENDOF(MonthDayTable); tp++) { - q = tp->name; - if (c == q[0] && p[1] == q[1] && p[2] == q[2]) { - yylval.Number = tp->value; - return tp->type; - } - } - else - for (tp = MonthDayTable; tp < ENDOF(MonthDayTable); tp++) - if (c == tp->name[0] && strcmp(p, tp->name) == 0) { - yylval.Number = tp->value; - return tp->type; - } - - /* Try for a timezone. */ - for (tp = TimezoneTable; tp < ENDOF(TimezoneTable); tp++) - if (c == tp->name[0] && p[1] == tp->name[1] - && strcmp(p, tp->name) == 0) { - yylval.Number = tp->value; - return tp->type; - } - - /* Try the units table. */ - for (tp = UnitsTable; tp < ENDOF(UnitsTable); tp++) - if (c == tp->name[0] && strcmp(p, tp->name) == 0) { - yylval.Number = tp->value; - return tp->type; - } - - /* Strip off any plural and try the units table again. */ - if (--length > 0 && p[length] == 's') { - p[length] = '\0'; - for (tp = UnitsTable; tp < ENDOF(UnitsTable); tp++) - if (c == tp->name[0] && strcmp(p, tp->name) == 0) { - p[length] = 's'; - yylval.Number = tp->value; - return tp->type; - } - p[length] = 's'; - } - length++; - - /* Drop out any periods. */ - for (p = buff, q = (char*)buff; *q; q++) - if (*q != '.') - *p++ = *q; - *p = '\0'; - - /* Try the meridians. */ - if (buff[1] == 'm' && buff[2] == '\0') { - if (buff[0] == 'a') { - yylval.Meridian = MERam; - return tMERIDIAN; - } - if (buff[0] == 'p') { - yylval.Meridian = MERpm; - return tMERIDIAN; - } - } - - /* If we saw any periods, try the timezones again. */ - if (p - buff != length) { - c = buff[0]; - for (p = buff, tp = TimezoneTable; tp < ENDOF(TimezoneTable); tp++) - if (c == tp->name[0] && p[1] == tp->name[1] - && strcmp(p, tp->name) == 0) { - yylval.Number = tp->value; - return tp->type; - } - } - - /* Unknown word -- assume GMT timezone. */ - yylval.Number = 0; - return tZONE; -} - - -int -date_lex(void) -{ - register char c; - register char *p; - char buff[20]; - register int sign; - register int i; - register int nesting; - - for ( ; ; ) { - /* Get first character after the whitespace. */ - for ( ; ; ) { - while (isspace(*yyInput)) - yyInput++; - c = *yyInput; - - /* Ignore RFC 822 comments, typically time zone names. */ - if (c != LPAREN) - break; - for (nesting = 1; (c = *++yyInput) != RPAREN || --nesting; ) - if (c == LPAREN) - nesting++; - else if (!IS7BIT(c) || c == '\0' || c == '\r' - || (c == '\\' && ((c = *++yyInput) == '\0' || !IS7BIT(c)))) - /* Lexical error: bad comment. */ - return '?'; - yyInput++; - } - - /* A number? */ - if (isdigit(c) || c == '-' || c == '+') { - if (c == '-' || c == '+') { - sign = c == '-' ? -1 : 1; - yyInput++; - if (!isdigit(*yyInput)) - /* Skip the plus or minus sign. */ - continue; - } - else - sign = 0; - for (i = 0; (c = *yyInput++) != '\0' && isdigit(c); ) - i = 10 * i + c - '0'; - yyInput--; - yylval.Number = sign < 0 ? -i : i; - return sign ? tSNUMBER : tUNUMBER; - } - - /* A word? */ - if (isalpha(c)) { - for (p = buff; (c = *yyInput++) == '.' || isalpha(c); ) - if (p < &buff[sizeof buff - 1]) - *p++ = isupper(c) ? tolower(c) : c; - *p = '\0'; - yyInput--; - return LookupWord(buff, p - buff); - } - - return *yyInput++; - } -} - - -time_t -parsedate(char *p) -{ - extern int date_parse(void); - time_t Start; - - yyInput = p; - - yyYear = 0; - yyMonth = 0; - yyDay = 0; - yyTimezone = 0; - yyDSTmode = DSTmaybe; - yyHour = 0; - yyMinutes = 0; - yySeconds = 0; - yyMeridian = MER24; - yyRelSeconds = 0; - yyRelMonth = 0; - yyHaveDate = 0; - yyHaveRel = 0; - yyHaveTime = 0; - - if (date_parse() || yyHaveTime > 1 || yyHaveDate > 1) - return -1; - - if (yyHaveDate || yyHaveTime) { - Start = Convert(yyMonth, yyDay, yyYear, yyHour, yyMinutes, yySeconds, - yyMeridian, yyDSTmode); - if (Start < 0) - return -1; - } - else - return -1; - - Start += yyRelSeconds; - if (yyRelMonth) - Start += RelativeMonth(Start, yyRelMonth); - - /* Have to do *something* with a legitimate -1 so it's distinguishable - * from the error return value. (Alternately could set errno on error.) */ - return Start == -1 ? 0 : Start; -} - - -#ifdef TEST - -#if YYDEBUG -extern int yydebug; -#endif /* YYDEBUG */ - -/* ARGSUSED */ -int -main(int ac, char *av[]) -{ - char buff[128]; - time_t d; - -#if YYDEBUG - yydebug = 1; -#endif /* YYDEBUG */ - - (void)printf("Enter date, or blank line to exit.\n\t> "); - for ( ; ; ) { - (void)printf("\t> "); - (void)fflush(stdout); - if (fgets(buff, sizeof buff, stdin) == NULL || buff[0] == '\n') - break; -#if YYDEBUG - if (strcmp(buff, "yydebug") == 0) { - yydebug = !yydebug; - printf("yydebug = %s\n", yydebug ? "on" : "off"); - continue; - } -#endif /* YYDEBUG */ - d = parsedate(buff, (TIMEINFO *)NULL); - if (d == -1) - (void)printf("Bad format - couldn't convert.\n"); - else - (void)printf("%s", ctime(&d)); - } - - exit(0); - /* NOTREACHED */ -} -#endif /* TEST */ - - diff --git a/rss2ctdl/parsedate.h b/rss2ctdl/parsedate.h deleted file mode 100644 index b28dae0eb..000000000 --- a/rss2ctdl/parsedate.h +++ /dev/null @@ -1,6 +0,0 @@ -/* - * $Id$ - * - */ - -time_t parsedate(char *); diff --git a/rss2ctdl/rdf_parsedate.c b/rss2ctdl/rdf_parsedate.c deleted file mode 100644 index 6e794c335..000000000 --- a/rss2ctdl/rdf_parsedate.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * $id: $ - * - * Convert RDF style datestamps (2005-09-17T06:18:00+00:00) into time_t - * - */ - -#include -#include -#include -#include -#include -#include - -#include "rdf_parsedate.h" - - - -time_t rdf_parsedate(char *p) -{ - struct tm tm; - - if (!p) return 0L; - if (strlen(p) < 10) return 0L; - - memset(&tm, 0, sizeof tm); - - /* We only extract the date. Time is not needed - * because we don't need that much granularity. - */ - tm.tm_year = atoi(&p[0]) - 1900; - tm.tm_mon = atoi(&p[5]); - tm.tm_mday = atoi(&p[8]); - - return mktime(&tm); -} diff --git a/rss2ctdl/rdf_parsedate.h b/rss2ctdl/rdf_parsedate.h deleted file mode 100644 index 71906e2f1..000000000 --- a/rss2ctdl/rdf_parsedate.h +++ /dev/null @@ -1,6 +0,0 @@ -/* - * $Id$ - * - */ - -time_t rdf_parsedate(char *); diff --git a/rss2ctdl/rssfeeds b/rss2ctdl/rssfeeds deleted file mode 100644 index 38f313272..000000000 --- a/rss2ctdl/rssfeeds +++ /dev/null @@ -1,4 +0,0 @@ -# syntax: remoteurl;citadel roomname;domainname for dns -# feed per line. -# rooms must exist and be writable -#http://slashdot.org/index.rss;Slashdot;slashdot.org diff --git a/rss2ctdl/setup.h b/rss2ctdl/setup.h deleted file mode 100644 index 40b7d92ef..000000000 --- a/rss2ctdl/setup.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * $Id$ - * - * Copyright 2003-2004 Oliver Feiler - * - * setup.h - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef SETUP_H -#define SETUP_H - -int Config (void); - -struct entity { - char * entity; - char * converted_entity; - int entity_length; - struct entity * next_ptr; -}; - -#endif diff --git a/rss2ctdl/xmlparse.c b/rss2ctdl/xmlparse.c deleted file mode 100644 index e4fad3b02..000000000 --- a/rss2ctdl/xmlparse.c +++ /dev/null @@ -1,420 +0,0 @@ -/* - * $Id$ - * - * Copyright 2003-2004 Rene Puls and - * Oliver Feiler - * - * http://kiza.kcore.de/software/snownews/ - * http://home.kcore.de/~kianga/study/c/xmlparse.c - * - * xmlparse.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - - -#include - -#include "config.h" -#include "xmlparse.h" -#include "conversions.h" - -#include "parsedate.h" -#include "rdf_parsedate.h" - -int saverestore; -struct newsitem *copy; -struct newsitem *firstcopy; - -/* During the parsens one calls, if we meet a element. - * The function returns a new Struct for the new feed. */ - -void parse_rdf10_channel(struct feed *feed, xmlDocPtr doc, xmlNodePtr node) { - xmlNodePtr cur; - - /* Free everything before we write to it again. */ - free (feed->title); - free (feed->link); - - if (feed->items != NULL) { - while (feed->items->next_ptr != NULL) { - feed->items = feed->items->next_ptr; - free (feed->items->prev_ptr->data->title); - free (feed->items->prev_ptr->data->link); - free (feed->items->prev_ptr->data->guid); - free (feed->items->prev_ptr->data->description); - free (feed->items->prev_ptr->data); - free (feed->items->prev_ptr); - } - free (feed->items->data->title); - free (feed->items->data->link); - free (feed->items->data->guid); - free (feed->items->data->description); - free (feed->items->data); - free (feed->items); - } - - /* At the moment we have still no Items, so set the list to null. */ - feed->items = NULL; - feed->title = NULL; - feed->link= NULL; - feed->description = NULL; - - /* Go through all tags and extract the information */ - for (cur = node; cur != NULL; cur = cur->next) { - if (cur->type != XML_ELEMENT_NODE) - continue; - if (xmlStrcmp(cur->name, "title") == 0) { - feed->title = xmlNodeListGetString(doc, cur->children, 1); - CleanupString (feed->title, 1); - /* Remove trailing newline */ - if (feed->title != NULL) { - if (strlen(feed->title) > 1) { - if (feed->title[strlen(feed->title)-1] == '\n') - feed->title[strlen(feed->title)-1] = '\0'; - } - } - } - else if (xmlStrcmp(cur->name, "link") == 0) { - feed->link = xmlNodeListGetString(doc, cur->children, 1); - /* Remove trailing newline */ - if (feed->link != NULL) { - if (strlen(feed->link) > 1) { - if (feed->link[strlen(feed->link)-1] == '\n') - feed->link[strlen(feed->link)-1] = '\0'; - } - } - } - else if (xmlStrcmp(cur->name, "description") == 0) { - feed->description = xmlNodeListGetString(doc, cur->children, 1); - CleanupString (feed->description, 0); - } - } -} - - -void parse_rdf20_channel(struct feed *feed, xmlDocPtr doc, xmlNodePtr node) -{ - xmlNodePtr cur; - - /* Free everything before we write to it again. */ - free (feed->title); - free (feed->link); - free (feed->description); - - if (feed->items != NULL) { - while (feed->items->next_ptr != NULL) { - feed->items = feed->items->next_ptr; - free (feed->items->prev_ptr->data->title); - free (feed->items->prev_ptr->data->link); - free (feed->items->prev_ptr->data->guid); - free (feed->items->prev_ptr->data->description); - free (feed->items->prev_ptr->data); - free (feed->items->prev_ptr); - } - free (feed->items->data->title); - free (feed->items->data->link); - free (feed->items->data->guid); - free (feed->items->data->description); - free (feed->items->data); - free (feed->items); - } - - /* At the moment we have still no Items, so set the list to NULL. */ - feed->items = NULL; - feed->title = NULL; - feed->link = NULL; - feed->description = NULL; - - /* Go through all tags in and extract the information. */ - for (cur = node; cur != NULL; cur = cur->next) { - if (cur->type != XML_ELEMENT_NODE) - continue; - if (xmlStrcmp(cur->name, "title") == 0) { - feed->title = xmlNodeListGetString(doc, cur->children, 1); - CleanupString (feed->title, 1); - /* Remove trailing newline */ - if (feed->title != NULL) { - if (strlen(feed->title) > 1) { - if (feed->title[strlen(feed->title)-1] == '\n') - feed->title[strlen(feed->title)-1] = '\0'; - } - } - } - else if (xmlStrcmp(cur->name, "link") == 0) { - feed->link = xmlNodeListGetString(doc, cur->children, 1); - /* Remove trailing newline */ - if (feed->link != NULL) { - if (strlen(feed->link) > 1) { - if (feed->link[strlen(feed->link)-1] == '\n') - feed->link[strlen(feed->link)-1] = '\0'; - } - } - } - else if (xmlStrcmp(cur->name, "description") == 0) { - feed->description = xmlNodeListGetString(doc, cur->children, 1); - CleanupString (feed->description, 0); - } else if (xmlStrcmp(cur->name, "item") == 0) { - parse_rdf10_item(feed, doc, cur->children); - } - } -} - -/* This function is called each mark, if we meet on. As parameter it needs the - * current new feed (new feed struct *), as well as the current XML - * document-acts and the current element, both comes directly of libxml. - */ - -void parse_rdf10_item(struct feed *feed, xmlDocPtr doc, xmlNodePtr node) -{ - xmlNodePtr cur; - xmlChar *readstatusstring; - - struct newsitem *item; - struct newsitem *current; - - /* Speicher für ein neues Newsitem reservieren */ - item = malloc(sizeof (struct newsitem)); - item->data = malloc (sizeof (struct newsdata)); - - item->data->title = NULL; - item->data->link = NULL; - item->data->guid = NULL; - item->data->description = NULL; - item->data->date = 0L; - item->data->readstatus = 0; - item->data->parent = feed; - - /* Alle Tags im Tag durchgehen und die Informationen extrahieren. - Selbe Vorgehensweise wie in der parse_channel() Funktion */ - for (cur = node; cur != NULL; cur = cur->next) { - if (cur->type != XML_ELEMENT_NODE) - continue; - if (xmlStrcmp(cur->name, "title") == 0) { - item->data->title = xmlNodeListGetString(doc, cur->children, 1); - CleanupString (item->data->title, 1); - /* Remove trailing newline */ - if (item->data->title != NULL) { - if (strlen(item->data->title) > 1) { - if (item->data->title[strlen(item->data->title)-1] == '\n') - item->data->title[strlen(item->data->title)-1] = '\0'; - } - } - } - else if (xmlStrcmp(cur->name, "link") == 0) { - item->data->link = xmlNodeListGetString(doc, cur->children, 1); - if (item->data->link == NULL) { - if (xmlStrcmp(cur->name, "guid") == 0) - item->data->link = xmlNodeListGetString(doc, cur->children, 1); - } - /* Remove trailing newline */ - if (item->data->link != NULL) { - if (strlen(item->data->link) > 1) { - if (item->data->link[strlen(item->data->link)-1] == '\n') - item->data->link[strlen(item->data->link)-1] = '\0'; - } - } - } - else if (xmlStrcmp(cur->name, "guid") == 0) { - item->data->guid = xmlNodeListGetString(doc, cur->children, 1); - if (item->data->guid == NULL) { - if (xmlStrcmp(cur->name, "guid") == 0) - item->data->guid = xmlNodeListGetString(doc, cur->children, 1); - } - /* Remove trailing newline */ - if (item->data->guid != NULL) { - if (strlen(item->data->guid) > 1) { - if (item->data->guid[strlen(item->data->guid)-1] == '\n') - item->data->guid[strlen(item->data->guid)-1] = '\0'; - } - } - } - else if (xmlStrcmp(cur->name, "description") == 0) { - item->data->description = xmlNodeListGetString(doc, cur->children, 1); - CleanupString (item->data->description, 0); - } - /* pubDate will be in the form of: Thu, 15 Sep 2005 14:32:44 +0000 */ - else if (xmlStrcmp(cur->name, "pubDate") == 0) { - item->data->date = parsedate(xmlNodeListGetString(doc, cur->children, 1)); - } - /* RSS style date will be in the form of: 2005-09-17T06:18:00+00:00 - * Only use it if no pubDate was already found. - */ - else if (xmlStrcmp(cur->name, "date") == 0) { - if (item->data->date <= 0L) { - item->data->date = rdf_parsedate(xmlNodeListGetString(doc, cur->children, 1)); - } - } - else if (xmlStrcmp(cur->name, "readstatus") == 0) { - /* Will cause memory leak otherwise, xmlNodeListGetString must be freed. */ - readstatusstring = xmlNodeListGetString(doc, cur->children, 1); - item->data->readstatus = atoi (readstatusstring); - xmlFree (readstatusstring); - } - } - - /* If saverestore == 1, restore readstatus. */ - if (saverestore == 1) { - for (current = firstcopy; current != NULL; current = current->next_ptr) { - if ((current->data->link != NULL) && (item->data->link != NULL)) { - if ((current->data->title != NULL) && (item->data->title != NULL)) { - if ((strcmp(item->data->link, current->data->link) == 0) && - (strcmp(item->data->title, current->data->title) == 0)) - item->data->readstatus = current->data->readstatus; - } else { - if (strcmp(item->data->link, current->data->link) == 0) - item->data->readstatus = current->data->readstatus; - } - } - } - } - - item->next_ptr = NULL; - if (feed->items == NULL) { - item->prev_ptr = NULL; - feed->items = item; - } else { - item->prev_ptr = feed->items; - while (item->prev_ptr->next_ptr != NULL) - item->prev_ptr = item->prev_ptr->next_ptr; - item->prev_ptr->next_ptr = item; - } -} - - -/* rrr */ - -int DeXML (struct feed *cur_ptr) { - xmlDocPtr doc; - xmlNodePtr cur; - struct newsitem *cur_item; - - if (cur_ptr->feed == NULL) - return -1; - - saverestore = 0; - /* Wenn cur_ptr->items != NULL dann können wir uns item->readstatus - zwischenspeichern. */ - if (cur_ptr->items != NULL) { - saverestore = 1; - - firstcopy = NULL; - - /* Copy current newsitem struct. */ - for (cur_item = cur_ptr->items; cur_item != NULL; cur_item = cur_item->next_ptr) { - copy = malloc (sizeof(struct newsitem)); - copy->data = malloc (sizeof (struct newsdata)); - copy->data->title = NULL; - copy->data->link = NULL; - copy->data->guid = NULL; - copy->data->description = NULL; - copy->data->date = 0L; - copy->data->readstatus = cur_item->data->readstatus; - if (cur_item->data->link != NULL) - copy->data->link = strdup (cur_item->data->link); - if (cur_item->data->title != NULL) - copy->data->title = strdup (cur_item->data->title); - - copy->next_ptr = NULL; - if (firstcopy == NULL) { - copy->prev_ptr = NULL; - firstcopy = copy; - } else { - copy->prev_ptr = firstcopy; - while (copy->prev_ptr->next_ptr != NULL) - copy->prev_ptr = copy->prev_ptr->next_ptr; - copy->prev_ptr->next_ptr = copy; - } - } - } - - /* xmlRecoverMemory: - parse an XML in-memory document and build a tree. - In case the document is not Well Formed, a tree is built anyway. */ - doc = xmlRecoverMemory(cur_ptr->feed, strlen(cur_ptr->feed)); - - if (doc == NULL) - return 2; - - /* Das Root-Element finden (in unserem Fall sollte es "" heißen. - Dabei wird das RDF: Prefix fürs Erste ignoriert, bis der Jaguar - herausfindet, wie man das genau auslesen kann (jau). */ - cur = xmlDocGetRootElement(doc); - - if (cur == NULL) { - xmlFreeDoc (doc); - return 2; - } - - /* Überprüfen, ob das Element auch wirklich heißt */ - if (xmlStrcmp(cur->name, "RDF") == 0) { - - /* Jetzt gehen wir alle Elemente im Dokument durch. Diese Schleife - selbst läuft jedoch nur durch die Elemente auf höchster Ebene - (bei HTML wären das nur HEAD und BODY), wandert also nicht die - gesamte Struktur nach unten durch. Dafür sind die Funktionen zuständig, - die wir dann in der Schleife selbst aufrufen. */ - for (cur = cur->children; cur != NULL; cur = cur->next) { - if (cur->type != XML_ELEMENT_NODE) - continue; - if (xmlStrcmp(cur->name, "channel") == 0) - parse_rdf10_channel(cur_ptr, doc, cur->children); - if (xmlStrcmp(cur->name, "item") == 0) - parse_rdf10_item(cur_ptr, doc, cur->children); - /* Last-Modified is only used when reading from internal feeds (disk cache). */ - if (xmlStrcmp(cur->name, "lastmodified") == 0) - cur_ptr->lastmodified = xmlNodeListGetString(doc, cur->children, 1); - } - } else if (xmlStrcmp(cur->name, "rss") == 0) { - for (cur = cur->children; cur != NULL; cur = cur->next) { - if (cur->type != XML_ELEMENT_NODE) - continue; - if (xmlStrcmp(cur->name, "channel") == 0) - parse_rdf20_channel(cur_ptr, doc, cur->children); - } - } else { - xmlFreeDoc(doc); - return 3; - } - - xmlFreeDoc(doc); - - if (saverestore == 1) { - /* free struct newsitem *copy. */ - while (firstcopy->next_ptr != NULL) { - firstcopy = firstcopy->next_ptr; - free (firstcopy->prev_ptr->data->link); - free (firstcopy->prev_ptr->data->guid); - free (firstcopy->prev_ptr->data->title); - free (firstcopy->prev_ptr->data); - free (firstcopy->prev_ptr); - } - free (firstcopy->data->link); - free (firstcopy->data->guid); - free (firstcopy->data->title); - free (firstcopy->data); - free (firstcopy); - } - - if (cur_ptr->original != NULL) - free (cur_ptr->original); - - /* Set -> title to something if it's a NULL pointer to avoid crash with strdup below. */ - if (cur_ptr->title == NULL) - cur_ptr->title = strdup (cur_ptr->feedurl); - cur_ptr->original = strdup (cur_ptr->title); - - return 0; -} diff --git a/rss2ctdl/xmlparse.h b/rss2ctdl/xmlparse.h deleted file mode 100644 index f929f1465..000000000 --- a/rss2ctdl/xmlparse.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * $Id$ - * - * Copyright 2003-2004 Rene Puls - * - * xmlparse.h - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef XMLPARSE_H -#define XMLPARSE_H - -#include - -void parse_rdf10_item(struct feed *feed, xmlDocPtr doc, xmlNodePtr node); -void parse_rdf10_channel(struct feed * feed, xmlDocPtr doc, xmlNodePtr node); -void parse_rdf20_channel(struct feed * feed, xmlDocPtr doc, xmlNodePtr node); -int DeXML (struct feed * cur_ptr); - -#endif diff --git a/rss2ctdl/zlib_interface.c b/rss2ctdl/zlib_interface.c deleted file mode 100644 index 6979d330d..000000000 --- a/rss2ctdl/zlib_interface.c +++ /dev/null @@ -1,165 +0,0 @@ -/* Low-level function, decompresses deflate compressed data. Used by gzip_uncompress below. */ - -#include "zlib_interface.h" -#include -#include -#include -#include - -int JG_ZLIB_DEBUG = 0; - -struct gzip_header { - unsigned char magic[2]; - unsigned char method; - unsigned char flags; - unsigned char mtime[4]; - unsigned char xfl; - unsigned char os; -}; - -struct gzip_footer { - unsigned char crc32[4]; - unsigned char size[4]; -}; - -int jg_zlib_uncompress(void * const in_buf, int in_size, - void **out_buf_ptr, int *out_size, - int gzip) -{ - char tmpstring[1024]; - z_stream stream; - char *out_buf = NULL; - int out_buf_bytes = 0; - char tmp_buf[4096]; - int result; - int new_bytes; - - /* Prepare the stream structure. */ - stream.zalloc = NULL; - stream.zfree = NULL; - stream.opaque = NULL; - stream.next_in = in_buf; - stream.avail_in = in_size; - stream.next_out = tmp_buf; - stream.avail_out = sizeof tmp_buf; - - if (out_size != NULL) - *out_size = 0; - - if (gzip) - result = inflateInit2(&stream, MAX_WBITS + 32); /* UNTESTED */ - else - result = inflateInit2(&stream, -MAX_WBITS); - - if (result != 0) { - if (JG_ZLIB_DEBUG) - fprintf(stderr, "inflateInit2 failed: %d\n", result); - return JG_ZLIB_ERROR_OLDVERSION; - } - - do { - /* Should be Z_FINISH? */ - result = inflate(&stream, Z_NO_FLUSH); - switch (result) { - case Z_BUF_ERROR: - if (stream.avail_in == 0) - goto DONE; /* zlib bug */ - case Z_ERRNO: - case Z_NEED_DICT: - case Z_MEM_ERROR: - case Z_DATA_ERROR: - case Z_VERSION_ERROR: - inflateEnd(&stream); - free(out_buf); - if (JG_ZLIB_DEBUG) { - snprintf (tmpstring, sizeof(tmpstring), "ERROR: zlib_uncompress: %d %s\n", result, stream.msg); - fprintf(stderr, tmpstring); - } - return JG_ZLIB_ERROR_UNCOMPRESS; - } - if (stream.avail_out < sizeof tmp_buf) { - /* Add the new uncompressed data to our output buffer. */ - new_bytes = sizeof tmp_buf - stream.avail_out; - out_buf = realloc(out_buf, out_buf_bytes + new_bytes); - memcpy(out_buf + out_buf_bytes, tmp_buf, new_bytes); - out_buf_bytes += new_bytes; - stream.next_out = tmp_buf; - stream.avail_out = sizeof tmp_buf; - } else { - /* For some reason, inflate() didn't write out a single byte. */ - inflateEnd(&stream); - free(out_buf); - if (JG_ZLIB_DEBUG) - fprintf(stderr, "ERROR: No output during decompression\n"); - return JG_ZLIB_ERROR_NODATA; - } - } while (result != Z_STREAM_END); - -DONE: - - inflateEnd(&stream); - - /* Null-terminate the output buffer so it can be handled like a string. */ - out_buf = realloc(out_buf, out_buf_bytes + 1); - out_buf[out_buf_bytes] = 0; - - /* The returned size does NOT include the additionall null byte! */ - if (out_size != NULL) - *out_size = out_buf_bytes; - - *out_buf_ptr = out_buf; - - return 0; -} - -/* Decompressed gzip,deflate compressed data. This is what the webservers usually send. */ - -int jg_gzip_uncompress(void *in_buf, int in_size, - void **out_buf_ptr, int *out_size) -{ - char tmpstring[1024]; - struct gzip_header *header; - char *data_start; - int offset = sizeof *header; - - header = in_buf; - - if (out_size != NULL) - *out_size = 0; - - if ((header->magic[0] != 0x1F) || (header->magic[1] != 0x8B)) { - if (JG_ZLIB_DEBUG) - fprintf(stderr, "ERROR: Invalid magic bytes for GZIP data\n"); - return JG_ZLIB_ERROR_BAD_MAGIC; - } - - if (header->method != 8) { - if (JG_ZLIB_DEBUG) - fprintf(stderr, "ERROR: Compression method is not deflate\n"); - return JG_ZLIB_ERROR_BAD_METHOD; - } - - if (header->flags != 0 && header->flags != 8) { - if (JG_ZLIB_DEBUG) { - snprintf (tmpstring, sizeof(tmpstring), "ERROR: Unsupported flags %d", header->flags); - fprintf(stderr, "ERROR: %s\n", tmpstring); - } - return JG_ZLIB_ERROR_BAD_FLAGS; - } - - if (header->flags & 8) { - /* skip the file name */ - while (offset < in_size) { - if (((char *)in_buf)[offset] == 0) { - offset++; - break; - } - offset++; - } - } - - data_start = (char *)in_buf + offset; - - return jg_zlib_uncompress(data_start, in_size - offset - 8, - out_buf_ptr, out_size, 0); -} diff --git a/rss2ctdl/zlib_interface.h b/rss2ctdl/zlib_interface.h deleted file mode 100644 index 1ba72c1a8..000000000 --- a/rss2ctdl/zlib_interface.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef JG_ZLIB_INTERFACE -#define JG_ZLIB_INTERFACE - -enum JG_ZLIB_ERROR { - JG_ZLIB_ERROR_OLDVERSION = -1, - JG_ZLIB_ERROR_UNCOMPRESS = -2, - JG_ZLIB_ERROR_NODATA = -3, - JG_ZLIB_ERROR_BAD_MAGIC = -4, - JG_ZLIB_ERROR_BAD_METHOD = -5, - JG_ZLIB_ERROR_BAD_FLAGS = -6 -}; - -extern int JG_ZLIB_DEBUG; - -int jg_zlib_uncompress(void *in_buf, int in_size, - void **out_buf_ptr, int *out_size, - int gzip); - -int jg_gzip_uncompress(void *in_buf, int in_size, - void **out_buf_ptr, int *out_size); - -#endif