add non-blocking i/o option
[ust.git] / config.def.h
1 /* software buffers */
2 const size_t wbuffsz = 1024;
3 const size_t rbuffsz = 1024;
4
5 /* scratch-pads for input processing */
6 const size_t scratchwsz = 256;
7 const size_t scratchrsz = 256;
8
9 /* `nanosleep()` values inside the read and write loops */
10 const long swritedelay = 0; /* seconds */
11 const long nswritedelay = 1000000; /* nanoseconds */
12
13 /* other names follow the same logic as above */
14
15 const long sreaddelay = 0;
16 const long nsreaddelay = 1000000;
17
18 /* `nanosleep()` values for the DTR pulse */
19 const long spulsedelay = 0;
20 const long nspulsedelay = 1000000;
21
22 /* lock the opened device */
23 const int exclusive = 1; /*(0|1)*/
24
25 /*
26 * set the device to blocking mode,
27 * on some systems this will stop all threads
28 * of a process during read/write, thus rendering
29 * ust unusable
30 */
31 const int blocking = 1; /*(0|1)*/
32
33 /* escape character for interactive use */
34 const char escapechar = '~';
35
36 /* print additional info to stderr */
37 int verbose = 0; /*(0|1)*/
38
39 /* exit timeout after piped ust reaches EOF */
40 long stimeout = 0;
41 long nstimeout = 10000;
42
43 /*
44 * device name
45 *
46 * Linux:
47 * ttyS* - any standard serial port
48 * ttyUSB* - any USB serial port
49 *
50 * FreeBSD:
51 * cuau* - does not wait for DCD
52 * ttyu* - 'dial-in' device, waits for DCD
53 * cuaU* - USB variant
54 * ttyU* - USB variant
55 *
56 * OpenBSD:
57 * cua* - does not wait for DCD
58 * tty* - 'dial-in' device, waits for DCD
59 * cuaU* - USB variant
60 * ttyU* - USB variant
61 *
62 * NetBSD:
63 * dty* - opening does not block, does not wait for DCD
64 * tty* - 'dial-in' device, blocks opening until a connection is established
65 * ttyU* - USB variant
66 */
67 char line[16] = "/dev/cuau0";
68
69 /*
70 * baud is usually configurable to standard values only,
71 * custom speed requires both hardware and driver support
72 */
73 unsigned int ispeed = 9600;
74 unsigned int ospeed = 9600;
75
76 /*
77 * data bits: can be 8,7,6 or 5.
78 * 9 is not supported
79 */
80 char datab = '8';
81
82 /*
83 * stop bits: setting this to 1 enables 2 stop bits for all numbers of data bits
84 * except 5 - it's 1.5 in that case
85 */
86 int stopb = 0; /*(0|1)*/
87
88 /*
89 * local echo (half-duplex mode) and canonical mode
90 */
91 int half = 0; /*(0|1)*/
92 int canonical = 0; /*(0|1)*/
93
94
95 /*
96 * CR and LF (NL) translation options
97 */
98 CRLFOpt tropts = { 0 };
99 CRLFOpt itropts = { 0 };
100
101 /*
102 * backspace: setting to one makes `^H` the backspace character, `^?` otherwise
103 */
104 int backspace = 0; /*(0|1)*/
105
106 /*
107 * the minimum of characters input before sending them to the line
108 */
109 int minchars = 1; /*(>=1)*/
110
111 /*
112 * delay between single characters being sent if the buffer has
113 * more than 1 (redirected stdin, writing a file)
114 * in nanoseconds
115 */
116 long chardelay = 0;
117
118 /*
119 * XON/XOFF flow control
120 * can be enabled with hardware flow control simultaneously
121 */
122 int soft = 0; /*(0|1)*/
123
124 /*
125 * hardware flow control
126 * 1 - RTS/CTS
127 * 2 - DTR/DSR (not supported on some platforms)
128 * 3 - DCD
129 */
130 int hard = 0; /*(0|1|2|3)*/
131
132 /*
133 * 1 - even
134 * 2 - odd
135 */
136 int parity = 0; /*(0|1|2)*/