/[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.235 by akochoi, Fri Apr 26 23:39:05 2002 UTC revision 1.235.2.1 by miles, Fri Apr 4 06:21:03 2003 UTC
# Line 69  static int delete_exited_processes; Line 69  static int delete_exited_processes;
69  #endif  #endif
70  #endif /* not WINDOWSNT */  #endif /* not WINDOWSNT */
71    
72    #ifdef HAVE_CARBON
73    #define read sys_read
74    #endif
75    
76  /* Does anyone other than VMS need this? */  /* Does anyone other than VMS need this? */
77  #ifndef fwrite  #ifndef fwrite
78  #define sys_fwrite fwrite  #define sys_fwrite fwrite
# Line 143  extern int errno; Line 147  extern int errno;
147  #define MAXIOSIZE (32 * PAGESIZE) /* Don't I/O more than 32 blocks at a time */  #define MAXIOSIZE (32 * PAGESIZE) /* Don't I/O more than 32 blocks at a time */
148  #endif /* VMS */  #endif /* VMS */
149    
150  #ifndef BSD4_1  #ifndef VMS
151  #ifdef BSD_SYSTEM /* avoid writing defined (BSD_SYSTEM) || defined (USG)  #include <sys/file.h>
152                because the vms compiler doesn't grok `defined' */  #endif /* not VMS */
153  #include <fcntl.h>  
154  #endif  #ifdef HAVE_FCNTL_H
 #ifdef USG  
 #ifndef USG5  
155  #include <fcntl.h>  #include <fcntl.h>
156  #endif  #endif
 #endif  
 #endif /* not 4.1 bsd */  
157    
158  #ifndef MSDOS  #ifndef MSDOS
159  #include <sys/ioctl.h>  #include <sys/ioctl.h>
# Line 327  discard_tty_input () Line 327  discard_tty_input ()
327     the terminal.  */     the terminal.  */
328    
329  void  void
330    #ifdef PROTOTYPES
331    stuff_char (char c)
332    #else
333  stuff_char (c)  stuff_char (c)
334       char c;       char c;
335    #endif
336  {  {
337    if (read_socket_hook)    if (read_socket_hook)
338      return;      return;
# Line 387  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 398  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 539  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 795  sys_subshell () Line 799  sys_subshell ()
799      goto xyzzy;      goto xyzzy;
800    
801    dir = expand_and_dir_to_file (Funhandled_file_name_directory (dir), Qnil);    dir = expand_and_dir_to_file (Funhandled_file_name_directory (dir), Qnil);
802    str = (unsigned char *) alloca (XSTRING (dir)->size + 2);    str = (unsigned char *) alloca (SCHARS (dir) + 2);
803    len = XSTRING (dir)->size;    len = SCHARS (dir);
804    bcopy (XSTRING (dir)->data, str, len);    bcopy (SDATA (dir), str, len);
805    if (str[len - 1] != '/') str[len++] = '/';    if (str[len - 1] != '/') str[len++] = '/';
806    str[len] = 0;    str[len] = 0;
807   xyzzy:   xyzzy:
# Line 808  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 998  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 1032  unrequest_sigio () Line 1036  unrequest_sigio ()
1036  }  }
1037    
1038  #else /* ! _CX_UX */  #else /* ! _CX_UX */
1039    #ifndef MSDOS
1040    
1041  void  void
1042  request_sigio ()  request_sigio ()
# Line 1041  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 1050  unrequest_sigio () Line 1055  unrequest_sigio ()
1055    
1056    croak ("unrequest_sigio");    croak ("unrequest_sigio");
1057  }  }
1058    
1059    #endif /* MSDOS */
1060  #endif /* _CX_UX */  #endif /* _CX_UX */
1061  #endif /* STRIDE */  #endif /* STRIDE */
1062  #endif /* FASYNC */  #endif /* FASYNC */
# Line 1252  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 1292  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 1407  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 1548  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 1673  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 1709  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 1723  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 1766  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 1787  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 1814  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 1897  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 1935  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 2011  kbd_input_ast () Line 2017  kbd_input_ast ()
2017    if (c >= 0)    if (c >= 0)
2018      {      {
2019        struct input_event e;        struct input_event e;
2020        e.kind = ascii_keystroke;        e.kind = ASCII_KEYSTROKE_EVENT;
2021        XSETINT (e.code, c);        XSETINT (e.code, c);
2022        e.frame_or_window = selected_frame;        e.frame_or_window = selected_frame;
2023        kbd_buffer_store_event (&e);        kbd_buffer_store_event (&e);
# Line 2136  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 2236  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
2247  char *  char *
2248  start_of_data ()  start_of_data ()
2249  {  {
# Line 2259  start_of_data () Line 2266  start_of_data ()
2266  #endif /* ORDINARY_LINK */  #endif /* ORDINARY_LINK */
2267  #endif /* DATA_START */  #endif /* DATA_START */
2268  }  }
2269    #endif /* start_of_data */
2270  #endif /* NEED_STARTS (not CANNOT_DUMP or not SYSTEM_MALLOC) */  #endif /* NEED_STARTS (not CANNOT_DUMP or not SYSTEM_MALLOC) */
   
 #ifndef CANNOT_DUMP  
 /* Some systems that cannot dump also cannot implement these.  */  
   
 /*  
  *      Return the address of the end of the text segment prior to  
  *      doing an unexec.  After unexec the return value is undefined.  
  */  
   
 char *  
 end_of_text ()  
 {  
 #ifdef TEXT_END  
   return ((char *) TEXT_END);  
 #else  
   extern int etext;  
   return ((char *) &etext);  
 #endif  
 }  
   
 /*  
  *      Return the address of the end of the data segment prior to  
  *      doing an unexec.  After unexec the return value is undefined.  
  */  
   
 char *  
 end_of_data ()  
 {  
 #ifdef DATA_END  
   return ((char *) DATA_END);  
 #else  
   extern int edata;  
   return ((char *) &edata);  
 #endif  
 }  
   
 #endif /* not CANNOT_DUMP */  
2271    
2272  /* init_system_name sets up the string for the Lisp function  /* init_system_name sets up the string for the Lisp function
2273     system-name to return. */     system-name to return. */
# Line 2465  init_system_name () Line 2436  init_system_name ()
2436  #endif /* BSD4_1 */  #endif /* BSD4_1 */
2437    {    {
2438      unsigned char *p;      unsigned char *p;
2439      for (p = XSTRING (Vsystem_name)->data; *p; p++)      for (p = SDATA (Vsystem_name); *p; p++)
2440        if (*p == ' ' || *p == '\t')        if (*p == ' ' || *p == '\t')
2441          *p = '-';          *p = '-';
2442    }    }
# Line 2571  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 2618  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 2636  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 2680  read_input_waiting () Line 2651  read_input_waiting ()
2651            kbd_buffer_store_event (&buf[i]);            kbd_buffer_store_event (&buf[i]);
2652            /* Don't look at input that follows a C-g too closely.            /* Don't look at input that follows a C-g too closely.
2653               This reduces lossage due to autorepeat on C-g.  */               This reduces lossage due to autorepeat on C-g.  */
2654            if (buf[i].kind == ascii_keystroke            if (buf[i].kind == ASCII_KEYSTROKE_EVENT
2655                && buf[i].code == quit_char)                && buf[i].code == quit_char)
2656              break;              break;
2657          }          }
# Line 2691  read_input_waiting () Line 2662  read_input_waiting ()
2662        nread = read (fileno (stdin), buf, 1);        nread = read (fileno (stdin), buf, 1);
2663    
2664        /* Scan the chars for C-g and store them in kbd_buffer.  */        /* Scan the chars for C-g and store them in kbd_buffer.  */
2665        e.kind = ascii_keystroke;        e.kind = ASCII_KEYSTROKE_EVENT;
2666        e.frame_or_window = selected_frame;        e.frame_or_window = selected_frame;
2667        e.modifiers = 0;        e.modifiers = 0;
2668        for (i = 0; i < nread; i++)        for (i = 0; i < nread; i++)
# Line 2816  sys_signal (int signal_number, signal_ha Line 2787  sys_signal (int signal_number, signal_ha
2787    struct sigaction new_action, old_action;    struct sigaction new_action, old_action;
2788    sigemptyset (&new_action.sa_mask);    sigemptyset (&new_action.sa_mask);
2789    new_action.sa_handler = action;    new_action.sa_handler = action;
2790  #ifdef SA_RESTART  #if defined (SA_RESTART) && ! defined (BROKEN_SA_RESTART)
2791    /* Emacs mostly works better with restartable system services. If this    /* Emacs mostly works better with restartable system services. If this
2792     * flag exists, we probably want to turn it on here.       flag exists, we probably want to turn it on here.
2793     */       However, on some systems this resets the timeout of `select'
2794         which means that `select' never finishes if it keeps getting signals.
2795         BROKEN_SA_RESTART is defined on those systems.  */
2796    new_action.sa_flags = SA_RESTART;    new_action.sa_flags = SA_RESTART;
2797  #else  #else
2798    new_action.sa_flags = 0;    new_action.sa_flags = 0;
# Line 3260  strerror (errnum) Line 3233  strerror (errnum)
3233    
3234  int  int
3235  emacs_open (path, oflag, mode)  emacs_open (path, oflag, mode)
3236       char *path;       const char *path;
3237       int oflag, mode;       int oflag, mode;
3238  {  {
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 3302  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 3311  emacs_read (fildes, buf, nbyte) Line 3284  emacs_read (fildes, buf, nbyte)
3284  int  int
3285  emacs_write (fildes, buf, nbyte)  emacs_write (fildes, buf, nbyte)
3286       int fildes;       int fildes;
3287       char *buf;       const char *buf;
3288       unsigned int nbyte;       unsigned int nbyte;
3289  {  {
3290    register int rtnval, bytes_written;    register int rtnval, bytes_written;
# Line 3442  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 3471  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 3480  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 3683  readdirver (dirp) Line 3656  readdirver (dirp)
3656    
3657  int  int
3658  set_file_times (filename, atime, mtime)  set_file_times (filename, atime, mtime)
3659       char *filename;       const char *filename;
3660       EMACS_TIME atime, mtime;       EMACS_TIME atime, mtime;
3661  {  {
3662  #ifdef HAVE_UTIMES  #ifdef HAVE_UTIMES
# Line 3858  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 3899  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 3913  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 3978  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 4040  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 4081  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 4174  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 4196  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 4533  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 4590  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 4654  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 4947  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 5115  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.235  
changed lines
  Added in v.1.235.2.1

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