commit 708d2eaf0fea470d3ba1c900562d315d5320c5a8 Author: 依瑪貓 Date: Mon Nov 30 07:20:14 2020 +0800 Initial commit. diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..d6c1a2a --- /dev/null +++ b/AUTHORS @@ -0,0 +1 @@ +imacat diff --git a/AUTHORS.zh-cn b/AUTHORS.zh-cn new file mode 100644 index 0000000..233b656 --- /dev/null +++ b/AUTHORS.zh-cn @@ -0,0 +1 @@ +依玛猫 diff --git a/AUTHORS.zh-tw b/AUTHORS.zh-tw new file mode 100644 index 0000000..cbc88f5 --- /dev/null +++ b/AUTHORS.zh-tw @@ -0,0 +1 @@ +依瑪貓 diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/COPYING @@ -0,0 +1,674 @@ + 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 + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..e69de29 diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..e69de29 diff --git a/INSTALL.zh-cn b/INSTALL.zh-cn new file mode 100644 index 0000000..e69de29 diff --git a/INSTALL.zh-tw b/INSTALL.zh-tw new file mode 100644 index 0000000..e69de29 diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/README b/README new file mode 100644 index 0000000..e69de29 diff --git a/README.zh-cn b/README.zh-cn new file mode 100644 index 0000000..e69de29 diff --git a/README.zh-tw b/README.zh-tw new file mode 100644 index 0000000..e69de29 diff --git a/TODO b/TODO new file mode 100644 index 0000000..e3f2d46 --- /dev/null +++ b/TODO @@ -0,0 +1 @@ +* Read presentation files list from the USB stick. diff --git a/TODO.zh-cn b/TODO.zh-cn new file mode 100644 index 0000000..fd33bfc --- /dev/null +++ b/TODO.zh-cn @@ -0,0 +1 @@ +* 由 USB 随身碟取得简报档清单。 diff --git a/TODO.zh-tw b/TODO.zh-tw new file mode 100644 index 0000000..fad0ba5 --- /dev/null +++ b/TODO.zh-tw @@ -0,0 +1 @@ +* 由 USB 隨身碟取得簡報檔清單。 diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..6e6566c --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.01 diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..de238d8 --- /dev/null +++ b/build.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mpresent.en.html b/mpresent.en.html new file mode 100644 index 0000000..c7f3f4a --- /dev/null +++ b/mpresent.en.html @@ -0,0 +1,440 @@ + + + + + + + + + + + + + + + +mpresent Version 0.01 + + + +
+ 正體中文 | + 简体中文 | + English +
+
+ + +
+ + +

mpresent Version 0.01

+ + +

What’s New?

+ +
+
2010-08-15
+ +
+

Re-release mpresent version 0.01 with license information.

+
+ +
2010-08-14
+ +
+

SourceForge project was applied. Raw package mpresent version 0.01 was released, with only the program file, but not any documentation or license. Presented on the OpenOffice.org UNO Magic talk on COSCUP 2010.

+
+
+ + +

Description

+ +

mpresent is the Mobile OpenOffice.org Presentation Controller. It is a mobile web office application that turns your smart phone into a presentation controller. The smart phone connects to the presentation host through the TCP/IP network. Mostly this is through Wi-Fi.

+ +

mpresent is written in JSP.

+ + +

Caution

+ +
    +
  • mpresent does not include any authentication or security mechanism. You have to protect it yourself.

  • +
+ + +

System Requirement

+ +
    +
  1. Linux or Solaris/OpenSolaris. Theorically MS-Windows should work, too, but I have not tested it yet. Please tell me if you do. mpresent requires Java and OpenOffice.org. The only platforms they both run that I know are Linux, Solaris/OpenSolaris and MS-Windows. If you successfully run it on other platforms, please let me know.

  2. + +
  3. OpenOffice.org, version 3.0 or above. mpresent uses the com.sun.star.presentation.Presentation2 service, which is only available since OpenOffice.org version 3.0. Most Linuxes come with OpenOffice.org 3 now. If you do not have it, or if your version is too old, you can download and install it from the OpenOffice.org website.

    +

    Notice that the current version of Debian (Lenny) still comes with OpenOffice.org 2.4. If you are running this under Debian Lenny or earlier, you have to download and install OpenOffice.org from the OpenOffice.org website.

    +
  4. + +
  5. OpenOffice.org SDK, version 3.0 or above. mpresent uses the com.sun.star.presentation.Presentation2 service, which is only available since OpenOffice.org SDK version 3.0. Most Linuxes come with OpenOffice.org 3 SDK in their package repository now.

    +
      +
    • If you are running Ubuntu Linux, you can install the openoffice.org-dev package.

    • +
    • If you are running Fedora Linux, you can install the openoffice.org-core and openoffice.org-ure packages.

    • +
    • If you are running OpenSUSE Linux, you can install the OpenOffice_org-ure package.

    • +
    • If you do not have it, or if your version is too old, you can download and install it from the OpenOffice.org website.

    • +
    +
  6. + +
  7. JDK, version 1.5.0 or above. mpresent is written with generic types, which is a new feature +since Java 1.5. Sun released the free OpenJDK since 2006. Till now, most Linux operating systems includes OpenJDK in their package repositories.

    +
      +
    • If you are running Debian or Ubuntu Linux, you can install the openjdk-6-jdk package.

    • +
    • If you are running Fedora or OpenSUSE Linux, you can install the java-1.6.0-openjdk package.

    • +
    • If you do not have it, or if your version is too old, you can download and install the Sun version from the Java website.

    • +
    +
  8. + +
  9. Apache web server, version 2 or above. mpresent is a web application that requires a web server to run. MS-IIS web server on MS-Windows should work, but I have not tested it yet. Please tell me if you do.

    +
      +
    • If you are running Debian or Ubuntu Linux, you can install the apache2 package.

    • +
    • If you are running Fedora or OpenSUSE Linux, you can install the httpd package.

    • +
    • If you do not have it, or if your version is too old, you can download and install it from the Apache website.

    • +
    +
  10. + +
  11. Apache Tomcat, version 5.5 or above. mpresent is a JSP application that requires a servlet container to run.

    +
      +
    • If you are running Debian Linux, you can install the tomcat5.5 package.

    • +
    • If you are running Ubuntu Linux, you can install the tomcat6 package.

    • +
    • If you are running Fedora or openSUSE Linux, you can install the tomcat6 package.

    • +
    • If you do not have it, or if your version is too old, you can download and install it from the Apache Tomcat website.

    • +
    +
  12. + +
  13. + +
+ + +

Download

+ +

arclog’s official websites is at…

+ + + +

You can always download the newest version of arclog from…

+ + + +

imacat’s PGP public key is at…

+ + + + +

Install

+ +

If you are upgrading from arclog.pl 2.1.1dev4 or earlier, please read UPGRADE for some upgrade instruction.

+ +

Install with ExtUtils::MakeMaker

+ +

arclog uses standard Perl installation with ExtUtils::MakeMaker. Follow these steps:

+ +
+% perl Makefile.PL
+% make
+% make test
+% make install
+
+ +

When running make install, make sure you have the priviledge to write to the installation location. This usually requires the root priviledge.

+ +

If you are using ActivePerl under MS-Windows, you should use nmake instead of make. nmake can be obtained from the Microsoft FTP site.

+ +

If you want to install into another location, you can set the PREFIX. For example, to install into your home when you are not root:

+ +
+% perl Makefile.PL PREFIX=/home/jessica
+
+ +

Refer to the docuemntation of ExtUtils::MakeMaker for more installation options (by running perldoc ExtUtils::MakeMaker).

+ + +

Install with Module::Build

+ +

You can install with Module::Build instead, if you prefer. Follow these steps:

+ +
+% perl Build.PL
+% ./Build
+% ./Build test
+% ./Build install
+
+ +

When running ./Build install, make sure you have the priviledge to write to the installation location. This usually requires the root priviledge.

+ +

If you want to install into another location, you can set the --prefix. For example, to install into your home when you are not root:

+ +
+% perl Build.PL --prefix=/home/jessica
+
+ +

Refer to the docuemntation of Module::Build for more installation options (by running perldoc Module::Build).

+ + +

Options

+ +
+./arclog [options] logfile… [output]
+./arclog [-h|-v]
+
+ + +
+
logfile
+ +
+

The log file to be archived. Specify - to read from STDIN. Multiple log files are supported. gzip or bzip2 compressed files are supported, too.

+
+ + +
output
+ +
+

The prefix of the output files. The output files will be named as output.yyyymm, i.e., output.200101, output.200102. If not specified, the default is the same as the log file. You must specify this if you want to read from STDIN. You cannot specify - (STDIN), since this is only a name prefix, not the output file.

+
+ + +
-c, --compress method
+ +
+

Specify the compression method for the archived files. Log files usually have large number of simular lines. Compress them saves you lots of disk spaces. (And this is why we want to archive them.) Currently the following compression methods are supported:

+ + +
+
g, gzip
+ +
+

Compress with gzip. This is the default. arclog can use Compress::Zlib to compress instead of calling gzip. This can be safer and faster for not calling foreign binaries. But if Compress::Zlib is not installed, it will try to use gzip binary instead. If gzip binary is not available, either, but gzip compression is required, the program will fail.

+
+ + +
b, bzip2
+ +
+

Compress with bzip2. arclog can use Compress::Bzip2 to compress instead of calling bzip2. This can be safer and faster for not calling foreign binaries. But if Compress::Bzip2 is not installed, it will try to use bzip2 binary instead. If bzip2 binary is not available, either, but bzip2 compression is required, the program will fail.

+
+ + +
n, none
+ +
+

No compression at all. (Why? :p)

+
+
+
+ + +
--nocompress
+ +
+

Do not compress the archived files. This is equal to --compress none.

+
+ + +
-s, --sort
+ +
+

Sort the records by time (and then the record order). Sorting eats huge memory and CPU, so it is disabled by default. See the description above for a detailed illustration on sorting.

+
+ + +
--nosort
+ +
+

Do not sort the records. This is the default.

+
+ + +
-o, --override mode
+ +
+

Whether we should overwrite the existing archived files. Currently the following modes are supported:

+ + +
+
o, overwrite
+ +
+

Overwrite existing target files. You will lost these existing records. Use with care. This is helpful if you are sure the master log file has the most complete records.

+
+ + +
a, append
+ +
+

Append the records to the existing target files. You may destroy the log file completely by putting irrelevant entries altogether accidently. Use with care. This is helpful if you append want to merge 2 or more log files, for ex., 2 log files of different periods.

+
+ + +
i, ignore
+ +
+

Ignore any existing target file, and discard all the records of those months. You will lost these log records. Use with care. This is helpful if you are supplying log records for the missing months, or if you are merging the log records in a complex manner.

+
+ + +
f, fail
+ +
+

Stop processing whenever a target file exists, to prevent destroying existing files by accident. This should be mostly wanted when run from some automatic mechanism, like crontab. So, this is the default if no terminal is found at STDIN.

+
+ + +
ask
+ +
+

Ask you what to do when a target file exists. This should be most wanted if you are running arclog interactively. So, this is the default if a terminal is found at STDIN. The answers are read from STDIN. Since you have only one STDIN, you cannot specify this mode if you want read the log file from STDIN. In that case, it will fall back to the fail mode. Also, if arclog cannot get its answer from STDIN, for ex., on a closed STDIN like crontab, it will fall back to fail mode.

+
+
+
+ + +
-k, --keep mode
+ +
+

What to keep in the source file. Current the following modes are supported:

+ +
+
a, all
+ +
+

Keep the source file after records are archived.

+
+ + +
r, restart
+ +
+

Restart the source log file after records are archived.

+
+ + +
d, delete
+ +
+

Delete the source log file after records are archived.

+
+ + +
t, this-month
+ +
+

Archive and strip records of previous months off from the log file. Keep the records of this month in the source log file, to be archived next month. This is designed to be run from crontab monthly, so this is the default.

+
+
+
+ + +
-d, --debug
+ +
+

Show the detailed debugging messages.

+
+ + +
-q, --quiet
+ +
+

Shihhhhhh. Only yell when errors.

+
+ + +
-h, --help
+ +
+

Display the help message and exit.

+
+ + +
-v, --version
+ +
+

Output version information and exit.

+
+
+ + +

Copyright

+ +

Copyright © 2001-2007 imacat..

+ +

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 3 of the License, or (at your option) any later version.

+ +

This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

+ +

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

+ + +

Release Notes

+ +

Please read the NEWS for the new functions and bug fixes.

+ + +

Support

+ +

arclog is hosted on SourceForge, CPAN and Tavern IMACAT’s. For the latest infomation, see

+ + + +

There is a arclog mailing list hosted at SourceForge. Please submit your questions, suggestions or bug reports there. It is a Mailman mailing list. For more information, see the arclog mailing list page. Alternatively, you can send a mail to the e-mail command mailbox with the subject help for a list of available e-mail commands.

+ +
+ + +
+ + + + diff --git a/mpresent.jsp b/mpresent.jsp new file mode 100644 index 0000000..86ba652 --- /dev/null +++ b/mpresent.jsp @@ -0,0 +1,725 @@ +<% +/* + * mpresent.jsp + * + * Created on 2010-07-13 (Original CGI 2010-07-07) + * + * Copyright (c) 2010 imacat + * + * version 0.01 + */ +%><%@ page +contentType="text/html; charset=utf-8" + +import="com.sun.star.beans.PropertyValue" +import="com.sun.star.bridge.XUnoUrlResolver" +import="com.sun.star.comp.helper.Bootstrap" +import="com.sun.star.frame.XDesktop" +import="com.sun.star.lang.XComponent" +import="com.sun.star.lang.XMultiComponentFactory" +import="com.sun.star.uno.UnoRuntime" +import="com.sun.star.uno.XComponentContext" +import="com.sun.star.ucb.XFileIdentifierConverter" + +import="com.sun.star.container.XEnumeration" +import="com.sun.star.container.XEnumerationAccess" +import="com.sun.star.frame.XModel" +import="com.sun.star.lang.XServiceInfo" + +import="com.sun.star.drawing.XDrawPages" +import="com.sun.star.drawing.XDrawPagesSupplier" + +import="com.sun.star.frame.XComponentLoader" +import="com.sun.star.presentation.XPresentation" +import="com.sun.star.presentation.XPresentation2" +import="com.sun.star.presentation.XPresentationSupplier" +import="com.sun.star.presentation.XSlideShowController" + +import="java.util.Hashtable" +import="java.util.Vector" +%><%! + /** The servlet request */ + private HttpServletRequest r = null; + + /** The desktop service. */ + private Object desktop = null; + + /** The bootstrap context. */ + private XComponentContext bootstrapContext = null; + + /** The registry service manager. */ + private XMultiComponentFactory serviceManager = null; + + /** The document. */ + private XComponent doc = null; + + /** The action type. */ + private ActionType action = null; + + /** The file. */ + private String file = null; + + /** The current slide index. */ + private int currentSlide = -1; + + /** The goto slide index. */ + private int slide = -1; + + /** The slide indeces of all the opened presentations. */ + private Hashtable savedSlideIndeces + = new Hashtable(); + + /** The presentation document files. */ + private Vector allFiles + = new Vector(); + + /** + * Parses the arguments. + * + */ + private void parseArguments() { + this.action = null; + this.file = null; + this.currentSlide = -1; + this.slide = -1; + if (this.allFiles.size() == 0) { + this.allFiles.add(new PresentationFile( + "/home/imacat/ooomagic.odp", + "OpenOffice.org的UNO魔術")); + this.allFiles.add(new PresentationFile( + "/home/imacat/(一)初級篇.odp", + "Perl Regular Expression初級篇")); + this.allFiles.add(new PresentationFile( + "/home/imacat/(二)進階篇.odp", + "Perl Regular Expression進階篇")); + this.allFiles.add(new PresentationFile( + "/home/imacat/ooomagic-real.odp", + "真•OpenOffice.org的UNO魔術")); + this.allFiles.add(new PresentationFile( + "/home/imacat/ooomagic-real-real.odp", + "真•真•OpenOffice.org的UNO魔術")); + } + + try { + this.r.setCharacterEncoding("UTF-8"); + } catch (java.io.UnsupportedEncodingException e) { + throw new java.lang.IllegalArgumentException(e); + } + + if (this.r.getMethod().equals("POST")) { + if (this.r.getParameter("start") != null) { + this.action = ActionType.START; + } else if (this.r.getParameter("next") != null) { + this.action = ActionType.NEXT; + } else if (this.r.getParameter("previous") != null) { + this.action = ActionType.PREVIOUS; + } else if (this.r.getParameter("stop") != null) { + this.action = ActionType.STOP; + } else if (this.r.getParameter("goto") != null) { + this.action = ActionType.GOTO; + } else if (this.r.getParameter("close") != null) { + this.action = ActionType.CLOSE; + } + this.file = this.r.getParameter("file"); + if (this.r.getParameter("slide") != null && !this.r.getParameter("slide").equals("")) { + this.slide = Integer.parseInt(this.r.getParameter("slide")) - 1; + } + } + + return; + } + + /** + * Shows the HTML presentation controller page. + * + * @return the HTML of the page + */ + private String showHTML() { + String html = null; + String script = this.r.getServletPath(); + int pos = 0; + + pos = script.lastIndexOf('/'); + script = script.substring(pos + 1); + + html = "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "簡報遙控\n" + + "\n" + + "\n"; + + if (this.doc != null) { + XDrawPagesSupplier xDrawPagesSupplier = null; + int count = -1; + + xDrawPagesSupplier = (XDrawPagesSupplier) + UnoRuntime.queryInterface( + XDrawPagesSupplier.class, this.doc); + count = xDrawPagesSupplier.getDrawPages().getCount(); + + html += "
\n" + + "
\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "
\n" + + "
 
\n"; + + html += "
\n" + + "\n" + + "\n" + + "\n" + + "
\n" + + "
\n"; + } + + html += "
\n" + + "
\n" + + "\n" + + "\n" + + "
\n" + + "\n" + + ""; + + return html; + } + + /** + * Connects to the OpenOffice.org process. + * + * @param host specifies the host name + * @param port specifies the port number + * @throws com.sun.star.comp.helper.BootstrapException if fails to + * create the initial component context + * @throws com.sun.star.connection.NoConnectException if no one + * is accepting on the specified resource. + * @throws com.sun.star.connection.ConnectionSetupException if + * it is not possible to accept on a local resource + */ + private void connect(String host, int port) + throws com.sun.star.comp.helper.BootstrapException, + com.sun.star.connection.NoConnectException, + com.sun.star.connection.ConnectionSetupException { + boolean doConnect = false; + XComponentContext localContext; + XMultiComponentFactory localServiceManager = null; + Object unoUrlResolver = null; + XUnoUrlResolver xUnoUrlResolver = null; + Object bootstrapContext = null; + + if (this.desktop == null) { + doConnect = true; + } else { + try { + UnoRuntime.queryInterface(XDesktop.class, this.desktop); + } catch (com.sun.star.lang.DisposedException e) { + doConnect = true; + } + } + if (!doConnect) { + return; + } + + // Obtain the local context + try { + localContext = Bootstrap.createInitialComponentContext(null); + } catch (java.lang.Exception e) { + throw new com.sun.star.comp.helper.BootstrapException(e); + } + if (localContext == null) { + throw new com.sun.star.comp.helper.BootstrapException( + "Failed to obtain the local OpenOffice.org component context."); + } + + // Obtain the local service manager + localServiceManager = localContext.getServiceManager(); + + // Obtain the URL resolver + try { + unoUrlResolver = localServiceManager.createInstanceWithContext( + "com.sun.star.bridge.UnoUrlResolver", localContext); + } catch (com.sun.star.uno.Exception e) { + throw new java.lang.UnsupportedOperationException(e); + } + xUnoUrlResolver = (XUnoUrlResolver) UnoRuntime.queryInterface( + XUnoUrlResolver.class, unoUrlResolver); + + // Obtain the context + try { + bootstrapContext = xUnoUrlResolver.resolve(String.format( + "uno:socket,host=%s,port=%d;urp;StarOffice.ComponentContext", + host, port)); + } catch (com.sun.star.connection.NoConnectException e) { + throw e; + } catch (com.sun.star.connection.ConnectionSetupException e) { + throw e; + } catch (com.sun.star.lang.IllegalArgumentException e) { + throw new java.lang.IllegalArgumentException(e); + } + if (bootstrapContext == null) { + throw new java.lang.UnsupportedOperationException( + String.format("Failed to connect to OpenOffice.org at %s:%d.", + host, port)); + } + this.bootstrapContext = (XComponentContext) UnoRuntime.queryInterface( + XComponentContext.class, bootstrapContext); + + // Obtain the service manager + this.serviceManager = this.bootstrapContext.getServiceManager(); + + // Obtain the desktop service + try { + this.desktop = this.serviceManager.createInstanceWithContext( + "com.sun.star.frame.Desktop", this.bootstrapContext); + } catch (com.sun.star.uno.Exception e) { + throw new java.lang.UnsupportedOperationException(e); + } + } + + /** + * Finds the already-opened document. + * + */ + private void findDocument() { + Object fileContentProvider = null; + XFileIdentifierConverter xFileIdentifierConverter = null; + String url = null; + XDesktop xDesktop = null; + XEnumerationAccess xEnumerationAccess = null; + XEnumeration xEnumeration = null; + boolean isRunning = false; + + try { + fileContentProvider + = this.serviceManager.createInstanceWithContext( + "com.sun.star.ucb.FileContentProvider", + this.bootstrapContext); + } catch (com.sun.star.uno.Exception e) { + throw new java.lang.UnsupportedOperationException(e); + } + xFileIdentifierConverter = (XFileIdentifierConverter) + UnoRuntime.queryInterface( + XFileIdentifierConverter.class, fileContentProvider); + url = xFileIdentifierConverter.getFileURLFromSystemPath( + "", this.file); + + this.doc = null; + + // Obtain all the components + xDesktop = (XDesktop) UnoRuntime.queryInterface( + XDesktop.class, this.desktop); + xEnumerationAccess = xDesktop.getComponents(); + xEnumeration = xEnumerationAccess.createEnumeration(); + while (xEnumeration.hasMoreElements()) { + Object component = null; + XServiceInfo xServiceInfo = null; + XPresentationSupplier xPresentationSupplier = null; + XPresentation xPresentation = null; + XPresentation2 xPresentation2 = null; + XModel xModel = null; + boolean isThisDocument = false; + + try { + component = xEnumeration.nextElement(); + } catch (com.sun.star.container.NoSuchElementException e) { + throw new java.util.NoSuchElementException(e.getMessage()); + } catch (com.sun.star.lang.WrappedTargetException e) { + throw new java.lang.RuntimeException(e); + } + + xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface( + XServiceInfo.class, component); + if (xServiceInfo == null) { + continue; + } + if (!xServiceInfo.supportsService( + "com.sun.star.presentation.PresentationDocument")) { + continue; + } + + xModel = (XModel) UnoRuntime.queryInterface( + XModel.class, component); + if (url.equals(xModel.getURL())) { + this.doc = (XComponent) UnoRuntime.queryInterface( + XComponent.class, component); + isThisDocument = true; + } + + xPresentationSupplier = (XPresentationSupplier) + UnoRuntime.queryInterface( + XPresentationSupplier.class, component); + xPresentation = xPresentationSupplier.getPresentation(); + xPresentation2 = (XPresentation2) UnoRuntime.queryInterface( + XPresentation2.class, xPresentation); + if (!isThisDocument && xPresentation2.isRunning()) { + XSlideShowController xSlideShowController + = xPresentation2.getController(); + + this.savedSlideIndeces.put(xModel.getURL(), + xSlideShowController.getCurrentSlideIndex()); + xPresentation2.end(); + } + } + } + + /** + * Opens the presentation document. + * + * @throws java.io.IOException when file couldn't be found or was + corrupt + */ + private void open() + throws java.io.IOException { + Object fileContentProvider = null; + XFileIdentifierConverter xFileIdentifierConverter = null; + String url = null; + XComponentLoader xComponentLoader = null; + PropertyValue props[] = new PropertyValue[0]; + XPresentationSupplier xPresentationSupplier = null; + XPresentation xPresentation = null; + XPresentation2 xPresentation2 = null; + XSlideShowController xSlideShowController = null; + + if (this.doc == null) { + try { + fileContentProvider + = this.serviceManager.createInstanceWithContext( + "com.sun.star.ucb.FileContentProvider", + this.bootstrapContext); + } catch (com.sun.star.uno.Exception e) { + throw new java.lang.UnsupportedOperationException(e); + } + xFileIdentifierConverter = (XFileIdentifierConverter) + UnoRuntime.queryInterface( + XFileIdentifierConverter.class, fileContentProvider); + + // Open the file + url = xFileIdentifierConverter.getFileURLFromSystemPath( + "", this.file); + xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface( + XComponentLoader.class, this.desktop); + try { + this.doc = xComponentLoader.loadComponentFromURL( + url, "_default", 0, props); + } catch (com.sun.star.io.IOException e) { + throw new java.io.IOException(e); + } catch (com.sun.star.lang.IllegalArgumentException e) { + throw new java.lang.IllegalArgumentException(e); + } + + if (this.savedSlideIndeces.containsKey(url)) { + this.savedSlideIndeces.remove(url); + } + } + + // Obtain the presentation + xPresentationSupplier = (XPresentationSupplier) + UnoRuntime.queryInterface( + XPresentationSupplier.class, this.doc); + xPresentation = xPresentationSupplier.getPresentation(); + xPresentation2 = (XPresentation2) UnoRuntime.queryInterface( + XPresentation2.class, xPresentation); + + // Obtain the current slide + if (xPresentation2.isRunning()) { + xSlideShowController = xPresentation2.getController(); + this.currentSlide = xSlideShowController.getCurrentSlideIndex(); + + // Start the presentation if not started yet + } else { + if (this.action != ActionType.STOP) { + XModel xModel = null; + + xPresentation2.start(); + while (!xPresentation2.isRunning()) { } + xSlideShowController = xPresentation2.getController(); + + xModel = (XModel) UnoRuntime.queryInterface( + XModel.class, this.doc); + url = xModel.getURL(); + if (this.savedSlideIndeces.containsKey(url)) { + this.currentSlide = this.savedSlideIndeces.get(url); + } else { + this.currentSlide = -1; + } + + // Go to the current slide + if (this.currentSlide == -1) { + if (xSlideShowController.getCurrentSlideIndex() != 0) { + xSlideShowController.gotoSlideIndex(0); + } + } else { + if ( xSlideShowController.getCurrentSlideIndex() + != this.currentSlide) { + xSlideShowController.gotoSlideIndex(this.currentSlide); + } + } + + // Redraw the screen for sometimes the screen is black + xSlideShowController.gotoNextSlide(); + try { + Thread.currentThread().sleep(50); + } catch (java.lang.InterruptedException e) { + } + xSlideShowController.gotoPreviousSlide(); + } + } + + return; + } + + /** + * Starts the presentation. + * + */ + private void start() { + XPresentationSupplier xPresentationSupplier = null; + XPresentation xPresentation = null; + XPresentation2 xPresentation2 = null; + XSlideShowController xSlideShowController = null; + + xPresentationSupplier = (XPresentationSupplier) + UnoRuntime.queryInterface( + XPresentationSupplier.class, this.doc); + xPresentation = xPresentationSupplier.getPresentation(); + xPresentation2 = (XPresentation2) UnoRuntime.queryInterface( + XPresentation2.class, xPresentation); + xSlideShowController = xPresentation2.getController(); + + this.currentSlide = xSlideShowController.getCurrentSlideIndex(); + return; + } + + /** + * Goes to the next slide. + * + */ + private void gotoNextSlide() { + XPresentationSupplier xPresentationSupplier = null; + XPresentation xPresentation = null; + XPresentation2 xPresentation2 = null; + XSlideShowController xSlideShowController = null; + + xPresentationSupplier = (XPresentationSupplier) + UnoRuntime.queryInterface( + XPresentationSupplier.class, this.doc); + xPresentation = xPresentationSupplier.getPresentation(); + xPresentation2 = (XPresentation2) UnoRuntime.queryInterface( + XPresentation2.class, xPresentation); + xSlideShowController = xPresentation2.getController(); + + xSlideShowController.gotoNextSlide(); + this.currentSlide = xSlideShowController.getCurrentSlideIndex(); + return; + } + + /** + * Goes to the previous slide. + * + */ + private void gotoPreviousSlide() { + XPresentationSupplier xPresentationSupplier = null; + XPresentation xPresentation = null; + XPresentation2 xPresentation2 = null; + XSlideShowController xSlideShowController = null; + + xPresentationSupplier = (XPresentationSupplier) + UnoRuntime.queryInterface( + XPresentationSupplier.class, this.doc); + xPresentation = xPresentationSupplier.getPresentation(); + xPresentation2 = (XPresentation2) UnoRuntime.queryInterface( + XPresentation2.class, xPresentation); + xSlideShowController = xPresentation2.getController(); + + xSlideShowController.gotoPreviousSlide(); + this.currentSlide = xSlideShowController.getCurrentSlideIndex(); + return; + } + + /** + * Stops the presentation + * + */ + private void stop() { + XPresentationSupplier xPresentationSupplier = null; + XPresentation xPresentation = null; + XPresentation2 xPresentation2 = null; + + xPresentationSupplier = (XPresentationSupplier) + UnoRuntime.queryInterface( + XPresentationSupplier.class, this.doc); + xPresentation = xPresentationSupplier.getPresentation(); + xPresentation2 = (XPresentation2) UnoRuntime.queryInterface( + XPresentation2.class, xPresentation); + + if (xPresentation2.isRunning()) { + XSlideShowController xSlideShowController + = xPresentation2.getController(); + XModel xModel = (XModel) UnoRuntime.queryInterface( + XModel.class, this.doc); + + this.savedSlideIndeces.put(xModel.getURL(), + xSlideShowController.getCurrentSlideIndex()); + xPresentation.end(); + } + return; + } + + /** + * Goes to a specific slide. + * + */ + private void gotoSlide() { + XPresentationSupplier xPresentationSupplier = null; + XPresentation xPresentation = null; + XPresentation2 xPresentation2 = null; + XSlideShowController xSlideShowController = null; + + xPresentationSupplier = (XPresentationSupplier) + UnoRuntime.queryInterface( + XPresentationSupplier.class, this.doc); + xPresentation = xPresentationSupplier.getPresentation(); + xPresentation2 = (XPresentation2) UnoRuntime.queryInterface( + XPresentation2.class, xPresentation); + xSlideShowController = xPresentation2.getController(); + + xSlideShowController.gotoSlideIndex(this.slide); + this.currentSlide = xSlideShowController.getCurrentSlideIndex(); + return; + } + + /** + * Closes the presentation document. + * + */ + private void close() { + this.doc.dispose(); + this.doc = null; + return; + } + + /** + * The action type. + * + * @author imacat + * @version 0.01 + */ + private enum ActionType { + + /** Starts the presentation. */ + START, + + /** Goes to the next slide. */ + NEXT, + + /** Goes to the previous slide. */ + PREVIOUS, + + /** Stop the presentation. */ + STOP, + + /** Goes to a specific slide. */ + GOTO, + + /** Closes the presentation document. */ + CLOSE; + } + + /** + * The presentation file. + * + * @author imacat + * @version 0.01 + */ + private class PresentationFile { + + /** The document file. */ + private String file = null; + + /** The document title. */ + private String title = null; + + /** + * Creates a new instance of PresentationFile. + * + * @param file the document file + * @param title the document title + */ + private PresentationFile(String file, String title) { + this.file = file; + this.title = title; + } + + /** + * Returns the document file. + * + * @return the document file + */ + private String getFile() { + return this.file; + } + + /** + * Returns the document title. + * + * @return the document title + */ + private String getTitle() { + return this.title; + } + } +%><% + this.r = request; + this.parseArguments(); + if (this.action != null) { + this.connect("localhost", 2002); + this.findDocument(); + this.open(); + switch (this.action) { + case START: + this.start(); + break; + case NEXT: + this.gotoNextSlide(); + break; + case PREVIOUS: + this.gotoPreviousSlide(); + break; + case STOP: + this.stop(); + break; + case CLOSE: + this.stop(); + this.close(); + break; + case GOTO: + this.gotoSlide(); + break; + } + } + out.print(this.showHTML()); +%> diff --git a/mpresent.zh-cn.html b/mpresent.zh-cn.html new file mode 100644 index 0000000..cfb053a --- /dev/null +++ b/mpresent.zh-cn.html @@ -0,0 +1,513 @@ + + + + + + + + + + + + + + + +mpresent 0.01 版 + + + +
+ 正體中文 | + 简体中文 | + English +
+
+ + +
+ + +

mpresent 0.01 版

+ + +

最新消息

+ +
+
2007-12-03
+ +
+

arclog 最新版本 0.01 。说明文件修正。若你之前安装了 arclog 3.00 版或之后的版本,不需要升级新版。下载 arclog 0.01 版

+
+ + +
2007-12-03
+ +
+

arclog 最新版本 3.03 。修正测试套件。所需 Perl 版本号码改用相容於旧版的号码格式,以消除 Perl 5.10 的警告讯息。若你之前安装了 arclog 3.00 版或之后的版本,不需要升级新版。下载 arclog 3.03 版

+
+ + +
2007-11-30
+ +
+

arclog 最新版本 3.02 。修正测试套件,以处理日光节约时间问题。若你之前安装了 arclog 3.00 版或之后的版本,不需要升级新版。下载 arclog 3.02 版

+
+ + +
2007-11-28
+ +
+

arclog 最新版本 3.01 。修正测试套件,以协助厘清 CPAN 测试回报的错误。若你之前安装了 arclog 3.00 版,不需要升级新版。下载 arclog 3.01 版

+
+ + +
2007-11-28
+ +
+

arclog 最新版本 3.00 。从 reslog 借过来的全新程式码,档名也从 arclog.pl 改为 arclog 。新的物件导向处理器,可顺利处理各种压缩法及档案格式。安装系统由 GNU autoconf 改用 PerlExtUtils::MakeMakerModule::Build 。新加上完整的测试套件,协助程式品管。版权更新为 GPLv3下载 arclog 3.00 版

+
+ + +
2002-09-26
+ +
+

arclog.pl 最新版本 2.1.0 。这是 2.1.0 的最终版,加上了 bzip2 压缩的支援,用 gzip 程式代替 Compress::Zlib 压缩,并改用 GNU autoconf 安装设定程式。下载 arclog.pl 2.1.0

+
+ + +
2002-09-18
+ +
+

arclog.pl 最新版本 2.1.0dev2 。本版修正了几个说明文件的错误,并把 SourceForge 加进 arclog.pl 的下载网址中。你可以把它当做申请 SourceForge 纪念版。原则上,不需要急著升级。下载 arclog.pl 2.1.0dev2

+
+ + +
2002-09-17
+ +
+

好消息! arclog.pl 已开始架设於 SourceForge 罗!(虽然我几乎还完全搞不清楚要怎么架…摸索中… ^^; )

+
+
+ + + +

说明

+ +

arclog 是记录档每月归档程式,将记录档中,前月的记录按月份压缩归档,以节省硬碟空间,并避免记录档被有心人士破坏。

+ +

arclog 目前支援 ApacheSyslogNTPApache 1 SSL engine log 及我自己用的括弧 ISO 修正格式五种格式的记录档,与 gzipbzip2 两种压缩法。很多程式都可以用 Apache 相容记录档格式记录,如 CUPSProFTPDPure-FTPd…等, arclog 也可以归档这些 Apache 相容格式的记录档。

+ + +

注意事项

+ +
    +
  • 归类记录档很耗时间。为减少占用原记录档的时间, arclog 会先把原记录档复制到暂时工作档,视需要把原记录档归零,再慢慢在暂时工作档上作业。不过仍请注意下列事项:

    +
      +
    1. 如果原记录档很大(好几百 MB ),光复制档案就很花时间了。这种情况下,最好先关闭记录程式,等整理完以后,再继续记录,以避免记录错乱。若平常有定期归档,记录档就不会无限制膨胀了。

    2. +
    3. arclog 执行到一半因故中断,会留下残存的暂时工作档。日后 arclog 执行时,碰到之前残存的暂时工作档,会停止执行。要先处理掉之前的暂时工作档,才能继续。暂时工作档只是原档的复本,只要改个档名再归档一次,就可以了。

    4. +
    +
  • + +
  • 没有特别理由,最好不要排序。排序的潜在问题如下:

    +
      +
    1. 记录档很大时,排序会吃掉很多记忆体。所需记忆体依归档后每个月记录笔数而定。新版的 LinuxMS-Windows 系统有记忆体耗用保护,会中断吃掉太多记忆体的程式,不过这还是要花好几分钟,这几分钟内系统会完全当掉不动。我不知道别的作业系统有没有记忆体耗用保护。如果你要玩,风险自负。

    2. +
    3. 所有支援的记录档格式,时间最小单位为。同一秒内的记录会先以记录档顺序(若同时归档好几个记录档),再以记录本身出现的次序排序。这样设计尽可能让排序归档后同一秒内的记录次序,和事件真正的发生顺序一致,但也无法完全保证。若同一秒内的事件次序很重要,你要自行小心。

    4. +
    +
  • + +
  • 归档 SyslogNTP 记录档时,请特别注意: SyslogNTP 记录档没有记年。 arclogDate::Parse 模组解读时间。无年份时, Date::Parse 会把年份设在这个月去年的下个月之间。例如,若今天是 2001-06-08 ,那年份会设在 2001-06-30 到 2000-07-01 之间。我原则上赞成这样。不过,若你的 SyslogNTP 记录档超过一年整理归档,不要跑 arclog ,否则记录档会大乱。

  • + +
  • 从标准输入读记录档,请注意下列事项:

    +
      +
    1. 若要读标准输入,就一定要设定归档时,档名的开头,不然不知道怎么归档后要存到哪里去。

    2. +
    3. 标准输入无法删除、归零或保留部份内容。若要读标准输入,原档保留模式会自动退回成全部保留。一次读入多档时,若其中有标准输入,会一律退回全部保留,以避免混乱。

    4. +
    5. ask 模式的回答也是从标准输入读的。因为标准输入只有一个,所以从标准输入读档时,无法跑 ask 模式,会自动退回到 fail 模式。

    6. +
    +
  • + +
  • 我建议安装 File::MMagic ,尽量不要用 file 程式。 File::MMagic 内建的档案类型表好像比 file 程式准确。若不是 gzipbzip2 压缩档, arclog 会把视为当成纯文字档。若压缩档被误判为图档, arclog 会当成纯文字档,直接读记录,并以错误结束。就算错误也不会弄乱原记录档,不过多少有点麻烦。

  • +
+ + +

系统需求

+ +
    +
  1. Perl 5.8.0 以上。 arclog 用三个参数的 open() 来复制档案操作,我还不知道怎么改写到更早的版本上执行。若你可以改写到更早的版本上执行,请告诉我。你可以输入 perl -v 查询你目前的 Perl 版本。如果你没有 Perl 或需要升级,可以到 Perl 网站下载安装最新版 Perl 。若你是用 MS-Windows ,可以到 ActiveState 公司下载 ActivePerl 安装。

  2. + +
  3. 需搭配的 Perl 模组:

    + +
    +
    Date::Parse
    + +
    +

    这是辨识记录时间用的。你可以CPAN 模组库下载安装 Date::Parse ,或用 CPAN Shell 执行 cpan Date::Parse 安装,或用 CPANPLUS Shell 执行 cpanp i Date::Parse 安装。若你是 Debian/Ubandu Linux 使用者,可以执行 apt-get install libtimedate-perl 安装。若你是 Red Hat/Fedora/CentOS Linux 使用者,可以执行 yum install perl-TimeDate 安装。若你是 FreeBSD 使用者,可以执行 ports install p5-TimeDate 安装。若你是 ActivePerl 使用者,可以执行 ppm install Date::Parse 安装。

    +
    +
    +
  4. + +
  5. 选配的 Perl 模组:

    + +
    +
    File::MMagic
    + +
    +

    这是检查档案类型用的。若没有安装, arclog 会找 file 程式代替。若还找不到, arclog 会改用档尾(副档名)判断档案类型。这时若从标准输入读档, arclog 就无法判断了。你可以CPAN 模组库下载安装 File::MMagic ,或用 CPAN Shell 执行 cpan File::MMagic 安装,或用 CPANPLUS Shell 执行 cpanp i File::MMagic 安装。若你是 Debian/Ubandu Linux 使用者,可以执行 apt-get install libfile-mmagic-perl 安装。若你是 Red Hat/Fedora/CentOS Linux 使用者,可以执行 yum install perl-File-MMagic 安装。若你是 FreeBSD 使用者,可以执行 ports install p5-File-MMagic 安装。若你是 ActivePerl 使用者,可以执行 ppm install File::MMagic 安装。若你要在 MS-Windows 下使用 file.exe 程式,可以由 GnuWin32 网站下载。请确认下载后,存档在系统的路径下,档名为 file.exe

    + +

    建议用 File::MMagicfile 程式偶尔会误判。

    +
    + +
    Compress::Zlib
    + +
    +

    这是处理 gzip 压缩档用的,只有在处理 gzip 压缩档才会用到。若要用时没有安装, arclog 会试著改用 gzip 程式代替。若还找不到, arclog 就无法执行。你可以CPAN 模组库下载安装 Compress::Zlib ,或用 CPAN Shell 执行 cpan Compress::Zlib 安装,或用 CPANPLUS Shell 执行 cpanp i Compress::Zlib 安装。若你是 Debian/Ubandu Linux 使用者,可以执行 apt-get install libcompress-zlib-perl 安装。若你是 Red Hat/Fedora/CentOS Linux 使用者,可以执行 yum install perl-Compress-Zlib 安装。若你是 FreeBSD 使用者,可以执行 ports install p5-Compress-Zlib 安装。若你是 ActivePerl 使用者,可以执行 ppm install Compress::Zlib 安装。若你要在 MS-Windows 下使用 gzip.exe 程式,可以由 gzip 网站下载。请确认下载后,存档在系统的路径下,档名为 gzip.exe

    +
    + +
    Compress::Bzip2 第二版以上
    + +
    +

    这是处理 bzip2 压缩档用的,只有在处理 bzip2 压缩档才会用到。若要用时没有安装, arclog 会试著改用 bzip2 程式代替。若还找不到, arclog 就无法执行。你可以CPAN 模组库下载安装 Compress::Bzip2 ,或用 CPAN Shell 执行 cpan Compress::Bzip2 安装,或用 CPANPLUS Shell 执行 cpanp i Compress::Bzip2 安装。若你是 Debian/Ubandu Linux 使用者,可以执行 apt-get install libcompress-bzip2-perl 安装。若你是 Red Hat/Fedora/CentOS Linux 使用者,可以执行 yum install perl-Compress-Bzip2 安装。若你是 FreeBSD 使用者,可以执行 ports install p5-Compress-Bzip2 安装。若你是 ActivePerl 使用者,可以执行 ppm install Compress::Bzip2 安装。若你要在 MS-Windows 下使用 bzip2.exe 程式,可以由 bzip2 网站下载。请确认下载后,存档在系统的路径下,档名为 bzip2.exe

    +
    + +
    Term::ReadKey
    + +
    +

    这是显示进度列用的,若没有安装,就不会显示进度列。此外不会有任何问题。进度列可以让你对 arclog 的工作进度一目了然。你可以CPAN 模组库下载安装 Term::ReadKey ,或用 CPAN Shell 执行 cpan Term::ReadKey 安装,或用 CPANPLUS Shell 执行 cpanp i Term::ReadKey 安装。若你是 Debian/Ubandu Linux 使用者,可以执行 apt-get install libterm-readkey-perl 安装。若你是 Red Hat/Fedora/CentOS Linux 使用者,可以执行 yum install perl-TermReadKey 安装。若你是 FreeBSD 使用者,可以执行 ports install p5-Term-ReadKey 安装。若你是 ActivePerl 使用者,可以执行 ppm install Term::ReadKey 安装。

    +
    +
    +
  6. +
+ + +

下载

+ +

arclog 的官方网站在:

+ + + +

最新版 arclog 可由下列位址下载:

+ + + +

依玛猫的 PGP 公钥在:

+ + + + +

安装

+ +

若你是由 arclog.pl 2.1.1dev4 以前的版本升级,请参阅 UPGRADE.zh-cn 档的升级说明。

+ +

ExtUtils::MakeMaker 安装

+ +

arclogPerl 标准的 ExtUtils::MakeMaker 安装,程序如下:

+ +
+% perl Makefile.PL
+% make
+% make test
+% make install
+
+ +

make install 前,请先确认你有在安装目录存档的权限。通常这时候要切换为 root ,才能安装存档。

+ +

若你是用 MS-Windows 下的 ActivePerlmake 请改用 nmakenmake 可由微软的 FTP 站下载

+ +

若要安装到其它地方,请设定好 PREFIX 。例如,一般使用者,要安装在自己的目录下时:

+ +
+% perl Makefile.PL PREFIX=/home/jessica
+
+ +

要知道更多安装选项的细节,请参阅 ExtUtils::MakeMaker 的说明(请执行 perldoc ExtUtils::MakeMaker )。

+ + +

Module::Build 安装

+ +

若你喜欢,也可以用 Module::Build 安装,程序如下:

+ +
+% perl Build.PL
+% ./Build
+% ./Build test
+% ./Build install
+
+ +

./Build install 前,请先确认你有在安装目录存档的权限。通常这时候要切换为 root ,才能安装存档。

+ +

若要安装到其它地方,请设定好 --prefix 。例如,一般使用者,要安装在自己的目录下时:

+ +
+% perl Build.PL --prefix=/home/jessica
+
+ +

要知道更多安装选项的细节,请参阅 Module::Build 的说明(请执行 perldoc Module::Build )。

+ + +

命令列参数

+ +
+./arclog [参数] 记录档档名… [归档档名开头]
+./arclog [-h|-v]
+
+ + +
+
记录档档名
+ +
+

要整理归档的记录档档名。若要从标准输入读记录档,请设定成 - 。可同时指定许多档案。支援 gzipbzip2 压缩档。

+
+ + +
归档档名开头
+ +
+

归档档名用的开头,归档后的档案会取名叫开头.yymmdd,如:开头.200101开头.200102 …等。如果没有设定,会用记录档的档名当开头。若你要从标准输入读记录档,就一定要设归档档名开头。这里不能用 - (标准输入),因为这里设定的是档名的开头,不是档名。

+
+ + +
-c, --compress 压缩法
+ +
+

设定归档用的压缩法。记录大多都长得很像,压缩掉会省下非常多的空间。(不然干嘛归档? ^_*’ )目前支援下列的压缩法:

+ + +
+
g, gzip
+ +
+

gzip 压缩。预设是用 gzip 压缩。 arclog 可以用 Compress::Zlib 来代替 gzip 压缩,不用呼叫外部程式,比较快比较安全。不过如果你没有装 Compress::Zlibarclog 还是会自己改用 gzip 程式压缩。但如果连 gzip 程式都没有,却要用到 gzip 压缩,就没有办法了,无法执行。

+
+ + +
b, bzip2
+ +
+

bzip2 压缩。 arclog 可以用 Compress::Bzip2 来代替 bzip2 压缩,不用呼叫外部程式,比较快比较安全。不过如果你没有装 Compress::Bzip2arclog 还是会自己改用 bzip2 程式压缩。但如果连 bzip2 程式都没有,却要用到 bzip2 压缩,就没有办法了,无法执行。

+
+ + +
n, none
+ +
+

不要压缩。(你没搞错吧? :p )

+
+
+
+ + +
--nocompress
+ +
+

归档后不要压缩,效果和 --compress none 一样。

+
+ + +
-s, --sort
+ +
+

按记录时间先后(及记录本身顺序)排序。排序很耗记忆体和 CPU ,所以预设是不排序。请参见前面关於排序的注意事项。

+
+ + +
--nosort
+ +
+

不要排序(预设值)。

+
+ + +
-o, --override 模式
+ +
+

如果有同名的旧档,该怎么办。目前有下列模式:

+ + +
+
o, overwrite
+ +
+

盖掉旧档。旧档的记录会被删掉,请多加小心。若你的记录档是主记录档,有最完整的记录,你可以用 overwrite

+
+ + +
a, append
+ +
+

和旧档加在一起。这有可能会演变成大混乱,请多加小心。若你想把两份不同时间的记录档加在一起,你可以用 append

+
+ + +
i, ignore
+ +
+

略过所有该月的记录。这有可能造成部份记录流失,请多加小心。若你只要补充没有归档的月份,你可以用 ignore

+
+ + +
f, fail
+ +
+

结束程式,以免不小心破坏旧档。若你要用 crontab 之类的程式,全自动化执行,最好这样,以免破坏资料。因此,若标准输入不是连到键盘上,预设是 fail

+
+ + +
ask
+ +
+

问你该怎么办。若你是手动执行,这样最方便。因此,若标准输入是连到键盘上,预设是 ask 。答案是从标准输入读的。因为标准输入只有一个,若你要从标准输入读记录档,不能跑 ask 模式,会自动退回 fail 模式。还有,如果从标准输入读不到东西,像 crontab 里标准输入被关掉了,也会自动退回 fail 模式。

+
+
+
+ + +
-k, --keep 模式
+ +
+

原记录档要怎么处理。目前有下列模式:

+ + +
+
a, all
+ +
+

完全保留原档。

+
+ + +
r, restart
+ +
+

归档后,原记录档归零。

+
+ + +
d, delete
+ +
+

归档后,删除原记录档。

+
+ + +
t, this-month
+ +
+

将之前月份的记录归档,保留这个月的记录,留待下个月归档。这是给 crontab 每月归档用的。因此,预设是 this-month

+
+
+ +
+ + +
-d, --debug
+ +
+

显示详细的执行过程。

+
+ + +
-q, --quiet
+ +
+

没事不要吵。 :p

+
+ + +
-h, --help
+ +
+

显示程式说明。

+
+ + +
-v, --version
+ +
+

显示程式版本。

+
+
+ + +

版权声明

+ +

版权所有 © 2001-2007 依玛猫。

+ +

本程式是自由软体,您可以遵照自由软体基金会 (Free Software Foundation) 出版的 GNU 通用公共许可证条款 (GNU General Public License) 第三版来修改和重新发布这一程式,或者自由选择使用任何更新的版本。

+ +

发布这一程式的目的是希望它有用,但没有任何担保。甚至没有适合特定目的而隐含的担保。更详细的情况请参阅 GNU 通用公共许可证

+ +

您应该已经和程式一起收到一份 GNU 通用公共许可证的副本。如果还没有,参阅<http://www.gnu.org/licenses/>

+ + +

版本纪录

+ +

请阅读 NEWS 档,查看程式的演变、新增的功能和修补的错误。

+ + +

支援协助

+ +

arclog 网站架在 SourceForgeCPAN旅舍依玛。索取最新资讯,请驾临:

+ + + +

SourceForge 上有一个 arclog 的邮件通讯 。使用上的问题、建议或错误回报,请提到通讯上讨论。它是 Mailman 的邮件通讯。若要加入,请到 arclog 邮件通讯的网页 。你也可以写信到 E-mail 指令信箱,标题填上 help ,索取 E-mail 指令说明。

+ +
+ + +
+ + + + diff --git a/mpresent.zh-tw.html b/mpresent.zh-tw.html new file mode 100644 index 0000000..1381d9c --- /dev/null +++ b/mpresent.zh-tw.html @@ -0,0 +1,518 @@ + + + + + + + + + + + + + + + +mpresent 0.01 版 + + + +
+ 正體中文 | + 简体中文 | + English +
+
+ + +
+ + +

mpresent 0.01 版

+ + +

最新消息

+ +
+
2007-12-03
+ +
+

arclog 最新版本 0.01 。說明文件修正。若妳之前安裝了 arclog 3.00 版或之後的版本,不需要昇級新版。下載 arclog 0.01 版

+
+ + +
2007-12-03
+ +
+

arclog 最新版本 3.03 。修正測試套件。所需 Perl 版本號碼改用相容於舊版的號碼格式,以消除 Perl 5.10 的警告訊息。若妳之前安裝了 arclog 3.00 版或之後的版本,不需要昇級新版。下載 arclog 3.03 版

+
+ + +
2007-11-30
+ +
+

arclog 最新版本 3.02 。修正測試套件,以處理日光節約時間問題。若妳之前安裝了 arclog 3.00 版或之後的版本,不需要昇級新版。下載 arclog 3.02 版

+
+ + +
2007-11-28
+ +
+

arclog 最新版本 3.01 。修正測試套件,以協助釐清 CPAN 測試回報的錯誤。若妳之前安裝了 arclog 3.00 版,不需要昇級新版。下載 arclog 3.01 版

+
+ + +
2007-11-28
+ +
+

arclog 最新版本 3.00 。從 reslog 借過來的全新程式碼,檔名也從 arclog.pl 改為 arclog 。新的物件導向處理器,可順利處理各種壓縮法及檔案格式。安裝系統由 GNU autoconf 改用 PerlExtUtils::MakeMakerModule::Build 。新加上完整的測試套件,協助程式品管。版權更新為 GPLv3下載 arclog 3.00 版

+
+ + +
2002-09-26
+ +
+

arclog.pl 最新版本 2.1.0 。這是 2.1.0 的最終版,加上了 bzip2 壓縮的支援,用 gzip 程式代替 Compress::Zlib 壓縮,並改用 GNU autoconf 安裝設定程式。下載 arclog.pl 2.1.0

+
+ + +
2002-09-18
+ +
+

arclog.pl 最新版本 2.1.0dev2 。本版修正了幾個說明文件的錯誤,並把 SourceForge 加進 arclog.pl 的下載網址中。妳可以把它當做申請 SourceForge 紀念版。原則上,不需要急著昇級。下載 arclog.pl 2.1.0dev2

+
+ + +
2002-09-17
+ +
+

好消息! arclog.pl 已開始架設於 SourceForge 囉!(雖然我幾乎還完全搞不清楚要怎麼架…摸索中… ^^; )

+
+
+ + + +

說明

+ +

arclog 是記錄檔每月歸檔程式,將記錄檔中,前月的記錄按月份壓縮歸檔,以節省硬碟空間,並避免記錄檔被有心人士破壞。

+ +

arclog 目前支援 ApacheSyslogNTPApache 1 SSL engine log 及我自己用的括弧 ISO 修正格式五種格式的記錄檔,與 gzipbzip2 兩種壓縮法。很多程式都可以用 Apache 相容記錄檔格式記錄,如 CUPSProFTPDPure-FTPd…等, arclog 也可以歸檔這些 Apache 相容格式的記錄檔。

+ + +

注意事項

+ +
    +
  • 歸類記錄檔很耗時間。為減少佔用原記錄檔的時間, arclog 會先把原記錄檔複製到暫時工作檔,視需要把原記錄檔歸零,再慢慢在暫時工作檔上作業。不過仍請注意下列事項:

    +
      +
    1. 如果原記錄檔很大(好幾百 MB ),光複製檔案就很花時間了。這種情況下,最好先關閉記錄程式,等整理完以後,再繼續記錄,以避免記錄錯亂。若平常有定期歸檔,記錄檔就不會無限制膨脹了。

    2. +
    3. arclog 執行到一半因故中斷,會留下殘存的暫時工作檔。日後 arclog 執行時,碰到之前殘存的暫時工作檔,會停止執行。要先處理掉之前的暫時工作檔,才能繼續。暫時工作檔只是原檔的複本,只要改個檔名再歸檔一次,就可以了。

    4. +
    +
  • + +
  • 沒有特別理由,最好不要排序。排序的潛在問題如下:

    +
      +
    1. 記錄檔很大時,排序會吃掉很多記憶體。所需記憶體依歸檔後每個月記錄筆數而定。新版的 LinuxMS-Windows 系統有記憶體耗用保護,會中斷吃掉太多記憶體的程式,不過這還是要花好幾分鐘,這幾分鐘內系統會完全當掉不動。我不知道別的作業系統有沒有記憶體耗用保護。如果妳要玩,風險自負。

    2. +
    3. 所有支援的記錄檔格式,時間最小單位為。同一秒內的記錄會先以記錄檔順序(若同時歸檔好幾個記錄檔),再以記錄本身出現的次序排序。這樣設計儘可能讓排序歸檔後同一秒內的記錄次序,和事件真正的發生順序一致,但也無法完全保證。若同一秒內的事件次序很重要,妳要自行小心。

    4. +
    +
  • + +
  • 歸檔 SyslogNTP 記錄檔時,請特別注意: SyslogNTP 記錄檔沒有記年。 arclogDate::Parse 模組解讀時間。無年份時, Date::Parse 會把年份設在這個月去年的下個月之間。例如,若今天是 2001-06-08 ,那年份會設在 2001-06-30 到 2000-07-01 之間。我原則上贊成這樣。不過,若妳的 SyslogNTP 記錄檔超過一年整理歸檔,不要跑 arclog ,否則記錄檔會大亂。

  • + +
  • 從標準輸入讀記錄檔,請注意下列事項:

    +
      +
    1. 若要讀標準輸入,就一定要設定歸檔時,檔名的開頭,不然不知道怎麼歸檔後要存到哪裏去。

    2. +
    3. 標準輸入無法刪除、歸零或保留部份內容。若要讀標準輸入,原檔保留模式會自動退回成全部保留。一次讀入多檔時,若其中有標準輸入,會一律退回全部保留,以避免混亂。

    4. +
    5. ask 模式的回答也是從標準輸入讀的。因為標準輸入只有一個,所以從標準輸入讀檔時,無法跑 ask 模式,會自動退回到 fail 模式。

    6. +
    +
  • + +
  • 我建議安裝 File::MMagic ,儘量不要用 file 程式。 File::MMagic 內建的檔案類型表好像比 file 程式準確。若不是 gzipbzip2 壓縮檔, arclog 會把視為當成純文字檔。若壓縮檔被誤判為圖檔, arclog 會當成純文字檔,直接讀記錄,並以錯誤結束。就算錯誤也不會弄亂原記錄檔,不過多少有點麻煩。

  • +
+ + +

系統需求

+ +
    +
  1. Perl 5.8.0 以上。 arclog 用三個參數的 open() 來複製檔案操作,我還不知道怎麼改寫到更早的版本上執行。若妳可以改寫到更早的版本上執行,請告訴我。妳可以輸入 perl -v 查詢妳目前的 Perl 版本。如果妳沒有 Perl 或需要昇級,可以到 Perl 網站下載安裝最新版 Perl 。若妳是用 MS-Windows ,可以到 ActiveState 公司下載 ActivePerl 安裝。

  2. + +
  3. 需搭配的 Perl 模組:

    + +
    +
    Date::Parse
    + +
    +

    這是辨識記錄時間用的。妳可以CPAN 模組庫下載安裝 Date::Parse ,或用 CPAN Shell 執行 cpan Date::Parse 安裝,或用 CPANPLUS Shell 執行 cpanp i Date::Parse 安裝。若妳是 Debian/Ubandu Linux 使用者,可以執行 apt-get install libtimedate-perl 安裝。若妳是 Red Hat/Fedora/CentOS Linux 使用者,可以執行 yum install perl-TimeDate 安裝。若妳是 FreeBSD 使用者,可以執行 ports install p5-TimeDate 安裝。若妳是 ActivePerl 使用者,可以執行 ppm install Date::Parse 安裝。

    +
    +
    + +

    若妳由 CPANCPANPLUS Shell 安裝 arclog ,會自動幫妳安裝以上所需的模組。

    +
  4. + +
  5. 選配的 Perl 模組:

    + +
    +
    File::MMagic
    + +
    +

    這是檢查檔案類型用的。若沒有安裝, arclog 會找 file 程式代替。若還找不到, arclog 會改用檔尾(副檔名)判斷檔案類型。這時若從標準輸入讀檔, arclog 就無法判斷了。妳可以CPAN 模組庫下載安裝 File::MMagic ,或用 CPAN Shell 執行 cpan File::MMagic 安裝,或用 CPANPLUS Shell 執行 cpanp i File::MMagic 安裝。若妳是 Debian/Ubandu Linux 使用者,可以執行 apt-get install libfile-mmagic-perl 安裝。若妳是 Red Hat/Fedora/CentOS Linux 使用者,可以執行 yum install perl-File-MMagic 安裝。若妳是 FreeBSD 使用者,可以執行 ports install p5-File-MMagic 安裝。若妳是 ActivePerl 使用者,可以執行 ppm install File::MMagic 安裝。若妳要在 MS-Windows 下使用 file.exe 程式,可以由 GnuWin32 網站下載。請確認下載後,存檔在系統的路徑下,檔名為 file.exe

    + +

    建議用 File::MMagicfile 程式偶爾會誤判。

    +
    + +
    Compress::Zlib
    + +
    +

    這是處理 gzip 壓縮檔用的,只有在處理 gzip 壓縮檔才會用到。若要用時沒有安裝, arclog 會試著改用 gzip 程式代替。若還找不到, arclog 就無法執行。妳可以CPAN 模組庫下載安裝 Compress::Zlib ,或用 CPAN Shell 執行 cpan Compress::Zlib 安裝,或用 CPANPLUS Shell 執行 cpanp i Compress::Zlib 安裝。若妳是 Debian/Ubandu Linux 使用者,可以執行 apt-get install libcompress-zlib-perl 安裝。若妳是 Red Hat/Fedora/CentOS Linux 使用者,可以執行 yum install perl-Compress-Zlib 安裝。若妳是 FreeBSD 使用者,可以執行 ports install p5-Compress-Zlib 安裝。若妳是 ActivePerl 使用者,可以執行 ppm install Compress::Zlib 安裝。若妳要在 MS-Windows 下使用 gzip.exe 程式,可以由 gzip 網站下載。請確認下載後,存檔在系統的路徑下,檔名為 gzip.exe

    +
    + +
    Compress::Bzip2 第二版以上
    + +
    +

    這是處理 bzip2 壓縮檔用的,只有在處理 bzip2 壓縮檔才會用到。若要用時沒有安裝, arclog 會試著改用 bzip2 程式代替。若還找不到, arclog 就無法執行。妳可以CPAN 模組庫下載安裝 Compress::Bzip2 ,或用 CPAN Shell 執行 cpan Compress::Bzip2 安裝,或用 CPANPLUS Shell 執行 cpanp i Compress::Bzip2 安裝。若妳是 Debian/Ubandu Linux 使用者,可以執行 apt-get install libcompress-bzip2-perl 安裝。若妳是 Red Hat/Fedora/CentOS Linux 使用者,可以執行 yum install perl-Compress-Bzip2 安裝。若妳是 FreeBSD 使用者,可以執行 ports install p5-Compress-Bzip2 安裝。若妳是 ActivePerl 使用者,可以執行 ppm install Compress::Bzip2 安裝。若妳要在 MS-Windows 下使用 bzip2.exe 程式,可以由 bzip2 網站下載。請確認下載後,存檔在系統的路徑下,檔名為 bzip2.exe

    +
    + +
    Term::ReadKey
    + +
    +

    這是顯示進度列用的,若沒有安裝,就不會顯示進度列。此外不會有任何問題。進度列可以讓妳對 arclog 的工作進度一目瞭然。妳可以CPAN 模組庫下載安裝 Term::ReadKey ,或用 CPAN Shell 執行 cpan Term::ReadKey 安裝,或用 CPANPLUS Shell 執行 cpanp i Term::ReadKey 安裝。若妳是 Debian/Ubandu Linux 使用者,可以執行 apt-get install libterm-readkey-perl 安裝。若妳是 Red Hat/Fedora/CentOS Linux 使用者,可以執行 yum install perl-TermReadKey 安裝。若妳是 FreeBSD 使用者,可以執行 ports install p5-Term-ReadKey 安裝。若妳是 ActivePerl 使用者,可以執行 ppm install Term::ReadKey 安裝。

    +
    +
    +
  6. +
+ + +

下載

+ +

arclog 的官方網站在:

+ + + +

最新版 arclog 可由下列位址下載:

+ + + +

依瑪貓的 PGP 公鑰在:

+ + + + +

安裝

+ +

若妳是由 arclog.pl 2.1.1dev4 以前的版本昇級,請參閱 UPGRADE.zh-tw 檔的昇級說明。

+ +

ExtUtils::MakeMaker 安裝

+ +

arclogPerl 標準的 ExtUtils::MakeMaker 安裝,程序如下:

+ +
+% perl Makefile.PL
+% make
+% make test
+% make install
+
+ +

make install 前,請先確認妳有在安裝目錄存檔的權限。通常這時候要切換為 root ,才能安裝存檔。

+ +

若妳是用 MS-Windows 下的 ActivePerlmake 請改用 nmakenmake 可由微軟的 FTP 站下載

+ +

若要安裝到其它地方,請設定好 PREFIX 。例如,一般使用者,要安裝在自己的目錄下時:

+ +
+% perl Makefile.PL PREFIX=/home/jessica
+
+ +

要知道更多安裝選項的細節,請參閱 ExtUtils::MakeMaker 的說明(請執行 perldoc ExtUtils::MakeMaker )。

+ + +

Module::Build 安裝

+ +

若妳喜歡,也可以用 Module::Build 安裝,程序如下:

+ +
+% perl Build.PL
+% ./Build
+% ./Build test
+% ./Build install
+
+ +

./Build install 前,請先確認妳有在安裝目錄存檔的權限。通常這時候要切換為 root ,才能安裝存檔。

+ +

若要安裝到其它地方,請設定好 --prefix 。例如,一般使用者,要安裝在自己的目錄下時:

+ +
+% perl Build.PL --prefix=/home/jessica
+
+ +

要知道更多安裝選項的細節,請參閱 Module::Build 的說明(請執行 perldoc Module::Build )。

+ + +

命令列參數

+ +
+./arclog [參數] 記錄檔檔名… [歸檔檔名開頭]
+./arclog [-h|-v]
+
+ + +
+
記錄檔檔名
+ +
+

要整理歸檔的記錄檔檔名。若要從標準輸入讀記錄檔,請設定成 - 。可同時指定許多檔案。支援 gzipbzip2 壓縮檔。

+
+ + +
歸檔檔名開頭
+ +
+

歸檔檔名用的開頭,歸檔後的檔案會取名叫開頭.yymmdd,如:開頭.200101開頭.200102 …等。如果沒有設定,會用記錄檔的檔名當開頭。若妳要從標準輸入讀記錄檔,就一定要設歸檔檔名開頭。這裏不能用 - (標準輸入),因為這裏設定的是檔名的開頭,不是檔名。

+
+ + +
-c, --compress 壓縮法
+ +
+

設定歸檔用的壓縮法。記錄大多都長得很像,壓縮掉會省下非常多的空間。(不然幹嘛歸檔? ^_*’ )目前支援下列的壓縮法:

+ + +
+
g, gzip
+ +
+

gzip 壓縮。預設是用 gzip 壓縮。 arclog 可以用 Compress::Zlib 來代替 gzip 壓縮,不用呼叫外部程式,比較快比較安全。不過如果妳沒有裝 Compress::Zlibarclog 還是會自己改用 gzip 程式壓縮。但如果連 gzip 程式都沒有,卻要用到 gzip 壓縮,就沒有辦法了,無法執行。

+
+ + +
b, bzip2
+ +
+

bzip2 壓縮。 arclog 可以用 Compress::Bzip2 來代替 bzip2 壓縮,不用呼叫外部程式,比較快比較安全。不過如果妳沒有裝 Compress::Bzip2arclog 還是會自己改用 bzip2 程式壓縮。但如果連 bzip2 程式都沒有,卻要用到 bzip2 壓縮,就沒有辦法了,無法執行。

+
+ + +
n, none
+ +
+

不要壓縮。(妳沒搞錯吧? :p )

+
+
+
+ + +
--nocompress
+ +
+

歸檔後不要壓縮,效果和 --compress none 一樣。

+
+ + +
-s, --sort
+ +
+

按記錄時間先後(及記錄本身順序)排序。排序很耗記憶體和 CPU ,所以預設是不排序。請參見前面關於排序的注意事項。

+
+ + +
--nosort
+ +
+

不要排序(預設值)。

+
+ + +
-o, --override 模式
+ +
+

如果有同名的舊檔,該怎麼辦。目前有下列模式:

+ + +
+
o, overwrite
+ +
+

蓋掉舊檔。舊檔的記錄會被刪掉,請多加小心。若妳的記錄檔是主記錄檔,有最完整的記錄,妳可以用 overwrite

+
+ + +
a, append
+ +
+

和舊檔加在一起。這有可能會演變成大混亂,請多加小心。若妳想把兩份不同時間的記錄檔加在一起,妳可以用 append

+
+ + +
i, ignore
+ +
+

略過所有該月的記錄。這有可能造成部份記錄流失,請多加小心。若妳只要補充沒有歸檔的月份,妳可以用 ignore

+
+ + +
f, fail
+ +
+

結束程式,以免不小心破壞舊檔。若妳要用 crontab 之類的程式,全自動化執行,最好這樣,以免破壞資料。因此,若標準輸入不是連到鍵盤上,預設是 fail

+
+ + +
ask
+ +
+

問妳該怎麼辦。若妳是手動執行,這樣最方便。因此,若標準輸入是連到鍵盤上,預設是 ask 。答案是從標準輸入讀的。因為標準輸入只有一個,若妳要從標準輸入讀記錄檔,不能跑 ask 模式,會自動退回 fail 模式。還有,如果從標準輸入讀不到東西,像 crontab 裏標準輸入被關掉了,也會自動退回 fail 模式。

+
+
+
+ + +
-k, --keep 模式
+ +
+

原記錄檔要怎麼處理。目前有下列模式:

+ + +
+
a, all
+ +
+

完全保留原檔。

+
+ + +
r, restart
+ +
+

歸檔後,原記錄檔歸零。

+
+ + +
d, delete
+ +
+

歸檔後,刪除原記錄檔。

+
+ + +
t, this-month
+ +
+

將之前月份的記錄歸檔,保留這個月的記錄,留待下個月歸檔。這是給 crontab 每月歸檔用的。因此,預設是 this-month

+
+
+ +
+ + +
-d, --debug
+ +
+

顯示詳細的執行過程。

+
+ + +
-q, --quiet
+ +
+

沒事不要吵。 :p

+
+ + +
-h, --help
+ +
+

顯示程式說明。

+
+ + +
-v, --version
+ +
+

顯示程式版本。

+
+
+ + +

版權聲明

+ +

版權所有 © 2001-2007 依瑪貓。

+ +

本程式是自由軟體,您可以遵照自由軟體基金會 (Free Software Foundation) 出版的 GNU 通用公共許可證條款 (GNU General Public License) 第三版來修改和重新發佈這一程式,或者自由選擇使用任何更新的版本。

+ +

發佈這一程式的目的是希望它有用,但沒有任何擔保。甚至沒有適合特定目的而隱含的擔保。更詳細的情況請參閱 GNU 通用公共許可證

+ +

您應該已經和程式一起收到一份 GNU 通用公共許可證的副本。如果還沒有,參閱<http://www.gnu.org/licenses/>

+ + +

版本紀錄

+ +

請閱讀 NEWS 檔,查看程式的演變、新增的功能和修補的錯誤。

+ + +

支援協助

+ +

arclog 網站架在 SourceForgeCPAN旅舍依瑪。索取最新資訊,請駕臨:

+ + + +

SourceForge 上有一個 arclog 的郵件通訊 。使用上的問題、建議或錯誤回報,請提到通訊上討論。它是 Mailman 的郵件通訊。若要加入,請到 arclog 郵件通訊的網頁 。妳也可以寫信到 E-mail 指令信箱,標題填上 help ,索取 E-mail 指令說明。

+ +
+ + +
+ + + +