crashes when you kill your input method (xterm crashes, too).
- fix bugs in x flushing, causing an empty screen after startup
the first until the first event arives.
+ - fix ~15kb memleak per term in rxvtd.
1.8 Mon Feb 2 20:09:18 CET 2004
- almost total conversion to C++. Except for introducing
struct object { };
void *obj;
- R (object::*meth)();
+ R (object::*meth) ();
/* a proxy is a kind of recipe on how to call a specific class method */
struct proxy_base {
- virtual R call (void *obj, R (object::*meth)()) = 0;
+ virtual R call (void *obj, R (object::*meth) ()) = 0;
};
template<class O1, class O2>
struct proxy : proxy_base {
- virtual R call (void *obj, R (object::*meth)())
+ virtual R call (void *obj, R (object::*meth) ())
{
- ((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)()>(meth)))
+ ((reinterpret_cast<O1 *> (obj)) ->* (reinterpret_cast<R (O2::*) ()> (meth)))
();
}
};
public:
template<class O1, class O2>
- callback0 (O1 *object, R (O2::*method)())
+ callback0 (O1 *object, R (O2::*method) ())
{
static proxy<O1,O2> p;
- obj = reinterpret_cast<void *>(object);
- meth = reinterpret_cast<R (object::*)()>(method);
+ obj = reinterpret_cast<void *> (object);
+ meth = reinterpret_cast<R (object::*) ()> (method);
prxy = &p;
}
- R call() const
+ R call () const
{
return prxy->call (obj, meth);
}
- R operator ()() const
+ R operator () () const
{
return call ();
}
struct object { };
void *obj;
- R (object::*meth)(A1);
+ R (object::*meth) (A1);
/* a proxy is a kind of recipe on how to call a specific class method */
struct proxy_base {
- virtual R call (void *obj, R (object::*meth)(A1), A1 a1) = 0;
+ virtual R call (void *obj, R (object::*meth) (A1), A1 a1) = 0;
};
template<class O1, class O2>
struct proxy : proxy_base {
- virtual R call (void *obj, R (object::*meth)(A1), A1 a1)
+ virtual R call (void *obj, R (object::*meth) (A1), A1 a1)
{
- ((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1)>(meth)))
+ ((reinterpret_cast<O1 *> (obj)) ->* (reinterpret_cast<R (O2::*) (A1)> (meth)))
(a1);
}
};
public:
template<class O1, class O2>
- callback1 (O1 *object, R (O2::*method)(A1))
+ callback1 (O1 *object, R (O2::*method) (A1))
{
static proxy<O1,O2> p;
- obj = reinterpret_cast<void *>(object);
- meth = reinterpret_cast<R (object::*)(A1)>(method);
+ obj = reinterpret_cast<void *> (object);
+ meth = reinterpret_cast<R (object::*) (A1)> (method);
prxy = &p;
}
- R call(A1 a1) const
+ R call (A1 a1) const
{
return prxy->call (obj, meth, a1);
}
- R operator ()(A1 a1) const
+ R operator () (A1 a1) const
{
return call (a1);
}
struct object { };
void *obj;
- R (object::*meth)(A1, A2);
+ R (object::*meth) (A1, A2);
/* a proxy is a kind of recipe on how to call a specific class method */
struct proxy_base {
- virtual R call (void *obj, R (object::*meth)(A1, A2), A1 a1, A2 a2) = 0;
+ virtual R call (void *obj, R (object::*meth) (A1, A2), A1 a1, A2 a2) = 0;
};
template<class O1, class O2>
struct proxy : proxy_base {
- virtual R call (void *obj, R (object::*meth)(A1, A2), A1 a1, A2 a2)
+ virtual R call (void *obj, R (object::*meth) (A1, A2), A1 a1, A2 a2)
{
- ((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2)>(meth)))
+ ((reinterpret_cast<O1 *> (obj)) ->* (reinterpret_cast<R (O2::*) (A1, A2)> (meth)))
(a1, a2);
}
};
public:
template<class O1, class O2>
- callback2 (O1 *object, R (O2::*method)(A1, A2))
+ callback2 (O1 *object, R (O2::*method) (A1, A2))
{
static proxy<O1,O2> p;
- obj = reinterpret_cast<void *>(object);
- meth = reinterpret_cast<R (object::*)(A1, A2)>(method);
+ obj = reinterpret_cast<void *> (object);
+ meth = reinterpret_cast<R (object::*) (A1, A2)> (method);
prxy = &p;
}
- R call(A1 a1, A2 a2) const
+ R call (A1 a1, A2 a2) const
{
return prxy->call (obj, meth, a1, a2);
}
- R operator ()(A1 a1, A2 a2) const
+ R operator () (A1 a1, A2 a2) const
{
return call (a1, a2);
}
struct object { };
void *obj;
- R (object::*meth)(A1, A2, A3);
+ R (object::*meth) (A1, A2, A3);
/* a proxy is a kind of recipe on how to call a specific class method */
struct proxy_base {
- virtual R call (void *obj, R (object::*meth)(A1, A2, A3), A1 a1, A2 a2, A3 a3) = 0;
+ virtual R call (void *obj, R (object::*meth) (A1, A2, A3), A1 a1, A2 a2, A3 a3) = 0;
};
template<class O1, class O2>
struct proxy : proxy_base {
- virtual R call (void *obj, R (object::*meth)(A1, A2, A3), A1 a1, A2 a2, A3 a3)
+ virtual R call (void *obj, R (object::*meth) (A1, A2, A3), A1 a1, A2 a2, A3 a3)
{
- ((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2, A3)>(meth)))
+ ((reinterpret_cast<O1 *> (obj)) ->* (reinterpret_cast<R (O2::*) (A1, A2, A3)> (meth)))
(a1, a2, a3);
}
};
public:
template<class O1, class O2>
- callback3 (O1 *object, R (O2::*method)(A1, A2, A3))
+ callback3 (O1 *object, R (O2::*method) (A1, A2, A3))
{
static proxy<O1,O2> p;
- obj = reinterpret_cast<void *>(object);
- meth = reinterpret_cast<R (object::*)(A1, A2, A3)>(method);
+ obj = reinterpret_cast<void *> (object);
+ meth = reinterpret_cast<R (object::*) (A1, A2, A3)> (method);
prxy = &p;
}
- R call(A1 a1, A2 a2, A3 a3) const
+ R call (A1 a1, A2 a2, A3 a3) const
{
return prxy->call (obj, meth, a1, a2, a3);
}
- R operator ()(A1 a1, A2 a2, A3 a3) const
+ R operator () (A1 a1, A2 a2, A3 a3) const
{
return call (a1, a2, a3);
}
struct object { };
void *obj;
- R (object::*meth)(A1, A2, A3, A4);
+ R (object::*meth) (A1, A2, A3, A4);
/* a proxy is a kind of recipe on how to call a specific class method */
struct proxy_base {
- virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4), A1 a1, A2 a2, A3 a3, A4 a4) = 0;
+ virtual R call (void *obj, R (object::*meth) (A1, A2, A3, A4), A1 a1, A2 a2, A3 a3, A4 a4) = 0;
};
template<class O1, class O2>
struct proxy : proxy_base {
- virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4), A1 a1, A2 a2, A3 a3, A4 a4)
+ virtual R call (void *obj, R (object::*meth) (A1, A2, A3, A4), A1 a1, A2 a2, A3 a3, A4 a4)
{
- ((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2, A3, A4)>(meth)))
+ ((reinterpret_cast<O1 *> (obj)) ->* (reinterpret_cast<R (O2::*) (A1, A2, A3, A4)> (meth)))
(a1, a2, a3, a4);
}
};
public:
template<class O1, class O2>
- callback4 (O1 *object, R (O2::*method)(A1, A2, A3, A4))
+ callback4 (O1 *object, R (O2::*method) (A1, A2, A3, A4))
{
static proxy<O1,O2> p;
- obj = reinterpret_cast<void *>(object);
- meth = reinterpret_cast<R (object::*)(A1, A2, A3, A4)>(method);
+ obj = reinterpret_cast<void *> (object);
+ meth = reinterpret_cast<R (object::*) (A1, A2, A3, A4)> (method);
prxy = &p;
}
- R call(A1 a1, A2 a2, A3 a3, A4 a4) const
+ R call (A1 a1, A2 a2, A3 a3, A4 a4) const
{
return prxy->call (obj, meth, a1, a2, a3, a4);
}
- R operator ()(A1 a1, A2 a2, A3 a3, A4 a4) const
+ R operator () (A1 a1, A2 a2, A3 a3, A4 a4) const
{
return call (a1, a2, a3, a4);
}
struct object { };
void *obj;
- R (object::*meth)(A1, A2, A3, A4, A5);
+ R (object::*meth) (A1, A2, A3, A4, A5);
/* a proxy is a kind of recipe on how to call a specific class method */
struct proxy_base {
- virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) = 0;
+ virtual R call (void *obj, R (object::*meth) (A1, A2, A3, A4, A5), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) = 0;
};
template<class O1, class O2>
struct proxy : proxy_base {
- virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
+ virtual R call (void *obj, R (object::*meth) (A1, A2, A3, A4, A5), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
{
- ((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2, A3, A4, A5)>(meth)))
+ ((reinterpret_cast<O1 *> (obj)) ->* (reinterpret_cast<R (O2::*) (A1, A2, A3, A4, A5)> (meth)))
(a1, a2, a3, a4, a5);
}
};
public:
template<class O1, class O2>
- callback5 (O1 *object, R (O2::*method)(A1, A2, A3, A4, A5))
+ callback5 (O1 *object, R (O2::*method) (A1, A2, A3, A4, A5))
{
static proxy<O1,O2> p;
- obj = reinterpret_cast<void *>(object);
- meth = reinterpret_cast<R (object::*)(A1, A2, A3, A4, A5)>(method);
+ obj = reinterpret_cast<void *> (object);
+ meth = reinterpret_cast<R (object::*) (A1, A2, A3, A4, A5)> (method);
prxy = &p;
}
- R call(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
+ R call (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
{
return prxy->call (obj, meth, a1, a2, a3, a4, a5);
}
- R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
+ R operator () (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
{
return call (a1, a2, a3, a4, a5);
}
struct object { };
void *obj;
- R (object::*meth)(A1, A2, A3, A4, A5, A6);
+ R (object::*meth) (A1, A2, A3, A4, A5, A6);
/* a proxy is a kind of recipe on how to call a specific class method */
struct proxy_base {
- virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5, A6), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) = 0;
+ virtual R call (void *obj, R (object::*meth) (A1, A2, A3, A4, A5, A6), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) = 0;
};
template<class O1, class O2>
struct proxy : proxy_base {
- virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5, A6), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
+ virtual R call (void *obj, R (object::*meth) (A1, A2, A3, A4, A5, A6), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
{
- ((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2, A3, A4, A5, A6)>(meth)))
+ ((reinterpret_cast<O1 *> (obj)) ->* (reinterpret_cast<R (O2::*) (A1, A2, A3, A4, A5, A6)> (meth)))
(a1, a2, a3, a4, a5, a6);
}
};
public:
template<class O1, class O2>
- callback6 (O1 *object, R (O2::*method)(A1, A2, A3, A4, A5, A6))
+ callback6 (O1 *object, R (O2::*method) (A1, A2, A3, A4, A5, A6))
{
static proxy<O1,O2> p;
- obj = reinterpret_cast<void *>(object);
- meth = reinterpret_cast<R (object::*)(A1, A2, A3, A4, A5, A6)>(method);
+ obj = reinterpret_cast<void *> (object);
+ meth = reinterpret_cast<R (object::*) (A1, A2, A3, A4, A5, A6)> (method);
prxy = &p;
}
- R call(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
+ R call (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
{
return prxy->call (obj, meth, a1, a2, a3, a4, a5, a6);
}
- R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
+ R operator () (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
{
return call (a1, a2, a3, a4, a5, a6);
}
struct object { };
void *obj;
- R (object::*meth)(A1, A2, A3, A4, A5, A6, A7);
+ R (object::*meth) (A1, A2, A3, A4, A5, A6, A7);
/* a proxy is a kind of recipe on how to call a specific class method */
struct proxy_base {
- virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5, A6, A7), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) = 0;
+ virtual R call (void *obj, R (object::*meth) (A1, A2, A3, A4, A5, A6, A7), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) = 0;
};
template<class O1, class O2>
struct proxy : proxy_base {
- virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5, A6, A7), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
+ virtual R call (void *obj, R (object::*meth) (A1, A2, A3, A4, A5, A6, A7), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
{
- ((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2, A3, A4, A5, A6, A7)>(meth)))
+ ((reinterpret_cast<O1 *> (obj)) ->* (reinterpret_cast<R (O2::*) (A1, A2, A3, A4, A5, A6, A7)> (meth)))
(a1, a2, a3, a4, a5, a6, a7);
}
};
public:
template<class O1, class O2>
- callback7 (O1 *object, R (O2::*method)(A1, A2, A3, A4, A5, A6, A7))
+ callback7 (O1 *object, R (O2::*method) (A1, A2, A3, A4, A5, A6, A7))
{
static proxy<O1,O2> p;
- obj = reinterpret_cast<void *>(object);
- meth = reinterpret_cast<R (object::*)(A1, A2, A3, A4, A5, A6, A7)>(method);
+ obj = reinterpret_cast<void *> (object);
+ meth = reinterpret_cast<R (object::*) (A1, A2, A3, A4, A5, A6, A7)> (method);
prxy = &p;
}
- R call(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
+ R call (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
{
return prxy->call (obj, meth, a1, a2, a3, a4, a5, a6, a7);
}
- R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
+ R operator () (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
{
return call (a1, a2, a3, a4, a5, a6, a7);
}
if (cmd_getc () == '8')
scr_E ();
break;
- case ' (':
+ case '(':
scr_charset_set (0, (unsigned int)cmd_getc ());
break;
case ')':
/*
- * $Id: command.h,v 1.5 2004-01-17 01:20:01 pcg Exp $
+ * $Id: command.h,v 1.6 2004-02-13 12:16:21 pcg Exp $
*/
#ifndef COMMAND_H_
* software in question is broken enough to be case insensitive to the 'c'
* character in the answerback string, we make the distinguishing
* characteristic be capitalization of that character. The length of the
- * two strings should be the same so that identical read(2) calls may be
+ * two strings should be the same so that identical read (2) calls may be
* used.
*/
#define VT100_ANS "\033[?1;2c" /* vt100 answerback */
/////////////////////////////////////////////////////////////////////////////
rxvt_fontset::rxvt_fontset (rxvt_t r)
-: r(r)
+: r (r)
{
clear ();
}
void
rxvt_fontset::clear ()
{
- for (rxvt_font **i = fonts.begin (); i != fonts.end(); i++)
+ for (rxvt_font **i = fonts.begin (); i != fonts.end (); i++)
FONT_UNREF (*i);
fonts.clear ();
// we currently need a base-font, no matter what
if ((int)fonts.size () <= base_id || !realize_font (base_id))
{
- puts ("unable to load specified font(s), falling back to 'fixed'\n");
+ puts ("unable to load specified font (s), falling back to 'fixed'\n");
add_fonts ("fixed");
base_id = fonts.size () - 1;
}
void populate (const char *desc);
int find_font (uint32_t unicode);
- rxvt_font *operator [](int id) const
+ rxvt_font *operator [] (int id) const
{
return fonts[id];
}
enum {
ZERO_WIDTH_CHAR = 0x200b,
- NOCHAR = 65535, // must be invalid in ANY codeset(!)
+ NOCHAR = 65535, // must be invalid in ANY codeset (!)
};
struct rxvt_codeset_conv {
#define COLOR_CURSOR_BACKGROUND NULL /* if NULL, use foreground colour */
/*
- * Define to remove support for XCopyArea() support. XCopyArea() is useful
+ * Define to remove support for XCopyArea () support. XCopyArea () is useful
* for scrolling on non-local X displays
*/
/* #define NO_SLOW_LINK_SUPPORT */
*
* The FSM can have MAX_STATES states (change it for more).
* Each state contains:
- * 1. many tranlsation tables (registered via kstate_add_xlat())
+ * 1. many tranlsation tables (registered via kstate_add_xlat ())
* 2. many switch codes for transition to other states (registered via
- * kstate_add_switcher()) : limit is static now: MAX_SWITCHER
+ * kstate_add_switcher ()) : limit is static now: MAX_SWITCHER
* 3. life: the number of xlations allowed in a state (0 = unlimited)
*
* Format of tranlation strings:
#define NUM_XLAT_TYPES (sizeof(xlat_type) / sizeof(xlat_type[0]))
-static void kstate_add_xlat(char *str);
-static void kstate_add_switcher(char *str);
-static void kstate_set_life(char *str);
+static void kstate_add_xlat (char *str);
+static void kstate_add_switcher (char *str);
+static void kstate_set_life (char *str);
/* --- Functions ------------- */
void
-kstate_setcurr(int stateno)
+kstate_setcurr (int stateno)
{
u_char prev_state;
}
void
-kstate_init(void)
+kstate_init (void)
{
pStateNow->num_xlat = pStateNow->num_switcher = pStateNow->life = pStateNow->prev_state = 0;
pStateNow->xlat = NULL;
}
void
-kstate_end(void)
+kstate_end (void)
{
int i;
for (i = 0; i < pStateNow->num_xlat; i++)
- free(pStateNow->xlat[i].pval);
+ free (pStateNow->xlat[i].pval);
if (pStateNow->num_xlat > 0)
- free(pStateNow->xlat);
+ free (pStateNow->xlat);
}
/*
* to support other remappers.
*/
void
-kstate_init_all(int greek_mode)
+kstate_init_all (int greek_mode)
{
/* the translation tables for the 4 FSM states for ELOT-928 mappings */
int i;
for (i = 0; i < MAX_STATES; i++)
{
- kstate_setcurr(i);
- kstate_init();
+ kstate_setcurr (i);
+ kstate_init ();
}
if (greek_mode < 0 || greek_mode >= NUM_XLAT_TYPES) /* avoid death */
greek_mode = GREEK_ELOT928;
xlat_now = &xlat_type[greek_mode];
- kstate_setcurr(0);
- kstate_add_xlat(xlat_now->plain);
- kstate_add_switcher("A;:1");
- kstate_add_switcher("A::2");
- kstate_set_life("L0");
-
- kstate_setcurr(1);
- kstate_add_xlat(xlat_now->accent);
- kstate_add_xlat(xlat_now->accent_xtra);
- kstate_add_switcher("A::3");
- kstate_set_life("L1");
-
- kstate_setcurr(2);
- kstate_add_xlat(xlat_now->umlaut);
- kstate_add_switcher("A;:3");
- kstate_set_life("L1");
-
- kstate_setcurr(3);
- kstate_add_xlat(xlat_now->acc_uml);
- kstate_set_life("L1");
+ kstate_setcurr (0);
+ kstate_add_xlat (xlat_now->plain);
+ kstate_add_switcher ("A;:1");
+ kstate_add_switcher ("A::2");
+ kstate_set_life ("L0");
+
+ kstate_setcurr (1);
+ kstate_add_xlat (xlat_now->accent);
+ kstate_add_xlat (xlat_now->accent_xtra);
+ kstate_add_switcher ("A::3");
+ kstate_set_life ("L1");
+
+ kstate_setcurr (2);
+ kstate_add_xlat (xlat_now->umlaut);
+ kstate_add_switcher ("A;:3");
+ kstate_set_life ("L1");
+
+ kstate_setcurr (3);
+ kstate_add_xlat (xlat_now->acc_uml);
+ kstate_set_life ("L1");
}
void
-kstate_end_all(void)
+kstate_end_all (void)
{
int i;
for (i = 0; i < MAX_STATES; i++)
{
- kstate_setcurr(i);
- kstate_end();
+ kstate_setcurr (i);
+ kstate_end ();
}
- kstate_setcurr(0);
+ kstate_setcurr (0);
}
/*
* reset FSM
*/
void
-kstate_reset(void)
+kstate_reset (void)
{
- kstate_setcurr(0);
+ kstate_setcurr (0);
}
void
-kstate_add_xlat(char *str)
+kstate_add_xlat (char *str)
{
K_XLAT *xlat;
u_int *pval_tmp;
/* add a new xlat table in state */
if (pStateNow->num_xlat == 0)
{
- pStateNow->xlat = malloc(sizeof(K_XLAT));
+ pStateNow->xlat = malloc (sizeof (K_XLAT));
}
else /* prefer contiguous data, realloc */
- pStateNow->xlat = realloc(pStateNow->xlat, (pStateNow->num_xlat + 1) * sizeof(K_XLAT));
+ pStateNow->xlat = realloc (pStateNow->xlat, (pStateNow->num_xlat + 1) * sizeof (K_XLAT));
xlat = &pStateNow->xlat[pStateNow->num_xlat];
/* parse str and derive first, last, values */
- xlat->first = (u_int) atoi(strtok(str, "-"));
- xlat->last = (u_int) atoi(strtok(NULL, ":"));
+ xlat->first = (u_int) atoi (strtok (str, "-"));
+ xlat->last = (u_int) atoi (strtok (NULL, ":"));
i = 0;
- pval_tmp = calloc(MAX_VAL, sizeof(K_XLAT));
- while ((sval = strtok(NULL, ",")) != NULL)
- pval_tmp[i++] = (u_int) (atoi(sval));
- xlat->pval = calloc(i, sizeof(K_XLAT));
+ pval_tmp = calloc (MAX_VAL, sizeof (K_XLAT));
+ while ((sval = strtok (NULL, ",")) != NULL)
+ pval_tmp[i++] = (u_int) (atoi (sval));
+ xlat->pval = calloc (i, sizeof (K_XLAT));
if (xlat->pval != NULL)
- memcpy(xlat->pval, pval_tmp, i * sizeof(u_int));
- free(pval_tmp);
+ memcpy (xlat->pval, pval_tmp, i * sizeof (u_int));
+ free (pval_tmp);
pStateNow->num_xlat++;
}
* Ascii only for this implementation
*/
void
-kstate_add_switcher(char *str)
+kstate_add_switcher (char *str)
{
K_SWITCH *switcher;
{
case 'A': /* ascii eg: A;:2 */
switcher->code = str[1];
- switcher->nextstate = atoi(&str[3]);
+ switcher->nextstate = atoi (&str[3]);
break;
}
switcher->on = 0;
/* L1 or L0 */
void
-kstate_set_life(char *str)
+kstate_set_life (char *str)
{
- pStateNow->life = atoi(&str[1]);
+ pStateNow->life = atoi (&str[1]);
}
unsigned int
-kstate_cxlat(unsigned int c)
+kstate_cxlat (unsigned int c)
{
int i;
if (pStateNow->switcher[i].type == 'A' && /* only ascii here */
c == pStateNow->switcher[i].code)
{
- kstate_setcurr(pStateNow->switcher[i].nextstate);
+ kstate_setcurr (pStateNow->switcher[i].nextstate);
pStateNow->switcher[i].on = 1;
return ((unsigned int)-1);
}
}
/* switch back to previous state if life of current is 1 */
if (pStateNow->life == 1)
- kstate_setcurr(pStateNow->prev_state);
+ kstate_setcurr (pStateNow->prev_state);
return (c);
}
#ifdef RXVT
void
-greek_init(void)
+greek_init (void)
{
- kstate_init_all(GreekMode);
+ kstate_init_all (GreekMode);
}
void
-greek_end(void)
+greek_end (void)
{
- kstate_end_all();
+ kstate_end_all ();
}
void
-greek_reset(void)
+greek_reset (void)
{
- kstate_reset();
+ kstate_reset ();
}
void
-greek_setmode(int greek_mode)
+greek_setmode (int greek_mode)
{
GreekMode = greek_mode;
}
int
-greek_getmode(void)
+greek_getmode (void)
{
return (GreekMode);
}
* xlate a given string in-place - return new string length
*/
int
-greek_xlat(char *s, int num_chars)
+greek_xlat (char *s, int num_chars)
{
int i, count;
unsigned int c;
for (i = 0, count = 0; i < num_chars; i++)
{
- c = kstate_cxlat((unsigned int)s[i]);
+ c = kstate_cxlat ((unsigned int)s[i]);
if (c != -1)
s[count++] = (char)c;
}
#ifdef TEST
int
-main(void)
+main (void)
{
/*char text[] = "abcdef;aGDZXC"; */
char text[] = "abcdef;a:ibgdezhuiklmnjoprstyfxcv";
- kstate_init_all(GREEK_ELOT928);
- printf("text: %s\n", text);
- greek_xlat(text, strlen(text));
- printf("xlat'ed text: %s\n", text);
- kstate_end_all();
+ kstate_init_all (GREEK_ELOT928);
+ printf ("text: %s\n", text);
+ greek_xlat (text, strlen (text));
+ printf ("xlat'ed text: %s\n", text);
+ kstate_end_all ();
return 0;
}
#endif
extern void greek_init (void);
extern void greek_end (void);
extern void greek_reset (void);
- extern void greek_setmode(int greek_mode);
- extern int greek_getmode(void);
+ extern void greek_setmode (int greek_mode);
+ extern int greek_getmode (void);
extern int greek_xlat (char *s, int num_chars);
#ifdef __cplusplus
}
#ifdef MENUBAR
menu_readonly = 1;
-# if !(MENUBAR_MAX > 1)
- CurrentBar = &(BarList);
+# if ! (MENUBAR_MAX > 1)
+ CurrentBar = & (BarList);
# endif /* (MENUBAR_MAX > 1) */
#endif
if (i == 4 || i == 7)
continue;
#endif
- close(i);
+ close (i);
}
#endif
}
* Look for -exec option. Find => split and make cmd_argv[] of command args
*/
for (r_argc = 0; r_argc < argc; r_argc++)
- if (!STRCMP (argv[r_argc], "-e") || !STRCMP(argv[r_argc], "-exec"))
+ if (!STRCMP (argv[r_argc], "-e") || !STRCMP (argv[r_argc], "-exec"))
break;
- r_argv = (const char **)rxvt_malloc (sizeof(char *) * (r_argc + 1));
+ r_argv = (const char **)rxvt_malloc (sizeof (char *) * (r_argc + 1));
for (i = 0; i < r_argc; i++)
r_argv[i] = (const char *)argv[i];
cmd_argv = NULL;
else
{
- cmd_argv = (const char **)rxvt_malloc (sizeof(char *) * (argc - r_argc));
+ cmd_argv = (const char **)rxvt_malloc (sizeof (char *) * (argc - r_argc));
for (i = 0; i < argc - r_argc - 1; i++)
cmd_argv[i] = (const char *)argv[i + r_argc + 1];
for (i = 0; i < NUM_RESOURCES;)
rs[i++] = NULL;
- rs[Rs_name] = rxvt_r_basename(argv[0]);
+ rs[Rs_name] = rxvt_r_basename (argv[0]);
/*
* Open display, get options/resources and create the window
#endif
if (!display
- && !(display = displays.get (rs[Rs_display_name])))
+ && ! (display = displays.get (rs[Rs_display_name])))
{
rxvt_print_error ("can't open display %s", rs[Rs_display_name]);
exit (EXIT_FAILURE);
if (cmd_argv && cmd_argv[0])
{
if (!rs[Rs_title])
- rs[Rs_title] = rxvt_r_basename(cmd_argv[0]);
+ rs[Rs_title] = rxvt_r_basename (cmd_argv[0]);
if (!rs[Rs_iconName])
rs[Rs_iconName] = rs[Rs_title];
}
rs[Rs_iconName] = rs[Rs_name];
}
- if (rs[Rs_saveLines] && (i = atoi(rs[Rs_saveLines])) >= 0)
- TermWin.saveLines = BOUND_POSITIVE_INT16(i);
+ if (rs[Rs_saveLines] && (i = atoi (rs[Rs_saveLines])) >= 0)
+ TermWin.saveLines = BOUND_POSITIVE_INT16 (i);
#ifndef NO_FRILLS
- if (rs[Rs_int_bwidth] && (i = atoi(rs[Rs_int_bwidth])) >= 0)
- TermWin.int_bwidth = min(i, 100); /* arbitrary limit */
- if (rs[Rs_ext_bwidth] && (i = atoi(rs[Rs_ext_bwidth])) >= 0)
- TermWin.ext_bwidth = min(i, 100); /* arbitrary limit */
+ if (rs[Rs_int_bwidth] && (i = atoi (rs[Rs_int_bwidth])) >= 0)
+ TermWin.int_bwidth = min (i, 100); /* arbitrary limit */
+ if (rs[Rs_ext_bwidth] && (i = atoi (rs[Rs_ext_bwidth])) >= 0)
+ TermWin.ext_bwidth = min (i, 100); /* arbitrary limit */
#endif
#ifndef NO_LINESPACE
- if (rs[Rs_lineSpace] && (i = atoi(rs[Rs_lineSpace])) >= 0)
- TermWin.lineSpace = min(i, 100); /* arbitrary limit */
+ if (rs[Rs_lineSpace] && (i = atoi (rs[Rs_lineSpace])) >= 0)
+ TermWin.lineSpace = min (i, 100); /* arbitrary limit */
#endif
#ifdef POINTER_BLANK
- if (rs[Rs_pointerBlankDelay] && (i = atoi(rs[Rs_pointerBlankDelay])) >= 0)
+ if (rs[Rs_pointerBlankDelay] && (i = atoi (rs[Rs_pointerBlankDelay])) >= 0)
pointerBlankDelay = i;
else
pointerBlankDelay = 2;
#ifdef ACS_ASCII
if (!rs[Rs_acs_chars])
rs[Rs_acs_chars] = ACS_CHARS;
- if ((i = STRLEN(rs[Rs_acs_chars])) < 0x20)
+ if ((i = STRLEN (rs[Rs_acs_chars])) < 0x20)
{
- val = rxvt_realloc((void *)rs[Rs_acs_chars], 0x20);
+ val = rxvt_realloc ((void *)rs[Rs_acs_chars], 0x20);
for (; i < 0x20; )
val[i] = ' ';
rs[Rs_acs_chars] = val;
# endif
else
{
- val = STRDUP(rs[Rs_backspace_key]);
- rxvt_Str_trim(val);
- rxvt_Str_escaped(val);
+ val = STRDUP (rs[Rs_backspace_key]);
+ rxvt_Str_trim (val);
+ rxvt_Str_escaped (val);
key_backspace = val;
}
#endif
# endif
else
{
- val = STRDUP(rs[Rs_delete_key]);
- rxvt_Str_trim(val);
- rxvt_Str_escaped(val);
+ val = STRDUP (rs[Rs_delete_key]);
+ rxvt_Str_trim (val);
+ rxvt_Str_escaped (val);
key_delete = val;
}
#endif
if (rs[Rs_answerbackstring])
{
- rxvt_Str_trim((char *)rs[Rs_answerbackstring]);
- rxvt_Str_escaped((char *)rs[Rs_answerbackstring]);
+ rxvt_Str_trim ((char *)rs[Rs_answerbackstring]);
+ rxvt_Str_escaped ((char *)rs[Rs_answerbackstring]);
}
if (rs[Rs_selectstyle])
{
- if (STRNCASECMP(rs[Rs_selectstyle], "oldword", 7) == 0)
+ if (STRNCASECMP (rs[Rs_selectstyle], "oldword", 7) == 0)
selection_style = OLD_WORD_SELECT;
#ifndef NO_OLD_SELECTION
- else if (STRNCASECMP(rs[Rs_selectstyle], "old", 3) == 0)
+ else if (STRNCASECMP (rs[Rs_selectstyle], "old", 3) == 0)
selection_style = OLD_SELECT;
#endif
#ifndef XTERM_REVERSE_VIDEO
/* this is how we implement reverseVideo */
if (Options & Opt_reverseVideo)
- SWAP_IT(rs[Rs_color + Color_fg], rs[Rs_color + Color_bg], const char *);
+ SWAP_IT (rs[Rs_color + Color_fg], rs[Rs_color + Color_bg], const char *);
#endif
/* convenient aliases for setting fg/bg to colors */
/* Fixup display_name for export over pty to any interested terminal
* clients via "ESC[7n" (e.g. shells). Note we use the pure IP number
* (for the first non-loopback interface) that we get from
- * rxvt_network_display(). This is more "name-resolution-portable", if you
+ * rxvt_network_display (). This is more "name-resolution-portable", if you
* will, and probably allows for faster x-client startup if your name
* server is beyond a slow link or overloaded at client startup. Of
* course that only helps the shell's child processes, not us.
if (val == NULL)
#endif /* DISPLAY_IS_IP */
- val = XDisplayString(display->display);
+ val = XDisplayString (display->display);
if (rs[Rs_display_name] == NULL)
rs[Rs_display_name] = val; /* use broken `:0' value */
i = STRLEN (val);
- env_display = (char *)rxvt_malloc ((i + 9) * sizeof(char));
+ env_display = (char *)rxvt_malloc ((i + 9) * sizeof (char));
sprintf (env_display, "DISPLAY=%s", val);
/* avoiding the math library:
- * i = (int)(ceil(log10((unsigned int)TermWin.parent[0]))) */
+ * i = (int) (ceil (log10 ((unsigned int)TermWin.parent[0]))) */
for (i = 0, u = (unsigned int)TermWin.parent[0]; u; u /= 10, i++)
;
- MAX_IT(i, 1);
- env_windowid = (char *)rxvt_malloc ((i + 10) * sizeof(char));
+ MAX_IT (i, 1);
+ env_windowid = (char *)rxvt_malloc ((i + 10) * sizeof (char));
sprintf (env_windowid, "WINDOWID=%u",
(unsigned int)TermWin.parent[0]);
if (rs[Rs_term_name] != NULL)
{
- env_term = (char *)rxvt_malloc ((STRLEN(rs[Rs_term_name]) + 6) * sizeof(char));
+ env_term = (char *)rxvt_malloc ((STRLEN (rs[Rs_term_name]) + 6) * sizeof (char));
sprintf (env_term, "TERM=%s", rs[Rs_term_name]);
putenv (env_term);
}
wmlocale = XInternAtom (display->display, "WM_LOCALE_NAME", False);
XChangeProperty (display->display, TermWin.parent[0], wmlocale,
XA_STRING, 8, PropModeReplace,
- (unsigned char *)locale, STRLEN(locale));
+ (unsigned char *)locale, STRLEN (locale));
if (!XSupportsLocale ())
{
/*----------------------------------------------------------------------*/
void
-rxvt_term::init_command(const char *const *argv)
+rxvt_term::init_command (const char *const *argv)
{
/*
* Initialize the command connection.
int i;
for (i = 0; i < NUM_XA; i++)
- xa[i] = XInternAtom(display->display, xa_names[i], False);
+ xa[i] = XInternAtom (display->display, xa_names[i], False);
/* Enable delete window protocol */
XSetWMProtocols (display->display, TermWin.parent[0],
- &(xa[XA_WMDELETEWINDOW]), 1);
+ & (xa[XA_WMDELETEWINDOW]), 1);
#ifdef USING_W11LIB
/* enable W11 callbacks */
get_ourmods ();
- if (!(Options & Opt_scrollTtyOutput))
+ if (! (Options & Opt_scrollTtyOutput))
PrivateModes |= PrivMode_TtyOutputInh;
if (Options & Opt_scrollTtyKeypress)
PrivateModes |= PrivMode_Keypress;
- if (!(Options & Opt_jumpScroll))
+ if (! (Options & Opt_jumpScroll))
PrivateModes |= PrivMode_smoothScroll;
#ifndef NO_BACKSPACE_KEY
- if (STRCMP(key_backspace, "DEC") == 0)
+ if (STRCMP (key_backspace, "DEC") == 0)
PrivateModes |= PrivMode_HaveBackSpace;
#endif
}
#ifdef GREEK_SUPPORT
- greek_init();
+ greek_init ();
#endif
#ifdef CURSOR_BLINK
xcol[1] = PixColors[Color_scroll];
# ifdef PREFER_24BIT
xcol[0].set (display, 65535, 65535, 65535);
- /* XFreeColors(display->display, XCMAP, &(xcol[0].pixel), 1, ~0); */
+ /* XFreeColors (display->display, XCMAP, & (xcol[0].pixel), 1, ~0); */
# else
xcol[0].set (display, WhitePixel (display->display, display->screen));
# endif
/*----------------------------------------------------------------------*/
/* color aliases, fg/bg bright-bold */
void
-rxvt_term::color_aliases(int idx)
+rxvt_term::color_aliases (int idx)
{
- if (rs[Rs_color + idx] && isdigit (*(rs[Rs_color + idx])))
+ if (rs[Rs_color + idx] && isdigit (* (rs[Rs_color + idx])))
{
int i = atoi (rs[Rs_color + idx]);
requestedmeta = realmeta = realalt = 0;
rsmod = rs[Rs_modifier];
if (rsmod
- && STRCASECMP(rsmod, "mod1") >= 0 && STRCASECMP(rsmod, "mod5") <= 0)
+ && STRCASECMP (rsmod, "mod1") >= 0 && STRCASECMP (rsmod, "mod5") <= 0)
requestedmeta = rsmod[3] - '0';
- map = XGetModifierMapping(display->display);
+ map = XGetModifierMapping (display->display);
kc = map->modifiermap;
for (i = 1; i < 6; i++)
{
{
if (kc[k] == 0)
break;
- switch (XKeycodeToKeysym(display->display, kc[k], 0))
+ switch (XKeycodeToKeysym (display->display, kc[k], 0))
{
case XK_Num_Lock:
ModNumLockMask = modmasks[i - 1];
/* FALLTHROUGH */
default:
- continue; /* for(;;) */
+ continue; /* for (;;) */
case XK_Meta_L:
case XK_Meta_R:
cm = "meta";
cm = "hyper";
break;
}
- if (rsmod && STRNCASECMP(rsmod, cm, STRLEN(cm)) == 0)
+ if (rsmod && STRNCASECMP (rsmod, cm, STRLEN (cm)) == 0)
requestedmeta = i;
}
}
- XFreeModifiermap(map);
+ XFreeModifiermap (map);
i = (requestedmeta ? requestedmeta
: (realmeta ? realmeta
: (realalt ? realalt : 0)));
}
/*----------------------------------------------------------------------*/
-/* rxvt_Create_Windows() - Open and map the window */
+/* rxvt_Create_Windows () - Open and map the window */
void
rxvt_term::create_windows (int argc, const char *const *argv)
{
if (Options & Opt_transparent)
{
- XGetWindowAttributes (display->display, RootWindow(display->display, display->screen), &gattr);
+ XGetWindowAttributes (display->display, RootWindow (display->display, display->screen), &gattr);
display->depth = gattr.depth; // doh //TODO, per-term not per-display?
}
old_height = szHint.height;
/* parent window - reverse video so we can see placement errors
- * sub-window placement & size in rxvt_resize_subwindows()
+ * sub-window placement & size in rxvt_resize_subwindows ()
*/
#ifdef PREFER_24BIT
: NormalState);
wmHint.window_group = TermWin.parent[0];
- XSetWMProperties(display->display, TermWin.parent[0], NULL, NULL,
+ XSetWMProperties (display->display, TermWin.parent[0], NULL, NULL,
(char **)argv, argc, &szHint, &wmHint, &classHint);
- XSelectInput(display->display, TermWin.parent[0],
+ XSelectInput (display->display, TermWin.parent[0],
KeyPressMask
#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)
| KeyReleaseMask
termwin_ev.start (display, TermWin.parent[0]);
/* vt cursor: Black-on-White is standard, but this is more popular */
- TermWin_cursor = XCreateFontCursor(display->display, XC_xterm);
+ TermWin_cursor = XCreateFontCursor (display->display, XC_xterm);
#if defined(HAVE_SCROLLBARS) || defined(MENUBAR)
/* cursor (menuBar/scrollBar): Black-on-White */
- leftptr_cursor = XCreateFontCursor(display->display, XC_left_ptr);
+ leftptr_cursor = XCreateFontCursor (display->display, XC_left_ptr);
#endif
#ifdef POINTER_BLANK
#endif
/* the vt window */
- TermWin.vt = XCreateSimpleWindow(display->display, TermWin.parent[0],
+ TermWin.vt = XCreateSimpleWindow (display->display, TermWin.parent[0],
window_vt_x, window_vt_y,
- TermWin_TotalWidth(),
- TermWin_TotalHeight(),
+ TermWin_TotalWidth (),
+ TermWin_TotalHeight (),
0,
PixColors[Color_fg],
PixColors[Color_bg]);
#ifdef DEBUG_X
- XStoreName(display->display, TermWin.vt, "vt window");
+ XStoreName (display->display, TermWin.vt, "vt window");
#endif
vt_emask = (ExposureMask | ButtonPressMask | ButtonReleaseMask
#endif
vt_emask |= (Button1MotionMask | Button3MotionMask);
- XSelectInput(display->display, TermWin.vt, vt_emask);
+ XSelectInput (display->display, TermWin.vt, vt_emask);
vt_ev.start (display, TermWin.vt);
#if defined(MENUBAR) && (MENUBAR_MAX > 1)
- if (menuBar_height())
+ if (menuBar_height ())
{
- menuBar.win = XCreateSimpleWindow(display->display, TermWin.parent[0],
+ menuBar.win = XCreateSimpleWindow (display->display, TermWin.parent[0],
window_vt_x, 0,
- TermWin_TotalWidth(),
- menuBar_TotalHeight(),
+ TermWin_TotalWidth (),
+ menuBar_TotalHeight (),
0,
PixColors[Color_fg],
PixColors[Color_scroll]);
#ifdef DEBUG_X
- XStoreName(display->display, menuBar.win, "menubar");
+ XStoreName (display->display, menuBar.win, "menubar");
#endif
- XDefineCursor(display->display, menuBar.win, pointer_leftptr);
+ XDefineCursor (display->display, menuBar.win, pointer_leftptr);
- XSelectInput(display->display, menuBar.win,
+ XSelectInput (display->display, menuBar.win,
(ExposureMask | ButtonPressMask | ButtonReleaseMask
| Button1MotionMask));
menubar_ev.start (display, menuBar.win);
#ifdef XPM_BACKGROUND
if (rs[Rs_backgroundPixmap] != NULL
- && !(Options & Opt_transparent))
+ && ! (Options & Opt_transparent))
{
const char *p = rs[Rs_backgroundPixmap];
- if ((p = STRCHR(p, ';')) != NULL)
+ if ((p = STRCHR (p, ';')) != NULL)
{
p++;
scale_pixmap (p);
gcvalue.foreground = PixColors[Color_fg];
gcvalue.background = PixColors[Color_bg];
gcvalue.graphics_exposures = 1;
- TermWin.gc = XCreateGC(display->display, TermWin.vt,
+ TermWin.gc = XCreateGC (display->display, TermWin.vt,
GCForeground | GCBackground
| GCGraphicsExposures, &gcvalue);
#if defined(MENUBAR) || defined(RXVT_SCROLLBAR)
gcvalue.foreground = PixColors[Color_topShadow];
- topShadowGC = XCreateGC(display->display, TermWin.vt,
+ topShadowGC = XCreateGC (display->display, TermWin.vt,
GCForeground, &gcvalue);
gcvalue.foreground = PixColors[Color_bottomShadow];
- botShadowGC = XCreateGC(display->display, TermWin.vt,
+ botShadowGC = XCreateGC (display->display, TermWin.vt,
GCForeground, &gcvalue);
- gcvalue.foreground = PixColors[(XDEPTH <= 2 ? Color_fg
+ gcvalue.foreground = PixColors[ (XDEPTH <= 2 ? Color_fg
: Color_scroll)];
- scrollbarGC = XCreateGC(display->display, TermWin.vt,
+ scrollbarGC = XCreateGC (display->display, TermWin.vt,
GCForeground, &gcvalue);
#endif
}
int cfd, er;
/* get master (pty) */
- if ((cfd = rxvt_get_pty (&(tty_fd), &(ttydev))) < 0)
+ if ((cfd = rxvt_get_pty (& (tty_fd), & (ttydev))) < 0)
{
- rxvt_print_error("can't open pseudo-tty");
+ rxvt_print_error ("can't open pseudo-tty");
return -1;
}
if ((tty_fd = rxvt_get_tty (ttydev)) < 0)
{
- close(cfd);
- rxvt_print_error("can't open slave tty %s", ttydev);
+ close (cfd);
+ rxvt_print_error ("can't open slave tty %s", ttydev);
return -1;
}
}
#ifndef NO_BACKSPACE_KEY
if (key_backspace[0] && !key_backspace[1])
er = key_backspace[0];
- else if (STRCMP(key_backspace, "DEC") == 0)
+ else if (STRCMP (key_backspace, "DEC") == 0)
er = '\177'; /* the initial state anyway */
else
#endif
er = -1;
- rxvt_get_ttymode (&(tio), er);
+ rxvt_get_ttymode (& (tio), er);
#ifndef __QNX__
/* spin off the command interpreter */
switch (cmd_pid = fork ())
{
case -1:
- rxvt_print_error("can't fork");
+ rxvt_print_error ("can't fork");
return -1;
case 0:
close (cfd); /* only keep tty_fd and STDERR open */
close (tty_fd); /* keep STDERR_FILENO, cmd_fd, display->fd () open */
break;
}
-#else /* __QNX__ uses qnxspawn() */
+#else /* __QNX__ uses qnxspawn () */
fchmod (tty_fd, 0622);
fcntl (tty_fd, F_SETFD, FD_CLOEXEC);
fcntl (cfd, F_SETFD, FD_CLOEXEC);
{
char *login;
- SET_TTYMODE (STDIN_FILENO, &(tio)); /* init terminal attributes */
+ SET_TTYMODE (STDIN_FILENO, & (tio)); /* init terminal attributes */
if (Options & Opt_console)
{ /* be virtual console, fail silently */
int i;
for (i = 0; argv[i]; i++)
- fprintf(stderr, "argv [%d] = \"%s\"\n", i, argv[i]);
+ fprintf (stderr, "argv [%d] = \"%s\"\n", i, argv[i]);
# endif
- execvp(argv[0], (char *const *)argv);
+ execvp (argv[0], (char *const *)argv);
/* no error message: STDERR is closed! */
}
else
{
const char *argv0, *shell;
- if ((shell = getenv("SHELL")) == NULL || *shell == '\0')
+ if ((shell = getenv ("SHELL")) == NULL || *shell == '\0')
shell = "/bin/sh";
- argv0 = (const char *)rxvt_r_basename(shell);
+ argv0 = (const char *)rxvt_r_basename (shell);
if (Options & Opt_loginShell)
{
- login = (char *)rxvt_malloc((STRLEN(argv0) + 2) * sizeof(char));
+ login = (char *)rxvt_malloc ((STRLEN (argv0) + 2) * sizeof (char));
login[0] = '-';
- STRCPY(&login[1], argv0);
+ STRCPY (&login[1], argv0);
argv0 = login;
}
- execlp(shell, argv0, NULL);
+ execlp (shell, argv0, NULL);
/* no error message: STDERR is closed! */
}
-#else /* __QNX__ uses qnxspawn() */
+#else /* __QNX__ uses qnxspawn () */
char iov_a[10] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
char *command = NULL, fullcommand[_MAX_PATH];
if (argv != NULL)
{
- if (access(argv[0], X_OK) == -1)
+ if (access (argv[0], X_OK) == -1)
{
- if (STRCHR(argv[0], '/') == NULL)
+ if (STRCHR (argv[0], '/') == NULL)
{
- searchenv(argv[0], "PATH", fullcommand);
+ searchenv (argv[0], "PATH", fullcommand);
if (fullcommand[0] != '\0')
command = fullcommand;
}
- if (access(command, X_OK) == -1)
+ if (access (command, X_OK) == -1)
return -1;
}
else
}
else
{
- if ((command = getenv("SHELL")) == NULL || *command == '\0')
+ if ((command = getenv ("SHELL")) == NULL || *command == '\0')
command = "/bin/sh";
- arg_a[0] = my_basename(command);
+ arg_a[0] = my_basename (command);
if (Options & Opt_loginShell)
{
- login = rxvt_malloc((STRLEN(arg_a[0]) + 2) * sizeof(char));
+ login = rxvt_malloc ((STRLEN (arg_a[0]) + 2) * sizeof (char));
login[0] = '-';
- STRCPY(&login[1], arg_a[0]);
+ STRCPY (&login[1], arg_a[0]);
arg_a[0] = login;
}
arg_v = arg_a;
}
iov_a[0] = iov_a[1] = iov_a[2] = tty_fd;
- cmd_pid = qnx_spawn(0, 0, 0, -1, -1,
+ cmd_pid = qnx_spawn (0, 0, 0, -1, -1,
_SPAWN_SETSID | _SPAWN_TCSETPGRP,
command, arg_v, environ, iov_a, 0);
if (login)
- free(login);
+ free (login);
- close(tty_fd);
+ close (tty_fd);
return cmd_fd;
#endif
/* ------------------------------------------------------------------------- *
* GET TTY CURRENT STATE *
* ------------------------------------------------------------------------- */
-/* rxvt_get_ttymode() */
+/* rxvt_get_ttymode () */
/* EXTPROTO */
void
-rxvt_get_ttymode(ttymode_t *tio, int erase)
+rxvt_get_ttymode (ttymode_t *tio, int erase)
{
#ifdef HAVE_TERMIOS_H
/*
* standard System V termios interface
*/
- if (GET_TERMIOS(STDIN_FILENO, tio) < 0)
+ if (GET_TERMIOS (STDIN_FILENO, tio) < 0)
{
/* return error - use system defaults */
tio->c_cc[VINTR] = CINTR;
*/
/* get parameters -- gtty */
- if (ioctl(STDIN_FILENO, TIOCGETP, &(tio->sg)) < 0)
+ if (ioctl (STDIN_FILENO, TIOCGETP, & (tio->sg)) < 0)
{
tio->sg.sg_erase = CERASE; /* ^H */
tio->sg.sg_kill = CKILL; /* ^U */
tio->sg.sg_flags = (CRMOD | ECHO | EVENP | ODDP);
/* get special characters */
- if (ioctl(STDIN_FILENO, TIOCGETC, &(tio->tc)) < 0)
+ if (ioctl (STDIN_FILENO, TIOCGETC, & (tio->tc)) < 0)
{
tio->tc.t_intrc = CINTR; /* ^C */
tio->tc.t_quitc = CQUIT; /* ^\ */
tio->tc.t_brkc = -1;
}
/* get local special chars */
- if (ioctl(STDIN_FILENO, TIOCGLTC, &(tio->lc)) < 0)
+ if (ioctl (STDIN_FILENO, TIOCGLTC, & (tio->lc)) < 0)
{
tio->lc.t_suspc = CSUSP; /* ^Z */
tio->lc.t_dsuspc = CDSUSP; /* ^Y */
tio->lc.t_lnextc = CLNEXT; /* ^V */
}
/* get line discipline */
- ioctl(STDIN_FILENO, TIOCGETD, &(tio->line));
+ ioctl (STDIN_FILENO, TIOCGETD, & (tio->line));
# ifdef NTTYDISC
tio->line = NTTYDISC;
#ifdef DEBUG_TTYMODE
#ifdef HAVE_TERMIOS_H
/* c_iflag bits */
- fprintf(stderr, "Input flags\n");
+ fprintf (stderr, "Input flags\n");
/* cpp token stringize doesn't work on all machines <sigh> */
# define FOO(flag,name) \
fprintf (stderr, "%s ", name)
/* c_iflag bits */
- FOO(IGNBRK, "IGNBRK");
- FOO(BRKINT, "BRKINT");
- FOO(IGNPAR, "IGNPAR");
- FOO(PARMRK, "PARMRK");
- FOO(INPCK, "INPCK");
- FOO(ISTRIP, "ISTRIP");
- FOO(INLCR, "INLCR");
- FOO(IGNCR, "IGNCR");
- FOO(ICRNL, "ICRNL");
- FOO(IXON, "IXON");
- FOO(IXOFF, "IXOFF");
+ FOO (IGNBRK, "IGNBRK");
+ FOO (BRKINT, "BRKINT");
+ FOO (IGNPAR, "IGNPAR");
+ FOO (PARMRK, "PARMRK");
+ FOO (INPCK, "INPCK");
+ FOO (ISTRIP, "ISTRIP");
+ FOO (INLCR, "INLCR");
+ FOO (IGNCR, "IGNCR");
+ FOO (ICRNL, "ICRNL");
+ FOO (IXON, "IXON");
+ FOO (IXOFF, "IXOFF");
# ifdef IUCLC
- FOO(IUCLC, "IUCLC");
+ FOO (IUCLC, "IUCLC");
# endif
# ifdef IXANY
- FOO(IXANY, "IXANY");
+ FOO (IXANY, "IXANY");
# endif
# ifdef IMAXBEL
- FOO(IMAXBEL, "IMAXBEL");
+ FOO (IMAXBEL, "IMAXBEL");
# endif
- fprintf(stderr, "\n");
+ fprintf (stderr, "\n");
# undef FOO
# define FOO(entry, name) \
- fprintf(stderr, "%-8s = %#04o\n", name, tio->c_cc [entry])
-
- FOO(VINTR, "VINTR");
- FOO(VQUIT, "VQUIT");
- FOO(VERASE, "VERASE");
- FOO(VKILL, "VKILL");
- FOO(VEOF, "VEOF");
- FOO(VEOL, "VEOL");
+ fprintf (stderr, "%-8s = %#04o\n", name, tio->c_cc [entry])
+
+ FOO (VINTR, "VINTR");
+ FOO (VQUIT, "VQUIT");
+ FOO (VERASE, "VERASE");
+ FOO (VKILL, "VKILL");
+ FOO (VEOF, "VEOF");
+ FOO (VEOL, "VEOL");
# ifdef VEOL2
- FOO(VEOL2, "VEOL2");
+ FOO (VEOL2, "VEOL2");
# endif
# ifdef VSWTC
- FOO(VSWTC, "VSWTC");
+ FOO (VSWTC, "VSWTC");
# endif
# ifdef VSWTCH
- FOO(VSWTCH, "VSWTCH");
+ FOO (VSWTCH, "VSWTCH");
# endif
- FOO(VSTART, "VSTART");
- FOO(VSTOP, "VSTOP");
- FOO(VSUSP, "VSUSP");
+ FOO (VSTART, "VSTART");
+ FOO (VSTOP, "VSTOP");
+ FOO (VSUSP, "VSUSP");
# ifdef VDSUSP
- FOO(VDSUSP, "VDSUSP");
+ FOO (VDSUSP, "VDSUSP");
# endif
# ifdef VREPRINT
- FOO(VREPRINT, "VREPRINT");
+ FOO (VREPRINT, "VREPRINT");
# endif
# ifdef VDISCRD
- FOO(VDISCRD, "VDISCRD");
+ FOO (VDISCRD, "VDISCRD");
# endif
# ifdef VWERSE
- FOO(VWERSE, "VWERSE");
+ FOO (VWERSE, "VWERSE");
# endif
# ifdef VLNEXT
- FOO(VLNEXT, "VLNEXT");
+ FOO (VLNEXT, "VLNEXT");
# endif
- fprintf(stderr, "\n");
+ fprintf (stderr, "\n");
# undef FOO
# endif /* HAVE_TERMIOS_H */
#endif /* DEBUG_TTYMODE */
# define SET_TTYMODE(fd,tt) \
tt->sg.sg_ispeed = tt->sg.sg_ospeed = BAUDRATE, \
- ioctl (fd, TIOCSETP, &(tt->sg)), \
- ioctl (fd, TIOCSETC, &(tt->tc)), \
- ioctl (fd, TIOCSLTC, &(tt->lc)), \
- ioctl (fd, TIOCSETD, &(tt->line)), \
- ioctl (fd, TIOCLSET, &(tt->local))
+ ioctl (fd, TIOCSETP, & (tt->sg)), \
+ ioctl (fd, TIOCSETC, & (tt->tc)), \
+ ioctl (fd, TIOCSLTC, & (tt->lc)), \
+ ioctl (fd, TIOCSETD, & (tt->line)), \
+ ioctl (fd, TIOCLSET, & (tt->local))
#endif /* HAVE_TERMIOS_H */
/* use the fastest baud-rate */
#include <sys/time.h>
-#if 1 // older unices need these includes for select(2)
+#if 1 // older unices need these includes for select (2)
# include <unistd.h>
# include <sys/types.h>
#endif
abort ();
}
- tw0()
+ tw0 ()
: time_watcher (this, &tw0::cb)
{ }}
tw0;
{
double diff = next->at - NOW;
tval.tv_sec = (int)diff;
- tval.tv_usec = (int)((diff - tval.tv_sec) * 1000000);
+ tval.tv_usec = (int) ((diff - tval.tv_sec) * 1000000);
to = &tval;
}
break;
struct watcher {
int active; /* 0 == inactive, else index into respective vector */
- watcher() : active(0) { }
+ watcher () : active (0) { }
};
#if IOM_IO
void stop () { iom.unreg (this); }
template<class O1, class O2>
- io_watcher (O1 *object, void (O2::*method)(io_watcher &, short))
- : callback2<void, io_watcher &, short>(object,method)
+ io_watcher (O1 *object, void (O2::*method) (io_watcher &, short))
+ : callback2<void, io_watcher &, short> (object,method)
{ }
~io_watcher () { stop (); }
};
void trigger ();
void set (tstamp when) { at = when; }
- void operator ()() { trigger (); }
+ void operator () () { trigger (); }
void start () { iom.reg (this); }
void start (tstamp when) { set (when); iom.reg (this); }
void stop () { iom.unreg (this); }
template<class O1, class O2>
- time_watcher (O1 *object, void (O2::*method)(time_watcher &))
- : callback1<void, time_watcher &>(object,method), at(0)
+ time_watcher (O1 *object, void (O2::*method) (time_watcher &))
+ : callback1<void, time_watcher &> (object,method), at (0)
{ }
~time_watcher () { stop (); }
};
void stop () { iom.unreg (this); }
template<class O1, class O2>
- check_watcher (O1 *object, void (O2::*method)(check_watcher &))
- : callback1<void, check_watcher &>(object,method)
+ check_watcher (O1 *object, void (O2::*method) (check_watcher &))
+ : callback1<void, check_watcher &> (object,method)
{ }
~check_watcher () { stop (); }
};
void stop () { iom.unreg (this); }
template<class O1, class O2>
- idle_watcher (O1 *object, void (O2::*method)(idle_watcher &))
- : callback1<void, idle_watcher &>(object,method)
+ idle_watcher (O1 *object, void (O2::*method) (idle_watcher &))
+ : callback1<void, idle_watcher &> (object,method)
{ }
~idle_watcher () { stop (); }
};
rxvt_term::makeutent (const char *pty, const char *hostname)
{
#ifdef HAVE_STRUCT_UTMP
- struct utmp *ut = &(this->ut);
+ struct utmp *ut = & (this->ut);
#endif
#ifdef HAVE_STRUCT_UTMPX
- struct utmpx *utx = &(this->utx);
+ struct utmpx *utx = & (this->utx);
#endif
#ifdef HAVE_UTMP_PID
int i;
#endif
char ut_id[5];
- struct passwd *pwent = getpwuid(getuid());
+ struct passwd *pwent = getpwuid (getuid ());
- if (!STRNCMP(pty, "/dev/", 5))
+ if (!STRNCMP (pty, "/dev/", 5))
pty += 5; /* skip /dev/ prefix */
- if (!STRNCMP(pty, "pty", 3) || !STRNCMP(pty, "tty", 3))
+ if (!STRNCMP (pty, "pty", 3) || !STRNCMP (pty, "tty", 3))
{
- STRNCPY(ut_id, (pty + 3), sizeof(ut_id));
+ STRNCPY (ut_id, (pty + 3), sizeof (ut_id));
}
#ifdef HAVE_UTMP_PID
- else if (sscanf(pty, "pts/%d", &i) == 1)
- sprintf(ut_id, "vt%02x", (i & 0xff)); /* sysv naming */
+ else if (sscanf (pty, "pts/%d", &i) == 1)
+ sprintf (ut_id, "vt%02x", (i & 0xff)); /* sysv naming */
#endif
- else if (STRNCMP(pty, "pty", 3) && STRNCMP(pty, "tty", 3))
+ else if (STRNCMP (pty, "pty", 3) && STRNCMP (pty, "tty", 3))
{
- rxvt_print_error("can't parse tty name \"%s\"", pty);
+ rxvt_print_error ("can't parse tty name \"%s\"", pty);
return;
}
#ifdef HAVE_STRUCT_UTMP
- MEMSET(ut, 0, sizeof(struct utmp));
+ MEMSET (ut, 0, sizeof (struct utmp));
# ifdef HAVE_UTMP_PID
- setutent();
- STRNCPY(ut->ut_id, ut_id, sizeof(ut->ut_id));
+ setutent ();
+ STRNCPY (ut->ut_id, ut_id, sizeof (ut->ut_id));
ut->ut_type = DEAD_PROCESS;
- getutid(ut); /* position to entry in utmp file */
- STRNCPY(ut_id, ut_id, sizeof(ut_id));
+ getutid (ut); /* position to entry in utmp file */
+ STRNCPY (ut_id, ut_id, sizeof (ut_id));
# endif
#endif
#ifdef HAVE_STRUCT_UTMPX
- MEMSET(utx, 0, sizeof(struct utmpx));
- setutxent();
- STRNCPY(utx->ut_id, ut_id, sizeof(utx->ut_id));
+ MEMSET (utx, 0, sizeof (struct utmpx));
+ setutxent ();
+ STRNCPY (utx->ut_id, ut_id, sizeof (utx->ut_id));
utx->ut_type = DEAD_PROCESS;
- getutxid(utx); /* position to entry in utmp file */
- STRNCPY(ut_id, ut_id, sizeof(ut_id));
+ getutxid (utx); /* position to entry in utmp file */
+ STRNCPY (ut_id, ut_id, sizeof (ut_id));
#endif
#ifdef HAVE_STRUCT_UTMP
- STRNCPY(ut->ut_line, pty, sizeof(ut->ut_line));
- ut->ut_time = time(NULL);
+ STRNCPY (ut->ut_line, pty, sizeof (ut->ut_line));
+ ut->ut_time = time (NULL);
# ifdef HAVE_UTMP_PID
- STRNCPY(ut->ut_user, (pwent && pwent->pw_name) ? pwent->pw_name : "?",
- sizeof(ut->ut_user));
- STRNCPY(ut->ut_id, ut_id, sizeof(ut->ut_id));
- ut->ut_time = time(NULL);
+ STRNCPY (ut->ut_user, (pwent && pwent->pw_name) ? pwent->pw_name : "?",
+ sizeof (ut->ut_user));
+ STRNCPY (ut->ut_id, ut_id, sizeof (ut->ut_id));
+ ut->ut_time = time (NULL);
ut->ut_pid = cmd_pid;
# ifdef HAVE_UTMP_HOST
- STRNCPY(ut->ut_host, hostname, sizeof(ut->ut_host));
+ STRNCPY (ut->ut_host, hostname, sizeof (ut->ut_host));
# endif
ut->ut_type = USER_PROCESS;
- pututline(ut);
- endutent(); /* close the file */
+ pututline (ut);
+ endutent (); /* close the file */
utmp_pos = 0;
# else
- STRNCPY(ut->ut_name, (pwent && pwent->pw_name) ? pwent->pw_name : "?",
- sizeof(ut->ut_name));
+ STRNCPY (ut->ut_name, (pwent && pwent->pw_name) ? pwent->pw_name : "?",
+ sizeof (ut->ut_name));
# ifdef HAVE_UTMP_HOST
- STRNCPY(ut->ut_host, hostname, sizeof(ut->ut_host));
+ STRNCPY (ut->ut_host, hostname, sizeof (ut->ut_host));
# endif
# endif
#endif
#ifdef HAVE_STRUCT_UTMPX
- STRNCPY(utx->ut_line, pty, sizeof(utx->ut_line));
- STRNCPY(utx->ut_user, (pwent && pwent->pw_name) ? pwent->pw_name : "?",
- sizeof(utx->ut_user));
- STRNCPY(utx->ut_id, ut_id, sizeof(utx->ut_id));
- utx->ut_session = getsid(0);
- utx->ut_tv.tv_sec = time(NULL);
+ STRNCPY (utx->ut_line, pty, sizeof (utx->ut_line));
+ STRNCPY (utx->ut_user, (pwent && pwent->pw_name) ? pwent->pw_name : "?",
+ sizeof (utx->ut_user));
+ STRNCPY (utx->ut_id, ut_id, sizeof (utx->ut_id));
+ utx->ut_session = getsid (0);
+ utx->ut_tv.tv_sec = time (NULL);
utx->ut_tv.tv_usec = 0;
utx->ut_pid = cmd_pid;
# ifdef HAVE_UTMPX_HOST
- STRNCPY(utx->ut_host, hostname, sizeof(utx->ut_host));
+ STRNCPY (utx->ut_host, hostname, sizeof (utx->ut_host));
# if 0
{
char *colon;
- if ((colon = STRRCHR(ut->ut_host, ':')) != NULL)
+ if ((colon = STRRCHR (ut->ut_host, ':')) != NULL)
*colon = '\0';
}
# endif
# endif
utx->ut_type = USER_PROCESS;
- pututxline(utx);
- endutxent(); /* close the file */
+ pututxline (utx);
+ endutxent (); /* close the file */
utmp_pos = 0;
#endif
{
int i;
# ifdef HAVE_TTYSLOT
- i = ttyslot();
- if (rxvt_write_bsd_utmp(i, ut))
+ i = ttyslot ();
+ if (rxvt_write_bsd_utmp (i, ut))
utmp_pos = i;
# else
FILE *fd0;
- if ((fd0 = fopen(TTYTAB_FILENAME, "r")) != NULL)
+ if ((fd0 = fopen (TTYTAB_FILENAME, "r")) != NULL)
{
char buf[256], name[256];
- buf[sizeof(buf) - 1] = '\0';
- for (i = 1; (fgets(buf, sizeof(buf) - 1, fd0) != NULL);)
+ buf[sizeof (buf) - 1] = '\0';
+ for (i = 1; (fgets (buf, sizeof (buf) - 1, fd0) != NULL);)
{
- if (*buf == '#' || sscanf(buf, "%s", name) != 1)
+ if (*buf == '#' || sscanf (buf, "%s", name) != 1)
continue;
- if (!STRCMP(ut->ut_line, name))
+ if (!STRCMP (ut->ut_line, name))
{
- if (!rxvt_write_bsd_utmp(i, ut))
+ if (!rxvt_write_bsd_utmp (i, ut))
i = 0;
utmp_pos = i;
- fclose(fd0);
+ fclose (fd0);
break;
}
i++;
}
- fclose(fd0);
+ fclose (fd0);
}
# endif
{
# ifdef HAVE_STRUCT_UTMP
# ifdef HAVE_UPDWTMP
- updwtmp(RXVT_WTMP_FILE, ut);
+ updwtmp (RXVT_WTMP_FILE, ut);
# else
- rxvt_update_wtmp(RXVT_WTMP_FILE, ut);
+ rxvt_update_wtmp (RXVT_WTMP_FILE, ut);
# endif
# endif
# ifdef HAVE_STRUCT_UTMPX
- updwtmpx(RXVT_WTMPX_FILE, utx);
+ updwtmpx (RXVT_WTMPX_FILE, utx);
# endif
}
#endif
#if defined(LASTLOG_SUPPORT) && defined(RXVT_LASTLOG_FILE)
if (Options & Opt_loginShell)
- rxvt_update_lastlog(RXVT_LASTLOG_FILE, pty, hostname);
+ rxvt_update_lastlog (RXVT_LASTLOG_FILE, pty, hostname);
#endif
}
rxvt_term::cleanutent ()
{
#ifdef HAVE_STRUCT_UTMP
- struct utmp *ut = &(this->ut);
+ struct utmp *ut = & (this->ut);
#endif
#ifdef HAVE_STRUCT_UTMPX
- struct utmpx *tmputx, *utx = &(this->utx);
+ struct utmpx *tmputx, *utx = & (this->utx);
#endif
#ifdef HAVE_STRUCT_UTMP
# ifdef HAVE_UTMP_PID
- MEMSET(ut, 0, sizeof(struct utmp));
- setutent();
- STRNCPY(ut->ut_id, ut_id, sizeof(ut->ut_id));
+ MEMSET (ut, 0, sizeof (struct utmp));
+ setutent ();
+ STRNCPY (ut->ut_id, ut_id, sizeof (ut->ut_id));
ut->ut_type = USER_PROCESS;
{
- struct utmp *tmput = getutid(ut);
+ struct utmp *tmput = getutid (ut);
if (tmput) /* position to entry in utmp file */
ut = tmput;
}
ut->ut_type = DEAD_PROCESS;
# else
- MEMSET(ut->ut_name, 0, sizeof(ut->ut_name));
+ MEMSET (ut->ut_name, 0, sizeof (ut->ut_name));
# ifdef HAVE_UTMP_HOST
- MEMSET(ut->ut_host, 0, sizeof(ut->ut_host));
+ MEMSET (ut->ut_host, 0, sizeof (ut->ut_host));
# endif
# endif
- ut->ut_time = time(NULL);
+ ut->ut_time = time (NULL);
#endif
#ifdef HAVE_STRUCT_UTMPX
- MEMSET(utx, 0, sizeof(struct utmpx));
- setutxent();
- STRNCPY(utx->ut_id, ut_id, sizeof(utx->ut_id));
+ MEMSET (utx, 0, sizeof (struct utmpx));
+ setutxent ();
+ STRNCPY (utx->ut_id, ut_id, sizeof (utx->ut_id));
utx->ut_type = USER_PROCESS;
- if ((tmputx = getutxid(utx))) /* position to entry in utmp file */
+ if ((tmputx = getutxid (utx))) /* position to entry in utmp file */
utx = tmputx;
utx->ut_type = DEAD_PROCESS;
- utx->ut_session = getsid(0);
- utx->ut_tv.tv_sec = time(NULL);
+ utx->ut_session = getsid (0);
+ utx->ut_tv.tv_sec = time (NULL);
utx->ut_tv.tv_usec = 0;
#endif
{
# ifdef HAVE_STRUCT_UTMP
# ifdef HAVE_UPDWTMP
- updwtmp(RXVT_WTMP_FILE, ut);
+ updwtmp (RXVT_WTMP_FILE, ut);
# else
- rxvt_update_wtmp(RXVT_WTMP_FILE, ut);
+ rxvt_update_wtmp (RXVT_WTMP_FILE, ut);
# endif
# endif
# ifdef HAVE_STRUCT_UTMPX
- updwtmpx(RXVT_WTMPX_FILE, utx);
+ updwtmpx (RXVT_WTMPX_FILE, utx);
# endif
}
#endif
#ifdef HAVE_STRUCT_UTMP
# ifdef HAVE_UTMP_PID
if (ut->ut_pid == cmd_pid)
- pututline(ut);
- endutent();
+ pututline (ut);
+ endutent ();
# else
- MEMSET(ut, 0, sizeof(struct utmp));
- rxvt_write_bsd_utmp(utmp_pos, ut);
+ MEMSET (ut, 0, sizeof (struct utmp));
+ rxvt_write_bsd_utmp (utmp_pos, ut);
# endif
#endif
#ifdef HAVE_STRUCT_UTMPX
if (utx->ut_pid == cmd_pid)
- pututxline(utx);
- endutxent();
+ pututxline (utx);
+ endutxent ();
#endif
}
#ifdef HAVE_UTMP_H
/* INTPROTO */
int
-rxvt_write_bsd_utmp(int utmp_pos, struct utmp *wu)
+rxvt_write_bsd_utmp (int utmp_pos, struct utmp *wu)
{
int fd;
- if (utmp_pos <= 0 || (fd = open(RXVT_UTMP_FILE, O_WRONLY)) == -1)
+ if (utmp_pos <= 0 || (fd = open (RXVT_UTMP_FILE, O_WRONLY)) == -1)
return 0;
- if (lseek(fd, (off_t) (utmp_pos * sizeof(struct utmp)), SEEK_SET) != -1)
- write(fd, wu, sizeof(struct utmp));
- close(fd);
+ if (lseek (fd, (off_t) (utmp_pos * sizeof (struct utmp)), SEEK_SET) != -1)
+ write (fd, wu, sizeof (struct utmp));
+ close (fd);
return 1;
}
#endif
#if defined(WTMP_SUPPORT) && !defined(HAVE_UPDWTMP)
/* INTPROTO */
void
-rxvt_update_wtmp(const char *fname, const struct utmp *putmp)
+rxvt_update_wtmp (const char *fname, const struct utmp *putmp)
{
int fd, gotlock, retry;
struct flock lck; /* fcntl locking scheme */
struct stat sbuf;
- if ((fd = open(fname, O_WRONLY | O_APPEND, 0)) < 0)
+ if ((fd = open (fname, O_WRONLY | O_APPEND, 0)) < 0)
return;
lck.l_whence = SEEK_END; /* start lock at current eof */
/* attempt lock with F_SETLK; F_SETLKW would cause a deadlock! */
for (retry = 10, gotlock = 0; retry--;)
- if (fcntl(fd, F_SETLK, &lck) != -1)
+ if (fcntl (fd, F_SETLK, &lck) != -1)
{
gotlock = 1;
break;
break;
if (!gotlock)
{ /* give it up */
- close(fd);
+ close (fd);
return;
}
- if (fstat(fd, &sbuf) == 0)
- if (write(fd, putmp, sizeof(struct utmp)) != sizeof(struct utmp))
- ftruncate(fd, sbuf.st_size); /* remove bad writes */
+ if (fstat (fd, &sbuf) == 0)
+ if (write (fd, putmp, sizeof (struct utmp)) != sizeof (struct utmp))
+ ftruncate (fd, sbuf.st_size); /* remove bad writes */
lck.l_type = F_UNLCK; /* unlocking the file */
- fcntl(fd, F_SETLK, &lck);
- close(fd);
+ fcntl (fd, F_SETLK, &lck);
+ close (fd);
}
#endif
#ifdef LASTLOG_SUPPORT
/* INTPROTO */
void
-rxvt_update_lastlog(const char *fname, const char *pty, const char *host)
+rxvt_update_lastlog (const char *fname, const char *pty, const char *host)
{
# ifdef HAVE_STRUCT_LASTLOGX
struct lastlogx llx;
# endif
# ifdef HAVE_STRUCT_LASTLOGX
- MEMSET(&llx, 0, sizeof(llx));
- llx.ll_tv.tv_sec = time(NULL);
+ MEMSET (&llx, 0, sizeof (llx));
+ llx.ll_tv.tv_sec = time (NULL);
llx.ll_tv.tv_usec = 0;
- STRNCPY(llx.ll_line, pty, sizeof(llx.ll_line));
- STRNCPY(llx.ll_host, host, sizeof(llx.ll_host));
- updlastlogx(RXVT_LASTLOGX_FILE, getuid(), &llx);
+ STRNCPY (llx.ll_line, pty, sizeof (llx.ll_line));
+ STRNCPY (llx.ll_host, host, sizeof (llx.ll_host));
+ updlastlogx (RXVT_LASTLOGX_FILE, getuid (), &llx);
# endif
# ifdef HAVE_STRUCT_LASTLOG
- pwent = getpwuid(getuid());
+ pwent = getpwuid (getuid ());
if (!pwent)
{
- rxvt_print_error("no entry in password file");
+ rxvt_print_error ("no entry in password file");
return;
}
- MEMSET(&ll, 0, sizeof(ll));
- ll.ll_time = time(NULL);
- STRNCPY(ll.ll_line, pty, sizeof(ll.ll_line));
- STRNCPY(ll.ll_host, host, sizeof(ll.ll_host));
+ MEMSET (&ll, 0, sizeof (ll));
+ ll.ll_time = time (NULL);
+ STRNCPY (ll.ll_line, pty, sizeof (ll.ll_line));
+ STRNCPY (ll.ll_host, host, sizeof (ll.ll_host));
# ifdef LASTLOG_IS_DIR
- sprintf(lastlogfile, "%.*s/%.*s",
- sizeof(lastlogfile) - sizeof(pwent->pw_name) - 2, fname,
- sizeof(pwent->pw_name),
+ sprintf (lastlogfile, "%.*s/%.*s",
+ sizeof (lastlogfile) - sizeof (pwent->pw_name) - 2, fname,
+ sizeof (pwent->pw_name),
(!pwent->pw_name || pwent->pw_name[0] == '\0') ? "unknown"
: pwent->pw_name);
- if ((fd = open(lastlogfile, O_WRONLY | O_CREAT, 0644)) >= 0)
+ if ((fd = open (lastlogfile, O_WRONLY | O_CREAT, 0644)) >= 0)
{
- write(fd, &ll, sizeof(ll));
- close(fd);
+ write (fd, &ll, sizeof (ll));
+ close (fd);
}
# else
- if ((fd = open(fname, O_RDWR)) != -1)
+ if ((fd = open (fname, O_RDWR)) != -1)
{
- if (lseek(fd, (off_t) ((long)pwent->pw_uid * sizeof(ll)),
+ if (lseek (fd, (off_t) ((long)pwent->pw_uid * sizeof (ll)),
SEEK_SET) != -1)
- write(fd, &ll, sizeof(ll));
- close(fd);
+ write (fd, &ll, sizeof (ll));
+ close (fd);
}
# endif /* LASTLOG_IS_DIR */
# endif /* HAVE_STRUCT_LASTLOG */
}
/*----------------------------------------------------------------------*/
-/* rxvt_init() */
+/* rxvt_init () */
/* LIBPROTO */
rxvt_t
rxvt_init (int argc, const char *const *argv)
return GET_R;
}
-static int (*old_xerror_handler)(Display *dpy, XErrorEvent *event);
+static int (*old_xerror_handler) (Display *dpy, XErrorEvent *event);
void
rxvt_init_signals ()
/* install exit handler for cleanup */
#if 0
#ifdef HAVE_ATEXIT
- atexit(rxvt_clean_exit);
+ atexit (rxvt_clean_exit);
#else
#endif
#endif
#if 0
#ifdef DEBUG_X
- XSynchronize(display->display, True);
+ XSynchronize (display->display, True);
#endif
#endif
resize_scrollbar (); /* create and map scrollbar */
#endif
#if (MENUBAR_MAX)
- if (menubar_visible(r))
+ if (menubar_visible (r))
XMapWindow (display->display, menuBar.win);
#endif
#ifdef TRANSPARENT
/* ARGSUSED */
/* EXTPROTO */
RETSIGTYPE
-rxvt_Child_signal(int sig __attribute__ ((unused)))
+rxvt_Child_signal (int sig __attribute__ ((unused)))
{
int pid, save_errno = errno;
while ((pid = waitpid (-1, NULL, WNOHANG)) == -1 && errno == EINTR)
*/
/* EXTPROTO */
RETSIGTYPE
-rxvt_Exit_signal(int sig)
+rxvt_Exit_signal (int sig)
{
signal (sig, SIG_DFL);
#ifdef DEBUG_CMD
rxvt_print_error ("signal %d", sig);
#endif
- rxvt_clean_exit();
+ rxvt_clean_exit ();
kill (getpid (), sig);
}
* ------------------------------------------------------------------------- */
/* EXTPROTO */
void *
-rxvt_malloc(size_t size)
+rxvt_malloc (size_t size)
{
void *p;
- p = malloc(size);
+ p = malloc (size);
if (p)
return p;
- fprintf(stderr, APL_NAME ": memory allocation failure. Aborting");
- rxvt_clean_exit();
- exit(EXIT_FAILURE);
+ fprintf (stderr, APL_NAME ": memory allocation failure. Aborting");
+ rxvt_clean_exit ();
+ exit (EXIT_FAILURE);
/* NOTREACHED */
}
/* EXTPROTO */
void *
-rxvt_calloc(size_t number, size_t size)
+rxvt_calloc (size_t number, size_t size)
{
void *p;
- p = calloc(number, size);
+ p = calloc (number, size);
if (p)
return p;
- fprintf(stderr, APL_NAME ": memory allocation failure. Aborting");
- rxvt_clean_exit();
- exit(EXIT_FAILURE);
+ fprintf (stderr, APL_NAME ": memory allocation failure. Aborting");
+ rxvt_clean_exit ();
+ exit (EXIT_FAILURE);
/* NOTREACHED */
}
/* EXTPROTO */
void *
-rxvt_realloc(void *ptr, size_t size)
+rxvt_realloc (void *ptr, size_t size)
{
void *p;
if (ptr)
- p = realloc(ptr, size);
+ p = realloc (ptr, size);
else
- p = malloc(size);
+ p = malloc (size);
if (p)
return p;
- fprintf(stderr, APL_NAME ": memory allocation failure. Aborting");
- rxvt_clean_exit();
- exit(EXIT_FAILURE);
+ fprintf (stderr, APL_NAME ": memory allocation failure. Aborting");
+ rxvt_clean_exit ();
+ exit (EXIT_FAILURE);
/* NOTREACHED */
}
{
#if ! defined(__CYGWIN32__)
# if !defined(HAVE_SETEUID) && defined(HAVE_SETREUID)
- /* setreuid() is the poor man's setuid(), seteuid() */
+ /* setreuid () is the poor man's setuid (), seteuid () */
# define seteuid(a) setreuid(-1, (a))
# define setegid(a) setregid(-1, (a))
# define HAVE_SETEUID
* change effective uid/gid - not real uid/gid - so we can switch
* back to root later, as required
*/
- seteuid(getuid());
- setegid(getgid());
+ seteuid (getuid ());
+ setegid (getgid ());
break;
case SAVE:
- euid = geteuid();
- egid = getegid();
+ euid = geteuid ();
+ egid = getegid ();
break;
case RESTORE:
- seteuid(euid);
- setegid(egid);
+ seteuid (euid);
+ setegid (egid);
break;
}
# else
switch (mode)
{
case IGNORE:
- setuid(getuid());
- setgid(getgid());
+ setuid (getuid ());
+ setgid (getgid ());
/* FALLTHROUGH */
case SAVE:
/* FALLTHROUGH */
void
rxvt_term::privileged_utmp (char action)
{
- D_MAIN((stderr, "rxvt_privileged_utmp(%c); waiting for: %c (pid: %d)",
- action, next_utmp_action, getpid()));
+ D_MAIN ((stderr, "rxvt_privileged_utmp (%c); waiting for: %c (pid: %d)",
+ action, next_utmp_action, getpid ()));
if (next_utmp_action != action || (action != SAVE && action != RESTORE)
|| (Options & Opt_utmpInhibit)
|| ttydev == NULL || *ttydev == '\0')
void
rxvt_term::privileged_ttydev (char action)
{
- D_MAIN((stderr,
+ D_MAIN ((stderr,
"privileged_ttydev (%c); waiting for: %c (pid: %d)",
- action, next_tty_action, getpid()));
+ action, next_tty_action, getpid ()));
if (next_tty_action != action || (action != SAVE && action != RESTORE)
|| ttydev == NULL || *ttydev == '\0')
return;
{
next_tty_action = RESTORE;
# ifndef RESET_TTY_TO_COMMON_DEFAULTS
- /* store original tty status for restoration rxvt_clean_exit() -- rgg 04/12/95 */
- if (lstat(ttydev, &ttyfd_stat) < 0) /* you lose out */
+ /* store original tty status for restoration rxvt_clean_exit () -- rgg 04/12/95 */
+ if (lstat (ttydev, &ttyfd_stat) < 0) /* you lose out */
next_tty_action = IGNORE;
else
# endif
{
- chown(ttydev, getuid(), ttygid); /* fail silently */
- chmod(ttydev, ttymode);
+ chown (ttydev, getuid (), ttygid); /* fail silently */
+ chmod (ttydev, ttymode);
# ifdef HAVE_REVOKE
- revoke(ttydev);
+ revoke (ttydev);
# endif
}
{ /* action == RESTORE */
next_tty_action = IGNORE;
# ifndef RESET_TTY_TO_COMMON_DEFAULTS
- chmod(ttydev, ttyfd_stat.st_mode);
- chown(ttydev, ttyfd_stat.st_uid, ttyfd_stat.st_gid);
+ chmod (ttydev, ttyfd_stat.st_mode);
+ chown (ttydev, ttyfd_stat.st_uid, ttyfd_stat.st_gid);
# else
- chmod(ttydev,
+ chmod (ttydev,
(S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH));
- chown(ttydev, 0, 0);
+ chown (ttydev, 0, 0);
# endif
}
privileges (IGNORE);
# ifndef RESET_TTY_TO_COMMON_DEFAULTS
- D_MAIN((stderr, "%s \"%s\": mode %03o, uid %d, gid %d",
+ D_MAIN ((stderr, "%s \"%s\": mode %03o, uid %d, gid %d",
action == RESTORE ? "Restoring" : (action ==
SAVE ? "Saving" :
"UNKNOWN ERROR for"), ttydev,
unsigned int w, h;
unsigned int max_width, max_height;
- D_SIZE((stderr, "< Cols/Rows: %3d x %3d ; Width/Height: %4d x %4d",
+ D_SIZE ((stderr, "< Cols/Rows: %3d x %3d ; Width/Height: %4d x %4d",
TermWin.ncol, TermWin.nrow, szHint.width,
szHint.height));
szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity;
{
parsed_geometry = 1;
if (rs[Rs_geometry])
- flags = XParseGeometry(rs[Rs_geometry], &x, &y, &w, &h);
+ flags = XParseGeometry (rs[Rs_geometry], &x, &y, &w, &h);
if (flags & WidthValue)
{
- TermWin.ncol = BOUND_POSITIVE_INT16(w);
+ TermWin.ncol = BOUND_POSITIVE_INT16 (w);
szHint.flags |= USSize;
}
if (flags & HeightValue)
{
- TermWin.nrow = BOUND_POSITIVE_INT16(h);
+ TermWin.nrow = BOUND_POSITIVE_INT16 (h);
szHint.flags |= USSize;
}
if (flags & XValue)
window_vt_x = window_vt_y = 0;
if (scrollbar_visible ())
{
- sb_w = scrollbar_TotalWidth();
+ sb_w = scrollbar_TotalWidth ();
szHint.base_width += sb_w;
- if (!(Options & Opt_scrollBar_right))
+ if (! (Options & Opt_scrollBar_right))
window_vt_x = sb_w;
}
if (menubar_visible ())
{
- mb_h = menuBar_TotalHeight();
+ mb_h = menuBar_TotalHeight ();
szHint.base_height += mb_h;
window_vt_y = mb_h;
}
}
else
{
- MIN_IT(TermWin.width, max_width);
+ MIN_IT (TermWin.width, max_width);
szHint.width = szHint.base_width + TermWin.width;
}
if (height && height - szHint.base_height < max_height)
}
else
{
- MIN_IT(TermWin.height, max_height);
+ MIN_IT (TermWin.height, max_height);
szHint.height = szHint.base_height + TermWin.height;
}
if (scrollbar_visible () && (Options & Opt_scrollBar_right))
TermWin.ncol = TermWin.width / TermWin.fwidth;
TermWin.nrow = TermWin.height / TermWin.fheight;
- D_SIZE((stderr, "> Cols/Rows: %3d x %3d ; Width/Height: %4d x %4d",
+ D_SIZE ((stderr, "> Cols/Rows: %3d x %3d ; Width/Height: %4d x %4d",
TermWin.ncol, TermWin.nrow, szHint.width,
szHint.height));
return;
(void)ioctl (cmd_fd, TIOCSWINSZ, &ws);
#else
if (ioctl (cmd_fd, TIOCSWINSZ, &ws) < 0)
- D_SIZE((stderr, "Failed to send TIOCSWINSZ to fd %d", fd));
+ D_SIZE ((stderr, "Failed to send TIOCSWINSZ to fd %d", fd));
# ifdef SIGWINCH
else if (cmd_pid) /* force through to the command */
kill (cmd_pid, SIGWINCH);
}
/*----------------------------------------------------------------------*/
-/* rxvt_change_font() - Switch to a new font */
+/* rxvt_change_font () - Switch to a new font */
/*
* init = 1 - initialize
*
rxvt_term::set_title (const char *str)
{
#ifndef SMART_WINDOW_TITLE
- XStoreName(display->display, TermWin.parent[0], str);
+ XStoreName (display->display, TermWin.parent[0], str);
#else
char *name;
- if (XFetchName(display->display, TermWin.parent[0], &name) == 0)
+ if (XFetchName (display->display, TermWin.parent[0], &name) == 0)
name = NULL;
- if (name == NULL || STRCMP(name, str))
- XStoreName(display->display, TermWin.parent[0], str);
+ if (name == NULL || STRCMP (name, str))
+ XStoreName (display->display, TermWin.parent[0], str);
if (name)
- XFree(name);
+ XFree (name);
#endif
}
rxvt_term::set_iconName (const char *str)
{
#ifndef SMART_WINDOW_TITLE
- XSetIconName(display->display, TermWin.parent[0], str);
+ XSetIconName (display->display, TermWin.parent[0], str);
#else
char *name;
- if (XGetIconName(display->display, TermWin.parent[0], &name))
+ if (XGetIconName (display->display, TermWin.parent[0], &name))
name = NULL;
- if (name == NULL || STRCMP(name, str))
- XSetIconName(display->display, TermWin.parent[0], str);
+ if (name == NULL || STRCMP (name, str))
+ XSetIconName (display->display, TermWin.parent[0], str);
if (name)
- XFree(name);
+ XFree (name);
#endif
}
return;
/* handle color aliases */
- if (isdigit(*color))
+ if (isdigit (*color))
{
- i = atoi(color);
+ i = atoi (color);
if (i >= 8 && i <= 15)
{ /* bright colors */
i -= 8;
# ifndef NO_BRIGHTCOLOR
PixColors[idx] = PixColors[minBrightCOLOR + i];
- SET_PIXCOLOR(idx);
+ SET_PIXCOLOR (idx);
goto Done;
# endif
if (i >= 0 && i <= 7)
{ /* normal colors */
PixColors[idx] = PixColors[minCOLOR + i];
- SET_PIXCOLOR(idx);
+ SET_PIXCOLOR (idx);
goto Done;
}
}
if (i > Color_White)
{
/* fprintf (stderr, "XFreeColors: PixColors [%d] = %lu\n", idx, PixColors [idx]); */
- XFreeColors(display->display, XCMAP, (PixColors + idx), 1,
- DisplayPlanes(display->display, display->screen));
+ XFreeColors (display->display, XCMAP, (PixColors + idx), 1,
+ DisplayPlanes (display->display, display->screen));
}
# endif
PixColors[idx] = xcol;
- SET_PIXCOLOR(idx);
+ SET_PIXCOLOR (idx);
/* XSetWindowAttributes attr; */
/* Cursor cursor; */
Done:
- if (idx == Color_bg && !(Options & Opt_transparent))
- XSetWindowBackground(display->display, TermWin.vt,
+ if (idx == Color_bg && ! (Options & Opt_transparent))
+ XSetWindowBackground (display->display, TermWin.vt,
PixColors[Color_bg]);
/* handle Color_BD, scrollbar background, etc. */
xcol[0] = PixColors[Color_pointer];
xcol[1] = PixColors[Color_bg];
XQueryColors (display->display, XCMAP, xcol, 2);
- XRecolorCursor (display->display, TermWin_cursor, &(xcol[0]), &(xcol[1]));
+ XRecolorCursor (display->display, TermWin_cursor, & (xcol[0]), & (xcol[1]));
#endif
}
{
unsigned int i;
const char *xpmb = "\0";
- char fstr[sizeof("default") + 1], bstr[sizeof("default") + 1];
+ char fstr[sizeof ("default") + 1], bstr[sizeof ("default") + 1];
env_colorfgbg =
- (char *)rxvt_malloc(sizeof("COLORFGBG=default;default;bg") + 1);
- STRCPY(fstr, "default");
- STRCPY(bstr, "default");
+ (char *)rxvt_malloc (sizeof ("COLORFGBG=default;default;bg") + 1);
+ STRCPY (fstr, "default");
+ STRCPY (bstr, "default");
for (i = Color_Black; i <= Color_White; i++)
if (PixColors[Color_fg] == PixColors[i])
{
- sprintf(fstr, "%d", (i - Color_Black));
+ sprintf (fstr, "%d", (i - Color_Black));
break;
}
for (i = Color_Black; i <= Color_White; i++)
if (PixColors[Color_bg] == PixColors[i])
{
- sprintf(bstr, "%d", (i - Color_Black));
+ sprintf (bstr, "%d", (i - Color_Black));
#ifdef XPM_BACKGROUND
xpmb = "default;";
#endif
break;
}
- sprintf(env_colorfgbg, "COLORFGBG=%s;%s%s", fstr, xpmb, bstr);
- putenv(env_colorfgbg);
+ sprintf (env_colorfgbg, "COLORFGBG=%s;%s%s", fstr, xpmb, bstr);
+ putenv (env_colorfgbg);
#ifndef NO_BRIGHTCOLOR
colorfgbg = DEFAULT_RSTYLE;
for (i = minCOLOR; i <= maxCOLOR; i++)
{
if (PixColors[Color_fg] == PixColors[i])
- colorfgbg = SET_FGCOLOR(colorfgbg, i);
+ colorfgbg = SET_FGCOLOR (colorfgbg, i);
if (PixColors[Color_bg] == PixColors[i])
- colorfgbg = SET_BGCOLOR(colorfgbg, i);
+ colorfgbg = SET_BGCOLOR (colorfgbg, i);
}
#endif
}
{
if (!screen_in_out->set (display, colour))
{
- rxvt_print_error("can't allocate colour: %s", colour);
+ rxvt_print_error ("can't allocate colour: %s", colour);
return false;
}
TermWin.ncol = ncol;
}
- scr_reset();
+ scr_reset ();
if (curr_screen >= 0) /* this is not the first time through */
{
if (width == 0 || height == 0)
{
- XGetWindowAttributes(display->display, display->root, &wattr);
+ XGetWindowAttributes (display->display, display->root, &wattr);
if (width == 0)
width = wattr.width - szHint.base_width;
if (height == 0)
{
size->x = TermWin.int_bwidth;
size->y = TermWin.int_bwidth;
- size->width = Width2Pixel(TermWin.ncol);
- size->height = Height2Pixel(TermWin.nrow);
+ size->width = Width2Pixel (TermWin.ncol);
+ size->height = Height2Pixel (TermWin.nrow);
}
void
char server[IMBUFSIZ];
/* get current locale modifier */
- if ((p = XSetLocaleModifiers(NULL)) != NULL)
+ if ((p = XSetLocaleModifiers (NULL)) != NULL)
{
- STRCPY(server, "@server=");
- STRNCAT(server, &(p[4]), IMBUFSIZ - 9); /* skip "@im=" */
- if ((p = STRCHR(server + 1, '@')) != NULL) /* first one only */
+ STRCPY (server, "@server=");
+ STRNCAT (server, & (p[4]), IMBUFSIZ - 9); /* skip "@im=" */
+ if ((p = STRCHR (server + 1, '@')) != NULL) /* first one only */
*p = '\0';
- atom = XInternAtom(display->display, server, False);
- win = XGetSelectionOwner(display->display, atom);
+ atom = XInternAtom (display->display, server, False);
+ win = XGetSelectionOwner (display->display, atom);
if (win != None)
return True;
}
XVaNestedList preedit_attr;
if (Input_Context == NULL
- || !TermWin.focus || !(input_style & XIMPreeditPosition)
- || !(event_type == KeyPress
+ || !TermWin.focus || ! (input_style & XIMPreeditPosition)
+ || ! (event_type == KeyPress
|| event_type == Expose
|| event_type == NoExpose
|| event_type == SelectionNotify
im_set_position (&spot);
- preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL);
- XSetICValues(Input_Context, XNPreeditAttributes, preedit_attr, NULL);
- XFree(preedit_attr);
+ preedit_attr = XVaCreateNestedList (0, XNSpotLocation, &spot, NULL);
+ XSetICValues (Input_Context, XNPreeditAttributes, preedit_attr, NULL);
+ XFree (preedit_attr);
}
void
{
int mbh, vtx = 0;
- if (scrollbar_visible () && !(Options & Opt_scrollBar_right))
- vtx = scrollbar_TotalWidth();
+ if (scrollbar_visible () && ! (Options & Opt_scrollBar_right))
+ vtx = scrollbar_TotalWidth ();
- mbh = menubar_visible () ? menuBar_TotalHeight() : 0;
+ mbh = menubar_visible () ? menuBar_TotalHeight () : 0;
mbh -= TermWin.lineSpace;
preedit_rect->x = needed_rect->width + vtx;
- preedit_rect->y = Height2Pixel(TermWin.nrow - 1) + mbh;
+ preedit_rect->y = Height2Pixel (TermWin.nrow - 1) + mbh;
- preedit_rect->width = Width2Pixel(TermWin.ncol + 1) - needed_rect->width + vtx;
- preedit_rect->height = Height2Pixel(1);
+ preedit_rect->width = Width2Pixel (TermWin.ncol + 1) - needed_rect->width + vtx;
+ preedit_rect->height = Height2Pixel (1);
status_rect->x = vtx;
- status_rect->y = Height2Pixel(TermWin.nrow - 1) + mbh;
+ status_rect->y = Height2Pixel (TermWin.nrow - 1) + mbh;
- status_rect->width = needed_rect->width ? needed_rect->width : Width2Pixel(TermWin.ncol + 1);
- status_rect->height = Height2Pixel(1);
+ status_rect->width = needed_rect->width ? needed_rect->width : Width2Pixel (TermWin.ncol + 1);
+ status_rect->height = Height2Pixel (1);
}
void
XIMStyles *xim_styles;
XVaNestedList preedit_attr, status_attr;
- if (!((p = XSetLocaleModifiers (modifiers)) && *p))
+ if (! ((p = XSetLocaleModifiers (modifiers)) && *p))
return false;
- D_MAIN((stderr, "rxvt_IM_get_IC()"));
+ D_MAIN ((stderr, "rxvt_IM_get_IC ()"));
input_method = display->get_xim (locale, modifiers);
if (input_method == NULL)
return false;
}
p = rs[Rs_preeditType] ? rs[Rs_preeditType] : "OverTheSpot,OffTheSpot,Root";
- s = rxvt_splitcommastring(p);
+ s = rxvt_splitcommastring (p);
for (i = found = 0; !found && s[i]; i++)
{
- if (!STRCMP(s[i], "OverTheSpot"))
+ if (!STRCMP (s[i], "OverTheSpot"))
input_style = (XIMPreeditPosition | XIMStatusNothing);
- else if (!STRCMP(s[i], "OffTheSpot"))
+ else if (!STRCMP (s[i], "OffTheSpot"))
input_style = (XIMPreeditArea | XIMStatusArea);
- else if (!STRCMP(s[i], "Root"))
+ else if (!STRCMP (s[i], "Root"))
input_style = (XIMPreeditNothing | XIMStatusNothing);
for (j = 0; j < xim_styles->count_styles; j++)
im_set_position (&spot);
im_set_color (&fg, &bg);
- preedit_attr = XVaCreateNestedList(0, XNArea, &rect,
+ preedit_attr = XVaCreateNestedList (0, XNArea, &rect,
XNSpotLocation, &spot,
XNForeground, fg, XNBackground, bg,
//XNFontSet, TermWin.fontset,
im_set_preedit_area (&rect, &status_rect, &needed_rect);
- preedit_attr = XVaCreateNestedList(0, XNArea, &rect,
+ preedit_attr = XVaCreateNestedList (0, XNArea, &rect,
XNForeground, fg, XNBackground, bg,
//XNFontSet, TermWin.fontset,
NULL);
- status_attr = XVaCreateNestedList(0, XNArea, &status_rect,
+ status_attr = XVaCreateNestedList (0, XNArea, &status_rect,
XNForeground, fg, XNBackground, bg,
//XNFontSet, TermWin.fontset,
NULL);
}
- Input_Context = XCreateIC(xim, XNInputStyle, input_style,
+ Input_Context = XCreateIC (xim, XNInputStyle, input_style,
XNClientWindow, TermWin.parent[0],
XNFocusWindow, TermWin.parent[0],
preedit_attr ? XNPreeditAttributes : NULL,
preedit_attr,
status_attr ? XNStatusAttributes : NULL,
status_attr, NULL);
- if (preedit_attr) XFree(preedit_attr);
- if (status_attr) XFree(status_attr);
+ if (preedit_attr) XFree (preedit_attr);
+ if (status_attr) XFree (status_attr);
if (Input_Context == NULL)
{
- rxvt_print_error("failed to create input context");
+ rxvt_print_error ("failed to create input context");
display->put_xim (input_method);
return false;
}
if (input_style & XIMPreeditArea)
IMSetStatusPosition ();
- D_MAIN((stderr, "rxvt_IM_get_IC() - successful connection"));
+ D_MAIN ((stderr, "rxvt_IM_get_IC () - successful connection"));
return true;
}
im_destroy ();
- D_MAIN((stderr, "rxvt_IMInstantiateCallback()"));
+ D_MAIN ((stderr, "rxvt_IMInstantiateCallback ()"));
if (Input_Context)
return;
}
}
for (i = 0; s[i]; i++)
- free(s[i]);
- free(s);
+ free (s[i]);
+ free (s);
if (found)
goto done;
XVaNestedList preedit_attr, status_attr;
if (Input_Context == NULL
- || !TermWin.focus || !(input_style & XIMPreeditArea)
+ || !TermWin.focus || ! (input_style & XIMPreeditArea)
|| !IMisRunning ())
return;
/* Getting the necessary width of preedit area */
- status_attr = XVaCreateNestedList(0, XNAreaNeeded, &needed_rect, NULL);
- XGetICValues(Input_Context, XNStatusAttributes, status_attr, NULL);
- XFree(status_attr);
+ status_attr = XVaCreateNestedList (0, XNAreaNeeded, &needed_rect, NULL);
+ XGetICValues (Input_Context, XNStatusAttributes, status_attr, NULL);
+ XFree (status_attr);
im_set_preedit_area (&preedit_rect, &status_rect, needed_rect);
- preedit_attr = XVaCreateNestedList(0, XNArea, &preedit_rect, NULL);
- status_attr = XVaCreateNestedList(0, XNArea, &status_rect, NULL);
+ preedit_attr = XVaCreateNestedList (0, XNArea, &preedit_rect, NULL);
+ status_attr = XVaCreateNestedList (0, XNArea, &status_rect, NULL);
- XSetICValues(Input_Context,
+ XSetICValues (Input_Context,
XNPreeditAttributes, preedit_attr,
XNStatusAttributes, status_attr, NULL);
- XFree(preedit_attr);
- XFree(status_attr);
+ XFree (preedit_attr);
+ XFree (status_attr);
}
#endif /* USE_XIM */