1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
Description: Fix print issue if using -n option
Originally, if using -n option, the output of result will be cleaned up as
soon as the program exit.
Author: Aristo Chen <wmchen.aristo@gmail.com>
---
Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>
--- statserial-1.1.orig/statserial.c
+++ statserial-1.1/statserial.c
@@ -127,7 +127,7 @@ int main(int argc, char *argv[])
}
/* init curses */
- if (!d_option && !x_option) {
+ if (!n_option && !d_option && !x_option) {
initscr();
atexit(cleanup);
}
@@ -151,10 +151,30 @@ int main(int argc, char *argv[])
old_status = arg;
/* home cursor */
- if (!d_option && !x_option) {
+ if (!n_option && !d_option && !x_option) {
move(0,0);
}
+ /* break out if -n option was used */
+ if (n_option)
+ {
+ printf("Device: %s\n\n", device);
+ printf("Signal Pin Pin Direction Status Full\n");
+ printf("Name (25) (9) (computer) Name\n");
+ printf("----- --- --- --------- ------ -----\n");
+ printf("FG 1 - - - Frame Ground\n");
+ printf("TxD 2 3 out - Transmit Data\n");
+ printf("RxD 3 2 in - Receive Data\n");
+ printf("RTS 4 7 out %1d Request To Send\n", !!(arg & TIOCM_RTS));
+ printf("CTS 5 8 in %1d Clear To Send\n", !!(arg & TIOCM_CTS));
+ printf("DSR 6 6 in %1d Data Set Ready\n", !!(arg & TIOCM_DSR));
+ printf("GND 7 5 - - Signal Ground\n");
+ printf("DCD 8 1 in %1d Data Carrier Detect\n", !!(arg & TIOCM_CAR));
+ printf("DTR 20 4 out %1d Data Terminal Ready\n", !!(arg & TIOCM_DTR));
+ printf("RI 22 9 in %1d Ring Indicator\n", !!(arg & TIOCM_RNG));
+ exit(0);
+ }
+
/* print status in decimal */
if (d_option) {
printf("%d\n", arg);
@@ -183,10 +203,6 @@ int main(int argc, char *argv[])
printw("RI 22 9 in %1d Ring Indicator\n", !!(arg & TIOCM_RNG));
refresh();
- /* break out if -n option was used */
- if (n_option)
- exit(0);
-
/* delay 1 second between loops */
sleep(1);
}
|