Lines Matching refs:fp

302  * synthesize state for fp
303 * fp==0 initializes from getenv(state.name)
309 synthesize(register Feature_t* fp, const char* path, const char* value)
318 if (fp)
319 error(-2, "astconf synthesize name=%s path=%s value=%s fp=%p%s", fp->name, path, value, fp, state.synthesizing ? " SYNTHESIZING" : "");
369 if (!fp)
378 s = (char*)fp->name;
379 n = fp->length;
419 if (!fp->op)
421 if (fp->flags & CONF_ALLOC)
422 fp->value[0] = 0;
424 fp->value = null;
450 for (s = (char*)fp->name; *d = *s++; d++);
463 if (!(fp->flags & CONF_ALLOC))
464 fp->value = 0;
467 if (!(fp->value = newof(fp->value, char, n, 1)))
468 fp->value = null;
471 fp->flags |= CONF_ALLOC;
472 memcpy(fp->value, value, n);
473 fp->value[n] = 0;
475 return fp->value;
479 * initialize the value for fp
481 * synthesize(fp,path,succeed) called on success
482 * otherwise synthesize(fp,path,fail) called
486 initialize(register Feature_t* fp, const char* path, const char* command, const char* succeed, const char* fail)
492 error(-2, "astconf initialize name=%s path=%s command=%s succeed=%s fail=%s fp=%p%s", fp->name, path, command, succeed, fail, fp, state.synthesizing ? " SYNTHESIZING" : "");
494 switch (fp->op)
519 error(-2, "astconf initialize name=%s ok=%d PATH=%s", fp->name, ok, p);
530 if (command && (fp->op != OP_universe || !ok))
540 if (fp->op != OP_universe)
552 if (fp->op == OP_universe)
564 if (fp->op == OP_universe)
592 error(-1, "AHA#%d state.std=%d %s [%s] std=%s ast=%s value=%s ok=%d", __LINE__, state.std, fp->name, ok ? succeed : fail, fp->std, fp->ast, fp->value, ok);
594 synthesize(fp, path, ok ? succeed : fail);
602 format(register Feature_t* fp, const char* path, const char* value, unsigned int flags, Error_f conferror)
608 error(-2, "astconf format name=%s path=%s value=%s flags=%04x fp=%p%s", fp->name, path, value, flags, fp, state.synthesizing ? " SYNTHESIZING" : "");
611 fp->flags &= ~CONF_GLOBAL;
612 else if (fp->flags & CONF_GLOBAL)
613 return fp->value;
614 switch (fp->op)
619 value = fp->std;
620 n = state.std = streq(fp->value, fp->std);
622 error(-1, "AHA#%d state.std=%d %s [%s] std=%s ast=%s value=%s", __LINE__, state.std, fp->name, value, fp->std, fp->ast, fp->value);
624 if (!synthesize(fp, path, value))
625 initialize(fp, path, NiL, fp->std, fp->value);
627 error(-1, "AHA#%d state.std=%d %s [%s] std=%s ast=%s value=%s", __LINE__, state.std, fp->name, value, fp->std, fp->ast, fp->value);
629 if (!n && STANDARD(fp->value))
637 error(-1, "AHA#%d state.std=%d %s [%s] std=%s ast=%s value=%s", __LINE__, state.std, fp->name, value, fp->std, fp->ast, fp->value);
642 fp->value = fs3d(value ? value[0] ? FS3D_ON : FS3D_OFF : FS3D_TEST) ? "1" : null;
661 s = fp->value;
662 e = s + sizeof(fp->value) - 1;
676 if (!synthesize(fp, path, value))
677 initialize(fp, path, NiL, "logical", DEFAULT(OP_path_resolve));
682 if (getuniverse(fp->value) < 0)
683 strcpy(fp->value, DEFAULT(OP_universe));
696 (*conferror)(&state, &state, 2, "%s: %s: universe value too large", fp->name, value);
709 strcpy(fp->value, univ_name[n - 1]);
715 if (!(fp->flags & CONF_ALLOC))
716 fp->value = 0;
718 if (!(fp->value = newof(fp->value, char, n, 1)))
719 fp->value = null;
722 fp->flags |= CONF_ALLOC;
723 memcpy(fp->value, value, n);
724 fp->value[n] = 0;
728 synthesize(fp, path, value);
731 initialize(fp, path, "echo", DEFAULT(OP_universe), "ucb");
737 synthesize(fp, path, value);
742 fp->flags |= CONF_GLOBAL;
743 return fp->value;
755 register Feature_t* fp;
760 for (fp = state.features; fp && !streq(fp->name, name); fp = fp->next);
762 error(-2, "astconf feature name=%s path=%s value=%s flags=%04x fp=%p%s", name, path, value, flags, fp, state.synthesizing ? " SYNTHESIZING" : "");
764 if (!fp)
771 if (!(fp = newof(0, Feature_t, 1, n + 1)))
777 fp->op = -1;
778 fp->name = (const char*)fp + sizeof(Feature_t);
779 strcpy((char*)fp->name, name);
780 fp->length = n;
781 fp->std = &null[0];
782 fp->next = state.features;
783 state.features = fp;
787 if (fp->flags & CONF_READONLY)
790 (*conferror)(&state, &state, 2, "%s: cannot set readonly symbol", fp->name);
793 if (state.notify && !streq(fp->value, value) && !(*state.notify)(name, path, value))
797 state.recent = fp;
798 return format(fp, path, value, flags, conferror);
1516 Feature_t* fp;
1609 for (fp = state.features; fp; fp = fp->next)
1620 if (regexec(&re, fp->name, 0, NiL, 0))
1625 if (regexec(&re, prefix[fp->standard].name, 0, NiL, 0))
1629 if (!(s = feature(fp->name, path, NiL, 0, 0)) || !*s)
1634 if (fp->flags & CONF_ALLOC)
1636 if (fp->flags & CONF_READONLY)
1641 sfprintf(sp, "%*s %*s %d %2s %4d %5s %s\n", sizeof(conf[0].name), fp->name, sizeof(prefix[fp->standard].name), prefix[fp->standard].name, 1, call, 0, flg, s);
1644 sfprintf(sp, "%s %s - %s\n", state.id, (flags & ASTCONF_lower) ? fmtlower(fp->name) : fp->name, fmtquote(s, "\"", "\"", strlen(s), FMT_SHELL));
1646 sfprintf(sp, "%s=%s\n", (flags & ASTCONF_lower) ? fmtlower(fp->name) : fp->name, (flags & ASTCONF_quote) ? fmtquote(s, "\"", "\"", strlen(s), FMT_SHELL) : s);