File: rec.c

package info (click to toggle)
termrec 0.19-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,148 kB
  • sloc: ansic: 8,430; makefile: 181; perl: 16; sh: 15
file content (24 lines) | stat: -rw-r--r-- 656 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <ttyrec.h>
#include <time.h>
#include "config.h"
#include "sys/error.h"

int main(int argc, char **argv)
{
    recorder r;
    struct timeval tv;

    if (argc!=2)
        die("Usage: rec outfile\n");

    tv.tv_sec=20;
    tv.tv_usec=10;
    if (!(r=ttyrec_w_open(-1, 0, argv[1], &tv)))
        die("Can't write the ttyrec to %s\n", argv[1]);
    ttyrec_w_write(r, &tv, "Abc", 3);    tv.tv_sec++;
    ttyrec_w_write(r, &tv, "D", 1);      tv.tv_sec++;
    ttyrec_w_write(r, &tv, "Ef", 2);     tv.tv_sec++;
    ttyrec_w_write(r, &tv, "G", 1);      tv.tv_sec++;
    ttyrec_w_write(r, &tv, "Hij\n", 4);  tv.tv_sec++;
    return !ttyrec_w_close(r);
}