home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
CLIPPER
/
NCCLIB.ZIP
/
NCCVIEW.ZIP
/
G_DOS.PRG
< prev
next >
Wrap
Text File
|
1993-10-26
|
2KB
|
101 lines
//═══════════════════════════════════════════════════════╕
// Program .....: G_Dos │
// CopyRight ...: 1993 National Computer Consultants │
// All rights are reserved. │
// Author ......: Greg Rice │
//═══════════════════════════════════════════════════════╛
#include "fileio.ch"
#define CRLF chr(13)+chr(10)
STATIC dos_param_list_ := { ;
"" , ; // File
"" , ; // Index
"" , ; // Mode
"" , ; // View
"" ; // .INI File
}
FUNCTION ParamPlace(x)
IF x == Nil
Return( NIL )
END
IF ! subs(x,1,1) $ '/@'
IF empty(DosParamList(1))
DosParamList(1,x)
ELSE
DosParamList(2,x)
END
ELSEIF subs(x,1,1) = '/'
DosParamList(3,DosParamList(3)+x)
ELSEIF ".INI" $ uppe(x)
DosParamList(5,x)
ELSE
DosParamList(4,x)
END
Return( NIL )
FUNCTION DosParamList(x,y)
IF y == NIL
IF x == NIL
Return( dos_param_list_ )
END
IF x > 0 .and. x < 6
Return( dos_param_list_[x] )
END
ELSE
dos_param_list_[x] := y
END
Return( NIL )
Function config()
LOCAL handle, buffer := space(1024), i, knownId, x, z, csearch, tmp
handle := fopen( subs(DosParamList(5),2), FO_READ+FO_SHARED )
if handle = -1
Return( .f. )
endif
fread( handle, @buffer, 1024 )
buffer := subs(buffer,1,len(trim(buffer)))
x := StrToArray(buffer, CRLF, .f.)
knownID := { ;
{ "FILE:" , { |x| DosParamList(1,x) } }, ;
{ "INDEX:" , { |x| DosParamList(2,x) } }, ;
{ "MODE:" , { |x| DosParamList(3,DosParamList(3)+x) } }, ;
{ "VIEW:" , { |x| DosParamList(4,'@'+x) } } ;
}
FOR i = 1 to Len(x)
cSearch := x[i]
z := ascan( knownID, { |y| y[1]==subs(uppe(cSearch),1,at(":",cSearch)) } )
if z # 0
eval( knownID[z,2], subs(uppe(x[i]),at(":",x[i])+1) )
endif
NEXT
fclose( handle )
Return( NIL )