Mercurial > hg > xemacs-beta
comparison src/sysdep.c @ 647:b39c14581166
[xemacs-hg @ 2001-08-13 04:45:47 by ben]
removal of unsigned, size_t, etc.
author | ben |
---|---|
date | Mon, 13 Aug 2001 04:46:48 +0000 |
parents | 023b83f4e54b |
children | fdefd0186b75 |
comparison
equal
deleted
inserted
replaced
646:00c54252fe4f | 647:b39c14581166 |
---|---|
816 { | 816 { |
817 struct termios t; | 817 struct termios t; |
818 tcgetattr (fd, &t); | 818 tcgetattr (fd, &t); |
819 #if 0 | 819 #if 0 |
820 /* What is the following line designed to do??? -mrb */ | 820 /* What is the following line designed to do??? -mrb */ |
821 if (strlen ((const char *) t.c_cc) < (unsigned int) (VEOF + 1)) | 821 if ((int) strlen ((const char *) t.c_cc) < (VEOF + 1)) |
822 return ctrl_d; | 822 return ctrl_d; |
823 else | 823 else |
824 return (Bufbyte) t.c_cc[VEOF]; | 824 return (Bufbyte) t.c_cc[VEOF]; |
825 #endif | 825 #endif |
826 return t.c_cc[VEOF] == _POSIX_VDISABLE ? ctrl_d : (Bufbyte) t.c_cc[VEOF]; | 826 return t.c_cc[VEOF] == _POSIX_VDISABLE ? ctrl_d : (Bufbyte) t.c_cc[VEOF]; |
839 characters. */ | 839 characters. */ |
840 #ifdef TCGETA | 840 #ifdef TCGETA |
841 { | 841 { |
842 struct termio t; | 842 struct termio t; |
843 ioctl (fd, TCGETA, &t); | 843 ioctl (fd, TCGETA, &t); |
844 if (strlen ((const char *) t.c_cc) < (unsigned int) (VINTR + 1)) | 844 if ((int) strlen ((const char *) t.c_cc) < (VINTR + 1)) |
845 return ctrl_d; | 845 return ctrl_d; |
846 else | 846 else |
847 return (Bufbyte) t.c_cc[VINTR]; | 847 return (Bufbyte) t.c_cc[VINTR]; |
848 } | 848 } |
849 #else /* ! defined (TCGETA) */ | 849 #else /* ! defined (TCGETA) */ |
931 decisions. */ | 931 decisions. */ |
932 | 932 |
933 void | 933 void |
934 init_baud_rate (struct device *d) | 934 init_baud_rate (struct device *d) |
935 { | 935 { |
936 struct console *con = XCONSOLE (DEVICE_CONSOLE (d)); | |
937 if (DEVICE_WIN_P (d) || DEVICE_STREAM_P (d)) | 936 if (DEVICE_WIN_P (d) || DEVICE_STREAM_P (d)) |
938 { | 937 { |
939 DEVICE_BAUD_RATE (d) = 38400; | 938 DEVICE_BAUD_RATE (d) = 38400; |
940 return; | 939 return; |
941 } | 940 } |
942 | 941 |
943 #ifdef HAVE_TTY | 942 #ifdef HAVE_TTY |
944 assert (DEVICE_TTY_P (d)); | 943 assert (DEVICE_TTY_P (d)); |
945 { | 944 { |
945 struct console *con = XCONSOLE (DEVICE_CONSOLE (d)); | |
946 int input_fd = CONSOLE_TTY_DATA (con)->infd; | 946 int input_fd = CONSOLE_TTY_DATA (con)->infd; |
947 #if defined (WIN32_NATIVE) | 947 #if defined (WIN32_NATIVE) |
948 DEVICE_TTY_DATA (d)->ospeed = 15; | 948 DEVICE_TTY_DATA (d)->ospeed = 15; |
949 #elif defined (HAVE_TERMIOS) | 949 #elif defined (HAVE_TERMIOS) |
950 struct termios sg; | 950 struct termios sg; |
1765 #if 0 /* We do our own buffering with lstreams. */ | 1765 #if 0 /* We do our own buffering with lstreams. */ |
1766 #ifdef _IOFBF | 1766 #ifdef _IOFBF |
1767 /* This symbol is defined on recent USG systems. | 1767 /* This symbol is defined on recent USG systems. |
1768 Someone says without this call USG won't really buffer the file | 1768 Someone says without this call USG won't really buffer the file |
1769 even with a call to setbuf. */ | 1769 even with a call to setbuf. */ |
1770 setvbuf (CONSOLE_TTY_DATA (con)->outfd, (char *) _sobuf, _IOFBF, sizeof _sobuf); | 1770 setvbuf (CONSOLE_TTY_DATA (con)->outfd, (char *) _sobuf, _IOFBF, |
1771 sizeof (_sobuf)); | |
1771 #else | 1772 #else |
1772 setbuf (CONSOLE_TTY_DATA (con)->outfd, (char *) _sobuf); | 1773 setbuf (CONSOLE_TTY_DATA (con)->outfd, (char *) _sobuf); |
1773 #endif | 1774 #endif |
1774 #endif | 1775 #endif |
1775 set_tty_modes (con); | 1776 set_tty_modes (con); |
2294 void | 2295 void |
2295 init_system_name (void) | 2296 init_system_name (void) |
2296 { | 2297 { |
2297 #if defined (WIN32_NATIVE) | 2298 #if defined (WIN32_NATIVE) |
2298 char hostname [MAX_COMPUTERNAME_LENGTH + 1]; | 2299 char hostname [MAX_COMPUTERNAME_LENGTH + 1]; |
2299 size_t size = sizeof (hostname); | 2300 DWORD size = sizeof (hostname); |
2300 GetComputerName (hostname, &size); | 2301 GetComputerName (hostname, &size); |
2301 Vsystem_name = build_string (hostname); | 2302 Vsystem_name = build_string (hostname); |
2302 #elif !defined (HAVE_GETHOSTNAME) | 2303 #elif !defined (HAVE_GETHOSTNAME) |
2303 struct utsname uts; | 2304 struct utsname uts; |
2304 uname (&uts); | 2305 uname (&uts); |
2305 Vsystem_name = build_string (uts.nodename); | 2306 Vsystem_name = build_string (uts.nodename); |
2306 #else /* HAVE_GETHOSTNAME */ | 2307 #else /* HAVE_GETHOSTNAME */ |
2307 unsigned int hostname_size = 256; | 2308 int hostname_size = 256; |
2308 char *hostname = (char *) alloca (hostname_size); | 2309 char *hostname = (char *) alloca (hostname_size); |
2309 | 2310 |
2310 /* Try to get the host name; if the buffer is too short, try | 2311 /* Try to get the host name; if the buffer is too short, try |
2311 again. Apparently, the only indication gethostname gives of | 2312 again. Apparently, the only indication gethostname gives of |
2312 whether the buffer was large enough is the presence or absence | 2313 whether the buffer was large enough is the presence or absence |
2315 { | 2316 { |
2316 gethostname (hostname, hostname_size - 1); | 2317 gethostname (hostname, hostname_size - 1); |
2317 hostname[hostname_size - 1] = '\0'; | 2318 hostname[hostname_size - 1] = '\0'; |
2318 | 2319 |
2319 /* Was the buffer large enough for the '\0'? */ | 2320 /* Was the buffer large enough for the '\0'? */ |
2320 if (strlen (hostname) < (size_t) (hostname_size - 1)) | 2321 if ((int) strlen (hostname) < (hostname_size - 1)) |
2321 break; | 2322 break; |
2322 | 2323 |
2323 hostname_size <<= 1; | 2324 hostname_size <<= 1; |
2324 hostname = (char *) alloca (hostname_size); | 2325 hostname = (char *) alloca (hostname_size); |
2325 } | 2326 } |