-commit d4e1180 (HEAD, origin/master, origin/HEAD, master)
+commit 2c88f35 (HEAD, origin/master, origin/HEAD, master)
+Author: Daniel Baumann <mail@daniel-baumann.ch>
+Date: Tue Jun 11 18:44:50 2013 +0200
+
+ Running indent on source files.
+
+ Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
+
+commit d495d43
+Author: Daniel Baumann <mail@daniel-baumann.ch>
+Date: Tue Jun 11 18:41:41 2013 +0200
+
+ Using memcpy instead of strcpy to fix segfault with fortify, thanks to Dave Reisner <falconindy@jabber.org>.
+
+ Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
+
+commit 9fb4ffc
+Author: Daniel Baumann <mail@daniel-baumann.ch>
+Date: Sun Jun 9 13:17:16 2013 +0200
+
+ Correcting fsck.fat spelling error in manpages, thanks to E.J.M. Hartman <E.J.M.Hartman@tudelft.nl>.
+
+ Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
+
+commit 2d8ef9b (tag: v3.0.18)
+Author: Daniel Baumann <mail@daniel-baumann.ch>
+Date: Thu Jun 6 09:49:00 2013 +0200
+
+ Releasing version 3.0.18.
+
+ Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
+
+commit d4e1180
Author: Daniel Baumann <mail@daniel-baumann.ch>
Date: Thu Jun 6 09:38:45 2013 +0200
.\" This file was generated with po4a. Translate the source file.
.\"
.\"*******************************************************************
-.TH FATLABEL 8 2013\-06\-06 3.0.18 dosfstools
+.TH FATLABEL 8 2013\-06\-11 3.0.19 dosfstools
.SH NAME
\fBfatlabel\fP \- set or get MS\-DOS filesystem label
-.\" fsc.fat.8 - manpage for fsc.fat
+.\" fsck.fat.8 - manpage for fsck.fat
.\"
.\" Copyright (C) 2006-2013 Daniel Baumann <daniel@debian.org>
.\"
.\" This file was generated with po4a. Translate the source file.
.\"
.\"*******************************************************************
-.TH FSCK.FAT 8 2013\-06\-06 3.0.18 dosfstools
+.TH FSCK.FAT 8 2013\-06\-11 3.0.19 dosfstools
.SH NAME
-\fBfsc.fat\fP \- check and repair MS\-DOS filesystems
+\fBfsck.fat\fP \- check and repair MS\-DOS filesystems
.SH SYNOPSIS
-\fBfsc.fat\fP|\fBfsck.msdos\fP|\fBfsck.vfat\fP [\-aAflnrtvVwy] [\-d \fIPATH\fP \-d\ \fI...\fP]
-[\-u\ \fIPATH\fP \-u \fI...\fP] \fIDEVICE\fP
+\fBfsck.fat\fP|\fBfsck.msdos\fP|\fBfsck.vfat\fP [\-aAflnrtvVwy] [\-d \fIPATH\fP \-d\ \&\fI...\fP] [\-u\ \fIPATH\fP \-u \fI...\fP] \fIDEVICE\fP
.SH DESCRIPTION
-\fBfsc.fat\fP verifies the consistency of MS\-DOS filesystems and optionally
+\fBfsck.fat\fP verifies the consistency of MS\-DOS filesystems and optionally
tries to repair them.
.PP
The following filesystem problems can be corrected (in this order):
.IP * 4
Absence of . and .. entries in non\-root directories
.PP
-When \fBfsc.fat\fP checks a filesystem, it accumulates all changes in memory
+When \fBfsck.fat\fP checks a filesystem, it accumulates all changes in memory
and performs them only after all checks are complete. This can be disabled
with the \fB\-w\fP option.
necessary. Whenever there is more than one method to solve a problem, the
least destructive approach is used.
.IP \fB\-A\fP 4
-Use Atari variation of the MS\-DOS filesystem. This is default if \fBfsc.fat\fP
+Use Atari variation of the MS\-DOS filesystem. This is default if \fBfsck.fat\fP
is run on an Atari, then this option turns off Atari format. There are some
minor differences in Atari format: Some boot sector fields are interpreted
slightly different, and the special FAT entries for end\-of\-file and bad
.IP \fB\-t\fP 4
Mark unreadable clusters as bad.
.IP \fB\-u\fP 4
-Try to undelete the specified file. \fBfsc.fat\fP tries to allocate a chain of
+Try to undelete the specified file. \fBfsck.fat\fP tries to allocate a chain of
contiguous unallocated clusters beginning with the start cluster of the
undeleted file.
.IP \fB\-v\fP 4
.IP 0 4
No recoverable errors have been detected.
.IP 1 4
-Recoverable errors have been detected or \fBfsc.fat\fP has discovered an
+Recoverable errors have been detected or \fBfsck.fat\fP has discovered an
internal inconsistency.
.IP 2 4
-Usage error. \fBfsc.fat\fP did not access the filesystem.
+Usage error. \fBfsck.fat\fP did not access the filesystem.
.SH FILES
.IP "fsck0000.rec, fsck0001.rec, ..." 4
-When recovering from a corrupted filesystem, \fBfsc.fat\fP dumps recovered data
-into files named 'fsckNNNN.rec' in the top level directory of the
+When recovering from a corrupted filesystem, \fBfsck.fat\fP dumps recovered
+data into files named 'fsckNNNN.rec' in the top level directory of the
filesystem.
.SH BUGS
.\" This file was generated with po4a. Translate the source file.
.\"
.\"*******************************************************************
-.TH MKFS.FAT 8 2013\-06\-06 3.0.18 dosfstools
+.TH MKFS.FAT 8 2013\-06\-11 3.0.19 dosfstools
.SH NAME
\fBmkfs.fat\fP \- create an MS\-DOS file system under Linux
.SH SYNOPSIS
.\" can be found in /usr/share/common-licenses/GPL-3 file.
.\"
.\"
-.TH FATLABEL 8 2013\-06\-06 3.0.18 "dosfstools"
+.TH FATLABEL 8 2013\-06\-11 3.0.19 "dosfstools"
.SH NAME
\fBfatlabel\fR \- set or get MS\-DOS filesystem label
-.\" fsc.fat.8 - manpage for fsc.fat
+.\" fsck.fat.8 - manpage for fsck.fat
.\"
.\" Copyright (C) 2006-2013 Daniel Baumann <daniel@debian.org>
.\"
.\" can be found in /usr/share/common-licenses/GPL-3 file.
.\"
.\"
-.TH FSCK.FAT 8 2013\-06\-06 3.0.18 "dosfstools"
+.TH FSCK.FAT 8 2013\-06\-11 3.0.19 "dosfstools"
.SH NAME
-\fBfsc.fat\fR \- check and repair MS\-DOS filesystems
+\fBfsck.fat\fR \- check and repair MS\-DOS filesystems
.SH SYNOPSIS
-\fBfsc.fat\fR|\fBfsck.msdos\fR|\fBfsck.vfat\fR [\-aAflnrtvVwy] [\-d \fIPATH\fR \-d\ \fI...\fR] [\-u\ \fIPATH\fR \-u \fI...\fR] \fIDEVICE\fR
+\fBfsck.fat\fR|\fBfsck.msdos\fR|\fBfsck.vfat\fR [\-aAflnrtvVwy] [\-d \fIPATH\fR \-d\ \fI...\fR] [\-u\ \fIPATH\fR \-u \fI...\fR] \fIDEVICE\fR
.SH DESCRIPTION
-\fBfsc.fat\fR verifies the consistency of MS\-DOS filesystems and optionally tries to repair them.
+\fBfsck.fat\fR verifies the consistency of MS\-DOS filesystems and optionally tries to repair them.
.PP
The following filesystem problems can be corrected (in this order):
.IP "*" 4
.IP "*" 4
Absence of . and .. entries in non\-root directories
.PP
-When \fBfsc.fat\fR checks a filesystem, it accumulates all changes in memory and performs them only after all checks are complete. This can be disabled with the \fB\-w\fR option.
+When \fBfsck.fat\fR checks a filesystem, it accumulates all changes in memory and performs them only after all checks are complete. This can be disabled with the \fB\-w\fR option.
.SH OPTIONS
.IP "\fB\-a\fR" 4
Automatically repair the filesystem. No user intervention is necessary. Whenever there is more than one method to solve a problem, the least destructive approach is used.
.IP "\fB\-A\fR" 4
-Use Atari variation of the MS\-DOS filesystem. This is default if \fBfsc.fat\fR is run on an Atari, then this option turns off Atari format. There are some minor differences in Atari format: Some boot sector fields are interpreted slightly different, and the special FAT entries for end\-of\-file and bad cluster can be different. Under MS\-DOS 0xfff8 is used for EOF and Atari employs 0xffff by default, but both systems recognize all values from 0xfff8...0xffff as end\-of\-file. MS\-DOS uses only 0xfff7 for bad clusters, where on Atari values 0xfff0...0xfff7 are for this purpose (but the standard value is still 0xfff7).
+Use Atari variation of the MS\-DOS filesystem. This is default if \fBfsck.fat\fR is run on an Atari, then this option turns off Atari format. There are some minor differences in Atari format: Some boot sector fields are interpreted slightly different, and the special FAT entries for end\-of\-file and bad cluster can be different. Under MS\-DOS 0xfff8 is used for EOF and Atari employs 0xffff by default, but both systems recognize all values from 0xfff8...0xffff as end\-of\-file. MS\-DOS uses only 0xfff7 for bad clusters, where on Atari values 0xfff0...0xfff7 are for this purpose (but the standard value is still 0xfff7).
.IP "\fB-b\fR" 4
Make read-only boot sector check.
.IP "\fB\-d\fR" 4
.IP "\fB\-t\fR" 4
Mark unreadable clusters as bad.
.IP "\fB\-u\fR" 4
-Try to undelete the specified file. \fBfsc.fat\fR tries to allocate a chain of contiguous unallocated clusters beginning with the start cluster of the undeleted file.
+Try to undelete the specified file. \fBfsck.fat\fR tries to allocate a chain of contiguous unallocated clusters beginning with the start cluster of the undeleted file.
.IP "\fB\-v\fR" 4
Verbose mode. Generates slightly more output.
.IP "\fB\-V\fR" 4
.IP "0" 4
No recoverable errors have been detected.
.IP "1" 4
-Recoverable errors have been detected or \fBfsc.fat\fR has discovered an internal inconsistency.
+Recoverable errors have been detected or \fBfsck.fat\fR has discovered an internal inconsistency.
.IP "2" 4
-Usage error. \fBfsc.fat\fR did not access the filesystem.
+Usage error. \fBfsck.fat\fR did not access the filesystem.
.SH FILES
.IP "fsck0000.rec, fsck0001.rec, ..." 4
-When recovering from a corrupted filesystem, \fBfsc.fat\fR dumps recovered data into files named 'fsckNNNN.rec' in the top level directory of the filesystem.
+When recovering from a corrupted filesystem, \fBfsck.fat\fR dumps recovered data into files named 'fsckNNNN.rec' in the top level directory of the filesystem.
.SH BUGS
Does not create . and .. files where necessary. Does not remove entirely empty directories. Should give more diagnostic messages. Undeleting files should use a more sophisticated algorithm.
.\" can be found in /usr/share/common-licenses/GPL-3 file.
.\"
.\"
-.TH MKFS.FAT 8 2013\-06\-06 3.0.18 "dosfstools"
+.TH MKFS.FAT 8 2013\-06\-11 3.0.19 "dosfstools"
.SH NAME
.B mkfs.fat
\- create an MS-DOS file system under Linux
msgid ""
msgstr ""
"Project-Id-Version: dosfstools VERSION\n"
-"POT-Creation-Date: 2013-06-06 09:34+0300\n"
+"POT-Creation-Date: 2013-06-11 18:45+0300\n"
"PO-Revision-Date: 2013-06-06 09:34+0300\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
#. type: TH
#: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22
#, no-wrap
-msgid "2013-06-06"
+msgid "2013-06-11"
msgstr ""
#. type: TH
#: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22
#, no-wrap
-msgid "3.0.18"
+msgid "3.0.19"
msgstr ""
#. type: TH
msgid ""
msgstr ""
"Project-Id-Version: dosfstools VERSION\n"
-"POT-Creation-Date: 2013-06-06 09:34+0300\n"
+"POT-Creation-Date: 2013-06-11 18:45+0300\n"
"PO-Revision-Date: 2013-06-06 09:34+0300\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
#. type: TH
#: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22
#, no-wrap
-msgid "2013-06-06"
+msgid "2013-06-11"
msgstr ""
#. type: TH
#: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22
#, no-wrap
-msgid "3.0.18"
+msgid "3.0.19"
msgstr ""
#. type: TH
#. type: Plain text
#: en/fsck.fat.8:26
-msgid "B<fsc.fat> - check and repair MS-DOS filesystems"
+msgid "B<fsck.fat> - check and repair MS-DOS filesystems"
msgstr ""
#. type: Plain text
#: en/fsck.fat.8:29
msgid ""
-"B<fsc.fat>|B<fsck.msdos>|B<fsck.vfat> [-aAflnrtvVwy] [-d I<PATH> -d\\ I<..."
+"B<fsck.fat>|B<fsck.msdos>|B<fsck.vfat> [-aAflnrtvVwy] [-d I<PATH> -d\\ I<..."
">] [-u\\ I<PATH> -u I<...>] I<DEVICE>"
msgstr ""
#. type: Plain text
#: en/fsck.fat.8:32
msgid ""
-"B<fsc.fat> verifies the consistency of MS-DOS filesystems and optionally "
+"B<fsck.fat> verifies the consistency of MS-DOS filesystems and optionally "
"tries to repair them."
msgstr ""
#. type: Plain text
#: en/fsck.fat.8:76
msgid ""
-"When B<fsc.fat> checks a filesystem, it accumulates all changes in memory "
+"When B<fsck.fat> checks a filesystem, it accumulates all changes in memory "
"and performs them only after all checks are complete. This can be disabled "
"with the B<-w> option."
msgstr ""
#. type: Plain text
#: en/fsck.fat.8:82
msgid ""
-"Use Atari variation of the MS-DOS filesystem. This is default if B<fsc.fat> "
+"Use Atari variation of the MS-DOS filesystem. This is default if B<fsck.fat> "
"is run on an Atari, then this option turns off Atari format. There are some "
"minor differences in Atari format: Some boot sector fields are interpreted "
"slightly different, and the special FAT entries for end-of-file and bad "
#. type: Plain text
#: en/fsck.fat.8:100
msgid ""
-"Try to undelete the specified file. B<fsc.fat> tries to allocate a chain of "
+"Try to undelete the specified file. B<fsck.fat> tries to allocate a chain of "
"contiguous unallocated clusters beginning with the start cluster of the "
"undeleted file."
msgstr ""
#. type: Plain text
#: en/fsck.fat.8:116
msgid ""
-"Recoverable errors have been detected or B<fsc.fat> has discovered an "
+"Recoverable errors have been detected or B<fsck.fat> has discovered an "
"internal inconsistency."
msgstr ""
#. type: Plain text
#: en/fsck.fat.8:118
-msgid "Usage error. B<fsc.fat> did not access the filesystem."
+msgid "Usage error. B<fsck.fat> did not access the filesystem."
msgstr ""
#. type: SH
#. type: Plain text
#: en/fsck.fat.8:122
msgid ""
-"When recovering from a corrupted filesystem, B<fsc.fat> dumps recovered data "
-"into files named 'fsckNNNN.rec' in the top level directory of the filesystem."
+"When recovering from a corrupted filesystem, B<fsck.fat> dumps recovered "
+"data into files named 'fsckNNNN.rec' in the top level directory of the "
+"filesystem."
msgstr ""
#. type: SH
msgid ""
msgstr ""
"Project-Id-Version: dosfstools VERSION\n"
-"POT-Creation-Date: 2013-06-06 09:34+0300\n"
+"POT-Creation-Date: 2013-06-11 18:45+0300\n"
"PO-Revision-Date: 2013-06-06 09:34+0300\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
#. type: TH
#: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22
#, no-wrap
-msgid "2013-06-06"
+msgid "2013-06-11"
msgstr ""
#. type: TH
#: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22
#, no-wrap
-msgid "3.0.18"
+msgid "3.0.19"
msgstr ""
#. type: TH
msgid ""
msgstr ""
"Project-Id-Version: dosfstools VERSION\n"
-"POT-Creation-Date: 2013-06-06 09:34+0300\n"
+"POT-Creation-Date: 2013-06-11 18:45+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
#. type: TH
#: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22
#, no-wrap
-msgid "2013-06-06"
+msgid "2013-06-11"
msgstr ""
#. type: TH
#: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22
#, no-wrap
-msgid "3.0.18"
+msgid "3.0.19"
msgstr ""
#. type: TH
msgid ""
msgstr ""
"Project-Id-Version: dosfstools VERSION\n"
-"POT-Creation-Date: 2013-06-06 09:34+0300\n"
+"POT-Creation-Date: 2013-06-11 18:45+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
#. type: TH
#: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22
#, no-wrap
-msgid "2013-06-06"
+msgid "2013-06-11"
msgstr ""
#. type: TH
#: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22
#, no-wrap
-msgid "3.0.18"
+msgid "3.0.19"
msgstr ""
#. type: TH
#. type: Plain text
#: en/fsck.fat.8:26
-msgid "B<fsc.fat> - check and repair MS-DOS filesystems"
+msgid "B<fsck.fat> - check and repair MS-DOS filesystems"
msgstr ""
#. type: Plain text
#: en/fsck.fat.8:29
msgid ""
-"B<fsc.fat>|B<fsck.msdos>|B<fsck.vfat> [-aAflnrtvVwy] [-d I<PATH> -d\\ I<..."
+"B<fsck.fat>|B<fsck.msdos>|B<fsck.vfat> [-aAflnrtvVwy] [-d I<PATH> -d\\ I<..."
">] [-u\\ I<PATH> -u I<...>] I<DEVICE>"
msgstr ""
#. type: Plain text
#: en/fsck.fat.8:32
msgid ""
-"B<fsc.fat> verifies the consistency of MS-DOS filesystems and optionally "
+"B<fsck.fat> verifies the consistency of MS-DOS filesystems and optionally "
"tries to repair them."
msgstr ""
#. type: Plain text
#: en/fsck.fat.8:76
msgid ""
-"When B<fsc.fat> checks a filesystem, it accumulates all changes in memory "
+"When B<fsck.fat> checks a filesystem, it accumulates all changes in memory "
"and performs them only after all checks are complete. This can be disabled "
"with the B<-w> option."
msgstr ""
#. type: Plain text
#: en/fsck.fat.8:82
msgid ""
-"Use Atari variation of the MS-DOS filesystem. This is default if B<fsc.fat> "
+"Use Atari variation of the MS-DOS filesystem. This is default if B<fsck.fat> "
"is run on an Atari, then this option turns off Atari format. There are some "
"minor differences in Atari format: Some boot sector fields are interpreted "
"slightly different, and the special FAT entries for end-of-file and bad "
#. type: Plain text
#: en/fsck.fat.8:100
msgid ""
-"Try to undelete the specified file. B<fsc.fat> tries to allocate a chain of "
+"Try to undelete the specified file. B<fsck.fat> tries to allocate a chain of "
"contiguous unallocated clusters beginning with the start cluster of the "
"undeleted file."
msgstr ""
#. type: Plain text
#: en/fsck.fat.8:116
msgid ""
-"Recoverable errors have been detected or B<fsc.fat> has discovered an "
+"Recoverable errors have been detected or B<fsck.fat> has discovered an "
"internal inconsistency."
msgstr ""
#. type: Plain text
#: en/fsck.fat.8:118
-msgid "Usage error. B<fsc.fat> did not access the filesystem."
+msgid "Usage error. B<fsck.fat> did not access the filesystem."
msgstr ""
#. type: SH
#. type: Plain text
#: en/fsck.fat.8:122
msgid ""
-"When recovering from a corrupted filesystem, B<fsc.fat> dumps recovered data "
-"into files named 'fsckNNNN.rec' in the top level directory of the filesystem."
+"When recovering from a corrupted filesystem, B<fsck.fat> dumps recovered "
+"data into files named 'fsckNNNN.rec' in the top level directory of the "
+"filesystem."
msgstr ""
#. type: SH
msgid ""
msgstr ""
"Project-Id-Version: dosfstools VERSION\n"
-"POT-Creation-Date: 2013-06-06 09:34+0300\n"
+"POT-Creation-Date: 2013-06-11 18:45+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
#. type: TH
#: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22
#, no-wrap
-msgid "2013-06-06"
+msgid "2013-06-11"
msgstr ""
#. type: TH
#: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22
#, no-wrap
-msgid "3.0.18"
+msgid "3.0.19"
msgstr ""
#. type: TH
/* On Atari, a 24 bit serial number is stored at offset 8 of the boot
* sector */
printf("Serial number 0x%x\n",
- b->system_id[5] | (b->
- system_id[6] << 8) | (b->system_id[7] << 16));
+ b->system_id[5] | (b->system_id[6] << 8) | (b->
+ system_id[7] << 16));
}
printf("Media byte 0x%02x (%s)\n", b->media, get_media_descr(b->media));
printf("%10d bytes per logical sector\n", GET_UNALIGNED_W(b->sector_size));
static char print_fat_dirty_state(void)
{
printf("Dirty bit is set. Fs was not properly unmounted and"
- " some data may be corrupt.\n");
+ " some data may be corrupt.\n");
if (interactive) {
- printf("1) Remove dirty bit\n"
- "2) No action\n");
- return get_key("12", "?");
+ printf("1) Remove dirty bit\n" "2) No action\n");
+ return get_key("12", "?");
} else
- printf(" Automatically removing dirty bit.\n");
+ printf(" Automatically removing dirty bit.\n");
return '1';
}
-static void check_fat_state_bit(DOS_FS *fs, void *b)
+static void check_fat_state_bit(DOS_FS * fs, void *b)
{
if (fs->fat_bits == 32) {
- struct boot_sector *b32 = b;
-
- if (b32->reserved3 & FAT_STATE_DIRTY) {
- printf("0x41: ");
- if (print_fat_dirty_state() == '1') {
- b32->reserved3 &= ~FAT_STATE_DIRTY;
- fs_write(0, sizeof(*b32), b32);
- }
- }
+ struct boot_sector *b32 = b;
+
+ if (b32->reserved3 & FAT_STATE_DIRTY) {
+ printf("0x41: ");
+ if (print_fat_dirty_state() == '1') {
+ b32->reserved3 &= ~FAT_STATE_DIRTY;
+ fs_write(0, sizeof(*b32), b32);
+ }
+ }
} else {
- struct boot_sector_16 *b16 = b;
-
- if (b16->reserved2 & FAT_STATE_DIRTY) {
- printf("0x25: ");
- if (print_fat_dirty_state() == '1') {
- b16->reserved2 &= ~FAT_STATE_DIRTY;
- fs_write(0, sizeof(*b16), b16);
- }
- }
+ struct boot_sector_16 *b16 = b;
+
+ if (b16->reserved2 & FAT_STATE_DIRTY) {
+ printf("0x25: ");
+ if (print_fat_dirty_state() == '1') {
+ b16->reserved2 &= ~FAT_STATE_DIRTY;
+ fs_write(0, sizeof(*b16), b16);
+ }
+ }
}
}
created = 0;
offset = find_volume_de(fs, &de);
- if (offset == 0)
- {
- created = 1;
- offset = alloc_rootdir_entry(fs, &de, label);
+ if (offset == 0) {
+ created = 1;
+ offset = alloc_rootdir_entry(fs, &de, label);
}
memcpy(de.name, label, 11);
de.time = htole16((unsigned short)((mtime->tm_sec >> 1) +
de.date = htole16((unsigned short)(mtime->tm_mday +
((mtime->tm_mon + 1) << 5) +
((mtime->tm_year - 80) << 9)));
- if (created)
- {
- de.attr = ATTR_VOLUME;
- de.ctime_ms = 0;
- de.ctime = de.time;
- de.cdate = de.date;
- de.adate = de.date;
- de.starthi = 0;
- de.start = 0;
- de.size = 0;
+ if (created) {
+ de.attr = ATTR_VOLUME;
+ de.ctime_ms = 0;
+ de.ctime = de.time;
+ de.cdate = de.date;
+ de.adate = de.date;
+ de.starthi = 0;
+ de.start = 0;
+ de.size = 0;
}
fs_write(offset, sizeof(DIR_ENT), &de);
void read_boot(DOS_FS * fs);
void write_label(DOS_FS * fs, char *label);
-loff_t find_volume_de(DOS_FS *fs, DIR_ENT *de);
+loff_t find_volume_de(DOS_FS * fs, DIR_ENT * de);
/* Reads the boot sector from the currently open device and initializes *FS */
int main(int argc, char *argv[])
{
- DOS_FS fs = {0};
+ DOS_FS fs = { 0 };
rw = 0;
int i;
char *device = NULL;
- char label[12] = {0};
+ char label[12] = { 0 };
loff_t offset;
DIR_ENT de;
"fatlabel: labels can be no longer than 11 characters\n");
exit(1);
}
- for (i = 0; label[i] && i < 11; i++)
- /* don't know if here should be more strict !uppercase(label[i])*/
- if (islower(label[i])) {
- fprintf(stderr,
- "fatlabel: labels cannot contain lower case characters\n");
- exit(1);
- }
+ for (i = 0; label[i] && i < 11; i++)
+ /* don't know if here should be more strict !uppercase(label[i]) */
+ if (islower(label[i])) {
+ fprintf(stderr,
+ "fatlabel: labels cannot contain lower case characters\n");
+ exit(1);
+ }
rw = 1;
}
if (fs.fat_bits == 32)
read_fat(&fs);
if (!rw) {
- offset = find_volume_de(&fs, &de);
- if (offset == 0)
- fprintf(stdout, "%s\n", fs.label);
- else
- fprintf(stdout, "%.8s%.3s\n", de.name, de.ext);
+ offset = find_volume_de(&fs, &de);
+ if (offset == 0)
+ fprintf(stdout, "%s\n", fs.label);
+ else
+ fprintf(stdout, "%.8s%.3s\n", de.name, de.ext);
exit(0);
}
fprintf(stderr, " -a automatically repair the file system\n");
fprintf(stderr, " -A toggle Atari file system format\n");
fprintf(stderr, " -b make read-only boot sector check\n");
- fprintf(stderr, " -c N use DOS codepage N to decode short file names (default: %d)\n", DEFAULT_DOS_CODEPAGE);
+ fprintf(stderr,
+ " -c N use DOS codepage N to decode short file names (default: %d)\n",
+ DEFAULT_DOS_CODEPAGE);
fprintf(stderr, " -d path drop that file\n");
fprintf(stderr, " -f salvage unused chains to files\n");
fprintf(stderr, " -l list path names\n");
read_boot(&fs);
if (boot_only)
- goto exit;
+ goto exit;
if (verify)
printf("Starting check/repair pass.\n");
char *label;
} DOS_FS;
-
extern int interactive, rw, list, verbose, test, write_immed;
extern int atari_format;
extern unsigned n_files;
if (walk->pos < pos + size && walk->pos + walk->size > pos) {
if (walk->pos < pos)
memcpy(data, (char *)walk->data + pos - walk->pos, min(size,
- walk->size
- - pos +
- walk->pos));
+ walk->
+ size -
+ pos +
+ walk->
+ pos));
else
memcpy((char *)data + walk->pos - pos, walk->data,
min(walk->size, size + pos - walk->pos));
cp = out = use_q ? qalloc(&mem_queue, len + 1) : alloc(len + 1);
for (up = uni; (up - uni) / 2 < maxlen && (up[0] || up[1]); up += 2) {
- if ((x = wctombs((char *)cp, BYTES_TO_WCHAR(up[0], up[1]))) != (size_t) - 1)
+ if ((x =
+ wctombs((char *)cp, BYTES_TO_WCHAR(up[0], up[1]))) != (size_t) - 1)
cp += x;
else if (UNICODE_CONVERTABLE(up[0], up[1]))
*cp++ = up[0];
#include <asm/types.h>
-
/* In earlier versions, an own llseek() was used, but glibc lseek() is
* sufficient (or even better :) for 64 bit offsets in the meantime */
#define llseek lseek
/* Given a filename, look to see how many blocks of BLOCK_SIZE are present, returning the answer */
static unsigned long long count_blocks(char *filename, int *remainder)
-
{
loff_t high, low;
int fd;
}
close(fd);
- *remainder = (low%BLOCK_SIZE)/sector_size;
- return(low / BLOCK_SIZE);
+ *remainder = (low % BLOCK_SIZE) / sector_size;
+ return (low / BLOCK_SIZE);
}
/* Check to see if the specified device is currently mounted - abort if it is */
* differently: The jump code is only 2 bytes (and m68k machine code
* :-), then 6 bytes filler (ignored), then 3 byte serial number. */
bs.boot_jump[2] = 'm';
- strcpy((char *)bs.system_id, "kdosf");
- }
- else
- strcpy((char *)bs.system_id, "mkfs.fat");
+ memcpy((char *)bs.system_id, "kdosf", strlen("kdosf"));
+ } else
+ memcpy((char *)bs.system_id, "mkfs.fat", strlen("mkfs.fat"));
if (sectors_per_cluster)
bs.cluster_size = (char)sectors_per_cluster;
if (size_fat == 32) {
memcpy(&bs.hidden, &hidden, 2);
}
- num_sectors = (long long)(blocks *BLOCK_SIZE / sector_size)+orphaned_sectors;
+ num_sectors =
+ (long long)(blocks * BLOCK_SIZE / sector_size) + orphaned_sectors;
if (!atari_format) {
unsigned fatdata1216; /* Sectors for FATs + data area (FAT12/16) */
case 'n': /* n : Volume name */
sprintf(volume_name, "%-11.11s", optarg);
- for (i = 0; i < 11; i++)
- volume_name[i] = toupper(volume_name[i]);
+ for (i = 0; i < 11; i++)
+ volume_name[i] = toupper(volume_name[i]);
break;
#ifndef _version_h
#define _version_h
-#define VERSION "3.0.18"
-#define VERSION_DATE "06 Jun 2013"
+#define VERSION "3.0.19"
+#define VERSION_DATE "11 Jun 2013"
#endif