From 052ee11aa64beca849a125aa5eb538762b9a3004 Mon Sep 17 00:00:00 2001 From: Enno Boland Date: Sat, 12 Apr 2014 10:23:11 +0200 Subject: [PATCH] New package: ttyrec-1.0.8 --- srcpkgs/ttyrec/patches/tty.diff | 82 +++++++++++++++++++++++++++++++++ srcpkgs/ttyrec/template | 21 +++++++++ 2 files changed, 103 insertions(+) create mode 100644 srcpkgs/ttyrec/patches/tty.diff create mode 100644 srcpkgs/ttyrec/template diff --git a/srcpkgs/ttyrec/patches/tty.diff b/srcpkgs/ttyrec/patches/tty.diff new file mode 100644 index 00000000000..be1df7740de --- /dev/null +++ b/srcpkgs/ttyrec/patches/tty.diff @@ -0,0 +1,82 @@ +diff -upr ttyplay.c ttyplay.c +--- ttyplay.c 2006-06-11 17:52:50.000000000 +0200 ++++ ttyplay.c 2014-04-11 13:17:47.870307005 +0200 +@@ -132,6 +132,26 @@ ttywait (struct timeval prev, struct tim + return speed; + } + ++int dropCommands = 0; ++double ++ttyspacewait (struct timeval prev, struct timeval cur, double speed) ++{ ++ char c = '0'; ++ if(dropCommands != 0) { ++ dropCommands--; ++ return 0; ++ } ++ ++ while(strchr("\n ", c = fgetc(stdin)) == NULL) { ++ if(c < '0' || c > '9') { ++ dropCommands = 0; ++ continue; ++ } ++ dropCommands = dropCommands * 10 + (c - '0'); ++ } ++ return 0; /* Speed isn't important. */ ++} ++ + double + ttynowait (struct timeval prev, struct timeval cur, double speed) + { +@@ -241,6 +261,8 @@ usage (void) + printf("Usage: ttyplay [OPTION] [FILE]\n"); + printf(" -s SPEED Set speed to SPEED [1.0]\n"); + printf(" -n No wait mode\n"); ++ printf(" -t type mode. space or enter for next sequence\n"); ++ printf(" -d STEPS drop STEPS steps before pausing in type mode\n"); + printf(" -p Peek another person's ttyrecord\n"); + exit(EXIT_FAILURE); + } +@@ -270,7 +292,7 @@ main (int argc, char **argv) + + set_progname(argv[0]); + while (1) { +- int ch = getopt(argc, argv, "s:np"); ++ int ch = getopt(argc, argv, "s:nptd:"); + if (ch == EOF) { + break; + } +@@ -282,9 +304,19 @@ main (int argc, char **argv) + } + sscanf(optarg, "%lf", &speed); + break; ++ case 'd': ++ if (optarg == NULL) { ++ perror("-d option requires an argument"); ++ exit(EXIT_FAILURE); ++ } ++ dropCommands = atoi(optarg); ++ break; + case 'n': + wait_func = ttynowait; + break; ++ case 't': ++ wait_func = ttyspacewait; ++ break; + case 'p': + process = ttypeek; + break; +diff -upr ttyrec-1.0.8/ttyrec.c ttyrec-1.0.8.new/ttyrec.c +--- ttyrec.c 2006-06-11 17:52:50.000000000 +0200 ++++ ttyrec.c 2014-04-11 13:10:07.403341468 +0200 +@@ -71,7 +71,9 @@ + #define _(FOO) FOO + + #ifdef HAVE_openpty +-#include ++/* #include */ ++#include // for openpty and forkpty ++#include // for login_tty + #endif + + #if defined(SVR4) && !defined(CDEL) diff --git a/srcpkgs/ttyrec/template b/srcpkgs/ttyrec/template new file mode 100644 index 00000000000..0533aa41e86 --- /dev/null +++ b/srcpkgs/ttyrec/template @@ -0,0 +1,21 @@ +# Template file for 'ttyrec' +pkgname=ttyrec +version=1.0.8 +revision=1 +homepage="http://0xcc.net/ttyrec" +distfiles="http://0xcc.net/ttyrec/${pkgname}-${version}.tar.gz" +short_desc="tty recorder and player" +maintainer="Enno Boland " +license="BSD" +checksum=ef5e9bf276b65bb831f9c2554cd8784bd5b4ee65353808f82b7e2aef851587ec + +do_build() { + make ${makejobs} CFLAGS='-DHAVE_openpty -lutil' +} + +do_install() { + vinstall ttyrec 755 /usr/bin + vinstall ttyrec.1 644 /usr/share/man/man1 + vinstall ttyplay 755 /usr/bin + vinstall ttyplay.1 644 /usr/share/man/man1 +}