2 // "$Id: connect.cxx 7913 2010-11-29 18:18:27Z greg.ercolano $"
4 // PPP example program for the Fast Light Tool Kit (FLTK).
6 // Program to make a button to turn a ppp connection on/off.
7 // You must chmod +s /usr/sbin/pppd, and put all the options
8 // into /etc/ppp/options.
10 // Copyright 1998-2010 by Bill Spitzak and others.
12 // This library is free software; you can redistribute it and/or
13 // modify it under the terms of the GNU Library General Public
14 // License as published by the Free Software Foundation; either
15 // version 2 of the License, or (at your option) any later version.
17 // This library is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 // Library General Public License for more details.
22 // You should have received a copy of the GNU Library General Public
23 // License along with this library; if not, write to the Free Software
24 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
27 // Please report all bugs and problems on the following page:
29 // http://www.fltk.org/str.php
39 #include <FL/Fl_Window.H>
40 #include <FL/Fl_Toggle_Button.H>
42 int running
; // actually the pid
43 Fl_Toggle_Button
*Button
;
46 waitpid(running
, 0, 0);
51 void cb(Fl_Widget
*o
, void *) {
52 if (((Fl_Toggle_Button
*)o
)->value()) {
55 if (!running
) execl("/usr/sbin/pppd","pppd","-detach",0);
56 else signal(SIGCHLD
, sigchld
);
59 kill(running
, SIGINT
);
60 waitpid(running
, 0, 0);
65 int main(int argc
, char ** argv
) {
66 Fl_Window
window(100,50);
67 Fl_Toggle_Button
button(0,0,100,50,"Connect");
70 button
.callback(cb
,0);
71 window
.show(argc
,argv
);
76 // End of "$Id: connect.cxx 7913 2010-11-29 18:18:27Z greg.ercolano $".