Use ISO C99 / POSIX types. Should fix PR 40416.diff -r1.5 -r1.6 pkgsrc/pkgtools/mtree/files/compare.c
(joerg)
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: compare.c,v 1.5 2008/11/06 02:14:52 jschauma Exp $ */ | 1 | /* $NetBSD: compare.c,v 1.6 2010/03/21 16:30:17 joerg Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1989, 1993 | 4 | * Copyright (c) 1989, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -34,27 +34,27 @@ | @@ -34,27 +34,27 @@ | |||
34 | #endif | 34 | #endif | |
35 | #if HAVE_NBTOOL_CONFIG_H | 35 | #if HAVE_NBTOOL_CONFIG_H | |
36 | #include "nbtool_config.h" | 36 | #include "nbtool_config.h" | |
37 | #endif | 37 | #endif | |
38 | 38 | |||
39 | #include <nbcompat.h> | 39 | #include <nbcompat.h> | |
40 | #if HAVE_SYS_CDEFS_H | 40 | #if HAVE_SYS_CDEFS_H | |
41 | #include <sys/cdefs.h> | 41 | #include <sys/cdefs.h> | |
42 | #endif | 42 | #endif | |
43 | #if defined(__RCSID) && !defined(lint) | 43 | #if defined(__RCSID) && !defined(lint) | |
44 | #if 0 | 44 | #if 0 | |
45 | static char sccsid[] = "@(#)compare.c 8.1 (Berkeley) 6/6/93"; | 45 | static char sccsid[] = "@(#)compare.c 8.1 (Berkeley) 6/6/93"; | |
46 | #else | 46 | #else | |
47 | __RCSID("$NetBSD: compare.c,v 1.5 2008/11/06 02:14:52 jschauma Exp $"); | 47 | __RCSID("$NetBSD: compare.c,v 1.6 2010/03/21 16:30:17 joerg Exp $"); | |
48 | #endif | 48 | #endif | |
49 | #endif /* not lint */ | 49 | #endif /* not lint */ | |
50 | 50 | |||
51 | #if HAVE_SYS_PARAM_H | 51 | #if HAVE_SYS_PARAM_H | |
52 | #include <sys/param.h> | 52 | #include <sys/param.h> | |
53 | #endif | 53 | #endif | |
54 | 54 | |||
55 | #if HAVE_ERRNO_H | 55 | #if HAVE_ERRNO_H | |
56 | #include <errno.h> | 56 | #include <errno.h> | |
57 | #endif | 57 | #endif | |
58 | #if HAVE_FCNTL_H | 58 | #if HAVE_FCNTL_H | |
59 | #include <fcntl.h> | 59 | #include <fcntl.h> | |
60 | #endif | 60 | #endif | |
@@ -141,27 +141,27 @@ do { \ | @@ -141,27 +141,27 @@ do { \ | |||
141 | * given pflags, reset the flags specified in s->st_flags and selected by mask | 141 | * given pflags, reset the flags specified in s->st_flags and selected by mask | |
142 | * (the other flags are left unchanged). | 142 | * (the other flags are left unchanged). | |
143 | */ | 143 | */ | |
144 | #define CLEARFLAGS(pflags, mask) \ | 144 | #define CLEARFLAGS(pflags, mask) \ | |
145 | do { \ | 145 | do { \ | |
146 | flags = (~(s->st_flags & (mask)) & CH_MASK) & (pflags); \ | 146 | flags = (~(s->st_flags & (mask)) & CH_MASK) & (pflags); \ | |
147 | CHANGEFLAGS; \ | 147 | CHANGEFLAGS; \ | |
148 | } while (0) | 148 | } while (0) | |
149 | #endif /* HAVE_STRUCT_STAT_ST_FLAGS */ | 149 | #endif /* HAVE_STRUCT_STAT_ST_FLAGS */ | |
150 | 150 | |||
151 | int | 151 | int | |
152 | compare(NODE *s, FTSENT *p) | 152 | compare(NODE *s, FTSENT *p) | |
153 | { | 153 | { | |
154 | u_int32_t len, val, flags; | 154 | uint32_t len, val, flags; | |
155 | int fd, label; | 155 | int fd, label; | |
156 | const char *cp, *tab; | 156 | const char *cp, *tab; | |
157 | #if !defined(NO_MD5) || !defined(NO_RMD160) || !defined(NO_SHA1) || !defined(NO_SHA2) | 157 | #if !defined(NO_MD5) || !defined(NO_RMD160) || !defined(NO_SHA1) || !defined(NO_SHA2) | |
158 | char digestbuf[MAXHASHLEN + 1]; | 158 | char digestbuf[MAXHASHLEN + 1]; | |
159 | #endif | 159 | #endif | |
160 | 160 | |||
161 | tab = NULL; | 161 | tab = NULL; | |
162 | label = 0; | 162 | label = 0; | |
163 | switch(s->type) { | 163 | switch(s->type) { | |
164 | case F_BLOCK: | 164 | case F_BLOCK: | |
165 | if (!S_ISBLK(p->fts_statp->st_mode)) | 165 | if (!S_ISBLK(p->fts_statp->st_mode)) | |
166 | goto typeerr; | 166 | goto typeerr; | |
167 | break; | 167 | break; |
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: verify.c,v 1.5 2008/11/06 02:14:52 jschauma Exp $ */ | 1 | /* $NetBSD: verify.c,v 1.6 2010/03/21 16:30:17 joerg Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1990, 1993 | 4 | * Copyright (c) 1990, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -34,27 +34,27 @@ | @@ -34,27 +34,27 @@ | |||
34 | #endif | 34 | #endif | |
35 | #if HAVE_NBTOOL_CONFIG_H | 35 | #if HAVE_NBTOOL_CONFIG_H | |
36 | #include "nbtool_config.h" | 36 | #include "nbtool_config.h" | |
37 | #endif | 37 | #endif | |
38 | 38 | |||
39 | #include <nbcompat.h> | 39 | #include <nbcompat.h> | |
40 | #if HAVE_SYS_CDEFS_H | 40 | #if HAVE_SYS_CDEFS_H | |
41 | #include <sys/cdefs.h> | 41 | #include <sys/cdefs.h> | |
42 | #endif | 42 | #endif | |
43 | #if defined(__RCSID) && !defined(lint) | 43 | #if defined(__RCSID) && !defined(lint) | |
44 | #if 0 | 44 | #if 0 | |
45 | static char sccsid[] = "@(#)verify.c 8.1 (Berkeley) 6/6/93"; | 45 | static char sccsid[] = "@(#)verify.c 8.1 (Berkeley) 6/6/93"; | |
46 | #else | 46 | #else | |
47 | __RCSID("$NetBSD: verify.c,v 1.5 2008/11/06 02:14:52 jschauma Exp $"); | 47 | __RCSID("$NetBSD: verify.c,v 1.6 2010/03/21 16:30:17 joerg Exp $"); | |
48 | #endif | 48 | #endif | |
49 | #endif /* not lint */ | 49 | #endif /* not lint */ | |
50 | 50 | |||
51 | #if HAVE_SYS_PARAM_H | 51 | #if HAVE_SYS_PARAM_H | |
52 | #include <sys/param.h> | 52 | #include <sys/param.h> | |
53 | #endif | 53 | #endif | |
54 | #if HAVE_SYS_STAT_H | 54 | #if HAVE_SYS_STAT_H | |
55 | #include <sys/stat.h> | 55 | #include <sys/stat.h> | |
56 | #endif | 56 | #endif | |
57 | 57 | |||
58 | #if ! HAVE_NBTOOL_CONFIG_H | 58 | #if ! HAVE_NBTOOL_CONFIG_H | |
59 | #if HAVE_DIRENT_H | 59 | #if HAVE_DIRENT_H | |
60 | #include <dirent.h> | 60 | #include <dirent.h> | |
@@ -179,27 +179,27 @@ vwalk(void) | @@ -179,27 +179,27 @@ vwalk(void) | |||
179 | } | 179 | } | |
180 | fts_close(t); | 180 | fts_close(t); | |
181 | if (sflag) | 181 | if (sflag) | |
182 | warnx("%s checksum: %u", fullpath, crc_total); | 182 | warnx("%s checksum: %u", fullpath, crc_total); | |
183 | return (rval); | 183 | return (rval); | |
184 | } | 184 | } | |
185 | 185 | |||
186 | static void | 186 | static void | |
187 | miss(NODE *p, char *tail) | 187 | miss(NODE *p, char *tail) | |
188 | { | 188 | { | |
189 | int create; | 189 | int create; | |
190 | char *tp; | 190 | char *tp; | |
191 | const char *type; | 191 | const char *type; | |
192 | u_int32_t flags; | 192 | uint32_t flags; | |
193 | 193 | |||
194 | for (; p; p = p->next) { | 194 | for (; p; p = p->next) { | |
195 | if (p->flags & F_OPT && !(p->flags & F_VISIT)) | 195 | if (p->flags & F_OPT && !(p->flags & F_VISIT)) | |
196 | continue; | 196 | continue; | |
197 | if (p->type != F_DIR && (dflag || p->flags & F_VISIT)) | 197 | if (p->type != F_DIR && (dflag || p->flags & F_VISIT)) | |
198 | continue; | 198 | continue; | |
199 | strcpy(tail, p->name); | 199 | strcpy(tail, p->name); | |
200 | if (!(p->flags & F_VISIT)) | 200 | if (!(p->flags & F_VISIT)) | |
201 | printf("missing: %s", path); | 201 | printf("missing: %s", path); | |
202 | switch (p->type) { | 202 | switch (p->type) { | |
203 | case F_BLOCK: | 203 | case F_BLOCK: | |
204 | case F_CHAR: | 204 | case F_CHAR: | |
205 | type = "device"; | 205 | type = "device"; |
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: crc.c,v 1.4 2008/11/06 02:14:52 jschauma Exp $ */ | 1 | /* $NetBSD: crc.c,v 1.5 2010/03/21 16:30:17 joerg Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1991, 1993 | 4 | * Copyright (c) 1991, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to Berkeley by | 7 | * This code is derived from software contributed to Berkeley by | |
8 | * James W. Williams of NASA Goddard Space Flight Center. | 8 | * James W. Williams of NASA Goddard Space Flight Center. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -37,47 +37,47 @@ | @@ -37,47 +37,47 @@ | |||
37 | #endif | 37 | #endif | |
38 | #if HAVE_NBTOOL_CONFIG_H | 38 | #if HAVE_NBTOOL_CONFIG_H | |
39 | #include "nbtool_config.h" | 39 | #include "nbtool_config.h" | |
40 | #endif | 40 | #endif | |
41 | 41 | |||
42 | #include <nbcompat.h> | 42 | #include <nbcompat.h> | |
43 | #if HAVE_SYS_CDEFS_H | 43 | #if HAVE_SYS_CDEFS_H | |
44 | #include <sys/cdefs.h> | 44 | #include <sys/cdefs.h> | |
45 | #endif | 45 | #endif | |
46 | #if defined(__RCSID) && !defined(lint) | 46 | #if defined(__RCSID) && !defined(lint) | |
47 | #if 0 | 47 | #if 0 | |
48 | static char sccsid[] = "@(#)crc.c 8.1 (Berkeley) 6/17/93"; | 48 | static char sccsid[] = "@(#)crc.c 8.1 (Berkeley) 6/17/93"; | |
49 | #else | 49 | #else | |
50 | __RCSID("$NetBSD: crc.c,v 1.4 2008/11/06 02:14:52 jschauma Exp $"); | 50 | __RCSID("$NetBSD: crc.c,v 1.5 2010/03/21 16:30:17 joerg Exp $"); | |
51 | #endif | 51 | #endif | |
52 | #endif /* not lint */ | 52 | #endif /* not lint */ | |
53 | 53 | |||
54 | #if HAVE_SYS_TYPES_H | 54 | #if HAVE_SYS_TYPES_H | |
55 | #include <sys/types.h> | 55 | #include <sys/types.h> | |
56 | #endif | 56 | #endif | |
57 | 57 | |||
58 | #if HAVE_STDIO_H | 58 | #if HAVE_STDIO_H | |
59 | #include <stdio.h> | 59 | #include <stdio.h> | |
60 | #endif | 60 | #endif | |
61 | #if HAVE_TIME_H | 61 | #if HAVE_TIME_H | |
62 | #include <time.h> | 62 | #include <time.h> | |
63 | #endif | 63 | #endif | |
64 | #if HAVE_UNISTD_H | 64 | #if HAVE_UNISTD_H | |
65 | #include <unistd.h> | 65 | #include <unistd.h> | |
66 | #endif | 66 | #endif | |
67 | 67 | |||
68 | #include "extern.h" | 68 | #include "extern.h" | |
69 | 69 | |||
70 | static const u_int32_t crctab[] = { | 70 | static const uint32_t crctab[] = { | |
71 | 0x0, | 71 | 0x0, | |
72 | 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, | 72 | 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, | |
73 | 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, | 73 | 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, | |
74 | 0x2b4bcb61, 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, | 74 | 0x2b4bcb61, 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, | |
75 | 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9, 0x5f15adac, | 75 | 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9, 0x5f15adac, | |
76 | 0x5bd4b01b, 0x569796c2, 0x52568b75, 0x6a1936c8, 0x6ed82b7f, | 76 | 0x5bd4b01b, 0x569796c2, 0x52568b75, 0x6a1936c8, 0x6ed82b7f, | |
77 | 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, 0x709f7b7a, | 77 | 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, 0x709f7b7a, | |
78 | 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039, | 78 | 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039, | |
79 | 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, | 79 | 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, | |
80 | 0xbaea46ef, 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, | 80 | 0xbaea46ef, 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, | |
81 | 0xa4ad16ea, 0xa06c0b5d, 0xd4326d90, 0xd0f37027, 0xddb056fe, | 81 | 0xa4ad16ea, 0xa06c0b5d, 0xd4326d90, 0xd0f37027, 0xddb056fe, | |
82 | 0xd9714b49, 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95, | 82 | 0xd9714b49, 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95, | |
83 | 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, 0xe13ef6f4, | 83 | 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, 0xe13ef6f4, | |
@@ -119,35 +119,35 @@ static const u_int32_t crctab[] = { | @@ -119,35 +119,35 @@ static const u_int32_t crctab[] = { | |||
119 | 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, 0x89b8fd09, | 119 | 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, 0x89b8fd09, | |
120 | 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662, | 120 | 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662, | |
121 | 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, | 121 | 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, | |
122 | 0xa2f33668, 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 | 122 | 0xa2f33668, 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 | |
123 | }; | 123 | }; | |
124 | 124 | |||
125 | /* | 125 | /* | |
126 | * Compute a POSIX 1003.2 checksum. This routine has been broken out so that | 126 | * Compute a POSIX 1003.2 checksum. This routine has been broken out so that | |
127 | * other programs can use it. It takes a file descriptor to read from and | 127 | * other programs can use it. It takes a file descriptor to read from and | |
128 | * locations to store the crc and the number of bytes read. It returns 0 on | 128 | * locations to store the crc and the number of bytes read. It returns 0 on | |
129 | * success and 1 on failure. Errno is set on failure. | 129 | * success and 1 on failure. Errno is set on failure. | |
130 | */ | 130 | */ | |
131 | extern int sflag; | 131 | extern int sflag; | |
132 | u_int32_t crc_total = ~0; /* The crc over a number of files. */ | 132 | uint32_t crc_total = ~0; /* The crc over a number of files. */ | |
133 | 133 | |||
134 | int | 134 | int | |
135 | crc(int fd, u_int32_t *cval, u_int32_t *clen) | 135 | crc(int fd, uint32_t *cval, uint32_t *clen) | |
136 | { | 136 | { | |
137 | u_char *p; | 137 | u_char *p; | |
138 | int nr; | 138 | int nr; | |
139 | u_int32_t thecrc, len; | 139 | uint32_t thecrc, len; | |
140 | u_int32_t crctot; | 140 | uint32_t crctot; | |
141 | u_char buf[16 * 1024]; | 141 | u_char buf[16 * 1024]; | |
142 | 142 | |||
143 | #define COMPUTE(var, ch) (var) = (var) << 8 ^ crctab[(var) >> 24 ^ (ch)] | 143 | #define COMPUTE(var, ch) (var) = (var) << 8 ^ crctab[(var) >> 24 ^ (ch)] | |
144 | 144 | |||
145 | thecrc = len = crctot = 0; | 145 | thecrc = len = crctot = 0; | |
146 | if (sflag) | 146 | if (sflag) | |
147 | crctot = ~crc_total; | 147 | crctot = ~crc_total; | |
148 | while ((nr = read(fd, buf, sizeof(buf))) > 0) | 148 | while ((nr = read(fd, buf, sizeof(buf))) > 0) | |
149 | if (sflag) { | 149 | if (sflag) { | |
150 | for (len += nr, p = buf; nr--; ++p) { | 150 | for (len += nr, p = buf; nr--; ++p) { | |
151 | COMPUTE(thecrc, *p); | 151 | COMPUTE(thecrc, *p); | |
152 | COMPUTE(crctot, *p); | 152 | COMPUTE(crctot, *p); | |
153 | } | 153 | } |
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: create.c,v 1.6 2008/11/06 02:14:52 jschauma Exp $ */ | 1 | /* $NetBSD: create.c,v 1.7 2010/03/21 16:30:17 joerg Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1989, 1993 | 4 | * Copyright (c) 1989, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -34,27 +34,27 @@ | @@ -34,27 +34,27 @@ | |||
34 | #endif | 34 | #endif | |
35 | #if HAVE_NBTOOL_CONFIG_H | 35 | #if HAVE_NBTOOL_CONFIG_H | |
36 | #include "nbtool_config.h" | 36 | #include "nbtool_config.h" | |
37 | #endif | 37 | #endif | |
38 | 38 | |||
39 | #include <nbcompat.h> | 39 | #include <nbcompat.h> | |
40 | #if HAVE_SYS_CDEFS_H | 40 | #if HAVE_SYS_CDEFS_H | |
41 | #include <sys/cdefs.h> | 41 | #include <sys/cdefs.h> | |
42 | #endif | 42 | #endif | |
43 | #if defined(__RCSID) && !defined(lint) | 43 | #if defined(__RCSID) && !defined(lint) | |
44 | #if 0 | 44 | #if 0 | |
45 | static char sccsid[] = "@(#)create.c 8.1 (Berkeley) 6/6/93"; | 45 | static char sccsid[] = "@(#)create.c 8.1 (Berkeley) 6/6/93"; | |
46 | #else | 46 | #else | |
47 | __RCSID("$NetBSD: create.c,v 1.6 2008/11/06 02:14:52 jschauma Exp $"); | 47 | __RCSID("$NetBSD: create.c,v 1.7 2010/03/21 16:30:17 joerg Exp $"); | |
48 | #endif | 48 | #endif | |
49 | #endif /* not lint */ | 49 | #endif /* not lint */ | |
50 | 50 | |||
51 | #if HAVE_SYS_PARAM_H | 51 | #if HAVE_SYS_PARAM_H | |
52 | #include <sys/param.h> | 52 | #include <sys/param.h> | |
53 | #endif | 53 | #endif | |
54 | #if HAVE_SYS_STAT_H | 54 | #if HAVE_SYS_STAT_H | |
55 | #include <sys/stat.h> | 55 | #include <sys/stat.h> | |
56 | #endif | 56 | #endif | |
57 | 57 | |||
58 | #if ! HAVE_NBTOOL_CONFIG_H | 58 | #if ! HAVE_NBTOOL_CONFIG_H | |
59 | #if HAVE_DIRENT_H | 59 | #if HAVE_DIRENT_H | |
60 | #include <dirent.h> | 60 | #include <dirent.h> | |
@@ -176,27 +176,27 @@ cwalk(void) | @@ -176,27 +176,27 @@ cwalk(void) | |||
176 | statf(p); | 176 | statf(p); | |
177 | break; | 177 | break; | |
178 | 178 | |||
179 | } | 179 | } | |
180 | } | 180 | } | |
181 | fts_close(t); | 181 | fts_close(t); | |
182 | if (sflag && keys & F_CKSUM) | 182 | if (sflag && keys & F_CKSUM) | |
183 | mtree_err("%s checksum: %u", fullpath, crc_total); | 183 | mtree_err("%s checksum: %u", fullpath, crc_total); | |
184 | } | 184 | } | |
185 | 185 | |||
186 | static void | 186 | static void | |
187 | statf(FTSENT *p) | 187 | statf(FTSENT *p) | |
188 | { | 188 | { | |
189 | u_int32_t len, val; | 189 | uint32_t len, val; | |
190 | int fd, indent; | 190 | int fd, indent; | |
191 | const char *name; | 191 | const char *name; | |
192 | #if !defined(NO_MD5) || !defined(NO_RMD160) || !defined(NO_SHA1) || !defined(NO_SHA2) | 192 | #if !defined(NO_MD5) || !defined(NO_RMD160) || !defined(NO_SHA1) || !defined(NO_SHA2) | |
193 | char digestbuf[MAXHASHLEN + 1]; | 193 | char digestbuf[MAXHASHLEN + 1]; | |
194 | #endif | 194 | #endif | |
195 | 195 | |||
196 | indent = printf("%s%s", | 196 | indent = printf("%s%s", | |
197 | S_ISDIR(p->fts_statp->st_mode) ? "" : " ", vispath(p->fts_name)); | 197 | S_ISDIR(p->fts_statp->st_mode) ? "" : " ", vispath(p->fts_name)); | |
198 | 198 | |||
199 | if (indent > INDENTNAMELEN) | 199 | if (indent > INDENTNAMELEN) | |
200 | indent = MAXLINELEN; | 200 | indent = MAXLINELEN; | |
201 | else | 201 | else | |
202 | indent += printf("%*s", INDENTNAMELEN - indent, ""); | 202 | indent += printf("%*s", INDENTNAMELEN - indent, ""); |
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: extern.h,v 1.3 2008/11/06 02:14:52 jschauma Exp $ */ | 1 | /* $NetBSD: extern.h,v 1.4 2010/03/21 16:30:17 joerg Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1991, 1993 | 4 | * Copyright (c) 1991, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -54,38 +54,38 @@ | @@ -54,38 +54,38 @@ | |||
54 | /* For MAXHOSTNAMELEN on some platforms. */ | 54 | /* For MAXHOSTNAMELEN on some platforms. */ | |
55 | #if HAVE_NETDB_H | 55 | #if HAVE_NETDB_H | |
56 | #include <netdb.h> | 56 | #include <netdb.h> | |
57 | #endif | 57 | #endif | |
58 | #endif | 58 | #endif | |
59 | 59 | |||
60 | #ifndef MAXHOSTNAMELEN | 60 | #ifndef MAXHOSTNAMELEN | |
61 | #define MAXHOSTNAMELEN 256 | 61 | #define MAXHOSTNAMELEN 256 | |
62 | #endif | 62 | #endif | |
63 | 63 | |||
64 | void addtag(slist_t *, char *); | 64 | void addtag(slist_t *, char *); | |
65 | int check_excludes(const char *, const char *); | 65 | int check_excludes(const char *, const char *); | |
66 | int compare(NODE *, FTSENT *); | 66 | int compare(NODE *, FTSENT *); | |
67 | int crc(int, u_int32_t *, u_int32_t *); | 67 | int crc(int, uint32_t *, uint32_t *); | |
68 | void cwalk(void); | 68 | void cwalk(void); | |
69 | void dump_nodes(const char *, NODE *, int); | 69 | void dump_nodes(const char *, NODE *, int); | |
70 | void init_excludes(void); | 70 | void init_excludes(void); | |
71 | int matchtags(NODE *); | 71 | int matchtags(NODE *); | |
72 | void mtree_err(const char *, ...) | 72 | void mtree_err(const char *, ...) | |
73 | __attribute__((__format__(__printf__, 1, 2))); | 73 | __attribute__((__format__(__printf__, 1, 2))); | |
74 | const char *nodetype(u_int); | 74 | const char *nodetype(u_int); | |
75 | u_int parsekey(const char *, int *); | 75 | u_int parsekey(const char *, int *); | |
76 | void parsetags(slist_t *, char *); | 76 | void parsetags(slist_t *, char *); | |
77 | u_int parsetype(const char *); | 77 | u_int parsetype(const char *); | |
78 | void read_excludes_file(const char *); | 78 | void read_excludes_file(const char *); | |
79 | const char *rlink(const char *); | 79 | const char *rlink(const char *); | |
80 | int verify(void); | 80 | int verify(void); | |
81 | 81 | |||
82 | extern int dflag, eflag, iflag, lflag, mflag, rflag, sflag, tflag, uflag; | 82 | extern int dflag, eflag, iflag, lflag, mflag, rflag, sflag, tflag, uflag; | |
83 | extern int mtree_Mflag, mtree_Wflag; | 83 | extern int mtree_Mflag, mtree_Wflag; | |
84 | extern size_t mtree_lineno; | 84 | extern size_t mtree_lineno; | |
85 | extern u_int32_t crc_total; | 85 | extern uint32_t crc_total; | |
86 | extern int ftsoptions, keys; | 86 | extern int ftsoptions, keys; | |
87 | extern char fullpath[]; | 87 | extern char fullpath[]; | |
88 | extern slist_t includetags, excludetags; | 88 | extern slist_t includetags, excludetags; | |
89 | 89 | |||
90 | 90 | |||
91 | #include "stat_flags.h" | 91 | #include "stat_flags.h" |