FreeBSD/libexec/rtld-elf/rtld.c
/*
 * Parse a file descriptor number without pulling in more of libc (e.g. atoi).
 */
Parse a file descriptor number without pulling in more of libc .
Parse a file descriptor number without pulling in more of libc .
static int
parse_libdir(const char *str)
{
	static const int RADIX = 10;  
	const char *orig;
	int fd;
	char c;
	orig = str;
	fd = 0;
	for (c = *str; c != '\0'; c = *++str) {
		if (c < '0' || c > '9')
			return (-1);
		fd *= RADIX;
		fd += c - '0';
	}
	if (str == orig) {
		_rtld_error("failed to parse directory FD from '%s'", str);
		return (-1);
	}
	return (fd);
}
static int parse_libdir ( const char * str ) { static const int RADIX = 10 ; const char * orig ; int fd ; char c ; orig = str ; fd = 0 ; for ( c = * str ; c != ' \0 ' ; c = * ++ str ) { if ( c < ' ' || c > ' ' ) return ( -1 ) ; fd *= RADIX ; fd += c - ' ' ; } if ( str == orig ) { _rtld_error ( " " , str ) ; return ( -1 ) ; } return ( fd ) ; }
Parse a file descriptor number without pulling in more of libc (e.g.
Parse a file descriptor number without pulling in more of libc ( e . g .
/* XXXJA: possibly support hex? */ /* Make sure we actually parsed something. */