1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00

- Redirecting stderr to a file no longer has the effect of showing error

messages and assertion failure notifications as requesters. The exception
  is in redirecting stderr to NIL: which will prompt the requester use.

- gettimeofday() now calls GetSysTime() rather than DateStamp() to obtain
  the current system time. This resolves granularity issues since the
  DateStamp() result was only accurate by 1/50 of a second.

- The "ptrdiff_t" definition in <stddef.h> now defaults to type 'int' rather
  than 'long int'.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14791 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2005-01-08 10:21:28 +00:00
parent 984c6729c1
commit f519aafaca
6 changed files with 58 additions and 29 deletions

View File

@ -1,3 +1,15 @@
- Redirecting stderr to a file no longer has the effect of showing error
messages and assertion failure notifications as requesters. The exception
is in redirecting stderr to NIL: which will prompt the requester use.
- gettimeofday() now calls GetSysTime() rather than DateStamp() to obtain
the current system time. This resolves granularity issues since the
DateStamp() result was only accurate by 1/50 of a second.
- The "ptrdiff_t" definition in <stddef.h> now defaults to type 'int' rather
than 'long int'.
c.lib 1.185 (2.1.2005)
- Moved the environment variable cleanup code into a destructor function.

View File

@ -1,5 +1,5 @@
/*
* $Id: stddef.h,v 1.2 2005-01-02 09:07:21 obarthel Exp $
* $Id: stddef.h,v 1.3 2005-01-08 10:21:28 obarthel Exp $
*
* :ts=4
*
@ -52,7 +52,7 @@ extern "C" {
/****************************************************************************/
typedef long int ptrdiff_t;
typedef int ptrdiff_t;
typedef unsigned int size_t;
typedef unsigned int wchar_t;

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_init_exit.c,v 1.6 2005-01-02 09:07:08 obarthel Exp $
* $Id: stdio_init_exit.c,v 1.7 2005-01-08 10:21:25 obarthel Exp $
*
* :ts=4
*
@ -263,15 +263,6 @@ __stdio_init(void)
SET_FLAG(__fd[STDERR_FILENO]->fd_Flags,FDF_IS_INTERACTIVE);
}
/* Check if the standard/error output refers to a console or must
be considered unusable for console output. */
if(FLAG_IS_CLEAR(__fd[STDOUT_FILENO]->fd_Flags,FDF_IS_INTERACTIVE) ||
FLAG_IS_CLEAR(__fd[STDERR_FILENO]->fd_Flags,FDF_IS_INTERACTIVE))
{
/* The standard I/O streams are no longer attached to a console. */
__no_standard_io = TRUE;
}
PROFILE_ON();
result = OK;

View File

@ -1,5 +1,5 @@
/*
* $Id: stdlib_assertion_failure.c,v 1.4 2005-01-02 09:07:08 obarthel Exp $
* $Id: stdlib_assertion_failure.c,v 1.5 2005-01-08 10:21:25 obarthel Exp $
*
* :ts=4
*
@ -70,6 +70,7 @@ __assertion_failure(
struct iob * iob;
iob = (struct iob *)stderr;
if(iob != NULL &&
FLAG_IS_SET(iob->iob_Flags,IOBF_IN_USE) &&
FLAG_IS_SET(iob->iob_Flags,IOBF_WRITE))
@ -77,14 +78,17 @@ __assertion_failure(
struct fd * fd;
fd = __get_file_descriptor(iob->iob_Descriptor);
if(fd != NULL &&
FLAG_IS_SET(fd->fd_Flags,FDF_IN_USE) &&
FLAG_IS_SET(fd->fd_Flags,FDF_WRITE) &&
FLAG_IS_SET(fd->fd_Flags,FDF_IS_INTERACTIVE))
FLAG_IS_CLEAR(fd->fd_Flags,FDF_IS_SOCKET))
{
assert( FLAG_IS_CLEAR(fd->fd_Flags,FDF_IS_SOCKET) );
struct FileHandle * fh = BADDR(fd->fd_DefaultFile);
use_stderr = TRUE;
/* Check if this is really not redirected to "NIL:". */
if(fh->fh_Type != NULL)
use_stderr = TRUE;
}
}
}

View File

@ -1,5 +1,5 @@
/*
* $Id: stdlib_showerror.c,v 1.5 2005-01-02 09:07:18 obarthel Exp $
* $Id: stdlib_showerror.c,v 1.6 2005-01-08 10:21:25 obarthel Exp $
*
* :ts=4
*
@ -78,6 +78,8 @@ __show_error(const char * message)
struct Library * IntuitionBase;
struct Library * DOSBase;
struct FileHandle * fh;
BPTR output;
PROFILE_OFF();
@ -96,10 +98,23 @@ __show_error(const char * message)
IIntuition = (struct IntuitionIFace *)GetInterface(IntuitionBase, "main", 1, 0);
if (IIntuition == NULL)
goto out;
/* Try to print the error message on the default error output stream. */
output = ErrorOutput();
if(output == ZERO)
output = Output();
}
#else
{
output = Output();
}
#endif /* __amigaos4__ */
if(__detach || __no_standard_io || __WBenchMsg != NULL)
/* This is for checking if the stream was redirected to "NIL:". */
fh = BADDR(output);
/* If we can't hope to print the error message, show a requester instead. */
if(__detach || __no_standard_io || __WBenchMsg != NULL || fh == NULL || fh->fh_Type == NULL)
{
if(IntuitionBase->lib_Version >= 37)
{
@ -149,10 +164,6 @@ __show_error(const char * message)
}
else
{
BPTR output;
output = Output();
Write(output,(STRPTR)message,(LONG)strlen(message));
Write(output,"\n",1);
}

View File

@ -1,5 +1,5 @@
/*
* $Id: time_gettimeofday.c,v 1.3 2005-01-02 09:07:19 obarthel Exp $
* $Id: time_gettimeofday.c,v 1.4 2005-01-08 10:21:25 obarthel Exp $
*
* :ts=4
*
@ -39,12 +39,20 @@
#include "locale_headers.h"
#endif /* _LOCALE_HEADERS_H */
#ifndef _UNISTD_HEADERS_H
#include "unistd_headers.h"
#endif /* _UNISTD_HEADERS_H */
/****************************************************************************/
#include <sys/time.h>
/****************************************************************************/
#include <proto/timer.h>
/****************************************************************************/
/* The following is not part of the ISO 'C' (1994) standard. */
/****************************************************************************/
@ -52,17 +60,20 @@
int
gettimeofday(struct timeval *tp, struct timezone *tzp)
{
struct Library * TimerBase = __TimerBase;
#if defined(__amigaos4__)
struct TimerIFace * ITimer = __ITimer;
#endif /* __amigaos4__ */
ULONG seconds,microseconds;
struct DateStamp ds;
struct timeval tv;
ENTER();
PROFILE_OFF();
DateStamp(&ds);
PROFILE_ON();
GetSysTime(&tv);
seconds = UNIX_TIME_OFFSET + 60 * ((ULONG)ds.ds_Minute + 24 * 60 * (ULONG)ds.ds_Days) + (ds.ds_Tick / TICKS_PER_SECOND);
microseconds = (1000000 * (ds.ds_Tick % TICKS_PER_SECOND)) / TICKS_PER_SECOND;
seconds = tv.tv_sec + UNIX_TIME_OFFSET;
microseconds = tv.tv_usec;
if(__default_locale != NULL)
seconds += 60 * __default_locale->loc_GMTOffset;