Annotation of coherent/g/usr/bin/vsh/winlib/editbox.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  *     Output edit box and edit input field
                      3:  *
                      4:  *      Copyright (c) 1990-93 by Udo Munk
                      5:  */
                      6: 
                      7: #ifdef AIX
                      8: #define NLS
                      9: #endif
                     10: 
                     11: #include <curses.h>
                     12: #include <string.h>
                     13:  
                     14: extern WINDOW *open_window();
                     15: extern int close_window();
                     16: extern int edit_field();
                     17: 
                     18: edit_box(t, s, n, e, fn)
                     19: char *t[], *s;
                     20: int n, e;
                     21: int (*fn) ();
                     22: {
                     23:        register int i, j;
                     24:        int bw, bh, nt;
                     25:        int ret;
                     26:        WINDOW *w;
                     27: 
                     28:        i = bh = 0;
                     29:        bw = n + 2;
                     30:        while (t[i] != NULL)
                     31:                if ((j = strlen(t[i++]) + 2) > bw)
                     32:                        bw = j; /* with of the box */
                     33:        bh = (i == 0) ? 3 : i + 4;
                     34:        nt = i;
                     35:        if ((w = open_window(bh, bw, (LINES-bh)/2, (COLS-bw)/2)) == (WINDOW *) 0)
                     36:                nomem();
                     37:        wattron(w, A_REVERSE);
                     38:        for (i = 0; i < bh; i++)/* output inverted box */
                     39:                for (j = 0; j < bw; j++)
                     40:                        mvwaddch(w, i, j, ' ');
                     41:        for (i = 0; i < nt; i++)
                     42:                mvwaddstr(w, i+1, 1, t[i]);
                     43:        wattroff(w, A_REVERSE);
                     44:        ret = edit_field(w, ((nt>0) ? nt+2 : nt+1), (bw-n)/2, s, n, e, fn);
                     45:        close_window(w);
                     46:        return(ret);
                     47: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.