version 1.19, 2015/01/16 06:40:06 |
version 1.20, 2015/02/01 11:50:23 |
|
|
/* Secondary hash (after G. Knott). */ |
/* Secondary hash (after G. Knott). */ |
disp = zs->zs_hsize_reg - i; |
disp = zs->zs_hsize_reg - i; |
if (i == 0) |
if (i == 0) |
disp = 1; |
disp = 1; |
probe: if ((i -= disp) < 0) |
probe: if ((i -= disp) < 0) |
i += zs->zs_hsize_reg; |
i += zs->zs_hsize_reg; |
|
|
|
|
FILE * |
FILE * |
zopen(const char *name, const char *mode, int bits) |
zopen(const char *name, const char *mode, int bits) |
{ |
{ |
|
FILE *fp; |
int fd; |
int fd; |
void *cookie; |
void *cookie; |
if ((fd = open(name, (*mode=='r'? O_RDONLY:O_WRONLY|O_CREAT), |
if ((fd = open(name, (*mode=='r'? O_RDONLY:O_WRONLY|O_CREAT), |
|
|
close(fd); |
close(fd); |
return NULL; |
return NULL; |
} |
} |
return funopen(cookie, (*mode == 'r'?zread:NULL), |
if ((fp = funopen(cookie, (*mode == 'r'?zread:NULL), |
(*mode == 'w'?zwrite:NULL), NULL, zclose); |
(*mode == 'w'?zwrite:NULL), NULL, zclose)) == NULL) { |
|
close(fd); |
|
free(cookie); |
|
return NULL; |
|
} |
|
return fp; |
} |
} |
|
|
void * |
void * |