Hi:

they can help me?

it was making a small script in CSH to be able to read this piece
of file:

> >   ######################
> >  # INTERFACE SETTINGS #
> > ######################
> > WAN = "xl0"
> > LAN = "xl1"
> > DMZ = "xl2"
 > webservers = "207.108.73.64/26"
> > 


/* reads line*/        
if((prueba = fgets(buffer, 1024, archivo)) != NULL)
        {
        palabra2 = strtok(buffer, salto); /* tokenized salto="\n\t" */
        /* compared */
        i = strcmp(var,palabra2); /* var="WAN" */
         if (i == 0) {
              printf("read vars...\n");
              printf("VAR1 %s\n",palabra2);
              /*read next line */
                if((linea = fgets(buffer, 1024, archivo)) != NULL) {
                       printf("find VAR %s\n", strstr(buffer,wan)); 
                        /* wan = "$WAN" */
                       paso = strstr(buffer,igual); /*igual = "=" */
                       printf("WAN: %s\n", paso);
                        }
                }
                /* read rest archive */
                printf("%s\n", palabra2);
                while( (palabra2 = strtok(NULL, salto)) != NULL) {
                        printf("Line: %s\n", palabra2);
                }
        }
    }
    while(prueba != NULL);


but...
as I can obtain in 1 string of exit "xl0" ?

thanks...


Reply via email to