Annotation of coherent/g/usr/bin/me/lookup.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * On GEMDOS and MSDOS, helpfiles specified on the command line
                      3:  * are <name>.HLP for the main help, and <name>.IDX for the index file,
                      4:  * if any.  On other systems, the help file is <name>, the index file,
                      5:  * <name>.idx
                      6:  */
                      7: #include "ed.h"
                      8: 
                      9: #if    LIBHELP
                     10: #ifndef        NULL
                     11: #define        NULL    ((char *)0)             /* rather than using stdio.h    */
                     12: #endif
                     13: 
                     14: static uchar lookbuff[NFILEN];
                     15: 
                     16: inithelp(){
                     17:        extern uchar *getenv();
                     18: 
                     19:        if (helpfile == NULL) {
                     20:                if ((helpfile = getenv("HELP")) == NULL) {
                     21:                        helpfile = "helpfile";
                     22: #if    GEM || MSDOS
                     23:                        helpindex = "helpindx";  /* Short name for xDOS */
                     24: #else
                     25:                        helpindex = "helpindex"; /* Long name for others */
                     26: #endif
                     27:                } else {
                     28:                        strcpy(hfname, helpfile);       /* from env.    */
                     29:                        helpfile = hfname;
                     30:                        strcpy(hiname, hfname);
                     31: #if    GEM || MSDOS
                     32:                        strcat(hfname, ".hlp");
                     33:                        strcat(hiname, ".idx");
                     34:                        helpindex = hiname;
                     35: #else
                     36:                        strcat(hiname, ".idx");
                     37:                        helpindex = hiname;
                     38: #endif
                     39:                }
                     40:        }
                     41: }
                     42: 
                     43: do_lookup(topic)
                     44: uchar *topic;
                     45: {
                     46:        inithelp();
                     47:        if (topic == NULL || *topic == '\0') {
                     48:                mlwrite("[No subject specified]");
                     49:                return FALSE;
                     50:        }
                     51:        mlwrite("[looking for topic %s]", topic);
                     52:        return helpwindow(topic);
                     53: }
                     54: 
                     55: promptlook(f, n)
                     56: {
                     57:        register int    s;
                     58: 
                     59:        inithelp();
                     60:        if ((s=mlreply("Topic: ", lookbuff, NFILEN)) != TRUE)
                     61:                return s;
                     62:        mlwrite("[looking for topic %s]", lookbuff);
                     63:        return do_lookup(lookbuff);
                     64: }
                     65: 
                     66: hlpindex(f, n)
                     67: {
                     68:        register int    s;
                     69: 
                     70:        inithelp();
                     71:        if ((s=mlreply("Keyword: ", lookbuff, NFILEN)) != TRUE)
                     72:                return s;
                     73:        mlwrite("[looking for keyword %s]", lookbuff);
                     74:        return topicwindow(lookbuff);
                     75: }
                     76: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.