char *
expand_tilde(char *s)
{
- struct passwd *pwd;
+ struct passwd *ppwd;
int i, max;
char *user;
const char *sc = s;
user[i] = '\0';
s = &s[i];
- pwd = strlen(user) == 0 ? getpwuid(getuid()) : getpwnam(user);
- if (pwd == NULL)
+ ppwd = strlen(user) == 0 ? getpwuid(getuid()) : getpwnam(user);
+ if (ppwd == NULL)
result = strdup(sc);
else
- if (asprintf(&result, "%s%s", pwd->pw_dir, s) == -1)
+ if (asprintf(&result, "%s%s", ppwd->pw_dir, s) == -1)
result = NULL;
out:
if (result == NULL)
xcb_create_pixmap(conn, screen->root_depth, r->bar->buffer, r->bar->id,
WIDTH(r->bar), HEIGHT(r->bar));
- xcb_randr_select_input(conn, r->bar->id,
- XCB_RANDR_NOTIFY_MASK_OUTPUT_CHANGE);
+ if (xrandr_support)
+ xcb_randr_select_input(conn, r->bar->id,
+ XCB_RANDR_NOTIFY_MASK_OUTPUT_CHANGE);
if (bar_enabled)
map_window_raised(r->bar->id);
{
char *cp, *class, *name;
int retval;
- unsigned long quirks;
+ unsigned long qrks;
/* suppress unused warning since var is needed */
(void)flags;
*cp = '\0';
class = selector;
name = cp + 1;
- if ((retval = parsequirks(value, &quirks)) == 0)
- setquirk(class, name, quirks);
+ if ((retval = parsequirks(value, &qrks)) == 0)
+ setquirk(class, name, qrks);
return (retval);
}
void
check_conn(void)
{
- int err = xcb_connection_has_error(conn);
+ int errcode = xcb_connection_has_error(conn);
char *s;
-
- switch (err) {
+#ifdef XCB_CONN_ERROR
+ switch (errcode) {
case XCB_CONN_ERROR:
s = "Socket error, pipe error or other stream error.";
break;
default:
s = "Unknown error.";
}
-
- if (err)
- errx(err, "X CONNECTION ERROR: %s", s);
+ if (errcode)
+ errx(errcode, "X CONNECTION ERROR: %s", s);
+#else
+ if (errcode)
+ errx(errcode, "X CONNECTION ERROR");
+#endif
}
int