=================================================================== RCS file: /home/cvs/OpenXM_contrib2/fep/fep_main.c,v retrieving revision 1.7 retrieving revision 1.11 diff -u -p -r1.7 -r1.11 --- OpenXM_contrib2/fep/fep_main.c 2010/04/23 05:34:05 1.7 +++ OpenXM_contrib2/fep/fep_main.c 2019/12/13 15:41:36 1.11 @@ -1,8 +1,14 @@ /* Copyright (c) 1987, 1988 by Software Research Associates, Inc. */ +#if defined(ANDROID) +#include +#define index(s,c) strchr(s,c) +#define rindex(s,c) strrchr(s,c) +#endif + #ifndef lint static char rcsid[]= -"$Id: fep_main.c,v 1.7 2010/04/23 05:34:05 ohara Exp $ (SRA)"; +"$Id: fep_main.c,v 1.11 2019/12/13 15:41:36 fujimoto Exp $ (SRA)"; #endif /* lint */ #include @@ -248,7 +254,11 @@ DEFAULT: * Set variable of command name. */ { +#if defined(ANDROID) + char *cp = argv[1]; +#else char *cp = argv[1], *rindex(); +#endif if (any ('/', cp)) cp = rindex (cp, '/') + 1; @@ -341,7 +351,7 @@ recover_signal () input_handler() { char *inputline; - char *getline (); + char *mygetline (); /* * Get slave tty descriptor for auto-tty-fix @@ -349,7 +359,7 @@ input_handler() if ((slave = open (slave_tty, O_RDONLY)) < 0) perror ("open"); - while (inputline = getline ()) { + while (inputline = mygetline ()) { /* * XXX: nbyte should be greater than 0 only for ^@ input in emacs. * This solution is very ugly.. but it will takes a half day @@ -365,7 +375,7 @@ input_handler() /* * NOTE: - * Saving command line to output buffer is done in getline(). + * Saving command line to output buffer is done in mygetline(). * Because inputline here is converted by alias. */ @@ -868,7 +878,7 @@ get_pty_master() master = 1; return; } -#if defined(__CYGWIN32__) || defined(__linux__) +#if defined(__CYGWIN32__) || defined(__linux__) || defined(__APPLE__) sprintf (master_tty, "/dev/ptmx"); master = open (master_tty, O_RDWR); if (master >= 0) { @@ -880,6 +890,14 @@ get_pty_master() strcpy(slave_tty, name); goto FOUND; } +#elif defined(__APPLE__) + char *name; + grantpt(master); + unlockpt(master); + if ( name = (char *)ptsname(master) ) { + strcpy(slave_tty, name); + goto FOUND; + } #else char *name; name = (char *)ptsname(master); @@ -1075,6 +1093,7 @@ usageAndExit() */ void sigwinch(int dummy) { + char *itoa(int i); #ifdef TIOCGWINSZ /* 4.3BSD */ struct winsize win;