Imported Upstream version 4.0.43
[platform/upstream/mtools.git] / mpartition.c
index fa660f8..56e2b6a 100644 (file)
@@ -19,9 +19,7 @@
 #define DONT_NEED_WAIT
 
 #include "sysincludes.h"
-#include "msdos.h"
 #include "mtools.h"
-#include "mainloop.h"
 #include "fsP.h"
 #include "file.h"
 #include "plain_io.h"
@@ -379,7 +377,7 @@ void mpartition(int argc, char **argv, int dummy UNUSEDP)
                                break;
                        case 'l':
                                size_set = 1;
-                               length = strtoui(optarg, &endptr, 0);
+                               length = parseSize(optarg);
                                break;
 
                        default:
@@ -442,7 +440,7 @@ void mpartition(int argc, char **argv, int dummy UNUSEDP)
                tot_sectors = used_dev.tot_sectors;
 
                /* read the partition table */
-               if (READS(Stream, (char *) buf, 0, 512) != 512 && !initialize){
+               if (PREADS(Stream, (char *) buf, 0, 512) != 512 && !initialize){
 #ifdef HAVE_SNPRINTF
                        snprintf(errmsg, sizeof(errmsg)-1,
                                "Error reading from '%s', wrong parameters?",
@@ -658,7 +656,7 @@ void mpartition(int argc, char **argv, int dummy UNUSEDP)
                printf("The following command will recreate the partition for drive %c:\n",
                       drive);
                used_dev.tracks =
-                       (_DWORD(tpartition->nr_sects) +
+                       (DWORD(tpartition->nr_sects) +
                         (BEGIN(tpartition) % sec_per_cyl)) /
                        sec_per_cyl;
                printf("mpartition -c -b %d -l %d -t %d -h %d -s %d -b %u %c:\n",
@@ -671,7 +669,7 @@ void mpartition(int argc, char **argv, int dummy UNUSEDP)
                /* write data back to the disk */
                if(verbose>=2)
                        print_sector("Writing sector", buf, 512);
-               if (WRITES(Stream, (char *) buf, 0, 512) != 512) {
+               if (PWRITES(Stream, (char *) buf, 0, 512) != 512) {
                        fprintf(stderr,"Error writing partition table");
                        exit(1);
                }