Annotation of xinu/sys/shell/x_help.c, revision 1.1.1.1

1.1       root        1: /* x_help.c - x_help */
                      2: 
                      3: #include <conf.h>
                      4: #include <kernel.h>
                      5: #include <shell.h>
                      6: #include <cmd.h>
                      7: 
                      8: #define        COLUMNS 4                       /* number of columns to print   */
                      9: 
                     10: /*------------------------------------------------------------------------
                     11:  *  x_help  -  (command help) print possible command names for user
                     12:  *------------------------------------------------------------------------
                     13:  */
                     14: COMMAND        x_help(stdin, stdout, stderr, nargs, args)
                     15: int    stdin, stdout, stderr, nargs;
                     16: char   *args[];
                     17: {
                     18:        int     inc;                    /* command names per column     */
                     19:        int     i;                      /* move through printed rows    */
                     20:        int     j;                      /* move across printed columns  */
                     21: 
                     22: 
                     23:        if ( (inc=(Shl.shncmds+COLUMNS-1)/COLUMNS) <= 0)
                     24:                inc = 1;
                     25:        fprintf(stdout, "Commands are:\n");
                     26:        for(i=0 ; i<inc && i<Shl.shncmds ; i++) {
                     27:                fprintf(stdout, "  ");
                     28:                for (j=i ; j<Shl.shncmds ; j+=inc)
                     29:                        fprintf(stdout, "%-16s", cmds[j].cmdnam);
                     30:                fprintf(stdout, "\n");
                     31:        }
                     32:        return(OK);
                     33: }

unix.superglobalmegacorp.com

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