2004 by Marc J. Rochkind. All rights reserved. Portions marked "Open Source" may be copied under license.

 

Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

c4/record.c File Reference


Detailed Description

Record and Playback Example [Sec. 4.10.2].

Definition in file record.c.

Go to the source code of this file.

Compounds

struct  event

Defines

#define EVFILE   "recording.tmp"
#define EVBUFSIZE   512

Functions

void timeval_subtract (const struct timeval *x, const struct timeval *y, struct timeval *diff)
void get_rel_time (struct timeval *tv_rel)
bool ev_open (void)
bool ev_creat (void)
bool ev_write (char *data, unsigned datalen)
bool ev_read (struct event *ev, char *data, unsigned datalen)
void ev_close (void)
bool ev_sleep (struct timeval *tv)
bool playback (void)
bool exec_redirected (const char *file, char *const argv[], int fd_stdin, int fd_stdout, int fd_stderr)
int main (int argc, char *argv[])

Variables

int fd_ev = -1


Define Documentation

#define EVBUFSIZE   512
 

Definition at line 59 of file record.c.

Referenced by main(), and playback().

#define EVFILE   "recording.tmp"
 

Definition at line 58 of file record.c.

Referenced by ev_creat(), and ev_open().


Function Documentation

void ev_close void   )  [static]
 

Definition at line 124 of file record.c.

References close(), and fd_ev.

Referenced by main(), and playback().

bool ev_creat void   )  [static]
 

Definition at line 77 of file record.c.

References EC_CLEANUP_BGN, EC_CLEANUP_END, ec_neg1, EVFILE, fd_ev, open(), and PERM_FILE.

Referenced by main().

bool ev_open void   )  [static]
 

Definition at line 67 of file record.c.

References EC_CLEANUP_BGN, EC_CLEANUP_END, ec_neg1, EVFILE, fd_ev, and open().

Referenced by playback().

bool ev_read struct event ev,
char *  data,
unsigned  datalen
[static]
 

Definition at line 103 of file record.c.

References event::e_datalen, EC_CLEANUP_BGN, EC_CLEANUP_END, EC_FAIL, ec_neg1, errno, fd_ev, and read().

Referenced by playback().

bool ev_sleep struct timeval tv  )  [static]
 

Definition at line 130 of file record.c.

References EC_CLEANUP_BGN, EC_CLEANUP_END, ec_neg1, get_rel_time(), sleep(), timeval_subtract(), timeval::tv_sec, timeval::tv_usec, and usleep().

Referenced by playback().

bool ev_write char *  data,
unsigned  datalen
[static]
 

Definition at line 88 of file record.c.

References event::e_datalen, event::e_time, EC_CLEANUP_BGN, EC_CLEANUP_END, ec_neg1, fd_ev, get_rel_time(), and writeall().

Referenced by main().

bool exec_redirected const char *  file,
char *const  argv[],
int  fd_stdin,
int  fd_stdout,
int  fd_stderr
 

Definition at line 184 of file record.c.

References close(), dup2(), EC_CLEANUP_BGN, EC_CLEANUP_END, ec_neg1, and execvp().

Referenced by main().

void get_rel_time struct timeval tv_rel  )  [static]
 

Definition at line 44 of file record.c.

References gettimeofday(), and timeval_subtract().

Referenced by ev_sleep(), and ev_write().

int main int  argc,
char *  argv[]
 

Definition at line 206 of file record.c.

References EC_CLEANUP, EC_CLEANUP_BGN, EC_CLEANUP_END, EC_FAIL, ec_false, ec_neg1, ec_null, errno, ev_close(), ev_creat(), ev_write(), EVBUFSIZE, exec_redirected(), exit(), FD_ISSET(), FD_SET(), FD_ZERO(), fork(), playback(), pt_close_master(), PT_GET_MASTER_FD, PT_GET_SLAVE_FD, pt_open_master(), pt_open_slave(), pt_wait_master(), read(), select(), tc_restore(), tc_setraw(), and writeall().

bool playback void   )  [static]
 

Definition at line 148 of file record.c.

References termios::c_lflag, event::e_datalen, event::e_time, EC_CLEANUP, EC_CLEANUP_BGN, EC_CLEANUP_END, ec_false, ec_neg1, ev_close(), ev_open(), ev_read(), ev_sleep(), EVBUFSIZE, sleep(), tcdrain(), tcgetattr(), tcsetattr(), write(), and writeall().

Referenced by main().

void timeval_subtract const struct timeval x,
const struct timeval y,
struct timeval diff
[static]
 

Definition at line 31 of file record.c.

References timeval::tv_sec, and timeval::tv_usec.

Referenced by ev_sleep(), and get_rel_time().


Variable Documentation

int fd_ev = -1 [static]
 

Definition at line 65 of file record.c.

Referenced by ev_close(), ev_creat(), ev_open(), ev_read(), and ev_write().


Generated on Fri Apr 23 10:57:08 2004 for AUP2 Example Source by doxygen 1.3.1