parse_line(buf)
int parse_line(buf)
parse_line(buf)char *buf;{	char *p, *q;	unsigned char tcall[7], tip[4];	struct hostent *he;	int i,j, uport;	unsigned int flags;	p = strtok(buf, " \t\n\r");	if(p==NULL)return 0;	if(*p=='#')return 0;	if(strcmp(p,"mycall")==0) {		q = strtok(NULL, " \t\n\r");		if(q==NULL)return -1;		if(a_to_call(q, mycallsign)!=0)return -2;		return 0;	} else if(strcmp(p,"mycall2")==0) {		q = strtok(NULL, " \t\n\r");		if(q==NULL)return -1;		if(a_to_call(q, mycallsign2)!=0)return -2;		return 0;	} else if(strcmp(p,"myalias")==0) {		q = strtok(NULL, " \t\n\r");		if(q==NULL)return -1;		if(a_to_call(q, myalias)!=0)return -2;		dual_port = 1;		if(mycallsign2[0]=='\0') {		dual_port = 0;		}		return 0;	} else if(strcmp(p,"myalias2")==0) {		q = strtok(NULL, " \t\n\r");		if(q==NULL)return -1;		if(a_to_call(q, myalias2)!=0)return -2;		return 0;	} else if(strcmp(p,"device")==0) {		q = strtok(NULL, " \t\n\r");		if(q==NULL)return -1;		strcpy(ttydevice, q);		return 0;	} else if(strcmp(p,"mode")==0) {		q = strtok(NULL, " \t\n\r");		if(q==NULL)return -1;		if(strcmp(q,"digi")==0) digi = 1;		else if(strcmp(q,"tnc")==0) digi = 0;		else return -4;		return 0;	} else if(strcmp(p,"speed")==0) {		q = strtok(NULL, " \t\n\r");		if(q==NULL)return -1;		ttyspeed = atoi(q);		return 0;	} else if(strcmp(p,"socket")==0) {		q = strtok(NULL, " \t\n\r");		if (q==NULL)			return -1;		if (strcmp(q,"ip")==0) {			ip_mode = 1;		}		else if(strcmp(q,"udp")==0) {			udp_mode = 1;			my_udp = htons(DEFAULT_UDP_PORT);			q = strtok(NULL, " \t\n\r");			if (q!=NULL) {				i = atoi(q);				if (i>0)					my_udp = htons(i);			}		}		else			return -9;		return 0;	} else if(strcmp(p,"beacon")==0) {		q = strtok(NULL, " \t\n\r");		if (q==NULL)			return -1;		if (strcmp(q,"every")==0)			bc_every = 1;		else if (strcmp(q,"after")==0)			bc_every = 0;		else			return -8;		q = strtok(NULL, " \t\n\r");		if (q==NULL)			return -1;		bc_interval = atoi(q);		return 0;/* This next one is a hack!!!!!! watch out!!!! */	} else if(strcmp(p,"btext")==0) {		q = p + strlen(p) + 1;		if(strlen(q) < 2) return -1;    /* line ends with a \n */		if(strlen(q) > sizeof bc_text)return -7;		q[strlen(q)-1]='\0';		strcpy(bc_text, q);		return 0;	} else if(strcmp(p,"loglevel")==0) {		q = strtok(NULL, " \t\n\r");		if(q==NULL)return -1;		loglevel = atoi(q);		return 0;	} else if(strcmp(p,"route")==0) {		uport = 0;		flags = 0;		q = strtok(NULL, " \t\n\r");		if(q==NULL)			return -1;		if(a_to_call(q, tcall)!=0)			return -2;		q = strtok(NULL, " \t\n\r");		if(q==NULL)			return -1;		he = gethostbyname(q);		if(he!=NULL) {			memcpy(tip, he->h_addr_list[0], 4);		} else {        /* maybe user specified a numeric addr? */			j = inet_addr(q);			if(j==-1)				return -5;     /* if -1, bad deal! */			memcpy(tip, (char *)&j, 4);		}		while((q = strtok(NULL, " \t\n\r"))!=NULL) {			if(strcmp(q,"udp")==0) {				uport = DEFAULT_UDP_PORT;				q = strtok(NULL, " \t\n\r");				if(q!=NULL) {					i = atoi(q);					if(i>0)						uport = i;				}			} else {				/* Test for broadcast flag */				if (strchr(q,'b')) {					flags|=AXRT_BCAST;				}				/* Test for Default flag */				if (strchr(q,'d')) {					flags|=AXRT_DEFAULT;				}			}		}		route_add(tip, tcall, uport, flags);		return 0;	} else if(strcmp(p,"broadcast")==0) {		while ((q = strtok(NULL, " \t\n\r"))!=NULL) {			if (a_to_call(q, tcall)!=0)				return -2;			bcast_add(tcall);		}		return 0;	} else if(strcmp(p,"param")==0) {		q = strtok(NULL, " \t\n\r");		if(q==NULL)return -1;		i = atoi(q);		q = strtok(NULL, " \t\n\r");		if(q==NULL)return -1;		j = atoi(q);		param_add(i,j);		return 0;	}	return -999;}