1 /* $Header: /p/tcsh/cvsroot/tcsh/sh.set.c,v 3.72 2007/09/28 21:02:03 christos Exp $ */
3 * sh.set.c: Setting and Clearing of variables
6 * Copyright (c) 1980, 1991 The Regents of the University of California.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 RCSID("$tcsh: sh.set.c,v 3.72 2007/09/28 21:02:03 christos Exp $")
40 #ifdef HAVE_NL_LANGINFO
44 extern int GotTermCaps;
47 static void update_vars (Char *);
48 static Char *getinx (Char *, int *);
49 static void asx (Char *, int, Char *);
50 static struct varent *getvx (Char *, int);
51 static Char *xset (Char *, Char ***);
52 static Char *operate (int, Char *, Char *);
53 static void putn1 (unsigned);
54 static struct varent *madrof (Char *, struct varent *);
55 static void unsetv1 (struct varent *);
56 static void balance (struct varent *, int, int);
65 if (eq(vp, STRpath)) {
66 struct varent *p = adrof(STRpath);
68 stderror(ERR_NAME | ERR_UNDVAR);
74 else if (eq(vp, STRhistchars)) {
75 Char *pn = varval(vp);
80 else if (eq(vp, STRpromptchars)) {
81 Char *pn = varval(vp);
86 else if (eq(vp, STRhistlit)) {
89 else if (eq(vp, STRuser)) {
90 tsetenv(STRKUSER, varval(vp));
91 tsetenv(STRLOGNAME, varval(vp));
93 else if (eq(vp, STRgroup)) {
94 tsetenv(STRKGROUP, varval(vp));
96 else if (eq(vp, STRwordchars)) {
97 word_chars = varval(vp);
99 else if (eq(vp, STRloginsh)) {
102 else if (eq(vp, STRsymlinks)) {
103 Char *pn = varval(vp);
105 if (eq(pn, STRignore))
106 symlinks = SYM_IGNORE;
107 else if (eq(pn, STRexpand))
108 symlinks = SYM_EXPAND;
109 else if (eq(pn, STRchase))
110 symlinks = SYM_CHASE;
114 else if (eq(vp, STRterm)) {
115 Char *cp = varval(vp);
116 tsetenv(STRKTERM, cp);
117 #ifdef DOESNT_WORK_RIGHT
118 cp = getenv("TERMCAP");
119 if (cp && (*cp != '/')) /* if TERMCAP and not a path */
120 Unsetenv(STRTERMCAP);
121 #endif /* DOESNT_WORK_RIGHT */
123 if (noediting && Strcmp(cp, STRnetwork) != 0 &&
124 Strcmp(cp, STRunknown) != 0 && Strcmp(cp, STRdumb) != 0) {
129 ed_Init(); /* reset the editor */
131 else if (eq(vp, STRhome)) {
134 cp = Strsave(varval(vp)); /* get the old value back */
135 cleanup_push(cp, xfree);
138 * convert to cononical pathname (possibly resolving symlinks)
140 canon = dcanon(cp, cp);
143 cleanup_push(canon, xfree);
145 setcopy(vp, canon, VAR_READWRITE); /* have to save the new val */
147 /* and now mirror home with HOME */
148 tsetenv(STRKHOME, canon);
149 /* fix directory stack for new tilde home */
151 cleanup_until(canon);
153 else if (eq(vp, STRedit)) {
156 /* PWP: add more stuff in here later */
158 else if (eq(vp, STRshlvl)) {
159 tsetenv(STRKSHLVL, varval(vp));
161 else if (eq(vp, STRignoreeof)) {
164 for ((cp = varval(STRignoreeof)); cp && *cp; cp++) {
169 numeof = numeof * 10 + *cp - '0';
171 if (numeof <= 0) numeof = 26; /* Sanity check */
173 else if (eq(vp, STRbackslash_quote)) {
176 else if (eq(vp, STRcompat_expr)) {
179 else if (eq(vp, STRdirstack)) {
182 else if (eq(vp, STRrecognize_only_executables)) {
185 else if (eq(vp, STRkillring)) {
186 SetKillRing(getn(varval(vp)));
189 else if (eq(vp, STRwatch)) {
192 #endif /* HAVENOUTMP */
193 else if (eq(vp, STRimplicitcd)) {
194 implicit_cd = ((eq(varval(vp), STRverbose)) ? 2 : 1);
197 else if (eq(vp, STRcolor)) {
200 #endif /* COLOR_LS_F */
201 #if defined(KANJI) && defined(SHORT_STRINGS) && defined(DSPMBYTE)
202 else if(eq(vp, CHECK_MBYTEVAR) || eq(vp, STRnokanji)) {
203 update_dspmbyte_vars();
207 else if (eq(vp, STRcatalog)) {
211 #if defined(FILEC) && defined(TIOCSTI)
212 else if (eq(vp, STRfilec))
215 #endif /* NLS_CATALOGS */
221 doset(Char **v, struct command *c)
228 int flags = VAR_READWRITE;
238 * Readonly addition From: Tim P. Starrin <noid@cyborg.larc.nasa.gov>
240 if (*v && eq(*v, STRmr)) {
241 flags = VAR_READONLY;
245 if (*v && eq(*v, STRmf) && !last_match) {
250 if (*v && eq(*v, STRml) && !first_match) {
258 plist(&shvhed, flags);
265 for (; alnum(*p); p++)
267 if (vp == p || !letter(*vp))
268 stderror(ERR_NAME | ERR_VARBEGIN);
271 p = getinx(p, &subscr);
273 if ((op = *p) != 0) {
275 if (*p == 0 && *v && **v == '(')
278 else if (*v && eq(*v, STRequal)) {
284 stderror(ERR_NAME | ERR_SYNTAX);
285 if (eq(p, STRLparen)) {
289 stderror(ERR_NAME | ERR_SYNTAX);
292 stderror(ERR_NAME | ERR_MISSING, ')');
305 set1(vp, vecp, &shvhed, flags);
313 cleanup_push(copy, xfree);
314 asx(vp, subscr, copy);
315 cleanup_ignore(copy);
319 setv(vp, Strsave(p), flags);
321 } while ((p = *v++) != NULL);
325 getinx(Char *cp, int *ip)
329 while (*cp && Isdigit(*cp))
330 *ip = *ip * 10 + *cp++ - '0';
332 stderror(ERR_NAME | ERR_SUBSCRIPT);
337 asx(Char *vp, int subscr, Char *p)
339 struct varent *v = getvx(vp, subscr);
342 if (v->v_flags & VAR_READONLY)
343 stderror(ERR_READONLY|ERR_NAME, v->v_name);
344 prev = v->vec[subscr - 1];
345 cleanup_push(prev, xfree);
346 v->vec[subscr - 1] = globone(p, G_APPEND);
350 static struct varent *
351 getvx(Char *vp, int subscr)
353 struct varent *v = adrof(vp);
357 if (subscr < 1 || subscr > blklen(v->vec))
358 stderror(ERR_NAME | ERR_RANGE);
364 dolet(Char **v, struct command *dummy)
382 for (; alnum(*p); p++)
384 if (vp == p || !letter(*vp))
385 stderror(ERR_NAME | ERR_VARBEGIN);
388 p = getinx(p, &subscr);
395 stderror(ERR_NAME | ERR_ASSIGN);
398 * if there is no expression after the '=' then print a "Syntax Error"
401 if (*p == '\0' && *v == NULL)
402 stderror(ERR_NAME | ERR_ASSIGN);
405 cleanup_push(vp, xfree);
414 stderror(ERR_NAME | ERR_UNKNOWNOP);
420 stderror(ERR_NAME | ERR_UNKNOWNOP);
421 stderror(ERR_NAME | ERR_SYNTAX);
424 stderror(ERR_NAME | ERR_UNKNOWNOP);
428 cleanup_push(p, xfree);
433 setv(vp, p, VAR_READWRITE);
437 struct varent *gv = getvx(vp, subscr);
440 val = operate(op, gv->vec[subscr - 1], p);
441 cleanup_push(val, xfree);
442 asx(vp, subscr, val);
449 val = operate(op, varval(vp), p);
450 cleanup_push(val, xfree);
451 setv(vp, val, VAR_READWRITE);
457 } while ((p = *v++) != NULL);
461 xset(Char *cp, Char ***vp)
471 return (putn(expr(vp)));
475 operate(int op, Char *vp, Char *p)
489 if (op == '<' || op == '>')
496 stderror(ERR_NAME | ERR_EXPRESSION);
505 Char nbuf[(CHAR_BIT * sizeof (n) + 2) / 3 + 2]; /* Enough even for octal */
514 return (Strsave(nbuf));
522 *putp++ = n % 10 + '0';
532 if (!cp) /* PWP: extra error checking */
533 stderror(ERR_NAME | ERR_BADNUM);
536 if (cp[0] == '+' && cp[1])
542 stderror(ERR_NAME | ERR_BADNUM);
545 if (cp[0] == '0' && cp[1])
553 if (base == 8 && *cp >= '8')
554 stderror(ERR_NAME | ERR_BADNUM);
555 n = n * base + *cp++ - '0';
558 stderror(ERR_NAME | ERR_BADNUM);
559 return (sign ? -n : n);
563 value1(Char *var, struct varent *head)
567 if (!var || !head) /* PWP: extra error checking */
570 vp = adrof1(var, head);
571 return ((vp == NULL || vp->vec == NULL || vp->vec[0] == NULL) ?
572 STRNULL : vp->vec[0]);
575 static struct varent *
576 madrof(Char *pat, struct varent *vp)
580 for (vp = vp->v_left; vp; vp = vp->v_right) {
581 if (vp->v_left && (vp1 = madrof(pat, vp)) != NULL)
583 if (Gmatch(vp->v_name, pat))
590 adrof1(const Char *name, struct varent *v)
595 while (v && ((cmp = *name - *v->v_name) != 0 ||
596 (cmp = Strcmp(name, v->v_name)) != 0))
605 setcopy(const Char *var, const Char *val, int flags)
610 cleanup_push(copy, xfree);
611 setv(var, copy, flags);
612 cleanup_ignore(copy);
617 * The caller is responsible for putting value in a safe place
620 setv(const Char *var, Char *val, int flags)
622 Char **vec = xmalloc(2 * sizeof(Char **));
626 set1(var, vec, &shvhed, flags);
630 set1(const Char *var, Char **vec, struct varent *head, int flags)
634 if ((flags & VAR_NOGLOB) == 0) {
639 vec = globall(oldv, gflag);
642 stderror(ERR_NAME | ERR_NOMATCH);
648 * Uniqueness addition from: Michael Veksler <mveksler@vnet.ibm.com>
650 if ( flags & (VAR_FIRST | VAR_LAST) ) {
652 * Code for -f (VAR_FIRST) and -l (VAR_LAST) options.
654 * Delete all duplicate words leaving "holes" in the word array (vec).
655 * Then remove the "holes", keeping the order of the words unchanged.
657 if (vec && vec[0] && vec[1]) { /* more than one word ? */
661 for (num_items = 0; vec[num_items]; num_items++)
663 if (flags & VAR_FIRST) {
664 /* delete duplications, keeping first occurance */
665 for (i = 1; i < num_items; i++)
666 for (j = 0; j < i; j++)
667 /* If have earlier identical item, remove i'th item */
668 if (vec[i] && vec[j] && Strcmp(vec[j], vec[i]) == 0) {
673 } else if (flags & VAR_LAST) {
674 /* delete duplications, keeping last occurance */
675 for (i = 0; i < num_items - 1; i++)
676 for (j = i + 1; j < num_items; j++)
677 /* If have later identical item, remove i'th item */
678 if (vec[i] && vec[j] && Strcmp(vec[j], vec[i]) == 0) {
679 /* remove identical item (the first) */
684 /* Compress items - remove empty items */
685 for (j = i = 0; i < num_items; i++)
689 /* NULL-fy remaining items */
690 for (; j < num_items; j++)
693 /* don't let the attribute propagate */
694 flags &= ~(VAR_FIRST|VAR_LAST);
696 setq(var, vec, head, flags);
701 setq(const Char *name, Char **vec, struct varent *p, int flags)
706 f = 0; /* tree hangs off the header's left link */
707 while ((c = p->v_link[f]) != 0) {
708 if ((f = *name - *c->v_name) == 0 &&
709 (f = Strcmp(name, c->v_name)) == 0) {
710 if (c->v_flags & VAR_READONLY)
711 stderror(ERR_READONLY|ERR_NAME, c->v_name);
720 p->v_link[f] = c = xmalloc(sizeof(struct varent));
721 c->v_name = Strsave(name);
724 c->v_left = c->v_right = 0;
732 unset(Char **v, struct command *c)
734 int did_roe, did_edit;
737 did_roe = adrof(STRrecognize_only_executables) != NULL;
738 did_edit = adrof(STRedit) != NULL;
741 #if defined(FILEC) && defined(TIOCSTI)
742 if (adrof(STRfilec) == 0)
744 #endif /* FILEC && TIOCSTI */
746 if (adrof(STRhistchars) == 0) {
750 if (adrof(STRignoreeof) == 0)
752 if (adrof(STRpromptchars) == 0) {
756 if (adrof(STRhistlit) == 0)
758 if (adrof(STRloginsh) == 0)
760 if (adrof(STRwordchars) == 0)
761 word_chars = STR_WORD_CHARS;
762 if (adrof(STRedit) == 0)
764 if (adrof(STRbackslash_quote) == 0)
766 if (adrof(STRcompat_expr) == 0)
768 if (adrof(STRsymlinks) == 0)
770 if (adrof(STRimplicitcd) == 0)
772 if (adrof(STRkillring) == 0)
774 if (did_edit && noediting && adrof(STRedit) == 0)
776 if (did_roe && adrof(STRrecognize_only_executables) == 0)
779 if (adrof(STRcolor) == 0)
781 #endif /* COLOR_LS_F */
782 #if defined(KANJI) && defined(SHORT_STRINGS) && defined(DSPMBYTE)
783 update_dspmbyte_vars();
788 #endif /* NLS_CATALOGS */
792 unset1(Char *v[], struct varent *head)
799 while ((vp = madrof(*v, head)) != NULL)
800 if (vp->v_flags & VAR_READONLY)
801 stderror(ERR_READONLY|ERR_NAME, vp->v_name);
805 setname(short2str(*v));
814 if ((vp = adrof1(var, &shvhed)) == 0)
820 unsetv1(struct varent *p)
822 struct varent *c, *pp;
826 * Free associated memory first to avoid complications.
831 * If p is missing one child, then we can move the other into where p is.
832 * Otherwise, we find the predecessor of p, which is guaranteed to have no
833 * right child, copy it into p, and move it's left child into it.
837 else if (p->v_left == 0)
840 for (c = p->v_left; c->v_right; c = c->v_right)
842 p->v_name = c->v_name;
843 p->v_flags = c->v_flags;
850 * Move c into where p is.
853 f = pp->v_right == p;
854 if ((pp->v_link[f] = c) != 0)
857 * Free the deleted node, and rebalance.
866 setcopy(cp, STRNULL, VAR_READWRITE);
871 shift(Char **v, struct command *c)
884 if (argv == NULL || argv->vec == NULL)
886 if (argv->vec[0] == 0)
887 stderror(ERR_NAME | ERR_NOMORE);
888 lshift(argv->vec, 1);
893 exportpath(Char **val)
895 struct Strbuf buf = Strbuf_INIT;
900 Strbuf_append(&buf, *val++);
901 if (*val == 0 || eq(*val, STRRparen))
903 Strbuf_append1(&buf, PATHSEP);
905 exppath = Strbuf_finish(&buf);
906 cleanup_push(exppath, xfree);
907 tsetenv(STRKPATH, exppath);
908 cleanup_until(exppath);
913 * Lint thinks these have null effect
915 /* macros to do single rotations on node p */
916 # define rright(p) (\
918 (t)->v_parent = (p)->v_parent,\
919 (((p)->v_left = t->v_right) != NULL) ?\
920 (t->v_right->v_parent = (p)) : 0,\
921 (t->v_right = (p))->v_parent = t,\
925 ((t)->v_parent = (p)->v_parent,\
926 ((p)->v_right = t->v_left) != NULL) ? \
927 (t->v_left->v_parent = (p)) : 0,\
928 (t->v_left = (p))->v_parent = t,\
931 static struct varent *
932 rleft(struct varent *p)
936 static struct varent *
937 rright(struct varent *p)
946 * Rebalance a tree, starting at p and up.
947 * F == 0 means we've come from p's left child.
948 * D == 1 means we've just done a delete, otherwise an insert.
951 balance(struct varent *p, int f, int d)
956 struct varent *t; /* used by the rotate macros */
960 ff = 0; /* Sun's lint is dumb! */
964 * Ok, from here on, p is the node we're operating on; pp is it's parent; f
965 * is the branch of p from which we have come; ff is the branch of pp which
968 for (; (pp = p->v_parent) != 0; p = pp, f = ff) {
969 ff = pp->v_right == p;
970 if (f ^ d) { /* right heavy */
972 case -1: /* was left heavy */
975 case 0: /* was balanced */
978 case 1: /* was already right heavy */
979 switch (p->v_right->v_bal) {
980 case 1: /* single rotate */
981 pp->v_link[ff] = rleft(p);
982 p->v_left->v_bal = 0;
985 case 0: /* single rotate */
986 pp->v_link[ff] = rleft(p);
987 p->v_left->v_bal = 1;
990 case -1: /* double rotate */
991 (void) rright(p->v_right);
992 pp->v_link[ff] = rleft(p);
994 p->v_bal < 1 ? 0 : -1;
996 p->v_bal > -1 ? 0 : 1;
1007 else { /* left heavy */
1009 case 1: /* was right heavy */
1012 case 0: /* was balanced */
1015 case -1: /* was already left heavy */
1016 switch (p->v_left->v_bal) {
1017 case -1: /* single rotate */
1018 pp->v_link[ff] = rright(p);
1019 p->v_right->v_bal = 0;
1022 case 0: /* single rotate */
1023 pp->v_link[ff] = rright(p);
1024 p->v_right->v_bal = -1;
1027 case 1: /* double rotate */
1028 (void) rleft(p->v_left);
1029 pp->v_link[ff] = rright(p);
1031 p->v_bal < 1 ? 0 : -1;
1033 p->v_bal > -1 ? 0 : 1;
1045 * If from insert, then we terminate when p is balanced. If from
1046 * delete, then we terminate when p is unbalanced.
1048 if ((p->v_bal == 0) ^ d)
1054 plist(struct varent *p, int what)
1063 if (p->v_parent == 0) /* is it the header? */
1065 if ((p->v_flags & what) != 0) {
1067 int old_pintr_disabled;
1069 pintr_push_enable(&old_pintr_disabled);
1070 cleanup_until(&old_pintr_disabled);
1072 len = blklen(p->vec);
1073 xprintf("%S\t", p->v_name);
1088 } while (p->v_right == c);
1093 #if defined(KANJI) && defined(SHORT_STRINGS) && defined(DSPMBYTE)
1094 extern int dspmbyte_ls;
1097 update_dspmbyte_vars(void)
1103 /* if variable "nokanji" is set, multi-byte display is disabled */
1104 if ((vp = adrof(CHECK_MBYTEVAR)) && !adrof(STRnokanji)) {
1107 if(eq (dstr1, STRsjis))
1109 else if (eq(dstr1, STReuc))
1111 else if (eq(dstr1, STRbig5))
1113 else if (eq(dstr1, STRutf8))
1115 else if ((dstr1[0] - '0') >= 0 && (dstr1[0] - '0') <= 3) {
1119 xprintf(CGETS(18, 2,
1120 "Warning: unknown multibyte display; using default(euc(JP))\n"));
1123 if (dstr1 && vp->vec[1] && eq(vp->vec[1], STRls))
1127 for (lp = 0; lp < 256 && iskcode > 0; lp++) {
1131 _cmap[lp] = _cmap_mbyte[lp];
1132 _mbmap[lp] = _mbmap_sjis[lp];
1136 _cmap[lp] = _cmap_mbyte[lp];
1137 _mbmap[lp] = _mbmap_euc[lp];
1141 _cmap[lp] = _cmap_mbyte[lp];
1142 _mbmap[lp] = _mbmap_big5[lp];
1146 _cmap[lp] = _cmap_mbyte[lp];
1147 _mbmap[lp] = _mbmap_utf8[lp];
1150 xprintf(CGETS(18, 3,
1151 "Warning: unknown multibyte code %d; multibyte disabled\n"),
1153 _cmap[lp] = _cmap_c[lp];
1154 _mbmap[lp] = 0; /* Default map all 0 */
1160 /* check original table */
1161 if (Strlen(dstr1) != 256) {
1162 xprintf(CGETS(18, 4,
1163 "Warning: Invalid multibyte table length (%d); multibyte disabled\n"),
1167 for (lp = 0; lp < 256 && _enable_mbdisp == 1; lp++) {
1168 if (!((dstr1[lp] - '0') >= 0 && (dstr1[lp] - '0') <= 3)) {
1169 xprintf(CGETS(18, 4,
1170 "Warning: bad multibyte code at offset +%d; multibyte diabled\n"),
1176 /* set original table */
1177 for (lp = 0; lp < 256; lp++) {
1178 if (_enable_mbdisp == 1) {
1179 _cmap[lp] = _cmap_mbyte[lp];
1180 _mbmap[lp] = (unsigned short) ((dstr1[lp] - '0') & 0x0f);
1183 _cmap[lp] = _cmap_c[lp];
1184 _mbmap[lp] = 0; /* Default map all 0 */
1190 for (lp = 0; lp < 256; lp++) {
1191 _cmap[lp] = _cmap_c[lp];
1192 _mbmap[lp] = 0; /* Default map all 0 */
1197 #ifdef MBYTEDEBUG /* Sorry, use for beta testing */
1200 for (lp = 0; lp < 256; lp++)
1201 mbmapstr[lp] = _mbmap[lp] + '0';
1203 setcopy(STRmbytemap, mbmapstr, VAR_READWRITE);
1205 #endif /* MBYTEMAP */
1208 /* dspkanji/dspmbyte autosetting */
1209 /* PATCH IDEA FROM Issei.Suzuki VERY THANKS */
1211 autoset_dspmbyte(const Char *pcp)
1214 static const struct dspm_autoset_Table {
1218 { STRLANGEUCJP, STReuc },
1219 { STRLANGEUCKR, STReuc },
1220 { STRLANGEUCZH, STReuc },
1221 { STRLANGEUCJPB, STReuc },
1222 { STRLANGEUCKRB, STReuc },
1223 { STRLANGEUCZHB, STReuc },
1225 { STRLANGEUCJPC, STReuc },
1227 { STRLANGSJIS, STRsjis },
1228 { STRLANGSJISB, STRsjis },
1229 { STRLANGBIG5, STRbig5 },
1230 { STRstarutfstar8, STRutf8 },
1233 #if defined(HAVE_NL_LANGINFO) && defined(CODESET)
1234 static const struct dspm_autoset_Table dspmc[] = {
1235 { STRstarutfstar8, STRutf8 },
1237 { STRGB2312, STReuc },
1238 { STRLANGBIG5, STRbig5 },
1243 codeset = str2short(nl_langinfo(CODESET));
1244 if (*codeset != '\0') {
1245 for (i = 0; dspmc[i].n; i++) {
1247 if (dspmc[i].n[0] && t_pmatch(pcp, dspmc[i].n, &estr, 0) > 0) {
1248 setcopy(CHECK_MBYTEVAR, dspmc[i].v, VAR_READWRITE);
1249 update_dspmbyte_vars();
1259 for (i = 0; dspmt[i].n; i++) {
1261 if (dspmt[i].n[0] && t_pmatch(pcp, dspmt[i].n, &estr, 0) > 0) {
1262 setcopy(CHECK_MBYTEVAR, dspmt[i].v, VAR_READWRITE);
1263 update_dspmbyte_vars();