usr.bin/dsynth/pkglist.c
/*
 * Query the package (at least to make sure it hasn't been truncated)
 * and mark it as PACKAGED if found.
 *
 * Threaded function
 */
Query the package (at least to make sure it hasn't been truncated)
and mark it as PACKAGED if found.

Threaded function
Query the package ( at least to make sure it hasn ' t been truncated ) and mark it as PACKAGED if found . Threaded function
static void
childGetBinaryDistInfo(bulk_t *bulk)
{
	char *ptr;
	FILE *fp;
	size_t len;
	pkg_t *pkg;
	const char *cav[MAXCAC];
	char *repopath;
	char buf[1024];
	pid_t pid;
	int cac;
	asprintf(&repopath, "%s/%s", RepositoryPath, bulk->s1);
	cac = 0;
	cav[cac++] = PKG_BINARY;
	cav[cac++] = "query";
	cav[cac++] = "-F";
	cav[cac++] = repopath;
	cav[cac++] = "%n-%v";
	fp = dexec_open(cav, cac, &pid, NULL, 1, 0);
	while ((ptr = fgetln(fp, &len)) != NULL) {
		if (len == 0 || ptr[len-1] != '\n')
			continue;
		ptr[len-1] = 0;
		snprintf(buf, sizeof(buf), "%s%s", ptr, UsePkgSufx);
		pkg = pkg_find(buf);
		if (pkg) {
			pkg->flags |= PKGF_PACKAGED;
		} else {
			ddprintf(0, "Note: package scan, not in list, "
				    "skipping %s\n", buf);
		}
	}
	if (dexec_close(fp, pid)) {
		printf("pkg query command failed for %s\n", repopath);
	}
	free(repopath);
}
static void childGetBinaryDistInfo ( bulk_t * bulk ) { char * ptr ; FILE * fp ; size_t len ; pkg_t * pkg ; const char * cav [ MAXCAC ] ; char * repopath ; char buf [ 1024 ] ; pid_t pid ; int cac ; asprintf ( & repopath , " " , RepositoryPath , bulk -> s1 ) ; cac = 0 ; cav [ cac ++ ] = PKG_BINARY ; cav [ cac ++ ] = " " ; cav [ cac ++ ] = " " ; cav [ cac ++ ] = repopath ; cav [ cac ++ ] = " " ; fp = dexec_open ( cav , cac , & pid , NULL , 1 , 0 ) ; while ( ( ptr = fgetln ( fp , & len ) ) != NULL ) { if ( len == 0 || ptr [ len - 1 ] != ' \n ' ) continue ; ptr [ len - 1 ] = 0 ; snprintf ( buf , sizeof ( buf ) , " " , ptr , UsePkgSufx ) ; pkg = pkg_find ( buf ) ; if ( pkg ) { pkg -> flags |= PKGF_PACKAGED ; } else { ddprintf ( 0 , " " " \n " , buf ) ; } } if ( dexec_close ( fp , pid ) ) { printf ( " \n " , repopath ) ; } free ( repopath ) ; }
Query the package (at least to make sure it hasn't been truncated)
 and mark it as PACKAGED if found.
Query the package ( at least to make sure it hasn ' t been truncated ) and mark it as PACKAGED if found .