Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 107697
Collapse All | Expand All

(-)omnitty-0.2.9/main.c (-6 / +20 lines)
Lines 47-57 Link Here
47
47
48
/* how many characters wide the list window will be, by default */
48
/* how many characters wide the list window will be, by default */
49
#define LISTWIN_DEFAULT_CHARS 8
49
#define LISTWIN_DEFAULT_CHARS 8
50
#define TERMWIN_DEFAULT_CHARS 80
51
#define TERMWIN_MIN 80
50
52
51
#define RTFM "Syntax: omnitty [-W list_width]\n" \
53
#define RTFM "Syntax: omnitty [-W list_width] [-T term_width]\n" \
52
             "\n" \
54
             "\n" \
53
             "     -W        specifies width of machine list area\n" \
55
             "     -W        specifies width of machine list area\n" \
54
             "               (default is 8 characters)\n" \
56
             "               (default is 8 characters)\n" \
57
             "\n" \
58
             "     -T        specifies width of terminal area\n" \
59
             "               (default is 80 characters)\n" \
55
             "\n"
60
             "\n"
56
61
57
static WINDOW *listwin   = NULL;
62
static WINDOW *listwin   = NULL;
Lines 116-132 Link Here
116
 *
121
 *
117
 * A = list_win_chars + 2
122
 * A = list_win_chars + 2
118
 */
123
 */
119
void wins_init(int *vtrows, int *vtcols, int list_win_chars) {
124
void wins_init(int *vtrows, int *vtcols, int list_win_chars, int term_win_chars) {
120
   int termcols, termrows, A, B, C;
125
   int termcols, termrows, A, B, C;
121
   const char *p;
126
   const char *p;
122
127
128
   printf("using list_width %i \nusing term_width %i\n", list_win_chars, term_win_chars);
123
   /* obtain terminal dimensions */
129
   /* obtain terminal dimensions */
124
   getmaxyx(stdscr, termrows, termcols);
130
   getmaxyx(stdscr, termrows, termcols);
125
131
126
   /* the geometry is hard-coded here, but nowhere else... so I don't
132
   /* the geometry is hard-coded here, but nowhere else... so I don't
127
    * see a lot of point using #defines or anything any more sophisticated */
133
    * see a lot of point using #defines or anything any more sophisticated */
128
   A = list_win_chars + 2;
134
   A = list_win_chars + 2;
129
   C = termcols - 80;
135
   C = termcols - term_win_chars;
130
   B = C-1;
136
   B = C-1;
131
   if (B < A) B = A, C = B + 1;
137
   if (B < A) B = A, C = B + 1;
132
   
138
   
Lines 299-321 Link Here
299
}
305
}
300
306
301
int main(int argc, char **argv) {
307
int main(int argc, char **argv) {
302
   static char optstr[] = "W:";
303
   int vtcols, vtrows, ch = 0;
308
   int vtcols, vtrows, ch = 0;
304
   int list_win_chars = LISTWIN_DEFAULT_CHARS;
309
   int list_win_chars = LISTWIN_DEFAULT_CHARS;
310
   int term_win_chars = TERMWIN_DEFAULT_CHARS;
305
   bool quit = false;
311
   bool quit = false;
306
   pid_t chldpid;
312
   pid_t chldpid;
307
313
308
   /* process command-line options */
314
   /* process command-line options */
309
   while ( 0 < (ch = getopt(argc, argv, optstr)) ) {
315
   while ( 0 < (ch = getopt(argc, argv, "W:T:")) ) {
310
      switch (ch) {
316
      switch (ch) {
311
         case 'W': list_win_chars = atoi(optarg); break;
317
         case 'W': list_win_chars = atoi(optarg); break;
318
	 case 'T': term_win_chars = atoi(optarg);
319
		   if( term_win_chars < TERMWIN_MIN ) {
320
		       fprintf(stderr, " terminal area too narrow: %i\n", term_win_chars);
321
		       fputs(RTFM, stderr);
322
		       exit(2);
323
		   }
324
		   break;
312
         default: fputs(RTFM, stderr); exit(2);
325
         default: fputs(RTFM, stderr); exit(2);
313
      }
326
      }
314
   }
327
   }
328
   printf("parsed args:\nlist_win_chars: %i\nterm_win_chars: %i\n", list_win_chars, term_win_chars);
315
329
316
   signal(SIGCHLD, sigchld_handler);
330
   signal(SIGCHLD, sigchld_handler);
317
   curses_init();
331
   curses_init();
318
   wins_init(&vtrows, &vtcols, list_win_chars);
332
   wins_init(&vtrows, &vtcols, list_win_chars, term_win_chars);
319
   menu_init(minibuf);
333
   menu_init(minibuf);
320
334
321
   machmgr_init(listwin, vtrows, vtcols);
335
   machmgr_init(listwin, vtrows, vtcols);
(-)omnitty-0.2.9/omnitty.1 (+7 lines)
Lines 23-28 Link Here
23
names, you might have to use this parameter to configure the desired
23
names, you might have to use this parameter to configure the desired
24
width of the list window.
24
width of the list window.
25
25
26
.TP
27
\fB-T\fR
28
specifies the width of the terminal window, if the default is not
29
satisfactory. For example, if you use omnitty in any X terminal with a 
30
small font you can increase the with to see longer lines without 
31
wrapping.
32
26
.SH PROJECT HOME PAGE
33
.SH PROJECT HOME PAGE
27
The Omnitty Project's official homepage is the following:
34
The Omnitty Project's official homepage is the following:
28
	
35
	

Return to bug 107697