| @@ -1,20 +1,202 @@ | | | @@ -1,20 +1,202 @@ |
1 | $NetBSD: patch-ad,v 1.1 2005/12/15 23:02:33 joerg Exp $ | | 1 | $NetBSD: patch-ad,v 1.2 2010/12/28 08:25:20 obache Exp $ |
2 | | | 2 | |
3 | --- screen.c.orig 2005-12-15 22:53:30.000000000 +0000 | | 3 | --- screen.c.orig 1999-02-22 16:52:34 -0500 |
4 | +++ screen.c | | 4 | +++ screen.c |
5 | @@ -36,6 +36,7 @@ static char rcsid[] = "$Id: screen.c,v 1 | | 5 | @@ -36,6 +36,7 @@ |
6 | #elif defined(HAVE_LIBGEN_H) | | 6 | #elif defined(HAVE_LIBGEN_H) |
7 | #include <libgen.h> | | 7 | #include <libgen.h> |
8 | #endif | | 8 | #endif |
9 | +#include <errno.h> | | 9 | +#include <errno.h> |
10 | | | 10 | |
11 | #include "compat.h" | | 11 | #include "compat.h" |
12 | #include "tty.h" | | 12 | #include "tty.h" |
13 | @@ -109,7 +110,6 @@ extern char *myname, nick[], *srvnm; | | 13 | @@ -66,7 +67,7 @@ |
| | | 14 | struct ircpage { |
| | | 15 | struct ircwin *ipg_iwa; |
| | | 16 | struct ircwin *ipg_iwc; |
| | | 17 | - CIRCLEQ_ENTRY(ircpage) ipg_entries; |
| | | 18 | + TAILQ_ENTRY(ircpage) ipg_entries; |
| | | 19 | int ipg_upd; |
| | | 20 | }; |
| | | 21 | |
| | | 22 | @@ -99,7 +100,7 @@ |
| | | 23 | static int dodisplay; /* if 0, window updates and clock won't be |
| | | 24 | * displayed (for example when in opt editor */ |
| | | 25 | |
| | | 26 | -CIRCLEQ_HEAD(, ircpage) pages_head; |
| | | 27 | +TAILQ_HEAD(, ircpage) pages_head = TAILQ_HEAD_INITIALIZER(pages_head); |
| | | 28 | |
| | | 29 | #define IW_USED 1 |
| | | 30 | #define IW_VISIBLE 2 |
| | | 31 | @@ -109,7 +110,6 @@ |
14 | extern void (*othercmd) __P((char *)); | | 32 | extern void (*othercmd) __P((char *)); |
15 | extern int on_irc; | | 33 | extern int on_irc; |
16 | extern int umd; | | 34 | extern int umd; |
17 | -extern int errno; | | 35 | -extern int errno; |
18 | extern int is_away; | | 36 | extern int is_away; |
19 | | | 37 | |
20 | char *prompt; | | 38 | char *prompt; |
| | | 39 | @@ -167,7 +167,7 @@ |
| | | 40 | tty_gotoxy(0, 0); |
| | | 41 | tty_flush(); |
| | | 42 | |
| | | 43 | - CIRCLEQ_INIT(&pages_head); |
| | | 44 | + TAILQ_INIT(&pages_head); |
| | | 45 | cpage = NULL; |
| | | 46 | cpageno = 0; |
| | | 47 | otherpage = 0; |
| | | 48 | @@ -307,8 +307,8 @@ |
| | | 49 | } |
| | | 50 | |
| | | 51 | /* Else try the other pages */ |
| | | 52 | - for (ipg = pages_head.cqh_first; ipg != (struct ircpage *)&pages_head; |
| | | 53 | - ipg = ipg->ipg_entries.cqe_next) { |
| | | 54 | + for (ipg = pages_head.tqh_first; ipg != NULL; |
| | | 55 | + ipg = ipg->ipg_entries.tqe_next) { |
| | | 56 | ipg_switchtopg(ipg); |
| | | 57 | |
| | | 58 | /* |
| | | 59 | @@ -656,9 +656,9 @@ |
| | | 60 | struct channel *ch; |
| | | 61 | struct ircpage *ipg, *savepg = cpage; |
| | | 62 | |
| | | 63 | - for (ipg = pages_head.cqh_first; |
| | | 64 | - ipg != (struct ircpage *) &pages_head; |
| | | 65 | - ipg = ipg->ipg_entries.cqe_next) { |
| | | 66 | + for (ipg = pages_head.tqh_first; |
| | | 67 | + ipg != NULL; |
| | | 68 | + ipg = ipg->ipg_entries.tqe_next) { |
| | | 69 | ipg_switchtopg(ipg); |
| | | 70 | /* |
| | | 71 | * Traverse the window list. For each window, iterate through |
| | | 72 | @@ -987,8 +987,8 @@ |
| | | 73 | { |
| | | 74 | struct ircpage *ipg, *savepg = cpage; |
| | | 75 | |
| | | 76 | - for (ipg = pages_head.cqh_first; ipg != (struct ircpage *)&pages_head; |
| | | 77 | - ipg = ipg->ipg_entries.cqe_next) { |
| | | 78 | + for (ipg = pages_head.tqh_first; ipg != NULL; |
| | | 79 | + ipg = ipg->ipg_entries.tqe_next) { |
| | | 80 | ipg_switchtopg(ipg); |
| | | 81 | equalwin(); |
| | | 82 | } |
| | | 83 | @@ -1099,8 +1099,8 @@ |
| | | 84 | strcpy(t, cname); |
| | | 85 | h = elf_hash(irc_strupr(t)); |
| | | 86 | |
| | | 87 | - for (ipg = pages_head.cqh_first; ipg != (struct ircpage *) &pages_head; |
| | | 88 | - ipg = ipg->ipg_entries.cqe_next) { |
| | | 89 | + for (ipg = pages_head.tqh_first; ipg != NULL; |
| | | 90 | + ipg = ipg->ipg_entries.tqe_next) { |
| | | 91 | ipg_switchtopg(ipg); |
| | | 92 | |
| | | 93 | w = iwa; |
| | | 94 | @@ -2163,8 +2163,8 @@ |
| | | 95 | struct ircwin *iw; |
| | | 96 | struct ircpage *ipg; |
| | | 97 | |
| | | 98 | - for (ipg = pages_head.cqh_first; ipg != (struct ircpage *) &pages_head; |
| | | 99 | - ipg = ipg->ipg_entries.cqe_next) |
| | | 100 | + for (ipg = pages_head.tqh_first; ipg != NULL; |
| | | 101 | + ipg = ipg->ipg_entries.tqe_next) |
| | | 102 | for (iw = ipg->ipg_iwa; iw != NULL; iw = iw->iw_next) |
| | | 103 | reformat_backscroll(iw, t_columns); |
| | | 104 | } |
| | | 105 | @@ -2197,7 +2197,7 @@ |
| | | 106 | ipg->ipg_iwa = iwa; |
| | | 107 | ipg->ipg_iwc = iwc; |
| | | 108 | ipg->ipg_upd = 0; |
| | | 109 | - CIRCLEQ_INSERT_TAIL(&pages_head, ipg, ipg_entries); |
| | | 110 | + TAILQ_INSERT_TAIL(&pages_head, ipg, ipg_entries); |
| | | 111 | otherpage = cpageno; |
| | | 112 | cpageno = numpages++; |
| | | 113 | set_prompt(NULL); |
| | | 114 | @@ -2214,11 +2214,9 @@ |
| | | 115 | int newpg; |
| | | 116 | |
| | | 117 | if (iwa == NULL || (iwa->iw_next == NULL && iwa->iw_ch == NULL)) { |
| | | 118 | - if (ipg->ipg_entries.cqe_prev != |
| | | 119 | - (struct ircpage *) &pages_head) |
| | | 120 | + if (*(ipg->ipg_entries.tqe_prev) != NULL) |
| | | 121 | newpg = cpageno - 1; |
| | | 122 | - else if (ipg->ipg_entries.cqe_next != |
| | | 123 | - (struct ircpage *) &pages_head) |
| | | 124 | + else if (ipg->ipg_entries.tqe_next != NULL) |
| | | 125 | newpg = cpageno + 1; |
| | | 126 | else { |
| | | 127 | iw_printf(COLI_TEXT, "%sCannot remove the only page\n", |
| | | 128 | @@ -2235,7 +2233,7 @@ |
| | | 129 | } |
| | | 130 | |
| | | 131 | ipg_switchto(newpg, 1); |
| | | 132 | - CIRCLEQ_REMOVE(&pages_head, ipg, ipg_entries); |
| | | 133 | + TAILQ_REMOVE(&pages_head, ipg, ipg_entries); |
| | | 134 | free(ipg); |
| | | 135 | numpages--; |
| | | 136 | set_prompt(NULL); |
| | | 137 | @@ -2256,11 +2254,11 @@ |
| | | 138 | struct ircpage *ipg; |
| | | 139 | int pns = pageno; |
| | | 140 | |
| | | 141 | - for (ipg = pages_head.cqh_first; |
| | | 142 | - ipg != (struct ircpage *) &pages_head && pageno > 0; |
| | | 143 | - ipg = ipg->ipg_entries.cqe_next, pageno--) |
| | | 144 | + for (ipg = pages_head.tqh_first; |
| | | 145 | + ipg != NULL && pageno > 0; |
| | | 146 | + ipg = ipg->ipg_entries.tqe_next, pageno--) |
| | | 147 | ; |
| | | 148 | - if (pageno == 0 && ipg != (struct ircpage *) &pages_head) { |
| | | 149 | + if (pageno == 0 && ipg != NULL) { |
| | | 150 | ipg_switchtopg(ipg); |
| | | 151 | set_prompt(NULL); |
| | | 152 | otherpage = cpageno; |
| | | 153 | @@ -2312,9 +2310,9 @@ |
| | | 154 | |
| | | 155 | pline[0] = 0; |
| | | 156 | |
| | | 157 | - for (i = 0, ipg = pages_head.cqh_first; i < numpages && |
| | | 158 | - ipg != (struct ircpage *) &pages_head; |
| | | 159 | - i++, ipg = ipg->ipg_entries.cqe_next) { |
| | | 160 | + for (i = 0, ipg = pages_head.tqh_first; i < numpages && |
| | | 161 | + ipg != NULL; |
| | | 162 | + i++, ipg = ipg->ipg_entries.tqe_next) { |
| | | 163 | if (ipg != cpage) |
| | | 164 | sprintf(t, "-%d-", i); |
| | | 165 | else |
| | | 166 | @@ -2352,9 +2350,9 @@ |
| | | 167 | struct ircpage *ipg; |
| | | 168 | int i, n = 1; |
| | | 169 | |
| | | 170 | - for (i = 0, ipg = pages_head.cqh_first; |
| | | 171 | - ipg != (struct ircpage *) &pages_head; |
| | | 172 | - ipg = ipg->ipg_entries.cqe_next, i++) |
| | | 173 | + for (i = 0, ipg = pages_head.tqh_first; |
| | | 174 | + ipg != NULL; |
| | | 175 | + ipg = ipg->ipg_entries.tqe_next, i++) |
| | | 176 | if (ipg->ipg_upd) |
| | | 177 | pglist[n++] = i + '0'; |
| | | 178 | if (n > 1) { |
| | | 179 | @@ -2378,9 +2376,9 @@ |
| | | 180 | struct ircpage *ipg; |
| | | 181 | int i; |
| | | 182 | |
| | | 183 | - for (i = 0, ipg = pages_head.cqh_first; |
| | | 184 | - ipg != (struct ircpage *) &pages_head; |
| | | 185 | - ipg = ipg->ipg_entries.cqe_next, i++) |
| | | 186 | + for (i = 0, ipg = pages_head.tqh_first; |
| | | 187 | + ipg != NULL; |
| | | 188 | + ipg = ipg->ipg_entries.tqe_next, i++) |
| | | 189 | if (ipg->ipg_upd) |
| | | 190 | pupd |= 1 << i; |
| | | 191 | if (force_update) |
| | | 192 | @@ -2434,8 +2432,8 @@ |
| | | 193 | struct ircwin *w; |
| | | 194 | struct channel *ch; |
| | | 195 | |
| | | 196 | - for (ipg = pages_head.cqh_first; ipg != (struct ircpage *)&pages_head; |
| | | 197 | - ipg = ipg->ipg_entries.cqe_next) |
| | | 198 | + for (ipg = pages_head.tqh_first; ipg != NULL; |
| | | 199 | + ipg = ipg->ipg_entries.tqe_next) |
| | | 200 | for (w = iwa; w != NULL && w->iw_flags & IW_USED; |
| | | 201 | w = w->iw_next) |
| | | 202 | for (ch = w->iw_ch; ch != NULL; ch = ch->ch_wnext) |