Discontinue HPUX support
This commit is contained in:
@@ -51,14 +51,6 @@ int set_cmd_env(void)
|
||||
if ((ret = read_cmd_conf()) != NoError)
|
||||
return ret;
|
||||
|
||||
# ifdef old_hpux
|
||||
p = get_real_locale(uenv->locale, &aliases);
|
||||
if (p) {
|
||||
uenv->real_locale = NEWSTR(p);
|
||||
uenv->locale_aliases = aliases;
|
||||
}
|
||||
# endif /* old_hpux */
|
||||
|
||||
expand_cmd_conf();
|
||||
|
||||
return ret;
|
||||
@@ -170,11 +162,6 @@ int expand_string(char *in_str, char *out_str, int out_len, ImsConf *ims)
|
||||
case 'A': ep = conf->userAltDir; break;
|
||||
case 'C': ep = conf->dt->confDir; break;
|
||||
case 'U': ep = conf->dt->userDir; break;
|
||||
# ifdef old_hpux
|
||||
case 'V': ep = conf->vue->confDir; break;
|
||||
case 'X': ep = conf->vue->userDir; break;
|
||||
# endif /* old_hpux */
|
||||
|
||||
case 'L': if (ep = uenv->real_locale) break;
|
||||
case 'l': ep = uenv->locale; break;
|
||||
case 'H': ep = uenv->homedir; break;
|
||||
@@ -264,13 +251,8 @@ int make_new_environ(OutEnv *oenv, UserSelection *sel)
|
||||
ims = sel->ent->ims;
|
||||
xmod = ENV_XMODIFIERS;
|
||||
xmod_done = False;
|
||||
# ifdef old_hpux
|
||||
xinput = xhp_xinput_name(NULL);
|
||||
xinput_done = (xinput) ? False : True;
|
||||
# else
|
||||
xinput = NULL;
|
||||
xinput_done = True;
|
||||
# endif /* old_hpux */
|
||||
proto = renv ? renv->proto : default_protocol(ims);
|
||||
|
||||
setp = unsetp = 0;
|
||||
@@ -295,20 +277,6 @@ int make_new_environ(OutEnv *oenv, UserSelection *sel)
|
||||
ep++;
|
||||
xmod_done = True;
|
||||
}
|
||||
# ifdef old_hpux
|
||||
if (!xinput_done && (proto == Proto_Xhp)) {
|
||||
#ifdef DEBUG
|
||||
if (!ims->servername) {
|
||||
DPR(("make_new_environ(): '%s' servername not defined\n",
|
||||
sel->name));
|
||||
}
|
||||
#endif
|
||||
ep->name = NEWSTR(xinput);
|
||||
ep->value = NEWSTR(ims->servername);
|
||||
ep++;
|
||||
xinput_done = True;
|
||||
}
|
||||
# endif /* old_hpux */
|
||||
if (ep == oenv->set) {
|
||||
FREE(oenv->set); oenv->set = (EnvEnt *)0;
|
||||
} else
|
||||
@@ -324,13 +292,6 @@ int make_new_environ(OutEnv *oenv, UserSelection *sel)
|
||||
ep++;
|
||||
xmod_done = True;
|
||||
}
|
||||
# ifdef old_hpux
|
||||
if (!xinput_done) {
|
||||
ep->name = NEWSTR(xinput);
|
||||
ep++;
|
||||
xinput_done = True;
|
||||
}
|
||||
# endif /* old_hpux */
|
||||
for (i = 0; i < num && (p = unsetp[i]); i++) {
|
||||
if (strcmp(p, xmod) == 0 || (xinput && (strcmp(p, xinput) == 0)))
|
||||
continue;
|
||||
@@ -470,87 +431,3 @@ int set_remote_env(char *ptr, char *env_pass)
|
||||
Conf.remote->passEnv, env_pass, ptr));
|
||||
return bp - ptr;
|
||||
}
|
||||
|
||||
# ifdef old_hpux
|
||||
char *xhp_xinput_name(char *locale)
|
||||
{
|
||||
char *xinput_name = "X@INPUT";
|
||||
char **pp, *p;
|
||||
int i, len;
|
||||
XhpLocale *xhp = Conf.xhp;
|
||||
char **ls;
|
||||
char typ = 0;
|
||||
|
||||
if (!xhp) return NULL;
|
||||
if (!locale) locale = userEnv.locale;
|
||||
|
||||
for (i = 0; !typ && i < XHP_LANG_NUM; i++) {
|
||||
if (!(ls = parse_strlist(xhp[i].locales, ' '))) continue;
|
||||
for (pp = ls; *pp; pp++) {
|
||||
if (locale[0] != (*pp)[0]) continue;
|
||||
len = strlen(p = *pp);
|
||||
if ((p[len - 1] == '*' && strncmp(locale, p, len - 1) == 0)
|
||||
|| strcmp(locale, p) == 0) {
|
||||
typ = xhp[i].type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
FREE_LIST(ls);
|
||||
}
|
||||
if (!typ) {
|
||||
DPR2(("xhp_xinput_name(%s): unknown locale\n", locale));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
xinput_name[1] = typ;
|
||||
return NEWSTR(xinput_name);
|
||||
}
|
||||
|
||||
|
||||
char *get_real_locale(char *locale, char ***aliases)
|
||||
{
|
||||
int i;
|
||||
int match_idx = -1;
|
||||
LocaleAlias **alias = Conf.alias, *ap;
|
||||
char **ls, **pp;
|
||||
char *real_locale = NULL;
|
||||
|
||||
if (!locale || !alias) return NULL;
|
||||
|
||||
for (i = 0; match_idx < 0 && (ap = alias[i]); i++) {
|
||||
if (strcmp(ap->name, locale) == 0) {
|
||||
match_idx = i;
|
||||
if (aliases)
|
||||
ls = parse_strlist(ap->aliases, ' ');
|
||||
break;
|
||||
}
|
||||
if (ls = parse_strlist(ap->aliases, ' ')) {
|
||||
for (pp = ls; *pp; pp++)
|
||||
if (strcmp(locale, *pp) == 0) {
|
||||
match_idx = i;
|
||||
break;
|
||||
}
|
||||
FREE_LIST(ls);
|
||||
ls = (char **)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (match_idx >= 0) {
|
||||
real_locale = alias[match_idx]->name;
|
||||
if (aliases) {
|
||||
*aliases = ls;
|
||||
ls = (char **)NULL;
|
||||
}
|
||||
} else {
|
||||
real_locale = NULL;
|
||||
if (aliases) *aliases = (char **) NULL;
|
||||
}
|
||||
if (ls) FREE_LIST(ls);
|
||||
|
||||
DPR(("get_real_locale(%s): real_locale=%s aliases=%s\n",
|
||||
locale, real_locale, aliases ? *aliases : NULL));
|
||||
|
||||
return real_locale;
|
||||
}
|
||||
|
||||
# endif /* old_hpux */
|
||||
|
||||
@@ -153,11 +153,6 @@ int read_cmd_conf(void)
|
||||
DtEnv *dt = NULL;
|
||||
RemoteEnv *remote;
|
||||
FILE *fp;
|
||||
# ifdef old_hpux
|
||||
VueEnv *vue;
|
||||
LocaleAlias *tmp_alias[MAXIMSENT], *ap;
|
||||
# endif /* old_hpux */
|
||||
|
||||
conf_dir = DTIMS_CONFDIR;
|
||||
if (!(path = Opt.ConfPath) || !*path) {
|
||||
if (!(path = getenv("DTIMS_STARTCONF")) || !*path) {
|
||||
@@ -235,10 +230,6 @@ int read_cmd_conf(void)
|
||||
RENEWSTR(conf->xmod[Proto_Ximp], valp);
|
||||
} else if (strncmp(p, "Xsi", 3) == 0) {
|
||||
RENEWSTR(conf->xmod[Proto_Xsi], valp);
|
||||
# ifdef old_hpux
|
||||
} else if (strncmp(p, "Xhp", 3) == 0) {
|
||||
RENEWSTR(conf->xmod[Proto_Xhp], valp);
|
||||
# endif /* old_hpux */
|
||||
} else if (strncmp(p, "None", 3) == 0) {
|
||||
RENEWSTR(conf->xmod[Proto_None], valp);
|
||||
} else
|
||||
@@ -251,10 +242,6 @@ int read_cmd_conf(void)
|
||||
RENEWSTR(conf->atom[Proto_Ximp], valp);
|
||||
} else if (strncmp(p, "Xsi", 3) == 0) {
|
||||
RENEWSTR(conf->atom[Proto_Xsi], valp);
|
||||
# ifdef old_hpux
|
||||
} else if (strncmp(p, "Xhp", 3) == 0) {
|
||||
RENEWSTR(conf->atom[Proto_Xhp], valp);
|
||||
# endif /* old_hpux */
|
||||
} else if (strncmp(p, "None", 3) == 0) {
|
||||
RENEWSTR(conf->atom[Proto_None], valp);
|
||||
} else
|
||||
@@ -281,47 +268,6 @@ int read_cmd_conf(void)
|
||||
RENEWSTR(remote->passEnv, valp);
|
||||
} else
|
||||
goto _inv;
|
||||
# ifdef old_hpux
|
||||
} else if (strncmp(lp, "Vue", 3) == 0) {
|
||||
p = lp + 3;
|
||||
if (!conf->vue) vue = conf->vue = ALLOC(1, VueEnv);
|
||||
if (strncmp(p, "ConfigDir", 4) == 0) {
|
||||
RENEWSTR(vue->confDir, valp);
|
||||
} else if (strncmp(p, "UserDir", 5) == 0) {
|
||||
RENEWSTR(vue->userDir, valp);
|
||||
} else if (strncmp(p, "UseLiteFile", 5) == 0) {
|
||||
RENEWSTR(vue->uselite, valp);
|
||||
} else if (strncmp(p, "LiteResourcePath", 5) == 0) {
|
||||
RENEWSTR(vue->litePath, valp);
|
||||
} else if (strncmp(p, "ResourcePath", 5) == 0) {
|
||||
RENEWSTR(vue->resPath, valp);
|
||||
} else
|
||||
goto _inv;
|
||||
} else if (strncmp(lp, "LocaleAlias", 6) == 0) {
|
||||
ap = ALLOC(1, LocaleAlias);
|
||||
p = valp; cut_field(valp);
|
||||
ap->name = NEWSTR(p);
|
||||
ap->aliases = NEWSTR(valp);
|
||||
tmp_alias[num_alias++] = ap;
|
||||
} else if (strncmp(lp, "XhpLocales", 3) == 0) {
|
||||
int idx = 0;
|
||||
p = strrchr(lp, '.');
|
||||
if (!p) continue; /* invalid */
|
||||
switch (p[1]) {
|
||||
case 'J': idx = XHP_JPN; break;
|
||||
case 'K': idx = XHP_KOR; break;
|
||||
case 'C': idx = XHP_CHS; break;
|
||||
case 'T': idx = XHP_CHT; break;
|
||||
default: goto _inv;
|
||||
}
|
||||
if (!conf->xhp)
|
||||
conf->xhp = ALLOC(XHP_LANG_NUM, XhpLocale);
|
||||
else if (conf->xhp[idx].locales) {
|
||||
FREE(conf->xhp[idx].locales);
|
||||
}
|
||||
conf->xhp[idx].type = p[1];
|
||||
conf->xhp[idx].locales = NEWSTR(valp);
|
||||
# endif /* old_hpux */
|
||||
} else {
|
||||
_inv:
|
||||
DPR(("\t[line=%d] invalid entry '%s'\n", line_num, lp));
|
||||
@@ -329,15 +275,6 @@ int read_cmd_conf(void)
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
# ifdef old_hpux
|
||||
if (num_alias > 0) {
|
||||
conf->alias = ALLOC(num_alias + 1, LocaleAlias *);
|
||||
memcpy((void *)conf->alias, (void *)tmp_alias,
|
||||
num_alias*sizeof(LocaleAlias *));
|
||||
conf->alias[num_alias] = (LocaleAlias *)0;
|
||||
}
|
||||
# endif /* old_hpux */
|
||||
|
||||
/* if (remote->disabled) FREE(remote->passEnv); */
|
||||
|
||||
_default:
|
||||
@@ -353,11 +290,6 @@ _default:
|
||||
if (!conf->dt) conf->dt = ALLOC(1, DtEnv);
|
||||
if (!conf->dt->confDir) conf->dt->confDir = NEWSTR(DT_CONFDIR);
|
||||
if (!conf->dt->userDir) conf->dt->userDir = NEWSTR(DT_USERDIR);
|
||||
# ifdef old_hpux
|
||||
if (!conf->vue) conf->vue = ALLOC(1, VueEnv);
|
||||
if (!conf->vue->confDir) conf->vue->confDir = NEWSTR(VUE_CONFDIR);
|
||||
if (!conf->vue->userDir) conf->vue->userDir = NEWSTR(VUE_USERDIR);
|
||||
# endif /* old_hpux */
|
||||
if (!conf->xmod[Proto_XIM]) conf->xmod[Proto_XIM] = NEWSTR(IM_XMOD_XIM);
|
||||
if (!conf->xmod[Proto_Ximp]) conf->xmod[Proto_Ximp] = NEWSTR(IM_XMOD_XIMP);
|
||||
if (!conf->xmod[Proto_Xsi]) conf->xmod[Proto_Xsi] = NEWSTR(IM_XMOD_XSI);
|
||||
@@ -401,15 +333,6 @@ int expand_cmd_conf(void)
|
||||
CHK_ADD(conf->dt->userDir)
|
||||
CHK_ADD(conf->dt->resPath)
|
||||
}
|
||||
# ifdef old_hpux
|
||||
if (conf->vue) {
|
||||
CHK_ADD(conf->vue->confDir)
|
||||
CHK_ADD(conf->vue->userDir)
|
||||
CHK_ADD(conf->vue->uselite)
|
||||
CHK_ADD(conf->vue->resPath)
|
||||
CHK_ADD(conf->vue->litePath)
|
||||
}
|
||||
# endif /* old_hpux */
|
||||
/* xmod[] & atom[] must not be expanded, since no ims selected */
|
||||
/* remote->* should be expanded at preparation of remote exec */
|
||||
|
||||
@@ -498,10 +421,6 @@ int read_imsconf(ImsConf *conf, char *ims_name, char *ims_fname)
|
||||
SET_FLAG(F_NO_REMOTE);
|
||||
else if (strcmp(lp, "no_option") == 0)
|
||||
SET_FLAG(F_NO_OPTION);
|
||||
# ifdef old_hpux
|
||||
else if (strcmp(lp, "try_connect") == 0)
|
||||
SET_FLAG(F_TRY_CONNECT);
|
||||
# endif /* old_hpux */
|
||||
else if (strcmp(lp, "has_window") == 0)
|
||||
SET_FLAG(F_HAS_WINDOW);
|
||||
#undef SET_FLAG
|
||||
@@ -1046,48 +965,6 @@ static int user_selection_fname(char *buf, int buf_len, int dpy_specific)
|
||||
}
|
||||
len = expand_string(dpy_specific ? "%S/%d/" : "%S/", buf, buf_len, 0);
|
||||
|
||||
# ifdef old_hpux
|
||||
if (!real_done && uenv->real_locale) {
|
||||
real_done = True;
|
||||
strcpy(buf + len, uenv->real_locale);
|
||||
if (!is_readable(buf, True)) {
|
||||
bool rename_done = False;
|
||||
char buf2[MAXPATHLEN], *bp;
|
||||
|
||||
strncpy(buf2, buf, len);
|
||||
bp = buf2 + len; *bp = 0;
|
||||
if (strcmp(uenv->locale, uenv->real_locale)) {
|
||||
strcpy(bp, uenv->locale);
|
||||
if (is_readable(buf2, False)) {
|
||||
rename_done = rename(buf2, buf) == 0;
|
||||
DPR(("user_selection_fname(): rename(%s, %s) %s\n",
|
||||
uenv->locale, uenv->real_locale,
|
||||
rename_done ? "OK" : "Failed"));
|
||||
}
|
||||
}
|
||||
|
||||
if (uenv->locale_aliases) {
|
||||
char **ap;
|
||||
for (ap = uenv->locale_aliases; *ap; ap++) {
|
||||
strcpy(bp, *ap);
|
||||
if (!is_readable(buf2, False)) continue;
|
||||
if (rename_done) {
|
||||
(void) unlink(buf2);
|
||||
DPR(("user_selection_fname(): unlink(%s) %s\n",
|
||||
*ap));
|
||||
} else {
|
||||
rename_done = rename(buf2, buf) == 0;
|
||||
DPR(("user_selection_fname(): rename(%s, %s) %s\n",
|
||||
*ap, uenv->real_locale,
|
||||
rename_done ? "OK" : "Failed"));
|
||||
}
|
||||
}
|
||||
}
|
||||
/* real_done = rename_done; */
|
||||
}
|
||||
}
|
||||
# endif /* old_hpux */
|
||||
|
||||
/* Add the CDE-generic locale name */
|
||||
strcpy(buf + len, real_done ? uenv->real_locale : uenv->CDE_locale);
|
||||
buf[buf_len-1] = 0;
|
||||
@@ -1104,9 +981,6 @@ int parse_protolist(char *valp)
|
||||
if (strstr(valp, "XIM")) proto_bits |= ProtoBit(Proto_XIM);
|
||||
if (strstr(valp, "Ximp")) proto_bits |= ProtoBit(Proto_Ximp);
|
||||
if (strstr(valp, "Xsi")) proto_bits |= ProtoBit(Proto_Xsi);
|
||||
# ifdef old_hpux
|
||||
if (strstr(valp, "Xhp")) proto_bits |= ProtoBit(Proto_Xhp);
|
||||
# endif /* old_hpux */
|
||||
if (strstr(valp, "None")) proto_bits |= ProtoBit(Proto_None);
|
||||
return proto_bits;
|
||||
}
|
||||
@@ -1116,9 +990,6 @@ int default_protocol(ImsConf *conf)
|
||||
if (conf->protocols & ProtoBit(Proto_XIM)) return Proto_XIM;
|
||||
else if (conf->protocols & ProtoBit(Proto_Ximp)) return Proto_Ximp;
|
||||
else if (conf->protocols & ProtoBit(Proto_Xsi)) return Proto_Xsi;
|
||||
# ifdef old_hpux
|
||||
else if (conf->protocols & ProtoBit(Proto_Xhp)) return Proto_Xhp;
|
||||
# endif /* old_hpux */
|
||||
else return Proto_None;
|
||||
}
|
||||
|
||||
|
||||
@@ -845,12 +845,6 @@ static int parse_options(int argc, char **argv)
|
||||
SET_FLAG(FLAG_CONNECT);
|
||||
} else if (optname_match("dt", opt, 2)) {
|
||||
SET_FLAG(FLAG_DT);
|
||||
# ifdef old_hpux
|
||||
CLR_FLAG(FLAG_VUE);
|
||||
} else if (optname_match("vue", opt, 2)) {
|
||||
SET_FLAG(FLAG_VUE);
|
||||
CLR_FLAG(FLAG_DT);
|
||||
# endif /* old_hpux */
|
||||
} else if (optname_match("window", opt, 2)) {
|
||||
SET_FLAG(FLAG_WINDOW);
|
||||
} else if (optname_match("nowindow", opt, 4)) {
|
||||
@@ -1062,10 +1056,6 @@ static OptDesc opts_internal[] = {
|
||||
{ "-notimeout", "do not timeout" },
|
||||
{ "-noremote", "disable remote execution" },
|
||||
{ "-notify", "print error code to stderr" },
|
||||
# ifdef old_hpux
|
||||
{ "-vue", "in VUE environment" },
|
||||
{ "-connect", "enable try_connect" },
|
||||
# endif /* old_hpux */
|
||||
#ifdef SelectMode_ONCE
|
||||
{ "-once", "auto-selection once selected" },
|
||||
#endif /* SelectMode_ONCE */
|
||||
|
||||
@@ -45,12 +45,6 @@ static void on_sig_chld(/* sig */);
|
||||
static bool is_ims_running(/* renv, ims */);
|
||||
static int settle_ims(/* sel */);
|
||||
static Window property_owner(/* prop_atom, prop_str */);
|
||||
# ifdef old_hpux
|
||||
static void catch_alarm(/* sig */);
|
||||
static int try_connection(/* sel */);
|
||||
static int create_dummy_ic(/* xim */);
|
||||
# endif /* old_hpux */
|
||||
|
||||
|
||||
void ximsStart(void)
|
||||
{
|
||||
@@ -185,12 +179,6 @@ void ximsWaitDone(void)
|
||||
|
||||
case ErrImsWaitDone:
|
||||
sel->status = NoError;
|
||||
# ifdef old_hpux
|
||||
if ((OpFlag & FLAG_CONNECT)
|
||||
|| (sel->ent->ims->flags & F_TRY_CONNECT)) {
|
||||
sel->status = try_connection(sel);
|
||||
}
|
||||
# endif /* old_hpux */
|
||||
break;
|
||||
|
||||
case ErrImsConnecting:
|
||||
@@ -360,11 +348,6 @@ int load_resources(void)
|
||||
if (isDT()) {
|
||||
sess_res = find_session_resfile(RES_TYPE_DT);
|
||||
}
|
||||
# ifdef old_hpux
|
||||
else if (isVUE()) {
|
||||
sess_res = find_session_resfile(RES_TYPE_VUE);
|
||||
}
|
||||
# endif /* old_hpux */
|
||||
if (sess_res && !is_readable(sess_res, False)) {
|
||||
FREE(sess_res);
|
||||
sess_res = NULL;
|
||||
@@ -407,17 +390,6 @@ static char *find_session_resfile(int res_type)
|
||||
if (res_type == RES_TYPE_DT) { /* DT */
|
||||
res = Conf.dt ? (Conf.dt)->resPath : NULL;
|
||||
}
|
||||
# ifdef old_hpux
|
||||
else if (res_type == RES_TYPE_VUE && Conf.vue) { /* VUE */
|
||||
VueEnv *vue = Conf.vue;
|
||||
res = vue->resPath;
|
||||
if (vue->uselite) {
|
||||
expand_string(vue->uselite, path, MAXPATHLEN, (ImsConf *)0);
|
||||
if (access(path, R_OK) == 0)
|
||||
res = vue->litePath;
|
||||
}
|
||||
}
|
||||
# endif /* old_hpux */
|
||||
|
||||
if (!res) return NULL;
|
||||
if (ls = parse_strlist(res, ':')) {
|
||||
@@ -490,12 +462,6 @@ static int build_run_env(UserSelection *sel)
|
||||
renv->atom_name = NEWSTR(buf);
|
||||
} else { /* copy im_mod, instead */
|
||||
renv->atom_name = NEWSTR(renv->im_mod);
|
||||
# ifdef old_hpux
|
||||
if ((p = renv->atom_name) && strchr(p, '#')) {
|
||||
while (p = strchr(p, '#')) /* replace '#' with '@' */
|
||||
*p++ = '@';
|
||||
}
|
||||
# endif /* old_hpux */
|
||||
}
|
||||
|
||||
/* others */
|
||||
@@ -768,177 +734,3 @@ static Window property_owner(Atom *prop_atom, char *prop_str)
|
||||
}
|
||||
return XGetSelectionOwner(Dpy, property);
|
||||
}
|
||||
|
||||
|
||||
# ifdef old_hpux
|
||||
/* ***** try_connection ***** */
|
||||
|
||||
#define MAX_RETRY 5
|
||||
|
||||
static jmp_buf jmp_env;
|
||||
static Window dmy_win = 0; /* temporary window used for XCreateIC() */
|
||||
|
||||
static void catch_alarm(int sig)
|
||||
{
|
||||
signal(SIGALRM, SIG_IGN);
|
||||
alarm(0);
|
||||
longjmp(jmp_env, 1);
|
||||
}
|
||||
|
||||
static int try_connection(UserSelection *sel)
|
||||
{
|
||||
RunEnv *renv = sel->renv;
|
||||
ImsConf *ims = sel->ent->ims;
|
||||
char envbuf[BUFSIZ], *bp;
|
||||
XIM xim;
|
||||
int ic_ok, retry_cnt;
|
||||
static char *saved_xmod = NULL;
|
||||
#ifdef DEBUG
|
||||
time_t last_time;
|
||||
#endif
|
||||
|
||||
DPR(("try_connection(%s):\n", sel->name));
|
||||
|
||||
if (sel->status != NoError || !renv->im_mod)
|
||||
return sel->status;
|
||||
|
||||
renv->status = ErrImsConnecting;
|
||||
set_sig_chld(True);
|
||||
|
||||
/* set XMODIFIERS */
|
||||
saved_xmod = NULL;
|
||||
bp = strcpyx(envbuf, ENV_MOD_IM);
|
||||
bp = strcpyx(bp, renv->im_mod);
|
||||
saved_xmod = XSetLocaleModifiers(envbuf);
|
||||
DPR(("\tXSetLocaleModifiers(%s)\n", envbuf));
|
||||
|
||||
ic_ok = False;
|
||||
if (setjmp(jmp_env) == 0) {
|
||||
signal(SIGALRM, catch_alarm);
|
||||
alarm(Opt.Timeout);
|
||||
|
||||
for (retry_cnt = 0; !ic_ok && retry_cnt <= MAX_RETRY; retry_cnt++) {
|
||||
if (retry_cnt) sleep(retry_cnt * retry_cnt);
|
||||
|
||||
#ifdef DEBUG
|
||||
last_time = time((time_t)0);
|
||||
#endif
|
||||
xim = XOpenIM(Dpy, (XrmDatabase)0, ims->servername, ims->classname);
|
||||
if (xim) {
|
||||
DPR(("try_connection(%d): XOpenIM() OK [%d sec.]",
|
||||
retry_cnt, time((time_t)0) - last_time));
|
||||
#ifdef DEBUG
|
||||
last_time = time((time_t)0);
|
||||
#endif
|
||||
ic_ok = create_dummy_ic(xim);
|
||||
DPR(("\tXCreateIC() %s [%d sec.]\n",
|
||||
ic_ok ? "OK" : "Failed", time((time_t)0) - last_time));
|
||||
XCloseIM(xim); xim = 0;
|
||||
} else {
|
||||
DPR(("try_connection(%d): XOpenIM() failed.\n", retry_cnt));
|
||||
ic_ok = False;
|
||||
}
|
||||
}
|
||||
} else { /* long_jmp() by alarm [timeout] */
|
||||
alarm(0); signal(SIGALRM, SIG_IGN);
|
||||
DPR(("try_connection(): XOpenIM() & XCreateIC() timed-out.\n"));
|
||||
if (dmy_win) {
|
||||
XDestroyWindow(Dpy, dmy_win); dmy_win = 0;
|
||||
}
|
||||
/* neither XDestroyIC() nor XCloseIM() should be called */
|
||||
xim = 0;
|
||||
ic_ok = False;
|
||||
}
|
||||
alarm(0); signal(SIGALRM, SIG_IGN);
|
||||
|
||||
/* restore XMODIFIERS */
|
||||
if (saved_xmod) {
|
||||
DPR2(("\tXSetLocaleModifiers(save='%s')\n", saved_xmod));
|
||||
XSetLocaleModifiers(saved_xmod);
|
||||
}
|
||||
|
||||
set_sig_chld(False);
|
||||
renv->status = ErrImsConnectDone;
|
||||
|
||||
return ic_ok ? NoError : ErrImsTimeout; /* ErrImsConnect; */
|
||||
}
|
||||
|
||||
static int create_dummy_ic(XIM xim)
|
||||
{
|
||||
int scr;
|
||||
XFontSet fset;
|
||||
XIMStyles *im_styles;
|
||||
XIMStyle style;
|
||||
XIC ic;
|
||||
unsigned long fg, bg;
|
||||
XRectangle area;
|
||||
XVaNestedList status_attr;
|
||||
|
||||
scr = DefaultScreen(Dpy);
|
||||
fg = BlackPixel(Dpy, scr);
|
||||
bg = WhitePixel(Dpy, scr);
|
||||
dmy_win = XCreateSimpleWindow(Dpy, RootWindow(Dpy, scr),
|
||||
0, 0, 1, 1, 0, bg, fg);
|
||||
|
||||
/* search (PreeditNothing | StatusNothing [or StatusArea]) style */
|
||||
ic = 0;
|
||||
style = (XIMStyle) 0;
|
||||
im_styles = (XIMStyles *) 0;
|
||||
if (XGetIMValues(xim, XNQueryInputStyle, &im_styles, NULL)) {
|
||||
DPR(("create_dummy_ic(): XGetIMValues(XNQueryInutStyle) failed.\n"));
|
||||
goto _err;
|
||||
}
|
||||
if (!im_styles || !im_styles->count_styles) {
|
||||
DPR(("create_dummy_ic(): No input styles supported on IMS.\n"));
|
||||
if (im_styles) XFree(im_styles);
|
||||
goto _err;
|
||||
}
|
||||
if ((int)im_styles->count_styles > 0) {
|
||||
int i, alt;
|
||||
for (i = 0, alt = -1; i < (int)im_styles->count_styles; i++)
|
||||
if (im_styles->supported_styles[i] & XIMPreeditNothing) {
|
||||
if (im_styles->supported_styles[i] & XIMStatusNothing) {
|
||||
style = im_styles->supported_styles[i];
|
||||
break;
|
||||
} else if (im_styles->supported_styles[i] & XIMStatusArea) {
|
||||
alt = i;
|
||||
}
|
||||
}
|
||||
if (!style && alt >= 0) style = im_styles->supported_styles[alt];
|
||||
XFree(im_styles);
|
||||
}
|
||||
if (!style) {
|
||||
DPR(("create_dummy_ic(): 'PreeditNothing' styles not supported.\n"));
|
||||
goto _err;
|
||||
/* style = XIMPreeditNothing | XIMStatusNothing; */
|
||||
}
|
||||
|
||||
fset = 0;
|
||||
status_attr = (XVaNestedList) 0;
|
||||
if (style & XIMStatusArea) {
|
||||
area.x = area.y = 0; area.width = area.height = 1;
|
||||
status_attr = XVaCreateNestedList(NULL,
|
||||
XNArea, &area,
|
||||
XNForeground, fg,
|
||||
XNBackground, bg,
|
||||
XNFontSet, fset,
|
||||
NULL );
|
||||
}
|
||||
|
||||
ic = XCreateIC(xim, XNInputStyle, style,
|
||||
XNClientWindow, dmy_win,
|
||||
XNStatusAttributes, status_attr,
|
||||
XNFocusWindow, dmy_win,
|
||||
NULL );
|
||||
|
||||
/* if (fset) XFreeFontSet(Dpy, fset); */
|
||||
if (ic) XDestroyIC(ic);
|
||||
|
||||
_err:
|
||||
if (dmy_win) XDestroyWindow(Dpy, dmy_win);
|
||||
dmy_win = 0;
|
||||
|
||||
return ic ? True : False;
|
||||
}
|
||||
|
||||
# endif /* old_hpux */
|
||||
|
||||
@@ -700,28 +700,6 @@ void clear_CmdConf(void)
|
||||
FREE(conf->dt->resPath);
|
||||
FREE(conf->dt);
|
||||
}
|
||||
# ifdef old_hpux
|
||||
if (conf->vue) {
|
||||
FREE(conf->vue->confDir);
|
||||
FREE(conf->vue->userDir);
|
||||
FREE(conf->vue->uselite);
|
||||
FREE(conf->vue->resPath);
|
||||
FREE(conf->vue->litePath);
|
||||
FREE(conf->vue);
|
||||
}
|
||||
if (conf->alias) {
|
||||
for (ap = conf->alias; *ap; ap++) {
|
||||
FREE((*ap)->name);
|
||||
FREE((*ap)->aliases);
|
||||
}
|
||||
FREE(conf->alias);
|
||||
}
|
||||
if (conf->xhp) {
|
||||
for (i = 0; i < XHP_LANG_NUM; i++)
|
||||
FREE(conf->xhp[i].locales);
|
||||
FREE(conf->xhp);
|
||||
}
|
||||
# endif /* old_hpux */
|
||||
}
|
||||
CLR(&Conf, CmdConf);
|
||||
cmdconf_initialized = False;
|
||||
@@ -803,11 +781,7 @@ void pr_ImsConf(ImsConf *conf, char *ims_name)
|
||||
(conf->protocols & ProtoBit(Proto_XIM)) ? "XIM," : NULL,
|
||||
(conf->protocols & ProtoBit(Proto_Ximp)) ? "Ximp," : NULL,
|
||||
(conf->protocols & ProtoBit(Proto_Xsi)) ? "Xsi," : NULL,
|
||||
# ifdef old_hpux
|
||||
(conf->protocols & ProtoBit(Proto_Xhp)) ? "Xhp," : NULL,
|
||||
# else
|
||||
NULL,
|
||||
# endif /* old_hpux */
|
||||
(conf->protocols & ProtoBit(Proto_None)) ? "None," : NULL);
|
||||
fprintf(LogFp, "\tproperty=%s servername=%s (%s) class=%s\n",
|
||||
conf->property, conf->servername,
|
||||
@@ -903,9 +877,6 @@ void pr_CmdConf(void)
|
||||
{
|
||||
int i;
|
||||
CmdConf *conf = &Conf;
|
||||
# ifdef old_hpux
|
||||
LocaleAlias **ap;
|
||||
# endif /* old_hpux */
|
||||
char **p;
|
||||
|
||||
fprintf(LogFp, "CmdConf:\n");
|
||||
@@ -918,21 +889,12 @@ void pr_CmdConf(void)
|
||||
fprintf(LogFp, "\tuserTmpDir=%s\n", conf->userTmpDir);
|
||||
fprintf(LogFp, "\tuserAltDir=%s\n", conf->userAltDir);
|
||||
|
||||
# ifdef old_hpux
|
||||
fprintf(LogFp, "\tImXmod:\tXIM=%s Ximp=%s Xsi=%s Xhp=%s None=%s\n",
|
||||
conf->xmod[Proto_XIM], conf->xmod[Proto_Ximp],
|
||||
conf->xmod[Proto_Xsi], conf->xmod[Proto_Xhp], conf->atom[Proto_None]);
|
||||
fprintf(LogFp, "\tImAtom:\tXIM=%s Ximp=%s Xsi=%s Xhp=%s None=%s\n",
|
||||
conf->atom[Proto_XIM], conf->atom[Proto_Ximp],
|
||||
conf->atom[Proto_Xsi], conf->atom[Proto_Xhp], conf->atom[Proto_None]);
|
||||
# else
|
||||
fprintf(LogFp, "\tImXmod:\tXIM=%s Ximp=%s Xsi=%s None=%s\n",
|
||||
conf->xmod[Proto_XIM], conf->xmod[Proto_Ximp],
|
||||
conf->xmod[Proto_Xsi], conf->atom[Proto_None]);
|
||||
fprintf(LogFp, "\tImAtom:\tXIM=%s Ximp=%s Xsi=%s None=%s\n",
|
||||
conf->atom[Proto_XIM], conf->atom[Proto_Ximp],
|
||||
conf->atom[Proto_Xsi], conf->atom[Proto_None]);
|
||||
# endif /* old_hpux */
|
||||
|
||||
fprintf(LogFp, "\tAction[%d]:\t{ ", NUM_ACTIONS);
|
||||
for (i = 0; i < NUM_ACTIONS; i++)
|
||||
@@ -952,29 +914,6 @@ void pr_CmdConf(void)
|
||||
} else
|
||||
fprintf(LogFp, "\tDtEnv:\t<None>\n");
|
||||
|
||||
# ifdef old_hpux
|
||||
if (conf->vue) {
|
||||
fprintf(LogFp, "\tVueEnv:\tConfDir=%s UserDir=%s\n",
|
||||
conf->vue->confDir, conf->vue->userDir);
|
||||
fprintf(LogFp, "\t uselite=%s\n", conf->vue->uselite);
|
||||
fprintf(LogFp, "\t resPath=\"%s\"\n", conf->vue->resPath);
|
||||
fprintf(LogFp, "\t litePath=\"%s\"\n", conf->vue->litePath);
|
||||
} else
|
||||
fprintf(LogFp, "\tVueEnv:\t<None>\n");
|
||||
|
||||
fprintf(LogFp, "\tlocaleAlias:\t%s\n", conf->alias ? NULL : "None");
|
||||
if (conf->alias) {
|
||||
for (ap = conf->alias; *ap; ap++)
|
||||
fprintf(LogFp, "\t [%s]\t%s\n", (*ap)->name, (*ap)->aliases);
|
||||
}
|
||||
|
||||
fprintf(LogFp, "\txhp:\t%s\n", conf->xhp ? NULL : "None");
|
||||
if (conf->xhp) {
|
||||
for (i = 0; i < XHP_LANG_NUM; i++)
|
||||
fprintf(LogFp, "\t [%c]\t%s\n",
|
||||
conf->xhp[i].type, conf->xhp[i].locales);
|
||||
}
|
||||
# endif /* old_hpux */
|
||||
}
|
||||
|
||||
void pr_CmdOpt(void)
|
||||
@@ -1018,9 +957,6 @@ void pr_OpModeFlag(void)
|
||||
if (OpFlag & FLAG_REMOTERUN) fputs("RemoteRun, ", LogFp);
|
||||
if (OpFlag & FLAG_WINDOW) fputs("Window, ", LogFp);
|
||||
if (OpFlag & FLAG_DT) fputs("Dt, ", LogFp);
|
||||
# ifdef old_hpux
|
||||
if (OpFlag & FLAG_VUE) fputs("Vue, ", LogFp);
|
||||
# endif /* old_hpux */
|
||||
}
|
||||
putc('\n', LogFp);
|
||||
}
|
||||
@@ -1132,11 +1068,7 @@ char *error_name(ximsError error)
|
||||
|
||||
|
||||
static char *_proto_names[NUM_PROTOCOLS] =
|
||||
# ifdef old_hpux
|
||||
{ "None", "XIM", "Ximp", "Xsi", "Xhp" };
|
||||
# else
|
||||
{ "None", "XIM", "Ximp", "Xsi" };
|
||||
# endif /* old_hpux */
|
||||
|
||||
char *proto_name(int proto_idx)
|
||||
{
|
||||
|
||||
@@ -72,16 +72,9 @@
|
||||
#define FLAG_REMOTERUN (1<<9) /* -remoterun option */
|
||||
#define FLAG_WINDOW (1<<10) /* -window option */
|
||||
#define FLAG_DT (1<<11) /* -dt option */
|
||||
# ifdef old_hpux
|
||||
#define FLAG_VUE (1<<12) /* -vue option */
|
||||
# endif /* old_hpux */
|
||||
|
||||
#define FLAG_DEFAULT (FLAG_DT)
|
||||
# ifdef old_hpux
|
||||
#define USE_WINDOW_MASK (FLAG_WINDOW|FLAG_VUE|FLAG_DT)
|
||||
# else
|
||||
#define USE_WINDOW_MASK (FLAG_WINDOW|FLAG_DT)
|
||||
# endif /* old_hpux */
|
||||
|
||||
#define MAXIMSENT 32 /* max # of ims for each locale */
|
||||
|
||||
@@ -122,12 +115,7 @@
|
||||
#define Proto_XIM 1
|
||||
#define Proto_Ximp 2
|
||||
#define Proto_Xsi 3
|
||||
# ifdef old_hpux
|
||||
#define Proto_Xhp 4
|
||||
#define NUM_PROTOCOLS 5
|
||||
# else
|
||||
#define NUM_PROTOCOLS 4
|
||||
# endif /* old_hpux */
|
||||
/* protocol flag */
|
||||
#define ProtoBit(i) (1<<(i))
|
||||
|
||||
@@ -167,15 +155,6 @@
|
||||
#define HOST_REMOTE 1
|
||||
#define HOST_UNKNOWN 2
|
||||
|
||||
# ifdef old_hpux
|
||||
/* index for XhpLocale */
|
||||
#define XHP_JPN 0
|
||||
#define XHP_KOR 1
|
||||
#define XHP_CHS 2
|
||||
#define XHP_CHT 3
|
||||
#define XHP_LANG_NUM 4
|
||||
# endif /* old_hpux */
|
||||
|
||||
/* message type for put_msg_win() */
|
||||
#define MSGTYP_INFO 0
|
||||
#define MSGTYP_WARN 1
|
||||
@@ -244,26 +223,6 @@ typedef struct {
|
||||
EnvEnt *unset;
|
||||
} OutEnv;
|
||||
|
||||
# ifdef old_hpux
|
||||
typedef struct {
|
||||
char *name;
|
||||
char *aliases;
|
||||
} LocaleAlias;
|
||||
|
||||
typedef struct {
|
||||
char type;
|
||||
char *locales;
|
||||
} XhpLocale;
|
||||
|
||||
typedef struct {
|
||||
char *confDir; /* override /etc/vue/config */
|
||||
char *userDir; /* override .vue */
|
||||
char *uselite; /* $HOME/.vue/sessions/usevuelite */
|
||||
char *resPath; /* path of session resource (colon separated) */
|
||||
char *litePath;
|
||||
} VueEnv;
|
||||
# endif /* old_hpux */
|
||||
|
||||
typedef struct {
|
||||
char *confDir; /* override /usr/dt/config */
|
||||
char *userDir; /* override .dt */
|
||||
@@ -391,11 +350,6 @@ typedef struct {
|
||||
char *action[NUM_ACTIONS]; /* actions internally used */
|
||||
DtEnv *dt;
|
||||
RemoteEnv *remote;
|
||||
# ifdef old_hpux
|
||||
VueEnv *vue;
|
||||
XhpLocale *xhp;
|
||||
LocaleAlias **alias;
|
||||
# endif /* old_hpux */
|
||||
} CmdConf;
|
||||
|
||||
typedef struct {
|
||||
@@ -447,13 +401,8 @@ Extern int LastErrMsg;
|
||||
|
||||
#undef Extern
|
||||
|
||||
# ifdef old_hpux
|
||||
#define isXsession() ((OpFlag & (FLAG_VUE|FLAG_DT)) ? True : False)
|
||||
#define isVUE() ((OpFlag & FLAG_VUE) ? True : False)
|
||||
# else
|
||||
#define isXsession() ((OpFlag & FLAG_DT) ? True : False)
|
||||
#define isVUE() (False)
|
||||
# endif /* old_hpux */
|
||||
#define isDT() ((OpFlag & FLAG_DT) ? True : False)
|
||||
#define useWINDOW() \
|
||||
(((OpFlag & USE_WINDOW_MASK) || window_env_ok()) ? True : False)
|
||||
|
||||
@@ -101,12 +101,6 @@
|
||||
#define XRDB_PATH "/usr/bin/X11/xrdb"
|
||||
#define DTSESSION_RES_PATH "/usr/dt/bin/dtsession_res"
|
||||
|
||||
# ifdef old_hpux
|
||||
/* VUE dirs */
|
||||
#define VUE_CONFDIR "/etc/vue/config"
|
||||
#define VUE_USERDIR "%H/.vue"
|
||||
# endif /* old_hpux */
|
||||
|
||||
/* DT dirs */
|
||||
#define DT_CONFDIR "/usr/dt/config"
|
||||
#define DT_USERDIR "%H/.dt"
|
||||
|
||||
Reference in New Issue
Block a user