hput.c | hput.c | |||
---|---|---|---|---|
/*** File libwcs/hput.c | /*** File libwcs/hput.c | |||
*** August 22, 2007 | *** September 9, 2011 | |||
*** By Doug Mink, dmink@cfa.harvard.edu | *** By Doug Mink, dmink@cfa.harvard.edu | |||
*** Harvard-Smithsonian Center for Astrophysics | *** Harvard-Smithsonian Center for Astrophysics | |||
*** Copyright (C) 1995-2007 | *** Copyright (C) 1995-2011 | |||
*** Smithsonian Astrophysical Observatory, Cambridge, MA, USA | *** Smithsonian Astrophysical Observatory, Cambridge, MA, USA | |||
This library is free software; you can redistribute it and/or | This library is free software; you can redistribute it and/or | |||
modify it under the terms of the GNU Lesser General Public | modify it under the terms of the GNU Lesser General Public | |||
License as published by the Free Software Foundation; either | License as published by the Free Software Foundation; either | |||
version 2 of the License, or (at your option) any later version. | version 2 of the License, or (at your option) any later version. | |||
This library is distributed in the hope that it will be useful, | This library is distributed in the hope that it will be useful, | |||
but WITHOUT ANY WARRANTY; without even the implied warranty of | but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
skipping to change at line 275 | skipping to change at line 275 | |||
{ | { | |||
int lroot, lcv, i, ii, nkw, lkw, lval; | int lroot, lcv, i, ii, nkw, lkw, lval; | |||
int comment = 0; | int comment = 0; | |||
const char *v; | const char *v; | |||
char keyroot[8], newkey[12], value[80]; | char keyroot[8], newkey[12], value[80]; | |||
char squot = 39; | char squot = 39; | |||
/* If COMMENT or HISTORY, use the same keyword on every line */ | /* If COMMENT or HISTORY, use the same keyword on every line */ | |||
lkw = (int) strlen (keyword); | lkw = (int) strlen (keyword); | |||
if (lkw == 7 && (strncmp (keyword,"COMMENT",7) == 0 || | if (lkw == 7 && (strncmp (keyword,"COMMENT",7) == 0 || | |||
strncmp (keyword,"HISTORY",7) == 0)) | strncmp (keyword,"HISTORY",7) == 0)) { | |||
comment = 1; | comment = 1; | |||
lroot = 0; | ||||
} | ||||
/* Set up keyword root, shortening it to 6 characters, if necessary */ | /* Set up keyword root, shortening it to 6 characters, if necessary */ | |||
else { | else { | |||
comment = 0; | comment = 0; | |||
strcpy (keyroot, keyword); | strcpy (keyroot, keyword); | |||
lroot = (int) strlen (keyroot); | lroot = (int) strlen (keyroot); | |||
if (lroot > 6) { | if (lroot > 6) { | |||
keyroot[6] = (char) 0; | keyroot[6] = (char) 0; | |||
lroot = 6; | lroot = 6; | |||
} | } | |||
skipping to change at line 677 | skipping to change at line 679 | |||
q2 = strchr (q1+1, squot); | q2 = strchr (q1+1, squot); | |||
if (q2 == NULL) { | if (q2 == NULL) { | |||
q2 = line + 79; | q2 = line + 79; | |||
while (*q2 == space) | while (*q2 == space) | |||
q2--; | q2--; | |||
q2++; | q2++; | |||
} | } | |||
} | } | |||
else | else | |||
q1 = NULL; | q1 = NULL; | |||
q2 = NULL; | ||||
} | } | |||
else | else | |||
q2 = NULL; | q2 = NULL; | |||
if (c1 != NULL) | if (c1 != NULL) | |||
c0 = v1 + (c1 - line) - 1; | c0 = v1 + (c1 - line) - 1; | |||
else if (q2 == NULL || q2-line < 30) | else if (q2 == NULL || q2-line < 30) | |||
c0 = v1 + 30; | c0 = v1 + 30; | |||
else | else | |||
skipping to change at line 1291 | skipping to change at line 1294 | |||
* May 22 2006 Add option to leave blank line when deleting a keyword | * May 22 2006 Add option to leave blank line when deleting a keyword | |||
* Jun 15 2006 Fix comment alignment in hputc() and hputcom() | * Jun 15 2006 Fix comment alignment in hputc() and hputcom() | |||
* Jun 20 2006 Initialized uninitialized variables in hputm() and hputcom() | * Jun 20 2006 Initialized uninitialized variables in hputm() and hputcom() | |||
* | * | |||
* Jan 4 2007 Declare keyword to be const | * Jan 4 2007 Declare keyword to be const | |||
* Jan 4 2007 Drop unused subroutine hputi2() | * Jan 4 2007 Drop unused subroutine hputi2() | |||
* Jan 5 2007 Drop ksearch() declarations; it is now in fitshead.h | * Jan 5 2007 Drop ksearch() declarations; it is now in fitshead.h | |||
* Jan 16 2007 Fix bugs in ra2str() and dec2str() so ndec=0 works | * Jan 16 2007 Fix bugs in ra2str() and dec2str() so ndec=0 works | |||
* Aug 20 2007 Fix bug so comments after quoted keywords work | * Aug 20 2007 Fix bug so comments after quoted keywords work | |||
* Aug 22 2007 If closing quote not found, make one up | * Aug 22 2007 If closing quote not found, make one up | |||
* | ||||
* Sep 9 2011 Always initialize q2 and lroot | ||||
*/ | */ | |||
End of changes. 6 change blocks. | ||||
3 lines changed or deleted | 8 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |