🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #51735

Re: [slrn] new feature suggestions

#51735
From: David Pashley
Date: Thu, 09 Sep 1999 00:00
72 lines
3147 bytes
Andreas Barth's words, in praise for the llamas, were:
> On Wed, 8 Sep 1999 11:36:21 +0100 (BST), David Pashley <cszdp@scs.leeds.ac.uk> wrote:
[snip me not reading the manual]
> 
> > When adding rules to the score file with K, adding the option of
> > specifying the number of days that you want the score for. Currently you
> > can choose a date, but often I want to flag a article's subject so I can
> > read any follow ups. I would only like to have that rule for 10 days. I
> > would rather say I want to follow that subject for the next 10 days than
> > work out when 10 days from now is.
> 
> That seems interessting. It would be nice to have a default
> value, so that normally all I have to do ist to acceppt.
> 
The default is to not expire the score, so it wouldn't really be
possible to do that.

Below is a patch I worked on last night against 0.9.5.7. There could be
a memory leak caused by localtime allocating memory to the tm struct.

--- slrn-0.9.5.7/src/editscore.c.old	Wed Sep  8 19:16:48 1999
+++ slrn-0.9.5.7/src/editscore.c	Thu Sep  9 09:41:56 1999
@@ -45,7 +45,7 @@
    int ich;
    char file[256];
    char qregexp[512];
-   unsigned int mm = 0, dd = 0, yy = 0;
+   unsigned int mm = 0, dd = 0, yy = 0, d = 0;
    int use_expired = 0;
    unsigned int linenum = 0;
    char *q, *ng = newsgroup;
@@ -78,16 +78,29 @@
 	while (1)
 	  {
 	     *qregexp = 0;
-	     if (-1 == slrn_read_input ("Expires (MM/DD/YYYY or DD-MM-YYYY or leave blank)", NULL, qregexp, 1, 0))
+	     if (-1 == slrn_read_input ("Expires (MM/DD/YYYY or DD-MM-YYYY or DDdays or leave blank)", NULL, qregexp, 1, 0))
 	       return -1;
 	     if (*qregexp)
 	       {
-		  if (((3 != sscanf (qregexp, "%u/%u/%u", &mm, &dd, &yy))
+		  if ((((3 != sscanf (qregexp, "%u/%u/%u", &mm, &dd, &yy))
 		       && (3 != sscanf (qregexp, "%u-%u-%u", &dd, &mm, &yy)))
 		      || (dd > 31)
 		      || (mm > 12)
 		      || (yy < 1900))
+		      &&((1 != sscanf (qregexp, "%udays", &d))
+		      || (d < 0)))
 		    continue;
+
+		 if (d>0) {
+			 struct tm *date;
+			 myclock = time ((time_t *) 0);
+			 myclock = myclock + (d * 86400);
+			 date = localtime (&myclock);
+			 dd = date->tm_mday;
+			 mm = date->tm_mon + 1;
+			 yy = date->tm_year + 1900;
+		 }
+
 		  use_expired = 1;
 		  break;
 	       }


-- 
David Pashley
david@davidpashley.com
http://www.davidpashley.com
Now he understood - "If it ain't broken, don't fix it"

Technical Details
Message-ID: <936794927.936794927.cszdp@scs.leeds.ac.uk>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail
References: <936630443.936630442.cszdp@scs.leeds.ac.uk> <slrn7tcv1k.5r8.aba@aphrodite.muenchen.pro-bahn.de>

Show Full Headers
Complete Article Headers
Message-ID: <936794927.936794927.cszdp@scs.leeds.ac.uk>
Subject: Re: [slrn] new feature suggestions
Date: Thu, 09 Sep 1999 00:00:00 +0000
From: cszdp@scs.leeds.ac.uk (David Pashley)
References: <936630443.936630442.cszdp@scs.leeds.ac.uk> <slrn7tcv1k.5r8.aba@aphrodite.muenchen.pro-bahn.de>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail
X-Deja-AN: 522875320
User-Agent: slrn/0.9.5.7 (UNIX)
Reply-To: david@davidpashley.com
Newsgroups: news.software.readers