Annotation of coherent/b/conf/convert/lsys/getACU.c, revision 1.1

1.1     ! root        1: /* getACU(): get the ACU entry from L-devices and store the name of the
        !             2:  *     line used by ACU. We need this because an L.sys entry specifies
        !             3:  *     a device ONLY when a direct connection is used, but ACU is used
        !             4:  *     when a modem is described.
        !             5:  */
        !             6: 
        !             7: #include <stdio.h>
        !             8: #include <ctype.h>
        !             9: 
        !            10: extern char acudev[];
        !            11: #define LDEV   "/usr/lib/uucp/L-devices"
        !            12: 
        !            13: getACU() 
        !            14: {
        !            15:        FILE *ldevin;
        !            16:        char ldevline[80];      
        !            17:        char *ldevptr;
        !            18:        char *lineptr;
        !            19: 
        !            20:        strcpy(acudev,"");
        !            21:        if( (ldevin = fopen(LDEV,"r")) == NULL){
        !            22:                printf("Error opening %s\n",LDEV);
        !            23:                exit(1);
        !            24:        }
        !            25: 
        !            26:        while( (fgets(ldevline,sizeof(ldevline),ldevin)) != NULL){
        !            27:                if(ldevline[0] != '#' && (ldevptr = strstr(ldevline, "ACU"))){  /* found ACU line */
        !            28:                        ldevptr += 3;           /* skip ACU field */
        !            29:                        lineptr = acudev;       
        !            30: 
        !            31:                        while(isspace(*ldevptr))
        !            32:                                ldevptr++;      /* skip whitespace */
        !            33: 
        !            34:                        while(!isspace(*ldevptr)){
        !            35:                                *lineptr++ = *ldevptr++;
        !            36:                        }
        !            37:                        *lineptr = '\0';
        !            38: #ifdef DEBUG
        !            39:                        printf("ACU device is %s\n",acudev);
        !            40: #endif
        !            41:                        fclose(ldevin);
        !            42:                        return(0);
        !            43:                }
        !            44:        }
        !            45: 
        !            46:        printf("Warning! No ACU entry found in L-devices\n");
        !            47:        acudev[0] = '\0';
        !            48:        fclose(ldevin);
        !            49:        return(0);
        !            50: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.