576 lines · 14.1 KB · C
RawDownload
 	srctree = getenv("SRCTREE");	if (!srctree)		srctree = getcwd(NULL, 0);	kernsrctree = getenv("KBUILD_SRC");	if (!kernsrctree || !*kernsrctree)		kernsrctree = srctree;	if (argc != 3) {		usage();		exit(1);	}	/* Open file, exit on error */	infile = fopen(argv[2], "r");        if (infile == NULL) {                fprintf(stderr, "docproc: ");                perror(argv[2]);                exit(2);        } 	if (strcmp("doc", argv[1]) == 0) {		/* Need to do this in two passes.		 * First pass is used to collect all symbols exported		 * in the various files;		 * Second pass generate the documentation.		 * This is required because some functions are declared		 * and exported in different files :-((		 */		/* Collect symbols */		defaultline       = noaction;		internalfunctions = find_export_symbols;		externalfunctions = find_export_symbols;		symbolsonly       = find_export_symbols;		singlefunctions   = noaction2;		docsection        = noaction2;		findall           = find_all_symbols;		parse_file(infile); 		/* Rewind to start from beginning of file again */		fseek(infile, 0, SEEK_SET);		defaultline       = printline;		internalfunctions = intfunc;		externalfunctions = extfunc;		symbolsonly       = printline;		singlefunctions   = singfunc;		docsection        = docsect;		findall           = NULL; 		parse_file(infile); 		for (i = 0; i < all_list_len; i++) {			if (!all_list[i])				continue;			fprintf(stderr, "Warning: didn't use docs for %s\n",				all_list[i]);		}	} else if (strcmp("depend", argv[1]) == 0) {		/* Create first part of dependency chain		 * file.tmpl */		printf("%s\t", argv[2]);		defaultline       = noaction;		internalfunctions = adddep;		externalfunctions = adddep;		symbolsonly       = adddep;		singlefunctions   = adddep2;		docsection        = adddep2;		findall           = adddep;		parse_file(infile);		printf("\n");	} else {		fprintf(stderr, "Unknown option: %s\n", argv[1]);		exit(1);	}	fclose(infile);	fflush(stdout);	return exitstatus;}

Lines 501–576 of 576. Previous lines