3 YAWMPPP - PPP dock app/helper for WindowMaker
6 Authors: Felipe Bergo (bergo@seul.org)
8 contains code from the wmppp application by
9 Martijn Pieterse (pieterse@xs4all.nl)
10 Antoine Nulle (warp@xs4all.nl)
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
34 GetISPInfo(char *rcname
,struct YAWMPPP_ISP_INFO
*wii
,int max
)
38 char temp
[512],work
[512];
40 char *tokens
=" :\n\t";
43 memset(&wii
[0],0,sizeof(struct YAWMPPP_ISP_INFO
));
51 while( fgets(temp
,128,f
) ) {
56 if (!strcmp(q
,"ISP.BEGIN")) {
57 if (num_isps
>=max
) continue;
59 /* enter ISP.BEGIN block */
60 memset(&wii
[num_isps
],0,sizeof(struct YAWMPPP_ISP_INFO
));
62 wii
[num_isps
].ppp
.override
=0;
63 wii
[num_isps
].ppp
.noipdefault
=1;
64 wii
[num_isps
].ppp
.noauth
=1;
65 wii
[num_isps
].ppp
.passive
=0;
66 wii
[num_isps
].ppp
.defaultroute
=1;
67 wii
[num_isps
].ppp
.chap
=AUTH_DONTCARE
;
68 wii
[num_isps
].ppp
.pap
=AUTH_DONTCARE
;
70 while( fgets(temp
,128,f
) ) {
75 if (!strcmp(q
,KEY_LONGNAME
)) {
76 q
=strtok(NULL
,tokens2
);
77 if (q
) strncpy(wii
[num_isps
].LongName
,q
,128);
80 if (!strcmp(q
,KEY_SHORTNAME
)) {
81 q
=strtok(NULL
,tokens2
);
82 if (q
) strncpy(wii
[num_isps
].ShortName
,q
,16);
85 if (!strcmp(q
,KEY_STARTACTION
)) {
86 q
=strtok(NULL
,tokens2
);
87 if (q
) strncpy(wii
[num_isps
].StartAction
,q
,512);
90 if (!strcmp(q
,KEY_STOPACTION
)) {
91 q
=strtok(NULL
,tokens2
);
92 if (q
) strncpy(wii
[num_isps
].StopAction
,q
,512);
95 if (!strcmp(q
,KEY_IFDOWNACTION
)) {
96 q
=strtok(NULL
,tokens2
);
97 if (q
) strncpy(wii
[num_isps
].IfDownAction
,q
,512);
100 if (!strcmp(q
,KEY_SPEEDACTION
)) {
101 q
=strtok(NULL
,tokens2
);
102 if (q
) strncpy(wii
[num_isps
].SpeedAction
,q
,512);
105 if (!strcmp(q
,KEY_PPPSTUFF
)) {
106 q
=strtok(NULL
,tokens2
);
107 if (q
) strncpy(wii
[num_isps
].PPPLine
,q
,512);
110 if (!strcmp(q
,KEY_CHATSTUFF
)) {
111 q
=strtok(NULL
,tokens2
);
112 if (q
) strncpy(wii
[num_isps
].ChatFile
,q
,512);
115 if (!strcmp(q
,KEY_USER
)) {
116 q
=strtok(NULL
,tokens2
);
117 if (q
) strncpy(wii
[num_isps
].User
,q
,32);
120 if (!strcmp(q
,KEY_PHONE
)) {
121 q
=strtok(NULL
,tokens2
);
122 if (q
) strncpy(wii
[num_isps
].Phone
,q
,32);
125 /* ppp options per ISP */
126 if (!strcmp(q
,KEY_PPP_OVER
)) {
127 q
=strtok(NULL
,tokens2
);
128 if (q
) wii
[num_isps
].ppp
.override
=atoi(q
);
131 if (!strcmp(q
,KEY_PPP_DEFAULTROUTE
)) {
132 q
=strtok(NULL
,tokens2
);
133 if (q
) wii
[num_isps
].ppp
.defaultroute
=atoi(q
);
136 if (!strcmp(q
,KEY_PPP_PASSIVE
)) {
137 q
=strtok(NULL
,tokens2
);
138 if (q
) wii
[num_isps
].ppp
.passive
=atoi(q
);
141 if (!strcmp(q
,KEY_PPP_NOAUTH
)) {
142 q
=strtok(NULL
,tokens2
);
143 if (q
) wii
[num_isps
].ppp
.noauth
=atoi(q
);
146 if (!strcmp(q
,KEY_PPP_NOIPDEFAULT
)) {
147 q
=strtok(NULL
,tokens2
);
148 if (q
) wii
[num_isps
].ppp
.noipdefault
=atoi(q
);
151 if (!strcmp(q
,KEY_PPP_CHAP
)) {
152 q
=strtok(NULL
,tokens2
);
153 if (q
) wii
[num_isps
].ppp
.chap
=atoi(q
);
156 if (!strcmp(q
,KEY_PPP_PAP
)) {
157 q
=strtok(NULL
,tokens2
);
158 if (q
) wii
[num_isps
].ppp
.pap
=atoi(q
);
161 if (!strcmp(q
,KEY_NOLOGIN
)) {
162 q
=strtok(NULL
,tokens2
);
163 if (q
) wii
[num_isps
].nologin
=atoi(q
);
166 if (!strcmp(q
,"ISP.END")) {