IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 2, 2005, 6:02:44 PM (21 years ago)
Author:
eugene
Message:

cleaned handling of single quotes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libfits/header/F_modify.c

    r2415 r3369  
    11# include "fits.h"
    22
     3char *fits_keyword_start (char *line);
    34char *fits_keyword_end (char *line);
    45void pad_ending (char *line, char value, int Nbyte);
     
    9899}
    99100
     101/* given a FITS card line, return pointer to the start of the data area */
     102char *fits_keyword_start (char *line) {
     103
     104  int done;
     105  char *c;
     106
     107  /* find the end of the existing data region */
     108  c = line + 8;
     109  if (*c != '=') return (c);  /* no data in COMMENT field */
     110 
     111  c += 2;
     112  /* advance pointer over whitespace */
     113  while ((*c == ' ') && (c < line + 80)) { c++; }
     114 
     115  /* skip one quote mark */
     116  if ((*c == 0x27) && (c < line + 80)) { c++; }
     117
     118  return (c);
     119}
     120
    100121/* given a FITS card line, return pointer to the end of the data area */
    101122char *fits_keyword_end (char *line) {
     
    105126
    106127  /* find the end of the existing data region */
    107   c2 = line + 8;
    108   if (*c2 != '=') return (c2);  /* no data in COMMENT field */
     128  c1 = line + 8;
     129  if (*c1 != '=') return (c1);  /* no data in COMMENT field */
     130  c1 += 2;
     131
     132  /* advance pointer over whitespace */
     133  while ((*c1 == ' ') && (c1 < line + 80)) { c1++; }
    109134 
    110   c1 = c2 + 2;
    111135  if (c1[0] == 0x27) { /* entry a string, skip over 'fred' */
    112136    for (done = FALSE, c2 = c1 + 1; !done && (c2 < line + 80); c2++) {
     
    116140      }
    117141      if (c2[0] == 0x27) {
    118         c1 = c2 + 1;
     142        c1 = c2;
    119143        done = TRUE;
    120144      }
     
    124148    }
    125149  } else {
    126     while ((*c1 == ' ') && (c1 < line + 80)) c1++;
    127150    while ((*c1 != ' ') && (c1 < line + 80)) c1++;
    128151  }
Note: See TracChangeset for help on using the changeset viewer.