⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gcc.c

📁 GUN开源阻止下的编译器GCC
💻 C
📖 第 1 页 / 共 5 页
字号:
	    /* Now try just the name.  */	    strcpy (temp, pl->prefix);	    strcat (temp, machine_suffix);	    strcat (temp, name);	    if (access (temp, mode) == 0)	      {		if (pl->used_flag_ptr != 0)		  *pl->used_flag_ptr = 1;		return temp;	      }	  }	/* Certain prefixes are tried with just the machine type,	   not the version.  This is used for finding as, ld, etc.  */	if (just_machine_suffix && pl->require_machine_suffix == 2)	  {	    /* Some systems have a suffix for executable files.	       So try appending that first.  */	    if (file_suffix[0] != 0)	      {		strcpy (temp, pl->prefix);		strcat (temp, just_machine_suffix);		strcat (temp, name);		strcat (temp, file_suffix);		if (access (temp, mode) == 0)		  {		    if (pl->used_flag_ptr != 0)		      *pl->used_flag_ptr = 1;		    return temp;		  }	      }	    strcpy (temp, pl->prefix);	    strcat (temp, just_machine_suffix);	    strcat (temp, name);	    if (access (temp, mode) == 0)	      {		if (pl->used_flag_ptr != 0)		  *pl->used_flag_ptr = 1;		return temp;	      }	  }	/* Certain prefixes can't be used without the machine suffix	   when the machine or version is explicitly specified.  */	if (!pl->require_machine_suffix)	  {	    /* Some systems have a suffix for executable files.	       So try appending that first.  */	    if (file_suffix[0] != 0)	      {		strcpy (temp, pl->prefix);		strcat (temp, name);		strcat (temp, file_suffix);		if (access (temp, mode) == 0)		  {		    if (pl->used_flag_ptr != 0)		      *pl->used_flag_ptr = 1;		    return temp;		  }	      }	    strcpy (temp, pl->prefix);	    strcat (temp, name);	    if (access (temp, mode) == 0)	      {		if (pl->used_flag_ptr != 0)		  *pl->used_flag_ptr = 1;		return temp;	      }	  }      }  free (temp);  return 0;}/* Add an entry for PREFIX in PLIST.  If FIRST is set, it goes   at the start of the list, otherwise it goes at the end.   If WARN is nonzero, we will warn if no file is found   through this prefix.  WARN should point to an int   which will be set to 1 if this entry is used.   REQUIRE_MACHINE_SUFFIX is 1 if this prefix can't be used without   the complete value of machine_suffix.   2 means try both machine_suffix and just_machine_suffix.  */static voidadd_prefix (pprefix, prefix, first, require_machine_suffix, warn)     struct path_prefix *pprefix;     char *prefix;     int first;     int require_machine_suffix;     int *warn;{  struct prefix_list *pl, **prev;  int len;  if (!first && pprefix->plist)    {      for (pl = pprefix->plist; pl->next; pl = pl->next)	;      prev = &pl->next;    }  else    prev = &pprefix->plist;  /* Keep track of the longest prefix */  len = strlen (prefix);  if (len > pprefix->max_len)    pprefix->max_len = len;  pl = (struct prefix_list *) xmalloc (sizeof (struct prefix_list));  pl->prefix = save_string (prefix, len);  pl->require_machine_suffix = require_machine_suffix;  pl->used_flag_ptr = warn;  if (warn)    *warn = 0;  if (*prev)    pl->next = *prev;  else    pl->next = (struct prefix_list *) 0;  *prev = pl;}/* Print warnings for any prefixes in the list PPREFIX that were not used.  */static voidunused_prefix_warnings (pprefix)     struct path_prefix *pprefix;{  struct prefix_list *pl = pprefix->plist;  while (pl)    {      if (pl->used_flag_ptr != 0 && !*pl->used_flag_ptr)	{	  error ("file path prefix `%s' never used",		 pl->prefix);	  /* Prevent duplicate warnings.  */	  *pl->used_flag_ptr = 1;	}      pl = pl->next;    }}/* Get rid of all prefixes built up so far in *PLISTP. */static voidfree_path_prefix (pprefix)     struct path_prefix *pprefix;{  struct prefix_list *pl = pprefix->plist;  struct prefix_list *temp;  while (pl)    {      temp = pl;      pl = pl->next;      free (temp->prefix);      free ((char *) temp);    }  pprefix->plist = (struct prefix_list *) 0;}/* stdin file number.  */#define STDIN_FILE_NO 0/* stdout file number.  */#define STDOUT_FILE_NO 1/* value of `pipe': port index for reading.  */#define READ_PORT 0/* value of `pipe': port index for writing.  */#define WRITE_PORT 1/* Pipe waiting from last process, to be used as input for the next one.   Value is STDIN_FILE_NO if no pipe is waiting   (i.e. the next command is the first of a group).  */static int last_pipe_input;/* Fork one piped subcommand.  FUNC is the system call to use   (either execv or execvp).  ARGV is the arg vector to use.   NOT_LAST is nonzero if this is not the last subcommand   (i.e. its output should be piped to the next one.)  */#ifdef __MSDOS__#include <process.h>static intpexecute (search_flag, program, argv, not_last)     int search_flag;     char *program;     char *argv[];     int not_last;{#ifdef __GO32__  int i = (search_flag ? spawnv : spawnvp) (1, program, argv);#else  char *scmd, *rf;  FILE *argfile;  int i, el = search_flag ? 0 : 4;  scmd = (char *)malloc (strlen (program) + strlen (temp_filename) + 6 + el);  rf = scmd + strlen(program) + 2 + el;  sprintf (scmd, "%s%s @%s.gp", program,	   (search_flag ? "" : ".exe"), temp_filename);  argfile = fopen (rf, "w");  if (argfile == 0)    pfatal_with_name (rf);  for (i=1; argv[i]; i++)    {      char *cp;      for (cp = argv[i]; *cp; cp++)	{	  if (*cp == '"' || *cp == '\'' || *cp == '\\' || isspace (*cp))	    fputc ('\\', argfile);	  fputc (*cp, argfile);	}      fputc ('\n', argfile);    }  fclose (argfile);  i = system (scmd);  remove (rf);#endif    if (i == -1)    {      perror_exec (program);      return MIN_FATAL_STATUS << 8;    }  return i << 8;}#endif#if !defined(__MSDOS__) && !defined(OS2) && !defined(_WIN32)static intpexecute (search_flag, program, argv, not_last)     int search_flag;     char *program;     char *argv[];     int not_last;{  int (*func)() = (search_flag ? execv : execvp);  int pid;  int pdes[2];  int input_desc = last_pipe_input;  int output_desc = STDOUT_FILE_NO;  int retries, sleep_interval;  /* If this isn't the last process, make a pipe for its output,     and record it as waiting to be the input to the next process.  */  if (not_last)    {      if (pipe (pdes) < 0)	pfatal_with_name ("pipe");      output_desc = pdes[WRITE_PORT];      last_pipe_input = pdes[READ_PORT];    }  else    last_pipe_input = STDIN_FILE_NO;  /* Fork a subprocess; wait and retry if it fails.  */  sleep_interval = 1;  for (retries = 0; retries < 4; retries++)    {      pid = vfork ();      if (pid >= 0)	break;      sleep (sleep_interval);      sleep_interval *= 2;    }  switch (pid)    {    case -1:#ifdef vfork      pfatal_with_name ("fork");#else      pfatal_with_name ("vfork");#endif      /* NOTREACHED */      return 0;    case 0: /* child */      /* Move the input and output pipes into place, if nec.  */      if (input_desc != STDIN_FILE_NO)	{	  close (STDIN_FILE_NO);	  dup (input_desc);	  close (input_desc);	}      if (output_desc != STDOUT_FILE_NO)	{	  close (STDOUT_FILE_NO);	  dup (output_desc);	  close (output_desc);	}      /* Close the parent's descs that aren't wanted here.  */      if (last_pipe_input != STDIN_FILE_NO)	close (last_pipe_input);      /* Exec the program.  */      (*func) (program, argv);      perror_exec (program);      exit (-1);      /* NOTREACHED */      return 0;    default:      /* In the parent, after forking.	 Close the descriptors that we made for this child.  */      if (input_desc != STDIN_FILE_NO)	close (input_desc);      if (output_desc != STDOUT_FILE_NO)	close (output_desc);      /* Return child's process number.  */      return pid;    }}#endif /* not __MSDOS__ and not OS2 and not _WIN32 */#if defined(OS2)static intpexecute (search_flag, program, argv, not_last)     int search_flag;     char *program;     char *argv[];     int not_last;{  return (search_flag ? spawnv : spawnvp) (1, program, argv);}#endif /* OS2 */#if defined(_WIN32)static intpexecute (search_flag, program, argv, not_last)     int search_flag;     char *program;     char *argv[];     int not_last;{  return (search_flag ? __spawnv : __spawnvp) (1, program, argv);}#endif /* _WIN32 *//* Execute the command specified by the arguments on the current line of spec.   When using pipes, this includes several piped-together commands   with `|' between them.   Return 0 if successful, -1 if failed.  */static intexecute (){  int i;  int n_commands;		/* # of command.  */  char *string;  struct command    {      char *prog;		/* program name.  */      char **argv;		/* vector of args.  */      int pid;			/* pid of process for this command.  */    };  struct command *commands;	/* each command buffer with above info.  */  /* Count # of piped commands.  */  for (n_commands = 1, i = 0; i < argbuf_index; i++)    if (strcmp (argbuf[i], "|") == 0)      n_commands++;  /* Get storage for each command.  */  commands    = (struct command *) alloca (n_commands * sizeof (struct command));  /* Split argbuf into its separate piped processes,     and record info about each one.     Also search for the programs that are to be run.  */  commands[0].prog = argbuf[0]; /* first command.  */  commands[0].argv = &argbuf[0];  string = find_a_file (&exec_prefixes, commands[0].prog, X_OK);  if (string)    commands[0].argv[0] = string;  for (n_commands = 1, i = 0; i < argbuf_index; i++)    if (strcmp (argbuf[i], "|") == 0)      {				/* each command.  */#ifdef __MSDOS__        fatal ("-pipe not supported under MS-DOS");#endif	argbuf[i] = 0;	/* termination of command args.  */	commands[n_commands].prog = argbuf[i + 1];	commands[n_commands].argv = &argbuf[i + 1];	string = find_a_file (&exec_prefixes, commands[n_commands].prog, X_OK);	if (string)	  commands[n_commands].argv[0] = string;	n_commands++;      }  argbuf[argbuf_index] = 0;  /* If -v, print what we are about to do, and maybe query.  */  if (verbose_flag)    {      /* Print each piped command as a separate line.  */      for (i = 0; i < n_commands ; i++)	{	  char **j;	  for (j = commands[i].argv; *j; j++)	    fprintf (stderr, " %s", *j);	  /* Print a pipe symbol after all but the last command.  */	  if (i + 1 != n_commands)	    fprintf (stderr, " |");	  fprintf (stderr, "\n");	}      fflush (stderr);#ifdef DEBUG      fprintf (stderr, "\nGo ahead? (y or n) ");      fflush (stderr

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -