🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #56497

[slrn] howto update counter in hook?

#56497
From: Rejo Zenger
Date: Thu, 06 Jan 2000 00:00
68 lines
3026 bytes
Hi,

I'm trying to have an address in my header that is uniq at every post
that i do. I thunk i can get this by having sa number in file that gets
increased every time i do a post. The number is inserted in my address i
use to post. So, just tried a thing and came to the following, but i
have two problems...

  variable Default_username;
  variable Default_replyto;

  Default_username = get_variable_value ("username");
  Default_replyto = get_variable_value ("replyto");

  define post_hook ()
  {
     variable cache_file = "/home/rejo/news/cache.txt";
     variable file_open = fopen (cache_file, "r");
     variable x;
     variable y = expr x + 1;

     if (file_open == NULL)
       {
          () = fprintf (stderr, "Unable to open %s\n", cache_file);
          return -1;
       }
   
     while (-1 != fgets (&x, file_open))
       {
          variable a;
  	  a = Default_username;
          a = sprintf ("rejo.f"+y, a);
          set_string_variable ("username", a);

          variable b;
          b = Default_replyto;
          b = sprintf ("rejo.r"+y, b);
          set_string_variable ("replyto", b);
        }
 
     () = fputs (y, file_open);
     () = fclose (file_open);
     return 0;
  }

In the first place, how can i increase that variable in the file (see
the line "variable y = expr x + 1;" above)? Do i have to do something
externally? I tried to use expr, but that (not a surprise) didn't work.
What should i use?

And how can i get this variable inserted in the address? I now have 
  a = sprintf ("rejo.f"+y, a);
but that doesn't work, i guess because of the quoting. I tried all
three, but i just cannot figure out what i need...

Someone know what i should do now?

	-Rejo.



-- 
= Rejo Zenger  [Sister Ray Crisiscentrum]               rejo@sisterray.xs4all.nl
= http://mediaport.org/~sister (and my_urls.html)               PGP: see headers
--------------------------------------------------------------------------------
  Destroy a spamhaus! http://www.xs4all.nl/~sister/mirror/sengir/spam_sites.html

Technical Details
Message-ID: <slrn87a8om.16h.rejo.f0001nim@sisterray.xs4all.nl>
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

Show Full Headers
Complete Article Headers
Message-ID: <slrn87a8om.16h.rejo.f0001nim@sisterray.xs4all.nl>
Subject: [slrn] howto update counter in hook?
Date: Thu, 06 Jan 2000 00:00:00 +0000
From: rejo.f0001nim@sisterray.xs4all.nl (Rejo Zenger)
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: 569306047
X-PGP-Id: ELG-E/DSS: 0x75FC50F3, DSS/DH: 0x2C8059B5, RSA: 0xFAE40065
X-Complaints-To: abuse@xs4all.nl
X-Trace: news1.xs4all.nl 947200813 23878 194.109.57.59 (6 Jan 2000 23:20:13 GMT)
Organization: Sister Ray Zenuwcentrum
X-PGP-Keys: Available at keyserver and website or finger <sister@xs4all.nl>
User-Agent: slrn/0.9.5.7 (UNIX)
Reply-To: rejo@sisterray.xs4all.nl
NNTP-Posting-Date: 6 Jan 2000 23:20:13 GMT
Newsgroups: news.software.readers