Re-running Nindent.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
This commit is contained in:
parent
0390c4c1c1
commit
91a1fb9536
@ -96,8 +96,8 @@ static void dump_boot(DOS_FS * fs, struct boot_sector *b, unsigned lss)
|
||||
/* 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));
|
||||
|
||||
39
src/check.c
39
src/check.c
@ -139,7 +139,8 @@ loff_t alloc_rootdir_entry(DOS_FS * fs, DIR_ENT * de, const char *pattern)
|
||||
while (clu_num > 0 && clu_num != -1) {
|
||||
fs_read(offset2, sizeof(DIR_ENT), &d2);
|
||||
if (offset2 != offset &&
|
||||
!strncmp((const char*)d2.name, (const char*)de->name, MSDOS_NAME))
|
||||
!strncmp((const char *)d2.name, (const char *)de->name,
|
||||
MSDOS_NAME))
|
||||
break;
|
||||
i += sizeof(DIR_ENT);
|
||||
offset2 += sizeof(DIR_ENT);
|
||||
@ -176,7 +177,8 @@ loff_t alloc_rootdir_entry(DOS_FS * fs, DIR_ENT * de, const char *pattern)
|
||||
sprintf((char *)de->name, pattern, curr_num);
|
||||
for (scan = 0; scan < fs->root_entries; scan++)
|
||||
if (scan != next_free &&
|
||||
!strncmp((const char*)root[scan].name, (const char*)de->name, MSDOS_NAME))
|
||||
!strncmp((const char *)root[scan].name,
|
||||
(const char *)de->name, MSDOS_NAME))
|
||||
break;
|
||||
if (scan == fs->root_entries)
|
||||
break;
|
||||
@ -386,7 +388,8 @@ static void auto_rename(DOS_FILE * file)
|
||||
memcpy(file->dir_ent.ext, num + 4, 3);
|
||||
for (walk = first; walk; walk = walk->next)
|
||||
if (walk != file
|
||||
&& !strncmp((const char*)walk->dir_ent.name, (const char*)file->dir_ent.name, MSDOS_NAME))
|
||||
&& !strncmp((const char *)walk->dir_ent.name,
|
||||
(const char *)file->dir_ent.name, MSDOS_NAME))
|
||||
break;
|
||||
if (!walk) {
|
||||
fs_write(file->offset, MSDOS_NAME, file->dir_ent.name);
|
||||
@ -418,9 +421,8 @@ static void rename_file(DOS_FILE * file)
|
||||
if (fgets((char *)name, 45, stdin)) {
|
||||
if ((here = (unsigned char *)strchr((const char *)name, '\n')))
|
||||
*here = 0;
|
||||
for (walk = (unsigned char*)strrchr((const char*)name, 0); walk >= name && (*walk == ' ' ||
|
||||
*walk == '\t');
|
||||
walk--) ;
|
||||
for (walk = (unsigned char *)strrchr((const char *)name, 0);
|
||||
walk >= name && (*walk == ' ' || *walk == '\t'); walk--) ;
|
||||
walk[1] = 0;
|
||||
for (walk = name; *walk == ' ' || *walk == '\t'; walk++) ;
|
||||
if (file_cvt(walk, file->dir_ent.name)) {
|
||||
@ -438,7 +440,9 @@ static int handle_dot(DOS_FS * fs, DOS_FILE * file, int dots)
|
||||
{
|
||||
char *name;
|
||||
|
||||
name = strncmp((const char*)file->dir_ent.name, MSDOS_DOT, MSDOS_NAME) ? ".." : ".";
|
||||
name =
|
||||
strncmp((const char *)file->dir_ent.name, MSDOS_DOT,
|
||||
MSDOS_NAME) ? ".." : ".";
|
||||
if (!(file->dir_ent.attr & ATTR_DIR)) {
|
||||
printf("%s\n Is a non-directory.\n", path_name(file));
|
||||
if (interactive)
|
||||
@ -483,7 +487,9 @@ static int check_file(DOS_FS * fs, DOS_FILE * file)
|
||||
path_name(file));
|
||||
MODIFY(file, size, CT_LE_L(0));
|
||||
}
|
||||
if (file->parent && !strncmp((const char*)file->dir_ent.name, MSDOS_DOT, MSDOS_NAME)) {
|
||||
if (file->parent
|
||||
&& !strncmp((const char *)file->dir_ent.name, MSDOS_DOT,
|
||||
MSDOS_NAME)) {
|
||||
expect = FSTART(file->parent, fs);
|
||||
if (FSTART(file, fs) != expect) {
|
||||
printf("%s\n Start (%ld) does not point to parent (%ld)\n",
|
||||
@ -492,7 +498,8 @@ static int check_file(DOS_FS * fs, DOS_FILE * file)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (file->parent && !strncmp((const char*)file->dir_ent.name, MSDOS_DOTDOT,
|
||||
if (file->parent
|
||||
&& !strncmp((const char *)file->dir_ent.name, MSDOS_DOTDOT,
|
||||
MSDOS_NAME)) {
|
||||
expect =
|
||||
file->parent->parent ? FSTART(file->parent->parent, fs) : 0;
|
||||
@ -677,13 +684,16 @@ static int check_dir(DOS_FS * fs, DOS_FILE ** root, int dots)
|
||||
dot = dotdot = redo = 0;
|
||||
walk = root;
|
||||
while (*walk) {
|
||||
if (!strncmp((const char*)((*walk)->dir_ent.name), MSDOS_DOT, MSDOS_NAME) ||
|
||||
!strncmp((const char*)((*walk)->dir_ent.name), MSDOS_DOTDOT, MSDOS_NAME)) {
|
||||
if (!strncmp
|
||||
((const char *)((*walk)->dir_ent.name), MSDOS_DOT, MSDOS_NAME)
|
||||
|| !strncmp((const char *)((*walk)->dir_ent.name), MSDOS_DOTDOT,
|
||||
MSDOS_NAME)) {
|
||||
if (handle_dot(fs, *walk, dots)) {
|
||||
*walk = (*walk)->next;
|
||||
continue;
|
||||
}
|
||||
if (!strncmp((const char*)((*walk)->dir_ent.name), MSDOS_DOT, MSDOS_NAME))
|
||||
if (!strncmp
|
||||
((const char *)((*walk)->dir_ent.name), MSDOS_DOT, MSDOS_NAME))
|
||||
dot++;
|
||||
else
|
||||
dotdot++;
|
||||
@ -1002,8 +1012,9 @@ static int subdirs(DOS_FS * fs, DOS_FILE * parent, FDSC ** cp)
|
||||
|
||||
for (walk = parent ? parent->first : root; walk; walk = walk->next)
|
||||
if (walk->dir_ent.attr & ATTR_DIR)
|
||||
if (strncmp((const char*)walk->dir_ent.name, MSDOS_DOT, MSDOS_NAME) &&
|
||||
strncmp((const char*)walk->dir_ent.name, MSDOS_DOTDOT, MSDOS_NAME))
|
||||
if (strncmp((const char *)walk->dir_ent.name, MSDOS_DOT, MSDOS_NAME)
|
||||
&& strncmp((const char *)walk->dir_ent.name, MSDOS_DOTDOT,
|
||||
MSDOS_NAME))
|
||||
if (scan_dir(fs, walk, file_cd(cp, (char *)walk->dir_ent.name)))
|
||||
return 1;
|
||||
return 0;
|
||||
|
||||
@ -170,8 +170,8 @@ void file_add(char *path, FD_TYPE type)
|
||||
&&
|
||||
!strncmp
|
||||
(name + 1,
|
||||
walk->
|
||||
name + 1,
|
||||
walk->name
|
||||
+ 1,
|
||||
MSDOS_NAME
|
||||
- 1))))
|
||||
die("Ambiguous name: \"%s\"", path);
|
||||
|
||||
8
src/io.c
8
src/io.c
@ -132,11 +132,9 @@ void fs_read(loff_t pos, int size, void *data)
|
||||
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));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user