]> datadissipation.net git - ust.git/commitdiff
Minor cleanup
authorgit <redacted>
Sun, 15 Feb 2026 08:22:32 +0000 (03:22 -0500)
committergit <redacted>
Sun, 15 Feb 2026 08:22:32 +0000 (03:22 -0500)
config.def.h
ust.c

index 1f48d92d3f3c76fbb3ae4cb4ff317493aa214090..8ccdb78b2d6e58f4fe0db6eed691a4d4b159f748 100644 (file)
@@ -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 b9cee49cd21bbca4fef83432c87ffa8ea96f6853..9d00fab98229c71d1eb0343c38b74a2294ecf539 100644 (file)
--- 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;