Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csst-pipeline
msc
sextractor
Commits
2e1330bb
Commit
2e1330bb
authored
May 22, 2009
by
Emmanuel Bertin
Browse files
Added filtering of non-numerical characters for floating-point FITS keywords
(thanks to D.G. Bonfield for the suggestion).
parent
57b20df0
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/fits/fitsutil.c
View file @
2e1330bb
...
...
@@ -9,7 +9,7 @@
*
* Contents: functions for handling FITS keywords.
*
* Last modify:
1
2/0
6
/200
7
* Last modify:
2
2/0
5
/200
9
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
...
...
@@ -340,6 +340,7 @@ int fitsread(char *fitsbuf, char *keyword, void *ptr, h_type htype,
sscanf
(
str
+
10
,
" %lf"
,
(
double
*
)
ptr
);
else
sscanf
(
str
+
10
,
" %f"
,
(
float
*
)
ptr
);
printf
(
"%80s
\n
"
,
str
);
break
;
case
H_BOOL
:
sscanf
(
str
+
10
,
"%1s"
,
s
);
...
...
@@ -569,22 +570,26 @@ int fitswrite(char *fitsbuf, char *keyword, void *ptr, h_type htype,
/****** fixexponent ***********************************************************
PROTO void fixexponent(char *s)
PURPOSE Replaces the FORTRAN 'D' exponent sign to 'E' in a FITS line.
PURPOSE Replaces the FORTRAN 'D' exponent sign to 'E' in a FITS line, and filter
out non-numerical characters
INPUT FITS line
OUTPUT -.
NOTES -.
AUTHOR E. Bertin (IAP
& Leiden observatory
)
VERSION 2
5
/0
4/97
AUTHOR E. Bertin (IAP)
VERSION 2
2
/0
5/2009
***/
void
fixexponent
(
char
*
s
)
{
int
i
;
int
c
,
i
;
s
+=
9
;
for
(
i
=
71
;
((
int
)
*
s
)
&&
(
int
)
*
s
!=
'/'
&&
i
--
;
s
++
)
if
(
(
int
)
*
s
==
'D'
||
(
int
)
*
s
==
'd'
)
for
(
i
=
71
;
(
c
=
(
int
)
*
s
)
&&
c
!=
'/'
&&
i
--
;
s
++
)
if
(
c
==
'D'
||
c
==
'd'
)
*
s
=
(
char
)
'E'
;
else
if
((
c
<
'0'
||
c
>
'9'
)
&&
c
!=
'+'
&&
c
!=
'-'
&&
c
!=
'e'
&&
c
!=
'E'
&&
c
!=
'.'
)
*
s
=
' '
;
return
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment