summaryrefslogblamecommitdiff
path: root/comms/asmodem/files/patch-aa
blob: 7961efa8753488a0966fc19b0c3f22adc9b0105e (plain) (tree)
1
2
3
4
5
6
7
8
9


                                                

                        


                         
                            
                           

                        
 
                                                                                
                 







                                                            
                   









                                                                                                            
                   



                                 
                                        


                                
                     

                                        
                                                         


                                                                              
                                                       



                                                                           
                                                    


                                                        
                   



                                    
                                    
 

                              
                   







                                                                               
                   

                                

                                        
                                        


                         
                    
         
 
                       

   
                                             







                                                                               
--- asmodem.c.orig	Mon Oct  5 04:56:57 1998
+++ asmodem.c	Thu Sep 30 05:30:03 1999
@@ -25,9 +25,8 @@
 #include <sys/socket.h>
 #include <net/if.h>
 
-#include <asm/types.h>
-#include <linux/types.h>
-#include <linux/ppp_defs.h>
+#include <machine/types.h>
+#include <net/if_ppp.h>
 
 
 /* XPM struct and icons ******************************************************/
@@ -63,7 +62,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;	 
@@ -114,8 +113,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");
@@ -298,7 +297,7 @@
 {
 	XEvent Event;            
 	XpmIcon Prev;
-	struct 	ifreq     ifreq;
+	struct 	ifpppstatsreq     ifreq;
 	struct 	ppp_stats stats;
 	int  	rb, tb;
 			      
@@ -315,12 +314,12 @@
 		//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)){
+			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) {
@@ -409,7 +408,7 @@
 	int WasStatus = 1;
 	int NewMailn = 0;
 
-	MailFile = fopen(Mbox, "r");
+/*	MailFile = fopen(Mbox, "r");
 
 	while(!feof(MailFile))
 	{
@@ -425,6 +424,8 @@
 	fclose(MailFile);
 
 	return (NewMailn||!WasStatus);
+*/
+	return 0;
 }
 
 /****************************************************************************/
@@ -433,7 +434,7 @@
 	FILE* MailFile = 0;
 	int Ret = 0;            
 
-	MailFile = fopen(Mbox, "r");	
+/*	MailFile = fopen(Mbox, "r");	
 	if(MailFile == 0)
 		Ret = 0;
 	else
@@ -447,6 +448,14 @@
 	}
 
 	return Ret;    
+*/
+
+	if ((MailFile=fopen(Mbox,"r"))==NULL)
+	  return 0;
+	else {
+	  fclose(MailFile);
+	  return 1;
+	}   
 }
 
 /****************************************************************************/