emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/mac.c


From: Juanma Barranquero
Subject: [Emacs-diffs] Changes to emacs/src/mac.c
Date: Fri, 18 Oct 2002 06:00:35 -0400

Index: emacs/src/mac.c
diff -c emacs/src/mac.c:1.9 emacs/src/mac.c:1.10
*** emacs/src/mac.c:1.9 Thu Aug 15 22:30:21 2002
--- emacs/src/mac.c     Fri Oct 18 06:00:10 2002
***************
*** 91,97 ****
    int l2 = strlen (s2);
    char *p = s1 + l1;
    int i;
!   
    strncat (s1, s2, n);
    for (i = 0; i < l2; i++)
      {
--- 91,97 ----
    int l2 = strlen (s2);
    char *p = s1 + l1;
    int i;
! 
    strncat (s1, s2, n);
    for (i = 0; i < l2; i++)
      {
***************
*** 104,130 ****
  
  /* Convert a Mac pathname to Posix form.  A Mac full pathname is one
     that does not begin with a ':' and contains at least one ':'. A Mac
!    full pathname causes an '/' to be prepended to the Posix pathname.
     The algorithm for the rest of the pathname is as follows:
       For each segment between two ':',
         if it is non-null, copy as is and then add a '/' at the end,
         otherwise, insert a "../" into the Posix pathname.
     Returns 1 if successful; 0 if fails.  */
!    
  int
  mac_to_posix_pathname (const char *mfn, char *ufn, int ufnbuflen)
  {
    const char *p, *q, *pe;
!       
    strcpy (ufn, "");
!       
    if (*mfn == '\0')
      return 1;
!       
    p = strchr (mfn, ':');
    if (p != 0 && p != mfn)  /* full pathname */
      strcat (ufn, "/");
!               
    p = mfn;
    if (*p == ':')
      p++;
--- 104,130 ----
  
  /* Convert a Mac pathname to Posix form.  A Mac full pathname is one
     that does not begin with a ':' and contains at least one ':'. A Mac
!    full pathname causes a '/' to be prepended to the Posix pathname.
     The algorithm for the rest of the pathname is as follows:
       For each segment between two ':',
         if it is non-null, copy as is and then add a '/' at the end,
         otherwise, insert a "../" into the Posix pathname.
     Returns 1 if successful; 0 if fails.  */
! 
  int
  mac_to_posix_pathname (const char *mfn, char *ufn, int ufnbuflen)
  {
    const char *p, *q, *pe;
! 
    strcpy (ufn, "");
! 
    if (*mfn == '\0')
      return 1;
! 
    p = strchr (mfn, ':');
    if (p != 0 && p != mfn)  /* full pathname */
      strcat (ufn, "/");
! 
    p = mfn;
    if (*p == ':')
      p++;
***************
*** 159,165 ****
          p = pe;
        }
      }
!       
    return 1;
  }
  
--- 159,165 ----
          p = pe;
        }
      }
! 
    return 1;
  }
  
***************
*** 169,188 ****
  
  /* Convert a Posix pathname to Mac form.  Approximately reverse of the
     above in algorithm.  */
!    
  int
  posix_to_mac_pathname (const char *ufn, char *mfn, int mfnbuflen)
  {
    const char *p, *q, *pe;
    char expanded_pathname[MAXPATHLEN+1];
!       
    strcpy (mfn, "");
!       
    if (*ufn == '\0')
      return 1;
  
    p = ufn;
!   
    /* Check for and handle volume names.  Last comparison: strangely
       somewhere "/.emacs" is passed.  A temporary fix for now.  */
    if (*p == '/' && strchr (p+1, '/') == NULL && strcmp (p, "/.emacs") != 0)
--- 169,188 ----
  
  /* Convert a Posix pathname to Mac form.  Approximately reverse of the
     above in algorithm.  */
! 
  int
  posix_to_mac_pathname (const char *ufn, char *mfn, int mfnbuflen)
  {
    const char *p, *q, *pe;
    char expanded_pathname[MAXPATHLEN+1];
! 
    strcpy (mfn, "");
! 
    if (*ufn == '\0')
      return 1;
  
    p = ufn;
! 
    /* Check for and handle volume names.  Last comparison: strangely
       somewhere "/.emacs" is passed.  A temporary fix for now.  */
    if (*p == '/' && strchr (p+1, '/') == NULL && strcmp (p, "/.emacs") != 0)
***************
*** 216,225 ****
        strcat (expanded_pathname, p);
        p = expanded_pathname;
          /* now p points to the pathname with emacs dir prefix */
!     }    
    else if (*p != '/')  /* relative pathname */
      strcat (mfn, ":");
!               
    if (*p == '/')
      p++;
  
--- 216,225 ----
        strcat (expanded_pathname, p);
        p = expanded_pathname;
          /* now p points to the pathname with emacs dir prefix */
!     }
    else if (*p != '/')  /* relative pathname */
      strcat (mfn, ":");
! 
    if (*p == '/')
      p++;
  
***************
*** 252,258 ****
          p = pe;
        }
      }
!       
    return 1;
  }
  
--- 252,258 ----
          p = pe;
        }
      }
! 
    return 1;
  }
  
***************
*** 311,317 ****
    cipb.hFileInfo.ioDirID = 0;
    cipb.hFileInfo.ioFDirIndex = 0;
      /* set to 0 to get information about specific dir or file */
!   
    errno = PBGetCatInfo (&cipb, false);
    if (errno == -43) /* -43: fnfErr defined in Errors.h */
      errno = ENOENT;
--- 311,317 ----
    cipb.hFileInfo.ioDirID = 0;
    cipb.hFileInfo.ioFDirIndex = 0;
      /* set to 0 to get information about specific dir or file */
! 
    errno = PBGetCatInfo (&cipb, false);
    if (errno == -43) /* -43: fnfErr defined in Errors.h */
      errno = ENOENT;
***************
*** 321,327 ****
    if (cipb.hFileInfo.ioFlAttrib & 0x10)  /* bit 4 = 1 for directories */
      {
        buf->st_mode = S_IFDIR | S_IREAD | S_IEXEC;
!       
        if (!(cipb.hFileInfo.ioFlAttrib & 0x1))
        buf->st_mode |= S_IWRITE;  /* bit 1 = 1 for locked files/directories */
        buf->st_ino = cipb.dirInfo.ioDrDirID;
--- 321,327 ----
    if (cipb.hFileInfo.ioFlAttrib & 0x10)  /* bit 4 = 1 for directories */
      {
        buf->st_mode = S_IFDIR | S_IREAD | S_IEXEC;
! 
        if (!(cipb.hFileInfo.ioFlAttrib & 0x1))
        buf->st_mode |= S_IWRITE;  /* bit 1 = 1 for locked files/directories */
        buf->st_ino = cipb.dirInfo.ioDrDirID;
***************
*** 377,383 ****
  
    if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1)
      return -1;
!   
    return stat_noalias (true_pathname, buf);
  }
  
--- 377,383 ----
  
    if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1)
      return -1;
! 
    return stat_noalias (true_pathname, buf);
  }
  
***************
*** 386,401 ****
  stat (const char *path, struct stat *sb)
  {
    int result;
!   char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1];  
    int len;
!   
    if ((result = stat_noalias (path, sb)) >= 0 &&
        ! (sb->st_mode & S_IFLNK))
      return result;
  
    if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1)
      return -1;
!   
    len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN);
    if (len > -1)
      {
--- 386,401 ----
  stat (const char *path, struct stat *sb)
  {
    int result;
!   char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1];
    int len;
! 
    if ((result = stat_noalias (path, sb)) >= 0 &&
        ! (sb->st_mode & S_IFLNK))
      return result;
  
    if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1)
      return -1;
! 
    len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN);
    if (len > -1)
      {
***************
*** 437,446 ****
  
    HFileParam hfpb;
    char true_pathname[MAXPATHLEN+1], mac_pathname[MAXPATHLEN+1];
!   
    if (find_true_pathname (dirname, true_pathname, MAXPATHLEN+1) == -1)
      return -1;
!       
    if (posix_to_mac_pathname (true_pathname, mac_pathname, MAXPATHLEN+1) == 0)
      return -1;
  
--- 437,446 ----
  
    HFileParam hfpb;
    char true_pathname[MAXPATHLEN+1], mac_pathname[MAXPATHLEN+1];
! 
    if (find_true_pathname (dirname, true_pathname, MAXPATHLEN+1) == -1)
      return -1;
! 
    if (posix_to_mac_pathname (true_pathname, mac_pathname, MAXPATHLEN+1) == 0)
      return -1;
  
***************
*** 448,454 ****
    hfpb.ioNamePtr = mac_pathname;
    hfpb.ioVRefNum = 0;  /* ignored unless name is invalid */
    hfpb.ioDirID = 0;  /* parent is the root */
!   
    errno = PBDirCreate ((HParmBlkPtr) &hfpb, false);
      /* just return the Mac OSErr code for now */
    return errno == noErr ? 0 : -1;
--- 448,454 ----
    hfpb.ioNamePtr = mac_pathname;
    hfpb.ioVRefNum = 0;  /* ignored unless name is invalid */
    hfpb.ioDirID = 0;  /* parent is the root */
! 
    errno = PBDirCreate ((HParmBlkPtr) &hfpb, false);
      /* just return the Mac OSErr code for now */
    return errno == noErr ? 0 : -1;
***************
*** 460,466 ****
  {
    HFileParam hfpb;
    char mac_pathname[MAXPATHLEN+1];
!       
    if (posix_to_mac_pathname (dirname, mac_pathname, MAXPATHLEN+1) == 0)
      return -1;
  
--- 460,466 ----
  {
    HFileParam hfpb;
    char mac_pathname[MAXPATHLEN+1];
! 
    if (posix_to_mac_pathname (dirname, mac_pathname, MAXPATHLEN+1) == 0)
      return -1;
  
***************
*** 468,474 ****
    hfpb.ioNamePtr = mac_pathname;
    hfpb.ioVRefNum = 0;  /* ignored unless name is invalid */
    hfpb.ioDirID = 0;  /* parent is the root */
!   
    errno = PBHDelete ((HParmBlkPtr) &hfpb, false);
    return errno == noErr ? 0 : -1;
  }
--- 468,474 ----
    hfpb.ioNamePtr = mac_pathname;
    hfpb.ioVRefNum = 0;  /* ignored unless name is invalid */
    hfpb.ioDirID = 0;  /* parent is the root */
! 
    errno = PBHDelete ((HParmBlkPtr) &hfpb, false);
    return errno == noErr ? 0 : -1;
  }
***************
*** 487,500 ****
  int
  utime (const char *path, const struct utimbuf *times)
  {
!   char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1];  
    int len;
    char mac_pathname[MAXPATHLEN+1];
    CInfoPBRec cipb;
!   
    if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1)
      return -1;
!   
    len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN);
    if (len > -1)
      fully_resolved_name[len] = '\0';
--- 487,500 ----
  int
  utime (const char *path, const struct utimbuf *times)
  {
!   char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1];
    int len;
    char mac_pathname[MAXPATHLEN+1];
    CInfoPBRec cipb;
! 
    if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1)
      return -1;
! 
    len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN);
    if (len > -1)
      fully_resolved_name[len] = '\0';
***************
*** 508,516 ****
    cipb.hFileInfo.ioNamePtr = mac_pathname;
    cipb.hFileInfo.ioVRefNum = 0;
    cipb.hFileInfo.ioDirID = 0;
!   cipb.hFileInfo.ioFDirIndex = 0; 
      /* set to 0 to get information about specific dir or file */
!   
    errno = PBGetCatInfo (&cipb, false);
    if (errno != noErr)
      return -1;
--- 508,516 ----
    cipb.hFileInfo.ioNamePtr = mac_pathname;
    cipb.hFileInfo.ioVRefNum = 0;
    cipb.hFileInfo.ioDirID = 0;
!   cipb.hFileInfo.ioFDirIndex = 0;
      /* set to 0 to get information about specific dir or file */
! 
    errno = PBGetCatInfo (&cipb, false);
    if (errno != noErr)
      return -1;
***************
*** 549,562 ****
  int
  access (const char *path, int mode)
  {
!   char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1];  
    int len;
    char mac_pathname[MAXPATHLEN+1];
    CInfoPBRec cipb;
!   
    if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1)
      return -1;
!   
    len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN);
    if (len > -1)
      fully_resolved_name[len] = '\0';
--- 549,562 ----
  int
  access (const char *path, int mode)
  {
!   char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1];
    int len;
    char mac_pathname[MAXPATHLEN+1];
    CInfoPBRec cipb;
! 
    if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1)
      return -1;
! 
    len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN);
    if (len > -1)
      fully_resolved_name[len] = '\0';
***************
*** 572,578 ****
    cipb.hFileInfo.ioDirID = 0;
    cipb.hFileInfo.ioFDirIndex = 0;
      /* set to 0 to get information about specific dir or file */
!   
    errno = PBGetCatInfo (&cipb, false);
    if (errno != noErr)
      return -1;
--- 572,578 ----
    cipb.hFileInfo.ioDirID = 0;
    cipb.hFileInfo.ioFDirIndex = 0;
      /* set to 0 to get information about specific dir or file */
! 
    errno = PBGetCatInfo (&cipb, false);
    if (errno != noErr)
      return -1;
***************
*** 605,620 ****
  int
  sys_open (const char *path, int oflag)
  {
!   char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1];  
    int len;
    char mac_pathname[MAXPATHLEN+1];
!       
    if (strcmp (path, "/dev/null") == 0)
      return DEV_NULL_FD;  /* some bogus fd to be ignored in write */
!   
    if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1)
      return -1;
!   
    len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN);
    if (len > -1)
      fully_resolved_name[len] = '\0';
--- 605,620 ----
  int
  sys_open (const char *path, int oflag)
  {
!   char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1];
    int len;
    char mac_pathname[MAXPATHLEN+1];
! 
    if (strcmp (path, "/dev/null") == 0)
      return DEV_NULL_FD;  /* some bogus fd to be ignored in write */
! 
    if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1)
      return -1;
! 
    len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN);
    if (len > -1)
      fully_resolved_name[len] = '\0';
***************
*** 642,651 ****
  int
  sys_creat (const char *path, mode_t mode)
  {
!   char true_pathname[MAXPATHLEN+1];  
    int len;
    char mac_pathname[MAXPATHLEN+1];
!       
    if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1)
      return -1;
  
--- 642,651 ----
  int
  sys_creat (const char *path, mode_t mode)
  {
!   char true_pathname[MAXPATHLEN+1];
    int len;
    char mac_pathname[MAXPATHLEN+1];
! 
    if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1)
      return -1;
  
***************
*** 668,680 ****
  int
  sys_unlink (const char *path)
  {
!   char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1];  
    int len;
    char mac_pathname[MAXPATHLEN+1];
!       
    if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1)
      return -1;
!   
    len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN);
    if (len > -1)
      fully_resolved_name[len] = '\0';
--- 668,680 ----
  int
  sys_unlink (const char *path)
  {
!   char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1];
    int len;
    char mac_pathname[MAXPATHLEN+1];
! 
    if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1)
      return -1;
! 
    len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN);
    if (len > -1)
      fully_resolved_name[len] = '\0';
***************
*** 723,735 ****
  sys_rename (const char * old_name, const char * new_name)
  {
    char true_old_pathname[MAXPATHLEN+1], true_new_pathname[MAXPATHLEN+1];
!   char fully_resolved_old_name[MAXPATHLEN+1];  
    int len;
    char mac_old_name[MAXPATHLEN+1], mac_new_name[MAXPATHLEN+1];
!       
    if (find_true_pathname (old_name, true_old_pathname, MAXPATHLEN+1) == -1)
      return -1;
!   
    len = readlink (true_old_pathname, fully_resolved_old_name, MAXPATHLEN);
    if (len > -1)
      fully_resolved_old_name[len] = '\0';
--- 723,735 ----
  sys_rename (const char * old_name, const char * new_name)
  {
    char true_old_pathname[MAXPATHLEN+1], true_new_pathname[MAXPATHLEN+1];
!   char fully_resolved_old_name[MAXPATHLEN+1];
    int len;
    char mac_old_name[MAXPATHLEN+1], mac_new_name[MAXPATHLEN+1];
! 
    if (find_true_pathname (old_name, true_old_pathname, MAXPATHLEN+1) == -1)
      return -1;
! 
    len = readlink (true_old_pathname, fully_resolved_old_name, MAXPATHLEN);
    if (len > -1)
      fully_resolved_old_name[len] = '\0';
***************
*** 738,744 ****
  
    if (find_true_pathname (new_name, true_new_pathname, MAXPATHLEN+1) == -1)
      return -1;
!       
    if (strcmp (fully_resolved_old_name, true_new_pathname) == 0)
      return 0;
  
--- 738,744 ----
  
    if (find_true_pathname (new_name, true_new_pathname, MAXPATHLEN+1) == -1)
      return -1;
! 
    if (strcmp (fully_resolved_old_name, true_new_pathname) == 0)
      return 0;
  
***************
*** 746,752 ****
                             mac_old_name,
                             MAXPATHLEN+1))
      return -1;
!               
    if (!posix_to_mac_pathname(true_new_pathname, mac_new_name, MAXPATHLEN+1))
      return -1;
  
--- 746,752 ----
                             mac_old_name,
                             MAXPATHLEN+1))
      return -1;
! 
    if (!posix_to_mac_pathname(true_new_pathname, mac_new_name, MAXPATHLEN+1))
      return -1;
  
***************
*** 754,760 ****
       file in Unix.  CW version fails in these situation.  So we add a
       call to unlink here.  */
    (void) unlink (mac_new_name);
!   
    return rename (mac_old_name, mac_new_name);
  }
  
--- 754,760 ----
       file in Unix.  CW version fails in these situation.  So we add a
       call to unlink here.  */
    (void) unlink (mac_new_name);
! 
    return rename (mac_old_name, mac_new_name);
  }
  
***************
*** 764,776 ****
  FILE *
  sys_fopen (const char *name, const char *mode)
  {
!   char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1];  
    int len;
    char mac_pathname[MAXPATHLEN+1];
!       
    if (find_true_pathname (name, true_pathname, MAXPATHLEN+1) == -1)
      return 0;
!   
    len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN);
    if (len > -1)
      fully_resolved_name[len] = '\0';
--- 764,776 ----
  FILE *
  sys_fopen (const char *name, const char *mode)
  {
!   char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1];
    int len;
    char mac_pathname[MAXPATHLEN+1];
! 
    if (find_true_pathname (name, true_pathname, MAXPATHLEN+1) == -1)
      return 0;
! 
    len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN);
    if (len > -1)
      fully_resolved_name[len] = '\0';
***************
*** 843,849 ****
  
    EMACS_GET_TIME (end_time);
    EMACS_ADD_TIME (end_time, end_time, *timeout);
!   
    do
      {
        /* Also return true if an event other than a keyDown has
--- 843,849 ----
  
    EMACS_GET_TIME (end_time);
    EMACS_ADD_TIME (end_time, end_time, *timeout);
! 
    do
      {
        /* Also return true if an event other than a keyDown has
***************
*** 858,864 ****
        {
          Point mouse_pos;
          static Point old_mouse_pos = {-1, -1};
!         
          GetMouse (&mouse_pos);
          if (!EqualPt (mouse_pos, old_mouse_pos))
            {
--- 858,864 ----
        {
          Point mouse_pos;
          static Point old_mouse_pos = {-1, -1};
! 
          GetMouse (&mouse_pos);
          if (!EqualPt (mouse_pos, old_mouse_pos))
            {
***************
*** 866,875 ****
              return 1;
            }
        }
!       
        WaitNextEvent (0, &e, 1UL, NULL);       /* Accept no event; wait 1
                                           tic. by T.I. */
!       
        EMACS_GET_TIME (now);
        EMACS_SUB_TIME (now, end_time, now);
      }
--- 866,875 ----
              return 1;
            }
        }
! 
        WaitNextEvent (0, &e, 1UL, NULL);       /* Accept no event; wait 1
                                           tic. by T.I. */
! 
        EMACS_GET_TIME (now);
        EMACS_SUB_TIME (now, end_time, now);
      }
***************
*** 887,904 ****
  {
    EventRecord e;
    unsigned long tick;
!   
    if (!target_ticks)  /* no alarm pending */
      return -1;
  
    if ((tick = TickCount ()) < target_ticks)
      WaitNextEvent (0, &e, target_ticks - tick, NULL); /* Accept no event;
                                                         just wait. by T.I. */
!   
    target_ticks = 0;
    if (alarm_signal_func)
      (*alarm_signal_func)(SIGALRM);
!   
    return 0;
  }
  
--- 887,904 ----
  {
    EventRecord e;
    unsigned long tick;
! 
    if (!target_ticks)  /* no alarm pending */
      return -1;
  
    if ((tick = TickCount ()) < target_ticks)
      WaitNextEvent (0, &e, target_ticks - tick, NULL); /* Accept no event;
                                                         just wait. by T.I. */
! 
    target_ticks = 0;
    if (alarm_signal_func)
      (*alarm_signal_func)(SIGALRM);
! 
    return 0;
  }
  
***************
*** 907,915 ****
  alarm (int seconds)
  {
    long remaining = target_ticks ? (TickCount () - target_ticks) / 60 : 0;
!       
    target_ticks = seconds ? TickCount () + 60 * seconds : 0;
!       
    return (remaining < 0) ? 0 : (unsigned int) remaining;
  }
  
--- 907,915 ----
  alarm (int seconds)
  {
    long remaining = target_ticks ? (TickCount () - target_ticks) / 60 : 0;
! 
    target_ticks = seconds ? TickCount () + 60 * seconds : 0;
! 
    return (remaining < 0) ? 0 : (unsigned int) remaining;
  }
  
***************
*** 932,940 ****
    else
      {
  #ifdef __MRC__
!       __sigfun old_signal_func;               
  #elif __MWERKS__
!       __signal_func_ptr old_signal_func;              
  #else
        You lose!!!
  #endif
--- 932,940 ----
    else
      {
  #ifdef __MRC__
!       __sigfun old_signal_func;
  #elif __MWERKS__
!       __signal_func_ptr old_signal_func;
  #else
        You lose!!!
  #endif
***************
*** 979,985 ****
  
    /* Get time since boot */
    Microseconds (&uw_microseconds);
!   
    /* Convert to time since midnight*/
    w_microseconds.hi = uw_microseconds.hi;
    w_microseconds.lo = uw_microseconds.lo;
--- 979,985 ----
  
    /* Get time since boot */
    Microseconds (&uw_microseconds);
! 
    /* Convert to time since midnight*/
    w_microseconds.hi = uw_microseconds.hi;
    w_microseconds.lo = uw_microseconds.lo;
***************
*** 1019,1025 ****
  sys_gmtime (const time_t *timer)
  {
    time_t unix_time = *timer + CW_OR_MPW_UNIX_EPOCH_DIFF;
!   
    return gmtime (&unix_time);
  }
  
--- 1019,1025 ----
  sys_gmtime (const time_t *timer)
  {
    time_t unix_time = *timer + CW_OR_MPW_UNIX_EPOCH_DIFF;
! 
    return gmtime (&unix_time);
  }
  
***************
*** 1034,1040 ****
  #else
    time_t unix_time = *timer + CW_OR_MPW_UNIX_EPOCH_DIFF;
  #endif
!   
    return localtime (&unix_time);
  }
  
--- 1034,1040 ----
  #else
    time_t unix_time = *timer + CW_OR_MPW_UNIX_EPOCH_DIFF;
  #endif
! 
    return localtime (&unix_time);
  }
  
***************
*** 1049,1055 ****
  #else
    time_t unix_time = *timer + CW_OR_MPW_UNIX_EPOCH_DIFF;
  #endif
!   
    return ctime (&unix_time);
  }
  
--- 1049,1055 ----
  #else
    time_t unix_time = *timer + CW_OR_MPW_UNIX_EPOCH_DIFF;
  #endif
! 
    return ctime (&unix_time);
  }
  
***************
*** 1067,1073 ****
  
    if (timer)
      *timer = mac_time;
!     
    return mac_time;
  }
  
--- 1067,1073 ----
  
    if (timer)
      *timer = mac_time;
! 
    return mac_time;
  }
  
***************
*** 1130,1152 ****
  {
    int len, k;
    static seqnum = 0;
!   
    len = strlen (template);
    k = len - 1;
    while (k >= 0 && template[k] == 'X')
      k--;
!   
    k++;  /* make k index of first 'X' */
!   
    if (k < len)
      {
        /* Zero filled, number of digits equal to the number of X's.  */
        sprintf (&template[k], "%0*d", len-k, seqnum++);
!   
        return template;
      }
    else
!     return 0;  
  }
  
  
--- 1130,1152 ----
  {
    int len, k;
    static seqnum = 0;
! 
    len = strlen (template);
    k = len - 1;
    while (k >= 0 && template[k] == 'X')
      k--;
! 
    k++;  /* make k index of first 'X' */
! 
    if (k < len)
      {
        /* Zero filled, number of digits equal to the number of X's.  */
        sprintf (&template[k], "%0*d", len-k, seqnum++);
! 
        return template;
      }
    else
!     return 0;
  }
  
  
***************
*** 1157,1163 ****
  static char my_passwd_name[PASSWD_FIELD_SIZE];
  static char my_passwd_dir[MAXPATHLEN+1];
  
! static struct passwd my_passwd = 
  {
    my_passwd_name,
    my_passwd_dir,
--- 1157,1163 ----
  static char my_passwd_name[PASSWD_FIELD_SIZE];
  static char my_passwd_dir[MAXPATHLEN+1];
  
! static struct passwd my_passwd =
  {
    my_passwd_name,
    my_passwd_dir,
***************
*** 1201,1207 ****
            }
        }
      }
!   
    if (!found)
      {
        /* Setting to "/" probably won't work but set it to something
--- 1201,1207 ----
            }
        }
      }
! 
    if (!found)
      {
        /* Setting to "/" probably won't work but set it to something
***************
*** 1212,1218 ****
  }
  
  
! static struct passwd emacs_passwd = 
  {
    "emacs",
    emacs_passwd_dir,
--- 1212,1218 ----
  }
  
  
! static struct passwd emacs_passwd =
  {
    "emacs",
    emacs_passwd_dir,
***************
*** 1248,1258 ****
  getpwuid (uid_t uid)
  {
    if (!my_passwd_inited)
!     {  
        init_my_passwd ();
        my_passwd_inited = 1;
      }
!   
    return &my_passwd;
  }
  
--- 1248,1258 ----
  getpwuid (uid_t uid)
  {
    if (!my_passwd_inited)
!     {
        init_my_passwd ();
        my_passwd_inited = 1;
      }
! 
    return &my_passwd;
  }
  
***************
*** 1264,1274 ****
        return &emacs_passwd;
  
    if (!my_passwd_inited)
!     {  
        init_my_passwd ();
        my_passwd_inited = 1;
      }
!   
    return &my_passwd;
  }
  
--- 1264,1274 ----
        return &emacs_passwd;
  
    if (!my_passwd_inited)
!     {
        init_my_passwd ();
        my_passwd_inited = 1;
      }
! 
    return &my_passwd;
  }
  
***************
*** 1310,1316 ****
  sigblock (int mask)
  {
    return 0;
! } 
  
  
  void
--- 1310,1316 ----
  sigblock (int mask)
  {
    return 0;
! }
  
  
  void
***************
*** 1392,1398 ****
        err = PBGetCatInfo (&cipb, false);
        if (err != noErr)
          return 0;
!       
        p2cstr (dir_name);
        if (strlen (dir_name) + strlen (path) + 1 >= man_path_len)
          return 0;
--- 1392,1398 ----
        err = PBGetCatInfo (&cipb, false);
        if (err != noErr)
          return 0;
! 
        p2cstr (dir_name);
        if (strlen (dir_name) + strlen (path) + 1 >= man_path_len)
          return 0;
***************
*** 1404,1410 ****
      }
    while (cipb.dirInfo.ioDrDirID != fsRtDirID);
      /* stop when we see the volume's root directory */
!   
    return 1;  /* success */
  }
  
--- 1404,1410 ----
      }
    while (cipb.dirInfo.ioDrDirID != fsRtDirID);
      /* stop when we see the volume's root directory */
! 
    return 1;  /* success */
  }
  
***************
*** 1468,1474 ****
      return -1;
  
    buf[0] = '\0';
!   
    p = path;
    if (*p == '/')
      q = strchr (p + 1, '/');
--- 1468,1474 ----
      return -1;
  
    buf[0] = '\0';
! 
    p = path;
    if (*p == '/')
      q = strchr (p + 1, '/');
***************
*** 1492,1501 ****
        p = q + 1;
        q = strchr(p, '/');
      }
!   
    if (len + strlen (p) + 1 >= bufsiz)
      return -1;
!   
    strcat (buf, p);
    return len + strlen (p);
  }
--- 1492,1501 ----
        p = q + 1;
        q = strchr(p, '/');
      }
! 
    if (len + strlen (p) + 1 >= bufsiz)
      return -1;
! 
    strcat (buf, p);
    return len + strlen (p);
  }
***************
*** 1543,1549 ****
  dup2 (int oldd, int newd)
  {
    int fd, ret;
!   
    close (newd);
  
    fd = dup (oldd);
--- 1543,1549 ----
  dup2 (int oldd, int newd)
  {
    int fd, ret;
! 
    close (newd);
  
    fd = dup (oldd);
***************
*** 1654,1660 ****
    CInfoPBRec cpb;
    char unix_dir_name[MAXPATHLEN+1];
    DIR *dir;
!   
    /* Cache directory name with pointer temp_dir_name.
       Look for it only the first time.  */
    if (!temp_dir_name)
--- 1654,1660 ----
    CInfoPBRec cpb;
    char unix_dir_name[MAXPATHLEN+1];
    DIR *dir;
! 
    /* Cache directory name with pointer temp_dir_name.
       Look for it only the first time.  */
    if (!temp_dir_name)
***************
*** 1663,1680 ****
                        &vol_ref_num, &dir_id);
        if (err != noErr)
        return NULL;
!       
        if (!path_from_vol_dir_name (full_path, 255, vol_ref_num, dir_id, "\p"))
          return NULL;
  
        if (strlen (full_path) + 6 <= MAXPATHLEN)
        strcat (full_path, "Emacs:");
!       else 
        return NULL;
  
        if (!mac_to_posix_pathname (full_path, unix_dir_name, MAXPATHLEN+1))
        return NULL;
!     
        dir = opendir (unix_dir_name);  /* check whether temp directory exists 
*/
        if (dir)
        closedir (dir);
--- 1663,1680 ----
                        &vol_ref_num, &dir_id);
        if (err != noErr)
        return NULL;
! 
        if (!path_from_vol_dir_name (full_path, 255, vol_ref_num, dir_id, "\p"))
          return NULL;
  
        if (strlen (full_path) + 6 <= MAXPATHLEN)
        strcat (full_path, "Emacs:");
!       else
        return NULL;
  
        if (!mac_to_posix_pathname (full_path, unix_dir_name, MAXPATHLEN+1))
        return NULL;
! 
        dir = opendir (unix_dir_name);  /* check whether temp directory exists 
*/
        if (dir)
        closedir (dir);
***************
*** 1693,1699 ****
  /* Allocate and construct an array of pointers to strings from a list
     of strings stored in a 'STR#' resource.  The returned pointer array
     is stored in the style of argv and environ: if the 'STR#' resource
!    contains numString strings, an pointer array with numString+1
     elements is returned in which the last entry contains a null
     pointer.  The pointer to the pointer array is passed by pointer in
     parameter t.  The resource ID of the 'STR#' resource is passed in
--- 1693,1699 ----
  /* Allocate and construct an array of pointers to strings from a list
     of strings stored in a 'STR#' resource.  The returned pointer array
     is stored in the style of argv and environ: if the 'STR#' resource
!    contains numString strings, a pointer array with numString+1
     elements is returned in which the last entry contains a null
     pointer.  The pointer to the pointer array is passed by pointer in
     parameter t.  The resource ID of the 'STR#' resource is passed in
***************
*** 1747,1765 ****
    CInfoPBRec cpb;
    static char system_folder_unix_name[MAXPATHLEN+1];
    DIR *dir;
!   
    err = FindFolder (kOnSystemDisk, kSystemFolderType, kDontCreateFolder,
                    &vol_ref_num, &dir_id);
    if (err != noErr)
      return NULL;
!       
    if (!path_from_vol_dir_name (full_path, 255, vol_ref_num, dir_id, "\p"))
      return NULL;
  
    if (!mac_to_posix_pathname (full_path, system_folder_unix_name,
                              MAXPATHLEN+1))
      return NULL;
!     
    return system_folder_unix_name;
  }
  
--- 1747,1765 ----
    CInfoPBRec cpb;
    static char system_folder_unix_name[MAXPATHLEN+1];
    DIR *dir;
! 
    err = FindFolder (kOnSystemDisk, kSystemFolderType, kDontCreateFolder,
                    &vol_ref_num, &dir_id);
    if (err != noErr)
      return NULL;
! 
    if (!path_from_vol_dir_name (full_path, 255, vol_ref_num, dir_id, "\p"))
      return NULL;
  
    if (!mac_to_posix_pathname (full_path, system_folder_unix_name,
                              MAXPATHLEN+1))
      return NULL;
! 
    return system_folder_unix_name;
  }
  
***************
*** 1774,1780 ****
  init_environ ()
  {
    int i;
!   
    get_string_list (&environ, ENVIRON_STRING_LIST_ID);
  
    i = 0;
--- 1774,1780 ----
  init_environ ()
  {
    int i;
! 
    get_string_list (&environ, ENVIRON_STRING_LIST_ID);
  
    i = 0;
***************
*** 1918,1924 ****
  
  char *
  mystrtok (char *s)
! {     
    while (*s)
      s++;
  
--- 1918,1924 ----
  
  char *
  mystrtok (char *s)
! {
    while (*s)
      s++;
  
***************
*** 1974,1980 ****
    RgnHandle cursor_region_handle;
    TargetID targ;
    unsigned long ref_con, len;
!       
    if (posix_to_mac_pathname (workdir, macworkdir, MAXPATHLEN+1) == 0)
      return -1;
    if (posix_to_mac_pathname (infn, macinfn, MAXPATHLEN+1) == 0)
--- 1974,1980 ----
    RgnHandle cursor_region_handle;
    TargetID targ;
    unsigned long ref_con, len;
! 
    if (posix_to_mac_pathname (workdir, macworkdir, MAXPATHLEN+1) == 0)
      return -1;
    if (posix_to_mac_pathname (infn, macinfn, MAXPATHLEN+1) == 0)
***************
*** 1983,1989 ****
      return -1;
    if (posix_to_mac_pathname (errfn, macerrfn, MAXPATHLEN+1) == 0)
      return -1;
!   
    paramlen = strlen (macworkdir) + strlen (macinfn) + strlen (macoutfn)
               + strlen (macerrfn) + 4;  /* count nulls at end of strings */
  
--- 1983,1989 ----
      return -1;
    if (posix_to_mac_pathname (errfn, macerrfn, MAXPATHLEN+1) == 0)
      return -1;
! 
    paramlen = strlen (macworkdir) + strlen (macinfn) + strlen (macoutfn)
               + strlen (macerrfn) + 4;  /* count nulls at end of strings */
  
***************
*** 2002,2015 ****
        && argc == 3 && strcmp (argv[1], "-c") == 0)
      {
        char *command, *t, tempmacpathname[MAXPATHLEN+1];
!     
        /* The arguments for the command in argv[2] are separated by
         spaces.  Count them and put the count in newargc.  */
        command = (char *) alloca (strlen (argv[2])+2);
        strcpy (command, argv[2]);
        if (command[strlen (command) - 1] != ' ')
        strcat (command, " ");
!     
        t = command;
        newargc = 0;
        t = mystrchr (t, ' ');
--- 2002,2015 ----
        && argc == 3 && strcmp (argv[1], "-c") == 0)
      {
        char *command, *t, tempmacpathname[MAXPATHLEN+1];
! 
        /* The arguments for the command in argv[2] are separated by
         spaces.  Count them and put the count in newargc.  */
        command = (char *) alloca (strlen (argv[2])+2);
        strcpy (command, argv[2]);
        if (command[strlen (command) - 1] != ' ')
        strcat (command, " ");
! 
        t = command;
        newargc = 0;
        t = mystrchr (t, ' ');
***************
*** 2018,2026 ****
          newargc++;
          t = mystrchr (t+1, ' ');
        }
!     
        newargv = (char **) alloca (sizeof (char *) * newargc);
!     
        t = command;
        for (j = 0; j < newargc; j++)
        {
--- 2018,2026 ----
          newargc++;
          t = mystrchr (t+1, ' ');
        }
! 
        newargv = (char **) alloca (sizeof (char *) * newargc);
! 
        t = command;
        for (j = 0; j < newargc; j++)
        {
***************
*** 2030,2036 ****
          t = mystrtok (t);
          paramlen += strlen (newargv[j]) + 1;
        }
!     
        if (strncmp (newargv[0], "~emacs/", 7) == 0)
        {
          if (posix_to_mac_pathname (newargv[0], tempmacpathname, MAXPATHLEN+1)
--- 2030,2036 ----
          t = mystrtok (t);
          paramlen += strlen (newargv[j]) + 1;
        }
! 
        if (strncmp (newargv[0], "~emacs/", 7) == 0)
        {
          if (posix_to_mac_pathname (newargv[0], tempmacpathname, MAXPATHLEN+1)
***************
*** 2057,2068 ****
        strcpy (macappname, tempmacpathname);
      }
    else
!     {      
        if (posix_to_mac_pathname (argv[0], macappname, MAXPATHLEN+1) == 0)
        return -1;
  
        newargv = (char **) alloca (sizeof (char *) * argc);
!       newargc = argc;  
        for (j = 1; j < argc; j++)
        {
          if (strncmp (argv[j], "~emacs/", 7) == 0)
--- 2057,2068 ----
        strcpy (macappname, tempmacpathname);
      }
    else
!     {
        if (posix_to_mac_pathname (argv[0], macappname, MAXPATHLEN+1) == 0)
        return -1;
  
        newargv = (char **) alloca (sizeof (char *) * argc);
!       newargc = argc;
        for (j = 1; j < argc; j++)
        {
          if (strncmp (argv[j], "~emacs/", 7) == 0)
***************
*** 2092,2098 ****
                }
            }
          else
!           newargv[j] = argv[j];  
          paramlen += strlen (newargv[j]) + 1;
        }
      }
--- 2092,2098 ----
                }
            }
          else
!           newargv[j] = argv[j];
          paramlen += strlen (newargv[j]) + 1;
        }
      }
***************
*** 2113,2136 ****
      /* null terminate strings sent so it's possible to use strcpy over there 
*/
    strcpy (p, macinfn);
    p += strlen (macinfn);
!   *p++ = '\0';  
    strcpy (p, macoutfn);
    p += strlen (macoutfn);
!   *p++ = '\0';  
    strcpy (p, macerrfn);
    p += strlen (macerrfn);
!   *p++ = '\0';  
    for (j = 1; j < newargc; j++)
      {
        strcpy (p, newargv[j]);
        p += strlen (newargv[j]);
!       *p++ = '\0';  
      }
!   
    c2pstr (macappname);
!   
    iErr = FSMakeFSSpec (0, 0, macappname, &spec);
!   
    if (iErr != noErr)
      {
        free (param);
--- 2113,2136 ----
      /* null terminate strings sent so it's possible to use strcpy over there 
*/
    strcpy (p, macinfn);
    p += strlen (macinfn);
!   *p++ = '\0';
    strcpy (p, macoutfn);
    p += strlen (macoutfn);
!   *p++ = '\0';
    strcpy (p, macerrfn);
    p += strlen (macerrfn);
!   *p++ = '\0';
    for (j = 1; j < newargc; j++)
      {
        strcpy (p, newargv[j]);
        p += strlen (newargv[j]);
!       *p++ = '\0';
      }
! 
    c2pstr (macappname);
! 
    iErr = FSMakeFSSpec (0, 0, macappname, &spec);
! 
    if (iErr != noErr)
      {
        free (param);
***************
*** 2171,2177 ****
      }
  
    cursor_region_handle = NewRgn ();
!       
    /* Wait for the subprocess to finish, when it will send us a ERPY
       high level event.  */
    while (1)
--- 2171,2177 ----
      }
  
    cursor_region_handle = NewRgn ();
! 
    /* Wait for the subprocess to finish, when it will send us a ERPY
       high level event.  */
    while (1)
***************
*** 2179,2185 ****
                       cursor_region_handle)
        && reply_event.message == kEmacsSubprocessReply)
        break;
!   
    /* The return code is sent through the refCon */
    iErr = AcceptHighLevelEvent (&targ, &ref_con, NULL, &len);
    if (iErr != noErr)
--- 2179,2185 ----
                       cursor_region_handle)
        && reply_event.message == kEmacsSubprocessReply)
        break;
! 
    /* The return code is sent through the refCon */
    iErr = AcceptHighLevelEvent (&targ, &ref_con, NULL, &len);
    if (iErr != noErr)
***************
*** 2188,2194 ****
        free (param);
        return -1;
      }
!   
    DisposeHandle ((Handle) cursor_region_handle);
    free (param);
  
--- 2188,2194 ----
        free (param);
        return -1;
      }
! 
    DisposeHandle ((Handle) cursor_region_handle);
    free (param);
  
***************
*** 2200,2215 ****
  DIR *
  opendir (const char *dirname)
  {
!   char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1];  
    char mac_pathname[MAXPATHLEN+1], vol_name[MAXPATHLEN+1];
    DIR *dirp;
    CInfoPBRec cipb;
    HVolumeParam vpb;
    int len, vol_name_len;
!       
    if (find_true_pathname (dirname, true_pathname, MAXPATHLEN+1) == -1)
      return 0;
!   
    len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN);
    if (len > -1)
      fully_resolved_name[len] = '\0';
--- 2200,2215 ----
  DIR *
  opendir (const char *dirname)
  {
!   char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1];
    char mac_pathname[MAXPATHLEN+1], vol_name[MAXPATHLEN+1];
    DIR *dirp;
    CInfoPBRec cipb;
    HVolumeParam vpb;
    int len, vol_name_len;
! 
    if (find_true_pathname (dirname, true_pathname, MAXPATHLEN+1) == -1)
      return 0;
! 
    len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN);
    if (len > -1)
      fully_resolved_name[len] = '\0';
***************
*** 2237,2243 ****
    len = strlen (mac_pathname);
    if (mac_pathname[len - 1] != ':' && len < MAXPATHLEN)
      strcat (mac_pathname, ":");
!   
    /* Extract volume name */
    vol_name_len = strchr (mac_pathname, ':') - mac_pathname;
    strncpy (vol_name, mac_pathname, vol_name_len);
--- 2237,2243 ----
    len = strlen (mac_pathname);
    if (mac_pathname[len - 1] != ':' && len < MAXPATHLEN)
      strcat (mac_pathname, ":");
! 
    /* Extract volume name */
    vol_name_len = strchr (mac_pathname, ':') - mac_pathname;
    strncpy (vol_name, mac_pathname, vol_name_len);
***************
*** 2251,2257 ****
    cipb.hFileInfo.ioDirID = 0;
    cipb.hFileInfo.ioFDirIndex = 0;
      /* set to 0 to get information about specific dir or file */
!   
    errno = PBGetCatInfo (&cipb, false);
    if (errno != noErr)
      {
--- 2251,2257 ----
    cipb.hFileInfo.ioDirID = 0;
    cipb.hFileInfo.ioFDirIndex = 0;
      /* set to 0 to get information about specific dir or file */
! 
    errno = PBGetCatInfo (&cipb, false);
    if (errno != noErr)
      {
***************
*** 2279,2285 ****
      }
  
    dirp->vol_ref_num = vpb.ioVRefNum;
!   
    return dirp;
  }
  
--- 2279,2285 ----
      }
  
    dirp->vol_ref_num = vpb.ioVRefNum;
! 
    return dirp;
  }
  
***************
*** 2312,2325 ****
        hpblock.volumeParam.ioNamePtr = s_name;
        hpblock.volumeParam.ioVRefNum = 0;
        hpblock.volumeParam.ioVolIndex = dp->current_index;
!                 
        errno = PBHGetVInfo (&hpblock, false);
        if (errno != noErr)
        {
          errno = ENOENT;
          return 0;
        }
!                         
        p2cstr (s_name);
        strcat (s_name, "/");  /* need "/" for stat to work correctly */
  
--- 2312,2325 ----
        hpblock.volumeParam.ioNamePtr = s_name;
        hpblock.volumeParam.ioVRefNum = 0;
        hpblock.volumeParam.ioVolIndex = dp->current_index;
! 
        errno = PBHGetVInfo (&hpblock, false);
        if (errno != noErr)
        {
          errno = ENOENT;
          return 0;
        }
! 
        p2cstr (s_name);
        strcat (s_name, "/");  /* need "/" for stat to work correctly */
  
***************
*** 2327,2333 ****
  
        s_dirent.d_ino = hpblock.volumeParam.ioVRefNum;
        s_dirent.d_name = s_name;
!   
        return &s_dirent;
      }
    else
--- 2327,2333 ----
  
        s_dirent.d_ino = hpblock.volumeParam.ioVRefNum;
        s_dirent.d_name = s_name;
! 
        return &s_dirent;
      }
    else
***************
*** 2343,2367 ****
          cipb.hFileInfo.ioDirID = dp->dir_id;
            /* directory ID found by opendir */
          cipb.hFileInfo.ioFDirIndex = dp->current_index;
!         
          errno = PBGetCatInfo (&cipb, false);
          if (errno != noErr)
            {
              errno = ENOENT;
              return 0;
            }
!         
!         /* insist on an visibile entry */
          if (cipb.hFileInfo.ioFlAttrib & 0x10)  /* directory? */
            done = !(cipb.dirInfo.ioDrUsrWds.frFlags & fInvisible);
          else
            done = !(cipb.hFileInfo.ioFlFndrInfo.fdFlags & fInvisible);
!         
          dp->current_index++;
        }
  
        p2cstr (s_name);
!       
        p = s_name;
        while (*p)
          {
--- 2343,2367 ----
          cipb.hFileInfo.ioDirID = dp->dir_id;
            /* directory ID found by opendir */
          cipb.hFileInfo.ioFDirIndex = dp->current_index;
! 
          errno = PBGetCatInfo (&cipb, false);
          if (errno != noErr)
            {
              errno = ENOENT;
              return 0;
            }
! 
!         /* insist on a visible entry */
          if (cipb.hFileInfo.ioFlAttrib & 0x10)  /* directory? */
            done = !(cipb.dirInfo.ioDrUsrWds.frFlags & fInvisible);
          else
            done = !(cipb.hFileInfo.ioFlFndrInfo.fdFlags & fInvisible);
! 
          dp->current_index++;
        }
  
        p2cstr (s_name);
! 
        p = s_name;
        while (*p)
          {
***************
*** 2373,2379 ****
        s_dirent.d_ino = cipb.dirInfo.ioDrDirID;
          /* value unimportant: non-zero for valid file */
        s_dirent.d_name = s_name;
!   
        return &s_dirent;
      }
  }
--- 2373,2379 ----
        s_dirent.d_ino = cipb.dirInfo.ioDrDirID;
          /* value unimportant: non-zero for valid file */
        s_dirent.d_name = s_name;
! 
        return &s_dirent;
      }
  }
***************
*** 2404,2410 ****
  {
    AEDesc null_desc;
    OSAError osaerror;
!   
    /* if open fails, as_scripting_component is set to NULL.  Its
       subsequent use in OSA calls will fail with badComponentInstance
       error.  */
--- 2404,2410 ----
  {
    AEDesc null_desc;
    OSAError osaerror;
! 
    /* if open fails, as_scripting_component is set to NULL.  Its
       subsequent use in OSA calls will fail with badComponentInstance
       error.  */
***************
*** 2530,2536 ****
    long status;
  
    CHECK_STRING (script);
!   
    status = do_applescript (SDATA (script), &result);
    if (status)
      {
--- 2530,2536 ----
    long status;
  
    CHECK_STRING (script);
! 
    status = do_applescript (SDATA (script), &result);
    if (status)
      {
***************
*** 2567,2573 ****
    char posix_filename[MAXPATHLEN+1];
  
    CHECK_STRING (mac_filename);
!   
    if (mac_to_posix_pathname (SDATA (mac_filename), posix_filename,
                           MAXPATHLEN))
      return build_string (posix_filename);
--- 2567,2573 ----
    char posix_filename[MAXPATHLEN+1];
  
    CHECK_STRING (mac_filename);
! 
    if (mac_to_posix_pathname (SDATA (mac_filename), posix_filename,
                           MAXPATHLEN))
      return build_string (posix_filename);
***************
*** 2585,2591 ****
    char mac_filename[MAXPATHLEN+1];
  
    CHECK_STRING (posix_filename);
!   
    if (posix_to_mac_pathname (SDATA (posix_filename), mac_filename,
                           MAXPATHLEN))
      return build_string (mac_filename);
--- 2585,2591 ----
    char mac_filename[MAXPATHLEN+1];
  
    CHECK_STRING (posix_filename);
! 
    if (posix_to_mac_pathname (SDATA (posix_filename), mac_filename,
                           MAXPATHLEN))
      return build_string (mac_filename);
***************
*** 2622,2628 ****
    if (GetScrapFlavorData (scrap, kScrapFlavorTypeText, &s, data) != noErr
        || s == 0)
      return Qnil;
!   
    /* Emacs expects clipboard contents have Unix-style eol's */
    for (i = 0; i < s; i++)
      if (data[i] == '\r')
--- 2622,2628 ----
    if (GetScrapFlavorData (scrap, kScrapFlavorTypeText, &s, data) != noErr
        || s == 0)
      return Qnil;
! 
    /* Emacs expects clipboard contents have Unix-style eol's */
    for (i = 0; i < s; i++)
      if (data[i] == '\r')
***************
*** 2650,2656 ****
    value = make_string (*my_handle, rc);
  
    HUnlock (my_handle);
!   
    DisposeHandle (my_handle);
  
    return value;
--- 2650,2656 ----
    value = make_string (*my_handle, rc);
  
    HUnlock (my_handle);
! 
    DisposeHandle (my_handle);
  
    return value;
***************
*** 2671,2682 ****
    /* fixme: ignore the push flag for now */
  
    CHECK_STRING (value);
!   
    len = SCHARS (value);
    buf = (char *) alloca (len+1);
    bcopy (SDATA (value), buf, len);
    buf[len] = '\0';
!   
    /* convert to Mac-style eol's before sending to clipboard */
    for (i = 0; i < len; i++)
      if (buf[i] == '\n')
--- 2671,2682 ----
    /* fixme: ignore the push flag for now */
  
    CHECK_STRING (value);
! 
    len = SCHARS (value);
    buf = (char *) alloca (len+1);
    bcopy (SDATA (value), buf, len);
    buf[len] = '\0';
! 
    /* convert to Mac-style eol's before sending to clipboard */
    for (i = 0; i < len; i++)
      if (buf[i] == '\n')
***************
*** 2697,2703 ****
    ZeroScrap ();
    PutScrap (len, 'TEXT', buf);
  #endif /* not TARGET_API_MAC_CARBON */
!   
    return Qnil;
  }
  
--- 2697,2703 ----
    ZeroScrap ();
    PutScrap (len, 'TEXT', buf);
  #endif /* not TARGET_API_MAC_CARBON */
! 
    return Qnil;
  }
  
***************
*** 2911,2917 ****
  {
    QCLIPBOARD = intern ("CLIPBOARD");
    staticpro (&QCLIPBOARD);
!   
    defsubr (&Smac_paste_function);
    defsubr (&Smac_cut_function);
    defsubr (&Sx_selection_exists_p);
--- 2911,2917 ----
  {
    QCLIPBOARD = intern ("CLIPBOARD");
    staticpro (&QCLIPBOARD);
! 
    defsubr (&Smac_paste_function);
    defsubr (&Smac_cut_function);
    defsubr (&Sx_selection_exists_p);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]