Overview
Comment: | Added basic support for "stty" |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
a7c3ea759b85d6ceed9ffe91dec7d8dd |
User & Date: | rkeene on 2014-10-29 18:09:02 |
Other Links: | manifest | tags |
Context
2014-10-29
| ||
18:14 | Removed skipping of "size" request check-in: ee22fadb48 user: rkeene tags: trunk | |
18:09 | Added basic support for "stty" check-in: a7c3ea759b user: rkeene tags: trunk | |
16:17 | Added support for device name loading check-in: 50eb7273e9 user: rkeene tags: trunk | |
Changes
Modified tuapi.c from [d8491577f6] to [774f54baad].
1 2 3 4 5 6 7 8 9 | #define _LINUX_SOURCE 1 #include <sys/syscall.h> #include <netinet/in.h> #include <arpa/inet.h> #include <sys/socket.h> #include <sys/select.h> #include <sys/mount.h> #include <sys/types.h> #include <sys/ioctl.h> | > | 1 2 3 4 5 6 7 8 9 10 | #define _LINUX_SOURCE 1 #include <sys/syscall.h> #include <sys/termios.h> #include <netinet/in.h> #include <arpa/inet.h> #include <sys/socket.h> #include <sys/select.h> #include <sys/mount.h> #include <sys/types.h> #include <sys/ioctl.h> |
︙ | ︙ | |||
1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 | if (sock_v6 != -1) { close(sock_v6); } return(retval); } #ifndef DISABLE_UNIX_SOCKETS struct tuapi_socket_unix__chan_id { int fd; Tcl_Channel chan; }; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 | if (sock_v6 != -1) { close(sock_v6); } return(retval); } static int tuapi_stty(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { Tcl_Obj *obj, *retobj = NULL; struct termios terminal_information; struct winsize terminal_size; unsigned long obj_hash; int fd, idx; int ioctl_ret; int retval = TCL_OK; fd = STDIN_FILENO; for (idx = 1; idx < objc; idx++) { obj = objv[idx]; obj_hash = tuapi_internal_simplehash_obj(obj); if (obj_hash == 0xe7a7d65) { /* size */ continue; } switch (obj_hash) { case 0xe7a7d65: /* size */ ioctl_ret = ioctl(fd, TIOCGWINSZ, &terminal_size); if (ioctl_ret != 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj("ioctl failed", -1)); return(TCL_ERROR); } if (retobj == NULL) { retobj = Tcl_NewObj(); } Tcl_ListObjAppendElement(interp, retobj, Tcl_NewLongObj(terminal_size.ws_row)); Tcl_ListObjAppendElement(interp, retobj, Tcl_NewLongObj(terminal_size.ws_col)); break; case 0x5bcb0f7: /* -raw */ case 0x1cb0f7: /* raw */ case 0xdcb8f56f: /* -echo */ case 0xcb8f46f: /* echo */ ioctl_ret = ioctl(fd, TCGETS, &terminal_information); if (ioctl_ret != 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj("ioctl failed", -1)); return(TCL_ERROR); } switch (obj_hash) { case 0x5bcb0f7: /* -raw */ terminal_information.c_iflag |= BRKINT | IGNPAR | ISTRIP | ICRNL | IXON; terminal_information.c_oflag |= OPOST; terminal_information.c_lflag |= ISIG | ICANON; #if VMIN == VEOF terminal_information.c_cc[VEOF] = CEOF; #endif #if VTIME == VEOL terminal_information.c_cc[VEOL] = CEOL; #endif break; case 0x1cb0f7: /* raw */ terminal_information.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON); terminal_information.c_oflag &= ~OPOST; terminal_information.c_lflag &= ~(ISIG | ICANON); terminal_information.c_cc[VMIN] = 1; terminal_information.c_cc[VTIME] = 0; break; case 0xdcb8f56f: /* -echo */ terminal_information.c_lflag &= ~ECHO; break; case 0xcb8f46f: /* echo */ terminal_information.c_lflag |= ECHO; break; } ioctl_ret = ioctl(fd, TCSETS, &terminal_information); if (ioctl_ret != 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj("ioctl failed", -1)); return(TCL_ERROR); } break; default: Tcl_SetObjResult(interp, Tcl_NewStringObj("subcommand not implemented", -1)); return(TCL_ERROR); } } if (retobj != NULL) { Tcl_SetObjResult(interp, retobj); } return(retval); } #ifndef DISABLE_UNIX_SOCKETS struct tuapi_socket_unix__chan_id { int fd; Tcl_Channel chan; }; |
︙ | ︙ | |||
2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 | /* Network related commands */ Tcl_CreateObjCommand(interp, "::tuapi::syscall::ifconfig", tuapi_ifconfig, NULL, NULL); Tcl_CreateObjCommand(interp, "::tuapi::syscall::route", tuapi_route, NULL, NULL); Tcl_CreateObjCommand(interp, "::tuapi::syscall::brctl", tuapi_brctl, NULL, NULL); Tcl_CreateObjCommand(interp, "::tuapi::syscall::vconfig", tuapi_vconfig, NULL, NULL); /* Needed commands for basic services Tcl lacks */ Tcl_CreateObjCommand(interp, "::tuapi::syscall::socket_unix", tuapi_socket_unix, NULL, NULL); /* Service (TSMF) related commands */ Tcl_CreateObjCommand(interp, "::tuapi::syscall::tsmf_start_svc", tuapi_tsmf_start_svc, NULL, NULL); /* Internal functions */ | > > > | 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 | /* Network related commands */ Tcl_CreateObjCommand(interp, "::tuapi::syscall::ifconfig", tuapi_ifconfig, NULL, NULL); Tcl_CreateObjCommand(interp, "::tuapi::syscall::route", tuapi_route, NULL, NULL); Tcl_CreateObjCommand(interp, "::tuapi::syscall::brctl", tuapi_brctl, NULL, NULL); Tcl_CreateObjCommand(interp, "::tuapi::syscall::vconfig", tuapi_vconfig, NULL, NULL); /* Terminal related commands */ Tcl_CreateObjCommand(interp, "::tuapi::syscall::stty", tuapi_stty, NULL, NULL); /* Needed commands for basic services Tcl lacks */ Tcl_CreateObjCommand(interp, "::tuapi::syscall::socket_unix", tuapi_socket_unix, NULL, NULL); /* Service (TSMF) related commands */ Tcl_CreateObjCommand(interp, "::tuapi::syscall::tsmf_start_svc", tuapi_tsmf_start_svc, NULL, NULL); /* Internal functions */ |
︙ | ︙ |