1*6670Smckusick /* freeze.c 4.1 82/05/07 */ 2*6670Smckusick 3*6670Smckusick #include "stdio.h" 4*6670Smckusick freeze(s) char *s; 5*6670Smckusick { int fd; 6*6670Smckusick unsigned int *len; 7*6670Smckusick len = (unsigned int *)sbrk(0); 8*6670Smckusick if((fd = creat(s, 0666)) < 0) { 9*6670Smckusick perror(s); 10*6670Smckusick return(1); 11*6670Smckusick } 12*6670Smckusick write(fd, &len, sizeof(len)); 13*6670Smckusick write(fd, (char *)0, len); 14*6670Smckusick close(fd); 15*6670Smckusick return(0); 16*6670Smckusick } 17*6670Smckusick 18*6670Smckusick thaw(s) char *s; 19*6670Smckusick { int fd; 20*6670Smckusick unsigned int *len; 21*6670Smckusick if(*s == 0) { 22*6670Smckusick fprintf(stderr, "empty restore file\n"); 23*6670Smckusick return(1); 24*6670Smckusick } 25*6670Smckusick if((fd = open(s, 0)) < 0) { 26*6670Smckusick perror(s); 27*6670Smckusick return(1); 28*6670Smckusick } 29*6670Smckusick read(fd, &len, sizeof(len)); 30*6670Smckusick (void) brk(len); 31*6670Smckusick read(fd, (char *)0, len); 32*6670Smckusick close(fd); 33*6670Smckusick return(0); 34*6670Smckusick } 35