patch-2.4.10 linux/arch/sparc/boot/btfixupprep.c

Next file: linux/arch/sparc/kernel/init_task.c
Previous file: linux/arch/sh/vmlinux.lds.S
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.9/linux/arch/sparc/boot/btfixupprep.c linux/arch/sparc/boot/btfixupprep.c
@@ -1,4 +1,4 @@
-/* $Id: btfixupprep.c,v 1.5 1998/09/16 12:24:55 jj Exp $
+/* $Id: btfixupprep.c,v 1.6 2001/08/22 15:27:47 davem Exp $
    Simple utility to prepare vmlinux image for sparc.
    Resolves all BTFIXUP uses and settings and creates
    a special .s object to link to the image.
@@ -88,6 +88,16 @@
 	return array + last - 1;
 }
 
+void set_mode (char *buffer)
+{
+  	for (mode = 0;; mode++)
+		if (buffer[mode] < '0' || buffer[mode] > '9')
+			break;
+	if (mode != 8 && mode != 16)
+		fatal();
+}
+
+
 int main(int argc,char **argv)
 {
 	char *p, *q;
@@ -106,14 +116,6 @@
 			goto main0;
 	fatal();
 main0:
-	if (fgets (buffer, 1024, stdin) == NULL || buffer[0] < '0' || buffer[0] > '9')
-		fatal();
-	for (mode = 0;; mode++)
-		if (buffer[mode] < '0' || buffer[mode] > '9')
-			break;
-	if (mode != 8 && mode != 16)
-		fatal();
-	
 	rellen = strlen(relrec);
 	while (fgets (buffer, 1024, stdin) != NULL)
 		if (!strncmp (buffer, relrec, rellen))
@@ -132,6 +134,8 @@
 		int nbase;
 		if (!strncmp (buffer, relrec, rellen))
 			goto main1;
+		if (mode == 0)
+			set_mode (buffer);
 		p = strchr (buffer, '\n');
 		if (p) *p = 0;
 		if (strlen (buffer) < 22+mode)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)