Example #1
0
int main(int argc, char *argv[]) {
    //NSAutoreleasePool *pool = [NSAutoreleasePool new];
    int i;
    //dumpinfo("/System/Library/Frameworks/AppKit.framework/AppKit");
    if (argc == 1) {
        printf("Usage: gcinfo [-v] [-r] [--] library_or_executable_image [image2 ...]\n");
        printf(" prints Garbage Collection readiness of named images, ignoring those without ObjC segments\n");
        printf("  'GC'      - compiled with write-barriers, presumably otherwise aware\n");
        printf("  'RR'      - retain/release (presumed) aware for non-GC\n");
        printf("  'GC-only' - compiled with write-barriers and marked at compile time as not being retain/release savvy\n");
        printf("  -v        - provide archtectural details\n");
        printf("  -r        - only show libraries that are non-GC, e.g. RR only\n");
        printf("  --        - read files & directories from stdin, e.g. find /Plug-ins | gcinfo --\n");
        printf("\nAuthor: [email protected]\n");
        exit(0);
    }
    for (i = 1; i < argc; ++i) {
        if (!strcmp(argv[i], "-v")) {
            verbose = true;
            continue;
        }
        if (!strcmp(argv[i], "-d")) {
            debug = true;
            continue;
        }
        if (!strcmp(argv[i], "-q")) {
            quiet = true;
            continue;
        }
        if (!strcmp(argv[i], "-r")) {
            quiet = true;
            rrOnly = true;
            continue;
        }
        if (!strcmp(argv[i], "-p")) {
            patch = true;
            continue;
        }
        if (!strcmp(argv[i], "--")) {
            char buf[1024];
            while (fgets(buf, 1024, stdin)) {
                int len = strlen(buf);
                buf[len-1] = 0;
                dumpinfo(buf);
            }
            continue;
        }
        dumpinfo(argv[i]);
    }
    return Errors;
}
Example #2
0
main() {
    FILE *in;
    int i;

    AddPredefineds();
    in = fopen("UnicodeData.txt","r");
    if ( in==NULL ) {
	fprintf(stderr,"Can't open UnicodeData.txt\n" );
	exit(1);
    }
    ParseUnicodeFile(in);
    for ( i=0; i<95; ++i )
	info[i] = RevQueue(info[i]);
    dumpinfo();
    exit(0);
}
Example #3
0
static void
report(void)
{
	struct cfstat *dp, *choice;
	int	i;
	int	pkgLgth = 0;
	int	longestPkg = 0;
	boolean_t output = B_FALSE;

	for (;;) {
		choice = (struct cfstat *)0;
		for (dp = data; dp; dp = dp->next) {
			pkgLgth = strlen(dp->pkginst);
			if (pkgLgth > longestPkg)
				longestPkg = pkgLgth;
		}
		for (dp = data; dp; dp = dp->next) {
			/* get information about this package */
			if (dp->installed < 0)
				continue; /* already used */
			if (Lflag && pkgcnt) {
				choice = dp;
				break;
			} else if (!choice ||
			    (strcmp(choice->pkginst, dp->pkginst) > 0))
				choice = dp;
		}
		if (!choice)
			break; /* no more packages */

		if (pkginfo(&info, choice->pkginst, ckarch, ckvers)) {
			choice->installed = (-1);
			continue;
		}

		/*
		 * Confirm that the pkginfo file contains the
		 * required information.
		 */
		if (info.name == NULL || *(info.name) == 0 ||
		    info.arch == NULL || *(info.arch) == 0 ||
		    info.version == NULL || *(info.version) == 0 ||
		    info.catg == NULL || *(info.catg) == 0) {
			progerr(gettext(ERR_BADINFO));
			errflg++;
			return;
		}

		/* is it in an appropriate catgory? */
		if (iscatg(info.catg)) {
			choice->installed = (-1);
			continue;
		}

		if (!pflag &&
			/* don't include partially installed packages */
			(choice->partial || (info.status == PI_PARTIAL) ||
				(info.status == PI_UNKNOWN))) {
			choice->installed = (-1);
			continue;
		}

		if (Nflag && (info.status == PI_PRESVR4)) {
			/* don't include preSVR4 packages */
			choice->installed = (-1);
			continue;
		}

		if (!iflag && (info.status == PI_INSTALLED)) {
			/* don't include completely installed packages */
			choice->installed = (-1);
			continue;
		}

		output = B_TRUE;
		dumpinfo(choice, longestPkg);
		choice->installed = (-1);
		if (pkgcnt) {
			i = selectp(choice->pkginst);
			if (i >= 0)
				pkg[i] = NULL;
			else {
				if (qflag) {
					errflg++;
					return;
				}
			}
		}
	}

	/* If no package matched and no output produced set error flag */
	if (!output)
		errflg++;

	/* verify that each package listed on command line was output */
	for (i = 0; i < pkgcnt; ++i) {
		if (pkg[i]) {
			errflg++;
			if (!qflag) {
				if (pflag == 1)
					logerr(gettext(ERR_NOPINFO), pkg[i]);
				else
					logerr(gettext(ERR_NOINFO), pkg[i]);
			} else
				return;
		}
	}
	(void) pkginfo(&info, NULL); /* free up all memory and open fds */
}
Example #4
0
static void failwith(const char *msg)
{
  fprintf(stderr, "%s\n", msg);
  dumpinfo();
  exit(EXIT_FAILURE);
}
Example #5
0
static void failwith_perror(const char *msg)
{
  perror(msg);
  dumpinfo();
  exit(EXIT_FAILURE);
}