|
|
1.1 root 1: .ds ZZ DEVELOPMENT PACKAGE
2: .TH SENDCHAR 3R "630 MTG"
3: .XE "sendchar()"
4: .XE "sendnchars()"
5: .SH NAME
6: sendchar, sendnchars \- send character(s) to host
7: .SH SYNOPSIS
8: \f3
9: int sendchar (c)
10: .br
11: char c;
12: .sp
13: void sendnchars (n, p)
14: .br
15: int n;
16: .br
17: char \(**p;
18: \fR
19: .SH DESCRIPTION
20: The
21: .I sendchar
22: function
23: sends a single byte to the host
24: which will normally be read on the standard input of the host process.
25: The bytes sent will be processed as though they were typed on the
26: keyboard by the user.
27: .PP
28: Since local programs have no host connection, a call to
29: .I sendchar
30: by a local program will always return -1.
31: Sendchar will always return 1 for non-local programs.
32: .PP
33: The
34: .I sendnchars
35: function is similar to
36: .I sendchar
37: except
38: .I n
39: characters pointed to by
40: .I p
41: are sent to the host.
42: .PP
43: A call to
44: .I sendchar
45: or
46: .I sendnchars
47: by an application program causes the bytes to be sent to the host computer to
48: be placed into a buffer in the terminal. The terminal will then send the bytes
49: in the buffer to the host as fast
50: as the communication line to the host is able to transmit.
51: An application program is generally able to queue requests to
52: send bytes to the host much faster than the terminal is able
53: to actually send the bytes over the communication line to the host.
54: So, if an application rapidly sends many bytes to the host,
55: internal terminal buffers eventually fill up. When this happens,
56: the
57: .I sendchar
58: and
59: .I sendnchars
60: routines will call
61: .I wait
62: to block the calling process until internal buffers are no longer full.
63: This whole process is transparent to applications, but application program
64: writers may want to be aware that a call to
65: .I sendchar
66: or
67: .I sendnchars
68: may not return immediately.
69: .SH EXAMPLE
70: The following program will send a
71: .I ls
72: command to the host and display its output.
73: Typing a 'q' on the keyboard will cause the program to exit.
74: .PP
75: .RS 3
76: .nf
77: .ft CM
78: #include <dmd.h>
79:
80: main()
81: {
82: int c;
83:
84: request(SEND|RCV|KBD);
85: sendnchars(3, "ls\er");
86: do {
87: wait(RCV|KBD);
88: while( (c=rcvchar()) != -1 )
89: lputchar(c);
90: } while(kbdchar() != 'q');
91: }
92: \fR
93: .fi
94: .RE
95: .SH SEE ALSO
96: local(3R), rcvchar(3R), resources(3R).
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.