Example #1
0
int set_model(char *m1, char *m2, char *m3, char *m4)
{
    if (gsysinfo_init_flg == FALSE )
        get_gsysinfo(NULL);

    /* Model may be binary zero */
    if ( m1 != NULL && m1[0] != '*' )
    {
        if ( strlen(m1) == 0 )
            memset(gsysinfo.model, 0, sizeof(gsysinfo.model));
        else if ( strcmp(m1, "=") == 0)
            memcpy(gsysinfo.model, dflt_model, sizeof(gsysinfo.model));
        else if ( copy_stringz_to_ebcdic(gsysinfo.model, sizeof(gsysinfo.model), m1) <= 0 ) return 1;
    }
    else if ( m1 == NULL )
        return 0;

    /* model-capa may NEVER be binary zero, if "" then default to
       the same value as the Model field if not binary zero. Otherwise
       if the Model field is binary zero the value 'EMULATOR' is used */
    if ( m2 != NULL && m2[0] != '*' )
    {
        if ( strlen(m2) == 0 || strcmp(m2, "=") == 0)
            memcpy(gsysinfo.modelcapa, gsysinfo.model[0] ? gsysinfo.model : dflt_model, sizeof(gsysinfo.modelcapa));
        else if ( copy_stringz_to_ebcdic(gsysinfo.modelcapa, sizeof(gsysinfo.modelcapa), m2) <= 0) return 2;
    }
    else if ( m2 == NULL )
        return 0;

    /* model-perm may be binary zero */
    if ( m3 != NULL && m3[0] != '*' )
    {
        if ( strlen(m3) == 0 )
            memset(gsysinfo.modelperm, 0, sizeof(gsysinfo.modelperm));
        else if ( strcmp(m3, "=") == 0)
            memcpy(gsysinfo.modelperm, gsysinfo.modelcapa, sizeof(gsysinfo.modelperm));
        else if ( copy_stringz_to_ebcdic(gsysinfo.modelperm, sizeof(gsysinfo.modelperm), m3) <= 0 ) return 3;
    }
    else if ( m3 == NULL )
        return 0;

    /* model-temp may be binary zero */
    if ( m4 != NULL && m4[0] != '*' )
    {
        if ( strlen(m4) == 0 )
            memset(gsysinfo.modeltemp, 0, sizeof(gsysinfo.modeltemp));
        else if ( strcmp(m4, "=") == 0)
            memcpy(gsysinfo.modeltemp, gsysinfo.modelperm, sizeof(gsysinfo.modeltemp));
        else if ( copy_stringz_to_ebcdic(gsysinfo.modeltemp, sizeof(gsysinfo.modeltemp), m4) <= 0 ) return 4;
    }
//  else if ( m4 == NULL )      // uncomment test if anything else is done
//      return 0;

    return 0;
}
Example #2
0
void set_model(int argc, char *m1, char *m2, char *m3, char *m4)
{
    if (argc > 1 && m1 != NULL)
        copy_stringz_to_ebcdic(model, sizeof(model), m1);
    if (argc > 2 && m2 != NULL)
        copy_stringz_to_ebcdic(modelcapa, sizeof(modelcapa), m2);
    if (argc > 3 && m3 != NULL)
        copy_stringz_to_ebcdic(modelperm, sizeof(modelperm), m3);
    if (argc > 4 && m4 != NULL)
        copy_stringz_to_ebcdic(modeltemp, sizeof(modeltemp), m4);
}