1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-05 22:43:24 +00:00
freebsd-ports/comms/asmodem/files/patch-aa
Satoshi Taoka 7e7b6c424c Displays the modem status, , designed to match AfterStep
PR:		ports/6598
Submitted by:	Sean Cole scole@aracnet.com
1999-03-18 05:51:46 +00:00

115 lines
3.1 KiB
Plaintext

--- asmodem-0.6/asmodem.c Mon May 11 15:38:04 1998
+++ asmodem.c Mon May 11 15:58:52 1998
@@ -22,8 +22,7 @@
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <net/if.h>
-#include <linux/ppp_defs.h>
-
+#include <net/if_ppp.h>
/* XPM struct and icons ******************************************************/
typedef struct _XpmIcon {
@@ -58,7 +57,7 @@
#define DEFINTERVAL 3 /* Default interval 2 sec */
#define TRUE 1;
#define FALSE 0;
-#define DEFAULTMODEM "/var/lock/LCK..modem"
+#define DEFAULTMODEM "/var/run/cuaa1.if"
int withdrawn= FALSE;
Display *Disp;
@@ -109,8 +108,8 @@
fprintf(stderr,"options:\n");
fprintf(stderr," -w withdrawn mode (For WindowMaker's Dock)\n");
fprintf(stderr," -s transparent edge mode\n");
- fprintf(stderr," -m <file> modem lockfile (ie /var/lock/LCK..cua1) \n");
- fprintf(stderr," default is /var/lock/LCK..modem (/dev/modem) \n");
+ fprintf(stderr," -m <file> modem lockfile (ie /var/lock/LCK..modem) \n");
+ fprintf(stderr," default is /var/run/cuaa1.if \n");
fprintf(stderr," -u <sec> update frequency (default 5 sec)\n");
fprintf(stderr," -p [+|-]x[+|-]y position of asmodem\n");
fprintf(stderr," -d <program> program to execute on click while disconnected (dial?)\n");
@@ -293,7 +292,7 @@
{
XEvent Event;
XpmIcon Prev;
- struct ifreq ifreq;
+ struct ifpppstatsreq ifreq;
struct ppp_stats stats;
int rb, tb;
@@ -309,13 +308,14 @@
}
//fprintf(stderr, "x ");
if (CarrierOn) {
- memset(&ifreq, 0, sizeof(ifreq));
- strcpy(ifreq.ifr_ifrn.ifrn_name, "ppp0");
- ifreq.ifr_ifru.ifru_data = (caddr_t)&stats;
- if ((ioctl(sock,SIOCDEVPRIVATE,(caddr_t)&ifreq) < 0)){
+ memset(&ifreq, 0, sizeof(ifreq));
+
+ strcpy(ifreq.ifr_name, "ppp0");
+ if ((ioctl(sock,SIOCGPPPSTATS,&ifreq) < 0)){
fprintf(stderr, "asmodem: ioctl f*cked\n");
prb = ptb = 0;
} else {
+ stats = ifreq.stats;
rb = stats.p.ppp_ibytes;
tb = stats.p.ppp_obytes;
if (rb > prb) {
@@ -398,14 +398,14 @@
/****************************************************************************/
int IsNewMail(char *Mbox)
{
+
FILE* MailFile;
int Ret = 0;
char Buffer[30] = "";
int WasStatus = 1;
int NewMailn = 0;
- MailFile = fopen(Mbox, "r");
-
+/* MailFile = fopen(Mbox, "r");
while(!feof(MailFile))
{
fgets(Buffer, 29, MailFile);
@@ -420,6 +420,8 @@
fclose(MailFile);
return (NewMailn||!WasStatus);
+*/
+ return 0;
}
/****************************************************************************/
@@ -427,8 +429,9 @@
{
FILE* MailFile = 0;
int Ret = 0;
+
+/* MailFile = fopen(Mbox, "r");
- MailFile = fopen(Mbox, "r");
if(MailFile == 0)
Ret = 0;
else
@@ -441,7 +444,15 @@
}
fclose(MailFile);
- return Ret;
+ return Ret;
+*/
+
+ if ((MailFile=fopen(Mbox,"r"))==NULL)
+ return 0;
+ else {
+ fclose(MailFile);
+ return 1;
+ }
}
/****************************************************************************/