DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ T t

⟦e0e1ba8be⟧ TextFile

    Length: 1752 (0x6d8)
    Types: TextFile
    Names: »type.c«

Derivation

└─⟦87ddcff64⟧ Bits:30001253 CPHDIST85 Tape, 1985 Autumn Conference Copenhagen
    └─ ⟦this⟧ »cph85dist/rman/daemon/type.c« 

TextFile

#include "defs.h"
#include "response.h"

static int t_index = 0;    /*  index of current type  */
static int n_types = 0;    /*  number of types known  */

/*
 *  Switch to an alternate type.  Returns 0 if ok, 1 on error.
 */

switchtype (name)
char *name;
{
    int  i;

    for (i = 0; i < n_types; i++)
        if (eq (name, types[i].name)) {
            t_index  = i;                    /* save the index */
            dirs     = types[i].dir;         /* and set the pointers */
            sections = types[i].sec;
            return (0);
        }
    return (1);
}


/*
 *  Interface to the "switchtype" command.  If no args, 
 *  prints current cpu type.
 */

dotype (argc, argv)
int     argc;
char   *argv[];
{
    if (argc == 1) {
        printf ("%d cpu type is \"%s\"\r\n", INFO_TYPE, types[t_index].name);
    } else {
        if (switchtype (argv[1]))
            printf ("%d unknown cpu type \"%s\"\r\n", ERR_TYPE, argv[1]);
        else
            printf ("%d new cpu type is \"%s\"\r\n", OK_TYPE, argv[1]);
    }
    fflush (stdout);
}


/*
 *  Add another cpu type to the list. Used in config(), 
 *  but uses static data here.  Note that "name" is the
 *  name of the _next_ type, not this one just ending.
 */

addtype (name)
char *name; 
{
    static char *this_type = (char *) 0;
    static int  this_index = 0;
        
    n_types++;

    types[this_index].dir = dirs;       /* save pointer to list */
    dirs = (DIR *) 0;                   /* and set it to zero for next list */
    types[this_index].sec = sections;
    sections = (SEC *) 0;

    types[this_index].name = this_type ? this_type : "generic";  /* save name */
    this_index++;

    this_type = name ? strsave (name) : (char *) 0;   /* this is next name */
}