bc: convert to "G trick" - this returns bc to zero bss increase
[oweals/busybox.git] / util-linux / fdisk_sgi.c
index 0e3cff50c1085b8928258a052950cceea2a01607..0e5491a19c14e4f53febea1f3c757cbf29bda024 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) Andreas Neuper, Sep 1998.
  *
- * Licensed under GPLv2, see file LICENSE in this tarball for details.
+ * Licensed under GPLv2, see file LICENSE in this source tree.
  */
 
 #if ENABLE_FEATURE_SGI_LABEL
@@ -425,7 +425,7 @@ create_sgiinfo(void)
        /* I keep SGI's habit to write the sgilabel to the second block */
        sgilabel->directory[0].vol_file_start = SGI_SSWAP32(2);
        sgilabel->directory[0].vol_file_size = SGI_SSWAP32(sizeof(sgiinfo));
-       strncpy((char*)sgilabel->directory[0].vol_file_name, "sgilabel", 8);
+       memcpy((char*)sgilabel->directory[0].vol_file_name, "sgilabel", 8);
 }
 
 static sgiinfo *fill_sgiinfo(void);
@@ -440,7 +440,7 @@ sgi_write_table(void)
                (unsigned int*)sgilabel, sizeof(*sgilabel)) == 0);
 
        write_sector(0, sgilabel);
-       if (!strncmp((char*)sgilabel->directory[0].vol_file_name, "sgilabel", 8)) {
+       if (is_prefixed_with((char*)sgilabel->directory[0].vol_file_name, "sgilabel")) {
                /*
                 * keep this habit of first writing the "sgilabel".
                 * I never tested whether it works without (AN 981002).
@@ -504,17 +504,19 @@ verify_sgi(int verbose)
        if (sgi_get_sysid(Index[0]) == SGI_ENTIRE_DISK) {
                if ((Index[0] != 10) && verbose)
                        printf("IRIX likes when Partition 11 covers the entire disk\n");
-               if ((sgi_get_start_sector(Index[0]) != 0) && verbose)
+               if ((sgi_get_start_sector(Index[0]) != 0) && verbose) {
                        printf("The entire disk partition should start "
                                "at block 0,\n"
                                "not at diskblock %u\n",
                                sgi_get_start_sector(Index[0]));
-               if (SGI_DEBUG)      /* I do not understand how some disks fulfil it */
+               }
+               if (SGI_DEBUG) {     /* I do not understand how some disks fulfil it */
                        if ((sgi_get_num_sectors(Index[0]) != lastblock) && verbose)
                                printf("The entire disk partition is only %u diskblock large,\n"
                                        "but the disk is %u diskblocks long\n",
                                        sgi_get_num_sectors(Index[0]), lastblock);
                        lastblock = sgi_get_num_sectors(Index[0]);
+               }
        } else {
                if (verbose)
                        printf("One Partition (#11) should cover the entire disk\n");
@@ -621,7 +623,7 @@ sgi_change_sysid(int i, int sys)
                        "retrieve from its directory standalone tools like sash and fx.\n"
                        "Only the \"SGI volume\" entire disk section may violate this.\n"
                        "Type YES if you are sure about tagging this partition differently.\n");
-               if (strcmp(line_ptr, "YES\n") != 0)
+               if (strcmp(line_ptr, "YES") != 0)
                        return;
        }
        sgilabel->partitions[i].id = SGI_SSWAP32(sys);
@@ -669,16 +671,17 @@ sgi_set_volhdr(void)
        int n;
 
        for (n = 8; n < g_partitions; n++) {
-       if (!sgi_get_num_sectors(n)) {
-               /*
-                * 5 cylinders is an arbitrary value I like
-                * IRIX 5.3 stored files in the volume header
-                * (like sash, symmon, fx, ide) with ca. 3200
-                * sectors.
-                */
-               if (g_heads * g_sectors * 5 < sgi_get_lastblock())
-                       sgi_set_partition(n, 0, g_heads * g_sectors * 5, SGI_VOLHDR);
-                       break;
+               if (!sgi_get_num_sectors(n)) {
+                       /*
+                        * 5 cylinders is an arbitrary value I like
+                        * IRIX 5.3 stored files in the volume header
+                        * (like sash, symmon, fx, ide) with ca. 3200
+                        * sectors.
+                        */
+                       if (g_heads * g_sectors * 5 < sgi_get_lastblock()) {
+                               sgi_set_partition(n, 0, g_heads * g_sectors * 5, SGI_VOLHDR);
+                               break;
+                       }
                }
        }
 }