Wed Jun 26 23:14:20 2002 Michael Jennings (mej)

Bug-hunting....


SVN revision: 6331
This commit is contained in:
Michael Jennings 2002-06-27 03:17:45 +00:00
parent ec34068f82
commit d0cbe0001c
4 changed files with 40 additions and 29 deletions

View File

@ -4735,3 +4735,7 @@ Wed Jun 26 16:58:14 2002 Michael Jennings (mej)
Latest Escreen stuff from Azundris, including work on twin support
(twin.sourceforge.net).
----------------------------------------------------------------------
Wed Jun 26 23:14:20 2002 Michael Jennings (mej)
Bug-hunting....
----------------------------------------------------------------------

View File

@ -122,8 +122,12 @@ bbar_free(buttonbar_t *bbar)
if (bbar->next) {
bbar_free(bbar->next);
}
button_free(bbar->rbuttons);
button_free(bbar->buttons);
if (bbar->rbuttons) {
button_free(bbar->rbuttons);
}
if (bbar->buttons) {
button_free(bbar->buttons);
}
#ifdef MULTI_CHARSET
if (bbar->fontset) {
XFreeFontSet(Xdisplay, bbar->fontset);
@ -510,7 +514,7 @@ bbar_calc_button_positions(buttonbar_t *bbar)
b->x = x;
b->y = y;
button_calc_rel_coords(bbar, b);
D_BBAR(("Set button \"%s\" (%8p, width %d) to coordinates %d, %d\n", b->text, b, b->w, x, y));
D_BBAR(("Set rbutton \"%s\" (%8p, width %d) to coordinates %d, %d\n", b->text, b, b->w, x, y));
}
}
}
@ -1087,7 +1091,7 @@ bbar_draw(buttonbar_t *bbar, unsigned char image_state, unsigned char force_mode
}
if (button->len) {
#ifdef ESCREEN
GC gc; /* evil temporary hack */
/* evil temporary hack */
int f = button->flags & ~NS_SCREAM_BUTTON;
if (f & NS_SCREAM_CURR) {
@ -1098,12 +1102,14 @@ bbar_draw(buttonbar_t *bbar, unsigned char image_state, unsigned char force_mode
f = 0;
}
gc = LIBAST_X_CREATE_GC(0, NULL);
XCopyGC(Xdisplay, bbar->gc, GCFont, gc);
XSetForeground(Xdisplay, gc, PixColors[minBright + f + 2]);
D_BBAR(("bbar_draw: text \"%s\", colour %d.\n", button->text, f));
D_BBAR(("bbar_draw: text \"%s\", color %d.\n", button->text, f));
if (f) {
GC gc;
gc = LIBAST_X_CREATE_GC(0, NULL);
XCopyGC(Xdisplay, bbar->gc, GCFont, gc);
XSetForeground(Xdisplay, gc, PixColors[minBright + f + 2]);
draw_string(bbar, bbar->bg, gc, button->text_x, button->text_y, button->text, button->len);
LIBAST_X_FREE_GC(gc);
} else

View File

@ -2880,6 +2880,7 @@ make_escreen_menu(buttonbar_t *bbar)
if ((button = button_create(NS_MENU_TITLE))) {
bbar_add_rbutton(bbar, button);
bbar_calc_button_sizes(bbar);
button_set_action(button, ACTION_MENU, NS_MENU_TITLE);
}
return 1;

View File

@ -1188,12 +1188,12 @@ ns_attach_by_URL(char *url, char *hop, _ns_efuns ** ef, int *err, void *xd)
if (url && strlen(url)) {
char *q;
if (!(d = strdup(url)))
if (!(d = STRDUP(url)))
goto fail;
if ((q = strstr(d, "://"))) { /* protocol, if any */
*q = '\0';
if (!(sess->proto = strdup(d)))
if (!(sess->proto = STRDUP(d)))
goto fail;
q += 3;
} else
@ -1206,10 +1206,10 @@ ns_attach_by_URL(char *url, char *hop, _ns_efuns ** ef, int *err, void *xd)
*p = '\0';
if ((r = strchr(q, ':'))) { /* password, if any */
*(r++) = '\0';
if (!(sess->pass = strdup(r))) /* password may be empty string! */
if (!(sess->pass = STRDUP(r))) /* password may be empty string! */
goto fail;
}
sess->user = strdup(q);
sess->user = STRDUP(q);
}
q = p + 1;
}
@ -1262,7 +1262,7 @@ ns_attach_by_URL(char *url, char *hop, _ns_efuns ** ef, int *err, void *xd)
sess->disp = 0;
}
if (strlen(y))
sess->host = strdup(y);
sess->host = STRDUP(y);
}
} else
# endif
@ -1284,7 +1284,7 @@ ns_attach_by_URL(char *url, char *hop, _ns_efuns ** ef, int *err, void *xd)
*rx = '\0';
if (*r != '/')
D_ESCREEN(("URL: path for screen's option -c should be absolute (%s)\n", r));
if ((rc = strdup(r))) {
if ((rc = STRDUP(r))) {
if (sess->home) /* this should never happen */
FREE(sess->home);
D_ESCREEN(("URL: searching for rc in %s\n", rc));
@ -1308,7 +1308,7 @@ ns_attach_by_URL(char *url, char *hop, _ns_efuns ** ef, int *err, void *xd)
}
}
if (!(sess->rsrc = strdup(p)))
if (!(sess->rsrc = STRDUP(p)))
goto fail;
}
}
@ -1322,7 +1322,7 @@ ns_attach_by_URL(char *url, char *hop, _ns_efuns ** ef, int *err, void *xd)
}
}
if (strlen(q) && !(sess->host = strdup(q))) /* host, if any */
if (strlen(q) && !(sess->host = STRDUP(q))) /* host, if any */
goto fail;
FREE(d);
@ -1336,7 +1336,7 @@ ns_attach_by_URL(char *url, char *hop, _ns_efuns ** ef, int *err, void *xd)
D_ESCREEN(("unknown user...\n"));
goto fail;
}
if (!(sess->user = strdup(pwe->pw_name)))
if (!(sess->user = STRDUP(pwe->pw_name)))
goto fail;
} else if ((sess->host && strcmp(sess->host, "localhost") && strcmp(sess->host, "127.0.0.1")) || (sess->port > 0)) {
pwe = NULL;
@ -1356,7 +1356,7 @@ ns_attach_by_URL(char *url, char *hop, _ns_efuns ** ef, int *err, void *xd)
#ifdef NS_HAVE_SCREEN
if (getenv("SYSSCREENRC")) { /* $SYSSCREENRC */
if (!(sess->sysrc = strdup(getenv("SCREENRC"))))
if (!(sess->sysrc = STRDUP(getenv("SCREENRC"))))
goto fail;
} else {
char *loc[] = { "/usr/local/etc/screenrc", /* official */
@ -1368,14 +1368,14 @@ ns_attach_by_URL(char *url, char *hop, _ns_efuns ** ef, int *err, void *xd)
for (n = 0; n < nloc; n++)
if (!access(loc[n], R_OK)) {
if (!(sess->sysrc = strdup(loc[n])))
if (!(sess->sysrc = STRDUP(loc[n])))
goto fail;
n = nloc;
}
}
if (getenv("SCREENRC")) { /* $SCREENRC */
sess->home = strdup(getenv("SCREENRC"));
sess->home = STRDUP(getenv("SCREENRC"));
} else if (pwe && !sess->home) { /* ~/.screenrc */
if ((sess->home = MALLOC(strlen(pwe->pw_dir) + strlen(NS_SCREEN_RC) + 2)))
sprintf(sess->home, "%s/%s", pwe->pw_dir, NS_SCREEN_RC);
@ -1407,7 +1407,7 @@ ns_attach_by_URL(char *url, char *hop, _ns_efuns ** ef, int *err, void *xd)
sess->disp = atoi(twdisp);
} /* fall back on TWDISPLAY host */
if (((!sess->host) || (!strlen(sess->host))) && strlen(twd) && strcmp(twd, "localhost"))
sess->host = strdup(twd);
sess->host = STRDUP(twd);
}
/* this is ugly, but does the intuitive thing.
* if you specifically want to connect a twin to a non-twin
@ -1443,7 +1443,7 @@ ns_attach_by_URL(char *url, char *hop, _ns_efuns ** ef, int *err, void *xd)
#endif
if (!sess->host) { /* no host */
if (!(sess->host = strdup("localhost")))
if (!(sess->host = STRDUP("localhost")))
goto fail;
if (sess->port <= 0) { /* no host/port */
sess->where = NS_LCL;
@ -2369,7 +2369,7 @@ ns_screen_command(_ns_sess * sess, char *cmd)
return NS_FAIL;
if (NS_EFUN_EXISTS(efuns, sess, NULL, inp_text)) {
if ((c = strdup(cmd))) {
if ((c = STRDUP(cmd))) {
{
char *p = c; /* replace default escape-char with that */
@ -2672,7 +2672,7 @@ ns_parse_screen_interactive(_ns_sess * sess, char *c)
if (!c || !*c)
return NS_FAIL;
#ifdef NS_PARANOID
if (!(s = o = strdup(c)))
if (!(s = o = STRDUP(c)))
return NS_FAIL;
#else
s = c;
@ -2854,7 +2854,7 @@ ns_parse_screen_msg(_ns_sess * screen, char *p)
if (screen->name) {
FREE(screen->name);
}
if ((screen->name = strdup(&p[strlen(NS_SCREEN_SESS_T)]))) {
if ((screen->name = STRDUP(&p[strlen(NS_SCREEN_SESS_T)]))) {
size_t lsn = strlen(screen->name);
if (lsn) {
@ -2955,7 +2955,7 @@ ns_parse_screen(_ns_sess * screen, int force, int width, char *p)
if (!force && screen->timestamp)
return NS_SUCC;
if ((p = strdup(p))) {
if ((p = STRDUP(p))) {
_ns_parse pd[NS_MAX_DISPS];
p2 = &p[width - 1];
@ -3067,7 +3067,7 @@ ns_parse_screen(_ns_sess * screen, int force, int width, char *p)
}
if (!disp) { /* new display */
if (!(disp = disp_fetch_or_make(screen, n)) || !(disp->name = strdup(pd[r].name))) {
if (!(disp = disp_fetch_or_make(screen, n)) || !(disp->name = STRDUP(pd[r].name))) {
D_ESCREEN(("parse_screen: out of memory in new_display(%d)\n", n));
ret = NS_FAIL;
} else {
@ -3084,7 +3084,7 @@ ns_parse_screen(_ns_sess * screen, int force, int width, char *p)
(disp->flags != fl)) {
if (tmp) {
FREE(disp->name);
if (!(disp->name = strdup(pd[r].name))) {
if (!(disp->name = STRDUP(pd[r].name))) {
FREE(p);
return NS_FAIL;
}