Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 874963 | Differences between
and this patch

Collapse All | Expand All

(-)cdb-0.75-orig/alloc.c (-2 / +1 lines)
Lines 1-7 Link Here
1
#include <stdlib.h>
1
#include "alloc.h"
2
#include "alloc.h"
2
#include "error.h"
3
#include "error.h"
3
extern char *malloc();
4
extern void free();
5
4
6
#define ALIGNMENT 16 /* XXX: assuming that this alignment is enough */
5
#define ALIGNMENT 16 /* XXX: assuming that this alignment is enough */
7
#define SPACE 4096 /* must be multiple of ALIGNMENT */
6
#define SPACE 4096 /* must be multiple of ALIGNMENT */
(-)cdb-0.75-orig/auto-str.c (-9 / +9 lines)
Lines 1-17 Link Here
1
#include <stdio.h>
1
#include "buffer.h"
2
#include "buffer.h"
2
#include "readwrite.h"
3
#include "exit.h"
3
#include "exit.h"
4
4
5
char buf1[256];
5
char buf1[256];
6
buffer ss1 = BUFFER_INIT(write,1,buf1,sizeof(buf1));
6
buffer ss1 = BUFFER_INIT(write,1,buf1,sizeof(buf1));
7
7
8
void puts(s)
8
void puts_djb(s)
9
char *s;
9
char *s;
10
{
10
{
11
  if (buffer_puts(&ss1,s) == -1) _exit(111);
11
  if (buffer_puts(&ss1,s) == -1) _exit(111);
12
}
12
}
13
13
14
main(argc,argv)
14
void main(argc,argv)
15
int argc;
15
int argc;
16
char **argv;
16
char **argv;
17
{
17
{
Lines 25-44 Link Here
25
  value = argv[2];
25
  value = argv[2];
26
  if (!value) _exit(100);
26
  if (!value) _exit(100);
27
27
28
  puts("char ");
28
  puts_djb("char ");
29
  puts(name);
29
  puts_djb(name);
30
  puts("[] = \"\\\n");
30
  puts_djb("[] = \"\\\n");
31
31
32
  while (ch = *value++) {
32
  while (ch = *value++) {
33
    puts("\\");
33
    puts_djb("\\");
34
    octal[3] = 0;
34
    octal[3] = 0;
35
    octal[2] = '0' + (ch & 7); ch >>= 3;
35
    octal[2] = '0' + (ch & 7); ch >>= 3;
36
    octal[1] = '0' + (ch & 7); ch >>= 3;
36
    octal[1] = '0' + (ch & 7); ch >>= 3;
37
    octal[0] = '0' + (ch & 7);
37
    octal[0] = '0' + (ch & 7);
38
    puts(octal);
38
    puts_djb(octal);
39
  }
39
  }
40
40
41
  puts("\\\n\";\n");
41
  puts_djb("\\\n\";\n");
42
  if (buffer_flush(&ss1) == -1) _exit(111);
42
  if (buffer_flush(&ss1) == -1) _exit(111);
43
  _exit(0);
43
  _exit(0);
44
}
44
}
(-)cdb-0.75-orig/buffer_0.c (-1 lines)
Lines 1-4 Link Here
1
#include "readwrite.h"
2
#include "buffer.h"
1
#include "buffer.h"
3
2
4
int buffer_0_read(fd,buf,len) int fd; char *buf; int len;
3
int buffer_0_read(fd,buf,len) int fd; char *buf; int len;
(-)cdb-0.75-orig/buffer_1.c (-1 lines)
Lines 1-4 Link Here
1
#include "readwrite.h"
2
#include "buffer.h"
1
#include "buffer.h"
3
2
4
char buffer_1_space[BUFFER_OUTSIZE];
3
char buffer_1_space[BUFFER_OUTSIZE];
(-)cdb-0.75-orig/buffer_1s.c (-1 lines)
Lines 1-4 Link Here
1
#include "readwrite.h"
2
#include "buffer.h"
1
#include "buffer.h"
3
2
4
char buffer_1small_space[256];
3
char buffer_1small_space[256];
(-)cdb-0.75-orig/buffer_2.c (-1 lines)
Lines 1-4 Link Here
1
#include "readwrite.h"
2
#include "buffer.h"
1
#include "buffer.h"
3
2
4
char buffer_2_space[256];
3
char buffer_2_space[256];
(-)cdb-0.75-orig/buffer.c (-1 / +1 lines)
Lines 1-6 Link Here
1
#include "buffer.h"
1
#include "buffer.h"
2
2
3
void buffer_init(buffer *s,int (*op)(),int fd,char *buf,unsigned int len)
3
void buffer_init(buffer *s,ssize_t (*op)(),int fd,char *buf,unsigned int len)
4
{
4
{
5
  s->x = buf;
5
  s->x = buf;
6
  s->fd = fd;
6
  s->fd = fd;
(-)cdb-0.75-orig/buffer_get.c (-2 / +2 lines)
Lines 2-10 Link Here
2
#include "byte.h"
2
#include "byte.h"
3
#include "error.h"
3
#include "error.h"
4
4
5
static int oneread(int (*op)(),int fd,char *buf,unsigned int len)
5
static int oneread(long int (*op)(),int fd,char *buf,unsigned int len)
6
{
6
{
7
  int r;
7
  long int r;
8
8
9
  for (;;) {
9
  for (;;) {
10
    r = op(fd,buf,len);
10
    r = op(fd,buf,len);
(-)cdb-0.75-orig/buffer.h (-3 / +5 lines)
Lines 1-19 Link Here
1
#ifndef BUFFER_H
1
#ifndef BUFFER_H
2
#define BUFFER_H
2
#define BUFFER_H
3
3
4
#include <unistd.h>
5
4
typedef struct buffer {
6
typedef struct buffer {
5
  char *x;
7
  char *x;
6
  unsigned int p;
8
  unsigned int p;
7
  unsigned int n;
9
  unsigned int n;
8
  int fd;
10
  int fd;
9
  int (*op)();
11
  ssize_t (*op)();
10
} buffer;
12
} buffer;
11
13
12
#define BUFFER_INIT(op,fd,buf,len) { (buf), 0, (len), (fd), (op) }
14
#define BUFFER_INIT(op,fd,buf,len) { (buf), 0, (len), (fd), (long(*)())(op) }
13
#define BUFFER_INSIZE 8192
15
#define BUFFER_INSIZE 8192
14
#define BUFFER_OUTSIZE 8192
16
#define BUFFER_OUTSIZE 8192
15
17
16
extern void buffer_init(buffer *,int (*)(),int,char *,unsigned int);
18
extern void buffer_init(buffer *,ssize_t (*)(),int,char *,unsigned int);
17
19
18
extern int buffer_flush(buffer *);
20
extern int buffer_flush(buffer *);
19
extern int buffer_put(buffer *,char *,unsigned int);
21
extern int buffer_put(buffer *,char *,unsigned int);
(-)cdb-0.75-orig/buffer_put.c (-2 / +2 lines)
Lines 3-11 Link Here
3
#include "byte.h"
3
#include "byte.h"
4
#include "error.h"
4
#include "error.h"
5
5
6
static int allwrite(int (*op)(),int fd,char *buf,unsigned int len)
6
static int allwrite(long int (*op)(),int fd,char *buf,unsigned int len)
7
{
7
{
8
  int w;
8
  long int w;
9
9
10
  while (len) {
10
  while (len) {
11
    w = op(fd,buf,len);
11
    w = op(fd,buf,len);
(-)cdb-0.75-orig/cdb.c (-1 lines)
Lines 3-9 Link Here
3
#include <sys/types.h>
3
#include <sys/types.h>
4
#include <sys/stat.h>
4
#include <sys/stat.h>
5
#include <sys/mman.h>
5
#include <sys/mman.h>
6
#include "readwrite.h"
7
#include "error.h"
6
#include "error.h"
8
#include "seek.h"
7
#include "seek.h"
9
#include "byte.h"
8
#include "byte.h"
(-)cdb-0.75-orig/cdbdump.c (-1 / +1 lines)
Lines 58-64 Link Here
58
58
59
char strnum[FMT_ULONG];
59
char strnum[FMT_ULONG];
60
60
61
main()
61
void main()
62
{
62
{
63
  uint32 eod;
63
  uint32 eod;
64
  uint32 klen;
64
  uint32 klen;
(-)cdb-0.75-orig/cdbget.c (-1 / +1 lines)
Lines 23-29 Link Here
23
static struct cdb c;
23
static struct cdb c;
24
char buf[1024];
24
char buf[1024];
25
25
26
main(int argc,char **argv)
26
void main(int argc,char **argv)
27
{
27
{
28
  char *key;
28
  char *key;
29
  int r;
29
  int r;
(-)cdb-0.75-orig/cdb.h (+1 lines)
Lines 3-8 Link Here
3
#ifndef CDB_H
3
#ifndef CDB_H
4
#define CDB_H
4
#define CDB_H
5
5
6
#include <unistd.h>
6
#include "uint32.h"
7
#include "uint32.h"
7
8
8
#define CDB_HASHSTART 5381
9
#define CDB_HASHSTART 5381
(-)cdb-0.75-orig/cdb_make.c (-1 lines)
Lines 1-6 Link Here
1
/* Public domain. */
1
/* Public domain. */
2
2
3
#include "readwrite.h"
4
#include "seek.h"
3
#include "seek.h"
5
#include "error.h"
4
#include "error.h"
6
#include "alloc.h"
5
#include "alloc.h"
(-)cdb-0.75-orig/cdbmake.c (-1 / +1 lines)
Lines 36-42 Link Here
36
36
37
static struct cdb_make c;
37
static struct cdb_make c;
38
38
39
main(int argc,char **argv)
39
void main(int argc,char **argv)
40
{
40
{
41
  unsigned int klen;
41
  unsigned int klen;
42
  unsigned int dlen;
42
  unsigned int dlen;
(-)cdb-0.75-orig/cdb_make.h (+1 lines)
Lines 3-8 Link Here
3
#ifndef CDB_MAKE_H
3
#ifndef CDB_MAKE_H
4
#define CDB_MAKE_H
4
#define CDB_MAKE_H
5
5
6
#include <stdio.h>
6
#include "buffer.h"
7
#include "buffer.h"
7
#include "uint32.h"
8
#include "uint32.h"
8
9
(-)cdb-0.75-orig/cdbstats.c (-1 / +2 lines)
Lines 3-8 Link Here
3
#include "buffer.h"
3
#include "buffer.h"
4
#include "strerr.h"
4
#include "strerr.h"
5
#include "seek.h"
5
#include "seek.h"
6
#include "str.h"
6
#include "cdb.h"
7
#include "cdb.h"
7
8
8
#define FATAL "cdbstats: fatal: "
9
#define FATAL "cdbstats: fatal: "
Lines 68-74 Link Here
68
static unsigned long numrecords;
69
static unsigned long numrecords;
69
static unsigned long numd[11];
70
static unsigned long numd[11];
70
71
71
main()
72
void main()
72
{
73
{
73
  uint32 eod;
74
  uint32 eod;
74
  uint32 klen;
75
  uint32 klen;
(-)cdb-0.75-orig/cdbtest.c (-1 / +2 lines)
Lines 3-8 Link Here
3
#include "buffer.h"
3
#include "buffer.h"
4
#include "strerr.h"
4
#include "strerr.h"
5
#include "seek.h"
5
#include "seek.h"
6
#include "str.h"
6
#include "cdb.h"
7
#include "cdb.h"
7
8
8
#define FATAL "cdbtest: fatal: "
9
#define FATAL "cdbtest: fatal: "
Lines 66-72 Link Here
66
67
67
static struct cdb c;
68
static struct cdb c;
68
69
69
main()
70
void main()
70
{
71
{
71
  uint32 eod;
72
  uint32 eod;
72
  uint32 klen;
73
  uint32 klen;
(-)cdb-0.75-orig/FILES (-1 / +1 lines)
Lines 55-66 Link Here
55
fmt.h
55
fmt.h
56
fmt_ulong.c
56
fmt_ulong.c
57
hier.c
57
hier.c
58
hier.h
58
install.c
59
install.c
59
instcheck.c
60
instcheck.c
60
open.h
61
open.h
61
open_read.c
62
open_read.c
62
open_trunc.c
63
open_trunc.c
63
readwrite.h
64
scan.h
64
scan.h
65
scan_ulong.c
65
scan_ulong.c
66
seek.h
66
seek.h
(-)cdb-0.75-orig/hier.c (+1 lines)
Lines 1-4 Link Here
1
#include "auto_home.h"
1
#include "auto_home.h"
2
#include "hier.h"
2
3
3
void hier()
4
void hier()
4
{
5
{
(-)cdb-0.75-orig/hier.h (+8 lines)
Line 0 Link Here
1
#ifndef HIER_H
2
#define HIER_H
3
4
void h(char *home,int uid,int gid,int mode);
5
void d(char *home,char *subdir,int uid,int gid,int mode);
6
void c(char *home,char *subdir,char *file,int uid,int gid,int mode);
7
8
#endif
(-)cdb-0.75-orig/install.c (-2 / +2 lines)
Lines 1-8 Link Here
1
#include <sys/stat.h>
1
#include "buffer.h"
2
#include "buffer.h"
2
#include "strerr.h"
3
#include "strerr.h"
3
#include "error.h"
4
#include "error.h"
4
#include "open.h"
5
#include "open.h"
5
#include "readwrite.h"
6
#include "exit.h"
6
#include "exit.h"
7
7
8
extern void hier();
8
extern void hier();
Lines 137-143 Link Here
137
    strerr_die6sys(111,FATAL,"unable to chmod .../",subdir,"/",file,": ");
137
    strerr_die6sys(111,FATAL,"unable to chmod .../",subdir,"/",file,": ");
138
}
138
}
139
139
140
main()
140
void main()
141
{
141
{
142
  fdsourcedir = open_read(".");
142
  fdsourcedir = open_read(".");
143
  if (fdsourcedir == -1)
143
  if (fdsourcedir == -1)
(-)cdb-0.75-orig/instcheck.c (-2 / +2 lines)
Lines 1-8 Link Here
1
#include <sys/types.h>
1
#include <sys/types.h>
2
#include <sys/stat.h>
2
#include <sys/stat.h>
3
#include <unistd.h>
3
#include "strerr.h"
4
#include "strerr.h"
4
#include "error.h"
5
#include "error.h"
5
#include "readwrite.h"
6
#include "exit.h"
6
#include "exit.h"
7
7
8
extern void hier();
8
extern void hier();
Lines 101-107 Link Here
101
  perm("",home,"/",file,S_IFREG,uid,gid,mode);
101
  perm("",home,"/",file,S_IFREG,uid,gid,mode);
102
}
102
}
103
103
104
main()
104
void main()
105
{
105
{
106
  hier();
106
  hier();
107
  _exit(0);
107
  _exit(0);
(-)cdb-0.75-orig/Makefile (-10 / +10 lines)
Lines 17-23 Link Here
17
	./load auto-str buffer.a unix.a byte.a 
17
	./load auto-str buffer.a unix.a byte.a 
18
18
19
auto-str.o: \
19
auto-str.o: \
20
compile auto-str.c buffer.h readwrite.h exit.h
20
compile auto-str.c buffer.h exit.h
21
	./compile auto-str.c
21
	./compile auto-str.c
22
22
23
auto_home.c: \
23
auto_home.c: \
Lines 40-58 Link Here
40
	./compile buffer.c
40
	./compile buffer.c
41
41
42
buffer_0.o: \
42
buffer_0.o: \
43
compile buffer_0.c readwrite.h buffer.h
43
compile buffer_0.c buffer.h
44
	./compile buffer_0.c
44
	./compile buffer_0.c
45
45
46
buffer_1.o: \
46
buffer_1.o: \
47
compile buffer_1.c readwrite.h buffer.h
47
compile buffer_1.c buffer.h
48
	./compile buffer_1.c
48
	./compile buffer_1.c
49
49
50
buffer_1s.o: \
50
buffer_1s.o: \
51
compile buffer_1s.c readwrite.h buffer.h
51
compile buffer_1s.c buffer.h
52
	./compile buffer_1s.c
52
	./compile buffer_1s.c
53
53
54
buffer_2.o: \
54
buffer_2.o: \
55
compile buffer_2.c readwrite.h buffer.h
55
compile buffer_2.c buffer.h
56
	./compile buffer_2.c
56
	./compile buffer_2.c
57
57
58
buffer_copy.o: \
58
buffer_copy.o: \
Lines 91-97 Link Here
91
	./makelib cdb.a cdb.o cdb_hash.o cdb_make.o
91
	./makelib cdb.a cdb.o cdb_hash.o cdb_make.o
92
92
93
cdb.o: \
93
cdb.o: \
94
compile cdb.c readwrite.h error.h seek.h byte.h cdb.h uint32.h
94
compile cdb.c error.h seek.h byte.h cdb.h uint32.h
95
	./compile cdb.c
95
	./compile cdb.c
96
96
97
cdb_hash.o: \
97
cdb_hash.o: \
Lines 99-105 Link Here
99
	./compile cdb_hash.c
99
	./compile cdb_hash.c
100
100
101
cdb_make.o: \
101
cdb_make.o: \
102
compile cdb_make.c readwrite.h seek.h error.h alloc.h cdb.h uint32.h \
102
compile cdb_make.c seek.h error.h alloc.h cdb.h uint32.h \
103
cdb_make.h buffer.h uint32.h
103
cdb_make.h buffer.h uint32.h
104
	./compile cdb_make.c
104
	./compile cdb_make.c
105
105
Lines 184-190 Link Here
184
	./compile fmt_ulong.c
184
	./compile fmt_ulong.c
185
185
186
hier.o: \
186
hier.o: \
187
compile hier.c auto_home.h
187
compile hier.c hier.h auto_home.h
188
	./compile hier.c
188
	./compile hier.c
189
189
190
install: \
190
install: \
Lines 192-198 Link Here
192
	./load install hier.o auto_home.o buffer.a unix.a byte.a 
192
	./load install hier.o auto_home.o buffer.a unix.a byte.a 
193
193
194
install.o: \
194
install.o: \
195
compile install.c buffer.h strerr.h error.h open.h readwrite.h exit.h
195
compile install.c buffer.h strerr.h error.h open.h exit.h
196
	./compile install.c
196
	./compile install.c
197
197
198
instcheck: \
198
instcheck: \
Lines 200-206 Link Here
200
	./load instcheck hier.o auto_home.o buffer.a unix.a byte.a 
200
	./load instcheck hier.o auto_home.o buffer.a unix.a byte.a 
201
201
202
instcheck.o: \
202
instcheck.o: \
203
compile instcheck.c strerr.h error.h readwrite.h exit.h
203
compile instcheck.c strerr.h error.h exit.h
204
	./compile instcheck.c
204
	./compile instcheck.c
205
205
206
it: \
206
it: \
(-)cdb-0.75-orig/readwrite.h (-7 lines)
Lines 1-7 Link Here
1
#ifndef READWRITE_H
2
#define READWRITE_H
3
4
extern int read();
5
extern int write();
6
7
#endif
(-)cdb-0.75-orig/seek.h (+2 lines)
Lines 1-6 Link Here
1
#ifndef SEEK_H
1
#ifndef SEEK_H
2
#define SEEK_H
2
#define SEEK_H
3
3
4
#include <unistd.h>
5
4
typedef unsigned long seek_pos;
6
typedef unsigned long seek_pos;
5
7
6
extern seek_pos seek_cur(int);
8
extern seek_pos seek_cur(int);
(-)cdb-0.75-orig/testzero.c (-1 / +1 lines)
Lines 14-20 Link Here
14
static char data[65536];
14
static char data[65536];
15
struct cdb_make c;
15
struct cdb_make c;
16
16
17
main(int argc,char **argv)
17
void main(int argc,char **argv)
18
{
18
{
19
  int fd;
19
  int fd;
20
  unsigned long loop;
20
  unsigned long loop;

Return to bug 874963