comparison src/sysdep.c @ 21514:fa9ff387d260

Fix -Wimplicit warnings.
author Andreas Schwab <schwab@suse.de>
date Tue, 14 Apr 1998 12:25:56 +0000
parents a9a9a13079b4
children fff5e42d7b2a
comparison
equal deleted inserted replaced
21513:984881b316fc 21514:fa9ff387d260
296 #ifdef SIGTSTP 296 #ifdef SIGTSTP
297 297
298 /* Arrange for character C to be read as the next input from 298 /* Arrange for character C to be read as the next input from
299 the terminal. */ 299 the terminal. */
300 300
301 void
301 stuff_char (c) 302 stuff_char (c)
302 char c; 303 char c;
303 { 304 {
304 if (read_socket_hook) 305 if (read_socket_hook)
305 return; 306 return;
375 if (baud_rate == 0) 376 if (baud_rate == 0)
376 baud_rate = 1200; 377 baud_rate = 1200;
377 } 378 }
378 379
379 /*ARGSUSED*/ 380 /*ARGSUSED*/
381 void
380 set_exclusive_use (fd) 382 set_exclusive_use (fd)
381 int fd; 383 int fd;
382 { 384 {
383 #ifdef FIOCLEX 385 #ifdef FIOCLEX
384 ioctl (fd, FIOCLEX, 0); 386 ioctl (fd, FIOCLEX, 0);
1026 1028
1027 /* Split off the foreground process group to Emacs alone. 1029 /* Split off the foreground process group to Emacs alone.
1028 When we are in the foreground, but not started in our own process 1030 When we are in the foreground, but not started in our own process
1029 group, redirect the TTY to point to our own process group. We need 1031 group, redirect the TTY to point to our own process group. We need
1030 to be in our own process group to receive SIGIO properly. */ 1032 to be in our own process group to receive SIGIO properly. */
1033 void
1031 narrow_foreground_group () 1034 narrow_foreground_group ()
1032 { 1035 {
1033 int me = getpid (); 1036 int me = getpid ();
1034 1037
1035 setpgrp (0, inherited_pgroup); 1038 setpgrp (0, inherited_pgroup);
1037 EMACS_SET_TTY_PGRP (input_fd, &me); 1040 EMACS_SET_TTY_PGRP (input_fd, &me);
1038 setpgrp (0, me); 1041 setpgrp (0, me);
1039 } 1042 }
1040 1043
1041 /* Set the tty to our original foreground group. */ 1044 /* Set the tty to our original foreground group. */
1045 void
1042 widen_foreground_group () 1046 widen_foreground_group ()
1043 { 1047 {
1044 if (inherited_pgroup != getpid ()) 1048 if (inherited_pgroup != getpid ())
1045 EMACS_SET_TTY_PGRP (input_fd, &inherited_pgroup); 1049 EMACS_SET_TTY_PGRP (input_fd, &inherited_pgroup);
1046 setpgrp (0, inherited_pgroup); 1050 setpgrp (0, inherited_pgroup);
1593 } 1597 }
1594 1598
1595 /* Return nonzero if safe to use tabs in output. 1599 /* Return nonzero if safe to use tabs in output.
1596 At the time this is called, init_sys_modes has not been done yet. */ 1600 At the time this is called, init_sys_modes has not been done yet. */
1597 1601
1602 int
1598 tabs_safe_p () 1603 tabs_safe_p ()
1599 { 1604 {
1600 struct emacs_tty tty; 1605 struct emacs_tty tty;
1601 1606
1602 EMACS_GET_TTY (input_fd, &tty); 1607 EMACS_GET_TTY (input_fd, &tty);
1846 1851
1847 /* Assigning an input channel is done at the start of Emacs execution. 1852 /* Assigning an input channel is done at the start of Emacs execution.
1848 This is called each time Emacs is resumed, also, but does nothing 1853 This is called each time Emacs is resumed, also, but does nothing
1849 because input_chain is no longer zero. */ 1854 because input_chain is no longer zero. */
1850 1855
1856 void
1851 init_vms_input () 1857 init_vms_input ()
1852 { 1858 {
1853 int status; 1859 int status;
1854 1860
1855 if (input_fd == 0) 1861 if (input_fd == 0)
1860 } 1866 }
1861 } 1867 }
1862 1868
1863 /* Deassigning the input channel is done before exiting. */ 1869 /* Deassigning the input channel is done before exiting. */
1864 1870
1871 void
1865 stop_vms_input () 1872 stop_vms_input ()
1866 { 1873 {
1867 return SYS$DASSGN (input_fd); 1874 return SYS$DASSGN (input_fd);
1868 } 1875 }
1869 1876
1870 short input_buffer; 1877 short input_buffer;
1871 1878
1872 /* Request reading one character into the keyboard buffer. 1879 /* Request reading one character into the keyboard buffer.
1873 This is done as soon as the buffer becomes empty. */ 1880 This is done as soon as the buffer becomes empty. */
1874 1881
1882 void
1875 queue_kbd_input () 1883 queue_kbd_input ()
1876 { 1884 {
1877 int status; 1885 int status;
1878 extern kbd_input_ast (); 1886 extern kbd_input_ast ();
1879 1887
1887 int input_count; 1895 int input_count;
1888 1896
1889 /* Ast routine that is called when keyboard input comes in 1897 /* Ast routine that is called when keyboard input comes in
1890 in accord with the SYS$QIO above. */ 1898 in accord with the SYS$QIO above. */
1891 1899
1900 void
1892 kbd_input_ast () 1901 kbd_input_ast ()
1893 { 1902 {
1894 register int c = -1; 1903 register int c = -1;
1895 int old_errno = errno; 1904 int old_errno = errno;
1896 extern EMACS_TIME *input_available_clear_time; 1905 extern EMACS_TIME *input_available_clear_time;
1934 errno = old_errno; 1943 errno = old_errno;
1935 } 1944 }
1936 1945
1937 /* Wait until there is something in kbd_buffer. */ 1946 /* Wait until there is something in kbd_buffer. */
1938 1947
1948 void
1939 wait_for_kbd_input () 1949 wait_for_kbd_input ()
1940 { 1950 {
1941 extern int have_process_input, process_exited; 1951 extern int have_process_input, process_exited;
1942 1952
1943 /* If already something, avoid doing system calls. */ 1953 /* If already something, avoid doing system calls. */
1980 or when we want to throw away pending input. 1990 or when we want to throw away pending input.
1981 We wait for a positive sign that the AST routine has run 1991 We wait for a positive sign that the AST routine has run
1982 and therefore there is no I/O request queued when we return. 1992 and therefore there is no I/O request queued when we return.
1983 SYS$SETAST is used to avoid a timing error. */ 1993 SYS$SETAST is used to avoid a timing error. */
1984 1994
1995 void
1985 end_kbd_input () 1996 end_kbd_input ()
1986 { 1997 {
1987 #ifdef ASTDEBUG 1998 #ifdef ASTDEBUG
1988 printf ("At end_kbd_input.\n"); 1999 printf ("At end_kbd_input.\n");
1989 fflush (stdout); 2000 fflush (stdout);
2006 waiting_for_ast = 0; 2017 waiting_for_ast = 0;
2007 } 2018 }
2008 2019
2009 /* Wait for either input available or time interval expiry. */ 2020 /* Wait for either input available or time interval expiry. */
2010 2021
2022 void
2011 input_wait_timeout (timeval) 2023 input_wait_timeout (timeval)
2012 int timeval; /* Time to wait, in seconds */ 2024 int timeval; /* Time to wait, in seconds */
2013 { 2025 {
2014 int time [2]; 2026 int time [2];
2015 static int zero = 0; 2027 static int zero = 0;
2562 #define BUFFER_SIZE_FACTOR 16 2574 #define BUFFER_SIZE_FACTOR 16
2563 #else 2575 #else
2564 #define BUFFER_SIZE_FACTOR 1 2576 #define BUFFER_SIZE_FACTOR 1
2565 #endif 2577 #endif
2566 2578
2579 void
2567 read_input_waiting () 2580 read_input_waiting ()
2568 { 2581 {
2569 struct input_event e; 2582 struct input_event e;
2570 int nread, i; 2583 int nread, i;
2571 extern int quit_char; 2584 extern int quit_char;
2655 return; 2668 return;
2656 lmode = LINTRUP | lmode; 2669 lmode = LINTRUP | lmode;
2657 ioctl (fd, TIOCLSET, &lmode); 2670 ioctl (fd, TIOCLSET, &lmode);
2658 } 2671 }
2659 2672
2673 void
2660 reset_sigio () 2674 reset_sigio ()
2661 { 2675 {
2662 if (noninteractive) 2676 if (noninteractive)
2663 return; 2677 return;
2664 lmode = ~LINTRUP & lmode; 2678 lmode = ~LINTRUP & lmode;
2684 /* still inside #ifdef BSD4_1 */ 2698 /* still inside #ifdef BSD4_1 */
2685 #ifdef subprocesses 2699 #ifdef subprocesses
2686 2700
2687 int sigheld; /* Mask of held signals */ 2701 int sigheld; /* Mask of held signals */
2688 2702
2703 void
2689 sigholdx (signum) 2704 sigholdx (signum)
2690 int signum; 2705 int signum;
2691 { 2706 {
2692 sigheld |= sigbit (signum); 2707 sigheld |= sigbit (signum);
2693 sighold (signum); 2708 sighold (signum);
2694 } 2709 }
2695 2710
2711 void
2696 sigisheld (signum) 2712 sigisheld (signum)
2697 int signum; 2713 int signum;
2698 { 2714 {
2699 sigheld |= sigbit (signum); 2715 sigheld |= sigbit (signum);
2700 } 2716 }
2701 2717
2718 void
2702 sigunhold (signum) 2719 sigunhold (signum)
2703 int signum; 2720 int signum;
2704 { 2721 {
2705 sigheld &= ~sigbit (signum); 2722 sigheld &= ~sigbit (signum);
2706 sigrelse (signum); 2723 sigrelse (signum);
2707 } 2724 }
2708 2725
2726 void
2709 sigfree () /* Free all held signals */ 2727 sigfree () /* Free all held signals */
2710 { 2728 {
2711 int i; 2729 int i;
2712 for (i = 0; i < NSIG; i++) 2730 for (i = 0; i < NSIG; i++)
2713 if (sigheld & sigbit (i)) 2731 if (sigheld & sigbit (i))
2714 sigrelse (i); 2732 sigrelse (i);
2715 sigheld = 0; 2733 sigheld = 0;
2716 } 2734 }
2717 2735
2736 int
2718 sigbit (i) 2737 sigbit (i)
2719 { 2738 {
2720 return 1 << (i - 1); 2739 return 1 << (i - 1);
2721 } 2740 }
2722 #endif /* subprocesses */ 2741 #endif /* subprocesses */
2727 2746
2728 #ifdef POSIX_SIGNALS 2747 #ifdef POSIX_SIGNALS
2729 2748
2730 sigset_t empty_mask, full_mask; 2749 sigset_t empty_mask, full_mask;
2731 2750
2751 void
2732 init_signals () 2752 init_signals ()
2733 { 2753 {
2734 sigemptyset (&empty_mask); 2754 sigemptyset (&empty_mask);
2735 sigfillset (&full_mask); 2755 sigfillset (&full_mask);
2736 } 2756 }
3021 3041
3022 #endif /* INTERRUPTIBLE_OPEN */ 3042 #endif /* INTERRUPTIBLE_OPEN */
3023 3043
3024 #ifdef INTERRUPTIBLE_CLOSE 3044 #ifdef INTERRUPTIBLE_CLOSE
3025 3045
3046 int
3026 sys_close (fd) 3047 sys_close (fd)
3027 int fd; 3048 int fd;
3028 { 3049 {
3029 int did_retry = 0; 3050 int did_retry = 0;
3030 register int rtnval; 3051 register int rtnval;
3324 #ifndef VMS 3345 #ifndef VMS
3325 #ifndef HAVE_GETTIMEOFDAY 3346 #ifndef HAVE_GETTIMEOFDAY
3326 #ifdef HAVE_TIMEVAL 3347 #ifdef HAVE_TIMEVAL
3327 3348
3328 /* ARGSUSED */ 3349 /* ARGSUSED */
3350 int
3329 gettimeofday (tp, tzp) 3351 gettimeofday (tp, tzp)
3330 struct timeval *tp; 3352 struct timeval *tp;
3331 struct timezone *tzp; 3353 struct timezone *tzp;
3332 { 3354 {
3333 extern long time (); 3355 extern long time ();
3334 3356
3335 tp->tv_sec = time ((long *)0); 3357 tp->tv_sec = time ((long *)0);
3336 tp->tv_usec = 0; 3358 tp->tv_usec = 0;
3337 if (tzp != 0) 3359 if (tzp != 0)
3338 tzp->tz_minuteswest = -1; 3360 tzp->tz_minuteswest = -1;
3361 return 0;
3339 } 3362 }
3340 3363
3341 #endif 3364 #endif
3342 #endif 3365 #endif
3343 #endif 3366 #endif
3345 3368
3346 /* 3369 /*
3347 * This function will go away as soon as all the stubs fixed. (fnf) 3370 * This function will go away as soon as all the stubs fixed. (fnf)
3348 */ 3371 */
3349 3372
3373 void
3350 croak (badfunc) 3374 croak (badfunc)
3351 char *badfunc; 3375 char *badfunc;
3352 { 3376 {
3353 printf ("%s not yet implemented\r\n", badfunc); 3377 printf ("%s not yet implemented\r\n", badfunc);
3354 reset_sys_modes (); 3378 reset_sys_modes ();
3869 static unsigned short memid, grpid; 3893 static unsigned short memid, grpid;
3870 static unsigned int uic; 3894 static unsigned int uic;
3871 3895
3872 /* Called from init_sys_modes, so it happens not very often 3896 /* Called from init_sys_modes, so it happens not very often
3873 but at least each time Emacs is loaded. */ 3897 but at least each time Emacs is loaded. */
3898 void
3874 sys_access_reinit () 3899 sys_access_reinit ()
3875 { 3900 {
3876 uic = 0; 3901 uic = 0;
3877 } 3902 }
3878 3903
4121 xfree (ptr); 4146 xfree (ptr);
4122 4147
4123 return pathname; 4148 return pathname;
4124 } 4149 }
4125 4150
4151 int
4126 getppid () 4152 getppid ()
4127 { 4153 {
4128 long item_code = JPI$_OWNER; 4154 long item_code = JPI$_OWNER;
4129 unsigned long parent_id; 4155 unsigned long parent_id;
4130 int status; 4156 int status;
4316 #ifndef va_count 4342 #ifndef va_count
4317 #define va_count(X) ((X) = *(((int *) &(va_alist)) - 1)) 4343 #define va_count(X) ((X) = *(((int *) &(va_alist)) - 1))
4318 #endif 4344 #endif
4319 #endif 4345 #endif
4320 4346
4347 int
4321 sys_creat (va_alist) 4348 sys_creat (va_alist)
4322 va_dcl 4349 va_dcl
4323 { 4350 {
4324 va_list list_incrementer; 4351 va_list list_incrementer;
4325 char *name; 4352 char *name;
4432 return fd; 4459 return fd;
4433 } 4460 }
4434 #endif /* creat */ 4461 #endif /* creat */
4435 4462
4436 /* fwrite to stdout is S L O W. Speed it up by using fputc...*/ 4463 /* fwrite to stdout is S L O W. Speed it up by using fputc...*/
4464 int
4437 sys_fwrite (ptr, size, num, fp) 4465 sys_fwrite (ptr, size, num, fp)
4438 register char * ptr; 4466 register char * ptr;
4439 FILE * fp; 4467 FILE * fp;
4440 { 4468 {
4441 register int tot = num * size; 4469 register int tot = num * size;
4442 4470
4443 while (tot--) 4471 while (tot--)
4444 fputc (*ptr++, fp); 4472 fputc (*ptr++, fp);
4473 return num;
4445 } 4474 }
4446 4475
4447 /* 4476 /*
4448 * The VMS C library routine creat actually creates a new version of an 4477 * The VMS C library routine creat actually creates a new version of an
4449 * existing file rather than truncating the old version. There are times 4478 * existing file rather than truncating the old version. There are times
4727 } 4756 }
4728 4757
4729 /* return total address space available to the current process. This is 4758 /* return total address space available to the current process. This is
4730 the sum of the current p0 size, p1 size and free page table entries 4759 the sum of the current p0 size, p1 size and free page table entries
4731 available. */ 4760 available. */
4761 int
4732 vlimit () 4762 vlimit ()
4733 { 4763 {
4734 int item_code; 4764 int item_code;
4735 unsigned long free_pages; 4765 unsigned long free_pages;
4736 unsigned long frep0va; 4766 unsigned long frep0va;
4762 } 4792 }
4763 4793
4764 return free_pages + frep0va + (0x7fffffff - frep1va); 4794 return free_pages + frep0va + (0x7fffffff - frep1va);
4765 } 4795 }
4766 4796
4797 int
4767 define_logical_name (varname, string) 4798 define_logical_name (varname, string)
4768 char *varname; 4799 char *varname;
4769 char *string; 4800 char *string;
4770 { 4801 {
4771 struct dsc$descriptor_s strdsc = 4802 struct dsc$descriptor_s strdsc =
4776 {7, DSC$K_DTYPE_T, DSC$K_CLASS_S, "LNM$JOB"}; 4807 {7, DSC$K_DTYPE_T, DSC$K_CLASS_S, "LNM$JOB"};
4777 4808
4778 return LIB$SET_LOGICAL (&envdsc, &strdsc, &lnmdsc, 0, 0); 4809 return LIB$SET_LOGICAL (&envdsc, &strdsc, &lnmdsc, 0, 0);
4779 } 4810 }
4780 4811
4812 int
4781 delete_logical_name (varname) 4813 delete_logical_name (varname)
4782 char *varname; 4814 char *varname;
4783 { 4815 {
4784 struct dsc$descriptor_s envdsc = 4816 struct dsc$descriptor_s envdsc =
4785 {strlen (varname), DSC$K_DTYPE_T, DSC$K_CLASS_S, varname}; 4817 {strlen (varname), DSC$K_DTYPE_T, DSC$K_CLASS_S, varname};
4787 {7, DSC$K_DTYPE_T, DSC$K_CLASS_S, "LNM$JOB"}; 4819 {7, DSC$K_DTYPE_T, DSC$K_CLASS_S, "LNM$JOB"};
4788 4820
4789 return LIB$DELETE_LOGICAL (&envdsc, &lnmdsc); 4821 return LIB$DELETE_LOGICAL (&envdsc, &lnmdsc);
4790 } 4822 }
4791 4823
4824 int
4792 ulimit () 4825 ulimit ()
4793 {} 4826 {
4794 4827 return 0;
4828 }
4829
4830 int
4795 setpgrp () 4831 setpgrp ()
4796 {} 4832 {
4797 4833 return 0;
4834 }
4835
4836 int
4798 execvp () 4837 execvp ()
4799 { 4838 {
4800 error ("execvp system call not implemented"); 4839 error ("execvp system call not implemented");
4840 return -1;
4801 } 4841 }
4802 4842
4803 int 4843 int
4804 rename (from, to) 4844 rename (from, to)
4805 char *from, *to; 4845 char *from, *to;
4918 LIB$SIGNAL (stat); 4958 LIB$SIGNAL (stat);
4919 strcpy (vms_file_written, to_esn); /* We will write this to the terminal*/ 4959 strcpy (vms_file_written, to_esn); /* We will write this to the terminal*/
4920 return 0; 4960 return 0;
4921 } 4961 }
4922 4962
4963 int
4923 link (file, new) 4964 link (file, new)
4924 char * file, * new; 4965 char * file, * new;
4925 { 4966 {
4926 register status; 4967 register status;
4927 struct FAB fab; 4968 struct FAB fab;
4985 } 5026 }
4986 5027
4987 return 0; 5028 return 0;
4988 } 5029 }
4989 5030
5031 void
4990 croak (badfunc) 5032 croak (badfunc)
4991 char *badfunc; 5033 char *badfunc;
4992 { 5034 {
4993 printf ("%s not yet implemented\r\n", badfunc); 5035 printf ("%s not yet implemented\r\n", badfunc);
4994 reset_sys_modes (); 5036 reset_sys_modes ();
5000 { 5042 {
5001 /* Arrange to return a range centered on zero. */ 5043 /* Arrange to return a range centered on zero. */
5002 return rand () - (1 << 30); 5044 return rand () - (1 << 30);
5003 } 5045 }
5004 5046
5047 void
5005 srandom (seed) 5048 srandom (seed)
5006 { 5049 {
5007 srand (seed); 5050 srand (seed);
5008 } 5051 }
5009 #endif /* VMS */ 5052 #endif /* VMS */
5010 5053
5011 #ifdef AIXHFT 5054 #ifdef AIXHFT
5012 5055
5013 /* Called from init_sys_modes. */ 5056 /* Called from init_sys_modes. */
5057 void
5014 hft_init () 5058 hft_init ()
5015 { 5059 {
5016 int junk; 5060 int junk;
5017 5061
5018 /* If we're not on an HFT we shouldn't do any of this. We determine 5062 /* If we're not on an HFT we shouldn't do any of this. We determine
5062 line_ins_del_ok = char_ins_del_ok = 0; 5106 line_ins_del_ok = char_ins_del_ok = 0;
5063 } 5107 }
5064 5108
5065 /* Reset the rubout key to backspace. */ 5109 /* Reset the rubout key to backspace. */
5066 5110
5111 void
5067 hft_reset () 5112 hft_reset ()
5068 { 5113 {
5069 struct hfbuf buf; 5114 struct hfbuf buf;
5070 struct hfkeymap keymap; 5115 struct hfkeymap keymap;
5071 int junk; 5116 int junk;
5181 #else 5226 #else
5182 while (length-- > 0) 5227 while (length-- > 0)
5183 *b2++ = *b1++; 5228 *b2++ = *b1++;
5184 #endif /* not VMS */ 5229 #endif /* not VMS */
5185 } 5230 }
5186 #endif /* (defined (BSTRING) && !defined (bcopy)) || defined (NEED_BCOPY) */ 5231 #endif /* (!defined (BSTRING) && !defined (bcopy)) || defined (NEED_BCOPY) */
5187 5232
5188 #ifndef BSTRING 5233 #ifndef BSTRING
5189 #ifndef bcmp 5234 #ifndef bcmp
5190 int 5235 int
5191 bcmp (b1, b2, length) /* This could be a macro! */ 5236 bcmp (b1, b2, length) /* This could be a macro! */