create.c (42787) | create.c (44303) |
---|---|
1/*- 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 22 unchanged lines hidden (view full) --- 31 * SUCH DAMAGE. 32 */ 33 34#ifndef lint 35#if 0 36static char sccsid[] = "@(#)create.c 8.1 (Berkeley) 6/6/93"; 37#endif 38static const char rcsid[] = | 1/*- 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 22 unchanged lines hidden (view full) --- 31 * SUCH DAMAGE. 32 */ 33 34#ifndef lint 35#if 0 36static char sccsid[] = "@(#)create.c 8.1 (Berkeley) 6/6/93"; 37#endif 38static const char rcsid[] = |
39 "$Id: create.c,v 1.12 1999/01/12 02:58:23 jkoshy Exp $"; | 39 "$Id: create.c,v 1.13 1999/01/18 06:58:25 jkoshy Exp $"; |
40#endif /* not lint */ 41 42#include <sys/param.h> 43#include <sys/stat.h> 44#include <dirent.h> 45#include <err.h> 46#include <errno.h> 47#include <fcntl.h> 48#include <fts.h> 49#include <grp.h> | 40#endif /* not lint */ 41 42#include <sys/param.h> 43#include <sys/stat.h> 44#include <dirent.h> 45#include <err.h> 46#include <errno.h> 47#include <fcntl.h> 48#include <fts.h> 49#include <grp.h> |
50#ifdef MD5 |
|
50#include <md5.h> | 51#include <md5.h> |
52#endif 53#ifdef SHA1 54#include <sha.h> 55#endif 56#ifdef RMD160 57#include <ripemd.h> 58#endif |
|
51#include <pwd.h> 52#include <stdio.h> 53#include <time.h> 54#include <unistd.h> 55#include <vis.h> 56#include "mtree.h" 57#include "extern.h" 58 --- 139 unchanged lines hidden (view full) --- 198 p->fts_statp->st_mtimespec.tv_nsec); 199 if (keys & F_CKSUM && S_ISREG(p->fts_statp->st_mode)) { 200 if ((fd = open(p->fts_accpath, O_RDONLY, 0)) < 0 || 201 crc(fd, &val, &len)) 202 err(1, "line %d: %s", lineno, p->fts_accpath); 203 (void)close(fd); 204 output(indent, &offset, "cksum=%lu", val); 205 } | 59#include <pwd.h> 60#include <stdio.h> 61#include <time.h> 62#include <unistd.h> 63#include <vis.h> 64#include "mtree.h" 65#include "extern.h" 66 --- 139 unchanged lines hidden (view full) --- 206 p->fts_statp->st_mtimespec.tv_nsec); 207 if (keys & F_CKSUM && S_ISREG(p->fts_statp->st_mode)) { 208 if ((fd = open(p->fts_accpath, O_RDONLY, 0)) < 0 || 209 crc(fd, &val, &len)) 210 err(1, "line %d: %s", lineno, p->fts_accpath); 211 (void)close(fd); 212 output(indent, &offset, "cksum=%lu", val); 213 } |
214#ifdef MD5 |
|
206 if (keys & F_MD5 && S_ISREG(p->fts_statp->st_mode)) { | 215 if (keys & F_MD5 && S_ISREG(p->fts_statp->st_mode)) { |
207 char *md5digest, buf[33]; | 216 char *digest, buf[33]; |
208 | 217 |
209 md5digest = MD5File(p->fts_accpath,buf); 210 if (!md5digest) { | 218 digest = MD5File(p->fts_accpath, buf); 219 if (!digest) { |
211 err(1, "line %d: %s", lineno, p->fts_accpath); 212 } else { | 220 err(1, "line %d: %s", lineno, p->fts_accpath); 221 } else { |
213 output(indent, &offset, "md5digest=%s", md5digest); | 222 output(indent, &offset, "md5digest=%s", digest); |
214 } 215 } | 223 } 224 } |
225#endif /* MD5 */ 226#ifdef SHA1 227 if (keys & F_SHA1 && S_ISREG(p->fts_statp->st_mode)) { 228 char *digest, buf[41]; 229 230 digest = SHA1_File(p->fts_accpath, buf); 231 if (!digest) { 232 err(1, "line %d: %s", lineno, p->fts_accpath); 233 } else { 234 output(indent, &offset, "sha1digest=%s", digest); 235 } 236 } 237#endif /* SHA1 */ 238#ifdef RMD160 239 if (keys & F_RMD160 && S_ISREG(p->fts_statp->st_mode)) { 240 char *digest, buf[41]; 241 242 digest = RIPEMD160_File(p->fts_accpath, buf); 243 if (!digest) { 244 err(1, "line %d: %s", lineno, p->fts_accpath); 245 } else { 246 output(indent, &offset, "ripemd160digest=%s", digest); 247 } 248 } 249#endif /* RMD160 */ |
|
216 if (keys & F_SLINK && 217 (p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) 218 output(indent, &offset, "link=%s", rlink(p->fts_accpath)); 219 (void)putchar('\n'); 220} 221 222#define MAXGID 5000 223#define MAXUID 5000 --- 140 unchanged lines hidden --- | 250 if (keys & F_SLINK && 251 (p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) 252 output(indent, &offset, "link=%s", rlink(p->fts_accpath)); 253 (void)putchar('\n'); 254} 255 256#define MAXGID 5000 257#define MAXUID 5000 --- 140 unchanged lines hidden --- |