add_fits_keyword (version 1.0)
You can also look at:
#! /usr/bin/perl
##############################################################################
#
# SYNTAX: add_fits_keyword file keyword value comment
#
# DESCRIPTION: This utility adds or updates a FITS keyword in a FITS file.
# DESCRIPTION: An add occurs if the keyword is not found in the header.
#
# VERSION: 1.0
#
# HISTORY: 0.0 -> 1.0 1999-05-07
# HISTORY: Converted from ksh to perl
#
# CALLS: $UTIL/ftool_test
# CALLS: $FTOOL/fparkey
#
##############################################################################
($file, $keyword, $value, $comment) = @ARGV;
$FTOOL = $ENV{"FTOOL"};
$UTIL = $ENV{"UTIL"};
if ( ! $file ) {
$file = "undefined";
}
if ( ! $keyword ) {
$keyword = "undefined";
}
if ( ! $value ) {
$value = "undefined";
}
if ( ! $comment ) {
#############
# No comment
#############
system("$FTOOL/fparkey value=$value \\
fitsfile=$file \\
keyword=$keyword \\
add=yes >stdout.log 2>stderr${$}.log");
system("$UTIL/ftool_test fparkey $? $0 1 stdout.log stderr${$}.log");
}
else {
####################
# Comment specified
####################
system("$FTOOL/fparkey value=$value \\
fitsfile=$file \\
keyword=$keyword \\
comm=\"$comment\" \\
add=yes >stdout.log 2>stderr${$}.log");
system("$UTIL/ftool_test fparkey $? $0 1 stdout.log stderr${$}.log");
}
exit 0;