kernels/linux-2.4.0/arch/ia64/sn/io/eeprom.c
/* These functions borrow heavily from chars2* in nic.c
 */
These functions borrow heavily from chars2* in nic.c
These functions borrow heavily from chars2 * in nic . c
void copy_ascii_field( char *to, char *from, int length,
		       int change_underscore )
{
    int i;
    for( i = 0; i < length; i++ ) {
	if( from[i] == '_' && change_underscore == HYPHEN )
	    to[i] = '-';
	else if( from[i] == ':' || from[i] == ';' )
	    to[i] = '?';
	else if( (unsigned char)from[i] == (unsigned char)0xff )
	    to[i] = ' ';
	else if( from[i] < ' ' || from[i] >= 0x7f )
	    to[i] = '.';
	else
	    to[i] = from[i];
    }
    if( i == 0 ) {
	to[i] = ' '; 
	i++;
    }
    to[i] = 0;	     
}
void copy_ascii_field ( char * to , char * from , int length , int change_underscore ) { int i ; for ( i = 0 ; i < length ; i ++ ) { if ( from [ i ] == ' ' && change_underscore == HYPHEN ) to [ i ] = ' ' ; else if ( from [ i ] == ' ' || from [ i ] == ' ' ) to [ i ] = ' ' ; else if ( ( unsigned char ) from [ i ] == ( unsigned char ) 0xff ) to [ i ] = ' ' ; else if ( from [ i ] < ' ' || from [ i ] >= 0x7f ) to [ i ] = ' ' ; else to [ i ] = from [ i ] ; } if ( i == 0 ) { to [ i ] = ' ' ; i ++ ; } to [ i ] = 0 ; }
These functions borrow heavily from chars2* in nic.c
These functions borrow heavily from chars2 * in nic . c
/* change underscores to hyphens if requested */ /* ; and ; are separators, so mustn't appear within
	 * a field */ /* I'm not sure why or if ASCII character 0xff would
	 * show up in an EEPROM field, but the NIC parsing
	 * routines wouldn't like it if it did... so we
	 * get rid of it, just in case. */ /* unprintable characters are replaced with . */ /* otherwise, just copy the character */ /* return at least a space... */ /* terminating null */