Changeset c227706 for help.c


Ignore:
Timestamp:
2006-12-24T19:35:13Z (18 years ago)
Author:
Jelmer Vernooij <jelmer@…>
Branches:
master
Children:
7bee5af
Parents:
9225e08
Message:

Refactor the help code to take a filename rather than using the global struct.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • help.c

    r9225e08 rc227706  
    3131#define BUFSIZE 1100
    3232
    33 help_t *help_init( help_t **help )
     33help_t *help_init( help_t **help, const char *helpfile )
    3434{
    3535        int i, buflen = 0;
     
    4141        *help = h = g_new0 ( help_t, 1 );
    4242       
    43         h->fd = open( global.helpfile, O_RDONLY
     43        h->fd = open( helpfile, O_RDONLY
    4444#ifdef _WIN32
    4545                                  | O_BINARY
     
    109109        help_t *h;
    110110
    111         h=*help;       
    112 
    113         while( h )
     111        for( h = *help; h; h = h->next )
    114112        {
    115                 if( g_strcasecmp( h->string, string ) == 0 ) break;
    116                 h = h->next;
     113                if( h->string != NULL &&
     114                        g_strcasecmp( h->string, string ) == 0 )
     115                        break;
    117116        }
    118117        if( h && h->length > 0 )
Note: See TracChangeset for help on using the changeset viewer.