1N/A * GRUB -- GRand Unified Bootloader 1N/A * Copyright (C) 2000,2001,2002 Free Software Foundation, Inc. 1N/A * This program is free software; you can redistribute it and/or modify 1N/A * it under the terms of the GNU General Public License as published by 1N/A * the Free Software Foundation; either version 2 of the License, or 1N/A * (at your option) any later version. 1N/A * This program is distributed in the hope that it will be useful, 1N/A * but WITHOUT ANY WARRANTY; without even the implied warranty of 1N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1N/A * GNU General Public License for more details. 1N/A * You should have received a copy of the GNU General Public License 1N/A * along with this program; if not, write to the Free Software 1N/A * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 1N/A/************************************************************************** 1N/ARANDOM - compute a random number between 0 and 2147483647L or 2147483562? 1N/A**************************************************************************/ 1N/A if (!
seed)
/* Initialize linear congruential generator */ 1N/A /* simplified version of the LCG given in Bruce Schneier's 1N/A "Applied Cryptography" */ 1N/A/************************************************************************** 1N/A**************************************************************************/ 1N/A/************************************************************************** 1N/A**************************************************************************/ 1N/A/************************************************************************** 1N/A**************************************************************************/ 1N/A/************************************************************************** 1N/A**************************************************************************/ 1N/A /* Limit the maximum rate at which characters are printed */ 1N/A#
endif /* BAR_PROGRESS */ 1N/A/* Because Etherboot uses its own formats for the printf family, 1N/A define separate definitions from GRUB. */ 1N/A/************************************************************************** 1N/A %[#]x - 4 bytes long (8 hex digits, lower case) 1N/A %[#]X - 4 bytes long (8 hex digits, upper case) 1N/A %[#]hx - 2 bytes int (4 hex digits, lower case) 1N/A %[#]hX - 2 bytes int (4 hex digits, upper case) 1N/A %[#]hhx - 1 byte int (2 hex digits, lower case) 1N/A %[#]hhX - 1 byte int (2 hex digits, upper case) 1N/A - optional # prefixes 0x or 0X 1N/A %@ - Internet address in ddd.ddd.ddd.ddd notation 1N/A %! - Ethernet address in xx:xx:xx:xx:xx:xx notation 1N/A Note: width specification not supported 1N/A**************************************************************************/ 1N/A for (p = (
char *) *
dp++; *p !=
'\0'; p++)
1N/A /* Length of item is bounded */ 1N/A * Before each format q points to tmp buffer 1N/A * After each format q points past end of item 1N/A /* With x86 gcc, sizeof(long) == sizeof(int) */ 1N/A const long *
lp = (
const long *)
dp;
1N/A p = q;
/* save beginning of digits */ 1N/A *q++ =
'0' + (i %
10);
1N/A /* reverse digits, stop in middle */ 1N/A r = q;
/* don't alter q */ 1N/A const long *
lp = (
const long *)
dp;
1N/A for (r = &u.c[0]; r < &u.c[
4]; ++r)
1N/A /* now output the saved string */ 1N/A for (i = 0; i <
4; i++)
1N/A if (i !=
3 && *p++ !=
'.')
1N/A if (*p <
'0' || *p >
'9')
1N/A while (*p >=
'0' && *p <=
'9')