Esempio n. 1
0
static int
putin_(int status, char *inkey, int inkeylen, char *inval, int invallen, char *indata)
{
    if (ypprot_err(status) != 0)
	return TRUE;
    inkey[inkeylen] = '\0';
    if (strcmp(inkey, "/-") == 0)
	return FALSE;

    h_addEnt_(&hashTab, inkey, 0);

    return FALSE;
}
Esempio n. 2
0
static int
putin_ (int status, char *inkey, int inkeylen, char *inval, int invallen,
	char *indata)
{
#if !defined(__CYGWIN__)
  if (ypprot_err (status) != 0)
    return TRUE;
#endif
  inkey[inkeylen] = '\0';
  if (strcmp (inkey, "/-") == 0)
    return FALSE;

  h_addEnt_ (&hashTab, inkey, 0);

  return FALSE;
}
Esempio n. 3
0
/* initParse()
 */
void
initParse(struct lsInfo *lsInfo)
{
    static char   fname[] = "initParse()";
    int           i;
    int           *indx;
    hEnt          *hashEntPtr;

    if (logclass & (LC_TRACE | LC_SCHED))
        ls_syslog(LOG_DEBUG1, "%s: Entering this routine...", fname);

    if (!h_TabEmpty_(&resNameTbl)) {
        h_freeRefTab_(&resNameTbl);
    }

    h_initTab_(&resNameTbl, lsInfo->nRes);

    /* We firmly believe those calloc() will
     * succeed.
     */
    indx = calloc(lsInfo->nRes, sizeof(int));
    for (i = 0; i < lsInfo->nRes; i++) {
        hashEntPtr = h_addEnt_(&resNameTbl,
                               lsInfo->resTable[i].name,
                               NULL);
        indx[i] = i;
        hashEntPtr->hData = &indx[i];
    }

    /* login, swap, idle and cpu are more human
     * readable aliases for ls, swp,it and ut (?).
     */
    indx = calloc(4, sizeof(int));
    hashEntPtr = h_addEnt_(&resNameTbl, "login", NULL);
    indx[0] = LS;
    hashEntPtr->hData = &indx[0];

    hashEntPtr = h_addEnt_(&resNameTbl, "swap", NULL);
    indx[1] = SWP;
    hashEntPtr->hData = &indx[1];

    hashEntPtr = h_addEnt_(&resNameTbl, "idle", NULL);
    indx[2] = IT;
    hashEntPtr->hData = &indx[2];

    hashEntPtr = h_addEnt_(&resNameTbl, "cpu", NULL);
    indx[3] = R1M;
    hashEntPtr->hData = &indx[3];

    if (h_TabEmpty_(&keyNameTbl)) {
        int   *key;

        key = calloc(NUM_KEYS, sizeof(int));
        h_initTab_(&keyNameTbl, NUM_KEYS);

        hashEntPtr = h_addEnt_(&keyNameTbl, "duration", NULL);
        key[0] = KEY_DURATION;
        hashEntPtr->hData = &key[0];

        hashEntPtr = h_addEnt_(&keyNameTbl, "decay", NULL);
        key[1] = KEY_DECAY;
        hashEntPtr->hData = &key[1];

        hashEntPtr = h_addEnt_(&keyNameTbl, "hosts", NULL);
        key[2] = KEY_HOSTS;
        hashEntPtr->hData = &key[2];

        hashEntPtr = h_addEnt_(&keyNameTbl, "ptile", NULL);
        key[3] = KEY_PTILE;
        hashEntPtr->hData = &key[3];
    }
}