ZPKGBIN=zpm-addfile zpm-extract zpm-init zpm-vercmp zpm-stat zpm-hash \
zpm-findpkg zpm-shell zpm-soneed zpm-foreach-path zpm-parse \
- zpm-runscript zpm-soname zpm-syncfs zpm-packagehash zpm-verify
+ zpm-runscript zpm-soname zpm-syncfs zpm-packagehash zpm-verify \
+ zpm-elftype
SCRIPTS=zpm zpm-install zpm-merge zpm-list zpm-preserve zpm-test zpm-log \
zpm-contents zpm-uninstall zpm-pathmod
uncompress: uncompress.o
$(CC) $(CFLAGS) -o $@ $+ -llzma
-elftype: elf/elftype.c
- $(CC) $(CFLAGS) -o $@ $+
+zpm-elftype: elf/elftype.c
+ $(CC) -Ielf $(CFLAGS) -o $@ $+
zpm-soname: elf/soname.c
$(CC) -Ielf $(CFLAGS) -o $@ $+
#define SYMLINKS 0x10
int readline(FILE *f, char *fn);
-int checkfile(char *fn, unsigned int want, int perr, int quiet);
+int checkfile(char *fn, unsigned int want, int perr);
int errors = 0;
int zeroterm = 0;
int main(int ac, char **av) {
int option;
unsigned int want = 0;
- int quiet = 0;
int printtype = 0;
int printname = 0;
int verbose = 0;
FILE *list = 0;
char fn[PATH_MAX];
- while ((option = getopt(ac, av, "vtnredclaqp0f:")) != -1) {
+ while ((option = getopt(ac, av, "vtnredclap0f:")) != -1) {
switch (option) {
case 'r': want |= RELOCATABLE; break;
case 'e': want |= EXECUTABLE; break;
case 'c': want |= CORE; break;
case 'l': want |= SYMLINKS; break;
case 'a': want = (RELOCATABLE|EXECUTABLE|DYNAMIC|CORE); break;
- case 'q': quiet++; break;
case 't': printtype++; break;
case 'n': printname++; break;
case 'v': verbose++; break;
if (list) {
int type;
- quiet = 2;
perr = 0;
while (readline(list, fn)) {
- if ((type = checkfile(fn, want,perr,quiet)) & want) {
+ if ((type = checkfile(fn, want, perr)) & want) {
if (printtype) {
switch (type) {
case RELOCATABLE:
fn = av[optind];
if (verbose) fprintf(stderr, "checking %s\n", av[optind]);
- type = checkfile(fn,want,perr,quiet);
+ type = checkfile(fn,want,perr);
if (printtype) {
switch (type) {
return 0;
}
-int checkfile(char *fn, unsigned int want, int perr, int quiet) {
+int checkfile(char *fn, unsigned int want, int perr) {
Elf64_Ehdr hdr;
int fd, bytes;
int endian = 0;
}
bytes = read(fd, &hdr, sizeof hdr);
close(fd);
- if (bytes < sizeof hdr) {
+ if ((size_t)bytes < sizeof hdr) {
if (perr) fprintf(stderr, "could not read full elf header (wanted %zu got %d bytes)\n", sizeof hdr, bytes);
return 0;
}