From 9f69f2163178203ce5dc4abb5a909be1338ec5b0 Mon Sep 17 00:00:00 2001 From: james Date: Sun, 11 Mar 2012 11:30:50 +0000 Subject: *** empty log message *** --- src/gpt.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/gpt.c b/src/gpt.c index 564da76..4a03379 100644 --- a/src/gpt.c +++ b/src/gpt.c @@ -6,10 +6,13 @@ * */ -static char rcsid[] = "$Id: gpt.c,v 1.20 2012/03/11 11:15:50 james Exp $"; +static char rcsid[] = "$Id: gpt.c,v 1.21 2012/03/11 11:30:50 james Exp $"; /* * $Log: gpt.c,v $ + * Revision 1.21 2012/03/11 11:30:50 james + * *** empty log message *** + * * Revision 1.20 2012/03/11 11:15:50 james * *** empty log message *** * @@ -76,7 +79,7 @@ static char rcsid[] = "$Id: gpt.c,v 1.20 2012/03/11 11:15:50 james Exp $"; void usage (void) { - fprintf(stderr,"gpt %s\n",get_version()); + fprintf (stderr, "gpt %s\n", get_version ()); fprintf (stderr, "Usage:\n" "gpt -h show help\n" @@ -126,22 +129,18 @@ main (int argc, char *argv[]) switch (c) { - case 'C': - n=0; - - if (d) { - h = headers_get (d); - crc = header_calc_ent_crc (d, &h.header); - n=(crc == h.header.partition_entry_crc) ? 1:0; + case 'C': + n = 0; - if (n) { - crc = header_calc_ent_crc (d, &h.alt_header); - n=(crc == h.alt_header.partition_entry_crc) ? 1:0; - } - } + if (d) + { + h = headers_get (d); + n = header_check_crc (d, &h.header); + if (n) + n = header_check_crc (d, &h.header); + } - printf("%d\n",n); - return n?0:-1; + return n ? 0 : -1; case 'd': d = disk_open (optarg); if (!d) @@ -179,14 +178,14 @@ main (int argc, char *argv[]) h = headers_get (d); n = atoi (optarg); e = entry_read (d, &h.header, n); - printf ("%s\n", guid_to_a(e.type)); + printf ("%s\n", guid_to_a (e.type)); return 0; case 'q': if (!d) usage (); fixup (d); disk_reread_kernel_table (d); - return 0; + return 0; case 'n': if (!d) usage (); -- cgit v1.2.3