cextern/cfitsio/lib/eval_y.c
/* Copy to FFRES the contents of FFSTR after stripping away unnecessary
   quotes and backslashes, so that it's suitable for fferror.  The
   heuristic is that double-quoting is unnecessary unless the string
   contains an apostrophe, a comma, or backslash (other than
   backslash-backslash).  FFSTR is taken from fftname.  If FFRES is
   null, do not copy; instead, return the length of what the result
   would have been.  */
Copy to FFRES the contents of FFSTR after stripping away unnecessary
quotes and backslashes, so that it's suitable for fferror.  The
heuristic is that double-quoting is unnecessary unless the string
contains an apostrophe, a comma, or backslash (other than
backslash-backslash).  FFSTR is taken from fftname.  If FFRES is
null, do not copy; instead, return the length of what the result
would have been.
Copy to FFRES the contents of FFSTR after stripping away unnecessary quotes and backslashes so that it ' s suitable for fferror . The heuristic is that double - quoting is unnecessary unless the string contains an apostrophe a comma or backslash ( other than backslash - backslash ) . FFSTR is taken from fftname . If FFRES is null do not copy ; instead return the length of what the result would have been .
static FFSIZE_T
fftnamerr (char *ffres, const char *ffstr)
{
  if (*ffstr == '"')
    {
      FFSIZE_T ffn = 0;
      char const *ffp = ffstr;
      for (;;)
	switch (*++ffp)
	  {
	  case '\'':
	  case ',':
	    goto do_not_strip_quotes;
	  case '\\':
	    if (*++ffp != '\\')
	      goto do_not_strip_quotes;
	  default:
	    if (ffres)
	      ffres[ffn] = *ffp;
	    ffn++;
	    break;
	  case '"':
	    if (ffres)
	      ffres[ffn] = '\0';
	    return ffn;
	  }
    do_not_strip_quotes: ;
    }
  if (! ffres)
    return ffstrlen (ffstr);
  return ffstpcpy (ffres, ffstr) - ffres;
}
static FFSIZE_T fftnamerr ( char * ffres , const char * ffstr ) { if ( * ffstr == ' ' ) { FFSIZE_T ffn = 0 ; char const * ffp = ffstr ; for ( ; ; ) switch ( * ++ ffp ) { case ' \' ' : case ' ' : goto do_not_strip_quotes ; case ' \\ ' : if ( * ++ ffp != ' \\ ' ) goto do_not_strip_quotes ; default : if ( ffres ) ffres [ ffn ] = * ffp ; ffn ++ ; break ; case ' ' : if ( ffres ) ffres [ ffn ] = ' \0 ' ; return ffn ; } do_not_strip_quotes : ; } if ( ! ffres ) return ffstrlen ( ffstr ) ; return ffstpcpy ( ffres , ffstr ) - ffres ; }
Copy to FFRES the contents of FFSTR after stripping away unnecessary
quotes and backslashes, so that it's suitable for fferror.
Copy to FFRES the contents of FFSTR after stripping away unnecessary quotes and backslashes so that it ' s suitable for fferror .
/* Fall through.  */