function gt_shape_cmd, item, header=header, string=string, short=short, spaces=spaces, x=x, y=y
;
;+
;NAME:
;	gt_shape_cmd
;PURPOSE:
;	To extract the word corresponding to shape commanded and optionally
;	return a string variable for that item.
;CALLING SEQUENCE:
;	x = gt_shape_cmd(roadmap)
;	x = gt_shape_cmd(index)
;	x = gt_shape_cmd(index.sxt, /space)	;put single space before string
;	x = gt_shape_cmd(index, space=3)	;put 3 spaces
;	x = gt_shape_cmd(roadmap, /x)		;just return 1xN array of x shape
;METHOD:
;	The input can be a structure or a scalar.  The structure can
;	be the index, or roadmap, or observing log.
;INPUT:
;	item	- A structure or scalar.  It can be an array.  
;OPTIONAL INPUT:
;	string	- If present, return the string mnemonic (long notation)
;	short	- If present, return the short string mnemonic 
;	spaces	- If present, place that many spaces before the output
;		  string.
;	x	- If present, just return the x (column) shape
;	y	- If present, just return the y (lines) shape
;OUTPUT:
;	returns	- The shape commanded, a integer value or a string
;		  value depending on the switches used.  It is a vector
;		  if the input is a vector.  The default is a 2xN array
;		  where N is the size of the roadmap or index array.  If 
;		  you use the /X or /Y options, it is 1xN.
;OPTIONAL OUTPUT:
;       header  - A string that describes the item that was selected
;                 to be used in listing headers.
;HISTORY:
;	Written 13-Nov-91 by M.Morrison
;	22-Nov-91 (MDM) - Added "x" and "y" options
;	 2-Jun-93 (MDM) - Made the output scalar if one element
;-
;
header_array = ' NX x NY'
fmt = "(i4,'x',i3)"		;8 characters
;
siz = size(item)
typ = siz( siz(0)+1 )
if (typ eq 8) then begin
    ;Check to see if an index was passed (which has the "periph" tag
    ;nested under "sxt", or a roadmap or observing log entry was
    ;passed
    tags = tag_names(item)
    if (tags(0) eq 'GEN') then out = item.sxt.shape_cmd $
			else out = item.shape_cmd
end else begin
    out = item
end
;
if (keyword_set(x)) then begin
    header_array = ' NX '
    fmt = "(i4)"
    out = reform(out(0,*))
end
if (keyword_set(y)) then begin
    header_array = ' NY'
    fmt = "(i3)"
    out = reform(out(1,*))
end

out = gt_conv2str(out, conv2str, conv2short, header_array, header=header, $
	string=string, short=short, spaces=spaces, fmt=fmt)
;
if (n_elements(out) eq 1) then out = out(0)	;MDM added 2-Jun-93
;
return, out
end
