Annotation of researchv10dc/630/man/src/p_man/man3/getwbuf.3r, revision 1.1.1.1

1.1       root        1: .ds ZZ DEVELOPMENT PACKAGE
                      2: .TH GETWBUF 3R "630 MTG"
                      3: .XE "getwbuf()"
                      4: .XE "putwbuf()"
                      5: .SH NAME
                      6: getwbuf, putwbuf, Wbufsize \- access the 630 MTG default terminal emulator buffer
                      7: .SH SYNOPSIS
                      8: .B int getwbuf (buf, size)
                      9: .sp
                     10: .B int putwbuf (buf, size)
                     11: .sp
                     12: .B char \(**buf;
                     13: .br
                     14: .B int size;
                     15: .sp
                     16: .B int Wbufsize;
                     17: .SH DESCRIPTION
                     18: These functions give access to the global
                     19: text buffer used by the 630 MTG default terminal emulator to hold the last cut, sent
                     20: or saved text.
                     21: They offer the ability for cut-and-paste communication between the 
                     22: default terminal emulator and user's
                     23: applications.
                     24: .PP
                     25: The
                     26: .I getwbuf
                     27: function reads from the global text buffer.
                     28: Up to
                     29: .I size
                     30: bytes are copied into the buffer pointed
                     31: to by
                     32: .IR buf .
                     33: The actual number of bytes copied is returned.
                     34: .PP
                     35: The
                     36: .I putwbuf
                     37: function writes from the character buffer pointed to by
                     38: .I buf
                     39: into the global text buffer.
                     40: The number of bytes copied is returned.
                     41: The previous content of the global text buffer is thrown away.
                     42: .PP
                     43: The global variable
                     44: .I Wbufsize
                     45: is the current number of characters in the global buffer used by
                     46: .I getwbuf
                     47: and
                     48: .IR putwbuf .
                     49: .SH EXAMPLE
                     50: The following example is a function that takes the global text buffer and
                     51: converts every 8 continuous spaces into a tab.
                     52: .sp
                     53: .nf
                     54: .RS 3
                     55: .ft CM
                     56: tabexpand()
                     57: {
                     58:    char buf1[120];
                     59:    char buf2[120];
                     60:    int i,j,k,space;
                     61: 
                     62:    k = 0;
                     63:    space = 0;
                     64:    i = getwbuf(buf1, 120);
                     65:    for(j=0; j<i; ++j)
                     66:    {
                     67:       buf2[k] = buf1[j];
                     68:       if(buf2[k] == ' ')
                     69:          space++;
                     70:       else
                     71:          space = 0;
                     72:       if(space == 8)
                     73:       {  
                     74:          k -= 7;
                     75:          buf2[k] = '\\t';
                     76:          space = 0;
                     77:       }
                     78:       ++k;
                     79:    }
                     80:    putwbuf(buf2, k);
                     81: }
                     82: .fi
                     83: .RE
                     84: .ft R

unix.superglobalmegacorp.com

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