~ubuntu-branches/ubuntu/jaunty/texlive-bin/jaunty

« back to all changes in this revision

Viewing changes to build/source/utils/dialog/dialog.c

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Preining
  • Date: 2008-06-26 23:14:59 UTC
  • mfrom: (2.1.30 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080626231459-y02rjsrgtafu83yr
Tags: 2007.dfsg.2-3
add missing source roadmap.fig of roadmap.eps in fontinst documentation
(Closes: #482915) (urgency medium due to RC bug)
(new patch add-missing-fontinst-source)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  dialog - Display simple dialog boxes from shell scripts
 
3
 *
 
4
 *  AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
 
5
 *
 
6
 *  This program is free software; you can redistribute it and/or
 
7
 *  modify it under the terms of the GNU General Public License
 
8
 *  as published by the Free Software Foundation; either version 2
 
9
 *  of the License, or (at your option) any later version.
 
10
 *
 
11
 *  This program is distributed in the hope that it will be useful,
 
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 *  GNU General Public License for more details.
 
15
 *
 
16
 *  You should have received a copy of the GNU General Public License
 
17
 *  along with this program; if not, write to the Free Software
 
18
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
19
 *
 
20
 *
 
21
 *  HISTORY:
 
22
 *
 
23
 *  17/12/93 - Version 0.1 released.
 
24
 *
 
25
 *  19/12/93 - menu will now scroll if there are more items than can fit
 
26
 *             on the screen.
 
27
 *           - added 'checklist', a dialog box with a list of options that
 
28
 *             can be turned on or off. A list of options that are on is 
 
29
 *             returned on exit.
 
30
 *
 
31
 *  20/12/93 - Version 0.15 released.
 
32
 *
 
33
 *  29/12/93 - Incorporated patch from Patrick J. Volkerding
 
34
 *             (volkerdi@mhd1.moorhead.msus.edu) that made these changes:
 
35
 *             - increased MAX_LEN to 2048
 
36
 *             - added 'infobox', equivalent to a message box without pausing
 
37
 *             - added option '--clear' that will clear the screen
 
38
 *             - Explicit line breaking when printing prompt text can be
 
39
 *               invoked by real newline '\n' besides the string "\n"
 
40
 *           - an optional parameter '--title <string>' can be used to
 
41
 *             specify a title string for the dialog box
 
42
 *
 
43
 *  03/01/94 - added 'textbox', a dialog box for displaying text from a file.
 
44
 *           - Version 0.2 released.
 
45
 *
 
46
 *  04/01/94 - some fixes and improvements for 'textbox':
 
47
 *             - fixed a bug that will cause a segmentation violation when a
 
48
 *               line is longer than MAX_LEN characters. Lines will now be
 
49
 *               truncated if they are longer than MAX_LEN characters.
 
50
 *             - removed wrefresh() from print_line(). This will increase
 
51
 *               efficiency of print_page() which calls print_line().
 
52
 *             - display current position in the form of percentage into file.
 
53
 *           - Version 0.21 released.
 
54
 *
 
55
 *  05/01/94 - some changes for faster screen update.
 
56
 *
 
57
 *  07/01/94 - much more flexible color settings. Can use all 16 colors
 
58
 *             (8 normal, 8 highlight) of the Linux console.
 
59
 *
 
60
 *  08/01/94 - added run-time configuration using configuration file.
 
61
 *
 
62
 *  09/01/94 - some minor bug fixes and cleanups for menubox, checklist and
 
63
 *             textbox.
 
64
 *
 
65
 *  11/01/94 - added a man page.
 
66
 *
 
67
 *  13/01/94 - some changes for easier porting to other Unix systems (tested
 
68
 *             on Ultrix, SunOS and HPUX)
 
69
 *           - Version 0.3 released.
 
70
 * 
 
71
 *  08/06/94 - Patches by Stuart Herbert - S.Herbert@shef.ac.uk
 
72
 *             Fixed attr_clear and the textbox stuff to work with ncurses 1.8.5
 
73
 *             Fixed the wordwrap routine - it'll actually wrap properly now
 
74
 *             Added a more 3D look to everything - having your own rc file could
 
75
 *               prove 'interesting' to say the least :-)
 
76
 *             Added radiolist option
 
77
 *             Added backtitle option
 
78
 *           - Version 0.4 released.
 
79
 *
 
80
 *  10/10/94 - Patches by Marc Ewing - marc@redhat.com
 
81
 *             Added --separate-output
 
82
 *             Added init val to inputbox
 
83
 *             Added guage widget
 
84
 */
 
85
 
 
86
 
 
87
#define __DIALOG_MAIN__
 
88
 
 
89
 
 
90
#include "dialog.h"
 
91
#ifdef HAVE_NCURSES
 
92
#include "colors.h"
 
93
#endif
 
94
 
 
95
static char *backtitle = NULL;
 
96
int separate_output = 0;
 
97
 
 
98
int main(int argc, char *argv[])
 
99
{
 
100
  int offset = 0, clear_screen = 0, end_common_opts = 0, retval;
 
101
  char *title = NULL;
 
102
  
 
103
#if defined(LOCALE)
 
104
  (void) setlocale(LC_ALL, "");
 
105
#endif
 
106
 
 
107
  if (argc < 2) {
 
108
    Usage(argv[0]);
 
109
    exit(-1);
 
110
  }
 
111
  else if (!strcmp(argv[1], "--create-rc")) {
 
112
#ifdef HAVE_NCURSES
 
113
    if (argc != 3) {
 
114
      Usage(argv[0]);
 
115
      exit(-1);
 
116
    }
 
117
    create_rc(argv[2]);
 
118
    return 0;
 
119
#else
 
120
    fprintf(stderr, "\nThis option is currently unsupported on your system.\n");
 
121
    return -1;
 
122
#endif
 
123
  }
 
124
 
 
125
  while (offset < argc-1 && !end_common_opts) {    /* Common options */
 
126
    if (!strcmp(argv[offset+1], "--title")) {
 
127
      if (argc-offset < 3 || title != NULL) {    /* No two "--title" please! */
 
128
        Usage(argv[0]);
 
129
        exit(-1);
 
130
      }
 
131
      else {
 
132
        title = argv[offset+2];
 
133
        offset += 2;
 
134
      }
 
135
    }
 
136
    else if (!strcmp(argv[offset+1], "--backtitle" ))
 
137
    {
 
138
      if (backtitle != NULL)
 
139
      {
 
140
        Usage(argv[0]);
 
141
        exit(-1);
 
142
      }
 
143
      else
 
144
      {
 
145
        backtitle = argv[offset+2];
 
146
        offset += 2;
 
147
      }
 
148
    }
 
149
    else if (!strcmp(argv[offset+1], "--separate-output" ))
 
150
    {
 
151
        separate_output = 1;
 
152
        offset++;
 
153
    }
 
154
    else if (!strcmp(argv[offset+1], "--clear")) {
 
155
      if (clear_screen) {    /* Hey, "--clear" can't appear twice! */
 
156
        Usage(argv[0]);
 
157
        exit(-1);
 
158
      }
 
159
      else if (argc == 2) {    /* we only want to clear the screen */
 
160
        init_dialog();
 
161
        refresh();    /* init_dialog() will clear the screen for us */
 
162
        endwin();
 
163
        return 0;
 
164
      }
 
165
      else {
 
166
        clear_screen = 1;
 
167
        offset++;
 
168
      }
 
169
    }
 
170
    else    /* no more common options */
 
171
      end_common_opts = 1;
 
172
  }
 
173
 
 
174
  if (argc-1 == offset) {    /* no more options */
 
175
    Usage(argv[0]);
 
176
    exit(-1);
 
177
  }
 
178
 
 
179
  /* Box options */
 
180
 
 
181
  if (!strcmp(argv[offset+1], "--yesno")) {
 
182
    if (argc-offset != 5) {
 
183
      Usage(argv[0]);
 
184
      exit(-1);
 
185
    }
 
186
    init_dialog();
 
187
    retval = dialog_yesno(title, argv[offset+2], atoi(argv[offset+3]),
 
188
                          atoi(argv[offset+4]));
 
189
 
 
190
    if (clear_screen) {    /* clear screen before exit */
 
191
      attr_clear(stdscr, LINES, COLS, screen_attr);
 
192
      refresh();
 
193
    }
 
194
    endwin();
 
195
    return retval;
 
196
  }
 
197
  else if (!strcmp(argv[offset+1], "--msgbox")) {
 
198
    if (argc-offset != 5) {
 
199
      Usage(argv[0]);
 
200
      exit(-1);
 
201
    }
 
202
    init_dialog();
 
203
    retval = dialog_msgbox(title, argv[offset+2], atoi(argv[offset+3]),
 
204
                           atoi(argv[offset+4]), 1);
 
205
 
 
206
    if (clear_screen) {    /* clear screen before exit */
 
207
      attr_clear(stdscr, LINES, COLS, screen_attr);
 
208
      refresh();
 
209
    }
 
210
    endwin();
 
211
    return retval;
 
212
  }
 
213
  else if (!strcmp(argv[offset+1], "--infobox")) {
 
214
    if (argc-offset != 5) {
 
215
      Usage(argv[0]);
 
216
      exit(-1);
 
217
    }
 
218
    init_dialog();
 
219
    retval = dialog_msgbox(title, argv[offset+2], atoi(argv[offset+3]),
 
220
                           atoi(argv[offset+4]), 0);
 
221
 
 
222
    if (clear_screen) {    /* clear screen before exit */
 
223
      attr_clear(stdscr, LINES, COLS, screen_attr);
 
224
      refresh();
 
225
    }
 
226
    endwin();
 
227
    return retval;
 
228
  }
 
229
  else if (!strcmp(argv[offset+1], "--textbox")) {
 
230
    if (argc-offset != 5) {
 
231
      Usage(argv[0]);
 
232
      exit(-1);
 
233
    }
 
234
    init_dialog();
 
235
    retval = dialog_textbox(title, argv[offset+2], atoi(argv[offset+3]),
 
236
                            atoi(argv[offset+4]));
 
237
 
 
238
    if (clear_screen) {    /* clear screen before exit */
 
239
      attr_clear(stdscr, LINES, COLS, screen_attr);
 
240
      refresh();
 
241
    }
 
242
    endwin();
 
243
    return retval;
 
244
  }
 
245
  else if (!strcmp(argv[offset+1], "--menu")) {
 
246
    if (argc-offset < 8 || ((argc-offset) % 2)) {
 
247
      Usage(argv[0]);
 
248
      exit(-1);
 
249
    }
 
250
    init_dialog();
 
251
    retval = dialog_menu(title, argv[offset+2], atoi(argv[offset+3]),
 
252
                         atoi(argv[offset+4]), atoi(argv[offset+5]),
 
253
                         (argc-offset-6)/2, argv+offset + 6);
 
254
 
 
255
    if (clear_screen) {    /* clear screen before exit */
 
256
      attr_clear(stdscr, LINES, COLS, screen_attr);
 
257
      refresh();
 
258
    }
 
259
    endwin();
 
260
    return retval;
 
261
  }
 
262
  else if (!strcmp(argv[offset+1], "--checklist")) {
 
263
    if (argc-offset < 9 || ((argc-offset-6) % 3)) {
 
264
      Usage(argv[0]);
 
265
      exit(-1);
 
266
    }
 
267
    init_dialog();
 
268
    retval = dialog_checklist(title, argv[offset+2], atoi(argv[offset+3]),
 
269
                              atoi(argv[offset+4]), atoi(argv[offset+5]),
 
270
                              (argc-offset-6)/3, argv+offset + 6);
 
271
 
 
272
    if (clear_screen) {    /* clear screen before exit */
 
273
      attr_clear(stdscr, LINES, COLS, screen_attr);
 
274
      refresh();
 
275
    }
 
276
    endwin();
 
277
    return retval;
 
278
  }
 
279
  else if (!strcmp(argv[offset+1], "--radiolist")) {
 
280
    if (argc-offset < 9 || ((argc-offset-6) % 3)) {
 
281
      Usage(argv[0]);
 
282
      exit(-1);
 
283
    }
 
284
    init_dialog();
 
285
    retval = dialog_radiolist(title, argv[offset+2], atoi(argv[offset+3]),
 
286
                              atoi(argv[offset+4]), atoi(argv[offset+5]),
 
287
                              (argc-offset-6)/3, argv+offset + 6);
 
288
 
 
289
    if (clear_screen) {    /* clear screen before exit */
 
290
      attr_clear(stdscr, LINES, COLS, screen_attr);
 
291
      refresh();
 
292
    }
 
293
    endwin();
 
294
    return retval;
 
295
  }
 
296
  else if (!strcmp(argv[offset+1], "--guage")) {
 
297
      if (argc-offset != 6) {
 
298
          Usage(argv[0]);
 
299
          exit(-1);
 
300
      }
 
301
      init_dialog();
 
302
      retval = dialog_guage(title,  argv[offset+2],
 
303
                            atoi(argv[offset+3]), atoi(argv[offset+4]),
 
304
                            atoi(argv[offset+5]));
 
305
      
 
306
      if (clear_screen) {    /* clear screen before exit */
 
307
          attr_clear(stdscr, LINES, COLS, screen_attr);
 
308
          refresh();
 
309
      }
 
310
      endwin();
 
311
      return retval;
 
312
  }
 
313
  else if (!strcmp(argv[offset+1], "--inputbox")) {
 
314
    if (argc-offset < 5 || argc-offset > 6) {
 
315
      Usage(argv[0]);
 
316
      exit(-1);
 
317
    }
 
318
    init_dialog();
 
319
    retval = dialog_inputbox(title, argv[offset+2], atoi(argv[offset+3]),
 
320
                             atoi(argv[offset+4]),
 
321
                             (argc-offset == 6) ? argv[offset+5] : (char *)NULL);
 
322
 
 
323
    if (clear_screen) {    /* clear screen before exit */
 
324
      attr_clear(stdscr, LINES, COLS, screen_attr);
 
325
      refresh();
 
326
    }
 
327
    endwin();
 
328
    return retval;
 
329
  }
 
330
 
 
331
  Usage(argv[0]);
 
332
  exit(-1);
 
333
}
 
334
/* End of main() */
 
335
 
 
336
 
 
337
/*
 
338
 * Print program usage
 
339
 */
 
340
void Usage(char *name)
 
341
{
 
342
  fprintf(stderr, "\
 
343
\ndialog version 0.3, by Savio Lam (lam836@cs.cuhk.hk).\
 
344
\n  patched to version %s by Stuart Herbert (S.Herbert@shef.ac.uk)\
 
345
\n\
 
346
\n* Display dialog boxes from shell scripts *\
 
347
\n\
 
348
\nUsage: %s --clear\
 
349
\n       %s --create-rc <file>\
 
350
\n       %s [--title <title>] [--separate-output] [--backtitle <backtitle>] [--clear] <Box options>\
 
351
\n\
 
352
\nBox options:\
 
353
\n\
 
354
\n  --yesno     <text> <height> <width>\
 
355
\n  --msgbox    <text> <height> <width>\
 
356
\n  --infobox   <text> <height> <width>\
 
357
\n  --inputbox  <text> <height> <width> [<init>]\
 
358
\n  --textbox   <file> <height> <width>\
 
359
\n  --menu      <text> <height> <width> <menu height> <tag1> <item1>...\
 
360
\n  --checklist <text> <height> <width> <list height> <tag1> <item1> <status1>...\
 
361
\n  --radiolist <text> <height> <width> <list height> <tag1> <item1> <status1>...\
 
362
\n  --guage     <text> <height> <width> <percent>\n", VERSION, name, name, name);
 
363
}
 
364
/* End of Usage() */
 
365
 
 
366
 
 
367
/*
 
368
 * Do some initialization for dialog
 
369
 */
 
370
void init_dialog(void)
 
371
{
 
372
  int i;
 
373
  
 
374
#ifdef HAVE_NCURSES
 
375
  if (parse_rc() == -1)    /* Read the configuration file */
 
376
    exit(-1);
 
377
#endif
 
378
 
 
379
  initscr();     /* Init curses */
 
380
  keypad(stdscr, TRUE);
 
381
  cbreak();
 
382
  noecho();
 
383
 
 
384
#ifdef HAVE_NCURSES
 
385
  if (use_colors || use_shadow)    /* Set up colors */
 
386
    color_setup();
 
387
#endif
 
388
 
 
389
  /* Set screen to screen attribute */
 
390
  attr_clear(stdscr, LINES, COLS, screen_attr);
 
391
 
 
392
  /* Display background title if it exists ... - SLH */
 
393
  if (backtitle != NULL)
 
394
  {
 
395
    wattrset(stdscr, screen_attr);
 
396
    wmove(stdscr, 0, 1);
 
397
    waddstr(stdscr,backtitle);
 
398
    wmove(stdscr, 1, 1);
 
399
    for(i=1; i<COLS-1; i++)
 
400
      waddch(stdscr, ACS_HLINE);
 
401
  }
 
402
  
 
403
  wnoutrefresh(stdscr);
 
404
}
 
405
/* End of init_dialog() */
 
406
 
 
407
 
 
408
#ifdef HAVE_NCURSES
 
409
/*
 
410
 * Setup for color display
 
411
 */
 
412
void color_setup(void)
 
413
{
 
414
  int i;
 
415
 
 
416
  if (has_colors()) {    /* Terminal supports color? */
 
417
    start_color();
 
418
 
 
419
    /* Initialize color pairs */
 
420
    for (i = 0; i < ATTRIBUTE_COUNT; i++)
 
421
      init_pair(i+1, color_table[i][0], color_table[i][1]);
 
422
 
 
423
    /* Setup color attributes */
 
424
    for (i = 0; i < ATTRIBUTE_COUNT; i++)
 
425
      attributes[i] = C_ATTR(color_table[i][2], i+1);
 
426
  }
 
427
}
 
428
/* End of color_setup() */
 
429
#endif
 
430
 
 
431
 
 
432
/*
 
433
 * Set window to attribute 'attr'
 
434
 */
 
435
void attr_clear(WINDOW *win, int height, int width, chtype attr)
 
436
{
 
437
/* ifdef HAVE_NCURSES
 
438
  wattrset(win, attr);    Set window to attribute 'attr'
 
439
  werase(win);
 
440
else */
 
441
  int i, j;
 
442
 
 
443
  wattrset(win, attr);    /* Set window to attribute 'attr' */
 
444
  for (i = 0; i < height; i++) {
 
445
    wmove(win, i, 0);
 
446
    for (j = 0; j < width; j++)
 
447
      waddch(win, ' ');
 
448
  }
 
449
  touchwin(win);
 
450
/* endif */
 
451
}
 
452
/* End of attr_clear() */
 
453
 
 
454
 
 
455
/*
 
456
 * Print a string of text in a window, automatically wrap around to the
 
457
 * next line if the string is too long to fit on one line. Note that the
 
458
 * string may contain "\n" to represent a newline character or the real
 
459
 * newline '\n', but in that case, auto wrap around will be disabled.
 
460
 */
 
461
void print_autowrap(WINDOW *win, char *prompt, int width, int y, int x)
 
462
{
 
463
  int first = 1, cur_x, cur_y;
 
464
  char tempstr[MAX_LEN+1], *word, *tempptr, *tempptr1;
 
465
 
 
466
  strcpy(tempstr, prompt);
 
467
  if ((strstr(tempstr, "\\n") != NULL) ||
 
468
      (strchr(tempstr, '\n') != NULL)) {    /* Prompt contains "\n" or '\n' */
 
469
    word = tempstr;
 
470
    cur_y = y;
 
471
    wmove(win, cur_y, x);
 
472
    while (1) {
 
473
      tempptr = strstr(word, "\\n");
 
474
      tempptr1 = strchr(word, '\n');
 
475
      if (tempptr == NULL && tempptr1 == NULL)
 
476
        break;
 
477
      else if (tempptr == NULL) {    /* No more "\n" */
 
478
        tempptr = tempptr1;
 
479
        tempptr[0] = '\0';
 
480
      }
 
481
      else if (tempptr1 == NULL) {    /* No more '\n' */
 
482
        tempptr[0] = '\0';
 
483
        tempptr++;
 
484
      }
 
485
      else {    /* Prompt contains both "\n" and '\n' */
 
486
        if (strlen(tempptr)-2 < strlen(tempptr1)-1) {
 
487
          tempptr = tempptr1;
 
488
          tempptr[0] = '\0';
 
489
        }
 
490
        else {
 
491
          tempptr[0] = '\0';
 
492
          tempptr++;
 
493
        }
 
494
      }
 
495
 
 
496
      waddstr(win, word);
 
497
      word = tempptr + 1;
 
498
      wmove(win, ++cur_y, x);
 
499
    }
 
500
    waddstr(win, word);
 
501
  }
 
502
  else if (strlen(tempstr) <= width-x*2) {    /* If prompt is short */
 
503
    wmove(win, y, (width - strlen(tempstr)) / 2);
 
504
    waddstr(win, tempstr);
 
505
  }
 
506
  else {
 
507
    cur_x = x;
 
508
    cur_y = y;
 
509
    /* Print prompt word by word, wrap around if necessary */
 
510
    while ((word = strtok(first ? tempstr : NULL, " ")) != NULL) {
 
511
      if (first)    /* First iteration */
 
512
        first = 0;
 
513
      if (cur_x+strlen(word) > width) {    /* wrap around to next line */
 
514
        cur_y++;
 
515
        cur_x = x;
 
516
      }
 
517
      wmove(win, cur_y, cur_x);
 
518
      waddstr(win, word);
 
519
      getyx(win, cur_y, cur_x);
 
520
      cur_x++;
 
521
    }
 
522
  }
 
523
}
 
524
/* End of print_autowrap() */
 
525
 
 
526
 
 
527
/*
 
528
 * Print a button
 
529
 */
 
530
void print_button(WINDOW *win, char *label, int y, int x, int selected)
 
531
{
 
532
  int i, temp;
 
533
 
 
534
  wmove(win, y, x);
 
535
  wattrset(win, selected ? button_active_attr : button_inactive_attr);
 
536
  waddstr(win, "<");
 
537
  temp = strspn(label, " ");
 
538
  label += temp;
 
539
  wattrset(win, selected ? button_label_active_attr : button_label_inactive_attr);
 
540
  for (i = 0; i < temp; i++)
 
541
    waddch(win, ' ');
 
542
  wattrset(win, selected ? button_key_active_attr : button_key_inactive_attr);
 
543
  waddch(win, label[0]);
 
544
  wattrset(win, selected ? button_label_active_attr : button_label_inactive_attr);
 
545
  waddstr(win, label+1);
 
546
  wattrset(win, selected ? button_active_attr : button_inactive_attr);
 
547
  waddstr(win, ">");
 
548
  wmove(win, y, x+temp+1);
 
549
}
 
550
/* End of print_button() */
 
551
 
 
552
 
 
553
/*
 
554
 * Draw a rectangular box with line drawing characters
 
555
 */
 
556
void draw_box(WINDOW *win, int y, int x, int height, int width, chtype box, chtype border)
 
557
{
 
558
  int i, j;
 
559
 
 
560
  wattrset(win, 0);
 
561
  for (i = 0; i < height; i++) {
 
562
    wmove(win, y + i, x);
 
563
    for (j = 0; j < width; j++)
 
564
      if (!i && !j)
 
565
        waddch(win, border | ACS_ULCORNER);
 
566
      else if (i == height-1 && !j)
 
567
        waddch(win, border | ACS_LLCORNER);
 
568
      else if (!i && j == width-1)
 
569
        waddch(win, box | ACS_URCORNER);
 
570
      else if (i == height-1 && j == width-1)
 
571
        waddch(win, box | ACS_LRCORNER);
 
572
      else if (!i)
 
573
        waddch(win, border | ACS_HLINE);
 
574
      else if (i == height-1)
 
575
        waddch(win, box | ACS_HLINE);
 
576
      else if (!j)
 
577
        waddch(win, border | ACS_VLINE);
 
578
      else if (j == width-1)
 
579
        waddch(win, box | ACS_VLINE);
 
580
      else
 
581
        waddch(win, box | ' ');
 
582
  }
 
583
}
 
584
/* End of draw_box() */
 
585
 
 
586
 
 
587
#ifdef HAVE_NCURSES
 
588
/*
 
589
 * Draw shadows along the right and bottom edge to give a more 3D look
 
590
 * to the boxes
 
591
 */
 
592
void draw_shadow(WINDOW *win, int y, int x, int height, int width)
 
593
{
 
594
  int i;
 
595
 
 
596
  if (has_colors()) {    /* Whether terminal supports color? */
 
597
    wattrset(win, shadow_attr);
 
598
    wmove(win, y + height, x + 2);
 
599
    for (i = 0; i < width; i++)
 
600
      waddch(win, winch(win) & A_CHARTEXT);
 
601
    for (i = y + 1; i < y + height + 1; i++) {
 
602
      wmove(win, i, x + width);
 
603
      waddch(win, winch(win) & A_CHARTEXT);
 
604
      waddch(win, winch(win) & A_CHARTEXT);
 
605
    }
 
606
    wnoutrefresh(win);
 
607
  }
 
608
}
 
609
/* End of draw_shadow() */
 
610
#endif