diff --git a/library/changes b/library/changes index d0f9b8e..bad9d32 100644 --- a/library/changes +++ b/library/changes @@ -1,3 +1,6 @@ +- fstat() now works with "NIL:" and "/dev/null", respectively. Not that + it returns much useful information, though. + - The _PC_MAX_INPUT query for file handles now returns the default buffer size. diff --git a/library/stat_convertfileinfo.c b/library/stat_convertfileinfo.c index 5d4a432..af12cd2 100644 --- a/library/stat_convertfileinfo.c +++ b/library/stat_convertfileinfo.c @@ -1,5 +1,5 @@ /* - * $Id: stat_convertfileinfo.c,v 1.8 2006-01-08 12:04:24 obarthel Exp $ + * $Id: stat_convertfileinfo.c,v 1.9 2006-09-20 19:46:57 obarthel Exp $ * * :ts=4 * @@ -81,7 +81,7 @@ __convert_file_info_to_stat( mode = S_IFIFO; else if (fib->fib_DirEntryType == ST_SOCKET) mode = S_IFSOCK; - else if (fib->fib_DirEntryType == ST_CONSOLE) + else if (fib->fib_DirEntryType == ST_CONSOLE || fib->fib_DirEntryType == ST_NIL) mode = S_IFCHR; else if (fib->fib_DirEntryType < 0) mode = S_IFREG; diff --git a/library/stdio_fdhookentry.c b/library/stdio_fdhookentry.c index bcc04cd..09bc895 100644 --- a/library/stdio_fdhookentry.c +++ b/library/stdio_fdhookentry.c @@ -1,5 +1,5 @@ /* - * $Id: stdio_fdhookentry.c,v 1.32 2006-01-08 12:04:24 obarthel Exp $ + * $Id: stdio_fdhookentry.c,v 1.33 2006-09-20 19:46:57 obarthel Exp $ * * :ts=4 * @@ -581,7 +581,18 @@ __fd_hook_entry( fh = BADDR(file); - if(CANNOT __safe_examine_file_handle(file,fam->fam_FileInfo)) + /* Special treatment for "NIL:", for which we make + some stuff up. */ + if(fh->fh_Type == NULL) + { + /* Make up some stuff for this stream. */ + memset(fam->fam_FileInfo,0,sizeof(*fam->fam_FileInfo)); + + DateStamp(&fam->fam_FileInfo->fib_Date); + + fam->fam_FileInfo->fib_DirEntryType = ST_NIL; + } + else if (CANNOT __safe_examine_file_handle(file,fam->fam_FileInfo)) { LONG error; diff --git a/library/stdio_headers.h b/library/stdio_headers.h index a594c65..85a0784 100644 --- a/library/stdio_headers.h +++ b/library/stdio_headers.h @@ -1,5 +1,5 @@ /* - * $Id: stdio_headers.h,v 1.25 2006-01-08 12:04:24 obarthel Exp $ + * $Id: stdio_headers.h,v 1.26 2006-09-20 19:46:57 obarthel Exp $ * * :ts=4 * @@ -168,6 +168,9 @@ struct iob; /* The same for a console stream. */ #define ST_CONSOLE (20050402) +/* And something for NIL: */ +#define ST_NIL (20060920) + /****************************************************************************/ /* Operations that can be performed by the file action function. */ diff --git a/library/termios_console_fdhookentry.c b/library/termios_console_fdhookentry.c index fe934b4..08491de 100755 --- a/library/termios_console_fdhookentry.c +++ b/library/termios_console_fdhookentry.c @@ -1,5 +1,5 @@ /* - * $Id: termios_console_fdhookentry.c,v 1.3 2006-09-12 14:16:44 obarthel Exp $ + * $Id: termios_console_fdhookentry.c,v 1.4 2006-09-20 19:46:57 obarthel Exp $ * * :ts=4 * @@ -589,7 +589,18 @@ __termios_console_hook( fh = BADDR(file); - if(CANNOT __safe_examine_file_handle(file,fam->fam_FileInfo)) + /* Special treatment for "NIL:", for which we make + some stuff up. */ + if(fh->fh_Type == NULL) + { + /* Make up some stuff for this stream. */ + memset(fam->fam_FileInfo,0,sizeof(*fam->fam_FileInfo)); + + DateStamp(&fam->fam_FileInfo->fib_Date); + + fam->fam_FileInfo->fib_DirEntryType = ST_NIL; + } + else if (CANNOT __safe_examine_file_handle(file,fam->fam_FileInfo)) { LONG error;