home *** CD-ROM | disk | FTP | other *** search
- /* (c)Copyright Sequiter Software Inc., 1987, 1988, 1989. All rights reserved. */
-
- /* List Using Multi-User Capabilities */
-
- #include "d4base.h"
- #include "w4.h"
- #include "p4misc.h"
-
- #ifndef NO_KBHIT
- #include <conio.h>
- #endif
-
- static int x4multi_list(void) ;
-
- main( int argc, char **argv )
- {
- d4init() ;
- w4clear(-1) ;
-
- w4(0,0, "Database Multi-User File Listing Program" ) ;
- w4(2,0, "(C) Sequiter Software Inc, 1988, 1989" ) ;
- w4position( 4,0) ;
-
- if ( argc < 2 )
- {
- w4(4,0, "USAGE: X4MULTI DBF_FILE_NAME [INDEX_FILE_NAME]" ) ;
- w4cursor(5,0) ;
- w4exit(1) ;
- }
-
- if ( d4use( argv[1] ) < 0 ) w4exit(1) ;
-
- if ( argc > 2 )
- i4open( argv[2] ) ;
-
- #ifdef TEST
- w4handle(1) ;
- while ( ! x4multi_list() ) ;
- #else
- x4multi_list() ;
- #endif
-
- d4close_all() ;
- w4exit(0) ;
- }
-
-
- static int x4multi_list()
- {
- int rc, j, hand, len, row ;
- long field_ref ;
-
- if ( (rc = d4top()) < 0) return -1 ;
- d4unlock(-1L) ;
-
- hand = w4handle( -2 ) ;
-
- while ( rc == 0 )
- {
- if ( (rc = x4filter_do()) < 0 ) return -1 ;
- if ( rc )
- {
- if ( (rc = d4skip(1L)) < 0 ) return -1 ;
- d4unlock(-1L) ;
-
- #ifndef NO_KBHIT
- if ( kbhit() )
- if ( g4char() == 27) return 1 ;
- #endif
- continue ;
- }
-
- row = w4row()+1 ;
- if ( w4col() == 0 ) row-- ;
-
- if ( hand < 0 )
- {
- if ( row >= w4height(-1) -1 )
- {
- w4( w4height(-1) -1,0, "Press any key to continue ... " ) ;
- w4cursor( w4row(), w4col() ) ;
- if ( g4char() == 27 ) return 1 ;
-
- row = 0 ;
- w4clear(0) ;
- }
- else
- w4position( row, 0 ) ;
- }
- else
- w4position( row, 0 ) ;
-
- for ( j=1; j <= f4num_fields(); j++ )
- {
- field_ref = f4j_ref(j) ;
- if ( f4type(field_ref) == 'M' ) continue ;
-
- len = f4width( field_ref ) ;
- if ( w4col()+len+2 > w4width(-1) )
- {
- len = w4width(-1) - w4col() ;
- if ( len > f4width(field_ref) ) len = f4width(field_ref) ;
-
- w4num( row,w4col(), f4ptr(field_ref), len ) ;
- break ;
- }
-
- w4num( row,w4col(), f4ptr(field_ref), len ) ;
- w4position( row, w4col()+2 ) ;
- }
-
- if ( (rc = d4skip(1L)) < 0 ) return -1 ;
- d4unlock(-1L) ;
-
- #ifndef NO_KBHIT
- if ( kbhit() )
- if ( g4char() == 27 ) return 1 ;
- #endif
- }
-
- d4unlock(-1L) ;
-
- if ( hand <= 0 )
- w4cursor( w4height(-1) -2, 0 ) ;
-
- return 0 ;
- }
-
-