1: /*----LENSTR----Calculate length of a string as the number 2: of characters before a null byte or the total length of the 3: string less any blanks on the right end. 4: PLWard, USGS, Menlo Park 2/19/80 5: */ 6: 7: int lenstr_(string,length) char string[]; long length; 8: { 9: int i; 10: for(i=0; i<length && string[i] != '\0'; i++); 11: if (i == length) for( ; i > 0 && string[i-1] == ' ';i--); 12: return(i); 13: }