MCPcopy Create free account
hub / github.com/NetHack/NetHack / optfn_align_message

Function optfn_align_message

src/options.c:922–970  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

920
921
922staticfn int
923optfn_align_message(
924 int optidx, int req, boolean negated,
925 char *opts, char *op)
926{
927 if (req == do_init) {
928 return optn_ok;
929 }
930 if (req == do_set) {
931 /* WINCAP align_message:[left|top|right|bottom] */
932
933 op = string_for_opt(opts, negated);
934 if ((op != empty_optstr) && !negated) {
935 if (!strncmpi(op, "left", sizeof "left" - 1))
936 iflags.wc_align_message = ALIGN_LEFT;
937 else if (!strncmpi(op, "top", sizeof "top" - 1))
938 iflags.wc_align_message = ALIGN_TOP;
939 else if (!strncmpi(op, "right", sizeof "right" - 1))
940 iflags.wc_align_message = ALIGN_RIGHT;
941 else if (!strncmpi(op, "bottom", sizeof "bottom" - 1))
942 iflags.wc_align_message = ALIGN_BOTTOM;
943 else {
944 config_error_add("Unknown %s parameter '%s'",
945 allopt[optidx].name, op);
946 return optn_err;
947 }
948 } else if (negated) {
949 bad_negation(allopt[optidx].name, TRUE);
950 return optn_err;
951 }
952 return optn_ok;
953 }
954 if (req == get_val || req == get_cnf_val) {
955 int which;
956
957 which = iflags.wc_align_message;
958 Sprintf(opts, "%s",
959 (which == ALIGN_TOP) ? "top"
960 : (which == ALIGN_LEFT) ? "left"
961 : (which == ALIGN_BOTTOM) ? "bottom"
962 : (which == ALIGN_RIGHT) ? "right"
963 : defopt);
964 return optn_ok;
965 }
966 if (req == do_handler) {
967 return handler_align_misc(optidx);
968 }
969 return optn_ok;
970}
971
972staticfn int
973optfn_align_status(

Callers

nothing calls this directly

Calls 5

string_for_optFunction · 0.85
config_error_addFunction · 0.85
bad_negationFunction · 0.85
handler_align_miscFunction · 0.85
strncmpiFunction · 0.70

Tested by

no test coverage detected