aboutsummaryrefslogtreecommitdiffstats
path: root/mac/src
diff options
context:
space:
mode:
authorAndrew Choi2001-08-21 16:00:33 +0000
committerAndrew Choi2001-08-21 16:00:33 +0000
commit60fe116151ab7d8604a24e0a4babf3d0b3d7c183 (patch)
treea338e0507c8dd86548bc0df38d0ac5630134c5c6 /mac/src
parent51c2603b4ae793a2e2a301f653cbe3ed67a6a73d (diff)
downloademacs-60fe116151ab7d8604a24e0a4babf3d0b3d7c183.tar.gz
emacs-60fe116151ab7d8604a24e0a4babf3d0b3d7c183.zip
2001-08-21 Andrew Choi <akochoi@cse.cuhk.edu.hk>
* src/macterm.c (local_to_global_coord): Comment out. * src/mac.c (mac-filename-to-unix): Change to mac-file-name-to-posix. (unix-filename-to-mac): Change to posix-file-name-to-mac. (mac_to_unix_pathname): Change to mac_to_posix_pathname. (unix_to_mac_pathname): Change to posix_to_mac_pathname. * src/macterm.c (do_ae_open_documents): Change call to mac_to_unix_pathname to mac_to_posix_pathname.
Diffstat (limited to 'mac/src')
-rw-r--r--mac/src/mac.c80
-rw-r--r--mac/src/macterm.c2
2 files changed, 41 insertions, 41 deletions
diff --git a/mac/src/mac.c b/mac/src/mac.c
index 1e468a308d7..e588fd38fb9 100644
--- a/mac/src/mac.c
+++ b/mac/src/mac.c
@@ -91,7 +91,7 @@ string_cat_and_replace (char *s1, const char *s2, int n, char a, char b)
91 Returns 1 if successful; 0 if fails. */ 91 Returns 1 if successful; 0 if fails. */
92 92
93int 93int
94mac_to_unix_pathname (const char *mfn, char *ufn, int ufnbuflen) 94mac_to_posix_pathname (const char *mfn, char *ufn, int ufnbuflen)
95{ 95{
96 const char *p, *q, *pe; 96 const char *p, *q, *pe;
97 97
@@ -150,7 +150,7 @@ extern char *get_temp_dir_name ();
150 above in algorithm. */ 150 above in algorithm. */
151 151
152int 152int
153unix_to_mac_pathname (const char *ufn, char *mfn, int mfnbuflen) 153posix_to_mac_pathname (const char *ufn, char *mfn, int mfnbuflen)
154{ 154{
155 const char *p, *q, *pe; 155 const char *p, *q, *pe;
156 char expanded_pathname[MAXPATHLEN+1]; 156 char expanded_pathname[MAXPATHLEN+1];
@@ -280,7 +280,7 @@ stat_noalias (const char *path, struct stat *buf)
280 char mac_pathname[MAXPATHLEN+1]; 280 char mac_pathname[MAXPATHLEN+1];
281 CInfoPBRec cipb; 281 CInfoPBRec cipb;
282 282
283 if (unix_to_mac_pathname (path, mac_pathname, MAXPATHLEN+1) == 0) 283 if (posix_to_mac_pathname (path, mac_pathname, MAXPATHLEN+1) == 0)
284 return -1; 284 return -1;
285 285
286 c2pstr (mac_pathname); 286 c2pstr (mac_pathname);
@@ -420,7 +420,7 @@ mkdir (const char *dirname, int mode)
420 if (find_true_pathname (dirname, true_pathname, MAXPATHLEN+1) == -1) 420 if (find_true_pathname (dirname, true_pathname, MAXPATHLEN+1) == -1)
421 return -1; 421 return -1;
422 422
423 if (unix_to_mac_pathname (true_pathname, mac_pathname, MAXPATHLEN+1) == 0) 423 if (posix_to_mac_pathname (true_pathname, mac_pathname, MAXPATHLEN+1) == 0)
424 return -1; 424 return -1;
425 425
426 c2pstr (mac_pathname); 426 c2pstr (mac_pathname);
@@ -440,7 +440,7 @@ sys_rmdir (const char *dirname)
440 HFileParam hfpb; 440 HFileParam hfpb;
441 char mac_pathname[MAXPATHLEN+1]; 441 char mac_pathname[MAXPATHLEN+1];
442 442
443 if (unix_to_mac_pathname (dirname, mac_pathname, MAXPATHLEN+1) == 0) 443 if (posix_to_mac_pathname (dirname, mac_pathname, MAXPATHLEN+1) == 0)
444 return -1; 444 return -1;
445 445
446 c2pstr (mac_pathname); 446 c2pstr (mac_pathname);
@@ -480,7 +480,7 @@ utime (const char *path, const struct utimbuf *times)
480 else 480 else
481 strcpy (fully_resolved_name, true_pathname); 481 strcpy (fully_resolved_name, true_pathname);
482 482
483 if (!unix_to_mac_pathname (fully_resolved_name, mac_pathname, MAXPATHLEN+1)) 483 if (!posix_to_mac_pathname (fully_resolved_name, mac_pathname, MAXPATHLEN+1))
484 return -1; 484 return -1;
485 485
486 c2pstr (mac_pathname); 486 c2pstr (mac_pathname);
@@ -542,7 +542,7 @@ access (const char *path, int mode)
542 else 542 else
543 strcpy (fully_resolved_name, true_pathname); 543 strcpy (fully_resolved_name, true_pathname);
544 544
545 if (!unix_to_mac_pathname (fully_resolved_name, mac_pathname, MAXPATHLEN+1)) 545 if (!posix_to_mac_pathname (fully_resolved_name, mac_pathname, MAXPATHLEN+1))
546 return -1; 546 return -1;
547 547
548 c2pstr (mac_pathname); 548 c2pstr (mac_pathname);
@@ -600,7 +600,7 @@ sys_open (const char *path, int oflag)
600 else 600 else
601 strcpy (fully_resolved_name, true_pathname); 601 strcpy (fully_resolved_name, true_pathname);
602 602
603 if (!unix_to_mac_pathname (fully_resolved_name, mac_pathname, MAXPATHLEN+1)) 603 if (!posix_to_mac_pathname (fully_resolved_name, mac_pathname, MAXPATHLEN+1))
604 return -1; 604 return -1;
605 else 605 else
606 { 606 {
@@ -624,7 +624,7 @@ sys_creat (const char *path, mode_t mode)
624 if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1) 624 if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1)
625 return -1; 625 return -1;
626 626
627 if (!unix_to_mac_pathname (true_pathname, mac_pathname, MAXPATHLEN+1)) 627 if (!posix_to_mac_pathname (true_pathname, mac_pathname, MAXPATHLEN+1))
628 return -1; 628 return -1;
629 else 629 else
630 { 630 {
@@ -656,7 +656,7 @@ sys_unlink (const char *path)
656 else 656 else
657 strcpy (fully_resolved_name, true_pathname); 657 strcpy (fully_resolved_name, true_pathname);
658 658
659 if (!unix_to_mac_pathname (fully_resolved_name, mac_pathname, MAXPATHLEN+1)) 659 if (!posix_to_mac_pathname (fully_resolved_name, mac_pathname, MAXPATHLEN+1))
660 return -1; 660 return -1;
661 else 661 else
662 return unlink (mac_pathname); 662 return unlink (mac_pathname);
@@ -717,12 +717,12 @@ sys_rename (const char * old_name, const char * new_name)
717 if (strcmp (fully_resolved_old_name, true_new_pathname) == 0) 717 if (strcmp (fully_resolved_old_name, true_new_pathname) == 0)
718 return 0; 718 return 0;
719 719
720 if (!unix_to_mac_pathname (fully_resolved_old_name, 720 if (!posix_to_mac_pathname (fully_resolved_old_name,
721 mac_old_name, 721 mac_old_name,
722 MAXPATHLEN+1)) 722 MAXPATHLEN+1))
723 return -1; 723 return -1;
724 724
725 if (!unix_to_mac_pathname(true_new_pathname, mac_new_name, MAXPATHLEN+1)) 725 if (!posix_to_mac_pathname(true_new_pathname, mac_new_name, MAXPATHLEN+1))
726 return -1; 726 return -1;
727 727
728 /* If a file with new_name already exists, rename deletes the old 728 /* If a file with new_name already exists, rename deletes the old
@@ -752,7 +752,7 @@ sys_fopen (const char *name, const char *mode)
752 else 752 else
753 strcpy (fully_resolved_name, true_pathname); 753 strcpy (fully_resolved_name, true_pathname);
754 754
755 if (!unix_to_mac_pathname (fully_resolved_name, mac_pathname, MAXPATHLEN+1)) 755 if (!posix_to_mac_pathname (fully_resolved_name, mac_pathname, MAXPATHLEN+1))
756 return 0; 756 return 0;
757 else 757 else
758 { 758 {
@@ -1381,7 +1381,7 @@ readlink (const char *path, char *buf, int bufsiz)
1381 Str255 directory_name, mac_pathname; 1381 Str255 directory_name, mac_pathname;
1382 CInfoPBRec cipb; 1382 CInfoPBRec cipb;
1383 1383
1384 if (unix_to_mac_pathname (path, mac_sym_link_name, MAXPATHLEN+1) == 0) 1384 if (posix_to_mac_pathname (path, mac_sym_link_name, MAXPATHLEN+1) == 0)
1385 return -1; 1385 return -1;
1386 1386
1387 c2pstr (mac_sym_link_name); 1387 c2pstr (mac_sym_link_name);
@@ -1406,7 +1406,7 @@ readlink (const char *path, char *buf, int bufsiz)
1406 return -1; 1406 return -1;
1407 } 1407 }
1408 1408
1409 if (mac_to_unix_pathname (mac_pathname, buf, bufsiz) == 0) 1409 if (mac_to_posix_pathname (mac_pathname, buf, bufsiz) == 0)
1410 { 1410 {
1411 errno = ENOENT; 1411 errno = ENOENT;
1412 return -1; 1412 return -1;
@@ -1631,7 +1631,7 @@ get_temp_dir_name ()
1631 else 1631 else
1632 return NULL; 1632 return NULL;
1633 1633
1634 if (!mac_to_unix_pathname (full_path, unix_dir_name, MAXPATHLEN+1)) 1634 if (!mac_to_posix_pathname (full_path, unix_dir_name, MAXPATHLEN+1))
1635 return NULL; 1635 return NULL;
1636 1636
1637 dir = opendir (unix_dir_name); /* check whether temp directory exists */ 1637 dir = opendir (unix_dir_name); /* check whether temp directory exists */
@@ -1714,7 +1714,7 @@ get_path_to_system_folder ()
1714 if (!path_from_vol_dir_name (full_path, 255, vol_ref_num, dir_id, "\p")) 1714 if (!path_from_vol_dir_name (full_path, 255, vol_ref_num, dir_id, "\p"))
1715 return NULL; 1715 return NULL;
1716 1716
1717 if (!mac_to_unix_pathname (full_path, system_folder_unix_name, MAXPATHLEN+1)) 1717 if (!mac_to_posix_pathname (full_path, system_folder_unix_name, MAXPATHLEN+1))
1718 return NULL; 1718 return NULL;
1719 1719
1720 return system_folder_unix_name; 1720 return system_folder_unix_name;
@@ -1929,13 +1929,13 @@ run_mac_command (argv, workdir, infn, outfn, errfn)
1929 TargetID targ; 1929 TargetID targ;
1930 unsigned long ref_con, len; 1930 unsigned long ref_con, len;
1931 1931
1932 if (unix_to_mac_pathname (workdir, macworkdir, MAXPATHLEN+1) == 0) 1932 if (posix_to_mac_pathname (workdir, macworkdir, MAXPATHLEN+1) == 0)
1933 return -1; 1933 return -1;
1934 if (unix_to_mac_pathname (infn, macinfn, MAXPATHLEN+1) == 0) 1934 if (posix_to_mac_pathname (infn, macinfn, MAXPATHLEN+1) == 0)
1935 return -1; 1935 return -1;
1936 if (unix_to_mac_pathname (outfn, macoutfn, MAXPATHLEN+1) == 0) 1936 if (posix_to_mac_pathname (outfn, macoutfn, MAXPATHLEN+1) == 0)
1937 return -1; 1937 return -1;
1938 if (unix_to_mac_pathname (errfn, macerrfn, MAXPATHLEN+1) == 0) 1938 if (posix_to_mac_pathname (errfn, macerrfn, MAXPATHLEN+1) == 0)
1939 return -1; 1939 return -1;
1940 1940
1941 paramlen = strlen (macworkdir) + strlen (macinfn) + strlen (macoutfn) 1941 paramlen = strlen (macworkdir) + strlen (macinfn) + strlen (macoutfn)
@@ -1987,7 +1987,7 @@ run_mac_command (argv, workdir, infn, outfn, errfn)
1987 1987
1988 if (strncmp (newargv[0], "~emacs/", 7) == 0) 1988 if (strncmp (newargv[0], "~emacs/", 7) == 0)
1989 { 1989 {
1990 if (unix_to_mac_pathname (newargv[0], tempmacpathname, MAXPATHLEN+1) 1990 if (posix_to_mac_pathname (newargv[0], tempmacpathname, MAXPATHLEN+1)
1991 == 0) 1991 == 0)
1992 return -1; 1992 return -1;
1993 } 1993 }
@@ -2004,7 +2004,7 @@ run_mac_command (argv, workdir, infn, outfn, errfn)
2004 2004
2005 if (NILP (path)) 2005 if (NILP (path))
2006 return -1; 2006 return -1;
2007 if (unix_to_mac_pathname (XSTRING (path)->data, tempmacpathname, 2007 if (posix_to_mac_pathname (XSTRING (path)->data, tempmacpathname,
2008 MAXPATHLEN+1) == 0) 2008 MAXPATHLEN+1) == 0)
2009 return -1; 2009 return -1;
2010 } 2010 }
@@ -2012,7 +2012,7 @@ run_mac_command (argv, workdir, infn, outfn, errfn)
2012 } 2012 }
2013 else 2013 else
2014 { 2014 {
2015 if (unix_to_mac_pathname (argv[0], macappname, MAXPATHLEN+1) == 0) 2015 if (posix_to_mac_pathname (argv[0], macappname, MAXPATHLEN+1) == 0)
2016 return -1; 2016 return -1;
2017 2017
2018 newargv = (char **) alloca (sizeof (char *) * argc); 2018 newargv = (char **) alloca (sizeof (char *) * argc);
@@ -2027,7 +2027,7 @@ run_mac_command (argv, workdir, infn, outfn, errfn)
2027 char tempcmdname[MAXPATHLEN+1], tempmaccmdname[MAXPATHLEN+1]; 2027 char tempcmdname[MAXPATHLEN+1], tempmaccmdname[MAXPATHLEN+1];
2028 strncpy (tempcmdname, argv[j], t-argv[j]); 2028 strncpy (tempcmdname, argv[j], t-argv[j]);
2029 tempcmdname[t-argv[j]] = '\0'; 2029 tempcmdname[t-argv[j]] = '\0';
2030 if (unix_to_mac_pathname (tempcmdname, tempmaccmdname, 2030 if (posix_to_mac_pathname (tempcmdname, tempmaccmdname,
2031 MAXPATHLEN+1) == 0) 2031 MAXPATHLEN+1) == 0)
2032 return -1; 2032 return -1;
2033 newargv[j] = (char *) alloca (strlen (tempmaccmdname) 2033 newargv[j] = (char *) alloca (strlen (tempmaccmdname)
@@ -2038,7 +2038,7 @@ run_mac_command (argv, workdir, infn, outfn, errfn)
2038 else 2038 else
2039 { 2039 {
2040 char tempmaccmdname[MAXPATHLEN+1]; 2040 char tempmaccmdname[MAXPATHLEN+1];
2041 if (unix_to_mac_pathname (argv[j], tempmaccmdname, 2041 if (posix_to_mac_pathname (argv[j], tempmaccmdname,
2042 MAXPATHLEN+1) == 0) 2042 MAXPATHLEN+1) == 0)
2043 return -1; 2043 return -1;
2044 newargv[j] = (char *) alloca (strlen (tempmaccmdname)+1); 2044 newargv[j] = (char *) alloca (strlen (tempmaccmdname)+1);
@@ -2183,7 +2183,7 @@ opendir (const char *dirname)
2183 } 2183 }
2184 2184
2185 /* Handle typical cases: not accessing all mounted volumes. */ 2185 /* Handle typical cases: not accessing all mounted volumes. */
2186 if (!unix_to_mac_pathname (fully_resolved_name, mac_pathname, MAXPATHLEN+1)) 2186 if (!posix_to_mac_pathname (fully_resolved_name, mac_pathname, MAXPATHLEN+1))
2187 return 0; 2187 return 0;
2188 2188
2189 /* Emacs calls opendir without the trailing '/', Mac needs trailing ':' */ 2189 /* Emacs calls opendir without the trailing '/', Mac needs trailing ':' */
@@ -2343,7 +2343,7 @@ getwd (char *path)
2343 if (path_from_vol_dir_name (mac_pathname, 255, 0, 0, "\p") == 0) 2343 if (path_from_vol_dir_name (mac_pathname, 255, 0, 0, "\p") == 0)
2344 return NULL; 2344 return NULL;
2345 2345
2346 if (mac_to_unix_pathname (mac_pathname, path, MAXPATHLEN+1) == 0) 2346 if (mac_to_posix_pathname (mac_pathname, path, MAXPATHLEN+1) == 0)
2347 return 0; 2347 return 0;
2348 else 2348 else
2349 return path; 2349 return path;
@@ -2486,35 +2486,35 @@ component.")
2486} 2486}
2487 2487
2488 2488
2489DEFUN ("mac-filename-to-unix", Fmac_filename_to_unix, Smac_filename_to_unix, 1, 2489DEFUN ("mac-file-name-to-posix", Fmac_file_name_to_posix, Smac_file_name_to_posix, 1,
2490 1, 0, 2490 1, 0,
2491 "Convert Macintosh filename to Unix form.") 2491 "Convert Macintosh filename to Posix form.")
2492 (mac_filename) 2492 (mac_filename)
2493 Lisp_Object mac_filename; 2493 Lisp_Object mac_filename;
2494{ 2494{
2495 char unix_filename[MAXPATHLEN+1]; 2495 char posix_filename[MAXPATHLEN+1];
2496 2496
2497 CHECK_STRING (mac_filename, 0); 2497 CHECK_STRING (mac_filename, 0);
2498 2498
2499 if (mac_to_unix_pathname(XSTRING (mac_filename)->data, unix_filename, 2499 if (mac_to_posix_pathname (XSTRING (mac_filename)->data, posix_filename,
2500 MAXPATHLEN)) 2500 MAXPATHLEN))
2501 return build_string (unix_filename); 2501 return build_string (posix_filename);
2502 else 2502 else
2503 return Qnil; 2503 return Qnil;
2504} 2504}
2505 2505
2506 2506
2507DEFUN ("unix-filename-to-mac", Funix_filename_to_mac, Sunix_filename_to_mac, 1, 2507DEFUN ("posix-file-name-to-mac", Fposix_file_name_to_mac, Sposix_file_name_to_mac, 1,
2508 1, 0, 2508 1, 0,
2509 "Convert Unix filename to Mac form.") 2509 "Convert Unix filename to Mac form.")
2510 (unix_filename) 2510 (posix_filename)
2511 Lisp_Object unix_filename; 2511 Lisp_Object posix_filename;
2512{ 2512{
2513 char mac_filename[MAXPATHLEN+1]; 2513 char mac_filename[MAXPATHLEN+1];
2514 2514
2515 CHECK_STRING (unix_filename, 0); 2515 CHECK_STRING (posix_filename, 0);
2516 2516
2517 if (unix_to_mac_pathname(XSTRING (unix_filename)->data, mac_filename, 2517 if (posix_to_mac_pathname (XSTRING (posix_filename)->data, mac_filename,
2518 MAXPATHLEN)) 2518 MAXPATHLEN))
2519 return build_string (mac_filename); 2519 return build_string (mac_filename);
2520 else 2520 else
@@ -2633,6 +2633,6 @@ syms_of_mac ()
2633 defsubr (&Sx_selection_exists_p); 2633 defsubr (&Sx_selection_exists_p);
2634 2634
2635 defsubr (&Sdo_applescript); 2635 defsubr (&Sdo_applescript);
2636 defsubr (&Smac_filename_to_unix); 2636 defsubr (&Smac_file_name_to_posix);
2637 defsubr (&Sunix_filename_to_mac); 2637 defsubr (&Sposix_file_name_to_mac);
2638} 2638}
diff --git a/mac/src/macterm.c b/mac/src/macterm.c
index 549b2369121..9bd22c7d062 100644
--- a/mac/src/macterm.c
+++ b/mac/src/macterm.c
@@ -11590,7 +11590,7 @@ do_ae_open_documents(AppleEvent *message, AppleEvent *reply, long refcon)
11590 11590
11591 if (path_from_vol_dir_name (path_name, 255, fs.vRefNum, fs.parID, 11591 if (path_from_vol_dir_name (path_name, 255, fs.vRefNum, fs.parID,
11592 fs.name) && 11592 fs.name) &&
11593 mac_to_unix_pathname (path_name, unix_path_name, 255)) 11593 mac_to_posix_pathname (path_name, unix_path_name, 255))
11594 drag_and_drop_file_list = Fcons (build_string (unix_path_name), 11594 drag_and_drop_file_list = Fcons (build_string (unix_path_name),
11595 drag_and_drop_file_list); 11595 drag_and_drop_file_list);
11596 } 11596 }