1: #include <sys/file.h>
2: #include "config.h"
3: #include "sh.h"
4:
5: char *efilname = "/etc/tcsh6.00strgs" ;
6:
7: void
8: mkprintf(a1,a2,a3,a4)
9: int a1;
10: int a2, a3, a4;
11: {
12: char buf[256];
13: int efil = -1;
14:
15: /* better not assume same file descriptor each time
16: static int efil = -1;
17: if (efil < 0) {
18: efil = open(efilname, O_RDONLY);
19: if (efil < 0) {
20: perror(efilname);
21: exit(2);
22: }
23: }
24: */
25: efil = open(efilname, O_RDONLY);
26: if (efil < 0) {
27: perror(efilname);
28: exit(2);
29: }
30: if (lseek(efil, (long)a1,0) == -1) {
31: printf("lseek of mkstr file failed\n");
32: perror(efilname);
33: exit(2);
34: }
35: if (read(efil, buf, 256) <= 0) {
36: printf("read of mkstr file failed\n");
37: perror(efilname);
38: exit(2);
39: }
40: close(efil);
41: xprintf(buf, a2, a3, a4);
42: }
Defined functions
Defined variables