SOURCES: slrn-pl-slang2.patch (NEW) - started port to slang2
arekm
arekm at pld-linux.org
Sun Sep 18 23:25:54 CEST 2005
Author: arekm Date: Sun Sep 18 21:25:54 2005 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- started port to slang2
---- Files affected:
SOURCES:
slrn-pl-slang2.patch (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: SOURCES/slrn-pl-slang2.patch
diff -u /dev/null SOURCES/slrn-pl-slang2.patch:1.1
--- /dev/null Sun Sep 18 23:25:54 2005
+++ SOURCES/slrn-pl-slang2.patch Sun Sep 18 23:25:49 2005
@@ -0,0 +1,683 @@
+diff -urNbB slrn-0.9.7.4.org/src/art.c slrn-0.9.7.4/src/art.c
+--- slrn-0.9.7.4.org/src/art.c 2005-09-18 22:12:15.781423000 +0200
++++ slrn-0.9.7.4/src/art.c 2005-09-18 22:59:58.958154608 +0200
+@@ -779,7 +779,7 @@
+ int dir)
+ /* dir: 0 is backward, 1 is forward, 2 is "find first" */
+ {
+- SLsearch_Type st;
++ SLsearch_Type *st;
+ Slrn_Article_Line_Type *l;
+ Slrn_Article_Type *a;
+ char *ptr;
+@@ -796,7 +796,12 @@
+ if (re == NULL)
+ return NULL;
+ }
+- else SLsearch_init (string, 1, 0, &st);
++ else
++ {
++ if (NULL == (st = SLsearch_new ((unsigned char *)string, 0)))
++ return NULL;
++ SLsearch_init (string, 1, 0, st);
++ }
+
+ a = Slrn_Current_Article;
+ if (dir == 2)
+@@ -815,9 +820,8 @@
+ if (is_regexp)
+ ptr = (char *) slrn_regexp_match (re, l->buf);
+ else
+- ptr = (char *) SLsearch ((unsigned char *) l->buf,
+- (unsigned char *) l->buf + strlen (l->buf),
+- &st);
++ ptr = (char *) SLsearch_forward (st, (unsigned char *) l->buf,
++ (unsigned char *) l->buf + strlen (l->buf));
+
+ if (ptr != NULL)
+ {
+@@ -834,6 +838,8 @@
+ l = (dir ? l->next : l->prev);
+ }
+
++ SLsearch_delete(st);
++
+ return l;
+ }
+
+@@ -2121,7 +2127,7 @@
+ if (status == 0)
+ break;
+
+- if ((status == -1) || (SLang_Error == USER_BREAK))
++ if ((status == -1) || (SLang_get_err() == USER_BREAK))
+ {
+ if (Slrn_Server_Obj->sv_reset != NULL)
+ Slrn_Server_Obj->sv_reset ();
+@@ -2501,7 +2507,7 @@
+ */
+ static int check_for_current_article (void)
+ {
+- if (SLang_Error)
++ if (SLang_get_err())
+ return -1;
+ if (Slrn_Current_Article == NULL)
+ {
+@@ -2531,7 +2537,7 @@
+ {
+ SLRegexp_Type *re;
+ re = *r++;
+- if (NULL != (was = SLang_regexp_match ((unsigned char*) subject, len, re)))
++ if (NULL != (was = SLregexp_match (re, (unsigned char*) subject, len)))
+ {
+ if (was == (unsigned char*) subject)
+ was = NULL;
+@@ -2568,10 +2574,12 @@
+ while (*r != NULL)
+ {
+ SLRegexp_Type *re = *r;
+- if (subject == (char*) SLang_regexp_match
+- ((unsigned char*) subject, len, re))
++ if (subject == (char*) SLregexp_match
++ (re, (unsigned char*) subject, len))
+ {
+- subject = subject + re->end_matches[0];
++ unsigned int ofs, mlen;
++ (void) SLregexp_nth_match (re, 0, &ofs, &mlen);
++ subject += mlen;
+ break;
+ }
+ r++;
+@@ -3635,7 +3643,7 @@
+ static Slrn_Header_Type *Same_Subject_Start_Header;
+ static void next_header_same_subject (void) /*{{{*/
+ {
+- SLsearch_Type st;
++ SLsearch_Type *st;
+ Slrn_Header_Type *l;
+ static char same_subject[256];
+
+@@ -3646,7 +3654,9 @@
+ if (slrn_read_input (_("Subject: "), same_subject, NULL, 0, 0) <= 0) return;
+ Same_Subject_Start_Header = Slrn_Current_Header;
+ }
+- SLsearch_init (same_subject, 1, 0, &st);
++ if (NULL == (st = SLsearch_new ((unsigned char *)same_subject, 0)))
++ return;
++ SLsearch_init (same_subject, 1, 0, st);
+
+ l = Slrn_Current_Header->next;
+
+@@ -3658,14 +3668,15 @@
+ ((l->flags & HEADER_READ) == 0) &&
+ #endif
+ (l->subject != NULL)
+- && (NULL != SLsearch ((unsigned char *) l->subject,
+- (unsigned char *) l->subject + strlen (l->subject),
+- &st)))
++ && (NULL != SLsearch_forward (st, (unsigned char *) l->subject,
++ (unsigned char *) l->subject + strlen (l->subject))));
+ break;
+
+ l = l->next;
+ }
+
++ SLsearch_delete(st);
++
+ if (l == NULL)
+ {
+ slrn_error (_("No more articles on that subject."));
+@@ -4000,10 +4011,10 @@
+ if (-1 == save_article_as_unix_mail (Num_Tag_List.headers[i], fp))
+ {
+ slrn_smg_refresh ();
+- if (SLang_Error == SL_USER_BREAK)
++ if (SLang_get_err() == SL_USER_BREAK)
+ break;
+
+- SLang_Error = 0;
++ SLang_set_err(0);
+ (void) SLang_input_pending (5); /* half second delay */
+ slrn_clear_message ();
+ }
+@@ -4020,7 +4031,7 @@
+ if (-1 == save_article_as_unix_mail (h, fp))
+ {
+ slrn_smg_refresh ();
+- SLang_Error = 0;
++ SLang_set_err(0);
+ (void) SLang_input_pending (5); /* half second delay */
+ }
+ else num_saved++;
+@@ -4032,7 +4043,7 @@
+ }
+ slrn_fclose (fp);
+
+- if (SLang_Error) return NULL;
++ if (SLang_get_err()) return NULL;
+
+ return Output_Filename;
+ }
+@@ -4150,7 +4161,7 @@
+ # endif
+ (void) slrn_uudecode_file (file, NULL, 0, NULL);
+
+- if (SLang_Error == 0)
++ if (SLang_get_err() == 0)
+ {
+ if (1 == slrn_get_yesno (1, _("Delete %s"), file))
+ {
+@@ -4586,7 +4597,7 @@
+ static void header_generic_search (int dir, int type) /*{{{*/
+ {
+ static char search_str[256];
+- SLsearch_Type st;
++ SLsearch_Type *st;
+ Slrn_Header_Type *l;
+ char* prompt;
+ int ret;
+@@ -4599,7 +4610,10 @@
+ slrn_free (prompt);
+ if (ret <= 0) return;
+
+- SLsearch_init (search_str, 1, 0, &st);
++ if (NULL == (st = SLsearch_new ((unsigned char *)search_str, 0)))
++ return;
++
++ SLsearch_init (search_str, 1, 0, st);
+
+ if (dir > 0) l = Slrn_Current_Header->next;
+ else l = Slrn_Current_Header->prev;
+@@ -4609,20 +4623,20 @@
+ if (type == 's')
+ {
+ if ((l->subject != NULL)
+- && (NULL != SLsearch ((unsigned char *) l->subject,
+- (unsigned char *) l->subject + strlen (l->subject),
+- &st)))
++ && (NULL != SLsearch_forward (st, (unsigned char *) l->subject,
++ (unsigned char *) l->subject + strlen (l->subject))));
+ break;
+ }
+ else if ((l->from != NULL)
+- && (NULL != SLsearch ((unsigned char *) l->from,
+- (unsigned char *) l->from + strlen (l->from),
+- &st)))
++ && (NULL != SLsearch_forward (st, (unsigned char *) l->from,
++ (unsigned char *) l->from + strlen (l->from))));
+ break;
+
+ if (dir > 0) l = l->next; else l = l->prev;
+ }
+
++ SLsearch_delete(st);
++
+ if (l == NULL)
+ {
+ slrn_error (_("Not found."));
+@@ -4858,7 +4872,7 @@
+
+ slrn_message_now (_("Scoring articles ..."));
+
+- while ((h != NULL) && (SLang_Error != USER_BREAK))
++ while ((h != NULL) && (SLang_get_err() != USER_BREAK))
+ {
+ Slrn_Header_Type *prev, *next;
+ prev = h->real_prev;
+@@ -4887,10 +4901,10 @@
+ }
+ h = next;
+ }
+- if (SLang_Error == USER_BREAK)
++ if (SLang_get_err() == USER_BREAK)
+ {
+ slrn_error ("Scoring aborted.");
+- SLang_Error = 0;
++ SLang_set_err(0);
+ }
+ if (apply_kill)
+ Slrn_Current_Header = _art_Headers = Slrn_First_Header;
+@@ -5094,7 +5108,7 @@
+
+ while (-1 != (this_num = slrn_read_add_xover(&l)))
+ {
+- if (SLang_Error == USER_BREAK)
++ if (SLang_get_err() == USER_BREAK)
+ {
+ if (Slrn_Server_Obj->sv_reset != NULL)
+ Slrn_Server_Obj->sv_reset ();
+@@ -5138,7 +5152,7 @@
+ if (total == 0)
+ return 0;
+
+- if (SLang_Error == USER_BREAK)
++ if (SLang_get_err() == USER_BREAK)
+ return -1;
+
+ if ((reads_per_update = Slrn_Reads_Per_Update) < 5)
+@@ -5163,7 +5177,7 @@
+ {
+ int this_num;
+
+- if (SLang_Error == USER_BREAK)
++ if (SLang_get_err() == USER_BREAK)
+ {
+ if (Slrn_Server_Obj->sv_reset != NULL)
+ Slrn_Server_Obj->sv_reset ();
+@@ -5187,7 +5201,7 @@
+ h = process_xover (&xov);
+
+ if ((1 == (num % reads_per_update))
+- && (SLang_Error == 0))
++ && (SLang_get_err() == 0))
+ {
+ slrn_message_now (_("%s: headers received: %2d/%d"),
+ Slrn_Current_Group_Name, num, total);
+@@ -6657,7 +6671,7 @@
+ unsigned int len, i;
+
+ SLsmg_gotorc (r - 1, 0);
+- len = SLsmg_read_raw (buf, sizeof (buf));
++ len = SLsmg_read_raw ((SLsmg_Char_Type *)buf, sizeof (buf));
+
+ i = (unsigned int) c;
+ while (c && (((buf[--c] >> 8) & 0xFF) == URL_COLOR))
+@@ -7074,7 +7088,7 @@
+
+ SLkm_define_key ("z", (FVOID_STAR) zoom_article_window, Slrn_Article_Keymap);
+
+- if (SLang_Error) slrn_exit_error (err);
++ if (SLang_get_err()) slrn_exit_error (err);
+ }
+
+ /*}}}*/
+@@ -7172,7 +7186,7 @@
+
+ #if SLRN_HAS_SLANG
+ slrn_run_hooks (HOOK_PRE_ARTICLE_MODE, 0);
+- if (SLang_Error)
++ if (SLang_get_err())
+ return -1;
+ #endif
+
+@@ -7305,7 +7319,7 @@
+
+ if ((status == -1) || SLKeyBoard_Quit)
+ {
+- if (SLang_Error == USER_BREAK)
++ if (SLang_get_err() == USER_BREAK)
+ slrn_error_now (0, _("Group transfer aborted."));
+ else
+ slrn_error_now (0, _("Server read failed."));
+@@ -7331,7 +7345,7 @@
+
+ free_kill_lists_and_update ();
+ Slrn_Current_Group_Name = NULL;
+- if ((SLang_Error == USER_BREAK) || (all != 0)) return -1;
++ if ((SLang_get_err() == USER_BREAK) || (all != 0)) return -1;
+ else return -2;
+ }
+
+@@ -7372,7 +7386,7 @@
+ #endif
+
+ if (Slrn_Startup_With_Article) art_pagedn ();
+- if (SLang_Error == 0)
++ if (SLang_get_err() == 0)
+ {
+ if (Perform_Scoring
+ /* && (Number_Killed || Number_High_Scored) */
+diff -urNbB slrn-0.9.7.4.org/src/editscore.c slrn-0.9.7.4/src/editscore.c
+--- slrn-0.9.7.4.org/src/editscore.c 2001-11-03 16:15:11.000000000 +0100
++++ slrn-0.9.7.4/src/editscore.c 2005-09-18 23:08:21.101817168 +0200
+@@ -57,7 +57,7 @@
+ FILE *fp;
+ time_t myclock;
+ int file_modified = 0, re_error = 0;
+- SLRegexp_Type re;
++ SLRegexp_Type *re;
+ /* Note to translators: The translated string needs to have 10 characters.
+ * Each pair becomes a valid response for "Subject", "From", "References",
+ * "Edit" and "Cancel" (in that order); you cannot use any of the default
+@@ -154,10 +154,7 @@
+ return -1;
+ }
+
+- re.pat = (unsigned char*) qregexp;
+- re.buf = (unsigned char*) buf;
+- re.buf_len = sizeof (buf);
+- re.case_sensitive = 0;
++ re = NULL;
+
+ if (Slrn_Prefix_Arg_Ptr == NULL)
+ {
+@@ -182,7 +179,7 @@
+
+ if ((NULL == (q = SLregexp_quote_string (subject, qregexp, sizeof (qregexp)))) ||
+ (ch != 's') ||
+- (0 != SLang_regexp_compile (&re)))
++ (NULL == (re = SLregexp_compile (qregexp, SLREGEXP_CASELESS))))
+ {
+ re_error |= (ch == 's');
+ comment = 1;
+@@ -192,10 +189,15 @@
+ fprintf (fp, "%c\tSubject: %s\n",
+ (comment ? '%' : ' '), (q ? q : subject));
+ slrn_free (subject);
++ if (re != NULL)
++ {
++ SLregexp_free (re);
++ re = NULL;
++ }
+
+ if ((NULL == (q = SLregexp_quote_string (h->from, qregexp, sizeof (qregexp)))) ||
+ (ch != 'f') ||
+- (0 != SLang_regexp_compile (&re)))
++ (NULL == (re = SLregexp_compile (qregexp, SLREGEXP_CASELESS))))
+ {
+ re_error |= (ch == 'f');
+ comment = 1;
+@@ -207,7 +209,7 @@
+
+ if ((NULL == (q = SLregexp_quote_string (h->msgid, qregexp, sizeof (qregexp)))) ||
+ (ch != 'r') ||
+- (0 != SLang_regexp_compile (&re)))
++ (NULL == (re = SLregexp_compile (qregexp, SLREGEXP_CASELESS))))
+ {
+ re_error |= (ch == 'r');
+ comment = 1;
+@@ -216,6 +218,11 @@
+ comment = 0;
+ fprintf (fp, "%c\tReferences: %s\n",
+ (comment ? '%' : ' '), (q ? q : h->msgid));
++ if (re != NULL)
++ {
++ SLregexp_free (re);
++ re = NULL;
++ }
+
+ if (NULL != (q = SLregexp_quote_string (h->xref, qregexp, sizeof (qregexp))))
+ {
+diff -urNbB slrn-0.9.7.4.org/src/group.c slrn-0.9.7.4/src/group.c
+--- slrn-0.9.7.4.org/src/group.c 2005-09-18 22:12:15.782423000 +0200
++++ slrn-0.9.7.4/src/group.c 2005-09-18 23:14:22.565866280 +0200
+@@ -843,14 +843,16 @@
+
+ int slrn_group_search (char *str, int dir) /*{{{*/
+ {
+- SLsearch_Type st;
++ SLsearch_Type *st = NULL;
+ Slrn_Group_Type *g;
+ int found = 0;
+
+ g = Slrn_Group_Current_Group;
+ if (g == NULL) return 0;
+
+- SLsearch_init (str, 1, 0, &st);
++ st = SLsearch_new ((SLuchar_Type *) str, SLSEARCH_CASELESS);
++ if (st == NULL)
++ return 0;
+
+ do
+ {
+@@ -868,13 +870,11 @@
+
+ if ((g->flags & GROUP_HIDDEN) == 0)
+ {
+- if ((NULL != SLsearch ((unsigned char *) g->group_name,
+- (unsigned char *) g->group_name + strlen (g->group_name),
+- &st))
++ if ((NULL != SLsearch_forward (st, (unsigned char *) g->group_name,
++ (unsigned char *) g->group_name + strlen (g->group_name)))
+ || ((NULL != g->descript)
+- && (NULL != SLsearch ((unsigned char *) g->descript,
+- (unsigned char *) g->descript + strlen (g->descript),
+- &st))))
++ && (NULL != SLsearch_forward (st, (unsigned char *) g->descript,
++ (unsigned char *) g->descript + strlen (g->descript)))))
+ {
+ found = 1;
+ break;
+@@ -883,6 +883,8 @@
+ }
+ while (g != Slrn_Group_Current_Group);
+
++ SLsearch_delete (st);
++
+ Slrn_Group_Current_Group = g;
+ find_line_num ();
+ return found;
+@@ -999,17 +1001,17 @@
+ if (Slrn_Group_Current_Group == NULL)
+ return;
+
+- while ((SLang_Error == 0) && (1 == slrn_group_down_n (1)))
++ while ((SLang_get_error() == 0) && (1 == slrn_group_down_n (1)))
+ {
+ if (Slrn_Group_Current_Group->unread == 0)
+ continue;
+
+ if (0 == slrn_group_select_group ())
+ break;
+- else if (SLang_Error == INTRINSIC_ERROR)
++ else if (SLang_get_error() == INTRINSIC_ERROR)
+ /* all articles killed by scorefile, so proceed */
+ {
+- SLang_Error = 0;
++ SLang_set_error(0);
+ slrn_clear_message ();
+ }
+ }
+@@ -1021,7 +1023,7 @@
+ if (Slrn_Group_Current_Group == NULL)
+ return;
+
+- while ((SLang_Error == 0) && (1 == slrn_group_up_n (1)))
++ while ((SLang_get_error() == 0) && (1 == slrn_group_up_n (1)))
+ {
+ if (Slrn_Group_Current_Group->unread == 0)
+ continue;
+@@ -1469,6 +1471,7 @@
+ }
+ find_line_num ();
+ Slrn_Full_Screen_Update = 1;
++ SLregexp_free (re);
+ }
+
+ /*}}}*/
+@@ -1538,6 +1541,7 @@
+ }
+ find_line_num ();
+ Slrn_Full_Screen_Update = 1;
++ SLregexp_free (re);
+ }
+
+ /*}}}*/
+@@ -1629,6 +1633,7 @@
+ }
+ g = g->next;
+ }
++ SLregexp_free (re);
+ }
+
+ g = Slrn_Group_Current_Group;
+@@ -1754,7 +1759,7 @@
+
+ #if SLRN_HAS_SLANG
+ slrn_run_hooks (HOOK_POST, 0);
+- if (SLang_Error)
++ if (SLang_get_error())
+ return;
+ #endif
+
+@@ -2123,7 +2128,7 @@
+ #if USE_TEST_FUNCTION
+ SLkm_define_key ("y", (FVOID_STAR) test_function, Slrn_Group_Keymap);
+ #endif
+- if (SLang_Error) slrn_exit_error (err);
++ if (SLang_get_error()) slrn_exit_error (err);
+ }
+
+ /*}}}*/
+diff -urNbB slrn-0.9.7.4.org/src/hooks.c slrn-0.9.7.4/src/hooks.c
+--- slrn-0.9.7.4.org/src/hooks.c 2002-03-13 14:01:05.000000000 +0100
++++ slrn-0.9.7.4/src/hooks.c 2005-09-18 23:15:07.170085408 +0200
+@@ -131,7 +131,7 @@
+ {
+ unsigned int i;
+
+- if (SLang_Error) return -1;
++ if (SLang_get_error()) return -1;
+
+ if (0 == SLang_is_defined (hook))
+ return 0;
+@@ -144,7 +144,7 @@
+ break;
+ }
+
+- if (SLang_Error) return -1;
++ if (SLang_get_error()) return -1;
+ return SLang_execute_function (hook);
+ }
+
+diff -urNbB slrn-0.9.7.4.org/src/interp.c slrn-0.9.7.4/src/interp.c
+--- slrn-0.9.7.4.org/src/interp.c 2005-09-18 22:12:15.776424000 +0200
++++ slrn-0.9.7.4/src/interp.c 2005-09-18 23:17:41.017697016 +0200
+@@ -109,7 +109,7 @@
+
+ if (NULL == (argv = (char **) slrn_malloc (sizeof (char *) * (argc + 1), 1, 1)))
+ {
+- SLang_Error = SL_MALLOC_ERROR;
++ SLang_set_error(SL_MALLOC_ERROR);
+ return NULL;
+ }
+
+@@ -528,14 +528,8 @@
+ return;
+ }
+
+- if ((kmap == Slrn_Keymap_RLI->keymap) &&
+- (NULL == SLang_find_key_function(fun, kmap)))
+- {
+- SLKeymap_Function_Type *tmp = kmap->functions;
+- kmap->functions = Slrn_Custom_Readline_Functions;
+- SLang_define_key (key, fun, kmap);
+- kmap->functions = tmp;
+- }
++ if (kmap == SLrline_get_keymap (Slrn_Keymap_RLI))
++ (void) slrn_rline_setkey (key, fun, kmap);
+ else
+ SLang_define_key (key, fun, kmap);
+ }
+@@ -893,7 +887,7 @@
+
+ if (NULL == (s = (char *) SLMALLOC (len + 1)))
+ {
+- SLang_Error = SL_MALLOC_ERROR;
++ SLang_set_error(SL_MALLOC_ERROR);
+ return NULL;
+ }
+
+diff -urNbB slrn-0.9.7.4.org/src/menu.c slrn-0.9.7.4/src/menu.c
+--- slrn-0.9.7.4.org/src/menu.c 2005-09-18 22:12:15.783423000 +0200
++++ slrn-0.9.7.4/src/menu.c 2005-09-18 23:18:04.419139456 +0200
+@@ -766,7 +766,7 @@
+ SLkm_define_key (buf, (FVOID_STAR) sl_jump, Select_List_Keymap);
+ }
+
+- if (SLang_Error)
++ if (SLang_get_error())
+ return -1;
+
<<Diff was trimmed, longer than 597 lines>>
More information about the pld-cvs-commit
mailing list