]>
Commit | Line | Data |
---|---|---|
ea85cf66 AM |
1 | --- console-tools-0.3.3/vttools/resizecons.c.resizecons Wed Aug 25 23:13:26 1999 |
2 | +++ console-tools-0.3.3/vttools/resizecons.c Sun Nov 7 10:45:40 1999 | |
3 | @@ -128,16 +128,18 @@ | |
4 | { NULL, 0, NULL, 0 } | |
5 | }; | |
6 | ||
7 | - while ( (c = getopt_long (argc, argv, "-vhc:r:l:", long_opts, NULL)) != EOF) | |
8 | + while ( (c = getopt_long (argc, argv, "vhc:r:l:", long_opts, NULL)) != EOF) | |
9 | { | |
10 | switch (c) | |
11 | { | |
12 | case 'h': | |
13 | usage(); | |
14 | exit(0); | |
15 | + break; | |
16 | case 'v': | |
17 | version(); | |
18 | exit(0); | |
19 | + break; | |
20 | case 'c': | |
21 | *cols = atoi(optarg); | |
22 | if (*cols == 0) | |
23 | @@ -161,41 +163,38 @@ | |
24 | *mode = MODE_VGALINES; | |
25 | break; | |
26 | case '?': | |
27 | + default: | |
28 | usage(); | |
29 | exit(1); | |
30 | + break; | |
31 | } | |
32 | } | |
33 | ||
34 | ||
35 | - if (argc == optind +1) /* COLSxROWS case */ | |
36 | + if (argc == (optind + 1)) /* COLSxROWS case */ | |
37 | { | |
38 | if (*rows || *cols) | |
39 | { | |
40 | - fprintf(stderr,_("%s: Invalid arguments"), | |
41 | + fprintf(stderr,_("%s: Invalid arguments\n"), | |
42 | progname); | |
43 | exit(1); | |
44 | } | |
45 | - if ((p = index (argv[optind],'x')) != 0) | |
46 | - { | |
47 | - *cols = atoi (argv[optind]); | |
48 | - *rows = atoi (p+1); | |
49 | - return; | |
50 | - } | |
51 | - else | |
52 | + if ((p = index (argv[optind],'x')) == NULL) | |
53 | { | |
54 | - fprintf(stderr,_("%s: Unrecognized argument"), | |
55 | + fprintf(stderr, _("%s: Unrecognized argument\n"), | |
56 | progname); | |
57 | exit(1); | |
58 | } | |
59 | + *cols = atoi (argv[optind]); | |
60 | + *rows = atoi (p+1); | |
61 | return; | |
62 | - | |
63 | } | |
64 | ||
65 | - if (argc == optind +2) /* COLS ROWS case */ | |
66 | + if (argc == (optind + 2)) /* COLS ROWS case */ | |
67 | { | |
68 | if (*rows || *cols) | |
69 | { | |
70 | - fprintf(stderr,_("%s: Invalid arguments"), | |
71 | + fprintf(stderr,_("%s: Invalid arguments\n"), | |
72 | progname); | |
73 | exit(1); | |
74 | } | |
75 | @@ -204,7 +203,7 @@ | |
76 | return; | |
77 | } | |
78 | ||
79 | - if (argc == optind && *rows && *cols) | |
80 | + if (argc == optind && ((*rows && *cols) || *mode == MODE_VGALINES)) | |
81 | return; | |
82 | ||
83 | fprintf (stderr, _("%s: bad number of arguments\n"), |