🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #60090

Re: [slrn] [suggestion] kill for N days -> Slrn WishList

#60090
From: phg... Philipp Grau
Date: Mon, 03 Apr 2000 00:00
72 lines
3077 bytes
On 3 Apr 2000 10:57:56 GMT, Sven Guckes wrote:
>* Curly++ <ocu...@NOSPAM.usa.net>:
>> When I 'K'ill a message, usually to mark the subject as interesting
>> for the next month or two, I have to enter the duration by figuring
>> out the termination date.  I know I want to keep the entry in my
>> killfile for about 40 days. [...] Why not let me enter something
>> like "+40" instead of "10/5/2000"?
>> It's not the keystrokes, it's all the converting back and forth.
>
>Your wish has been on the wishlist since July 1996.  ;-)

Here is a small patch that works for me, the usual disclaimers
apply... Did not check for mktime on non-Irix systems.

#v+
--- editscore.c.org	Thu Dec 23 18:24:44 1999
+++ editscore.c	Mon Apr  3 16:41:38 2000
@@ -48,6 +48,7 @@
    char file[256];
    char qregexp[512];
    unsigned int mm = 0, dd = 0, yy = 0;
+   int days = 0;
    int use_expired = 0;
    unsigned int linenum = 0;
    char *q, *ng = newsgroup;
@@ -80,10 +81,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, DD-MM-YYYY, +NN (days)  or leave blank)", NULL, qregexp, 1, 0))
 	       return -1;
 	     if (*qregexp)
 	       {
+		  if (1 == sscanf(qregexp, "+%d",&days)) {
+		     if (days < 1) {
+		       continue;
+		     } else {
+			struct tm *mytime,*newtime;
+			time_t newclock;
+			myclock = time((time_t *) 0); 
+			mytime = localtime(&myclock);
+			mytime->tm_hour = mytime->tm_hour + (24 * days);
+			newclock = mktime(mytime);
+			newtime = localtime(&newclock);
+			dd = newtime->tm_mday;
+			mm = newtime->tm_mon + 1;
+			yy = newtime->tm_year + 1900;
+			use_expired = 1;
+			break;
+		     }
+		  }
+		  
 		  if (((3 != sscanf (qregexp, "%u/%u/%u", &mm, &dd, &yy))
 		       && (3 != sscanf (qregexp, "%u-%u-%u", &dd, &mm, &yy)))
 		      || (dd > 31)

#v-

Give it a try and let me know if something goes wrong.

\bye
Philipp


-- 
 Philipp Grau               | Freie Universitaet Berlin 
 phg...@zedat.fu-berlin.de  | Zentraleinrichtung fuer Datenverarbeitung
                            |
    We had joy, we had fun, | we had Pacman on the sun...      
Technical Details
Message-ID: <slrn8ehcba.7ocq.phgrau@Python.CIS.FU-Berlin.DE>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp!not-for-mail
References: <slrn8efjlh.32u.ocurtin@jarod.oc> <2000-04-03T12-02-05@guckes.net>

Show Full Headers
Complete Article Headers
Message-ID: <slrn8ehcba.7ocq.phgrau@Python.CIS.FU-Berlin.DE>
Subject: Re: [slrn] [suggestion] kill for N days -> Slrn WishList
Date: Mon, 03 Apr 2000 00:00:00 +0000
From: phg...@zedat.fu-berlin.de (Philipp Grau)
References: <slrn8efjlh.32u.ocurtin@jarod.oc> <2000-04-03T12-02-05@guckes.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp!not-for-mail
X-Deja-AN: 606079484
X-Trace: fu-berlin.de 954773866 6374883 160.45.11.158 (16 17 19)
Organization: Freie Universitaet Berlin
User-Agent: slrn/0.9.6.2+ (IRIX)
Reply-To: phg...@zedat.fu-berlin.de
Newsgroups: news.software.readers,alt.lang.s-lang