1515// Module Description: Save File System Function
1616*/
1717
18+ #include <string.h> /* strncmp */
1819
1920#include "format.h"
2021#include "floppy.h"
2324#include "savefs.h"
2425#include "hdisk.h" /* Force_Drive_Recheck */
2526#include "userint.h" /* Display_Percentage_Formatted */
27+ #include "msghlpr.h"
2628
27- #include <string.h> /* strncmp */
2829
2930
3031
@@ -35,10 +36,19 @@ void MMapWrite(unsigned long mmapsec, unsigned long * mmapbuf)
3536 memcpy ((void * )& sector_buffer [0 ], (void * )mmapbuf , 512 );
3637 if (debug_prog == TRUE) printf (" [map %lu] " , mmapsec );
3738 if (Drive_IO (WRITE , mmapsec , -1 ) != 0 )
38- printf ("Cannot write MIRROR MAP sector %lu - UNFORMAT spoiled!\n" ,
39+ printf (catgets ( catalog , 23 , 0 , "Cannot write MIRROR MAP sector %lu - UNFORMAT spoiled!\n" ) ,
3940 mmapsec );
4041}
4142
43+ /* detailed help screen messages */
44+ char const * const properties_not_preserved [] = {
45+ "Filesystem properties will change, cannot preserve the\n" ,
46+ "(possibly empty) old bad cluster list. Use a surface scan\n" ,
47+ "tool or FORMAT /U if you want to update the bad cluster list.\n" ,
48+ NULL
49+ };
50+
51+
4252/* Save the old file system for possible recovery with unformat */
4353/* Used for SafeFormat and MIRROR, as you might have guessed... */
4454/* *** WARNING: This only works if (...) the root directory follows *** */
@@ -113,29 +123,29 @@ void Save_File_System(int overwrite)
113123
114124 if ( BSWord (0x0b ) != 512 )
115125 {
116- printf ("Not 512 bytes / sector. Cannot save UNFORMAT data.\n" );
126+ printf (catgets ( catalog , 23 , 1 , "Not 512 bytes / sector. Cannot save UNFORMAT data.\n" ) );
117127 bad_boot_sector = TRUE;
118128 }
119129
120130 number_of_fats = sector_buffer [0x10 ];
121131 if ( (number_of_fats < 1 ) || (number_of_fats > 2 ) )
122132 {
123- printf ("Not 1 or 2 FAT copies. Cannot save UNFORMAT data.\n" );
133+ printf (catgets ( catalog , 23 , 2 , "Not 1 or 2 FAT copies. Cannot save UNFORMAT data.\n" ) );
124134 bad_boot_sector = TRUE;
125135 }
126136
127137 reserved_sectors = BSWord (0x0e );
128138 if ((param .fat_type != FAT32 ) && (reserved_sectors != 1 ))
129139 {
130- printf ("WARNING: Number of reserved / boot sectors is %u, not 1.\n" ,
140+ printf (catgets ( catalog , 23 , 3 , "WARNING: Number of reserved / boot sectors is %u, not 1.\n" ) ,
131141 reserved_sectors );
132142 if ((reserved_sectors < 1 ) || (reserved_sectors > 64 ))
133143 bad_boot_sector = TRUE;
134144 }
135145 if ((param .fat_type == FAT32 ) &&
136146 (reserved_sectors != parameter_block .bpb .reserved_sectors ))
137147 {
138- printf ("WARNING: Reserved sectors are %u but will be %u after format.\n" ,
148+ printf (catgets ( catalog , 23 , 4 , "WARNING: Reserved sectors are %u but will be %u after format.\n" ) ,
139149 reserved_sectors , parameter_block .bpb .reserved_sectors );
140150 if ((reserved_sectors < 1 ) || (reserved_sectors > 64 )) /* no ; */
141151 bad_boot_sector = TRUE;
@@ -146,18 +156,18 @@ void Save_File_System(int overwrite)
146156 (BSWord (0x16 ) == 0 ) ) /* FAT1x size zero? */
147157 && (fat_type != FAT32 ))
148158 {
149- printf (" Must be FAT32, not %s!\n" ,
159+ printf (catgets ( catalog , 23 , 5 , " Must be FAT32, not %s!\n" ) ,
150160 (fat_type == FAT12 ) ? "FAT12" : "FAT16" );
151161 /* 0 root dir entries or FAT1x size in Save_File_System */
152162
153163 nomirror_wimp : /* common bailout point avoids duplicated code (0.91p) */
154164
155- printf (" NOT saving unformat info, not preserving bad cluster list.\n" );
165+ printf (catgets ( catalog , 23 , 6 , " NOT saving unformat info, not preserving bad cluster list.\n" ) );
156166 return ;
157167 }
158168 if ( (number_of_root_directory_entries != 0 ) && (fat_type == FAT32 ) )
159169 {
160- printf ("WARNING: FAT32 with FAT1x style extra Root Directory???\n" );
170+ printf (catgets ( catalog , 23 , 7 , "WARNING: FAT32 with FAT1x style extra Root Directory???\n" ) );
161171 goto nomirror_wimp ; /* 0.91p */
162172 }
163173
@@ -172,20 +182,20 @@ void Save_File_System(int overwrite)
172182 sectors_per_fat = BSLong (0x24 );
173183 if (fat_type != FAT32 )
174184 {
175- printf (" Must be FAT32, not FAT1x!\n" );
185+ printf (catgets ( catalog , 23 , 8 , " Must be FAT32, not FAT1x!\n" ) );
176186 goto nomirror_wimp ; /* 0.91p */
177187 }
178188 }
179189 else
180190 { /* FAT1x case: 16bit sectors per fat value nonzero */
181191 if (number_of_root_directory_entries == 0 )
182192 {
183- printf (" FAT32 Root Directory but FAT1x FAT!\n" );
193+ printf (catgets ( catalog , 23 , 9 , " FAT32 Root Directory but FAT1x FAT!\n" ) );
184194 goto nomirror_wimp ; /* 0.91p */
185195 }
186196 if (fat_type != ( (sectors_per_fat <= 12 ) ? FAT12 : FAT16 ))
187197 {
188- printf (" %s size but supposed to be FAT32!\n" ,
198+ printf (catgets ( catalog , 23 , 10 , " %s size but supposed to be FAT32!\n" ) ,
189199 (sectors_per_fat <= 12 ) ? "FAT12" : "FAT16" );
190200 goto nomirror_wimp ; /* 0.91p */
191201 }
@@ -203,13 +213,13 @@ void Save_File_System(int overwrite)
203213 (sectors_per_fat < 1 ) ||
204214 (number_of_logical_sectors_on_drive < 200 ) )
205215 { /* not plausible root directory or FAT or drive size */
206- printf (" Implausible Root Directory, FAT or drive size! Bad boot sector?\n" );
216+ printf (catgets ( catalog , 23 , 11 , " Implausible Root Directory, FAT or drive size! Bad boot sector?\n" ) );
207217 bad_boot_sector = TRUE; /* -ea */
208218 } else {
209219 if ( ( 1 + sectors_per_fat + (number_of_root_directory_entries >> 4 ) +
210220 5 ) > ( number_of_logical_sectors_on_drive >> 1 ) ) /* estimate only */
211221 {
212- printf (" Big FAT for little data? Bad boot sector?\n" );
222+ printf (catgets ( catalog , 23 , 12 , " Big FAT for little data? Bad boot sector?\n" ) );
213223 bad_boot_sector = TRUE;
214224 }
215225 } /* root directory an FAT and drive size was plausible */
@@ -236,7 +246,7 @@ void Save_File_System(int overwrite)
236246 }
237247
238248 if (BSLong (0x2c ) != 2 )
239- printf ("Root Directory NOT in 1st cluster, NOT saving it!\n" );
249+ printf (catgets ( catalog , 23 , 13 , "Root Directory NOT in 1st cluster, NOT saving it!\n" ) );
240250 /* would have to change some code below to save it properly... */
241251 }
242252 else
@@ -261,7 +271,7 @@ void Save_File_System(int overwrite)
261271 /* If the boot sector is not any good, don't save the file system. */
262272 if (bad_boot_sector == TRUE)
263273 {
264- printf (" Drive looks unformatted, UNFORMAT information NOT saved.\n" );
274+ printf (catgets ( catalog , 23 , 14 , " Drive looks unformatted, UNFORMAT information NOT saved.\n" ) );
265275 /* not preserving "existing" bad cluster list either, of course! */
266276 return ;
267277 }
@@ -282,15 +292,13 @@ void Save_File_System(int overwrite)
282292 else
283293 {
284294 unsigned long scratch ;
285- printf ("Filesystem properties will change, cannot preserve the\n" );
286- printf ("(possibly empty) old bad cluster list. Use a surface scan\n" );
287- printf ("tool or FORMAT /U if you want to update the bad cluster list.\n" );
295+ Print_Messages_With_Pauses (catalog , 24 , properties_not_preserved );
288296
289297 if (reserved_sectors != parameter_block .bpb .reserved_sectors )
290- printf ("Number of reserved sectors differs: FOUND %lu / PLANNED %u.\n" ,
298+ printf (catgets ( catalog , 23 , 15 , "Number of reserved sectors differs: FOUND %lu / PLANNED %u.\n" ) ,
291299 reserved_sectors , parameter_block .bpb .reserved_sectors );
292300 if (number_of_fats != parameter_block .bpb .number_of_fats )
293- printf ("Number of FATs differs: FOUND %lu / PLANNED %hu\n" ,
301+ printf (catgets ( catalog , 23 , 16 , "Number of FATs differs: FOUND %lu / PLANNED %hu\n" ) ,
294302 number_of_fats , parameter_block .bpb .number_of_fats );
295303 if (sectors_per_cluster != BPB_SECTORS_PER_CLUSTER (parameter_block .bpb ))
296304 printf ("Cluster size differs: FOUND %lu / PLANNED %hu (sectors)\n" ,
0 commit comments