annotate src/sysfile.h @ 4952:19a72041c5ed

Mule-izing, various fixes related to char * arguments -------------------- ChangeLog entries follow: -------------------- modules/ChangeLog addition: 2010-01-26 Ben Wing <ben@xemacs.org> * postgresql/postgresql.c: * postgresql/postgresql.c (CHECK_LIVE_CONNECTION): * postgresql/postgresql.c (print_pgresult): * postgresql/postgresql.c (Fpq_conn_defaults): * postgresql/postgresql.c (Fpq_connectdb): * postgresql/postgresql.c (Fpq_connect_start): * postgresql/postgresql.c (Fpq_result_status): * postgresql/postgresql.c (Fpq_res_status): Mule-ize large parts of it. 2010-01-26 Ben Wing <ben@xemacs.org> * ldap/eldap.c (print_ldap): * ldap/eldap.c (allocate_ldap): Use write_ascstring(). src/ChangeLog addition: 2010-01-26 Ben Wing <ben@xemacs.org> * alloc.c: * alloc.c (build_ascstring): * alloc.c (build_msg_cistring): * alloc.c (staticpro_1): * alloc.c (staticpro_name): * alloc.c (staticpro_nodump_1): * alloc.c (staticpro_nodump_name): * alloc.c (unstaticpro_nodump_1): * alloc.c (mcpro_1): * alloc.c (mcpro_name): * alloc.c (object_memory_usage_stats): * alloc.c (common_init_alloc_early): * alloc.c (init_alloc_once_early): * buffer.c (print_buffer): * buffer.c (vars_of_buffer): * buffer.c (common_init_complex_vars_of_buffer): * buffer.c (init_initial_directory): * bytecode.c (invalid_byte_code): * bytecode.c (print_compiled_function): * bytecode.c (mark_compiled_function): * chartab.c (print_table_entry): * chartab.c (print_char_table): * config.h.in: * console-gtk.c: * console-gtk.c (gtk_device_to_console_connection): * console-gtk.c (gtk_semi_canonicalize_console_connection): * console-gtk.c (gtk_canonicalize_console_connection): * console-gtk.c (gtk_semi_canonicalize_device_connection): * console-gtk.c (gtk_canonicalize_device_connection): * console-stream.c (stream_init_frame_1): * console-stream.c (vars_of_console_stream): * console-stream.c (init_console_stream): * console-x.c (x_semi_canonicalize_console_connection): * console-x.c (x_semi_canonicalize_device_connection): * console-x.c (x_canonicalize_device_connection): * console-x.h: * data.c (eq_with_ebola_notice): * data.c (Fsubr_interactive): * data.c (Fnumber_to_string): * data.c (digit_to_number): * device-gtk.c (gtk_init_device): * device-msw.c (print_devmode): * device-x.c (x_event_name): * dialog-msw.c (handle_directory_dialog_box): * dialog-msw.c (handle_file_dialog_box): * dialog-msw.c (vars_of_dialog_mswindows): * doc.c (weird_doc): * doc.c (Fsnarf_documentation): * doc.c (vars_of_doc): * dumper.c (pdump): * dynarr.c: * dynarr.c (Dynarr_realloc): * editfns.c (Fuser_real_login_name): * editfns.c (get_home_directory): * elhash.c (print_hash_table_data): * elhash.c (print_hash_table): * emacs.c (main_1): * emacs.c (vars_of_emacs): * emodules.c: * emodules.c (_emodules_list): * emodules.c (Fload_module): * emodules.c (Funload_module): * emodules.c (Flist_modules): * emodules.c (find_make_module): * emodules.c (attempt_module_delete): * emodules.c (emodules_load): * emodules.c (emodules_doc_subr): * emodules.c (emodules_doc_sym): * emodules.c (syms_of_module): * emodules.c (vars_of_module): * emodules.h: * eval.c (print_subr): * eval.c (signal_call_debugger): * eval.c (build_error_data): * eval.c (signal_error): * eval.c (maybe_signal_error): * eval.c (signal_continuable_error): * eval.c (maybe_signal_continuable_error): * eval.c (signal_error_2): * eval.c (maybe_signal_error_2): * eval.c (signal_continuable_error_2): * eval.c (maybe_signal_continuable_error_2): * eval.c (signal_ferror): * eval.c (maybe_signal_ferror): * eval.c (signal_continuable_ferror): * eval.c (maybe_signal_continuable_ferror): * eval.c (signal_ferror_with_frob): * eval.c (maybe_signal_ferror_with_frob): * eval.c (signal_continuable_ferror_with_frob): * eval.c (maybe_signal_continuable_ferror_with_frob): * eval.c (syntax_error): * eval.c (syntax_error_2): * eval.c (maybe_syntax_error): * eval.c (sferror): * eval.c (sferror_2): * eval.c (maybe_sferror): * eval.c (invalid_argument): * eval.c (invalid_argument_2): * eval.c (maybe_invalid_argument): * eval.c (invalid_constant): * eval.c (invalid_constant_2): * eval.c (maybe_invalid_constant): * eval.c (invalid_operation): * eval.c (invalid_operation_2): * eval.c (maybe_invalid_operation): * eval.c (invalid_change): * eval.c (invalid_change_2): * eval.c (maybe_invalid_change): * eval.c (invalid_state): * eval.c (invalid_state_2): * eval.c (maybe_invalid_state): * eval.c (wtaerror): * eval.c (stack_overflow): * eval.c (out_of_memory): * eval.c (print_multiple_value): * eval.c (issue_call_trapping_problems_warning): * eval.c (backtrace_specials): * eval.c (backtrace_unevalled_args): * eval.c (Fbacktrace): * eval.c (warn_when_safe): * event-Xt.c (modwarn): * event-Xt.c (modbarf): * event-Xt.c (check_modifier): * event-Xt.c (store_modifier): * event-Xt.c (emacs_Xt_format_magic_event): * event-Xt.c (describe_event): * event-gtk.c (dragndrop_data_received): * event-gtk.c (store_modifier): * event-gtk.c (gtk_reset_modifier_mapping): * event-msw.c (dde_eval_string): * event-msw.c (Fdde_alloc_advise_item): * event-msw.c (mswindows_dde_callback): * event-msw.c (FROB): * event-msw.c (emacs_mswindows_format_magic_event): * event-stream.c (external_debugging_print_event): * event-stream.c (execute_help_form): * event-stream.c (vars_of_event_stream): * events.c (print_event_1): * events.c (print_event): * events.c (event_equal): * extents.c (print_extent_1): * extents.c (print_extent): * extents.c (vars_of_extents): * faces.c (print_face): * faces.c (complex_vars_of_faces): * file-coding.c: * file-coding.c (print_coding_system): * file-coding.c (print_coding_system_in_print_method): * file-coding.c (default_query_method): * file-coding.c (find_coding_system): * file-coding.c (make_coding_system_1): * file-coding.c (chain_print): * file-coding.c (undecided_print): * file-coding.c (gzip_print): * file-coding.c (vars_of_file_coding): * file-coding.c (complex_vars_of_file_coding): * fileio.c: * fileio.c (report_file_type_error): * fileio.c (report_error_with_errno): * fileio.c (report_file_error): * fileio.c (barf_or_query_if_file_exists): * fileio.c (vars_of_fileio): * floatfns.c (matherr): * fns.c (print_bit_vector): * fns.c (Fmapconcat): * fns.c (add_suffix_to_symbol): * fns.c (add_prefix_to_symbol): * frame-gtk.c: * frame-gtk.c (Fgtk_window_id): * frame-x.c (def): * frame-x.c (x_cde_transfer_callback): * frame.c: * frame.c (Fmake_frame): * gc.c (show_gc_cursor_and_message): * gc.c (vars_of_gc): * glyphs-eimage.c (png_instantiate): * glyphs-eimage.c (tiff_instantiate): * glyphs-gtk.c (gtk_print_image_instance): * glyphs-msw.c (mswindows_print_image_instance): * glyphs-x.c (x_print_image_instance): * glyphs-x.c (update_widget_face): * glyphs.c (make_string_from_file): * glyphs.c (print_image_instance): * glyphs.c (signal_image_error): * glyphs.c (signal_image_error_2): * glyphs.c (signal_double_image_error): * glyphs.c (signal_double_image_error_2): * glyphs.c (xbm_mask_file_munging): * glyphs.c (pixmap_to_lisp_data): * glyphs.h: * gui.c (gui_item_display_flush_left): * hpplay.c (player_error_internal): * hpplay.c (myHandler): * intl-win32.c: * intl-win32.c (langcode_to_lang): * intl-win32.c (sublangcode_to_lang): * intl-win32.c (Fmswindows_get_locale_info): * intl-win32.c (lcid_to_locale_mule_or_no): * intl-win32.c (mswindows_multibyte_to_unicode_print): * intl-win32.c (complex_vars_of_intl_win32): * keymap.c: * keymap.c (print_keymap): * keymap.c (ensure_meta_prefix_char_keymapp): * keymap.c (Fkey_description): * keymap.c (Ftext_char_description): * lisp.h: * lisp.h (struct): * lisp.h (DECLARE_INLINE_HEADER): * lread.c (Fload_internal): * lread.c (locate_file): * lread.c (read_escape): * lread.c (read_raw_string): * lread.c (read1): * lread.c (read_list): * lread.c (read_compiled_function): * lread.c (init_lread): * lrecord.h: * marker.c (print_marker): * marker.c (marker_equal): * menubar-msw.c (displayable_menu_item): * menubar-x.c (command_builder_operate_menu_accelerator): * menubar.c (vars_of_menubar): * minibuf.c (reinit_complex_vars_of_minibuf): * minibuf.c (complex_vars_of_minibuf): * mule-charset.c (Fmake_charset): * mule-charset.c (complex_vars_of_mule_charset): * mule-coding.c (iso2022_print): * mule-coding.c (fixed_width_query): * number.c (bignum_print): * number.c (ratio_print): * number.c (bigfloat_print): * number.c (bigfloat_finalize): * objects-msw.c: * objects-msw.c (mswindows_color_to_string): * objects-msw.c (mswindows_color_list): * objects-tty.c: * objects-tty.c (tty_font_list): * objects-tty.c (tty_find_charset_font): * objects-xlike-inc.c (xft_find_charset_font): * objects-xlike-inc.c (endif): * print.c: * print.c (write_istring): * print.c (write_ascstring): * print.c (Fterpri): * print.c (Fprint): * print.c (print_error_message): * print.c (print_vector_internal): * print.c (print_cons): * print.c (print_string): * print.c (printing_unreadable_object): * print.c (print_internal): * print.c (print_float): * print.c (print_symbol): * process-nt.c (mswindows_report_winsock_error): * process-nt.c (nt_canonicalize_host_name): * process-unix.c (unix_canonicalize_host_name): * process.c (print_process): * process.c (report_process_error): * process.c (report_network_error): * process.c (make_process_internal): * process.c (Fstart_process_internal): * process.c (status_message): * process.c (putenv_internal): * process.c (vars_of_process): * process.h: * profile.c (vars_of_profile): * rangetab.c (print_range_table): * realpath.c (vars_of_realpath): * redisplay.c (vars_of_redisplay): * search.c (wordify): * search.c (Freplace_match): * sheap.c (sheap_adjust_h): * sound.c (report_sound_error): * sound.c (Fplay_sound_file): * specifier.c (print_specifier): * symbols.c (Fsubr_name): * symbols.c (do_symval_forwarding): * symbols.c (set_default_buffer_slot_variable): * symbols.c (set_default_console_slot_variable): * symbols.c (store_symval_forwarding): * symbols.c (default_value): * symbols.c (defsymbol_massage_name_1): * symbols.c (defsymbol_massage_name_nodump): * symbols.c (defsymbol_massage_name): * symbols.c (defsymbol_massage_multiword_predicate_nodump): * symbols.c (defsymbol_massage_multiword_predicate): * symbols.c (defsymbol_nodump): * symbols.c (defsymbol): * symbols.c (defkeyword): * symbols.c (defkeyword_massage_name): * symbols.c (check_module_subr): * symbols.c (deferror_1): * symbols.c (deferror): * symbols.c (deferror_massage_name): * symbols.c (deferror_massage_name_and_message): * symbols.c (defvar_magic): * symeval.h: * symeval.h (DEFVAR_SYMVAL_FWD): * sysdep.c: * sysdep.c (init_system_name): * sysdll.c: * sysdll.c (MAYBE_PREPEND_UNDERSCORE): * sysdll.c (dll_function): * sysdll.c (dll_variable): * sysdll.c (dll_error): * sysdll.c (dll_open): * sysdll.c (dll_close): * sysdll.c (image_for_address): * sysdll.c (my_find_image): * sysdll.c (search_linked_libs): * sysdll.h: * sysfile.h: * sysfile.h (DEFAULT_DIRECTORY_FALLBACK): * syswindows.h: * tests.c (DFC_CHECK_LENGTH): * tests.c (DFC_CHECK_CONTENT): * tests.c (Ftest_hash_tables): * text.c (vars_of_text): * text.h: * tooltalk.c (tt_opnum_string): * tooltalk.c (tt_message_arg_ival_string): * tooltalk.c (Ftooltalk_default_procid): * tooltalk.c (Ftooltalk_default_session): * tooltalk.c (init_tooltalk): * tooltalk.c (vars_of_tooltalk): * ui-gtk.c (Fdll_load): * ui-gtk.c (type_to_marshaller_type): * ui-gtk.c (Fgtk_import_function_internal): * ui-gtk.c (emacs_gtk_object_printer): * ui-gtk.c (emacs_gtk_boxed_printer): * unicode.c (unicode_to_ichar): * unicode.c (unicode_print): * unicode.c (unicode_query): * unicode.c (vars_of_unicode): * unicode.c (complex_vars_of_unicode): * win32.c: * win32.c (mswindows_report_process_error): * window.c (print_window): * xemacs.def.in.in: BASIC IDEA: Further fixing up uses of char * and CIbyte * to reflect their actual semantics; Mule-izing some code; redoing of the not-yet-working code to handle message translation. Clean up code to handle message-translation (not yet working). Create separate versions of build_msg_string() for working with Ibyte *, CIbyte *, and Ascbyte * arguments. Assert that Ascbyte * arguments are pure-ASCII. Make build_msg_string() be the same as build_msg_ascstring(). Create same three versions of GETTEXT() and DEFER_GETTEXT(). Also create build_defer_string() and variants for the equivalent of DEFER_GETTEXT() when building a string. Remove old CGETTEXT(). Clean up code where GETTEXT(), DEFER_GETTEXT(), build_msg_string(), etc. was being called and introduce some new calls to build_msg_string(), etc. Remove GETTEXT() from calls to weird_doc() -- we assume that the message snarfer knows about weird_doc(). Remove uses of DEFER_GETTEXT() from error messages in sysdep.c and instead use special comments /* @@@begin-snarf@@@ */ and /* @@@end-snarf@@@ */ that the message snarfer presumably knows about. Create build_ascstring() and use it in many instances in place of build_string(). The purpose of having Ascbyte * variants is to make the code more self-documenting in terms of what sort of semantics is expected for char * strings. In fact in the process of looking for uses of build_string(), much improperly Mule-ized was discovered. Mule-ize a lot of code as described in previous paragraph, e.g. in sysdep.c. Make the error functions take Ascbyte * strings and fix up a couple of places where non-pure-ASCII strings were being passed in (file-coding.c, mule-coding.c, unicode.c). (It's debatable whether we really need to make the error functions work this way. It helps catch places where code is written in a way that message translation won't work, but we may well never implement message translation.) Make staticpro() and friends take Ascbyte * strings instead of raw char * strings. Create a const_Ascbyte_ptr dynarr type to describe what's held by staticpro_names[] and friends, create pdump descriptions for const_Ascbyte_ptr dynarrs, and use them in place of specially-crafted staticpro descriptions. Mule-ize certain other functions (e.g. x_event_name) by correcting raw use of char * to Ascbyte *, Rawbyte * or another such type, and raw use of char[] buffers to another type (usually Ascbyte[]). Change many uses of write_c_string() to write_msg_string(), write_ascstring(), etc. Mule-ize emodules.c, emodules.h, sysdll.h. Fix some un-Mule-ized code in intl-win32.c. A comment in event-Xt.c and the limitations of the message snarfer (make-msgfile or whatever) is presumably incorrect -- it should be smart enough to handle function calls spread over more than one line. Clean up code in event-Xt.c that was written awkwardly for this reason. In config.h.in, instead of NEED_ERROR_CHECK_TYPES_INLINES, create a more general XEMACS_DEFS_NEEDS_INLINE_DECLS to indicate when inlined functions need to be declared in xemacs.defs.in.in, and make use of it in xemacs.defs.in.in. We need to do this because postgresql.c now calls qxestrdup(), which is an inline function. Make nconc2() and other such functions MODULE_API and put them in xemacs.defs.in.in since postgresql.c now uses them. Clean up indentation in lread.c and a few other places. In text.h, document ASSERT_ASCTEXT_ASCII() and ASSERT_ASCTEXT_ASCII_LEN(), group together the stand-in encodings and add some more for DLL symbols, function and variable names, etc.
author Ben Wing <ben@xemacs.org>
date Tue, 26 Jan 2010 23:22:30 -0600
parents 5ab6dc5d789e
children 4aebb0131297
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1995 Free Software Foundation, Inc.
2421
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
3 Copyright (C) 2000, 2001, 2002, 2004 Ben Wing.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 /* Synched up with: Not really in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
24 #ifndef INCLUDED_sysfile_h_
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
25 #define INCLUDED_sysfile_h_
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
26
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
27 /* The anonymous voice of the past says:
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
28 Must come before sysfile.h
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
29
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
30 So instead we just put it here. --ben */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
31 #ifdef HAVE_LIBGEN_H
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
32 #include <libgen.h>
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
33 #endif
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
34
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 #include <errno.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
37 #ifndef WIN32_NATIVE
573
6cca1c9bdc85 [xemacs-hg @ 2001-05-25 03:49:08 by martinb]
martinb
parents: 558
diff changeset
38 # include <sys/errno.h> /* <errno.h> does not always imply this */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40
4863
5ab6dc5d789e Fix EOVERFLOW breakage under Visual Studio 6
Vin Shelton <acs@xemacs.org>
parents: 4854
diff changeset
41 /* EOVERFLOW isn't defined on native Windows under VC6 */
5ab6dc5d789e Fix EOVERFLOW breakage under Visual Studio 6
Vin Shelton <acs@xemacs.org>
parents: 4854
diff changeset
42 #ifndef EOVERFLOW
5ab6dc5d789e Fix EOVERFLOW breakage under Visual Studio 6
Vin Shelton <acs@xemacs.org>
parents: 4854
diff changeset
43 # define EOVERFLOW 10139
5ab6dc5d789e Fix EOVERFLOW breakage under Visual Studio 6
Vin Shelton <acs@xemacs.org>
parents: 4854
diff changeset
44 #endif
5ab6dc5d789e Fix EOVERFLOW breakage under Visual Studio 6
Vin Shelton <acs@xemacs.org>
parents: 4854
diff changeset
45
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 #ifdef HAVE_UNISTD_H
558
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
47 # include <unistd.h>
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 #ifndef INCLUDED_FCNTL
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 # define INCLUDED_FCNTL
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 # include <fcntl.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 #endif /* INCLUDED_FCNTL */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54
558
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
55 /* The anonymous voice of the past says:
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 In some systems loading it twice is suicidal. */
558
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
57 #ifndef INCLUDED_SYS_TYPES
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
58 # define INCLUDED_SYS_TYPES
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
59 # include <sys/types.h> /* some typedefs are used in sys/file.h */
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
60 #endif /* INCLUDED_SYS_TYPES */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
61
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
62 #ifndef WIN32_NATIVE
558
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
63 # include <sys/file.h>
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
64 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
65
1467
e5da225ea2ca [xemacs-hg @ 2003-05-09 09:50:40 by stephent]
stephent
parents: 1315
diff changeset
66 /* Some systems (SCO 3.2v5) do #define stat ... in this header. So it
e5da225ea2ca [xemacs-hg @ 2003-05-09 09:50:40 by stephent]
stephent
parents: 1315
diff changeset
67 _must_ be included before any use of struct stat. Most emacs files
e5da225ea2ca [xemacs-hg @ 2003-05-09 09:50:40 by stephent]
stephent
parents: 1315
diff changeset
68 should include sysfile.h. The unex*.c include <sys/stat.h> directly. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 #include <sys/stat.h>
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
70
1315
70921960b980 [xemacs-hg @ 2003-02-20 08:19:28 by ben]
ben
parents: 867
diff changeset
71 #ifdef WIN32_ANY
558
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
72 # include <io.h>
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
73 #endif
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
74
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
75 #ifdef WIN32_NATIVE
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
76 # include <direct.h>
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
77 #else
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
78 /* Some configuration files' definitions for the LOAD_AVE_CVT macro
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
79 (like sparc.h's) use macros like FSCALE, defined here. */
558
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
80 # ifdef HAVE_GTK
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 448
diff changeset
81 /* I hate GTK */
558
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
82 # undef MIN
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
83 # undef MAX
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
84 # endif /* HAVE_GTK */
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
85 # include <sys/param.h>
609
13e3d7ae7155 [xemacs-hg @ 2001-06-06 12:34:42 by ben]
ben
parents: 573
diff changeset
86 /* As per Martin's recommendation, we do not include this. There was
13e3d7ae7155 [xemacs-hg @ 2001-06-06 12:34:42 by ben]
ben
parents: 573
diff changeset
87 a comment stating that stuff from here was needed on NeXT, Cygwin,
13e3d7ae7155 [xemacs-hg @ 2001-06-06 12:34:42 by ben]
ben
parents: 573
diff changeset
88 and sunplay.c. However, Cygwin includes this automatically from
13e3d7ae7155 [xemacs-hg @ 2001-06-06 12:34:42 by ben]
ben
parents: 573
diff changeset
89 fcntl.h, and Martin says that a "conforming" system should never
13e3d7ae7155 [xemacs-hg @ 2001-06-06 12:34:42 by ben]
ben
parents: 573
diff changeset
90 need this. We will put it back if necessary on systems requiring it. */
13e3d7ae7155 [xemacs-hg @ 2001-06-06 12:34:42 by ben]
ben
parents: 573
diff changeset
91 /* # include <sys/fcntl.h> */
777
e65d9cf16707 [xemacs-hg @ 2002-03-15 11:00:28 by ben]
ben
parents: 771
diff changeset
92 #endif /* WIN32_NATIVE */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93
4854
95c4ced5c07c fix compile problems
Ben Wing <ben@xemacs.org>
parents: 4834
diff changeset
94 /* Needed for C_STRING_TO_TSTR, MAX_XETCHAR_SIZE below; but syswindows.h
95c4ced5c07c fix compile problems
Ben Wing <ben@xemacs.org>
parents: 4834
diff changeset
95 depends on lisp.h being previously included. */
95c4ced5c07c fix compile problems
Ben Wing <ben@xemacs.org>
parents: 4834
diff changeset
96 #if defined (WIN32_ANY) && defined (emacs)
95c4ced5c07c fix compile problems
Ben Wing <ben@xemacs.org>
parents: 4834
diff changeset
97 # include "syswindows.h"
95c4ced5c07c fix compile problems
Ben Wing <ben@xemacs.org>
parents: 4834
diff changeset
98 #endif
95c4ced5c07c fix compile problems
Ben Wing <ben@xemacs.org>
parents: 4834
diff changeset
99
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 #ifndef STDERR_FILENO
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 #define STDIN_FILENO 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 #define STDOUT_FILENO 1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 #define STDERR_FILENO 2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 #ifndef O_RDONLY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 #define O_RDONLY 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 #ifndef O_WRONLY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 #define O_WRONLY 1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 #ifndef O_RDWR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 #define O_RDWR 2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 /* file opening defaults */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 #ifndef OPEN_BINARY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 #ifdef O_BINARY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 #define OPEN_BINARY O_BINARY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 #define OPEN_BINARY (0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 #ifndef OPEN_TEXT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 #ifdef O_TEXT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 #define OPEN_TEXT O_TEXT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 #define OPEN_TEXT (0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 #ifndef CREAT_MODE
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
136 #ifdef WIN32_NATIVE
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 #define CREAT_MODE (S_IREAD | S_IWRITE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 #define CREAT_MODE (0666)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 #ifndef READ_TEXT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 #ifdef O_TEXT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 #define READ_TEXT "rt"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 #define READ_TEXT "r"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 #ifndef READ_BINARY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 #ifdef O_BINARY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 #define READ_BINARY "rb"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 #define READ_BINARY "r"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
159 #ifndef READ_PLUS_TEXT
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
160 #ifdef O_TEXT
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
161 #define READ_PLUS_TEXT "r+t"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
162 #else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
163 #define READ_PLUS_TEXT "r+"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
164 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
165 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
166
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
167 #ifndef READ_PLUS_BINARY
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
168 #ifdef O_BINARY
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
169 #define READ_PLUS_BINARY "r+b"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
170 #else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
171 #define READ_PLUS_BINARY "r+"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
172 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
173 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
174
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
175 #ifndef WRITE_TEXT
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
176 #ifdef O_TEXT
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
177 #define WRITE_TEXT "wt"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
178 #else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
179 #define WRITE_TEXT "w"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
180 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
181 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
182
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 #ifndef WRITE_BINARY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 #ifdef O_BINARY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 #define WRITE_BINARY "wb"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 #define WRITE_BINARY "w"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
191 #ifndef APPEND_TEXT
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
192 #ifdef O_TEXT
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
193 #define APPEND_TEXT "at"
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
194 #else
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
195 #define APPEND_TEXT "a"
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
196 #endif
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
197 #endif
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
198
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
199 #ifndef APPEND_BINARY
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
200 #ifdef O_BINARY
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
201 #define APPEND_BINARY "ab"
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
202 #else
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
203 #define APPEND_BINARY "a"
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
204 #endif
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
205 #endif
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
206
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 #ifndef O_NONBLOCK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 #ifdef O_NDELAY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 #define O_NONBLOCK O_NDELAY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 #define O_NONBLOCK 04000
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 #if !S_IRUSR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 # if S_IREAD
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 # define S_IRUSR S_IREAD
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 # else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 # define S_IRUSR 00400
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 # endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 #if !S_IWUSR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 # if S_IWRITE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 # define S_IWUSR S_IWRITE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 # else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 # define S_IWUSR 00200
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 # endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 #if !S_IXUSR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 # if S_IEXEC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 # define S_IXUSR S_IEXEC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 # else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 # define S_IXUSR 00100
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 # endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 #ifdef STAT_MACROS_BROKEN
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 #undef S_ISBLK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 #undef S_ISCHR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 #undef S_ISDIR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 #undef S_ISFIFO
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 #undef S_ISLNK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 #undef S_ISMPB
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 #undef S_ISMPC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 #undef S_ISNWK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 #undef S_ISREG
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 #undef S_ISSOCK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 #endif /* STAT_MACROS_BROKEN. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251
2526
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
252 #ifdef WIN32_NATIVE
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
253 /* This is the standard value for S_IFLNK. All of the S_... flags that
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
254 exist in the MSVCRT have standard values, so their bit tests will
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
255 magically work. */
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
256 #define S_IFLNK 0120000
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
257 #endif
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
258
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 #if !defined(S_ISBLK) && defined(S_IFBLK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 #if !defined(S_ISCHR) && defined(S_IFCHR)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 #if !defined(S_ISDIR) && defined(S_IFDIR)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 #if !defined(S_ISREG) && defined(S_IFREG)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 #if !defined(S_ISFIFO) && defined(S_IFIFO)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 #if !defined(S_ISLNK) && defined(S_IFLNK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 #if !defined(S_ISSOCK) && defined(S_IFSOCK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 #if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 #define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 #define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 #if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 #define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287
2421
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
288 /* Determining the maximum pathname length.
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
289
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
290 NOTE: IN GENERAL, YOU SHOULD NOT USE THIS.
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
291 If at all possible, avoid using fixed-length buffers of any sort.
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
292 You cannot guarantee on many systems that pathnames won't exceed
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
293 these limits for one reason or another.
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
294
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
295 Unfortunately, there is no universal agreement over whether these
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
296 values should include a final null-terminator or not. Even recent
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
297 versions of Linux (circa 2002) are switching from the not-including-
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
298 terminator kind to the including-terminator kind. So we assume that
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
299 the including-terminator kind will be even (usually is), and round
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
300 up as necessary. */
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
301
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
302 #define ROUND_UP_TO_EVEN_NUMBER(val) (((val + 1) >> 1) << 1)
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
303 #ifdef PATH_MAX
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
304 # define QXE_PATH_MAX ROUND_UP_TO_EVEN_NUMBER (PATH_MAX)
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
305 #elif defined (_MAX_PATH)
558
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
306 /* MS Win -- and preferable to _POSIX_PATH_MAX, which is also defined */
2421
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
307 # define QXE_PATH_MAX ROUND_UP_TO_EVEN_NUMBER (_MAX_PATH)
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
308 #elif defined (_POSIX_PATH_MAX)
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
309 # define QXE_PATH_MAX ROUND_UP_TO_EVEN_NUMBER (_POSIX_PATH_MAX)
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
310 #elif defined (MAXPATHLEN)
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
311 # define QXE_PATH_MAX ROUND_UP_TO_EVEN_NUMBER (MAXPATHLEN)
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
312 #else
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
313 # define QXE_PATH_MAX 1024
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
314 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
315
4854
95c4ced5c07c fix compile problems
Ben Wing <ben@xemacs.org>
parents: 4834
diff changeset
316 /* Client .c files should use PATH_MAX_INTERNAL or PATH_MAX_TCHAR
2421
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
317 if they must use either one at all. */
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
318
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
319 /* Use for internally formatted text, which can potentially have up to
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
320 four bytes per character */
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
321 #define PATH_MAX_INTERNAL (QXE_PATH_MAX * MAX_ICHAR_LEN)
4854
95c4ced5c07c fix compile problems
Ben Wing <ben@xemacs.org>
parents: 4834
diff changeset
322 #ifdef WIN32_ANY
95c4ced5c07c fix compile problems
Ben Wing <ben@xemacs.org>
parents: 4834
diff changeset
323 /* Use for externally formatted text in TCHAR's. */
95c4ced5c07c fix compile problems
Ben Wing <ben@xemacs.org>
parents: 4834
diff changeset
324 #define PATH_MAX_TCHAR (QXE_PATH_MAX * MAX_XETCHAR_SIZE)
95c4ced5c07c fix compile problems
Ben Wing <ben@xemacs.org>
parents: 4834
diff changeset
325 #endif
2421
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
326
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
327 /* The following definitions are needed under Windows, at least */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
328 #ifndef X_OK
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
329 # define X_OK 1
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
330 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
332 #ifndef R_OK
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
333 # define R_OK 4
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
334 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
335
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
336 #ifndef D_OK
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
337 # define D_OK 8
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
338 #endif
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
339
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
340 #ifndef W_OK
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
341 # define W_OK 2
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
342 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
343
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
344 #ifndef F_OK
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
345 # define F_OK 0
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 #ifndef FD_CLOEXEC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 # define FD_CLOEXEC 1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
352 #ifdef emacs
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
353
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 /* Emacs needs to use its own definitions of certain system calls on
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 some systems (like SunOS 4.1 and USG systems, where the read system
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 call is interruptible but Emacs expects it not to be; and under
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 MULE, where all filenames need to be converted to external format).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
359 We used to play preprocessor games, but in the long run that just leads
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
360 you to ruin. So we explicitly put in the new calls, even if the source
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
361 gets marginally less pretty.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
363 Current files where we don't use retry_ or qxe_ versions:
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
365 -- all sound files except ntplay.c (includes esd.c libsst.[ch] libst.h
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
366 linuxplay.c sgiplay.c sunplay.c
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
367 hpplay.c nas.c)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
368 -- all unex* files
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
369 -- lib-src files
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
370 */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
372 ssize_t retry_read (int, void *, size_t);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
373 ssize_t retry_write (int, const void *, size_t);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
374 int retry_open (const Extbyte *path, int oflag, ...);
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
375 int qxe_open (const Ibyte *path, int oflag, ...);
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
376 int qxe_interruptible_open (const Ibyte *path, int oflag, int mode);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
377 int retry_close (int);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
378 Bytecount read_allowing_quit (int fildes, void *buf, Bytecount size);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
379 Bytecount write_allowing_quit (int fildes, const void *buf,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
380 Bytecount size);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 /* Now the stdio versions ... */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
384 size_t retry_fread (void *, size_t, size_t, FILE *);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
385 size_t retry_fwrite (const void *, size_t, size_t, FILE *);
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1467
diff changeset
386 FILE *retry_fopen (const Extbyte *path, const Ascbyte *mode);
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1467
diff changeset
387 FILE *qxe_fopen (const Ibyte *path, const Ascbyte *mode);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
388 int retry_fclose (FILE *);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 /* encapsulations: file-information calls */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
392 int qxe_access (const Ibyte *path, int mode);
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
393 int qxe_eaccess (const Ibyte *path, int mode);
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
394 int qxe_lstat (const Ibyte *path, struct stat *buf);
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
395 int qxe_readlink (const Ibyte *path, Ibyte *buf, size_t bufsiz);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
396 int qxe_fstat (int fd, struct stat *buf);
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
397 int qxe_stat (const Ibyte *path, struct stat *buf);
2526
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
398 Ibyte *qxe_realpath (const Ibyte *path, Ibyte resolved_path [],
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
399 Boolint links_only);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 /* encapsulations: file-manipulation calls */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
403 int qxe_chmod (const Ibyte *path, mode_t mode);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
404
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
405 #if defined (HAVE_LINK)
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2526
diff changeset
406 int qxe_link (const Ibyte *existing, const Ibyte *new_);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
407 #endif /* defined (HAVE_LINK) */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
408
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2526
diff changeset
409 int qxe_rename (const Ibyte *old, const Ibyte *new_);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
410
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
411 #if defined (HAVE_SYMLINK)
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
412 int qxe_symlink (const Ibyte *name1, const Ibyte *name2);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
413 #endif /* defined (HAVE_SYMLINK) */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
414
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
415 int qxe_unlink (const Ibyte *path);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
416
1467
e5da225ea2ca [xemacs-hg @ 2003-05-09 09:50:40 by stephent]
stephent
parents: 1315
diff changeset
417 /* definition in filemode.c
e5da225ea2ca [xemacs-hg @ 2003-05-09 09:50:40 by stephent]
stephent
parents: 1315
diff changeset
418 must be declared here to ensure that struct stat is properly formed
e5da225ea2ca [xemacs-hg @ 2003-05-09 09:50:40 by stephent]
stephent
parents: 1315
diff changeset
419 on systems like SCO 3.2v5 */
e5da225ea2ca [xemacs-hg @ 2003-05-09 09:50:40 by stephent]
stephent
parents: 1315
diff changeset
420 void filemodestring (struct stat *, char *);
e5da225ea2ca [xemacs-hg @ 2003-05-09 09:50:40 by stephent]
stephent
parents: 1315
diff changeset
421
2526
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
422 #ifdef WIN32_ANY
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
423 extern int mswindows_shortcuts_are_symlinks;
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
424 #endif
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
425
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
426 #endif /* emacs */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
427
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
428
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
429 #ifndef HAVE_H_ERRNO
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
430 extern int h_errno;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
433 #ifndef HAVE_DUP2
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
434 int dup2 (int oldd, int newd);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
437 #ifndef HAVE_STRERROR
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
438 /* X11R6 defines strerror as a macro */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
439 # ifdef strerror
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
440 # undef strerror
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
441 # endif
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
442 const char *strerror (int);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
445
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
446
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
447 /*
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
448 DEFAULT_DIRECTORY_SEP is the default value of Vdirectory_sep_char.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
449 DIRECTORY_SEP is the currently preferred separator between elements
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
450 of a path, when paths are canonicalized.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
451 DEVICE_SEP is the separator between devices and paths (might not
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
452 be defined).
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
453 SEPCHAR is the separator between paths in a path search string
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
454 (e.g. the PATH environment variable).
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
455 IS_DIRECTORY_SEP() returns true if the character is any directory
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
456 separator (there might be more than one allowed on a system.).
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
457 IS_DEVICE_SEP() returns true if the character is a device separator.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
458 IS_ANY_SEP() returns true if the character is a directory or device
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
459 separator.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
460 */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
461
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
462 /* We used to put some of this stuff in the s+m files for the various
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
463 types of MS Windows, but that's disingenuous. The various definitions
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
464 above were specifically created for MS Windows, and the "if not, then
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
465 let's define the defaults" stuff (formerly in lisp.h) specifically knows
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
466 about what is going to get redefined and how, and code all over the
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
467 place that works with filenames has to conditionalize on WIN32_NATIVE
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
468 anyway. It's much clearer if we put all related definitions in one
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
469 place. (In fact, I discovered a number of bugs in the process.)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
470
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
471 S+M files should be used for simple on-off or multiple-choice settings,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
472 or possibly string settings. Anything that gets to the level of
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
473 programming should be elsewhere, and anything that ends up having
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
474 lots of complicated interactions scattered around in many files should
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
475 be consolidated. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
476
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
477 #ifdef WIN32_NATIVE
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
478
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
479 #define SEPCHAR ';'
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
480 #define DEFAULT_DIRECTORY_SEP '\\'
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481
3379
b544987e2eca [xemacs-hg @ 2006-05-06 08:09:35 by aidan]
aidan
parents: 3368
diff changeset
482 #ifdef emacs
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
483 DECLARE_INLINE_HEADER (Ibyte sysfile_get_directory_sep (void))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
484 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
485 if (!CHARP (Vdirectory_sep_char)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
486 || (XCHAR (Vdirectory_sep_char) != '/'
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
487 && XCHAR (Vdirectory_sep_char) != '\\'))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
488 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
489 warn_when_safe
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
490 (Qfile_name, Qerror,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
491 "`directory-sep-char' set to invalid %s: resetting to %c.",
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
492 DEFAULT_DIRECTORY_SEP);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
493 Vdirectory_sep_char = make_char (DEFAULT_DIRECTORY_SEP);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
494 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
495
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
496 return XCHAR (Vdirectory_sep_char);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
497 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
498 #define DIRECTORY_SEP sysfile_get_directory_sep()
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
499
4952
19a72041c5ed Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents: 4863
diff changeset
500 #define DEFAULT_DIRECTORY_FALLBACK "C:\\"
4736
d261888e5069 Fix Win32 native build after my DEFAULT_DIRECTORY_FALLBACK change, thanks Vin!
Aidan Kehoe <kehoea@parhasard.net>
parents: 4733
diff changeset
501
d261888e5069 Fix Win32 native build after my DEFAULT_DIRECTORY_FALLBACK change, thanks Vin!
Aidan Kehoe <kehoea@parhasard.net>
parents: 4733
diff changeset
502 #else /* not emacs */
3379
b544987e2eca [xemacs-hg @ 2006-05-06 08:09:35 by aidan]
aidan
parents: 3368
diff changeset
503
b544987e2eca [xemacs-hg @ 2006-05-06 08:09:35 by aidan]
aidan
parents: 3368
diff changeset
504 /* The above Lisp variables are not available to make-docfile, etc. */
b544987e2eca [xemacs-hg @ 2006-05-06 08:09:35 by aidan]
aidan
parents: 3368
diff changeset
505 #define DIRECTORY_SEP DEFAULT_DIRECTORY_SEP
b544987e2eca [xemacs-hg @ 2006-05-06 08:09:35 by aidan]
aidan
parents: 3368
diff changeset
506
b544987e2eca [xemacs-hg @ 2006-05-06 08:09:35 by aidan]
aidan
parents: 3368
diff changeset
507 #endif /* emacs */
b544987e2eca [xemacs-hg @ 2006-05-06 08:09:35 by aidan]
aidan
parents: 3368
diff changeset
508
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
509 #else /* not WIN32_NATIVE */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
510
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
511 #define SEPCHAR ':'
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
512 #define DEFAULT_DIRECTORY_SEP '/'
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
513 #define DIRECTORY_SEP '/'
4952
19a72041c5ed Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents: 4863
diff changeset
514 #define DEFAULT_DIRECTORY_FALLBACK "/"
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
515
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
516 #endif /* WIN32_NATIVE */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
517
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518
1315
70921960b980 [xemacs-hg @ 2003-02-20 08:19:28 by ben]
ben
parents: 867
diff changeset
519 #ifdef WIN32_ANY
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
520
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
521 #define DEVICE_SEP ':'
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
522
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
523 #define IS_DEVICE_SEP(c) ((c) == DEVICE_SEP)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
524
3379
b544987e2eca [xemacs-hg @ 2006-05-06 08:09:35 by aidan]
aidan
parents: 3368
diff changeset
525 #ifdef emacs
b544987e2eca [xemacs-hg @ 2006-05-06 08:09:35 by aidan]
aidan
parents: 3368
diff changeset
526
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
527 DECLARE_INLINE_HEADER (int IS_DIRECTORY_SEP (Ichar c))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
528 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
529 return (c == '/' || c == '\\');
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
530 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
531
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
532 DECLARE_INLINE_HEADER (int IS_ANY_SEP (Ichar c))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
533 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
534 return (c == '/' || c == '\\' || c == ':');
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
535 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
536
3379
b544987e2eca [xemacs-hg @ 2006-05-06 08:09:35 by aidan]
aidan
parents: 3368
diff changeset
537 #else /* emacs */
b544987e2eca [xemacs-hg @ 2006-05-06 08:09:35 by aidan]
aidan
parents: 3368
diff changeset
538
b544987e2eca [xemacs-hg @ 2006-05-06 08:09:35 by aidan]
aidan
parents: 3368
diff changeset
539 /* The Ichar typedef is not available to make-docfile, etc. */
b544987e2eca [xemacs-hg @ 2006-05-06 08:09:35 by aidan]
aidan
parents: 3368
diff changeset
540
b544987e2eca [xemacs-hg @ 2006-05-06 08:09:35 by aidan]
aidan
parents: 3368
diff changeset
541 DECLARE_INLINE_HEADER (int IS_DIRECTORY_SEP (int c))
b544987e2eca [xemacs-hg @ 2006-05-06 08:09:35 by aidan]
aidan
parents: 3368
diff changeset
542 {
b544987e2eca [xemacs-hg @ 2006-05-06 08:09:35 by aidan]
aidan
parents: 3368
diff changeset
543 return (c == '/' || c == '\\');
b544987e2eca [xemacs-hg @ 2006-05-06 08:09:35 by aidan]
aidan
parents: 3368
diff changeset
544 }
b544987e2eca [xemacs-hg @ 2006-05-06 08:09:35 by aidan]
aidan
parents: 3368
diff changeset
545
b544987e2eca [xemacs-hg @ 2006-05-06 08:09:35 by aidan]
aidan
parents: 3368
diff changeset
546 DECLARE_INLINE_HEADER (int IS_ANY_SEP (int c))
b544987e2eca [xemacs-hg @ 2006-05-06 08:09:35 by aidan]
aidan
parents: 3368
diff changeset
547 {
b544987e2eca [xemacs-hg @ 2006-05-06 08:09:35 by aidan]
aidan
parents: 3368
diff changeset
548 return (c == '/' || c == '\\' || c == ':');
b544987e2eca [xemacs-hg @ 2006-05-06 08:09:35 by aidan]
aidan
parents: 3368
diff changeset
549 }
b544987e2eca [xemacs-hg @ 2006-05-06 08:09:35 by aidan]
aidan
parents: 3368
diff changeset
550
b544987e2eca [xemacs-hg @ 2006-05-06 08:09:35 by aidan]
aidan
parents: 3368
diff changeset
551 #endif
b544987e2eca [xemacs-hg @ 2006-05-06 08:09:35 by aidan]
aidan
parents: 3368
diff changeset
552
1315
70921960b980 [xemacs-hg @ 2003-02-20 08:19:28 by ben]
ben
parents: 867
diff changeset
553 #else /* not WIN32_ANY */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
554
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
555 #define IS_DEVICE_SEP(c) 0
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
556 #define IS_DIRECTORY_SEP(c) ((c) == DIRECTORY_SEP)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
557 #define IS_ANY_SEP(c) IS_DIRECTORY_SEP (c)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
558
1315
70921960b980 [xemacs-hg @ 2003-02-20 08:19:28 by ben]
ben
parents: 867
diff changeset
559 #endif /* WIN32_ANY */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
560
3368
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 3025
diff changeset
561 /* How long can a source filename be in DOC (including "\037S" at the start
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 3025
diff changeset
562 and "\n" at the end) ? */
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 3025
diff changeset
563 #define DOC_MAX_FILENAME_LENGTH 2048
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 3025
diff changeset
564
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 3025
diff changeset
565 #ifdef emacs
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 3025
diff changeset
566
2526
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
567 #if defined (WIN32_NATIVE)
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
568 #define PATHNAME_RESOLVE_LINKS(path, pathout) \
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
569 do \
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
570 { \
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
571 if (mswindows_shortcuts_are_symlinks) \
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
572 { \
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
573 Ibyte *_prl_path_ = (Ibyte *) (path); \
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
574 Ibyte _prl_path2_[PATH_MAX_INTERNAL]; \
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
575 \
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
576 if (!qxe_realpath (_prl_path_, _prl_path2_, 1)) \
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
577 (pathout) = _prl_path_; \
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
578 else \
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
579 IBYTE_STRING_TO_ALLOCA (_prl_path2_, pathout); \
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
580 } \
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
581 else (pathout) = (Ibyte *) (path); \
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
582 } while (0)
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
583 #else
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
584 #define PATHNAME_RESOLVE_LINKS(path, pathout) ((pathout) = (Ibyte *) (path))
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
585 #endif
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
586
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
587 #define LISP_PATHNAME_RESOLVE_LINKS(path, pathout) \
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
588 PATHNAME_RESOLVE_LINKS (XSTRING_DATA (path), pathout)
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
589
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
590 /* The documentation in VC++ claims that the pathname library functions
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
591 accept strings in the current locale-specific encoding, but that's
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
592 false, because they just call the native Win32 routines directly, which
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
593 always use the system-default encoding (which is what Qmswindows_tstr
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
594 will give us when not XEUNICODE_P). */
4834
b3ea9c582280 Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents: 4759
diff changeset
595 #define PATHNAME_CONVERT_OUT_TSTR(path, pathout) \
b3ea9c582280 Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents: 4759
diff changeset
596 do \
b3ea9c582280 Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents: 4759
diff changeset
597 { \
b3ea9c582280 Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents: 4759
diff changeset
598 const Ibyte *_pco_path_; \
b3ea9c582280 Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents: 4759
diff changeset
599 PATHNAME_RESOLVE_LINKS (path, _pco_path_); \
b3ea9c582280 Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents: 4759
diff changeset
600 C_STRING_TO_TSTR (_pco_path_, pathout); \
b3ea9c582280 Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents: 4759
diff changeset
601 } while (0)
b3ea9c582280 Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents: 4759
diff changeset
602
b3ea9c582280 Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents: 4759
diff changeset
603 #define PATHNAME_CONVERT_OUT_UTF_8(path, pathout) \
b3ea9c582280 Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents: 4759
diff changeset
604 do \
b3ea9c582280 Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents: 4759
diff changeset
605 { \
b3ea9c582280 Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents: 4759
diff changeset
606 const Ibyte *_pco_path_; \
b3ea9c582280 Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents: 4759
diff changeset
607 PATHNAME_RESOLVE_LINKS (path, _pco_path_); \
b3ea9c582280 Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents: 4759
diff changeset
608 C_STRING_TO_EXTERNAL (_pco_path_, pathout, Qutf_8); \
b3ea9c582280 Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents: 4759
diff changeset
609 } while (0)
b3ea9c582280 Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents: 4759
diff changeset
610
2526
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
611 #ifdef WIN32_NATIVE
4834
b3ea9c582280 Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents: 4759
diff changeset
612 #define PATHNAME_CONVERT_OUT(path, pathout) \
b3ea9c582280 Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents: 4759
diff changeset
613 PATHNAME_CONVERT_OUT_TSTR (path, pathout)
2526
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
614 #else
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
615 # define PATHNAME_CONVERT_OUT(path, pathout) \
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
616 C_STRING_TO_EXTERNAL (path, pathout, Qfile_name)
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
617 #endif
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
618
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
619 #define LISP_PATHNAME_CONVERT_OUT(path, pathout) \
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
620 PATHNAME_CONVERT_OUT (XSTRING_DATA (path), pathout)
902d5bd9b75c [xemacs-hg @ 2005-01-28 02:36:11 by ben]
ben
parents: 2421
diff changeset
621
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
622 #endif /* emacs */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
623
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
624 #endif /* INCLUDED_sysfile_h_ */