Mercurial > hg > xemacs-beta
comparison src/sysdep.c @ 70:131b0175ea99 r20-0b30
Import from CVS: tag r20-0b30
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:02:59 +0200 |
parents | 6a22abad6937 |
children | c7528f8e288d |
comparison
equal
deleted
inserted
replaced
69:804d1389bcd6 | 70:131b0175ea99 |
---|---|
36 /* basic includes */ | 36 /* basic includes */ |
37 /* ------------------------------- */ | 37 /* ------------------------------- */ |
38 | 38 |
39 #ifdef HAVE_TTY | 39 #ifdef HAVE_TTY |
40 #include "console-tty.h" | 40 #include "console-tty.h" |
41 #else | |
42 #include "syssignal.h" | |
43 #include "systty.h" | |
44 #endif /* HAVE_TTY */ | 41 #endif /* HAVE_TTY */ |
45 | 42 |
46 #include "console-stream.h" | 43 #include "console-stream.h" |
47 | 44 |
48 #include "buffer.h" | 45 #include "buffer.h" |
451 s.main.c_iflag &= ~IUCLC; /* Disable downcasing on input. */ | 448 s.main.c_iflag &= ~IUCLC; /* Disable downcasing on input. */ |
452 #endif | 449 #endif |
453 #ifdef OLCUC | 450 #ifdef OLCUC |
454 s.main.c_oflag &= ~OLCUC; /* Disable upcasing on output. */ | 451 s.main.c_oflag &= ~OLCUC; /* Disable upcasing on output. */ |
455 #endif | 452 #endif |
456 s.main.c_oflag &= ~TAB3; /* Disable tab expansion */ | |
457 #if defined (CSIZE) && defined (CS8) | 453 #if defined (CSIZE) && defined (CS8) |
458 s.main.c_cflag = (s.main.c_cflag & ~CSIZE) | CS8; /* Don't strip 8th bit */ | 454 s.main.c_cflag = (s.main.c_cflag & ~CSIZE) | CS8; /* Don't strip 8th bit */ |
459 #endif | 455 #endif |
460 #ifdef ISTRIP | 456 #ifdef ISTRIP |
461 s.main.c_iflag &= ~ISTRIP; /* Don't strip 8th bit on input */ | 457 s.main.c_iflag &= ~ISTRIP; /* Don't strip 8th bit on input */ |
580 int pid; | 576 int pid; |
581 struct save_signal saved_handlers[5]; | 577 struct save_signal saved_handlers[5]; |
582 Lisp_Object dir; | 578 Lisp_Object dir; |
583 unsigned char *str = 0; | 579 unsigned char *str = 0; |
584 int len; | 580 int len; |
585 struct gcpro gcpro1; | |
586 | 581 |
587 saved_handlers[0].code = SIGINT; | 582 saved_handlers[0].code = SIGINT; |
588 saved_handlers[1].code = SIGQUIT; | 583 saved_handlers[1].code = SIGQUIT; |
589 saved_handlers[2].code = SIGTERM; | 584 saved_handlers[2].code = SIGTERM; |
590 #ifdef SIGIO | 585 #ifdef SIGIO |
600 if (NILP (Fboundp (Qdefault_directory))) | 595 if (NILP (Fboundp (Qdefault_directory))) |
601 goto xyzzy; | 596 goto xyzzy; |
602 dir = Fsymbol_value (Qdefault_directory); | 597 dir = Fsymbol_value (Qdefault_directory); |
603 if (!STRINGP (dir)) | 598 if (!STRINGP (dir)) |
604 goto xyzzy; | 599 goto xyzzy; |
605 | 600 |
606 GCPRO1 (dir); | 601 dir = expand_and_dir_to_file (Funhandled_file_name_directory (dir), Qnil); |
607 dir = Funhandled_file_name_directory (dir); | |
608 dir = expand_and_dir_to_file (dir, Qnil); | |
609 UNGCPRO; | |
610 str = (unsigned char *) alloca (XSTRING_LENGTH (dir) + 2); | 602 str = (unsigned char *) alloca (XSTRING_LENGTH (dir) + 2); |
611 len = XSTRING_LENGTH (dir); | 603 len = XSTRING_LENGTH (dir); |
612 memcpy (str, XSTRING_DATA (dir), len); | 604 memcpy (str, XSTRING_DATA (dir), len); |
613 /* #### Unix specific */ | 605 /* #### Unix specific */ |
614 if (str[len - 1] != '/') str[len++] = '/'; | 606 if (str[len - 1] != '/') str[len++] = '/'; |
733 /* On a system where suspending is not implemented, | 725 /* On a system where suspending is not implemented, |
734 instead fork a subshell and let it talk directly to the terminal | 726 instead fork a subshell and let it talk directly to the terminal |
735 while we wait. */ | 727 while we wait. */ |
736 sys_subshell (); | 728 sys_subshell (); |
737 | 729 |
738 #endif | |
739 } | |
740 | |
741 /* Suspend a process if possible; give terminal to its superior. */ | |
742 void | |
743 sys_suspend_process (process) | |
744 int process; | |
745 { | |
746 /* I don't doubt that it is possible to suspend processes on | |
747 * VMS machines or thost that use USG_JOBCTRL, | |
748 * but I don't know how to do it, so... | |
749 */ | |
750 #if defined (SIGTSTP) && !defined (MSDOS) | |
751 kill(process, SIGTSTP); | |
752 #endif | 730 #endif |
753 } | 731 } |
754 | 732 |
755 /* Set the logical window size associated with descriptor FD | 733 /* Set the logical window size associated with descriptor FD |
756 to HEIGHT and WIDTH. This is used mainly with ptys. */ | 734 to HEIGHT and WIDTH. This is used mainly with ptys. */ |
3062 /* Apparently setting errno is necessary on some systems? | 3040 /* Apparently setting errno is necessary on some systems? |
3063 Maybe readdir() doesn't always set errno ?! */ | 3041 Maybe readdir() doesn't always set errno ?! */ |
3064 while (!(errno = 0, rtnval = readdir (dirp)) | 3042 while (!(errno = 0, rtnval = readdir (dirp)) |
3065 && (errno == EINTR)) | 3043 && (errno == EINTR)) |
3066 ; | 3044 ; |
3045 #ifndef MULE | |
3067 return rtnval; | 3046 return rtnval; |
3047 #else /* MULE */ | |
3048 if (rtnval == NULL) /* End of directory */ | |
3049 return NULL; | |
3050 { | |
3051 Extcount external_len; | |
3052 int ascii_filename_p = 1; | |
3053 CONST Extbyte * CONST external_name = (CONST Extbyte *) rtnval->d_name; | |
3054 | |
3055 /* Optimize for the common all-ASCII case, computing len en passant */ | |
3056 for (external_len = 0; external_name[external_len] ; external_len++) | |
3057 { | |
3058 if (!BYTE_ASCII_P (external_name[external_len])) | |
3059 ascii_filename_p = 0; | |
3060 } | |
3061 if (ascii_filename_p) | |
3062 return rtnval; | |
3063 | |
3064 { /* Non-ASCII filename */ | |
3065 static bufbyte_dynarr *internal_DIRENTRY; | |
3066 CONST Bufbyte *internal_name; | |
3067 Bytecount internal_len; | |
3068 if (!internal_DIRENTRY) | |
3069 internal_DIRENTRY = Dynarr_new (Bufbyte); | |
3070 else | |
3071 Dynarr_reset (internal_DIRENTRY); | |
3072 | |
3073 Dynarr_add_many (internal_DIRENTRY, (Bufbyte *) rtnval, | |
3074 offsetof (DIRENTRY, d_name)); | |
3075 | |
3076 internal_name = | |
3077 convert_from_external_format (external_name, external_len, | |
3078 &internal_len, FORMAT_FILENAME); | |
3079 | |
3080 Dynarr_add_many (internal_DIRENTRY, internal_name, internal_len); | |
3081 Dynarr_add (internal_DIRENTRY, 0); /* zero-terminate */ | |
3082 return (DIRENTRY *) Dynarr_atp (internal_DIRENTRY, 0); | |
3083 } | |
3084 } | |
3085 #endif /* MULE */ | |
3068 } | 3086 } |
3069 #endif /* ENCAPSULATE_READDIR */ | 3087 #endif /* ENCAPSULATE_READDIR */ |
3070 | 3088 |
3071 | 3089 |
3072 #ifdef ENCAPSULATE_CLOSEDIR | 3090 #ifdef ENCAPSULATE_CLOSEDIR |