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

📄 args.c

📁 GNU 系统开发优化 C 语言程序的应用程序
💻 C
📖 第 1 页 / 共 2 页
字号:
  {"blank-lines-after-block-comments", "bbb"},  {"blank-lines-after-commas", "bc"},  {"brace-indent", "bli"},  {"braces-after-if-line", "bl"},  {"braces-on-if-line", "br"},  {"Bill-Shannon", "bs"},  {"blank-before-sizeof", "bs"},  {"comment-delimiters-on-blank-lines", "cdb"},  {"declaration-comment-column", "cd"},  {"cuddle-else", "ce"},  {"continuation-indentation", "ci"},  {"case-indentation", "cli"},  {"else-endif-column", "cp"},  {"space-after-cast", "cs"},  {"comment-indentation", "c"},  {"declaration-indentation", "di"},  {"left-justify-declarations", "dj"},  {"line-comments-indentation", "d"},  {"extra-expression-indentation", "eei"},  {"else-if", "ei"},  {"*", "fbc"},  {"*", "fbx"},  {"*", "fb"},  {"format-first-column-comments", "fc1"},  {"format-all-comments", "fca"},  {"*", "fc"},  {"*", "fk"},  {"*", "fs"},  {"gnu-style", "gnu"},  {"parameter-indentation", "ip"},  {"indentation-level", "i"},  {"indent-level", "i"},  {"k-and-r-style", "kr"},  {"kernighan-and-ritchie-style", "kr"},  {"kernighan-and-ritchie", "kr"},  {"*", "lc"},  {"continue-at-parentheses", "lp"},  {"leave-preprocessor-space", "lps"},  {"remove-preprocessor-space", "nlps"},  {"line-length", "l"},  {"no-blank-lines-after-ifdefs", "nbacc"},  {"no-blank-lines-after-procedure-declarations", "nbadp"},  {"no-blank-lines-after-declarations", "nbad"},  {"no-blank-lines-after-procedures", "nbap"},  {"no-blank-lines-after-block-comments", "nbbb"},  {"no-blank-lines-after-commas", "nbc"},  {"no-Bill-Shannon", "nbs"},  {"no-blank-before-sizeof", "nbs"},  {"no-comment-delimiters-on-blank-lines", "ncdb"},  {"dont-cuddle-else", "nce"},  {"no-space-after-casts", "ncs"},  {"dont-left-justify-declarations", "ndj"},  {"no-extra-expression-indentation", "neei"},  {"no-else-if", "nei"},  {"dont-format-first-column-comments", "nfc1"},  {"dont-format-comments", "nfca"},  {"no-parameter-indentation", "nip"},  {"dont-indent-parameters", "nip"},  {"dont-line-up-parentheses", "nlp"},  {"no-space-after-function-call-names", "npcs"},  {"ignore-profile", "npro"},  {"dont-break-procedure-type", "npsl"},  {"*", "nps"},  {"dont-star-comments", "nsc"},  {"leave-optional-blank-lines", "nsob"},  {"dont-space-special-semicolon", "nss"},  {"no-verbosity", "nv"},  {"output", "o"},  {"output-file", "o"},  {"original", "orig"},  {"original-style", "orig"},  {"berkeley-style", "orig"},  {"berkeley", "orig"},  {"space-after-procedure-calls", "pcs"},  {"procnames-start-lines", "psl"},  {"pointer-as-binary-op", "ps"},  {"start-left-side-of-comments", "sc"},  {"swallow-optional-blank-lines", "sob"},  {"space-special-semicolon", "ss"},  {"standard-output", "st"},  {"troff-formatting", "troff"},  {"tab-size", "ts"},  {"version", "version"},  {"verbose", "v"},  {0, 0},};/* S1 should be a string.  S2 should be a string, perhaps followed by an   argument.  Compare the two, returning true if they are equal, and if they   are equal set *START_PARAM to point to the argument in S2.  */static inteqin (s1, s2, start_param)     register char *s1;     register char *s2;     char **start_param;{  while (*s1)    {      if (*s1++ != *s2++)	return (false);    }  *start_param = s2;  return (true);}/* Set the defaults. */voidset_defaults (){  register struct pro *p;  for (p = pro; p->p_name; p++)    if (p->p_type == PRO_BOOL || p->p_type == PRO_INT)      *p->p_obj = p->p_default;}/* Stings which can prefix an option, longest first. */static char *option_prefixes[] ={  "--",  "-",  "+",  0};static intoption_prefix (arg)     char *arg;{  register char **prefixes = option_prefixes;  register char *this_prefix, *argp;  do    {      this_prefix = *prefixes;      argp = arg;      while (*this_prefix == *argp)	{	  this_prefix++;	  argp++;	}      if (*this_prefix == '\0')	return this_prefix - *prefixes;    }  while (*++prefixes);  return 0;}/* Process an option ARG (e.g. "-l60").  PARAM is a possible value   for ARG, if PARAM is nonzero.  EXPLICT should be nonzero iff the   argument is being explicitly specified (as opposed to being taken from a   PRO_SETTINGS group of settings).  */intset_option (option, param, explicit)     char *option, *param;     int explicit;{  struct pro *p = pro;  char *param_start;  register int option_length, val;  val = 0;  option_length = option_prefix (option);  if (option_length > 0)    {      if (option_length == 1 && *option == '-')	/* Short option prefix */	{	  option++;	  for (p = pro; p->p_name; p++)	    if (*p->p_name == *option		&& eqin (p->p_name, option, &param_start))	      goto found;	}      else	/* Long prefix */	{	  register struct long_option_conversion *o = option_conversions;	  option += option_length;	  while (o->short_name)	    {	      if (eqin (o->long_name, option, &param_start))		break;	      o++;	    }	  /* Searching twice means we don't have to keep the two tables in	     sync. */	  if (o->short_name)	    for (p = pro; p->p_name; p++)	      if (!strcmp (p->p_name, o->short_name))		goto found;	}    }  fprintf (stderr, "indent: unknown option \"%s\"\n", option - 1);  exit (1);arg_missing:  fprintf (stderr, "indent: missing argument to parameter %s\n", option);  exit (1);found:  /* If the parameter has been explicitly specified, we don't     want a group of bundled settings to override the explicit     setting.  */  if (verbose)    fprintf (stderr, "option: %s\n", p->p_name);  if (explicit || !*(p->p_explicit))    {      if (explicit)	*(p->p_explicit) = 1;      switch (p->p_type)	{	case PRO_PRSTRING:	  puts ((char *) p->p_obj);	  exit (0);	case PRO_SETTINGS:	  {	    char *t;		/* current position */	    t = (char *) p->p_obj;	    do	      {		set_option (t, 0, 0);		/* advance to character following next NUL */		while (*t++);	      }	    while (*t);	  }	case PRO_IGN:	  break;	case PRO_KEY:	  {	    register char *str;	    if (*param_start == 0)	      if (!(param_start = param))		goto arg_missing;	      else		val = 1;	    str = (char *) xmalloc (strlen (param_start) + 1);	    strcpy (str, param_start);	    addkey (str, rw_decl);	  }	  break;	case PRO_BOOL:	  if (p->p_special == OFF)	    *p->p_obj = false;	  else	    *p->p_obj = true;	  break;	case PRO_INT:	  if (*param_start == 0)	    if (!(param_start = param))	      goto arg_missing;	    else	      val = 1;	  if (!isdigit (*param_start))	    {	      fprintf (stderr,		     "indent: option ``%s'' requires a numeric parameter\n",		       option - 1);	      exit (1);	    }	  *p->p_obj = atoi (param_start);	  break;	case PRO_FONT:	  if (*param_start == 0)	    if (!(param_start = param))	      goto arg_missing;	    else	      val = 1;	  parsefont ((struct fstate *) p->p_obj, param_start);	  break;	default:	  fprintf (stderr, "indent: set_option: internal error: p_type %d\n",		   (int) p->p_type);	  exit (1);	}    }  return val;}/* Scan the options in the file F. */static voidscan_profile (f)     register FILE *f;{  register int i;  register char *p, *this, *next, *temp;  char b0[BUFSIZ];  char b1[BUFSIZ];  next = b0;  this = 0;  while (1)    {      for (p = next; (i = getc (f)) != EOF && (*p = i) > ' '; ++p);      if (p != next)	{	  *p++ = 0;	  if (!this)	    {	      this = b0;	      next = b1;	      continue;	    }	  if (set_option (this, next, 1))	    {	      this = 0;	      next = b0;	      continue;	    }	  temp = this;	  this = next;	  next = temp;	}      else if (i == EOF)	{	  if (this)	    set_option (this, 0, 1);	  return;	}    }}/* Some operating systems don't allow more than one dot in a filename.  */#if defined (ONE_DOT_PER_FILENAME)#define INDENT_PROFILE "indent.pro"#else#define INDENT_PROFILE ".indent.pro"#endif#ifndef PROFILE_FORMAT#define PROFILE_FORMAT "%s/%s"#endif/* set_profile looks for ./.indent.pro or $HOME/.indent.pro, in   that order, and reads the options given in that file.  Return the   path of the file read.   Note that as of version 1.3, indent only reads one file. */char *set_profile (){  register FILE *f;  char *fname;  static char prof[] = INDENT_PROFILE;  char *homedir;  if ((f = fopen (INDENT_PROFILE, "r")) != NULL)    {      int len = strlen (INDENT_PROFILE) + 3;      scan_profile (f);      (void) fclose (f);      fname = xmalloc (len);      fname[0] = '.';      fname[1] = '/';      memcpy (&fname[2], INDENT_PROFILE, len - 3);      fname[len - 1] = '\0';      return fname;    }  homedir = getenv ("HOME");  if (homedir)    {      fname = xmalloc (strlen (homedir) + 10 + sizeof prof);      sprintf (fname, PROFILE_FORMAT, homedir, prof);      if ((f = fopen (fname, "r")) != NULL)	{	  scan_profile (f);	  (void) fclose (f);	  return fname;	}      free (fname);    }  return 0;}

⌨️ 快捷键说明

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