/[emacs]/emacs/src/sysdep.c
ViewVC logotype

Diff of /emacs/src/sysdep.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.247 by tamm, Sun Dec 8 06:00:10 2002 UTC revision 1.248 by lektu, Tue Feb 4 14:03:13 2003 UTC
# Line 391  init_baud_rate () Line 391  init_baud_rate ()
391        emacs_ospeed = sg.c_cflag & CBAUD;        emacs_ospeed = sg.c_cflag & CBAUD;
392  #else /* neither VMS nor TERMIOS nor TERMIO */  #else /* neither VMS nor TERMIOS nor TERMIO */
393        struct sgttyb sg;        struct sgttyb sg;
394          
395        sg.sg_ospeed = B9600;        sg.sg_ospeed = B9600;
396        if (ioctl (input_fd, TIOCGETP, &sg) < 0)        if (ioctl (input_fd, TIOCGETP, &sg) < 0)
397          abort ();          abort ();
# Line 402  init_baud_rate () Line 402  init_baud_rate ()
402  #endif /* not DOS_NT */  #endif /* not DOS_NT */
403  #endif /* not INIT_BAUD_RATE */  #endif /* not INIT_BAUD_RATE */
404      }      }
405      
406    baud_rate = (emacs_ospeed < sizeof baud_convert / sizeof baud_convert[0]    baud_rate = (emacs_ospeed < sizeof baud_convert / sizeof baud_convert[0]
407                 ? baud_convert[emacs_ospeed] : 9600);                 ? baud_convert[emacs_ospeed] : 9600);
408    if (baud_rate == 0)    if (baud_rate == 0)
# Line 543  wait_for_termination (pid) Line 543  wait_for_termination (pid)
543   *      flush any pending output   *      flush any pending output
544   *      (may flush input as well; it does not matter the way we use it)   *      (may flush input as well; it does not matter the way we use it)
545   */   */
546    
547  void  void
548  flush_pending_output (channel)  flush_pending_output (channel)
549       int channel;       int channel;
# Line 812  sys_subshell () Line 812  sys_subshell ()
812    save_signal_handlers (saved_handlers);    save_signal_handlers (saved_handlers);
813    synch_process_alive = 1;    synch_process_alive = 1;
814  #endif /* __DJGPP__ > 1 */  #endif /* __DJGPP__ > 1 */
815  #else    #else
816    pid = vfork ();    pid = vfork ();
817    if (pid == -1)    if (pid == -1)
818      error ("Can't spawn subshell");      error ("Can't spawn subshell");
# Line 1002  unrequest_sigio () Line 1002  unrequest_sigio ()
1002  }  }
1003    
1004  #else /* not FASYNC, not STRIDE */  #else /* not FASYNC, not STRIDE */
1005    
1006  #ifdef _CX_UX  #ifdef _CX_UX
1007    
1008  #include <termios.h>  #include <termios.h>
# Line 1046  request_sigio () Line 1046  request_sigio ()
1046    
1047    croak ("request_sigio");    croak ("request_sigio");
1048  }  }
1049    
1050  void  void
1051  unrequest_sigio ()  unrequest_sigio ()
1052  {  {
# Line 1258  emacs_set_tty (fd, settings, flushp) Line 1258  emacs_set_tty (fd, settings, flushp)
1258        || ioctl (fd, TIOCLSET, &settings->lmode) < 0)        || ioctl (fd, TIOCLSET, &settings->lmode) < 0)
1259      return -1;      return -1;
1260  #endif  #endif
1261      
1262    /* We have survived the tempest.  */    /* We have survived the tempest.  */
1263    return 0;    return 0;
1264  }  }
# Line 1298  unsigned char _sobuf[BUFSIZ+8]; Line 1298  unsigned char _sobuf[BUFSIZ+8];
1298  char _sobuf[BUFSIZ];  char _sobuf[BUFSIZ];
1299  #endif  #endif
1300  #endif  #endif
1301    
1302  #ifdef HAVE_LTCHARS  #ifdef HAVE_LTCHARS
1303  static struct ltchars new_ltchars = {-1,-1,-1,-1,-1,-1};  static struct ltchars new_ltchars = {-1,-1,-1,-1,-1,-1};
1304  #endif  #endif
1305  #ifdef HAVE_TCHARS  #ifdef HAVE_TCHARS
1306  static struct tchars new_tchars = {-1,-1,-1,-1,-1,-1};  static struct tchars new_tchars = {-1,-1,-1,-1,-1,-1};
1307  #endif  #endif
1308    
1309  void  void
1310  init_sys_modes ()  init_sys_modes ()
# Line 1413  nil means don't delete them until `list- Line 1413  nil means don't delete them until `list-
1413          }          }
1414        else        else
1415          tty.main.c_iflag &= ~IXON;      /* Disable start/stop output control */          tty.main.c_iflag &= ~IXON;      /* Disable start/stop output control */
1416        tty.main.c_oflag &= ~ONLCR;       /* Disable map of NL to CR-NL        tty.main.c_oflag &= ~ONLCR;       /* Disable map of NL to CR-NL
1417                                             on output */                                             on output */
1418        tty.main.c_oflag &= ~TAB3;        /* Disable tab expansion */        tty.main.c_oflag &= ~TAB3;        /* Disable tab expansion */
1419  #ifdef CS8  #ifdef CS8
# Line 1554  nil means don't delete them until `list- Line 1554  nil means don't delete them until `list-
1554           anything, and leaving it in breaks the meta key.  Go figure.  */           anything, and leaving it in breaks the meta key.  Go figure.  */
1555        tty.lmode &= ~LLITOUT;        tty.lmode &= ~LLITOUT;
1556  #endif  #endif
1557          
1558  #ifdef BSD4_1  #ifdef BSD4_1
1559        lmode = tty.lmode;        lmode = tty.lmode;
1560  #endif  #endif
# Line 1679  nil means don't delete them until `list- Line 1679  nil means don't delete them until `list-
1679    
1680  /* Return nonzero if safe to use tabs in output.  /* Return nonzero if safe to use tabs in output.
1681     At the time this is called, init_sys_modes has not been done yet.  */     At the time this is called, init_sys_modes has not been done yet.  */
1682      
1683  int  int
1684  tabs_safe_p ()  tabs_safe_p ()
1685  {  {
# Line 1715  get_frame_size (widthp, heightp) Line 1715  get_frame_size (widthp, heightp)
1715  #ifdef TIOCGSIZE  #ifdef TIOCGSIZE
1716    
1717    /* SunOS - style.  */    /* SunOS - style.  */
1718    struct ttysize size;      struct ttysize size;
1719    
1720    if (ioctl (input_fd, TIOCGSIZE, &size) == -1)    if (ioctl (input_fd, TIOCGSIZE, &size) == -1)
1721      *widthp = *heightp = 0;      *widthp = *heightp = 0;
# Line 1729  get_frame_size (widthp, heightp) Line 1729  get_frame_size (widthp, heightp)
1729  #ifdef VMS  #ifdef VMS
1730    
1731    struct sensemode tty;    struct sensemode tty;
1732      
1733    SYS$QIOW (0, input_fd, IO$_SENSEMODE, &tty, 0, 0,    SYS$QIOW (0, input_fd, IO$_SENSEMODE, &tty, 0, 0,
1734              &tty.class, 12, 0, 0, 0, 0);              &tty.class, 12, 0, 0, 0, 0);
1735    *widthp = tty.scr_wid;    *widthp = tty.scr_wid;
# Line 1772  set_window_size (fd, height, width) Line 1772  set_window_size (fd, height, width)
1772  #ifdef TIOCSSIZE  #ifdef TIOCSSIZE
1773    
1774    /* SunOS - style.  */    /* SunOS - style.  */
1775    struct ttysize size;      struct ttysize size;
1776    size.ts_lines = height;    size.ts_lines = height;
1777    size.ts_cols = width;    size.ts_cols = width;
1778    
# Line 1793  void Line 1793  void
1793  reset_sys_modes ()  reset_sys_modes ()
1794  {  {
1795    struct frame *sf;    struct frame *sf;
1796      
1797    if (noninteractive)    if (noninteractive)
1798      {      {
1799        fflush (stdout);        fflush (stdout);
# Line 1820  reset_sys_modes () Line 1820  reset_sys_modes ()
1820    cursor_to (FRAME_HEIGHT (sf) - 1, 0);    cursor_to (FRAME_HEIGHT (sf) - 1, 0);
1821  #if defined (IBMR2AIX) && defined (AIXHFT)  #if defined (IBMR2AIX) && defined (AIXHFT)
1822    {    {
1823      /* HFT devices normally use ^J as a LF/CR.  We forced it to      /* HFT devices normally use ^J as a LF/CR.  We forced it to
1824         do the LF only.  Now, we need to reset it. */         do the LF only.  Now, we need to reset it. */
1825      struct termio tty;      struct termio tty;
1826    
# Line 1903  setup_pty (fd) Line 1903  setup_pty (fd)
1903       does this.  Also it is known that telnet mode will hang       does this.  Also it is known that telnet mode will hang
1904       in such a way that Emacs must be stopped (perhaps this       in such a way that Emacs must be stopped (perhaps this
1905       is the same problem).       is the same problem).
1906        
1907       If TIOCREMOTE is turned off, then there is a bug in       If TIOCREMOTE is turned off, then there is a bug in
1908       hp-ux which sometimes loses data.  Apparently the       hp-ux which sometimes loses data.  Apparently the
1909       code which blocks the master process when the internal       code which blocks the master process when the internal
1910       buffer fills up does not work.  Other than this,       buffer fills up does not work.  Other than this,
1911       though, everything else seems to work fine.       though, everything else seems to work fine.
1912        
1913       Since the latter lossage is more benign, we may as well       Since the latter lossage is more benign, we may as well
1914       lose that way.  -- cph */       lose that way.  -- cph */
1915  #ifdef FIONBIO  #ifdef FIONBIO
# Line 1941  void Line 1941  void
1941  init_vms_input ()  init_vms_input ()
1942  {  {
1943    int status;    int status;
1944      
1945    if (input_fd == 0)    if (input_fd == 0)
1946      {      {
1947        status = SYS$ASSIGN (&input_dsc, &input_fd, 0, 0);        status = SYS$ASSIGN (&input_dsc, &input_fd, 0, 0);
# Line 2142  sys_sleep (timeval) Line 2142  sys_sleep (timeval)
2142    int time [2];    int time [2];
2143    static int zero = 0;    static int zero = 0;
2144    static int large = -10000000;    static int large = -10000000;
2145      
2146    LIB$EMUL (&timeval, &large, &zero, time);       /* Convert to VMS format */    LIB$EMUL (&timeval, &large, &zero, time);       /* Convert to VMS format */
2147    
2148    SYS$CANTIM (1, 0);    SYS$CANTIM (1, 0);
# Line 2242  start_of_text () Line 2242  start_of_text ()
2242   *      will be patched by unexec to the correct value.   *      will be patched by unexec to the correct value.
2243   *   *
2244   */   */
2245    
2246  #ifndef start_of_data  #ifndef start_of_data
2247  char *  char *
2248  start_of_data ()  start_of_data ()
# Line 2542  sys_select (nfds, rfds, wfds, efds, time Line 2542  sys_select (nfds, rfds, wfds, efds, time
2542    /* Once a second, till the timer expires, check all the flagged read    /* Once a second, till the timer expires, check all the flagged read
2543     * descriptors to see if any input is available.  If there is some then     * descriptors to see if any input is available.  If there is some then
2544     * set the corresponding bit in the return copy of rfds.     * set the corresponding bit in the return copy of rfds.
2545     */     */
2546    while (1)    while (1)
2547      {      {
2548        register int to_check, fd;        register int to_check, fd;
# Line 2589  sys_select (nfds, rfds, wfds, efds, time Line 2589  sys_select (nfds, rfds, wfds, efds, time
2589        signal (SIGALRM, select_alarm);        signal (SIGALRM, select_alarm);
2590        select_alarmed = 0;        select_alarmed = 0;
2591        alarm (SELECT_PAUSE);        alarm (SELECT_PAUSE);
2592          
2593        /* Wait for a SIGALRM (or maybe a SIGTINT) */        /* Wait for a SIGALRM (or maybe a SIGTINT) */
2594        while (select_alarmed == 0 && *local_timeout != 0        while (select_alarmed == 0 && *local_timeout != 0
2595               && process_tick == update_tick)               && process_tick == update_tick)
# Line 2607  sys_select (nfds, rfds, wfds, efds, time Line 2607  sys_select (nfds, rfds, wfds, efds, time
2607              pause ();              pause ();
2608          }          }
2609        (*local_timeout) -= SELECT_PAUSE;        (*local_timeout) -= SELECT_PAUSE;
2610          
2611        /* Reset the old alarm if there was one.  */        /* Reset the old alarm if there was one.  */
2612        turn_on_atimers (1);        turn_on_atimers (1);
2613          
2614        if (*local_timeout == 0)  /* Stop on timer being cleared */        if (*local_timeout == 0)  /* Stop on timer being cleared */
2615          break;          break;
2616      }      }
# Line 3239  emacs_open (path, oflag, mode) Line 3239  emacs_open (path, oflag, mode)
3239    register int rtnval;    register int rtnval;
3240    
3241  #ifdef BSD4_1  #ifdef BSD4_1
3242    if (oflag & O_CREAT)    if (oflag & O_CREAT)
3243      return creat (path, mode);      return creat (path, mode);
3244  #endif  #endif
3245      
3246    while ((rtnval = open (path, oflag, mode)) == -1    while ((rtnval = open (path, oflag, mode)) == -1
3247           && (errno == EINTR));           && (errno == EINTR));
3248    return (rtnval);    return (rtnval);
# Line 3275  emacs_read (fildes, buf, nbyte) Line 3275  emacs_read (fildes, buf, nbyte)
3275       unsigned int nbyte;       unsigned int nbyte;
3276  {  {
3277    register int rtnval;    register int rtnval;
3278      
3279    while ((rtnval = read (fildes, buf, nbyte)) == -1    while ((rtnval = read (fildes, buf, nbyte)) == -1
3280           && (errno == EINTR));           && (errno == EINTR));
3281    return (rtnval);    return (rtnval);
# Line 3415  dup2 (oldd, newd) Line 3415  dup2 (oldd, newd)
3415       int newd;       int newd;
3416  {  {
3417    register int fd, ret;    register int fd, ret;
3418      
3419    emacs_close (newd);    emacs_close (newd);
3420    
3421  #ifdef F_DUPFD  #ifdef F_DUPFD
# Line 3444  dup2 (oldd, newd) Line 3444  dup2 (oldd, newd)
3444  #ifndef VMS  #ifndef VMS
3445  #ifndef HAVE_GETTIMEOFDAY  #ifndef HAVE_GETTIMEOFDAY
3446  #ifdef HAVE_TIMEVAL  #ifdef HAVE_TIMEVAL
3447    
3448  /* ARGSUSED */  /* ARGSUSED */
3449  int  int
3450  gettimeofday (tp, tzp)  gettimeofday (tp, tzp)
# Line 3453  gettimeofday (tp, tzp) Line 3453  gettimeofday (tp, tzp)
3453  {  {
3454    extern long time ();    extern long time ();
3455    
3456    tp->tv_sec = time ((long *)0);        tp->tv_sec = time ((long *)0);
3457    tp->tv_usec = 0;    tp->tv_usec = 0;
3458    if (tzp != 0)    if (tzp != 0)
3459      tzp->tz_minuteswest = -1;      tzp->tz_minuteswest = -1;
3460    return 0;    return 0;
3461  }  }
3462    
3463  #endif  #endif
3464  #endif  #endif
3465  #endif  #endif
3466  #endif /* subprocess && !HAVE_GETTIMEOFDAY && HAVE_TIMEVAL && !VMS */  #endif /* subprocess && !HAVE_GETTIMEOFDAY && HAVE_TIMEVAL && !VMS */
3467      
3468  /*  /*
3469   *      This function will go away as soon as all the stubs fixed. (fnf)   *      This function will go away as soon as all the stubs fixed. (fnf)
3470   */   */
# Line 3831  vmserrstr (status) Line 3831  vmserrstr (status)
3831    
3832  #ifdef access  #ifdef access
3833  #undef access  #undef access
3834      
3835  /* The following is necessary because 'access' emulation by VMS C (2.0) does  /* The following is necessary because 'access' emulation by VMS C (2.0) does
3836   * not work correctly.  (It also doesn't work well in version 2.3.)   * not work correctly.  (It also doesn't work well in version 2.3.)
3837   */   */
# Line 3872  sys_access (path, mode) Line 3872  sys_access (path, mode)
3872     * access can treat the directory like a file.  */     * access can treat the directory like a file.  */
3873    if (directory_file_name (path, dir_fn))    if (directory_file_name (path, dir_fn))
3874      path = dir_fn;      path = dir_fn;
3875      
3876    if (mode == F_OK)    if (mode == F_OK)
3877      return access (path, mode);      return access (path, mode);
3878    if (user == NULL && (user = (char *) getenv ("USER")) == NULL)    if (user == NULL && (user = (char *) getenv ("USER")) == NULL)
# Line 3886  sys_access (path, mode) Line 3886  sys_access (path, mode)
3886      static int constant = ACL$C_FILE;      static int constant = ACL$C_FILE;
3887      DESCRIPTOR (path_desc, path);      DESCRIPTOR (path_desc, path);
3888      DESCRIPTOR (user_desc, user);      DESCRIPTOR (user_desc, user);
3889    
3890      flags = 0;      flags = 0;
3891      acces = 0;      acces = 0;
3892      if ((mode & X_OK) && ((stat = access (path, mode)) < 0 || mode == X_OK))      if ((mode & X_OK) && ((stat = access (path, mode)) < 0 || mode == X_OK))
# Line 3951  sys_access (filename, type) Line 3951  sys_access (filename, type)
3951      return access (filename, type);      return access (filename, type);
3952    
3953    /* Check write protection. */    /* Check write protection. */
3954        
3955  #define CHECKPRIV(bit)    (prvmask.bit)  #define CHECKPRIV(bit)    (prvmask.bit)
3956  #define WRITABLE(field)  (! ((xab.xab$w_pro >> field) & XAB$M_NOWRITE))  #define WRITABLE(field)  (! ((xab.xab$w_pro >> field) & XAB$M_NOWRITE))
3957    
# Line 4013  sys_access (filename, type) Line 4013  sys_access (filename, type)
4013  }  }
4014  #endif /* not VMS4_4 */  #endif /* not VMS4_4 */
4015  #endif /* access */  #endif /* access */
4016      
4017  static char vtbuf[NAM$C_MAXRSS+1];  static char vtbuf[NAM$C_MAXRSS+1];
4018    
4019  /* translate a vms file spec to a unix path */  /* translate a vms file spec to a unix path */
# Line 4054  sys_translate_vms (vfile) Line 4054  sys_translate_vms (vfile)
4054              *targ++ = '.';              *targ++ = '.';
4055              *targ++ = '.';              *targ++ = '.';
4056              break;              break;
4057                
4058            default:            default:
4059              *targ++ = *vfile;              *targ++ = *vfile;
4060              break;              break;
# Line 4147  sys_translate_unix (ufile) Line 4147  sys_translate_unix (ufile)
4147        ufile++;        ufile++;
4148      }      }
4149    *targ = '\0';    *targ = '\0';
4150      
4151    return utbuf;    return utbuf;
4152  }  }
4153    
# Line 4169  getwd (pathname) Line 4169  getwd (pathname)
4169      }      }
4170    strcpy (pathname, ptr);    strcpy (pathname, ptr);
4171    xfree (ptr);    xfree (ptr);
4172      
4173   return pathname;   return pathname;
4174  }  }
4175    
# Line 4506  sys_fwrite (ptr, size, num, fp) Line 4506  sys_fwrite (ptr, size, num, fp)
4506   * when this is not the desired behavior, for instance, when writing an   * when this is not the desired behavior, for instance, when writing an
4507   * auto save file (you only want one version), or when you don't have   * auto save file (you only want one version), or when you don't have
4508   * write permission in the directory containing the file (but the file   * write permission in the directory containing the file (but the file
4509   * itself is writable).  Hence this routine, which is equivalent to   * itself is writable).  Hence this routine, which is equivalent to
4510   * "close (creat (fn, 0));" on Unix if fn already exists.   * "close (creat (fn, 0));" on Unix if fn already exists.
4511   */   */
4512  int  int
# Line 4563  get_uaf_name (uname) Line 4563  get_uaf_name (uname)
4563    register status;    register status;
4564    struct FAB uaf_fab;    struct FAB uaf_fab;
4565    struct RAB uaf_rab;    struct RAB uaf_rab;
4566      
4567    uaf_fab = cc$rms_fab;    uaf_fab = cc$rms_fab;
4568    uaf_rab = cc$rms_rab;    uaf_rab = cc$rms_rab;
4569    /* initialize fab fields */    /* initialize fab fields */
# Line 4627  get_uaf_uic (uic) Line 4627  get_uaf_uic (uic)
4627    register status;    register status;
4628    struct FAB uaf_fab;    struct FAB uaf_fab;
4629    struct RAB uaf_rab;    struct RAB uaf_rab;
4630      
4631    uaf_fab = cc$rms_fab;    uaf_fab = cc$rms_fab;
4632    uaf_rab = cc$rms_rab;    uaf_rab = cc$rms_rab;
4633    /* initialize fab fields */    /* initialize fab fields */
# Line 4920  rename (from, to) Line 4920  rename (from, to)
4920     bits).  To maintain portability, the VMS implementation of `chmod' wires     bits).  To maintain portability, the VMS implementation of `chmod' wires
4921     the W and D bits together.  */     the W and D bits together.  */
4922    
4923    
4924  static struct fibdef fib;       /* We need this initialized to zero */  static struct fibdef fib;       /* We need this initialized to zero */
4925  char vms_file_written[NAM$C_MAXRSS];  char vms_file_written[NAM$C_MAXRSS];
4926    
# Line 5088  hft_init () Line 5088  hft_init ()
5088    
5089    /* If we're not on an HFT we shouldn't do any of this.  We determine    /* If we're not on an HFT we shouldn't do any of this.  We determine
5090       if we are on an HFT by trying to get an HFT error code.  If this       if we are on an HFT by trying to get an HFT error code.  If this
5091       call fails, we're not on an HFT. */       call fails, we're not on an HFT. */
5092  #ifdef IBMR2AIX  #ifdef IBMR2AIX
5093    if (ioctl (0, HFQERROR, &junk) < 0)    if (ioctl (0, HFQERROR, &junk) < 0)
5094      return;      return;

Legend:
Removed from v.1.247  
changed lines
  Added in v.1.248

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26