Subject: Pine 4.56 code cleanup (remove unused code, patch 1 of 3+)

From: Bernhard Kaindl <[email-masked]>
Date: Sun, 1 Jun 2003 13:32:32 +0200

Hi,

I did a quick review of the diff from pine4.55 to pine 4.56 and found this:

 /*
  * Paint the signature.
- *
- * Patch contributed by Nicolas Christin <[email-masked]>, 2003
  */
 int
 color_signature(linenum, line, ins, is_in_sig)

(I twisted this address above for spam)

I think such notices should not be removed except if Nicolas approved/reqested
it.

However, this inspried me to do a little bit more, actual code cleanup:

-Wunused gives such masses of undefined warnings that you don't see your
own in case you have some while writing your code.

Another item is that rfc1522_decode() has an argument called charset in
which the first charset found is returned, but many places don't need it
and pass NULL in place which is checked by rfc1522_decode() and does not
return the charset at the NULL pointer :-)

However, much code has not seen the cleanup to not pass a dummy pointer
to it and free it afterwards... :-(

The attached patch contains the fixes for the obvious -Wunused warnings
within the directory pine4.56/pine and the removal of the obsolete dummy
variable passing and freeing.

Please apply this safe cleanup to your RCS/CVS,
thanks
Bernd

PS: I don't understand why contributors like Nicolas Christin are not
mentioned in the version changelog on the web and the announces(just
name, not email) to show that there are actually people contributing
which could potentially motivate others to contribute to pine.

--- pine4.56/pine/addrbook.c
+++ cleanup1/pine/addrbook.c
@@ -3461,5 +3461,5 @@
 		  /* Have to rfc1522_decode the addr */
 		  if(addr){
-		      char    *tmp_a_string, *p, *dummy = NULL;
+		      char    *tmp_a_string, *p;
 		      ADDRESS *a = NULL;
 
@@ -3493,5 +3493,5 @@
 			  p = (char *)fs_get(len * sizeof(char));
 			  if(rfc1522_decode((unsigned char *)p,
-					    len, addr, &dummy)
+					    len, addr, NULL)
 						      == (unsigned char *)p){
 			      fs_give((void **)&addr);
@@ -3500,7 +3500,4 @@
 			  else
 			    fs_give((void **)&p);
-			  
-			  if(dummy)
-			    fs_give((void **)&dummy);
 		      }
 		  }
@@ -4955,5 +4952,4 @@
 
 	  default:
-          bleep:
 	    bogus_command(c, F_ON(F_USE_FK, ps) ? "F1" : "?");
 	    break;
--- pine4.56/pine/adrbkcmd.c
+++ cleanup1/pine/adrbkcmd.c
@@ -181,5 +181,4 @@
     dprint(5, (debugfile, "- view_abook_entry -\n"));
 
-repaint_view:
     if(is_addr(cur_line)){
 	abe = ae(cur_line);
@@ -397,7 +396,4 @@
 	 * and end up back out at the index of entries screen.
 	 */
-    /*****
-	goto repaint_view;
-      *****/
     }
 
@@ -932,5 +928,5 @@
     int rc = 0, resort_happened = 0, list_changed = 0, which_addrbook;
     int editor_result, i = 0, add, n_end, ldap = 0;
-    char *nick, *full, *fcc, *comment, *dcomment, *fname, *dummy, *pp;
+    char *nick, *full, *fcc, *comment, *dcomment, *fname, *pp;
     char **orig_encoded = NULL, **orig_decoded = NULL;
     char **new_encoded = NULL, **new_decoded = NULL;
@@ -1047,13 +1043,9 @@
     he[N_NICK].realaddr = &nick;
 
-    dummy = NULL;
     full = cpystr((char *)rfc1522_decode((unsigned char *)tmp_20k_buf+10000,
 					 SIZEOF_20KBUF-10000,
-				         abe->fullname, &dummy));
+				         abe->fullname, NULL));
     removing_leading_and_trailing_white_space(full);
 
-    if(dummy)
-      fs_give((void **)&dummy);
-
     he[N_FULL]          = headents_for_edit[N_FULL];
     he[N_FULL].realaddr = &full;
@@ -1073,8 +1065,5 @@
     }
     
-    dummy = NULL;
-    dcomment = (char *)rfc1522_decode(ptmp, len, abe->extra, &dummy);
-    if(dummy)
-      fs_give((void **)&dummy);
+    dcomment = (char *)rfc1522_decode(ptmp, len, abe->extra, NULL);
 
     comment = cpystr(dcomment);
@@ -1363,9 +1352,6 @@
 	    len = strlen(fname)+1;
 	    decodebuf = (char *)fs_get(len * sizeof(char));
-	    dummy = NULL;
 	    decode = (char *)rfc1522_decode((unsigned char *)decodebuf, len,
-					    fname, &dummy);
-	    if(dummy)
-	      fs_give((void **)&dummy);
+					    fname, NULL);
 
 	    q_status_message4(SM_ORDER, 5, 9,
--- pine4.56/pine/adrbklib.c
+++ cleanup1/pine/adrbklib.c
@@ -7096,5 +7096,4 @@
     else{
 	register char *p, *q, *r, *s;
-	char *dummy = NULL;
 
 	p = (*x)->fullname;
@@ -7107,14 +7106,8 @@
 
 	r = (char *)rfc1522_decode((unsigned char *)tmp_20k_buf,
-				   SIZEOF_20KBUF, p, &dummy);
-	if(dummy){
-	    fs_give((void **)&dummy);
-	    dummy = NULL;
-	}
+				   SIZEOF_20KBUF, p, NULL);
 	
 	s = (char *)rfc1522_decode((unsigned char *)tmp_20k_buf+10000,
-				   SIZEOF_20KBUF-10000, q, &dummy);
-	if(dummy)
-	  fs_give((void **)&dummy);
+				   SIZEOF_20KBUF-10000, q, NULL);
 
 	result = (*pcollator)(r, s);
@@ -7167,5 +7160,4 @@
     int result;
     register char *p, *q, *r, *s;
-    char *dummy = NULL;
 
     p = (*x)->fullname;
@@ -7178,14 +7170,8 @@
 
     r = (char *)rfc1522_decode((unsigned char *)tmp_20k_buf,
-			       SIZEOF_20KBUF, p, &dummy);
-    if(dummy){
-	fs_give((void **)&dummy);
-	dummy = NULL;
-    }
+			       SIZEOF_20KBUF, p, NULL);
     
     s = (char *)rfc1522_decode((unsigned char *)tmp_20k_buf+10000,
-			       SIZEOF_20KBUF-10000, q, &dummy);
-    if(dummy)
-      fs_give((void **)&dummy);
+			       SIZEOF_20KBUF-10000, q, NULL);
 
     result = (*pcollator)(r, s);
@@ -7325,5 +7311,4 @@
     char *x = *(char **)a1, *y = *(char **)a2;
     char *r, *s;
-    char *dummy = NULL;
 
     if(x && *x == '"')
@@ -7334,14 +7319,8 @@
     
     r = (char *)rfc1522_decode((unsigned char *)tmp_20k_buf,
-			       SIZEOF_20KBUF, x, &dummy);
-    if(dummy){
-	fs_give((void **)&dummy);
-	dummy = NULL;
-    }
+			       SIZEOF_20KBUF, x, NULL);
     
     s = (char *)rfc1522_decode((unsigned char *)tmp_20k_buf+10000,
-			       SIZEOF_20KBUF-10000, y, &dummy);
-    if(dummy)
-      fs_give((void **)&dummy);
+			       SIZEOF_20KBUF-10000, y, NULL);
 
     return((*pcollator)(r, s));
--- pine4.56/pine/bldaddr.c
+++ cleanup1/pine/bldaddr.c
@@ -3102,6 +3102,5 @@
     char    *pers_decoded,
             *tmp_a_string,
-            *ret = NULL,
-	    *dummy = NULL;
+            *ret = NULL;
     ADDRESS *adr;
     static char *fakedomain = "@";
@@ -3120,9 +3119,7 @@
 					    SIZEOF_20KBUF,
 					    adr->personal,
-					    verbose ? NULL : &dummy));
+					    NULL));
 	fs_give((void **)&adr->personal);
 	adr->personal = pers_decoded;
-	if(dummy)
-	  fs_give((void **)&dummy);
     }
 
@@ -3269,6 +3266,5 @@
     char	    *p,
 		    *fcc_local = NULL,
-		    *to = NULL,
-		    *dummy;
+		    *to = NULL;
     jmp_buf          save_jmp_buf;
 
@@ -3353,6 +3349,5 @@
 	len = strlen(*full_lcc)+1;
 	p = (char *)fs_get(len * sizeof(char));
-	dummy = NULL;
-	if(rfc1522_decode((unsigned char *)p, len, *full_lcc, &dummy)
+	if(rfc1522_decode((unsigned char *)p, len, *full_lcc, NULL)
 						== (unsigned char *)p){
 	    fs_give((void **)full_lcc);
@@ -3361,7 +3356,4 @@
 	else
 	  fs_give((void **)&p);
-
-	if(dummy)
-	  fs_give((void **)&dummy);
     }
 
@@ -3376,6 +3368,5 @@
 	len = strlen(to)+1;
 	p = (char *)fs_get(len * sizeof(char));
-	dummy = NULL;
-	if(rfc1522_decode((unsigned char *)p, len, to, &dummy)
+	if(rfc1522_decode((unsigned char *)p, len, to, NULL)
 						== (unsigned char *)p){
 	    /*
@@ -3416,8 +3407,4 @@
 	  fs_give((void **)&p);
 
-	if(dummy)
-	  fs_give((void **)&dummy);
-
-
 	/*
 	 * This part is recording the fact that the To line was set to
@@ -3611,5 +3598,5 @@
     PrivateTop *pt = NULL;
     PrivateAffector *af = NULL;
-    char   *fcc_local = NULL, *dummy = NULL;
+    char   *fcc_local = NULL;
     jmp_buf save_jmp_buf;
 
@@ -3673,5 +3660,4 @@
 	af = NULL;
 	fcc_local = NULL;
-	dummy = NULL;
 	if(error != NULL)
 	  *error = (char *)NULL;
@@ -3712,5 +3698,5 @@
 	len = strlen(*full_to)+1;
 	q = (char *)fs_get(len * sizeof(char));
-	p = (char *)rfc1522_decode((unsigned char *)q, len, *full_to, &dummy);
+	p = (char *)rfc1522_decode((unsigned char *)q, len, *full_to, NULL);
 	/* p == q means that decoding happened, p is decoded *full_to */
 	if(p == q || (pt && pt->encoded && pt->encoded->etext)){
@@ -3869,7 +3855,4 @@
 	if(p != q)
 	  fs_give((void **)&q);
-
-	if(dummy)
-	  fs_give((void **)&dummy);
     }
     else{
@@ -4480,5 +4463,4 @@
 		/* still haven't found it */
 		if(a->host[0] == '@'){
-		    extern const char *rspecials;
 		    int space_phrase;
 
--- pine4.56/pine/help.c
+++ cleanup1/pine/help.c
@@ -814,6 +814,4 @@
 {
     char **config;
-    char **p;
-    FILE  *f = stdout;
 
     config = get_supported_options();
--- pine4.56/pine/init.c
+++ cleanup1/pine/init.c
@@ -5568,5 +5568,4 @@
     char               *p, *dir, *tmp = NULL, *pinrc;
     char               *pval, **lval;
-    FILE               *f;
     PINERC_LINE        *pline;
     struct variable    *var;
@@ -8165,6 +8164,4 @@
       return rab;
 
-try_once_more:
-
     if((metafile = rd_metadata_name()) == NULL)
       return rab;
--- pine4.56/pine/mailcmd.c
+++ cleanup1/pine/mailcmd.c
@@ -197,14 +197,4 @@

-static ESCKEY_S other_opts[] = {
-    { -1,   0, NULL, NULL},
-    { -1,   0, NULL, NULL},
-    { -1,   0, NULL, NULL},
-    { -1,   0, NULL, NULL},
-    { -1,   0, NULL, NULL},
-    {-1,    0, NULL, NULL}
-};
-
-
 static char *sel_flag = 
     "Select New, Deleted, Answered, or Important messages ? ";
@@ -2372,5 +2362,4 @@
       q_status_message(SM_ORDER, 0, 2, "No status flags changed.");
 
-  fini:
     if(agg)
       restore_selected(msgmap);
@@ -3246,11 +3235,7 @@
         /* Fish out the realname */
 	if(tmp_adr && tmp_adr->personal && tmp_adr->personal[0]){
-	    char *dummy = NULL;
-
 	    folder_name = (char *)rfc1522_decode((unsigned char *)tmp_20k_buf,
 						 SIZEOF_20KBUF,
-						 tmp_adr->personal, &dummy);
-	    if(dummy)
-	      fs_give((void **)&dummy);
+						 tmp_adr->personal, NULL);
 	}
 
@@ -7226,5 +7211,5 @@
     long	recent;
 {
-    long	  i, n, raw, orig_nmsgs;
+    long	  i, n, raw;
     unsigned long uid;
     int		  exbits, nt = 0, pending_actions = 0, for_debugging = 0;
@@ -7271,7 +7256,5 @@
 	 * Here we're using spare6 (MN_STMP), meaning we'll only
 	 * search the ones with spare6 marked, new messages coming 
-	 * in will not be considered.  There used to be orig_nmsgs,
-	 * which kept track of this, but if a message gets expunged,
-	 * then a new message could be lower than orig_nmsgs.
+	 * in will not be considered.
 	 */
 	for(i = 1; i <= stream->nmsgs; i++)
@@ -9458,5 +9441,5 @@
     long cur;
     int  all_selected = 0;
-    unsigned long was, is, tot;
+    unsigned long was, tot;
 
     cur = mn_get_cur(msgmap);
--- pine4.56/pine/mailindx.c
+++ cleanup1/pine/mailindx.c
@@ -2573,5 +2573,5 @@
     long     at_top, lines_per_page;
 {
-    long current, hidden, visible, lastn;
+    long current, hidden, lastn;
     long n, m = 0L, t = 1L;
 
@@ -2595,5 +2595,4 @@
 
 	    if(any_lflagged(msgs, MN_HIDE)){
-		long vis = 0L;
 		PINETHRD_S *is_current_thrd;
 
@@ -3137,5 +3136,5 @@
     int		 j, columns, some_to_calculate;
     int		 space_left, screen_width, width, fix, col, scol, altcol;
-    int          pcol, pluscol;
+    int          pluscol;
     int		 keep_going, tot_pct, was_sl;
     long         max_msgno;
@@ -4152,5 +4151,5 @@
 {
     char          str_buf[MAXIFLDS][MAX_SCREEN_COLS+1], to_us, status, *field,
-		 *buffer, *s_tmp, *p, *str, *newsgroups;
+		 *buffer, *p, *str, *newsgroups;
     int		  width, offsets_set = 0, i, j, smallest, which_array = 0;
     int           plus_off = -1, imp_off = -1, del_off = -1, ans_off = -1,
@@ -4510,12 +4509,9 @@
 
 		 if((addr = fetch_from(idata)) && addr->personal){
-		    char *name, *initials = NULL, *dummy = NULL;
+		    char *name, *initials = NULL;
 
-			
 		    name = (char *) rfc1522_decode((unsigned char *)tmp_20k_buf,
 						   SIZEOF_20KBUF,
-						   addr->personal, &dummy);
-		    if(dummy)
-		      fs_give((void **)&dummy);
+						   addr->personal, NULL);
 
 		    if(name == addr->personal){
@@ -5857,5 +5853,4 @@
        && addr->host			/* not group syntax */
        && addr->personal && addr->personal[0]){	/* there is a personal name */
-	char *dummy = NULL;
 	char  buftmp[MAILTMPLEN];
 	int   l;
@@ -5866,10 +5861,8 @@
 	sprintf(buftmp, "%.75s", addr->personal);
 	p = (char *) rfc1522_decode((unsigned char *) tmp_20k_buf,
-				    SIZEOF_20KBUF, buftmp, &dummy);
+				    SIZEOF_20KBUF, buftmp, NULL);
 	removing_leading_and_trailing_white_space(p);
 	istrncpy(s + l, p, width - l);
 	s[width] = '\0';
-	if(dummy)
-	  fs_give((void **)&dummy);
 	
 	if(*(s+l))
@@ -6472,5 +6465,4 @@
     PINETHRD_S    *thd, *thdorig;
     HLINE_S       *hline;
-    unsigned long  rawno;
 
     memset(str, 0, (width+1) * sizeof(*str));
@@ -6577,5 +6569,4 @@
 			    char       *s1 = NULL, *s2 = NULL, *free_s2 = NULL;
 			    ENVELOPE   *env;
-			    char       *prevsubj = NULL;
 			    mailcache_t mc;
 			    SORTCACHE  *sc = NULL;
@@ -7721,7 +7712,6 @@
     THREADNODE *collapsed_tree = NULL;
     long          i;
-    PINETHRD_S   *thrd = NULL, *nthrd, *top;
-    unsigned long msgno, rawno, set_in_thread, in_thread;
-    int           bail, this_is_vis;
+    PINETHRD_S   *thrd = NULL;
+    unsigned long msgno, rawno;
     int           un_view_thread = 0;
     long          raw_current;
@@ -9836,5 +9826,4 @@
 
     if(any_lflagged(msgmap, MN_HIDE) > 0L){
-	long cur;
 
 	/* if nothing left selected, unhide all */
@@ -9979,5 +9968,4 @@
     int           collapsed, adjust_current = 0;
     PINETHRD_S   *thrd = NULL, *nthrd;
-    HLINE_S      *hline;
     unsigned long rawno;
 
@@ -10114,5 +10102,5 @@
     long        flags;		/* flag to count */
 {
-    unsigned long rawno, count = 0;
+    unsigned long count = 0;
     PINETHRD_S *nthrd, *bthrd;
     MESSAGECACHE *mc;
@@ -10158,5 +10146,5 @@
     int         flags;		/* flag to count */
 {
-    unsigned long rawno, count = 0;
+    unsigned long count = 0;
     PINETHRD_S *nthrd, *bthrd;
 
@@ -10193,5 +10181,4 @@
     PINETHRD_S *thrd;
 {
-    unsigned long rawno, count = 0;
     PINETHRD_S *nthrd, *bthrd;
 
@@ -10332,5 +10319,5 @@
     int         v;		/* set or clear? */
 {
-    unsigned long rawno, msgno;
+    unsigned long msgno;
     PINETHRD_S *nthrd, *bthrd;
 
@@ -10384,5 +10371,4 @@
 {
     char        status = ' ';
-    PINETHRD_S *nthrd, *bthrd;
     unsigned long save_branch, cnt, tot_in_thrd;
 
@@ -10529,5 +10515,5 @@
 {
     int hiding;
-    unsigned long rawno, msgno;
+    unsigned long msgno;
     PINETHRD_S *nthrd, *bthrd;
 
@@ -10648,5 +10634,5 @@
 {
     PINETHRD_S   *thrd = NULL, *topthrd = NULL;
-    unsigned long rawno, i;
+    unsigned long rawno;
 
     if(!(stream && msgmap))
--- pine4.56/pine/mailpart.c
+++ cleanup1/pine/mailpart.c
@@ -1392,5 +1392,5 @@
      char     *method;
 {
-    char	filename[MAXPATH+1], full_filename[MAXPATH+1], *charset,
+    char	filename[MAXPATH+1], full_filename[MAXPATH+1],
 	       *l_string, title_buf[64], prompt_buf[256], *att_name, *err, *terr;
     int         r, is_text, over = 0, we_cancel = 0;
--- pine4.56/pine/other.c
+++ cleanup1/pine/other.c
@@ -19676,6 +19676,4 @@
 	    if(!strncmp((*cl)->varname, NOT, NOTLEN) &&
 	       !strncmp((*cl)->var->name, NOT, NOTLEN)){
-		char *pp;
-
 		rplstr((*cl)->var->name, NOTLEN, "");
 		rplstr((*cl)->varname, NOTLEN, "");
@@ -20229,5 +20227,4 @@
     int   rv = -1;
     char **apval;
-    char  *abook;
 
     switch(cmd){
--- pine4.56/pine/pine.c
+++ cleanup1/pine/pine.c
@@ -4503,5 +4503,4 @@
     MAILSTREAM *stream;
 {
-    PARTEX_S **partp;
     long       n;
 
--- pine4.56/pine/reply.c
+++ cleanup1/pine/reply.c
@@ -649,5 +649,4 @@
     pine_send(outgoing, &body, "COMPOSE MESSAGE REPLY",
 	      role, fcc.tptr, &reply, redraft_pos, NULL, NULL, 0);
-  done:
     pine_free_body(&body);
     if(reply.mailbox)
@@ -1619,5 +1618,4 @@
     if(p = strstr(buf, init_token)){
 	char *q = NULL;
-	char *dummy = NULL;
 	char  buftmp[MAILTMPLEN];
 
@@ -1629,10 +1627,7 @@
 						(unsigned char *)tmp_20k_buf, 
 						SIZEOF_20KBUF,
-						buftmp, &dummy)))
+						buftmp, NULL)))
 		 : "";
 
-	if(dummy)
-	  fs_give((void **)&dummy);
-
 	istrncpy(pbf, repl, sizeof(pbf)-1);
 	pbf[sizeof(pbf)-1] = '\0';;
@@ -2257,11 +2252,9 @@
       case iInit:
 	if(env && env->from && env->from->personal){
-	    char *name, *initials = NULL, *dummy = NULL;
+	    char *name, *initials = NULL;
 
 	    name = (char *)rfc1522_decode((unsigned char *)tmp_20k_buf,
 					  SIZEOF_20KBUF, env->from->personal,
-					  &dummy);
-	    if(dummy)
-	      fs_give((void **)&dummy);
+					  NULL);
 
 	    if(name == env->from->personal){
@@ -2541,6 +2534,4 @@
     size_t   maxlen;
 {
-    char *dummy = NULL;
-
     buf[0] = '\0';
     if(addr){
@@ -2550,8 +2541,6 @@
 	    sprintf(tmp, "%.200s", addr->personal);
 	    istrncpy(buf, (char *)rfc1522_decode((unsigned char *)tmp_20k_buf,
-						 SIZEOF_20KBUF, tmp, &dummy),
+						 SIZEOF_20KBUF, tmp, NULL),
 		     maxlen);
-	    if(dummy)
-	      fs_give((void **)&dummy);
 	}
 	else if(addr->mailbox && addr->mailbox[0]){
@@ -2710,5 +2699,4 @@
 	    size_t n, len;
 	    unsigned char *p, *tmp = NULL;
-	    char  *dummy = NULL;
 
 	    if((n = strlen(env->subject)) > SIZEOF_20KBUF-1){
@@ -2721,10 +2709,8 @@
 	    }
 	  
-	    istrncpy(buf, (char *)rfc1522_decode(p, len, env->subject, &dummy),
+	    istrncpy(buf, (char *)rfc1522_decode(p, len, env->subject, NULL),
 		     maxlen);
 
 	    buf[maxlen] = '\0';
-	    if(dummy)
-	      fs_give((void **)&dummy);
 	    if(tmp)
 	      fs_give((void **)&tmp);
--- pine4.56/pine/screen.c
+++ cleanup1/pine/screen.c
@@ -432,5 +432,4 @@
     char    *lp, *label;
     COLOR_PAIR *name_color = NULL, *label_color = NULL, *lastc = NULL;
-    COLOR_PAIR *deflabelc = NULL;
     struct variable *vars = ps_global->vars;
 
--- pine4.56/pine/send.c
+++ cleanup1/pine/send.c
@@ -1295,5 +1295,4 @@
 	    if(values[INDEX_SMTP]){
 		char  *q;
-		char **lp;
 		size_t cnt = 0;
 
@@ -1331,5 +1330,4 @@
 	    if(values[INDEX_NNTP]){
 		char  *q;
-		char **lp;
 		size_t cnt = 0;
 
--- pine4.56/pine/status.c
+++ cleanup1/pine/status.c
@@ -1644,5 +1644,5 @@
 {
     ESCKEY_S *list = NULL, *list1 = NULL, *list2 = NULL;
-    int       count, i = 0, j;
+    int       i = 0, j;
     int       v = OTHER_RETURN_VAL, listnum = 0;
 
--- pine4.56/pine/strings.c
+++ cleanup1/pine/strings.c
@@ -798,5 +798,5 @@
 {
     size_t len;
-    unsigned char *rv, *p, *q, c;
+    unsigned char *rv, *p, *q;
     int    inside_esc_seq = 0;
     int    c1 = -1;		/* remembers first of pair for Shift-JIS */
@@ -871,5 +871,5 @@
 	    else{
 #ifdef _WINDOWS					/* Shift-JIS */
-		c = (*p) & 0x7f;		/* 8-bit can't win */
+		unsigned char c = (*p) & 0x7f;	/* 8-bit can't win */
 		if(c1 >= 0){			/* second of a pair? */
 		    int rowOffset = (c1 < 95) ? 112 : 176;
@@ -4396,7 +4396,5 @@
 			*pattern_h_incol_ne,    *pattern_h_incol_any,
 			*pattern_h_other_ne,    *pattern_h_other_any,
-			*pattern_h_oldpat_ne,   *pattern_h_oldpat_any,
-			*pattern_h_oldfilt_ne,  *pattern_h_oldfilt_any,
-			*pattern_h_oldscore_ne, *pattern_h_oldscore_any;
+			*pattern_h_oldpat_ne,   *pattern_h_oldpat_any;
 
 /*
@@ -6229,5 +6227,4 @@
 {
     PAT_S           *pat;
-    struct variable *vars = ps_global->vars;
     long             rflags;
 
@@ -6367,5 +6364,4 @@
 {
     PAT_S           *pat;
-    struct variable *vars = ps_global->vars;
     long             rflags;
 
@@ -6455,5 +6451,4 @@
 {
     PAT_S           *pat;
-    struct variable *vars = ps_global->vars;
     long             rflags;
 
@@ -6540,5 +6535,4 @@
 {
     PAT_S           *pat;
-    struct variable *vars = ps_global->vars;
     long             rflags;

---

From: Bernhard Kaindl <[email-masked]>
Date: Sun, 1 Jun 2003 16:43:28 +0200

Hi,
   In my last mail, I overlooked the case that the charset address passed
to rfc1522_decode() also serves the purpose to indicate if the charsets
found during decoding should be verbosely formatted and included within
brackets like "[iso-2022-jp]" into the decoded output.

I've updated the function header to describe this and to prevent having
to pass a pointer and free it afterwards as so many places, I defined
the address -1, where you could only write one byte to flag that nothing
should be done done with the charset.

Fixed diff attached,
Bernd

+++ cleanup2/pine/addrbook.c
 
@@ -3493,5 +3493,5 @@
+					    len, addr, -1)
 
 	  default:
-          bleep:
 	    bogus_command(c, F_ON(F_USE_FK, ps) ? "F1" : "?");
 	    break;
--- pine4.56/pine/adrbkcmd.c
+++ cleanup2/pine/adrbkcmd.c
@@ -181,5 +181,4 @@ view_abook_entry(ps, cur_line)
     dprint(5, (debugfile, "- view_abook_entry -\n"));
 
-repaint_view:
     if(is_addr(cur_line)){
 	abe = ae(cur_line);
@@ -397,7 +396,4 @@
 
@@ -932,5 +928,5 @@ edit_entry(abook, abe, entry, old_tag, r
     int rc = 0, resort_happened = 0, list_changed = 0, which_addrbook;
     int editor_result, i = 0, add, n_end, ldap = 0;
-    char *nick, *full, *fcc, *comment, *dcomment, *fname, *dummy, *pp;
+    char *nick, *full, *fcc, *comment, *dcomment, *fname, *pp;
     char **orig_encoded = NULL, **orig_decoded = NULL;
     char **new_encoded = NULL, **new_decoded = NULL;
@@ -1047,13 +1043,9 @@ edit_entry(abook, abe, entry, old_tag, r
     he[N_NICK].realaddr = &nick;
 
-    dummy = NULL;
+				         abe->fullname, -1));
 
-    if(dummy)
-      fs_give((void **)&dummy);
-
     he[N_FULL]          = headents_for_edit[N_FULL];
     he[N_FULL].realaddr = &full;
@@ -1073,8 +1065,5 @@ edit_entry(abook, abe, entry, old_tag, r
     }
     
-    dummy = NULL;
-    dcomment = (char *)rfc1522_decode(ptmp, len, abe->extra, &dummy);
-    if(dummy)
-      fs_give((void **)&dummy);
+    dcomment = (char *)rfc1522_decode(ptmp, len, abe->extra, -1);
 
@@ -1363,9 +1352,6 @@ edit_entry(abook, abe, entry, old_tag, r
+					    fname, -1);
 
 	    q_status_message4(SM_ORDER, 5, 9,
--- pine4.56/pine/adrbklib.c
+++ cleanup2/pine/adrbklib.c
@@ -7096,5 +7096,4 @@ cmp_ae_by_full_lists_last(a, b)
     else{
 	register char *p, *q, *r, *s;
-	char *dummy = NULL;
 
 	p = (*x)->fullname;
@@ -7107,14 +7106,8 @@ cmp_ae_by_full_lists_last(a, b)
 
+				   SIZEOF_20KBUF, p, -1);
 	
 	s = (char *)rfc1522_decode((unsigned char *)tmp_20k_buf+10000,
-				   SIZEOF_20KBUF-10000, q, &dummy);
-	if(dummy)
-	  fs_give((void **)&dummy);
+				   SIZEOF_20KBUF-10000, q, -1);
 
 	result = (*pcollator)(r, s);
@@ -7167,5 +7160,4 @@ cmp_ae_by_full(a, b)
     int result;
     register char *p, *q, *r, *s;
-    char *dummy = NULL;
 
     p = (*x)->fullname;
@@ -7178,14 +7170,8 @@ cmp_ae_by_full(a, b)
 
+			       SIZEOF_20KBUF, p, -1);
     
     s = (char *)rfc1522_decode((unsigned char *)tmp_20k_buf+10000,
-			       SIZEOF_20KBUF-10000, q, &dummy);
-    if(dummy)
-      fs_give((void **)&dummy);
+			       SIZEOF_20KBUF-10000, q, -1);
 
     result = (*pcollator)(r, s);
@@ -7325,5 +7311,4 @@ cmp_addr(a1, a2)
     char *x = *(char **)a1, *y = *(char **)a2;
     char *r, *s;
-    char *dummy = NULL;
 
     if(x && *x == '"')
@@ -7334,14 +7319,8 @@ cmp_addr(a1, a2)
     
+			       SIZEOF_20KBUF, x, -1);
     
     s = (char *)rfc1522_decode((unsigned char *)tmp_20k_buf+10000,
-			       SIZEOF_20KBUF-10000, y, &dummy);
-    if(dummy)
-      fs_give((void **)&dummy);
+			       SIZEOF_20KBUF-10000, y, -1);
 
     return((*pcollator)(r, s));
--- pine4.56/pine/bldaddr.c
+++ cleanup2/pine/bldaddr.c
@@ -3102,6 +3102,5 @@ decode_fullname_of_addrstring(addr, verb
     char    *pers_decoded,
             *tmp_a_string,
-            *ret = NULL,
-	    *dummy = NULL;
+            *ret = NULL;
     ADDRESS *adr;
     static char *fakedomain = "@";
@@ -3120,9 +3119,7 @@ decode_fullname_of_addrstring(addr, verb
 					    SIZEOF_20KBUF,
 					    adr->personal,
-					    verbose ? NULL : &dummy));
+					    -1));
 	fs_give((void **)&adr->personal);
 	adr->personal = pers_decoded;
-	if(dummy)
-	  fs_give((void **)&dummy);
     }
 
@@ -3269,6 +3266,5 @@ build_addr_lcc(lcc, full_lcc, error, bar
     char	    *p,
 		    *fcc_local = NULL,
-		    *to = NULL,
-		    *dummy;
+		    *to = NULL;
     jmp_buf          save_jmp_buf;
 
@@ -3353,6 +3349,5 @@ build_addr_lcc(lcc, full_lcc, error, bar
 	len = strlen(*full_lcc)+1;
 	p = (char *)fs_get(len * sizeof(char));
-	dummy = NULL;
-	if(rfc1522_decode((unsigned char *)p, len, *full_lcc, &dummy)
+	if(rfc1522_decode((unsigned char *)p, len, *full_lcc, -1)
 						== (unsigned char *)p){
 	    fs_give((void **)full_lcc);
@@ -3361,7 +3356,4 @@ build_addr_lcc(lcc, full_lcc, error, bar
 	else
 	  fs_give((void **)&p);
-
-	if(dummy)
-	  fs_give((void **)&dummy);
     }
 
@@ -3376,6 +3368,5 @@ build_addr_lcc(lcc, full_lcc, error, bar
 	len = strlen(to)+1;
 	p = (char *)fs_get(len * sizeof(char));
-	dummy = NULL;
-	if(rfc1522_decode((unsigned char *)p, len, to, &dummy)
+	if(rfc1522_decode((unsigned char *)p, len, to, -1)
 						== (unsigned char *)p){
 	    /*
@@ -3416,8 +3407,4 @@ build_addr_lcc(lcc, full_lcc, error, bar
 	  fs_give((void **)&p);
 
-	if(dummy)
@@ -3611,5 +3598,5 @@ build_address(to, full_to, error, barg, 
 
@@ -3673,5 +3660,4 @@ build_address(to, full_to, error, barg, 
 	af = NULL;
 	fcc_local = NULL;
-	dummy = NULL;
 	if(error != NULL)
 	  *error = (char *)NULL;
@@ -3712,5 +3698,5 @@ build_address(to, full_to, error, barg, 
 	len = strlen(*full_to)+1;
 	q = (char *)fs_get(len * sizeof(char));
-	p = (char *)rfc1522_decode((unsigned char *)q, len, *full_to, &dummy);
+	p = (char *)rfc1522_decode((unsigned char *)q, len, *full_to, -1);
 	/* p == q means that decoding happened, p is decoded *full_to */
 	if(p == q || (pt && pt->encoded && pt->encoded->etext)){
@@ -3869,7 +3855,4 @@ build_address(to, full_to, error, barg, 
 	if(p != q)
 	  fs_give((void **)&q);
-
-	if(dummy)
-	  fs_give((void **)&dummy);
     }
     else{
@@ -4480,5 +4463,4 @@ expand_address(to, userdomain, localdoma
 		/* still haven't found it */
 		if(a->host[0] == '@'){
-		    extern const char *rspecials;
 		    int space_phrase;
 
--- pine4.56/pine/help.c
+++ cleanup2/pine/help.c
@@ -814,6 +814,4 @@ dump_supported_options()
 {
     char **config;
-    char **p;
-    FILE  *f = stdout;
 
     config = get_supported_options();
--- pine4.56/pine/init.c
+++ cleanup2/pine/init.c
@@ -5568,5 +5568,4 @@ write_pinerc(ps, which)
     char               *p, *dir, *tmp = NULL, *pinrc;
     char               *pval, **lval;
-    FILE               *f;
     PINERC_LINE        *pline;
     struct variable    *var;
@@ -8165,6 +8164,4 @@ rd_find_our_metadata(key, flags)
       return rab;
 
-try_once_more:
-
     if((metafile = rd_metadata_name()) == NULL)
       return rab;
--- pine4.56/pine/mailcmd.c
+++ cleanup2/pine/mailcmd.c
@@ -197,14 +197,4 @@ static ESCKEY_S sel_opts4[] = {

-static ESCKEY_S other_opts[] = {
-    { -1,   0, NULL, NULL},
-    { -1,   0, NULL, NULL},
-    { -1,   0, NULL, NULL},
-    { -1,   0, NULL, NULL},
-    { -1,   0, NULL, NULL},
-    {-1,    0, NULL, NULL}
-};
-
-
 static char *sel_flag = 
     "Select New, Deleted, Answered, or Important messages ? ";
@@ -2372,5 +2362,4 @@ cmd_flag(state, msgmap, agg)
       q_status_message(SM_ORDER, 0, 2, "No status flags changed.");
 
-  fini:
     if(agg)
       restore_selected(msgmap);
@@ -3246,11 +3235,7 @@ get_save_fldr_from_env(fbuf, nfbuf, e, s
         /* Fish out the realname */
 	if(tmp_adr && tmp_adr->personal && tmp_adr->personal[0]){
-	    char *dummy = NULL;
-
 	    folder_name = (char *)rfc1522_decode((unsigned char *)tmp_20k_buf,
 						 SIZEOF_20KBUF,
-						 tmp_adr->personal, &dummy);
-	    if(dummy)
-	      fs_give((void **)&dummy);
+						 tmp_adr->personal, -1);
 	}
 
@@ -7226,5 +7211,5 @@ process_filter_patterns(stream, msgmap, 
     long	recent;
 {
-    long	  i, n, raw, orig_nmsgs;
+    long	  i, n, raw;
     unsigned long uid;
     int		  exbits, nt = 0, pending_actions = 0, for_debugging = 0;
@@ -7271,7 +7256,5 @@ process_filter_patterns(stream, msgmap, 
 	 * Here we're using spare6 (MN_STMP), meaning we'll only
 	 * search the ones with spare6 marked, new messages coming 
-	 * in will not be considered.  There used to be orig_nmsgs,
-	 * which kept track of this, but if a message gets expunged,
-	 * then a new message could be lower than orig_nmsgs.
+	 * in will not be considered.
 	 */
 	for(i = 1; i <= stream->nmsgs; i++)
@@ -9458,5 +9441,5 @@ individual_select(state, msgmap, q_line,
     long cur;
     int  all_selected = 0;
-    unsigned long was, is, tot;
+    unsigned long was, tot;
 
     cur = mn_get_cur(msgmap);
--- pine4.56/pine/mailindx.c
+++ cleanup2/pine/mailindx.c
@@ -2573,5 +2573,5 @@ top_ent_calc(stream, msgs, at_top, lines
     long     at_top, lines_per_page;
 {
-    long current, hidden, visible, lastn;
+    long current, hidden, lastn;
     long n, m = 0L, t = 1L;
 
@@ -2595,5 +2595,4 @@ top_ent_calc(stream, msgs, at_top, lines

@@ -3137,5 +3136,5 @@ setup_index_header_widths()
     int		 j, columns, some_to_calculate;
     int		 space_left, screen_width, width, fix, col, scol, altcol;
-    int          pcol, pluscol;
+    int          pluscol;
     int		 keep_going, tot_pct, was_sl;
     long         max_msgno;
@@ -4152,5 +4151,5 @@ format_index_index_line(idata)
 {
     char          str_buf[MAXIFLDS][MAX_SCREEN_COLS+1], to_us, status, *field,
-		 *buffer, *s_tmp, *p, *str, *newsgroups;
+		 *buffer, *p, *str, *newsgroups;
     int		  width, offsets_set = 0, i, j, smallest, which_array = 0;
     int           plus_off = -1, imp_off = -1, del_off = -1, ans_off = -1,
@@ -4510,12 +4509,9 @@ format_index_index_line(idata)

-			
+						   addr->personal, -1);
 
 		    if(name == addr->personal){
@@ -5857,5 +5853,4 @@ set_index_addr(idata, field, addr, prefi
        && addr->host			/* not group syntax */
        && addr->personal && addr->personal[0]){	/* there is a personal name */
-	char *dummy = NULL;
 	char  buftmp[MAILTMPLEN];
 	int   l;
@@ -5866,10 +5861,8 @@ set_index_addr(idata, field, addr, prefi
 	sprintf(buftmp, "%.75s", addr->personal);
 	p = (char *) rfc1522_decode((unsigned char *) tmp_20k_buf,
-				    SIZEOF_20KBUF, buftmp, &dummy);
+				    SIZEOF_20KBUF, buftmp, -1);
 	removing_leading_and_trailing_white_space(p);
 	istrncpy(s + l, p, width - l);
 	s[width] = '\0';
-	if(dummy)
-	  fs_give((void **)&dummy);
 	
 	if(*(s+l))
@@ -6472,5 +6465,4 @@ subj_str(idata, width, str)
     PINETHRD_S    *thd, *thdorig;
     HLINE_S       *hline;
-    unsigned long  rawno;
 
     memset(str, 0, (width+1) * sizeof(*str));
@@ -6577,5 +6569,4 @@ subj_str(idata, width, str)
 			    char       *s1 = NULL, *s2 = NULL, *free_s2 = NULL;
 			    ENVELOPE   *env;
-			    char       *prevsubj = NULL;
 			    mailcache_t mc;
 			    SORTCACHE  *sc = NULL;
@@ -7721,7 +7712,6 @@ sort_thread_callback(stream, tree)
     THREADNODE *collapsed_tree = NULL;
     long          i;
-    PINETHRD_S   *thrd = NULL, *nthrd, *top;
-    unsigned long msgno, rawno, set_in_thread, in_thread;
-    int           bail, this_is_vis;
+    PINETHRD_S   *thrd = NULL;
+    unsigned long msgno, rawno;
     int           un_view_thread = 0;
     long          raw_current;
@@ -9836,5 +9826,4 @@ thread_command(state, stream, msgmap, pr

 	/* if nothing left selected, unhide all */
@@ -9979,5 +9968,4 @@ collapse_or_expand(state, stream, msgmap
     int           collapsed, adjust_current = 0;
     PINETHRD_S   *thrd = NULL, *nthrd;
-    HLINE_S      *hline;
     unsigned long rawno;
 
@@ -10114,5 +10102,5 @@ count_flags_in_thread(stream, thrd, flag
     long        flags;		/* flag to count */
 {
-    unsigned long rawno, count = 0;
+    unsigned long count = 0;
     PINETHRD_S *nthrd, *bthrd;
     MESSAGECACHE *mc;
@@ -10158,5 +10146,5 @@ count_lflags_in_thread(stream, thrd, msg
     int         flags;		/* flag to count */
 {
-    unsigned long rawno, count = 0;
+    unsigned long count = 0;
     PINETHRD_S *nthrd, *bthrd;
 
@@ -10193,5 +10181,4 @@ thread_has_some_visible(stream, thrd)
     PINETHRD_S *thrd;
 {
-    unsigned long rawno, count = 0;
     PINETHRD_S *nthrd, *bthrd;
 
@@ -10332,5 +10319,5 @@ set_thread_lflags(stream, thrd, msgmap, 
     int         v;		/* set or clear? */
 {
-    unsigned long rawno, msgno;
+    unsigned long msgno;
     PINETHRD_S *nthrd, *bthrd;
 
@@ -10384,5 +10371,4 @@ status_symbol_for_thread(stream, thrd, t
 {
     char        status = ' ';
-    PINETHRD_S *nthrd, *bthrd;
     unsigned long save_branch, cnt, tot_in_thrd;
 
@@ -10529,5 +10515,5 @@ set_thread_subtree(stream, thrd, msgmap,
 {
     int hiding;
-    unsigned long rawno, msgno;
+    unsigned long msgno;
     PINETHRD_S *nthrd, *bthrd;
 
@@ -10648,5 +10634,5 @@ unview_thread(state, stream, msgmap)
 {
     PINETHRD_S   *thrd = NULL, *topthrd = NULL;
-    unsigned long rawno, i;
+    unsigned long rawno;
 
     if(!(stream && msgmap))
--- pine4.56/pine/mailpart.c
+++ cleanup2/pine/mailpart.c
@@ -1392,5 +1392,5 @@ write_attachment(qline, msgno, a, method
      char     *method;
 {
-    char	filename[MAXPATH+1], full_filename[MAXPATH+1], *charset,
+    char	filename[MAXPATH+1], full_filename[MAXPATH+1],
 	       *l_string, title_buf[64], prompt_buf[256], *att_name, *err, *terr;
     int         r, is_text, over = 0, we_cancel = 0;
--- pine4.56/pine/other.c
+++ cleanup2/pine/other.c
@@ -19676,6 +19676,4 @@ role_text_tool(ps, cmd, cl, flags)
 	    if(!strncmp((*cl)->varname, NOT, NOTLEN) &&
 	       !strncmp((*cl)->var->name, NOT, NOTLEN)){
-		char *pp;
-
 		rplstr((*cl)->var->name, NOTLEN, "");
 		rplstr((*cl)->varname, NOTLEN, "");
@@ -20229,5 +20227,4 @@ role_text_tool_afrom(ps, cmd, cl, flags)
     int   rv = -1;
     char **apval;
-    char  *abook;
 
     switch(cmd){
--- pine4.56/pine/pine.c
+++ cleanup2/pine/pine.c
@@ -4503,5 +4503,4 @@ pine_mail_close(stream)
     MAILSTREAM *stream;
 {
-    PARTEX_S **partp;
     long       n;
 
--- pine4.56/pine/reply.c
+++ cleanup2/pine/reply.c
@@ -649,5 +649,4 @@ reply(pine_state)
     pine_send(outgoing, &body, "COMPOSE MESSAGE REPLY",
 	      role, fcc.tptr, &reply, redraft_pos, NULL, NULL, 0);
-  done:
     pine_free_body(&body);
     if(reply.mailbox)
@@ -1619,5 +1618,4 @@ reply_quote_str(env)
     if(p = strstr(buf, init_token)){
 	char *q = NULL;
-	char *dummy = NULL;
 	char  buftmp[MAILTMPLEN];
 
@@ -1629,10 +1627,7 @@ reply_quote_str(env)
 						(unsigned char *)tmp_20k_buf, 
 						SIZEOF_20KBUF,
-						buftmp, &dummy)))
+						buftmp, -1)))
 		 : "";
 
-	if(dummy)
@@ -2257,11 +2252,9 @@ get_addr_data(env, type, buf, maxlen)
 
+					  -1);
 
 	    if(name == env->from->personal){
@@ -2541,6 +2534,4 @@ a_little_addr_string(addr, buf, maxlen)
     size_t   maxlen;
 {
-    char *dummy = NULL;
-
     buf[0] = '\0';
     if(addr){
@@ -2550,8 +2541,6 @@ a_little_addr_string(addr, buf, maxlen)
 	    sprintf(tmp, "%.200s", addr->personal);
 	    istrncpy(buf, (char *)rfc1522_decode((unsigned char *)tmp_20k_buf,
-						 SIZEOF_20KBUF, tmp, &dummy),
+						 SIZEOF_20KBUF, tmp, -1),
 		     maxlen);
-	    if(dummy)
-	      fs_give((void **)&dummy);
 	}
 	else if(addr->mailbox && addr->mailbox[0]){
@@ -2710,5 +2699,4 @@ get_reply_data(env, role, type, buf, max
 	    size_t n, len;
 	    unsigned char *p, *tmp = NULL;
-	    char  *dummy = NULL;
 
 	    if((n = strlen(env->subject)) > SIZEOF_20KBUF-1){
@@ -2721,10 +2709,8 @@ get_reply_data(env, role, type, buf, max
 	    }
 	  
-	    istrncpy(buf, (char *)rfc1522_decode(p, len, env->subject, &dummy),
+	    istrncpy(buf, (char *)rfc1522_decode(p, len, env->subject, -1),
 		     maxlen);
 
 	    buf[maxlen] = '\0';
-	    if(dummy)
-	      fs_give((void **)&dummy);
 	    if(tmp)
 	      fs_give((void **)&tmp);
--- pine4.56/pine/screen.c
+++ cleanup2/pine/screen.c
@@ -432,5 +432,4 @@ print_inverted_label(state, m)
     char    *lp, *label;
     COLOR_PAIR *name_color = NULL, *label_color = NULL, *lastc = NULL;
-    COLOR_PAIR *deflabelc = NULL;
     struct variable *vars = ps_global->vars;
 
--- pine4.56/pine/send.c
+++ cleanup2/pine/send.c
@@ -1295,5 +1295,4 @@ redraft(stream, outgoing, body, fcc, lcc
 	    if(values[INDEX_SMTP]){
 		char  *q;
-		char **lp;
 		size_t cnt = 0;
 
@@ -1331,5 +1330,4 @@ redraft(stream, outgoing, body, fcc, lcc
 	    if(values[INDEX_NNTP]){
 		char  *q;
-		char **lp;
 		size_t cnt = 0;
 
--- pine4.56/pine/status.c
+++ cleanup2/pine/status.c
@@ -1644,5 +1644,5 @@ double_radio_buttons(prompt, line, esc_l
 {
     ESCKEY_S *list = NULL, *list1 = NULL, *list2 = NULL;
-    int       count, i = 0, j;
+    int       i = 0, j;
     int       v = OTHER_RETURN_VAL, listnum = 0;
 
--- pine4.56/pine/strings.c
+++ cleanup2/pine/strings.c
@@ -798,5 +798,5 @@ trans_2022_jp_to_euc(src)
 {
     size_t len;
-    unsigned char *rv, *p, *q, c;
+    unsigned char *rv, *p, *q;
     int    inside_esc_seq = 0;
     int    c1 = -1;		/* remembers first of pair for Shift-JIS */
@@ -871,5 +871,5 @@ trans_2022_jp_to_euc(src)
 	    else{
 #ifdef _WINDOWS					/* Shift-JIS */
-		c = (*p) & 0x7f;		/* 8-bit can't win */
+		unsigned char c = (*p) & 0x7f;	/* 8-bit can't win */
 		if(c1 >= 0){			/* second of a pair? */
 		    int rowOffset = (c1 < 95) ? 112 : 176;
@@ -2921,12 +2921,24 @@
 
 /*
- * rfc1522_decode - decode the given source string ala RFC 2047 (nee 1522),
- *		    IF NECESSARY, into the given destination buffer.
- *		    Don't bother copying if it turns out decoding
- *		    isn't necessary.
+ * rfc1522_decode - decode the given source string ala RFC 2047 (new 1522),
+ *		    if neccesary, into the given destination buffer.
+ * args:
+ * d       -- destination buffer
+ * len     -- length of destination buffer
+ * s       -- source buffer
+ * charset -- address to which a pointer to an allocated string of the
+ *            first charset found during decoding which does not match
+ *            the current charset should be written. If no such charset
+ *            is found during decoding, the address is filled with 0's.
+ *          - if the address is NULL, then, instead of the above, which is
+ *            not possible then, verbosley add the charsets found, within
+ *            brackets, like [iso-2022-jp], into the output.
+ *          - if the address is -1, do nothing of the above.
  *
  * Returns: pointer to either the destination buffer containing the
- *	    decoded text, or a pointer to the source buffer if there was
- *	    no reason to decode it.
+ *	    decoded text, or a pointer to the source buffer if there
+ *          no valid rfc1522 tag found during scanning.
+ * *address points to an allocated string of the first non-matching
+ * charset found, if applicable(see description of charset above)
  */
 unsigned char *
@@ -2945,5 +2957,5 @@ rfc1522_decode(d, len, s, charset)
 
     *d = '\0';					/* init destination */
-    if(charset)
+    if(charset && charset != -1)
       *charset = NULL;
 
@@ -2977,5 +2989,5 @@ rfc1522_decode(d, len, s, charset)
 		   || strucmp(ps_global->VAR_CHAR_SET, "iso-2022-jp")){
 		    if(charset){
-			if(!*charset)		/* only write first charset */
+			if(charset != -1 && !*charset) /* only first charset */
 			  *charset = cpystr(cset);
 		    }
@@ -3002,5 +3014,5 @@ rfc1522_decode(d, len, s, charset)
 
 		if(charset){
-		    if(!*charset)		/* only write first charset */
+		    if(charset != -1 && !*charset) /* only first charset */
 		      *charset = cpystr(cset);
 		}
@@ -4396,7 +4408,5 @@ static PAT_HANDLE	*pattern_h_roles_ne,  
 			*pattern_h_incol_ne,    *pattern_h_incol_any,
 			*pattern_h_other_ne,    *pattern_h_other_any,
-			*pattern_h_oldpat_ne,   *pattern_h_oldpat_any,
-			*pattern_h_oldfilt_ne,  *pattern_h_oldfilt_any,
-			*pattern_h_oldscore_ne, *pattern_h_oldscore_any;
+			*pattern_h_oldpat_ne,   *pattern_h_oldpat_any;
 
 /*
@@ -6229,5 +6239,4 @@ first_pattern(pstate)
 {
     PAT_S           *pat;
-    struct variable *vars = ps_global->vars;
     long             rflags;
 
@@ -6367,5 +6376,4 @@ last_pattern(pstate)
 {
     PAT_S           *pat;
-    struct variable *vars = ps_global->vars;
     long             rflags;
 
@@ -6455,5 +6463,4 @@ next_pattern(pstate)
 {
     PAT_S           *pat;
-    struct variable *vars = ps_global->vars;
     long             rflags;
 
@@ -6540,5 +6547,4 @@ prev_pattern(pstate)
 {
     PAT_S           *pat;
-    struct variable *vars = ps_global->vars;
     long             rflags;

---

From: Nicolas Christin <[email-masked]>
Date: Sun, 1 Jun 2003 11:04:17 -0400

On Sun, 1 Jun 2003, Bernhard Kaindl wrote:

> I think such notices should not be removed except if Nicolas
> approved/reqested it.

I did. None of the other contributors has their name proeminently in the
source, I don't see why I should have mine for a 50-line patch.

> which could potentially motivate others to contribute to pine.

Contributors' names are at
<http://www.washington.edu/pine/overview/credits.html>.

Cheers,
-- 
Nicolas

---

From: Matt Ackeret <[email-masked]>
Date: Tue, 3 Jun 2003 11:29:33 -0700 (PDT)

>own in case you have some while writing your code.

There's also an unterminated /* comment in pico.h

/*----------------- time.h ---------------------------------------------*/
/* #include <time.h>
/* plain time.h isn't enough on some systems */

I turned on -Wall in gcc3.3, and gave up quickly (LOTS of warnings about
things not in switch statements).. I'll try it again some other time..