New package: ttyrec-1.0.8

This commit is contained in:
Enno Boland 2014-04-12 10:23:11 +02:00
parent 881cec66ef
commit 052ee11aa6
2 changed files with 103 additions and 0 deletions

View file

@ -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 <libutil.h>
+/* #include <libutil.h> */
+#include <pty.h> // for openpty and forkpty
+#include <utmp.h> // for login_tty
#endif
#if defined(SVR4) && !defined(CDEL)

21
srcpkgs/ttyrec/template Normal file
View file

@ -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 <eb@s01.de>"
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
}