/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1982-2010 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* David Korn <dgk@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* sleep delay
*
* David Korn
* AT&T Labs
*
*/
#include "defs.h"
#include <error.h>
#include <errno.h>
#include <tmx.h>
#include "builtins.h"
#ifdef _NEXT_SOURCE
#endif /* _NEXT_SOURCE */
#ifdef _lib_poll_notimer
#endif /* _lib_poll_notimer */
{
register char *cp;
register double d=0;
int sflag=0;
char *last;
{
case 's':
sflag=1;
break;
case ':':
break;
case '?':
break;
}
{
if(*last)
{
char* pp;
else
{
}
if(*last)
d /= TMX_RESOLUTION;
}
if(argv[1])
}
else if(!sflag)
if(d > .10)
{
}
if(sflag && d==0)
pause();
else while(1)
{
errno = 0;
sh_delay(d);
break;
sh_sigcheck();
break;
sh_timetraps();
}
return(0);
}
{
*expired = 1;
}
{
void *tp;
char expired = 0;
do
{
pause();
sh_timetraps();
{
if(expired)
expired = 0;
else
}
}
if(!expired)
sh_sigcheck();
return(0);
}
/*
* delay execution for time <t>
*/
void sh_delay(double t)
{
register int n = (int)t;
#ifdef _lib_poll
if(t<=0)
return;
else if(n > 30)
{
sleep(n);
t -= n;
}
if(n=(int)(1000*t))
{
}
#else
# if defined(_lib_select) && defined(_mem_tv_usec_timeval)
if(t<=0)
return;
return;
n = (int)t;
# else
# ifdef _lib_select
/* for 9th edition machines */
if(t<=0)
return;
if(n > 30)
{
sleep(n);
t -= n;
}
if(n=(int)(1000*t))
{
}
# else
if(t<=0)
return;
sleep(n);
t -= n;
if(t)
{
if(begin==0)
return;
n += (t+.5);
}
# endif
# endif
#endif /* _lib_poll */
}