diff options
author | pgen <p.gen.progs@gmail.com> | 2016-12-08 19:27:00 +0100 |
---|---|---|
committer | pgen <p.gen.progs@gmail.com> | 2016-12-08 19:27:00 +0100 |
commit | 1be2eaf126790229c291abbbb735133abc51992a (patch) | |
tree | d5a8b1a9975035f3acb4031ba41e56be1bb076a0 | |
parent | ba750d22093bcadb2befa74b3b4559e6d3e25fee (diff) |
Manage conflicts between -C, -R, -c, -l, and -t
-rw-r--r-- | smenu.c | 33 |
1 files changed, 25 insertions, 8 deletions
@@ -4674,9 +4674,10 @@ main(int argc, char * argv[]) case 't': if (optarg != NULL) win.max_cols = atoi(optarg); - win.tab_mode = 1; - win.col_mode = 0; - win.line_mode = 0; + + win.tab_mode = 1; + win.col_mode = 0; + win.line_mode = 0; break; case 'k': @@ -4736,10 +4737,7 @@ main(int argc, char * argv[]) case 'C': if (optarg && *optarg != '-') - { cols_selector = optarg; - win.col_mode = 1; - } else TELL("Option requires an argument -- "); break; @@ -4748,8 +4746,6 @@ main(int argc, char * argv[]) if (optarg && *optarg != '-') { rows_selector = optarg; - win.line_mode = 1; - win.tab_mode = 0; win.max_cols = 0; } else @@ -4909,6 +4905,27 @@ main(int argc, char * argv[]) exit(EXIT_FAILURE); } + /* Force the right modes when the -C option is given */ + /* """"""""""""""""""""""""""""""""""""""""""""""""" */ + if (cols_selector) + { + if (win.tab_mode || win.col_mode || win.line_mode) + win.tab_mode = 0; + + win.col_mode = 1; + } + + /* Force the right modes when the -R option is given */ + /* """"""""""""""""""""""""""""""""""""""""""""""""" */ + if (rows_selector) + { + if (win.tab_mode) + win.tab_mode = 0; + + if (!win.col_mode && !win.line_mode) + win.line_mode = 1; + } + /* If we did not impose the number of columns, use the whole terminal width */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (win.tab_mode && !win.max_cols) |