|
|
1.1 root 1: #include "stdio.h"
2: freeze(s) char *s;
3: { int fd;
4: unsigned int *len;
5: len = (unsigned int *)sbrk(0);
6: if((fd = creat(s, 0666)) < 0) {
7: perror(s);
8: return(1);
9: }
10: write(fd, &len, sizeof(len));
11: write(fd, (char *)0, len);
12: close(fd);
13: return(0);
14: }
15:
16: thaw(s) char *s;
17: { int fd;
18: unsigned int *len;
19: if(*s == 0) {
20: fprintf(stderr, "empty restore file\n");
21: return(1);
22: }
23: if((fd = open(s, 0)) < 0) {
24: perror(s);
25: return(1);
26: }
27: read(fd, &len, sizeof(len));
28: (void) brk(len);
29: read(fd, (char *)0, len);
30: close(fd);
31: return(0);
32: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.