From: git Date: Sun, 15 Feb 2026 08:22:32 +0000 (-0500) Subject: Minor cleanup X-Git-Url: https://git.datadissipation.net/?a=commitdiff_plain;h=6f2a866b18c444935724e2902a14a41d0edf2ade;p=ust.git Minor cleanup --- diff --git a/config.def.h b/config.def.h index 1f48d92..8ccdb78 100644 --- a/config.def.h +++ b/config.def.h @@ -24,14 +24,32 @@ const char escapechar = '~'; int verbose = 0; /*(0|1)*/ /* - * device name: - * on Linux, you have `ttyS#` and `ttyUSB#` - * on BSD (MacOS included) systems `cuau#` and `cuaU#` (uppercase for USB TTYs) should be used + * device name + * + * Linux: + * ttyS* - any standard serial port + * ttyUSB* - any USB serial port + * + * FreeBSD: + * cuau* - does not wait for DCD + * ttyu* - 'dial-in' device, waits for DCD + * cuaU* - USB variant + * ttyU* - USB variant + * + * OpenBSD: + * cua* - does not wait for DCD + * tty* - 'dial-in' device, waits for DCD + * cuaU* - USB variant + * ttyU* - USB variant + * + * NetBSD: + * dty* - opening does not block, does not wait for DCD + * tty* - 'dial-in' device, blocks opening until a connection is established */ char line[16] = "/dev/cuau0"; /* - * speed is usually configurable to standard values only, + * baud is usually configurable to standard values only, * custom speed requires both hardware and driver support */ unsigned int ispeed = 9600; @@ -73,7 +91,7 @@ crlfopt tropts = {0}; crlfopt itropts = {0}; /* - * backspace: setting to one makes `^H` the backspace character, `^?` by default + * backspace: setting to one makes `^H` the backspace character, `^?` otherwise */ int backspace = 0; /*(0|1)*/ @@ -89,7 +107,7 @@ int soft = 0; /*(0|1)*/ /* * hardware flow control * 1 - RTS/CTS - * 2 - DTR/DSR (does not work on Linux) + * 2 - DTR/DSR (not supported on some platforms) * 3 - DCD */ int hard = 0; /*(0|1|2|3)*/ diff --git a/ust.c b/ust.c index b9cee49..9d00fab 100644 --- a/ust.c +++ b/ust.c @@ -85,7 +85,7 @@ main(int argc, char **argv) {"speed", required_argument, NULL, 's'}, {"rx-speed", required_argument, NULL, 'i'}, {"echo", no_argument, NULL, 'h'}, - {"canonical", no_argument, 0, 'c'}, + {"canonical", no_argument, NULL, 'c'}, {"odd", no_argument, NULL, 'o'}, {"even", no_argument, NULL, 'e'}, {"hardware-rtscts", no_argument, NULL, 'R'}, @@ -604,10 +604,6 @@ replacechar(char *str, ssize_t size, const char find, const char repl) inline ssize_t __attribute__((hot)) addchar(char *str, int *scratch, ssize_t size, const size_t bsize,const char find, const char inp, const int offset) { - /* turns any signed int into a signed 1 - int toff = offset & (~(uintmax >> 1) | 1) - */ - int toff = offset; int c = 0; for (int i = 0; i < size; i++) { if (str[i] == find) { @@ -626,7 +622,7 @@ addchar(char *str, int *scratch, ssize_t size, const size_t bsize,const char fin } for (int i = c; i > 0; i--) { for (int s = size; s >= scratch[i]; s--) - str[s + toff] = str[s]; + str[s + offset] = str[s]; str[scratch[i]] = inp; } return (size + c); @@ -670,7 +666,6 @@ interchck() newterm.c_iflag |= INLCR; newterm.c_cc[VMIN] = minchars; - newterm.c_cc[VTIME] = chardelay; newterm.c_cc[VINTR] = _POSIX_VDISABLE; newterm.c_cc[VSUSP] = _POSIX_VDISABLE; newterm.c_cc[VQUIT] = _POSIX_VDISABLE;