|
|
1.1 root 1: /*-----------------------------------------------------------------------------
2: Talking BIOS device driver for the AT&T PC6300.
3: Copyright (C) Karl Dahlke 1987
4: This software may be freely used and distributed
5: for any non-profit purpose.
6: *-----------------------------------------------------------------------------
7: */
8:
9: /* savebuf.c: save the accumulated text in a session file */
10:
11: #include <stdio.h>
12:
13: extern errno;
14:
15: char *filename = "session.log";
16:
17: setenv(){} /* no environment */
18:
19: main(argc, argv)
20: int argc;
21: char **argv;
22: {
23: FILE *f;
24: register char c;
25:
26: if(argc > 1) filename = argv[1];
27: if(argc > 2) {
28: fprintf(stderr, "usage: savebuf [file]\n");
29: exit(1);
30: }
31:
32: f = fopen(filename, "w");
33: if(!f) {
34: fprintf(stderr, "savebuf: cannot create file %s\n", filename);
35: exit(1);
36: }
37:
38: while(1) {
39: c = getch();
40: if(c == '\32') break;
41: if(c == '\r') c = '\n';
42: putc(c, f);
43: }
44:
45: putc('\n', f);
46: } /* main */
47:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.