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;
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)*/
/*
* 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)*/
{"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'},
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) {
}
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);
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;