aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjames <james>2012-03-11 11:30:50 +0000
committerjames <james>2012-03-11 11:30:50 +0000
commit9f69f2163178203ce5dc4abb5a909be1338ec5b0 (patch)
treec849c449fbd02f12d320a9441c283f3a367fce51
parent2da5ebdfd7cdf401d384ba25e307e68fd4c8cdc1 (diff)
downloadgpt-9f69f2163178203ce5dc4abb5a909be1338ec5b0.tar.gz
gpt-9f69f2163178203ce5dc4abb5a909be1338ec5b0.tar.bz2
gpt-9f69f2163178203ce5dc4abb5a909be1338ec5b0.zip
*** empty log message ***
-rw-r--r--src/gpt.c35
1 files 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 ();