static void printDescrip( FileInfo *info) { char *buf; HelpFp fp; char tmp[ _MAX_PATH ]; HelpHdl hdl; strcpy( tmp, info->fpath ); #ifdef __UNIX__ strcat( tmp, "/" ); #else strcat( tmp, "\\" ); #endif strcat( tmp, info->fname ); strcat( tmp, DEF_EXT ); fp = HelpOpen( tmp, HELP_OPEN_RDONLY | HELP_OPEN_BINARY ); if( fp != -1 ) { hdl = InitHelpSearch( fp ); buf = GetDescrip( hdl ); if( buf != NULL ) { printf( "%s", buf ); } FiniHelpSearch( hdl ); } printf( "\n" ); HelpClose( fp ); }
void main( int argc, char *argv[] ) { HelpFp fp; HelpHdl hdl; char name[_MAX_PATH]; char *cur; HelpSrchInfo cursor; unsigned i; if( argc != 2 ) { printf( "USAGE:\n" ); printf( "exename <help file>\n" ); return; } fp = HelpOpen( argv[1], HELP_OPEN_RDONLY | HELP_OPEN_BINARY ); if( fp == -1 ) { printf( "Unable to open %s\n", argv[1] ); return; } TRMemOpen(); hdl = InitHelpSearch( fp ); for( ;; ) { gets( name ); if( !strcmp( name, "bob" ) ) break; cur = HelpFindFirst( hdl, name, &cursor ); for( i=0; i < 5; i++ ) { if( cur == NULL ) break; printf( " %s\n", cur ); HelpMemFree( cur ); cur = HelpFindNext( &cursor ); } if( cur != NULL ) { HelpMemFree( cur ); } } FiniHelpSearch( hdl ); HelpClose( fp ); TRMemClose(); }
/* * help_open - open a help file at a topic location */ static help_file *help_open( char *buffer ) { help_file *h; char *newtopic; for( h = HelpFiles; h->name != NULL; ++h ) { if( h->f == 0 ) { /* text files screw up ctrl z */ h->f = HelpOpen( h->name, HELP_OPEN_RDONLY | HELP_OPEN_BINARY ); h->searchhdl = InitHelpSearch( h->f ); } if( helpStack->word[0] == '\0' ) { newtopic = GetDefTopic( h->searchhdl ); replacetopic( newtopic ); } if( OpenTopicInFile( h, helpStack->word, buffer ) ) { break; } } if( h->name == NULL ) return( NULL ); return( h ); }