=================================================================== RCS file: /home/cvs/OpenXM_contrib2/fep/fep_main.c,v retrieving revision 1.5 retrieving revision 1.7 diff -u -p -r1.5 -r1.7 --- OpenXM_contrib2/fep/fep_main.c 2005/01/18 14:20:19 1.5 +++ OpenXM_contrib2/fep/fep_main.c 2010/04/23 05:34:05 1.7 @@ -2,10 +2,12 @@ #ifndef lint static char rcsid[]= -"$Id: fep_main.c,v 1.5 2005/01/18 14:20:19 ohara Exp $ (SRA)"; +"$Id: fep_main.c,v 1.7 2010/04/23 05:34:05 ohara Exp $ (SRA)"; #endif /* lint */ #include +#include +#include #include #include #include @@ -545,7 +547,7 @@ int set_buffer (bp, size) BUFFER *bp; int size; { - char *newbuf, *malloc(), *realloc(); + char *newbuf; if (bp->b_buf) newbuf = (char *) realloc (bp->b_buf, size); @@ -866,16 +868,26 @@ get_pty_master() master = 1; return; } -#ifdef __CYGWIN32__ +#if defined(__CYGWIN32__) || defined(__linux__) sprintf (master_tty, "/dev/ptmx"); master = open (master_tty, O_RDWR); if (master >= 0) { +#if defined(__linux__) + char name[BUFSIZ]; + grantpt(master); + unlockpt(master); + if ( !ptsname_r(master,name,sizeof(name)) ) { + strcpy(slave_tty, name); + goto FOUND; + } +#else char *name; name = (char *)ptsname(master); if ( name != 0 ) { strcpy(slave_tty, name); goto FOUND; } +#endif } #else for (c = 'p'; c <= 's'; c++) {