Add missing libraries to examples' Makefiles
[dockapps.git] / yawmppp / src / dockapp / yawmppp.c
blob12c98869c6adf2cbaec21956c9163f71505a9502
1 /*
3 YAWMPPP - PPP dock app/helper for WindowMaker
4 Copyright (C) 2000,2001:
6 Author: Felipe Bergo (bergo@seul.org)
8 based on the wmppp application by
10 Martijn Pieterse (pieterse@xs4all.nl)
11 Antoine Nulle (warp@xs4all.nl)
13 This program is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2 of the License, or
16 (at your option) any later version.
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 $Id: yawmppp.c,v 1.1.1.1 2001/02/22 07:16:01 bergo Exp $
30 #include <stdio.h>
31 #include <stdlib.h>
32 #include <time.h>
33 #include <string.h>
34 #include <fcntl.h>
35 #include <unistd.h>
36 #include <ctype.h>
37 #include <signal.h>
39 #include <sys/wait.h>
40 #include <sys/stat.h>
41 #include <sys/param.h>
42 #include <sys/types.h>
44 #include <X11/Xlib.h>
45 #include <X11/xpm.h>
46 #include <X11/extensions/shape.h>
48 #include "wmgeneral.h"
49 #include "misc.h"
50 #include "isprc.h"
51 #include "ycommon.h"
53 #include "dockxpm.xpm"
54 #include "yawmppp.h"
56 /* external vars */
58 extern char **environ;
60 /* global variables */
62 long starttime;
64 char *ProgName;
65 char *active_interface = "ppp0";
66 int TimerDivisor = 60;
67 int updaterate = 5;
69 int dock_mask_width = 64;
70 int dock_mask_height = 64;
71 char dock_mask_bits[64 * 64];
73 int current_isp = 0;
74 int num_isps = 0;
76 int got_sched=0;
77 int caution=1;
79 struct YAWMPPP_ISP_INFO IspData[MAX_ISPS];
81 /* log data */
82 struct {
83 time_t start;
84 time_t end;
85 int status; /* 0=ok 1=error 2=crash */
86 char longname[128];
87 char shortname[16];
88 char phone[32];
89 char user[32];
90 } logconn;
92 /* PPP variables */
94 #define PPP_UNIT 0
95 int ppp_h = -1;
96 int ppp_open = 0;
98 #define PPP_STATS_HIS 54
100 int pixels_per_byte;
102 int ppp_history[PPP_STATS_HIS + 1][2];
104 /* main */
107 main (int argc, char *argv[])
110 int i;
112 /* Parse Command Line */
114 ProgName = argv[0];
115 if (strlen (ProgName) >= 5)
116 ProgName += (strlen (ProgName) - 5);
118 for (i = 1; i < argc; i++)
120 char *arg = argv[i];
122 if (*arg == '-')
124 switch (arg[1])
126 case 'c':
127 caution=1;
128 break;
129 case 'd':
130 if (strcmp (arg + 1, "display"))
132 usage ();
133 exit (1);
135 break;
136 case 'g':
137 if (strcmp (arg + 1, "geometry"))
139 usage ();
140 exit (1);
142 break;
143 case 'i':
144 if (!argv[i + 1])
146 usage ();
147 exit (1);
149 if (strncmp (argv[i + 1], "ppp", 3))
151 usage ();
152 exit (1);
154 active_interface = argv[i + 1];
155 i++;
156 break;
157 case 'p':
158 caution=2;
159 break;
160 case 't':
161 TimerDivisor = 1;
162 break;
163 case 'u':
164 i++;
165 if (!argv[i])
167 usage ();
168 exit (1);
170 updaterate = atoi (argv[i]);
171 if (updaterate < 1 || updaterate > 10)
173 usage ();
174 exit (1);
176 break;
177 case 'v':
178 printversion ();
179 exit (0);
180 break;
181 case 'z':
182 printf("Caution level: %d\n",caution);
183 break;
184 default:
185 usage ();
186 exit (0);
187 break;
192 for (i = 0; i < MAX_ISPS; i++)
193 memset(&IspData[i],0,sizeof(struct YAWMPPP_ISP_INFO));
195 make_config_dir();
196 signal(SIGUSR1,sigusr_handler);
197 signal(SIGHUP,sigusr_handler);
198 signal(SIGINT,sigusr_handler);
199 signal(SIGTERM,sigusr_handler);
201 write_pid_file();
202 clean_guards();
204 yawmppp_routine (argc, argv);
206 return 0;
209 void
210 yawmppp_routine (int argc, char **argv)
212 int i, j;
214 int but_stat;
216 long currenttime;
217 long lasttime;
218 long waittime;
219 long ppptime;
220 int hour, minute;
221 long timetolog;
223 long ppp_send, ppp_sl = -1;
224 long ppp_recv, ppp_rl = -1;
225 long ppp_sbytes, ppp_rbytes;
226 long ppp_osbytes, ppp_orbytes;
228 struct stat st;
230 pid_t stop_child = 0;
231 pid_t start_child = 0;
232 int status;
234 int isonline = 0;
236 XEvent Event;
238 int speed_ind = 10;
240 /* Initialize some stuff */
242 get_statistics (active_interface, &ppp_rl, &ppp_sl,
243 &ppp_orbytes, &ppp_osbytes);
244 if (caution>0)
245 close_ppp();
247 grab_isp_info(1);
249 /* Open the display */
251 createXBMfromXPM (dock_mask_bits, dockxpm_xpm,
252 dock_mask_width, dock_mask_height);
254 openXwindow (argc, argv, dockxpm_xpm, dock_mask_bits,
255 dock_mask_width, dock_mask_height);
257 /* V Button */
258 AddMouseRegion (0, 35, 48, 46, 58);
259 /* x Button */
260 AddMouseRegion (1, 47, 48, 58, 58);
262 /* < Button */
263 AddMouseRegion (2, 5, 48, 16, 58);
264 /* > Button */
265 AddMouseRegion (3, 17, 48, 28, 58);
266 /* ISP display */
267 AddMouseRegion (4, 5, 6, 59, 43);
269 starttime = 0;
270 currenttime = time (0);
271 ppptime = 0;
272 but_stat = -1;
273 waittime = 0;
274 timetolog=0;
276 /* 888k8 on bottom */
277 copyXPMArea (ERR_SRC_X+28, ERR_SRC_Y+9, 25, 8, ERR_DEST_X, ERR_DEST_Y);
279 DrawISPName ();
281 while (1)
283 lasttime = currenttime;
284 currenttime = time (0);
286 /* Check if any child has left the playground */
287 i = waitpid (0, &status, WNOHANG);
288 if (i == stop_child && stop_child != 0)
291 starttime = 0;
292 SetOffLED (LED_PPP_POWER);
293 SetOffLED (LED_PPP_RX);
294 SetOffLED (LED_PPP_TX);
295 /* 888k8 on bottom */
296 copyXPMArea (ERR_SRC_X+28, ERR_SRC_Y+9, 25, 8,
297 ERR_DEST_X, ERR_DEST_Y);
298 RedrawWindow ();
300 stop_child = 0;
302 if (i == start_child && start_child != 0)
304 if (WIFEXITED (status))
306 if (WEXITSTATUS (status) == 10)
309 starttime = 0;
310 /* 88k8 on bottom */
311 copyXPMArea (ERR_SRC_X+28, ERR_SRC_Y+9, 25, 8,
312 ERR_DEST_X, ERR_DEST_Y);
313 SetOffLED (LED_PPP_POWER);
314 DrawTime (0, 1);
315 RedrawWindow ();
317 start_child = 0;
321 /* On-line detectie! 1x per second */
323 if (currenttime != lasttime)
325 i = 0;
327 if (stillonline (active_interface))
329 i = 1;
330 if (!starttime)
332 starttime = currenttime;
334 if (stat (STAMP_FILE, &st) == 0)
335 starttime = st.st_mtime;
337 SetOnLED (LED_PPP_POWER);
338 waittime = 0;
340 /* 88k8 on bottom */
341 copyXPMArea (ERR_SRC_X+28, ERR_SRC_Y+9, 25, 8,
342 ERR_DEST_X, ERR_DEST_Y);
344 if (IspData[current_isp].SpeedAction)
345 DrawSpeedInd (IspData[current_isp].SpeedAction);
347 speed_ind = currenttime + 10;
349 RedrawWindow ();
352 if (!i && starttime)
354 starttime = 0;
355 SetErrLED (LED_PPP_POWER);
356 logconn.status=1;
358 /* Error */
359 copyXPMArea (ERR_SRC_X, ERR_SRC_Y+9, 25, 8,
360 ERR_DEST_X, ERR_DEST_Y);
362 if (IspData[current_isp].IfDownAction)
363 execCommand (IspData[current_isp].IfDownAction);
365 RedrawWindow ();
369 if (waittime && waittime <= currenttime)
371 SetOffLED (LED_PPP_POWER);
372 RedrawWindow ();
373 waittime = 0;
376 if ((starttime)&&(!isonline)) {
377 isonline=1;
379 logconn.start=time(NULL);
380 logconn.status=0;
381 strcpy(logconn.longname,IspData[current_isp].LongName);
382 strcpy(logconn.shortname,IspData[current_isp].ShortName);
383 strcpy(logconn.user,IspData[current_isp].User);
384 strcpy(logconn.phone,IspData[current_isp].Phone);
386 if (!strlen(logconn.shortname))
387 strcpy(logconn.shortname,"empty");
388 if (!strlen(logconn.longname))
389 strcpy(logconn.longname,"empty");
390 if (!strlen(logconn.user))
391 strcpy(logconn.user,"empty");
392 if (!strlen(logconn.phone))
393 strcpy(logconn.phone,"empty");
395 make_guards();
397 if ((!starttime)&&(isonline)) {
398 isonline=0;
399 logconn.end=time(NULL);
400 write_log();
401 if (got_sched)
402 make_delayed_update();
403 if (caution>0)
404 close_ppp();
407 /* If we are on-line. Print the time we are */
408 if (starttime)
410 i = currenttime - starttime;
412 i /= TimerDivisor;
414 if (TimerDivisor == 1)
415 if (i > 59 * 60 + 59)
416 i /= 60;
418 minute = i % 60;
419 hour = (i / 60) % 100;
420 i = hour * 100 + minute;
422 DrawTime (i, currenttime % 2);
423 /* We are online, so we can check for send/recv packets */
425 get_statistics (active_interface, &ppp_recv, &ppp_send,
426 &ppp_rbytes, &ppp_sbytes);
427 if (caution>1)
428 close_ppp();
430 if (ppp_send != ppp_sl)
431 SetOnLED (LED_PPP_TX);
432 else
433 SetOffLED (LED_PPP_TX);
435 if (ppp_recv != ppp_rl)
436 SetOnLED (LED_PPP_RX);
437 else
438 SetOffLED (LED_PPP_RX);
440 ppp_sl = ppp_send;
441 ppp_rl = ppp_recv;
443 /* Every five seconds we check to load on the line */
445 if (currenttime - timetolog >= 0) {
446 timetolog=currenttime + 60;
447 make_guards();
450 if ((currenttime - ppptime >= 0) || (ppptime == 0))
453 ppptime = currenttime + updaterate;
455 ppp_history[PPP_STATS_HIS][0] = ppp_rbytes - ppp_orbytes;
456 ppp_history[PPP_STATS_HIS][1] = ppp_sbytes - ppp_osbytes;
458 ppp_orbytes = ppp_rbytes;
459 ppp_osbytes = ppp_sbytes;
461 DrawStats (54, 17, 5, 32);
463 for (j = 1; j < 55; j++)
465 ppp_history[j - 1][0] = ppp_history[j][0];
466 ppp_history[j - 1][1] = ppp_history[j][1];
468 if (currenttime > speed_ind)
470 DrawLoadInd ((ppp_history[54][0] + ppp_history[54][1]) / updaterate);
474 RedrawWindow ();
478 while (XPending (display))
480 XNextEvent (display, &Event);
481 switch (Event.type)
483 case Expose:
484 RedrawWindow ();
485 break;
486 case DestroyNotify:
487 XCloseDisplay (display);
488 while (start_child | stop_child)
490 i = waitpid (0, &status, WNOHANG);
491 if (i == stop_child)
492 stop_child = 0;
493 if (i == start_child)
494 start_child = 0;
495 usleep (50000l);
497 exit (0);
498 break;
499 case ButtonPress:
500 i = CheckMouseRegion (Event.xbutton.x, Event.xbutton.y);
501 switch (i)
503 case 0:
504 ButtonDown (BUT_V);
505 break;
506 case 1:
507 ButtonDown (BUT_X);
508 break;
509 case 2:
510 ButtonDown (BUT_REW);
511 break;
512 case 3:
513 ButtonDown (BUT_FF);
514 break;
516 but_stat = i;
518 RedrawWindow ();
519 break;
520 case ButtonRelease:
521 i = CheckMouseRegion (Event.xbutton.x, Event.xbutton.y);
522 // Button but_stat omhoogdoen!
523 switch (but_stat)
525 case 0:
526 ButtonUp (BUT_V);
527 break;
528 case 1:
529 ButtonUp (BUT_X);
530 break;
531 case 2:
532 ButtonUp (BUT_REW);
533 break;
534 case 3:
535 ButtonUp (BUT_FF);
536 break;
539 if (i == but_stat && but_stat >= 0)
541 switch (i)
543 case 0:
544 if (!starttime)
546 /* 888k8 */
547 copyXPMArea (ERR_SRC_X+28, ERR_SRC_Y+9,
548 25, 8,
549 ERR_DEST_X, ERR_DEST_Y);
550 DrawTime (0, 1);
551 start_child = execCommand (IspData[current_isp].StartAction);
552 SetWaitLED (LED_PPP_POWER);
553 waittime = ORANGE_LED_TIMEOUT + currenttime;
556 break;
557 case 1:
558 if (stop_child == 0)
560 stop_child = execCommand (IspData[current_isp].StopAction);
562 break;
563 case 2:
564 if (!starttime)
566 current_isp--;
567 if (current_isp < 0)
568 current_isp = num_isps - 1;
569 if (current_isp < 0)
570 current_isp=0;
571 DrawISPName ();
573 break;
574 case 3:
575 if (!starttime)
577 current_isp++;
578 if (current_isp == num_isps)
579 current_isp = 0;
580 DrawISPName ();
582 break;
583 case 4:
584 if (Event.xbutton.button==Button1)
585 run_pref_app();
586 else
587 run_log_app();
588 break;
591 RedrawWindow ();
593 but_stat = -1;
594 break;
595 default:
596 break;
599 usleep (50000L);
603 /* DrawTime */
605 void
606 DrawTime (int i, int j)
609 int k = 1000;
611 copyXPMArea (TIMER_SZE_X * ((i / k) % 10) + 1, TIMER_SRC_Y,
612 5, 7,
613 TIMER_DES_X + 6 * 0, TIMER_DES_Y);
614 k = k / 10;
615 copyXPMArea (TIMER_SZE_X * ((i / k) % 10) + 1, TIMER_SRC_Y,
616 5, 7,
617 TIMER_DES_X + 6 * 1, TIMER_DES_Y);
618 k = k / 10;
620 /* colon */
621 if (j)
622 copyXPMArea (62, TIMER_SRC_Y,
623 1, 7,
624 TIMER_DES_X + 6 * 2 + 1, TIMER_DES_Y);
625 else
626 copyXPMArea (63, TIMER_SRC_Y,
627 1, 7,
628 TIMER_DES_X + 6 * 2 + 1, TIMER_DES_Y);
630 copyXPMArea (TIMER_SZE_X * ((i / k) % 10) + 1, TIMER_SRC_Y,
631 5, 7,
632 TIMER_DES_X + 6 * 2 + 4, TIMER_DES_Y);
633 k = k / 10;
634 copyXPMArea (TIMER_SZE_X * ((i / k) % 10) + 1, TIMER_SRC_Y,
635 5, 7,
636 TIMER_DES_X + 6 * 3 + 4, TIMER_DES_Y);
639 void
640 DrawStats (int num, int size, int x_left, int y_bottom)
643 int pixels_per_byte;
644 int j, k;
646 pixels_per_byte = size;
647 for (j = 0; j < num; j++)
648 if ((ppp_history[j][0]+ppp_history[j][1]) > pixels_per_byte)
649 pixels_per_byte = ppp_history[j][0] + ppp_history[j][1];
651 pixels_per_byte /= size;
653 for (k = 0; k < num; k++)
654 for (j = 0; j < size; j++)
656 if (j < (ppp_history[k][0] / pixels_per_byte))
657 copyXPMArea (58 + 2, 92, 1, 1, k + x_left, y_bottom - j);
658 else if (j < (ppp_history[k][0] + ppp_history[k][1]) / pixels_per_byte)
659 copyXPMArea (58 + 1, 92, 1, 1, k + x_left, y_bottom - j);
660 else
661 copyXPMArea (58 + 0, 92, 1, 1, k + x_left, y_bottom - j);
665 void
666 PrintLittle (int i, int *k)
669 switch (i)
671 case -1:
672 *k -= 5;
673 copyXPMArea (12 * 5, ERR_SRC_Y, 4, 8, *k, ERR_DEST_Y);
674 break;
675 case 0:
676 *k -= 5;
677 copyXPMArea (45, ERR_SRC_Y, 5, 8, *k, ERR_DEST_Y);
678 break;
679 default:
680 *k -= 5;
681 copyXPMArea (i * 5 - 5, ERR_SRC_Y, 5, 8, *k, ERR_DEST_Y);
682 break;
686 void
687 DrawSpeedInd (char *speed_action)
690 int linespeed, i, k;
691 FILE *fp;
692 char *p;
693 char temp[128];
695 fp = popen (speed_action, "r");
697 if (fp)
699 linespeed = 0;
701 while (fgets (temp, 128, fp))
704 pclose (fp);
706 if ((p = strstr (temp, "CONNECT")))
708 linespeed = atoi (p + 8);
711 k = ERR_DEST_X+25;
713 i = (linespeed % 1000) / 100;
714 linespeed /= 1000;
715 PrintLittle (i, &k);
717 k -= 5;
718 copyXPMArea (ERR_SRC_X+50, ERR_SRC_Y, 5, 8, k, ERR_DEST_Y);
722 PrintLittle (linespeed % 10, &k);
723 linespeed /= 10;
725 while (linespeed);
729 /* DrawLoadInd */
731 void
732 DrawLoadInd (int speed)
735 int i, k;
737 k = ERR_DEST_X+25;
738 for (i = 0; i < 5; i++)
739 PrintLittle (-1, &k);
741 k = ERR_DEST_X+25;
745 PrintLittle (speed % 10, &k);
746 speed /= 10;
748 while (speed);
751 /* usage */
753 void
754 usage (void)
756 fprintf (stderr,
757 "\nyawmppp - Yet Another Window Maker PPP dock applet\n\n");
758 fprintf (stderr,
759 "version %s\n\n",VERSION);
760 fprintf (stderr, "usage:\n");
761 fprintf (stderr, "-h this help screen\n");
762 fprintf (stderr, "-i <device> (ppp0, ppp1, etc)\n");
763 fprintf (stderr, "-t set the on-line timer to MM:SS instead of HH:MM\n");
764 fprintf (stderr, "-u <update rate> (1..10), default 5 seconds\n");
765 fprintf (stderr, "-v print the version number\n");
766 fprintf (stderr, "-paranoid be paranoid about open sockets\n");
767 fprintf (stderr, "\n");
770 /* printversion */
772 void
773 printversion (void)
775 fprintf (stderr, "%s\n", VERSION);
778 /* SetOnLED */
780 void
781 SetOnLED (int led)
783 switch (led)
785 case LED_PPP_POWER:
786 copyXPMArea (LED_ON_X, LED_ON_Y, LED_SZE_X, LED_SZE_Y, LED_PWR_X, LED_PWR_Y);
787 break;
788 case LED_PPP_RX:
789 copyXPMArea (ARR_DN_X, ARR_DN_Y+ARR_ACTV, ARR_W, ARR_H, LED_RCV_X, LED_RCV_Y);
790 break;
791 case LED_PPP_TX:
792 copyXPMArea (ARR_UP_X, ARR_UP_Y+ARR_ACTV, ARR_W, ARR_H, LED_SND_X, LED_SND_Y);
793 break;
797 /* SetOffLED */
799 void
800 SetOffLED (int led)
803 switch (led)
805 case LED_PPP_POWER:
806 copyXPMArea (LED_OFF_X, LED_OFF_Y, LED_SZE_X, LED_SZE_Y, LED_PWR_X, LED_PWR_Y);
807 break;
808 case LED_PPP_RX:
809 copyXPMArea (ARR_DN_X, ARR_DN_Y , ARR_W, ARR_H, LED_RCV_X, LED_RCV_Y);
810 break;
811 case LED_PPP_TX:
812 copyXPMArea (ARR_UP_X, ARR_UP_Y, ARR_W, ARR_H, LED_SND_X, LED_SND_Y);
813 break;
818 /* SetErrELD */
820 void
821 SetErrLED (int led)
824 switch (led)
826 case LED_PPP_POWER:
827 copyXPMArea (LED_ERR_X, LED_ERR_Y, LED_SZE_X, LED_SZE_Y, LED_PWR_X, LED_PWR_Y);
828 break;
832 /* SetWaitLED */
834 void
835 SetWaitLED (int led)
838 switch (led)
840 case LED_PPP_POWER:
841 copyXPMArea (LED_WTE_X, LED_WTE_Y, LED_SZE_X, LED_SZE_Y, LED_PWR_X, LED_PWR_Y);
842 break;
846 /* Button Up */
848 void
849 ButtonUp (int button)
852 switch (button)
854 case BUT_V:
855 copyXPMArea (BUT_V_SRC_X+BUT_UP_INC, BUT_V_SRC_Y,
856 12, 11,
857 BUT_V_X, BUT_V_Y);
858 break;
859 case BUT_X:
860 copyXPMArea (BUT_X_SRC_X+BUT_UP_INC, BUT_X_SRC_Y,
861 12, 11,
862 BUT_X_X, BUT_X_Y);
863 break;
864 case BUT_REW:
865 copyXPMArea (BUT_R_SRC_X+BUT_UP_INC, BUT_R_SRC_Y,
866 12, 11,
867 BUT_R_X, BUT_R_Y);
868 break;
869 case BUT_FF:
870 copyXPMArea (BUT_F_SRC_X+BUT_UP_INC, BUT_F_SRC_Y,
871 12, 11,
872 BUT_F_X, BUT_F_Y);
873 break;
877 /* Button Down */
879 void
880 ButtonDown (int button)
883 switch (button)
885 case BUT_V:
886 copyXPMArea (BUT_V_SRC_X, BUT_V_SRC_Y,
887 12, 11,
888 BUT_V_X, BUT_V_Y);
889 break;
890 case BUT_X:
891 copyXPMArea (BUT_X_SRC_X, BUT_X_SRC_Y,
892 12, 11,
893 BUT_X_X, BUT_X_Y);
894 break;
895 case BUT_REW:
896 copyXPMArea (BUT_R_SRC_X, BUT_R_SRC_Y,
897 12, 11,
898 BUT_R_X, BUT_R_Y);
899 break;
900 case BUT_FF:
901 copyXPMArea (BUT_F_SRC_X, BUT_F_SRC_Y,
902 12, 11,
903 BUT_F_X, BUT_F_Y);
904 break;
908 void
909 DrawISPName (void)
911 int i, s;
913 s = strlen (IspData[current_isp].ShortName);
914 for (i = 0; i < 5; i++)
916 if (s >= (i + 1))
917 draw_isp_char (i, IspData[current_isp].ShortName[i]);
918 else
919 draw_isp_char (i, ' ');
923 void
924 draw_isp_char (int pos, char letter)
926 int sx = 0, sy = 0, ac = 0;
928 if ((!ac) && (letter >= 'A') && (letter <= 'Z'))
930 sx = UPPER_ABC_BASE_X;
931 sy = UPPER_ABC_BASE_Y;
932 sy += 8 * ((letter - 'A') / 12);
933 sx += 5 * ((letter - 'A') % 12);
934 ac = 1;
936 if ((!ac) && (letter >= 'a') && (letter <= 'z'))
938 sx = LOWER_ABC_BASE_X;
939 sy = LOWER_ABC_BASE_Y;
940 sy += 8 * ((letter - 'a') / 12);
941 sx += 5 * ((letter - 'a') % 12);
942 ac = 1;
944 if ((!ac) && (letter >= '0') && (letter <= '9'))
946 sx = DIGIT_BASE_X;
947 sy = DIGIT_BASE_Y;
948 sx += 5 * (letter - '0');
949 ac = 1;
951 if (!ac)
953 sx = SPACE_BASE_X;
954 sy = SPACE_BASE_Y;
957 copyXPMArea (sx, sy, 4, 7, ISP_BASE_X + 5 * pos, ISP_BASE_Y);
960 void
961 sigusr_handler(int signum)
963 if (signum==SIGUSR1) {
964 if (!starttime) {
965 grab_isp_info(0);
966 if (current_isp>=num_isps)
967 current_isp=0;
968 DrawISPName();
969 RedrawWindow();
970 } else {
971 got_sched=1;
972 warn_pref();
975 else {
976 remove_pid_file();
977 exit(0);
981 void
982 make_delayed_update(void)
984 grab_isp_info(0);
985 if (current_isp>=num_isps)
986 current_isp=0;
987 DrawISPName();
988 RedrawWindow();
989 got_sched=0;