From db4042d6554f78fe4fe0df79c4f6cf0b8e6831eb Mon Sep 17 00:00:00 2001 From: Harvie Date: Sun, 30 May 2010 15:07:45 +0200 Subject: [PATCH] some playing with bbs - new fm --- bash/bbs/utils/fm/PKGBUILD | 18 +- bash/bbs/utils/fm/fm-1.1.tar.gz.part | 0 bash/bbs/utils/fm/fm/.hg_archival.txt | 2 + bash/bbs/utils/fm/fm/.hgignore | 5 + bash/bbs/utils/fm/fm/.hgtags | 3 + bash/bbs/utils/fm/fm/AUTHOR | 1 + bash/bbs/utils/fm/fm/COPYING | 674 ++++++++++++++++++++++++++ bash/bbs/utils/fm/fm/Makefile | 29 ++ bash/bbs/utils/fm/fm/README | 70 +++ bash/bbs/utils/fm/fm/cmd.c | 273 +++++++++++ bash/bbs/utils/fm/fm/debian/changelog | 6 + bash/bbs/utils/fm/fm/debian/compat | 1 + bash/bbs/utils/fm/fm/debian/control | 15 + bash/bbs/utils/fm/fm/debian/copyright | 25 + bash/bbs/utils/fm/fm/debian/dirs | 1 + bash/bbs/utils/fm/fm/debian/docs | 2 + bash/bbs/utils/fm/fm/debian/rules | 90 ++++ bash/bbs/utils/fm/fm/fm.c | 128 +++++ bash/bbs/utils/fm/fm/fm.h | 163 +++++++ bash/bbs/utils/fm/fm/fs.c | 466 ++++++++++++++++++ bash/bbs/utils/fm/fm/gen_protos.sh | 13 + bash/bbs/utils/fm/fm/ino.c | 308 ++++++++++++ bash/bbs/utils/fm/fm/ui.c | 374 ++++++++++++++ bash/bbs/utils/fm/tm | 2 + 24 files changed, 2660 insertions(+), 9 deletions(-) create mode 100644 bash/bbs/utils/fm/fm-1.1.tar.gz.part create mode 100644 bash/bbs/utils/fm/fm/.hg_archival.txt create mode 100644 bash/bbs/utils/fm/fm/.hgignore create mode 100644 bash/bbs/utils/fm/fm/.hgtags create mode 100644 bash/bbs/utils/fm/fm/AUTHOR create mode 100644 bash/bbs/utils/fm/fm/COPYING create mode 100644 bash/bbs/utils/fm/fm/Makefile create mode 100644 bash/bbs/utils/fm/fm/README create mode 100644 bash/bbs/utils/fm/fm/cmd.c create mode 100644 bash/bbs/utils/fm/fm/debian/changelog create mode 100644 bash/bbs/utils/fm/fm/debian/compat create mode 100644 bash/bbs/utils/fm/fm/debian/control create mode 100644 bash/bbs/utils/fm/fm/debian/copyright create mode 100644 bash/bbs/utils/fm/fm/debian/dirs create mode 100644 bash/bbs/utils/fm/fm/debian/docs create mode 100755 bash/bbs/utils/fm/fm/debian/rules create mode 100644 bash/bbs/utils/fm/fm/fm.c create mode 100644 bash/bbs/utils/fm/fm/fm.h create mode 100644 bash/bbs/utils/fm/fm/fs.c create mode 100755 bash/bbs/utils/fm/fm/gen_protos.sh create mode 100644 bash/bbs/utils/fm/fm/ino.c create mode 100644 bash/bbs/utils/fm/fm/ui.c create mode 100644 bash/bbs/utils/fm/tm diff --git a/bash/bbs/utils/fm/PKGBUILD b/bash/bbs/utils/fm/PKGBUILD index dfc9255..06ad55d 100644 --- a/bash/bbs/utils/fm/PKGBUILD +++ b/bash/bbs/utils/fm/PKGBUILD @@ -1,20 +1,20 @@ -#Maintainer: Stefan husmann +# Maintainer: Stefan Husmann # Contributor: Grigorios Bouzakis pkgname=fm -pkgver=1.0 -pkgrel=2 -pkgdesc="Minimalistic ncurses filesystem viewer" +pkgver=1.1 +pkgrel=3 +pkgdesc="Fast Move: minimalistic ncurses file system viewer" arch=('i686' 'x86_64') url="http://server01.iiiii.info/fm.html" license=('GPL3') +#depends=('glib2' 'ncurses' 'ctags') depends=('glib2' 'ncurses') -source=(http://server01.iiiii.info/public/$pkgname-$pkgver.tar.gz) -md5sums=('ae8d015f3c45b72c12d7382a558b5697') +#source=($pkgname-$pkgver.tar.gz::http://server01.iiiii.info/public/$pkgname-$pkgver.tar.gz) +source=("http://server01.iiiii.info/public/$pkgname.tar.gz") +md5sums=('e393e0655ea341ad8158d8de41bb6e52') build() { - return 1 - cd $srcdir/$pkgname-$pkgver + cd $srcdir/$pkgname sed -i 's+vim+vi+' fm.h || return 1 make PREFIX=$pkgdir/usr install || return 1 } - diff --git a/bash/bbs/utils/fm/fm-1.1.tar.gz.part b/bash/bbs/utils/fm/fm-1.1.tar.gz.part new file mode 100644 index 0000000..e69de29 diff --git a/bash/bbs/utils/fm/fm/.hg_archival.txt b/bash/bbs/utils/fm/fm/.hg_archival.txt new file mode 100644 index 0000000..80917f7 --- /dev/null +++ b/bash/bbs/utils/fm/fm/.hg_archival.txt @@ -0,0 +1,2 @@ +repo: e6e2a887a6ed32a4604e8068af57dc20149d2e71 +node: d803a902819fcf436e1850ec2d30739d615ec20e diff --git a/bash/bbs/utils/fm/fm/.hgignore b/bash/bbs/utils/fm/fm/.hgignore new file mode 100644 index 0000000..d9c7acc --- /dev/null +++ b/bash/bbs/utils/fm/fm/.hgignore @@ -0,0 +1,5 @@ +syntax: glob +*.o +*.swp +tags +fm diff --git a/bash/bbs/utils/fm/fm/.hgtags b/bash/bbs/utils/fm/fm/.hgtags new file mode 100644 index 0000000..d663c5c --- /dev/null +++ b/bash/bbs/utils/fm/fm/.hgtags @@ -0,0 +1,3 @@ +fdbcd4753407d7a83433cc062d24665ba4d7bce9 1.0 +7ff29ee8db71974fcd60cce0ddf3c08a346bed94 1.1-beta +9f2a7be3b03b33c6cb5b0b9a92e121721eff5b2e 1.1 diff --git a/bash/bbs/utils/fm/fm/AUTHOR b/bash/bbs/utils/fm/fm/AUTHOR new file mode 100644 index 0000000..0a27df9 --- /dev/null +++ b/bash/bbs/utils/fm/fm/AUTHOR @@ -0,0 +1 @@ +Ricardo Catalinas Jiménez diff --git a/bash/bbs/utils/fm/fm/COPYING b/bash/bbs/utils/fm/fm/COPYING new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/bash/bbs/utils/fm/fm/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/bash/bbs/utils/fm/fm/Makefile b/bash/bbs/utils/fm/fm/Makefile new file mode 100644 index 0000000..aeed075 --- /dev/null +++ b/bash/bbs/utils/fm/fm/Makefile @@ -0,0 +1,29 @@ +# Comment next 2 line to disable Linux inotify support. +INOTIFY = -DINOTIFY +INOTIFY_SOURCE = ino.c +CFLAGS = -Wall -pedantic -ansi ${INOTIFY} $$(pkg-config --cflags glib-2.0) -g #-O2 +LDFLAGS = -lncursesw $$(pkg-config --libs glib-2.0) #-s +PREFIX = /usr/local +SOURCES = fm.c fs.c ui.c cmd.c ${INOTIFY_SOURCE} +HEADERS = fm.h +OBJECTS = ${SOURCES:.c=.o} +BINARY = fm + +all: ${BINARY} + +${BINARY}: ${OBJECTS} + ${CC} ${LDFLAGS} -o ${BINARY} ${OBJECTS} + +${OBJECTS}: ${HEADERS} + +tags: ${SOURCES} ${HEADERS} + ctags ${SOURCES} ${HEADERS} + +install: all + install -D -m 755 -o root -g root ${BINARY} ${DESTDIR}/${PREFIX}/bin/${BINARY} + +uninstall: + rm -f ${PREFIX}/bin/${BINARY} + +clean: + rm -f ${BINARY} *.o tags diff --git a/bash/bbs/utils/fm/fm/README b/bash/bbs/utils/fm/fm/README new file mode 100644 index 0000000..5c5e51f --- /dev/null +++ b/bash/bbs/utils/fm/fm/README @@ -0,0 +1,70 @@ +fm (Fast Move: minimalistic ncurses file system viewer) +======================================================= +Small, simple and efficient file system viewer for the console. It offers fast navigation, easy invocation of your common tools (`Emacs`/`Vim`/`Xpdf`/`less`/...) and instant access to your favorite shell. It also can use Linux inotify to update the file tree. + +### How to compile +It should run in any modern UNIX-like with minimal effort. You just need to have installed `ncursesw`, `glib` and its development headers. Then just run: + + make + +### Hacking +Internally the file system hierarchy is represented in a N-ary tree in which each node represents a file and its associated information. Additionally a double-linked list is used to represent the lines from screen. The `glib` is used for its N-ary trees and double-linked lists. Also some string manipulation functions are used for commodity. The rest is standard POSIX code. + +### Screenshot +![fm screenshot](/imgs/fm-screenshot.png) + +### Invocation + Usage: fm [-h|-d] [] + The root of the displayed tree is `tree_root'. + -h: show this help + -d: print on stderr inotify events debug info + +### Keyboard commands +Most commands are based in text navigation of `Vim`. + +Moving the cursor: + + j: select next file. + k: select previous file. + l: open selected directory (open the directory twice to show dot files). + h: close current/selected directory. + Ctrl + f: move one page forward the cursor. + Ctrl + b: move one page backward the cursor. + Ctrl + d: move half page forward the cursor. + Ctrl + u: move half page backward the cursor. + gg: select first file. + G: select last file. + zz: center selected file on screen. + H: select first line from screen. + L: select last line from screen. + }: selects next file without going deeper in the hierarchy. + {: selects previous file without going deeper in the hierarchy. + [[: selects parent directory. + f + : selects next file that begins with . + F + : selects previous file that begins with . + +Running external programs: + + l: opens the selected file with text pager/PDF viewer/PS viewer/image viewer (based on the file name extension). + s: spawns the shell in the current directory (Use Ctrl + d to return). + Enter: starts the editor with selected file. + +Miscellanea: + + q: quits fm. + Ctrl + l: redraws the entire screen and reloads the content of the current working directory. + Ctrl + g: prints info from the selected like `ls -l`. + Esc: clear info window. Set command repetitions to one. + +The default choices for the external programs are `vim`/`xpdf`/`gv`/`display`. They are configured from `fm.h`. Also the can be customized setting the environment variables `PAGER` and `EDITOR` from the shell. The commands `h j k l` can be repeated several times with just one keystroke if a number is given first, just like `Vim` commands repetitions. The cursor can also be moved with the arrows from the keyboard. + +### Project status +Version 1.1 finished, Linux inotify support added. + +### License +The program is under the `GPLv3`. + +### Feedback +Send me an email if you have any question about the code, you found a bug or you have a feature request. Send it to: + + jimenezrick@gmail.com diff --git a/bash/bbs/utils/fm/fm/cmd.c b/bash/bbs/utils/fm/fm/cmd.c new file mode 100644 index 0000000..ed3929d --- /dev/null +++ b/bash/bbs/utils/fm/fm/cmd.c @@ -0,0 +1,273 @@ +/* Copyright (C) 2008 Ricardo Catalinas Jiménez + * + * 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 . + */ + +#include "fm.h" + +void get_key(void) +{ + static int command_repetitions = -1; + static chtype previous_key = 0; + char *info; + chtype key; + +#ifdef INOTIFY + while ((key = getch()) == ERR) + watch_events(); +#else + key = getch(); +#endif + if (key != KEY_RESIZE) + clear_info(); + + if (isdigit(key)) { + if (command_repetitions == -1) + command_repetitions = key - '0'; + else { + command_repetitions *= 10; + command_repetitions += key - '0'; + } + previous_key = key; + + return; + } + + if (previous_key == 'f') { + select_next_line_by_first_letter((char) key); + command_repetitions = -1; + previous_key = 0; + + return; + } else if (previous_key == 'F') { + select_previous_line_by_first_letter((char) key); + command_repetitions = -1; + previous_key = 0; + + return; + } + + if (command_repetitions == -1) + command_repetitions = 1; + + switch (key) { + case KEY_RESIZE: + endwin(); + init_curses(); + update_last_line(); + print_lines(first_line, last_line, TRUE); + select_line_inside_window(); + PRINT_LAST_INFO(); + break; + case 0x0c: /* Ctrl + l */ + clearok(curscr, TRUE); + if (!G_NODE_IS_ROOT(NODE(selected_line))) + select_file(NODE(selected_line)->parent); + update_directory(NODE(selected_line)); + break; + case 0x1b: /* Escape */ + command_repetitions = -1; + previous_key = 0; + + return; + case KEY_NPAGE: + case 0x06: /* Ctrl + f */ + select_line(last_line); + scroll_tree(command_repetitions * (getmaxy(tree_window) - 1)); + break; + case KEY_PPAGE: + case 0x02: /* Ctrl + b */ + select_line(first_line); + scroll_tree(command_repetitions * (-(getmaxy(tree_window) - 1))); + break; + case 0x04: /* Ctrl + d */ + scroll_tree(command_repetitions * getmaxy(tree_window) / 2); + select_nth_line(command_repetitions * getmaxy(tree_window) / 2); + break; + case 0x15: /* Ctrl + u */ + scroll_tree(command_repetitions * -getmaxy(tree_window) / 2); + select_nth_line(command_repetitions * -getmaxy(tree_window) / 2); + break; + case 'g': + if (previous_key == 'g') + select_line(lines); + break; + case 'G': + select_line(g_list_last(lines)); + break; + case 0x07: /* Ctrl + g */ + if ((info = get_file_info(NODE(selected_line))) != NULL) { + print_info(info, FALSE); + free(info); + } + break; + case 'z': + if (previous_key == 'z') + scroll_tree(g_list_position(first_line, selected_line) - + getmaxy(tree_window) / 2); + break; + case 'H': + select_line(first_line); + break; + case 'L': + select_line(last_line); + break; + case KEY_DOWN: + case 'j': + select_nth_line(command_repetitions); + break; + case KEY_UP: + case 'k': + select_nth_line(-command_repetitions); + break; + case KEY_RIGHT: + case 'l': + if (FILE(NODE(selected_line))->type == directory_type && + FILE(NODE(selected_line))->open == FALSE) + open_directory(NODE(selected_line)); + else if (FILE(NODE(selected_line))->type == directory_type && + FILE(NODE(selected_line))->open == TRUE && + FILE(NODE(selected_line))->show_dotfiles == FALSE) + show_dotfiles(NODE(selected_line)); + else if (FILE(NODE(selected_line))->type == file_type) + read_file(NODE(selected_line)); + break; + case KEY_LEFT: + case 'h': +close_parent: if (FILE(NODE(selected_line))->type == directory_type && + FILE(NODE(selected_line))->open == TRUE && + FILE(NODE(selected_line))->show_dotfiles == TRUE && + !G_NODE_IS_LEAF(NODE(selected_line)) && + FILE(g_node_first_child(NODE(selected_line)))->name[0] == '.') + hide_dotfiles(NODE(selected_line)); + else if (FILE(NODE(selected_line))->type == directory_type && + FILE(NODE(selected_line))->open == TRUE && + !G_NODE_IS_LEAF(NODE(selected_line))) + close_directory(NODE(selected_line)); + else if (!G_NODE_IS_ROOT(NODE(selected_line))) { + select_file(NODE(selected_line)->parent); + goto close_parent; + } + break; + case 'q': + endwin(); + clean_up(); + exit(EXIT_SUCCESS); + break; + case '{': + if (g_node_prev_sibling(NODE(selected_line)) != NULL) + select_file(g_node_prev_sibling(NODE(selected_line))); + else + select_nth_line(-1); + break; + case '}': + if (g_node_next_sibling(NODE(selected_line)) != NULL) + select_file(g_node_next_sibling(NODE(selected_line))); + else + select_nth_line(1); + break; + case '[': + if (previous_key == '[' && !G_NODE_IS_ROOT(NODE(selected_line))) + select_file(NODE(selected_line)->parent); + break; + case 's': + if (!G_NODE_IS_ROOT(NODE(selected_line))) + run_shell(NODE(selected_line)->parent); + else + run_shell(NODE(selected_line)); + break; + case KEY_ENTER: + case 0x0d: /* Enter */ + if (FILE(NODE(selected_line))->type == file_type) + edit_file(NODE(selected_line)); + break; + } + if (key != KEY_RESIZE) { + command_repetitions = -1; + previous_key = key; + } +} + +void run_program(GNode *current_directory, char *program_name_variable, + char *default_program_name, char *arg, gboolean wait_proccess) +{ + char *path, *pwd, *program_name; + pid_t child; + int status; + + endwin(); + if ((child = fork()) != 0 && wait_proccess) { + unset_sighandlers(); + waitpid(child, &status, 0); + set_sighandlers(); + } else if (child == 0) { + path = get_path(current_directory); + if (chdir(path) == -1) + exit(EXIT_FAILURE); + pwd = g_strconcat("PWD=", path, NULL); + putenv(pwd); + free(path); + + if (!wait_proccess) { + close(0); + close(1); + close(2); + } + + if (program_name_variable != NULL && + (program_name = getenv(program_name_variable)) != NULL) { + if (execlp(program_name, program_name, arg, NULL) == -1) + exit(EXIT_FAILURE); + } else { + if (execlp(default_program_name, default_program_name, arg, NULL) == -1) + exit(EXIT_FAILURE); + } + } + init_curses(); + update_last_line(); + print_lines(first_line, last_line, TRUE); + select_line_inside_window(); + + if (wait_proccess && WIFEXITED(status) && WEXITSTATUS(status) != EXIT_SUCCESS) + PRINT_ERROR_INFO("Something failed when running the external program"); +} + +void run_shell(GNode *directory) +{ + run_program(directory, "SHELL", DEFAULT_SHELL, NULL, TRUE); +} + +void read_file(GNode *file) +{ + if (g_str_has_suffix(FILE(file)->name, ".pdf") || + g_str_has_suffix(FILE(file)->name, ".pdf.gz") || + g_str_has_suffix(FILE(file)->name, ".pdf.Z")) + run_program(file->parent, NULL, DEFAULT_PDF_VIEWER, FILE(file)->name, FALSE); + else if (g_str_has_suffix(FILE(file)->name, ".ps") || + g_str_has_suffix(FILE(file)->name, ".ps.gz") || + g_str_has_suffix(FILE(file)->name, ".ps.Z")) + run_program(file->parent, NULL, DEFAULT_PS_VIEWER, FILE(file)->name, FALSE); + else if (g_str_has_suffix(FILE(file)->name, ".jpg") || + g_str_has_suffix(FILE(file)->name, ".jpeg") || + g_str_has_suffix(FILE(file)->name, ".png") || + g_str_has_suffix(FILE(file)->name, ".gif")) + run_program(file->parent, NULL, DEFAULT_IMAGE_VIEWER, FILE(file)->name, FALSE); + else + run_program(file->parent, "PAGER", DEFAULT_PAGER, FILE(file)->name, TRUE); +} + +void edit_file(GNode *file) +{ + run_program(file->parent, "EDITOR", DEFAULT_EDITOR, FILE(file)->name, TRUE); +} diff --git a/bash/bbs/utils/fm/fm/debian/changelog b/bash/bbs/utils/fm/fm/debian/changelog new file mode 100644 index 0000000..263cf2a --- /dev/null +++ b/bash/bbs/utils/fm/fm/debian/changelog @@ -0,0 +1,6 @@ +fm (1.1-8) hardy; urgency=low + + * Initial release. + + -- Ricardo Catalinas Jiménez Wed, 29 Jul 2009 13:06:36 +0200 + diff --git a/bash/bbs/utils/fm/fm/debian/compat b/bash/bbs/utils/fm/fm/debian/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/bash/bbs/utils/fm/fm/debian/compat @@ -0,0 +1 @@ +5 diff --git a/bash/bbs/utils/fm/fm/debian/control b/bash/bbs/utils/fm/fm/debian/control new file mode 100644 index 0000000..589d630 --- /dev/null +++ b/bash/bbs/utils/fm/fm/debian/control @@ -0,0 +1,15 @@ +Source: fm +Section: utils +Priority: extra +Maintainer: Ricardo Catalinas Jiménez +Build-Depends: debhelper (>= 5), libc6-dev, libncurses5-dev, libncursesw5-dev, libglib2.0-dev +Standards-Version: 3.7.3 + +Package: fm +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, libc6, libncursesw5, libglib2.0-0 +Description: Small, simple and efficient file system viewer for the console + Small, simple and efficient file system viewer for the console. It offers fast + navigation, easy invocation of your common tools + (`Emacs`/`Vim`/`Xpdf`/`less`/...) and instant access to your favorite shell. + It also can use Linux inotify to update the file tree. diff --git a/bash/bbs/utils/fm/fm/debian/copyright b/bash/bbs/utils/fm/fm/debian/copyright new file mode 100644 index 0000000..1499070 --- /dev/null +++ b/bash/bbs/utils/fm/fm/debian/copyright @@ -0,0 +1,25 @@ +This package was debianized by Ricardo Catalinas Jiménez on +Wed, 29 Jul 2009 13:06:36 +0200. + +It was downloaded from http://server01.iiiii.info/public/fm.tar.gz + +Upstream Author(s): + + Ricardo Catalinas Jiménez + +Copyright: + + Copyright (C) 2008 Ricardo Catalinas Jiménez + +License: + + 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. + +The Debian packaging is (C) 2009, Ricardo Catalinas Jiménez and +is licensed under the GPL, see `/usr/share/common-licenses/GPL'. + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. diff --git a/bash/bbs/utils/fm/fm/debian/dirs b/bash/bbs/utils/fm/fm/debian/dirs new file mode 100644 index 0000000..e772481 --- /dev/null +++ b/bash/bbs/utils/fm/fm/debian/dirs @@ -0,0 +1 @@ +usr/bin diff --git a/bash/bbs/utils/fm/fm/debian/docs b/bash/bbs/utils/fm/fm/debian/docs new file mode 100644 index 0000000..60507c2 --- /dev/null +++ b/bash/bbs/utils/fm/fm/debian/docs @@ -0,0 +1,2 @@ +README +AUTHOR diff --git a/bash/bbs/utils/fm/fm/debian/rules b/bash/bbs/utils/fm/fm/debian/rules new file mode 100755 index 0000000..1d6e9b9 --- /dev/null +++ b/bash/bbs/utils/fm/fm/debian/rules @@ -0,0 +1,90 @@ +#!/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 + + + + +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/fm.sgml > fm.1 + + touch $@ + +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 + dh_installdirs + + # Add here commands to install the package into debian/fm. + $(MAKE) PREFIX=/usr DESTDIR=$(CURDIR)/debian/fm install + + +# 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_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + dh_strip + dh_compress + dh_fixperms +# dh_perl +# 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/bash/bbs/utils/fm/fm/fm.c b/bash/bbs/utils/fm/fm/fm.c new file mode 100644 index 0000000..e47c436 --- /dev/null +++ b/bash/bbs/utils/fm/fm/fm.c @@ -0,0 +1,128 @@ +/* Copyright (C) 2008 Ricardo Catalinas Jiménez + * + * 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 . + */ + +#include "fm.h" + +char *program_name; + +void clean_up(void) +{ +#ifdef INOTIFY + stop_inotify(); +#endif + g_list_free(lines); + destroy_directory_content(tree_root); + free_node_data(tree_root, NULL); + g_node_destroy(tree_root); +} + +void print_errno_and_exit(int last_errno, char *file, int line) +{ + char *message_format = "%s (%s:%i)"; + char *message; + + endwin(); + message = g_strdup_printf(message_format, program_name, file, line); + errno = last_errno; + perror(message); + free(message); + exit(EXIT_FAILURE); +} + +void handle_sigsegv(int signal_number) +{ + endwin(); + fprintf(stderr, "%s\n", g_strsignal(SIGSEGV)); + exit(EXIT_FAILURE); +} + +void handle_sigint(int signal_number) +{ + endwin(); + exit(EXIT_SUCCESS); +} + +void set_sighandlers(void) +{ + struct sigaction act; + + act.sa_handler = handle_sigsegv; + sigemptyset(&act.sa_mask); + act.sa_flags = 0; + sigaction(SIGSEGV, &act, NULL); + + act.sa_handler = handle_sigint; + sigaction(SIGINT, &act, NULL); + + act.sa_handler = handle_sigwinch; + sigaction(SIGWINCH, &act, NULL); +} + +void unset_sighandlers(void) +{ + struct sigaction act; + + act.sa_handler = SIG_IGN; + sigemptyset(&act.sa_mask); + act.sa_flags = 0; + + sigaction(SIGSEGV, &act, NULL); + sigaction(SIGINT, &act, NULL); + sigaction(SIGWINCH, &act, NULL); +} + +void print_usage(void) +{ + printf("Usage: %s [-h|-d] []\n", program_name); + printf("The root of the displayed tree is `tree_root'.\n"); + printf("\t-h: show this help\n\t-d: print on stderr inotify events debug info\n"); +} + +int main(int argc, char *argv[]) +{ + program_name = argv[0]; + if (argc > 1 && !strcmp(argv[1], "-h")) { + print_usage(); + return 0; + } else if ((argc == 2 || argc == 3) && !strcmp(argv[1], "-d")) { +#ifdef INOTIFY + debug_inotify = TRUE; +#endif + } else if ((argc > 3 && !strcmp(argv[1], "-d")) || argc > 2) { + fprintf(stderr, "%s: invalid option\n", program_name); + print_usage(); + return 1; + } + if (setlocale(LC_ALL, "") == NULL) + fprintf(stderr, "Error: Can't set the specified locale\n"); + + set_sighandlers(); + if (argc == 1) + init_ui(NULL); + else if (argc == 2 && !strcmp(argv[1], "-d")) + init_ui(NULL); + else if (argc == 2) + init_ui(argv[1]); + else + init_ui(argv[2]); + + for (;;) { + get_key(); + refresh_screen(); + } + + return 0; +} diff --git a/bash/bbs/utils/fm/fm/fm.h b/bash/bbs/utils/fm/fm/fm.h new file mode 100644 index 0000000..6765fa2 --- /dev/null +++ b/bash/bbs/utils/fm/fm/fm.h @@ -0,0 +1,163 @@ +/* Copyright (C) 2008 Ricardo Catalinas Jiménez + * + * 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 . + */ + +#ifndef FM_H +#define FM_H + +#define _XOPEN_SOURCE 500 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#undef FILE +#define FILE(node) ((File *) (node)->data) +#define NODE(element) ((GNode *) (element)->data) +#define PRINT_ERRNO_AND_EXIT() print_errno_and_exit(errno, __FILE__, __LINE__) +#define PRINT_ERRNO_INFO() print_error_info(errno, __FILE__, __LINE__, NULL) +#define PRINT_ERROR_INFO(message) print_error_info(0, __FILE__, __LINE__, message) +#define PRINT_LAST_INFO() print_info(NULL, -1) + +#define DEFAULT_EDITOR "vim" +#define DEFAULT_PAGER "less" +#define DEFAULT_SHELL "bash" +#define DEFAULT_PS_VIEWER "gv" +#define DEFAULT_PDF_VIEWER "xpdf" +#define DEFAULT_IMAGE_VIEWER "display" +#define GETCH_DELAY 5 + +typedef struct File File; +struct File { + char *name, *link_path; + enum Type {file_type, directory_type} type; + struct stat info; + gboolean read, open, show_dotfiles, link; + GList *line, *dotfiles; + int watch; +}; + +extern char *program_name; +extern GNode *tree_root; +extern WINDOW *tree_window, *info_window; +extern GList *lines, *selected_line, *first_line, *last_line; + +/* cmd.c */ +void get_key(void); +void run_program(GNode *current_directory, char *program_name_variable, + char *default_program_name, char *arg, gboolean wait_proccess); +void run_shell(GNode *directory); +void read_file(GNode *file); +void edit_file(GNode *file); + +/* fm.c */ +void clean_up(void); +void print_errno_and_exit(int last_errno, char *file, int line); +void handle_sigsegv(int signal_number); +void handle_sigint(int signal_number); +void set_sighandlers(void); +void unset_sighandlers(void); +void print_usage(void); + +/* fs.c */ +void init_tree(char *name); +File *create_new_file(char *name, char *path, gboolean exit_on_error); +gboolean read_directory(GNode *directory); +void free_element_data(gpointer element_data, gpointer data); +void destroy_dotfiles(GList *dotfiles); +gboolean free_node_data(GNode *node, gpointer data); +void destroy_directory_content(GNode *directory); +void destroy_directory_content_real(GNode *directory, gboolean remove_watch); +void add_dotfiles(GNode *directory); +void remove_dotfiles(GNode *directory); +int file_cmp(File *file1, File *file2); +int file_cmp_list(gconstpointer file1, gconstpointer file2); +void insert_sorted_in_dotfiles(GNode *directory, File *file); +GNode *insert_sorted_in_tree(GNode *directory, File *file); +char *get_path(GNode *file); +GNode *get_next_file_real(GNode *file, gboolean go_deeper); +GNode *get_previous_file(GNode *file); +GNode *get_next_file(GNode *file); +GNode *get_next_file_not_deepper(GNode *file); +char *get_file_info(GNode *file); + +/* ui.c */ +void init_lines(void); +void init_curses(void); +void init_ui(char *name); +void refresh_screen(void); +void handle_sigwinch(int signal_number); +void print_lines(GList *start_line, GList *end_line, gboolean clear_bottom_lines); +void print_parents_lines(GList *line); +void print_line(GList *line); +void clear_info(void); +void print_info(char *message, gboolean bold); +void print_error_info(int last_errno, char *file, int line, char *message); +void update_last_line(void); +void add_directory_content(GNode *directory); +void open_directory(GNode *directory); +void close_directory(GNode *directory); +void update_directory(GNode *directory); +void show_dotfiles(GNode *directory); +void hide_dotfiles(GNode *directory); +void select_line(GList *line); +void select_file(GNode *file); +void select_nth_line(int n_lines); +void scroll_tree(int n_lines); +void select_line_inside_window(void); +void select_next_line_by_first_letter(char letter); +void select_previous_line_by_first_letter(char letter); + +#ifdef INOTIFY +#include + +#define CHECK_INOTIFY_ENABLED() if (inotify_enabled == FALSE) return +#define BUFFER_LENGTH 10 * (sizeof(struct inotify_event) + 16) + +extern gboolean inotify_enabled, debug_inotify; +extern GHashTable *watches_table; +extern int inotify_descriptor; +extern char events_buffer[BUFFER_LENGTH]; + +/* ino.c */ +void init_inotify(GNode *tree_root); +void stop_inotify(void); +void free_key(gpointer key, gpointer value, gpointer data); +void add_watch_directory(GNode *directory); +void remove_watch_directory(GNode *directory, gboolean remove_watch); +void watch_events(void); +gboolean insert_in_tree(GNode *directory, File *file); +gboolean remove_from_tree(GNode *file, gboolean unmount); +GNode *search_node_by_name(GNode *directory, char *name); +void dump_event(struct inotify_event *event); +void dump_mask(int mask); +#endif + +#endif diff --git a/bash/bbs/utils/fm/fm/fs.c b/bash/bbs/utils/fm/fm/fs.c new file mode 100644 index 0000000..2510857 --- /dev/null +++ b/bash/bbs/utils/fm/fm/fs.c @@ -0,0 +1,466 @@ +/* Copyright (C) 2008 Ricardo Catalinas Jiménez + * + * 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 . + */ + +#include "fm.h" + +GNode *tree_root; + +void init_tree(char *name) +{ + char *path; + + if (name != NULL) + tree_root = g_node_new(create_new_file(name, NULL, TRUE)); + else { + path = g_get_current_dir(); + tree_root = g_node_new(create_new_file(path, NULL, TRUE)); + free(path); + } +} + +File *create_new_file(char *name, char *path, gboolean exit_on_error) +{ + struct stat info, link_info; + File *file = malloc(sizeof(File)); + char *file_path; + + if (path != NULL) + file_path = g_strconcat(path, "/", name, NULL); + else + file_path = name; + + if (lstat(file_path, &link_info) == -1) { + if (exit_on_error) + PRINT_ERRNO_AND_EXIT(); + else { + /* Sometimes a file is created and then removed, this under Linux + * inotify events can create confusion because we try to stat a + * file that no longer exists. The file is removed before we can do + * the stat. So we ignore the errno and return NULL to take account + * of it. */ + + /* PRINT_ERRNO_INFO(); */ + free(file_path); + free(file); + + return NULL; + } + } else if (S_ISLNK(link_info.st_mode)) { + if (link_info.st_size == 0) + link_info.st_size = PATH_MAX; + + file->link_path = malloc(link_info.st_size + 1); + file->link_path[link_info.st_size] = '\0'; + file->link_path[0] = '\0'; + file->link = TRUE; + + if (readlink(file_path, file->link_path, link_info.st_size) == -1) + PRINT_ERRNO_INFO(); + } else { + file->link_path = NULL; + file->link = FALSE; + } + if (stat(file_path, &info) == -1) { + if (exit_on_error) + PRINT_ERRNO_AND_EXIT(); + else { + PRINT_ERRNO_INFO(); + file->type = file_type; + } + } else if (S_ISDIR(info.st_mode)) + file->type = directory_type; + else + file->type = file_type; + + if (file->link == TRUE) + file->info = link_info; + else + file->info = info; + + file->name = strdup(name); + file->read = FALSE; + file->open = FALSE; + file->show_dotfiles = FALSE; + file->line = NULL; + file->dotfiles = NULL; + file->watch = -1; + + if (path != NULL) + free(file_path); + + return file; +} + +gboolean read_directory(GNode *directory) +{ + DIR *dir; + struct dirent *entry; + File *new_file; + char *path = get_path(directory); + int i; + + if ((dir = opendir(path)) == NULL) { + PRINT_ERRNO_INFO(); + return FALSE; + } + for (errno = 0, i = 0; (entry = readdir(dir)) != NULL; ) { + if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, "..")) + continue; + + if ((new_file = create_new_file(entry->d_name, path, FALSE)) == NULL) + continue; + + if (new_file->name[0] == '.') { + insert_sorted_in_dotfiles(directory, new_file); + i = 1; + } else { + insert_sorted_in_tree(directory, new_file); + i = 1; + } + } + if (errno == EBADF) + PRINT_ERRNO_INFO(); + if (closedir(dir) == -1) + PRINT_ERRNO_INFO(); + free(path); + if (i > 0) { + FILE(directory)->read = TRUE; +#ifdef INOTIFY + add_watch_directory(directory); +#endif + return TRUE; + } + + return FALSE; +} + +void free_element_data(gpointer element_data, gpointer data) +{ + if (FILE((GNode *) element_data)->type == directory_type) + destroy_directory_content((GNode *) element_data); + free_node_data((GNode *) element_data, NULL); +} + +void destroy_dotfiles(GList *dotfiles) +{ + g_list_foreach(dotfiles, free_element_data, NULL); + g_list_free(dotfiles); +} + +gboolean free_node_data(GNode *node, gpointer data) +{ + free(FILE(node)->name); + free(FILE(node)->link_path); + destroy_dotfiles(FILE(node)->dotfiles); + free(node->data); + + return FALSE; +} + +void destroy_directory_content(GNode *directory) +{ + destroy_directory_content_real(directory, TRUE); +} + +void destroy_directory_content_real(GNode *directory, gboolean remove_watch) +{ + GNode *file_ptr, *file_ptr2; + +#ifdef INOTIFY + if (FILE(directory)->read == TRUE) + remove_watch_directory(directory, remove_watch); +#endif + for (file_ptr = g_node_first_child(directory); file_ptr != NULL; ) { + file_ptr2 = file_ptr; + file_ptr = g_node_next_sibling(file_ptr); + + g_node_unlink(file_ptr2); + g_node_traverse(file_ptr2, G_PRE_ORDER, G_TRAVERSE_ALL, -1, free_node_data, NULL); + g_node_destroy(file_ptr2); + } + destroy_dotfiles(FILE(directory)->dotfiles); + FILE(directory)->dotfiles = NULL; + FILE(directory)->read = FALSE; +} + +void add_dotfiles(GNode *directory) +{ + GList *line_ptr; + GNode *file_ptr; + int position; + + for (line_ptr = g_list_next(FILE(directory)->line), position = 0; + FILE(directory)->dotfiles != NULL; position++) { + file_ptr = NODE(FILE(directory)->dotfiles); + FILE(directory)->dotfiles = g_list_delete_link(FILE(directory)->dotfiles, + FILE(directory)->dotfiles); + g_node_insert(directory, position, file_ptr); + lines = g_list_insert_before(lines, line_ptr, file_ptr); + FILE(file_ptr)->line = g_list_previous(line_ptr); + if (FILE(file_ptr)->type == directory_type && FILE(file_ptr)->open == TRUE) + add_directory_content(file_ptr); + } + FILE(directory)->show_dotfiles = TRUE; +} + +void remove_dotfiles(GNode *directory) +{ + GNode *file_ptr; + GList *line_ptr, *line_ptr_aux; + + for (file_ptr = g_node_first_child(directory); file_ptr != NULL && + FILE(file_ptr)->name[0] == '.'; ) { + lines = g_list_delete_link(lines, FILE(file_ptr)->line); + FILE(directory)->dotfiles = g_list_insert(FILE(directory)->dotfiles, file_ptr, -1); + FILE(file_ptr)->line = NULL; + file_ptr = g_node_next_sibling(file_ptr); + g_node_unlink(NODE(g_list_last(FILE(directory)->dotfiles))); + + for (line_ptr = g_list_previous(FILE(file_ptr)->line); + line_ptr != FILE(directory)->line; ) { + line_ptr_aux = line_ptr; + line_ptr = g_list_previous(line_ptr); + FILE(NODE(line_ptr_aux))->line = NULL; + lines = g_list_delete_link(lines, line_ptr_aux); + } + } + FILE(directory)->show_dotfiles = FALSE; +} + +int file_cmp(File *file1, File *file2) +{ + if (file1->name[0] == '.' && file2->name[0] != '.') + return -1; + else if (file1->name[0] != '.' && file2->name[0] == '.') + return 1; + else if (file1->type == file2->type) + return strcmp(file1->name, file2->name); + else if (file1->type == directory_type) + return -1; + else + return 1; +} + +int file_cmp_list(gconstpointer file1, gconstpointer file2) +{ + return file_cmp(FILE((GNode *) file1), FILE((GNode *) file2)); +} + +void insert_sorted_in_dotfiles(GNode *directory, File *file) +{ + FILE(directory)->dotfiles = g_list_insert_sorted(FILE(directory)->dotfiles, + g_node_new(file), file_cmp_list); +} + +GNode *insert_sorted_in_tree(GNode *directory, File *file) +{ + GNode *file_ptr, *new_file; + + if (G_NODE_IS_LEAF(directory)) { + g_node_append_data(directory, file); + return g_node_first_child(directory); + } else if (file_cmp(file, FILE(g_node_first_child(directory))) < 0) { + g_node_prepend_data(directory, file); + return g_node_first_child(directory); + } else { + for (file_ptr = g_node_last_child(directory); file_ptr != NULL; + file_ptr = g_node_prev_sibling(file_ptr)) { + if (file_cmp(file, FILE(file_ptr)) > 0) { + new_file = g_node_new(file); + g_node_insert_after(directory, file_ptr, new_file); + break; + } + } + + return new_file; + } +} + +char *get_path(GNode *file) +{ + GNode *file_ptr; + GString *path = g_string_new(FILE(file)->name); + + for (file_ptr = file->parent; file_ptr != NULL; file_ptr = file_ptr->parent) { + g_string_prepend(path, "/"); + g_string_prepend(path, FILE(file_ptr)->name); + } + + return g_string_free(path, FALSE); +} + +GNode *get_next_file_real(GNode *file, gboolean go_deeper) +{ + GNode *file_ptr, *directory_ptr; + + if (go_deeper && (file_ptr = g_node_first_child(file)) != NULL && FILE(file)->open == TRUE) + return file_ptr; + else if ((file_ptr = g_node_next_sibling(file)) != NULL) + return file_ptr; + else { + for (directory_ptr = file->parent; directory_ptr != NULL; + directory_ptr = directory_ptr->parent) { + if ((file_ptr = g_node_next_sibling(directory_ptr)) != NULL) + return file_ptr; + } + + return NULL; + } +} + +GNode *get_previous_file(GNode *file) +{ + GNode *file_ptr; + + if (G_NODE_IS_ROOT(file)) + return NULL; + else if (file == g_node_first_sibling(file)) + return file->parent; + else if (!G_NODE_IS_LEAF(file_ptr = g_node_prev_sibling(file)) && + FILE(file_ptr)->open == TRUE) { + do + file_ptr = g_node_last_child(file_ptr); + while (!G_NODE_IS_LEAF(file_ptr) && FILE(file_ptr)->open == TRUE); + return file_ptr; + } else + return file_ptr; +} + +GNode *get_next_file(GNode *file) +{ + return get_next_file_real(file, TRUE); +} + +GNode *get_next_file_not_deepper(GNode *file) +{ + return get_next_file_real(file, FALSE); +} + +char *get_file_info(GNode *file) +{ + struct passwd *pw; + struct group *grp; + struct tm *mtime; + char mode[11], mtime_str[17], size_suffix; + double size; + + switch (FILE(file)->info.st_mode & S_IFMT) { + case S_IFSOCK: + mode[0] = 's'; + break; + case S_IFLNK: + mode[0] = 'l'; + break; + case S_IFREG: + mode[0] = '-'; + break; + case S_IFBLK: + mode[0] = 'b'; + break; + case S_IFDIR: + mode[0] = 'd'; + break; + case S_IFCHR: + mode[0] = 'c'; + break; + case S_IFIFO: + mode[0] = 'p'; + break; + } + mode[1] = (FILE(file)->info.st_mode & S_IRUSR) ? 'r' : '-'; + mode[2] = (FILE(file)->info.st_mode & S_IWUSR) ? 'w' : '-'; + mode[3] = (FILE(file)->info.st_mode & S_IXUSR) ? 'x' : '-'; + + mode[4] = (FILE(file)->info.st_mode & S_IRGRP) ? 'r' : '-'; + mode[5] = (FILE(file)->info.st_mode & S_IWGRP) ? 'w' : '-'; + mode[6] = (FILE(file)->info.st_mode & S_IXGRP) ? 'x' : '-'; + + mode[7] = (FILE(file)->info.st_mode & S_IROTH) ? 'r' : '-'; + mode[8] = (FILE(file)->info.st_mode & S_IWOTH) ? 'w' : '-'; + mode[9] = (FILE(file)->info.st_mode & S_IXOTH) ? 'x' : '-'; + mode[10] = '\0'; + + if (FILE(file)->info.st_mode & S_ISUID && mode[3] == 'x') + mode[9] = 's'; + else if (FILE(file)->info.st_mode & S_ISUID && mode[3] == '-') + mode[9] = 'S'; + if (FILE(file)->info.st_mode & S_ISGID && mode[6] == 'x') + mode[9] = 's'; + else if (FILE(file)->info.st_mode & S_ISGID && mode[6] == '-') + mode[9] = 'S'; + if (FILE(file)->info.st_mode & S_ISVTX && mode[9] == 'x') + mode[9] = 't'; + else if (FILE(file)->info.st_mode & S_ISVTX && mode[9] == '-') + mode[9] = 'T'; + + if ((pw = getpwuid(FILE(file)->info.st_uid)) == NULL) { + if (errno == 0) { + struct passwd pw_unknown; + + pw_unknown.pw_name = "unknown"; + pw = &pw_unknown; + } else { + PRINT_ERRNO_INFO(); + return NULL; + } + } if ((grp = getgrgid(FILE(file)->info.st_gid)) == NULL) { + if (errno == 0) { + struct group grp_unknown; + + grp_unknown.gr_name = "unknown"; + grp = &grp_unknown; + } else { + PRINT_ERRNO_INFO(); + return NULL; + } + } + + if ((size =(double) FILE(file)->info.st_size / (1024.0 * 1024.0 * 1024.0)) > 1.0) + size_suffix = 'G'; + else if ((size =(double) FILE(file)->info.st_size / (1024.0 * 1024.0)) > 1.0) + size_suffix = 'M'; + else if ((size =(double) FILE(file)->info.st_size / (1024.0)) > 1.0) + size_suffix = 'K'; + else { + size =(double) FILE(file)->info.st_size; + size_suffix = ' '; + } + + if ((mtime = localtime(&(FILE(file)->info.st_mtime))) == NULL) { + PRINT_ERRNO_INFO(); + return NULL; + } + if (strftime(mtime_str, sizeof(mtime_str), "%Y-%m-%d %H:%M", mtime) == 0) { + PRINT_ERRNO_INFO(); + return NULL; + } + + if (FILE(file)->link == TRUE) { + if (size_suffix == ' ') + return g_strdup_printf("%s %s %s %i %s %s -> %s", mode, pw->pw_name, grp->gr_name, + (int) size, mtime_str, FILE(file)->name, FILE(file)->link_path); + else + return g_strdup_printf("%s %s %s %.2f%c %s %s -> %s", mode, pw->pw_name, grp->gr_name, + size, size_suffix, mtime_str, FILE(file)->name, FILE(file)->link_path); + } else { + if (size_suffix == ' ') + return g_strdup_printf("%s %s %s %i %s %s", mode, pw->pw_name, grp->gr_name, + (int) size, mtime_str, FILE(file)->name); + else + return g_strdup_printf("%s %s %s %.2f%c %s %s", mode, pw->pw_name, grp->gr_name, + size, size_suffix, mtime_str, FILE(file)->name); + } +} diff --git a/bash/bbs/utils/fm/fm/gen_protos.sh b/bash/bbs/utils/fm/fm/gen_protos.sh new file mode 100755 index 0000000..a000f57 --- /dev/null +++ b/bash/bbs/utils/fm/fm/gen_protos.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +TYPES='void|char|int|File|gboolean|GNode|GList|WINDOW' + +egrep -h '^('$TYPES').*;$' *.c | sed 's/^/extern /' +echo + +for file in *.c; do + echo '/* ' $file ' */' + egrep '^('$TYPES').*(\)|,)$' $file | grep -v '^int main(.*)' | sed 's/)$/);/' + echo +done +echo '#endif' diff --git a/bash/bbs/utils/fm/fm/ino.c b/bash/bbs/utils/fm/fm/ino.c new file mode 100644 index 0000000..7cc97c9 --- /dev/null +++ b/bash/bbs/utils/fm/fm/ino.c @@ -0,0 +1,308 @@ +/* Copyright (C) 2008 Ricardo Catalinas Jiménez + * + * 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 . + */ + +#ifdef INOTIFY + +#include "fm.h" + +gboolean inotify_enabled = FALSE, debug_inotify = FALSE; +GHashTable *watches_table; +int inotify_descriptor; +char events_buffer[BUFFER_LENGTH]; + +void init_inotify(GNode *tree_root) +{ + if ((inotify_descriptor = inotify_init()) == -1) { + PRINT_ERRNO_INFO(); + return; + } + watches_table = g_hash_table_new(g_int_hash, g_int_equal); + inotify_enabled = TRUE; +} + +void stop_inotify(void) +{ + CHECK_INOTIFY_ENABLED(); + g_hash_table_destroy(watches_table); + close(inotify_descriptor); + inotify_enabled = FALSE; +} + +void add_watch_directory(GNode *directory) +{ + char *path; + int watch; + + CHECK_INOTIFY_ENABLED(); + path = get_path(directory); + if ((watch = inotify_add_watch(inotify_descriptor, path, IN_CREATE | IN_MOVED_FROM | + IN_MOVED_TO | IN_DELETE)) == -1) + PRINT_ERRNO_INFO(); + else { + FILE(directory)->watch = watch; + g_hash_table_insert(watches_table, &(FILE(directory)->watch), directory); + } + free(path); +} + +void remove_watch_directory(GNode *directory, gboolean remove_watch) +{ + CHECK_INOTIFY_ENABLED(); + if (FILE(directory)->watch == -1) + PRINT_ERROR_INFO("Directory doesn't have a watch associated"); + else if (remove_watch && inotify_rm_watch(inotify_descriptor, FILE(directory)->watch) == -1) + PRINT_ERRNO_INFO(); + else if (g_hash_table_remove(watches_table, &(FILE(directory)->watch)) == FALSE) + PRINT_ERROR_INFO("Element removal failed in watches_table"); +} + +void watch_events(void) +{ + GNode *modified_directory, *removed_file; + File *new_file; + gboolean refresh_request = FALSE; + struct timeval time; + struct inotify_event *event; + int n, i; + fd_set fds; + + CHECK_INOTIFY_ENABLED(); +again: time.tv_sec = 0; + time.tv_usec = 0; + FD_ZERO(&fds); + FD_SET(inotify_descriptor, &fds); + while ((n = select(inotify_descriptor + 1, &fds, NULL, NULL, &time)) == 1) { +again2: if ((n = read(inotify_descriptor, events_buffer, BUFFER_LENGTH)) > 0) { + for (i = 0; i < n; i += sizeof(struct inotify_event) + event->len) { + event = (struct inotify_event *) (events_buffer + i); + if (debug_inotify == TRUE) + dump_event(event); + modified_directory = (GNode *) g_hash_table_lookup( + watches_table, &(event->wd)); + + if (event->mask & IN_CREATE || event->mask & IN_MOVED_TO) { + if ((new_file = create_new_file(event->name, + get_path(modified_directory), FALSE)) != NULL) + refresh_request |= insert_in_tree(modified_directory, new_file); + } else if (event->mask & IN_DELETE || event->mask & IN_MOVED_FROM) { + if ((removed_file = search_node_by_name(modified_directory, + event->name)) != NULL) + refresh_request |= remove_from_tree(removed_file, FALSE); + } else if (event->mask & IN_UNMOUNT) { + refresh_request |= remove_from_tree(modified_directory, TRUE); + } + } + } else if (n == -1) { + if (errno == EINTR) + goto again2; + else + PRINT_ERRNO_AND_EXIT(); + } + } + if (n == -1) { + if (errno == EINTR) + goto again; + else + PRINT_ERRNO_AND_EXIT(); + } + if (refresh_request == TRUE) + refresh_screen(); +} + +gboolean insert_in_tree(GNode *directory, File *file) +{ + GNode *new_file, *file_ptr; + int position; + + if (file->name[0] == '.' && FILE(directory)->show_dotfiles == FALSE) { + insert_sorted_in_dotfiles(directory, file); + + return FALSE; + } + new_file = insert_sorted_in_tree(directory, file); + file_ptr = get_previous_file(new_file); + position = g_list_position(lines, FILE(file_ptr)->line); + lines = g_list_insert(lines, new_file, position + 1); + file->line = g_list_nth(lines, position + 1); + + if (g_list_length(first_line) - g_list_length(last_line) + 1) { + if (g_list_previous(first_line) == file->line) + first_line = file->line; + else if (g_list_next(last_line) == file->line) + last_line = file->line; + } + if (g_list_position(lines, first_line) <= position + 1 && + position + 1 <= g_list_position(lines, last_line)) { + if (position + 1 < g_list_position(lines, selected_line)) { + if (g_list_length(first_line) <= getmaxy(tree_window)) + print_lines(first_line, last_line, FALSE); + else { + first_line = g_list_next(first_line); + print_lines(first_line, file->line, FALSE); + } + } else { + if (g_list_length(first_line) > getmaxy(tree_window)) + last_line = g_list_previous(last_line); + + if (g_node_last_sibling(new_file) == new_file) + print_lines(g_list_previous(file->line), last_line, FALSE); + else + print_lines(file->line, last_line, FALSE); + } + + return TRUE; + } + + return FALSE; +} + +gboolean remove_from_tree(GNode *file, gboolean unmount) +{ + int position = g_list_position(lines, FILE(file)->line); + gboolean refresh_needed = FALSE; + GList *line_ptr, *line_ptr2; + + if (G_NODE_IS_ROOT(file)) { + endwin(); + clean_up(); + printf("The tree root was removed\n"); + exit(EXIT_SUCCESS); + } + if (g_node_is_ancestor(file, NODE(selected_line))) + select_file(file); + if (FILE(file)->type == directory_type) { + close_directory(file); + destroy_directory_content_real(file, FALSE); + if (unmount) + return TRUE; + } + g_node_unlink(file); + + if (g_list_position(lines, first_line) <= position && + position <= g_list_position(lines, last_line)) { + if (first_line == FILE(file)->line && selected_line == FILE(file)->line) { + selected_line = first_line = g_list_previous(first_line); + lines = g_list_delete_link(lines, FILE(file)->line); + print_lines(first_line, first_line, FALSE); + } else if (position < g_list_position(lines, selected_line)) { + if (first_line == FILE(file)->line) + first_line = g_list_next(first_line); + line_ptr = g_list_previous(FILE(file)->line); + lines = g_list_delete_link(lines, FILE(file)->line); + if ((line_ptr2 = g_list_previous(first_line)) != NULL) { + first_line = line_ptr2; + print_lines(first_line, line_ptr, FALSE); + } else if ((line_ptr2 = g_list_next(last_line)) != NULL) { + last_line = line_ptr2; + print_lines(line_ptr, last_line, FALSE); + } else + print_lines(line_ptr, last_line, TRUE); + } else { + if (FILE(file)->line == selected_line) + selected_line = g_list_previous(selected_line); + if (last_line == FILE(file)->line) + last_line = g_list_previous(last_line); + line_ptr = g_list_previous(FILE(file)->line); + lines = g_list_delete_link(lines, FILE(file)->line); + if ((line_ptr2 = g_list_next(last_line)) != NULL) { + last_line = line_ptr2; + print_lines(line_ptr, last_line, FALSE); + } else + print_lines(line_ptr, last_line, TRUE); + } + refresh_needed = TRUE; + } else { + if (last_line == g_list_previous(FILE(file)->line)) { + lines = g_list_delete_link(lines, FILE(file)->line); + print_lines(last_line, last_line, FALSE); + refresh_needed = TRUE; + } else + lines = g_list_delete_link(lines, FILE(file)->line); + } + free_node_data(file, NULL); + g_node_destroy(file); + + return refresh_needed; +} + +GNode *search_node_by_name(GNode *directory, char *name) +{ + GNode *file_ptr; + + for (file_ptr = g_node_first_child(directory); file_ptr != NULL; + file_ptr = g_node_next_sibling(file_ptr)) { + if (!strcmp(FILE(file_ptr)->name, name)) + return file_ptr; + } + + return NULL; +} + +void dump_event(struct inotify_event *event) +{ + static int first = 0; + + if (first != 0) + fprintf(stderr, "================================\n"); + if (event->len > 0) { + fprintf(stderr, "wd = %i\ncookie = %i\nlen = %i\nname = %s\nmask = ", + event->wd, event->cookie, event->len, event->name); + } else { + fprintf(stderr, "wd = %i\ncookie = %i\nlen = %i\nname =\nmask = ", + event->wd, event->cookie, event->len); + } + dump_mask(event->mask); + first = 1; +} + +void dump_mask(int mask) +{ + if (mask & IN_ACCESS) + fprintf(stderr, " IN_ACCESS "); + if (mask & IN_ATTRIB) + fprintf(stderr, " IN_ATTRIB "); + if (mask & IN_CLOSE_WRITE) + fprintf(stderr, " IN_CLOSE_WRITE "); + if (mask & IN_CLOSE_NOWRITE) + fprintf(stderr, " IN_CLOSE_NOWRITE "); + if (mask & IN_CREATE) + fprintf(stderr, " IN_CREATE "); + if (mask & IN_DELETE) + fprintf(stderr, " IN_DELETE "); + if (mask & IN_DELETE_SELF) + fprintf(stderr, " IN_DELETE_SELF "); + if (mask & IN_MODIFY) + fprintf(stderr, " IN_MODIFY "); + if (mask & IN_MOVE_SELF) + fprintf(stderr, " IN_MOVE_SELF "); + if (mask & IN_MOVED_FROM) + fprintf(stderr, " IN_MOVED_FROM "); + if (mask & IN_MOVED_TO) + fprintf(stderr, " IN_MOVED_TO "); + if (mask & IN_OPEN) + fprintf(stderr, " IN_OPEN "); + if (mask & IN_IGNORED) + fprintf(stderr, " IN_IGNORED "); + if (mask & IN_ISDIR) + fprintf(stderr, " IN_ISDIR "); + if (mask & IN_Q_OVERFLOW) + fprintf(stderr, " IN_Q_OVERFLOW "); + if (mask & IN_UNMOUNT) + fprintf(stderr, " IN_UNMOUNT "); + fprintf(stderr, "\n"); +} + +#endif diff --git a/bash/bbs/utils/fm/fm/ui.c b/bash/bbs/utils/fm/fm/ui.c new file mode 100644 index 0000000..d306b9f --- /dev/null +++ b/bash/bbs/utils/fm/fm/ui.c @@ -0,0 +1,374 @@ +/* Copyright (C) 2008 Ricardo Catalinas Jiménez + * + * 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 . + */ + +#include "fm.h" + +WINDOW *tree_window, *info_window; +GList *lines, *selected_line, *first_line, *last_line; + +void init_lines(void) +{ + lines = g_list_append(lines, tree_root); + FILE(tree_root)->line = lines; + selected_line = lines; + first_line = lines; + update_last_line(); +} + +void init_curses(void) +{ + int screen_size[2]; + + initscr(); +#ifdef INOTIFY + halfdelay(GETCH_DELAY); +#else + cbreak(); +#endif + nonl(); + noecho(); + keypad(stdscr, TRUE); + curs_set(0); + refresh(); + + getmaxyx(stdscr, screen_size[0], screen_size[1]); + tree_window = newwin(screen_size[0] - 1, screen_size[1], 0, 0); + info_window = newwin(1, screen_size[1], screen_size[0] - 1, 0); + scrollok(tree_window, TRUE); + idlok(tree_window, TRUE); +} + +void init_ui(char *name) +{ + init_curses(); + init_tree(name); + init_lines(); + print_line(FILE(tree_root)->line); +#ifdef INOTIFY + init_inotify(tree_root); +#endif + open_directory(tree_root); + refresh_screen(); +} + +void refresh_screen(void) +{ + wnoutrefresh(tree_window); + wnoutrefresh(info_window); + doupdate(); +} + +void handle_sigwinch(int signal_number) +{ + ungetch(KEY_RESIZE); +} + +void print_lines(GList *start_line, GList *end_line, gboolean clear_bottom_lines) +{ + GList *line_ptr; + int line_number; + + if (end_line == NULL) + end_line = last_line; + else if (start_line != NULL) { + for (line_ptr = start_line; + g_list_position(first_line, line_ptr) < getmaxy(tree_window); + line_ptr = g_list_next(line_ptr)) { + print_line(line_ptr); + if (line_ptr == end_line) + break; + } + } + line_number = g_list_position(first_line, last_line) + 1; + if (clear_bottom_lines && line_number < getmaxy(tree_window)) { + wmove(tree_window, line_number, 0); + wclrtobot(tree_window); + } +} + +void print_parents_lines(GList *line) +{ + GNode *file_ptr; + int depth; + + for (file_ptr = NODE(line)->parent, depth = g_node_depth(file_ptr) - 1; + !G_NODE_IS_ROOT(file_ptr); file_ptr = file_ptr->parent, depth--) { + if (file_ptr != g_node_last_sibling(file_ptr)) + mvwaddch(tree_window, g_list_position(first_line, line), + 2 * depth - 2, ACS_VLINE); + else + mvwaddch(tree_window, g_list_position(first_line, line), + 2 * depth - 2, ' '); + mvwaddch(tree_window, g_list_position(first_line, line), 2 * depth - 1, ' '); + } +} + +void print_line(GList *line) +{ + int line_number = g_list_position(first_line, line); + GNode *file = NODE(line); + int depth = g_node_depth(file) - 1; + char *link_str; + + wmove(tree_window, line_number, 0); + wclrtoeol(tree_window); + + if (line == selected_line) + wattron(tree_window, A_REVERSE); + + if (G_NODE_IS_ROOT(file)) { + wattron(tree_window, A_BOLD); + waddnstr(tree_window, FILE(file)->name, getmaxx(tree_window) - 1); + if (!g_str_has_suffix(FILE(file)->name, "/")) + waddch(tree_window, '/'); + wattroff(tree_window, A_BOLD); + } else { + if (file != g_node_last_sibling(file)) + mvwaddch(tree_window, line_number, 2 * depth - 2, ACS_LTEE); + else + mvwaddch(tree_window, line_number, 2 * depth - 2, ACS_LLCORNER); + + waddch(tree_window, ACS_HLINE); + if (FILE(file)->link == TRUE) { + link_str = g_strdup_printf("%s -> %s", FILE(file)->name, + FILE(file)->link_path); + waddnstr(tree_window, link_str, getmaxx(tree_window) - 2 * depth - 1); + free(link_str); + } else + waddnstr(tree_window, FILE(file)->name, + getmaxx(tree_window) - 2 * depth - 1); + + if (FILE(file)->type == directory_type && ((FILE(file)->link == TRUE && + !g_str_has_suffix(FILE(file)->link_path, "/")) || + (FILE(file)->link == FALSE && + !g_str_has_suffix(FILE(file)->name, "/")))) + waddch(tree_window, '/'); + print_parents_lines(line); + } + wattroff(tree_window, A_REVERSE); +} + +void clear_info(void) +{ + werase(info_window); +} + +void print_info(char *message, gboolean bold) +{ + static char *last_message = NULL; + static gboolean last_bold = FALSE; + + if (message != NULL) { + if (last_message != NULL) + free(last_message); + last_message = strdup(message); + } + if (bold == TRUE || bold == FALSE) + last_bold = bold; + if (last_bold == TRUE) + wattron(info_window, A_BOLD); + werase(info_window); + if (last_message != NULL) + waddnstr(info_window, last_message, getmaxx(info_window)); + wattroff(info_window, A_BOLD); +} + +void print_error_info(int last_errno, char *file, int line, char *message) +{ + char *message_format = "Error (%s:%i): %s"; + char *message_str; + + if (message != NULL) + message_str = g_strdup_printf(message_format, file, line, message); + else + message_str = g_strdup_printf(message_format, file, line, strerror(last_errno)); + print_info(message_str, TRUE); + free(message_str); +} + +void update_last_line(void) +{ + if (g_list_length(first_line) > getmaxy(tree_window)) + last_line = g_list_nth(first_line, getmaxy(tree_window) - 1); + else + last_line = g_list_last(lines); +} + +void add_directory_content(GNode *directory) +{ + GNode *file_ptr, *directory_sibling; + int position; + + directory_sibling = get_next_file_not_deepper(directory); + + for (position = g_list_position(lines, FILE(directory)->line) + 1, + file_ptr = g_node_first_child(directory); + file_ptr != NULL && file_ptr != directory_sibling; + position++, file_ptr = get_next_file(file_ptr)) { + lines = g_list_insert(lines, file_ptr, position); + FILE(file_ptr)->line = g_list_nth(lines, position); + } +} + +void open_directory(GNode *directory) +{ + if (FILE(directory)->read == FALSE && read_directory(directory) == FALSE) + return; + + FILE(directory)->open = TRUE; + add_directory_content(directory); + update_last_line(); + print_lines(g_list_next(FILE(directory)->line), last_line, TRUE); +} + +void close_directory(GNode *directory) +{ + GNode *directory_sibling; + GList *line_ptr; + + directory_sibling = get_next_file_not_deepper(directory); + + for (line_ptr = g_list_next(FILE(directory)->line); line_ptr != NULL && + NODE(line_ptr) != directory_sibling; line_ptr = g_list_next(FILE(directory)->line)) + lines = g_list_delete_link(lines, line_ptr); + + FILE(directory)->open = FALSE; + update_last_line(); + print_lines(g_list_next(FILE(directory)->line), last_line, TRUE); +} + +void update_directory(GNode *directory) +{ + close_directory(directory); + destroy_directory_content(directory); + open_directory(directory); + + if (FILE(directory)->show_dotfiles == TRUE) + show_dotfiles(directory); +} + +void show_dotfiles(GNode *directory) +{ + add_dotfiles(directory); + update_last_line(); + print_lines(g_list_next(FILE(directory)->line), last_line, TRUE); +} + +void hide_dotfiles(GNode *directory) +{ + remove_dotfiles(directory); + update_last_line(); + print_lines(g_list_next(FILE(directory)->line), last_line, TRUE); +} + +void select_line(GList *line) +{ + select_nth_line(g_list_position(lines, line) - g_list_position(lines, selected_line)); +} + +void select_file(GNode *file) +{ + select_line(FILE(file)->line); +} + +void select_nth_line(int n_lines) +{ + GList *old_selected_line; + int min_n_lines, max_n_lines; + + if ((max_n_lines = g_list_length(selected_line) - 1) < n_lines) + n_lines = max_n_lines; + else if((min_n_lines = (int) g_list_length(selected_line) - + (int) g_list_length(lines)) > n_lines) + n_lines = min_n_lines; + + old_selected_line = selected_line; + if (n_lines < 0) + selected_line = g_list_nth(lines, g_list_position(lines, selected_line) + n_lines); + else if (n_lines > 0) + selected_line = g_list_nth(selected_line, n_lines); + + if (g_list_position(lines, selected_line) < g_list_position(lines, first_line)) + scroll_tree(g_list_position(lines, selected_line) - + g_list_position(lines, first_line)); + else if (g_list_position(lines, selected_line) > g_list_position(lines, last_line)) + scroll_tree(g_list_position(lines, selected_line) - + g_list_position(lines, last_line)); + + if (n_lines != 0) { + print_line(selected_line); + if (g_list_position(lines, first_line) <= g_list_position(lines, old_selected_line) && + g_list_position(lines, old_selected_line) <= + g_list_position(lines, last_line)) + print_line(old_selected_line); + } +} + +void scroll_tree(int n_lines) +{ + int min_n_lines, max_n_lines; + + if ((min_n_lines = -g_list_position(lines, first_line)) > n_lines) + n_lines = min_n_lines; + else if ((max_n_lines = g_list_length(last_line) - 1) < n_lines) + n_lines = max_n_lines; + + wscrl(tree_window, n_lines); + if (n_lines < 0) { + first_line = g_list_nth(lines, g_list_position(lines, first_line) + n_lines); + update_last_line(); + print_lines(first_line, g_list_nth(first_line, -n_lines), FALSE); + } else if (n_lines > 0) { + first_line = g_list_nth(first_line, n_lines); + update_last_line(); + print_lines(g_list_nth(lines, g_list_position(lines, last_line) - n_lines), + last_line, TRUE); + } +} + +void select_line_inside_window(void) +{ + if (g_list_position(lines, selected_line) < g_list_position(lines, first_line)) + select_line(first_line); + else if (g_list_position(lines, selected_line) > g_list_position(lines, last_line)) + select_line(last_line); +} + +void select_next_line_by_first_letter(char letter) +{ + GList *line_ptr; + + for (line_ptr = g_list_next(selected_line); line_ptr != NULL; + line_ptr = g_list_next(line_ptr)) { + if (FILE(NODE(line_ptr))->name[0] == letter) { + select_line(line_ptr); + return; + } + } +} + +void select_previous_line_by_first_letter(char letter) +{ + GList *line_ptr; + + for (line_ptr = g_list_previous(selected_line); line_ptr != NULL; + line_ptr = g_list_previous(line_ptr)) { + if (FILE(NODE(line_ptr))->name[0] == letter) { + select_line(line_ptr); + return; + } + } +} diff --git a/bash/bbs/utils/fm/tm b/bash/bbs/utils/fm/tm new file mode 100644 index 0000000..152ce0a --- /dev/null +++ b/bash/bbs/utils/fm/tm @@ -0,0 +1,2 @@ +fdsfd +ffds -- 2.30.2