File: fileops.h

package info (click to toggle)
parchive 1.1-4.1
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 260 kB
  • ctags: 341
  • sloc: ansic: 3,895; makefile: 55
file content (65 lines) | stat: -rw-r--r-- 1,489 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*\
|*|  Parity Archive - A way to restore missing files in a set.
|*|
|*|  Copyright (C) 2001  Willem Monsuwe (willem@stack.nl)
|*|
|*|  File operations, in a separate file because these are probably
|*|   going to cause the most portability problems.
\*/

#ifndef FILEOPS_H
#define FILEOPS_H

#define DIR_SEP '/'

#include <sys/types.h>
#include <stdlib.h>
#include <stdio.h>
#include "types.h"

struct hfile_s {
	hfile_t *next;
	md5 hash_16k;
	md5 hash;
	i64 file_size;
	i64 magic;
	u16 *filename;
	char *dir;
	u8 hashed;
};

struct file_s {
	file_t next;
	FILE *f;
	char *name;
	i64 off, s_off;
	int wr;
};

#define HASH16K 1
#define HASH 2

void unistr(const char *str, u16 *buf);
u16 *make_uni_str(const char *str);
char *stuni(const u16 *str);
u16 *unist(const char *str);
char *stmd5(const md5 hash);
i64 uni_copy(u16 *dst, u16 *src, i64 n);
u16 * unicode_copy(u16 *str);
int file_rename(u16 *src, u16 *dst);
file_t file_open(const u16 *path, int wr);
file_t file_open_ascii(const char *path, int wr);
int file_close(file_t f);
int file_exists(u16 *file);
int file_delete(u16 *file);
int file_seek(file_t f, i64 off);
i64 file_md5(u16 *file, md5 block);
int file_md5_buffer(u16 *file, md5 block, u8 *buf, i64 size);
int file_add_md5(file_t f, i64 md5off, i64 off, i64 len);
int file_get_md5(file_t f, i64 off, md5 block);
char * complete_path(char *path);
hfile_t *read_dir(char *dir);
i64 file_read(file_t f, void *buf, i64 n);
i64 file_write(file_t f, void *buf, i64 n);

#endif