[BACK]Return to fep_main.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / fep

Diff for /OpenXM_contrib2/fep/fep_main.c between version 1.4 and 1.8

version 1.4, 2004/12/01 17:40:16 version 1.8, 2011/06/16 08:17:15
Line 6  static char rcsid[]=
Line 6  static char rcsid[]=
 #endif /* lint */  #endif /* lint */
   
 #include <stdio.h>  #include <stdio.h>
   #include <stdlib.h>
   #include <string.h>
 #include <signal.h>  #include <signal.h>
 #include <sys/types.h>  #include <sys/types.h>
 #include <sys/stat.h>  #include <sys/stat.h>
Line 257  DEFAULT:
Line 259  DEFAULT:
     commandv = &argv[1];      commandv = &argv[1];
   
     if (! isatty (0)) {      if (! isatty (0)) {
   #if defined(__INTERIX)
           execvp (*commandv, commandv);
   #else
         execvp (*commandv, commandv, 0);          execvp (*commandv, commandv, 0);
   #endif
         perror (*commandv);          perror (*commandv);
         exit (1);          exit (1);
     }      }
Line 335  recover_signal ()
Line 341  recover_signal ()
 input_handler()  input_handler()
 {  {
     char   *inputline;      char   *inputline;
     char   *getline ();      char   *mygetline ();
   
     /*      /*
      * Get slave tty descriptor for auto-tty-fix       * Get slave tty descriptor for auto-tty-fix
Line 343  input_handler()
Line 349  input_handler()
     if ((slave = open (slave_tty, O_RDONLY)) < 0)      if ((slave = open (slave_tty, O_RDONLY)) < 0)
         perror ("open");          perror ("open");
   
     while (inputline = getline ()) {      while (inputline = mygetline ()) {
         /*          /*
          * XXX: nbyte should be greater than 0 only for ^@ input in emacs.           * XXX: nbyte should be greater than 0 only for ^@ input in emacs.
          * This solution is very ugly.. but it will takes a half day           * This solution is very ugly.. but it will takes a half day
Line 359  input_handler()
Line 365  input_handler()
   
         /*          /*
          * NOTE:           * 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.           * Because inputline here is converted by alias.
          */           */
   
Line 541  int set_buffer (bp, size)
Line 547  int set_buffer (bp, size)
     BUFFER *bp;      BUFFER *bp;
     int size;      int size;
 {  {
     char *newbuf, *malloc(), *realloc();      char *newbuf;
   
     if (bp->b_buf)      if (bp->b_buf)
         newbuf = (char *) realloc (bp->b_buf, size);          newbuf = (char *) realloc (bp->b_buf, size);
Line 673  swallow_output()
Line 679  swallow_output()
 #include <sys/m_wait.h>  #include <sys/m_wait.h>
 #endif  #endif
   
   #if defined(__INTERIX)
   #define wait3(s,opt,rp)   (waitpid((-1),(s),(opt)))
   #endif
   
 void  void
 catchsig(n)  catchsig(n)
     int n;      int n;
Line 702  exec_to_command(argv)
Line 712  exec_to_command(argv)
      */       */
     t = open ("/dev/tty", 2);      t = open ("/dev/tty", 2);
     if (t >= 0) {      if (t >= 0) {
 #ifndef __CYGWIN32__  #if !defined(__CYGWIN32__) && !defined(__INTERIX)
         ioctl (t, TIOCNOTTY, (char *) 0);          ioctl (t, TIOCNOTTY, (char *) 0);
 #endif  #endif
         (void) close (t);          (void) close (t);
Line 721  exec_to_command(argv)
Line 731  exec_to_command(argv)
 #elif defined(TIOCSETN)  #elif defined(TIOCSETN)
     ioctl (0, TIOCSETN, (char *) & slave_ttymode);      ioctl (0, TIOCSETN, (char *) & slave_ttymode);
 #endif  #endif
   #if defined(__INTERIX)
       execvp (*argv, argv);
   #else
     execvp (*argv, argv, 0);      execvp (*argv, argv, 0);
   #endif
     perror (*argv);      perror (*argv);
     exit (1);      exit (1);
 }  }
Line 854  get_pty_master()
Line 868  get_pty_master()
         master = 1;          master = 1;
         return;          return;
     }      }
 #ifdef __CYGWIN32__  #if defined(__CYGWIN32__) || defined(__linux__)
     sprintf (master_tty, "/dev/ptmx");      sprintf (master_tty, "/dev/ptmx");
     master = open (master_tty, O_RDWR);      master = open (master_tty, O_RDWR);
     if (master >= 0) {      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;          char *name;
         name = (char *)ptsname(master);          name = (char *)ptsname(master);
         if ( name != 0 ) {          if ( name != 0 ) {
             strcpy(slave_tty, name);              strcpy(slave_tty, name);
             goto FOUND;              goto FOUND;
         }          }
   #endif
     }      }
 #else  #else
     for (c = 'p'; c <= 's'; c++) {      for (c = 'p'; c <= 's'; c++) {

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.8

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>