Lst_AtEnd(makefiles, optarg);
Lst_AtEnd(&makefiles, optarg);
char *			chdir_verify_path __P((char *, char *));static int		ReadMakefile __P((void *, void *));static void		usage __P((void));int 			main __P((int, char **));static char *curdir;			/* startup directory */static char *objdir;			/* where we chdir'ed to *//*- * MainParseArgs -- *	Parse a given argument vector. Called from main() and from *	Main_ParseArgLine() when the .MAKEFLAGS target is used. * *	XXX: Deal with command line overriding .MAKEFLAGS in makefile * * Results: *	None * * Side Effects: *	Various global and local flags will be set depending on the flags *	given */static voidMainParseArgs(argc, argv)	int argc;	char **argv;{	extern int optind;	extern char *optarg;	int c;	int forceJobs = 0;	optind = 1;	/* since we're called more than once */#ifdef REMOTE# define OPTFLAGS "BD:I:L:PSV:d:ef:ij:km:nqrst"#else# define OPTFLAGS "BD:I:PSV:d:ef:ij:km:nqrst"#endifrearg:	while((c = getopt(argc, argv, OPTFLAGS)) != -1) {		switch(c) {		case 'D':			Var_Set(optarg, "1", VAR_GLOBAL);			Var_Append(MAKEFLAGS, "-D", VAR_GLOBAL);			Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL);			break;		case 'I':			Parse_AddIncludeDir(optarg);			Var_Append(MAKEFLAGS, "-I", VAR_GLOBAL);			Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL);			break;		case 'V':			printVars = TRUE;			Lst_AtEnd(variables, optarg);			Var_Append(MAKEFLAGS, "-V", VAR_GLOBAL);			Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL);			break;		case 'B':			compatMake = TRUE;			break;#ifdef REMOTE		case 'L': {		   char *endptr;			maxLocal = strtol(optarg, &endptr, 0);			if (endptr == optarg) {				fprintf(stderr,					"make: illegal argument to -L option -- %s -- not a number\n",					optarg);				usage();			}			Var_Append(MAKEFLAGS, "-L", VAR_GLOBAL);			Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL);			break;		}#endif		case 'P':			usePipes = FALSE;			Var_Append(MAKEFLAGS, "-P", VAR_GLOBAL);			break;		case 'S':			keepgoing = FALSE;			Var_Append(MAKEFLAGS, "-S", VAR_GLOBAL);			break;		case 'd': {			char *modules = optarg;			for (; *modules; ++modules)				switch (*modules) {				case 'A':					debug = ~0;					break;				case 'a':					debug |= DEBUG_ARCH;					break;				case 'c':					debug |= DEBUG_COND;					break;				case 'd':					debug |= DEBUG_DIR;					break;				case 'f':					debug |= DEBUG_FOR;					break;				case 'g':					if (modules[1] == '1') {						debug |= DEBUG_GRAPH1;						++modules;					}					else if (modules[1] == '2') {						debug |= DEBUG_GRAPH2;						++modules;					}					break;				case 'j':					debug |= DEBUG_JOB;					break;				case 'm':					debug |= DEBUG_MAKE;					break;				case 's':					debug |= DEBUG_SUFF;					break;				case 't':					debug |= DEBUG_TARG;					break;				case 'v':					debug |= DEBUG_VAR;					break;				default:					(void)fprintf(stderr,				"make: illegal argument to d option -- %c\n",					    *modules);					usage();				}			Var_Append(MAKEFLAGS, "-d", VAR_GLOBAL);			Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL);			break;		}		case 'e':			checkEnvFirst = TRUE;			Var_Append(MAKEFLAGS, "-e", VAR_GLOBAL);			break;		case 'f':			Lst_AtEnd(makefiles, optarg);			break;		case 'i':			ignoreErrors = TRUE;			Var_Append(MAKEFLAGS, "-i", VAR_GLOBAL);			break;		case 'j': {		   char *endptr;			forceJobs = TRUE;			maxJobs = strtol(optarg, &endptr, 0);			if (endptr == optarg) {				fprintf(stderr,					"make: illegal argument to -j option -- %s -- not a number\n",					optarg);				usage();			}			maxJobs = atoi(optarg);#ifndef REMOTE			maxLocal = maxJobs;#endif			Var_Append(MAKEFLAGS, "-j", VAR_GLOBAL);			Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL);			break;		}		case 'k':			keepgoing = TRUE;			Var_Append(MAKEFLAGS, "-k", VAR_GLOBAL);			break;		case 'm':			Dir_AddDir(sysIncPath, optarg);			Var_Append(MAKEFLAGS, "-m", VAR_GLOBAL);			Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL);			break;		case 'n':			noExecute = TRUE;			Var_Append(MAKEFLAGS, "-n", VAR_GLOBAL);			break;		case 'q':			queryFlag = TRUE;			/* Kind of nonsensical, wot? */			Var_Append(MAKEFLAGS, "-q", VAR_GLOBAL);			break;		case 'r':			noBuiltins = TRUE;			Var_Append(MAKEFLAGS, "-r", VAR_GLOBAL);			break;		case 's':			beSilent = TRUE;			Var_Append(MAKEFLAGS, "-s", VAR_GLOBAL);			break;		case 't':			touchFlag = TRUE;			Var_Append(MAKEFLAGS, "-t", VAR_GLOBAL);			break;		default:		case '?':			usage();		}	}	/*	 * Be compatible if user did not specify -j and did not explicitly	 * turned compatibility on	 */	if (!compatMake && !forceJobs)		compatMake = TRUE;	oldVars = TRUE;	/*	 * See if the rest of the arguments are variable assignments and	 * perform them if so. Else take them to be targets and stuff them	 * on the end of the "create" list.	 */	for (argv += optind, argc -= optind; *argv; ++argv, --argc)		if (Parse_IsVar(*argv)) {			char *var = estrdup(*argv);			Parse_DoVar(var, VAR_CMD);			free(var);		} else {			if (!**argv)				Punt("illegal (null) argument.");			if (**argv == '-') {				if ((*argv)[1])					optind = 0;     /* -flag... */				else					optind = 1;     /* - */				goto rearg;			}			Lst_AtEnd(create, estrdup(*argv));		}}/*- * Main_ParseArgLine -- *  	Used by the parse module when a .MFLAGS or .MAKEFLAGS target *	is encountered and by main() when reading the .MAKEFLAGS envariable. *	Takes a line of arguments and breaks it into its * 	component words and passes those words and the number of them to the *	MainParseArgs function. *	The line should have all its leading whitespace removed. * * Results: *	None * * Side Effects: *	Only those that come from the various arguments. */voidMain_ParseArgLine(line)	char *line;			/* Line to fracture */{	char **argv;			/* Manufactured argument vector */	int argc;			/* Number of arguments in argv */	char *args;			/* Space used by the args */	char *buf;	char *argv0 = Var_Value(".MAKE", VAR_GLOBAL);	if (line == NULL)		return;	for (; *line == ' '; ++line)		continue;	if (!*line)		return;	buf = emalloc(strlen(line) + strlen(argv0) + 2);	(void)sprintf(buf, "%s %s", argv0, line);	argv = brk_string(buf, &argc, TRUE, &args);	free(buf);	MainParseArgs(argc, argv);	free(args);	free(argv);}char *chdir_verify_path(path, obpath)	char *path;	char *obpath;{	struct stat sb;	if (stat(path, &sb) == 0 && S_ISDIR(sb.st_mode)) {		if (chdir(path)) {			(void)fprintf(stderr, "make warning: %s: %s.\n",				      path, strerror(errno));			return 0;		}		else {			if (path[0] != '/') {				(void) snprintf(obpath, MAXPATHLEN, "%s/%s",						curdir, path);				return obpath;			}			else				return path;		}	}	return 0;}