(read_history_range, history_truncate_file, history_do_write) [__MSDOS__]:
Allow for a `_' to replace the leading dot in hard-wrired file names.
This commit is contained in:
parent
bd0856513e
commit
057b35a099
1 changed files with 35 additions and 0 deletions
|
@ -140,6 +140,16 @@ read_history_range (filename, from, to)
|
||||||
input = history_filename (filename);
|
input = history_filename (filename);
|
||||||
file = open (input, O_RDONLY|O_BINARY, 0666);
|
file = open (input, O_RDONLY|O_BINARY, 0666);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __MSDOS__
|
||||||
|
/* MSDOS doesn't allow leading dots in file names. Try again
|
||||||
|
with the dot replaced by an underscore. */
|
||||||
|
if (file < 0 && !filename)
|
||||||
|
{
|
||||||
|
input[strlen (input) - 8] = '_';
|
||||||
|
file = open (input, O_RDONLY|O_BINARY, 0666);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if ((file < 0) || (fstat (file, &finfo) == -1))
|
if ((file < 0) || (fstat (file, &finfo) == -1))
|
||||||
goto error_and_exit;
|
goto error_and_exit;
|
||||||
|
|
||||||
|
@ -233,6 +243,16 @@ history_truncate_file (fname, lines)
|
||||||
filename = history_filename (fname);
|
filename = history_filename (fname);
|
||||||
file = open (filename, O_RDONLY|O_BINARY, 0666);
|
file = open (filename, O_RDONLY|O_BINARY, 0666);
|
||||||
|
|
||||||
|
#ifdef __MSDOS__
|
||||||
|
/* MSDOS doesn't allow leading dots in file names. Try again
|
||||||
|
with the dot replaced by an underscore. */
|
||||||
|
if (file < 0 && !fname)
|
||||||
|
{
|
||||||
|
filename[strlen (filename) - 8] = '_';
|
||||||
|
file = open (filename, O_RDONLY|O_BINARY, 0666);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (file == -1 || fstat (file, &finfo) == -1)
|
if (file == -1 || fstat (file, &finfo) == -1)
|
||||||
goto truncate_exit;
|
goto truncate_exit;
|
||||||
|
|
||||||
|
@ -314,8 +334,23 @@ history_do_write (filename, nelements, overwrite)
|
||||||
|
|
||||||
if ((file = open (output, mode, 0600)) == -1)
|
if ((file = open (output, mode, 0600)) == -1)
|
||||||
{
|
{
|
||||||
|
#ifdef __MSDOS__
|
||||||
|
/* MSDOS doesn't allow leading dots in file names. If this is
|
||||||
|
the default file name, try again with the dot replaced by an
|
||||||
|
underscore. */
|
||||||
|
if (!filename)
|
||||||
|
{
|
||||||
|
output[strlen (output) - 8] = '_';
|
||||||
|
if ((file = open (output, mode, 0600)) == -1)
|
||||||
|
{
|
||||||
|
FREE (output);
|
||||||
|
return (errno);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
FREE (output);
|
FREE (output);
|
||||||
return (errno);
|
return (errno);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nelements > history_length)
|
if (nelements > history_length)
|
||||||
|
|
Loading…
Reference in a new issue