FUNCTION dir2name, filename ; Description: This function takes a file name with a full directory path and ; returns the file name without the directory path. ; ; Input Parameters: ; ; filename - STRING - The full directory path and file name to be processed. ; ; Return Value: ; ; The input parameter "filename" is returned with the directory path removed. ; For example, for the filename '/data/dmb/ngc7789.fits', the function would ; return the string 'ngc7789.fits'. ; In more detail, if the parameter "filename" is not a string, then the ; function returns an empty string ''. If the parameter "filename" does not ; contain any instances of the character '/', then the function returns the ; parameter "filename". If the parameter "filename" contains instances of ; the character '/', then the function returns the last string of characters ; after the last instance of the character '/', even if this is the empty ; string ''. ; ; Author: Dan Bramich (dmb@ing.iac.es) ; ; History: ; ; 19/05/2008 - Module created (dmb) ;Check that "filename" is a scalar string ;If "filename" is an empty string, then return an empty string ;Decompose "filename" into individual characters ;Find the occurrences of "/" in "filename" ;If "filename" does not contain any instances of the character "/", then ;return "filename" ;If "filename" does contain instances of the character "/", then return ;the last string of characters after the last instance of "/", even if ;this is the empty string