PRO Add, header, zeile, pos, overwrite=ow ;+ ; NAME: ; Add ; PURPOSE: ; Add/insert/overwrite an entry in a FITS-header ; CALLING SEQUENCE: ; Add, Header, Line [, Pos] ; INPUTS: ; Header : FITS-Header (String array) ; Line : single Fits line (String) ; OPTIONAL INPUT PARAMETER: ; Pos : (integer) Position where to insert Line into Header. If ; omitted, Line is added immideately before the END line. ; KEYWORDS: ; OVERWRITE: (Flag) If set and not zero, replace an existing ; line with the new one. Only meaningfull if Pos is ; supplied. Default is to insert the new line ; between the existing ones. ; MODIFICATION HISTORY: ; 01-Aug-1993 P.Suetterlin, KIS ;- z = bytarr(80) & z(*) = 32 & z(0) = byte(zeile) z = string(z) IF n_params() LE 2 THEN BEGIN p = (where(strpos(header, 'END ') EQ 0))(0) IF p GT 0 THEN pos = p ELSE pos = n_elements(header) ENDIF IF keyword_set(ow) THEN $ header(pos) = z $ ELSE BEGIN IF pos EQ n_elements(header) THEN $ header = [header, z] $ ELSE $ header = [header(0:pos-1), z, header(pos:*)] ENDELSE END