#
# https://www.gluelogic.com/code/PINE-maildir/
#
diff -ruN pine4.61/pico/efunc.h pine4.61.new/pico/efunc.h
--- pine4.61/pico/efunc.h	2004-06-15 18:22:58.000000000 -0400
+++ pine4.61.new/pico/efunc.h	2004-11-05 21:54:45.918286304 -0500
@@ -242,8 +242,8 @@
 extern	int pico_new_mail PROTO((void));
 extern	int time_to_check PROTO((void));
 extern	int sstrcasecmp PROTO((const QSType *, const QSType *));
-extern	int strucmp PROTO((char *, char *));
-extern	int struncmp PROTO((char *, char *, int));
+extern	int strucmp PROTO((const char *, const char *));
+extern	int struncmp PROTO((const char *, const char *, int));
 extern	void chkptinit PROTO((char *, int));
 extern	void set_collation PROTO((int, int));
 extern	int (*pcollator)();
diff -ruN pine4.61/pico/osdep/unix pine4.61.new/pico/osdep/unix
--- pine4.61/pico/osdep/unix	2004-05-05 18:01:13.000000000 -0400
+++ pine4.61.new/pico/osdep/unix	2004-11-05 21:54:45.920286000 -0500
@@ -3733,7 +3733,7 @@
   ---*/
 int
 strucmp(o, r)
-    register char *o, *r;
+    register const char *o, *r;
 {
     if(o == NULL){
 	if(r == NULL)
@@ -3775,7 +3775,7 @@
   ----*/
 int
 struncmp(o, r, n)
-    register char *o,
+    register const char *o,
 		  *r;
     register int   n;
 {
diff -ruN pine4.61/pico/pico.h pine4.61.new/pico/pico.h
--- pine4.61/pico/pico.h	2004-07-09 16:31:54.000000000 -0400
+++ pine4.61.new/pico/pico.h	2004-11-05 21:54:45.920286000 -0500
@@ -66,7 +66,7 @@
 #if defined(DOS) || defined(HELPFILE)
 #define	HELP_T	short
 #else
-#define	HELP_T	char **
+#define	HELP_T	const char * const *
 #endif
 
  
diff -ruN pine4.61/pine/args.c pine4.61.new/pine/args.c
--- pine4.61/pine/args.c	2003-10-10 17:05:32.000000000 -0400
+++ pine4.61.new/pine/args.c	2004-11-05 21:54:45.921285848 -0500
@@ -68,27 +68,27 @@
 /*
  * Various error and informational strings..
  */
-char args_err_missing_pinerc[] =	"missing argument for option \"-pinerc\" (use - for standard out)";
-char args_err_missing_aux[] =		"missing argument for option \"-aux\"";
-char args_err_missing_passfile[] =	"missing argument for option \"-passfile\"";
-char args_err_non_abs_passfile[] =	"argument to \"-passfile\" should be fully-qualified";
-char args_err_missing_lu[] =		"missing argument for option \"-create_lu\"\nUsage: pine -create_lu <addrbook_file> <addrbook_sort_type>";
-char args_err_missing_sort[] =		"missing argument for option \"-sort\"";
-char args_err_missing_flag_arg[] =	"missing argument for flag \"%c\"";
-char args_err_missing_flag_num[] =	"Non numeric argument for flag \"%c\"";
-char args_err_missing_debug_num[] =	"Non numeric argument for \"%s\"";
-char args_err_missing_url[] =		"missing URL for \"-url\"";
-char args_err_missing_attachment[] =	"missing attachment for \"%s\"";
-char args_err_conflict[] =		"conflicting action: \"%s\"";
-char args_err_unknown[] =		"unknown flag \"%c\"";
-char args_err_I_error[] =		"-I argument \"%s\": %s";
-char args_err_d_error[] =		"-d argument \"%s\": %s";
-char args_err_internal[] =		"%s";
-char args_err_missing_copyprc[] =	"missing argument for option \"-copy_pinerc\"\nUsage: pine -copy_pinerc <local_pinerc> <remote_pinerc>";
-char args_err_missing_copyabook[] =	"missing argument for option \"-copy_abook\"\nUsage: pine -copy_abook <local_abook> <remote_abook>";
+const char args_err_missing_pinerc[] =	"missing argument for option \"-pinerc\" (use - for standard out)";
+const char args_err_missing_aux[] =		"missing argument for option \"-aux\"";
+const char args_err_missing_passfile[] =	"missing argument for option \"-passfile\"";
+const char args_err_non_abs_passfile[] =	"argument to \"-passfile\" should be fully-qualified";
+const char args_err_missing_lu[] =		"missing argument for option \"-create_lu\"\nUsage: pine -create_lu <addrbook_file> <addrbook_sort_type>";
+const char args_err_missing_sort[] =		"missing argument for option \"-sort\"";
+const char args_err_missing_flag_arg[] =	"missing argument for flag \"%c\"";
+const char args_err_missing_flag_num[] =	"Non numeric argument for flag \"%c\"";
+const char args_err_missing_debug_num[] =	"Non numeric argument for \"%s\"";
+const char args_err_missing_url[] =		"missing URL for \"-url\"";
+const char args_err_missing_attachment[] =	"missing attachment for \"%s\"";
+const char args_err_conflict[] =		"conflicting action: \"%s\"";
+const char args_err_unknown[] =		"unknown flag \"%c\"";
+const char args_err_I_error[] =		"-I argument \"%s\": %s";
+const char args_err_d_error[] =		"-d argument \"%s\": %s";
+const char args_err_internal[] =		"%s";
+const char args_err_missing_copyprc[] =	"missing argument for option \"-copy_pinerc\"\nUsage: pine -copy_pinerc <local_pinerc> <remote_pinerc>";
+const char args_err_missing_copyabook[] =	"missing argument for option \"-copy_abook\"\nUsage: pine -copy_abook <local_abook> <remote_abook>";
 
 
-char *args_pine_args[] = {
+const char * const args_pine_args[] = {
 "Possible Starting Arguments for Pine program:",
 "",
 " Argument\tMeaning",
@@ -1075,16 +1075,19 @@
   ----------------------------------------------------------------------*/
 void
 display_args_err(s, a, err)
-    char  *s;
-    char **a;
+    const char *s;
+    HelpType a;
     int    err;
 {
-    char  errstr[256], *errp;
+    char  errstr[256];
+    const char *errp;
     FILE *fp = err ? stderr : stdout;
 
 
-    if(err && s)
-      sprintf(errp = errstr, "Argument Error: %.200s", s);
+    if(err && s){
+      sprintf(errstr, "Argument Error: %.200s", s);
+      errp = (const char *)errstr;
+    }
     else
       errp = s;
 
diff -ruN pine4.61/pine/cmplhelp.sh pine4.61.new/pine/cmplhelp.sh
--- pine4.61/pine/cmplhelp.sh	1998-02-20 19:50:38.000000000 -0500
+++ pine4.61.new/pine/cmplhelp.sh	2004-11-05 21:54:45.921285848 -0500
@@ -57,7 +57,7 @@
 
      /^====/       { if(in_text)
                          printf("NULL\n};\n\n\n");
-                     printf ("char *%s[] = {\n ", $2 );
+                     printf ("const char * const %s[] = {\n ", $2 );
                      texts[count++] = $2;
                      in_text = 1;
                     }
@@ -70,7 +70,7 @@
                     }
      END            { if(in_text)
                           printf("NULL\n};\n\n");
-                      printf("struct _help_texts h_texts[] = {\n");
+                      printf("const struct _help_texts h_texts[] = {\n");
                       for(i = 0; i < count; i++)
                           printf("{%s,\"%s\"},\n",texts[i], texts[i]);
                       printf("{NO_HELP, NULL}\n};\n\n");
diff -ruN pine4.61/pine/cmplhlp2.sh pine4.61.new/pine/cmplhlp2.sh
--- pine4.61/pine/cmplhlp2.sh	2000-06-22 14:01:13.000000000 -0400
+++ pine4.61.new/pine/cmplhlp2.sh	2004-11-05 21:54:45.921285848 -0500
@@ -47,13 +47,13 @@
 awk  ' BEGIN	{  printf("\n\n\t\t/*\n");
                    printf("\t\t * AUTMATICALLY GENERATED FILE!\n");
                    printf("\t\t * DO NOT EDIT!!\n\t\t */\n\n\n");
-                   printf("#define\tHelpType\tchar **\n");
-                   printf("#define\tNO_HELP\t(char **) NULL\n");
+                   printf("#define\tHelpType\t const char * const *\n");
+                   printf("#define\tNO_HELP\t(const char * const *) NULL\n");
                    printf("struct _help_texts {\n");
                    printf("  HelpType help_text;\n");
-                   printf("  char  *tag;\n};\n\n"); }
-       /^====/  {  printf ("extern char *%s[] ; \n\n", $2 ); }
-       END      {  printf ("\n\nextern struct _help_texts h_texts[];\n\n");}'
+                   printf("  const char  * const tag;\n};\n\n"); }
+       /^====/  {  printf ("extern const char * const %s[] ; \n\n", $2 ); }
+       END      {  printf ("\n\nextern const struct _help_texts h_texts[];\n\n");}'
 
 
 
diff -ruN pine4.61/pine/date.c pine4.61.new/pine/date.c
--- pine4.61/pine/date.c	1969-12-31 19:00:00.000000000 -0500
+++ pine4.61.new/pine/date.c	2004-11-05 21:54:45.922285696 -0500
@@ -0,0 +1,2 @@
+char datestamp[]="Wed Feb 4 22:46:46 EST 2004";
+char hoststamp[]="netspace.org";
diff -ruN pine4.61/pine/help.c pine4.61.new/pine/help.c
--- pine4.61/pine/help.c	2004-04-08 12:59:19.000000000 -0400
+++ pine4.61.new/pine/help.c	2004-11-05 21:54:45.924285392 -0500
@@ -73,20 +73,20 @@
 
 typedef struct _help_scroll {
     unsigned	keys_formatted:1;	/* Has full keymenu been formatted? */
-    char      **help_source;		/* Source of displayed help text */
+    HelpType    help_source;		/* Source of displayed help text */
 } HELP_SCROLL_S;
 
 
 static struct {
-    unsigned   crlf:1;
-    char     **line,
-	      *offset;
+    unsigned    crlf:1;
+    HelpType    line;
+    const char *offset;
 } g_h_text;
 
 
 typedef struct _help_print_state {
     int	  page;
-    char *title;
+    const char *title;
     int   title_len;
 } HPRT_S;
 
@@ -119,7 +119,7 @@
 /*
  * Internal prototypes
  */
-int	 helper_internal PROTO((HelpType, char **, char *, char *, int));
+int	 helper_internal PROTO((HelpType, HelpType, char *, char *, int));
 HelpType help_name2section PROTO((char *, int));
 int	 help_processor PROTO((int, MSGNO_S *, SCROLL_S *));
 int	 journal_processor PROTO((int, MSGNO_S *, SCROLL_S *));
@@ -162,12 +162,12 @@
 int
 helper_internal(text, otext, frag, title, flags)
     HelpType  text;
-    char    **otext;
+    HelpType otext;
     char     *frag;
     char     *title;
     int	      flags;
 {
-    char	  **shown_text;
+    HelpType	    shown_text;
     int		    cmd = MC_NONE;
     long	    offset = 0L;
     char	   *error = NULL, tmp_title[MAX_SCREEN_COLS + 1];
@@ -176,7 +176,7 @@
     HELP_SCROLL_S   hscroll;
     gf_io_t	    pc;
 #ifdef	HELPFILE
-    char	  **dynamic_text = NULL;
+    HelpType	    dynamic_text = NULL;
 #endif /* HELPFILE */
 
     dprint(1, (debugfile, "\n\n    ---- HELPER ----\n"));
@@ -416,7 +416,7 @@
 
 void
 init_helper_getc(help_txt)
-    char **help_txt;
+    HelpType help_txt;
 {
     g_h_text.crlf   = 0;
     g_h_text.line   = help_txt;
@@ -513,7 +513,7 @@
  */
 void
 print_help(text)
-    char **text;
+    HelpType text;
 {
     char   *error, buf[256];
     HPRT_S  help_data;
@@ -569,9 +569,9 @@
 #ifdef	HELPFILE
     short t;
 #else
-    struct _help_texts *t;
+    const struct _help_texts *t;
 #endif
-    char **h;
+    HelpType h;
 
     if(open_printer("all 150+ pages of help text ") == 0) {
 #ifndef	DOS
@@ -796,7 +796,7 @@
 
 	config = get_supported_options();
 	if(config){
-	    rv = helper_internal(NO_HELP, config, NULL, "HELP CONFIG",
+	    rv = helper_internal(NO_HELP, (HelpType)config, NULL, "HELP CONFIG",
 				 HLPD_NEWWIN | HLPD_SIMPLE | HLPD_FROMHELP);
 	    free_list_array(&config);
 	}
@@ -820,7 +820,7 @@
 
     config = get_supported_options();
     if(config){
-	display_args_err(NULL, config, 0);
+	display_args_err(NULL, (HelpType)config, 0);
 	free_list_array(&config);
     }
 }
@@ -836,7 +836,7 @@
 #ifdef	HELPFILE
     HelpType		t;
 #else
-    struct _help_texts *t;
+    const struct _help_texts *t;
 #endif
 
     sprintf(name, "%.*s", min(url_len,sizeof(name)), url);
diff -ruN pine4.61/pine/imap.c pine4.61.new/pine/imap.c
--- pine4.61/pine/imap.c	2004-06-02 18:00:36.000000000 -0400
+++ pine4.61.new/pine/imap.c	2004-11-05 21:54:45.925285240 -0500
@@ -2515,7 +2515,7 @@
 	      *p++ = c;
 	}
 
-	display_args_err(NULL, q, 0);
+	display_args_err(NULL, (HelpType)q, 0);
 	free_list_array(&q);
     }
 
diff -ruN pine4.61/pine/osdep/termin.gen pine4.61.new/pine/osdep/termin.gen
--- pine4.61/pine/osdep/termin.gen	2003-12-03 19:51:08.000000000 -0500
+++ pine4.61.new/pine/osdep/termin.gen	2004-11-05 21:54:45.926285088 -0500
@@ -206,7 +206,7 @@
                    real_y_base, km_popped, passwd;
     char          *saved_original = NULL, *k, *kb;
     char          *kill_buffer = NULL;
-    char         **help_text;
+    HelpType	   help_text;
     int		   fkey_table[12];
     struct	   key_menu *km;
     bitmap_t	   bitmap;
diff -ruN pine4.61/pine/osdep/termout.dos pine4.61.new/pine/osdep/termout.dos
--- pine4.61/pine/osdep/termout.dos	2003-01-28 21:00:34.000000000 -0500
+++ pine4.61.new/pine/osdep/termout.dos	2004-11-05 21:54:45.926285088 -0500
@@ -508,7 +508,7 @@
   ----------------------------------------------------------------------*/
 void
 Write_to_screen(string)				/* DOS */
-      register char *string;
+      register const char *string;
 {
     if(ps_global->in_init_seq)
       return;
diff -ruN pine4.61/pine/osdep/termout.gen pine4.61.new/pine/osdep/termout.gen
--- pine4.61/pine/osdep/termout.gen	2004-07-09 14:15:18.000000000 -0400
+++ pine4.61.new/pine/osdep/termout.gen	2004-11-05 21:54:45.927284936 -0500
@@ -19,7 +19,7 @@
 void
 PutLine0(x, y, line)
     int            x,y;
-    register char *line;
+    register const char *line;
 {
     MoveCursor(x,y);
     Write_to_screen(line);
diff -ruN pine4.61/pine/osdep/termout.unx pine4.61.new/pine/osdep/termout.unx
--- pine4.61/pine/osdep/termout.unx	2003-10-09 15:46:42.000000000 -0400
+++ pine4.61.new/pine/osdep/termout.unx	2004-11-05 21:54:45.927284936 -0500
@@ -843,7 +843,7 @@
   ----*/
 void
 Write_to_screen(string)				/* UNIX */
-      register char *string; 
+      register const char *string; 
 {
     while(*string)
       Writechar((unsigned char) *string++, 0);
@@ -860,7 +860,7 @@
   ----*/
 void
 Write_to_screen_n(string, n)				/* UNIX */
-      register char *string; 
+      register const char *string; 
       int            n;
 {
     while(n-- && *string)
diff -ruN pine4.61/pine/pine.c pine4.61.new/pine/pine.c
--- pine4.61/pine/pine.c	2004-07-14 14:17:13.000000000 -0400
+++ pine4.61.new/pine/pine.c	2004-11-05 21:54:45.930284480 -0500
@@ -2813,7 +2813,7 @@
 new_user_or_version(ps)
     struct pine *ps;
 {
-    char	  **shown_text;
+    HelpType	    shown_text;
     int		    cmd = MC_NONE;
     char	   *error = NULL;
     HelpType	    text;
@@ -2822,7 +2822,7 @@
     HANDLE_S	   *handles = NULL, *htmp;
     gf_io_t	    pc;
 #ifdef	HELPFILE
-    char	  **dynamic_text;
+    HelpType	    dynamic_text;
 #endif /* HELPFILE */
 
     text = ps->first_time_user ? new_user_greeting : new_version_greeting;
diff -ruN pine4.61/pine/pine.h pine4.61.new/pine/pine.h
--- pine4.61/pine/pine.h	2004-07-14 20:25:12.000000000 -0400
+++ pine4.61.new/pine/pine.h	2004-11-05 21:54:45.932284176 -0500
@@ -4372,7 +4372,7 @@
 
 /*-- args.c --*/
 void	    pine_args PROTO((struct pine *, int, char **, ARGDATA_S *));
-void        display_args_err PROTO((char *, char **, int));
+void        display_args_err PROTO((const char *, HelpType, int));
 void        args_help PROTO((void));
 
 /*-- bldaddr.c --*/
@@ -4512,9 +4512,9 @@
 void	    add_review_message PROTO((char *, int));
 void	    end_status_review PROTO((void));
 int	    gripe_gripe_to PROTO((char *));
-void	    init_helper_getc PROTO((char **));
+void	    init_helper_getc PROTO((HelpType));
 int	    helper_getc PROTO((char *));
-void	    print_help PROTO((char **));
+void	    print_help PROTO((HelpType));
 void	    dump_supported_options PROTO((void));
 #if defined(DOS) || defined(HELPFILE)
 char	  **get_help_text PROTO((HelpType)); 
@@ -5207,7 +5207,7 @@
 char	   *strclean PROTO((char *));
 char	   *short_str PROTO((char *, char *, int, WhereDots));
 int	    in_dir PROTO((char *, char *));
-char	   *srchstr PROTO((char *, char *));
+char	   *srchstr PROTO((const char *, const char *));
 char	   *srchrstr PROTO((char *, char *));
 char	   *strindex PROTO((char *, int));
 char	   *strrindex PROTO((char *, int));
@@ -5356,9 +5356,9 @@
 void	    EndScroll PROTO((void));
 int	    ScrollRegion PROTO(( int));
 void	    Writechar PROTO((unsigned int, int));
-void	    Write_to_screen PROTO((char *));
-void	    Write_to_screen_n PROTO((char *, int));
-void	    PutLine0 PROTO((int, int, char *));
+void	    Write_to_screen PROTO((const char *));
+void	    Write_to_screen_n PROTO((const char *, int));
+void	    PutLine0 PROTO((int, int, const char *));
 void	    PutLine0n8b PROTO((int, int, char *, int, HANDLE_S *));
 void	    PutLine1 PROTO((int, int, char *, void *));
 void	    PutLine2 PROTO((int, int, char *, void *, void *));
diff -ruN pine4.61/pine/status.c pine4.61.new/pine/status.c
--- pine4.61/pine/status.c	2004-05-07 18:56:52.000000000 -0400
+++ pine4.61.new/pine/status.c	2004-11-05 21:54:45.933284024 -0500
@@ -1821,7 +1821,7 @@
      int line, column;
      HelpType help;
 {
-    char **text;
+    HelpType text;
 
 #if defined(HELPFILE)
     text = get_help_text(help);
diff -ruN pine4.61/pine/strings.c pine4.61.new/pine/strings.c
--- pine4.61/pine/strings.c	2004-07-14 18:15:10.000000000 -0400
+++ pine4.61.new/pine/strings.c	2004-11-05 21:54:45.936283568 -0500
@@ -516,15 +516,15 @@
   ----*/
 char *	    
 srchstr(is, ss)
-    char *is, *ss;
+    const char *is, *ss;
 {
-    register char *p, *q;
+    register const char *p, *q;
 
     if(ss && is)
       for(; *is; is++)
 	for(p = ss, q = is; ; p++, q++){
 	    if(!*p)
-	      return(is);			/* winner! */
+	      return((char *)is);		/* winner! */
 	    else if(!*q)
 	      return(NULL);			/* len(ss) > len(is)! */
 	    else if(*p != *q && !CMPNOCASE(*p, *q))
