summaryrefslogtreecommitdiff
path: root/lib/oldheader.h
blob: 087c4976ee0988cce17ece804cbeb51504c8e052 (plain)
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
#ifndef H_HEADER
#define H_HEADER

#include <stdio.h>

struct oldrpmFileInfo {
    char * path;
    int state;
    unsigned short mode;
    unsigned short uid;
    unsigned short gid;
    unsigned short rdev;
    unsigned long size;
    unsigned long mtime;
    char md5[32];
    char * linkto;
    int isconf;
    int isdoc;
} ;

void oldrpmfileFromSpecLine(char * str, struct oldrpmFileInfo * fi);
void oldrpmfileFromInfoLine(char * path, char * state, char * str, 
			struct oldrpmFileInfo * fi);
void oldrpmfileFree(struct oldrpmFileInfo * fi);
char * oldrpmfileToInfoStr(struct oldrpmFileInfo * fi);

struct oldrpmHeader {
    unsigned short type, cpu;
    unsigned int size;
    unsigned int os;
    unsigned int iconLength;

    char * name, * version, * release, * group;
    char * icon;

    unsigned int specLength;
    char * spec;
} ;

struct oldrpmHeaderSpec {
    char * description;
    char * vendor;
    char * distribution;
    char * buildHost;
    char * copyright;
    char * prein, * postin, * preun, * postun;

    int buildTime;

    int fileCount;
    struct oldrpmFileInfo * files;
} ;

char * oldhdrReadFromStream(int fd, struct oldrpmHeader * header);
char * oldhdrReadFromFile(char * filename, struct oldrpmHeader * header);
char * oldhdrParseSpec(struct oldrpmHeader * header, struct oldrpmHeaderSpec * spec);
void   oldhdrFree(struct oldrpmHeader * header);
void   oldhdrSpecFree(struct oldrpmHeaderSpec * spec);

#endif