Line 0
Link Here
|
|
|
1 |
--- apps/asmodem/asmodem.c Mon May 11 15:38:04 1998 |
2 |
+++ apps/asmodem/asmodem.c Mon May 11 15:58:52 1998 |
3 |
@@ -22,8 +22,7 @@ |
4 |
#include <sys/ioctl.h> |
5 |
#include <sys/socket.h> |
6 |
#include <net/if.h> |
7 |
-#include <linux/ppp_defs.h> |
8 |
- |
9 |
+#include <net/if_ppp.h> |
10 |
|
11 |
/* XPM struct and icons ******************************************************/ |
12 |
typedef struct _XpmIcon { |
13 |
@@ -58,7 +57,7 @@ |
14 |
#define DEFINTERVAL 3 /* Default interval 2 sec */ |
15 |
#define TRUE 1; |
16 |
#define FALSE 0; |
17 |
-#define DEFAULTMODEM "/var/lock/LCK..modem" |
18 |
+#define DEFAULTMODEM "/var/run/cuaa1.if" |
19 |
|
20 |
int withdrawn= FALSE; |
21 |
Display *Disp; |
22 |
@@ -109,8 +108,8 @@ |
23 |
fprintf(stderr,"options:\n"); |
24 |
fprintf(stderr," -w withdrawn mode (For WindowMaker's Dock)\n"); |
25 |
fprintf(stderr," -s transparent edge mode\n"); |
26 |
- fprintf(stderr," -m <file> modem lockfile (ie /var/lock/LCK..cua1) \n"); |
27 |
- fprintf(stderr," default is /var/lock/LCK..modem (/dev/modem) \n"); |
28 |
+ fprintf(stderr," -m <file> modem lockfile (ie /var/lock/LCK..modem) \n"); |
29 |
+ fprintf(stderr," default is /var/run/cuaa1.if \n"); |
30 |
fprintf(stderr," -u <sec> update frequency (default 5 sec)\n"); |
31 |
fprintf(stderr," -p [+|-]x[+|-]y position of asmodem\n"); |
32 |
fprintf(stderr," -d <program> program to execute on click while disconnected (dial?)\n"); |
33 |
@@ -293,7 +292,7 @@ |
34 |
{ |
35 |
XEvent Event; |
36 |
XpmIcon Prev; |
37 |
- struct ifreq ifreq; |
38 |
+ struct ifpppstatsreq ifreq; |
39 |
struct ppp_stats stats; |
40 |
int rb, tb; |
41 |
|
42 |
@@ -309,13 +308,14 @@ |
43 |
} |
44 |
//fprintf(stderr, "x "); |
45 |
if (CarrierOn) { |
46 |
- memset(&ifreq, 0, sizeof(ifreq)); |
47 |
- strcpy(ifreq.ifr_ifrn.ifrn_name, "ppp0"); |
48 |
- ifreq.ifr_ifru.ifru_data = (caddr_t)&stats; |
49 |
- if ((ioctl(sock,SIOCDEVPRIVATE,(caddr_t)&ifreq) < 0)){ |
50 |
+ memset(&ifreq, 0, sizeof(ifreq)); |
51 |
+ |
52 |
+ strcpy(ifreq.ifr_name, "ppp0"); |
53 |
+ if ((ioctl(sock,SIOCGPPPSTATS,&ifreq) < 0)){ |
54 |
fprintf(stderr, "asmodem: ioctl f*cked\n"); |
55 |
prb = ptb = 0; |
56 |
} else { |
57 |
+ stats = ifreq.stats; |
58 |
rb = stats.p.ppp_ibytes; |
59 |
tb = stats.p.ppp_obytes; |
60 |
if (rb > prb) { |
61 |
@@ -398,14 +398,14 @@ |
62 |
/****************************************************************************/ |
63 |
int IsNewMail(char *Mbox) |
64 |
{ |
65 |
+ |
66 |
FILE* MailFile; |
67 |
int Ret = 0; |
68 |
char Buffer[30] = ""; |
69 |
int WasStatus = 1; |
70 |
int NewMailn = 0; |
71 |
|
72 |
- MailFile = fopen(Mbox, "r"); |
73 |
- |
74 |
+/* MailFile = fopen(Mbox, "r"); |
75 |
while(!feof(MailFile)) |
76 |
{ |
77 |
fgets(Buffer, 29, MailFile); |
78 |
@@ -420,6 +420,8 @@ |
79 |
fclose(MailFile); |
80 |
|
81 |
return (NewMailn||!WasStatus); |
82 |
+*/ |
83 |
+ return 0; |
84 |
} |
85 |
|
86 |
/****************************************************************************/ |
87 |
@@ -427,8 +429,9 @@ |
88 |
{ |
89 |
FILE* MailFile = 0; |
90 |
int Ret = 0; |
91 |
+ |
92 |
+/* MailFile = fopen(Mbox, "r"); |
93 |
|
94 |
- MailFile = fopen(Mbox, "r"); |
95 |
if(MailFile == 0) |
96 |
Ret = 0; |
97 |
else |
98 |
@@ -441,7 +444,15 @@ |
99 |
} |
100 |
fclose(MailFile); |
101 |
|
102 |
- return Ret; |
103 |
+ return Ret; |
104 |
+*/ |
105 |
+ |
106 |
+ if ((MailFile=fopen(Mbox,"r"))==NULL) |
107 |
+ return 0; |
108 |
+ else { |
109 |
+ fclose(MailFile); |
110 |
+ return 1; |
111 |
+ } |
112 |
} |
113 |
|
114 |
/****************************************************************************/ |