/usr/share/gnudatalanguage/astrolib/fdecomp.pro is in gdl-astrolib 2018.02.16+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | pro fdecomp, filename, disk, dir, name, qual, version, OSfamily = osfamily
;+
; NAME:
; FDECOMP
; PURPOSE:
; Routine to decompose file name(s) for any operating system.
;
; CALLING SEQUENCE:
; FDECOMP, filename, disk, dir, name, qual, [OSFamily = ]
;
; INPUT:
; filename - string file name(s), scalar or vector
;
; OUTPUTS:
; All the output parameters will have the same number of elements as
; input filename
;
; disk - disk name, always '' on a Unix machine, scalar or vector string
; dir - directory name, scalar or vector string
; name - file name, scalar or vector string
; qual - qualifier, set equal to the characters beyond the last "."
;
; OPTIONAL INPUT KEYWORD:
; OSFamily - scalar string specifying the operating system, must be either
; 'Windows' or 'unix'. If not supplied,
; then !VERSION.OS_FAMILY is used to determine the OS.
; EXAMPLES:
; Consider the following file names
;
; unix: file = '/itt/idl71/avg.pro'
; Windows: file = 'd:\itt\idl71\avg.pro'
;
; then IDL> FDECOMP, file, disk, dir, name, qual
; will return the following
;
; Disk Dir Name Qual
; Unix: '' '/itt/idl71/' 'avg' 'pro'
; Windows: 'd:' \itt\idl71\ 'avg' 'pro'
;
; NOTES:
; (1) The period is removed between the name and qualifier
; (2) Unlike the intrinsic FILE_BASENAME() and FILE_DIRNAME() functions,
; one can use FDECOMP to decompose a Windows file name on a Unix machine
; or a Unix filename on a Windows machine.
;
; ROUTINES CALLED:
; None.
; HISTORY
; version 1 D. Lindler Oct 1986
; Include VMS DECNET machine name in disk W. Landsman HSTX Feb. 94
; Converted to Mac IDL, I. Freedman HSTX March 1994
; Major rewrite to accept vector filenames V5.3 W. Landsman June 2000
; Fix cases where disk name not always present W. Landsman Sep. 2000
; Make sure version defined for Windows W. Landsman April 2004
; Include final delimiter in directory under Windows as advertised
; W. Landsman May 2006
; Remove VMS support, W. Landsman September 2006
; Remove MacOS branch (same as Unix) W. Landsman August 2009
;-
;--------------------------------------------------------
;
On_error,2 ;Return to caller
compile_opt idl2
if N_params() LT 2 then begin
print, 'Syntax - FDECOMP, filename, disk, [dir, name, qual ] '
return
endif
if ~keyword_set(osfamily) then osfamily = !Version.OS_Family
st = filename
disk = st
replicate_inplace,disk,''
dir = disk
qual = disk
if OSFAMILY EQ "Windows" then begin
lpos = strpos( st, ':') ; DOS diskdrive (i.e. c:)
good = where(lpos GT 0, Ngood)
if Ngood GT 0 then begin
stg = st[good]
lpos = reform( lpos[good], 1, Ngood)
disk[good] = strmid( stg, 0, lpos+1)
st[good] = strmid(stg,lpos+1 )
endif
; Search the path name (i.e. \dos\idl\) and locate last backslash
lpos = strpos(st,'\',/reverse_search)
good = where(lpos Gt 0, Ngood)
endif ELSE begin ;Unix
; Unix directory name ends at last slash
lpos = strpos(st,'/',/reverse_search)
good = where(lpos GE 0, Ngood)
endelse
if Ngood GT 0 then begin ;Extract directory name if present
stg = st[good]
lpos = reform( lpos[good],1, Ngood )
dir[good] = strmid(stg,0, lpos+1)
st[good] = strmid(stg,lpos+1 )
endif
; get name and qualifier (extension)...qual is optional
lpos = strpos(st,'.',/reverse_search)
good = where(lpos GE 0, Ngood)
name = st
if Ngood GT 0 then begin
stg = st[good]
lpos = reform(lpos[good], 1, Ngood)
name[good] = strmid(stg,0,lpos )
qual[good] = strmid(stg,lpos+1 )
endif
return
end
|