mirror of
https://github.com/UzixLS/picocom.git
synced 2025-07-19 07:21:18 +03:00
Moved msec2tv() to fdio.c/h
This commit is contained in:
9
fdio.c
9
fdio.c
@ -34,6 +34,15 @@
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
struct timeval *
|
||||
msec2tv (struct timeval *tv, long ms)
|
||||
{
|
||||
tv->tv_sec = ms / 1000;
|
||||
tv->tv_usec = (ms % 1000) * 1000;
|
||||
|
||||
return tv;
|
||||
}
|
||||
|
||||
ssize_t
|
||||
writen_ni(int fd, const void *buff, size_t n)
|
||||
{
|
||||
|
2
fdio.h
2
fdio.h
@ -24,6 +24,8 @@
|
||||
|
||||
#ifndef FDIO_H
|
||||
|
||||
struct timeval *msec2tv (struct timeval *tv, long ms);
|
||||
|
||||
/* Write exactly "n" bytes from "buff" to "fd". Works with blocking
|
||||
and non-blocking fds. Returns number of bytes written; if != "n",
|
||||
sets errno. */
|
||||
|
@ -1385,15 +1385,6 @@ do_command (unsigned char c)
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
static struct timeval *
|
||||
msec2tv (struct timeval *tv, long ms)
|
||||
{
|
||||
tv->tv_sec = ms / 1000;
|
||||
tv->tv_usec = (ms % 1000) * 1000;
|
||||
|
||||
return tv;
|
||||
}
|
||||
|
||||
/* loop-exit reason */
|
||||
enum le_reason {
|
||||
LE_CMD,
|
||||
|
9
tn2217.c
9
tn2217.c
@ -1199,15 +1199,6 @@ cond_comport_start(struct term_s *t)
|
||||
return STATE(t)->can_comport;
|
||||
}
|
||||
|
||||
static struct timeval *
|
||||
msec2tv (struct timeval *tv, long ms)
|
||||
{
|
||||
tv->tv_sec = ms / 1000;
|
||||
tv->tv_usec = (ms % 1000) * 1000;
|
||||
|
||||
return tv;
|
||||
}
|
||||
|
||||
/* Wait (keep reading from the fd and processing commands) until the
|
||||
condition is satisfied (that is, until "cond" returns non-zero), or
|
||||
until the timeout expires. Returns a positive on success, zero if
|
||||
|
Reference in New Issue
Block a user