comparison motdwin.c @ 3:5a977ccbc7a9 default tip

Empty changelog
author darius
date Sat, 06 Dec 1997 05:41:29 +0000
parents
children
comparison
equal deleted inserted replaced
2:fba0b6e6cdc7 3:5a977ccbc7a9
1 /* $Id: motdwin.c,v 1.1.1.1 1997/12/06 05:41:29 darius Exp $ */
2
3 /*** Pop-up motd window code. [BDyess] 11/21/93 ***/
4
5 #include <stdio.h>
6 #include <math.h>
7 #include <signal.h>
8 #include <sys/types.h>
9 #ifdef hpux
10 #include <time.h>
11 #else /* hpux */
12 #include <sys/time.h>
13 #endif /* hpux */
14 #include "Wlib.h"
15 #include "defs.h"
16 #include "struct.h"
17 #include "data.h"
18 #include "proto.h"
19 #ifdef SVR4
20 #include <string.h>
21 #else
22 #include <strings.h>
23 #endif
24
25 void
26 motdWinEvent(key)
27 int key;
28 /* handles keystrokes in the motd window */
29 {
30 static valuesOn = 0;
31
32 switch (key) {
33 case 'f': /* scroll forward */
34 if (currpage == NULL) {
35 currpage = motddata;
36 if (currpage == NULL)
37 break;
38 }
39 if (currpage->next == NULL)
40 break;
41 if (currpage->next)
42 currpage->next->prev = currpage;
43 currpage = currpage->next;
44 showMotd(motdWin);
45 break;
46 case 'b': /* Scroll motd backward */
47 if (currpage == NULL || currpage->prev == NULL)
48 break;
49 currpage = currpage->prev;
50 showMotd(motdWin);
51 break;
52 case ' ': /* unmap window */
53 showMotdWin();
54 break;
55 case '\t': /* tab: swap between sysdef and motd */
56 W_ClearWindow(motdWin);
57 if (!valuesOn) {
58 showValues(motdWin);
59 valuesOn = 1;
60 } else {
61 showMotd(motdWin);
62 valuesOn = 0;
63 }
64 break;
65 case 'r': /* refresh */
66 if (valuesOn)
67 showValues(motdWin);
68 else
69 showMotd(motdWin);
70 break;
71 }
72 }
73
74 void
75 showMotdWin()
76 /* handles map/unmap requests */
77 {
78 if (!motdWin) {
79 motdWin = W_MakeWindow(
80 "Motd"
81 ,-BORDER, -BORDER, WINSIDE, WINSIDE, NULL,
82 (char *) 0, BORDER, foreColor);
83 W_MapWindow(motdWin);
84 currpage = motddata;
85 showMotd(motdWin);
86 } else if (W_IsMapped(motdWin)) {
87 W_UnmapWindow(motdWin);
88 } else {
89 W_MapWindow(motdWin);
90 currpage = motddata;
91 showMotd(motdWin);
92 }
93 }