From 34469ed88cb6ba3936c46f6fa8c08330f23adb22 Mon Sep 17 00:00:00 2001 From: Bart Massey Date: Thu, 7 Feb 2008 17:47:23 -0800 Subject: [PATCH] fixed to give errors on some bogus arguments; fixed to warn if one of the outputs given did not exist --- xrandr.c | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-) diff --git a/xrandr.c b/xrandr.c index 674dc0b..8d6cfd4 100644 --- a/xrandr.c +++ b/xrandr.c @@ -275,6 +275,8 @@ struct _output { Rotation rotation; Bool automatic; + + Bool mark; }; typedef enum _umode_action { @@ -449,6 +451,7 @@ add_output (void) if (!output) fatal ("out of memory"); output->next = NULL; + output->mark = False; *outputs_tail = output; outputs_tail = &output->next; return output; @@ -1137,6 +1140,7 @@ void get_outputs (void) { int o; + output_t *q; for (o = 0; o < res->noutput; o++) { @@ -1175,6 +1179,7 @@ get_outputs (void) } } } + output->mark = True; /* * Automatic mode -- track connection state and enable/disable outputs @@ -1205,6 +1210,14 @@ get_outputs (void) set_output_info (output, res->outputs[o], output_info); } + for (q = outputs; q; q = q->next) + { + if (!q->mark) + { + fprintf(stderr, "warning: output %s not found; ignoring\n", + q->output.string); + } + } } void @@ -1728,7 +1741,7 @@ main (int argc, char **argv) if (!strcmp ("-o", argv[i]) || !strcmp ("--orientation", argv[i])) { char *endptr; if (++i>=argc) usage (); - dirind = check_strtol(argv[i], &endptr, 10); + dirind = strtol(argv[i], &endptr, 10); if (argv[i] == endptr) { for (dirind = 0; dirind < 4; dirind++) { if (strcmp (direction[dirind], argv[i]) == 0) break; -- 1.5.3.4