diff options
| author | Juanma Barranquero | 2002-10-18 10:09:43 +0000 |
|---|---|---|
| committer | Juanma Barranquero | 2002-10-18 10:09:43 +0000 |
| commit | 7d0393cf12f2e50ee50e1a1fd73a60e9ef1f56ac (patch) | |
| tree | 2331486f0c145e370d029e273961af152c190c65 /src/mac.c | |
| parent | d49e7392f87656dfddf7a529fc7d312898524130 (diff) | |
| download | emacs-7d0393cf12f2e50ee50e1a1fd73a60e9ef1f56ac.tar.gz emacs-7d0393cf12f2e50ee50e1a1fd73a60e9ef1f56ac.zip | |
Fix typo in comment.
Diffstat (limited to 'src/mac.c')
| -rw-r--r-- | src/mac.c | 286 |
1 files changed, 143 insertions, 143 deletions
| @@ -91,7 +91,7 @@ string_cat_and_replace (char *s1, const char *s2, int n, char a, char b) | |||
| 91 | int l2 = strlen (s2); | 91 | int l2 = strlen (s2); |
| 92 | char *p = s1 + l1; | 92 | char *p = s1 + l1; |
| 93 | int i; | 93 | int i; |
| 94 | 94 | ||
| 95 | strncat (s1, s2, n); | 95 | strncat (s1, s2, n); |
| 96 | for (i = 0; i < l2; i++) | 96 | for (i = 0; i < l2; i++) |
| 97 | { | 97 | { |
| @@ -104,27 +104,27 @@ string_cat_and_replace (char *s1, const char *s2, int n, char a, char b) | |||
| 104 | 104 | ||
| 105 | /* Convert a Mac pathname to Posix form. A Mac full pathname is one | 105 | /* Convert a Mac pathname to Posix form. A Mac full pathname is one |
| 106 | that does not begin with a ':' and contains at least one ':'. A Mac | 106 | that does not begin with a ':' and contains at least one ':'. A Mac |
| 107 | full pathname causes an '/' to be prepended to the Posix pathname. | 107 | full pathname causes a '/' to be prepended to the Posix pathname. |
| 108 | The algorithm for the rest of the pathname is as follows: | 108 | The algorithm for the rest of the pathname is as follows: |
| 109 | For each segment between two ':', | 109 | For each segment between two ':', |
| 110 | if it is non-null, copy as is and then add a '/' at the end, | 110 | if it is non-null, copy as is and then add a '/' at the end, |
| 111 | otherwise, insert a "../" into the Posix pathname. | 111 | otherwise, insert a "../" into the Posix pathname. |
| 112 | Returns 1 if successful; 0 if fails. */ | 112 | Returns 1 if successful; 0 if fails. */ |
| 113 | 113 | ||
| 114 | int | 114 | int |
| 115 | mac_to_posix_pathname (const char *mfn, char *ufn, int ufnbuflen) | 115 | mac_to_posix_pathname (const char *mfn, char *ufn, int ufnbuflen) |
| 116 | { | 116 | { |
| 117 | const char *p, *q, *pe; | 117 | const char *p, *q, *pe; |
| 118 | 118 | ||
| 119 | strcpy (ufn, ""); | 119 | strcpy (ufn, ""); |
| 120 | 120 | ||
| 121 | if (*mfn == '\0') | 121 | if (*mfn == '\0') |
| 122 | return 1; | 122 | return 1; |
| 123 | 123 | ||
| 124 | p = strchr (mfn, ':'); | 124 | p = strchr (mfn, ':'); |
| 125 | if (p != 0 && p != mfn) /* full pathname */ | 125 | if (p != 0 && p != mfn) /* full pathname */ |
| 126 | strcat (ufn, "/"); | 126 | strcat (ufn, "/"); |
| 127 | 127 | ||
| 128 | p = mfn; | 128 | p = mfn; |
| 129 | if (*p == ':') | 129 | if (*p == ':') |
| 130 | p++; | 130 | p++; |
| @@ -159,7 +159,7 @@ mac_to_posix_pathname (const char *mfn, char *ufn, int ufnbuflen) | |||
| 159 | p = pe; | 159 | p = pe; |
| 160 | } | 160 | } |
| 161 | } | 161 | } |
| 162 | 162 | ||
| 163 | return 1; | 163 | return 1; |
| 164 | } | 164 | } |
| 165 | 165 | ||
| @@ -169,20 +169,20 @@ extern char *get_temp_dir_name (); | |||
| 169 | 169 | ||
| 170 | /* Convert a Posix pathname to Mac form. Approximately reverse of the | 170 | /* Convert a Posix pathname to Mac form. Approximately reverse of the |
| 171 | above in algorithm. */ | 171 | above in algorithm. */ |
| 172 | 172 | ||
| 173 | int | 173 | int |
| 174 | posix_to_mac_pathname (const char *ufn, char *mfn, int mfnbuflen) | 174 | posix_to_mac_pathname (const char *ufn, char *mfn, int mfnbuflen) |
| 175 | { | 175 | { |
| 176 | const char *p, *q, *pe; | 176 | const char *p, *q, *pe; |
| 177 | char expanded_pathname[MAXPATHLEN+1]; | 177 | char expanded_pathname[MAXPATHLEN+1]; |
| 178 | 178 | ||
| 179 | strcpy (mfn, ""); | 179 | strcpy (mfn, ""); |
| 180 | 180 | ||
| 181 | if (*ufn == '\0') | 181 | if (*ufn == '\0') |
| 182 | return 1; | 182 | return 1; |
| 183 | 183 | ||
| 184 | p = ufn; | 184 | p = ufn; |
| 185 | 185 | ||
| 186 | /* Check for and handle volume names. Last comparison: strangely | 186 | /* Check for and handle volume names. Last comparison: strangely |
| 187 | somewhere "/.emacs" is passed. A temporary fix for now. */ | 187 | somewhere "/.emacs" is passed. A temporary fix for now. */ |
| 188 | if (*p == '/' && strchr (p+1, '/') == NULL && strcmp (p, "/.emacs") != 0) | 188 | if (*p == '/' && strchr (p+1, '/') == NULL && strcmp (p, "/.emacs") != 0) |
| @@ -216,10 +216,10 @@ posix_to_mac_pathname (const char *ufn, char *mfn, int mfnbuflen) | |||
| 216 | strcat (expanded_pathname, p); | 216 | strcat (expanded_pathname, p); |
| 217 | p = expanded_pathname; | 217 | p = expanded_pathname; |
| 218 | /* now p points to the pathname with emacs dir prefix */ | 218 | /* now p points to the pathname with emacs dir prefix */ |
| 219 | } | 219 | } |
| 220 | else if (*p != '/') /* relative pathname */ | 220 | else if (*p != '/') /* relative pathname */ |
| 221 | strcat (mfn, ":"); | 221 | strcat (mfn, ":"); |
| 222 | 222 | ||
| 223 | if (*p == '/') | 223 | if (*p == '/') |
| 224 | p++; | 224 | p++; |
| 225 | 225 | ||
| @@ -252,7 +252,7 @@ posix_to_mac_pathname (const char *ufn, char *mfn, int mfnbuflen) | |||
| 252 | p = pe; | 252 | p = pe; |
| 253 | } | 253 | } |
| 254 | } | 254 | } |
| 255 | 255 | ||
| 256 | return 1; | 256 | return 1; |
| 257 | } | 257 | } |
| 258 | 258 | ||
| @@ -311,7 +311,7 @@ stat_noalias (const char *path, struct stat *buf) | |||
| 311 | cipb.hFileInfo.ioDirID = 0; | 311 | cipb.hFileInfo.ioDirID = 0; |
| 312 | cipb.hFileInfo.ioFDirIndex = 0; | 312 | cipb.hFileInfo.ioFDirIndex = 0; |
| 313 | /* set to 0 to get information about specific dir or file */ | 313 | /* set to 0 to get information about specific dir or file */ |
| 314 | 314 | ||
| 315 | errno = PBGetCatInfo (&cipb, false); | 315 | errno = PBGetCatInfo (&cipb, false); |
| 316 | if (errno == -43) /* -43: fnfErr defined in Errors.h */ | 316 | if (errno == -43) /* -43: fnfErr defined in Errors.h */ |
| 317 | errno = ENOENT; | 317 | errno = ENOENT; |
| @@ -321,7 +321,7 @@ stat_noalias (const char *path, struct stat *buf) | |||
| 321 | if (cipb.hFileInfo.ioFlAttrib & 0x10) /* bit 4 = 1 for directories */ | 321 | if (cipb.hFileInfo.ioFlAttrib & 0x10) /* bit 4 = 1 for directories */ |
| 322 | { | 322 | { |
| 323 | buf->st_mode = S_IFDIR | S_IREAD | S_IEXEC; | 323 | buf->st_mode = S_IFDIR | S_IREAD | S_IEXEC; |
| 324 | 324 | ||
| 325 | if (!(cipb.hFileInfo.ioFlAttrib & 0x1)) | 325 | if (!(cipb.hFileInfo.ioFlAttrib & 0x1)) |
| 326 | buf->st_mode |= S_IWRITE; /* bit 1 = 1 for locked files/directories */ | 326 | buf->st_mode |= S_IWRITE; /* bit 1 = 1 for locked files/directories */ |
| 327 | buf->st_ino = cipb.dirInfo.ioDrDirID; | 327 | buf->st_ino = cipb.dirInfo.ioDrDirID; |
| @@ -377,7 +377,7 @@ lstat (const char *path, struct stat *buf) | |||
| 377 | 377 | ||
| 378 | if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1) | 378 | if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1) |
| 379 | return -1; | 379 | return -1; |
| 380 | 380 | ||
| 381 | return stat_noalias (true_pathname, buf); | 381 | return stat_noalias (true_pathname, buf); |
| 382 | } | 382 | } |
| 383 | 383 | ||
| @@ -386,16 +386,16 @@ int | |||
| 386 | stat (const char *path, struct stat *sb) | 386 | stat (const char *path, struct stat *sb) |
| 387 | { | 387 | { |
| 388 | int result; | 388 | int result; |
| 389 | char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1]; | 389 | char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1]; |
| 390 | int len; | 390 | int len; |
| 391 | 391 | ||
| 392 | if ((result = stat_noalias (path, sb)) >= 0 && | 392 | if ((result = stat_noalias (path, sb)) >= 0 && |
| 393 | ! (sb->st_mode & S_IFLNK)) | 393 | ! (sb->st_mode & S_IFLNK)) |
| 394 | return result; | 394 | return result; |
| 395 | 395 | ||
| 396 | if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1) | 396 | if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1) |
| 397 | return -1; | 397 | return -1; |
| 398 | 398 | ||
| 399 | len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN); | 399 | len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN); |
| 400 | if (len > -1) | 400 | if (len > -1) |
| 401 | { | 401 | { |
| @@ -437,10 +437,10 @@ mkdir (const char *dirname, int mode) | |||
| 437 | 437 | ||
| 438 | HFileParam hfpb; | 438 | HFileParam hfpb; |
| 439 | char true_pathname[MAXPATHLEN+1], mac_pathname[MAXPATHLEN+1]; | 439 | char true_pathname[MAXPATHLEN+1], mac_pathname[MAXPATHLEN+1]; |
| 440 | 440 | ||
| 441 | if (find_true_pathname (dirname, true_pathname, MAXPATHLEN+1) == -1) | 441 | if (find_true_pathname (dirname, true_pathname, MAXPATHLEN+1) == -1) |
| 442 | return -1; | 442 | return -1; |
| 443 | 443 | ||
| 444 | if (posix_to_mac_pathname (true_pathname, mac_pathname, MAXPATHLEN+1) == 0) | 444 | if (posix_to_mac_pathname (true_pathname, mac_pathname, MAXPATHLEN+1) == 0) |
| 445 | return -1; | 445 | return -1; |
| 446 | 446 | ||
| @@ -448,7 +448,7 @@ mkdir (const char *dirname, int mode) | |||
| 448 | hfpb.ioNamePtr = mac_pathname; | 448 | hfpb.ioNamePtr = mac_pathname; |
| 449 | hfpb.ioVRefNum = 0; /* ignored unless name is invalid */ | 449 | hfpb.ioVRefNum = 0; /* ignored unless name is invalid */ |
| 450 | hfpb.ioDirID = 0; /* parent is the root */ | 450 | hfpb.ioDirID = 0; /* parent is the root */ |
| 451 | 451 | ||
| 452 | errno = PBDirCreate ((HParmBlkPtr) &hfpb, false); | 452 | errno = PBDirCreate ((HParmBlkPtr) &hfpb, false); |
| 453 | /* just return the Mac OSErr code for now */ | 453 | /* just return the Mac OSErr code for now */ |
| 454 | return errno == noErr ? 0 : -1; | 454 | return errno == noErr ? 0 : -1; |
| @@ -460,7 +460,7 @@ sys_rmdir (const char *dirname) | |||
| 460 | { | 460 | { |
| 461 | HFileParam hfpb; | 461 | HFileParam hfpb; |
| 462 | char mac_pathname[MAXPATHLEN+1]; | 462 | char mac_pathname[MAXPATHLEN+1]; |
| 463 | 463 | ||
| 464 | if (posix_to_mac_pathname (dirname, mac_pathname, MAXPATHLEN+1) == 0) | 464 | if (posix_to_mac_pathname (dirname, mac_pathname, MAXPATHLEN+1) == 0) |
| 465 | return -1; | 465 | return -1; |
| 466 | 466 | ||
| @@ -468,7 +468,7 @@ sys_rmdir (const char *dirname) | |||
| 468 | hfpb.ioNamePtr = mac_pathname; | 468 | hfpb.ioNamePtr = mac_pathname; |
| 469 | hfpb.ioVRefNum = 0; /* ignored unless name is invalid */ | 469 | hfpb.ioVRefNum = 0; /* ignored unless name is invalid */ |
| 470 | hfpb.ioDirID = 0; /* parent is the root */ | 470 | hfpb.ioDirID = 0; /* parent is the root */ |
| 471 | 471 | ||
| 472 | errno = PBHDelete ((HParmBlkPtr) &hfpb, false); | 472 | errno = PBHDelete ((HParmBlkPtr) &hfpb, false); |
| 473 | return errno == noErr ? 0 : -1; | 473 | return errno == noErr ? 0 : -1; |
| 474 | } | 474 | } |
| @@ -487,14 +487,14 @@ execvp (const char *path, ...) | |||
| 487 | int | 487 | int |
| 488 | utime (const char *path, const struct utimbuf *times) | 488 | utime (const char *path, const struct utimbuf *times) |
| 489 | { | 489 | { |
| 490 | char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1]; | 490 | char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1]; |
| 491 | int len; | 491 | int len; |
| 492 | char mac_pathname[MAXPATHLEN+1]; | 492 | char mac_pathname[MAXPATHLEN+1]; |
| 493 | CInfoPBRec cipb; | 493 | CInfoPBRec cipb; |
| 494 | 494 | ||
| 495 | if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1) | 495 | if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1) |
| 496 | return -1; | 496 | return -1; |
| 497 | 497 | ||
| 498 | len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN); | 498 | len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN); |
| 499 | if (len > -1) | 499 | if (len > -1) |
| 500 | fully_resolved_name[len] = '\0'; | 500 | fully_resolved_name[len] = '\0'; |
| @@ -508,9 +508,9 @@ utime (const char *path, const struct utimbuf *times) | |||
| 508 | cipb.hFileInfo.ioNamePtr = mac_pathname; | 508 | cipb.hFileInfo.ioNamePtr = mac_pathname; |
| 509 | cipb.hFileInfo.ioVRefNum = 0; | 509 | cipb.hFileInfo.ioVRefNum = 0; |
| 510 | cipb.hFileInfo.ioDirID = 0; | 510 | cipb.hFileInfo.ioDirID = 0; |
| 511 | cipb.hFileInfo.ioFDirIndex = 0; | 511 | cipb.hFileInfo.ioFDirIndex = 0; |
| 512 | /* set to 0 to get information about specific dir or file */ | 512 | /* set to 0 to get information about specific dir or file */ |
| 513 | 513 | ||
| 514 | errno = PBGetCatInfo (&cipb, false); | 514 | errno = PBGetCatInfo (&cipb, false); |
| 515 | if (errno != noErr) | 515 | if (errno != noErr) |
| 516 | return -1; | 516 | return -1; |
| @@ -549,14 +549,14 @@ utime (const char *path, const struct utimbuf *times) | |||
| 549 | int | 549 | int |
| 550 | access (const char *path, int mode) | 550 | access (const char *path, int mode) |
| 551 | { | 551 | { |
| 552 | char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1]; | 552 | char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1]; |
| 553 | int len; | 553 | int len; |
| 554 | char mac_pathname[MAXPATHLEN+1]; | 554 | char mac_pathname[MAXPATHLEN+1]; |
| 555 | CInfoPBRec cipb; | 555 | CInfoPBRec cipb; |
| 556 | 556 | ||
| 557 | if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1) | 557 | if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1) |
| 558 | return -1; | 558 | return -1; |
| 559 | 559 | ||
| 560 | len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN); | 560 | len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN); |
| 561 | if (len > -1) | 561 | if (len > -1) |
| 562 | fully_resolved_name[len] = '\0'; | 562 | fully_resolved_name[len] = '\0'; |
| @@ -572,7 +572,7 @@ access (const char *path, int mode) | |||
| 572 | cipb.hFileInfo.ioDirID = 0; | 572 | cipb.hFileInfo.ioDirID = 0; |
| 573 | cipb.hFileInfo.ioFDirIndex = 0; | 573 | cipb.hFileInfo.ioFDirIndex = 0; |
| 574 | /* set to 0 to get information about specific dir or file */ | 574 | /* set to 0 to get information about specific dir or file */ |
| 575 | 575 | ||
| 576 | errno = PBGetCatInfo (&cipb, false); | 576 | errno = PBGetCatInfo (&cipb, false); |
| 577 | if (errno != noErr) | 577 | if (errno != noErr) |
| 578 | return -1; | 578 | return -1; |
| @@ -605,16 +605,16 @@ access (const char *path, int mode) | |||
| 605 | int | 605 | int |
| 606 | sys_open (const char *path, int oflag) | 606 | sys_open (const char *path, int oflag) |
| 607 | { | 607 | { |
| 608 | char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1]; | 608 | char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1]; |
| 609 | int len; | 609 | int len; |
| 610 | char mac_pathname[MAXPATHLEN+1]; | 610 | char mac_pathname[MAXPATHLEN+1]; |
| 611 | 611 | ||
| 612 | if (strcmp (path, "/dev/null") == 0) | 612 | if (strcmp (path, "/dev/null") == 0) |
| 613 | return DEV_NULL_FD; /* some bogus fd to be ignored in write */ | 613 | return DEV_NULL_FD; /* some bogus fd to be ignored in write */ |
| 614 | 614 | ||
| 615 | if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1) | 615 | if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1) |
| 616 | return -1; | 616 | return -1; |
| 617 | 617 | ||
| 618 | len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN); | 618 | len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN); |
| 619 | if (len > -1) | 619 | if (len > -1) |
| 620 | fully_resolved_name[len] = '\0'; | 620 | fully_resolved_name[len] = '\0'; |
| @@ -642,10 +642,10 @@ sys_open (const char *path, int oflag) | |||
| 642 | int | 642 | int |
| 643 | sys_creat (const char *path, mode_t mode) | 643 | sys_creat (const char *path, mode_t mode) |
| 644 | { | 644 | { |
| 645 | char true_pathname[MAXPATHLEN+1]; | 645 | char true_pathname[MAXPATHLEN+1]; |
| 646 | int len; | 646 | int len; |
| 647 | char mac_pathname[MAXPATHLEN+1]; | 647 | char mac_pathname[MAXPATHLEN+1]; |
| 648 | 648 | ||
| 649 | if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1) | 649 | if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1) |
| 650 | return -1; | 650 | return -1; |
| 651 | 651 | ||
| @@ -668,13 +668,13 @@ sys_creat (const char *path, mode_t mode) | |||
| 668 | int | 668 | int |
| 669 | sys_unlink (const char *path) | 669 | sys_unlink (const char *path) |
| 670 | { | 670 | { |
| 671 | char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1]; | 671 | char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1]; |
| 672 | int len; | 672 | int len; |
| 673 | char mac_pathname[MAXPATHLEN+1]; | 673 | char mac_pathname[MAXPATHLEN+1]; |
| 674 | 674 | ||
| 675 | if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1) | 675 | if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1) |
| 676 | return -1; | 676 | return -1; |
| 677 | 677 | ||
| 678 | len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN); | 678 | len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN); |
| 679 | if (len > -1) | 679 | if (len > -1) |
| 680 | fully_resolved_name[len] = '\0'; | 680 | fully_resolved_name[len] = '\0'; |
| @@ -723,13 +723,13 @@ int | |||
| 723 | sys_rename (const char * old_name, const char * new_name) | 723 | sys_rename (const char * old_name, const char * new_name) |
| 724 | { | 724 | { |
| 725 | char true_old_pathname[MAXPATHLEN+1], true_new_pathname[MAXPATHLEN+1]; | 725 | char true_old_pathname[MAXPATHLEN+1], true_new_pathname[MAXPATHLEN+1]; |
| 726 | char fully_resolved_old_name[MAXPATHLEN+1]; | 726 | char fully_resolved_old_name[MAXPATHLEN+1]; |
| 727 | int len; | 727 | int len; |
| 728 | char mac_old_name[MAXPATHLEN+1], mac_new_name[MAXPATHLEN+1]; | 728 | char mac_old_name[MAXPATHLEN+1], mac_new_name[MAXPATHLEN+1]; |
| 729 | 729 | ||
| 730 | if (find_true_pathname (old_name, true_old_pathname, MAXPATHLEN+1) == -1) | 730 | if (find_true_pathname (old_name, true_old_pathname, MAXPATHLEN+1) == -1) |
| 731 | return -1; | 731 | return -1; |
| 732 | 732 | ||
| 733 | len = readlink (true_old_pathname, fully_resolved_old_name, MAXPATHLEN); | 733 | len = readlink (true_old_pathname, fully_resolved_old_name, MAXPATHLEN); |
| 734 | if (len > -1) | 734 | if (len > -1) |
| 735 | fully_resolved_old_name[len] = '\0'; | 735 | fully_resolved_old_name[len] = '\0'; |
| @@ -738,7 +738,7 @@ sys_rename (const char * old_name, const char * new_name) | |||
| 738 | 738 | ||
| 739 | if (find_true_pathname (new_name, true_new_pathname, MAXPATHLEN+1) == -1) | 739 | if (find_true_pathname (new_name, true_new_pathname, MAXPATHLEN+1) == -1) |
| 740 | return -1; | 740 | return -1; |
| 741 | 741 | ||
| 742 | if (strcmp (fully_resolved_old_name, true_new_pathname) == 0) | 742 | if (strcmp (fully_resolved_old_name, true_new_pathname) == 0) |
| 743 | return 0; | 743 | return 0; |
| 744 | 744 | ||
| @@ -746,7 +746,7 @@ sys_rename (const char * old_name, const char * new_name) | |||
| 746 | mac_old_name, | 746 | mac_old_name, |
| 747 | MAXPATHLEN+1)) | 747 | MAXPATHLEN+1)) |
| 748 | return -1; | 748 | return -1; |
| 749 | 749 | ||
| 750 | if (!posix_to_mac_pathname(true_new_pathname, mac_new_name, MAXPATHLEN+1)) | 750 | if (!posix_to_mac_pathname(true_new_pathname, mac_new_name, MAXPATHLEN+1)) |
| 751 | return -1; | 751 | return -1; |
| 752 | 752 | ||
| @@ -754,7 +754,7 @@ sys_rename (const char * old_name, const char * new_name) | |||
| 754 | file in Unix. CW version fails in these situation. So we add a | 754 | file in Unix. CW version fails in these situation. So we add a |
| 755 | call to unlink here. */ | 755 | call to unlink here. */ |
| 756 | (void) unlink (mac_new_name); | 756 | (void) unlink (mac_new_name); |
| 757 | 757 | ||
| 758 | return rename (mac_old_name, mac_new_name); | 758 | return rename (mac_old_name, mac_new_name); |
| 759 | } | 759 | } |
| 760 | 760 | ||
| @@ -764,13 +764,13 @@ extern FILE *fopen (const char *name, const char *mode); | |||
| 764 | FILE * | 764 | FILE * |
| 765 | sys_fopen (const char *name, const char *mode) | 765 | sys_fopen (const char *name, const char *mode) |
| 766 | { | 766 | { |
| 767 | char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1]; | 767 | char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1]; |
| 768 | int len; | 768 | int len; |
| 769 | char mac_pathname[MAXPATHLEN+1]; | 769 | char mac_pathname[MAXPATHLEN+1]; |
| 770 | 770 | ||
| 771 | if (find_true_pathname (name, true_pathname, MAXPATHLEN+1) == -1) | 771 | if (find_true_pathname (name, true_pathname, MAXPATHLEN+1) == -1) |
| 772 | return 0; | 772 | return 0; |
| 773 | 773 | ||
| 774 | len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN); | 774 | len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN); |
| 775 | if (len > -1) | 775 | if (len > -1) |
| 776 | fully_resolved_name[len] = '\0'; | 776 | fully_resolved_name[len] = '\0'; |
| @@ -843,7 +843,7 @@ select (n, rfds, wfds, efds, timeout) | |||
| 843 | 843 | ||
| 844 | EMACS_GET_TIME (end_time); | 844 | EMACS_GET_TIME (end_time); |
| 845 | EMACS_ADD_TIME (end_time, end_time, *timeout); | 845 | EMACS_ADD_TIME (end_time, end_time, *timeout); |
| 846 | 846 | ||
| 847 | do | 847 | do |
| 848 | { | 848 | { |
| 849 | /* Also return true if an event other than a keyDown has | 849 | /* Also return true if an event other than a keyDown has |
| @@ -858,7 +858,7 @@ select (n, rfds, wfds, efds, timeout) | |||
| 858 | { | 858 | { |
| 859 | Point mouse_pos; | 859 | Point mouse_pos; |
| 860 | static Point old_mouse_pos = {-1, -1}; | 860 | static Point old_mouse_pos = {-1, -1}; |
| 861 | 861 | ||
| 862 | GetMouse (&mouse_pos); | 862 | GetMouse (&mouse_pos); |
| 863 | if (!EqualPt (mouse_pos, old_mouse_pos)) | 863 | if (!EqualPt (mouse_pos, old_mouse_pos)) |
| 864 | { | 864 | { |
| @@ -866,10 +866,10 @@ select (n, rfds, wfds, efds, timeout) | |||
| 866 | return 1; | 866 | return 1; |
| 867 | } | 867 | } |
| 868 | } | 868 | } |
| 869 | 869 | ||
| 870 | WaitNextEvent (0, &e, 1UL, NULL); /* Accept no event; wait 1 | 870 | WaitNextEvent (0, &e, 1UL, NULL); /* Accept no event; wait 1 |
| 871 | tic. by T.I. */ | 871 | tic. by T.I. */ |
| 872 | 872 | ||
| 873 | EMACS_GET_TIME (now); | 873 | EMACS_GET_TIME (now); |
| 874 | EMACS_SUB_TIME (now, end_time, now); | 874 | EMACS_SUB_TIME (now, end_time, now); |
| 875 | } | 875 | } |
| @@ -887,18 +887,18 @@ pause () | |||
| 887 | { | 887 | { |
| 888 | EventRecord e; | 888 | EventRecord e; |
| 889 | unsigned long tick; | 889 | unsigned long tick; |
| 890 | 890 | ||
| 891 | if (!target_ticks) /* no alarm pending */ | 891 | if (!target_ticks) /* no alarm pending */ |
| 892 | return -1; | 892 | return -1; |
| 893 | 893 | ||
| 894 | if ((tick = TickCount ()) < target_ticks) | 894 | if ((tick = TickCount ()) < target_ticks) |
| 895 | WaitNextEvent (0, &e, target_ticks - tick, NULL); /* Accept no event; | 895 | WaitNextEvent (0, &e, target_ticks - tick, NULL); /* Accept no event; |
| 896 | just wait. by T.I. */ | 896 | just wait. by T.I. */ |
| 897 | 897 | ||
| 898 | target_ticks = 0; | 898 | target_ticks = 0; |
| 899 | if (alarm_signal_func) | 899 | if (alarm_signal_func) |
| 900 | (*alarm_signal_func)(SIGALRM); | 900 | (*alarm_signal_func)(SIGALRM); |
| 901 | 901 | ||
| 902 | return 0; | 902 | return 0; |
| 903 | } | 903 | } |
| 904 | 904 | ||
| @@ -907,9 +907,9 @@ int | |||
| 907 | alarm (int seconds) | 907 | alarm (int seconds) |
| 908 | { | 908 | { |
| 909 | long remaining = target_ticks ? (TickCount () - target_ticks) / 60 : 0; | 909 | long remaining = target_ticks ? (TickCount () - target_ticks) / 60 : 0; |
| 910 | 910 | ||
| 911 | target_ticks = seconds ? TickCount () + 60 * seconds : 0; | 911 | target_ticks = seconds ? TickCount () + 60 * seconds : 0; |
| 912 | 912 | ||
| 913 | return (remaining < 0) ? 0 : (unsigned int) remaining; | 913 | return (remaining < 0) ? 0 : (unsigned int) remaining; |
| 914 | } | 914 | } |
| 915 | 915 | ||
| @@ -932,9 +932,9 @@ sys_signal (int signal_num, __signal_func_ptr signal_func) | |||
| 932 | else | 932 | else |
| 933 | { | 933 | { |
| 934 | #ifdef __MRC__ | 934 | #ifdef __MRC__ |
| 935 | __sigfun old_signal_func; | 935 | __sigfun old_signal_func; |
| 936 | #elif __MWERKS__ | 936 | #elif __MWERKS__ |
| 937 | __signal_func_ptr old_signal_func; | 937 | __signal_func_ptr old_signal_func; |
| 938 | #else | 938 | #else |
| 939 | You lose!!! | 939 | You lose!!! |
| 940 | #endif | 940 | #endif |
| @@ -979,7 +979,7 @@ gettimeofday (tp) | |||
| 979 | 979 | ||
| 980 | /* Get time since boot */ | 980 | /* Get time since boot */ |
| 981 | Microseconds (&uw_microseconds); | 981 | Microseconds (&uw_microseconds); |
| 982 | 982 | ||
| 983 | /* Convert to time since midnight*/ | 983 | /* Convert to time since midnight*/ |
| 984 | w_microseconds.hi = uw_microseconds.hi; | 984 | w_microseconds.hi = uw_microseconds.hi; |
| 985 | w_microseconds.lo = uw_microseconds.lo; | 985 | w_microseconds.lo = uw_microseconds.lo; |
| @@ -1019,7 +1019,7 @@ struct tm * | |||
| 1019 | sys_gmtime (const time_t *timer) | 1019 | sys_gmtime (const time_t *timer) |
| 1020 | { | 1020 | { |
| 1021 | time_t unix_time = *timer + CW_OR_MPW_UNIX_EPOCH_DIFF; | 1021 | time_t unix_time = *timer + CW_OR_MPW_UNIX_EPOCH_DIFF; |
| 1022 | 1022 | ||
| 1023 | return gmtime (&unix_time); | 1023 | return gmtime (&unix_time); |
| 1024 | } | 1024 | } |
| 1025 | 1025 | ||
| @@ -1034,7 +1034,7 @@ sys_localtime (const time_t *timer) | |||
| 1034 | #else | 1034 | #else |
| 1035 | time_t unix_time = *timer + CW_OR_MPW_UNIX_EPOCH_DIFF; | 1035 | time_t unix_time = *timer + CW_OR_MPW_UNIX_EPOCH_DIFF; |
| 1036 | #endif | 1036 | #endif |
| 1037 | 1037 | ||
| 1038 | return localtime (&unix_time); | 1038 | return localtime (&unix_time); |
| 1039 | } | 1039 | } |
| 1040 | 1040 | ||
| @@ -1049,7 +1049,7 @@ sys_ctime (const time_t *timer) | |||
| 1049 | #else | 1049 | #else |
| 1050 | time_t unix_time = *timer + CW_OR_MPW_UNIX_EPOCH_DIFF; | 1050 | time_t unix_time = *timer + CW_OR_MPW_UNIX_EPOCH_DIFF; |
| 1051 | #endif | 1051 | #endif |
| 1052 | 1052 | ||
| 1053 | return ctime (&unix_time); | 1053 | return ctime (&unix_time); |
| 1054 | } | 1054 | } |
| 1055 | 1055 | ||
| @@ -1067,7 +1067,7 @@ sys_time (time_t *timer) | |||
| 1067 | 1067 | ||
| 1068 | if (timer) | 1068 | if (timer) |
| 1069 | *timer = mac_time; | 1069 | *timer = mac_time; |
| 1070 | 1070 | ||
| 1071 | return mac_time; | 1071 | return mac_time; |
| 1072 | } | 1072 | } |
| 1073 | 1073 | ||
| @@ -1130,23 +1130,23 @@ mktemp (char *template) | |||
| 1130 | { | 1130 | { |
| 1131 | int len, k; | 1131 | int len, k; |
| 1132 | static seqnum = 0; | 1132 | static seqnum = 0; |
| 1133 | 1133 | ||
| 1134 | len = strlen (template); | 1134 | len = strlen (template); |
| 1135 | k = len - 1; | 1135 | k = len - 1; |
| 1136 | while (k >= 0 && template[k] == 'X') | 1136 | while (k >= 0 && template[k] == 'X') |
| 1137 | k--; | 1137 | k--; |
| 1138 | 1138 | ||
| 1139 | k++; /* make k index of first 'X' */ | 1139 | k++; /* make k index of first 'X' */ |
| 1140 | 1140 | ||
| 1141 | if (k < len) | 1141 | if (k < len) |
| 1142 | { | 1142 | { |
| 1143 | /* Zero filled, number of digits equal to the number of X's. */ | 1143 | /* Zero filled, number of digits equal to the number of X's. */ |
| 1144 | sprintf (&template[k], "%0*d", len-k, seqnum++); | 1144 | sprintf (&template[k], "%0*d", len-k, seqnum++); |
| 1145 | 1145 | ||
| 1146 | return template; | 1146 | return template; |
| 1147 | } | 1147 | } |
| 1148 | else | 1148 | else |
| 1149 | return 0; | 1149 | return 0; |
| 1150 | } | 1150 | } |
| 1151 | 1151 | ||
| 1152 | 1152 | ||
| @@ -1157,7 +1157,7 @@ mktemp (char *template) | |||
| 1157 | static char my_passwd_name[PASSWD_FIELD_SIZE]; | 1157 | static char my_passwd_name[PASSWD_FIELD_SIZE]; |
| 1158 | static char my_passwd_dir[MAXPATHLEN+1]; | 1158 | static char my_passwd_dir[MAXPATHLEN+1]; |
| 1159 | 1159 | ||
| 1160 | static struct passwd my_passwd = | 1160 | static struct passwd my_passwd = |
| 1161 | { | 1161 | { |
| 1162 | my_passwd_name, | 1162 | my_passwd_name, |
| 1163 | my_passwd_dir, | 1163 | my_passwd_dir, |
| @@ -1201,7 +1201,7 @@ init_emacs_passwd_dir () | |||
| 1201 | } | 1201 | } |
| 1202 | } | 1202 | } |
| 1203 | } | 1203 | } |
| 1204 | 1204 | ||
| 1205 | if (!found) | 1205 | if (!found) |
| 1206 | { | 1206 | { |
| 1207 | /* Setting to "/" probably won't work but set it to something | 1207 | /* Setting to "/" probably won't work but set it to something |
| @@ -1212,7 +1212,7 @@ init_emacs_passwd_dir () | |||
| 1212 | } | 1212 | } |
| 1213 | 1213 | ||
| 1214 | 1214 | ||
| 1215 | static struct passwd emacs_passwd = | 1215 | static struct passwd emacs_passwd = |
| 1216 | { | 1216 | { |
| 1217 | "emacs", | 1217 | "emacs", |
| 1218 | emacs_passwd_dir, | 1218 | emacs_passwd_dir, |
| @@ -1248,11 +1248,11 @@ struct passwd * | |||
| 1248 | getpwuid (uid_t uid) | 1248 | getpwuid (uid_t uid) |
| 1249 | { | 1249 | { |
| 1250 | if (!my_passwd_inited) | 1250 | if (!my_passwd_inited) |
| 1251 | { | 1251 | { |
| 1252 | init_my_passwd (); | 1252 | init_my_passwd (); |
| 1253 | my_passwd_inited = 1; | 1253 | my_passwd_inited = 1; |
| 1254 | } | 1254 | } |
| 1255 | 1255 | ||
| 1256 | return &my_passwd; | 1256 | return &my_passwd; |
| 1257 | } | 1257 | } |
| 1258 | 1258 | ||
| @@ -1264,11 +1264,11 @@ getpwnam (const char *name) | |||
| 1264 | return &emacs_passwd; | 1264 | return &emacs_passwd; |
| 1265 | 1265 | ||
| 1266 | if (!my_passwd_inited) | 1266 | if (!my_passwd_inited) |
| 1267 | { | 1267 | { |
| 1268 | init_my_passwd (); | 1268 | init_my_passwd (); |
| 1269 | my_passwd_inited = 1; | 1269 | my_passwd_inited = 1; |
| 1270 | } | 1270 | } |
| 1271 | 1271 | ||
| 1272 | return &my_passwd; | 1272 | return &my_passwd; |
| 1273 | } | 1273 | } |
| 1274 | 1274 | ||
| @@ -1310,7 +1310,7 @@ int | |||
| 1310 | sigblock (int mask) | 1310 | sigblock (int mask) |
| 1311 | { | 1311 | { |
| 1312 | return 0; | 1312 | return 0; |
| 1313 | } | 1313 | } |
| 1314 | 1314 | ||
| 1315 | 1315 | ||
| 1316 | void | 1316 | void |
| @@ -1392,7 +1392,7 @@ path_from_vol_dir_name (char *path, int man_path_len, short vol_ref_num, | |||
| 1392 | err = PBGetCatInfo (&cipb, false); | 1392 | err = PBGetCatInfo (&cipb, false); |
| 1393 | if (err != noErr) | 1393 | if (err != noErr) |
| 1394 | return 0; | 1394 | return 0; |
| 1395 | 1395 | ||
| 1396 | p2cstr (dir_name); | 1396 | p2cstr (dir_name); |
| 1397 | if (strlen (dir_name) + strlen (path) + 1 >= man_path_len) | 1397 | if (strlen (dir_name) + strlen (path) + 1 >= man_path_len) |
| 1398 | return 0; | 1398 | return 0; |
| @@ -1404,7 +1404,7 @@ path_from_vol_dir_name (char *path, int man_path_len, short vol_ref_num, | |||
| 1404 | } | 1404 | } |
| 1405 | while (cipb.dirInfo.ioDrDirID != fsRtDirID); | 1405 | while (cipb.dirInfo.ioDrDirID != fsRtDirID); |
| 1406 | /* stop when we see the volume's root directory */ | 1406 | /* stop when we see the volume's root directory */ |
| 1407 | 1407 | ||
| 1408 | return 1; /* success */ | 1408 | return 1; /* success */ |
| 1409 | } | 1409 | } |
| 1410 | 1410 | ||
| @@ -1468,7 +1468,7 @@ find_true_pathname (const char *path, char *buf, int bufsiz) | |||
| 1468 | return -1; | 1468 | return -1; |
| 1469 | 1469 | ||
| 1470 | buf[0] = '\0'; | 1470 | buf[0] = '\0'; |
| 1471 | 1471 | ||
| 1472 | p = path; | 1472 | p = path; |
| 1473 | if (*p == '/') | 1473 | if (*p == '/') |
| 1474 | q = strchr (p + 1, '/'); | 1474 | q = strchr (p + 1, '/'); |
| @@ -1492,10 +1492,10 @@ find_true_pathname (const char *path, char *buf, int bufsiz) | |||
| 1492 | p = q + 1; | 1492 | p = q + 1; |
| 1493 | q = strchr(p, '/'); | 1493 | q = strchr(p, '/'); |
| 1494 | } | 1494 | } |
| 1495 | 1495 | ||
| 1496 | if (len + strlen (p) + 1 >= bufsiz) | 1496 | if (len + strlen (p) + 1 >= bufsiz) |
| 1497 | return -1; | 1497 | return -1; |
| 1498 | 1498 | ||
| 1499 | strcat (buf, p); | 1499 | strcat (buf, p); |
| 1500 | return len + strlen (p); | 1500 | return len + strlen (p); |
| 1501 | } | 1501 | } |
| @@ -1543,7 +1543,7 @@ int | |||
| 1543 | dup2 (int oldd, int newd) | 1543 | dup2 (int oldd, int newd) |
| 1544 | { | 1544 | { |
| 1545 | int fd, ret; | 1545 | int fd, ret; |
| 1546 | 1546 | ||
| 1547 | close (newd); | 1547 | close (newd); |
| 1548 | 1548 | ||
| 1549 | fd = dup (oldd); | 1549 | fd = dup (oldd); |
| @@ -1654,7 +1654,7 @@ get_temp_dir_name () | |||
| 1654 | CInfoPBRec cpb; | 1654 | CInfoPBRec cpb; |
| 1655 | char unix_dir_name[MAXPATHLEN+1]; | 1655 | char unix_dir_name[MAXPATHLEN+1]; |
| 1656 | DIR *dir; | 1656 | DIR *dir; |
| 1657 | 1657 | ||
| 1658 | /* Cache directory name with pointer temp_dir_name. | 1658 | /* Cache directory name with pointer temp_dir_name. |
| 1659 | Look for it only the first time. */ | 1659 | Look for it only the first time. */ |
| 1660 | if (!temp_dir_name) | 1660 | if (!temp_dir_name) |
| @@ -1663,18 +1663,18 @@ get_temp_dir_name () | |||
| 1663 | &vol_ref_num, &dir_id); | 1663 | &vol_ref_num, &dir_id); |
| 1664 | if (err != noErr) | 1664 | if (err != noErr) |
| 1665 | return NULL; | 1665 | return NULL; |
| 1666 | 1666 | ||
| 1667 | if (!path_from_vol_dir_name (full_path, 255, vol_ref_num, dir_id, "\p")) | 1667 | if (!path_from_vol_dir_name (full_path, 255, vol_ref_num, dir_id, "\p")) |
| 1668 | return NULL; | 1668 | return NULL; |
| 1669 | 1669 | ||
| 1670 | if (strlen (full_path) + 6 <= MAXPATHLEN) | 1670 | if (strlen (full_path) + 6 <= MAXPATHLEN) |
| 1671 | strcat (full_path, "Emacs:"); | 1671 | strcat (full_path, "Emacs:"); |
| 1672 | else | 1672 | else |
| 1673 | return NULL; | 1673 | return NULL; |
| 1674 | 1674 | ||
| 1675 | if (!mac_to_posix_pathname (full_path, unix_dir_name, MAXPATHLEN+1)) | 1675 | if (!mac_to_posix_pathname (full_path, unix_dir_name, MAXPATHLEN+1)) |
| 1676 | return NULL; | 1676 | return NULL; |
| 1677 | 1677 | ||
| 1678 | dir = opendir (unix_dir_name); /* check whether temp directory exists */ | 1678 | dir = opendir (unix_dir_name); /* check whether temp directory exists */ |
| 1679 | if (dir) | 1679 | if (dir) |
| 1680 | closedir (dir); | 1680 | closedir (dir); |
| @@ -1693,7 +1693,7 @@ get_temp_dir_name () | |||
| 1693 | /* Allocate and construct an array of pointers to strings from a list | 1693 | /* Allocate and construct an array of pointers to strings from a list |
| 1694 | of strings stored in a 'STR#' resource. The returned pointer array | 1694 | of strings stored in a 'STR#' resource. The returned pointer array |
| 1695 | is stored in the style of argv and environ: if the 'STR#' resource | 1695 | is stored in the style of argv and environ: if the 'STR#' resource |
| 1696 | contains numString strings, an pointer array with numString+1 | 1696 | contains numString strings, a pointer array with numString+1 |
| 1697 | elements is returned in which the last entry contains a null | 1697 | elements is returned in which the last entry contains a null |
| 1698 | pointer. The pointer to the pointer array is passed by pointer in | 1698 | pointer. The pointer to the pointer array is passed by pointer in |
| 1699 | parameter t. The resource ID of the 'STR#' resource is passed in | 1699 | parameter t. The resource ID of the 'STR#' resource is passed in |
| @@ -1747,19 +1747,19 @@ get_path_to_system_folder () | |||
| 1747 | CInfoPBRec cpb; | 1747 | CInfoPBRec cpb; |
| 1748 | static char system_folder_unix_name[MAXPATHLEN+1]; | 1748 | static char system_folder_unix_name[MAXPATHLEN+1]; |
| 1749 | DIR *dir; | 1749 | DIR *dir; |
| 1750 | 1750 | ||
| 1751 | err = FindFolder (kOnSystemDisk, kSystemFolderType, kDontCreateFolder, | 1751 | err = FindFolder (kOnSystemDisk, kSystemFolderType, kDontCreateFolder, |
| 1752 | &vol_ref_num, &dir_id); | 1752 | &vol_ref_num, &dir_id); |
| 1753 | if (err != noErr) | 1753 | if (err != noErr) |
| 1754 | return NULL; | 1754 | return NULL; |
| 1755 | 1755 | ||
| 1756 | if (!path_from_vol_dir_name (full_path, 255, vol_ref_num, dir_id, "\p")) | 1756 | if (!path_from_vol_dir_name (full_path, 255, vol_ref_num, dir_id, "\p")) |
| 1757 | return NULL; | 1757 | return NULL; |
| 1758 | 1758 | ||
| 1759 | if (!mac_to_posix_pathname (full_path, system_folder_unix_name, | 1759 | if (!mac_to_posix_pathname (full_path, system_folder_unix_name, |
| 1760 | MAXPATHLEN+1)) | 1760 | MAXPATHLEN+1)) |
| 1761 | return NULL; | 1761 | return NULL; |
| 1762 | 1762 | ||
| 1763 | return system_folder_unix_name; | 1763 | return system_folder_unix_name; |
| 1764 | } | 1764 | } |
| 1765 | 1765 | ||
| @@ -1774,7 +1774,7 @@ void | |||
| 1774 | init_environ () | 1774 | init_environ () |
| 1775 | { | 1775 | { |
| 1776 | int i; | 1776 | int i; |
| 1777 | 1777 | ||
| 1778 | get_string_list (&environ, ENVIRON_STRING_LIST_ID); | 1778 | get_string_list (&environ, ENVIRON_STRING_LIST_ID); |
| 1779 | 1779 | ||
| 1780 | i = 0; | 1780 | i = 0; |
| @@ -1918,7 +1918,7 @@ mystrchr (char *s, char c) | |||
| 1918 | 1918 | ||
| 1919 | char * | 1919 | char * |
| 1920 | mystrtok (char *s) | 1920 | mystrtok (char *s) |
| 1921 | { | 1921 | { |
| 1922 | while (*s) | 1922 | while (*s) |
| 1923 | s++; | 1923 | s++; |
| 1924 | 1924 | ||
| @@ -1974,7 +1974,7 @@ run_mac_command (argv, workdir, infn, outfn, errfn) | |||
| 1974 | RgnHandle cursor_region_handle; | 1974 | RgnHandle cursor_region_handle; |
| 1975 | TargetID targ; | 1975 | TargetID targ; |
| 1976 | unsigned long ref_con, len; | 1976 | unsigned long ref_con, len; |
| 1977 | 1977 | ||
| 1978 | if (posix_to_mac_pathname (workdir, macworkdir, MAXPATHLEN+1) == 0) | 1978 | if (posix_to_mac_pathname (workdir, macworkdir, MAXPATHLEN+1) == 0) |
| 1979 | return -1; | 1979 | return -1; |
| 1980 | if (posix_to_mac_pathname (infn, macinfn, MAXPATHLEN+1) == 0) | 1980 | if (posix_to_mac_pathname (infn, macinfn, MAXPATHLEN+1) == 0) |
| @@ -1983,7 +1983,7 @@ run_mac_command (argv, workdir, infn, outfn, errfn) | |||
| 1983 | return -1; | 1983 | return -1; |
| 1984 | if (posix_to_mac_pathname (errfn, macerrfn, MAXPATHLEN+1) == 0) | 1984 | if (posix_to_mac_pathname (errfn, macerrfn, MAXPATHLEN+1) == 0) |
| 1985 | return -1; | 1985 | return -1; |
| 1986 | 1986 | ||
| 1987 | paramlen = strlen (macworkdir) + strlen (macinfn) + strlen (macoutfn) | 1987 | paramlen = strlen (macworkdir) + strlen (macinfn) + strlen (macoutfn) |
| 1988 | + strlen (macerrfn) + 4; /* count nulls at end of strings */ | 1988 | + strlen (macerrfn) + 4; /* count nulls at end of strings */ |
| 1989 | 1989 | ||
| @@ -2002,14 +2002,14 @@ run_mac_command (argv, workdir, infn, outfn, errfn) | |||
| 2002 | && argc == 3 && strcmp (argv[1], "-c") == 0) | 2002 | && argc == 3 && strcmp (argv[1], "-c") == 0) |
| 2003 | { | 2003 | { |
| 2004 | char *command, *t, tempmacpathname[MAXPATHLEN+1]; | 2004 | char *command, *t, tempmacpathname[MAXPATHLEN+1]; |
| 2005 | 2005 | ||
| 2006 | /* The arguments for the command in argv[2] are separated by | 2006 | /* The arguments for the command in argv[2] are separated by |
| 2007 | spaces. Count them and put the count in newargc. */ | 2007 | spaces. Count them and put the count in newargc. */ |
| 2008 | command = (char *) alloca (strlen (argv[2])+2); | 2008 | command = (char *) alloca (strlen (argv[2])+2); |
| 2009 | strcpy (command, argv[2]); | 2009 | strcpy (command, argv[2]); |
| 2010 | if (command[strlen (command) - 1] != ' ') | 2010 | if (command[strlen (command) - 1] != ' ') |
| 2011 | strcat (command, " "); | 2011 | strcat (command, " "); |
| 2012 | 2012 | ||
| 2013 | t = command; | 2013 | t = command; |
| 2014 | newargc = 0; | 2014 | newargc = 0; |
| 2015 | t = mystrchr (t, ' '); | 2015 | t = mystrchr (t, ' '); |
| @@ -2018,9 +2018,9 @@ run_mac_command (argv, workdir, infn, outfn, errfn) | |||
| 2018 | newargc++; | 2018 | newargc++; |
| 2019 | t = mystrchr (t+1, ' '); | 2019 | t = mystrchr (t+1, ' '); |
| 2020 | } | 2020 | } |
| 2021 | 2021 | ||
| 2022 | newargv = (char **) alloca (sizeof (char *) * newargc); | 2022 | newargv = (char **) alloca (sizeof (char *) * newargc); |
| 2023 | 2023 | ||
| 2024 | t = command; | 2024 | t = command; |
| 2025 | for (j = 0; j < newargc; j++) | 2025 | for (j = 0; j < newargc; j++) |
| 2026 | { | 2026 | { |
| @@ -2030,7 +2030,7 @@ run_mac_command (argv, workdir, infn, outfn, errfn) | |||
| 2030 | t = mystrtok (t); | 2030 | t = mystrtok (t); |
| 2031 | paramlen += strlen (newargv[j]) + 1; | 2031 | paramlen += strlen (newargv[j]) + 1; |
| 2032 | } | 2032 | } |
| 2033 | 2033 | ||
| 2034 | if (strncmp (newargv[0], "~emacs/", 7) == 0) | 2034 | if (strncmp (newargv[0], "~emacs/", 7) == 0) |
| 2035 | { | 2035 | { |
| 2036 | if (posix_to_mac_pathname (newargv[0], tempmacpathname, MAXPATHLEN+1) | 2036 | if (posix_to_mac_pathname (newargv[0], tempmacpathname, MAXPATHLEN+1) |
| @@ -2057,12 +2057,12 @@ run_mac_command (argv, workdir, infn, outfn, errfn) | |||
| 2057 | strcpy (macappname, tempmacpathname); | 2057 | strcpy (macappname, tempmacpathname); |
| 2058 | } | 2058 | } |
| 2059 | else | 2059 | else |
| 2060 | { | 2060 | { |
| 2061 | if (posix_to_mac_pathname (argv[0], macappname, MAXPATHLEN+1) == 0) | 2061 | if (posix_to_mac_pathname (argv[0], macappname, MAXPATHLEN+1) == 0) |
| 2062 | return -1; | 2062 | return -1; |
| 2063 | 2063 | ||
| 2064 | newargv = (char **) alloca (sizeof (char *) * argc); | 2064 | newargv = (char **) alloca (sizeof (char *) * argc); |
| 2065 | newargc = argc; | 2065 | newargc = argc; |
| 2066 | for (j = 1; j < argc; j++) | 2066 | for (j = 1; j < argc; j++) |
| 2067 | { | 2067 | { |
| 2068 | if (strncmp (argv[j], "~emacs/", 7) == 0) | 2068 | if (strncmp (argv[j], "~emacs/", 7) == 0) |
| @@ -2092,7 +2092,7 @@ run_mac_command (argv, workdir, infn, outfn, errfn) | |||
| 2092 | } | 2092 | } |
| 2093 | } | 2093 | } |
| 2094 | else | 2094 | else |
| 2095 | newargv[j] = argv[j]; | 2095 | newargv[j] = argv[j]; |
| 2096 | paramlen += strlen (newargv[j]) + 1; | 2096 | paramlen += strlen (newargv[j]) + 1; |
| 2097 | } | 2097 | } |
| 2098 | } | 2098 | } |
| @@ -2113,24 +2113,24 @@ run_mac_command (argv, workdir, infn, outfn, errfn) | |||
| 2113 | /* null terminate strings sent so it's possible to use strcpy over there */ | 2113 | /* null terminate strings sent so it's possible to use strcpy over there */ |
| 2114 | strcpy (p, macinfn); | 2114 | strcpy (p, macinfn); |
| 2115 | p += strlen (macinfn); | 2115 | p += strlen (macinfn); |
| 2116 | *p++ = '\0'; | 2116 | *p++ = '\0'; |
| 2117 | strcpy (p, macoutfn); | 2117 | strcpy (p, macoutfn); |
| 2118 | p += strlen (macoutfn); | 2118 | p += strlen (macoutfn); |
| 2119 | *p++ = '\0'; | 2119 | *p++ = '\0'; |
| 2120 | strcpy (p, macerrfn); | 2120 | strcpy (p, macerrfn); |
| 2121 | p += strlen (macerrfn); | 2121 | p += strlen (macerrfn); |
| 2122 | *p++ = '\0'; | 2122 | *p++ = '\0'; |
| 2123 | for (j = 1; j < newargc; j++) | 2123 | for (j = 1; j < newargc; j++) |
| 2124 | { | 2124 | { |
| 2125 | strcpy (p, newargv[j]); | 2125 | strcpy (p, newargv[j]); |
| 2126 | p += strlen (newargv[j]); | 2126 | p += strlen (newargv[j]); |
| 2127 | *p++ = '\0'; | 2127 | *p++ = '\0'; |
| 2128 | } | 2128 | } |
| 2129 | 2129 | ||
| 2130 | c2pstr (macappname); | 2130 | c2pstr (macappname); |
| 2131 | 2131 | ||
| 2132 | iErr = FSMakeFSSpec (0, 0, macappname, &spec); | 2132 | iErr = FSMakeFSSpec (0, 0, macappname, &spec); |
| 2133 | 2133 | ||
| 2134 | if (iErr != noErr) | 2134 | if (iErr != noErr) |
| 2135 | { | 2135 | { |
| 2136 | free (param); | 2136 | free (param); |
| @@ -2171,7 +2171,7 @@ run_mac_command (argv, workdir, infn, outfn, errfn) | |||
| 2171 | } | 2171 | } |
| 2172 | 2172 | ||
| 2173 | cursor_region_handle = NewRgn (); | 2173 | cursor_region_handle = NewRgn (); |
| 2174 | 2174 | ||
| 2175 | /* Wait for the subprocess to finish, when it will send us a ERPY | 2175 | /* Wait for the subprocess to finish, when it will send us a ERPY |
| 2176 | high level event. */ | 2176 | high level event. */ |
| 2177 | while (1) | 2177 | while (1) |
| @@ -2179,7 +2179,7 @@ run_mac_command (argv, workdir, infn, outfn, errfn) | |||
| 2179 | cursor_region_handle) | 2179 | cursor_region_handle) |
| 2180 | && reply_event.message == kEmacsSubprocessReply) | 2180 | && reply_event.message == kEmacsSubprocessReply) |
| 2181 | break; | 2181 | break; |
| 2182 | 2182 | ||
| 2183 | /* The return code is sent through the refCon */ | 2183 | /* The return code is sent through the refCon */ |
| 2184 | iErr = AcceptHighLevelEvent (&targ, &ref_con, NULL, &len); | 2184 | iErr = AcceptHighLevelEvent (&targ, &ref_con, NULL, &len); |
| 2185 | if (iErr != noErr) | 2185 | if (iErr != noErr) |
| @@ -2188,7 +2188,7 @@ run_mac_command (argv, workdir, infn, outfn, errfn) | |||
| 2188 | free (param); | 2188 | free (param); |
| 2189 | return -1; | 2189 | return -1; |
| 2190 | } | 2190 | } |
| 2191 | 2191 | ||
| 2192 | DisposeHandle ((Handle) cursor_region_handle); | 2192 | DisposeHandle ((Handle) cursor_region_handle); |
| 2193 | free (param); | 2193 | free (param); |
| 2194 | 2194 | ||
| @@ -2200,16 +2200,16 @@ run_mac_command (argv, workdir, infn, outfn, errfn) | |||
| 2200 | DIR * | 2200 | DIR * |
| 2201 | opendir (const char *dirname) | 2201 | opendir (const char *dirname) |
| 2202 | { | 2202 | { |
| 2203 | char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1]; | 2203 | char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1]; |
| 2204 | char mac_pathname[MAXPATHLEN+1], vol_name[MAXPATHLEN+1]; | 2204 | char mac_pathname[MAXPATHLEN+1], vol_name[MAXPATHLEN+1]; |
| 2205 | DIR *dirp; | 2205 | DIR *dirp; |
| 2206 | CInfoPBRec cipb; | 2206 | CInfoPBRec cipb; |
| 2207 | HVolumeParam vpb; | 2207 | HVolumeParam vpb; |
| 2208 | int len, vol_name_len; | 2208 | int len, vol_name_len; |
| 2209 | 2209 | ||
| 2210 | if (find_true_pathname (dirname, true_pathname, MAXPATHLEN+1) == -1) | 2210 | if (find_true_pathname (dirname, true_pathname, MAXPATHLEN+1) == -1) |
| 2211 | return 0; | 2211 | return 0; |
| 2212 | 2212 | ||
| 2213 | len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN); | 2213 | len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN); |
| 2214 | if (len > -1) | 2214 | if (len > -1) |
| 2215 | fully_resolved_name[len] = '\0'; | 2215 | fully_resolved_name[len] = '\0'; |
| @@ -2237,7 +2237,7 @@ opendir (const char *dirname) | |||
| 2237 | len = strlen (mac_pathname); | 2237 | len = strlen (mac_pathname); |
| 2238 | if (mac_pathname[len - 1] != ':' && len < MAXPATHLEN) | 2238 | if (mac_pathname[len - 1] != ':' && len < MAXPATHLEN) |
| 2239 | strcat (mac_pathname, ":"); | 2239 | strcat (mac_pathname, ":"); |
| 2240 | 2240 | ||
| 2241 | /* Extract volume name */ | 2241 | /* Extract volume name */ |
| 2242 | vol_name_len = strchr (mac_pathname, ':') - mac_pathname; | 2242 | vol_name_len = strchr (mac_pathname, ':') - mac_pathname; |
| 2243 | strncpy (vol_name, mac_pathname, vol_name_len); | 2243 | strncpy (vol_name, mac_pathname, vol_name_len); |
| @@ -2251,7 +2251,7 @@ opendir (const char *dirname) | |||
| 2251 | cipb.hFileInfo.ioDirID = 0; | 2251 | cipb.hFileInfo.ioDirID = 0; |
| 2252 | cipb.hFileInfo.ioFDirIndex = 0; | 2252 | cipb.hFileInfo.ioFDirIndex = 0; |
| 2253 | /* set to 0 to get information about specific dir or file */ | 2253 | /* set to 0 to get information about specific dir or file */ |
| 2254 | 2254 | ||
| 2255 | errno = PBGetCatInfo (&cipb, false); | 2255 | errno = PBGetCatInfo (&cipb, false); |
| 2256 | if (errno != noErr) | 2256 | if (errno != noErr) |
| 2257 | { | 2257 | { |
| @@ -2279,7 +2279,7 @@ opendir (const char *dirname) | |||
| 2279 | } | 2279 | } |
| 2280 | 2280 | ||
| 2281 | dirp->vol_ref_num = vpb.ioVRefNum; | 2281 | dirp->vol_ref_num = vpb.ioVRefNum; |
| 2282 | 2282 | ||
| 2283 | return dirp; | 2283 | return dirp; |
| 2284 | } | 2284 | } |
| 2285 | 2285 | ||
| @@ -2312,14 +2312,14 @@ readdir (DIR *dp) | |||
| 2312 | hpblock.volumeParam.ioNamePtr = s_name; | 2312 | hpblock.volumeParam.ioNamePtr = s_name; |
| 2313 | hpblock.volumeParam.ioVRefNum = 0; | 2313 | hpblock.volumeParam.ioVRefNum = 0; |
| 2314 | hpblock.volumeParam.ioVolIndex = dp->current_index; | 2314 | hpblock.volumeParam.ioVolIndex = dp->current_index; |
| 2315 | 2315 | ||
| 2316 | errno = PBHGetVInfo (&hpblock, false); | 2316 | errno = PBHGetVInfo (&hpblock, false); |
| 2317 | if (errno != noErr) | 2317 | if (errno != noErr) |
| 2318 | { | 2318 | { |
| 2319 | errno = ENOENT; | 2319 | errno = ENOENT; |
| 2320 | return 0; | 2320 | return 0; |
| 2321 | } | 2321 | } |
| 2322 | 2322 | ||
| 2323 | p2cstr (s_name); | 2323 | p2cstr (s_name); |
| 2324 | strcat (s_name, "/"); /* need "/" for stat to work correctly */ | 2324 | strcat (s_name, "/"); /* need "/" for stat to work correctly */ |
| 2325 | 2325 | ||
| @@ -2327,7 +2327,7 @@ readdir (DIR *dp) | |||
| 2327 | 2327 | ||
| 2328 | s_dirent.d_ino = hpblock.volumeParam.ioVRefNum; | 2328 | s_dirent.d_ino = hpblock.volumeParam.ioVRefNum; |
| 2329 | s_dirent.d_name = s_name; | 2329 | s_dirent.d_name = s_name; |
| 2330 | 2330 | ||
| 2331 | return &s_dirent; | 2331 | return &s_dirent; |
| 2332 | } | 2332 | } |
| 2333 | else | 2333 | else |
| @@ -2343,25 +2343,25 @@ readdir (DIR *dp) | |||
| 2343 | cipb.hFileInfo.ioDirID = dp->dir_id; | 2343 | cipb.hFileInfo.ioDirID = dp->dir_id; |
| 2344 | /* directory ID found by opendir */ | 2344 | /* directory ID found by opendir */ |
| 2345 | cipb.hFileInfo.ioFDirIndex = dp->current_index; | 2345 | cipb.hFileInfo.ioFDirIndex = dp->current_index; |
| 2346 | 2346 | ||
| 2347 | errno = PBGetCatInfo (&cipb, false); | 2347 | errno = PBGetCatInfo (&cipb, false); |
| 2348 | if (errno != noErr) | 2348 | if (errno != noErr) |
| 2349 | { | 2349 | { |
| 2350 | errno = ENOENT; | 2350 | errno = ENOENT; |
| 2351 | return 0; | 2351 | return 0; |
| 2352 | } | 2352 | } |
| 2353 | 2353 | ||
| 2354 | /* insist on an visibile entry */ | 2354 | /* insist on a visible entry */ |
| 2355 | if (cipb.hFileInfo.ioFlAttrib & 0x10) /* directory? */ | 2355 | if (cipb.hFileInfo.ioFlAttrib & 0x10) /* directory? */ |
| 2356 | done = !(cipb.dirInfo.ioDrUsrWds.frFlags & fInvisible); | 2356 | done = !(cipb.dirInfo.ioDrUsrWds.frFlags & fInvisible); |
| 2357 | else | 2357 | else |
| 2358 | done = !(cipb.hFileInfo.ioFlFndrInfo.fdFlags & fInvisible); | 2358 | done = !(cipb.hFileInfo.ioFlFndrInfo.fdFlags & fInvisible); |
| 2359 | 2359 | ||
| 2360 | dp->current_index++; | 2360 | dp->current_index++; |
| 2361 | } | 2361 | } |
| 2362 | 2362 | ||
| 2363 | p2cstr (s_name); | 2363 | p2cstr (s_name); |
| 2364 | 2364 | ||
| 2365 | p = s_name; | 2365 | p = s_name; |
| 2366 | while (*p) | 2366 | while (*p) |
| 2367 | { | 2367 | { |
| @@ -2373,7 +2373,7 @@ readdir (DIR *dp) | |||
| 2373 | s_dirent.d_ino = cipb.dirInfo.ioDrDirID; | 2373 | s_dirent.d_ino = cipb.dirInfo.ioDrDirID; |
| 2374 | /* value unimportant: non-zero for valid file */ | 2374 | /* value unimportant: non-zero for valid file */ |
| 2375 | s_dirent.d_name = s_name; | 2375 | s_dirent.d_name = s_name; |
| 2376 | 2376 | ||
| 2377 | return &s_dirent; | 2377 | return &s_dirent; |
| 2378 | } | 2378 | } |
| 2379 | } | 2379 | } |
| @@ -2404,7 +2404,7 @@ initialize_applescript () | |||
| 2404 | { | 2404 | { |
| 2405 | AEDesc null_desc; | 2405 | AEDesc null_desc; |
| 2406 | OSAError osaerror; | 2406 | OSAError osaerror; |
| 2407 | 2407 | ||
| 2408 | /* if open fails, as_scripting_component is set to NULL. Its | 2408 | /* if open fails, as_scripting_component is set to NULL. Its |
| 2409 | subsequent use in OSA calls will fail with badComponentInstance | 2409 | subsequent use in OSA calls will fail with badComponentInstance |
| 2410 | error. */ | 2410 | error. */ |
| @@ -2530,7 +2530,7 @@ component. */) | |||
| 2530 | long status; | 2530 | long status; |
| 2531 | 2531 | ||
| 2532 | CHECK_STRING (script); | 2532 | CHECK_STRING (script); |
| 2533 | 2533 | ||
| 2534 | status = do_applescript (SDATA (script), &result); | 2534 | status = do_applescript (SDATA (script), &result); |
| 2535 | if (status) | 2535 | if (status) |
| 2536 | { | 2536 | { |
| @@ -2567,7 +2567,7 @@ DEFUN ("mac-file-name-to-posix", Fmac_file_name_to_posix, | |||
| 2567 | char posix_filename[MAXPATHLEN+1]; | 2567 | char posix_filename[MAXPATHLEN+1]; |
| 2568 | 2568 | ||
| 2569 | CHECK_STRING (mac_filename); | 2569 | CHECK_STRING (mac_filename); |
| 2570 | 2570 | ||
| 2571 | if (mac_to_posix_pathname (SDATA (mac_filename), posix_filename, | 2571 | if (mac_to_posix_pathname (SDATA (mac_filename), posix_filename, |
| 2572 | MAXPATHLEN)) | 2572 | MAXPATHLEN)) |
| 2573 | return build_string (posix_filename); | 2573 | return build_string (posix_filename); |
| @@ -2585,7 +2585,7 @@ DEFUN ("posix-file-name-to-mac", Fposix_file_name_to_mac, | |||
| 2585 | char mac_filename[MAXPATHLEN+1]; | 2585 | char mac_filename[MAXPATHLEN+1]; |
| 2586 | 2586 | ||
| 2587 | CHECK_STRING (posix_filename); | 2587 | CHECK_STRING (posix_filename); |
| 2588 | 2588 | ||
| 2589 | if (posix_to_mac_pathname (SDATA (posix_filename), mac_filename, | 2589 | if (posix_to_mac_pathname (SDATA (posix_filename), mac_filename, |
| 2590 | MAXPATHLEN)) | 2590 | MAXPATHLEN)) |
| 2591 | return build_string (mac_filename); | 2591 | return build_string (mac_filename); |
| @@ -2622,7 +2622,7 @@ DEFUN ("mac-paste-function", Fmac_paste_function, Smac_paste_function, 0, 0, 0, | |||
| 2622 | if (GetScrapFlavorData (scrap, kScrapFlavorTypeText, &s, data) != noErr | 2622 | if (GetScrapFlavorData (scrap, kScrapFlavorTypeText, &s, data) != noErr |
| 2623 | || s == 0) | 2623 | || s == 0) |
| 2624 | return Qnil; | 2624 | return Qnil; |
| 2625 | 2625 | ||
| 2626 | /* Emacs expects clipboard contents have Unix-style eol's */ | 2626 | /* Emacs expects clipboard contents have Unix-style eol's */ |
| 2627 | for (i = 0; i < s; i++) | 2627 | for (i = 0; i < s; i++) |
| 2628 | if (data[i] == '\r') | 2628 | if (data[i] == '\r') |
| @@ -2650,7 +2650,7 @@ DEFUN ("mac-paste-function", Fmac_paste_function, Smac_paste_function, 0, 0, 0, | |||
| 2650 | value = make_string (*my_handle, rc); | 2650 | value = make_string (*my_handle, rc); |
| 2651 | 2651 | ||
| 2652 | HUnlock (my_handle); | 2652 | HUnlock (my_handle); |
| 2653 | 2653 | ||
| 2654 | DisposeHandle (my_handle); | 2654 | DisposeHandle (my_handle); |
| 2655 | 2655 | ||
| 2656 | return value; | 2656 | return value; |
| @@ -2671,12 +2671,12 @@ DEFUN ("mac-cut-function", Fmac_cut_function, Smac_cut_function, 1, 2, 0, | |||
| 2671 | /* fixme: ignore the push flag for now */ | 2671 | /* fixme: ignore the push flag for now */ |
| 2672 | 2672 | ||
| 2673 | CHECK_STRING (value); | 2673 | CHECK_STRING (value); |
| 2674 | 2674 | ||
| 2675 | len = SCHARS (value); | 2675 | len = SCHARS (value); |
| 2676 | buf = (char *) alloca (len+1); | 2676 | buf = (char *) alloca (len+1); |
| 2677 | bcopy (SDATA (value), buf, len); | 2677 | bcopy (SDATA (value), buf, len); |
| 2678 | buf[len] = '\0'; | 2678 | buf[len] = '\0'; |
| 2679 | 2679 | ||
| 2680 | /* convert to Mac-style eol's before sending to clipboard */ | 2680 | /* convert to Mac-style eol's before sending to clipboard */ |
| 2681 | for (i = 0; i < len; i++) | 2681 | for (i = 0; i < len; i++) |
| 2682 | if (buf[i] == '\n') | 2682 | if (buf[i] == '\n') |
| @@ -2697,7 +2697,7 @@ DEFUN ("mac-cut-function", Fmac_cut_function, Smac_cut_function, 1, 2, 0, | |||
| 2697 | ZeroScrap (); | 2697 | ZeroScrap (); |
| 2698 | PutScrap (len, 'TEXT', buf); | 2698 | PutScrap (len, 'TEXT', buf); |
| 2699 | #endif /* not TARGET_API_MAC_CARBON */ | 2699 | #endif /* not TARGET_API_MAC_CARBON */ |
| 2700 | 2700 | ||
| 2701 | return Qnil; | 2701 | return Qnil; |
| 2702 | } | 2702 | } |
| 2703 | 2703 | ||
| @@ -2911,7 +2911,7 @@ syms_of_mac () | |||
| 2911 | { | 2911 | { |
| 2912 | QCLIPBOARD = intern ("CLIPBOARD"); | 2912 | QCLIPBOARD = intern ("CLIPBOARD"); |
| 2913 | staticpro (&QCLIPBOARD); | 2913 | staticpro (&QCLIPBOARD); |
| 2914 | 2914 | ||
| 2915 | defsubr (&Smac_paste_function); | 2915 | defsubr (&Smac_paste_function); |
| 2916 | defsubr (&Smac_cut_function); | 2916 | defsubr (&Smac_cut_function); |
| 2917 | defsubr (&Sx_selection_exists_p); | 2917 | defsubr (&Sx_selection_exists_p); |