From c50ceb41d76fc1965c7916b57906b9537729fdba Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Tue, 22 Aug 2017 19:44:55 -0400 Subject: [PATCH] yawmppp: Add version 2.0.2 to the repository. Obtained from: https://archive.org/download/tucows_59618_yawmppp/yawmppp-2.0.2.tar.gz --- yawmppp/CHANGELOG | 89 + yawmppp/COPYING | 339 ++++ yawmppp/FAQ | 164 ++ yawmppp/INSTALL | 82 + yawmppp/Makefile.in | 42 + yawmppp/README | 278 +++ yawmppp/TODO | 8 + yawmppp/configure | 2531 ++++++++++++++++++++++++ yawmppp/configure.in | 179 ++ yawmppp/install-sh | 250 +++ yawmppp/src/Makefile.in | 71 + yawmppp/src/about.c | 120 ++ yawmppp/src/about.h | 8 + yawmppp/src/dockapp/Makefile.in | 35 + yawmppp/src/dockapp/dockxpm.xpm | 228 +++ yawmppp/src/dockapp/getmodemspeed.c | 17 + yawmppp/src/dockapp/wmgeneral.c | 369 ++++ yawmppp/src/dockapp/wmgeneral.h | 42 + yawmppp/src/dockapp/yawmppp.c | 991 ++++++++++ yawmppp/src/dockapp/yawmppp.h | 142 ++ yawmppp/src/gtklog/Makefile.in | 35 + yawmppp/src/gtklog/loglist.c | 875 ++++++++ yawmppp/src/gtklog/loglist.h | 39 + yawmppp/src/gtklog/status_crash.xpm | 64 + yawmppp/src/gtklog/status_error.xpm | 124 ++ yawmppp/src/gtklog/status_ok.xpm | 23 + yawmppp/src/gtksetup/Makefile.in | 37 + yawmppp/src/gtksetup/applet.c | 2858 +++++++++++++++++++++++++++ yawmppp/src/gtksetup/applet.h | 182 ++ yawmppp/src/gtksetup/bong.xpm | 100 + yawmppp/src/gtksetup/cmd_del.xpm | 26 + yawmppp/src/gtksetup/cmd_down.xpm | 13 + yawmppp/src/gtksetup/cmd_dup.xpm | 27 + yawmppp/src/gtksetup/cmd_new.xpm | 27 + yawmppp/src/gtksetup/cmd_up.xpm | 13 + yawmppp/src/gtksetup/exclam.xpm | 132 ++ yawmppp/src/gtksetup/info.xpm | 100 + yawmppp/src/gtksetup/msgbox.c | 188 ++ yawmppp/src/gtksetup/msgbox.h | 100 + yawmppp/src/gtksetup/padlock.xpm | 140 ++ yawmppp/src/gtksetup/pppdoc.xpm | 100 + yawmppp/src/gtksetup/question.xpm | 100 + yawmppp/src/isprc.c | 175 ++ yawmppp/src/isprc.h | 64 + yawmppp/src/list.c | 169 ++ yawmppp/src/list.h | 59 + yawmppp/src/misc.c | 164 ++ yawmppp/src/misc.h | 9 + yawmppp/src/stepphone.xpm | 115 ++ yawmppp/src/thinppp/Makefile.in | 36 + yawmppp/src/thinppp/backxpm.xpm | 96 + yawmppp/src/thinppp/dataxpm.xpm | 260 +++ yawmppp/src/thinppp/thinppp.c | 1085 ++++++++++ yawmppp/src/thinppp/thinppp.h | 153 ++ yawmppp/src/yawmppp.1x | 167 ++ yawmppp/src/ycommon.c | 410 ++++ yawmppp/src/ycommon.h | 36 + 57 files changed, 14286 insertions(+) create mode 100644 yawmppp/CHANGELOG create mode 100644 yawmppp/COPYING create mode 100644 yawmppp/FAQ create mode 100644 yawmppp/INSTALL create mode 100644 yawmppp/Makefile.in create mode 100644 yawmppp/README create mode 100644 yawmppp/TODO create mode 100755 yawmppp/configure create mode 100644 yawmppp/configure.in create mode 100644 yawmppp/install-sh create mode 100644 yawmppp/src/Makefile.in create mode 100644 yawmppp/src/about.c create mode 100644 yawmppp/src/about.h create mode 100644 yawmppp/src/dockapp/Makefile.in create mode 100644 yawmppp/src/dockapp/dockxpm.xpm create mode 100644 yawmppp/src/dockapp/getmodemspeed.c create mode 100644 yawmppp/src/dockapp/wmgeneral.c create mode 100644 yawmppp/src/dockapp/wmgeneral.h create mode 100644 yawmppp/src/dockapp/yawmppp.c create mode 100644 yawmppp/src/dockapp/yawmppp.h create mode 100644 yawmppp/src/gtklog/Makefile.in create mode 100644 yawmppp/src/gtklog/loglist.c create mode 100644 yawmppp/src/gtklog/loglist.h create mode 100644 yawmppp/src/gtklog/status_crash.xpm create mode 100644 yawmppp/src/gtklog/status_error.xpm create mode 100644 yawmppp/src/gtklog/status_ok.xpm create mode 100644 yawmppp/src/gtksetup/Makefile.in create mode 100644 yawmppp/src/gtksetup/applet.c create mode 100644 yawmppp/src/gtksetup/applet.h create mode 100644 yawmppp/src/gtksetup/bong.xpm create mode 100644 yawmppp/src/gtksetup/cmd_del.xpm create mode 100644 yawmppp/src/gtksetup/cmd_down.xpm create mode 100644 yawmppp/src/gtksetup/cmd_dup.xpm create mode 100644 yawmppp/src/gtksetup/cmd_new.xpm create mode 100644 yawmppp/src/gtksetup/cmd_up.xpm create mode 100644 yawmppp/src/gtksetup/exclam.xpm create mode 100644 yawmppp/src/gtksetup/info.xpm create mode 100644 yawmppp/src/gtksetup/msgbox.c create mode 100644 yawmppp/src/gtksetup/msgbox.h create mode 100644 yawmppp/src/gtksetup/padlock.xpm create mode 100644 yawmppp/src/gtksetup/pppdoc.xpm create mode 100644 yawmppp/src/gtksetup/question.xpm create mode 100644 yawmppp/src/isprc.c create mode 100644 yawmppp/src/isprc.h create mode 100644 yawmppp/src/list.c create mode 100644 yawmppp/src/list.h create mode 100644 yawmppp/src/misc.c create mode 100644 yawmppp/src/misc.h create mode 100644 yawmppp/src/stepphone.xpm create mode 100644 yawmppp/src/thinppp/Makefile.in create mode 100644 yawmppp/src/thinppp/backxpm.xpm create mode 100644 yawmppp/src/thinppp/dataxpm.xpm create mode 100644 yawmppp/src/thinppp/thinppp.c create mode 100644 yawmppp/src/thinppp/thinppp.h create mode 100644 yawmppp/src/yawmppp.1x create mode 100644 yawmppp/src/ycommon.c create mode 100644 yawmppp/src/ycommon.h diff --git a/yawmppp/CHANGELOG b/yawmppp/CHANGELOG new file mode 100644 index 0000000..edb3e14 --- /dev/null +++ b/yawmppp/CHANGELOG @@ -0,0 +1,89 @@ + +CHANGELOG for YAWMPPP +$Id: CHANGELOG,v 1.2 2001/04/21 18:29:33 bergo Exp $ + +2.0.2 (Apr 21 2001) + * fixed minor bug when generating files with the + "don't generate login password pairs" option + turned on (a CONNECT line was not being added) + +2.0.1 (Mar 3 2001) + * fixed minor bug: the installation script now creates + the /etc/ppp/peers directory if it is missing. + +2.0.0 (Feb 22 2001) + * Revamped the way the GUI manages config files, now pppd + files go under /etc/ppp/peers (and you'll have to + exercise your root password sometimes when configuring + ISP info). Configuration now goes under ~/.yawmppp2 + * Changed RX/TX leds for arrows in the Window Maker applet. + * Dropped old named-based DNS support + * Added support for the usepeerdns option in pppd. + +1.2.1 (Apr 12 2000) + * Increased Modem Init Strings maximum size from 64 to + 256 characters. + +1.2.0 (Apr 3 2000) + * Fixed bug regarding user names made up of digits + only. + * Added the yawmppp.thin applet. + * Made the -caution option default. + * Bug fix: now modem init strings may contain spaces. + * Bug fix: the config applet wasn't recognizing the first + init string, it was putting ATZ always. As no one has + complained about it, I'm surprised to know that ATZ is + good for everyone :) + +1.1.3 (Mar 24 2000) + * Fixed bug in Help system (memory buffer for man pages was too + small and the Configuration program dumped core). Now the + buffers are initialized with 128K instead of 64K and will grow + on demand. Thanks to Thomas Hood for reporting this one. + * Added the -caution and -paranoid command line options, meant to + help PCMCIA & APM users. + * Minor documentation fixes. + +1.1.2 (Mar 20 2000) + * Added the online help (er... man) system. + * Tried to fix a compilation bug that happened with Debian regarding the + double inclusion of linux/socket.h and sys/socket.h. I don't have + a Debian system to test, so I don't know for sure if it will work + right now (Debian only). + * Added the --with-x-include-dirs= option to the configure script. This + should be helpful for FreeBSD users. + * Due to the change below, changed the caption on the + "Post-login conversation" button to "Additional conversation". + * Added the "Don't generate login/password pairs" checkbox to help people + with even stranger ISP conversations. I can't keep it simple if ISPs can't. + * Fixed bug in expect/send pair parsing, now usernames, passwords, + and all expected/sent strings may contain spaces and escaped + quotes (\"). + * Fixed stop.* script generation (missing space between + quote and bracket, thanks to Igor Marinovic for reporting + it) + * Fixed W,X,Y,Z characters which were apeearing swapped on the + dock applet display. + +1.1.1 (Mar 11 2000) + * Fixed small bug in configure script that would prevent + yawmppp from building in some FreeBSD systems. + +1.1.0 (Mar 7 2000) + * Added tooltips to most widgets in the PPP page. + * Added capability for more multiple expect/send pairs in the + entries. + * Added support for PAP/CHAP related options in the pppd + command line (the secrets must still be set manually in + the secret files, read the FAQ for furhter information) + +1.0.1 (Feb 29 2000) + + * Added "user " to command line of pppd, + which may help PAPers and CHAPers. + + * Some of the options shown with yawmppp -h were + bogus. Took them out. + +1.0.0 (Feb 14 2000) + * First public release diff --git a/yawmppp/COPYING b/yawmppp/COPYING new file mode 100644 index 0000000..a43ea21 --- /dev/null +++ b/yawmppp/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/yawmppp/FAQ b/yawmppp/FAQ new file mode 100644 index 0000000..a7a2df4 --- /dev/null +++ b/yawmppp/FAQ @@ -0,0 +1,164 @@ + +YAWMPPP FAQ +$Id: FAQ,v 1.2 2001/04/21 18:29:33 bergo Exp $ + +1 Generic +1.1 How can I see what is going on with my connection ? + +1.2 Nothing happens when I hit the "V" button. + +1.3 Yawmppp/pppd complain about not having root privileges. + +1.4 Why doesn't it shows with the NeXTSTEP(tm) look + in my system as it does in the screenshots ? + +1.X Where can I get more info ? + + +2 Specific +2.1 How do I setup PAP/CHAP ? + +2.2 My modem dials, connects, but hangs up some seconds later. + What is happening ? + +--------------------------------------------------------------------------- + +Q1.1: How can I see what is going on with my connection ? + +A1.1: The ppp daemon throws lots of logging information (if asked to), + but some of this information may get lost. + Change your /etc/syslog.conf file so that is has a line + + daemon,local2.debug,daemon.notice /etc/ppp/log + + (the separation is made out of *tabs*, NOT spaces!) + + and create a zero-sized log file: + + touch /etc/ppp/log + + Then restart the syslog daemon (e.g.: send a SIGHUP to it as root). + Then enable the debug and kdebug options at yawmppp.pref's PPP options + notebook page. + + The log file should give more information than you actually need. + Even if you don't want to change your logging configuration, some of + pppd's log output may go to /var/log/messages. + + + +Q1.2: Nothing happens when I hit the "V" button. + +A1.2: The pppd daemon requires root privileges to run. The solution here is + to set the setuid bit on pppd's executable: + + chmod 4755 `which pppd` + + You must run this as root. Notice that the quotes are backticks. + + + +Q1.3: Yawmppp/pppd complain about not having root privileges. + +A1.3: Maybe you're trying a noauth connection with a non-setuid pppd. If you + really need to keep pppd non-setuid root, add the + + noauth + + line to your + + /etc/ppp/options + + file. + +Q1.4: Why doesn't it shows with the NeXTSTEP(tm) look + in my system as it does in the screenshots ? + +A1.4: The GTK+ GUI toolkit allows themeing. It means that you may turn + your GTK+ applications to look like Macintosh(tm), Aqua(tm), + NeXT(tm) or whatever you want. Even Windows(tm) if you're sick + enough for it. + You can make your themes or download ready ones (faster). + + There are lots of GTK+ themes at + + http://gtk.themes.org + + You can browse documentation on how to add the themes at the same + site. To use gtk.themes.org pixmap themes you'll probably need + the gtk-engines and imlib packages, you can find them perusing + the site. + + The NeXT look seen in the screenshots at yawmppp.seul.org is + provided by the Xenophilia engine: + + http://www.obsession.se/johan/gtk.html + + (if this link ever gets broken, search for Xenophilia at + freshmeat.net) + +Q1.X: Where can I get more info ? + +A1.X: You can read the PPP-HOWTO and ISP-Hookup-HOWTO from the LDP + (Linux Documentation Project), available from + + http://sunsite.unc.edu/LDP/HOWTO/ + + (Linux distributions may have it installed under /usr/doc/HOWTO) + + + You can also read the ppp FAQ that comes with ppp's source, which + can be downloaded from: + + ftp://cs.anu.edu.au/pub/software/ppp + + +Q2.1: How do I setup PAP/CHAP ? + +A2.1: PAP and CHAP are authentication protocols and some ISPs require them to + be used. Their purpose is to confirm identity throughout the connection. + Unless you're afraid of someone tapping your phone line and transmitting + "bogus" data through YOUR PPP link, you should not worry about it, unless + your ISP does. + + First, you'll have to set yawmppp.pref's local PPP options on your + ISP entry to reflect the desired behaviour about CHAP/PAP. + If your ISP doesn't even present a login prompt, you'll want to + check the "don't generate login/password pairs" in the "More Settings" + dialog. + + Then, as root, edit /etc/ppp/chap-secrets and/or /etc/ppp/pap-secrets + as desired. + The ppp FAQ (included in the source distribution of ppp) tells the nitty + gritty, but basically you'll have a set of lines, one for each ISP that + reads like this: + + username * password + + where username is your username, password is your password. The + first * means the server (any) and the second * means the allowed IPs + (any). The log output of ppp may help you if you still can't get a + conection. Read Q1.1 for instructions to get the most of ppp's log. + + + +Q2.2: My modem dials, connects, but hangs up some seconds later. + What is happening ? + +A2.2: There are several possibilities, which you will only be sure by reading the + logs. Here they are: + + 1. bad login/password, or your ISP is under maintenance and refused login + + 2. the ISP required CHAP/PAP authentication and you either didn't have + a proper secret to give in the secret files (read Q2.1), or + has the refuse-chap/refuse-pap options on, or had a bad (wrong) secret. + If this is the case, asking help from your ISP is a good idea. + + 3. your ISP is taking too long to answer for the initial PPP requests. + It may be busy, buggy, bad configured, or gone BSOD (Q2.3). + You can try setting on the "passive" option or increase the + lcp-max-configure number. + + +--- diff --git a/yawmppp/INSTALL b/yawmppp/INSTALL new file mode 100644 index 0000000..ecba820 --- /dev/null +++ b/yawmppp/INSTALL @@ -0,0 +1,82 @@ +Installation instructions for YAWMPPP. + +Upgrading ? +----------- +If so, just follow the usual INSTALL instructions, run +yawmppp.pref and click Ok or Apply. It will not +damage your previous versions' ISP entries or log, and will write the +new pppd command line to your ~/.yawmppp scripts. + +Upgrading from 1.x.x to 2.x.x: +------------------------------ +The configuration files of 2.x.x are placed separated from 1.x.x +files. You are can uninstall 1.x.x before installing 2.x.x, but it +isn't necessary. (to do so, unpack the 1.x.x tar.gz, configure and +make uninstall). + + +Just notice that if you chmod'ed the files in ~/.yawmppp to +prevent yawmppp from overwriting your manual changes, the +new version will not be able to add new data to them, ok ? + +NOTE! +-------------------------------------------------------------- +Installing this program requires root privileges, ask your +local system/network administrator kindly if she/he wants +to install this software for you ;-) + +you need root access for installation. + +What the installation will do +---------------------------------------------------------- + + The installation requires a program + be copied to /etc/ppp: + + /etc/ppp/yagetmodemspeed + + and will also copy an icon to /usr/local/share/icons + + the yawmppp binaries will be installed in + /usr/local/bin (you can change the /usr/local prefix, + see below) + + /usr/local/bin/yawmppp + /usr/local/bin/yawmppp.pref + /usr/local/bin/yawmppp.log + + the documentation will be installed in + /usr/local/doc/yawmppp- + + and yawmppp's man page will be placed in + /usr/local/man/man1 + +Installation +-------------------------------------------------------------- +1) % tar zxvf yawmppp-2.x.x.tar.gz +2) % cd yawmppp-2.x.x +3) % ./configure +4) % make +5) % su +6) # make install + +As non-privileged user: + +7) % yawmppp & (try 'yawmppp -h &' for help) + +If you have no ISP entries configured you'll see the yawmppp.pref +GUI. + +FreeBSD note: if configure fails to find the X11 includes you may have +to use the --with-x-includes=DIR option, type "configure --help" for +information. + +Extras +-------------------------------------------------------------- + +Changing the prefix: if you want the binaries to be installed +somewhere else than /usr/local, do a + +./configure --prefix=/where/I/want/the/prefix/to/be + +in the 3) step above. diff --git a/yawmppp/Makefile.in b/yawmppp/Makefile.in new file mode 100644 index 0000000..e88bbdf --- /dev/null +++ b/yawmppp/Makefile.in @@ -0,0 +1,42 @@ +# YAWMPPP toplevel Makefile + +#GTKLIB = @GTK_LIBS@ +#GTKFLAG = @GTK_FLAGS@ +#RLFLAG = -DVERSION=\"@MK_YAWMPPP_RELEASE@\" +PROGINST = @INSTALL@ + +all: build_src + +build_src: + @$(MAKE) -C src + +install: + @$(MAKE) -C src install + $(PROGINST) -d -g 0 -o 0 -m 0755 @prefix@/doc/yawmppp-@MK_YAWMPPP_RELEASE@ + $(PROGINST) -g 0 -o 0 -m 0644 README @prefix@/doc/yawmppp-@MK_YAWMPPP_RELEASE@ + $(PROGINST) -g 0 -o 0 -m 0644 COPYING @prefix@/doc/yawmppp-@MK_YAWMPPP_RELEASE@ + $(PROGINST) -g 0 -o 0 -m 0644 CHANGELOG @prefix@/doc/yawmppp-@MK_YAWMPPP_RELEASE@ + $(PROGINST) -g 0 -o 0 -m 0644 INSTALL @prefix@/doc/yawmppp-@MK_YAWMPPP_RELEASE@ + $(PROGINST) -g 0 -o 0 -m 0644 FAQ @prefix@/doc/yawmppp-@MK_YAWMPPP_RELEASE@ + +install-strip: + @$(MAKE) -C src install-strip + $(PROGINST) -d -g 0 -o 0 -m 0755 @prefix@/doc/yawmppp-@MK_YAWMPPP_RELEASE@ + $(PROGINST) -g 0 -o 0 -m 0644 README @prefix@/doc/yawmppp-@MK_YAWMPPP_RELEASE@ + $(PROGINST) -g 0 -o 0 -m 0644 COPYING @prefix@/doc/yawmppp-@MK_YAWMPPP_RELEASE@ + $(PROGINST) -g 0 -o 0 -m 0644 CHANGELOG @prefix@/doc/yawmppp-@MK_YAWMPPP_RELEASE@ + $(PROGINST) -g 0 -o 0 -m 0644 INSTALL @prefix@/doc/yawmppp-@MK_YAWMPPP_RELEASE@ + $(PROGINST) -g 0 -o 0 -m 0644 FAQ @prefix@/doc/yawmppp-@MK_YAWMPPP_RELEASE@ + +uninstall: + @echo "----> Uninstalling YAWMPPP from prefix @prefix@" + rm -f @prefix@/bin/yawmppp @prefix@/bin/yawmppp.pref @prefix@/bin/yawmppp.log /etc/ppp/managednsonthefly /etc/ppp/yagetmodemspeed @prefix@/share/icons/redphone.xpm @prefix@/share/icons/pppdoc.xpm @prefix@/share/icons/pedestal.xpm @prefix@/man/man1/yawmppp.1x + rm -rf @prefix@/doc/yawmppp* + @echo "----> done." + +clean: + @$(MAKE) -C src clean + +distclean: + @$(MAKE) -C src distclean + rm -f config.* Makefile *~ diff --git a/yawmppp/README b/yawmppp/README new file mode 100644 index 0000000..9dde441 --- /dev/null +++ b/yawmppp/README @@ -0,0 +1,278 @@ + + YAWMPPP + version 2.0.2 + Yet Another PPP Window Maker dock applet + (C) 2000 Felipe Bergo + +Table of Contents + +Overview +Requirements +Installing +Features +Files +Reporting Bugs +Usage Hints + Programs + Interface Guide + Window Manager Placement + Configuration + DNS Servers + Modem Ports + Login/Password expects + Trouble? +More Documentation + +Overview +-------- + +YAWMPPP sits in Window Maker's dock (or AfterStep's Wharf, or keeps +standing as a 64x64 window with other Window Managers) and manages +PPP connections. For window managers not capable of docking +yawmppp also provides a bar shaped version (yawmppp.thin). + +It includes a GUI to easily setup your ISP entries, so that you +don't need to edit CHAT scripts. + +YAWMPPP is distributed under the terms of the GNU General Public +License, version 2 or later (at your choice). A copy of the +license is provided in the file COPYING in this same directory. + +Requirements +------------ + +YAWMPPP is known to run on Linux (tested with 2.2 kernels) and FreeBSD +(tested with 3.4-RELEASE) and has been reported to work with NetBSD 1.5. + +You'll need: + +- root access to install YAWMPPP + +- A kernel with PPP support compiled in. + +- pppd, the ppp daemon, installed in /usr/sbin/pppd + (currently this path mandatory for the builtin scripts to + work). If you wish to use YAWMPPP as non-root pppd must + have the setuid bit set. The RedHat installation already + brings this set. + Version 2.3.11 or newer is recommended. + +- the "chat" program (usually included in the pppd package, comes + with the FreeBSD distribution too). + +- GTK+ 1.2.1 or greater. 1.2.6 recommended. + If you don't have it you can grab it from + + http://www.gtk.org + + Remember to get the GLib too (needed by GTK+). + + On RedHat-based systems (RedHat itself, Mandrake, Conectiva, + Independence, etc.) you'll need these packages installed to + compile YAWMPPP: + + glib-1.2.x + glib-devel-1.2.x + gtk+-1.2.x + gtk+-devel-1.2.x + +Author: Felipe Bergo , who built YAWMPPP + using code from the WMPPP application developed by + Martijn Pieterse and Antoine Nulle. + + YAWMPPP's web page is located at + http://yawmppp.seul.org + + For more information on WMPPP see + http://windowmaker.mezaway.org + +Installing +---------- + +Read the file INSTALL for instructions. Be sure to read this file +entirely before using YAWMPPP + +Features +-------- +YAWMPPP features all things the standard pppd offers and gives +you some additional amusements: + + * Integrated online timer; + * Integrated modem RX/TX LED's; + * Integrated YAWMPPP status LED; + * Integrated autoscaling PPP transfer statistics; + * Integrated bytes/second Speed-O-Meter; + * Automatic detection of active ppp interfaces; + * Several commandline options (try '-h' for help); + * Easy ISP configuration GUI + * Multiple ISP entries support + * Logging facility with GUI viewer + +Files +----- +README This file. +INSTALL Installation instructions. +CHANGELOG Description of changes. +COPYING GNU General Public License Version 2. +FAQ Frequently Asked Questions + + +Reporting Bugs +-------------- +If you discover any bugs in this software, please send a +bug report to bergo@seul.org and describe the +problem as detailed as you can. + + +Usage Hints +----------- + +First of all: you can type "man yawmppp" for help at the command line. + +Programs: +--------- + +yawmppp - The PPP dock applet +yawmppp.thin - A PPP applet for non dock-capable window managers + (e.g. Enlightenment, Sapphire...) +yawmppp.pref - The Dialing setup tool (can be run from + yawmppp by clicking the left mouse + button in the display area) +yawmppp.log - The log view tool (can be run from yawmppp + by clicking the middle or right mouse buttons + in the display area) + +Interface guide (yawmppp) +------------------------- +Please, don't laugh at the drawing. + ++-----------------------------+ A : Connection timer +|+---------------------------+| +||AAAAAAAAAAA BB CC DD || B : RX LED (blinks when PPP packets +||AAAAAAAAAAA BB CC DD || are received) +|| || +||EEEEEEEEEEEEEEEEEEEEEEEEEEE|| C : TX LED (blinks when PPP packets +||EEEEEEEEEEEEEEEEEEEEEEEEEEE|| are sent) +||EEEEEEEEEEEEEEEEEEEEEEEEEEE|| +||EEEEEEEEEEEEEEEEEEEEEEEEEEE|| D : ON/OFF LED: dark when there is no +|| || active connection, GREEN if +||FFFFFFFFFF GGGGGGGGGGGGG|| the connection is up, YELLOW +||FFFFFFFFFF GGGGGGGGGGGGG|| while dialing, RED on error. +|+---------------------------+| +|+-----++-----+ +-----++-----+| E : Speed history +|| || | | || || +|| < || > | | V || X || F : ISP entry name (short) +|| || | | || || +|+-----++-----+ +-----++-----|| G : Connection speed, speed-o-meter, ++-----------------------------+ error messages + + < : selects prior ISP. You can't change + the ISP entry while online + + > : selects next ISP. + + V : connects to currently selected ISP + + X : closes current connection. + +You can click the display area with the left mouse button to open the +ISP configuration tool (yawmppp.pref) or with any other mouse button +to open the connection log viewer (yawmppp.log). + +Window Manager Placement +------------------------ +Window Maker: Window Maker users simply drag and drop YAWMPPP on + the WindowMaker Dock or the Clip. + Press the right mouse button on YAWMPPP's outer edges and + select "Settings..." from the popup menu that appears. + Enable the 'Start when WindowMaker is started' option, + then click on the 'OK' button in the Docked Applications + Panel. + +AfterStep: Afterstep users put something like this in their Wharf rc + file "Wharf yawmppp - MaxSwallow "yawmppp" yawmppp &" + (this should be somewhere under ~/GNUstep/Library/AfterStep) + +Elsewhere: For other windowmanagers, YAWMPPP runs nicely as a 64x64 + pixel shaped icon on your desktop. You may prefer to run + yawmppp.thin when not using Window Maker or AfterStep. + +Configuration +------------- + +YAWMPPP's configuration files stay beneath ~/.yawmppp2, which will +be created as soon as you run yawmppp for the first time. The main +configuration file is yawmppprc. You should use the yawmppp.pref +application to create your entries. If you're willing to edit entries +by hand, create some bogus entries with yawmppp.pref and take a look +at the generated files for hints. It should be easy to figure out. + +The format has changed since YAWMPPP 1.x.x, thus the +directory has changed (from ~/.yawmppp to ~/.yawmppp2). + +Don't try copying files between 1.x.x and 2.x.x versions. + +Modem ports +----------- +On Linux the serial ports are (or at least should be :-) ): + +/dev/cua0 _or_ /dev/ttyS0 : DOS' COM1 +/dev/cua1 _or_ /dev/ttyS1 : " COM2 +/dev/cua2 _or_ /dev/ttyS2 : " COM3 +/dev/cua3 _or_ /dev/ttyS3 : " COM4 + +If you don't know where your modem is, type + + dmesg | grep tty + +It should print something like + + ttyS00 at 0x03f8 (irq = 4) is a 16550A + ttyS01 at 0x02f8 (irq = 3) is a 16550A + ttyS02 at 0x03e8 (irq = 4) is a 16550A + +If it shows the wrong irq to you, add a setserial command +to one of your boot time scripts (maybe /etc/rc.d/rc.local) +like: + + /bin/setserial /dev/ttyS2 irq 10 + +See "man setserial" for more information. + +On FreeBSD the dialout serial ports are + + /dev/cuaa0 (kernel interface sio0) + /dev/cuaa1 (kernel interface sio1) + /dev/cuaa2 (kernel interface sio2) + /dev/cuaa3 (kernel interface sio3) + +If it fails to recognize your modem's port, or gives it the wrong +IRQ, you have to compile a new kernel with the correct settings. +Read the FreeBSD handbook if don't know how to do this +(/usr/share/doc/books/handbook) + +Login/Password Expects +---------------------- +The supplied expects for login and password are rather common, +but if it fails, connect to your ISP using a standard communication +program (like minicom) and watch what the ISP sends to ask for +login and password. + +Trouble? +-------- +Read the FAQ in this same directory. + +More Documentation +------------------ +Linux users can read the ISP-Hookup and PPP howtos. These howtos +are available from + + http://sunsite.unc.edu/LDP/HOWTO/ + +If you are on a major Linux distribution the HOWTOs should be +installed. Try looking beneath /usr/doc. + +You may also get the ppp source and read the FAQ included, it is +at + + ftp://cs.anu.edu.au/pub/software/ppp diff --git a/yawmppp/TODO b/yawmppp/TODO new file mode 100644 index 0000000..6ebf32d --- /dev/null +++ b/yawmppp/TODO @@ -0,0 +1,8 @@ + +Yawmppp TODO + + +- Provide an easy way for the user to browse the chat/ppp logs. This + is tough because of security guards put around the log files, I'm + wondering a way to make it (securely). + diff --git a/yawmppp/configure b/yawmppp/configure new file mode 100755 index 0000000..5e55d91 --- /dev/null +++ b/yawmppp/configure @@ -0,0 +1,2531 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help + --with-x use the X Window System" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=src/gtksetup/applet.c + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + + +# Extract the first word of "make", so it can be a program name with args. +set dummy make; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:532: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_GNU_MAKE'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$GNU_MAKE"; then + ac_cv_prog_GNU_MAKE="$GNU_MAKE" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_GNU_MAKE="yes" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +GNU_MAKE="$ac_cv_prog_GNU_MAKE" +if test -n "$GNU_MAKE"; then + echo "$ac_t""$GNU_MAKE" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "sed", so it can be a program name with args. +set dummy sed; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:561: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_GOTSED'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$GOTSED"; then + ac_cv_prog_GOTSED="$GOTSED" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_GOTSED="yes" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_GOTSED" && ac_cv_prog_GOTSED="no" +fi +fi +GOTSED="$ac_cv_prog_GOTSED" +if test -n "$GOTSED"; then + echo "$ac_t""$GOTSED" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:591: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:621: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:672: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:704: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 715 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:720: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:746: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:751: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:779: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:841: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:895: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:916: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:933: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:950: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:975: checking for ANSI C header files" >&5 +if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#include +#include +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:988: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + ac_cv_header_stdc=yes +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. +if test "$cross_compiling" = yes; then + : +else + cat > conftest.$ac_ext < +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int main () { int i; for (i = 0; i < 256; i++) +if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); +exit (0); } + +EOF +if { (eval echo configure:1055: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + +ac_safe=`echo "unistd.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for unistd.h""... $ac_c" 1>&6 +echo "configure:1080: checking for unistd.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1090: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +{ echo "configure: error: required header file missing" 1>&2; exit 1; } +fi + +ac_safe=`echo "sys/wait.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for sys/wait.h""... $ac_c" 1>&6 +echo "configure:1114: checking for sys/wait.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1124: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +{ echo "configure: error: required header file missing" 1>&2; exit 1; } +fi + +ac_safe=`echo "sys/stat.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for sys/stat.h""... $ac_c" 1>&6 +echo "configure:1148: checking for sys/stat.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1158: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +{ echo "configure: error: required header file missing" 1>&2; exit 1; } +fi + +ac_safe=`echo "sys/param.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for sys/param.h""... $ac_c" 1>&6 +echo "configure:1182: checking for sys/param.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1192: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +{ echo "configure: error: required header file missing" 1>&2; exit 1; } +fi + +ac_safe=`echo "sys/types.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for sys/types.h""... $ac_c" 1>&6 +echo "configure:1216: checking for sys/types.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1226: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +{ echo "configure: error: required header file missing" 1>&2; exit 1; } +fi + +ac_safe=`echo "sys/ioctl.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for sys/ioctl.h""... $ac_c" 1>&6 +echo "configure:1250: checking for sys/ioctl.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1260: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +{ echo "configure: error: required header file missing" 1>&2; exit 1; } +fi + +ac_safe=`echo "sys/socket.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for sys/socket.h""... $ac_c" 1>&6 +echo "configure:1284: checking for sys/socket.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1294: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +{ echo "configure: error: required header file missing" 1>&2; exit 1; } +fi + + +# If we find X, set shell vars x_includes and x_libraries to the +# paths, otherwise set no_x=yes. +# Uses ac_ vars as temps to allow command line to override cache and checks. +# --without-x overrides everything else, but does not touch the cache. +echo $ac_n "checking for X""... $ac_c" 1>&6 +echo "configure:1322: checking for X" >&5 + +# Check whether --with-x or --without-x was given. +if test "${with_x+set}" = set; then + withval="$with_x" + : +fi + +# $have_x is `yes', `no', `disabled', or empty when we do not yet know. +if test "x$with_x" = xno; then + # The user explicitly disabled X. + have_x=disabled +else + if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then + # Both variables are already set. + have_x=yes + else +if eval "test \"`echo '$''{'ac_cv_have_x'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # One or both of the vars are not set, and there is no cached value. +ac_x_includes=NO ac_x_libraries=NO +rm -fr conftestdir +if mkdir conftestdir; then + cd conftestdir + # Make sure to not put "make" in the Imakefile rules, since we grep it out. + cat > Imakefile <<'EOF' +acfindx: + @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' +EOF + if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then + # GNU make sometimes prints "make[1]: Entering...", which would confuse us. + eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` + # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. + for ac_extension in a so sl; do + if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && + test -f $ac_im_libdir/libX11.$ac_extension; then + ac_im_usrlibdir=$ac_im_libdir; break + fi + done + # Screen out bogus values from the imake configuration. They are + # bogus both because they are the default anyway, and because + # using them would break gcc on systems where it needs fixed includes. + case "$ac_im_incroot" in + /usr/include) ;; + *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;; + esac + case "$ac_im_usrlibdir" in + /usr/lib | /lib) ;; + *) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;; + esac + fi + cd .. + rm -fr conftestdir +fi + +if test "$ac_x_includes" = NO; then + # Guess where to find include files, by looking for this one X11 .h file. + test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h + + # First, try using that file with no special directory specified. +cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1389: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + # We can compile using X headers with no special include directory. +ac_x_includes= +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + # Look for the header file in a standard set of common directories. +# Check X11 before X11Rn because it is often a symlink to the current release. + for ac_dir in \ + /usr/X11/include \ + /usr/X11R6/include \ + /usr/X11R5/include \ + /usr/X11R4/include \ + \ + /usr/include/X11 \ + /usr/include/X11R6 \ + /usr/include/X11R5 \ + /usr/include/X11R4 \ + \ + /usr/local/X11/include \ + /usr/local/X11R6/include \ + /usr/local/X11R5/include \ + /usr/local/X11R4/include \ + \ + /usr/local/include/X11 \ + /usr/local/include/X11R6 \ + /usr/local/include/X11R5 \ + /usr/local/include/X11R4 \ + \ + /usr/X386/include \ + /usr/x386/include \ + /usr/XFree86/include/X11 \ + \ + /usr/include \ + /usr/local/include \ + /usr/unsupported/include \ + /usr/athena/include \ + /usr/local/x11r5/include \ + /usr/lpp/Xamples/include \ + \ + /usr/openwin/include \ + /usr/openwin/share/include \ + ; \ + do + if test -r "$ac_dir/$x_direct_test_include"; then + ac_x_includes=$ac_dir + break + fi + done +fi +rm -f conftest* +fi # $ac_x_includes = NO + +if test "$ac_x_libraries" = NO; then + # Check for the libraries. + + test -z "$x_direct_test_library" && x_direct_test_library=Xt + test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc + + # See if we find them without any special options. + # Don't add to $LIBS permanently. + ac_save_LIBS="$LIBS" + LIBS="-l$x_direct_test_library $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + LIBS="$ac_save_LIBS" +# We can link X programs with no special library path. +ac_x_libraries= +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + LIBS="$ac_save_LIBS" +# First see if replacing the include by lib works. +# Check X11 before X11Rn because it is often a symlink to the current release. +for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \ + /usr/X11/lib \ + /usr/X11R6/lib \ + /usr/X11R5/lib \ + /usr/X11R4/lib \ + \ + /usr/lib/X11 \ + /usr/lib/X11R6 \ + /usr/lib/X11R5 \ + /usr/lib/X11R4 \ + \ + /usr/local/X11/lib \ + /usr/local/X11R6/lib \ + /usr/local/X11R5/lib \ + /usr/local/X11R4/lib \ + \ + /usr/local/lib/X11 \ + /usr/local/lib/X11R6 \ + /usr/local/lib/X11R5 \ + /usr/local/lib/X11R4 \ + \ + /usr/X386/lib \ + /usr/x386/lib \ + /usr/XFree86/lib/X11 \ + \ + /usr/lib \ + /usr/local/lib \ + /usr/unsupported/lib \ + /usr/athena/lib \ + /usr/local/x11r5/lib \ + /usr/lpp/Xamples/lib \ + /lib/usr/lib/X11 \ + \ + /usr/openwin/lib \ + /usr/openwin/share/lib \ + ; \ +do + for ac_extension in a so sl; do + if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then + ac_x_libraries=$ac_dir + break 2 + fi + done +done +fi +rm -f conftest* +fi # $ac_x_libraries = NO + +if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then + # Didn't find X anywhere. Cache the known absence of X. + ac_cv_have_x="have_x=no" +else + # Record where we found X for the cache. + ac_cv_have_x="have_x=yes \ + ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" +fi +fi + fi + eval "$ac_cv_have_x" +fi # $with_x != no + +if test "$have_x" != yes; then + echo "$ac_t""$have_x" 1>&6 + no_x=yes +else + # If each of the values was on the command line, it overrides each guess. + test "x$x_includes" = xNONE && x_includes=$ac_x_includes + test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries + # Update the cache value to reflect the command line values. + ac_cv_have_x="have_x=yes \ + ac_x_includes=$x_includes ac_x_libraries=$x_libraries" + echo "$ac_t""libraries $x_libraries, headers $x_includes" 1>&6 +fi + + +XINC="$x_includes" +XLIB="$x_libraries" + +if test "tmp$no_x" = "tmpyes" ; then + { echo "configure: error: +** You must have the X11R6 system. If you have an X11R6 system installed + and are seeing this message, try using the --x-includes and --x-libraries + options with configure. Use the --help option for help. + +" 1>&2; exit 1; } +fi + +ac_safe=`echo "X11/Xlib.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for X11/Xlib.h""... $ac_c" 1>&6 +echo "configure:1566: checking for X11/Xlib.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1576: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +echo "configure: warning: required header file missing ?" 1>&2 +fi + +ac_safe=`echo "X11/xpm.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for X11/xpm.h""... $ac_c" 1>&6 +echo "configure:1600: checking for X11/xpm.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1610: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +echo "configure: warning: required header file missing ?" 1>&2 +fi + +ac_safe=`echo "X11/extensions/shape.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for X11/extensions/shape.h""... $ac_c" 1>&6 +echo "configure:1634: checking for X11/extensions/shape.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1644: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +echo "configure: warning: required header file missing ?" 1>&2 +fi + + + + + +echo $ac_n "checking Operating System""... $ac_c" 1>&6 +echo "configure:1671: checking Operating System" >&5 +OSTYPE=`uname -s` +echo "$ac_t"""$OSTYPE"" 1>&6 + +SYSDEF="UNKNOWN" + +case $OSTYPE in + Linux) + ac_safe=`echo "asm/types.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for asm/types.h""... $ac_c" 1>&6 +echo "configure:1681: checking for asm/types.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1691: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +{ echo "configure: error: required header file missing" 1>&2; exit 1; } +fi + + ac_safe=`echo "linux/if.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for linux/if.h""... $ac_c" 1>&6 +echo "configure:1715: checking for linux/if.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1725: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +{ echo "configure: error: required header file missing" 1>&2; exit 1; } +fi + + ac_safe=`echo "linux/ppp_defs.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for linux/ppp_defs.h""... $ac_c" 1>&6 +echo "configure:1749: checking for linux/ppp_defs.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1759: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +{ echo "configure: error: required header file missing" 1>&2; exit 1; } +fi + + ac_safe=`echo "linux/if_ppp.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for linux/if_ppp.h""... $ac_c" 1>&6 +echo "configure:1783: checking for linux/if_ppp.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1793: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +{ echo "configure: error: required header file missing" 1>&2; exit 1; } +fi + + SYSDEF="LINUX" + ;; + FreeBSD) + ac_safe=`echo "net/if.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for net/if.h""... $ac_c" 1>&6 +echo "configure:1820: checking for net/if.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1830: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +{ echo "configure: error: required header file missing" 1>&2; exit 1; } +fi + + ac_safe=`echo "net/ppp_defs.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for net/ppp_defs.h""... $ac_c" 1>&6 +echo "configure:1854: checking for net/ppp_defs.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1864: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +{ echo "configure: error: required header file missing" 1>&2; exit 1; } +fi + + SYSDEF="FREEBSD" + ;; + OpenBSD) + echo "configure: warning: *************************************************" 1>&2 + echo "configure: warning: * *" 1>&2 + echo "configure: warning: * OpenBSD support not tested - if it works *" 1>&2 + echo "configure: warning: * please report to bergo@seul.org. Good Luck. *" 1>&2 + echo "configure: warning: * *" 1>&2 + echo "configure: warning: *************************************************" 1>&2 + sleep 2 + ac_safe=`echo "net/if.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for net/if.h""... $ac_c" 1>&6 +echo "configure:1898: checking for net/if.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1908: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +{ echo "configure: error: required header file missing" 1>&2; exit 1; } +fi + + ac_safe=`echo "net/ppp_defs.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for net/ppp_defs.h""... $ac_c" 1>&6 +echo "configure:1932: checking for net/ppp_defs.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1942: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +{ echo "configure: error: required header file missing" 1>&2; exit 1; } +fi + + SYSDEF="OPENBSD" + ;; + NetBSD) + echo "configure: warning: *************************************************" 1>&2 + echo "configure: warning: * *" 1>&2 + echo "configure: warning: * NetBSD support not tested - if it works *" 1>&2 + echo "configure: warning: * please report to bergo@seul.org. Good Luck. *" 1>&2 + echo "configure: warning: * *" 1>&2 + echo "configure: warning: *************************************************" 1>&2 + sleep 2 + ac_safe=`echo "net/if.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for net/if.h""... $ac_c" 1>&6 +echo "configure:1976: checking for net/if.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1986: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +{ echo "configure: error: required header file missing" 1>&2; exit 1; } +fi + + ac_safe=`echo "net/ppp_defs.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for net/ppp_defs.h""... $ac_c" 1>&6 +echo "configure:2010: checking for net/ppp_defs.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2020: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +{ echo "configure: error: required header file missing" 1>&2; exit 1; } +fi + + SYSDEF="NETBSD" + ;; +esac + +if test "$SYSDEF" = "UNKNOWN" ; then + ac_safe=`echo "net/if.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for net/if.h""... $ac_c" 1>&6 +echo "configure:2049: checking for net/if.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2059: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +{ echo "configure: error: required header file missing" 1>&2; exit 1; } +fi + + ac_safe=`echo "net/if_ppp.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for net/if_ppp.h""... $ac_c" 1>&6 +echo "configure:2083: checking for net/if_ppp.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2093: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +{ echo "configure: error: required header file missing" 1>&2; exit 1; } +fi + + ac_safe=`echo "net/ppp_defs.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for net/ppp_defs.h""... $ac_c" 1>&6 +echo "configure:2117: checking for net/ppp_defs.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2127: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +{ echo "configure: error: required header file missing" 1>&2; exit 1; } +fi + + echo "configure: warning: *************************************************" 1>&2 + echo "configure: warning: * *" 1>&2 + echo "configure: warning: * This system has not been tested. I will try *" 1>&2 + echo "configure: warning: * compiling with BSDish settings. If it works *" 1>&2 + echo "configure: warning: * please report to bergo@seul.org. Good Luck! *" 1>&2 + echo "configure: warning: * *" 1>&2 + echo "configure: warning: *************************************************" 1>&2 + sleep 2 + SYSDEF="BSDISH" +fi + + + + +# Extract the first word of "gtk-config", so it can be a program name with args. +set dummy gtk-config; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2166: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_GTKCONFIG'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$GTKCONFIG" in + /*) + ac_cv_path_GTKCONFIG="$GTKCONFIG" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_GTKCONFIG="$GTKCONFIG" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_GTKCONFIG="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GTKCONFIG" && ac_cv_path_GTKCONFIG="no" + ;; +esac +fi +GTKCONFIG="$ac_cv_path_GTKCONFIG" +if test -n "$GTKCONFIG"; then + echo "$ac_t""$GTKCONFIG" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test "$GTKCONFIG" = "no" ; then +{ echo "configure: error: +-(GTK >= 1.2.1 NOT FOUND)--------------------------------------- + The config application requires the GTK libary. See the + README for information on how to install GTK. +---------------------------------------------------------------- +" 1>&2; exit 1; } +else + GTK_LIBS=`$GTKCONFIG --libs` + GTK_FLAGS=`$GTKCONFIG --cflags` + + echo $ac_n "checking for gtk+ >=1.2.1""... $ac_c" 1>&6 +echo "configure:2212: checking for gtk+ >=1.2.1" >&5 + + GTK_MAJOR=`$GTKCONFIG --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` + GTK_MINOR=`$GTKCONFIG --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` + GTK_MICRO=`$GTKCONFIG --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` + + GTK121_FINE=1 + + if test $GTK_MAJOR -lt 1 ; then + GTK121_FINE=0 + else + if test $GTK_MAJOR -eq 1 ; then + if test $GTK_MINOR -lt 2 ; then + GTK121_FINE=0 + fi + if test $GTK_MINOR -eq 2 ; then + if test $GTK_MICRO -lt 1 ; then + GTK121_FINE=0 + fi + fi + fi + fi + + if test "$GTK121_FINE" = "1" ; then + echo "$ac_t""yes" 1>&6 + else + echo "$ac_t""no" 1>&6 + { echo "configure: error: +-(GTK >= 1.2.1 NOT FOUND)--------------------------------------- + The config application requires the GTK libary. See the + README for information on how to install GTK. +---------------------------------------------------------------- + +" 1>&2; exit 1; } + fi +fi + + + + +MK_YAWMPPP_RELEASE="2.0.2" + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile src/Makefile src/dockapp/Makefile src/gtksetup/Makefile src/gtklog/Makefile src/thinppp/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@GNU_MAKE@%$GNU_MAKE%g +s%@GOTSED@%$GOTSED%g +s%@CC@%$CC%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@CPP@%$CPP%g +s%@XINC@%$XINC%g +s%@XLIB@%$XLIB%g +s%@SYSDEF@%$SYSDEF%g +s%@GTKCONFIG@%$GTKCONFIG%g +s%@GTK_LIBS@%$GTK_LIBS%g +s%@GTK_FLAGS@%$GTK_FLAGS%g +s%@MK_YAWMPPP_RELEASE@%$MK_YAWMPPP_RELEASE%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + + +echo +echo "--> type make to compile yawmppp" +echo diff --git a/yawmppp/configure.in b/yawmppp/configure.in new file mode 100644 index 0000000..b6f6b77 --- /dev/null +++ b/yawmppp/configure.in @@ -0,0 +1,179 @@ +dnl configure.in for yawmppp +dnl by Felipe Bergo (bergo@seul.org) + +dnl Process this file with autoconf to produce a configure script. +AC_INIT(src/gtksetup/applet.c) +AC_PREREQ(2.0) + +AC_CHECK_PROG(GNU_MAKE,make,yes) +AC_CHECK_PROG(GOTSED,sed,yes,no) +AC_PROG_CC +AC_PROG_INSTALL + +AC_HEADER_STDC +AC_HEADER_CHECK(unistd.h,,AC_MSG_ERROR(required header file missing)) +AC_HEADER_CHECK(sys/wait.h,,AC_MSG_ERROR(required header file missing)) +AC_HEADER_CHECK(sys/stat.h,,AC_MSG_ERROR(required header file missing)) +AC_HEADER_CHECK(sys/param.h,,AC_MSG_ERROR(required header file missing)) +AC_HEADER_CHECK(sys/types.h,,AC_MSG_ERROR(required header file missing)) +AC_HEADER_CHECK(sys/ioctl.h,,AC_MSG_ERROR(required header file missing)) +AC_HEADER_CHECK(sys/socket.h,,AC_MSG_ERROR(required header file missing)) + +AC_PATH_X + +XINC="$x_includes" +XLIB="$x_libraries" + +if test "tmp$no_x" = "tmpyes" ; then + AC_MSG_ERROR( +[ +** You must have the X11R6 system. If you have an X11R6 system installed + and are seeing this message, try using the --x-includes and --x-libraries + options with configure. Use the --help option for help. +] +) +fi + +AC_HEADER_CHECK(X11/Xlib.h,,AC_MSG_WARN(required header file missing ?)) +AC_HEADER_CHECK(X11/xpm.h,,AC_MSG_WARN(required header file missing ?)) +AC_HEADER_CHECK(X11/extensions/shape.h,,AC_MSG_WARN(required header file missing ?)) + +AC_SUBST(XINC) +AC_SUBST(XLIB) + +AC_MSG_CHECKING(Operating System) +OSTYPE=`uname -s` +AC_MSG_RESULT("$OSTYPE") + +SYSDEF="UNKNOWN" + +case $OSTYPE in + Linux) + AC_HEADER_CHECK(asm/types.h,,AC_MSG_ERROR(required header file missing)) + AC_HEADER_CHECK(linux/if.h,,AC_MSG_ERROR(required header file missing)) + AC_HEADER_CHECK(linux/ppp_defs.h,,AC_MSG_ERROR(required header file missing)) + AC_HEADER_CHECK(linux/if_ppp.h,,AC_MSG_ERROR(required header file missing)) + SYSDEF="LINUX" + ;; + FreeBSD) + AC_HEADER_CHECK(net/if.h,,AC_MSG_ERROR(required header file missing)) +dnl AC_HEADER_CHECK(net/if_ppp.h,,AC_MSG_ERROR(required header file missing)) + AC_HEADER_CHECK(net/ppp_defs.h,,AC_MSG_ERROR(required header file missing)) + SYSDEF="FREEBSD" + ;; + OpenBSD) + AC_MSG_WARN(*************************************************) + AC_MSG_WARN(* *) + AC_MSG_WARN(* OpenBSD support not tested - if it works *) + AC_MSG_WARN(* please report to bergo@seul.org. Good Luck. *) + AC_MSG_WARN(* *) + AC_MSG_WARN(*************************************************) + sleep 2 + AC_HEADER_CHECK(net/if.h,,AC_MSG_ERROR(required header file missing)) +dnl AC_HEADER_CHECK(net/if_ppp.h,,AC_MSG_ERROR(required header file missing)) + AC_HEADER_CHECK(net/ppp_defs.h,,AC_MSG_ERROR(required header file missing)) + SYSDEF="OPENBSD" + ;; + NetBSD) + AC_MSG_WARN(*************************************************) + AC_MSG_WARN(* *) + AC_MSG_WARN(* NetBSD support not tested - if it works *) + AC_MSG_WARN(* please report to bergo@seul.org. Good Luck. *) + AC_MSG_WARN(* *) + AC_MSG_WARN(*************************************************) + sleep 2 + AC_HEADER_CHECK(net/if.h,,AC_MSG_ERROR(required header file missing)) +dnl AC_HEADER_CHECK(net/if_ppp.h,,AC_MSG_ERROR(required header file missing)) + AC_HEADER_CHECK(net/ppp_defs.h,,AC_MSG_ERROR(required header file missing)) + SYSDEF="NETBSD" + ;; +esac + +if test "$SYSDEF" = "UNKNOWN" ; then + AC_HEADER_CHECK(net/if.h,,AC_MSG_ERROR(required header file missing)) + AC_HEADER_CHECK(net/if_ppp.h,,AC_MSG_ERROR(required header file missing)) + AC_HEADER_CHECK(net/ppp_defs.h,,AC_MSG_ERROR(required header file missing)) + AC_MSG_WARN(*************************************************) + AC_MSG_WARN(* *) + AC_MSG_WARN(* This system has not been tested. I will try *) + AC_MSG_WARN(* compiling with BSDish settings. If it works *) + AC_MSG_WARN(* please report to bergo@seul.org. Good Luck! *) + AC_MSG_WARN(* *) + AC_MSG_WARN(*************************************************) + sleep 2 + SYSDEF="BSDISH" +fi + +AC_SUBST(SYSDEF) + +dnl now gtk + +AC_PATH_PROG(GTKCONFIG,gtk-config,no) + +if test "$GTKCONFIG" = "no" ; then +AC_MSG_ERROR( +[ +-(GTK >= 1.2.1 NOT FOUND)--------------------------------------- + The config application requires the GTK libary. See the + README for information on how to install GTK. +---------------------------------------------------------------- +]) +else + dnl check for gtk-version + GTK_LIBS=`$GTKCONFIG --libs` + GTK_FLAGS=`$GTKCONFIG --cflags` + + dnl test for Gtk+ >= 1.2.1 + AC_MSG_CHECKING(for gtk+ >=1.2.1) + + dnl copied from gtk+'s aclocal.m4. These guys must love sed + GTK_MAJOR=`$GTKCONFIG --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + GTK_MINOR=`$GTKCONFIG --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + GTK_MICRO=`$GTKCONFIG --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + + GTK121_FINE=1 + + if test $GTK_MAJOR -lt 1 ; then + GTK121_FINE=0 + else + if test $GTK_MAJOR -eq 1 ; then + if test $GTK_MINOR -lt 2 ; then + GTK121_FINE=0 + fi + if test $GTK_MINOR -eq 2 ; then + if test $GTK_MICRO -lt 1 ; then + GTK121_FINE=0 + fi + fi + fi + fi + + if test "$GTK121_FINE" = "1" ; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + AC_MSG_ERROR( +[ +-(GTK >= 1.2.1 NOT FOUND)--------------------------------------- + The config application requires the GTK libary. See the + README for information on how to install GTK. +---------------------------------------------------------------- +] +) + fi +fi + +AC_SUBST(GTK_LIBS) +AC_SUBST(GTK_FLAGS) + +MK_YAWMPPP_RELEASE="2.0.2" +AC_SUBST(MK_YAWMPPP_RELEASE) + +AC_OUTPUT(Makefile src/Makefile src/dockapp/Makefile src/gtksetup/Makefile src/gtklog/Makefile src/thinppp/Makefile) + +echo +echo "--> type make to compile yawmppp" +echo diff --git a/yawmppp/install-sh b/yawmppp/install-sh new file mode 100644 index 0000000..ebc6691 --- /dev/null +++ b/yawmppp/install-sh @@ -0,0 +1,250 @@ +#! /bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/yawmppp/src/Makefile.in b/yawmppp/src/Makefile.in new file mode 100644 index 0000000..b392a58 --- /dev/null +++ b/yawmppp/src/Makefile.in @@ -0,0 +1,71 @@ +# yawmppp/src + +CC = @CC@ +CFLAGS = -O2 -Wall +OBJS = isprc.o ycommon.o misc.o list.o +RLFLAG = -DVERSION=\"@MK_YAWMPPP_RELEASE@\" -D@SYSDEF@ +PROGINST = @INSTALL@ +GTKLIB = @GTK_LIBS@ +GTKFLAG = @GTK_FLAGS@ + +all: isprc.o ycommon.o misc.o list.o about_obj \ + build_dockapp build_gtksetup build_gtklog \ + build_thinppp + +$(OBJS): %.o : %.c %.h + $(CC) $(CFLAGS) $(RLFLAG) -o $@ -c $< + +about_obj: about.c about.h + $(CC) $(GTKFLAG) $(RLFLAG) -c about.c -o about.o + +build_gtklog: + @$(MAKE) -C gtklog + +build_dockapp: + @$(MAKE) -C dockapp + +build_thinppp: + @$(MAKE) -C thinppp + +build_gtksetup: + @$(MAKE) -C gtksetup + +install: + $(PROGINST) -m 0755 -d @prefix@/share/icons + $(PROGINST) -m 0755 -d @prefix@/man/man1 + $(PROGINST) -m 0755 -d @prefix@/bin + $(PROGINST) -m 0755 -d /etc/ppp + $(PROGINST) -m 0755 -d @prefix@/doc/yawmppp-@MK_YAWMPPP_RELEASE@ + $(PROGINST) -m 0644 stepphone.xpm @prefix@/share/icons/stepphone.xpm + $(PROGINST) -m 0644 yawmppp.1x @prefix@/man/man1/yawmppp.1x + @$(MAKE) -C dockapp install + @$(MAKE) -C thinppp install + @$(MAKE) -C gtksetup install + @$(MAKE) -C gtklog install + +install-strip: + $(PROGINST) -m 0755 -d @prefix@/share/icons + $(PROGINST) -m 0755 -d @prefix@/bin + $(PROGINST) -m 0755 -d /etc/ppp + $(PROGINST) -m 0755 -d @prefix@/doc/yawmppp-@MK_YAWMPPP_RELEASE@ + $(PROGINST) -m 0644 stepphone.xpm @prefix@/share/icons/stepphone.xpm + $(PROGINST) -m 0644 yawmppp.1x @prefix@/man/man1/yawmppp.1x + @$(MAKE) -C dockapp install-strip + @$(MAKE) -C thinppp install-strip + @$(MAKE) -C gtksetup install-strip + @$(MAKE) -C gtklog install-strip + +clean: + @$(MAKE) -C dockapp clean + @$(MAKE) -C thinppp clean + @$(MAKE) -C gtksetup clean + @$(MAKE) -C gtklog clean + rm -f $(OBJS) about.o *~ + +distclean: + @$(MAKE) -C dockapp distclean + @$(MAKE) -C thinppp distclean + @$(MAKE) -C gtksetup distclean + @$(MAKE) -C gtklog distclean + rm -f Makefile + diff --git a/yawmppp/src/about.c b/yawmppp/src/about.c new file mode 100644 index 0000000..e065427 --- /dev/null +++ b/yawmppp/src/about.c @@ -0,0 +1,120 @@ +/* + + YAWMPPP - PPP dock app/helper for WindowMaker + Copyright (C) 2000, 2001: + + Author: Felipe Bergo (bergo@seul.org) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + $Id: about.c,v 1.1.1.1 2001/02/22 06:15:21 bergo Exp $ + */ + +#include +#include +#include +#include +#include "about.h" + +#include "stepphone.xpm" + +GtkWidget *about; + +/* data must be a pointer to parent widget (GtkWindow) */ +void applet_about (GtkWidget * widget, gpointer data) +{ + GtkStyle *style; + GdkPixmap *phone; + GtkWidget *pi,*v,*h,*text,*h2,*b,*p,*v2; + char tabout[1024]; + GdkBitmap *mask; + int i; + + about=gtk_window_new(GTK_WINDOW_DIALOG); + gtk_window_set_transient_for(GTK_WINDOW(about),GTK_WINDOW(data)); + gtk_window_set_wmclass(GTK_WINDOW(about),"yawmppp","about"); + gtk_widget_realize(about); + gtk_window_set_policy(GTK_WINDOW(about),TRUE,TRUE,TRUE); + gtk_window_set_title (GTK_WINDOW (about), "About YAWMPPP"); + + style=gtk_widget_get_style(about); + phone=gdk_pixmap_create_from_xpm_d(about->window,&mask, + &style->bg[GTK_STATE_NORMAL], + (gchar **)stepphone_xpm); + pi=gtk_pixmap_new(phone,mask); + gdk_pixmap_unref(phone); + + v=gtk_vbox_new(FALSE,2); + gtk_container_add(GTK_CONTAINER(about),v); + + h=gtk_hbox_new(FALSE,2); + gtk_box_pack_start(GTK_BOX(v),h,FALSE,TRUE,2); + + v2=gtk_vbox_new(FALSE,4); + gtk_box_pack_start(GTK_BOX(h),v2,FALSE,FALSE,2); + gtk_box_pack_start(GTK_BOX(v2),pi,FALSE,FALSE,6); + + strcpy(tabout,"YAWMPPP\nYet Another PPP Dock Applet for Window Maker\n"); + strcat(tabout,"Version "); + strcat(tabout,VERSION); + strcat(tabout,"\nCopyright (C) 2000, 2001 Felipe Bergo\n"); + strcat(tabout,"email: bergo@seul.org\n\n"); + + strcat(tabout,"YAWMPPP is distributed under the terms of the GNU\n"); + strcat(tabout,"General Public License, version 2 or later.\n"); + strcat(tabout,"YAWMPPP comes with ABSOLUTELY NO WARRANTY;\n"); + strcat(tabout,"This is free software, and you are welcome to\n"); + strcat(tabout,"redistribute it under certain conditions.\n"); + strcat(tabout,"Read the file COPYING for details.\n\n"); + strcat(tabout,"To learn more about free software visit\n"); + strcat(tabout,"http://www.gnu.org\n"); + + text=gtk_label_new(tabout); + gtk_box_pack_start(GTK_BOX(h),text,FALSE,TRUE,2); + gtk_label_set_justify(GTK_LABEL(text),GTK_JUSTIFY_LEFT); + + h2=gtk_hbox_new(TRUE,2); + gtk_box_pack_start(GTK_BOX(v),h2,FALSE,TRUE,2); + + for(i=0;i<3;i++) { + p=gtk_label_new(" "); + gtk_box_pack_start(GTK_BOX(h2),p,FALSE,FALSE,2); + gtk_widget_show(p); + } + + b=gtk_button_new_with_label("Dismiss"); + gtk_box_pack_start(GTK_BOX(h2),b,FALSE,TRUE,4); + + gtk_container_set_border_width(GTK_CONTAINER(about),6); + + gtk_widget_show(b); + gtk_widget_show(text); + gtk_widget_show(pi); + gtk_widget_show(h2); + gtk_widget_show(h); + gtk_widget_show(v2); + gtk_widget_show(v); + gtk_widget_show(about); + gtk_signal_connect(GTK_OBJECT(b),"clicked", + GTK_SIGNAL_FUNC(about_dismiss),NULL); + gtk_grab_add(about); +} + +void +about_dismiss(GtkWidget *wid,gpointer data) +{ + gtk_grab_remove(about); + gtk_widget_destroy(about); +} diff --git a/yawmppp/src/about.h b/yawmppp/src/about.h new file mode 100644 index 0000000..a425fa5 --- /dev/null +++ b/yawmppp/src/about.h @@ -0,0 +1,8 @@ + +#ifndef ABOUT_H +#define ABOUT_H + +void about_dismiss(GtkWidget *wid,gpointer data); +void applet_about (GtkWidget * widget, gpointer data); + +#endif diff --git a/yawmppp/src/dockapp/Makefile.in b/yawmppp/src/dockapp/Makefile.in new file mode 100644 index 0000000..a73275e --- /dev/null +++ b/yawmppp/src/dockapp/Makefile.in @@ -0,0 +1,35 @@ +CC = @CC@ +LIBDIR = -L/usr/X11R6/lib -L@XLIB@ +LIBS = -lXpm -lXext -lX11 +CFLAGS = -O2 -Wall -I.. -I@XINC@ +RLFLAG = -DVERSION=\"@MK_YAWMPPP_RELEASE@\" -D@SYSDEF@ +OBJS = yawmppp.o wmgeneral.o +DOTHS = yawmppp.h wmgeneral.h ../misc.h ../list.h ../isprc.h ../ycommon.h +EOBJS = ../isprc.o ../ycommon.o ../misc.o ../list.o +PROGINST = @INSTALL@ +PIXMAPS = dockxpm.xpm + +all: yawmppp_bin getmodemspeed_bin + +$(OBJS): %.o : %.c $(DOTHS) $(PIXMAPS) + $(CC) -c $(CFLAGS) $(RLFLAG) $< -o $*.o + +yawmppp_bin: $(OBJS) + $(CC) -o yawmppp $^ $(EOBJS) -lXext $(LIBDIR) $(LIBS) + +getmodemspeed_bin: getmodemspeed.c + $(CC) $(CFLAGS) getmodemspeed.c -o yagetmodemspeed + +clean: + rm -f $(OBJS) yawmppp yagetmodemspeed + +distclean: + rm -f Makefile *~ + +install: + $(PROGINST) -m 0755 yawmppp @prefix@/bin/yawmppp + $(PROGINST) -m 0755 yagetmodemspeed /etc/ppp/yagetmodemspeed + +install-strip: + $(PROGINST) -s -m 0755 yawmppp @prefix@/bin/yawmppp + $(PROGINST) -s -m 0755 yagetmodemspeed /etc/ppp/yagetmodemspeed diff --git a/yawmppp/src/dockapp/dockxpm.xpm b/yawmppp/src/dockapp/dockxpm.xpm new file mode 100644 index 0000000..da791bb --- /dev/null +++ b/yawmppp/src/dockapp/dockxpm.xpm @@ -0,0 +1,228 @@ +/* XPM */ +static char * dockxpm_xpm[] = { +"64 192 33 1", +" c None", +". c #000000", +"+ c #202020", +"@ c #C7C3C7", +"# c #283C38", +"$ c #F7F3FF", +"% c #86828E", +"& c #AEAAAE", +"* c #139613", +"= c #0FAA0F", +"- c #0ABD0A", +"; c #06CE06", +"> c #04D604", +", c #07CA07", +"' c #0EAD0E", +") c #09C109", +"! c #00EA00", +"~ c #0ABC0A", +"{ c #05D305", +"] c #11A111", +"^ c #0CB70C", +"/ c #188318", +"( c #139713", +"_ c #0FA90F", +": c #B60418", +"< c #00EB00", +"[ c #E7C308", +"} c #71E371", +"| c #35C26D", +"1 c #0F9846", +"2 c #49C349", +"3 c #1ADF69", +"4 c #10773A", +" ", +" ", +" ", +" ", +" ", +" ........................................................ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .+++###+++###+++++++###+++###++++++++++++++++++++++++++@ ", +" .++#+++#+#+++#++#++#+++#+#+++#+++#######+++#+++++##++++@ ", +" .++#+++#+#+++#++#++#+++#+#+++#++++#####+++###+++####+++@ ", +" .+++###+++###+++++++###+++###++++++###+++#####++####+++@ ", +" .++#+++#+#+++#+++++#+++#+#+++#++++++#+++#######++##++++@ ", +" .++#+++#+#+++#++#++#+++#+#+++#+++++++++++++++++++++++++@ ", +" .+++###+++###+++#+++###+++###++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .######################################################@ ", +" .######################################################@ ", +" .######################################################@ ", +" .######################################################@ ", +" .######################################################@ ", +" .######################################################@ ", +" .######################################################@ ", +" .######################################################@ ", +" .######################################################@ ", +" .######################################################@ ", +" .######################################################@ ", +" .######################################################@ ", +" .######################################################@ ", +" .######################################################@ ", +" .######################################################@ ", +" .######################################################@ ", +" .######################################################@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .+####+####+####+####+####++++####+####+####++++++####+@ ", +" .+#++#+#++#+#++#+#++#+#++#++++#++#+#++#+#++#++++++#++#+@ ", +" .+#++#+#++#+#++#+#++#+#++#++++#++#+#++#+#++#+#++#+#++#+@ ", +" .+####+####+####+####+####++++####+####+####+#+#++####+@ ", +" .+#++#+#++#+#++#+#++#+#++#++++#++#+#++#+#++#+##+++#++#+@ ", +" .+#++#+#++#+#++#+#++#+#++#++++#++#+#++#+#++#+#+#++#++#+@ ", +" .+####+####+####+####+####++++####+####+####+#++#+####+@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", +" ", +" ", +" .......................... .......................... ", +" .$$$$$$$$$$$%$$$$$$$$$$$%@ .$$$$$$$$$$$%$$$$$$$$$$$%@ ", +" .$&&&&&&&&&&.$&&&&&&&&&&.@ .$&&&&&&&&&&.$&&&&&&&&&&.@ ", +" .$&&&&&.&&&&.$&&&&.&&&&&.@ .$&&&&&&..&&.$&..&&&..&&.@ ", +" .$&&&&..&&&&.$&&&&..&&&&.@ .$&&&&&...&&.$&...&...&&.@ ", +" .$&&&...&&&&.$&&&&...&&&.@ .$&..&...&&&.$&&.....&&&.@ ", +" .$&&....&&&&.$&&&&....&&.@ .$&.....&&&&.$&&&...&&&&.@ ", +" .$&&&...&&&&.$&&&&...&&&.@ .$&....&&&&&.$&&.....&&&.@ ", +" .$&&&&..&&&&.$&&&&..&&&&.@ .$&...&&&&&&.$&...&...&&.@ ", +" .$&&&&&.&&&&.$&&&&.&&&&&.@ .$&..&&&&&&&.$&..&&&..&&.@ ", +" .$&&&&&&&&&&.$&&&&&&&&&&.@ .$&&&&&&&&&&.$&&&&&&&&&&.@ ", +" .%...........%...........@ .%...........%...........@ ", +" @@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@ ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +"...........%...........%$$$$$$$$$$$%$$$$$$$$$$$% #######+++#+++", +".&&&&&&&&&&$.&&&&&&&&&&$$&&&&&&&&&&.$&&&&&&&&&&. +#####+++###++", +".&&&&&&..&&$.&..&&&..&&$$&&&&&&..&&.$&..&&&..&&. ++###+++#####+", +".&&&&&...&&$.&...&...&&$$&&&&&...&&.$&...&...&&. +++#+++#######", +".&..&...&&&$.&&.....&&&$$&..&...&&&.$&&.....&&&. ", +".&.....&&&&$.&&&...&&&&$$&.....&&&&.$&&&...&&&&. *=-;>;-+++,+++", +".&....&&&&&$.&&.....&&&$$&....&&&&&.$&&.....&&&. +')>!>+++~{!++", +".&...&&&&&&$.&...&...&&$$&...&&&&&&.$&...&...&&. ++-;>+++]^,{,+", +".&..&&&&&&&$.&..&&&..&&$$&..&&&&&&&.$&..&&&..&&. +++-+++/(_^~^_", +".&&&&&&&&&&$.&&&&&&&&&&$$&&&&&&&&&&.$&&&&&&&&&&. ", +"%$$$$$$$$$$$%$$$$$$$$$$$%...........%........... ", +" ", +"...........%...........%$$$$$$$$$$$%$$$$$$$$$$$% +##+ +::+ ", +".&&&&&&&&&&$.&&&&&&&&&&$$&&&&&&&&&&.$&&&&&&&&&&. #### :$:: ", +".&&&&&.&&&&$.&&&&.&&&&&$$&&&&&.&&&&.$&&&&.&&&&&. #### :::: ", +".&&&&..&&&&$.&&&&..&&&&$$&&&&..&&&&.$&&&&..&&&&. +##+ +::+ ", +".&&&...&&&&$.&&&&...&&&$$&&&...&&&&.$&&&&...&&&. ", +".&&....&&&&$.&&&&....&&$$&&....&&&&.$&&&&....&&. +<<+ +[[+ ", +".&&&...&&&&$.&&&&...&&&$$&&&...&&&&.$&&&&...&&&. <$<< [$[[ ", +".&&&&..&&&&$.&&&&..&&&&$$&&&&..&&&&.$&&&&..&&&&. <<<< [[[[ ", +".&&&&&.&&&&$.&&&&.&&&&&$$&&&&&.&&&&.$&&&&.&&&&&. +<<+ +[[+ ", +".&&&&&&&&&&$.&&&&&&&&&&$$&&&&&&&&&&.$&&&&&&&&&&. ", +"%$$$$$$$$$$$%$$$$$$$$$$$%...........%........... }#|1} ", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"###2+2}}2+2}}2+2##2+2}}2+2}}2+2}}2+2}}2+2}}2+2}}2+####+####+####", +"#++}+#++}+#++}+}++}+}++#+}++#+#++}+}++}+}++}+}++}+#++#+#++#+#++#", +"#++}+#++}+#++}+}++}+}++#+}++#+#++}+}++}+}++}+}++}+}++}+}++}+#++#", +"###2+2}}2+2}}2+2}}2+2}}2+2}}2+###2+2}}2+2}}2+2##2+}#}#+}}}}+####", +"#++}+}++#+#++}+#++}+#++}+}++}+#++}+}++}+#++}+}++}+}}+#+}++}+#++#", +"#++}+}++#+#++}+#++}+#++}+}++}+#++}+}++}+#++}+}++}+}+}#+}++}+#++#", +"###}+2}}2+2}}2+###2+2}}2+2}}2+###2+2}}2+2}}2+2}}2+}##}+}##}+####", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"2}}2+2}}2+2}}2+2}}2+2}}2++++####+####+####++++++####++++++++++++", +"}++#+}++}+}++}+}++}+}++}++++#++#+#++#+#++#++++++#++#++++++++++++", +"}++#+}++}+}++}+}++}+}++}++++#++#+#++#+#++#+#++#+#++#++++++++++++", +"2}}#+2}}++2}}++2##2+2}}+++++####+####+####+#+#++####++++++++++++", +"}++#+}++}+}++}+}++}+}++}++++#++#+#++#+#++#+##+++#++#++++++++++++", +"}++#+}++}+}++}+}++}+}++}++++#++#+#++#+#++#+#+#++#++#++++++++++++", +"2}}2+2##2+2##2+2}}2+2##2++++####+####+####+#++#+####++++++++++++", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"++###+++###+++++++###+++###+++++++++++++++++++++++++++++++++++++", +"+#+++#+#+++#++#++#+++#+#+++#++++++++++++++++++++++++++++++++++++", +"+#+++#+#+++#++#++#+++#+#+++#++++++++++++++++++++++++++++++++++++", +"++###+++###+++++++###+++###+++++++++++++++++++++++++++++++++++++", +"+#+++#+#+++#+++++#+++#+#+++#++++++++++++++++++++++++++++++++++++", +"+#+++#+#+++#++#++#+++#+#+++#++++++++++++++++++++++++++++++++++++", +"++###+++###+++#+++###+++###+++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +" ", +" ", +"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ", +"+#}}#+}}}#+#}}#+}}}#+}}}}+}}}}+#}}#+}##}+#}##+###}+}##}+}###+ ", +"+}++}+}++}+}++}+}++}+}++#+}++#+}++#+}++}+#}+#+#++}+}++}+}++#+ ", +"+}++}+}++}+}++#+}++}+}++#+}++#+}++#+}++}+#}+#+#++}+}+}#+}++#+ ", +"+}}}}+}}}#+}###+}##}+}}}#+}}}#+}#}}+}}}}+#}##+###}+}}##+}###+ ", +"+}++}+}++}+}++#+}++}+}++#+}++#+}++}+}++}+#}+#+#++}+}+}#+}++#+ ", +"+}++}+}++}+}++}+}++}+}++#+}++#+}++}+}++}+#}+#+}++}+}++}+}++#+ ", +"+}##}+}}}#+#}}#+}}}#+}}}}+}###+#}}#+}##}+#}##+#}}#+}##}+}}}}+ ", +"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ", +"+}##}+}##}+#}}#+}}}#+#}}#+}}}#+#}}#+#}}}+}##}+}##}+}##}+}##}+ ", +"+}}}}+}}+}+}++}+}++}+}++}+}++}+}++}+#+}#+}++}+}++}+}++}+}++}+ ", +"+}++}+}+}}+}++}+}++}+}++}+}++}+}++#+#+}#+}++}+}++}+}++}+#}}#+ ", +"+}##}+}##}+}##}+}}}#+}##}+}}}#+#}}#+##}#+}##}+}##}+}##}+#}}#+ ", +"+}++}+}++}+}++}+}++#+}++}+}+}#+#++}+#+}#+}++}+}++}+}}}}+#}}#+ ", +"+}++}+}++}+}++}+}++#+}+}#+}++}+}++}+#+}#+}++}+#}}#+}}}}+}++}+ ", +"+}##}+}##}+#}}#+}###+#}#}+}##}+#}}#+##}#+}}}}+#}}#+}##}+}##}+ ", +"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ", +"+}##}+}}}}+####+####+####+####+####+####+####+####+####+####+ ", +"+}#+}+#++}+#++#+#++#+#++#+#++#+#++#+#++#+#++#+#++#+#++#+#++#+ ", +"+}##}+#+}#+#++#+#++#+#++#+#++#+#++#+#++#+#++#+#++#+#++#+#++#+ ", +"+#}}#+#}##+####+####+####+####+####+####+####+####+####+####+ ", +"+#+}#+#}+#+#++#+#++#+#++#+#++#+#++#+#++#+#++#+#++#+#++#+#++#+ ", +"+#+}#+}++#+#++#+#++#+#++#+#++#+#++#+#++#+#++#+#++#+#++#+#++#+ ", +"+#}##+}}}}+####+####+####+####+####+####+####+####+####+####+ ", +"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ", +"+#}}#+}###+####+###}+}}}}+#}}#+#}}#+}###+####+###}+####+}###+ ", +"+}++}+}++#+#++#+#++}+}++#+}++}+}++#+}++#+#}+#+#++}+}++}+}++#+ ", +"+}++}+}++#+#}}#+#++}+}++#+}++#+}++#+}++#+##+#+#++}+}+}#+}++#+ ", +"+}}}}+}}}#+}##}+#}}}+}}}#+}}##+}#}}+}}}#+#}##+###}+}}##+}###+ ", +"+}++}+}++}+}++#+}++}+}++#+}++#+}++}+}++}+#}+#+#++}+}+}#+}++#+ ", +"+}++}+}++}+}++}+}++}+}++#+}++#+}++}+}++}+#}+#+}++}+}++}+}++#+ ", +"+}##}+}}}#+#}}#+#}}}+}}}}+}###+#}}#+}##}+#}##+#}}#+}##}+#}}#+ ", +"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ", +"+}##}+####+####+}}}#+#}}#+####+#}}#+####+####+}##}+}##}+}##}+ ", +"+}}}}+##+#+#++#+}++}+}++}+#++#+}++}+#+}#+#++#+}++}+}++}+}++}+ ", +"+}++}+#+##+#++#+}++}+}++}+#++#+}++#+#+}#+#++#+}++}+}++}+#}}#+ ", +"+}##}+}#}}+#}}#+}}}#+}##}+}#}#+#}}#+#}}}+}##}+}##}+}##}+#}}#+ ", +"+}++}+}}+}+}++}+}++#+}++}+}}#}+#++}+#+}#+}++}+}++}+}}}}+#}}#+ ", +"+}++}+}++}+}++}+}++#+}+}#+}++#+}++}+#+}#+}++}+#}}#+}}}}+}++}+ ", +"+}##}+}##}+#}}#+}###+#}#}+}###+#}}#+##}#+#}}#+#}}#+}##}+}##}+ ", +"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ", +"+}##}+####+2}}2+###2+2}}2+2}}2+2##2+2}}2+2}}2+2}}2+2}}2+2}}2+ ", +"+}#+}+#++#+}++}+#+}}+#++}+#++}+}++}+}++#+}++#+#++}+}++}+}++}+ ", +"+}##}+}}}}+}++}+#++}+#++}+#++}+}++}+}++#+}++#+#++}+}++}+}++}+ ", +"+#}}#+###}+2##2+###2+2}}2+2}}2+2}}2+2}}2+2}}2+###2+2}}2+2}}2+ ", +"+#+}#+#}}#+}++}+#++}+}++#+#++}+#++}+#++}+}++}+#++}+}++}+#++}+ ", +"+#+}#+}++#+}++}+#++}+}++#+#++}+#++}+#++}+}++}+#++}+}++}+#++}+ ", +"+#}##+}}}}+2}}2+###}+2}}2+2}}2+###2+2}}2+2}}2+###2+2}}2+2}}2+ ", +"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ", +"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ", +"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ", +" ", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"++333+++###4+43334+43334+4###4+43334+43334+43334+43334+43334++++", +"+3+++3+#+++3+#+++3+#+++3+3+++3+3+++#+3+++#+#+++3+3+++3+3+++3++3+", +"+3+++3+#+++3+#+++3+#+++3+3+++3+3+++#+3+++#+#+++3+3+++3+3+++3++4+", +"+4###4++###4+43334++3334+43334+43334+43334++###4+43334+43334++++", +"+3+++3+#+++3+3+++#+#+++3+#+++3+#+++3+3+++3+#+++3+3+++3+#+++3++++", +"+3+++3+#+++3+3+++#+#+++3+#+++3+#+++3+3+++3+#+++3+3+++3+#+++3++3+", +"++333+++###4+43334+43334++###4+43334+43334++###4+43334+43334++4+", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" "}; diff --git a/yawmppp/src/dockapp/getmodemspeed.c b/yawmppp/src/dockapp/getmodemspeed.c new file mode 100644 index 0000000..6530e6e --- /dev/null +++ b/yawmppp/src/dockapp/getmodemspeed.c @@ -0,0 +1,17 @@ +#include + +int main(void) { + + FILE *fd; + char temp[256]; + + fd = popen("tac /etc/ppp/connect-errors | grep '['CONNECT'|'CARRIER']' | head -1", "r"); + + while (fgets(temp, 256, fd)) { + printf("%s", temp); + } + + pclose(fd); + + return 0; +} diff --git a/yawmppp/src/dockapp/wmgeneral.c b/yawmppp/src/dockapp/wmgeneral.c new file mode 100644 index 0000000..1b726ae --- /dev/null +++ b/yawmppp/src/dockapp/wmgeneral.c @@ -0,0 +1,369 @@ +/* + + WMPPP - PPP dock app/helper for WindowMaker + Copyright (C) 1997-2000: + + Authors: Martijn Pieterse (pieterse@xs4all.nl) + Antoine Nulle (warp@xs4all.nl) + Felipe Bergo (bergo@seul.org) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "wmgeneral.h" + +Window Root; +int screen; +int x_fd; +int d_depth; +XSizeHints mysizehints; +XWMHints mywmhints; +Pixel back_pix, fore_pix; +char *Geometry = ""; +Window iconwin, win; +GC NormalGC; +XpmIcon wmgen; +Pixmap pixmask; + +typedef struct + { + int enable; + int top; + int bottom; + int left; + int right; + } +MOUSE_REGION; + +MOUSE_REGION mouse_region[MAX_MOUSE_REGION]; + +static void GetXPM (XpmIcon *, char **); +static Pixel GetColor (char *); +void RedrawWindow (void); +void AddMouseRegion (int, int, int, int, int); +int CheckMouseRegion (int, int); + +static void +GetXPM (XpmIcon * wmgen, char *pixmap_bytes[]) +{ + + XWindowAttributes attributes; + int err; + + /* For the colormap */ + XGetWindowAttributes (display, Root, &attributes); + + wmgen->attributes.valuemask |= (XpmReturnPixels | XpmReturnExtensions); + + err = XpmCreatePixmapFromData (display, Root, pixmap_bytes, &(wmgen->pixmap), + &(wmgen->mask), &(wmgen->attributes)); + + if (err != XpmSuccess) + { + fprintf (stderr, "Not enough free colorcells.\n"); + exit (1); + } +} + +static Pixel +GetColor (char *name) +{ + + XColor color; + XWindowAttributes attributes; + + XGetWindowAttributes (display, Root, &attributes); + + color.pixel = 0; + if (!XParseColor (display, attributes.colormap, name, &color)) + { + fprintf (stderr, "wm.app: can't parse %s.\n", name); + } + else if (!XAllocColor (display, attributes.colormap, &color)) + { + fprintf (stderr, "wm.app: can't allocate %s.\n", name); + } + return color.pixel; +} + +static int +flush_expose (Window w) +{ + + XEvent dummy; + int i = 0; + + while (XCheckTypedWindowEvent (display, w, Expose, &dummy)) + i++; + + return i; +} + +void +RedrawWindow (void) +{ + + flush_expose (iconwin); + XCopyArea (display, wmgen.pixmap, iconwin, NormalGC, + 0, 0, wmgen.attributes.width, wmgen.attributes.height, 0, 0); + flush_expose (win); + XCopyArea (display, wmgen.pixmap, win, NormalGC, + 0, 0, wmgen.attributes.width, wmgen.attributes.height, 0, 0); +} + +void +RedrawWindowXY (int x, int y) +{ + + flush_expose (iconwin); + XCopyArea (display, wmgen.pixmap, iconwin, NormalGC, + x, y, wmgen.attributes.width, wmgen.attributes.height, 0, 0); + flush_expose (win); + XCopyArea (display, wmgen.pixmap, win, NormalGC, + x, y, wmgen.attributes.width, wmgen.attributes.height, 0, 0); +} + +void +AddMouseRegion (int index, int left, int top, int right, int bottom) +{ + + if (index < MAX_MOUSE_REGION) + { + mouse_region[index].enable = 1; + mouse_region[index].top = top; + mouse_region[index].left = left; + mouse_region[index].bottom = bottom; + mouse_region[index].right = right; + } +} + +int +CheckMouseRegion (int x, int y) +{ + + int i; + int found; + + found = 0; + + for (i = 0; i < MAX_MOUSE_REGION && !found; i++) + { + if (mouse_region[i].enable && + x <= mouse_region[i].right && + x >= mouse_region[i].left && + y <= mouse_region[i].bottom && + y >= mouse_region[i].top) + found = 1; + } + if (!found) + return -1; + return (i - 1); +} + +void +createXBMfromXPM (char *xbm, char **xpm, int sx, int sy) +{ + + int i, j; + int width, height, numcol; + char zero; + unsigned char bwrite; + int bcount; + + + sscanf (*xpm, "%d %d %d", &width, &height, &numcol); + + zero = xpm[1][0]; + for (i = numcol + 1; i < numcol + sy + 1; i++) + { + bcount = 0; + bwrite = 0; + for (j = 0; j < sx; j++) + { + bwrite >>= 1; + if (xpm[i][j] != zero) + { + bwrite += 128; + } + bcount++; + if (bcount == 8) + { + *xbm = bwrite; + xbm++; + bcount = 0; + bwrite = 0; + } + } + } +} + +void +copyXPMArea (int x, int y, int sx, int sy, int dx, int dy) +{ + + XCopyArea (display, wmgen.pixmap, wmgen.pixmap, NormalGC, x, y, sx, sy, dx, dy); + +} + +void +copyXBMArea (int x, int y, int sx, int sy, int dx, int dy) +{ + + XCopyArea (display, wmgen.mask, wmgen.pixmap, NormalGC, x, y, sx, sy, dx, dy); +} + +void +setMaskXY (int x, int y) +{ + + XShapeCombineMask (display, win, ShapeBounding, x, y, pixmask, ShapeSet); + XShapeCombineMask (display, iconwin, ShapeBounding, x, y, pixmask, ShapeSet); +} + +void +openXwindow (int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bits, int pixmask_width, int pixmask_height) +{ + + unsigned int borderwidth = 1; + XClassHint classHint; + char *display_name = NULL; + char *wname = argv[0]; + XTextProperty name; + + XGCValues gcv; + unsigned long gcm; + + char *geometry = NULL; + + int dummy = 0; + int i, wx, wy; + + for (i = 1; argv[i]; i++) + { + if (!strcmp (argv[i], "-display")) + { + display_name = argv[i + 1]; + i++; + } + if (!strcmp (argv[i], "-geometry")) + { + geometry = argv[i + 1]; + i++; + } + } + + if (!(display = XOpenDisplay (display_name))) + { + fprintf (stderr, "%s: can't open display %s\n", + wname, XDisplayName (display_name)); + exit (1); + } + screen = DefaultScreen (display); + Root = RootWindow (display, screen); + d_depth = DefaultDepth (display, screen); + x_fd = XConnectionNumber (display); + + /* Convert XPM to XImage */ + GetXPM (&wmgen, pixmap_bytes); + + /* Create a window to hold the stuff */ + mysizehints.flags = USSize | USPosition; + mysizehints.x = 0; + mysizehints.y = 0; + + back_pix = GetColor ("white"); + fore_pix = GetColor ("black"); + + XWMGeometry (display, screen, Geometry, NULL, borderwidth, &mysizehints, + &mysizehints.x, &mysizehints.y, &mysizehints.width, &mysizehints.height, &dummy); + + mysizehints.width = 64; + mysizehints.height = 64; + + win = XCreateSimpleWindow (display, Root, mysizehints.x, mysizehints.y, + mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix); + + iconwin = XCreateSimpleWindow (display, win, mysizehints.x, mysizehints.y, + mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix); + + /* Activate hints */ + XSetWMNormalHints (display, win, &mysizehints); + classHint.res_name = wname; + classHint.res_class = wname; + XSetClassHint (display, win, &classHint); + + XSelectInput (display, win, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask); + XSelectInput (display, iconwin, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask); + + if (XStringListToTextProperty (&wname, 1, &name) == 0) + { + fprintf (stderr, "%s: can't allocate window name\n", wname); + exit (1); + } + + XSetWMName (display, win, &name); + + /* Create GC for drawing */ + + gcm = GCForeground | GCBackground | GCGraphicsExposures; + gcv.foreground = fore_pix; + gcv.background = back_pix; + gcv.graphics_exposures = 0; + NormalGC = XCreateGC (display, Root, gcm, &gcv); + + /* ONLYSHAPE ON */ + + pixmask = XCreateBitmapFromData (display, win, pixmask_bits, pixmask_width, pixmask_height); + + XShapeCombineMask (display, win, ShapeBounding, 0, 0, pixmask, ShapeSet); + XShapeCombineMask (display, iconwin, ShapeBounding, 0, 0, pixmask, ShapeSet); + + /* ONLYSHAPE OFF */ + + mywmhints.initial_state = WithdrawnState; + mywmhints.icon_window = iconwin; + mywmhints.icon_x = mysizehints.x; + mywmhints.icon_y = mysizehints.y; + mywmhints.window_group = win; + mywmhints.flags = StateHint | IconWindowHint | IconPositionHint | WindowGroupHint; + + XSetWMHints (display, win, &mywmhints); + + XSetCommand (display, win, argv, argc); + XMapWindow (display, win); + + if (geometry) + { + if (sscanf (geometry, "+%d+%d", &wx, &wy) != 2) + { + fprintf (stderr, "Bad geometry string.\n"); + exit (1); + } + XMoveWindow (display, win, wx, wy); + } +} + diff --git a/yawmppp/src/dockapp/wmgeneral.h b/yawmppp/src/dockapp/wmgeneral.h new file mode 100644 index 0000000..b89cf00 --- /dev/null +++ b/yawmppp/src/dockapp/wmgeneral.h @@ -0,0 +1,42 @@ +#ifndef WMGENERAL_H_INCLUDED +#define WMGENERAL_H_INCLUDED + + /***********/ + /* Defines */ +/***********/ + +#define MAX_MOUSE_REGION (16) + + /************/ + /* Typedefs */ +/************/ + +typedef struct { + Pixmap pixmap; + Pixmap mask; + XpmAttributes attributes; +} XpmIcon; + + /*******************/ + /* Global variable */ +/*******************/ + +Display *display; + + /***********************/ + /* Function Prototypes */ +/***********************/ + +void AddMouseRegion(int index, int left, int top, int right, int bottom); +int CheckMouseRegion(int x, int y); + +void openXwindow(int argc, char *argv[], char **, char *, int, int); +void RedrawWindow(void); +void RedrawWindowXY(int x, int y); + +void createXBMfromXPM(char *, char **, int, int); +void copyXPMArea(int, int, int, int, int, int); +void copyXBMArea(int, int, int, int, int, int); +void setMaskXY(int, int); + +#endif diff --git a/yawmppp/src/dockapp/yawmppp.c b/yawmppp/src/dockapp/yawmppp.c new file mode 100644 index 0000000..d379618 --- /dev/null +++ b/yawmppp/src/dockapp/yawmppp.c @@ -0,0 +1,991 @@ +/* + + YAWMPPP - PPP dock app/helper for WindowMaker + Copyright (C) 2000,2001: + + Author: Felipe Bergo (bergo@seul.org) + + based on the wmppp application by + + Martijn Pieterse (pieterse@xs4all.nl) + Antoine Nulle (warp@xs4all.nl) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + $Id: yawmppp.c,v 1.1.1.1 2001/02/22 07:16:01 bergo Exp $ + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include "wmgeneral.h" +#include "misc.h" +#include "isprc.h" +#include "ycommon.h" + +#include "dockxpm.xpm" +#include "yawmppp.h" + +/* external vars */ + +extern char **environ; + +/* global variables */ + +long starttime; + +char *ProgName; +char *active_interface = "ppp0"; +int TimerDivisor = 60; +int updaterate = 5; + +int dock_mask_width = 64; +int dock_mask_height = 64; +char dock_mask_bits[64 * 64]; + +int current_isp = 0; +int num_isps = 0; + +int got_sched=0; +int caution=1; + +struct YAWMPPP_ISP_INFO IspData[MAX_ISPS]; + +/* log data */ +struct { + time_t start; + time_t end; + int status; /* 0=ok 1=error 2=crash */ + char longname[128]; + char shortname[16]; + char phone[32]; + char user[32]; +} logconn; + +/* PPP variables */ + +#define PPP_UNIT 0 +int ppp_h = -1; +int ppp_open = 0; + +#define PPP_STATS_HIS 54 + +int pixels_per_byte; + +int ppp_history[PPP_STATS_HIS + 1][2]; + +/* main */ + +int +main (int argc, char *argv[]) +{ + + int i; + + /* Parse Command Line */ + + ProgName = argv[0]; + if (strlen (ProgName) >= 5) + ProgName += (strlen (ProgName) - 5); + + for (i = 1; i < argc; i++) + { + char *arg = argv[i]; + + if (*arg == '-') + { + switch (arg[1]) + { + case 'c': + caution=1; + break; + case 'd': + if (strcmp (arg + 1, "display")) + { + usage (); + exit (1); + } + break; + case 'g': + if (strcmp (arg + 1, "geometry")) + { + usage (); + exit (1); + } + break; + case 'i': + if (!argv[i + 1]) + { + usage (); + exit (1); + } + if (strncmp (argv[i + 1], "ppp", 3)) + { + usage (); + exit (1); + } + active_interface = argv[i + 1]; + i++; + break; + case 'p': + caution=2; + break; + case 't': + TimerDivisor = 1; + break; + case 'u': + i++; + if (!argv[i]) + { + usage (); + exit (1); + } + updaterate = atoi (argv[i]); + if (updaterate < 1 || updaterate > 10) + { + usage (); + exit (1); + } + break; + case 'v': + printversion (); + exit (0); + break; + case 'z': + printf("Caution level: %d\n",caution); + break; + default: + usage (); + exit (0); + break; + } + } + } + + for (i = 0; i < MAX_ISPS; i++) + memset(&IspData[i],0,sizeof(struct YAWMPPP_ISP_INFO)); + + make_config_dir(); + signal(SIGUSR1,sigusr_handler); + signal(SIGHUP,sigusr_handler); + signal(SIGINT,sigusr_handler); + signal(SIGTERM,sigusr_handler); + + write_pid_file(); + clean_guards(); + + yawmppp_routine (argc, argv); + + return 0; +} + +void +yawmppp_routine (int argc, char **argv) +{ + int i, j; + + int but_stat; + + long currenttime; + long lasttime; + long waittime; + long ppptime; + int hour, minute; + long timetolog; + + long ppp_send, ppp_sl = -1; + long ppp_recv, ppp_rl = -1; + long ppp_sbytes, ppp_rbytes; + long ppp_osbytes, ppp_orbytes; + + struct stat st; + + pid_t stop_child = 0; + pid_t start_child = 0; + int status; + + int isonline = 0; + + XEvent Event; + + int speed_ind = 10; + + /* Initialize some stuff */ + + get_statistics (active_interface, &ppp_rl, &ppp_sl, + &ppp_orbytes, &ppp_osbytes); + if (caution>0) + close_ppp(); + + grab_isp_info(1); + + /* Open the display */ + + createXBMfromXPM (dock_mask_bits, dockxpm_xpm, + dock_mask_width, dock_mask_height); + + openXwindow (argc, argv, dockxpm_xpm, dock_mask_bits, + dock_mask_width, dock_mask_height); + + /* V Button */ + AddMouseRegion (0, 35, 48, 46, 58); + /* x Button */ + AddMouseRegion (1, 47, 48, 58, 58); + + /* < Button */ + AddMouseRegion (2, 5, 48, 16, 58); + /* > Button */ + AddMouseRegion (3, 17, 48, 28, 58); + /* ISP display */ + AddMouseRegion (4, 5, 6, 59, 43); + + starttime = 0; + currenttime = time (0); + ppptime = 0; + but_stat = -1; + waittime = 0; + timetolog=0; + + /* 888k8 on bottom */ + copyXPMArea (ERR_SRC_X+28, ERR_SRC_Y+9, 25, 8, ERR_DEST_X, ERR_DEST_Y); + + DrawISPName (); + + while (1) + { + lasttime = currenttime; + currenttime = time (0); + + /* Check if any child has left the playground */ + i = waitpid (0, &status, WNOHANG); + if (i == stop_child && stop_child != 0) + { + + starttime = 0; + SetOffLED (LED_PPP_POWER); + SetOffLED (LED_PPP_RX); + SetOffLED (LED_PPP_TX); + /* 888k8 on bottom */ + copyXPMArea (ERR_SRC_X+28, ERR_SRC_Y+9, 25, 8, + ERR_DEST_X, ERR_DEST_Y); + RedrawWindow (); + + stop_child = 0; + } + if (i == start_child && start_child != 0) + { + if (WIFEXITED (status)) + { + if (WEXITSTATUS (status) == 10) + { + + starttime = 0; + /* 88k8 on bottom */ + copyXPMArea (ERR_SRC_X+28, ERR_SRC_Y+9, 25, 8, + ERR_DEST_X, ERR_DEST_Y); + SetOffLED (LED_PPP_POWER); + DrawTime (0, 1); + RedrawWindow (); + } + start_child = 0; + } + } + + /* On-line detectie! 1x per second */ + + if (currenttime != lasttime) + { + i = 0; + + if (stillonline (active_interface)) + { + i = 1; + if (!starttime) + { + starttime = currenttime; + + if (stat (STAMP_FILE, &st) == 0) + starttime = st.st_mtime; + + SetOnLED (LED_PPP_POWER); + waittime = 0; + + /* 88k8 on bottom */ + copyXPMArea (ERR_SRC_X+28, ERR_SRC_Y+9, 25, 8, + ERR_DEST_X, ERR_DEST_Y); + + if (IspData[current_isp].SpeedAction) + DrawSpeedInd (IspData[current_isp].SpeedAction); + + speed_ind = currenttime + 10; + + RedrawWindow (); + } + } + if (!i && starttime) + { + starttime = 0; + SetErrLED (LED_PPP_POWER); + logconn.status=1; + + /* Error */ + copyXPMArea (ERR_SRC_X, ERR_SRC_Y+9, 25, 8, + ERR_DEST_X, ERR_DEST_Y); + + if (IspData[current_isp].IfDownAction) + execCommand (IspData[current_isp].IfDownAction); + + RedrawWindow (); + } + } + + if (waittime && waittime <= currenttime) + { + SetOffLED (LED_PPP_POWER); + RedrawWindow (); + waittime = 0; + } + + if ((starttime)&&(!isonline)) { + isonline=1; + + logconn.start=time(NULL); + logconn.status=0; + strcpy(logconn.longname,IspData[current_isp].LongName); + strcpy(logconn.shortname,IspData[current_isp].ShortName); + strcpy(logconn.user,IspData[current_isp].User); + strcpy(logconn.phone,IspData[current_isp].Phone); + + if (!strlen(logconn.shortname)) + strcpy(logconn.shortname,"empty"); + if (!strlen(logconn.longname)) + strcpy(logconn.longname,"empty"); + if (!strlen(logconn.user)) + strcpy(logconn.user,"empty"); + if (!strlen(logconn.phone)) + strcpy(logconn.phone,"empty"); + + make_guards(); + } + if ((!starttime)&&(isonline)) { + isonline=0; + logconn.end=time(NULL); + write_log(); + if (got_sched) + make_delayed_update(); + if (caution>0) + close_ppp(); + } + + /* If we are on-line. Print the time we are */ + if (starttime) + { + i = currenttime - starttime; + + i /= TimerDivisor; + + if (TimerDivisor == 1) + if (i > 59 * 60 + 59) + i /= 60; + + minute = i % 60; + hour = (i / 60) % 100; + i = hour * 100 + minute; + + DrawTime (i, currenttime % 2); + /* We are online, so we can check for send/recv packets */ + + get_statistics (active_interface, &ppp_recv, &ppp_send, + &ppp_rbytes, &ppp_sbytes); + if (caution>1) + close_ppp(); + + if (ppp_send != ppp_sl) + SetOnLED (LED_PPP_TX); + else + SetOffLED (LED_PPP_TX); + + if (ppp_recv != ppp_rl) + SetOnLED (LED_PPP_RX); + else + SetOffLED (LED_PPP_RX); + + ppp_sl = ppp_send; + ppp_rl = ppp_recv; + + /* Every five seconds we check to load on the line */ + + if (currenttime - timetolog >= 0) { + timetolog=currenttime + 60; + make_guards(); + } + + if ((currenttime - ppptime >= 0) || (ppptime == 0)) + { + + ppptime = currenttime + updaterate; + + ppp_history[PPP_STATS_HIS][0] = ppp_rbytes - ppp_orbytes; + ppp_history[PPP_STATS_HIS][1] = ppp_sbytes - ppp_osbytes; + + ppp_orbytes = ppp_rbytes; + ppp_osbytes = ppp_sbytes; + + DrawStats (54, 17, 5, 32); + + for (j = 1; j < 55; j++) + { + ppp_history[j - 1][0] = ppp_history[j][0]; + ppp_history[j - 1][1] = ppp_history[j][1]; + } + if (currenttime > speed_ind) + { + DrawLoadInd ((ppp_history[54][0] + ppp_history[54][1]) / updaterate); + } + } + + RedrawWindow (); + } + + + while (XPending (display)) + { + XNextEvent (display, &Event); + switch (Event.type) + { + case Expose: + RedrawWindow (); + break; + case DestroyNotify: + XCloseDisplay (display); + while (start_child | stop_child) + { + i = waitpid (0, &status, WNOHANG); + if (i == stop_child) + stop_child = 0; + if (i == start_child) + start_child = 0; + usleep (50000l); + } + exit (0); + break; + case ButtonPress: + i = CheckMouseRegion (Event.xbutton.x, Event.xbutton.y); + switch (i) + { + case 0: + ButtonDown (BUT_V); + break; + case 1: + ButtonDown (BUT_X); + break; + case 2: + ButtonDown (BUT_REW); + break; + case 3: + ButtonDown (BUT_FF); + break; + } + but_stat = i; + + RedrawWindow (); + break; + case ButtonRelease: + i = CheckMouseRegion (Event.xbutton.x, Event.xbutton.y); + // Button but_stat omhoogdoen! + switch (but_stat) + { + case 0: + ButtonUp (BUT_V); + break; + case 1: + ButtonUp (BUT_X); + break; + case 2: + ButtonUp (BUT_REW); + break; + case 3: + ButtonUp (BUT_FF); + break; + } + + if (i == but_stat && but_stat >= 0) + { + switch (i) + { + case 0: + if (!starttime) + { + /* 888k8 */ + copyXPMArea (ERR_SRC_X+28, ERR_SRC_Y+9, + 25, 8, + ERR_DEST_X, ERR_DEST_Y); + DrawTime (0, 1); + start_child = execCommand (IspData[current_isp].StartAction); + SetWaitLED (LED_PPP_POWER); + waittime = ORANGE_LED_TIMEOUT + currenttime; + } + + break; + case 1: + if (stop_child == 0) + { + stop_child = execCommand (IspData[current_isp].StopAction); + } + break; + case 2: + if (!starttime) + { + current_isp--; + if (current_isp < 0) + current_isp = num_isps - 1; + if (current_isp < 0) + current_isp=0; + DrawISPName (); + } + break; + case 3: + if (!starttime) + { + current_isp++; + if (current_isp == num_isps) + current_isp = 0; + DrawISPName (); + } + break; + case 4: + if (Event.xbutton.button==Button1) + run_pref_app(); + else + run_log_app(); + break; + } + } + RedrawWindow (); + + but_stat = -1; + break; + default: + break; + } + } + usleep (50000L); + } +} + +/* DrawTime */ + +void +DrawTime (int i, int j) +{ + + int k = 1000; + + copyXPMArea (TIMER_SZE_X * ((i / k) % 10) + 1, TIMER_SRC_Y, + 5, 7, + TIMER_DES_X + 6 * 0, TIMER_DES_Y); + k = k / 10; + copyXPMArea (TIMER_SZE_X * ((i / k) % 10) + 1, TIMER_SRC_Y, + 5, 7, + TIMER_DES_X + 6 * 1, TIMER_DES_Y); + k = k / 10; + + /* colon */ + if (j) + copyXPMArea (62, TIMER_SRC_Y, + 1, 7, + TIMER_DES_X + 6 * 2 + 1, TIMER_DES_Y); + else + copyXPMArea (63, TIMER_SRC_Y, + 1, 7, + TIMER_DES_X + 6 * 2 + 1, TIMER_DES_Y); + + copyXPMArea (TIMER_SZE_X * ((i / k) % 10) + 1, TIMER_SRC_Y, + 5, 7, + TIMER_DES_X + 6 * 2 + 4, TIMER_DES_Y); + k = k / 10; + copyXPMArea (TIMER_SZE_X * ((i / k) % 10) + 1, TIMER_SRC_Y, + 5, 7, + TIMER_DES_X + 6 * 3 + 4, TIMER_DES_Y); +} + +void +DrawStats (int num, int size, int x_left, int y_bottom) +{ + + int pixels_per_byte; + int j, k; + + pixels_per_byte = size; + for (j = 0; j < num; j++) + if ((ppp_history[j][0]+ppp_history[j][1]) > pixels_per_byte) + pixels_per_byte = ppp_history[j][0] + ppp_history[j][1]; + + pixels_per_byte /= size; + + for (k = 0; k < num; k++) + for (j = 0; j < size; j++) + { + if (j < (ppp_history[k][0] / pixels_per_byte)) + copyXPMArea (58 + 2, 92, 1, 1, k + x_left, y_bottom - j); + else if (j < (ppp_history[k][0] + ppp_history[k][1]) / pixels_per_byte) + copyXPMArea (58 + 1, 92, 1, 1, k + x_left, y_bottom - j); + else + copyXPMArea (58 + 0, 92, 1, 1, k + x_left, y_bottom - j); + } +} + +void +PrintLittle (int i, int *k) +{ + + switch (i) + { + case -1: + *k -= 5; + copyXPMArea (12 * 5, ERR_SRC_Y, 4, 8, *k, ERR_DEST_Y); + break; + case 0: + *k -= 5; + copyXPMArea (45, ERR_SRC_Y, 5, 8, *k, ERR_DEST_Y); + break; + default: + *k -= 5; + copyXPMArea (i * 5 - 5, ERR_SRC_Y, 5, 8, *k, ERR_DEST_Y); + break; + } +} + +void +DrawSpeedInd (char *speed_action) +{ + + int linespeed, i, k; + FILE *fp; + char *p; + char temp[128]; + + fp = popen (speed_action, "r"); + + if (fp) + { + linespeed = 0; + + while (fgets (temp, 128, fp)) + ; + + pclose (fp); + + if ((p = strstr (temp, "CONNECT"))) + { + linespeed = atoi (p + 8); + } + + k = ERR_DEST_X+25; + + i = (linespeed % 1000) / 100; + linespeed /= 1000; + PrintLittle (i, &k); + + k -= 5; + copyXPMArea (ERR_SRC_X+50, ERR_SRC_Y, 5, 8, k, ERR_DEST_Y); + + do + { + PrintLittle (linespeed % 10, &k); + linespeed /= 10; + } + while (linespeed); + } +} + +/* DrawLoadInd */ + +void +DrawLoadInd (int speed) +{ + + int i, k; + + k = ERR_DEST_X+25; + for (i = 0; i < 5; i++) + PrintLittle (-1, &k); + + k = ERR_DEST_X+25; + + do + { + PrintLittle (speed % 10, &k); + speed /= 10; + } + while (speed); +} + +/* usage */ + +void +usage (void) +{ + fprintf (stderr, + "\nyawmppp - Yet Another Window Maker PPP dock applet\n\n"); + fprintf (stderr, + "version %s\n\n",VERSION); + fprintf (stderr, "usage:\n"); + fprintf (stderr, "-h this help screen\n"); + fprintf (stderr, "-i (ppp0, ppp1, etc)\n"); + fprintf (stderr, "-t set the on-line timer to MM:SS instead of HH:MM\n"); + fprintf (stderr, "-u (1..10), default 5 seconds\n"); + fprintf (stderr, "-v print the version number\n"); + fprintf (stderr, "-paranoid be paranoid about open sockets\n"); + fprintf (stderr, "\n"); +} + +/* printversion */ + +void +printversion (void) +{ + fprintf (stderr, "%s\n", VERSION); +} + +/* SetOnLED */ + +void +SetOnLED (int led) +{ + switch (led) + { + case LED_PPP_POWER: + copyXPMArea (LED_ON_X, LED_ON_Y, LED_SZE_X, LED_SZE_Y, LED_PWR_X, LED_PWR_Y); + break; + case LED_PPP_RX: + copyXPMArea (ARR_DN_X, ARR_DN_Y+ARR_ACTV, ARR_W, ARR_H, LED_RCV_X, LED_RCV_Y); + break; + case LED_PPP_TX: + copyXPMArea (ARR_UP_X, ARR_UP_Y+ARR_ACTV, ARR_W, ARR_H, LED_SND_X, LED_SND_Y); + break; + } +} + +/* SetOffLED */ + +void +SetOffLED (int led) +{ + + switch (led) + { + case LED_PPP_POWER: + copyXPMArea (LED_OFF_X, LED_OFF_Y, LED_SZE_X, LED_SZE_Y, LED_PWR_X, LED_PWR_Y); + break; + case LED_PPP_RX: + copyXPMArea (ARR_DN_X, ARR_DN_Y , ARR_W, ARR_H, LED_RCV_X, LED_RCV_Y); + break; + case LED_PPP_TX: + copyXPMArea (ARR_UP_X, ARR_UP_Y, ARR_W, ARR_H, LED_SND_X, LED_SND_Y); + break; + + } +} + +/* SetErrELD */ + +void +SetErrLED (int led) +{ + + switch (led) + { + case LED_PPP_POWER: + copyXPMArea (LED_ERR_X, LED_ERR_Y, LED_SZE_X, LED_SZE_Y, LED_PWR_X, LED_PWR_Y); + break; + } +} + +/* SetWaitLED */ + +void +SetWaitLED (int led) +{ + + switch (led) + { + case LED_PPP_POWER: + copyXPMArea (LED_WTE_X, LED_WTE_Y, LED_SZE_X, LED_SZE_Y, LED_PWR_X, LED_PWR_Y); + break; + } +} + +/* Button Up */ + +void +ButtonUp (int button) +{ + + switch (button) + { + case BUT_V: + copyXPMArea (BUT_V_SRC_X+BUT_UP_INC, BUT_V_SRC_Y, + 12, 11, + BUT_V_X, BUT_V_Y); + break; + case BUT_X: + copyXPMArea (BUT_X_SRC_X+BUT_UP_INC, BUT_X_SRC_Y, + 12, 11, + BUT_X_X, BUT_X_Y); + break; + case BUT_REW: + copyXPMArea (BUT_R_SRC_X+BUT_UP_INC, BUT_R_SRC_Y, + 12, 11, + BUT_R_X, BUT_R_Y); + break; + case BUT_FF: + copyXPMArea (BUT_F_SRC_X+BUT_UP_INC, BUT_F_SRC_Y, + 12, 11, + BUT_F_X, BUT_F_Y); + break; + } +} + +/* Button Down */ + +void +ButtonDown (int button) +{ + + switch (button) + { + case BUT_V: + copyXPMArea (BUT_V_SRC_X, BUT_V_SRC_Y, + 12, 11, + BUT_V_X, BUT_V_Y); + break; + case BUT_X: + copyXPMArea (BUT_X_SRC_X, BUT_X_SRC_Y, + 12, 11, + BUT_X_X, BUT_X_Y); + break; + case BUT_REW: + copyXPMArea (BUT_R_SRC_X, BUT_R_SRC_Y, + 12, 11, + BUT_R_X, BUT_R_Y); + break; + case BUT_FF: + copyXPMArea (BUT_F_SRC_X, BUT_F_SRC_Y, + 12, 11, + BUT_F_X, BUT_F_Y); + break; + } +} + +void +DrawISPName (void) +{ + int i, s; + + s = strlen (IspData[current_isp].ShortName); + for (i = 0; i < 5; i++) + { + if (s >= (i + 1)) + draw_isp_char (i, IspData[current_isp].ShortName[i]); + else + draw_isp_char (i, ' '); + } +} + +void +draw_isp_char (int pos, char letter) +{ + int sx = 0, sy = 0, ac = 0; + + if ((!ac) && (letter >= 'A') && (letter <= 'Z')) + { + sx = UPPER_ABC_BASE_X; + sy = UPPER_ABC_BASE_Y; + sy += 8 * ((letter - 'A') / 12); + sx += 5 * ((letter - 'A') % 12); + ac = 1; + } + if ((!ac) && (letter >= 'a') && (letter <= 'z')) + { + sx = LOWER_ABC_BASE_X; + sy = LOWER_ABC_BASE_Y; + sy += 8 * ((letter - 'a') / 12); + sx += 5 * ((letter - 'a') % 12); + ac = 1; + } + if ((!ac) && (letter >= '0') && (letter <= '9')) + { + sx = DIGIT_BASE_X; + sy = DIGIT_BASE_Y; + sx += 5 * (letter - '0'); + ac = 1; + } + if (!ac) + { + sx = SPACE_BASE_X; + sy = SPACE_BASE_Y; + } + + copyXPMArea (sx, sy, 4, 7, ISP_BASE_X + 5 * pos, ISP_BASE_Y); +} + +void +sigusr_handler(int signum) +{ + if (signum==SIGUSR1) { + if (!starttime) { + grab_isp_info(0); + if (current_isp>=num_isps) + current_isp=0; + DrawISPName(); + RedrawWindow(); + } else { + got_sched=1; + warn_pref(); + } + } + else { + remove_pid_file(); + exit(0); + } +} + +void +make_delayed_update(void) +{ + grab_isp_info(0); + if (current_isp>=num_isps) + current_isp=0; + DrawISPName(); + RedrawWindow(); + got_sched=0; +} + diff --git a/yawmppp/src/dockapp/yawmppp.h b/yawmppp/src/dockapp/yawmppp.h new file mode 100644 index 0000000..b95c2cc --- /dev/null +++ b/yawmppp/src/dockapp/yawmppp.h @@ -0,0 +1,142 @@ +/* DEFINES */ + +#define START_ACTION (NULL) +#define STOP_ACTION (NULL) +#define SPEED_ACTION (NULL) +#define IFDOWN_ACTION (NULL) + +#define STAMP_FILE "/var/run/ppp0.pid" + +#define LED_PPP_RX (1) +#define LED_PPP_TX (2) +#define LED_PPP_POWER (3) + +#define BUT_V (1) +#define BUT_X (2) +#define BUT_REW (3) +#define BUT_FF (4) + +#define TIMER_SRC_Y (176) +#define TIMER_DES_Y (8) +#define TIMER_DES_X (7) +#define TIMER_SZE_X (6) + +#define LED_ON_X (51) +#define LED_ON_Y (87) +#define LED_OFF_X (51) +#define LED_OFF_Y (82) + +#define LED_ERR_X (57) +#define LED_ERR_Y (82) +#define LED_WTE_X (57) +#define LED_WTE_Y (87) +#define LED_SZE_X (4) +#define LED_SZE_Y (4) + +#define LED_PWR_X (52) +#define LED_PWR_Y (9) +#define LED_SND_X (44) +#define LED_SND_Y (9) +#define LED_RCV_X (37) +#define LED_RCV_Y (9) + +#define ISP_BASE_X (6) +#define ISP_BASE_Y (35) + +#define UPPER_ABC_BASE_X (1) +#define UPPER_ABC_BASE_Y (124) +#define LOWER_ABC_BASE_X (1) +#define LOWER_ABC_BASE_Y (148) +#define DIGIT_BASE_X (11) +#define DIGIT_BASE_Y (164) +#define SPACE_BASE_X (11) +#define SPACE_BASE_Y (140) + +#define ERR_DEST_X (34) +#define ERR_DEST_Y (35) + +#define ERR_SRC_X (0) +#define ERR_SRC_Y (94) + +#define BUT_V_X (35) +#define BUT_V_Y (48) +#define BUT_X_X (47) +#define BUT_X_Y (48) +#define BUT_R_X (5) +#define BUT_R_Y (48) +#define BUT_F_X (17) +#define BUT_F_Y (48) + +#define BUT_V_SRC_X (0) +#define BUT_V_SRC_Y (70) +#define BUT_X_SRC_X (12) +#define BUT_X_SRC_Y (70) + +#define BUT_R_SRC_X (0) +#define BUT_R_SRC_Y (82) +#define BUT_F_SRC_X (12) +#define BUT_F_SRC_Y (82) + +#define BUT_UP_INC (24) + +#define ARR_UP_X (50) +#define ARR_UP_Y (70) +#define ARR_DN_X (57) +#define ARR_DN_Y (70) + +#define ARR_ACTV (5) + +#define ARR_W (7) +#define ARR_H (4) + +#define ORANGE_LED_TIMEOUT (60) + +/* prototypes */ + +void usage (void); +void printversion (void); +void DrawTime (int, int); +void DrawStats (int, int, int, int); +void DrawSpeedInd (char *); +void DrawLoadInd (int); +void DrawISPName (void); + +void SetOnLED (int); +void SetErrLED (int); +void SetWaitLED (int); +void SetOffLED (int); + +void ButtonUp (int); +void ButtonDown (int); + +void yawmppp_routine (int, char **); + +int get_statistics (char *, long *, long *, long *, long *); +int stillonline (char *); + +void draw_isp_char (int, char); +void grab_isp_info (int); + +void sigusr_handler(int signum); +void remove_pid_file(void); +void write_pid_file(void); +void make_config_dir(void); + +void run_pref_app(void); +void run_log_app(void); + +void add_dns(void); +void remove_dns(void); + +void warn_pref(void); +void make_delayed_update(void); + +/* logs */ +void clean_guards(void); +void make_guards(void); +void write_log(void); + +/* pcmcia blues ? */ + +void open_ppp(void); +void close_ppp(void); diff --git a/yawmppp/src/gtklog/Makefile.in b/yawmppp/src/gtklog/Makefile.in new file mode 100644 index 0000000..865dbec --- /dev/null +++ b/yawmppp/src/gtklog/Makefile.in @@ -0,0 +1,35 @@ +# +# gtklog: shows yawmppp log files +# + +CC = @CC@ +CFLAGS = -Wall -O2 +GTKLIB = @GTK_LIBS@ +GTKFLAG = @GTK_FLAGS@ +RLFLAG = -DVERSION=\"@MK_YAWMPPP_RELEASE@\" +PROGINST = @INSTALL@ +EOBJS = ../about.o + +ALLDOTOS = loglist.o +ALLDOTHS = loglist.h + +all: build_gtklog + +build_gtklog: $(ALLDOTOS) + $(CC) $(ALLDOTOS) $(EOBJS) -o yawmppp.log $(GTKLIB) + +$(ALLDOTOS): %.o : %.c $(ALLDOTHS) + $(CC) $(CFLAGS) $(RLFLAG) $(GTKFLAG) -I.. -c $< -o $@ + +install: + $(PROGINST) -m 0755 yawmppp.log @prefix@/bin/yawmppp.log + +install-strip: + $(PROGINST) -s -m 0755 yawmppp.log @prefix@/bin/yawmppp.log + +clean: + rm -f $(ALLDOTOS) yawmppp.log + +distclean: + rm -f Makefile *~ + diff --git a/yawmppp/src/gtklog/loglist.c b/yawmppp/src/gtklog/loglist.c new file mode 100644 index 0000000..cec35b8 --- /dev/null +++ b/yawmppp/src/gtklog/loglist.c @@ -0,0 +1,875 @@ +/* + + YAWMPPP - PPP dock app/helper for WindowMaker + Copyright (C) 2000: + + Author: Felipe Bergo (bergo@seul.org) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + $Id: loglist.c,v 1.1.1.1 2001/02/22 07:35:59 bergo Exp $ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "loglist.h" +#include "about.h" + +#include "status_error.xpm" +#include "status_crash.xpm" +#include "status_ok.xpm" +#include "stepphone.xpm" + +GtkWidget *applet,*loglist,*lresume[2],*hgraph,*wgraph; +GdkPixmap *iconmap[3]; +GdkBitmap *maskmap[3]; + +GdkPixmap *hcanvas=NULL; +GdkPixmap *wcanvas=NULL; + +GList *log=NULL; + +/* start end difftime statuspix staustext handle name phone user */ +static int colsize[8]={160,160,64,54,45,110,64,64}; + +static char *resumeo[]= +{ + "All time", + "Today", + "Yesterday", + "This week", + "This month", + "This year", + "Last 24 hours", + "Last 7 days", + "Last 30 days", + "Last 365 days" +}; + +static char *titles[8]={"Start time", + "End time", + "Online time", + "Status", + "ISP", + "Dialup entry", + "Phone", + "User"}; + +static char *wdays[]={ + "Sun","Mon","Tue","Wed","Thu","Fri","Sat" +}; + +static long hourly[24],weekly[7]; + +int nsrc[256]; + +GList *users=NULL; +GList *isps=NULL; + +/* constraints */ + +time_t time_cons[2]; +int useridx,ispidx; + +int +main(int argc,char **argv) +{ + int i; + + for(i=0;i<24;i++) + hourly[i]=0; + for(i=0;i<7;i++) + weekly[i]=0; + for(i=0;i<256;i++) + nsrc[i]=i; + + time_cons[0]=0; + time_cons[1]=0; + useridx=ispidx=0; + + gtk_init(&argc,&argv); + gdk_rgb_init(); + load_log(); + create_loglist(); + update_list(); + + make_resume(); + + gtk_main(); + + g_list_free(users); + g_list_free(isps); + for(i=0;i<3;i++) + gdk_pixmap_unref(iconmap[i]); + + free_log(); + return 0; +} + +void +create_loglist(void) +{ + GtkWidget *mvb,*sw,*dhb,*dhw[30]; + GdkBitmap *mask; + GdkPixmap *myicon; + GtkStyle *style; + GList *pt; + int i; + + applet=gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_default_size(GTK_WINDOW(applet),780,510); + gtk_window_set_title (GTK_WINDOW (applet), "YAWMPPP Connection Log"); + gtk_window_set_wmclass(GTK_WINDOW(applet),"yawmppp","log"); + gtk_container_set_border_width(GTK_CONTAINER(applet),4); + gtk_widget_show (applet); + + style=gtk_widget_get_style(applet); + myicon = gdk_pixmap_create_from_xpm_d (applet->window, &mask, + &style->bg[GTK_STATE_NORMAL], + (gchar **) stepphone_xpm); + gdk_window_set_icon (applet->window, NULL, myicon, mask); + gdk_window_set_icon_name(applet->window,"The Log"); + + mvb=gtk_vbox_new(FALSE,0); + gtk_container_add(GTK_CONTAINER(applet),mvb); + + dhb=gtk_hbox_new(FALSE,0); + gtk_box_pack_start(GTK_BOX(mvb),dhb,FALSE,TRUE,0); + + /* data */ + dhw[0]=gtk_label_new("Show summary for:"); + gtk_box_pack_start(GTK_BOX(dhb),dhw[0],FALSE,FALSE,4); + + dhw[1]=gtk_option_menu_new(); + gtk_box_pack_start(GTK_BOX(dhb),dhw[1],FALSE,FALSE,2); + + dhw[2]=gtk_menu_new(); + + for(i=0;i<10;i++) { + dhw[3]=gtk_menu_item_new_with_label(resumeo[i]); + gtk_signal_connect(GTK_OBJECT(dhw[3]),"activate", + GTK_SIGNAL_FUNC(time_menu),&nsrc[i]); + gtk_menu_append(GTK_MENU(dhw[2]),dhw[3]); + gtk_widget_show(dhw[3]); + } + + gtk_option_menu_set_menu(GTK_OPTION_MENU(dhw[1]),dhw[2]); + + dhw[12]=gtk_label_new("include entries from"); + gtk_box_pack_start(GTK_BOX(dhb),dhw[12],FALSE,FALSE,4); + dhw[13]=gtk_option_menu_new(); + gtk_box_pack_start(GTK_BOX(dhb),dhw[13],FALSE,FALSE,2); + + dhw[14]=gtk_menu_new(); + + for(i=0,pt=isps;pt!=NULL;pt=g_list_next(pt),i++) { + dhw[3]=gtk_menu_item_new_with_label((char *)(pt->data)); + gtk_signal_connect(GTK_OBJECT(dhw[3]),"activate", + GTK_SIGNAL_FUNC(isp_menu),&nsrc[i]); + gtk_menu_append(GTK_MENU(dhw[14]),dhw[3]); + gtk_widget_show(dhw[3]); + } + + gtk_option_menu_set_menu(GTK_OPTION_MENU(dhw[13]),dhw[14]); + + + dhw[15]=gtk_label_new("include connections as"); + gtk_box_pack_start(GTK_BOX(dhb),dhw[15],FALSE,FALSE,4); + dhw[16]=gtk_option_menu_new(); + gtk_box_pack_start(GTK_BOX(dhb),dhw[16],FALSE,FALSE,2); + + dhw[17]=gtk_menu_new(); + + for(i=0,pt=users;pt!=NULL;pt=g_list_next(pt),i++) { + dhw[3]=gtk_menu_item_new_with_label((char *)(pt->data)); + gtk_signal_connect(GTK_OBJECT(dhw[3]),"activate", + GTK_SIGNAL_FUNC(user_menu),&nsrc[i]); + gtk_menu_append(GTK_MENU(dhw[17]),dhw[3]); + gtk_widget_show(dhw[3]); + } + + gtk_option_menu_set_menu(GTK_OPTION_MENU(dhw[16]),dhw[17]); + + dhw[5]=gtk_hseparator_new(); + gtk_box_pack_start(GTK_BOX(mvb),dhw[5],FALSE,FALSE,3); + + dhw[3]=gtk_hbox_new(FALSE,4); + gtk_box_pack_start(GTK_BOX(mvb),dhw[3],FALSE,TRUE,3); + + dhw[4]=lresume[0]=gtk_label_new("\n\n\n\n\n"); + dhw[6]=lresume[1]=gtk_label_new("\n\n\n\n\n"); + + for(i=0;i<2;i++) + gtk_label_set_justify(GTK_LABEL(lresume[i]),GTK_JUSTIFY_LEFT); + + gtk_box_pack_start(GTK_BOX(dhw[3]),dhw[4],FALSE,TRUE,4); + gtk_box_pack_start(GTK_BOX(dhw[3]),dhw[6],FALSE,TRUE,4); + + hgraph=dhw[7]=gtk_drawing_area_new(); + gtk_drawing_area_size(GTK_DRAWING_AREA(dhw[7]),24*9+2,120); + gtk_widget_set_events(dhw[7],GDK_EXPOSURE_MASK); + + gtk_box_pack_start(GTK_BOX(dhw[3]),dhw[7],FALSE,FALSE,4); + + wgraph=dhw[8]=gtk_drawing_area_new(); + gtk_drawing_area_size(GTK_DRAWING_AREA(dhw[8]),7*20+2,120); + gtk_widget_set_events(dhw[8],GDK_EXPOSURE_MASK); + + gtk_box_pack_start(GTK_BOX(dhw[3]),dhw[8],FALSE,FALSE,4); + + dhw[11]=gtk_hseparator_new(); + gtk_box_pack_start(GTK_BOX(mvb),dhw[11],FALSE,FALSE,4); + + dhw[9]=gtk_hbox_new(FALSE,2); + dhw[10]=gtk_label_new("Raw log listing (unfiltered):"); + + gtk_box_pack_start(GTK_BOX(mvb),dhw[9],FALSE,FALSE,4); + gtk_box_pack_start(GTK_BOX(dhw[9]),dhw[10],FALSE,FALSE,2); + + /* list */ + + sw=gtk_scrolled_window_new(NULL,NULL); + gtk_box_pack_start(GTK_BOX(mvb),sw,TRUE,TRUE,4); + gtk_widget_show(sw); + gtk_container_set_border_width(GTK_CONTAINER(sw),0); + + loglist=gtk_clist_new(8); + gtk_clist_set_shadow_type(GTK_CLIST(loglist),GTK_SHADOW_IN); + gtk_clist_set_selection_mode(GTK_CLIST(loglist),GTK_SELECTION_SINGLE); + for(i=0;i<8;i++) { + gtk_clist_set_column_title(GTK_CLIST(loglist),i,titles[i]); + gtk_clist_set_column_width(GTK_CLIST(loglist),i,colsize[i]); + } + gtk_clist_column_titles_passive(GTK_CLIST(loglist)); + gtk_clist_column_titles_show(GTK_CLIST(loglist)); + gtk_clist_set_row_height(GTK_CLIST(loglist),16); + gtk_clist_set_column_auto_resize(GTK_CLIST(loglist),1,FALSE); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_ALWAYS); + gtk_container_add(GTK_CONTAINER(sw),loglist); + gtk_widget_show(loglist); + + /* bottom */ + + dhw[18]=gtk_hseparator_new(); + gtk_box_pack_start(GTK_BOX(mvb),dhw[18],FALSE,FALSE,4); + + dhw[19]=gtk_table_new(1,6,TRUE); + dhw[21]=gtk_button_new_with_label(" About... "); + dhw[22]=gtk_button_new_with_label(" Close "); + + dhw[23]=gtk_hbox_new(TRUE,6); + + gtk_box_pack_start(GTK_BOX(mvb),dhw[19],FALSE,FALSE,4); + + gtk_table_attach_defaults(GTK_TABLE(dhw[19]),dhw[23],4,6,0,1); + + gtk_box_pack_start(GTK_BOX(dhw[23]),dhw[21],FALSE,TRUE,4); + gtk_box_pack_start(GTK_BOX(dhw[23]),dhw[22],FALSE,TRUE,4); + + for(i=0;i<24;i++) + if (i!=20) + gtk_widget_show(dhw[i]); + gtk_widget_show(dhb); + gtk_widget_show(mvb); + + iconmap[0] = gdk_pixmap_create_from_xpm_d (applet->window, &maskmap[0], + &style->bg[GTK_STATE_NORMAL], + (gchar **) status_ok_xpm); + iconmap[1] = gdk_pixmap_create_from_xpm_d (applet->window, &maskmap[1], + &style->bg[GTK_STATE_NORMAL], + (gchar **) status_error_xpm); + iconmap[2] = gdk_pixmap_create_from_xpm_d (applet->window, &maskmap[2], + &style->bg[GTK_STATE_NORMAL], + (gchar **) status_crash_xpm); + + /* signal plumbing */ + gtk_signal_connect (GTK_OBJECT (applet), "delete_event", + GTK_SIGNAL_FUNC (applet_kill), NULL); + gtk_signal_connect (GTK_OBJECT (applet), "destroy", + GTK_SIGNAL_FUNC (applet_destroy), NULL); + gtk_signal_connect (GTK_OBJECT (hgraph), "expose_event", + GTK_SIGNAL_FUNC (hgra_expose), NULL); + gtk_signal_connect (GTK_OBJECT (hgraph), "configure_event", + GTK_SIGNAL_FUNC (hgra_configure), NULL); + gtk_signal_connect (GTK_OBJECT (wgraph), "expose_event", + GTK_SIGNAL_FUNC (wgra_expose), NULL); + gtk_signal_connect (GTK_OBJECT (wgraph), "configure_event", + GTK_SIGNAL_FUNC (wgra_configure), NULL); + + gtk_signal_connect (GTK_OBJECT (dhw[21]), "clicked", + GTK_SIGNAL_FUNC (applet_about), + (gpointer)GTK_WINDOW(applet)); + gtk_signal_connect (GTK_OBJECT (dhw[22]), "clicked", + GTK_SIGNAL_FUNC (applet_destroy), NULL); +} + +void +load_log(void) +{ + FILE *f; + char *p; + char temp[256],aux[256]; + GList *pt; + struct logentry *le; + + if (users) + g_list_free(users); + if (isps) + g_list_free(isps); + users=NULL; + isps=NULL; + + users=g_list_append(users,"All users"); + isps=g_list_append(isps,"All ISPs"); + + p=getenv("HOME"); + sprintf(temp,"%s/.yawmppp2/logfile",p); + + if (log) + free_log(); + + f=fopen(temp,"r"); + if (!f) + return; + + while(fgets(aux,255,f)) + prepend_log_entry(aux); + + fclose(f); + + for(pt=log;pt!=NULL;pt=g_list_next(pt)) { + le=(struct logentry *)(pt->data); + + if (!already_exists(le->user,users)) { + users=g_list_append(users,(gpointer)(le->user)); + } + + if (!already_exists(le->shortname,isps)) + isps=g_list_append(isps,(gpointer)(le->shortname)); + } +} + +void +prepend_log_entry(char *logline) +{ + char *p; + struct logentry *le; + + le=(struct logentry *)g_malloc0(sizeof(struct logentry)); + + if ((p=strtok(logline,"\t\n"))==NULL) { g_free(le); return; } + le->start=(time_t)atol(p); + + if ((p=strtok(NULL,"\t\n"))==NULL) { g_free(le); return; } + le->end=(time_t)atol(p); + + if ((p=strtok(NULL,"\t\n"))==NULL) { g_free(le); return; } + le->status=atoi(p); + + if ((p=strtok(NULL,"\t\n"))==NULL) { g_free(le); return; } + strncpy(le->longname,p,128); + + if ((p=strtok(NULL,"\t\n"))==NULL) { g_free(le); return; } + strncpy(le->shortname,p,16); + + if ((p=strtok(NULL,"\t\n"))==NULL) { g_free(le); return; } + strncpy(le->phone,p,32); + + if ((p=strtok(NULL,"\t\n"))==NULL) { g_free(le); return; } + strncpy(le->user,p,32); + + log=g_list_prepend(log,(gpointer)(le)); +} + +void +free_log(void) +{ + GList *pt; + + for(pt=log;pt!=NULL;pt=g_list_next(pt)) + g_free(pt->data); + + g_list_free(log); + log=NULL; +} + +void +update_list(void) +{ + GList *pt; + struct logentry *le; + char tmp[8][128]; + gchar *pp[8]; + int ontime,h,m,s,i; + int lc; + + gtk_clist_freeze(GTK_CLIST(loglist)); + gtk_clist_clear(GTK_CLIST(loglist)); + + for(i=0;i<8;i++) + pp[i]=tmp[i]; + + for(lc=0,pt=log;pt!=NULL;pt=g_list_next(pt),lc++) { + le=(struct logentry *)(pt->data); + strcpy(tmp[0],ctime(&(le->start))); + strcpy(tmp[1],ctime(&(le->end))); + ontime=(int)(le->end - le->start); + h=ontime/3600; + ontime-=3600*h; + m=ontime/60; + ontime-=60*m; + s=ontime; + sprintf(tmp[2],"%.4d:%.2d:%.2d",h,m,s); + switch(le->status) { + case 0: + strcpy(tmp[3],"OK"); + break; + case 1: + strcpy(tmp[3],"Error"); + break; + default: + strcpy(tmp[3],"Crash"); + } + strcpy(tmp[4],le->shortname); + strcpy(tmp[5],le->longname); + strcpy(tmp[6],le->phone); + strcpy(tmp[7],le->user); + + gtk_clist_append(GTK_CLIST(loglist),pp); + gtk_clist_set_pixtext(GTK_CLIST(loglist),lc,3, + tmp[3],6, + iconmap[le->status%3], + maskmap[le->status%3]); + } + + gtk_clist_thaw(GTK_CLIST(loglist)); +} + + +gint +applet_kill (GtkWidget * widget, GdkEvent * event, gpointer data) +{ + return FALSE; +} + +void +applet_destroy (GtkWidget * widget, gpointer data) +{ + gtk_main_quit(); +} + +void +make_resume(void) +{ + static char temp[1024],aux[256]; + GList *pt; + long olt,ldiff,avg,maior,menor; + struct logentry *le; + int h,m,s, + i,n,t, + j,o,u, + k,p,v; + int ec; + int sv[3]; + + for(i=0;i<24;i++) + hourly[i]=0; + for(i=0;i<7;i++) + weekly[i]=0; + + strcpy(temp,"Summary:\n\n"); + + olt=0; + sv[0]=sv[1]=sv[2]=0; + ec=0; + maior=0; + menor=time(NULL); /* unless you've been wired since + Jan 1 1970 this will work... ;-) */ + for(pt=log;pt!=NULL;pt=g_list_next(pt)) { + le=(struct logentry *)(pt->data); + + if (time_cons[1]!=0) + if ((le->end < time_cons[0])||(le->start > time_cons[1])) + continue; + if (useridx) + if (strcmp((char *)(g_list_nth_data(users,useridx)),le->user)) + continue; + if (ispidx) + if (strcmp((char *)(g_list_nth_data(isps,ispidx)),le->shortname)) + continue; + + ec++; + ldiff=(le->end - le->start); + olt+=ldiff; + sv[le->status]++; + add_hourly(le->start,le->end); + add_weekly(le->start,le->end); + + if (ldiff>maior) + maior=ldiff; + if (ldifftm_hour]++; + } +} + +void +add_weekly(long s,long e) +{ + time_t t; + struct tm *st; + + for(t=s;t<=e;t+=30) { + st=localtime(&t); + if (!st) + exit(2); + weekly[st->tm_wday]++; + } +} + +gint +hgra_expose(GtkWidget *widget,GdkEventExpose *ee,gpointer data) +{ + gdk_draw_pixmap(widget->window, + widget->style->fg_gc[GTK_WIDGET_STATE (widget)], + hcanvas, + ee->area.x, ee->area.y, + ee->area.x, ee->area.y, + ee->area.width, ee->area.height); + return FALSE; +} + +gint +hgra_configure(GtkWidget *widget,GdkEventConfigure *ee,gpointer data) +{ + GdkGC *mygc; + int x,y,cx,xs; + int i,v; + long max; + float fac; + GdkFont *fn; + char tmp[64]; + + if (hcanvas!=NULL) + gdk_pixmap_unref(hcanvas); + + mygc=gdk_gc_new(widget->window); + + hcanvas=gdk_pixmap_new(widget->window,x=widget->allocation.width, + y=widget->allocation.height,-1); + gdk_draw_rectangle(hcanvas,widget->style->white_gc,TRUE,0,0,x,y); + gdk_draw_rectangle(hcanvas,widget->style->black_gc,FALSE,0,0,x-1,y-1); + + max=0; + for(i=0;i<24;i++) + if (hourly[i]>max) + max=hourly[i]; + + if (max==0) max=1; + fac=((float)(y-18-16))/((float)max); + + cx=1; + xs=(x-2)/24; + fn=gdk_font_load("-*-helvetica-medium-r-*-*-8-*-*-*-*-*-*-*"); + for (i=0;i<24;i++) { + v=(int)(((float)hourly[i])*fac); + gdk_rgb_gc_set_foreground(mygc,0xc0c0c0); + gdk_draw_line(hcanvas,mygc,cx,1,cx,y-2); + gdk_rgb_gc_set_foreground(mygc,0x004080); + gdk_draw_rectangle(hcanvas,mygc,TRUE,cx,y-18-v,xs,v); + cx+=xs; + } + + gdk_rgb_gc_set_foreground(mygc,0x000000); + for(cx=1,i=0;i<24;i+=2) { + sprintf(tmp,"%2d",i); + gdk_draw_string(hcanvas,fn,mygc,cx,y-6,tmp); + cx+=2*xs; + } + + gdk_draw_line(hcanvas,widget->style->black_gc,0,y-18,x-1,y-18); + + gdk_rgb_gc_set_foreground(mygc,0xffffff); + gdk_draw_rectangle(hcanvas,mygc,TRUE,0,0,22*4,13); + gdk_rgb_gc_set_foreground(mygc,0x000000); + gdk_draw_rectangle(hcanvas,mygc,FALSE,0,0,22*4,13); + + gdk_font_unref(fn); + fn=gdk_font_load("-*-helvetica-medium-r-*-*-10-*-*-*-*-*-*-*"); + + gdk_draw_string(hcanvas,fn,mygc,5,10,"hourly summary"); + + gdk_font_unref(fn); + gdk_gc_destroy(mygc); + + return FALSE; +} + +gint +wgra_expose(GtkWidget *widget,GdkEventExpose *ee,gpointer data) +{ + gdk_draw_pixmap(widget->window, + widget->style->fg_gc[GTK_WIDGET_STATE (widget)], + wcanvas, + ee->area.x, ee->area.y, + ee->area.x, ee->area.y, + ee->area.width, ee->area.height); + return FALSE; +} + +gint +wgra_configure(GtkWidget *widget,GdkEventConfigure *ee,gpointer data) +{ + GdkGC *mygc; + int x,y,cx,xs; + int i,v; + long max; + float fac; + GdkFont *fn; + + if (wcanvas!=NULL) + gdk_pixmap_unref(wcanvas); + + mygc=gdk_gc_new(widget->window); + + wcanvas=gdk_pixmap_new(widget->window,x=widget->allocation.width, + y=widget->allocation.height,-1); + gdk_draw_rectangle(wcanvas,widget->style->white_gc,TRUE,0,0,x,y); + gdk_draw_rectangle(wcanvas,widget->style->black_gc,FALSE,0,0,x-1,y-1); + + max=0; + for(i=0;i<7;i++) + if (weekly[i]>max) + max=weekly[i]; + + if (!max) max=1; + fac=((float)(y-18-16))/((float)max); + + cx=1; + xs=(x-2)/7; + fn=gdk_font_load("-*-helvetica-medium-r-*-*-8-*-*-*-*-*-*-*"); + for (i=0;i<7;i++) { + v=(int)(((float)weekly[i])*fac); + gdk_rgb_gc_set_foreground(mygc,0xc0c0c0); + gdk_draw_line(wcanvas,mygc,cx,1,cx,y-2); + gdk_rgb_gc_set_foreground(mygc,0x004080); + gdk_draw_rectangle(wcanvas,mygc,TRUE,cx,y-18-v,xs,v); + gdk_rgb_gc_set_foreground(mygc,0x000000); + gdk_draw_string(wcanvas,fn,mygc,cx,y-6,wdays[i]); + cx+=xs; + } + + gdk_draw_line(wcanvas,widget->style->black_gc,0,y-18,x-1,y-18); + + gdk_rgb_gc_set_foreground(mygc,0xffffff); + gdk_draw_rectangle(wcanvas,mygc,TRUE,0,0,23*4,13); + gdk_rgb_gc_set_foreground(mygc,0x000000); + gdk_draw_rectangle(wcanvas,mygc,FALSE,0,0,23*4,13); + + gdk_font_unref(fn); + fn=gdk_font_load("-*-helvetica-medium-r-*-*-10-*-*-*-*-*-*-*"); + + gdk_draw_string(wcanvas,fn,mygc,5,10,"weekday summary"); + + gdk_font_unref(fn); + gdk_gc_destroy(mygc); + + return FALSE; +} + +void +time_menu(GtkMenuItem *gmi,gpointer data) +{ + int x; + struct tm *his; + time_t t; + + x=*((int *)data); + + t=time(NULL); + his=localtime(&t); + + switch(x) { + case 0: /* all */ + time_cons[0]=time_cons[1]=0; + break; + case 1: /* today */ + his->tm_sec=0; + his->tm_min=0; + his->tm_hour=0; + time_cons[0]=mktime(his); + his->tm_sec=59; + his->tm_min=59; + his->tm_hour=23; + time_cons[1]=mktime(his); + break; + case 2: /* yesterday */ + t-=24*3600; + his=localtime(&t); + his->tm_sec=0; + his->tm_min=0; + his->tm_hour=0; + time_cons[0]=mktime(his); + his->tm_sec=59; + his->tm_min=59; + his->tm_hour=23; + time_cons[1]=mktime(his); + break; + case 3: /* this week */ + t-=((long)(24*3600))*((long)(his->tm_wday)); + his=localtime(&t); + his->tm_sec=0; + his->tm_min=0; + his->tm_hour=0; + time_cons[0]=mktime(his); + time_cons[1]=time(NULL); + break; + case 4: /* this month */ + t-=((long)(24*3600))*((long)(his->tm_mday)); + his=localtime(&t); + his->tm_sec=0; + his->tm_min=0; + his->tm_hour=0; + time_cons[0]=mktime(his); + time_cons[1]=time(NULL); + break; + case 5: /* this year */ + t-=((long)(24*3600))*((long)(his->tm_yday)); + his=localtime(&t); + his->tm_sec=0; + his->tm_min=0; + his->tm_hour=0; + time_cons[0]=mktime(his); + time_cons[1]=time(NULL); + break; + case 6: /* Last 24 hours */ + time_cons[0]=t-24*3600; + time_cons[1]=t; + break; + case 7: /* Last 7 days */ + time_cons[0]=t-7*24*3600; + time_cons[1]=t; + break; + case 8: /* Last 30 days */ + time_cons[0]=t-30*24*3600; + time_cons[1]=t; + break; + case 9: + time_cons[0]=t-365*24*3600; + time_cons[1]=t; + break; + default: + return; + } + make_resume(); +} + +void +user_menu(GtkMenuItem *gmi,gpointer data) +{ + useridx=*((int *)data); + make_resume(); +} + +void +isp_menu(GtkMenuItem *gmi,gpointer data) +{ + ispidx=*((int *)data); + make_resume(); +} + +int +already_exists(char *s,GList *pt) +{ + GList *w; + for(w=pt;w!=NULL;w=g_list_next(w)) { + if (!strcmp((char *)(w->data),s)) + return 1; + } + return 0; +} diff --git a/yawmppp/src/gtklog/loglist.h b/yawmppp/src/gtklog/loglist.h new file mode 100644 index 0000000..62adf0d --- /dev/null +++ b/yawmppp/src/gtklog/loglist.h @@ -0,0 +1,39 @@ + +#ifndef LOGLIST_H +#define LOGLIST_H + +#include + +void create_loglist(void); +void load_log(void); +void prepend_log_entry(char *); +void free_log(void); +void update_list(void); +void make_resume(void); +void add_hourly(long s,long e); +void add_weekly(long s,long e); + +gint applet_kill (GtkWidget * widget, GdkEvent * event, gpointer data); +void applet_destroy (GtkWidget * widget, gpointer data); + +void time_menu(GtkMenuItem *gmi,gpointer data); +void user_menu(GtkMenuItem *gmi,gpointer data); +void isp_menu(GtkMenuItem *gmi,gpointer data); +int already_exists(char *s,GList *pt); + +gint hgra_expose(GtkWidget *,GdkEventExpose *,gpointer); +gint hgra_configure(GtkWidget *,GdkEventConfigure *,gpointer); +gint wgra_expose(GtkWidget *,GdkEventExpose *,gpointer); +gint wgra_configure(GtkWidget *,GdkEventConfigure *,gpointer); + +struct logentry { + time_t start; + time_t end; + int status; /* 0=ok 1=error 2=crash */ + char longname[128]; + char shortname[16]; + char phone[32]; + char user[32]; +}; + +#endif diff --git a/yawmppp/src/gtklog/status_crash.xpm b/yawmppp/src/gtklog/status_crash.xpm new file mode 100644 index 0000000..8680d62 --- /dev/null +++ b/yawmppp/src/gtklog/status_crash.xpm @@ -0,0 +1,64 @@ +/* XPM */ +static char * status_crash_xpm[] = { +"16 16 45 1", +" c None", +". c #000000", +"+ c #FF8A3D", +"@ c #FFE43A", +"# c #FFEBD1", +"$ c #080808", +"% c #484848", +"& c #585858", +"* c #545454", +"= c #474747", +"- c #292929", +"; c #606060", +"> c #6D6D6D", +", c #737373", +"' c #5D5D5D", +") c #2B2B2B", +"! c #181818", +"~ c #111111", +"{ c #575757", +"] c #828282", +"^ c #8D8D8D", +"/ c #060606", +"( c #0D0D0D", +"_ c #404040", +": c #595959", +"< c #A7A7A7", +"[ c #3F3F3F", +"} c #242424", +"| c #0A0A0A", +"1 c #0C0C0C", +"2 c #3D3D3D", +"3 c #555555", +"4 c #3B3B3B", +"5 c #222222", +"6 c #323232", +"7 c #494949", +"8 c #1A1A1A", +"9 c #020202", +"0 c #252525", +"a c #383838", +"b c #0F0F0F", +"c c #171717", +"d c #131313", +"e c #030303", +"f c #010101", +" .+..@. ", +" .@+.++. ", +" .++.#.. ", +" ....@.#.++. ", +" $%&*=@.#.@@. ", +" .-;>,>')#)!.. ", +" ~{>]^]>)))/( ", +"._:,^<^,:[}|1. ", +".23>]^]>345$.. ", +".67'>,>'7689.. ", +".0a73:37a}b... ", +".c}64[46}d..e. ", +" 9b85}58b...f ", +" .f9$|$9..... ", +" ........ ", +" ...... "}; diff --git a/yawmppp/src/gtklog/status_error.xpm b/yawmppp/src/gtklog/status_error.xpm new file mode 100644 index 0000000..a07330e --- /dev/null +++ b/yawmppp/src/gtklog/status_error.xpm @@ -0,0 +1,124 @@ +/* XPM */ +static char * status_error_xpm[] = { +"16 16 105 2", +" c None", +". c #000000", +"+ c #B81818", +"@ c #B61818", +"# c #AD1514", +"$ c #A11111", +"% c #920B0B", +"& c #7E0504", +"* c #B91819", +"= c #B9191B", +"- c #B51A1B", +"; c #C21D1C", +"> c #C21A1B", +", c #B51718", +"' c #9B0E0E", +") c #7E0505", +"! c #6F0204", +"~ c #B21717", +"{ c #B41919", +"] c #952A2A", +"^ c #B37575", +"/ c #971C1C", +"( c #BF1D1C", +"_ c #B81718", +": c #880E0E", +"< c #824040", +"[ c #5C1617", +"} c #620204", +"| c #B71819", +"1 c #A21819", +"2 c #DBC6C4", +"3 c #FEFEFC", +"4 c #CDACAB", +"5 c #901414", +"6 c #955959", +"7 c #CFC1C0", +"8 c #550204", +"9 c #6D0204", +"0 c #A21110", +"a c #BB1819", +"b c #B11C1C", +"c c #994948", +"d c #F2EBEA", +"e c #F8F4F3", +"f c #9B5F5F", +"g c #7C3333", +"h c #F7F4F2", +"i c #764849", +"j c #5C0204", +"k c #710204", +"l c #9C0F0F", +"m c #C31D1B", +"n c #A01C1C", +"o c #B88786", +"p c #E3D7D5", +"q c #A17B7B", +"r c #5B0204", +"s c #6B0204", +"t c #930C0B", +"u c #AA1414", +"v c #BA191A", +"w c #B51A1A", +"x c #7F1414", +"y c #CAB0AF", +"z c #BFADAC", +"A c #550405", +"B c #850707", +"C c #990E0E", +"D c #A51212", +"E c #9A1111", +"F c #77201F", +"G c #DED5D4", +"H c #571617", +"I c #600204", +"J c #6C0204", +"K c #790304", +"L c #840706", +"M c #890808", +"N c #6D0909", +"O c #B2908F", +"P c #C5B7B6", +"Q c #4A0204", +"R c #660204", +"S c #6E0204", +"T c #750304", +"U c #977171", +"V c #E6DFDE", +"W c #501617", +"X c #D6CBCA", +"Y c #A08584", +"Z c #510204", +"` c #680204", +" . c #530204", +".. c #7C5253", +"+. c #5A0204", +"@. c #6D3E3F", +"#. c #642A2B", +"$. c #650204", +"%. c #703E3F", +"&. c #560204", +"*. c #690204", +"=. c #570204", +"-. c #6E3E3F", +";. c #630204", +">. c #640204", +" . . . . . . ", +" . . + @ # $ % & . . ", +" . * = - ; > , ' ) ! ! . ", +" . ~ { ] ^ / ( _ : < [ } ! . ", +" . | 1 2 3 4 / 5 6 3 7 8 9 . ", +". 0 a b c d e f g h 3 i j ! k . ", +". l @ m n o 3 3 p 3 q r s k k . ", +". t u v w x y 3 3 z A s ! k k . ", +". B C D E F p 3 3 G H I J ! k . ", +". K L M N O 3 G G 3 P Q R k S . ", +". k T } U 3 V W W X 3 Y Z ` k . ", +" . S .7 3 ..8 +.@.3 3 #.$.. ", +" . ! } H %.&.s *.=.-.-.+.J . ", +" . ! R ;.9 k k J >.>.s . ", +" . . k k S k k k . . ", +" . . . . . . "}; diff --git a/yawmppp/src/gtklog/status_ok.xpm b/yawmppp/src/gtklog/status_ok.xpm new file mode 100644 index 0000000..e9fc6cf --- /dev/null +++ b/yawmppp/src/gtklog/status_ok.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * status_ok_xpm[] = { +"16 16 4 1", +" c None", +". c #000000", +"+ c #7FDB82", +"@ c #1CA525", +" . ", +" .+.", +" .+@.", +" .+@.", +" .+@. ", +" .+@. ", +" . .+@. ", +" .+. .+@. ", +" .+@@. .+@. ", +" .@@@. .+@. ", +" .@@@..+@. ", +" .@@@+@@. ", +" .@@@@. ", +" .@@@. ", +" .@. ", +" . "}; diff --git a/yawmppp/src/gtksetup/Makefile.in b/yawmppp/src/gtksetup/Makefile.in new file mode 100644 index 0000000..388196f --- /dev/null +++ b/yawmppp/src/gtksetup/Makefile.in @@ -0,0 +1,37 @@ +# +# gtksetup: a setup applet for yawmppp +# + +CC = @CC@ +CFLAGS = -Wall -O2 +GTKLIB = @GTK_LIBS@ +GTKFLAG = @GTK_FLAGS@ +RLFLAG = -DVERSION=\"@MK_YAWMPPP_RELEASE@\" -DIPREFIX=\"@prefix@\" -D@SYSDEF@ +PROGINST = @INSTALL@ + +ALLDOTOS = applet.o msgbox.o +ALLDOTHS = applet.h msgbox.h ../isprc.h +EOBJS = ../isprc.o ../about.o + +all: build_gtksetup + +build_gtksetup: $(ALLDOTOS) + $(CC) $(ALLDOTOS) $(EOBJS) -o yawmppp.pref $(GTKLIB) + +$(ALLDOTOS): %.o : %.c $(ALLDOTHS) + $(CC) $(CFLAGS) $(RLFLAG) $(GTKFLAG) -I.. -c $< -o $@ + +install: + $(PROGINST) -m 0755 yawmppp.pref @prefix@/bin/yawmppp.pref + $(PROGINST) -m 0644 pppdoc.xpm @prefix@/share/icons/pppdoc.xpm + +install-strip: + $(PROGINST) -s -m 0755 yawmppp.pref @prefix@/bin/yawmppp.pref + $(PROGINST) -m 0644 pppdoc.xpm @prefix@/share/icons/pppdoc.xpm + +clean: + rm -f $(ALLDOTOS) yawmppp.pref + +distclean: + rm -f Makefile *~ + diff --git a/yawmppp/src/gtksetup/applet.c b/yawmppp/src/gtksetup/applet.c new file mode 100644 index 0000000..41f3f68 --- /dev/null +++ b/yawmppp/src/gtksetup/applet.c @@ -0,0 +1,2858 @@ +/* + + YAWMPPP - PPP dock app/helper for WindowMaker + Copyright (C) 2000,2001: + + Author: Felipe Bergo (bergo@seul.org) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + $Id: applet.c,v 1.2 2001/04/21 18:29:33 bergo Exp $ + + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "applet.h" +#include "isprc.h" +#include "about.h" +#include "msgbox.h" + +#include "stepphone.xpm" +#include "pppdoc.xpm" +#include "padlock.xpm" + +/* straight from the Gimp... */ +#include "cmd_new.xpm" +#include "cmd_dup.xpm" +#include "cmd_del.xpm" +#include "cmd_up.xpm" +#include "cmd_down.xpm" + +GtkWidget *applet,*nbook; +GtkWidget *isp_list,*rem_button,*dup_button, + *up_button,*dn_button; +GtkWidget *right_pane[8]; + +GtkWidget *ppp_pw[31]; + +struct YAWMPPP_ISP_INFO rc_entries[MAX_ISPS]; +struct PREF_ISP_INFO pref_entries[MAX_ISPS]; +struct PREF_PPP_OPT pppo; +int isp_count; + +int selected_entry=-1; + +char chat_path[512]; +char pppd_path[512]; + +int man_flag[6]={0,0,0,0,0,0}; +char *man_help[6]; + +GdkFont *fixedfont=NULL; + +int +main(int argc, char **argv) +{ + int i; + + gtk_init(&argc,&argv); + find_out_paths(); + + create_preferences_panel(); + load_rc_entries(); + set_ppp_pane(); + + if (gdk_screen_width()>800) + fixedfont=gdk_font_load("-*-fixed-medium-r-normal--15-*-*-*-*-*-*"); + else + fixedfont=gdk_font_load("-*-fixed-medium-r-normal--10-*-*-*-*-*-*"); + + gtk_main(); + + gdk_font_unref(fixedfont); + + for(i=0;i<6;i++) + if (man_flag[i]) + g_free(man_help[i]); + + return 0; +} + +void +create_preferences_panel(void) +{ + GtkWidget *mvb; + GtkWidget *hs,*bhb,*cb[5],*lt,*up,*down,*nl[2]; + GtkWidget *mhb,*svb,*sw,*aw[30],*rp,*vs,*ghb,*abo,*pppp,*hel; + + GtkStyle *style; + GdkBitmap *mask; + GdkPixmap *myicon,*tp; + + GtkTooltips *tips; + + int i; + + applet=gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_widget_set_usize (applet, 550, 430); + gtk_window_set_title (GTK_WINDOW (applet), "YAWMPPP Configuration"); + gtk_window_set_wmclass(GTK_WINDOW(applet),"yawmppp","pref"); + gtk_container_set_border_width(GTK_CONTAINER(applet),4); + gtk_widget_show (applet); + + style=gtk_widget_get_style(applet); + myicon = gdk_pixmap_create_from_xpm_d (applet->window, &mask, + &style->bg[GTK_STATE_NORMAL], + (gchar **) stepphone_xpm); + gdk_window_set_icon (applet->window, NULL, myicon, mask); + gdk_window_set_icon_name(applet->window,"yawmppp"); + + mvb=gtk_vbox_new(FALSE,2); + gtk_container_add(GTK_CONTAINER(applet),mvb); + + nbook=gtk_notebook_new(); + gtk_box_pack_start(GTK_BOX(mvb),nbook,TRUE,TRUE,0); + + mhb=gtk_hbox_new(FALSE,2); + + nl[0]=gtk_label_new("Dialing Entries"); + gtk_notebook_append_page(GTK_NOTEBOOK(nbook),mhb,nl[0]); + + nl[1]=gtk_label_new("PPP Options"); + pppp=make_ppp_pane(); + gtk_notebook_append_page(GTK_NOTEBOOK(nbook),pppp,nl[1]); + + /* LEFT PANE */ + + svb=gtk_vbox_new(FALSE,2); + gtk_box_pack_start(GTK_BOX(mhb),svb,TRUE,TRUE,2); + + aw[0]=hlabel_new("YAWMPPP Dialing Entries:"); + gtk_box_pack_start(GTK_BOX(svb),aw[0],FALSE,TRUE,2); + + sw=gtk_scrolled_window_new(NULL,NULL); + gtk_box_pack_start(GTK_BOX(svb),sw,TRUE,TRUE,4); + gtk_widget_show(sw); + gtk_container_set_border_width(GTK_CONTAINER(sw),0); + + isp_list=gtk_clist_new(2); + gtk_clist_set_shadow_type(GTK_CLIST(isp_list),GTK_SHADOW_IN); + gtk_clist_set_selection_mode(GTK_CLIST(isp_list),GTK_SELECTION_SINGLE); + gtk_clist_column_titles_passive(GTK_CLIST(isp_list)); + gtk_clist_column_titles_hide(GTK_CLIST(isp_list)); + gtk_clist_set_column_width(GTK_CLIST(isp_list),0,34); + gtk_clist_set_column_width(GTK_CLIST(isp_list),1,110); + gtk_clist_set_row_height(GTK_CLIST(isp_list),36); + gtk_clist_set_column_auto_resize(GTK_CLIST(isp_list),1,TRUE); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_ALWAYS); + gtk_container_add(GTK_CONTAINER(sw),isp_list); + gtk_widget_show(isp_list); + + lt=gtk_hbox_new(TRUE,0); + gtk_box_pack_start(GTK_BOX(svb),lt,FALSE,FALSE,2); + + /* NEW */ + tp=gdk_pixmap_create_from_xpm_d (applet->window, &mask, + &style->bg[GTK_STATE_NORMAL], + (gchar **) cmd_new_xpm); + up=gtk_pixmap_new(tp,mask); gtk_widget_show(up); gdk_pixmap_unref(tp); + aw[1]=gtk_button_new(); + gtk_container_add(GTK_CONTAINER(aw[1]),up); + + /* DEL */ + tp=gdk_pixmap_create_from_xpm_d (applet->window, &mask, + &style->bg[GTK_STATE_NORMAL], + (gchar **) cmd_del_xpm); + up=gtk_pixmap_new(tp,mask); gtk_widget_show(up); gdk_pixmap_unref(tp); + rem_button=aw[2]=gtk_button_new(); + gtk_container_add(GTK_CONTAINER(aw[2]),up); + + /* DUP */ + tp=gdk_pixmap_create_from_xpm_d (applet->window, &mask, + &style->bg[GTK_STATE_NORMAL], + (gchar **) cmd_dup_xpm); + up=gtk_pixmap_new(tp,mask); gtk_widget_show(up); gdk_pixmap_unref(tp); + dup_button=aw[19]=gtk_button_new(); + gtk_container_add(GTK_CONTAINER(aw[19]),up); + + /* UP */ + tp=gdk_pixmap_create_from_xpm_d (applet->window, &mask, + &style->bg[GTK_STATE_NORMAL], + (gchar **) cmd_up_xpm); + up=gtk_pixmap_new(tp,mask); gtk_widget_show(up); gdk_pixmap_unref(tp); + up_button=aw[20]=gtk_button_new(); + gtk_container_add(GTK_CONTAINER(aw[20]),up); + + /* DOWN */ + tp=gdk_pixmap_create_from_xpm_d (applet->window, &mask, + &style->bg[GTK_STATE_NORMAL], + (gchar **) cmd_down_xpm); + down=gtk_pixmap_new(tp,mask); gtk_widget_show(down); gdk_pixmap_unref(tp); + dn_button=aw[21]=gtk_button_new(); + gtk_container_add(GTK_CONTAINER(aw[21]),down); + + gtk_box_pack_start(GTK_BOX(lt),aw[1],FALSE,TRUE,0); + gtk_box_pack_start(GTK_BOX(lt),aw[19],FALSE,TRUE,0); + gtk_box_pack_start(GTK_BOX(lt),aw[2],FALSE,TRUE,0); + gtk_box_pack_start(GTK_BOX(lt),aw[21],FALSE,TRUE,0); + gtk_box_pack_start(GTK_BOX(lt),aw[20],FALSE,TRUE,0); + + /* TIPS */ + tips=gtk_tooltips_new(); + gtk_tooltips_set_tip(tips,aw[1],"New entry",NULL); + gtk_tooltips_set_tip(tips,aw[19],"Duplicate entry",NULL); + gtk_tooltips_set_tip(tips,aw[2],"Delete entry",NULL); + gtk_tooltips_set_tip(tips,aw[21],"Move down",NULL); + gtk_tooltips_set_tip(tips,aw[20],"Move up",NULL); + + vs=gtk_vseparator_new(); + gtk_box_pack_start(GTK_BOX(mhb),vs,FALSE,TRUE,2); + + /* RIGHT PANE */ + + aw[3]=hlabel_new("Selected Entry:"); + + rp=gtk_vbox_new(FALSE,0); + gtk_box_pack_start(GTK_BOX(mhb),rp,TRUE,TRUE,2); + + aw[4]=hlabel_new("Description"); + aw[6]=hlabel_new("Display Handle"); + aw[8]=hlabel_new("Phone number"); + aw[10]=hlabel_new("Modem device"); + aw[12]=hlabel_new("Username"); + aw[14]=hlabel_new("Password"); + + right_pane[0]=aw[5]=gtk_entry_new_with_max_length(128); + right_pane[1]=aw[7]=gtk_entry_new_with_max_length(16); + right_pane[2]=aw[9]=gtk_entry_new_with_max_length(32); + right_pane[3]=aw[11]=gtk_entry_new_with_max_length(64); + right_pane[4]=aw[13]=gtk_entry_new_with_max_length(32); + right_pane[5]=aw[15]=gtk_entry_new_with_max_length(32); + + gtk_entry_set_visibility(GTK_ENTRY(aw[15]),FALSE); + + right_pane[6]=aw[16]=gtk_check_button_new_with_label("Pulse dialing"); + + aw[17]=gtk_hbox_new(FALSE,2); + + for(i=3;i<=17;i++) + gtk_box_pack_start(GTK_BOX(rp),aw[i],FALSE,TRUE,(i<4)?2:1); + + right_pane[7]=aw[18]=gtk_button_new_with_label(" More settings... "); + gtk_box_pack_end(GTK_BOX(aw[17]),aw[18],FALSE,FALSE,2); + + /* BOTTOM */ + + hs=gtk_hseparator_new(); + gtk_box_pack_start(GTK_BOX(mvb),hs,FALSE,FALSE,2); + + ghb=gtk_hbox_new(FALSE,2); + gtk_box_pack_start(GTK_BOX(mvb),ghb,FALSE,FALSE,2); + abo=gtk_button_new_with_label(" ... "); + gtk_box_pack_start(GTK_BOX(ghb),abo,FALSE,FALSE,2); + hel=gtk_button_new_with_label(" Help "); + gtk_box_pack_start(GTK_BOX(ghb),hel,FALSE,FALSE,4); + + bhb=gtk_hbox_new(TRUE,4); + gtk_box_pack_start(GTK_BOX(ghb),bhb,TRUE,TRUE,2); + + cb[0]=gtk_button_new_with_label(" Apply "); + cb[1]=gtk_button_new_with_label(" Cancel "); + cb[2]=gtk_button_new_with_label(" OK"); + + cb[3]=gtk_label_new(" "); + cb[4]=gtk_label_new(" "); + + gtk_box_pack_start(GTK_BOX(bhb),cb[3],FALSE,TRUE,4); + gtk_box_pack_start(GTK_BOX(bhb),cb[4],FALSE,TRUE,4); + gtk_box_pack_start(GTK_BOX(bhb),cb[0],FALSE,TRUE,4); + gtk_box_pack_start(GTK_BOX(bhb),cb[1],FALSE,TRUE,4); + gtk_box_pack_start(GTK_BOX(bhb),cb[2],FALSE,TRUE,4); + + gtk_tooltips_set_tip(tips,abo,"About...",NULL); + + for(i=0;i<5;i++) + gtk_widget_show(cb[i]); + for(i=0;i<22;i++) + gtk_widget_show(aw[i]); + for(i=0;i<2;i++) + gtk_widget_show(nl[i]); + gtk_widget_show(bhb); + gtk_widget_show(abo); + gtk_widget_show(hel); + gtk_widget_show(ghb); + gtk_widget_show(rp); + gtk_widget_show(lt); + gtk_widget_show(vs); + gtk_widget_show(hs); + gtk_widget_show(svb); + gtk_widget_show(mhb); + gtk_widget_show(nbook); + gtk_widget_show(mvb); + + /* signal plumbing */ + gtk_signal_connect (GTK_OBJECT (applet), "delete_event", + GTK_SIGNAL_FUNC (applet_kill), NULL); + gtk_signal_connect (GTK_OBJECT (applet), "destroy", + GTK_SIGNAL_FUNC (applet_destroy), NULL); + + gtk_signal_connect (GTK_OBJECT (isp_list), "select_row", + GTK_SIGNAL_FUNC (list_select), NULL); + gtk_signal_connect (GTK_OBJECT (isp_list), "unselect_row", + GTK_SIGNAL_FUNC (list_unselect), NULL); + + gtk_signal_connect (GTK_OBJECT (dn_button), "clicked", + GTK_SIGNAL_FUNC (list_movedown), NULL); + gtk_signal_connect (GTK_OBJECT (up_button), "clicked", + GTK_SIGNAL_FUNC (list_moveup), NULL); + gtk_signal_connect (GTK_OBJECT (rem_button), "clicked", + GTK_SIGNAL_FUNC (list_remove), NULL); + gtk_signal_connect (GTK_OBJECT (dup_button), "clicked", + GTK_SIGNAL_FUNC (list_duplicate), NULL); + gtk_signal_connect (GTK_OBJECT (aw[1]), "clicked", + GTK_SIGNAL_FUNC (list_add), NULL); + gtk_signal_connect (GTK_OBJECT (right_pane[7]), "clicked", + GTK_SIGNAL_FUNC (pop_advanced), NULL); + + gtk_signal_connect (GTK_OBJECT (right_pane[0]), "changed", + GTK_SIGNAL_FUNC (isp_rename), NULL); + + gtk_signal_connect (GTK_OBJECT (cb[0]), "clicked", + GTK_SIGNAL_FUNC (applet_apply), NULL); + gtk_signal_connect (GTK_OBJECT (cb[1]), "clicked", + GTK_SIGNAL_FUNC (applet_destroy), NULL); + gtk_signal_connect (GTK_OBJECT (cb[2]), "clicked", + GTK_SIGNAL_FUNC (applet_save_and_quit), NULL); + + gtk_signal_connect (GTK_OBJECT (abo), "clicked", + GTK_SIGNAL_FUNC (applet_about), (gpointer)GTK_WINDOW(applet)); + gtk_signal_connect (GTK_OBJECT (hel), "clicked", + GTK_SIGNAL_FUNC (pop_help), NULL); + gtk_notebook_set_page(GTK_NOTEBOOK(nbook),0); +} + +gint +applet_kill (GtkWidget * widget, GdkEvent * event, gpointer data) +{ + return FALSE; +} + +void +applet_destroy (GtkWidget * widget, gpointer data) +{ + gtk_main_quit(); +} + +void +list_select(GtkCList *cl, + gint row, + gint column, + GdkEventButton *geb, + gpointer data) +{ + selected_entry=row; + update_right_pane(); +} + +void +list_unselect(GtkCList *cl, + gint row, + gint column, + GdkEventButton *geb, + gpointer data) +{ + commit_back_to_db(); + selected_entry=-1; + clear_and_disable_right_pane(); +} + +GtkWidget * +hlabel_new(char *s) +{ + GtkWidget *h,*l; + h=gtk_hbox_new(FALSE,0); + l=gtk_label_new(s); + gtk_label_set_justify(GTK_LABEL(l),GTK_JUSTIFY_LEFT); + gtk_box_pack_start(GTK_BOX(h),l,FALSE,FALSE,0); + gtk_container_set_border_width(GTK_CONTAINER(h),1); + gtk_widget_show(l); + return(h); +} + +void +clear_and_disable_right_pane(void) +{ + int i; + + for(i=0;i<6;i++) { + gtk_editable_select_region(GTK_EDITABLE(right_pane[i]),0,-1); + gtk_editable_delete_selection(GTK_EDITABLE(right_pane[i])); + gtk_widget_set_sensitive(right_pane[i],FALSE); + } + + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(right_pane[6]),FALSE); + gtk_widget_set_sensitive(right_pane[6],FALSE); + gtk_widget_set_sensitive(right_pane[7],FALSE); + gtk_widget_set_sensitive(rem_button,FALSE); + gtk_widget_set_sensitive(up_button,FALSE); + gtk_widget_set_sensitive(dn_button,FALSE); + gtk_widget_set_sensitive(dup_button,FALSE); +} + +void +update_right_pane(void) +{ + int i; + + if (selected_entry<0) { + clear_and_disable_right_pane(); + return; + } + + for(i=0;i<8;i++) + gtk_widget_set_sensitive(right_pane[i],TRUE); + + gtk_entry_set_text(GTK_ENTRY(right_pane[0]), + pref_entries[selected_entry].LongName); + gtk_entry_set_text(GTK_ENTRY(right_pane[1]), + pref_entries[selected_entry].ShortName); + gtk_entry_set_text(GTK_ENTRY(right_pane[2]), + pref_entries[selected_entry].Phone); + gtk_entry_set_text(GTK_ENTRY(right_pane[3]), + pref_entries[selected_entry].Device); + gtk_entry_set_text(GTK_ENTRY(right_pane[4]), + pref_entries[selected_entry].Username); + gtk_entry_set_text(GTK_ENTRY(right_pane[5]), + pref_entries[selected_entry].Password); + + if (atoi(pref_entries[selected_entry].PulseDial)) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(right_pane[6]),TRUE); + else + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(right_pane[6]),FALSE); + gtk_widget_set_sensitive(rem_button,TRUE); + gtk_widget_set_sensitive(up_button,(selected_entry!=0)); + gtk_widget_set_sensitive(dn_button,(selected_entry<(isp_count-1))); + gtk_widget_set_sensitive(dup_button,TRUE); +} + +void +commit_back_to_db(void) +{ + if (selected_entry<0) + return; + + strcpy(pref_entries[selected_entry].LongName, + gtk_entry_get_text(GTK_ENTRY(right_pane[0]))); + strcpy(pref_entries[selected_entry].ShortName, + gtk_entry_get_text(GTK_ENTRY(right_pane[1]))); + strcpy(pref_entries[selected_entry].Phone, + gtk_entry_get_text(GTK_ENTRY(right_pane[2]))); + strcpy(pref_entries[selected_entry].Device, + gtk_entry_get_text(GTK_ENTRY(right_pane[3]))); + strcpy(pref_entries[selected_entry].Username, + gtk_entry_get_text(GTK_ENTRY(right_pane[4]))); + strcpy(pref_entries[selected_entry].Password, + gtk_entry_get_text(GTK_ENTRY(right_pane[5]))); + + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(right_pane[6]))) + strcpy(pref_entries[selected_entry].PulseDial,"1"); + else + strcpy(pref_entries[selected_entry].PulseDial,"0"); +} + +void +load_rc_entries(void) +{ + char p[512],*q; + int i; + + q=getenv("HOME"); + sprintf(p,"%s/.yawmppp2/yawmppprc",q); + isp_count=GetISPInfo(p,&rc_entries[0],MAX_ISPS); + + read_ppp_options_from_rc(p); + + for(i=0;iDevice,"/dev/modem"); + if ((p=getenv("USER"))!=NULL) + strcpy(pii->Username,p); + strcpy(pii->ModemInit1,"ATZ"); + strcpy(pii->ModemInit2,"ATM1L2"); + strcpy(pii->PulseDial,"0"); + strcpy(pii->UserString,"ogin:"); + strcpy(pii->PassString,"word:"); + strcpy(pii->ModemSpeed,"115200"); + pii->nExpectPairs=0; + + memcpy(&(pii->ppp),&(wii->ppp),sizeof(struct ISP_PPP)); + + /* entry name */ + strcpy(pii->LongName,wii->LongName); + strcpy(pii->ShortName,wii->ShortName); + pii->nologin=wii->nologin; + + /* get device and chat script filename from "Start" file */ + f=fopen(wii->PPPLine,"r"); + if (!f) return; + + fgets(pii->Device,63,f); strtok(pii->Device,"\n"); + fgets(pii->ModemSpeed,15,f); strtok(pii->ModemSpeed,"\n"); + fgets(pii->PulseDial,7,f); strtok(pii->PulseDial,"\n"); + fgets(pii->Phone,31,f); strtok(pii->Phone,"\n"); + fgets(pii->ModemInit1,255,f); strtok(pii->ModemInit1,"\n"); + fgets(pii->ModemInit2,255,f); strtok(pii->ModemInit2,"\n"); + + fgets(pii->UserString,31,f); strtok(pii->UserString,"\n"); + fgets(pii->Username,31,f); strtok(pii->Username,"\n"); + + fgets(pii->PassString,31,f); strtok(pii->PassString,"\n"); + fgets(pii->Password,31,f); strtok(pii->Password,"\n"); + + fgets(tmp,511,f); strtok(tmp,"\n"); pii->nExpectPairs=atoi(tmp); + for(i=0;inExpectPairs;i++) { + fgets(pii->s_expect[i],31,f); strtok(pii->s_expect[i],"\n"); + fgets(pii->s_send[i],31,f); strtok(pii->s_send[i],"\n"); + } + fclose(f); +} + +void +list_moveup(GtkWidget *gw,gpointer data) +{ + int j; + struct PREF_ISP_INFO tmp; + j=selected_entry; + commit_back_to_db(); + selected_entry=-1; + clear_and_disable_right_pane(); + + memcpy(&tmp,&pref_entries[j],sizeof(struct PREF_ISP_INFO)); + memcpy(&pref_entries[j],&pref_entries[j-1],sizeof(struct PREF_ISP_INFO)); + memcpy(&pref_entries[j-1],&tmp,sizeof(struct PREF_ISP_INFO)); + + fill_list(); + gtk_clist_select_row(GTK_CLIST(isp_list),j-1,0); +} + +void +list_movedown(GtkWidget *gw,gpointer data) +{ + int j; + struct PREF_ISP_INFO tmp; + j=selected_entry; + commit_back_to_db(); + selected_entry=-1; + clear_and_disable_right_pane(); + + memcpy(&tmp,&pref_entries[j],sizeof(struct PREF_ISP_INFO)); + memcpy(&pref_entries[j],&pref_entries[j+1],sizeof(struct PREF_ISP_INFO)); + memcpy(&pref_entries[j+1],&tmp,sizeof(struct PREF_ISP_INFO)); + + fill_list(); + gtk_clist_select_row(GTK_CLIST(isp_list),j+1,0); +} + +void +fill_list(void) +{ + int i; + char *q,*pp[2]; + GtkStyle *style; + GdkBitmap *mask; + GdkPixmap *tp; + + style=gtk_widget_get_style(applet); + tp = gdk_pixmap_create_from_xpm_d (applet->window, &mask, + &style->bg[GTK_STATE_NORMAL], + (gchar **) pppdoc_xpm); + + gtk_clist_freeze(GTK_CLIST(isp_list)); + gtk_clist_clear(GTK_CLIST(isp_list)); + + for(i=0;i=MAX_ISPS) { + message_box(GTK_WINDOW(applet), + ERR_MAX_ISPS,"Error", + MSGBOX_OK,MSGBOX_ICON_EXCLAMATION); + return; + } + + commit_back_to_db(); + i=selected_entry; + memcpy(&pref_entries[isp_count],&pref_entries[i], + sizeof(struct PREF_ISP_INFO)); + selected_entry=-1; + clear_and_disable_right_pane(); + sprintf(tmp,"copy of %s",pref_entries[isp_count].LongName); + strcpy(pref_entries[isp_count].LongName,tmp); + isp_count++; + fill_list(); + gtk_clist_select_row(GTK_CLIST(isp_list),i,0); +} + +void +list_add(GtkWidget *gw,gpointer data) +{ + int i; + struct PREF_ISP_INFO *ne; + + if (isp_count>=MAX_ISPS) { + message_box(GTK_WINDOW(applet), + ERR_MAX_ISPS,"Error", + MSGBOX_OK,MSGBOX_ICON_EXCLAMATION); + return; + } + + i=selected_entry; + commit_back_to_db(); + selected_entry=-1; + clear_and_disable_right_pane(); + + ne=&pref_entries[isp_count]; + memset(ne,0,sizeof(struct PREF_ISP_INFO)); + + strcpy(ne->LongName,"New Entry"); + strcpy(ne->ShortName,"ISP"); + strcpy(ne->Device,"/dev/modem"); + strcpy(ne->ModemInit1,"ATZ"); + strcpy(ne->ModemInit2,"ATM1L2"); + strcpy(ne->UserString,"ogin:"); + strcpy(ne->PassString,"word:"); + strcpy(ne->ModemSpeed,"57600"); + ne->nExpectPairs=0; + + ne->ppp.override=0; + ne->ppp.noipdefault=1; + ne->ppp.noauth=1; + ne->ppp.passive=0; + ne->ppp.defaultroute=1; + ne->ppp.chap=AUTH_DONTCARE; + ne->ppp.pap=AUTH_DONTCARE; + + isp_count++; + fill_list(); + if (i>=0) + gtk_clist_select_row(GTK_CLIST(isp_list),i,0); +} + +GtkWidget *adv_e[7],*advdlg,*adv_w[20],*adv_nl; +struct PREF_ISP_INFO adv_regret; + +void +pop_advanced(GtkWidget *gw,gpointer data) +{ + GtkWidget *dlg,*l[7],*hs,*bhb,*bt[4],*esp,*esb; + GtkWidget *av[30]; + GSList *pap,*chap; + char tmp[128]; + int i; + struct PREF_ISP_INFO *pii; + + memcpy(&adv_regret,&pref_entries[selected_entry],sizeof(struct PREF_ISP_INFO)); + + advdlg=dlg=gtk_window_new(GTK_WINDOW_DIALOG); + gtk_window_set_transient_for(GTK_WINDOW(advdlg),GTK_WINDOW(applet)); + sprintf(tmp,"Settings: %s",pref_entries[selected_entry].LongName); + gtk_window_set_title(GTK_WINDOW(dlg),tmp); + gtk_window_set_policy(GTK_WINDOW(dlg),TRUE,TRUE,TRUE); + gtk_container_set_border_width(GTK_CONTAINER(dlg),4); + + /* main vbox */ + av[0]=gtk_vbox_new(FALSE,2); + gtk_container_add(GTK_CONTAINER(dlg),av[0]); + + av[1]=gtk_hbox_new(FALSE,1); + + /* first vbox */ + av[2]=gtk_vbox_new(FALSE,1); + /* second vbox */ + av[3]=gtk_vbox_new(FALSE,1); + av[4]=gtk_vseparator_new(); + + gtk_box_pack_start(GTK_BOX(av[0]),av[1],FALSE,TRUE,1); + gtk_box_pack_start(GTK_BOX(av[1]),av[2],FALSE,TRUE,1); + gtk_box_pack_start(GTK_BOX(av[1]),av[4],FALSE,TRUE,1); + gtk_box_pack_start(GTK_BOX(av[1]),av[3],FALSE,TRUE,1); + + l[0]=hlabel_new("Modem Init String #1"); + l[1]=hlabel_new("Modem Init String #2 (sent after #1)"); + l[2]=hlabel_new("Port/Modem speed (bps)"); + l[3]=hlabel_new("Send username when this string is received:"); + l[4]=hlabel_new("Send password when this string is received:"); + + adv_e[0]=gtk_entry_new_with_max_length(256); + adv_e[1]=gtk_entry_new_with_max_length(256); + adv_e[2]=gtk_entry_new_with_max_length(16); + adv_e[3]=gtk_entry_new_with_max_length(32); + adv_e[4]=gtk_entry_new_with_max_length(32); + + esb=gtk_hbox_new(FALSE,2); + esp=gtk_button_new_with_label(" Additional conversation... "); + + adv_nl=gtk_check_button_new_with_label("Don't generate login/password pairs"); + + for(i=0;i<5;i++) { + gtk_box_pack_start(GTK_BOX(av[2]),l[i],FALSE,FALSE,1); + gtk_box_pack_start(GTK_BOX(av[2]),adv_e[i],FALSE,FALSE,1); + + if (i==4) { + gtk_box_pack_start(GTK_BOX(av[2]),esb,FALSE,TRUE,1); + gtk_box_pack_end(GTK_BOX(esb),esp,FALSE,TRUE,1); + gtk_widget_show(esb); + gtk_widget_show(esp); + gtk_box_pack_start(GTK_BOX(av[2]),adv_nl,FALSE,TRUE,1); + gtk_widget_show(adv_nl); + } + + gtk_widget_show(l[i]); + gtk_widget_show(adv_e[i]); + } + + /* second pane */ + + av[5]=gtk_label_new(" ISP PPP Options "); + + av[6]=gtk_hseparator_new(); + adv_w[0]=av[7]=gtk_check_button_new_with_label("Override global PPP options"); + av[8]=gtk_hseparator_new(); + + adv_w[1]=av[9]=gtk_check_button_new_with_label("defaultroute"); + adv_w[2]=av[10]=gtk_check_button_new_with_label("passive"); + adv_w[3]=av[11]=gtk_check_button_new_with_label("noauth"); + adv_w[4]=av[12]=gtk_check_button_new_with_label("noipdefault"); + av[13]=gtk_frame_new(" CHAP Authentication "); + av[14]=gtk_frame_new(" PAP Authentication "); + + av[15]=gtk_vbox_new(FALSE,1); + av[16]=gtk_vbox_new(FALSE,1); + + gtk_frame_set_shadow_type(GTK_FRAME(av[13]),GTK_SHADOW_ETCHED_IN); + gtk_frame_set_shadow_type(GTK_FRAME(av[14]),GTK_SHADOW_ETCHED_IN); + + gtk_container_add(GTK_CONTAINER(av[13]),av[15]); + gtk_container_add(GTK_CONTAINER(av[14]),av[16]); + + for(i=5;i<=14;i++) + gtk_box_pack_start(GTK_BOX(av[3]),av[i],FALSE,FALSE,1); + + adv_w[5]=av[20]=gtk_radio_button_new_with_label(NULL,"require CHAP "); + chap=gtk_radio_button_group(GTK_RADIO_BUTTON(av[20])); + adv_w[6]=av[21]=gtk_radio_button_new_with_label(chap,"refuse CHAP "); + chap=gtk_radio_button_group(GTK_RADIO_BUTTON(av[21])); + adv_w[7]=av[22]=gtk_radio_button_new_with_label(chap,"don't care "); + + gtk_box_pack_start(GTK_BOX(av[15]),av[20],FALSE,TRUE,1); + gtk_box_pack_start(GTK_BOX(av[15]),av[21],FALSE,TRUE,1); + gtk_box_pack_start(GTK_BOX(av[15]),av[22],FALSE,TRUE,1); + + adv_w[8]=av[23]=gtk_radio_button_new_with_label(NULL,"require PAP "); + pap=gtk_radio_button_group(GTK_RADIO_BUTTON(av[23])); + adv_w[9]=av[24]=gtk_radio_button_new_with_label(pap,"refuse PAP "); + pap=gtk_radio_button_group(GTK_RADIO_BUTTON(av[24])); + adv_w[10]=av[25]=gtk_radio_button_new_with_label(pap,"don't care "); + + gtk_box_pack_start(GTK_BOX(av[16]),av[23],FALSE,TRUE,1); + gtk_box_pack_start(GTK_BOX(av[16]),av[24],FALSE,TRUE,1); + gtk_box_pack_start(GTK_BOX(av[16]),av[25],FALSE,TRUE,1); + + for(i=20;i<=25;i++) + gtk_widget_show(av[i]); + + /* second pane */ + + hs=gtk_hseparator_new(); + gtk_box_pack_start(GTK_BOX(av[0]),hs,FALSE,FALSE,4); + + bhb=gtk_hbox_new(TRUE,4); + + gtk_box_pack_start(GTK_BOX(av[0]),bhb,FALSE,FALSE,4); + + bt[0]=gtk_button_new_with_label(" Help "); + bt[1]=gtk_label_new(" "); + bt[2]=gtk_button_new_with_label(" OK "); + bt[3]=gtk_button_new_with_label(" Cancel "); + + for(i=0;i<4;i++) { + gtk_box_pack_start(GTK_BOX(bhb),bt[i],FALSE,TRUE,4); + gtk_widget_show(bt[i]); + } + + gtk_widget_show(bhb); + gtk_widget_show(hs); + for(i=0;i<17;i++) + gtk_widget_show(av[i]); + + gtk_widget_show(dlg); + gtk_widget_grab_focus(adv_e[0]); + + pii=&pref_entries[selected_entry]; + gtk_entry_set_text(GTK_ENTRY(adv_e[0]),pii->ModemInit1); + gtk_entry_set_text(GTK_ENTRY(adv_e[1]),pii->ModemInit2); + gtk_entry_set_text(GTK_ENTRY(adv_e[2]),pii->ModemSpeed); + gtk_entry_set_text(GTK_ENTRY(adv_e[3]),pii->UserString); + gtk_entry_set_text(GTK_ENTRY(adv_e[4]),pii->PassString); + + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(adv_w[0]),!!(pii->ppp.override)); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(adv_w[1]),!!(pii->ppp.defaultroute)); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(adv_w[2]),!!(pii->ppp.passive)); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(adv_w[3]),!!(pii->ppp.noauth)); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(adv_w[4]),!!(pii->ppp.noipdefault)); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(adv_w[5+pii->ppp.chap]),TRUE); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(adv_w[8+pii->ppp.pap]),TRUE); + + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(adv_nl),!!(pii->nologin)); + + if (!(pii->ppp.override)) + enable_local_ppp(FALSE); + + gtk_signal_connect (GTK_OBJECT (bt[0]), "clicked", + GTK_SIGNAL_FUNC (pop_help), NULL); + gtk_signal_connect (GTK_OBJECT (bt[2]), "clicked", + GTK_SIGNAL_FUNC (adv_ok), NULL); + gtk_signal_connect (GTK_OBJECT (bt[3]), "clicked", + GTK_SIGNAL_FUNC (adv_cancel), NULL); + gtk_signal_connect (GTK_OBJECT (dlg), "destroy", + GTK_SIGNAL_FUNC (adv_destroy), NULL); + + gtk_signal_connect (GTK_OBJECT (esp), "clicked", + GTK_SIGNAL_FUNC (pop_expect), NULL); + + gtk_signal_connect (GTK_OBJECT (adv_w[0]), "toggled", + GTK_SIGNAL_FUNC (ppp_override_toggle), NULL); + + gtk_grab_add(dlg); +} + +void +enable_local_ppp(gboolean e) +{ + int i; + for(i=1;i<11;i++) + gtk_widget_set_sensitive(adv_w[i],e); +} + +void +ppp_override_toggle(GtkToggleButton *gtb,gpointer data) +{ + enable_local_ppp(gtb->active); +} + +void +adv_ok (GtkWidget * widget, gpointer data) +{ + struct PREF_ISP_INFO *pii; + + pii=&pref_entries[selected_entry]; + strcpy(pii->ModemInit1,gtk_entry_get_text(GTK_ENTRY(adv_e[0]))); + strcpy(pii->ModemInit2,gtk_entry_get_text(GTK_ENTRY(adv_e[1]))); + strcpy(pii->ModemSpeed,gtk_entry_get_text(GTK_ENTRY(adv_e[2]))); + strcpy(pii->UserString,gtk_entry_get_text(GTK_ENTRY(adv_e[3]))); + strcpy(pii->PassString,gtk_entry_get_text(GTK_ENTRY(adv_e[4]))); + + pii->nologin=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(adv_nl)); + + pii->ppp.override=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(adv_w[0])); + pii->ppp.defaultroute=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(adv_w[1])); + pii->ppp.passive=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(adv_w[2])); + pii->ppp.noauth=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(adv_w[3])); + pii->ppp.noipdefault=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(adv_w[4])); + + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(adv_w[5]))) + pii->ppp.chap=AUTH_REQUIRE; + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(adv_w[6]))) + pii->ppp.chap=AUTH_REFUSE; + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(adv_w[7]))) + pii->ppp.chap=AUTH_DONTCARE; + + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(adv_w[8]))) + pii->ppp.pap=AUTH_REQUIRE; + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(adv_w[9]))) + pii->ppp.pap=AUTH_REFUSE; + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(adv_w[10]))) + pii->ppp.pap=AUTH_DONTCARE; + + gtk_widget_destroy(advdlg); +} + +void +adv_cancel (GtkWidget * widget, gpointer data) +{ + memcpy(&pref_entries[selected_entry],&adv_regret,sizeof(struct PREF_ISP_INFO)); + gtk_widget_destroy(advdlg); +} + +void +adv_destroy (GtkWidget * widget, gpointer data) +{ + gtk_grab_remove(widget); + advdlg=NULL; +} + +void +isp_rename(GtkEditable *ge,gpointer data) +{ + if (selected_entry<0) return; + strcpy(pref_entries[selected_entry].LongName, + gtk_entry_get_text(GTK_ENTRY(ge))); + gtk_clist_set_text(GTK_CLIST(isp_list),selected_entry,1, + pref_entries[selected_entry].LongName); +} + +int +write_and_apply_data(void) +{ + char tmp[256],aux[768],yet[512],v_home[512],v_user[64]; + struct stat ss; + FILE *f; + int i,j,needroot; + struct PREF_PPP_OPT modippp; + + get_ppp_pane(); + if (selected_entry>=0) + commit_back_to_db(); + + sprintf(tmp,"%s/.yawmppp2",getenv("HOME")); + + if (stat(tmp,&ss)<0) { + if (mkdir(tmp,0700)<0) { + message_box(GTK_WINDOW(applet),ERR_CANT_MKDIR,"Error", + MSGBOX_OK, + MSGBOX_ICON_ERROR); + return(-1); + } + } else + chmod(tmp,0700); + + /* the yawmppprc file */ + sprintf(aux,"%s/yawmppprc",tmp); + f=fopen(aux,"w"); + if (!f) { + message_box(GTK_WINDOW(applet),ERR_CANT_WRITE,"Error", + MSGBOX_OK, + MSGBOX_ICON_ERROR); + } else { + + /* FILE 1: YAWMPPPRC mode 600 */ + + fprintf(f,"# yawmppprc : configuration for yawmppp generated by\n"); + fprintf(f,"# yawmppp.pref version %s. You should avoid editing this manually.\n", + VERSION); + fprintf(f,"# Use the yawmppp.pref program instead.\n"); + fprintf(f,"#\n# BTW, the format changed from YAWMPPP 1.x.x to 2.x.x,\n"); + fprintf(f,"# copying old yawmppprc files to this directory is a bad idea\n\n"); + + for(i=0;i/dev/console \"ERROR: Removed stale pid file\"\n"); + fprintf(f,"\t\texit 1\n"); + fprintf(f,"\tfi\n\n"); + fprintf(f,"\techo >/dev/console \"PPP link to $DEVICE terminated.\"\n"); + fprintf(f,"\texit 0\n"); + fprintf(f,"fi\n\n"); + fprintf(f,"echo >/dev/console \"ERROR: PPP link not active on $DEVICE\"\n"); + fprintf(f,"exit 1\n"); + fclose(f); + chmod(aux,0700); + + /* FILE 5 : ifdown.x mode 700 */ + + sprintf(aux,"%s/ifdown.%d",tmp,i); + f=fopen(aux,"w"); + if (!f) { + message_box(GTK_WINDOW(applet),ERR_CANT_WRITE,"Error", + MSGBOX_OK, + MSGBOX_ICON_ERROR); + return(-1); + } + + fprintf(f,"#!/bin/sh\n"); + fprintf(f,"# YAWMPPP dialing script generated by yawmppp.pref\n"); + fprintf(f,"# version %s. If possible, do not edit manually.\n\n",VERSION); + + fprintf(f,"# uncomment the line below to have yawmppp restart\n"); + fprintf(f,"# connections automatically\n\n"); + fprintf(f,"# source %s/start.%d\n",tmp,i); + fclose(f); + chmod(aux,0700); + + /* FILE 6 : user_chat.x mode 700 */ + + sprintf(aux,"%s/%s_chat.%d",tmp,getenv("USER"),i); + f=fopen(aux,"w"); + if (!f) { + message_box(GTK_WINDOW(applet),ERR_CANT_WRITE,"Error", + MSGBOX_OK, + MSGBOX_ICON_ERROR); + return(-1); + } + fprintf(f,"ABORT \"NO CARRIER\"\n"); + fprintf(f,"ABORT \"NO DIALTONE\"\n"); + fprintf(f,"ABORT \"BUSY\"\n"); + fprintf(f,"ABORT \"ERROR\"\n"); + fprintf(f,"ABORT \"NO ANSWER\"\n"); + fprintf(f,"ABORT \"Username/Password Incorrect\"\n"); + fprintf(f,"ABORT \"Authentication Failure\"\n"); + fprintf(f,"ABORT \"Bad password\"\n"); + fprintf(f,"ABORT \"Bad Password\"\n"); + fprintf(f,"REPORT CARRIER\n"); + fprintf(f,"REPORT CONNECT\n"); + fprintf(f,"\"\" \"at\"\n"); + fprintf(f,"OK \"%s\"\n",pref_entries[i].ModemInit1); + fprintf(f,"OK \"%s\"\n",pref_entries[i].ModemInit2); + fprintf(f,"OK \"ATD%c%s\"\n", + (atoi(pref_entries[i].PulseDial)?'P':'T'), + pref_entries[i].Phone); + + if (!pref_entries[i].nologin) { + fprintf(f,"\"%s\" \"%s\"\n", + pref_entries[i].UserString, + pref_entries[i].Username); + fprintf(f,"\"%s\" \"%s\"\n", + pref_entries[i].PassString, + pref_entries[i].Password); + } else { + if (!pref_entries[i].nExpectPairs) + fprintf(f,"CONNECT \"\"\n"); + } + + for(j=0;j/dev/null 2>/dev/null\"", + v_user,i,tmp,v_user,i); + if (system(aux)) { + sprintf(aux,"/bin/sh -c \"cp -f %s/%s_yawmppp_isp%d /etc/ppp/peers/%s_yawmppp_isp%d >/dev/null 2>/dev/null\"", + tmp,v_user,i,v_user,i); + if (system(aux)) + needroot=1; + } + if (needroot) + break; + sprintf(aux,"/bin/sh -c \"diff -q /etc/ppp/peers/%s_chat.%d %s/%s_chat.%d >/dev/null 2>/dev/null\"", + v_user,i,tmp,v_user,i); + if (system(aux)) { + sprintf(aux,"/bin/sh -c \"cp -f %s/%s_chat.%d /etc/ppp/peers/%s_chat.%d >/dev/null 2>/dev/null\"", + tmp,v_user,i,v_user,i); + if (system(aux)) + needroot=1; + } + if (needroot) + break; + } + + if (needroot) { + sprintf(aux,"%s/root_apply.sh",tmp); + run_as_root(aux); + sprintf(aux,"%s/.root_didnt_run_it",tmp); + f=fopen(aux,"r"); + if (f!=NULL) { + fclose(f); + unlink(aux); + } + } else { + sprintf(aux,"%s/root_apply.sh",tmp); + unlink(aux); + sprintf(aux,"%s/.root_didnt_run_it",tmp); + unlink(aux); + } + return 0; +} + +void +applet_apply (GtkWidget * widget, gpointer data) +{ + write_and_apply_data(); +} + +void +applet_save_and_quit (GtkWidget * widget, gpointer data) +{ + int i; + i=write_and_apply_data(); + if (i<0) + if (message_box(GTK_WINDOW(applet),ERR_DIDNT_WRITE,"Confirmation", + MSGBOX_YESNO, + MSGBOX_ICON_QUESTION)==MSGBOX_R_NO) + return; + gtk_widget_destroy(applet); +} + +void +check_client(void) +{ + char *p; + char temp[128]; + FILE *f; + + p=getenv("HOME"); + strcpy (temp, p); + strcat (temp, "/.yawmppp2/.delayedupdate"); + + usleep(100000L); + + f=fopen(temp,"r"); + if (!f) return; + fclose(f); + unlink(temp); + + message_box(GTK_WINDOW(applet), + INFO_CANT_APPLY_NOW, + "Apply request acknowledged", + MSGBOX_OK, + MSGBOX_ICON_INFO); +} + +int +file_exists(char *s) +{ + FILE *f; + + f=fopen(s,"r"); + if (!f) + return 0; + fclose(f); + return 1; +} + +void +find_out_paths(void) +{ + strcpy(chat_path,"/usr/sbin/chat"); + strcpy(pppd_path,"/usr/sbin/pppd"); + + test_set_path(chat_path,"/bin/chat"); + test_set_path(chat_path,"/usr/bin/chat"); + test_set_path(chat_path,"/usr/local/bin/chat"); + test_set_path(chat_path,"/usr/local/sbin/chat"); + test_set_path(chat_path,"/sbin/chat"); + test_set_path(chat_path,"/usr/sbin/chat"); + + test_set_path(pppd_path,"/bin/pppd"); + test_set_path(pppd_path,"/usr/bin/pppd"); + test_set_path(pppd_path,"/usr/local/bin/pppd"); + test_set_path(pppd_path,"/usr/local/sbin/pppd"); + test_set_path(pppd_path,"/sbin/pppd"); + test_set_path(pppd_path,"/usr/sbin/pppd"); +} + +void +test_set_path(char *dest,char *path) +{ + if (file_exists(path)) + strcpy(dest,path); +} + +/* PPP PANE */ + +GtkWidget * +make_ppp_pane(void) +{ + GtkWidget *bv,*h,*v[4]; + GtkTooltips *tt; + int i; + GtkWidget *wi[40],*ew[20]; + GSList *modem,*flow; + + bv=gtk_vbox_new(FALSE,0); + + tt=gtk_tooltips_new(); + + ew[0]=gtk_label_new("These options are set to a safe default."\ + " Don't change them unless you know what you are\n"\ + "doing. All options are documented in pppd's man"\ + " page. Hit the Help button for details."); + gtk_label_set_justify(GTK_LABEL(ew[0]),GTK_JUSTIFY_LEFT); + + ew[1]=gtk_hseparator_new(); + + gtk_box_pack_start(GTK_BOX(bv),ew[0],FALSE,TRUE,1); + gtk_box_pack_start(GTK_BOX(bv),ew[1],FALSE,TRUE,1); + + h=gtk_hbox_new(TRUE,2); + gtk_box_pack_start(GTK_BOX(bv),h,TRUE,TRUE,1); + + v[0]=gtk_vbox_new(FALSE,1); + v[1]=gtk_vbox_new(FALSE,1); + v[2]=gtk_vbox_new(FALSE,1); + v[3]=gtk_vbox_new(FALSE,1); + gtk_box_pack_start(GTK_BOX(h),v[0],FALSE,TRUE,4); + gtk_box_pack_start(GTK_BOX(h),v[1],FALSE,TRUE,4); + gtk_box_pack_start(GTK_BOX(h),v[2],FALSE,TRUE,4); + gtk_box_pack_start(GTK_BOX(h),v[3],FALSE,TRUE,4); + + wi[0]=gtk_check_button_new_with_label("defaultroute"); + wi[1]=gtk_check_button_new_with_label("lock"); + wi[2]=gtk_check_button_new_with_label("passive"); + wi[3]=gtk_check_button_new_with_label("debug"); + wi[4]=gtk_check_button_new_with_label("kdebug : general"); + wi[5]=gtk_check_button_new_with_label("kdebug : receive"); + wi[6]=gtk_check_button_new_with_label("kdebug : send"); + wi[7]=gtk_check_button_new_with_label("noauth"); + wi[8]=gtk_check_button_new_with_label("noipdefault"); + wi[30]=gtk_check_button_new_with_label("usepeerdns"); + + gtk_tooltips_set_tip(tt,wi[0], + "add a default route to the system routing tables", + NULL); + gtk_tooltips_set_tip(tt,wi[1], + "create lock file for exclusive device access", + NULL); + gtk_tooltips_set_tip(tt,wi[2], + "wait passively for LCP packet from peer", + NULL); + gtk_tooltips_set_tip(tt,wi[3], + "logs the control packets sent and received "\ + "in human readable form", + NULL); + gtk_tooltips_set_tip(tt,wi[4], + "kernel level debugging", + NULL); + gtk_tooltips_set_tip(tt,wi[5], + "kernel level debugging", + NULL); + gtk_tooltips_set_tip(tt,wi[6], + "kernel level debugging", + NULL); + gtk_tooltips_set_tip(tt,wi[7], + "do not require peer to authenticate itself", + NULL); + gtk_tooltips_set_tip(tt,wi[8], + "require IP address to be negotiated via IPCP", + NULL); + gtk_tooltips_set_tip(tt,wi[30], + "ask DNS server info to peer, requires pppd 2.3.10 or newer, 2.3.11 recommended", + NULL); + + /* --- */ + + ew[2]=gtk_frame_new("Line control"); + gtk_frame_set_shadow_type(GTK_FRAME(ew[2]),GTK_SHADOW_ETCHED_IN); + ew[3]=gtk_vbox_new(TRUE,1); + + gtk_container_add(GTK_CONTAINER(ew[2]),ew[3]); + + wi[9]=gtk_radio_button_new_with_label(NULL,"modem "); + modem=gtk_radio_button_group(GTK_RADIO_BUTTON(wi[9])); + wi[10]=gtk_radio_button_new_with_label(modem,"local "); + gtk_box_pack_start(GTK_BOX(ew[3]),wi[9],FALSE,TRUE,1); + gtk_box_pack_start(GTK_BOX(ew[3]),wi[10],FALSE,TRUE,1); + + gtk_tooltips_set_tip(tt,wi[9], + "use modem control lines (CD/DTR)", + NULL); + gtk_tooltips_set_tip(tt,wi[10], + "don't use modem control lines (ignores CD/DTR)", + NULL); + + /* --- */ + + ew[4]=gtk_frame_new("Flow control"); + gtk_frame_set_shadow_type(GTK_FRAME(ew[4]),GTK_SHADOW_ETCHED_IN); + ew[5]=gtk_vbox_new(TRUE,1); + gtk_container_add(GTK_CONTAINER(ew[4]),ew[5]); + + wi[11]=gtk_radio_button_new_with_label(NULL,"crtscts"); + flow=gtk_radio_button_group(GTK_RADIO_BUTTON(wi[11])); + + wi[12]=gtk_radio_button_new_with_label(flow,"xonxoff"); + flow=gtk_radio_button_group(GTK_RADIO_BUTTON(wi[12])); + + wi[13]=gtk_radio_button_new_with_label(flow,"nocrtscts"); + flow=gtk_radio_button_group(GTK_RADIO_BUTTON(wi[13])); + + wi[14]=gtk_radio_button_new_with_label(flow,"don't care"); + + gtk_box_pack_start(GTK_BOX(ew[5]),wi[11],FALSE,TRUE,1); + gtk_box_pack_start(GTK_BOX(ew[5]),wi[12],FALSE,TRUE,1); + gtk_box_pack_start(GTK_BOX(ew[5]),wi[13],FALSE,TRUE,1); + gtk_box_pack_start(GTK_BOX(ew[5]),wi[14],FALSE,TRUE,1); + + gtk_tooltips_set_tip(tt,wi[11], + "use hardware flow control (RTS/CTS)", + NULL); + gtk_tooltips_set_tip(tt,wi[12], + "use software flow control (XON/XOFF)", + NULL); + gtk_tooltips_set_tip(tt,wi[13], + "disable hardware flow control (RTS/CTS)", + NULL); + + /* -- */ + + wi[15]=hlabel_new("MTU (minimum 128)"); + wi[16]=hlabel_new("MRU (minimum 128)"); + + wi[17]=hlabel_new("lcp-echo-failure\n(0 disables)"); + wi[18]=hlabel_new("lcp-echo-interval\n(0 disables)"); + wi[19]=hlabel_new("lcp-max-configure"); + wi[20]=hlabel_new("lcp-max-terminate"); + wi[21]=hlabel_new("lcp-restart"); + + wi[22]=gtk_entry_new_with_max_length(12); + wi[23]=gtk_entry_new_with_max_length(12); + + wi[24]=gtk_entry_new_with_max_length(12); + wi[25]=gtk_entry_new_with_max_length(12); + wi[26]=gtk_entry_new_with_max_length(12); + wi[27]=gtk_entry_new_with_max_length(12); + wi[28]=gtk_entry_new_with_max_length(12); + + gtk_tooltips_set_tip(tt,wi[22], + "Maximum Transfer Unit (bytes)",NULL); + gtk_tooltips_set_tip(tt,wi[23], + "Maximum Receive Unit (bytes)",NULL); + + for(i=15;i<17;i++) { + gtk_box_pack_start(GTK_BOX(v[2]),wi[i],FALSE,TRUE,0); + gtk_box_pack_start(GTK_BOX(v[2]),wi[i+7],FALSE,FALSE,0); + } + + for(i=17;i<22;i++) { + gtk_box_pack_start(GTK_BOX(v[3]),wi[i],FALSE,TRUE,0); + gtk_box_pack_start(GTK_BOX(v[3]),wi[i+7],FALSE,FALSE,0); + } + + /* - */ + + wi[29]=gtk_button_new_with_label("Set defaults"); + gtk_box_pack_end(GTK_BOX(v[3]),wi[29],FALSE,TRUE,4); + + for(i=0;i<9;i++) { + gtk_box_pack_start(GTK_BOX(v[0]),wi[i],FALSE,FALSE,1); + gtk_widget_show(wi[i]); + } + gtk_box_pack_start(GTK_BOX(v[0]),wi[30],FALSE,FALSE,1); + gtk_widget_show(wi[30]); + + gtk_box_pack_start(GTK_BOX(v[1]),ew[2],FALSE,TRUE,4); + gtk_box_pack_start(GTK_BOX(v[1]),ew[4],FALSE,TRUE,4); + + for(i=9;i<30;i++) + gtk_widget_show(wi[i]); + + for(i=0;i<6;i++) + gtk_widget_show(ew[i]); + + for(i=0;i<4;i++) + gtk_widget_show(v[i]); + + gtk_widget_show(h); + gtk_widget_show(bv); + + for(i=0;i<31;i++) + ppp_pw[i]=wi[i]; + + gtk_signal_connect(GTK_OBJECT(wi[29]),"clicked", + GTK_SIGNAL_FUNC(make_ppp_default),NULL); + + return bv; +} + +void +make_ppp_default(GtkWidget *w,gpointer data) +{ + pppo.defaultroute=1; + pppo.lock=1; + pppo.passive=0; + pppo.debug=0; + pppo.kdebug=0; + pppo.noauth=1; + pppo.noipdefault=1; + pppo.flowctl=3; + pppo.mtu=1500; + pppo.mru=1500; + pppo.lcp[0]=0; + pppo.lcp[1]=0; + pppo.lcp[2]=10; + pppo.lcp[3]=10; + pppo.lcp[4]=3; + pppo.chap=AUTH_DONTCARE; + pppo.pap=AUTH_DONTCARE; + pppo.usepeerdns=1; + if (w!=NULL) + set_ppp_pane(); +} + +void get_ppp_pane(void) +{ + int i; + pppo.defaultroute=!!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ppp_pw[0])); + pppo.lock =!!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ppp_pw[1])); + pppo.passive =!!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ppp_pw[2])); + pppo.debug =!!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ppp_pw[3])); + pppo.kdebug =!!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ppp_pw[4]))<<0; + pppo.kdebug |=!!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ppp_pw[5]))<<1; + pppo.kdebug |=!!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ppp_pw[6]))<<2; + pppo.noauth =!!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ppp_pw[7])); + pppo.noipdefault =!!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ppp_pw[8])); + + pppo.linectl =!!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ppp_pw[10])); + pppo.usepeerdns =!!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ppp_pw[30])); + + for(i=11;i<15;i++) + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ppp_pw[i]))) + pppo.flowctl=i-11; + + pppo.mtu=atoi(gtk_entry_get_text(GTK_ENTRY(ppp_pw[22]))); + pppo.mru=atoi(gtk_entry_get_text(GTK_ENTRY(ppp_pw[23]))); + + for(i=0;i<5;i++) + pppo.lcp[i]=atoi(gtk_entry_get_text(GTK_ENTRY(ppp_pw[24+i]))); +} + +void set_ppp_pane(void) +{ + int i; + char b[32]; + + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ppp_pw[0]),pppo.defaultroute); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ppp_pw[1]),pppo.lock); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ppp_pw[2]),pppo.passive); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ppp_pw[3]),pppo.debug); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ppp_pw[4]),pppo.kdebug&0x01); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ppp_pw[5]),pppo.kdebug&0x02); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ppp_pw[6]),pppo.kdebug&0x04); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ppp_pw[7]),pppo.noauth); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ppp_pw[8]),pppo.noipdefault); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ppp_pw[30]),pppo.usepeerdns); + + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ppp_pw[9+pppo.linectl]),TRUE); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ppp_pw[11+pppo.flowctl]),TRUE); + + sprintf(b,"%d",pppo.mtu); + gtk_entry_set_text(GTK_ENTRY(ppp_pw[22]),b); + sprintf(b,"%d",pppo.mru); + gtk_entry_set_text(GTK_ENTRY(ppp_pw[23]),b); + + for(i=0;i<5;i++) { + sprintf(b,"%d",pppo.lcp[i]); + gtk_entry_set_text(GTK_ENTRY(ppp_pw[24+i]),b); + } +} + +char * +mk_ppp_string(struct PREF_PPP_OPT *modi,char *sep) +{ + static char here[512]; + char local[256]; + + here[0]=0; + if (modi->defaultroute) { + strcat(here,"defaultroute"); + strcat(here,sep); + } + if (modi->lock) { + strcat(here,"lock"); + strcat(here,sep); + } + if (modi->passive) { + strcat(here,"passive"); + strcat(here,sep); + } + if (modi->debug) { + strcat(here,"debug"); + strcat(here,sep); + } + if (modi->kdebug) { + sprintf(local,"kdebug %d",modi->kdebug); + strcat(here,local); + strcat(here,sep); + } + if (modi->noauth) { + strcat(here,"noauth"); + strcat(here,sep); + } + if (modi->noipdefault) { + strcat(here,"noipdefault"); + strcat(here,sep); + } + + switch(modi->chap) { + case AUTH_REQUIRE: + strcat(here,"require-chap"); + strcat(here,sep); + break; + case AUTH_REFUSE: + strcat(here,"refuse-chap"); + strcat(here,sep); + break; + } + + switch(modi->pap) { + case AUTH_REQUIRE: + strcat(here,"require-pap"); + strcat(here,sep); + break; + case AUTH_REFUSE: + strcat(here,"refuse-pap"); + strcat(here,sep); + break; + } + + if (modi->linectl) + strcat(here,"local"); + else + strcat(here,"modem"); + strcat(here,sep); + + switch(modi->flowctl) { + case 0: strcat(here,"crtscts"); break; + case 1: strcat(here,"xonxoff"); break; + case 2: strcat(here,"nocrtscts"); break; + } + strcat(here,sep); + + sprintf(local,"mtu %d%smru %d%s", + modi->mtu,sep, + modi->mru,sep); + + strcat(here,local); + + if (modi->lcp[0]) { + sprintf(local,"lcp-echo-failure %d",modi->lcp[0]); + strcat(here,local); + strcat(here,sep); + } + if (modi->lcp[1]) { + sprintf(local,"lcp-echo-interval %d",modi->lcp[1]); + strcat(here,local); + strcat(here,sep); + } + sprintf(local,"lcp-max-configure %d",modi->lcp[2]); + strcat(here,local); + strcat(here,sep); + sprintf(local,"lcp-max-terminate %d",modi->lcp[3]); + strcat(here,local); + strcat(here,sep); + sprintf(local,"lcp-restart %d",modi->lcp[4]); + strcat(here,local); + strcat(here,sep); + + if (modi->usepeerdns) { + strcat(here,"usepeerdns"); + strcat(here,sep); + } + return(here); +} + +void +read_ppp_options_from_rc(char *p) +{ + FILE *f; + char b[512],*t; + int i; + + make_ppp_default(NULL,NULL); + + f=fopen(p,"r"); + if (!f) + return; + + while(fgets(b,511,f)) { + if (strstr(b,"PPPOPTIONS")==&b[0]) { + t=wrapped_strtok(b," \t\n"); + t=wrapped_strtok(NULL," \t\n"); pppo.defaultroute=atoi(t); + t=wrapped_strtok(NULL," \t\n"); pppo.lock=atoi(t); + t=wrapped_strtok(NULL," \t\n"); pppo.passive=atoi(t); + t=wrapped_strtok(NULL," \t\n"); pppo.debug=atoi(t); + t=wrapped_strtok(NULL," \t\n"); pppo.kdebug=atoi(t); + t=wrapped_strtok(NULL," \t\n"); pppo.noauth=atoi(t); + t=wrapped_strtok(NULL," \t\n"); pppo.noipdefault=atoi(t); + t=wrapped_strtok(NULL," \t\n"); pppo.linectl=atoi(t); + t=wrapped_strtok(NULL," \t\n"); pppo.flowctl=atoi(t); + t=wrapped_strtok(NULL," \t\n"); pppo.mtu=atoi(t); + t=wrapped_strtok(NULL," \t\n"); pppo.mru=atoi(t); + for(i=0;i<5;i++) { + t=wrapped_strtok(NULL," \t\n"); + pppo.lcp[i]=atoi(t); + } + t=wrapped_strtok(NULL," \t\n"); pppo.usepeerdns=atoi(t); + break; + } + } + fclose(f); +} + +char * +wrapped_strtok(char *a,char *b) +{ + char *pt; + static int wasnull=0; + static char zero[]="0"; + + if ((a==NULL)&&(wasnull)) + return zero; + if (a!=NULL) + wasnull=0; + + pt=strtok(a,b); + if (pt==NULL) { + wasnull=1; + return(zero); + } else + return pt; +} + +/* expect/send dialog */ + +GtkWidget *exsdlg,*exp_cl,*exp_ctl[5]; +int exp_sel=-1; +struct PREF_ISP_INFO exp_regret; + +void pop_expect(GtkWidget *w,gpointer data) +{ + GtkWidget *dlg,*v1,*hs,*bhb,*bt[4],*bb,*lb[5],*wl; + GtkWidget *sw,*cl; + GtkStyle *style; + GdkBitmap *mask; + GdkPixmap *tp; + GtkWidget *px; + char tmp[128]; + int i; + + memcpy(&exp_regret,&pref_entries[selected_entry],sizeof(struct PREF_ISP_INFO)); + + exsdlg=dlg=gtk_window_new(GTK_WINDOW_DIALOG); + gtk_window_set_transient_for(GTK_WINDOW(advdlg),GTK_WINDOW(advdlg)); + gtk_window_set_default_size(GTK_WINDOW(dlg),400,370); + gtk_widget_realize(dlg); + + v1=gtk_vbox_new(FALSE,1); + gtk_container_add(GTK_CONTAINER(dlg),v1); + + sprintf(tmp,"Conversation: %s",pref_entries[selected_entry].LongName); + gtk_window_set_title(GTK_WINDOW(dlg),tmp); + gtk_window_set_policy(GTK_WINDOW(dlg),TRUE,TRUE,TRUE); + gtk_container_set_border_width(GTK_CONTAINER(dlg),4); + + wl=gtk_label_new("You only need to add something here if your connection has\n"\ + "has non-standard prompt/timing between the login and the\n"\ + "start of the PPP session. All expect/send pairs are placed\n"\ + "right after the user/password ones in the chat script.\n"\ + "If you checked the Don't generate login/password pairs\n"\ + "checkbox then the expect/send pairs defined here will be the\n"\ + "only ones in the chat script."); + + gtk_box_pack_start(GTK_BOX(v1),wl,FALSE,FALSE,1); + + /* list */ + sw=gtk_scrolled_window_new(NULL,NULL); + gtk_box_pack_start(GTK_BOX(v1),sw,TRUE,TRUE,4); + gtk_widget_show(sw); + gtk_container_set_border_width(GTK_CONTAINER(sw),4); + + exp_cl=cl=gtk_clist_new(2); + gtk_clist_set_shadow_type(GTK_CLIST(cl),GTK_SHADOW_IN); + gtk_clist_set_selection_mode(GTK_CLIST(cl),GTK_SELECTION_SINGLE); + gtk_clist_set_column_title(GTK_CLIST(cl),0,"Expect"); + gtk_clist_set_column_title(GTK_CLIST(cl),1,"Send"); + gtk_clist_column_titles_passive(GTK_CLIST(cl)); + gtk_clist_column_titles_show(GTK_CLIST(cl)); + gtk_clist_set_column_width(GTK_CLIST(cl),0,120); + gtk_clist_set_column_width(GTK_CLIST(cl),1,120); + gtk_clist_set_column_auto_resize(GTK_CLIST(cl),0,FALSE); + gtk_clist_set_column_auto_resize(GTK_CLIST(cl),1,FALSE); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_ALWAYS); + gtk_container_add(GTK_CONTAINER(sw),cl); + gtk_widget_show(cl); + /* list */ + + bb=gtk_hbox_new(FALSE,0); + gtk_box_pack_start(GTK_BOX(v1),bb,FALSE,TRUE,2); + + exp_ctl[0]=lb[0]=gtk_button_new_with_label(" Add pair "); + exp_ctl[1]=lb[1]=gtk_button_new_with_label(" Add delay "); + exp_ctl[2]=lb[2]=gtk_button_new_with_label(" Remove "); + + + exp_ctl[3]=lb[3]=gtk_button_new(); + exp_ctl[4]=lb[4]=gtk_button_new(); + + style=gtk_widget_get_style(dlg); + + tp=gdk_pixmap_create_from_xpm_d (dlg->window, &mask, + &style->bg[GTK_STATE_NORMAL], + (gchar **) cmd_up_xpm); + px=gtk_pixmap_new(tp,mask); gtk_widget_show(px); gdk_pixmap_unref(tp); + gtk_container_add(GTK_CONTAINER(lb[3]),px); + + tp=gdk_pixmap_create_from_xpm_d (dlg->window, &mask, + &style->bg[GTK_STATE_NORMAL], + (gchar **) cmd_down_xpm); + px=gtk_pixmap_new(tp,mask); gtk_widget_show(px); gdk_pixmap_unref(tp); + gtk_container_add(GTK_CONTAINER(lb[4]),px); + + for(i=0;i<5;i++) { + gtk_box_pack_start(GTK_BOX(bb),lb[i],FALSE,TRUE,2); + gtk_widget_show(lb[i]); + } + + hs=gtk_hseparator_new(); + gtk_box_pack_start(GTK_BOX(v1),hs,FALSE,FALSE,4); + + bhb=gtk_hbox_new(TRUE,4); + + gtk_box_pack_start(GTK_BOX(v1),bhb,FALSE,FALSE,4); + + bt[0]=gtk_button_new_with_label(" Help "); + bt[1]=gtk_label_new(" "); + bt[2]=gtk_button_new_with_label(" OK "); + bt[3]=gtk_button_new_with_label(" Cancel "); + + for(i=0;i<4;i++) { + gtk_box_pack_start(GTK_BOX(bhb),bt[i],FALSE,TRUE,4); + gtk_widget_show(bt[i]); + } + + gtk_widget_show(bb); + gtk_widget_show(bhb); + gtk_widget_show(hs); + gtk_widget_show(wl); + gtk_widget_show(v1); + gtk_widget_show(dlg); + + exp_update(); + + gtk_signal_connect (GTK_OBJECT (bt[0]), "clicked", + GTK_SIGNAL_FUNC (pop_help), NULL); + gtk_signal_connect (GTK_OBJECT (bt[2]), "clicked", + GTK_SIGNAL_FUNC (exp_ok), NULL); + gtk_signal_connect (GTK_OBJECT (bt[3]), "clicked", + GTK_SIGNAL_FUNC (exp_cancel), NULL); + gtk_signal_connect (GTK_OBJECT (dlg), "destroy", + GTK_SIGNAL_FUNC (exp_destroy), NULL); + + gtk_signal_connect (GTK_OBJECT (lb[0]), "clicked", + GTK_SIGNAL_FUNC (exp_add), NULL); + gtk_signal_connect (GTK_OBJECT (lb[1]), "clicked", + GTK_SIGNAL_FUNC (exp_add_delay), NULL); + gtk_signal_connect (GTK_OBJECT (lb[2]), "clicked", + GTK_SIGNAL_FUNC (exp_remove), NULL); + + gtk_signal_connect (GTK_OBJECT (lb[3]), "clicked", + GTK_SIGNAL_FUNC (exp_up), NULL); + gtk_signal_connect (GTK_OBJECT (lb[4]), "clicked", + GTK_SIGNAL_FUNC (exp_down), NULL); + + gtk_signal_connect (GTK_OBJECT (cl), "select_row", + GTK_SIGNAL_FUNC (exp_select), NULL); + gtk_signal_connect (GTK_OBJECT (cl), "unselect_row", + GTK_SIGNAL_FUNC (exp_unselect), NULL); + + + gtk_grab_add(dlg); +} + +void +exp_update(void) +{ + int i; + struct PREF_ISP_INFO *pii; + char *pp[2]; + + pii=&pref_entries[selected_entry]; + + gtk_clist_freeze(GTK_CLIST(exp_cl)); + gtk_clist_clear(GTK_CLIST(exp_cl)); + for(i=0;inExpectPairs;i++) { + pp[0]=pii->s_expect[i]; + pp[1]=pii->s_send[i]; + if (!strlen(pp[0])) { + pp[0]=""; + pp[1]=""; + } + gtk_clist_append(GTK_CLIST(exp_cl),pp); + } + gtk_clist_thaw(GTK_CLIST(exp_cl)); + exp_sel=-1; + exp_disable(); +} + +void +exp_ok (GtkWidget * widget, gpointer data) +{ + gtk_widget_destroy(exsdlg); +} + +void +exp_cancel (GtkWidget * widget, gpointer data) +{ + memcpy(&pref_entries[selected_entry],&exp_regret,sizeof(struct PREF_ISP_INFO)); + gtk_widget_destroy(exsdlg); +} + +void +exp_destroy (GtkWidget * widget, gpointer data) +{ + gtk_grab_remove(widget); + exsdlg=NULL; +} + +void +exp_up(GtkWidget *widget,gpointer data) +{ + char aux[2][32]; + struct PREF_ISP_INFO *pii; + int nsel; + + pii=&pref_entries[selected_entry]; + + strcpy(aux[0],pii->s_expect[exp_sel]); + strcpy(aux[1],pii->s_send[exp_sel]); + + strcpy(pii->s_expect[exp_sel],pii->s_expect[exp_sel-1]); + strcpy(pii->s_send[exp_sel],pii->s_send[exp_sel-1]); + strcpy(pii->s_expect[exp_sel-1],aux[0]); + strcpy(pii->s_send[exp_sel-1],aux[1]); + nsel=--exp_sel; + exp_update(); + gtk_clist_select_row(GTK_CLIST(exp_cl),nsel,0); +} + +void +exp_down(GtkWidget *widget,gpointer data) +{ + char aux[2][32]; + struct PREF_ISP_INFO *pii; + int nsel; + pii=&pref_entries[selected_entry]; + + strcpy(aux[0],pii->s_expect[exp_sel]); + strcpy(aux[1],pii->s_send[exp_sel]); + + strcpy(pii->s_expect[exp_sel],pii->s_expect[exp_sel+1]); + strcpy(pii->s_send[exp_sel],pii->s_send[exp_sel+1]); + strcpy(pii->s_expect[exp_sel+1],aux[0]); + strcpy(pii->s_send[exp_sel+1],aux[1]); + nsel=++exp_sel; + exp_update(); + gtk_clist_select_row(GTK_CLIST(exp_cl),nsel,0); +} + +void +exp_disable(void) +{ + gtk_widget_set_sensitive(exp_ctl[2],FALSE); + gtk_widget_set_sensitive(exp_ctl[3],FALSE); + gtk_widget_set_sensitive(exp_ctl[4],FALSE); +} + +void +exp_enable(void) +{ + int n; + n=pref_entries[selected_entry].nExpectPairs; + n--; + gtk_widget_set_sensitive(exp_ctl[2],TRUE); + gtk_widget_set_sensitive(exp_ctl[3],!!(exp_sel>0)); + gtk_widget_set_sensitive(exp_ctl[4],!(exp_sel==n)); +} + +void +exp_select(GtkCList *cl,gint row,gint column, + GdkEventButton *geb,gpointer data) +{ + exp_sel=row; + exp_enable(); +} + +void +exp_unselect(GtkCList *cl,gint row,gint column, + GdkEventButton *geb,gpointer data) +{ + exp_sel=-1; + exp_disable(); +} + +void +exp_add_delay(void) +{ + struct PREF_ISP_INFO *pii; + pii=&pref_entries[selected_entry]; + pii->s_expect[pii->nExpectPairs][0]=0; + pii->s_send[pii->nExpectPairs][0]=0; + pii->nExpectPairs++; + exp_update(); +} + +void +exp_remove(void) +{ + struct PREF_ISP_INFO *pii; + int i; + pii=&pref_entries[selected_entry]; + pii->nExpectPairs--; + for(i=exp_sel;inExpectPairs;i++) { + strcpy(pii->s_send[i],pii->s_send[i+1]); + strcpy(pii->s_expect[i],pii->s_expect[i+1]); + } + exp_sel=-1; + exp_update(); +} + +GtkWidget *expa,*expa_e[2]; + +void +exp_add(void) +{ + GtkWidget *v1,*ea[15]; + int i; + + expa=gtk_window_new(GTK_WINDOW_DIALOG); + gtk_window_set_title(GTK_WINDOW(expa),"Add expect/send pair"); + gtk_window_set_transient_for(GTK_WINDOW(expa),GTK_WINDOW(exsdlg)); + gtk_window_set_default_size(GTK_WINDOW(expa),220,110); + gtk_widget_realize(expa); + + v1=gtk_vbox_new(FALSE,0); + gtk_container_add(GTK_CONTAINER(expa),v1); + ea[0]=gtk_hbox_new(FALSE,0); + ea[1]=gtk_label_new("Expect:"); + expa_e[0]=ea[2]=gtk_entry_new(); + + ea[3]=gtk_hbox_new(FALSE,0); + ea[4]=gtk_label_new("Send:"); + expa_e[1]=ea[5]=gtk_entry_new(); + + gtk_box_pack_start(GTK_BOX(v1),ea[0],FALSE,TRUE,1); + gtk_box_pack_start(GTK_BOX(ea[0]),ea[1],FALSE,FALSE,0); + gtk_box_pack_start(GTK_BOX(v1),ea[2],FALSE,TRUE,1); + + gtk_box_pack_start(GTK_BOX(v1),ea[3],FALSE,TRUE,1); + gtk_box_pack_start(GTK_BOX(ea[3]),ea[4],FALSE,FALSE,0); + gtk_box_pack_start(GTK_BOX(v1),ea[5],FALSE,TRUE,1); + + ea[6]=gtk_hseparator_new(); + ea[7]=gtk_hbox_new(TRUE,4); + + ea[8]=gtk_label_new(" "); + ea[9]=gtk_label_new(" "); + ea[10]=gtk_button_new_with_label(" OK "); + ea[11]=gtk_button_new_with_label(" Cancel "); + + gtk_box_pack_start(GTK_BOX(v1),ea[6],FALSE,TRUE,2); + gtk_box_pack_start(GTK_BOX(v1),ea[7],FALSE,TRUE,1); + + for(i=0;i<4;i++) + gtk_box_pack_start(GTK_BOX(ea[7]),ea[8+i],FALSE,TRUE,4); + + for(i=0;i<12;i++) + gtk_widget_show(ea[i]); + gtk_widget_show(v1); + gtk_widget_show(expa); + + gtk_widget_grab_focus(ea[2]); + gtk_grab_add(expa); + + gtk_signal_connect(GTK_OBJECT(ea[10]),"clicked", + GTK_SIGNAL_FUNC(expa_ok),NULL); + gtk_signal_connect(GTK_OBJECT(ea[11]),"clicked", + GTK_SIGNAL_FUNC(expa_cancel),NULL); + gtk_signal_connect(GTK_OBJECT(expa),"destroy", + GTK_SIGNAL_FUNC(expa_destroy),NULL); +} + +void +expa_ok (GtkWidget * widget, gpointer data) +{ + struct PREF_ISP_INFO *pii; + pii=&pref_entries[selected_entry]; + strncpy(pii->s_expect[pii->nExpectPairs],gtk_entry_get_text(GTK_ENTRY(expa_e[0])),31); + strncpy(pii->s_send[pii->nExpectPairs],gtk_entry_get_text(GTK_ENTRY(expa_e[1])),31); + pii->nExpectPairs++; + gtk_widget_destroy(expa); + exp_update(); +} + +void +expa_cancel (GtkWidget * widget, gpointer data) +{ + gtk_widget_destroy(expa); +} + +void +expa_destroy (GtkWidget * widget, gpointer data) +{ + gtk_grab_remove(widget); + expa=NULL; +} + +void +extract_delimited_string(char *dest,char *src,int count,char delim,int max) +{ + char *p,*it; + int cur,on; + char last; + + dest[0]=0; + + p=dest; + it=src; + last=0; + on=0; + + for(cur=0;it[0]!=0;it++) { + if ((it[0]==delim)&&(last!='\\')) { + if (!on) + cur++; + on=!on; + last=it[0]; + continue; + } + + if ((on)&&(cur==count)) { + p[0]=it[0]; + p[1]=0; + p++; + if (strlen(dest)>=max) + return; + } + + last=it[0]; + } +} + +GtkWidget *helpwnd=NULL; + +void +pop_help (GtkWidget * widget, gpointer data) +{ + GtkWidget *cw[40]; + int i; + + if (helpwnd!=NULL) { + gdk_window_raise(helpwnd->window); + return; + } + + helpwnd=gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(helpwnd),"YAWMPPP Help"); + + if (gdk_screen_width()>800) + gtk_window_set_default_size(GTK_WINDOW(helpwnd),800,420); + else + gtk_window_set_default_size(GTK_WINDOW(helpwnd),630,420); + + gtk_window_set_position(GTK_WINDOW(helpwnd),GTK_WIN_POS_CENTER); + gtk_widget_realize(helpwnd); + + cw[0]=gtk_vbox_new(FALSE,1); + gtk_container_add(GTK_CONTAINER(helpwnd),cw[0]); + gtk_container_set_border_width(GTK_CONTAINER(helpwnd),4); + + cw[1]=gtk_notebook_new(); + + /* the help pages */ + + cw[2]=gtk_label_new("man yawmppp"); + cw[3]=gtk_hbox_new(FALSE,1); + cw[4]=gtk_text_new(NULL,NULL); + cw[7]=gtk_vscrollbar_new(GTK_TEXT(cw[4])->vadj); + gtk_box_pack_start(GTK_BOX(cw[3]),cw[4],TRUE,TRUE,1); + gtk_box_pack_start(GTK_BOX(cw[3]),cw[7],FALSE,TRUE,1); + gtk_notebook_append_page(GTK_NOTEBOOK(cw[1]),cw[3],cw[2]); + + cw[8]=gtk_label_new("man pppd"); + cw[9]=gtk_hbox_new(FALSE,1); + cw[10]=gtk_text_new(NULL,NULL); + cw[11]=gtk_vscrollbar_new(GTK_TEXT(cw[10])->vadj); + gtk_box_pack_start(GTK_BOX(cw[9]),cw[10],TRUE,TRUE,1); + gtk_box_pack_start(GTK_BOX(cw[9]),cw[11],FALSE,TRUE,1); + gtk_notebook_append_page(GTK_NOTEBOOK(cw[1]),cw[9],cw[8]); + + cw[12]=gtk_label_new("man chat"); + cw[13]=gtk_hbox_new(FALSE,1); + cw[14]=gtk_text_new(NULL,NULL); + cw[15]=gtk_vscrollbar_new(GTK_TEXT(cw[14])->vadj); + gtk_box_pack_start(GTK_BOX(cw[13]),cw[14],TRUE,TRUE,1); + gtk_box_pack_start(GTK_BOX(cw[13]),cw[15],FALSE,TRUE,1); + gtk_notebook_append_page(GTK_NOTEBOOK(cw[1]),cw[13],cw[12]); + + cw[16]=gtk_label_new("README"); + cw[17]=gtk_hbox_new(FALSE,1); + cw[18]=gtk_text_new(NULL,NULL); + cw[19]=gtk_vscrollbar_new(GTK_TEXT(cw[18])->vadj); + gtk_box_pack_start(GTK_BOX(cw[17]),cw[18],TRUE,TRUE,1); + gtk_box_pack_start(GTK_BOX(cw[17]),cw[19],FALSE,TRUE,1); + gtk_notebook_append_page(GTK_NOTEBOOK(cw[1]),cw[17],cw[16]); + + cw[20]=gtk_label_new("FAQ"); + cw[21]=gtk_hbox_new(FALSE,1); + cw[22]=gtk_text_new(NULL,NULL); + cw[23]=gtk_vscrollbar_new(GTK_TEXT(cw[22])->vadj); + gtk_box_pack_start(GTK_BOX(cw[21]),cw[22],TRUE,TRUE,1); + gtk_box_pack_start(GTK_BOX(cw[21]),cw[23],FALSE,TRUE,1); + gtk_notebook_append_page(GTK_NOTEBOOK(cw[1]),cw[21],cw[20]); + + cw[24]=gtk_label_new("License"); + cw[25]=gtk_hbox_new(FALSE,1); + cw[26]=gtk_text_new(NULL,NULL); + cw[27]=gtk_vscrollbar_new(GTK_TEXT(cw[26])->vadj); + gtk_box_pack_start(GTK_BOX(cw[25]),cw[26],TRUE,TRUE,1); + gtk_box_pack_start(GTK_BOX(cw[25]),cw[27],FALSE,TRUE,1); + gtk_notebook_append_page(GTK_NOTEBOOK(cw[1]),cw[25],cw[24]); + + + gtk_box_pack_start(GTK_BOX(cw[0]),cw[1],TRUE,TRUE,4); + cw[5]=gtk_hbox_new(FALSE,4); + cw[6]=gtk_button_new_with_label(" Dismiss "); + + gtk_box_pack_start(GTK_BOX(cw[0]),cw[5],FALSE,TRUE,2); + gtk_box_pack_end(GTK_BOX(cw[5]),cw[6],FALSE,FALSE,4); + + for(i=0;i<28;i++) + gtk_widget_show(cw[i]); + gtk_widget_show(helpwnd); + gtk_grab_add(helpwnd); + + gtk_signal_connect(GTK_OBJECT(helpwnd),"destroy", + GTK_SIGNAL_FUNC(help_dead),NULL); + gtk_signal_connect(GTK_OBJECT(cw[6]),"clicked", + GTK_SIGNAL_FUNC(help_die),NULL); + + gtk_window_set_title(GTK_WINDOW(helpwnd), + "YAWMPPP Help (retrieving man yawmppp...)"); + add_man("yawmppp",cw[4],0); + gtk_window_set_title(GTK_WINDOW(helpwnd), + "YAWMPPP Help (retrieving man pppd...)"); + add_man("pppd",cw[10],1); + gtk_window_set_title(GTK_WINDOW(helpwnd), + "YAWMPPP Help (retrieving man chat...)"); + add_man("chat",cw[14],2); + gtk_window_set_title(GTK_WINDOW(helpwnd), + "YAWMPPP Help (retrieving README...)"); + add_docfile("README",cw[18],3); + gtk_window_set_title(GTK_WINDOW(helpwnd), + "YAWMPPP Help (retrieving FAQ...)"); + add_docfile("FAQ",cw[22],4); + gtk_window_set_title(GTK_WINDOW(helpwnd), + "YAWMPPP Help (retrieving GPL...)"); + add_docfile("COPYING",cw[26],5); + gtk_window_set_title(GTK_WINDOW(helpwnd), + "YAWMPPP Help"); +} + +void +help_die (GtkWidget * widget, gpointer data) +{ + gtk_grab_remove(helpwnd); + gtk_widget_destroy(helpwnd); +} + +void +help_dead (GtkWidget * widget, gpointer data) +{ + helpwnd=NULL; +} + +#define YAWMPPP_CANT_MAN "help system: unable to retrieve document" + +void +add_man(char *manpage,GtkWidget *text,int index) +{ + char *buf; + char line[512]; + FILE *man; + long blen,tlen; + + if (man_flag[index]) { + gtk_text_freeze(GTK_TEXT(text)); + gtk_text_insert(GTK_TEXT(text),fixedfont,NULL,NULL,man_help[index], + strlen(man_help[index])); + gtk_text_thaw(GTK_TEXT(text)); + while(gtk_events_pending()) + gtk_main_iteration(); + return; + } + + sprintf(line,"man %s",manpage); + man=popen(line,"r"); + + while(gtk_events_pending()) /* let man,troff,etc. work a little */ + gtk_main_iteration(); + + gtk_text_freeze(GTK_TEXT(text)); + if (man) { + buf=(char *)g_malloc(blen=(128<<10)); + buf[0]=0; tlen=0; + while(fgets(line,511,man)) { + unman(line); + strcat(buf,line); + tlen+=strlen(line); + if (tlen>(blen-(4<<10))) + buf=(char *)g_realloc(buf,blen+=(10<<10)); + } + pclose(man); + buf=g_realloc(buf,strlen(buf)+4); + gtk_text_insert(GTK_TEXT(text),fixedfont,NULL,NULL,buf,strlen(buf)); + man_help[index]=buf; + man_flag[index]=1; + } else { + gtk_text_insert(GTK_TEXT(text),fixedfont,NULL,NULL,YAWMPPP_CANT_MAN, + strlen(YAWMPPP_CANT_MAN)); + } + gtk_text_thaw(GTK_TEXT(text)); + while(gtk_events_pending()) + gtk_main_iteration(); +} + +void +add_docfile(char *source,GtkWidget *text,int index) +{ + FILE *f; + char *buf; + char line[512]; + long tlen,blen; + + if (man_flag[index]) { + gtk_text_freeze(GTK_TEXT(text)); + gtk_text_insert(GTK_TEXT(text),fixedfont,NULL,NULL,man_help[index], + strlen(man_help[index])); + gtk_text_thaw(GTK_TEXT(text)); + while(gtk_events_pending()) + gtk_main_iteration(); + return; + } + + sprintf(line,"%s/doc/yawmppp-%s/%s",IPREFIX,VERSION,source); + f=fopen(line,"r"); + + gtk_text_freeze(GTK_TEXT(text)); + if (f) { + buf=(char *)g_malloc(blen=(128<<10)); + buf[0]=0; tlen=0; + while(fgets(line,511,f)) { + strcat(buf,line); + tlen+=strlen(line); + if (tlen>(blen-(4<<10))) + buf=(char *)g_realloc(buf,blen+=(10<<10)); + } + fclose(f); + buf=g_realloc(buf,strlen(buf)+4); + gtk_text_insert(GTK_TEXT(text),fixedfont,NULL,NULL,buf,strlen(buf)); + man_help[index]=buf; + man_flag[index]=1; + } else { + gtk_text_insert(GTK_TEXT(text),fixedfont,NULL,NULL,YAWMPPP_CANT_MAN, + strlen(YAWMPPP_CANT_MAN)); + } + gtk_text_thaw(GTK_TEXT(text)); + while(gtk_events_pending()) + gtk_main_iteration(); +} + +void +unman(char *s) +{ + int i,fs; + fs=strlen(s); + for(i=0;iwindow, &mask, + &style->bg[GTK_STATE_NORMAL], + (gchar **) padlock_xpm); + + /* main vbox */ + mv=gtk_vbox_new(FALSE,2); + gtk_container_add(GTK_CONTAINER(wpwd),mv); + + sprintf(z,"To commit the changes made to the configuration\n"\ + "YAWMPPP must run some actions with superuser\n"\ + "privileges to write down PPP configuration to the\n"\ + "/etc/ppp/peers directory. The script that will be\n"\ + "run is %s.\n"\ + "If you click 'Proceed' an xterm window will pop up\n"\ + "asking the root password to run the script.\n"\ + "You can 'Skip' and run the script on your own,\n"\ + "but the configuration changes will only take effect\n"\ + "after the script is properly run as root.\n"\ + "You can examine the script that will be run clicking the\n"\ + "'View Script' button.",what); + + ehb=gtk_hbox_new(FALSE,8); + gtk_box_pack_start(GTK_BOX(mv),ehb,FALSE,TRUE,4); + + pix=gtk_pixmap_new(padlock,mask); + gtk_box_pack_start(GTK_BOX(ehb),pix,FALSE,TRUE,4); + + lb=gtk_label_new(z); + gtk_label_set_justify(GTK_LABEL(lb),GTK_JUSTIFY_LEFT); + + gtk_box_pack_start(GTK_BOX(ehb),lb,FALSE,TRUE,4); + + hs=gtk_hseparator_new(); + gtk_box_pack_start(GTK_BOX(mv),hs,FALSE,TRUE,4); + + hb=gtk_hbox_new(TRUE,8); + gtk_box_pack_start(GTK_BOX(mv),hb,FALSE,TRUE,4); + + b[0]=gtk_button_new_with_label("Proceed"); + b[1]=gtk_button_new_with_label("Skip"); + b[2]=gtk_button_new_with_label("View Script"); + + gtk_box_pack_start(GTK_BOX(hb),b[0],FALSE,TRUE,2); + gtk_box_pack_start(GTK_BOX(hb),b[1],FALSE,TRUE,2); + gtk_box_pack_start(GTK_BOX(hb),b[2],FALSE,TRUE,2); + + gtk_widget_show(mv); + gtk_widget_show(hs); + gtk_widget_show(lb); + gtk_widget_show(pix); + gtk_widget_show(ehb); + gtk_widget_show(hb); + gtk_widget_show(b[0]); + gtk_widget_show(b[1]); + gtk_widget_show(b[2]); + gtk_widget_show(wpwd); + + gtk_grab_add(wpwd); + + gtk_signal_connect (GTK_OBJECT (wpwd), "delete_event", + GTK_SIGNAL_FUNC (pwd_kill), NULL); + + gtk_signal_connect (GTK_OBJECT (b[0]), "clicked", + GTK_SIGNAL_FUNC (pwd_ok), NULL); + gtk_signal_connect (GTK_OBJECT (b[1]), "clicked", + GTK_SIGNAL_FUNC (pwd_cancel), NULL); + gtk_signal_connect (GTK_OBJECT (b[2]), "clicked", + GTK_SIGNAL_FUNC (pwd_view), NULL); + + pwdb[0]=b[0]; + pwdb[1]=b[1]; + pwdb[2]=b[2]; + + pwd_over=0; + while(!pwd_over) + if (gtk_events_pending()) + gtk_main_iteration(); +} + +gint +pwd_kill (GtkWidget * widget, GdkEvent * event, gpointer data) +{ + return TRUE; +} + +void +pwd_cancel(GtkWidget *gw,gpointer data) +{ + gtk_grab_remove(wpwd); + gtk_widget_destroy(wpwd); + wpwd=0; + pwd_over=1; +} + +void +pwd_ok(GtkWidget *gw,gpointer data) +{ + gtk_widget_set_sensitive(pwdb[0],0); + gtk_widget_set_sensitive(pwdb[1],0); + gtk_widget_set_sensitive(pwdb[2],0); + + if (try_run_script(cmdtorun)) { + gtk_grab_remove(wpwd); + gtk_widget_destroy(wpwd); + wpwd=0; + pwd_over=1; + } else { + message_box(GTK_WINDOW(wpwd), + ERR_CANT_SU,"Error", + MSGBOX_OK,MSGBOX_ICON_EXCLAMATION); + gtk_widget_set_sensitive(pwdb[0],TRUE); + gtk_widget_set_sensitive(pwdb[1],TRUE); + gtk_widget_set_sensitive(pwdb[2],TRUE); + } +} + +GtkWidget *swnd; + +void +pwd_view(GtkWidget *gw,gpointer data) +{ + char z[512],x[256]; + FILE *f; + GtkWidget *v,*txt,*hs,*hb,*b_close,*hh,*vsb; + GdkFont *fixed; + + fixed=gdk_font_load("-*-fixed-medium-r-normal--14-*-*-*-*-*-*"); + + sprintf(z,"View Script: %s",cmdtorun); + + swnd=gtk_window_new(GTK_WINDOW_DIALOG); + gtk_window_set_default_size(GTK_WINDOW(swnd),600,500); + gtk_window_set_transient_for(GTK_WINDOW(swnd),GTK_WINDOW(wpwd)); + gtk_window_set_title(GTK_WINDOW(swnd),z); + gtk_window_set_policy(GTK_WINDOW(swnd),TRUE,TRUE,TRUE); + gtk_container_set_border_width(GTK_CONTAINER(swnd),4); + + v=gtk_vbox_new(FALSE,2); + gtk_container_add(GTK_CONTAINER(swnd),v); + + hh=gtk_hbox_new(FALSE,0); + txt=gtk_text_new(NULL,NULL); + vsb=gtk_vscrollbar_new(GTK_TEXT(txt)->vadj); + + gtk_box_pack_start(GTK_BOX(hh),txt,TRUE,TRUE,0); + gtk_box_pack_start(GTK_BOX(hh),vsb,FALSE,TRUE,0); + gtk_box_pack_start(GTK_BOX(v),hh,TRUE,TRUE,2); + + hs=gtk_hseparator_new(); + gtk_box_pack_start(GTK_BOX(v),hs,FALSE,FALSE,4); + + hb=gtk_hbox_new(FALSE,8); + gtk_box_pack_start(GTK_BOX(v),hb,FALSE,TRUE,4); + + b_close=gtk_button_new_with_label(" Close "); + gtk_box_pack_end(GTK_BOX(hb),b_close,FALSE,TRUE,4); + + GTK_WIDGET_SET_FLAGS(b_close,GTK_CAN_DEFAULT); + + gtk_text_freeze(GTK_TEXT(txt)); + f=fopen(cmdtorun,"r"); + if (f) { + while(fgets(x,255,f)) + gtk_text_insert(GTK_TEXT(txt),fixed,NULL,NULL,x,-1); + fclose(f); + } + + gtk_text_thaw(GTK_TEXT(txt)); + + gtk_widget_show(b_close); + gtk_widget_show(hb); + gtk_widget_show(txt); + gtk_widget_show(vsb); + gtk_widget_show(hh); + gtk_widget_show(hs); + gtk_widget_show(v); + gtk_widget_show(swnd); + + gtk_grab_add(swnd); + gtk_widget_grab_default(b_close); + + gtk_signal_connect (GTK_OBJECT (swnd), "delete_event", + GTK_SIGNAL_FUNC (pwd_kill), NULL); + gtk_signal_connect (GTK_OBJECT (b_close), "clicked", + GTK_SIGNAL_FUNC (spwd_close), NULL); + + if (fixed) + gdk_font_unref(fixed); +} + +void +spwd_close(GtkWidget *gw,gpointer data) +{ + gtk_grab_remove(swnd); + gtk_widget_destroy(swnd); +} + +int +try_run_script(char *cmd) +{ + int xtermpid,status; + char fcmd[512],aux[256]; + FILE *f; + + xtermpid=fork(); + if (xtermpid<0) return 0; + + if (xtermpid) { + /* parent */ + while (!waitpid(xtermpid,&status,WNOHANG)) + if (gtk_events_pending()) + gtk_main_iteration(); + else + usleep(100000L); + + if (WIFEXITED(status)) + if (WEXITSTATUS(status)) + return 0; + + /* check if script ran successfully */ + sprintf(aux,"%s/.yawmppp2/.root_didnt_run_it",getenv("HOME")); + f=fopen(aux,"r"); + if (f) { + fclose(f); + return 0; + } + + return 1; + } else { + /* child */ + sprintf(fcmd,"echo \"(YAWMPPP)\" ; echo \"Enter root password for running %s\" ; su -c %s", + cmd,cmd); + execlp("xterm","xterm", + "-geometry","75x10", + "-fn","-*-fixed-medium-r-normal--15-*-*-*-*-*-*", + "-title","xterm - YAWMPPP [Apply Changes]", + "-e","/bin/sh","-c",fcmd,0); + execlp("rxvt","rxvt", + "-geometry","75x10", + "-fn","-*-fixed-medium-r-normal--15-*-*-*-*-*-*", + "-title","xterm - YAWMPPP [Apply Changes]", + "-e","/bin/sh","-c",fcmd,0); + execlp("aterm","aterm", + "-geometry","75x10", + "-fn","-*-fixed-medium-r-normal--15-*-*-*-*-*-*", + "-title","xterm - YAWMPPP [Apply Changes]", + "-e","/bin/sh","-c",fcmd,0); + execlp("eterm","eterm", + "-geometry","75x10", + "-fn","-*-fixed-medium-r-normal--15-*-*-*-*-*-*", + "-title","xterm - YAWMPPP [Apply Changes]", + "-e","/bin/sh","-c",fcmd,0); + /* well, we really tried ... */ + exit(1); + } +} diff --git a/yawmppp/src/gtksetup/applet.h b/yawmppp/src/gtksetup/applet.h new file mode 100644 index 0000000..d8e52ec --- /dev/null +++ b/yawmppp/src/gtksetup/applet.h @@ -0,0 +1,182 @@ + +#ifndef YAWMPPP_APPLET_H +#define YAWMPPP_APPLET_H + +#include +#include "isprc.h" + +/* not less than the dock applet */ +#define MAX_ISPS 40 + +#define ERR_MAX_ISPS "You can't have more than 40 entries." + +#define ERR_CANT_MKDIR "Unable to create directory ~/.yawmppp\n"\ + "Current configuration could not be\n"\ + "written." + +#define ERR_CANT_WRITE "Unable to create configuration files\n"\ + "in directory ~/.yawmppp. Current configuration\n"\ + "may not have been only partially written." + +#define ERR_DIDNT_WRITE "There were errors when saving the configuration.\n"\ + "Do you still wish to close wmppp.pref and [maybe] lose\n"\ + "current data ?" + +#define INFO_CANT_APPLY_NOW "The dock applet will update itself only when\n"\ + "the current connection is over." + +#define ERR_CANT_SU "Script didn't run properly. Bad password ?" + +#define MAX_EXPECT_PAIRS 16 + +struct PREF_ISP_INFO { + char LongName[128]; + char ShortName[16]; + char Device[64]; + char Username[32]; + char Password[32]; + char Phone[32]; + char ModemInit1[256]; + char ModemInit2[256]; + char UserString[32]; + char PassString[32]; + char PulseDial[8]; + char ModemSpeed[16]; + + /* appended in 1.1.0 */ + int nExpectPairs; + char s_expect[MAX_EXPECT_PAIRS][32]; + char s_send[MAX_EXPECT_PAIRS][32]; + + struct ISP_PPP ppp; /* defined in ../isprc.h */ + + /* appended in 1.1.2 */ + int nologin; +}; + +struct PREF_PPP_OPT { + int defaultroute; + int lock; + int passive; + int debug; + int kdebug; + int noauth; + int noipdefault; + int linectl; /* 0=modem 1=local */ + int flowctl; /* 0=crtscts 1=xonxoff 2=nocrtscts 3=DC */ + int mtu; + int mru; + int lcp[5]; /* in the same order as in the dialog */ + + int chap; + int pap; + + int usepeerdns; +}; + +void create_preferences_panel(void); +void clear_and_disable_right_pane(void); +void load_rc_entries(void); +void update_right_pane(void); +void commit_back_to_db(void); +void fill_list(void); +int write_and_apply_data(void); +void check_client(void); +int file_exists(char *s); +void find_out_paths(void); +void test_set_path(char *,char *); + +void xlate_ppp_to_pref(struct YAWMPPP_ISP_INFO *wii, + struct PREF_ISP_INFO *pii); + +GtkWidget *hlabel_new(char *); + +GtkWidget *make_ppp_pane(void); +void get_ppp_pane(void); +void set_ppp_pane(void); +char *mk_ppp_string(struct PREF_PPP_OPT *modi,char *sep); +void read_ppp_options_from_rc(char *p); + +char *wrapped_strtok(char *a,char *b); + +gint applet_kill (GtkWidget * widget, GdkEvent * event, gpointer data); +void applet_destroy (GtkWidget * widget, gpointer data); +void applet_apply (GtkWidget * widget, gpointer data); +void applet_save_and_quit (GtkWidget * widget, gpointer data); + +void list_select(GtkCList *cl,gint row,gint column, + GdkEventButton *geb,gpointer data); +void list_unselect(GtkCList *cl,gint row,gint column, + GdkEventButton *geb,gpointer data); + +void list_moveup(GtkWidget *gw,gpointer data); +void list_movedown(GtkWidget *gw,gpointer data); +void list_remove(GtkWidget *gw,gpointer data); +void list_duplicate(GtkWidget *gw,gpointer data); +void list_add(GtkWidget *gw,gpointer data); + +/* more settings dialog */ + +void pop_advanced(GtkWidget *gw,gpointer data); +void adv_ok (GtkWidget * widget, gpointer data); +void adv_cancel (GtkWidget * widget, gpointer data); +void adv_destroy (GtkWidget * widget, gpointer data); + +void enable_local_ppp(gboolean e); +void ppp_override_toggle(GtkToggleButton *gtb,gpointer data); + +/* more settings dialog */ + +void isp_rename(GtkEditable *ge,gpointer data); + +void make_ppp_default(GtkWidget *w,gpointer data); + +/* expect/send */ + +void pop_expect(GtkWidget *w,gpointer data); +void exp_ok (GtkWidget * widget, gpointer data); +void exp_cancel (GtkWidget * widget, gpointer data); +void exp_destroy (GtkWidget * widget, gpointer data); +void exp_update(void); +void exp_up(GtkWidget *widget,gpointer data); +void exp_down(GtkWidget *widget,gpointer data); +void exp_disable(void); +void exp_enable(void); +void exp_select(GtkCList *cl,gint row,gint column, + GdkEventButton *geb,gpointer data); +void exp_unselect(GtkCList *cl,gint row,gint column, + GdkEventButton *geb,gpointer data); +void exp_add_delay(void); +void exp_remove(void); +void exp_add(void); +void expa_destroy (GtkWidget * widget, gpointer data); +void expa_ok (GtkWidget * widget, gpointer data); +void expa_cancel (GtkWidget * widget, gpointer data); + +/* expect/send */ + +void extract_delimited_string(char *dest,char *src,int count,char delim,int max); + +/* help */ +void pop_help (GtkWidget * widget, gpointer data); +void help_dead (GtkWidget * widget, gpointer data); +void help_die (GtkWidget * widget, gpointer data); + +void unman(char *s); +void add_man(char *manpage,GtkWidget *text,int index); +void add_docfile(char *source,GtkWidget *text,int index); + + +/* misc */ +void run_as_root(char *what); +gint pwd_kill (GtkWidget * widget, GdkEvent * event, gpointer data); + +void pwd_cancel(GtkWidget *gw,gpointer data); +void pwd_ok(GtkWidget *gw,gpointer data); +void pwd_view(GtkWidget *gw,gpointer data); + +void spwd_destroy (GtkWidget * widget, gpointer data); +void spwd_close(GtkWidget *gw,gpointer data); +int try_run_script(char *cmd); + +#endif diff --git a/yawmppp/src/gtksetup/bong.xpm b/yawmppp/src/gtksetup/bong.xpm new file mode 100644 index 0000000..11b6cd4 --- /dev/null +++ b/yawmppp/src/gtksetup/bong.xpm @@ -0,0 +1,100 @@ +/* XPM */ +static char * bong_xpm[] = { +"64 64 33 1", +" c None", +". c #020204", +"+ c #FEFEFC", +"@ c #710204", +"# c #A21213", +"$ c #6E1414", +"% c #B9191A", +"& c #3C0204", +"* c #891514", +"= c #550304", +"- c #8A090A", +"; c #A31D1D", +"> c #661719", +", c #570B0C", +"' c #8A1C1C", +") c #801514", +"! c #7E0504", +"~ c #BB1E1D", +"{ c #320204", +"] c #4A0304", +"^ c #6C0C0C", +"/ c #711B1C", +"( c #AE1614", +"_ c #970D0C", +": c #AF1B1C", +"< c #7E1D1C", +"[ c #7D0C0C", +"} c #C51E1C", +"| c #971414", +"1 c #620204", +"2 c #600D0C", +"3 c #971C1C", +"4 c #C41A1C", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ........ ", +" ....#____--!.... ", +" ..(((#((#_#_--!!@@.. ", +" .(%(%%%%(((##__-!!!@!. ", +" ..(%%4%4%4%%((##__-!!@@@.. ", +" .(%%44%44}}4%4%((__-!!@@@@@. ", +" .(%%%%%%:%}}4}4%%##_-!@@@@@@@. ", +" .#(%4%::33;;}}4444(_-!@111@1@@@. ", +" .(%%%(|'$/<';~}}4%#_[2=]]=11@@@. ", +" .((%%%;'$+++/<;~}4(#)2]++&]=11@@!. ", +" ._(%(%:*$+++++/<;~~|*^,++++&]=@1@@@. ", +" ._(%%%:*+++++++<3;||^,++++++]=1@@@@. ", +" ._#(%%%:3/++++++//')$2++++++&]=@@@@@@. ", +" .__(%4%~;'/++++++>$^2++++++&]=11@@@@@. ", +" ._#((44~:3++++++++++]]1@11@@@@@@@@. ", +" .--__#(%%}~%#*$2++++++++&,=1@@@@@@@@@@@. ", +" .!--_#(#%%%%;*2,++++++++&]=@@1@@@@@@@@@. ", +" .!!-__##(%(#|)2,++++++++&]==@@@@@@@@@@@. ", +" .@!!-__#####[^]++++++++++&]==11@1@@@@@@. ", +" .@@!!-_____[^2++++++++++++{]=11@@@@@@@@. ", +" .@@!!!---_[^=]+++++++++++++{]=11@@@1@@@. ", +" .@@!!!!!!^1]++++++&&++++++{&=11@@@@@@. ", +" .@@@!!!@1=]++++++&&&&++++++&&]=11@@@@. ", +" .@@@@@@1=&++++++&&]]&&++++++&]=11@@@@. ", +" .@@@@@1=]&++++++&]==]&{++++++&]11@@@@. ", +" .@@@@1=&++++++&]==1=]&+++++++]=1@@@. ", +" .@@@@11]&++++&&]11@1=]{+++++{]=@1@@. ", +" .@@@11=&&++{]==1@111]]{+++{]=11@@. ", +" .@@@11=]&&]]=1@@@@11]]&&&]]11@@. ", +" .@@@@11====1@@@@@@@11=]]]=1@@@@. ", +" .@@@@11111@1@@@@@@@11111111@@. ", +" .@@@@@@@1@@@@@@@@@@@@@@@@@@. ", +" ..@@@@@@@@@@@@@@@@@@@@@@.. ", +" .@@@@@@@@1@@@@@@@@@@@. ", +" ..@@@@@@@@@@@@@@@@.. ", +" ....@@@@1@@@.... ", +" ........ ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" "}; diff --git a/yawmppp/src/gtksetup/cmd_del.xpm b/yawmppp/src/gtksetup/cmd_del.xpm new file mode 100644 index 0000000..c2baa8e --- /dev/null +++ b/yawmppp/src/gtksetup/cmd_del.xpm @@ -0,0 +1,26 @@ +/* XPM */ +static char * cmd_del_xpm[] = { +"20 20 3 1", +" c None", +". c #000000", +"+ c #7B7D7B", +" ", +" ", +" ", +" ", +" .+ .+ ", +" ...+ ...+ ", +" ...+ ...+ ", +" ...+ ...+ ", +" ......+ ", +" ....+ ", +" ....+ ", +" ......+ ", +" ...++...+ ", +" ...+ ...+ ", +" ...+ ...+ ", +" .+ .+ ", +" ", +" ", +" ", +" "}; diff --git a/yawmppp/src/gtksetup/cmd_down.xpm b/yawmppp/src/gtksetup/cmd_down.xpm new file mode 100644 index 0000000..2bc1fda --- /dev/null +++ b/yawmppp/src/gtksetup/cmd_down.xpm @@ -0,0 +1,13 @@ +/* XPM */ +static char * cmd_down_xpm[] = { +"13 7 3 1", +" c None", +". c #000000", +"+ c #7B7D7B", +"............+", +" ..........+ ", +" ........+ ", +" ......+ ", +" ....+ ", +" ..+ ", +" + "}; diff --git a/yawmppp/src/gtksetup/cmd_dup.xpm b/yawmppp/src/gtksetup/cmd_dup.xpm new file mode 100644 index 0000000..2850686 --- /dev/null +++ b/yawmppp/src/gtksetup/cmd_dup.xpm @@ -0,0 +1,27 @@ +/* XPM */ +static char * cmd_dup_xpm[] = { +"20 20 4 1", +" c None", +". c #000000", +"+ c #FFFFFF", +"@ c #7B7D7B", +" ", +" ", +" ...... ", +" ..++++. ", +" .+.++++.@ ", +" .++.++++.... ", +" .....++++.++.@ ", +" .++++++++.++.@ ", +" .++++++++.++.@ ", +" .++++++++.++.@ ", +" .++++++++.++.@ ", +" .++++++++.++.@ ", +" .++++++++.++.@ ", +" .++++++++.++.@ ", +" ..........++.@ ", +" @@.++++++++.@ ", +" .++++++++.@ ", +" ..........@ ", +" @@@@@@@@@@ ", +" "}; diff --git a/yawmppp/src/gtksetup/cmd_new.xpm b/yawmppp/src/gtksetup/cmd_new.xpm new file mode 100644 index 0000000..61c6396 --- /dev/null +++ b/yawmppp/src/gtksetup/cmd_new.xpm @@ -0,0 +1,27 @@ +/* XPM */ +static char * cmd_new_xpm[] = { +"20 20 4 1", +" c None", +". c #000000", +"+ c #FFFFFF", +"@ c #7B7D7B", +" ", +" ", +" ", +" ...... ", +" ..++++.@ ", +" .+.++++.@ ", +" .++.++++.@ ", +" .....++++.@ ", +" .++++++++.@ ", +" .++++++++.@ ", +" .++++++++.@ ", +" .++++++++.@ ", +" .++++++++.@ ", +" .++++++++.@ ", +" .++++++++.@ ", +" ..........@ ", +" @@@@@@@@@@ ", +" ", +" ", +" "}; diff --git a/yawmppp/src/gtksetup/cmd_up.xpm b/yawmppp/src/gtksetup/cmd_up.xpm new file mode 100644 index 0000000..8cf8bfe --- /dev/null +++ b/yawmppp/src/gtksetup/cmd_up.xpm @@ -0,0 +1,13 @@ +/* XPM */ +static char * cmd_up_xpm[] = { +"13 7 3 1", +" c None", +". c #000000", +"+ c #7B7D7B", +" .. ", +" ....+ ", +" ......+ ", +" ........+ ", +" ..........+ ", +"............+", +" ++++++++++++"}; diff --git a/yawmppp/src/gtksetup/exclam.xpm b/yawmppp/src/gtksetup/exclam.xpm new file mode 100644 index 0000000..f8ca72b --- /dev/null +++ b/yawmppp/src/gtksetup/exclam.xpm @@ -0,0 +1,132 @@ +/* XPM */ +static char * exclam_xpm[] = { +"64 64 65 1", +" c None", +". c #020204", +"+ c #958204", +"@ c #C6C604", +"# c #EAE604", +"$ c #4E4204", +"% c #AAA604", +"& c #E7C704", +"* c #282204", +"= c #CDB304", +"- c #E8D604", +"; c #F5F504", +"> c #A89204", +", c #6A6204", +"' c #D8D504", +") c #C1A504", +"! c #383304", +"~ c #727204", +"{ c #EEEA04", +"] c #FAD904", +"^ c #141204", +"/ c #D5BB04", +"( c #A28E04", +"_ c #EDCE04", +": c #E0C204", +"< c #B19A04", +"[ c #3C3C04", +"} c #B9A204", +"| c #FEFD04", +"1 c #C5AB04", +"2 c #8C7904", +"3 c #FAE404", +"4 c #302C04", +"5 c #F2DE04", +"6 c #565204", +"7 c #7C6B04", +"8 c #6E5E04", +"9 c #201C04", +"0 c #DEDC04", +"a c #DFCB04", +"b c #937E04", +"c c #FEEB04", +"d c #0D0A04", +"e c #8E8A04", +"f c #DDBE04", +"g c #F4D104", +"h c #B79C04", +"i c #CECE04", +"j c #AAAA04", +"k c #FADE04", +"l c #8E7E04", +"m c #BAAA04", +"n c #F1D804", +"o c #FEF304", +"p c #E2D204", +"q c #463E04", +"r c #625204", +"s c #9A8604", +"t c #B2A204", +"u c #EECA04", +"v c #2E2604", +"w c #D2B504", +"x c #AE9604", +"y c #726304", +"z c #3E3604", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" 0s ", +" ', ", +" #'}l ", +" {a/(4 ", +" ;;'=}4 ", +" |5-/mb* ", +" ||3na1hv ", +" ||35n_/1+y ", +" |co||#_=}s* ", +" |||@!..!>)<* ", +" |c|9....^}hb9 ", +" ||cj......y1hv ", +" |c3j......8=1sy ", +" ||33|......>/=}+* ", +" |33]c......xuf1h* ", +" ||33536....!)g&=}b9 ", +" |c3k]3~....$fguf1h4 ", +" ||33]]k%....y:]g&w)+y ", +" |c3k]]]@....2_]gg:=}s* ", +" ||3k]]]]c....x_]]guf1<9 ", +" ||33k]]]]c!..9)]]]]g&wh29 ", +" |c33k]]]]c6..!w]]g]guf1>9 ", +" ||33]]g]]]3e..r:]]]]gg&=h29 ", +" |33k]]]]g]]%..y&]]]]]gu:1hv ", +" ||ckk]]]]]]]|..xg]]]]]]g&/)sy ", +" |335]]]]]]]]39^h]]g]]]]g_&=}+* ", +" ||33]]g]]]g]]kh21]]]g]]]]guf1h* ", +" |c3k]]]]g]]]||jtk]]]]]g]]ng&=}b9 ", +" ||3k]]]]]]]]|j...9sg]]]]]]]guf1h4 ", +" |c33]]]]]]]]|9....^w]]]]]g]gg&w)+y ", +" ||3k]]]g]]]]]c......h]]g]]]]]gu&=}s* ", +" |c3k]]]]]g]]]]8....q1]]]]]]]]]guf1h* ", +" |;35]]g]g]]]]]]_2!!y):]]]]g]]]]g_&=hb9 ", +" ;;5nngggggggggg__ufwf&ggggggg_gg_u:/)xv ", +" {-aa&::ffffff:::ff::f:ffff::ffff:f/=}x28 ", +" 0'/=m1))))111)))1)))))))))1)1111))))hx(279 ", +" im%<>(>((>(((((((>((>(((>>(((((((((((sb27^ ", +" 0[!*^...................................ddd. ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" "}; diff --git a/yawmppp/src/gtksetup/info.xpm b/yawmppp/src/gtksetup/info.xpm new file mode 100644 index 0000000..140d284 --- /dev/null +++ b/yawmppp/src/gtksetup/info.xpm @@ -0,0 +1,100 @@ +/* XPM */ +static char * info_xpm[] = { +"64 64 33 1", +" c None", +". c #020208", +"+ c #8E8E91", +"@ c #56565B", +"# c #3A3A3F", +"$ c #06025F", +"% c #0A068F", +"& c #1E1E25", +"* c #040237", +"= c #0A0A71", +"- c #050250", +"; c #090677", +"> c #0E0EA9", +", c #0A069C", +"' c #E2E2E4", +") c #09065F", +"! c #060641", +"~ c #030223", +"{ c #C6C6C7", +"] c #72727E", +"^ c #AAAAAD", +"/ c #FEFEFC", +"( c #1E1E3C", +"_ c #0A0654", +": c #0C0A80", +"< c #0E0A8F", +"[ c #06064F", +"} c #0D0A9D", +"| c #56566A", +"1 c #3A3A54", +"2 c #040244", +"3 c #0A0684", +"4 c #09066C", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ....................................... ", +" .}}}}}}}}}}}}}}}},,%333%%,,}}}}}}}}}}}. ", +" .>>>>>>>>>>>>>>>}}:;)));:}}}>>>>>>>>>>. ", +" .}>>>>>>>>>>>>>,,%)[*~*2$3,,>>>>>>>>}}. ", +" .>,>,>,>,>,>,>},<4!({/'|!)<,,>,>,>}>}>. ", +" .>}}>}>}>}>}>}},:-~'////(-:,,}>}>}>}}}. ", +" .}}}}}}}}}}}}},%;[|/////|!;%,}}}}}}}}}. ", +" .>><}<}}}<}}<}<342|/////12=%<}<}}<}>><. ", +" .<<<}<<<<<}<><%:;[~'///^~_;<%}<<}<<<<<. ", +" .<<}<<}<<<<<<<%3;[!(+^]~2);%<<<<<><<<<. ", +" .<<<<<<<<<<<:%3;;)-*~~*2);;3<<<<:<<:<:. ", +" .:<<:<<<<::<;;;4[[2**~*[);3:<:<<<:::<:. ", +" .:::::::::3;;$[-2~~~~~*-$;;::<=:3:::3;. ", +" .=::::=:::;;;[2~~&@^'/]!$;;:::::33:::;. ", +" .:==:=:::=3$[-]^'/////|*)$;=;3===:;=:=. ", +" .;;;;;;4;;;$)!////////&*[$;==;;:==;;=;. ", +" .=========$)$*~|+'////.~$$$;;==4;;==4=. ", +" .)4444444=$4$[~..^///^~*[44=)4===44=4). ", +" .44))4)=444$[-*~.////^.*-$44)=))_==)4). ", +" .=====)=)=)$$$*~&////@~*-$)=_4)4)))==). ", +" .____)))[)))[-*~@////#~!--=))_)=)))))[. ", +" ._)))[)))[))-2~.+////.~*--))))_)_)_))). ", +" .)___)[)[)[--2*.^///'.~2--____)___)[[[. ", +" .[[[[[[[)[[--*~.////^.~*--[[[[[[[[[_[[. ", +" .[[[[[[[[[--2~~&////]~~*-[[[[-[[[[_[--. ", +" .--[-[2[[[!-*~~@////@.**2[[[[[[[2-!_!-. ", +" .!!2!!!!2!!2*~.+////&~~***!!!22!!!2!!!. ", +" .!!!2!2!22*2*~.^////..~**2*2!!2!!!22!*. ", +" .***!*!*!!**~~./////..~~~*****!*2*!!*!. ", +" .!!*!*!*****~~./////&..~~~~***!!!**!**. ", +" .*~!~**~***~~../////{@@^+~~**~*~*~!**~. ", +" .~*~!~!~!~~*~~.'////////+~~~~**~!~~!~*. ", +" .*~~~!~~~*~~~~.@/////{+#.~~~~~~!~~~~!~. ", +" .~~~~~~~~~~~~~...@@#...~.~~~~~~~~~~~~~. ", +" .~~~~~~~~~~~~~~~......~.~~~~~~~~~~~~~~. ", +" .~~~~~~~~~~~.~.~.~.~.~.~.~~~~~~~~~~~.~. ", +" .~.~.~.~~.~.~~.~.~.~.~.~.~.~.~.~.~.~~.. ", +" ....................................... ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" "}; diff --git a/yawmppp/src/gtksetup/msgbox.c b/yawmppp/src/gtksetup/msgbox.c new file mode 100644 index 0000000..5eda9b6 --- /dev/null +++ b/yawmppp/src/gtksetup/msgbox.c @@ -0,0 +1,188 @@ +/* + + Message Box Composite Widget + (currently included in various software packages) + Copyright (C) 1999-2000 Felipe Paulo Guazzi Bergo + bergo@seul.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +*/ + +#include +#include +#include +#include +#include "msgbox.h" + +#include "bong.xpm" +#include "exclam.xpm" +#include "info.xpm" +#include "question.xpm" + +/* PRIVATE */ + +void message_box_click_yes(GtkWidget *widget,gpointer data); +void message_box_click_no(GtkWidget *widget,gpointer data); +void message_box_click_cancel(GtkWidget *widget,gpointer data); +void message_box_click_ok(GtkWidget *widget,gpointer data); +gint immortal(GtkWidget *widget,GdkEvent *event,gpointer data); + +struct msgbox_data { + gint answer_available; + MsgBoxResult answer; +} cmdata; + +gchar ** mb_icons[5]={NULL,bong_xpm,info_xpm,exclam_xpm,question_xpm}; + +MsgBoxResult +message_box(GtkWindow *parent,char *txt,char *title,MsgBoxType mbt,MsgBoxIcon mbi) +{ + GtkWidget *msgbox,*b[3],*lb,*tbl,*hs; + GdkBitmap *mask; + GdkPixmap *dqmark; + GtkWidget *tqmark; + GtkStyle *style; + int i,nb; + + cmdata.answer_available=FALSE; + + msgbox=gtk_window_new(GTK_WINDOW_DIALOG); + tbl=gtk_table_new(3,4,FALSE); + gtk_container_add(GTK_CONTAINER(msgbox),tbl); + gtk_window_set_title(GTK_WINDOW(msgbox),title); + if (parent!=NULL) + gtk_window_set_transient_for(GTK_WINDOW(msgbox),parent); + gtk_container_set_border_width(GTK_CONTAINER(msgbox),4); + gtk_window_set_position(GTK_WINDOW(msgbox),GTK_WIN_POS_CENTER); + gtk_window_set_policy(GTK_WINDOW(msgbox),TRUE,TRUE,TRUE); + gtk_widget_realize(msgbox); + + style=gtk_widget_get_style(msgbox); + if (mbi!=MSGBOX_ICON_NONE) { + dqmark=gdk_pixmap_create_from_xpm_d(msgbox->window,&mask, + &style->bg[GTK_STATE_NORMAL], + mb_icons[mbi]); + tqmark=gtk_pixmap_new(dqmark,mask); + gtk_table_attach(GTK_TABLE(tbl),tqmark,0,1,0,1,GTK_FILL,GTK_FILL,5,5); + gtk_widget_show(tqmark); + } + + lb=gtk_label_new(txt); + gtk_label_set_justify(GTK_LABEL(lb),GTK_JUSTIFY_LEFT); + gtk_table_attach(GTK_TABLE(tbl),lb,1,4,0,1,GTK_FILL,GTK_FILL,10,10); + gtk_widget_show(lb); + + hs=gtk_hseparator_new(); + gtk_table_attach(GTK_TABLE(tbl),hs,0,4,1,2,GTK_FILL,GTK_FILL,0,10); + gtk_widget_show(hs); + + /* buttons */ + + switch(mbt) { + case MSGBOX_OK: + nb=1; + b[0]=gtk_button_new_with_label("OK"); + gtk_signal_connect(GTK_OBJECT(b[0]),"clicked", + GTK_SIGNAL_FUNC(message_box_click_ok),NULL); + break; + case MSGBOX_OKCANCEL: + nb=2; + b[0]=gtk_button_new_with_label("OK"); + gtk_signal_connect(GTK_OBJECT(b[0]),"clicked", + GTK_SIGNAL_FUNC(message_box_click_ok),NULL); + b[1]=gtk_button_new_with_label("Cancel"); + gtk_signal_connect(GTK_OBJECT(b[1]),"clicked", + GTK_SIGNAL_FUNC(message_box_click_cancel),NULL); + break; + case MSGBOX_YESNO: + nb=2; + b[0]=gtk_button_new_with_label("Yes"); + gtk_signal_connect(GTK_OBJECT(b[0]),"clicked", + GTK_SIGNAL_FUNC(message_box_click_yes),NULL); + b[1]=gtk_button_new_with_label("No"); + gtk_signal_connect(GTK_OBJECT(b[1]),"clicked", + GTK_SIGNAL_FUNC(message_box_click_no),NULL); + break; + case MSGBOX_YESNOCANCEL: + nb=3; + b[0]=gtk_button_new_with_label("Yes"); + gtk_signal_connect(GTK_OBJECT(b[0]),"clicked", + GTK_SIGNAL_FUNC(message_box_click_yes),NULL); + b[1]=gtk_button_new_with_label("No"); + gtk_signal_connect(GTK_OBJECT(b[1]),"clicked", + GTK_SIGNAL_FUNC(message_box_click_no),NULL); + b[2]=gtk_button_new_with_label("Cancel"); + gtk_signal_connect(GTK_OBJECT(b[2]),"clicked", + GTK_SIGNAL_FUNC(message_box_click_cancel),NULL); + break; + default: + nb=0; + } + + for(i=0;i + +/* ENUMS */ + +typedef enum +{ + MSGBOX_ICON_NONE, + MSGBOX_ICON_ERROR, + MSGBOX_ICON_INFO, + MSGBOX_ICON_EXCLAMATION, + MSGBOX_ICON_QUESTION +} MsgBoxIcon; + +typedef enum +{ + MSGBOX_OK, + MSGBOX_OKCANCEL, + MSGBOX_YESNO, + MSGBOX_YESNOCANCEL +} MsgBoxType; + +typedef enum +{ + MSGBOX_R_OK, + MSGBOX_R_YES, + MSGBOX_R_NO, + MSGBOX_R_CANCEL +} MsgBoxResult; + +/* prototype */ + +/* + obs 1: this call blocks until the user picks a choice. + obs 2: parent can be NULL. + obs 3: you must have a gtk_main loop running before calling it. +*/ + +MsgBoxResult message_box(GtkWindow *parent, + char *txt, + char *title, + MsgBoxType mbt, + MsgBoxIcon mbi); + +/* + excerpt from my 900-page book + + "The Ultimate Guide to Message Box Icons + Felipe Bergo - 0th edition + Prentice Room publishers, + ISBN 6666-6666-6666" + + MSGBOX_ICON_NONE No icon. + + MSGBOX_ICON_ERROR Should be used on errors, i.e., + something wrong really happened. + Currently included icon is a white + cross in a red circle. "bong.xpm" + + MSGBOX_ICON_QUESTION Should be used on any questions, like + confirmations. Currently included + icon is a white question mark in a + green circle. "question.xpm" + + MSGBOX_ICON_EXCLAMATION Should be used on warnings, like when + your code tries to allocate a resource + and it is busy (and being busy is "normal"). + Currently included icon is a black exclamation + mark in an yellow triangle. + + MSGBOX_ICON_INFO Should be used on general informative + messages, like "Operation Finished", + "Scan finished: 999999 blocks, + 999998 bad, 1 good.", and the like. + Currently included icon is a white "i" + in a blue square. + + The return value is an enum of MsgBoxResult type. +*/ + +#endif diff --git a/yawmppp/src/gtksetup/padlock.xpm b/yawmppp/src/gtksetup/padlock.xpm new file mode 100644 index 0000000..579138d --- /dev/null +++ b/yawmppp/src/gtksetup/padlock.xpm @@ -0,0 +1,140 @@ +/* XPM */ +static char * padlock_xpm[] = { +"64 64 73 1", +" c None", +". c #020202", +"+ c #464646", +"@ c #818181", +"# c #C2C2C2", +"$ c #3D3326", +"% c #929292", +"& c #5F5E5C", +"* c #B59470", +"= c #262626", +"- c #FEE6BE", +"; c #2C221B", +"> c #ACACAC", +", c #8F6E52", +"' c #DDC097", +") c #B4B4B4", +"! c #DADADA", +"~ c #231E19", +"{ c #BFA787", +"] c #1C1A18", +"^ c #8A8A8A", +"/ c #BABABA", +"( c #D4D4D4", +"_ c #777777", +": c #CECECE", +"< c #8E8E8E", +"[ c #5E4636", +"} c #171411", +"| c #666666", +"1 c #4C392D", +"2 c #A27E5E", +"3 c #D2B792", +"4 c #F4D2A5", +"5 c #DEDEDE", +"6 c #A98561", +"7 c #D9B287", +"8 c #707070", +"9 c #110E0B", +"0 c #9E7A5A", +"a c #F1CA9E", +"b c #989693", +"c c #FDDEB1", +"d c #5E4A36", +"e c #9A9A9A", +"f c #6C543E", +"g c #424242", +"h c #6A6A6A", +"i c #F8F8F8", +"j c #565656", +"k c #2A2A2A", +"l c #0B0A08", +"m c #ECC698", +"n c #795E46", +"o c #463E30", +"p c #B08C66", +"q c #E2E2E2", +"r c #E8E8E8", +"s c #2E2A26", +"t c #4A4A4A", +"u c #CDA67E", +"v c #505050", +"w c #A4A4A4", +"x c #D1AE84", +"y c #060606", +"z c #594636", +"A c #E7C094", +"B c #534131", +"C c #7E624A", +"D c #3C2D21", +"E c #C09A72", +"F c #DEB78B", +"G c #F0F0F0", +"H c #CACACA", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" .kjjjjvg}. ", +" ]hw(!(:#)_gl. ", +" }%5qq!(::H#w_k. ", +" 9^rrrq5!(:H##/b~. ", +" 9#GGr:v==~$%#))b}. ", +" .wiii_9y ylgw)>^l. ", +" ^Giirh .t>)w8. ", +" .eiiG@. .vw>@. ", +" ]eGi)y .@w^}. ", +" 8(GG)l ._ww|. ", +" _!rrwy .hweh. ", +" 8(q(j. .e/)8. ", +" 8(5#] .b)>h. ", +" 8H(/] .%>>|. ", +" hH(/] .<>w] ._ee_= ", +" tw##w] ,,y_b%&. ", +" $)b9lyAAFFac44mo8<^&f2.., ", +" n$j>)b+4ccc----c4'o+@8o&'mB... ", +" ByD~&w>eBm4ccccccc!'b];]$*'a{... ", +" 9}nn7,&w>%oFAa444444am3x{{x#mE9.9. ", +" ..s7xuCjew c #2B3264", +", c #4E5285", +"' c #64589F", +") c #BB9CF9", +"! c #6B62B1", +"~ c #7F60F1", +"{ c #836DE4", +"] c #4F4CBD", +"^ c #836DCA", +"/ c #A485FF", +"( c #906FFF", +"_ c #8178C9", +": c #47408D", +"< c #8D7CD5", +"[ c #001256", +"} c #011080", +"| c #693BFF", +"1 c #6A5BD8", +"2 c #7C6895", +"3 c #37318E", +"4 c #9C7AFB", +"5 c #7056F5", +"6 c #5A41D8", +"7 c #071256", +"8 c #2B25B0", +"9 c #001143", +"0 c #0F2292", +"a c #463FA4", +"b c #000B7A", +"c c #422ED9", +"d c #B9BCBA", +"e c #22247D", +"f c #4630EB", +"g c #7F5CFF", +"h c #8568FF", +"i c #7A57FF", +"j c #9E87D8", +"k c #7047F4", +"l c #3120CF", +"m c #5E27FF", +"n c #3B0FDC", +"o c #14257B", +"p c #A693D6", +"q c #6D40FF", +"r c #AD95FF", +"s c #14205B", +"t c #001299", +"u c #1406C7", +"v c #2417A4", +"w c #CFBAFF", +"x c #09219E", +"y c #00138C", +"z c #C7ABFE", +" ", +" ............... ", +" .+++++++++++++.. ", +" .+++++++++++++.@. ", +" .++#++#++##+++.+@. ", +" .++#+#+#+#+#++.++@. ", +" .++#+#+++#+#++...... ", +" .++#++#++##++++$%$%. ", +" .++#+++#+#+++++++++. ", +" .++#+#+#+#+++++++++. ", +" .&&#&&#&&#&&&&&&&&&. ", +" .&&&&&&&&&&&&&&+&&&...... ", +" .&&********@****...#=--;>. ", +" .%%&%&%&%&%%%&..,'))-'!~{]. ", +" .%%%%%%%%%%%..'^//(_:<[}|12. ", +" .$$*******$.3/4]:5678~9[0a>. ", +" .$$$$$$$$$._~/'>->b[85c1[3'. ", +" .$$$$$d$$._((c9a/7efgfhg1>. ", +" .ddddddd.=h4i898hf||]jekh-. ", +" .........'{h|l9h|mn!aop!{{;. ", +" .}}q|c9l|mml]p,'3r(j. ", +" .sti|u9tu|q|lo^^!ok~). ", +" .77vv8[}blgqqc:86gr)w2.", +" .so^i:}xyychq|k{=wz/j2.", +" ...39bbbyx6i|/wwrgq4. ", +" .7tyyyytl4)4~g~^^. ", +" ..}xxyyb5gi~4:.. ", +" ..oyybfi5^.. ", +" ..[}{:.. ", +" .... ", +" ", +" "}; diff --git a/yawmppp/src/gtksetup/question.xpm b/yawmppp/src/gtksetup/question.xpm new file mode 100644 index 0000000..ec89ac4 --- /dev/null +++ b/yawmppp/src/gtksetup/question.xpm @@ -0,0 +1,100 @@ +/* XPM */ +static char * question_xpm[] = { +"64 64 33 1", +" c None", +". c #020204", +"+ c #41891C", +"@ c #1C4807", +"# c #256812", +"$ c #6BC22C", +"% c #889C80", +"& c #4EA624", +"* c #2D470C", +"= c #516D44", +"- c #618C40", +"; c #54B62A", +"> c #1E570D", +", c #337817", +"' c #0D3104", +") c #093704", +"! c #46981F", +"~ c #2F5713", +"{ c #BEC7BA", +"] c #E7EAE6", +"^ c #76B32C", +"/ c #AAB6A3", +"( c #AAC2A4", +"_ c #D1D9CE", +": c #497A2A", +"< c #FEFEFC", +"[ c #5E9A27", +"} c #62A927", +"| c #071E04", +"1 c #677A5C", +"2 c #65B82C", +"3 c #396819", +"4 c #203A05", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" .......... ", +" ...,,,333~>>@... ", +" ..+++-+::333#>>>@@.. ", +" ..!![[[[-++:,33#>>@@@).. ", +" .![&[[[[[-+:::33#~>>@@@4). ", +" .[&}}}}}[[[-+,,33##~~~@*444. ", +" .&}};;;}}}[++:33#~~~~~~*@444). ", +" .[}};;;&&[-+:,33~~>*>~~~~**444). ", +" .&&}^2;;;&+:333~**4444***~*@4444'. ", +" .!}}22;;;&+:3==-%%%1**44*****44'4)'. ", +" .[}}^2$2&[3~%{_{/_<<<_%*4****4444''. ", +" .!}}}^$$2}:3/]<1~*=/<<<<{~4***444'4''. ", +" .[[^^^$$^[:{<<<1*~>*<<<<<_*44*44'4'''. ", +" .+[[}^^$22--<<<<_~>*@{<<<<<%4**444|4'4'. ", +" .+[[^}^$$}[%<<<<<:#>@/<<<<@/<<<<){<<<<<=4**4444|4'4'. ", +" .,+[[[&;;;;2&![}!,,#>@<<<<%<<<<{****444444444). ", +" .,+++!!&&;;;;2;&!!,#3]<<]%~@>@**444444444. ", +" .#,++!!!&&&;;2}&&+,>%<*@4'4444444'. ", +" .#,,++!!!&&&};;&!+,,<]1@>>>~>@*4'44444444. ", +" .##,,++!+!!!&&&&!+#%_,>>~>~~~@@44444444'4. ", +" .>##,,+++!!!!!!!!,#(%>>#>#>>**4'4444444'4. ", +" .>###,,++,+!!+!+,,#(#>>>~>~~@*44444444|4'. ", +" .>>###,,+,+,+++,,##:~>>#>~>@*@444444444''. ", +" .>>###,,,,,,,,,#>>@@@@>>@*@44@44444'|'|. ", +" .>>>######,,###>@=-1~4*@*@@444@4444'44'. ", +" .@@>>>#######>>@%]]<_=444444@4)44''|'|'. ", +" .@@@@>>>>>>>>@3<<<<<]')4444444''4'4''. ", +" .)@@@@@>@>>@@)=<<<<<]|'4)4))4)4''''|'. ", +" .)))@)@@@@@@)4_<<<<%|''44)4))'''''). ", +" .))))))))))))'4%{{1'|4')4)))))')'''. ", +" .)'')))))))'|||||||'''))))))))))). ", +" .)''''))'''''|||'|''''')')')))). ", +" .'''''''''''''''''''')))))')). ", +" .''''))''''''''''')'')))))'. ", +" .)''''))))''''''''))))))). ", +" ..')')'))''''''''')')).. ", +" ..)))')')''''))))).. ", +" ...))')''''''... ", +" .......... ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" "}; diff --git a/yawmppp/src/isprc.c b/yawmppp/src/isprc.c new file mode 100644 index 0000000..db1a6c4 --- /dev/null +++ b/yawmppp/src/isprc.c @@ -0,0 +1,175 @@ +/* + + YAWMPPP - PPP dock app/helper for WindowMaker + Copyright (C) 2000: + + Authors: Felipe Bergo (bergo@seul.org) + + contains code from the wmppp application by + Martijn Pieterse (pieterse@xs4all.nl) + Antoine Nulle (warp@xs4all.nl) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + */ + +#include +#include +#include +#include "isprc.h" + +int +GetISPInfo(char *rcname,struct YAWMPPP_ISP_INFO *wii,int max) +{ + FILE *f; + int num_isps; + char temp[512],work[512]; + char *q; + char *tokens=" :\n\t"; + char *tokens2="\n"; + + memset(&wii[0],0,sizeof(struct YAWMPPP_ISP_INFO)); + + f=fopen(rcname,"r"); + if (!f) return 0; + + num_isps=0; + + /* level 0 */ + while( fgets(temp,128,f) ) { + strcpy(work,temp); + q=work; + q=strtok(q,tokens); + if (!q) continue; + if (!strcmp(q,"ISP.BEGIN")) { + if (num_isps>=max) continue; + + /* enter ISP.BEGIN block */ + memset(&wii[num_isps],0,sizeof(struct YAWMPPP_ISP_INFO)); + + wii[num_isps].ppp.override=0; + wii[num_isps].ppp.noipdefault=1; + wii[num_isps].ppp.noauth=1; + wii[num_isps].ppp.passive=0; + wii[num_isps].ppp.defaultroute=1; + wii[num_isps].ppp.chap=AUTH_DONTCARE; + wii[num_isps].ppp.pap=AUTH_DONTCARE; + + while( fgets(temp,128,f) ) { + strcpy(work,temp); + q=work; + q=strtok(q,tokens); + + if (!strcmp(q,KEY_LONGNAME)) { + q=strtok(NULL,tokens2); + if (q) strncpy(wii[num_isps].LongName,q,128); + continue; + } + if (!strcmp(q,KEY_SHORTNAME)) { + q=strtok(NULL,tokens2); + if (q) strncpy(wii[num_isps].ShortName,q,16); + continue; + } + if (!strcmp(q,KEY_STARTACTION)) { + q=strtok(NULL,tokens2); + if (q) strncpy(wii[num_isps].StartAction,q,512); + continue; + } + if (!strcmp(q,KEY_STOPACTION)) { + q=strtok(NULL,tokens2); + if (q) strncpy(wii[num_isps].StopAction,q,512); + continue; + } + if (!strcmp(q,KEY_IFDOWNACTION)) { + q=strtok(NULL,tokens2); + if (q) strncpy(wii[num_isps].IfDownAction,q,512); + continue; + } + if (!strcmp(q,KEY_SPEEDACTION)) { + q=strtok(NULL,tokens2); + if (q) strncpy(wii[num_isps].SpeedAction,q,512); + continue; + } + if (!strcmp(q,KEY_PPPSTUFF)) { + q=strtok(NULL,tokens2); + if (q) strncpy(wii[num_isps].PPPLine,q,512); + continue; + } + if (!strcmp(q,KEY_CHATSTUFF)) { + q=strtok(NULL,tokens2); + if (q) strncpy(wii[num_isps].ChatFile,q,512); + continue; + } + if (!strcmp(q,KEY_USER)) { + q=strtok(NULL,tokens2); + if (q) strncpy(wii[num_isps].User,q,32); + continue; + } + if (!strcmp(q,KEY_PHONE)) { + q=strtok(NULL,tokens2); + if (q) strncpy(wii[num_isps].Phone,q,32); + continue; + } + /* ppp options per ISP */ + if (!strcmp(q,KEY_PPP_OVER)) { + q=strtok(NULL,tokens2); + if (q) wii[num_isps].ppp.override=atoi(q); + continue; + } + if (!strcmp(q,KEY_PPP_DEFAULTROUTE)) { + q=strtok(NULL,tokens2); + if (q) wii[num_isps].ppp.defaultroute=atoi(q); + continue; + } + if (!strcmp(q,KEY_PPP_PASSIVE)) { + q=strtok(NULL,tokens2); + if (q) wii[num_isps].ppp.passive=atoi(q); + continue; + } + if (!strcmp(q,KEY_PPP_NOAUTH)) { + q=strtok(NULL,tokens2); + if (q) wii[num_isps].ppp.noauth=atoi(q); + continue; + } + if (!strcmp(q,KEY_PPP_NOIPDEFAULT)) { + q=strtok(NULL,tokens2); + if (q) wii[num_isps].ppp.noipdefault=atoi(q); + continue; + } + if (!strcmp(q,KEY_PPP_CHAP)) { + q=strtok(NULL,tokens2); + if (q) wii[num_isps].ppp.chap=atoi(q); + continue; + } + if (!strcmp(q,KEY_PPP_PAP)) { + q=strtok(NULL,tokens2); + if (q) wii[num_isps].ppp.pap=atoi(q); + continue; + } + if (!strcmp(q,KEY_NOLOGIN)) { + q=strtok(NULL,tokens2); + if (q) wii[num_isps].nologin=atoi(q); + continue; + } + if (!strcmp(q,"ISP.END")) { + num_isps++; + break; + } + } + } + } + fclose(f); + return(num_isps); +} diff --git a/yawmppp/src/isprc.h b/yawmppp/src/isprc.h new file mode 100644 index 0000000..b08593a --- /dev/null +++ b/yawmppp/src/isprc.h @@ -0,0 +1,64 @@ + +#ifndef YAWMPPP_ISPRC_H +#define YAWMPPP_ISPRC_H + +#define KEY_LONGNAME "LongName" +#define KEY_SHORTNAME "ShortName" +#define KEY_STARTACTION "StartAction" +#define KEY_STOPACTION "StopAction" +#define KEY_SPEEDACTION "SpeedAction" +#define KEY_IFDOWNACTION "IfDownAction" +#define KEY_USER "User" +#define KEY_PHONE "Phone" + +#define KEY_PPP_OVER "PPPOptionsOverride" +#define KEY_PPP_DEFAULTROUTE "PPPDefaultRoute" +#define KEY_PPP_PASSIVE "PPPPassive" +#define KEY_PPP_NOAUTH "PPPNoAuth" +#define KEY_PPP_NOIPDEFAULT "PPPNoIPDefault" + +#define KEY_PPP_CHAP "PPPChap" +#define KEY_PPP_PAP "PPPPap" + +#define KEY_NOLOGIN "NoLogin" + +#define KEY_PPPSTUFF "PPPLine" +#define KEY_CHATSTUFF "ChatFile" + +#define AUTH_REQUIRE 0 +#define AUTH_REFUSE 1 +#define AUTH_DONTCARE 2 + +struct ISP_PPP { + int override; + int defaultroute; + int passive; + int noauth; + int noipdefault; + int chap; + int pap; + int usepeerdns; +}; + +struct YAWMPPP_ISP_INFO { + char LongName[128]; + char ShortName[16]; + char StartAction[512]; + char StopAction[512]; + char SpeedAction[512]; + char IfDownAction[512]; + char PPPLine[512]; + char ChatFile[512]; + char User[32]; + char Phone[32]; + + struct ISP_PPP ppp; + + int nologin; +}; + +int +GetISPInfo(char *rcname,struct YAWMPPP_ISP_INFO *wii,int max); + +#endif + diff --git a/yawmppp/src/list.c b/yawmppp/src/list.c new file mode 100644 index 0000000..f804b2c --- /dev/null +++ b/yawmppp/src/list.c @@ -0,0 +1,169 @@ +/* Generic single linked list to keep various information + Copyright (C) 1993, 1994 Free Software Foundation, Inc. + + +Author: Kresten Krab Thorup + +Many modifications by Alfredo K. Kojima + + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC 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 GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* As a special exception, if you link this library with files compiled with + GCC to produce an executable, this does not cause the resulting executable + to be covered by the GNU General Public License. This exception does not + however invalidate any other reasons why the executable file might be + covered by the GNU General Public License. */ + +#include "list.h" +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#include + +/* Return a cons cell produced from (head . tail) */ + +INLINE LinkedList* +list_cons(void* head, LinkedList* tail) +{ + LinkedList* cell; + + cell = (LinkedList*)malloc(sizeof(LinkedList)); + cell->head = head; + cell->tail = tail; + return cell; +} + +/* Return the length of a list, list_length(NULL) returns zero */ + +INLINE int +list_length(LinkedList* list) +{ + int i = 0; + while(list) + { + i += 1; + list = list->tail; + } + return i; +} + +/* Return the Nth element of LIST, where N count from zero. If N + larger than the list length, NULL is returned */ + +INLINE void* +list_nth(int index, LinkedList* list) +{ + while(index-- != 0) + { + if(list->tail) + list = list->tail; + else + return 0; + } + return list->head; +} + +/* Remove the element at the head by replacing it by its successor */ + +INLINE void +list_remove_head(LinkedList** list) +{ + if (!*list) return; + if ((*list)->tail) + { + LinkedList* tail = (*list)->tail; /* fetch next */ + *(*list) = *tail; /* copy next to list head */ + free(tail); /* free next */ + } + else /* only one element in list */ + { + free(*list); + (*list) = 0; + } +} + + +/* Remove the element with `car' set to ELEMENT */ +/* +INLINE void +list_remove_elem(LinkedList** list, void* elem) +{ + while (*list) + { + if ((*list)->head == elem) + list_remove_head(list); + *list = (*list ? (*list)->tail : NULL); + } +}*/ + +INLINE LinkedList * +list_remove_elem(LinkedList* list, void* elem) +{ + LinkedList *tmp; + + if (list) { + if (list->head == elem) { + tmp = list->tail; + free(list); + return tmp; + } + list->tail = list_remove_elem(list->tail, elem); + return list; + } + return NULL; +} + + +/* Return element that has ELEM as car */ + +INLINE LinkedList* +list_find(LinkedList* list, void* elem) +{ + while(list) + { + if (list->head == elem) + return list; + list = list->tail; + } + return NULL; +} + +/* Free list (backwards recursive) */ + +INLINE void +list_free(LinkedList* list) +{ + if(list) + { + list_free(list->tail); + free(list); + } +} + +/* Map FUNCTION over all elements in LIST */ + +INLINE void +list_mapcar(LinkedList* list, void(*function)(void*)) +{ + while(list) + { + (*function)(list->head); + list = list->tail; + } +} diff --git a/yawmppp/src/list.h b/yawmppp/src/list.h new file mode 100644 index 0000000..af0f22c --- /dev/null +++ b/yawmppp/src/list.h @@ -0,0 +1,59 @@ +/* Generic single linked list to keep various information + Copyright (C) 1993, 1994 Free Software Foundation, Inc. + +Author: Kresten Krab Thorup + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC 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 GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* As a special exception, if you link this library with files compiled with + GCC to produce an executable, this does not cause the resulting executable + to be covered by the GNU General Public License. This exception does not + however invalidate any other reasons why the executable file might be + covered by the GNU General Public License. */ + +#ifndef __LIST_H_ +#define __LIST_H_ + +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) +# define INLINE inline +#else +# define INLINE +#endif + +typedef struct LinkedList { + void *head; + struct LinkedList *tail; +} LinkedList; + +INLINE LinkedList* list_cons(void* head, LinkedList* tail); + +INLINE int list_length(LinkedList* list); + +INLINE void* list_nth(int index, LinkedList* list); + +INLINE void list_remove_head(LinkedList** list); + +INLINE LinkedList *list_remove_elem(LinkedList* list, void* elem); + +INLINE void list_mapcar(LinkedList* list, void(*function)(void*)); + +INLINE LinkedList*list_find(LinkedList* list, void* elem); + +INLINE void list_free(LinkedList* list); + +#endif diff --git a/yawmppp/src/misc.c b/yawmppp/src/misc.c new file mode 100644 index 0000000..34281e2 --- /dev/null +++ b/yawmppp/src/misc.c @@ -0,0 +1,164 @@ +/* dock.c- built-in Dock module for WindowMaker + * + * WindowMaker window manager + * + * Copyright (c) 1997 Alfredo K. Kojima + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include "list.h" +#include "misc.h" + +/* + *---------------------------------------------------------------------- + * parse_command-- + * Divides a command line into a argv/argc pair. + *---------------------------------------------------------------------- + */ +#define PRC_ALPHA 0 +#define PRC_BLANK 1 +#define PRC_ESCAPE 2 +#define PRC_DQUOTE 3 +#define PRC_EOS 4 +#define PRC_SQUOTE 5 + +typedef struct { + short nstate; + short output; +} DFA; + + +static DFA mtable[9][6] = { + {{3,1},{0,0},{4,0},{1,0},{8,0},{6,0}}, + {{1,1},{1,1},{2,0},{3,0},{5,0},{1,1}}, + {{1,1},{1,1},{1,1},{1,1},{5,0},{1,1}}, + {{3,1},{5,0},{4,0},{1,0},{5,0},{6,0}}, + {{3,1},{3,1},{3,1},{3,1},{5,0},{3,1}}, + {{-1,-1},{0,0},{0,0},{0,0},{0,0},{0,0}}, /* final state */ + {{6,1},{6,1},{7,0},{6,1},{5,0},{3,0}}, + {{6,1},{6,1},{6,1},{6,1},{5,0},{6,1}}, + {{-1,-1},{0,0},{0,0},{0,0},{0,0},{0,0}}, /* final state */ +}; + +char* +next_token(char *word, char **next) +{ + char *ptr; + char *ret, *t; + int state, ctype; + + t = ret = malloc(strlen(word)+1); + ptr = word; + + state = 0; + *t = 0; + while (1) { + if (*ptr==0) + ctype = PRC_EOS; + else if (*ptr=='\\') + ctype = PRC_ESCAPE; + else if (*ptr=='"') + ctype = PRC_DQUOTE; + else if (*ptr=='\'') + ctype = PRC_SQUOTE; + else if (*ptr==' ' || *ptr=='\t') + ctype = PRC_BLANK; + else + ctype = PRC_ALPHA; + + if (mtable[state][ctype].output) { + *t = *ptr; t++; + *t = 0; + } + state = mtable[state][ctype].nstate; + ptr++; + if (mtable[state][0].output<0) { + break; + } + } + + if (*ret==0) + t = NULL; + else + t = strdup(ret); + + free(ret); + + if (ctype==PRC_EOS) + *next = NULL; + else + *next = ptr; + + return t; +} + + +extern void +parse_command(char *command, char ***argv, int *argc) +{ + LinkedList *list = NULL; + char *token, *line; + int count, i; + + line = command; + do { + token = next_token(line, &line); + if (token) { + list = list_cons(token, list); + } + } while (token!=NULL && line!=NULL); + + count = list_length(list); + *argv = malloc(sizeof(char*)*count); + i = count; + while (list!=NULL) { + (*argv)[--i] = list->head; + list_remove_head(&list); + } + *argc = count; +} + +extern pid_t +execCommand(char *command) +{ + pid_t pid; + char **argv; + int argc; + + parse_command(command, &argv, &argc); + + if (argv==NULL) { + return 0; + } + + if ((pid=fork())==0) { + char **args; + int i; + + args = malloc(sizeof(char*)*(argc+1)); + if (!args) + exit(10); + for (i=0; i + +extern void parse_command(char *, char ***, int *); + +extern pid_t execCommand(char *); +#endif /* __MISC_H */ diff --git a/yawmppp/src/stepphone.xpm b/yawmppp/src/stepphone.xpm new file mode 100644 index 0000000..61d217c --- /dev/null +++ b/yawmppp/src/stepphone.xpm @@ -0,0 +1,115 @@ +/* XPM */ +static char * stepphone_xpm[] = { +"48 48 64 1", +" c None", +". c #020202", +"+ c #E6E6E6", +"@ c #9A9A9A", +"# c #5E5E5E", +"$ c #424242", +"% c #363636", +"& c #222222", +"* c #B2B2B2", +"= c #8A8A8A", +"- c #1A1A1A", +"; c #EAEAEA", +"> c #EEEEEE", +", c #161616", +"' c #D2D2D2", +") c #767676", +"! c #525252", +"~ c #F2F2F2", +"{ c #0E0E0E", +"] c #F6F6F6", +"^ c #6E6E6E", +"/ c #BABABA", +"( c #FAFAFA", +"_ c #4E4E4E", +": c #BEBEBE", +"< c #9E9E9E", +"[ c #262626", +"} c #0A0A0A", +"| c #626262", +"1 c #969696", +"2 c #3A3A3A", +"3 c #DEDEDE", +"4 c #A2A2A2", +"5 c #7E7E7E", +"6 c #C2C2C2", +"7 c #4A4A4A", +"8 c #2A2A2A", +"9 c #5A5A5A", +"0 c #060606", +"a c #FEFEFE", +"b c #CACACA", +"c c #A6A6A6", +"d c #464646", +"e c #323232", +"f c #929292", +"g c #666666", +"h c #D6D6D6", +"i c #1E1E1E", +"j c #AEAEAE", +"k c #565656", +"l c #6A6A6A", +"m c #121212", +"n c #727272", +"o c #8E8E8E", +"p c #2E2E2E", +"q c #AAAAAA", +"r c #C6C6C6", +"s c #DADADA", +"t c #7A7A7A", +"u c #828282", +"v c #3E3E3E", +"w c #CECECE", +"x c #E2E2E2", +"y c #B6B6B6", +" ", +" .......... ", +" ................ ", +" .................... ", +" ........................ ", +" ............................ ", +" .............................. ", +" ................0}}{{}00........ ", +" ..............}{m&8peee[i;](aaaaaa ", +" ............0{,ip$_#^n)^|7b3>(aaaaaa ", +" ...........}m&8v!g51qy//*cof*';]aaaaaa ", +" .........},&2_lu@*6h2vdvv2b_)(_0%^ch~aaaaa ", +" ......0,p_n1/wvv]]]aaa]$dk5];$k.$5/+(aaaaa ", +" .....}-%#=*wv2~~;aa~~a2aak)n~v$l.#cs]aaaaa ", +" .....0-%|16v2(]+a(+;>]$t~(dqu5!9..!1h]aaaaaa ", +" ....}-%g]($m$d.k])d)]a$~~x;]^a(]+l.}8gch~aaaaaaa ", +" ...{[94%aa~>(>xndf~]~~+]5aa%n](_^.i_=:+]aaaaaa ", +" ...{p^yvoaaa>>>=$(]++;na(d5()aad_n.p#1r+]aaaaa ", +" ...{en:%=n5;>+~5d]~3;;xd=~oaa%n__kg0%|aaa ", +" ...}&94v55o~97!0-[i,m,9!7$7d$d$l^^^9$n.$=w>aaa ", +" ..0-d5/%jo)##00&m,,-ii#9$p!9^nll!v$!n.dob~(a ", +" ..0{8k=:22d.00-m,im,-&-!d_#|^l#_d_7!t._1']aa ", +" ...0,ekuc6h.0,,i,---,i-mk9gg_$_d7kd9.}^j3]aa ", +" ...0,8d|5<$p00m---i---mmg7kd$_!$!..%#fr+(a ", +" ....0{ipvk=gd8.0&-iim--m!!$$k$|..8dl163~(a ", +" .....0m-&6c=gdp00&mim,,$_!kg..pdgojbx]aa ", +" .......0{;srq=gd8.0m-,,9!_..pdg=j6s;](aa ", +" ........a~;srq=gdp..m,^0.pdg=c6s;~aaaa ", +" ........aaa~;src=g7e..0p7g=c6s;]aaaaaa ", +" .......aaaa(~;srqon#k|n=qrs;](aaaaaa ", +" ......aaaaaaa~;3b*cx3h3x;](aaaaaaaa ", +" aaaaaaaaaaaaaaa(]]](aaaaaaaaaa ", +" aaaaaaaaaaaaaaaaaaaaaaaaaaaa ", +" aaaaaaaaaaaaaaaaaaaaaaaa ", +" aaaaaaaaaaaaaaaaaaaa ", +" aaaaaaaaaaaaaaaa ", +" aaaaaaaaaa ", +" "}; diff --git a/yawmppp/src/thinppp/Makefile.in b/yawmppp/src/thinppp/Makefile.in new file mode 100644 index 0000000..2e51c55 --- /dev/null +++ b/yawmppp/src/thinppp/Makefile.in @@ -0,0 +1,36 @@ +# +# thinppp: non-docked PPP applet +# + +CC = @CC@ +CFLAGS = -Wall -O2 +GTKLIB = @GTK_LIBS@ +GTKFLAG = @GTK_FLAGS@ +RLFLAG = -DVERSION=\"@MK_YAWMPPP_RELEASE@\" -DIPREFIX=\"@prefix@\" -D@SYSDEF@ +PROGINST = @INSTALL@ + +ALLDOTOS = thinppp.o +ALLDOTHS = thinppp.h ../isprc.h ../misc.h ../list.h ../ycommon.h +EOBJS = ../isprc.o ../ycommon.o ../misc.o ../list.o + +all: build_thinppp + +build_thinppp: $(ALLDOTOS) + $(CC) $(ALLDOTOS) $(EOBJS) -o yawmppp.thin $(GTKLIB) + +$(ALLDOTOS): %.o : %.c $(ALLDOTHS) + $(CC) $(CFLAGS) $(RLFLAG) $(GTKFLAG) -I.. -c $< -o $@ + +install: + $(PROGINST) -m 0755 yawmppp.thin @prefix@/bin/yawmppp.thin + +install-strip: + $(PROGINST) -s -m 0755 yawmppp.thin @prefix@/bin/yawmppp.thin + + +clean: + rm -f $(ALLDOTOS) yawmppp.thin + +distclean: + rm -f Makefile *~ + diff --git a/yawmppp/src/thinppp/backxpm.xpm b/yawmppp/src/thinppp/backxpm.xpm new file mode 100644 index 0000000..bbf49ab --- /dev/null +++ b/yawmppp/src/thinppp/backxpm.xpm @@ -0,0 +1,96 @@ +/* XPM */ +static char * backxpm_xpm[] = { +"320 20 73 1", +" c None", +". c #020204", +"+ c #C6C6C4", +"@ c #CACACC", +"# c #ACAAAC", +"$ c #8E8E8C", +"% c #B6B6B4", +"& c #CECECC", +"* c #BBBBBC", +"= c #424244", +"- c #1E1E1C", +"; c #2D2E2C", +"> c #B2B2B4", +", c #D2D2D4", +"' c #4C4C4C", +") c #121214", +"! c #848288", +"~ c #969694", +"{ c #5E5E5C", +"] c #727274", +"^ c #3A3A3C", +"/ c #262624", +"( c #3E3E3C", +"_ c #9A9A9C", +": c #2A2A2C", +"< c #565654", +"[ c #363634", +"} c #666664", +"| c #626264", +"1 c #868684", +"2 c #767674", +"3 c #6A6A6C", +"4 c #212624", +"5 c #222224", +"6 c #F6F2FC", +"7 c #E2E2E4", +"8 c #C6C2C4", +"9 c #283C38", +"0 c #222B2B", +"a c #A2A2A4", +"b c #263430", +"c c #929294", +"d c #8A8A8C", +"e c #7C7C7C", +"f c #464644", +"g c #323234", +"h c #2A3E3C", +"i c #263A34", +"j c #525254", +"k c #FEFEFC", +"l c #766264", +"m c #945C5C", +"n c #7A3E3C", +"o c #8B5254", +"p c #7A5354", +"q c #854A4C", +"r c #826E6C", +"s c #8E7E7C", +"t c #8E5654", +"u c #926E6C", +"v c #8E6664", +"w c #9F2B2C", +"x c #AE0204", +"y c #A41C1C", +"z c #964A4C", +"A c #A80E0C", +"B c #8A7674", +"C c #9A3A3C", +"D c #9A2224", +"E c #924244", +"F c #7E5A5C", +"G c #725E5C", +"H c #922E2C", +"................................................................................................................................................................................................................................................................................................................................", +".++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++@#.++++$+++++++$%@##.", +".&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@&#.@@*=-*&&&&&*-;*%>.", +".,,#''##)!#~.{##.##.##.#.!###)]])^^/#^/^/{#.^^/!#############################################################################################################################################################################################;;;;;#########################;################################(.@_:--<#####[--:}].", +".,,#_._|:##''/##/11.11/#./##|.]2^##^]^]##.#.##2^####..........................##.............................##..........................##...................................................................................###############>;;;#########################;::###..........................##^.+#;--:####{---322.", +".,,##'')!##)~41#']'[']'#.'1#/^3]5]])~[']{5#.]]^{####.66666666666!66666666666!7##.---------------------------7##.66666666666!66666666666!8##.-----------------------------9999999999999999999999999---------------------------7######|45503###a#;a###|45503#######|45503##;;;;b##.66666666666!66666666666!8##^.@#c---3##d---2#]].", +".&&_a$.5aae4a%]]]]3]3]3]3]3]3]3]]]]xq]]]xq2]]xq]qx]]x]]FAxq]3]].6#####.####.6####.#####.7]].-----------------------5--57]].6#..#######.6#..###..##.8]].-----------------------------9999999999999999999999999------------------------55-7]]]]]j4----'a3]]]]]]]j4--5-'a]]]]]j4---5'a3]3]23]].6###.$j.###.6#.k....k.#.8]]^.@23}4=]]}5-j3]]''.", +".#>333333333333333333333Dp333Dp333Dp3pD33D333GHp3333.6##########.6##########.733.5555555555555555555555-55-5733.6##########.6##########.833.55555555555555555555555555555999999999999999999999999955555555555555555555555--5-7}33333{{31a~3333333333{{3!a~3333333{{3!__333333333.6###.$j.###.6#.kkkkkk.#.833^.+335[3333'--{33'f.", +".>#}}|}}}}}}}}}|}|}|||||||||||||||}|||||||||||}|}|||.!...........s...........7||.7777777777777777777777777777||.!...........!...........8||.7777777777777777777777777777777777777777777777777777777777777777777777777777777777}||}||}||||}}}}|}||}||}||||}||||}||}|||}}}}}}|}|||.!...........!...........8||^.@}[g|}||}}'-/|}==.", +".#a{{<{<{<{<{<{<{<{{<{{{<{{{{<{{{<{{{<{{{<{{<{{<{{{{77777777777777777777777777<{{<{<<{<<{<<{<<{<<{<<{<{<{{{<{{{888888888888888888888888+8{<{{<<{<<{<<{<<{<<{<<{<<{<<{<<{<<{<<{<<{<<{<<{<<{<<{<<{<<{<<{<<{<<{<<{<<{<<{<<{{{{{{<{{<{{<{<{{<{<{{<{{<{{<{<{{<{{<{<{{<{{{<{<{<{<{{{{{888888888888888888888888+8<{^.@<'j<{{{{<{[(j<=(.", +"._~^^(^(^(^(^(((((^^(^^^(^^^^(^[^(^[^(^^^(^^(^^(^^[^^^^^^^^(^^^^(^^^^^^^^^^^^^([^(^((^((^((^((^((^((^(^(^^^(^[^^^^^^(^(^^^^^^^^^^^^^^^^^^^([^((^((^((^((^((^((^((^((^((^((^((^((^((^((^((^((^((^((^((^((^((^((^((^((^((^^^[^^(^^(^^(^(^^(^h^^(^^(^^(^(^^h^^(((^^(^^^(^(^(^(^^^[^^^^^^^^^^^^^^^^^^^^^^^^^^((^^.#^^^(^[[^(^^^((^^.", +"._~^^^^[^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^(^[^^[^^^^^^^^^^^^^^[^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^.>^^^^^^^^^^^^^^^^.", +"................................................................................................................................................................................................................................................................................................................................"}; diff --git a/yawmppp/src/thinppp/dataxpm.xpm b/yawmppp/src/thinppp/dataxpm.xpm new file mode 100644 index 0000000..a5de88c --- /dev/null +++ b/yawmppp/src/thinppp/dataxpm.xpm @@ -0,0 +1,260 @@ +/* XPM */ +static char * dataxpm_xpm[] = { +"64 192 65 1", +" c None", +". c #020204", +"+ c #1E861C", +"@ c #968428", +"# c #424244", +"$ c #CAC214", +"% c #9A4A4C", +"& c #760A0C", +"* c #EE8284", +"= c #12763B", +"- c #B2A224", +"; c #DEE20C", +"> c #222224", +", c #0AD10C", +"' c #273634", +") c #C4C4C4", +"! c #969697", +"~ c #545453", +"{ c #686869", +"] c #8A2624", +"^ c #D3D3D4", +"/ c #12AA14", +"( c #ADAAAC", +"_ c #72E274", +": c #89878B", +"< c #967A34", +"[ c #E7E7E8", +"} c #06EA04", +"| c #624E34", +"1 c #747473", +"2 c #272B2C", +"3 c #39393A", +"4 c #B8B8B9", +"5 c #121210", +"6 c #E67674", +"7 c #CA4644", +"8 c #4AC24C", +"9 c #A20204", +"0 c #BC2C2A", +"a c #07DE04", +"b c #1E5E1C", +"c c #FEA2A4", +"d c #F8F4FC", +"e c #F6FE04", +"f c #B11B1A", +"g c #82623C", +"h c #C63A3C", +"i c #C2BA1C", +"j c #1ADE6C", +"k c #159618", +"l c #2A7E24", +"m c #D65A5C", +"n c #0FBB0C", +"o c #02FE04", +"p c #7E7E7C", +"q c #5E5E5C", +"r c #821A1C", +"s c #D6D214", +"t c #6E5E34", +"u c #7A663C", +"v c #A28E2C", +"w c #DCDCDA", +"x c #1E1E1C", +"y c #2A3E3C", +"z c #CBCBCC", +" ", +" !(q>xx>{!( !(q>xx>{!( !(q>xx>{!( !(q>xx>{!( ", +" (~=nn,,k{( (~tv-i$@{( (~r07mm%{( (~>x>22>{! ", +" ~=/n,a}ak{ ~|<-is;s@{ ~&fhm6*6%{ q>x>22''21 ", +" >k/na}o},~ >g@-i;e;i~ >9f7m*c*m~ xx>>2'y'2~ ", +" xk/n,}}},{ xg<-is;si{ >9fhm6*6m{ xxxx2''22{ ", +" xk/nn,,,np xgx>x>222>p ", +" >+k/nnnnn( >gg>xxxx>>x( ", +" ~b+k////+! ~|gg<<@>xxxx~: ", +" {~b+kkkl(1 1~|ugggt!1 1~&9999r(1 1~>xx>x~!1 ", +" {{q~{:(:{{ {{qq{:(({{ {{qq{p(!{{ {{qq{p(!{{ ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +"{1{1~{1{1{1{~{1:!)))):))))))):4z(( ", +"11{>5{1p1p1{5x{!!zz4#>4zzzzz4>2444 ", +"1!2x>~(((((3xx>[[z!2x>q(((((3xx2q{ ", +"1('xx2((((qxxx{[[)('xx2((((qxxx{1p ", +"1(!xxx{((:xxxp([[z(!xxx{((:xxxp(1{ ", +"1(!qxx'!(2x51!([[)(!qx>2((2x51!({{ ", +"1!!!3xxq#xx1!!![[z!!!3>xq#xx1!!!1{ ", +"1!!!p>x2x>:!!!![wz!!!p>x2x>:!!!!{q ", +"1::!:{xx>p:::::wwz::!:{xx2p:::!:qq ", +"1:::::'x>{:::::[^zp:::p'xx{:::::q~ ", +"1ppppqx2x2p:p1pwwzppppqx2x2ppp1p~~ ", +"11p1qxq{>x3ppp1^zz1p1{x~{>x3ppp1~~ ", +"11{{>#11{>x~{11^zz1{{>#11{>x~{11## ", +"1{{>3{{{{#xxq{{^z){{>3{{{{#xxq{{~# ", +"1{3'q{{q{{#>>q{zzz{3'q{{{{{~x2q{## ", +"1~|~~qqqq~q3#~~z)zq#~qqqqq~q'#~~## ", +"q))))))4)z4))))))(333#3'333333##33 ", +"{))4))))))))))))4433333333#3333333 ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +"...........p...........pdddddddddddpdddddddddddp ", +".(((.((.(((d.((((((((((dd(((.((.(((.d((((((((((. ", +".((..((..((d.(........(dd((..((..((.d(........(. ", +".(.:.((.~.(d.(.dddddd.([d(.:.((.~.(.d(.dddddd.(. ", +".(.:.((.~.(d.(.d5..5d.(dd(.:.((.~.(.d(.d5..5d.(. ", +".(.!:..:~.(d.4.dddddd.(dd(.!:..:~.(.d(.dddddd.(. ", +".((.:!:q.((d.(.d5..5d.(dd((.:!:q.((.d(.d5..5d.(. ", +".(((.:~.(((d.4.dddddd.(dd(((.:~.(((.d4.dddddd.(. ", +".(((.!~.(((d.(.d5..5d.(dd(((.!~.(((.d(.d5..5d.(. ", +".(((.:~.(((d.4.dddddd.(dd(((.:~.(((.d4.dddddd.(. ", +":dddddddddddpdddddddddd[:...........p...5..5.... ", +" ", +"...........:...........:dddddddddddpdddddddddddp ", +".((((((((((d.((((((((((dd((((((((((.d((((((((((. ", +".((((((..((d.(..(((..(([d((((((..((.d(..(((..((. ", +".(((((...((d.(...(...((dd(((((...((.d(...(...((. ", +".(..(...(((d.((.....(((dd(..(...(((.d((.....(((. ", +".(.....((((d.(((...(((([d(.....((((.d(((...((((. ", +".(....(((((d.((.....(((dd(....(((((.d((.....(((. ", +".(...((((((d.(...(...((dd(...((((((.d(...(...((. ", +".(..(((((((d.(..(((..((dd(..(((((((.d(..(((..((. ", +".((((((((((d.((((((((((dd((((((((((.d((((((((((. ", +":ddddddddddd:dddddddddd[p...........p........... ", +" ", +"...........p...........:dddddddddddpdddddddddddp ", +".((((((((((d.(((((((((([d((((((((((.d((((((((((. ", +".(((((.((((d.((((.(((((dd(((((.((((.d((((.(((((. ", +".((((..((((d.((((..((((dd((((..((((.d((((..((((. ", +".(((...((((d.((((...(((dd(((...((((.d((((...(((. ", +".((....((((d.((((....(([d((....((((.d((((....((. ", +".(((...((((d.((((...(((dd(((...((((.d((((...(((. ", +".((((..((((d.((((..((((dd((((..((((.d((((..((((. ", +".(((((.((((d.((((.(((((dd(((((.((((.d((((.(((((. ", +".((((((((((d.((((((((((dd((((((((((.d((((((((((. ", +":dddddddddddpdddddddddddp...........p........... _'8k_ ", +"xxxxxx>x>x>xxxxxxxx>xxx>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", +"yyy8x8__8x8__8>83y8>8__8>8__8>8__8>8__8>8__8>8__8>yyyy>yyyy>yyyy", +"yx>_x3>>_>3>x_>_x>_>_>>yx_>>yxy>>_>_>>_x_>>_x_>>_xyxxyxyxxyxyxxy", +"yxx_xyxx_>y>>_>_x>_>_x>3>_xxyxyx>_>_x>_>_x>_>_x>_x_xx_x_xx_xyxxy", +"3yy8x8__8x8__8>8__8x8__8>8__8>yyy8>8__8>8__8x8yy8>_y_y>____xyyyy", +"yx>_x_x>yx'>x_xyx>_x3x>_x_x>_xyxx_x_x>_xyxx_>_xx_x__xy>_>>_xyxxy", +"y>x_>_xxyxy>x_xyxx_xy>x_>_>x_xyxx_>_xx_xyx>_x_x>_x_x_'x_>x_xyxxy", +"yyy_x8__8x8__8xyyy8>8__8x8__8xyyy8x8__8>8__8x8__8>_yy_>_yy_xyyyy", +"xxx>>>x>x>x>>x>xx>xxx>x>x>xx>xxxx>>>x>xx>>x>>x>x>xxxxxxxx>>>xxxx", +">x>xx>x>x>x>x>x>x>x>xx>x>x>xx>x>xx>x>x>>x>x>x>x>x>x>>>x>xxx>xx>>", +"8__8>8__8>8__8x8__8>8__8>x>xyyyyxyyyyxyyyy>x>x>xyyyy>x>x>>>x>>xx", +"_>xyx_>>_x_>>_>_>x_>_>>_x>x>yxxyxyxxyxyxxyx>x>xxyxxy>x>xxx>xx>>>", +"_>xy>_x>_>_x>_>_>>_>_>x_>xxx'>xyxy>xyxyxxyxy>xyxyxx'>x>>>>x>>xxx", +"8__yx8__>x8__>x8yy8x8__>x>x>3yyyxyyyyxyyyyxyxyxxyyyyx>xxx>xx>>>>", +"_>xy>_x>_>_x>_>_xx_>_x>_x>xxyxxyxyxxyxyxxyxyy>xxyxxy>x>>>x>>xxxx", +"_x>yx_>x_>_>x_>_>x_>_>x_>x>>yxxyxyxxyxyxxyxyxyxxyxxyxxxx>xx>>>>>", +"8__8>8yy8>8yy8>8__8>8yy8>x>xyyyyxyyyyxyyyyxyxxyxyy''>>>>x>>xxxxx", +">x>>x>xx>x>x>x>x>>x>x>x>x>xxxxxxxxxxxxxxxx>x>x>xx>x>xxx>xx>>>>>>", +"xxyyyx>xyyyx>x>x>xyyyx>xyyyx>xx>x>xx>x>x>x>x>xx>x>x>>>>x>>xxxxxx", +">yxx>yxyxx>yx>yx>yxx>yxyxx>yx>>xx>x>x>x>x>x>x>>x>x>xxx>xx>>>>>>>", +"xy>xxyxy>xxyxxyxxy>xxyxy>xxyxx>x>x>x>x>x>x>x>x>x>>x>>>x>>xxxxxxx", +"xxyyyxxxyyyx>xx>xxyyyxxxyyyx>x>x>x>x>x>x>x>x>x>x>x>xx>xx>>>>>>>>", +"xyxxxyxyxxxyx>x>xyxxxyxyxxxy>x>x>x>x>x>x>x>x>x>>x>x>>x>>xxxxxxxx", +">yx>>yxyx>>yx>yxxyx>xyxyx>xyx>x>x>x>x>x>x>x>xx>xx>xx>xx>>>>>>>>>", +"xxyyyx>xyyyxxxyx>xyyyx>xyyyx>x>x>x>x>x>x>x>x>x>>x>>>x>>xxxxxxxxx", +">xxxx>xxxx>x>>x>xxxx>x>xxxx>x>x>x>x>x>x>x>x>x>xx>xx>xx>>>>>>>>>>", +"x>x>x>x>x>x>x>x>x>>x>xx>>x>x>x>x>x>x>x>x>x>x>x>>x>>x>>xxxxxxxxxx", +">x>x>x>x>x>x>x>x>xx>x>>xx>x>x>x>x>x>x>x>x>x>x>xx>x>xx>>>>>>>>>>>", +" ", +" ", +"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ", +">y__y>___y>y__y>___y>____>____>y__y>_yy_>y_yy>yyy_>_yy_>_yyyx ", +"x_>>_x_>>_x_>>_x_>>_>_>>yx_>>yx_>>yx_xx_xy_xyxyxx_x_xx_x_xxy> ", +"x_x>_>_xx_x_x>y>_xx_>_xxy>_x>y>_xxy>_>>_xy_xyxyx>_>_>_y>_xxyx ", +">____x___y>_y''x_yy_x___'x___'x_y__>____x'_yyxyyy_>__''>_yyyx ", +">_xx_>_x>_x_>x'>_xx_x_x>yx_xxyx_xx_x_xx_xy_xyxyxx_x_>_'x_xxyx ", +">_x>_>_xx_x_xx_x_x>_>_x>y>_>xyx_>x_>_x>_xy_xyx_xx_>_xx_>_>xyx ", +">_yy_x___y>y__y>___yx____x_yyyxy__yx_yy_xy_''xy__yx_yy_x____x ", +"x>xx>>>xx>xx>>>x>x>x>>xx>>xxxxxx>x>x>xx>xxxx>x>xx>x>x>x>x>x>> ", +">_yy_>_yy_>y__yx___yxy__yx___y>y__yxy___>_y'_x_yy_>_yy_x_yy_x ", +"x____>__x_x_x>_>_>x_>_x>_>_x>_x_x>_xy>_y>_>x_>_>x_x_>x_x_xx_> ", +">_x>_x_>__>_>x_>_>x_>_>x_>_>x_>_>xyxyx_yx_>>_x_>x_>_>x_>y__'x ", +"x_yy_>_yy_>_yy_>___y>_yy_>___yxy__yxyy_y>_yy_>_yy_>_yy_x'__yx ", +">_x>_x_>x_x_>x_>_>xyx_x>_x_>_yxyx>_xyx_yx_xx_>_x>_x____>y__yx ", +"x_x>_>_>>_>_x>_>_>xy>_>_y>_>x_>_x>_xyx_yx_>>_xy__y>____x_xx_> ", +">_yy_x_yy_xy__yx_yyyxy_y_x_yy_xy__yxyy_yx____>y__yx_yy_>_yy_x ", +"xx>xx>x>xx>x>x>>xxxxx>xx>>x>x>x>x>x>xx>xx>>x>xx>x>x>>x>>xxxx> ", +">_yy_x____>yyyyxyyyyxyyyyxyyyyxyyyyxyyyyxyyyyxyyyyxyyyyxyyyyx ", +"x_y>_xy>>_xyxxyxyxxyxyxxyxyxxyxyxxyxyxxyxyxxyxyxxyxyxxyxy>xyx ", +">_yy_>yx_yxyxxyxyxxyxyxxyxyxxyxyxxyxyxxyxyxxyxyxxyxyxxyx'xxyx ", +"xy__yxy_yyxyyyyxyyyyxyyyyxyyyyxyyyyxyyyyxyyyyxyyyyxyyyy>yyyy> ", +"xyx_yxy_xyxyxxyxyxxyxyxxyxyxxyxyxxyxyxxyxyxxyxyxxyxyxxyxyxxyx ", +"x'>_yx_xxyxyxxyxyxxyxyxxyxyxxyxyxxyxyxxyxyxxyxyxxyxyxxy>'>xyx ", +">y_yyx____xyyyyxyyyyxyyyyxyyyyxyyyyxyyyyxyyyyxyyyyxyy''xyy''x ", +"x>xxx>>>x>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>xxx>>> ", +">y__yx_yyyxyyyyxyyy_>____>y__yxy__yx_yyyxyyyyxyyy_>yyyyx_yyyx ", +"x_x>_>_xxyxyxxyxyxx_>_>xyx_x>_x_>xy>_xxyxy_xyxyxx_x_x>_x_xxyx ", +">_>x_>_>xyxy__yxyx>_x_>xyx_>xy>_x>yx_>xyxyyxyxyx>_>_x_yx_xxyx ", +"x____x___yx_yy_xy___x___y>__yy>_y__>___yxy_yyxyyy_>__yyx_yyy> ", +">_>>_>_>x_>_xxy>_>>_>_>xyx_xxyx_x>_>_>x_xy_xyxyxx_>_x_yx_xxyx ", +"x_>x_x_x>_x_x>_x_>x_x_>xy>_>xy>_>x_x_>x_xy_xyx_>>_>_x>_x_>xyx ", +">_yy_>___y>y__yxy___2____x_yyyxy__y>_yy_xy_yyxy__yx_yy_>'__'x ", +">xxx>>>x>xx>x>x>>x>xx>x>>x>xxxx>x>x>xxx>xx>xxxx>x>x>x>x>>x>>x ", +">_yy_xyyyyxyyyyx___yxy__yxyyyyxy__yxyyyyxyyyyx_yy_>_yy_x_yy_x ", +"x____xyyxyxyxxy>_>x_>_x>_xyxxy>_x>_xyx_yxyxxy>_xx_>_xx_>_xx_> ", +">_>x_xyxyyxyxxyx_>>_x_>x_>yxxyx_>xyxyx_yxyxxyx_>>_x_>>_xy__yx ", +"x_yy_x_y__xy__y>___y>_yy_x_y_y>y__yxy___x_yy_>_yy_>_yy_xy__yx ", +">_x>_x__x_>_>x_x_>xyx_x>_>__y_xyx>_>yx_y>_xx_x_x>_x____xy__yx ", +">_x>_x_>>_x_x>_>_>xy>_x_yx_xxyx_>x_xy>_yx_>>_xy__y>____x_x>_> ", +"x_yy_>_yy_>y__yx_yyyxy_y_>_yyyxy__yxyy_yxy__y>y__yx_yy_>_y'_x ", +">>xx>x>xxx>x>x>x>xxx>x>x>x>xxxx>x>>xxx>xx>>xx>xx>x>>x>>x>xx>> ", +"x_yy_>yyyyx8__8>yyy8x8__8>8__8>8yy8>8__8>8__8>8__8>8__8>8__8x ", +">_yx_xyxxy>_>>_xyx__xy>>_xy>>_x_xx_x_x>yx_>xyxy>>_x_x>_>_x>_> ", +"x_yy_x____>_x>_xyx>_>yxx_>yxx_>_>>_>_>xy>_>>yxyxx_>_>x_>_xx_x ", +"xy__yxyyy_>8yy8xyyy8>8__8>8__8x8__8x8__8x8__8xyyy8>8__8>8__8> ", +">yx_yxy__yx_x>_xyxx_>_>>yxy>>_2yx>_>y>>_>_>>_>yxx_>_x>_>yxx_x ", +"xy>_yx_>xy>_x>_xy>>_x_xxyxy>x_xy>x_xy>x_x_>x_xy>>_>_x>_xy>x_> ", +"xy_yyx____x8__8xyyy_>8__8>8__8xyyy8>8__8>8__8xyyy8x8__8>8__8x ", +"xxxxxx>x>>>>>>x>xxx>x>>x>x>x>>xxxx>x>x>>x>x>x>xxx>>>>>x>x>x>> ", +">x>>x>>x>xx>xx>x>x>x>>x>x>x>xx>>x>x>x>>x>>>x>x>x>x>x>xx>x>xxx ", +">xx>x>x>x>x>>x>x>x>xx>x>x>x>>xx>x>x>>xx>xx>x>x>x>x>x>>x>xx>>> ", +" ", +">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>xxxxxxx", +"xxjjjxxx'''=x=jjj=x=jjj=x='''=x=jjj=x=jjj=x=jjj=x=jjj=x=jjj=>>>>", +">jx>xj>y>>xjx'xxxjxyxxxjxjx>xjxjxxxyxjxxx'>'xxxjxjxxxjxj>>>jxxjx", +">jx>xjxy>x>jxy>x>jxyx>>j>j>>>jxj>>xyxjx>x'xyxx>jxj>>>jxjxx>j>x=>", +"x=yyy=xxyyy=x=jjj=xxjjj=>=jjj=x=jjj=>=jjj=>xyyy=>=jjj=>=jjj=x>>x", +">jxxxj>yxxxj>j>x>yxyxx>jxy>x>j>yxxxjxj>x>j>yxxxjxjxx>jxyx>>jxx>>", +"xj>x>jxyx>>j>j>xxyxy>x>jxy>x>jxyx>>j>j>x>j>'>x>j>jx>xjxyxx>j>>jx", +">>jjj>xxyyy=x=jjj=x=jjj=>xyyy=x=jjj=>=jjj=x>yyy=x=jjj=>=jjj=xx=>", +"xxx>x>x>xxx>>>>x>>x>>>>x>xxxx>>x>>x>x>x>>>x>xxx>>>>>x>x>x>x>>>>x", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" "}; diff --git a/yawmppp/src/thinppp/thinppp.c b/yawmppp/src/thinppp/thinppp.c new file mode 100644 index 0000000..9d2a831 --- /dev/null +++ b/yawmppp/src/thinppp/thinppp.c @@ -0,0 +1,1085 @@ +/* + + YAWMPPP - PPP dock app/helper for WindowMaker + Copyright (C) 2000: + + Author: Felipe Bergo (bergo@seul.org) + + based on the wmppp application by + + Martijn Pieterse (pieterse@xs4all.nl) + Antoine Nulle (warp@xs4all.nl) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include "thinppp.h" +#include "ycommon.h" +#include "misc.h" +#include "isprc.h" + +#include "dataxpm.xpm" +#include "backxpm.xpm" + +GdkPixmap *origback, *myback ,*datasrc; +GtkWidget *mainw,*mda; + +/* ppp related globals */ + +/* global variables */ + +long starttime; + +char *ProgName; +char *active_interface = "ppp0"; +int TimerDivisor = 60; +int updaterate = 5; +int current_isp = 0; +int num_isps = 0; + +int got_sched=0; +int caution=1; + +struct YAWMPPP_ISP_INFO IspData[MAX_ISPS]; + +/* log data */ +struct LogStruct logconn; + +/* PPP variables */ + +#define PPP_UNIT 0 +int ppp_h = -1; +int ppp_open = 0; + +#define PPP_STATS_HIS 23 + +int pixels_per_byte; +int ppp_history[PPP_STATS_HIS + 1][2]; + +int pressed_button=-1; +int myaction=-1; + +pid_t stop_child = 0; +pid_t start_child = 0; +int status; + +int wx,wy,dragx,dragy,xlimit,ylimit,ipx,ipy; + +int +main(int argc,char **argv) { + + int i; + + /* Parse Command Line */ + + ProgName = argv[0]; + if (strlen (ProgName) >= 5) + ProgName += (strlen (ProgName) - 5); + + for (i = 1; i < argc; i++) { + char *arg = argv[i]; + + if (*arg == '-') { + switch (arg[1]) { + case 'c': + caution=1; + break; + case 'd': + if (strcmp (arg + 1, "display")) { + usage (); + exit (1); + } + break; + case 'g': + if (strcmp (arg + 1, "geometry")) { + usage (); + exit (1); + } + break; + case 'i': + if (!argv[i + 1]) { + usage (); + exit (1); + } + if (strncmp (argv[i + 1], "ppp", 3)) { + usage (); + exit (1); + } + active_interface = argv[i + 1]; + i++; + break; + case 'p': + caution=2; + break; + case 't': + TimerDivisor = 1; + break; + case 'u': + i++; + if (!argv[i]) { + usage (); + exit (1); + } + updaterate = atoi (argv[i]); + if (updaterate < 1 || updaterate > 10) { + usage (); + exit (1); + } + break; + case 'v': + printversion (); + exit (0); + break; + case 'z': + printf("Caution level: %d\n",caution); + break; + default: + usage (); + exit (0); + break; + } + } + } + + gtk_init(&argc,&argv); + gdk_rgb_init(); + + create_thinppp(); + + init_ppp(); + gtk_idle_add(thinppp,NULL); + gtk_main(); + save_initial_position(); + + gdk_pixmap_unref(origback); + gdk_pixmap_unref(datasrc); + gdk_pixmap_unref(myback); + + return 0; +} + +void +create_thinppp(void) +{ + GtkStyle *sty; + GdkBitmap *mask; + + ipx=((gdk_screen_width()-320)/2); + ipy=0; + read_initial_position(); + wx=ipx; wy=ipy; + + mainw=gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_widget_set_usize(mainw,320,20); + gtk_widget_set_uposition(mainw,wx,wy); + gtk_widget_realize(mainw); + gdk_window_set_decorations(mainw->window,0); + + xlimit=gdk_screen_width()-320; + ylimit=gdk_screen_height()-20; + + mda=gtk_drawing_area_new(); + gtk_widget_set_events(mda,GDK_EXPOSURE_MASK|GDK_BUTTON_PRESS_MASK| + GDK_BUTTON_RELEASE_MASK|GDK_BUTTON_MOTION_MASK); + gtk_drawing_area_size(GTK_DRAWING_AREA(mda),320,20); + gtk_container_add(GTK_CONTAINER(mainw),mda); + + sty=gtk_widget_get_style(mainw); + + origback=gdk_pixmap_create_from_xpm_d(mainw->window, + &mask, + NULL, + backxpm_xpm); + datasrc=gdk_pixmap_create_from_xpm_d(mainw->window, + &mask, + NULL, + dataxpm_xpm); + + myback=gdk_pixmap_new(mainw->window,320,20,-1); + gdk_draw_pixmap(myback, + mainw->style->fg_gc[GTK_WIDGET_STATE (mainw)], + origback, + 0, 0, + 0, 0, + 320, 20); + + gtk_signal_connect(GTK_OBJECT(mda),"expose_event", + GTK_SIGNAL_FUNC(exposed),NULL); + + gtk_signal_connect(GTK_OBJECT(mda),"button_press_event", + GTK_SIGNAL_FUNC(bpress),NULL); + gtk_signal_connect(GTK_OBJECT(mda),"button_release_event", + GTK_SIGNAL_FUNC(brelease),NULL); + gtk_signal_connect(GTK_OBJECT(mda),"motion_notify_event", + GTK_SIGNAL_FUNC(bmotion),NULL); + + gtk_signal_connect(GTK_OBJECT(mainw),"destroy", + GTK_SIGNAL_FUNC(wdestroy),NULL); + + gtk_widget_show(mda); + gtk_widget_show(mainw); +} + +gboolean +exposed(GtkWidget *w,GdkEventExpose *gee,gpointer data) +{ + gdk_draw_pixmap(w->window, + w->style->fg_gc[GTK_WIDGET_STATE (w)], + myback, + gee->area.x, gee->area.y, + gee->area.x, gee->area.y, + gee->area.width, gee->area.height); + return FALSE; +} + +void +refresh(void) +{ + gdk_draw_pixmap(mainw->window, + mainw->style->fg_gc[GTK_WIDGET_STATE (mainw)], + myback, + 0, 0, + 0, 0, + 320, 20); + gdk_flush(); + gtk_widget_queue_resize(mda); +} + +void +setled(int index,int type) +{ + int sx,sy,dx,dy,w,h; + + w=LED_SZE_X; + h=LED_SZE_Y; + + switch(index) { + case LED_PPP_POWER: + dx=LED_PWR_X; + dy=LED_PWR_Y; + break; + case LED_PPP_TX: + dx=LED_SND_X; + dy=LED_SND_Y; + break; + case LED_PPP_RX: + dx=LED_RCV_X; + dy=LED_RCV_Y; + break; + default: + return; + } + + switch(type) { + case LED_GREEN: + sx=LED_ON_X; + sy=LED_ON_Y; + break; + case LED_YELLOW: + sx=LED_WTE_X; + sy=LED_WTE_Y; + break; + case LED_RED: + sx=LED_ERR_X; + sy=LED_ERR_Y; + break; + case LED_DARK: + sx=LED_OFF_X; + sy=LED_OFF_Y; + break; + default: + return; + } + + paste_xpm(dx,dy,sx,sy,w,h); + refresh(); +} + +void +paste_xpm(int dx,int dy,int sx,int sy,int w,int h) +{ + gdk_draw_pixmap(myback, + mainw->style->fg_gc[GTK_WIDGET_STATE (mainw)], + datasrc, + sx, sy, + dx, dy, + w, h); +} + +void +init_ppp(void) +{ + int i; + for (i = 0; i < MAX_ISPS; i++) + memset(&IspData[i],0,sizeof(struct YAWMPPP_ISP_INFO)); + + make_config_dir(); + signal(SIGUSR1,sigusr_handler); + signal(SIGHUP,sigusr_handler); + signal(SIGINT,sigusr_handler); + signal(SIGTERM,sigusr_handler); + + write_pid_file(); + clean_guards(); + grab_isp_info(1); +} + +gint +thinppp(gpointer data) +{ + static int like_a_virgin=1; + static int but_stat; + static long currenttime; + static long lasttime; + static long waittime; + static long ppptime; + static int hour, minute; + static long timetolog; + static long ppp_send, ppp_sl = -1; + static long ppp_recv, ppp_rl = -1; + static long ppp_sbytes, ppp_rbytes; + static long ppp_osbytes, ppp_orbytes; + static struct stat st; + static int isonline = 0; + static int speed_ind = 10; + + int i,j; + + if (like_a_virgin) { + get_statistics (active_interface, &ppp_rl, &ppp_sl, + &ppp_orbytes, &ppp_osbytes); + starttime = 0; + currenttime = time (0); + ppptime = 0; + but_stat = -1; + waittime = 0; + timetolog=0; + + /* 888k8 on bottom */ + paste_xpm(ERR_DEST_X,ERR_DEST_Y,ERR_SRC_X+28,ERR_SRC_Y+9,25,8); + DrawISPName (); + refresh(); + + like_a_virgin=0; + } + + lasttime = currenttime; + currenttime = time (0); + + /* Check if any child has left the playground */ + i = waitpid (0, &status, WNOHANG); + if (i == stop_child && stop_child != 0) { + starttime = 0; + + setled(LED_PPP_POWER,LED_DARK); + setled(LED_PPP_RX,LED_DARK); + setled(LED_PPP_TX,LED_DARK); + /* 888k8 on bottom */ + paste_xpm(ERR_DEST_X,ERR_DEST_Y,ERR_SRC_X+28,ERR_SRC_Y+9,25,8); + refresh(); + stop_child = 0; + } + if (i == start_child && start_child != 0) { + if (WIFEXITED (status)) { + if (WEXITSTATUS (status) == 10) { + starttime = 0; + /* 88k8 on bottom */ + paste_xpm(ERR_DEST_X,ERR_DEST_Y,ERR_SRC_X+28,ERR_SRC_Y+9,25,8); + setled(LED_PPP_POWER,LED_DARK); + DrawTime (0, 1); + refresh(); + } + start_child = 0; + } + } + + /* On-line detectie! 1x per second */ + + if (currenttime != lasttime) { + i = 0; + + if (stillonline (active_interface)) { + i = 1; + if (!starttime) { + starttime = currenttime; + + if (stat (STAMP_FILE, &st) == 0) + starttime = st.st_mtime; + + setled(LED_PPP_POWER,LED_GREEN); + waittime = 0; + + /* 88k8 on bottom */ + paste_xpm(ERR_DEST_X,ERR_DEST_Y,ERR_SRC_X+28,ERR_SRC_Y+9,25,8); + + if (IspData[current_isp].SpeedAction) + DrawSpeedInd (IspData[current_isp].SpeedAction); + + speed_ind = currenttime + 10; + refresh(); + } + } + if (!i && starttime) { + starttime = 0; + setled(LED_PPP_POWER,LED_RED); + logconn.status=1; + /* Error */ + paste_xpm(ERR_DEST_X,ERR_DEST_Y,ERR_SRC_X,ERR_SRC_Y+9,25,8); + if (IspData[current_isp].IfDownAction) + execCommand (IspData[current_isp].IfDownAction); + refresh(); + } + } + + if (waittime && waittime <= currenttime) { + setled(LED_PPP_POWER,LED_RED); + refresh(); + waittime = 0; + } + + if ((starttime)&&(!isonline)) { + isonline=1; + + logconn.start=time(NULL); + logconn.status=0; + strcpy(logconn.longname,IspData[current_isp].LongName); + strcpy(logconn.shortname,IspData[current_isp].ShortName); + strcpy(logconn.user,IspData[current_isp].User); + strcpy(logconn.phone,IspData[current_isp].Phone); + + if (!strlen(logconn.shortname)) + strcpy(logconn.shortname,"empty"); + if (!strlen(logconn.longname)) + strcpy(logconn.longname,"empty"); + if (!strlen(logconn.user)) + strcpy(logconn.user,"empty"); + if (!strlen(logconn.phone)) + strcpy(logconn.phone,"empty"); + + make_guards(); + } + if ((!starttime)&&(isonline)) { + isonline=0; + logconn.end=time(NULL); + write_log(); + if (got_sched) + make_delayed_update(); + if (caution>0) + close_ppp(); + } + + /* If we are on-line. Print the time we are */ + if (starttime) { + i = currenttime - starttime; + i /= TimerDivisor; + + if (TimerDivisor == 1) + if (i > 59 * 60 + 59) + i /= 60; + + minute = i % 60; + hour = (i / 60) % 100; + i = hour * 100 + minute; + + DrawTime (i, currenttime % 2); + /* We are online, so we can check for send/recv packets */ + + get_statistics (active_interface, &ppp_recv, &ppp_send, + &ppp_rbytes, &ppp_sbytes); + if (caution>1) + close_ppp(); + + if (ppp_send != ppp_sl) + setled(LED_PPP_TX,LED_GREEN); + else + setled(LED_PPP_TX,LED_DARK); + + if (ppp_recv != ppp_rl) + setled(LED_PPP_RX,LED_GREEN); + else + setled(LED_PPP_RX,LED_DARK); + + ppp_sl = ppp_send; + ppp_rl = ppp_recv; + + /* Every five seconds we check to load on the line */ + + if (currenttime - timetolog >= 0) { + timetolog=currenttime + 60; + make_guards(); + } + + if ((currenttime - ppptime >= 0) || (ppptime == 0)) { + ppptime = currenttime + updaterate; + + ppp_history[PPP_STATS_HIS][0] = ppp_rbytes - ppp_orbytes; + ppp_history[PPP_STATS_HIS][1] = ppp_sbytes - ppp_osbytes; + + ppp_orbytes = ppp_rbytes; + ppp_osbytes = ppp_sbytes; + + DrawStats (23, 9, 170, 13); + + for (j = 1; j < 24; j++) { + ppp_history[j - 1][0] = ppp_history[j][0]; + ppp_history[j - 1][1] = ppp_history[j][1]; + } + if (currenttime > speed_ind) { + DrawLoadInd ((ppp_history[23][0] + ppp_history[23][1]) / updaterate); + } + } + + refresh(); + } + + switch (myaction) { + case BUT_V: + if (!starttime) { + /* 888k8 */ + paste_xpm(ERR_DEST_X,ERR_DEST_Y,ERR_SRC_X+28,ERR_SRC_Y+9,25,8); + DrawTime (0, 1); + start_child = execCommand (IspData[current_isp].StartAction); + setled(LED_PPP_POWER,LED_YELLOW); + waittime = ORANGE_LED_TIMEOUT + currenttime; + refresh(); + } + break; + case BUT_X: + if (stop_child == 0) + stop_child = execCommand (IspData[current_isp].StopAction); + break; + case BUT_REW: + if (!starttime) { + current_isp--; + if (current_isp < 0) + current_isp = num_isps - 1; + if (current_isp < 0) + current_isp=0; + DrawISPName (); + refresh(); + } + break; + case BUT_FF: + if (!starttime) { + current_isp++; + if (current_isp == num_isps) + current_isp = 0; + DrawISPName (); + refresh(); + } + break; + case BUT_CONF: + run_pref_app(); + break; + case BUT_LOG: + run_log_app(); + break; + case BUT_KILL: + if (!starttime) + gtk_widget_destroy(mainw); + break; + } + myaction=-1; + + usleep (50000L); + return TRUE; +} + +gboolean +wdestroy(GtkWidget *w,GdkEvent *ev,gpointer data) +{ + int i; + while (start_child | stop_child) { + i = waitpid (0, &status, WNOHANG); + if (i == stop_child) + stop_child = 0; + if (i == start_child) + start_child = 0; + usleep (50000l); + } + gtk_main_quit(); + return FALSE; +} + +gboolean +bpress(GtkWidget *w,GdkEventButton *geb,gpointer data) +{ + int x,y; + + if (geb==NULL) + return FALSE; + + x=(int)geb->x; + y=(int)geb->y; + + dragx=(int)geb->x_root; + dragy=(int)geb->y_root; + + pressed_button=-1; + + if (x<50) { + pressed_button=BUT_DRAG; + grab_me(); + } + + if (inbox(x,y,BUT_V_X,BUT_V_Y,12,11)) { + pressed_button=BUT_V; + paste_xpm(BUT_V_X,BUT_V_Y,BUT_V_SRC_X,BUT_V_SRC_Y,12,11); + refresh(); + grab_me(); + return FALSE; + } + + if (inbox(x,y,BUT_X_X,BUT_X_Y,12,11)) { + pressed_button=BUT_X; + paste_xpm(BUT_X_X,BUT_X_Y,BUT_X_SRC_X,BUT_X_SRC_Y,12,11); + refresh(); + grab_me(); + return FALSE; + } + + if (inbox(x,y,BUT_R_X,BUT_R_Y,12,11)) { + pressed_button=BUT_REW; + paste_xpm(BUT_R_X,BUT_R_Y,BUT_R_SRC_X,BUT_R_SRC_Y,12,11); + refresh(); + grab_me(); + return FALSE; + } + + if (inbox(x,y,BUT_F_X,BUT_F_Y,12,11)) { + pressed_button=BUT_FF; + paste_xpm(BUT_F_X,BUT_F_Y,BUT_F_SRC_X,BUT_F_SRC_Y,12,11); + refresh(); + grab_me(); + return FALSE; + } + + if (inbox(x,y,BUT_C_X,BUT_C_Y,12,11)) { + pressed_button=BUT_CONF; + paste_xpm(BUT_C_X,BUT_C_Y,BUT_C_SRC_X,BUT_C_SRC_Y,12,11); + refresh(); + grab_me(); + return FALSE; + } + + if (inbox(x,y,BUT_L_X,BUT_L_Y,12,11)) { + pressed_button=BUT_LOG; + paste_xpm(BUT_L_X,BUT_L_Y,BUT_L_SRC_X,BUT_L_SRC_Y,12,11); + refresh(); + grab_me(); + return FALSE; + } + + if (inbox(x,y,BUT_K_X,BUT_K_Y,17,18)) { + pressed_button=BUT_KILL; + paste_xpm(BUT_K_X,BUT_K_Y,BUT_K_SRC_X,BUT_K_SRC_Y,17,18); + refresh(); + grab_me(); + return FALSE; + } + + return FALSE; +} + +gboolean +brelease(GtkWidget *w,GdkEventButton *geb,gpointer data) +{ + int x,y,c; + if (geb==NULL) + return FALSE; + + if (pressed_button<0) + return FALSE; + + x=(int)geb->x; + y=(int)geb->y; + c=-1; + + if (inbox(x,y,BUT_V_X,BUT_V_Y,12,11)) + c=BUT_V; + if (inbox(x,y,BUT_X_X,BUT_X_Y,12,11)) + c=BUT_X; + if (inbox(x,y,BUT_R_X,BUT_R_Y,12,11)) + c=BUT_REW; + if (inbox(x,y,BUT_F_X,BUT_F_Y,12,11)) + c=BUT_FF; + if (inbox(x,y,BUT_C_X,BUT_C_Y,12,11)) + c=BUT_CONF; + if (inbox(x,y,BUT_L_X,BUT_L_Y,12,11)) + c=BUT_LOG; + if (inbox(x,y,BUT_K_X,BUT_K_Y,17,18)) + c=BUT_KILL; + + ungrab_me(); + if (c!=pressed_button) { + pressed_button=-1; + paste_xpm(BUT_V_X,BUT_V_Y,BUT_V_SRC_X+24,BUT_V_SRC_Y,12,11); + paste_xpm(BUT_X_X,BUT_X_Y,BUT_X_SRC_X+24,BUT_X_SRC_Y,12,11); + paste_xpm(BUT_R_X,BUT_R_Y,BUT_R_SRC_X+24,BUT_R_SRC_Y,12,11); + paste_xpm(BUT_F_X,BUT_F_Y,BUT_F_SRC_X+24,BUT_F_SRC_Y,12,11); + paste_xpm(BUT_C_X,BUT_C_Y,BUT_C_SRC_X+24,BUT_C_SRC_Y,12,11); + paste_xpm(BUT_L_X,BUT_L_Y,BUT_L_SRC_X+24,BUT_L_SRC_Y,12,11); + paste_xpm(BUT_K_X,BUT_K_Y,BUT_K_SRC_X+17,BUT_K_SRC_Y,17,18); + refresh(); + return FALSE; + } + + myaction=pressed_button; + + paste_xpm(BUT_V_X,BUT_V_Y,BUT_V_SRC_X+24,BUT_V_SRC_Y,12,11); + paste_xpm(BUT_X_X,BUT_X_Y,BUT_X_SRC_X+24,BUT_X_SRC_Y,12,11); + paste_xpm(BUT_R_X,BUT_R_Y,BUT_R_SRC_X+24,BUT_R_SRC_Y,12,11); + paste_xpm(BUT_F_X,BUT_F_Y,BUT_F_SRC_X+24,BUT_F_SRC_Y,12,11); + paste_xpm(BUT_C_X,BUT_C_Y,BUT_C_SRC_X+24,BUT_C_SRC_Y,12,11); + paste_xpm(BUT_L_X,BUT_L_Y,BUT_L_SRC_X+24,BUT_L_SRC_Y,12,11); + paste_xpm(BUT_K_X,BUT_K_Y,BUT_K_SRC_X+17,BUT_K_SRC_Y,17,18); + refresh(); + pressed_button=-1; + return FALSE; +} + +gboolean +bmotion(GtkWidget *w,GdkEventMotion *geb,gpointer data) +{ + if (pressed_button!=BUT_DRAG) + return TRUE; + + if (geb==NULL) + return TRUE; + + wx=wx+((int)geb->x_root-dragx); + wy=wy+((int)geb->y_root-dragy); + + if (wx<0) wx=0; + if (wx>xlimit) wx=xlimit; + if (wy<0) wy=0; + if (wy>ylimit) wy=ylimit; + + dragx=(int)geb->x_root; + dragy=(int)geb->y_root; + + gdk_window_move(mainw->window,wx,wy); + gdk_flush(); + return FALSE; +} + +void +grab_me(void) +{ + gdk_pointer_grab(mda->window,FALSE, + GDK_BUTTON_RELEASE_MASK, + NULL, + NULL, + time(NULL)); +} + +void +ungrab_me(void) +{ + gdk_pointer_ungrab(time(NULL)); +} + +gboolean +inbox(int x,int y,int bx,int by,int bw,int bh) +{ + if ((x>=bx)&&(y>=by)&&(x<=(bx+bw))&&(y<=(by+bh))) + return TRUE; + else + return FALSE; +} + +void +sigusr_handler(int signum) +{ + save_initial_position(); + if (signum==SIGUSR1) { + if (!starttime) { + grab_isp_info(0); + if (current_isp>=num_isps) + current_isp=0; + DrawISPName(); + refresh(); + } else { + got_sched=1; + warn_pref(); + } + } + else { + remove_pid_file(); + exit(0); + } +} + +/* lower level drawing */ + +void +DrawISPName (void) +{ + int i, s; + + s = strlen (IspData[current_isp].ShortName); + for (i = 0; i < 5; i++) + { + if (s >= (i + 1)) + draw_isp_char (i, IspData[current_isp].ShortName[i]); + else + draw_isp_char (i, ' '); + } +} + +void +draw_isp_char (int pos, char letter) +{ + int sx = 0, sy = 0, ac = 0; + + if ((!ac) && (letter >= 'A') && (letter <= 'Z')) + { + sx = UPPER_ABC_BASE_X; + sy = UPPER_ABC_BASE_Y; + sy += 8 * ((letter - 'A') / 12); + sx += 5 * ((letter - 'A') % 12); + ac = 1; + } + if ((!ac) && (letter >= 'a') && (letter <= 'z')) + { + sx = LOWER_ABC_BASE_X; + sy = LOWER_ABC_BASE_Y; + sy += 8 * ((letter - 'a') / 12); + sx += 5 * ((letter - 'a') % 12); + ac = 1; + } + if ((!ac) && (letter >= '0') && (letter <= '9')) + { + sx = DIGIT_BASE_X; + sy = DIGIT_BASE_Y; + sx += 5 * (letter - '0'); + ac = 1; + } + if (!ac) + { + sx = SPACE_BASE_X; + sy = SPACE_BASE_Y; + } + + paste_xpm(ISP_BASE_X + 5 * pos, ISP_BASE_Y, sx, sy, 4, 7); +} + +void +DrawTime (int i, int j) +{ + int k = 1000; + + paste_xpm(TIMER_DES_X + 6 * 0, TIMER_DES_Y, + TIMER_SZE_X * ((i/k)%10)+1, TIMER_SRC_Y,5,7); + k=k/10; + + paste_xpm(TIMER_DES_X + 6 * 1, TIMER_DES_Y, + TIMER_SZE_X * ((i/k)%10)+1, TIMER_SRC_Y,5,7); + k=k/10; + + /* colon */ + if (j) + paste_xpm(TIMER_DES_X + 6 * 2 + 1, TIMER_DES_Y, + 62, TIMER_SRC_Y,1,7); + else + paste_xpm(TIMER_DES_X + 6 * 2 + 1, TIMER_DES_Y, + 63, TIMER_SRC_Y,1,7); + + paste_xpm(TIMER_DES_X + 6 * 2 + 4, TIMER_DES_Y, + TIMER_SZE_X * ((i/k)%10)+1, TIMER_SRC_Y,5,7); + k=k/10; + + paste_xpm(TIMER_DES_X + 6 * 3 + 4, TIMER_DES_Y, + TIMER_SZE_X * ((i/k)%10)+1, TIMER_SRC_Y,5,7); +} + +void +DrawStats (int num, int size, int x_left, int y_bottom) +{ + int pixels_per_byte; + int j, k; + + pixels_per_byte = size; + for (j = 0; j < num; j++) + if ((ppp_history[j][0]+ppp_history[j][1]) > pixels_per_byte) + pixels_per_byte = ppp_history[j][0] + ppp_history[j][1]; + + pixels_per_byte /= size; + + for (k = 0; k < num; k++) + for (j = 0; j < size; j++) { + if (j < (ppp_history[k][0] / pixels_per_byte)) + paste_xpm(k+x_left, y_bottom-j,HIST_SRC_X+2,HIST_SRC_Y,1,1); + else if (j < (ppp_history[k][0] + ppp_history[k][1]) / pixels_per_byte) + paste_xpm(k+x_left,y_bottom-j,HIST_SRC_X+1,HIST_SRC_Y,1,1); + else + paste_xpm(k+x_left,y_bottom-j,HIST_SRC_X,HIST_SRC_Y,1,1); + } +} + +void +PrintLittle (int i, int *k) +{ + switch (i) { + case -1: + *k -= 5; + paste_xpm(*k,ERR_DEST_Y,12*5,ERR_SRC_Y,4,8); + break; + case 0: + *k -= 5; + paste_xpm(*k,ERR_DEST_Y,45,ERR_SRC_Y,5,8); + break; + default: + *k -= 5; + paste_xpm(*k,ERR_DEST_Y,i*5 - 5,ERR_SRC_Y,5,8); + break; + } +} + +void +DrawSpeedInd (char *speed_action) +{ + int linespeed, i, k; + FILE *fp; + char *p; + char temp[128]; + + fp = popen (speed_action, "r"); + + if (fp) { + linespeed = 0; + + while (fgets (temp, 128, fp)) + ; + + pclose (fp); + + if ((p = strstr (temp, "CONNECT"))) + linespeed = atoi (p + 8); + + k = ERR_DEST_X+25; + + i = (linespeed % 1000) / 100; + linespeed /= 1000; + PrintLittle (i, &k); + + k -= 5; + paste_xpm(k,ERR_DEST_Y,ERR_SRC_X+50,ERR_SRC_Y,5,8); + + do { + PrintLittle (linespeed % 10, &k); + linespeed /= 10; + } while (linespeed); + } +} + +void +DrawLoadInd (int speed) +{ + int i, k; + + k = ERR_DEST_X+25; + for (i = 0; i < 5; i++) + PrintLittle (-1, &k); + + k = ERR_DEST_X+25; + + do { + PrintLittle (speed % 10, &k); + speed /= 10; + } while (speed); +} + + +void +make_delayed_update(void) +{ + grab_isp_info(0); + if (current_isp>=num_isps) + current_isp=0; + DrawISPName(); + refresh(); + got_sched=0; +} + +void +usage (void) { + fprintf (stderr, + "\nyawmppp.thin\nYet Another Window Maker PPP dock applet,\nfor non-Window Maker window managers\n\n"); + fprintf (stderr, + "version %s\n\n",VERSION); + fprintf (stderr, "usage:\n"); + fprintf (stderr, "-h this help screen\n"); + fprintf (stderr, "-i (ppp0, ppp1, etc)\n"); + fprintf (stderr, "-t set the on-line timer to MM:SS instead of HH:MM\n"); + fprintf (stderr, "-u (1..10), default 5 seconds\n"); + fprintf (stderr, "-v print the version number\n"); + fprintf (stderr, "-paranoid be paranoid about open sockets\n"); + fprintf (stderr, "\n"); +} + +void +printversion (void) +{ + fprintf (stderr, "%s\n", VERSION); +} + +void +read_initial_position(void) +{ + FILE *f; + char *p,z[256]; + p=getenv("HOME"); + sprintf(z,"%s/.yawmppp/thin.position",p); + f=fopen(z,"r"); + if (!f) + return; + fgets(z,255,f); + ipx=atoi(strtok(z," \t\n")); + ipy=atoi(strtok(NULL," \t\n")); + fclose(f); +} + +void +save_initial_position(void) +{ + FILE *f; + char *p,z[256]; + p=getenv("HOME"); + sprintf(z,"%s/.yawmppp/thin.position",p); + f=fopen(z,"w"); + if (!f) + return; + ipx=wx; + ipy=wy; + fprintf(f,"%d %d\n",ipx,ipy); + fclose(f); +} diff --git a/yawmppp/src/thinppp/thinppp.h b/yawmppp/src/thinppp/thinppp.h new file mode 100644 index 0000000..505a235 --- /dev/null +++ b/yawmppp/src/thinppp/thinppp.h @@ -0,0 +1,153 @@ + +/* DEFINES */ + +#include + +#define MAX_ISPS 40 + +#define START_ACTION (NULL) +#define STOP_ACTION (NULL) +#define SPEED_ACTION (NULL) +#define IFDOWN_ACTION (NULL) + +#define STAMP_FILE "/var/run/ppp0.pid" + +/* leds */ + +#define LED_PWR_X (226) +#define LED_PWR_Y (5) +#define LED_SND_X (255) +#define LED_SND_Y (5) +#define LED_RCV_X (242) +#define LED_RCV_Y (5) + +#define LED_PPP_RX (1) +#define LED_PPP_TX (2) +#define LED_PPP_POWER (3) + +#define LED_ON_X (1) +#define LED_ON_Y (1) +#define LED_OFF_X (34) +#define LED_OFF_Y (1) +#define LED_ERR_X (23) +#define LED_ERR_Y (1) +#define LED_WTE_X (12) +#define LED_WTE_Y (1) +#define LED_SZE_X (10) +#define LED_SZE_Y (10) + +#define LED_GREEN (1) +#define LED_RED (2) +#define LED_YELLOW (3) +#define LED_DARK (4) + +/* buttons */ + +#define BUT_V (1) +#define BUT_X (2) +#define BUT_REW (3) +#define BUT_FF (4) +#define BUT_CONF (5) +#define BUT_LOG (6) +#define BUT_KILL (7) +#define BUT_DRAG (8) + +#define BUT_V_X (112) +#define BUT_V_Y (5) +#define BUT_X_X (124) +#define BUT_X_Y (5) +#define BUT_R_X (53) +#define BUT_R_Y (5) +#define BUT_F_X (65) +#define BUT_F_Y (5) +#define BUT_C_X (273) +#define BUT_C_Y (5) +#define BUT_L_X (285) +#define BUT_L_Y (5) + +#define BUT_K_X (302) +#define BUT_K_Y (1) + +#define BUT_K_SRC_X (0) +#define BUT_K_SRC_Y (30) + +/* displays */ + +#define TIMER_SRC_Y (176) +#define TIMER_DES_Y (6) +#define TIMER_DES_X (141) +#define TIMER_SZE_X (6) + +#define ISP_BASE_X (82) +#define ISP_BASE_Y (6) + +#define ERR_DEST_X (195) +#define ERR_DEST_Y (6) + +#define ERR_SRC_X (0) +#define ERR_SRC_Y (94) + +#define UPPER_ABC_BASE_X (1) +#define UPPER_ABC_BASE_Y (124) +#define LOWER_ABC_BASE_X (1) +#define LOWER_ABC_BASE_Y (148) +#define DIGIT_BASE_X (11) +#define DIGIT_BASE_Y (164) +#define SPACE_BASE_X (11) +#define SPACE_BASE_Y (140) + +#define HIST_SRC_X (58) +#define HIST_SRC_Y (92) + +#define BUT_V_SRC_X (0) +#define BUT_V_SRC_Y (70) +#define BUT_X_SRC_X (12) +#define BUT_X_SRC_Y (70) + +#define BUT_R_SRC_X (0) +#define BUT_R_SRC_Y (82) +#define BUT_F_SRC_X (12) +#define BUT_F_SRC_Y (82) + +#define BUT_C_SRC_X (0) +#define BUT_C_SRC_Y (58) +#define BUT_L_SRC_X (12) +#define BUT_L_SRC_Y (58) + +#define BUT_UP_INC (24) + +#define ORANGE_LED_TIMEOUT (60) + +void create_thinppp(void); +gboolean exposed(GtkWidget *w,GdkEventExpose *gee,gpointer data); +gboolean bpress(GtkWidget *w,GdkEventButton *geb,gpointer data); +gboolean brelease(GtkWidget *w,GdkEventButton *geb,gpointer data); +gboolean bmotion(GtkWidget *w,GdkEventMotion *geb,gpointer data); +gboolean wdestroy(GtkWidget *w,GdkEvent *ev,gpointer data); + +void refresh(void); + +void setled(int index,int type); +void paste_xpm(int dx,int dy,int sx,int sy,int w,int h); +void DrawISPName (void); +void draw_isp_char (int pos, char letter); +void DrawTime (int i, int j); +void DrawStats (int num, int size, int x_left, int y_bottom); +void PrintLittle (int i, int *k); +void DrawSpeedInd (char *speed_action); +void DrawLoadInd (int speed); + +void init_ppp(void); +gint thinppp(gpointer data); + +void sigusr_handler(int signum); +void make_delayed_update(void); +void usage (void); +void printversion (void); + +void grab_me(void); +void ungrab_me(void); +gboolean inbox(int x,int y,int bx,int by,int bw,int bh); + +void read_initial_position(void); +void save_initial_position(void); diff --git a/yawmppp/src/yawmppp.1x b/yawmppp/src/yawmppp.1x new file mode 100644 index 0000000..9387015 --- /dev/null +++ b/yawmppp/src/yawmppp.1x @@ -0,0 +1,167 @@ +.TH YAWMPPP 1x "22 Feb 2001" "Free Software" "User Manuals" +.SH NAME +yawmppp \- Window Maker dock front end for pppd and chat +.SH SYNOPSIS +yawmppp [\fB\-h\fR] [\fB\-i\fR \fIdevice\fR] [\fB-t\fR] + [\fB\-u\fR \fIupdate rate\fR] [\fB\-v\fR] + [\fB\-caution\fR | \fB-paranoid\fR] + +yawmppp.thin [\fB\-h\fR] [\fB\-i\fR \fIdevice\fR] [\fB-t\fR] + [\fB\-u\fR \fIupdate rate\fR] [\fB\-v\fR] + [\fB\-caution\fR | \fB-paranoid\fR] + +.SH DESCRIPTION +This man page documents version 2.0.2 of \fByawmppp\fR. + +.B "yawmppp" +is \fBY\fRet \fBA\fRnother \fBW\fRindow \fBM\fRaker +\fBPPP\fR dock applet. + +.B "yawmppp" +runs docked in Window Maker's dock (or clip), swallowed in +AfterStep's wharf or as a iconic shaped window on other +window managers. If you are not using a dock-capable +window manager (Window Maker and AfterStep) then you may +prefer to run \fByawmppp.thin\fR instead, which is +the same applet shaped as an horizontal bar, designed +for use without a dock. + +It provides a front end for the programs chat and pppd, in +a way that you probably shouldn't ever need to edit +directly these programs' scripts. + +The \fBv\fR button starts a connection to the currently +selected ISP entry (whose handle is shown in the bottom +left corner of the display). The \fBx\fR button closes +the current connection. The arrow buttons let you +select a dialing entry. + +To create and edit dialing entries you should use the +\fByawmppp.pref\fR program, which can be run by clicking the +left mouse button in yawmppp's display area. + +You can see a log of your connections with the \fByawmppp.log\fR +program, which can be run by clicking yawmppp's display area +with any mouse button but the left. + +.SH DISPLAY +Yawmppp's display has a connection timer at the top left corner, +three LEDs at the top right meaning RX,TX and POWER. The RX/TX +leds blinking upon the receive/send of PPP packets. The +POWER led is dark when you're offline, yellow when dialing, +green when connected, red when an error has ocurred with the +connection. + +In the middle of the display is an auto-scaling load graph. The +bottom left corner shows the current ISP's handle and the +bottom right corner displays the CONNECT speed in the first +10 seconds of connection, then starts showing the +characters-per-second rate. + +.SH "COMMAND-LINE OPTIONS" +.IP "\-caution" +.IP "\-paranoid" +these options will change the way yawmppp touches the PPP interface. +Caution will keep associated structures open while +the connection is up only. Paranoid will open and close the +structures LOTS of times to keep them closed as much as possible. +These options are meant for PCMCIA & APM (notebooks, maybe PDAs) users +who run into trouble with cardctl commands. Don't use these options unless +you really need them. And if you need, check if caution is enough, +be paranoid only when absolutely necessary. When none is +specified, \fB-caution\fR is default. +.IP "\-i device" +use a ppp device other then ppp0. +.IP "\-h" +shows a brief help message +.IP "\-t" +set timer to MM:SS instead of HH:MM +.IP "\-u update\-rate" +sets the interval for statistics update (load graph and cps rate). +If not set, defaults to 5 seconds. +.IP "\-v" +shows version and exits. + +.SH "PPPD OPTIONS" +yawmppp.pref provides a good set of options from pppd, but if need +any other that isn't (yet) directly supported, put it in +/etc/ppp/options. Per-ISP options are placed in /etc/ppp/peers, +as newer pppd versions require (since 2.3.7 at least). Whenever +YAWMPPP needs to write some file there, it will ask for the +superuser password on an xterm. Configuration files must go +under /etc/ppp/peers or the noauth option, usually required to +connect to ISPs, won't be allowed. + +.SH "DNS Handling" +In the past, YAWMPPP changed the named(8) configuration files to +set DNS up, but nowadays pppd has taken over this task with the +usepeerdns option. From pppd 2.3.11 up, DNS should work out of the +box. pppd 2.3.10 and some earlier versions may require working +/etc/ppp/ip-up and /etc/ppp/ip-down files. Some distributions +provide these files worked out (Red Hat), others +don't (Slackware). Here is a sample minimalist set of these files: + +\fB/etc/ppp/ip-up\fR +.br +#!/bin/sh +.br +echo "search mydomain.org" > /etc/resolv.conf +.br +echo "nameserver $DNS1" >> /etc/resolv.conf +.br + +\fB/etc/ppp/ip-down\fR +.br +#!/bin/sh +.br +echo "search mydomain.org" > /etc/resolv.conf +.br +echo "nameserver" >> /etc/resolv.conf +.br + +.SH "FILES" + +.IR ~/.yawmppp2 +.br +.IR ~/.yawmppp2/yawmppprc +.br +.IR ~/.yawmppp2/logfile +.br + +.SH "BUGS" +.BR "yawmppp " +You must set your PAP/CHAP secrets directly in the /etc/ppp/chap-secrets +and /etc/ppp/pap-secrets files. For security reasons, yawmppp cannot do +it for you. + +If you run more than one copy of yawmppp or yawmppp.thin you'll get +repeated log entries. + +.SH "PORTABILITY" +.BR "yawmppp " +has been reported to run on Linux, NetBSD and FreeBSD. Your +mileage may vary on Linux, as pppd configuration can vary wildly from +distribution to distribution. + +On Slackware Linux 7.0 you must set up /etc/ppp/ip-up and /etc/ppp/ip-down +on your own to get DNS resolution working. +The minimalist sample given in this man page works. + +.SH "CREDITS" +.BR "yawmppp " +was written by Felipe Bergo . The dock applet +is based on wmppp 1.3.0, which was written by Martijn Pieterse and +Antoine Nulle. + +.SH "UNRESTRICTIONS" +.BR "yawmppp " +is free; anyone may redistribute copies of \fByawmppp\fR to anyone under the +terms stated in the GNU General Public License. A copy of the license accompanies +each copy of \fByawmppp\fR. + +.SH "WEB SITE" +http://yawmppp.seul.org + +.SH "SEE ALSO" +\fBpppd\fR(8), \fBchat\fR(8), \fBresolver\fR(5), \fBsetserial\fR(8), +\fBttys\fR(4) diff --git a/yawmppp/src/ycommon.c b/yawmppp/src/ycommon.c new file mode 100644 index 0000000..2d7e578 --- /dev/null +++ b/yawmppp/src/ycommon.c @@ -0,0 +1,410 @@ +/* + + YAWMPPP - PPP dock app/helper for WindowMaker + Copyright (C) 2000,2001: + + Author: Felipe Bergo (bergo@seul.org) + + based on the wmppp application by + + Martijn Pieterse (pieterse@xs4all.nl) + Antoine Nulle (warp@xs4all.nl) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + $Id: ycommon.c,v 1.1.1.1 2001/02/22 07:15:59 bergo Exp $ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#ifdef LINUX +#define _LINUX_SOCKET_H +#endif + +/* guessworks for critters beyond the realm of Linux and FreeBSD */ + +#ifdef OPENBSD +#define FREEBSD +#endif + +#ifdef NETBSD +#define FREEBSD +#endif + +#ifdef BSDISH +#define FREEBSD +#endif + +#ifdef LINUX + #include + #include + #include + #include +#endif + +#ifdef FREEBSD + #include + #include + #include +#endif + +#include "ycommon.h" +#include "isprc.h" + + +extern struct LogStruct logconn; + +extern int ppp_h; +extern int ppp_open; + +extern struct YAWMPPP_ISP_INFO IspData[MAX_ISPS]; +extern int num_isps; +extern int current_isp; + +extern char *active_interface; + +/* LOGS = ~/.yawmppp2/log */ + +void +clean_guards(void) +{ + char *p; + char temp[128],aux[128]; + FILE *f; + + p = getenv ("HOME"); + strcpy (temp, p); + strcat (temp, "/.yawmppp2/.floatlog"); + f=fopen(temp,"r"); + if (!f) + return; /* fine: no crash file */ + if (!fgets(aux,128,f)) return; + if ((p=strtok(aux,"\n"))==NULL) return; + logconn.start=atoi(p); + if (!fgets(aux,128,f)) return; + if ((p=strtok(aux,"\n"))==NULL) return; + logconn.end=atoi(p); + if (!fgets(aux,128,f)) return; + if ((p=strtok(aux,"\n"))==NULL) return; + logconn.status=atoi(p); + if (!fgets(aux,128,f)) return; + if ((p=strtok(aux,"\n"))==NULL) return; + strcpy(logconn.longname,p); + if (!fgets(aux,128,f)) return; + if ((p=strtok(aux,"\n"))==NULL) return; + strcpy(logconn.shortname,p); + if (!fgets(aux,128,f)) return; + if ((p=strtok(aux,"\n"))==NULL) return; + strcpy(logconn.phone,p); + if (!fgets(aux,128,f)) return; + if ((p=strtok(aux,"\n"))==NULL) return; + strcpy(logconn.user,p); + fclose(f); + logconn.status=2; /* CRASH */ + write_log(); +} + +void +make_guards(void) +{ + char *p; + char temp[128]; + FILE *f; + + p = getenv ("HOME"); + strcpy (temp, p); + strcat (temp, "/.yawmppp2/.floatlog"); + f=fopen(temp,"w"); + if (!f) return; + + logconn.end=time(NULL); + fprintf(f,"%lu\n%lu\n%d\n",logconn.start,logconn.end,logconn.status); + fprintf(f,"%s\n%s\n%s\n",logconn.longname,logconn.shortname,logconn.phone); + fprintf(f,"%s\n",logconn.user); + fclose(f); +} + +void +write_log(void) +{ + char *p; + char temp[128]; + FILE *f; + int i,s; + + p = getenv ("HOME"); + strcpy (temp, p); + strcat (temp, "/.yawmppp2/logfile"); + f=fopen(temp,"a"); + if (!f) return; + + s=strlen(logconn.phone); + for(i=0;i= 0) + ppp_open = 1; +} + +void +close_ppp(void) +{ + if (!ppp_open) + return; + close(ppp_h); + ppp_open=0; +} + +/* other stuff */ + +void +write_pid_file(void) +{ + char *p; + char temp[128]; + FILE *f; + + p = getenv ("HOME"); + strcpy (temp, p); + strcat (temp, "/.yawmppp2/yawmppp.pid"); + + f=fopen(temp,"w"); + if (f) { + fprintf(f,"%d",getpid()); + fclose(f); + } +} + +void +remove_pid_file(void) +{ + char *p; + char temp[128]; + + p = getenv ("HOME"); + strcpy (temp, p); + strcat (temp, "/.yawmppp2/yawmppp.pid"); + + unlink(temp); +} + +void +make_config_dir(void) +{ + struct stat ss; + char tmp[256]; + + sprintf(tmp,"%s/.yawmppp2",getenv("HOME")); + + if (stat(tmp,&ss)<0) + mkdir(tmp,0700); +} + + +void +grab_isp_info(int rof) +{ + char *p; + char temp[128]; + + p = getenv ("HOME"); + strcpy (temp, p); + strcat (temp, "/.yawmppp2/yawmppprc"); + + num_isps=GetISPInfo(temp,&IspData[0],MAX_ISPS); + + if ((!num_isps)&&(rof)) { + run_pref_app(); + } +} + +void +run_pref_app(void) +{ + if (!fork()) { + execlp("yawmppp.pref","yawmppp.pref",NULL); + execlp("/usr/local/bin/yawmppp.pref","yawmppp.pref",NULL); + execlp("/usr/bin/yawmppp.pref","yawmppp.pref",NULL); + exit(2); + } +} + +void +run_log_app(void) +{ + if (!fork()) { + execlp("yawmppp.log","yawmppp.log",NULL); + execlp("/usr/local/bin/yawmppp.log","yawmppp.log",NULL); + execlp("/usr/bin/yawmppp.log","yawmppp.log",NULL); + exit(2); + } +} + +/* essential */ + + +/* get_statistics */ + +int +get_statistics (char *devname, long *ip, long *op, long *is, long *os) +{ + + struct ifpppstatsreq req; + struct ppp_stats ppp_cur; + + memset (&ppp_cur, 0, sizeof (ppp_cur)); + + open_ppp(); + if (!ppp_open) + return(-1); + +memset(&req,0,sizeof(req)); + +#ifdef LINUX +req.stats_ptr=(caddr_t) & req.stats; +strcpy(req.ifr__name, active_interface); +#endif + +#ifdef FREEBSD +strcpy(req.ifr_name, active_interface); +#endif + + if (ioctl(ppp_h,SIOCGPPPSTATS,&req) >= 0) + ppp_cur=req.stats; + + *op = ppp_cur.p.ppp_opackets; + *ip = ppp_cur.p.ppp_ipackets; + *is = ppp_cur.p.ppp_ibytes; + *os = ppp_cur.p.ppp_obytes; + + return 0; +} + +/* stillonline */ + +int +stillonline (char *ifs) +{ + +#ifdef LINUX + FILE *fp; + char temp[128]; +#endif +#ifdef FREEBSD + struct ifreq req; +#endif + int i=0; + +#ifdef LINUX + fp = fopen ("/proc/net/route", "r"); + if (fp) + { + while (fgets (temp, 128, fp)) + { + if (strstr (temp, ifs)) + { + i = 1; /* Line is alive */ + } + } + fclose (fp); + } +#endif + +#ifdef FREEBSD + strcpy(req.ifr_name,active_interface); + open_ppp(); + if (!ppp_open) + return 0; + if (ioctl(ppp_h,SIOCGIFFLAGS,&req)>=0) { + if (req.ifr_flags&IFF_UP) + i=1; + } +#endif + return i; +} diff --git a/yawmppp/src/ycommon.h b/yawmppp/src/ycommon.h new file mode 100644 index 0000000..9766a9d --- /dev/null +++ b/yawmppp/src/ycommon.h @@ -0,0 +1,36 @@ + +#ifndef YAWMPPP_COMMON_H +#define YAWMPPP_COMMON_H + +#define MAX_ISPS 40 + +struct LogStruct { + time_t start; + time_t end; + int status; /* 0=ok 1=error 2=crash */ + char longname[128]; + char shortname[16]; + char phone[32]; + char user[32]; +}; + +void clean_guards(void); +void make_guards(void); +void write_log(void); +void warn_pref(void); + +void open_ppp(void); +void close_ppp(void); + +void write_pid_file(void); +void remove_pid_file(void); +void make_config_dir(void); +void grab_isp_info(int rof); +void run_pref_app(void); +void run_log_app(void); + +int get_statistics (char *devname, long *ip, long *op, long *is, long *os); +int stillonline (char *ifs); + +#endif +