Mercurial > hg > xemacs-beta
comparison src/sysdep.c @ 867:804517e16990
[xemacs-hg @ 2002-06-05 09:54:39 by ben]
Textual renaming: text/char names
abbrev.c, alloc.c, buffer.c, buffer.h, bytecode.c, callint.c, casefiddle.c, casetab.c, charset.h, chartab.c, chartab.h, cmds.c, console-gtk.h, console-msw.c, console-msw.h, console-stream.c, console-tty.c, console-x.c, console-x.h, console.h, data.c, device-msw.c, device-x.c, dialog-msw.c, dired-msw.c, dired.c, doc.c, doprnt.c, editfns.c, eldap.c, emodules.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-unixoid.c, events.c, events.h, file-coding.c, file-coding.h, fileio.c, filelock.c, fns.c, font-lock.c, frame-gtk.c, frame-msw.c, frame-x.c, frame.c, glyphs-eimage.c, glyphs-msw.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gui-x.c, gui-x.h, gui.c, gui.h, hpplay.c, indent.c, insdel.c, insdel.h, intl-win32.c, keymap.c, line-number.c, line-number.h, lisp-disunion.h, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, md5.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, mule-ccl.c, mule-charset.c, mule-coding.c, mule-wnnfns.c, ndir.h, nt.c, objects-gtk.c, objects-gtk.h, objects-msw.c, objects-tty.c, objects-x.c, objects.c, objects.h, postgresql.c, print.c, process-nt.c, process-unix.c, process.c, procimpl.h, realpath.c, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-tty.c, redisplay-x.c, redisplay.c, redisplay.h, regex.c, search.c, select-common.h, select-gtk.c, select-x.c, sound.h, symbols.c, syntax.c, syntax.h, sysdep.c, sysdep.h, sysdir.h, sysfile.h, sysproc.h, syspwd.h, systime.h, syswindows.h, termcap.c, tests.c, text.c, text.h, toolbar-common.c, tooltalk.c, ui-gtk.c, unexnt.c, unicode.c, win32.c: Text/char naming rationalization.
[a] distinguish between "charptr" when it refers to operations on
the pointer itself and when it refers to operations on text; and
[b] use consistent naming for everything referring to internal
format, i.e.
Itext == text in internal format
Ibyte == a byte in such text
Ichar == a char as represented in internal character format
thus e.g.
set_charptr_emchar -> set_itext_ichar
The pre and post tags on either side of this change are:
pre-internal-format-textual-renaming
post-internal-format-textual-renaming
See the Internals Manual for details of exactly how this was done,
how to handle the change in your workspace, etc.
author | ben |
---|---|
date | Wed, 05 Jun 2002 09:58:45 +0000 |
parents | 42375619fa45 |
children | 79c6ff3eef26 |
comparison
equal
deleted
inserted
replaced
866:613552a02607 | 867:804517e16990 |
---|---|
567 /* Fork a subshell. */ | 567 /* Fork a subshell. */ |
568 static void | 568 static void |
569 sys_subshell (void) | 569 sys_subshell (void) |
570 { | 570 { |
571 Lisp_Object dir; | 571 Lisp_Object dir; |
572 Intbyte *str = 0; | 572 Ibyte *str = 0; |
573 Bytecount len; | 573 Bytecount len; |
574 struct gcpro gcpro1; | 574 struct gcpro gcpro1; |
575 Intbyte *sh = 0; | 575 Ibyte *sh = 0; |
576 Extbyte *shext; | 576 Extbyte *shext; |
577 | 577 |
578 /* Use our buffer's default directory for the subshell. */ | 578 /* Use our buffer's default directory for the subshell. */ |
579 | 579 |
580 /* Note: These calls are spread out to insure that the return values | 580 /* Note: These calls are spread out to insure that the return values |
588 results, so put the slash back. */ | 588 results, so put the slash back. */ |
589 dir = Ffile_name_as_directory (dir); | 589 dir = Ffile_name_as_directory (dir); |
590 dir = Funhandled_file_name_directory (dir); | 590 dir = Funhandled_file_name_directory (dir); |
591 dir = expand_and_dir_to_file (dir, Qnil); | 591 dir = expand_and_dir_to_file (dir, Qnil); |
592 | 592 |
593 str = (Intbyte *) ALLOCA (XSTRING_LENGTH (dir) + 2); | 593 str = (Ibyte *) ALLOCA (XSTRING_LENGTH (dir) + 2); |
594 len = XSTRING_LENGTH (dir); | 594 len = XSTRING_LENGTH (dir); |
595 memcpy (str, XSTRING_DATA (dir), len); | 595 memcpy (str, XSTRING_DATA (dir), len); |
596 if (!IS_ANY_SEP (str[len - 1])) | 596 if (!IS_ANY_SEP (str[len - 1])) |
597 str[len++] = DIRECTORY_SEP; | 597 str[len++] = DIRECTORY_SEP; |
598 str[len] = 0; | 598 str[len] = 0; |
741 #endif | 741 #endif |
742 } | 742 } |
743 | 743 |
744 /* Figure out the eof character for the FD. */ | 744 /* Figure out the eof character for the FD. */ |
745 | 745 |
746 Intbyte | 746 Ibyte |
747 get_eof_char (int fd) | 747 get_eof_char (int fd) |
748 { | 748 { |
749 const Intbyte ctrl_d = (Intbyte) '\004'; | 749 const Ibyte ctrl_d = (Ibyte) '\004'; |
750 | 750 |
751 if (!isatty (fd)) | 751 if (!isatty (fd)) |
752 return ctrl_d; | 752 return ctrl_d; |
753 #ifdef HAVE_TERMIOS | 753 #ifdef HAVE_TERMIOS |
754 { | 754 { |
757 #if 0 | 757 #if 0 |
758 /* What is the following line designed to do??? -mrb */ | 758 /* What is the following line designed to do??? -mrb */ |
759 if ((int) strlen ((const char *) t.c_cc) < (VEOF + 1)) | 759 if ((int) strlen ((const char *) t.c_cc) < (VEOF + 1)) |
760 return ctrl_d; | 760 return ctrl_d; |
761 else | 761 else |
762 return (Intbyte) t.c_cc[VEOF]; | 762 return (Ibyte) t.c_cc[VEOF]; |
763 #endif | 763 #endif |
764 return t.c_cc[VEOF] == _POSIX_VDISABLE ? ctrl_d : (Intbyte) t.c_cc[VEOF]; | 764 return t.c_cc[VEOF] == _POSIX_VDISABLE ? ctrl_d : (Ibyte) t.c_cc[VEOF]; |
765 } | 765 } |
766 #else /* ! HAVE_TERMIOS */ | 766 #else /* ! HAVE_TERMIOS */ |
767 /* On Berkeley descendants, the following IOCTL's retrieve the | 767 /* On Berkeley descendants, the following IOCTL's retrieve the |
768 current control characters. */ | 768 current control characters. */ |
769 #if defined (TIOCGETC) | 769 #if defined (TIOCGETC) |
770 { | 770 { |
771 struct tchars c; | 771 struct tchars c; |
772 ioctl (fd, TIOCGETC, &c); | 772 ioctl (fd, TIOCGETC, &c); |
773 return (Intbyte) c.t_eofc; | 773 return (Ibyte) c.t_eofc; |
774 } | 774 } |
775 #else /* ! defined (TIOCGLTC) && defined (TIOCGETC) */ | 775 #else /* ! defined (TIOCGLTC) && defined (TIOCGETC) */ |
776 /* On SYSV descendants, the TCGETA ioctl retrieves the current control | 776 /* On SYSV descendants, the TCGETA ioctl retrieves the current control |
777 characters. */ | 777 characters. */ |
778 #ifdef TCGETA | 778 #ifdef TCGETA |
780 struct termio t; | 780 struct termio t; |
781 ioctl (fd, TCGETA, &t); | 781 ioctl (fd, TCGETA, &t); |
782 if ((int) strlen ((const char *) t.c_cc) < (VINTR + 1)) | 782 if ((int) strlen ((const char *) t.c_cc) < (VINTR + 1)) |
783 return ctrl_d; | 783 return ctrl_d; |
784 else | 784 else |
785 return (Intbyte) t.c_cc[VINTR]; | 785 return (Ibyte) t.c_cc[VINTR]; |
786 } | 786 } |
787 #else /* ! defined (TCGETA) */ | 787 #else /* ! defined (TCGETA) */ |
788 /* Rather than complain, we'll just guess ^D, which is what | 788 /* Rather than complain, we'll just guess ^D, which is what |
789 * earlier emacsen always used. */ | 789 * earlier emacsen always used. */ |
790 return ctrl_d; | 790 return ctrl_d; |
2322 } | 2322 } |
2323 # endif /* HAVE_SOCKETS */ | 2323 # endif /* HAVE_SOCKETS */ |
2324 Vsystem_name = build_string (hostname); | 2324 Vsystem_name = build_string (hostname); |
2325 #endif /* HAVE_GETHOSTNAME */ | 2325 #endif /* HAVE_GETHOSTNAME */ |
2326 { | 2326 { |
2327 Intbyte *p; | 2327 Ibyte *p; |
2328 Bytecount i; | 2328 Bytecount i; |
2329 | 2329 |
2330 for (i = 0, p = XSTRING_DATA (Vsystem_name); | 2330 for (i = 0, p = XSTRING_DATA (Vsystem_name); |
2331 i < XSTRING_LENGTH (Vsystem_name); | 2331 i < XSTRING_LENGTH (Vsystem_name); |
2332 i++, p++) | 2332 i++, p++) |
2561 | 2561 |
2562 /* The basic external entry point to open(). Handles conversion to | 2562 /* The basic external entry point to open(). Handles conversion to |
2563 external encoding, interruptions, etc. */ | 2563 external encoding, interruptions, etc. */ |
2564 | 2564 |
2565 int | 2565 int |
2566 qxe_open (const Intbyte *path, int oflag, ...) | 2566 qxe_open (const Ibyte *path, int oflag, ...) |
2567 { | 2567 { |
2568 Extbyte *pathout; | 2568 Extbyte *pathout; |
2569 int mode; | 2569 int mode; |
2570 va_list ap; | 2570 va_list ap; |
2571 | 2571 |
2584 | 2584 |
2585 This function will not function as expected on systems where open() | 2585 This function will not function as expected on systems where open() |
2586 is not interrupted by C-g. However, the worst that can happen is | 2586 is not interrupted by C-g. However, the worst that can happen is |
2587 the fallback to simple open(). */ | 2587 the fallback to simple open(). */ |
2588 int | 2588 int |
2589 qxe_interruptible_open (const Intbyte *path, int oflag, int mode) | 2589 qxe_interruptible_open (const Ibyte *path, int oflag, int mode) |
2590 { | 2590 { |
2591 /* This function can GC */ | 2591 /* This function can GC */ |
2592 Extbyte *pathout; | 2592 Extbyte *pathout; |
2593 | 2593 |
2594 PATHNAME_CONVERT_OUT (path, pathout); | 2594 PATHNAME_CONVERT_OUT (path, pathout); |
2771 return fopen (path, mode); | 2771 return fopen (path, mode); |
2772 #endif /* defined (INTERRUPTIBLE_OPEN) */ | 2772 #endif /* defined (INTERRUPTIBLE_OPEN) */ |
2773 } | 2773 } |
2774 | 2774 |
2775 FILE * | 2775 FILE * |
2776 qxe_fopen (const Intbyte *path, const Char_ASCII *mode) | 2776 qxe_fopen (const Ibyte *path, const Char_ASCII *mode) |
2777 { | 2777 { |
2778 Extbyte *pathout; | 2778 Extbyte *pathout; |
2779 PATHNAME_CONVERT_OUT (path, pathout); | 2779 PATHNAME_CONVERT_OUT (path, pathout); |
2780 return retry_fopen (pathout, mode); | 2780 return retry_fopen (pathout, mode); |
2781 } | 2781 } |
2852 } | 2852 } |
2853 | 2853 |
2854 /********************* directory calls *******************/ | 2854 /********************* directory calls *******************/ |
2855 | 2855 |
2856 int | 2856 int |
2857 qxe_chdir (const Intbyte *path) | 2857 qxe_chdir (const Ibyte *path) |
2858 { | 2858 { |
2859 Extbyte *pathout; | 2859 Extbyte *pathout; |
2860 PATHNAME_CONVERT_OUT (path, pathout); | 2860 PATHNAME_CONVERT_OUT (path, pathout); |
2861 #ifdef WIN32_NATIVE | 2861 #ifdef WIN32_NATIVE |
2862 if (XEUNICODE_P) | 2862 if (XEUNICODE_P) |
2867 return chdir (pathout); | 2867 return chdir (pathout); |
2868 #endif | 2868 #endif |
2869 } | 2869 } |
2870 | 2870 |
2871 int | 2871 int |
2872 qxe_mkdir (const Intbyte *path, mode_t mode) | 2872 qxe_mkdir (const Ibyte *path, mode_t mode) |
2873 { | 2873 { |
2874 Extbyte *pathout; | 2874 Extbyte *pathout; |
2875 PATHNAME_CONVERT_OUT (path, pathout); | 2875 PATHNAME_CONVERT_OUT (path, pathout); |
2876 #ifdef WIN32_NATIVE | 2876 #ifdef WIN32_NATIVE |
2877 if (XEUNICODE_P) | 2877 if (XEUNICODE_P) |
2882 return mkdir (pathout, mode); | 2882 return mkdir (pathout, mode); |
2883 #endif | 2883 #endif |
2884 } | 2884 } |
2885 | 2885 |
2886 DIR * | 2886 DIR * |
2887 qxe_opendir (const Intbyte *filename) | 2887 qxe_opendir (const Ibyte *filename) |
2888 { | 2888 { |
2889 #ifdef WIN32_NATIVE | 2889 #ifdef WIN32_NATIVE |
2890 return mswindows_opendir (filename); | 2890 return mswindows_opendir (filename); |
2891 #else | 2891 #else |
2892 DIR *rtnval; | 2892 DIR *rtnval; |
2919 if (rtnval == NULL) /* End of directory */ | 2919 if (rtnval == NULL) /* End of directory */ |
2920 return NULL; | 2920 return NULL; |
2921 { | 2921 { |
2922 const Extbyte * const external_name = (const Extbyte *) rtnval->d_name; | 2922 const Extbyte * const external_name = (const Extbyte *) rtnval->d_name; |
2923 Bytecount external_len = strlen (rtnval->d_name); | 2923 Bytecount external_len = strlen (rtnval->d_name); |
2924 const Intbyte *internal_name; | 2924 const Ibyte *internal_name; |
2925 Bytecount internal_len; | 2925 Bytecount internal_len; |
2926 | 2926 |
2927 TO_INTERNAL_FORMAT (DATA, (external_name, external_len), | 2927 TO_INTERNAL_FORMAT (DATA, (external_name, external_len), |
2928 ALLOCA, (internal_name, internal_len), | 2928 ALLOCA, (internal_name, internal_len), |
2929 Qfile_name); | 2929 Qfile_name); |
2932 if (internal_len == external_len && | 2932 if (internal_len == external_len && |
2933 !memcmp (external_name, internal_name, internal_len)) | 2933 !memcmp (external_name, internal_name, internal_len)) |
2934 return rtnval; | 2934 return rtnval; |
2935 | 2935 |
2936 { /* Non-ASCII filename */ | 2936 { /* Non-ASCII filename */ |
2937 static Intbyte_dynarr *internal_DIRENTRY; | 2937 static Ibyte_dynarr *internal_DIRENTRY; |
2938 if (!internal_DIRENTRY) | 2938 if (!internal_DIRENTRY) |
2939 internal_DIRENTRY = Dynarr_new (Intbyte); | 2939 internal_DIRENTRY = Dynarr_new (Ibyte); |
2940 else | 2940 else |
2941 Dynarr_reset (internal_DIRENTRY); | 2941 Dynarr_reset (internal_DIRENTRY); |
2942 | 2942 |
2943 Dynarr_add_many (internal_DIRENTRY, (Intbyte *) rtnval, | 2943 Dynarr_add_many (internal_DIRENTRY, (Ibyte *) rtnval, |
2944 offsetof (DIRENTRY, d_name)); | 2944 offsetof (DIRENTRY, d_name)); |
2945 | 2945 |
2946 | 2946 |
2947 Dynarr_add_many (internal_DIRENTRY, internal_name, internal_len); | 2947 Dynarr_add_many (internal_DIRENTRY, internal_name, internal_len); |
2948 Dynarr_add (internal_DIRENTRY, '\0'); /* NUL-terminate */ | 2948 Dynarr_add (internal_DIRENTRY, '\0'); /* NUL-terminate */ |
2967 return rtnval; | 2967 return rtnval; |
2968 #endif /* WIN32_NATIVE */ | 2968 #endif /* WIN32_NATIVE */ |
2969 } | 2969 } |
2970 | 2970 |
2971 int | 2971 int |
2972 qxe_rmdir (const Intbyte *path) | 2972 qxe_rmdir (const Ibyte *path) |
2973 { | 2973 { |
2974 Extbyte *pathout; | 2974 Extbyte *pathout; |
2975 PATHNAME_CONVERT_OUT (path, pathout); | 2975 PATHNAME_CONVERT_OUT (path, pathout); |
2976 #ifdef WIN32_NATIVE | 2976 #ifdef WIN32_NATIVE |
2977 if (XEUNICODE_P) | 2977 if (XEUNICODE_P) |
2981 #else | 2981 #else |
2982 return rmdir (pathout); | 2982 return rmdir (pathout); |
2983 #endif | 2983 #endif |
2984 } | 2984 } |
2985 | 2985 |
2986 Intbyte * | 2986 Ibyte * |
2987 qxe_allocating_getcwd (void) | 2987 qxe_allocating_getcwd (void) |
2988 { | 2988 { |
2989 #ifdef HAVE_GETCWD | 2989 #ifdef HAVE_GETCWD |
2990 Bytecount cwdsize = 1024; | 2990 Bytecount cwdsize = 1024; |
2991 Extbyte *cwd = xnew_array (Extbyte, cwdsize); | 2991 Extbyte *cwd = xnew_array (Extbyte, cwdsize); |
3003 else | 3003 else |
3004 ret = _getcwd (cwd, cwdsize); | 3004 ret = _getcwd (cwd, cwdsize); |
3005 | 3005 |
3006 if (ret) | 3006 if (ret) |
3007 { | 3007 { |
3008 Intbyte *retin; | 3008 Ibyte *retin; |
3009 TSTR_TO_C_STRING_MALLOC (ret, retin); | 3009 TSTR_TO_C_STRING_MALLOC (ret, retin); |
3010 xfree (cwd); | 3010 xfree (cwd); |
3011 return retin; | 3011 return retin; |
3012 } | 3012 } |
3013 #else | 3013 #else |
3014 Extbyte *ret = getcwd (cwd, cwdsize); | 3014 Extbyte *ret = getcwd (cwd, cwdsize); |
3015 if (ret) | 3015 if (ret) |
3016 { | 3016 { |
3017 Intbyte *retin; | 3017 Ibyte *retin; |
3018 EXTERNAL_TO_C_STRING_MALLOC (ret, retin, Qfile_name); | 3018 EXTERNAL_TO_C_STRING_MALLOC (ret, retin, Qfile_name); |
3019 xfree (cwd); | 3019 xfree (cwd); |
3020 return retin; | 3020 return retin; |
3021 } | 3021 } |
3022 #endif /* WIN32_NATIVE */ | 3022 #endif /* WIN32_NATIVE */ |
3032 return NULL; | 3032 return NULL; |
3033 } | 3033 } |
3034 } | 3034 } |
3035 #else | 3035 #else |
3036 Extbyte chingame_limitos_arbitrarios[PATH_MAX]; | 3036 Extbyte chingame_limitos_arbitrarios[PATH_MAX]; |
3037 Intbyte *ret2; | 3037 Ibyte *ret2; |
3038 | 3038 |
3039 if (!getwd (chingame_limitos_arbitrarios)) | 3039 if (!getwd (chingame_limitos_arbitrarios)) |
3040 return 0; | 3040 return 0; |
3041 EXTERNAL_TO_C_STRING_MALLOC (chingame_limitos_arbitrarios, ret2, Qfile_name); | 3041 EXTERNAL_TO_C_STRING_MALLOC (chingame_limitos_arbitrarios, ret2, Qfile_name); |
3042 return ret2; | 3042 return ret2; |
3044 } | 3044 } |
3045 | 3045 |
3046 /***************** file-information calls ******************/ | 3046 /***************** file-information calls ******************/ |
3047 | 3047 |
3048 int | 3048 int |
3049 qxe_access (const Intbyte *path, int mode) | 3049 qxe_access (const Ibyte *path, int mode) |
3050 { | 3050 { |
3051 #ifdef WIN32_NATIVE | 3051 #ifdef WIN32_NATIVE |
3052 return mswindows_access (path, mode); | 3052 return mswindows_access (path, mode); |
3053 #else /* not WIN32_NATIVE */ | 3053 #else /* not WIN32_NATIVE */ |
3054 Extbyte *pathout; | 3054 Extbyte *pathout; |
3057 #endif /* WIN32_NATIVE */ | 3057 #endif /* WIN32_NATIVE */ |
3058 } | 3058 } |
3059 | 3059 |
3060 #if defined (HAVE_EACCESS) | 3060 #if defined (HAVE_EACCESS) |
3061 int | 3061 int |
3062 qxe_eaccess (const Intbyte *path, int mode) | 3062 qxe_eaccess (const Ibyte *path, int mode) |
3063 { | 3063 { |
3064 Extbyte *pathout; | 3064 Extbyte *pathout; |
3065 PATHNAME_CONVERT_OUT (path, pathout); | 3065 PATHNAME_CONVERT_OUT (path, pathout); |
3066 return eaccess (pathout, mode); | 3066 return eaccess (pathout, mode); |
3067 } | 3067 } |
3068 #endif /* defined (HAVE_EACCESS) */ | 3068 #endif /* defined (HAVE_EACCESS) */ |
3069 | 3069 |
3070 int | 3070 int |
3071 qxe_lstat (const Intbyte *path, struct stat *buf) | 3071 qxe_lstat (const Ibyte *path, struct stat *buf) |
3072 { | 3072 { |
3073 /* if system does not have symbolic links, it does not have lstat. | 3073 /* if system does not have symbolic links, it does not have lstat. |
3074 In that case, use ordinary stat instead. */ | 3074 In that case, use ordinary stat instead. */ |
3075 #ifndef S_IFLNK | 3075 #ifndef S_IFLNK |
3076 return qxe_stat (path, buf); | 3076 return qxe_stat (path, buf); |
3081 #endif | 3081 #endif |
3082 } | 3082 } |
3083 | 3083 |
3084 #if defined (HAVE_READLINK) | 3084 #if defined (HAVE_READLINK) |
3085 int | 3085 int |
3086 qxe_readlink (const Intbyte *path, Intbyte *buf, size_t bufsiz) | 3086 qxe_readlink (const Ibyte *path, Ibyte *buf, size_t bufsiz) |
3087 { | 3087 { |
3088 int retval; | 3088 int retval; |
3089 Extbyte *pathout; | 3089 Extbyte *pathout; |
3090 | 3090 |
3091 PATHNAME_CONVERT_OUT (path, pathout); | 3091 PATHNAME_CONVERT_OUT (path, pathout); |
3092 retval = readlink (pathout, (char *) buf, bufsiz); | 3092 retval = readlink (pathout, (char *) buf, bufsiz); |
3093 if (retval < 0) | 3093 if (retval < 0) |
3094 return retval; | 3094 return retval; |
3095 { | 3095 { |
3096 Intbyte *intbuf; | 3096 Ibyte *intbuf; |
3097 Bytecount tamanho; | 3097 Bytecount tamanho; |
3098 | 3098 |
3099 TO_INTERNAL_FORMAT (DATA, (buf, retval), | 3099 TO_INTERNAL_FORMAT (DATA, (buf, retval), |
3100 ALLOCA, (intbuf, tamanho), Qfile_name); | 3100 ALLOCA, (intbuf, tamanho), Qfile_name); |
3101 /* the man page says this function does not null-terminate */ | 3101 /* the man page says this function does not null-terminate */ |
3116 return fstat (fd, buf); | 3116 return fstat (fd, buf); |
3117 #endif /* WIN32_NATIVE */ | 3117 #endif /* WIN32_NATIVE */ |
3118 } | 3118 } |
3119 | 3119 |
3120 int | 3120 int |
3121 qxe_stat (const Intbyte *path, struct stat *buf) | 3121 qxe_stat (const Ibyte *path, struct stat *buf) |
3122 { | 3122 { |
3123 #ifdef WIN32_NATIVE | 3123 #ifdef WIN32_NATIVE |
3124 return mswindows_stat (path, buf); | 3124 return mswindows_stat (path, buf); |
3125 #else /* not WIN32_NATIVE */ | 3125 #else /* not WIN32_NATIVE */ |
3126 Extbyte *pathout; | 3126 Extbyte *pathout; |
3131 | 3131 |
3132 | 3132 |
3133 /****************** file-manipulation calls *****************/ | 3133 /****************** file-manipulation calls *****************/ |
3134 | 3134 |
3135 int | 3135 int |
3136 qxe_chmod (const Intbyte *path, mode_t mode) | 3136 qxe_chmod (const Ibyte *path, mode_t mode) |
3137 { | 3137 { |
3138 Extbyte *pathout; | 3138 Extbyte *pathout; |
3139 PATHNAME_CONVERT_OUT (path, pathout); | 3139 PATHNAME_CONVERT_OUT (path, pathout); |
3140 #ifdef WIN32_NATIVE | 3140 #ifdef WIN32_NATIVE |
3141 if (XEUNICODE_P) | 3141 if (XEUNICODE_P) |
3147 #endif | 3147 #endif |
3148 } | 3148 } |
3149 | 3149 |
3150 #if defined (HAVE_LINK) | 3150 #if defined (HAVE_LINK) |
3151 int | 3151 int |
3152 qxe_link (const Intbyte *existing, const Intbyte *new) | 3152 qxe_link (const Ibyte *existing, const Ibyte *new) |
3153 { | 3153 { |
3154 #ifdef WIN32_NATIVE | 3154 #ifdef WIN32_NATIVE |
3155 return mswindows_link (existing, new); | 3155 return mswindows_link (existing, new); |
3156 #else /* not WIN32_NATIVE */ | 3156 #else /* not WIN32_NATIVE */ |
3157 Extbyte *existingout, *newout; | 3157 Extbyte *existingout, *newout; |
3161 #endif /* WIN32_NATIVE */ | 3161 #endif /* WIN32_NATIVE */ |
3162 } | 3162 } |
3163 #endif /* defined (HAVE_LINK) */ | 3163 #endif /* defined (HAVE_LINK) */ |
3164 | 3164 |
3165 int | 3165 int |
3166 qxe_rename (const Intbyte *old, const Intbyte *new) | 3166 qxe_rename (const Ibyte *old, const Ibyte *new) |
3167 { | 3167 { |
3168 #ifdef WIN32_NATIVE | 3168 #ifdef WIN32_NATIVE |
3169 /* Windows rename fails if NEW exists */ | 3169 /* Windows rename fails if NEW exists */ |
3170 if (mswindows_rename (old, new) == 0) | 3170 if (mswindows_rename (old, new) == 0) |
3171 return 0; | 3171 return 0; |
3182 #endif /* WIN32_NATIVE */ | 3182 #endif /* WIN32_NATIVE */ |
3183 } | 3183 } |
3184 | 3184 |
3185 #if defined (HAVE_SYMLINK) | 3185 #if defined (HAVE_SYMLINK) |
3186 int | 3186 int |
3187 qxe_symlink (const Intbyte *name1, const Intbyte *name2) | 3187 qxe_symlink (const Ibyte *name1, const Ibyte *name2) |
3188 { | 3188 { |
3189 Extbyte *name1out, *name2out; | 3189 Extbyte *name1out, *name2out; |
3190 PATHNAME_CONVERT_OUT (name1, name1out); | 3190 PATHNAME_CONVERT_OUT (name1, name1out); |
3191 PATHNAME_CONVERT_OUT (name2, name2out); | 3191 PATHNAME_CONVERT_OUT (name2, name2out); |
3192 return symlink (name1out, name2out); | 3192 return symlink (name1out, name2out); |
3193 } | 3193 } |
3194 #endif /* defined (HAVE_SYMLINK) */ | 3194 #endif /* defined (HAVE_SYMLINK) */ |
3195 | 3195 |
3196 int | 3196 int |
3197 qxe_unlink (const Intbyte *path) | 3197 qxe_unlink (const Ibyte *path) |
3198 { | 3198 { |
3199 #ifdef WIN32_NATIVE | 3199 #ifdef WIN32_NATIVE |
3200 return mswindows_unlink (path); | 3200 return mswindows_unlink (path); |
3201 #else /* not WIN32_NATIVE */ | 3201 #else /* not WIN32_NATIVE */ |
3202 Extbyte *pathout; | 3202 Extbyte *pathout; |
3207 | 3207 |
3208 | 3208 |
3209 /****************** process calls *****************/ | 3209 /****************** process calls *****************/ |
3210 | 3210 |
3211 int | 3211 int |
3212 qxe_execve (const Intbyte *filename, Intbyte * const argv[], | 3212 qxe_execve (const Ibyte *filename, Ibyte * const argv[], |
3213 Intbyte * const envp[]) | 3213 Ibyte * const envp[]) |
3214 { | 3214 { |
3215 int i, argc, envc; | 3215 int i, argc, envc; |
3216 Extbyte *pathext; | 3216 Extbyte *pathext; |
3217 Extbyte **new_argv; | 3217 Extbyte **new_argv; |
3218 Extbyte **new_envp; | 3218 Extbyte **new_envp; |
3286 C_STRING_MALLOC, cached_pwd.pw_shell, Qfile_name); | 3286 C_STRING_MALLOC, cached_pwd.pw_shell, Qfile_name); |
3287 return &cached_pwd; | 3287 return &cached_pwd; |
3288 } | 3288 } |
3289 | 3289 |
3290 struct passwd * | 3290 struct passwd * |
3291 qxe_getpwnam (const Intbyte *name) | 3291 qxe_getpwnam (const Ibyte *name) |
3292 { | 3292 { |
3293 #ifdef WIN32_NATIVE | 3293 #ifdef WIN32_NATIVE |
3294 /* Synthetic versions are defined in nt.c and already do conversion. */ | 3294 /* Synthetic versions are defined in nt.c and already do conversion. */ |
3295 return getpwnam (name); | 3295 return getpwnam (name); |
3296 #else | 3296 #else |
3323 | 3323 |
3324 #endif /* not WIN32_NATIVE */ | 3324 #endif /* not WIN32_NATIVE */ |
3325 | 3325 |
3326 /****************** time calls *****************/ | 3326 /****************** time calls *****************/ |
3327 | 3327 |
3328 static Intbyte *ctime_static; | 3328 static Ibyte *ctime_static; |
3329 | 3329 |
3330 Intbyte * | 3330 Ibyte * |
3331 qxe_ctime (const time_t *t) | 3331 qxe_ctime (const time_t *t) |
3332 { | 3332 { |
3333 Extbyte *str = (Extbyte *) ctime (t); | 3333 Extbyte *str = (Extbyte *) ctime (t); |
3334 if (!str) /* can happen on MS Windows */ | 3334 if (!str) /* can happen on MS Windows */ |
3335 return (Intbyte *) "Sun Jan 01 00:00:00 1970"; | 3335 return (Ibyte *) "Sun Jan 01 00:00:00 1970"; |
3336 if (ctime_static) | 3336 if (ctime_static) |
3337 xfree (ctime_static); | 3337 xfree (ctime_static); |
3338 EXTERNAL_TO_C_STRING_MALLOC (str, ctime_static, Qnative); | 3338 EXTERNAL_TO_C_STRING_MALLOC (str, ctime_static, Qnative); |
3339 return ctime_static; | 3339 return ctime_static; |
3340 } | 3340 } |