head 1.6; access; symbols pkgsrc-2026Q1:1.6.0.82 pkgsrc-2026Q1-base:1.6 pkgsrc-2025Q4:1.6.0.80 pkgsrc-2025Q4-base:1.6 pkgsrc-2025Q3:1.6.0.78 pkgsrc-2025Q3-base:1.6 pkgsrc-2025Q2:1.6.0.76 pkgsrc-2025Q2-base:1.6 pkgsrc-2025Q1:1.6.0.74 pkgsrc-2025Q1-base:1.6 pkgsrc-2024Q4:1.6.0.72 pkgsrc-2024Q4-base:1.6 pkgsrc-2024Q3:1.6.0.70 pkgsrc-2024Q3-base:1.6 pkgsrc-2024Q2:1.6.0.68 pkgsrc-2024Q2-base:1.6 pkgsrc-2024Q1:1.6.0.66 pkgsrc-2024Q1-base:1.6 pkgsrc-2023Q4:1.6.0.64 pkgsrc-2023Q4-base:1.6 pkgsrc-2023Q3:1.6.0.62 pkgsrc-2023Q3-base:1.6 pkgsrc-2023Q2:1.6.0.60 pkgsrc-2023Q2-base:1.6 pkgsrc-2023Q1:1.6.0.58 pkgsrc-2023Q1-base:1.6 pkgsrc-2022Q4:1.6.0.56 pkgsrc-2022Q4-base:1.6 pkgsrc-2022Q3:1.6.0.54 pkgsrc-2022Q3-base:1.6 pkgsrc-2022Q2:1.6.0.52 pkgsrc-2022Q2-base:1.6 pkgsrc-2022Q1:1.6.0.50 pkgsrc-2022Q1-base:1.6 pkgsrc-2021Q4:1.6.0.48 pkgsrc-2021Q4-base:1.6 pkgsrc-2021Q3:1.6.0.46 pkgsrc-2021Q3-base:1.6 pkgsrc-2021Q2:1.6.0.44 pkgsrc-2021Q2-base:1.6 pkgsrc-2021Q1:1.6.0.42 pkgsrc-2021Q1-base:1.6 pkgsrc-2020Q4:1.6.0.40 pkgsrc-2020Q4-base:1.6 pkgsrc-2020Q3:1.6.0.38 pkgsrc-2020Q3-base:1.6 pkgsrc-2020Q2:1.6.0.34 pkgsrc-2020Q2-base:1.6 pkgsrc-2020Q1:1.6.0.14 pkgsrc-2020Q1-base:1.6 pkgsrc-2019Q4:1.6.0.36 pkgsrc-2019Q4-base:1.6 pkgsrc-2019Q3:1.6.0.32 pkgsrc-2019Q3-base:1.6 pkgsrc-2019Q2:1.6.0.30 pkgsrc-2019Q2-base:1.6 pkgsrc-2019Q1:1.6.0.28 pkgsrc-2019Q1-base:1.6 pkgsrc-2018Q4:1.6.0.26 pkgsrc-2018Q4-base:1.6 pkgsrc-2018Q3:1.6.0.24 pkgsrc-2018Q3-base:1.6 pkgsrc-2018Q2:1.6.0.22 pkgsrc-2018Q2-base:1.6 pkgsrc-2018Q1:1.6.0.20 pkgsrc-2018Q1-base:1.6 pkgsrc-2017Q4:1.6.0.18 pkgsrc-2017Q4-base:1.6 pkgsrc-2017Q3:1.6.0.16 pkgsrc-2017Q3-base:1.6 pkgsrc-2017Q2:1.6.0.12 pkgsrc-2017Q2-base:1.6 pkgsrc-2017Q1:1.6.0.10 pkgsrc-2017Q1-base:1.6 pkgsrc-2016Q4:1.6.0.8 pkgsrc-2016Q4-base:1.6 pkgsrc-2016Q3:1.6.0.6 pkgsrc-2016Q3-base:1.6 pkgsrc-2016Q2:1.6.0.4 pkgsrc-2016Q2-base:1.6 pkgsrc-2016Q1:1.6.0.2 pkgsrc-2016Q1-base:1.6 pkgsrc-2015Q4:1.5.0.48 pkgsrc-2015Q4-base:1.5 pkgsrc-2015Q3:1.5.0.46 pkgsrc-2015Q3-base:1.5 pkgsrc-2015Q2:1.5.0.44 pkgsrc-2015Q2-base:1.5 pkgsrc-2015Q1:1.5.0.42 pkgsrc-2015Q1-base:1.5 pkgsrc-2014Q4:1.5.0.40 pkgsrc-2014Q4-base:1.5 pkgsrc-2014Q3:1.5.0.38 pkgsrc-2014Q3-base:1.5 pkgsrc-2014Q2:1.5.0.36 pkgsrc-2014Q2-base:1.5 pkgsrc-2014Q1:1.5.0.34 pkgsrc-2014Q1-base:1.5 pkgsrc-2013Q4:1.5.0.32 pkgsrc-2013Q4-base:1.5 pkgsrc-2013Q3:1.5.0.30 pkgsrc-2013Q3-base:1.5 pkgsrc-2013Q2:1.5.0.28 pkgsrc-2013Q2-base:1.5 pkgsrc-2013Q1:1.5.0.26 pkgsrc-2013Q1-base:1.5 pkgsrc-2012Q4:1.5.0.24 pkgsrc-2012Q4-base:1.5 pkgsrc-2012Q3:1.5.0.22 pkgsrc-2012Q3-base:1.5 pkgsrc-2012Q2:1.5.0.20 pkgsrc-2012Q2-base:1.5 pkgsrc-2012Q1:1.5.0.18 pkgsrc-2012Q1-base:1.5 pkgsrc-2011Q4:1.5.0.16 pkgsrc-2011Q4-base:1.5 pkgsrc-2011Q3:1.5.0.14 pkgsrc-2011Q3-base:1.5 pkgsrc-2011Q2:1.5.0.12 pkgsrc-2011Q2-base:1.5 pkgsrc-2011Q1:1.5.0.10 pkgsrc-2011Q1-base:1.5 pkgsrc-2010Q4:1.5.0.8 pkgsrc-2010Q4-base:1.5 pkgsrc-2010Q3:1.5.0.6 pkgsrc-2010Q3-base:1.5 pkgsrc-2010Q2:1.5.0.4 pkgsrc-2010Q2-base:1.5 pkgsrc-2010Q1:1.5.0.2 pkgsrc-2010Q1-base:1.5 pkgsrc-2009Q4:1.4.0.12 pkgsrc-2009Q4-base:1.4 pkgsrc-2009Q3:1.4.0.10 pkgsrc-2009Q3-base:1.4 pkgsrc-2009Q2:1.4.0.8 pkgsrc-2009Q2-base:1.4 pkgsrc-2009Q1:1.4.0.6 pkgsrc-2009Q1-base:1.4 pkgsrc-2008Q4:1.4.0.4 pkgsrc-2008Q4-base:1.4 pkgsrc-2008Q3:1.4.0.2 pkgsrc-2008Q3-base:1.4 cube-native-xorg:1.3.0.26 cube-native-xorg-base:1.3 pkgsrc-2008Q2:1.3.0.24 pkgsrc-2008Q2-base:1.3 cwrapper-base:1.3 cwrapper:1.3.0.22 pkgsrc-2008Q1:1.3.0.20 pkgsrc-2008Q1-base:1.3 pkgsrc-2007Q4:1.3.0.18 pkgsrc-2007Q4-base:1.3 pkgsrc-2007Q3:1.3.0.16 pkgsrc-2007Q3-base:1.3 pkgsrc-2007Q2:1.3.0.14 pkgsrc-2007Q2-base:1.3 pkgsrc-2007Q1:1.3.0.12 pkgsrc-2007Q1-base:1.3 pkgsrc-2006Q4:1.3.0.10 pkgsrc-2006Q4-base:1.3 pkgsrc-2006Q3:1.3.0.8 pkgsrc-2006Q3-base:1.3 pkgsrc-2006Q2:1.3.0.6 pkgsrc-2006Q2-base:1.3 pkgsrc-2006Q1:1.3.0.4 pkgsrc-2006Q1-base:1.3 pkgsrc-2005Q4:1.3.0.2 pkgsrc-2005Q4-base:1.3 pkgsrc-2005Q3:1.2.0.6 pkgsrc-2005Q3-base:1.2 pkgsrc-2005Q2:1.2.0.4 pkgsrc-2005Q2-base:1.2 pkgsrc-2005Q1:1.2.0.2 pkgsrc-2005Q1-base:1.2 pkgsrc-2004Q4:1.1.1.1.0.10 pkgsrc-2004Q4-base:1.1.1.1 pkgsrc-2004Q3:1.1.1.1.0.8 pkgsrc-2004Q3-base:1.1.1.1 pkgsrc-2004Q2:1.1.1.1.0.6 pkgsrc-2004Q2-base:1.1.1.1 pkgsrc-2004Q1:1.1.1.1.0.4 pkgsrc-2004Q1-base:1.1.1.1 pkgsrc-2003Q4:1.1.1.1.0.2 pkgsrc-2003Q4-base:1.1.1.1 pkgsrc-base:1.1.1.1 TNF:1.1.1; locks; strict; comment @# @; 1.6 date 2016.03.31.17.06.18; author agc; state Exp; branches; next 1.5; commitid NpwX6AXfGV2NJO0z; 1.5 date 2010.02.24.22.00.03; author joerg; state Exp; branches; next 1.4; 1.4 date 2008.09.18.10.38.45; author joerg; state Exp; branches; next 1.3; 1.3 date 2005.12.02.16.30.07; author rillig; state Exp; branches; next 1.2; 1.2 date 2005.01.21.02.18.23; author tv; state Exp; branches; next 1.1; 1.1 date 2003.07.24.05.21.07; author atatat; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2003.07.24.05.21.07; author atatat; state Exp; branches; next ; desc @@ 1.6 log @Build fixes for rdigest, following previous changes to pkgtools/digest in February. @ text @$NetBSD: patch-ac,v 1.5 2010/02/24 22:00:03 joerg Exp $ patch digest program to recurse through directories --- digest.c.orig 2016-03-31 09:37:14.729643239 -0700 +++ digest.c 2016-03-31 10:02:46.312679447 -0700 @@@@ -28,9 +28,19 @@@@ #include "config.h" #endif +#include +#include +#include + #ifdef HAVE_ERRNO_H #include #endif +#include +#ifdef HAVE_FTS_H +#include +#else +#include +#endif #ifdef HAVE_LOCALE_H #include #endif @@@@ -161,19 +171,173 @@@@ return (rc); } +struct excl { + LIST_ENTRY(excl) n; + const char *p; +}; + +LIST_HEAD(, excl) excl; + +static void +exclude(const char *p) +{ + struct excl *e; + + e = malloc(sizeof(struct excl)); + e->p = p; + LIST_INSERT_HEAD(&excl, e, n); +} + +static int +skip(const char *p) +{ + struct excl *e; + +#ifdef LIST_FOREACH + LIST_FOREACH(e, &excl, n) +#else + for (e = excl.lh_first; e; e = e->n.le_next) +#endif + if (strcmp(e->p, p) == 0) + return (1); + + return (0); +} + +static int +compar(const FTSENT **fa, const FTSENT **fb) +{ + return (strcmp((*fa)->fts_name, (*fb)->fts_name)); +} + +static int +digest_directory(char *dn, alg_t *alg) +{ + char in[BUFSIZ * 20], dot[2]; + char *digest; + int cc, rc, l, fd, cwd; + char *pathlist[2]; + FTS *ftsp; + FTSENT *f; + + rc = 1; + l = alg->hash_len * 2; + digest = malloc(l + 1); + sprintf(dot, "."); + pathlist[0] = dot; + pathlist[1] = NULL; + + if ((cwd = open(".", O_RDONLY)) == -1 || + chdir(dn) == -1 || + (ftsp = fts_open(pathlist, + FTS_COMFOLLOW | FTS_NOCHDIR | FTS_PHYSICAL, + compar)) == NULL) { + (void) fprintf(stderr, "%s\n", dn); + free(digest); + return (0); + } + + (*alg->hash_init)(&alg->hash_ctx); + + while ((f = fts_read(ftsp)) != NULL) { + /* skip the second pass on a directory */ + if (f->fts_info == FTS_DP) + continue; + + /* skip directories named CVS, RCS, or SCCS */ + if ((f->fts_info == FTS_NS || + S_ISDIR(f->fts_statp->st_mode)) && + skip(f->fts_name)) { + fts_set(ftsp, f, FTS_SKIP); + continue; + } + + /* try to handle things based on stat info */ + if (f->fts_info != FTS_NS) { + /* only mention directories */ + if (S_ISDIR(f->fts_statp->st_mode)) { + (*alg->hash_init)(&alg->hash_ctx2); + (*alg->hash_update)(&alg->hash_ctx2, "d ", 2); + (*alg->hash_update)(&alg->hash_ctx2, f->fts_path, f->fts_pathlen); + (*alg->hash_end)(&alg->hash_ctx2, digest); + digest[l] = '\n'; + (*alg->hash_update)(&alg->hash_ctx, digest, l + 1); + + /* hash the filename and then the contents separately */ + } else if (S_ISREG(f->fts_statp->st_mode)) { + if ((fd = open(f->fts_path, O_RDONLY)) != -1) { + (*alg->hash_init)(&alg->hash_ctx2); + (*alg->hash_update)(&alg->hash_ctx2, "f ", 2); + (*alg->hash_update)(&alg->hash_ctx2, f->fts_path, f->fts_pathlen); + (*alg->hash_end)(&alg->hash_ctx2, &digest[0]); + digest[l] = '\n'; + (*alg->hash_update)(&alg->hash_ctx, digest, 33); + + (*alg->hash_init)(&alg->hash_ctx2); + while ((cc = read(fd, in, sizeof(in))) > 0) { + (*alg->hash_update)(&alg->hash_ctx2, in, cc); + } + close(fd); + (*alg->hash_end)(&alg->hash_ctx2, digest); + digest[l] = '\n'; + (*alg->hash_update)(&alg->hash_ctx, digest, l + 1); + } else { + (void) fprintf(stderr, "%s\n", f->fts_path); + rc = 0; + } + + /* hash in symlinks as well, along with the link contents */ + } else if (S_ISLNK(f->fts_statp->st_mode)) { + if ((cc = readlink(f->fts_path, in, sizeof(in))) > 0) { + (*alg->hash_init)(&alg->hash_ctx2); + (*alg->hash_update)(&alg->hash_ctx2, "l ", 2); + (*alg->hash_update)(&alg->hash_ctx2, f->fts_path, f->fts_pathlen); + (*alg->hash_end)(&alg->hash_ctx2, digest); + digest[l] = '\n'; + (*alg->hash_update)(&alg->hash_ctx, digest, l + 1); + + (*alg->hash_init)(&alg->hash_ctx2); + (*alg->hash_update)(&alg->hash_ctx2, in, cc); + (*alg->hash_end)(&alg->hash_ctx2, digest); + digest[l] = '\n'; + (*alg->hash_update)(&alg->hash_ctx, digest, l + 1); + } else { + (void) fprintf(stderr, "%s\n", f->fts_path); + rc = 0; + } + } + } + } + + fts_close(ftsp); + fchdir(cwd); + close(cwd); + + if (rc == 1) { + (*alg->hash_end)(&alg->hash_ctx, digest); + (void) printf("%s (%s) = %s\n", alg->name, dn, digest); + } + + free(digest); + return (rc); +} + int main(int argc, char **argv) { + struct stat st; alg_t *alg; int test; int ok; int i; + LIST_INIT(&excl); + #ifdef HAVE_SETLOCALE (void) setlocale(LC_ALL, ""); #endif test = 0; - while ((i = getopt(argc, argv, "Vt")) != -1) { + while ((i = getopt(argc, argv, "Vtx:")) != -1) { switch(i) { case 'V': printf("%s\n", VERSION); @@@@ -181,6 +345,9 @@@@ case 't': test = 1; break; + case 'x': + exclude(optarg); + break; } } if (test) { @@@@ -212,7 +379,9 @@@@ } } else { for (i = optind + 1 ; i < argc ; i++) { - if (!digest_file(argv[i], alg)) { + if (stat(argv[i], &st) == -1 || + (S_ISREG(st.st_mode) && !digest_file(argv[i], alg)) || + (S_ISDIR(st.st_mode) && !digest_directory(argv[i], alg))) { fprintf(stderr, "%s\n", argv[i]); ok = 0; } @ 1.5 log @Fix path to not confuse RCS ID check for +BUILD_INFO. @ text @d1 1 a1 1 $NetBSD: patch-ac,v 1.4 2008/09/18 10:38:45 joerg Exp $ d3 6 a8 3 --- digest.c.orig 2008-09-18 12:13:50.000000000 +0200 +++ digest.c @@@@ -41,8 +41,17 @@@@ d14 1 a14 1 d26 3 a28 1 @@@@ -158,4 +167,155 @@@@ digest_file(char *fn, alg_t *alg) d184 5 a188 2 @@@@ -164,13 +324,19 @@@@ main(int argc, char **argv) int rval; d190 2 a191 1 + struct stat st; a192 2 + LIST_INIT(&excl); d196 3 a198 2 - while ((i = getopt(argc, argv, "V")) != -1) { + while ((i = getopt(argc, argv, "Vx:")) != -1) { d202 4 a205 1 return EXIT_SUCCESS; d211 3 a213 1 @@@@ -197,5 +363,7 @@@@ main(int argc, char **argv) d215 1 a215 1 for (i = 0 ; i < argc ; i++) { d220 3 a222 2 (void) fprintf(stderr, "%s\n", argv[i]); rval = EXIT_FAILURE; @ 1.4 log @Fix build on Solaris by using nbcompat. @ text @d1 1 a1 1 $NetBSD$ d5 1 a5 1 @@@@ -41,8 +41,17 @@@@ __RCSID("$NetBSD: digest.c,v 1.15 2007/0 @ 1.3 log @Removed the partial RCS Id tag from patch-ac. Didn't update distinfo, as NO_CHECKSUM is set in the ../digest/Makefile, which is included, so it won't be checked anyway. @ text @d1 1 a1 1 $NetBSD: patch-ac,v 1.2 2005/01/21 02:18:23 tv Exp $ d3 1 a3 1 --- digest.c.orig 2005-01-20 21:10:03.000000000 -0500 d5 1 a5 1 @@@@ -43,9 +43,14 @@@@ d8 3 a11 3 +#include +#include + d16 1 d18 3 d23 1 a23 3 #endif @@@@ -147,21 +152,178 @@@@ digest_file(char *fn, alg_t *alg) return (rc); d179 1 a179 2 { alg_t *alg; d200 1 a200 3 argc -= optind; @@@@ -186,7 +348,9 @@@@ main(int argc, char **argv) } a208 1 } @ 1.2 log @Make build on Interix, which has a slightly older . @ text @d1 1 a1 1 $NetBSD$ d5 1 a5 1 @@@@ -43,9 +43,14 @@@@ __RCSID("$NetBSD: digest.c,v 1.8 2003/07 @ 1.1 log @Initial revision @ text @d3 1 a3 1 --- digest.c.orig 2003-07-23 20:27:09.000000000 -0400 d20 1 a20 1 @@@@ -147,21 +152,172 @@@@ digest_file(char *fn, alg_t *alg) d29 1 a29 1 +LIST_HEAD(, excl) excl = LIST_HEAD_INITIALIZER(excl); d46 1 d48 3 d182 2 d200 1 a200 1 @@@@ -186,7 +342,9 @@@@ main(int argc, char **argv) @ 1.1.1.1 log @A strange meta-package of a sort, rdigest is implemented as a jumbo patch to the well-known digest package. The output is the same for files, but if rdigest is given a directory as an argument, it will recursively checksum the directory in such a manner as to: (1) give a repeatable checksum (2) with no regard for file ownership (3) or timestamps (4) or modes (5) while taking into account empty files and directories such that the checksum of an extracted tar file will match the checksum of the same tree as retrieved via cvs, or two allegedly matching trees from different cvs servers, etc. @ text @@