findunref.c (b998737654179ec0e068e04f6fda6e76777171c9) findunref.c (93b8872871607b3d21317283c1230b2a4a00920b)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 9 unchanged lines hidden (view full) ---

18 *
19 * CDDL HEADER END
20 *
21 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
22 * Use is subject to license terms.
23 */
24
25/*
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 9 unchanged lines hidden (view full) ---

18 *
19 * CDDL HEADER END
20 *
21 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
22 * Use is subject to license terms.
23 */
24
25/*
26 * Copyright (c) 2018, Joyent, Inc.
27 */
28
29/*
26 * Finds all unreferenced files in a source tree that do not match a list of
27 * permitted pathnames.
28 */
29
30#include <ctype.h>
31#include <errno.h>
32#include <fnmatch.h>
33#include <ftw.h>

--- 161 unchanged lines hidden (view full) ---

195hg_manifest(const char *hgroot)
196{
197 FILE *fp = NULL;
198 char *hgcmd = NULL;
199 char *newline;
200 pnset_t *pnsetp;
201 char path[MAXPATHLEN];
202
30 * Finds all unreferenced files in a source tree that do not match a list of
31 * permitted pathnames.
32 */
33
34#include <ctype.h>
35#include <errno.h>
36#include <fnmatch.h>
37#include <ftw.h>

--- 161 unchanged lines hidden (view full) ---

199hg_manifest(const char *hgroot)
200{
201 FILE *fp = NULL;
202 char *hgcmd = NULL;
203 char *newline;
204 pnset_t *pnsetp;
205 char path[MAXPATHLEN];
206
203 pnsetp = calloc(sizeof (pnset_t), 1);
207 pnsetp = calloc(1, sizeof (pnset_t));
204 if (pnsetp == NULL ||
205 asprintf(&hgcmd, "hg manifest -R %s", hgroot) == -1)
206 goto fail;
207
208 fp = popen(hgcmd, "r");
209 if (fp == NULL)
210 goto fail;
211

--- 25 unchanged lines hidden (view full) ---

237git_manifest(const char *gitroot)
238{
239 FILE *fp = NULL;
240 char *gitcmd = NULL;
241 char *newline;
242 pnset_t *pnsetp;
243 char path[MAXPATHLEN];
244
208 if (pnsetp == NULL ||
209 asprintf(&hgcmd, "hg manifest -R %s", hgroot) == -1)
210 goto fail;
211
212 fp = popen(hgcmd, "r");
213 if (fp == NULL)
214 goto fail;
215

--- 25 unchanged lines hidden (view full) ---

241git_manifest(const char *gitroot)
242{
243 FILE *fp = NULL;
244 char *gitcmd = NULL;
245 char *newline;
246 pnset_t *pnsetp;
247 char path[MAXPATHLEN];
248
245 pnsetp = calloc(sizeof (pnset_t), 1);
249 pnsetp = calloc(1, sizeof (pnset_t));
246 if (pnsetp == NULL ||
247 asprintf(&gitcmd, "git --git-dir=%s/.git ls-files", gitroot) == -1)
248 goto fail;
249
250 fp = popen(gitcmd, "r");
251 if (fp == NULL)
252 goto fail;
253

--- 141 unchanged lines hidden (view full) ---

395make_exset(const char *exceptfile)
396{
397 FILE *fp;
398 char line[MAXPATHLEN];
399 char *newline;
400 pnset_t *pnsetp;
401 unsigned int i;
402
250 if (pnsetp == NULL ||
251 asprintf(&gitcmd, "git --git-dir=%s/.git ls-files", gitroot) == -1)
252 goto fail;
253
254 fp = popen(gitcmd, "r");
255 if (fp == NULL)
256 goto fail;
257

--- 141 unchanged lines hidden (view full) ---

399make_exset(const char *exceptfile)
400{
401 FILE *fp;
402 char line[MAXPATHLEN];
403 char *newline;
404 pnset_t *pnsetp;
405 unsigned int i;
406
403 pnsetp = calloc(sizeof (pnset_t), 1);
407 pnsetp = calloc(1, sizeof (pnset_t));
404 if (pnsetp == NULL)
405 return (NULL);
406
407 /*
408 * Add any exceptions from the file.
409 */
410 fp = fopen(exceptfile, "r");
411 if (fp == NULL) {

--- 190 unchanged lines hidden ---
408 if (pnsetp == NULL)
409 return (NULL);
410
411 /*
412 * Add any exceptions from the file.
413 */
414 fp = fopen(exceptfile, "r");
415 if (fp == NULL) {

--- 190 unchanged lines hidden ---