| 1 | diff -u -r ../ttyrec-1.0.8/ttyrec.c ./ttyrec.c |
| 2 | --- ../ttyrec-1.0.8/ttyrec.c 2006-06-11 17:52:50.000000000 +0200 |
| 3 | +++ ./ttyrec.c 2014-06-26 11:01:31.614213029 +0200 |
| 4 | @@ -48,7 +48,7 @@ |
| 5 | #include <sys/ioctl.h> |
| 6 | #include <sys/time.h> |
| 7 | #include <sys/file.h> |
| 8 | -#include <sys/signal.h> |
| 9 | +#include <signal.h> |
| 10 | #include <stdio.h> |
| 11 | #include <time.h> |
| 12 | #include <unistd.h> |
| 13 | @@ -74,6 +74,35 @@ |
| 14 | #include <libutil.h> |
| 15 | #endif |
| 16 | |
| 17 | +#ifdef __ANDROID__ |
| 18 | +#define HAVE_openpty |
| 19 | +int openpty(int *amaster, int *aslave, char *name, struct termios *termp, struct winsize *winp) |
| 20 | +{ |
| 21 | + char buf[512]; |
| 22 | + int master, slave; |
| 23 | + |
| 24 | + master = open("/dev/ptmx", O_RDWR); |
| 25 | + if (master == -1) return -1; |
| 26 | + if (grantpt(master) || unlockpt(master) || ptsname_r(master, buf, sizeof buf)) goto fail; |
| 27 | + |
| 28 | + slave = open(buf, O_RDWR | O_NOCTTY); |
| 29 | + if (slave == -1) goto fail; |
| 30 | + |
| 31 | + /* XXX Should we ignore errors here? */ |
| 32 | + if (termp) tcsetattr(slave, TCSAFLUSH, termp); |
| 33 | + if (winp) ioctl(slave, TIOCSWINSZ, winp); |
| 34 | + |
| 35 | + *amaster = master; |
| 36 | + *aslave = slave; |
| 37 | + if (name != NULL) strcpy(name, buf); |
| 38 | + return 0; |
| 39 | + |
| 40 | +fail: |
| 41 | + close(master); |
| 42 | + return -1; |
| 43 | +} |
| 44 | +#endif |
| 45 | + |
| 46 | #if defined(SVR4) && !defined(CDEL) |
| 47 | #if defined(_POSIX_VDISABLE) |
| 48 | #define CDEL _POSIX_VDISABLE |
| 49 | @@ -156,7 +185,7 @@ |
| 50 | |
| 51 | shell = getenv("SHELL"); |
| 52 | if (shell == NULL) |
| 53 | - shell = "/bin/sh"; |
| 54 | + shell = "@TERMUX_PREFIX@/bin/sh"; |
| 55 | |
| 56 | getmaster(); |
| 57 | fixtty(); |
| 58 | @@ -203,11 +232,7 @@ |
| 59 | void |
| 60 | finish() |
| 61 | { |
| 62 | -#if defined(SVR4) |
| 63 | int status; |
| 64 | -#else /* !SVR4 */ |
| 65 | - union wait status; |
| 66 | -#endif /* !SVR4 */ |
| 67 | register int pid; |
| 68 | register int die = 0; |
| 69 | |