Changeset 6ee1e193fd896ab9a4729fde14f009d9ce629815 for lxdialog/lxdialog.c
- Timestamp:
- 10/09/07 20:56:52 (1 year ago)
- git-parent:
- Files:
-
- lxdialog/lxdialog.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
lxdialog/lxdialog.c
re5d7794 r6ee1e19 68 68 #endif 69 69 if (argc < 2) { 70 Usage (argv[0]);71 exit (-1);72 } 73 74 while (offset < argc - 1 && !end_common_opts) { /* Common options */75 if (!strcmp (argv[offset + 1], "--title")) {76 if (argc - offset < 3 || title != NULL) {77 Usage (argv[0]);78 exit (-1);79 } else {80 title = argv[offset + 2];81 offset += 2;82 }70 Usage (argv[0]); 71 exit (-1); 72 } 73 74 while (offset < argc - 1 && !end_common_opts) { /* Common options */ 75 if (!strcmp (argv[offset + 1], "--title")) { 76 if (argc - offset < 3 || title != NULL) { 77 Usage (argv[0]); 78 exit (-1); 79 } else { 80 title = argv[offset + 2]; 81 offset += 2; 82 } 83 83 } else if (!strcmp (argv[offset + 1], "--backtitle")) { 84 84 if (backtitle != NULL) { … … 89 89 offset += 2; 90 90 } 91 } else if (!strcmp (argv[offset + 1], "--clear")) {92 if (clear_screen) {/* Hey, "--clear" can't appear twice! */93 Usage (argv[0]);94 exit (-1);95 } else if (argc == 2) {/* we only want to clear the screen */96 init_dialog ();97 refresh ();/* init_dialog() will clear the screen for us */98 end_dialog ();99 return 0;100 } else {101 clear_screen = 1;102 offset++;103 }104 } else/* no more common options */105 end_common_opts = 1;106 } 107 108 if (argc - 1 == offset) { /* no more options */109 Usage (argv[0]);110 exit (-1);91 } else if (!strcmp (argv[offset + 1], "--clear")) { 92 if (clear_screen) { /* Hey, "--clear" can't appear twice! */ 93 Usage (argv[0]); 94 exit (-1); 95 } else if (argc == 2) { /* we only want to clear the screen */ 96 init_dialog (); 97 refresh (); /* init_dialog() will clear the screen for us */ 98 end_dialog (); 99 return 0; 100 } else { 101 clear_screen = 1; 102 offset++; 103 } 104 } else /* no more common options */ 105 end_common_opts = 1; 106 } 107 108 if (argc - 1 == offset) { /* no more options */ 109 Usage (argv[0]); 110 exit (-1); 111 111 } 112 112 /* use a table to look for the requested mode, to avoid code duplication */ 113 113 114 for (modePtr = modes; modePtr->name; modePtr++) /* look for the mode */115 if (!strcmp (argv[offset + 1], modePtr->name))116 break;114 for (modePtr = modes; modePtr->name; modePtr++) /* look for the mode */ 115 if (!strcmp (argv[offset + 1], modePtr->name)) 116 break; 117 117 118 118 if (!modePtr->name) 119 Usage (argv[0]);119 Usage (argv[0]); 120 120 if (argc - offset < modePtr->argmin) 121 Usage (argv[0]);121 Usage (argv[0]); 122 122 if (modePtr->argmax && argc - offset > modePtr->argmax) 123 Usage (argv[0]);123 Usage (argv[0]); 124 124 125 125 … … 128 128 retval = (*(modePtr->jumper)) (title, argc - offset, argv + offset); 129 129 130 if (clear_screen) { /* clear screen before exit */131 attr_clear (stdscr, LINES, COLS, screen_attr);132 refresh ();130 if (clear_screen) { /* clear screen before exit */ 131 attr_clear (stdscr, LINES, COLS, screen_attr); 132 refresh (); 133 133 } 134 134 end_dialog(); … … 174 174 { 175 175 return dialog_menu (t, av[2], atoi (av[3]), atoi (av[4]), 176 atoi (av[5]), av[6], (ac - 6) / 2, av + 7);176 atoi (av[5]), av[6], (ac - 6) / 2, av + 7); 177 177 } 178 178 … … 181 181 { 182 182 return dialog_checklist (t, av[2], atoi (av[3]), atoi (av[4]), 183 atoi (av[5]), (ac - 6) / 3, av + 6, FLAG_CHECK);183 atoi (av[5]), (ac - 6) / 3, av + 6, FLAG_CHECK); 184 184 } 185 185 … … 188 188 { 189 189 return dialog_checklist (t, av[2], atoi (av[3]), atoi (av[4]), 190 atoi (av[5]), (ac - 6) / 3, av + 6, FLAG_RADIO);190 atoi (av[5]), (ac - 6) / 3, av + 6, FLAG_RADIO); 191 191 } 192 192
