Changeset 925e122
- Timestamp:
- Dec 27, 2007, 11:01:22 AM (17 years ago)
- Branches:
- master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 5376a95
- Parents:
- 9866c3a (diff), 9aba27b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
stylefunc.c
rfa86732 r9aba27b 146 146 if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES)) { 147 147 if (owl_message_is_personal(m)) { 148 owl_fmtext_addattr( (&m->fmtext), OWL_FMTEXT_ATTR_BOLD);148 owl_fmtext_addattr(fm, OWL_FMTEXT_ATTR_BOLD); 149 149 } 150 150 } … … 309 309 if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES)) { 310 310 if (owl_message_is_personal(m)) { 311 owl_fmtext_addattr( (&m->fmtext), OWL_FMTEXT_ATTR_BOLD);311 owl_fmtext_addattr(fm, OWL_FMTEXT_ATTR_BOLD); 312 312 } 313 313 } … … 627 627 if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES)) { 628 628 if (owl_message_is_personal(m)) { 629 owl_fmtext_addattr( (&m->fmtext), OWL_FMTEXT_ATTR_BOLD);629 owl_fmtext_addattr(fm, OWL_FMTEXT_ATTR_BOLD); 630 630 } 631 631 } -
aim.c
r9854278 r34509d5 948 948 949 949 if (modname) { 950 if (!(filename = malloc(strlen(priv->aimbinarypath)+1+strlen(modname)+4+1))) {950 if (!(filename = owl_malloc(strlen(priv->aimbinarypath)+1+strlen(modname)+4+1))) { 951 951 /* perror("memrequest: malloc"); */ 952 952 return -1; … … 954 954 sprintf(filename, "%s/%s.ocm", priv->aimbinarypath, modname); 955 955 } else { 956 if (!(filename = malloc(strlen(priv->aimbinarypath)+1+strlen(defaultmod)+1))) {956 if (!(filename = owl_malloc(strlen(priv->aimbinarypath)+1+strlen(defaultmod)+1))) { 957 957 /* perror("memrequest: malloc"); */ 958 958 return -1; … … 964 964 if (!modname) { 965 965 /* perror("memrequest: stat"); */ 966 free(filename);966 owl_free(filename); 967 967 return -1; 968 968 } … … 986 986 int i; 987 987 988 free(filename); /* not needed */988 owl_free(filename); /* not needed */ 989 989 owl_function_error("getaimdata memrequest: recieved invalid request for 0x%08lx bytes at 0x%08lx (file %s)\n", len, offset, modname); 990 990 i = 8; … … 993 993 } 994 994 995 if (!(buf = malloc(i))) {995 if (!(buf = owl_malloc(i))) { 996 996 return -1; 997 997 } … … 1017 1017 *buflenret = i; 1018 1018 } else { 1019 if (!(buf = malloc(len))) {1020 free(filename);1019 if (!(buf = owl_malloc(len))) { 1020 owl_free(filename); 1021 1021 return -1; 1022 1022 } … … 1024 1024 if (!(f = fopen(filename, "r"))) { 1025 1025 /* perror("memrequest: fopen"); */ 1026 free(filename);1027 free(buf);1026 owl_free(filename); 1027 owl_free(buf); 1028 1028 return -1; 1029 1029 } 1030 1030 1031 free(filename);1031 owl_free(filename); 1032 1032 1033 1033 if (fseek(f, offset, SEEK_SET) == -1) { 1034 1034 /* perror("memrequest: fseek"); */ 1035 1035 fclose(f); 1036 free(buf);1036 owl_free(buf); 1037 1037 return -1; 1038 1038 } … … 1041 1041 /* perror("memrequest: fread"); */ 1042 1042 fclose(f); 1043 free(buf);1043 owl_free(buf); 1044 1044 return -1; 1045 1045 } … … 1076 1076 if (priv->aimbinarypath && (getaimdata(sess, &buf, &buflen, offset, len, modname) == 0)) { 1077 1077 aim_sendmemblock(sess, fr->conn, offset, buflen, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST); 1078 free(buf);1078 owl_free(buf); 1079 1079 } else { 1080 1080 owl_function_debugmsg("faimtest_memrequest: unable to use AIM binary (\"%s/%s\"), sending defaults...\n", priv->aimbinarypath, modname); … … 1342 1342 int z; 1343 1343 1344 newbuf = malloc(i+1);1344 newbuf = owl_malloc(i+1); 1345 1345 for (z = 0; z < i; z++) 1346 1346 newbuf[z] = (z % 10)+0x30; 1347 1347 newbuf[i] = '\0'; 1348 1348 /* aim_send_im(sess, userinfo->sn, AIM_IMFLAGS_ACK | AIM_IMFLAGS_AWAY, newbuf); */ 1349 free(newbuf);1349 owl_free(newbuf); 1350 1350 } 1351 1351 } else if (strstr(tmpstr, "seticqstatus")) { -
cmd.c
r6922edd r34509d5 74 74 owl_cmd *cmd; 75 75 76 tmpbuff= strdup(cmdbuff);76 tmpbuff=owl_strdup(cmdbuff); 77 77 argv=owl_parseline(tmpbuff, &argc); 78 78 if (argc < 0) { -
configure.in
r18e28a4 r762512d 12 12 fi 13 13 14 m4_include(/usr/share/aclocal/pkg.m4) 15 dnl m4_include(pkg.m4) 14 16 15 17 dnl Check for Athena … … 109 111 LDFLAGS=${LDFLAGS}\ ${FOO} 110 112 113 dnl Add CFLAGS and LDFLAGS for glib-2.0 114 PKG_CHECK_MODULES(GLIB,glib-2.0) 115 116 echo Adding glib-2.0 CFLAGS ${GLIB_CFLAGS} 117 CFLAGS=${CFLAGS}\ ${GLIB_CFLAGS} 118 echo Adding glib-2.0 LDFLAGS ${GLIB_LIBS} 119 LDFLAGS=${LDFLAGS}\ ${GLIB_LIBS} 120 121 111 122 dnl Checks for typedefs, structures, and compiler characteristics. 112 123 -
fmtext.c
rfa3290d r9866c3a 8 8 void owl_fmtext_init_null(owl_fmtext *f) 9 9 { 10 f->textlen=0; 11 f->bufflen=5; 12 f->textbuff=owl_malloc(5); 13 f->fmbuff=owl_malloc(5); 14 f->fgcolorbuff=owl_malloc(5 * sizeof(short)); 15 f->bgcolorbuff=owl_malloc(5 * sizeof(short)); 16 f->textbuff[0]=0; 17 f->fmbuff[0]=OWL_FMTEXT_ATTR_NONE; 18 f->fgcolorbuff[0]=OWL_COLOR_DEFAULT; 19 f->bgcolorbuff[0]=OWL_COLOR_DEFAULT; 10 f->textlen = 0; 11 f->bufflen = 5; 12 f->textbuff = owl_malloc(5); 13 f->textbuff[0] = 0; 14 f->default_attrs = OWL_FMTEXT_ATTR_NONE; 15 f->default_fgcolor = OWL_COLOR_DEFAULT; 16 f->default_fgcolor = OWL_COLOR_DEFAULT; 20 17 } 21 18 … … 24 21 void owl_fmtext_clear(owl_fmtext *f) 25 22 { 26 f->textlen = 0; 27 f->textbuff[0] = 0; 28 f->fmbuff[0]=OWL_FMTEXT_ATTR_NONE; 29 f->fgcolorbuff[0]=OWL_COLOR_DEFAULT; 30 f->bgcolorbuff[0]=OWL_COLOR_DEFAULT; 31 } 32 33 /* Internal function. Set the attribute 'attr' from index 'first' to 34 * index 'last' 35 */ 36 void _owl_fmtext_set_attr(owl_fmtext *f, int attr, int first, int last) 37 { 38 int i; 39 for (i=first; i<=last; i++) { 40 f->fmbuff[i]=(unsigned char) attr; 41 } 42 } 43 44 /* Internal function. Add the attribute 'attr' to the existing 45 * attributes from index 'first' to index 'last' 46 */ 47 void _owl_fmtext_add_attr(owl_fmtext *f, int attr, int first, int last) 48 { 49 int i; 50 for (i=first; i<=last; i++) { 51 f->fmbuff[i]|=(unsigned char) attr; 52 } 53 } 54 55 /* Internal function. Set the color to be 'color' from index 'first' 56 * to index 'last 57 */ 58 void _owl_fmtext_set_fgcolor(owl_fmtext *f, int color, int first, int last) 59 { 60 int i; 61 for (i=first; i<=last; i++) { 62 f->fgcolorbuff[i]=(short)color; 63 } 64 } 65 66 void _owl_fmtext_set_bgcolor(owl_fmtext *f, int color, int first, int last) 67 { 68 int i; 69 for (i=first; i<=last; i++) { 70 f->bgcolorbuff[i]=(short)color; 71 } 23 f->textlen = 0; 24 f->textbuff[0] = 0; 25 f->default_attrs = OWL_FMTEXT_ATTR_NONE; 26 f->default_fgcolor = OWL_COLOR_DEFAULT; 27 f->default_fgcolor = OWL_COLOR_DEFAULT; 72 28 } 73 29 … … 75 31 { 76 32 if(newlen + 1 > f->bufflen) { 77 f->textbuff=owl_realloc(f->textbuff, newlen+1); 78 f->fmbuff=owl_realloc(f->fmbuff, newlen+1); 79 f->fgcolorbuff=owl_realloc(f->fgcolorbuff, (newlen+1) * sizeof(short)); 80 f->bgcolorbuff=owl_realloc(f->bgcolorbuff, (newlen+1) * sizeof(short)); 33 f->textbuff = owl_realloc(f->textbuff, newlen + 1); 81 34 f->bufflen = newlen+1; 82 35 } 83 36 } 84 37 38 int _owl_fmtext_is_format_char(gunichar c) /*noproto*/ 39 { 40 if ((c & ~OWL_FMTEXT_UC_ATTR_MASK) == OWL_FMTEXT_UC_ATTR) return 1; 41 if ((c & ~(OWL_FMTEXT_UC_ALLCOLOR_MASK)) == OWL_FMTEXT_UC_COLOR_BASE) return 1; 42 return 0; 43 } 85 44 /* append text to the end of 'f' with attribute 'attr' and color 86 45 * 'color' 87 46 */ 88 void owl_fmtext_append_attr(owl_fmtext *f, char *text, int attr, int fgcolor, int bgcolor) 89 { 90 int newlen; 91 newlen=strlen(f->textbuff)+strlen(text); 47 void owl_fmtext_append_attr(owl_fmtext *f, char *text, char attr, short fgcolor, short bgcolor) 48 { 49 char attrbuff[6]; 50 int newlen, a = 0, fg = 0, bg = 0; 51 52 if (attr != OWL_FMTEXT_ATTR_NONE) a=1; 53 if (fgcolor != OWL_COLOR_DEFAULT) fg=1; 54 if (bgcolor != OWL_COLOR_DEFAULT) bg=1; 55 56 /* Plane-16 characters in UTF-8 are 4 bytes long. */ 57 newlen = strlen(f->textbuff) + strlen(text) + (8 * (a + fg + bg)); 92 58 _owl_fmtext_realloc(f, newlen); 59 60 /* Set attributes */ 61 if (a) { 62 memset(attrbuff,0,6); 63 g_unichar_to_utf8(OWL_FMTEXT_UC_ATTR | attr, attrbuff); 64 strcat(f->textbuff, attrbuff); 65 } 66 if (fg) { 67 memset(attrbuff,0,6); 68 g_unichar_to_utf8(OWL_FMTEXT_UC_FGCOLOR | fgcolor, attrbuff); 69 strcat(f->textbuff, attrbuff); 70 } 71 if (bg) { 72 memset(attrbuff,0,6); 73 g_unichar_to_utf8(OWL_FMTEXT_UC_BGCOLOR | bgcolor, attrbuff); 74 strcat(f->textbuff, attrbuff); 75 } 93 76 94 77 strcat(f->textbuff, text); 95 _owl_fmtext_set_attr(f, attr, f->textlen, newlen); 96 _owl_fmtext_set_fgcolor(f, fgcolor, f->textlen, newlen); 97 _owl_fmtext_set_bgcolor(f, bgcolor, f->textlen, newlen); 78 79 /* Reset attributes */ 80 if (bg) strcat(f->textbuff, OWL_FMTEXT_UTF8_BGDEFAULT); 81 if (fg) strcat(f->textbuff, OWL_FMTEXT_UTF8_FGDEFAULT); 82 if (a) strcat(f->textbuff, OWL_FMTEXT_UTF8_ATTR_NONE); 98 83 f->textlen=newlen; 99 84 } … … 129 114 } 130 115 131 /* Add the attribute 'attr' to alltext in 'f' */132 void owl_fmtext_addattr(owl_fmtext *f, intattr)116 /* Add the attribute 'attr' to the default atts for the text in 'f' */ 117 void owl_fmtext_addattr(owl_fmtext *f, char attr) 133 118 { 134 119 /* add the attribute to all text */ 135 int i, j; 136 137 j=f->textlen; 138 for (i=0; i<j; i++) { 139 f->fmbuff[i] |= attr; 140 } 141 } 142 143 /* Anywhere the color is NOT ALREDY SET, set the color to 'color'. 144 * Other colors are left unchanged 120 f->default_attrs |= attr; 121 } 122 123 /* Set the default foreground color for this fmtext to 'color'. 124 * Only affects text that is colored default. 145 125 */ 146 126 void owl_fmtext_colorize(owl_fmtext *f, int color) 147 127 { 148 /* everywhere the fgcolor is OWL_COLOR_DEFAULT, change it to be 'color' */ 149 int i, j; 150 151 j=f->textlen; 152 for(i=0; i<j; i++) { 153 if (f->fgcolorbuff[i]==OWL_COLOR_DEFAULT) f->fgcolorbuff[i] = (short)color; 154 } 155 } 156 128 f->default_fgcolor = color; 129 } 130 131 /* Set the default foreground color for this fmtext to 'color'. 132 * Only affects text that is colored default. 133 */ 157 134 void owl_fmtext_colorizebg(owl_fmtext *f, int color) 158 135 { 159 /* everywhere the bgcolor is OWL_COLOR_DEFAULT, change it to be 'color' */ 160 int i, j; 161 162 j=f->textlen; 163 for(i=0; i<j; i++) { 164 if (f->bgcolorbuff[i]==OWL_COLOR_DEFAULT) f->bgcolorbuff[i] = (short)color; 165 } 166 } 136 f->default_bgcolor = color; 137 } 138 139 /* Internal function. Parse attrbute character. */ 140 void _owl_fmtext_update_attributes(gunichar c, char *attr, short *fgcolor, short *bgcolor) /*noproto*/ 141 { 142 if ((c & OWL_FMTEXT_UC_ATTR) == OWL_FMTEXT_UC_ATTR) { 143 *attr = c & OWL_FMTEXT_UC_ATTR_MASK; 144 } 145 else if ((c & OWL_FMTEXT_UC_FGCOLOR) == OWL_FMTEXT_UC_FGCOLOR) { 146 *fgcolor = (c == OWL_FMTEXT_UC_FGDEFAULT 147 ? OWL_COLOR_DEFAULT 148 : c & OWL_FMTEXT_UC_COLOR_MASK); 149 } 150 else if ((c & OWL_FMTEXT_UC_BGCOLOR) == OWL_FMTEXT_UC_BGCOLOR) { 151 *bgcolor = (c == OWL_FMTEXT_UC_BGDEFAULT 152 ? OWL_COLOR_DEFAULT 153 : c & OWL_FMTEXT_UC_COLOR_MASK); 154 } 155 } 156 157 /* Internal function. Scan for attribute characters. */ 158 void _owl_fmtext_scan_attributes(owl_fmtext *f, int start, char *attr, short *fgcolor, short *bgcolor) /*noproto*/ 159 { 160 char *p; 161 p = strchr(f->textbuff, OWL_FMTEXT_UC_STARTBYTE_UTF8); 162 while (p && p < f->textbuff + start) { 163 _owl_fmtext_update_attributes(g_utf8_get_char(p), attr, fgcolor, bgcolor); 164 p = strchr(p+1, OWL_FMTEXT_UC_STARTBYTE_UTF8); 165 } 166 } 167 167 168 168 /* Internal function. Append text from 'in' between index 'start' and 169 169 * 'stop' to the end of 'f' 170 170 */ 171 void _owl_fmtext_append_fmtext(owl_fmtext *f, owl_fmtext *in, int start, int stop) 172 { 173 int newlen, i; 174 175 newlen=strlen(f->textbuff)+(stop-start+1); 171 void _owl_fmtext_append_fmtext(owl_fmtext *f, owl_fmtext *in, int start, int stop) /*noproto*/ 172 { 173 char attrbuff[6]; 174 int newlen, a = 0, fg = 0, bg = 0; 175 char attr = 0; 176 short fgcolor = OWL_COLOR_DEFAULT; 177 short bgcolor = OWL_COLOR_DEFAULT; 178 179 _owl_fmtext_scan_attributes(in, start, &attr, &fgcolor, &bgcolor); 180 if (attr != OWL_FMTEXT_ATTR_NONE) a=1; 181 if (fgcolor != OWL_COLOR_DEFAULT) fg=1; 182 if (bgcolor != OWL_COLOR_DEFAULT) bg=1; 183 184 /* We will reset to defaults after appending the text. We may need 185 to set initial attributes. */ 186 newlen=strlen(f->textbuff)+(stop-start+1) + (4 * (a + fg + bg)) + 12; 176 187 _owl_fmtext_realloc(f, newlen); 177 188 189 if (a) { 190 memset(attrbuff,0,6); 191 g_unichar_to_utf8(OWL_FMTEXT_UC_ATTR | attr, attrbuff); 192 strcat(f->textbuff, attrbuff); 193 } 194 if (fg) { 195 memset(attrbuff,0,6); 196 g_unichar_to_utf8(OWL_FMTEXT_UC_FGCOLOR | fgcolor, attrbuff); 197 strcat(f->textbuff, attrbuff); 198 } 199 if (bg) { 200 memset(attrbuff,0,6); 201 g_unichar_to_utf8(OWL_FMTEXT_UC_BGCOLOR | bgcolor, attrbuff); 202 strcat(f->textbuff, attrbuff); 203 } 204 178 205 strncat(f->textbuff, in->textbuff+start, stop-start+1); 206 207 /* Reset attributes */ 208 strcat(f->textbuff, OWL_FMTEXT_UTF8_BGDEFAULT); 209 strcat(f->textbuff, OWL_FMTEXT_UTF8_FGDEFAULT); 210 strcat(f->textbuff, OWL_FMTEXT_UTF8_ATTR_NONE); 211 179 212 f->textbuff[newlen]='\0'; 180 for (i=start; i<=stop; i++) {181 f->fmbuff[f->textlen+(i-start)]=in->fmbuff[i];182 f->fgcolorbuff[f->textlen+(i-start)]=in->fgcolorbuff[i];183 f->bgcolorbuff[f->textlen+(i-start)]=in->bgcolorbuff[i];184 }185 213 f->textlen=newlen; 186 214 } … … 207 235 char *owl_fmtext_print_plain(owl_fmtext *f) 208 236 { 209 return(owl_strdup(f->textbuff)); 210 } 211 237 char *r, *s, *p; 238 r = owl_malloc(f->bufflen); 239 r[0] = '\0'; 240 s = f->textbuff; 241 /* Find next possible format character. */ 242 p = strchr(s, OWL_FMTEXT_UC_STARTBYTE_UTF8); 243 while(p) { 244 /* If it's a format character, copy up to it, and skip all 245 immediately following format characters. */ 246 if (_owl_fmtext_is_format_char(g_utf8_get_char(p))) { 247 strncat(r, s, p-s); 248 p = g_utf8_next_char(p); 249 while (p && _owl_fmtext_is_format_char(g_utf8_get_char(p))) { 250 p = g_utf8_next_char(p); 251 } 252 s = p; 253 p = strchr(s, OWL_FMTEXT_UC_STARTBYTE_UTF8); 254 } 255 else { 256 p = strchr(p+1, OWL_FMTEXT_UC_STARTBYTE_UTF8); 257 } 258 } 259 if (s) strcat(r,s); 260 return(r); 261 } 262 263 void _owl_fmtext_wattrset(WINDOW *w, int attrs) /*noproto*/ 264 { 265 wattrset(w, A_NORMAL); 266 if (attrs & OWL_FMTEXT_ATTR_BOLD) wattron(w, A_BOLD); 267 if (attrs & OWL_FMTEXT_ATTR_REVERSE) wattron(w, A_REVERSE); 268 if (attrs & OWL_FMTEXT_ATTR_UNDERLINE) wattron(w, A_UNDERLINE); 269 } 212 270 /* add the formatted text to the curses window 'w'. The window 'w' 213 271 * must already be initiatlized with curses 214 272 */ 215 void owl_fmtext_curs_waddstr(owl_fmtext *f, WINDOW *w) 216 { 217 char *tmpbuff; 218 int position, trans1, trans2, trans3, len, lastsame; 219 273 void owl_fmtext_curs_waddstr(owl_fmtext *f, WINDOW *w, int do_search) 274 { 275 /* char *tmpbuff; */ 276 /* int position, trans1, trans2, trans3, len, lastsame; */ 277 char *s, *p; 278 char attr; 279 short fg, bg; 280 int search_results, search_len; 281 220 282 if (w==NULL) { 221 283 owl_function_debugmsg("Hit a null window in owl_fmtext_curs_waddstr."); … … 223 285 } 224 286 225 tmpbuff=owl_malloc(f->textlen+10); 226 227 position=0; 228 len=f->textlen; 229 while (position<=len) { 230 /* find the last char with the current format and color */ 231 trans1=owl_util_find_trans(f->fmbuff+position, len-position); 232 trans2=owl_util_find_trans_short(f->fgcolorbuff+position, len-position); 233 trans3=owl_util_find_trans_short(f->bgcolorbuff+position, len-position); 234 235 lastsame = (trans1 < trans2) ? trans1 : trans2; 236 lastsame = (lastsame < trans3) ? lastsame : trans3; 237 lastsame += position; 238 239 /* set the format */ 240 wattrset(w, A_NORMAL); 241 if (f->fmbuff[position] & OWL_FMTEXT_ATTR_BOLD) { 242 wattron(w, A_BOLD); 243 } 244 if (f->fmbuff[position] & OWL_FMTEXT_ATTR_REVERSE) { 245 wattron(w, A_REVERSE); 246 } 247 if (f->fmbuff[position] & OWL_FMTEXT_ATTR_UNDERLINE) { 248 wattron(w, A_UNDERLINE); 249 } 250 251 /* set the color */ 252 /* warning, this is sort of a hack */ 253 if (owl_global_get_hascolors(&g)) { 254 short fg, bg, pair; 255 fg = f->fgcolorbuff[position]; 256 bg = f->bgcolorbuff[position]; 257 258 pair = owl_fmtext_get_colorpair(fg, bg); 259 if (pair != -1) { 260 wcolor_set(w,pair,NULL); 261 } 262 } 263 264 /* add the text */ 265 strncpy(tmpbuff, f->textbuff + position, lastsame-position+1); 266 tmpbuff[lastsame-position+1]='\0'; 267 waddstr(w, tmpbuff); 268 269 position=lastsame+1; 270 } 271 owl_free(tmpbuff); 287 search_results = (do_search 288 ? owl_fmtext_search(f, owl_global_get_search_string(&g)) 289 : NULL); 290 if (search_results) search_len = strlen(owl_global_get_search_string(&g)); 291 s = f->textbuff; 292 /* Set default attributes. */ 293 attr = f->default_attrs; 294 fg = f->default_fgcolor; 295 bg = f->default_bgcolor; 296 _owl_fmtext_wattrset(w, attr); 297 if (owl_global_get_hascolors(&g)) { 298 short pair; 299 pair = owl_fmtext_get_colorpair(fg, bg); 300 if (pair != -1) { 301 wcolor_set(w,pair,NULL); 302 } 303 } 304 305 /* Find next possible format character. */ 306 p = strchr(s, OWL_FMTEXT_UC_STARTBYTE_UTF8); 307 while(p) { 308 if (_owl_fmtext_is_format_char(g_utf8_get_char(p))) { 309 /* Deal with all text from last insert to here. */ 310 char tmp; 311 312 tmp = p[0]; 313 p[0] = '\0'; 314 if (search_results) { 315 /* Search is active, so highlight search results. */ 316 char tmp2, *ss; 317 ss = stristr(s, owl_global_get_search_string(&g)); 318 while (ss) { 319 /* Found search string, highlight it. */ 320 321 tmp2 = ss[0]; 322 ss[0] = '\0'; 323 waddstr(w, s); 324 ss[0] = tmp2; 325 326 _owl_fmtext_wattrset(w,attr ^ A_REVERSE); 327 328 tmp2 = ss[search_len]; 329 ss[search_len] = '\0'; 330 waddstr(w, ss); 331 ss[search_len] = tmp2; 332 333 _owl_fmtext_wattrset(w,attr); 334 335 s = ss + search_len; 336 ss = stristr(s, owl_global_get_search_string(&g)); 337 } 338 } 339 /* Deal with remaining part of string. */ 340 waddstr(w, s); 341 p[0] = tmp; 342 343 /* Deal with new attributes. Initialize to defaults, then 344 process all consecutive formatting characters. */ 345 attr = f->default_attrs; 346 fg = f->default_fgcolor; 347 bg = f->default_bgcolor; 348 while (p && _owl_fmtext_is_format_char(g_utf8_get_char(p))) { 349 _owl_fmtext_update_attributes(g_utf8_get_char(p), &attr, &fg, &bg); 350 p = g_utf8_next_char(p); 351 } 352 _owl_fmtext_wattrset(w, attr | f->default_attrs); 353 if (owl_global_get_hascolors(&g)) { 354 if (fg == OWL_COLOR_DEFAULT) fg = f->default_fgcolor; 355 if (bg == OWL_COLOR_DEFAULT) bg = f->default_bgcolor; 356 short pair; 357 pair = owl_fmtext_get_colorpair(fg, bg); 358 if (pair != -1) { 359 wcolor_set(w,pair,NULL); 360 } 361 } 362 /* Advance to next non-formatting character. */ 363 s = p; 364 p = strchr(s, OWL_FMTEXT_UC_STARTBYTE_UTF8); 365 } 366 else { 367 p = strchr(p+1, OWL_FMTEXT_UC_STARTBYTE_UTF8); 368 } 369 } 370 if (s) { 371 waddstr(w, s); 372 } 272 373 } 273 374 … … 282 383 283 384 /* find the starting line */ 284 ptr1=in->textbuff; 285 if (aline!=0) { 286 for (i=0; i<aline; i++) { 287 ptr1=strchr(ptr1, '\n'); 288 if (!ptr1) return(-1); 289 ptr1++; 290 } 291 } 385 ptr1 = in->textbuff; 386 for (i = 0; i < aline; i++) { 387 ptr1 = strchr(ptr1, '\n'); 388 if (!ptr1) return(-1); 389 ptr1++; 390 } 391 292 392 /* ptr1 now holds the starting point */ 293 393 294 394 /* copy in the next 'lines' lines */ 295 if (lines <1) return(-1);296 297 for (i =0; i<lines; i++) {298 offset =ptr1-in->textbuff;299 ptr2 =strchr(ptr1, '\n');395 if (lines < 1) return(-1); 396 397 for (i = 0; i < lines; i++) { 398 offset = ptr1 - in->textbuff; 399 ptr2 = strchr(ptr1, '\n'); 300 400 if (!ptr2) { 301 _owl_fmtext_append_fmtext(out, in, offset, (in->textlen) -1);401 _owl_fmtext_append_fmtext(out, in, offset, (in->textlen) - 1); 302 402 return(-1); 303 403 } 304 _owl_fmtext_append_fmtext(out, in, offset, (ptr2 -ptr1)+offset);305 ptr1 =ptr2+1;404 _owl_fmtext_append_fmtext(out, in, offset, (ptr2 - ptr1) + offset); 405 ptr1 = ptr2 + 1; 306 406 } 307 407 return(0); … … 315 415 void owl_fmtext_truncate_cols(owl_fmtext *in, int acol, int bcol, owl_fmtext *out) 316 416 { 317 char *ptr 1, *ptr2, *last;318 int len, offset;417 char *ptr_s, *ptr_e, *ptr_c, *last; 418 int col, st, padding, chwidth; 319 419 320 420 last=in->textbuff+in->textlen-1; 321 ptr 1=in->textbuff;322 while (ptr 1<=last) {323 ptr 2=strchr(ptr1, '\n');324 if (!ptr 2) {421 ptr_s=in->textbuff; 422 while (ptr_s <= last) { 423 ptr_e=strchr(ptr_s, '\n'); 424 if (!ptr_e) { 325 425 /* but this shouldn't happen if we end in a \n */ 326 426 break; 327 427 } 328 428 329 if (ptr 2==ptr1) {429 if (ptr_e == ptr_s) { 330 430 owl_fmtext_append_normal(out, "\n"); 331 ptr1++;431 ++ptr_s; 332 432 continue; 333 433 } 334 434 335 /* we need to check that we won't run over here */ 336 len=bcol-acol; 337 if (len > (ptr2-(ptr1+acol))) { 338 /* the whole line fits with room to spare, don't take a full 'len' */ 339 len=ptr2-(ptr1+acol); 340 } 341 if (len>last-ptr1) { 342 /* the whole rest of the text fits with room to spare, adjust for it */ 343 len-=(last-ptr1); 344 } 345 if (len<=0) { 346 /* saftey check */ 435 col = 0; 436 st = 0; 437 padding = 0; 438 ptr_c = ptr_s; 439 while(col <= bcol && ptr_c < ptr_e) { 440 gunichar c = g_utf8_get_char(ptr_c); 441 if (!_owl_fmtext_is_format_char(c)) { 442 chwidth = wcwidth(c); 443 444 if (col + chwidth > bcol) 445 break; 446 if (col >= acol) { 447 if (st == 0) { 448 ptr_s = ptr_c; 449 padding = col - acol; 450 ++st; 451 } 452 } 453 col += chwidth; 454 chwidth = 0; 455 } 456 ptr_c = g_utf8_next_char(ptr_c); 457 } 458 if (st) { 459 /* lead padding */ 460 owl_fmtext_append_spaces(out, padding); 461 if (ptr_c[0] & 0x80) { 462 if (col + chwidth == bcol) 463 ptr_c = g_utf8_next_char(ptr_c); 464 _owl_fmtext_append_fmtext(out, in, ptr_s - in->textbuff, ptr_c - 1 - in->textbuff); 465 owl_fmtext_append_normal(out, "\n"); 466 } 467 else { 468 _owl_fmtext_append_fmtext(out, in, ptr_s - in->textbuff, ptr_c - in->textbuff); 469 } 470 } 471 else { 347 472 owl_fmtext_append_normal(out, "\n"); 348 ptr1=ptr2+1; 349 continue; 350 } 351 352 offset=ptr1-in->textbuff; 353 _owl_fmtext_append_fmtext(out, in, offset+acol, offset+acol+len); 354 355 ptr1=ptr2+1; 473 } 474 ptr_s = g_utf8_next_char(ptr_e); 356 475 } 357 476 } … … 381 500 382 501 /* set the charater at 'index' to be 'char'. If index is out of 383 * bounds don't do anything */ 384 void owl_fmtext_set_char(owl_fmtext *f, int index, int ch) 502 * bounds don't do anything. If c or char at index is not ASCII, don't 503 * do anything because it's not UTF-8 safe. */ 504 void owl_fmtext_set_char(owl_fmtext *f, int index, char ch) 385 505 { 386 506 if ((index < 0) || (index > f->textlen-1)) return; 507 /* NOT ASCII*/ 508 if (f->textbuff[index] & 0x80 || ch & 0x80) return; 387 509 f->textbuff[index]=ch; 388 510 } … … 400 522 dst->textlen=src->textlen; 401 523 dst->textbuff=owl_malloc(mallocsize); 402 dst->fmbuff=owl_malloc(mallocsize);403 dst->fgcolorbuff=owl_malloc(mallocsize * sizeof(short));404 dst->bgcolorbuff=owl_malloc(mallocsize * sizeof(short));405 524 memcpy(dst->textbuff, src->textbuff, src->textlen+1); 406 memcpy(dst->fmbuff, src->fmbuff, src->textlen); 407 memcpy(dst->fgcolorbuff, src->fgcolorbuff, src->textlen * sizeof(short)); 408 memcpy(dst->bgcolorbuff, src->bgcolorbuff, src->textlen * sizeof(short)); 409 } 410 411 /* highlight all instances of "string". Return the number of 412 * instances found. This is a case insensitive search. 413 */ 414 int owl_fmtext_search_and_highlight(owl_fmtext *f, char *string) 415 { 416 417 int found, len; 418 char *ptr1, *ptr2; 419 420 len=strlen(string); 421 found=0; 422 ptr1=f->textbuff; 423 while (ptr1-f->textbuff <= f->textlen) { 424 ptr2=stristr(ptr1, string); 425 if (!ptr2) return(found); 426 427 found++; 428 _owl_fmtext_add_attr(f, OWL_FMTEXT_ATTR_REVERSE, 429 ptr2 - f->textbuff, 430 ptr2 - f->textbuff + len - 1); 431 432 ptr1=ptr2+len; 433 } 434 return(found); 525 dst->default_attrs = src->default_attrs; 526 dst->default_fgcolor = src->default_fgcolor; 527 dst->default_bgcolor = src->default_bgcolor; 435 528 } 436 529 … … 440 533 int owl_fmtext_search(owl_fmtext *f, char *string) 441 534 { 442 443 535 if (stristr(f->textbuff, string)) return(1); 444 536 return(0); … … 681 773 { 682 774 if (f->textbuff) owl_free(f->textbuff); 683 if (f->fmbuff) owl_free(f->fmbuff);684 if (f->fgcolorbuff) owl_free(f->fgcolorbuff);685 if (f->bgcolorbuff) owl_free(f->bgcolorbuff);686 775 } 687 776 -
functions.c
r3939268 r28ee32b 2598 2598 } 2599 2599 /* downcase it */ 2600 downstr(filtname); 2600 { 2601 char *temp = g_utf8_strdown(filtname, -1); 2602 if (temp) { 2603 owl_free(filtname); 2604 filtname = temp; 2605 } 2606 } 2601 2607 /* turn spaces, single quotes, and double quotes into dots */ 2602 2608 owl_text_tr(filtname, ' ', '.'); … … 3023 3029 char *quoted; 3024 3030 3025 buff= malloc(strlen(class)+strlen(inst)+strlen(recip)+100);3031 buff=owl_malloc(strlen(class)+strlen(inst)+strlen(recip)+100); 3026 3032 strcpy(buff, "class"); 3027 3033 if (!strcmp(class, "*")) { … … 3327 3333 if (ret==0) { 3328 3334 for (x=0; x<numlocs; x++) { 3329 line= malloc(strlen(location[x].host)+strlen(location[x].time)+strlen(location[x].tty)+100);3335 line=owl_malloc(strlen(location[x].host)+strlen(location[x].time)+strlen(location[x].tty)+100); 3330 3336 tmp=short_zuser(user); 3331 3337 sprintf(line, " %-10.10s %-24.24s %-12.12s %20.20s\n", … … 3433 3439 _exit(127); 3434 3440 } 3435 parsed= realloc(parsed, sizeof(*parsed) * (myargc+1));3441 parsed=owl_realloc(parsed, sizeof(*parsed) * (myargc+1)); 3436 3442 parsed[myargc] = NULL; 3437 3443 -
global.c
rad15610 r93ee554 545 545 len+=strlen(argv[i])+5; 546 546 } 547 g->startupargs= malloc(len+5);547 g->startupargs=owl_malloc(len+5); 548 548 549 549 strcpy(g->startupargs, ""); -
logging.c
rd0961fe r28ee32b 155 155 to = owl_sprintf("jabber:%s", owl_message_get_recipient(m)); 156 156 } else if (owl_message_is_type_aim(m)) { 157 char *temp2; 157 158 temp = owl_aim_normalize_screenname(owl_message_get_recipient(m)); 158 downstr(temp); 159 to = owl_sprintf("aim:%s", temp); 159 temp2 = g_utf8_strdown(temp,-1); 160 to = owl_sprintf("aim:%s", temp2); 161 owl_free(temp2); 160 162 owl_free(temp); 161 163 } else { … … 267 269 } else if (owl_message_is_type_aim(m)) { 268 270 /* we do not yet handle chat rooms */ 269 char *normalto ;270 normalto=owl_aim_normalize_screenname(owl_message_get_sender(m));271 downstr(normalto);271 char *normalto, *temp; 272 temp = owl_aim_normalize_screenname(owl_message_get_sender(m)); 273 normalto = g_utf8_strdown(temp, -1); 272 274 from=frombuff=owl_sprintf("aim:%s", normalto); 273 275 owl_free(normalto); 276 owl_free(temp); 274 277 } else if (owl_message_is_type_loopback(m)) { 275 278 from=frombuff=owl_strdup("loopback"); … … 290 293 291 294 ch=frombuff[0]; 292 if (! isalnum(ch)) from="weird";295 if (!g_ascii_isalnum(ch)) from="weird"; 293 296 294 297 for (i=0; i<len; i++) { … … 299 302 300 303 if (!personal) { 301 if (strcmp(from, "weird")) downstr(from); 304 if (strcmp(from, "weird")) { 305 char* temp = g_utf8_strdown(frombuff, -1); 306 if (temp) { 307 owl_free(frombuff); 308 from = frombuff = temp; 309 } 310 } 302 311 } 303 312 -
message.c
r6711361 r9866c3a 493 493 { 494 494 if(m->zwriteline) owl_free(m->zwriteline); 495 m->zwriteline= strdup(line);495 m->zwriteline=owl_strdup(line); 496 496 } 497 497 … … 537 537 owl_fmtext_truncate_lines(&(m->fmtext->fmtext), aline, bline-aline+1, &a); 538 538 owl_fmtext_truncate_cols(&a, acol, bcol, &b); 539 if (fgcolor!=OWL_COLOR_DEFAULT) { 540 owl_fmtext_colorize(&b, fgcolor); 541 } 542 if (bgcolor!=OWL_COLOR_DEFAULT) { 543 owl_fmtext_colorizebg(&b, bgcolor); 544 } 545 546 if (owl_global_is_search_active(&g)) { 547 owl_fmtext_search_and_highlight(&b, owl_global_get_search_string(&g)); 548 } 549 550 owl_fmtext_curs_waddstr(&b, win); 539 owl_fmtext_colorize(&b, fgcolor); 540 owl_fmtext_colorizebg(&b, bgcolor); 541 542 owl_fmtext_curs_waddstr(&b, win, owl_global_is_search_active(&g)); 551 543 552 544 owl_fmtext_free(&a); … … 890 882 } 891 883 892 m->zwriteline= strdup("");884 m->zwriteline=owl_strdup(""); 893 885 894 886 /* save the hostname */ … … 972 964 } 973 965 974 m->zwriteline= strdup("");966 m->zwriteline=owl_strdup(""); 975 967 976 968 owl_message_set_body(m, "<uninitialized>"); -
owl.c
r89f5338 r5bc0f68 48 48 #include <termios.h> 49 49 #include <sys/stat.h> 50 #include <locale.h> 50 51 #include "owl.h" 51 52 … … 92 93 debug=0; 93 94 initialsubs=1; 95 96 setlocale(LC_ALL, ""); 97 94 98 if (argc>0) { 95 99 argv++; -
owl.h
r18e28a4 r9866c3a 52 52 #include <termios.h> 53 53 #include <libfaim/aim.h> 54 #include <wchar.h> 54 55 #include "config.h" 56 #include "glib.h" 55 57 #ifdef HAVE_LIBZEPHYR 56 58 #include <zephyr/zephyr.h> … … 98 100 #define OWL_FMTEXT_ATTR_REVERSE 2 99 101 #define OWL_FMTEXT_ATTR_UNDERLINE 4 102 103 #define OWL_FMTEXT_UC_BASE 0x100000 /* Unicode Plane 16 - Supplementary Private Use Area-B*/ 104 #define OWL_FMTEXT_UC_ATTR ( OWL_FMTEXT_UC_BASE | 0x800 ) 105 #define OWL_FMTEXT_UC_ATTR_MASK 0x7 106 #define OWL_FMTEXT_UC_COLOR_BASE ( OWL_FMTEXT_UC_BASE | 0x400 ) 107 #define OWL_FMTEXT_UC_FGCOLOR OWL_FMTEXT_UC_COLOR_BASE 108 #define OWL_FMTEXT_UC_BGCOLOR ( OWL_FMTEXT_UC_COLOR_BASE | 0x200 ) 109 #define OWL_FMTEXT_UC_DEFAULT_COLOR 0x100 110 #define OWL_FMTEXT_UC_FGDEFAULT ( OWL_FMTEXT_UC_FGCOLOR | OWL_FMTEXT_UC_DEFAULT_COLOR ) 111 #define OWL_FMTEXT_UC_BGDEFAULT ( OWL_FMTEXT_UC_BGCOLOR | OWL_FMTEXT_UC_DEFAULT_COLOR ) 112 #define OWL_FMTEXT_UC_COLOR_MASK 0xFF 113 #define OWL_FMTEXT_UC_ALLCOLOR_MASK ( OWL_FMTEXT_UC_COLOR_MASK | OWL_FMTEXT_UC_DEFAULT_COLOR | 0x200) 114 #define OWL_FMTEXT_UC_STARTBYTE_UTF8 '\xf4' 115 116 #define OWL_FMTEXT_UTF8_ATTR_NONE "\xf4\x80\xa0\x80" 117 #define OWL_FMTEXT_UTF8_FGDEFAULT "\xf4\x80\x94\x80" 118 #define OWL_FMTEXT_UTF8_BGDEFAULT "\xf4\x80\x96\x80" 119 120 121 100 122 101 123 #define OWL_COLOR_BLACK 0 … … 254 276 int bufflen; 255 277 char *textbuff; 256 char *fmbuff;257 short *fgcolorbuff;258 short *bgcolorbuff;278 char default_attrs; 279 short default_fgcolor; 280 short default_bgcolor; 259 281 } owl_fmtext; 260 282 -
text.c
r72db971 rdd24b6a 50 50 void owl_text_truncate_cols(char *out, char *in, int acol, int bcol) 51 51 { 52 char *ptr 1, *ptr2, *tmpbuff, *last;53 int len;54 52 char *ptr_s, *ptr_e, *ptr_c, *tmpbuff, *last; 53 int col, cnt, padding; 54 55 55 tmpbuff=owl_malloc(strlen(in)+20); 56 56 57 57 strcpy(tmpbuff, ""); 58 58 last=in+strlen(in)-1; 59 ptr 1=in;60 while (ptr 1<last) {61 ptr 2=strchr(ptr1, '\n');62 if (!ptr 2) {59 ptr_s=in; 60 while (ptr_s<last) { 61 ptr_e=strchr(ptr_s, '\n'); 62 if (!ptr_e) { 63 63 /* but this shouldn't happen if we end in a \n */ 64 64 break; 65 65 } 66 66 67 if (ptr 2==ptr1) {67 if (ptr_e==ptr_s) { 68 68 strcat(tmpbuff, "\n"); 69 ptr1++; 70 continue; 71 } 72 69 ptr_s++; 70 continue; 71 } 72 73 col = 0; 74 cnt = 0; 75 padding = 0; 76 ptr_c = ptr_s; 77 while(col < bcol && ptr_c < ptr_e) { 78 gunichar c = g_utf8_get_char(ptr_c); 79 if (col + wcwidth(c) > bcol) break; 80 col += wcwidth(c); 81 ptr_c = g_utf8_next_char(ptr_c); 82 if (col >= acol) { 83 if (cnt == 0) { 84 ptr_s = ptr_c; 85 padding = col - acol; 86 } 87 ++cnt; 88 } 89 } 90 if (cnt) { 91 while(padding-- > 0) { 92 strcat(tmpbuff, " "); 93 } 94 strncat(tmpbuff, ptr_s, ptr_c - ptr_s - 1); 95 } 96 strcat(tmpbuff, "\n"); 97 ptr_s = ptr_e + 1; 98 #if 0 73 99 /* we need to check that we won't run over here */ 74 if ( (ptr 2-ptr1) < (bcol-acol) ) {75 len=ptr 2-(ptr1+acol);100 if ( (ptr_e-ptr_s) < (bcol-acol) ) { 101 len=ptr_e-(ptr_s+acol); 76 102 } else { 77 103 len=bcol-acol; 78 104 } 79 if ((ptr 1+len)>=last) {80 len-=last-(ptr 1+len);81 } 82 83 strncat(tmpbuff, ptr 1+acol, len);105 if ((ptr_s+len)>=last) { 106 len-=last-(ptr_s+len); 107 } 108 109 strncat(tmpbuff, ptr_s+acol, len); 84 110 strcat(tmpbuff, "\n"); 85 111 86 ptr1=ptr2+1; 112 ptr_s=ptr_e+1; 113 #endif 87 114 } 88 115 strcpy(out, tmpbuff); … … 275 302 char *stristr(char *a, char *b) 276 303 { 277 char *x, *y, *ret; 278 279 if ((x=owl_strdup(a))==NULL) return(NULL); 280 if ((y=owl_strdup(b))==NULL) return(NULL); 281 downstr(x); 282 downstr(y); 283 ret=strstr(x, y); 284 if (ret==NULL) { 285 owl_free(x); 286 owl_free(y); 287 return(NULL); 288 } 289 ret=ret-x+a; 290 owl_free(x); 291 owl_free(y); 304 char *x, *y; 305 char *ret = NULL; 306 if ((x = g_utf8_casefold(a, -1)) != NULL) { 307 if ((y = g_utf8_casefold(b, -1)) != NULL) { 308 ret = strstr(x, y); 309 if (ret != NULL) { 310 ret = ret - x + a; 311 } 312 g_free(y); 313 } 314 g_free(x); 315 } 292 316 return(ret); 293 317 } … … 296 320 int only_whitespace(char *s) 297 321 { 298 int i; 299 for (i=0; s[i]; i++) { 300 if (!isspace((int) s[i])) return(0); 322 if (g_utf8_validate(s,-1,NULL)) { 323 char *p; 324 for(p = s; p[0]; p=g_utf8_next_char(p)) { 325 if (!g_unichar_isspace(g_utf8_get_char(p))) return 0; 326 } 327 } 328 else { 329 int i; 330 for (i=0; s[i]; i++) { 331 if (!isspace((int) s[i])) return(0); 332 } 301 333 } 302 334 return(1); … … 327 359 tolen = strlen(to); 328 360 fromlen = strlen(from); 329 out = malloc(outlen);361 out = owl_malloc(outlen); 330 362 331 363 while (in[inpos]) { -
util.c
r89f5338 r28ee32b 399 399 } 400 400 401 /* downcase the string 'foo' */402 void downstr(char *foo)403 {404 int i;405 for (i=0; foo[i]!='\0'; i++) {406 foo[i]=tolower(foo[i]);407 }408 }409 410 401 /* Caller must free response. 411 402 * Takes in strings which are space-separated lists of tokens … … 446 437 void *owl_malloc(size_t size) 447 438 { 448 return( malloc(size));439 return(g_malloc(size)); 449 440 } 450 441 451 442 void owl_free(void *ptr) 452 443 { 453 free(ptr);444 g_free(ptr); 454 445 } 455 446 456 447 char *owl_strdup(const char *s1) 457 448 { 458 return( strdup(s1));449 return(g_strdup(s1)); 459 450 } 460 451 461 452 void *owl_realloc(void *ptr, size_t size) 462 453 { 463 return( realloc(ptr, size));454 return(g_realloc(ptr, size)); 464 455 } 465 456 466 457 /* allocates memory and returns the string or null. 467 458 * caller must free the string. 468 * from Linux sprintf man page.469 459 */ 470 460 char *owl_sprintf(const char *fmt, ...) 471 461 { 472 int n, size = 100;473 char *p;474 462 va_list ap; 475 if ((p = owl_malloc (size)) == NULL) return (NULL); 476 while (1) { 477 /* Try to print in the allocated space. */ 478 va_start(ap, fmt); 479 n = vsnprintf (p, size, fmt, ap); 480 va_end(ap); 481 /* If that worked, return the string. */ 482 if (n > -1 && n < size) 483 return p; 484 /* Else try again with more space. */ 485 if (n > -1) /* glibc 2.1 */ 486 size = n+1; /* precisely what is needed */ 487 else /* glibc 2.0 */ 488 size *= 2; /* twice the old size */ 489 if ((p = owl_realloc (p, size)) == NULL) 490 return NULL; 491 } 492 } 463 char *ret = NULL; 464 va_start(ap, fmt); 465 ret = g_strdup_vprintf(fmt, ap); 466 va_end(ap); 467 return ret; 468 } 469 493 470 494 471 /* Return the owl color associated with the named color. Return -1 -
viewwin.c
r8721756 r9866c3a 73 73 owl_fmtext_truncate_cols(&fm1, v->rightshift, v->wincols-1+v->rightshift, &fm2); 74 74 75 owl_fmtext_curs_waddstr(&fm2, v->curswin );75 owl_fmtext_curs_waddstr(&fm2, v->curswin, 0); 76 76 77 77 /* print the message at the bottom */ -
zcrypt.c
r9ceee9d r34509d5 385 385 386 386 /* Build a space-separated string from argv from elements between start * 387 * and end - 1. malloc()'s the returned string. */387 * and end - 1. owl_malloc()'s the returned string. */ 388 388 char *BuildArgString(char **argv, int start, int end) { 389 389 int len = 1; … … 397 397 398 398 /* Allocate memory */ 399 result = (char *) malloc(len);399 result = (char *)owl_malloc(len); 400 400 if (result) { 401 401 /* Build the string */ … … 482 482 /* Prepare result to be returned */ 483 483 char *temp = keyfile; 484 keyfile = (char *) malloc(strlen(temp) + 1);484 keyfile = (char *)owl_malloc(strlen(temp) + 1); 485 485 if (keyfile) { 486 486 strcpy(keyfile, temp); … … 611 611 } 612 612 use_buffer = TRUE; 613 if ((inptr = inbuff = (char *) malloc(MAX_RESULT)) == NULL) {613 if ((inptr = inbuff = (char *)owl_malloc(MAX_RESULT)) == NULL) { 614 614 printf("Memory allocation error\n"); 615 615 return FALSE; … … 639 639 printf("Could not run zwrite\n"); 640 640 if (freein && inbuff) { 641 free(inbuff);641 owl_free(inbuff); 642 642 } 643 643 return(FALSE); … … 685 685 686 686 /* Free the input buffer, if necessary */ 687 if (freein && inbuff) free(inbuff);687 if (freein && inbuff) owl_free(inbuff); 688 688 689 689 return(!error); -
zwrite.c
r1fe100c r93ee554 95 95 z->message=owl_strdup(""); 96 96 while (myargc) { 97 z->message= realloc(z->message, strlen(z->message)+strlen(myargv[0])+5);97 z->message=owl_realloc(z->message, strlen(z->message)+strlen(myargv[0])+5); 98 98 strcat(z->message, myargv[0]); 99 99 strcat(z->message, " "); … … 113 113 } else { 114 114 /* anything unattached is a recipient */ 115 owl_list_append_element(&(z->recips), strdup(myargv[0]));115 owl_list_append_element(&(z->recips), owl_strdup(myargv[0])); 116 116 myargv++; 117 117 myargc--; … … 177 177 z->zsig=owl_strdup(zsigzvar); 178 178 } else if (((pw=getpwuid(getuid()))!=NULL) && (pw->pw_gecos)) { 179 z->zsig= strdup(pw->pw_gecos);179 z->zsig=owl_strdup(pw->pw_gecos); 180 180 ptr=strchr(z->zsig, ','); 181 181 if (ptr) {
Note: See TracChangeset
for help on using the changeset viewer.