home *** CD-ROM | disk | FTP | other *** search
- /*
- Program: NET_USE()
- System: GRUMPFISH LIBRARY
- Author: Greg Lief
- Copyright (c) 1988-90, Greg Lief
- Clipper 5.x Version
- Compile instructions: clipper netuse /n/w/a
- Opens files for exclusive and shared use in multi-user systems
- */
-
- //───── begin preprocessor directives
-
- #include "grump.ch"
- #include "inkey.ch"
-
- //───── end preprocessor directives
-
- function net_use(mfile, excl_use, ndx1,ndx2,ndx3,ndx4,ndx5,ndx6,ndx7,ndx8)
- local firstloop := .t., ret_val := .f., box_no, oldcolor, waitmsg, buffer, ;
- oldscrn, malias, ptr, key := 0
- default excl_use to .f.
- //───── if they passed the word "alias" as part of filename,
- //───── use a different alias
- if ( ptr := at("ALIAS", upper(mfile)) ) > 0
- malias := trim(substr(mfile, ptr + 6))
- mfile := substr(mfile, 1, ptr - 1)
- else
- malias := ''
- endif
- waitmsg := mfile + '.dbf' // used in kaleidoscope if user has to wait
- do while key != K_ESC
- if excl_use
- if ! empty(malias)
- use (mfile) new exclusive alias &malias
- else
- use (mfile) new exclusive
- endif
- else
- if ! empty(malias)
- use (mfile) new alias &malias
- else
- use (mfile) new
- endif
- endif
- if ! neterr() // file opened successfully - now open indexes
- ret_val := .t.
- if ndx1 != NIL
- do case
- case ndx2 == NIL
- set index to (ndx1)
- case ndx3 == NIL
- set index to (ndx1), (ndx2)
- case ndx4 == NIL
- set index to (ndx1), (ndx2), (ndx3)
- case ndx5 == NIL
- set index to (ndx1), (ndx2), (ndx3), (ndx4)
- case ndx6 == NIL
- set index to (ndx1), (ndx2), (ndx3), (ndx4), (ndx5)
- case ndx7 == NIL
- set index to (ndx1), (ndx2), (ndx3), (ndx4), (ndx5), (ndx6)
- case ndx8 == NIL
- set index to (ndx1), (ndx2), (ndx3), (ndx4), (ndx5), (ndx6), ;
- (ndx7)
- otherwise
- set index to (ndx1), (ndx2), (ndx3), (ndx4), (ndx5), (ndx6), ;
- (ndx7), (ndx8)
- endcase
- endif
- exit
- else
- if firstloop
- if yes_no('File ' + mfile + ' cannot be opened at this time', ;
- 'Would you like to wait')
- oldscrn := savescreen(0, 0, 24, 79)
- kaleid(.t., waitmsg)
- firstloop := .f.
- else
- exit
- endif
- else
- kaleid(.f., waitmsg)
- endif
- endif
- key := lastkey()
- enddo
- if ! firstloop
- setcolor(oldcolor)
- restscreen(0, 0, 24, 79, oldscrn)
- if ret_val // file opened successfully - give user aural feedback
- CHARGE
- endif
- endif
- return (ret_val)
-
- * end function Net_Use()
- *--------------------------------------------------------------------*
-
- * eof netuse.prg
-