Thread View: news.software.readers
34 messages
34 total messages
Started by Crashdamage
Sat, 28 Jun 2003 17:29
slrn - Will it show uptime like Mutt?
Author: Crashdamage
Date: Sat, 28 Jun 2003 17:29
Date: Sat, 28 Jun 2003 17:29
10 lines
1026 bytes
1026 bytes
With Mutt, I use this line to show my uptime in mail headers to Windows boneheads: my_hdr X-Uptime: `uptime | sed -e 's/.*up \([^,]*\),.*/\1/'` Is there a way to this in slrn? Can't find it in the manual or anything like it in examples of .slrnrc files. Thanks...
Re: slrn - Will it show uptime like Mutt?
Author: Mark Hill
Date: Sat, 28 Jun 2003 17:53
Date: Sat, 28 Jun 2003 17:53
21 lines
1638 bytes
1638 bytes
On 2003-06-28,
Crashdamage <tmeador@nospam.invalid> wrote:
>
> my_hdr X-Uptime: `uptime | sed -e 's/.*up \([^,]*\),.*/\1/'`
>
> Is there a way to this in slrn?
I found the following macro in Google groups:
<URL:http://groups.google.co.uk/groups?q=slrn+X-uptime&hl=en&lr=&ie=UTF-8&selm=slrn9vtlum.16i.davdi%40glop.davdi.perso&rnum=1>
Maybe you can customise it to your needs?
It seems to work. I'm using it right now. :)
--
Mark Hill <mark_usenet@yahoo.co.uk>
"No bugs were harmed in the preparation of this patch.
It's just me fartarsing around."
- Andrew Morton
Re: slrn - Will it show uptime like Mutt?
Author: Andrew Preater
Date: Sat, 28 Jun 2003 18:17
Date: Sat, 28 Jun 2003 18:17
17 lines
1496 bytes
1496 bytes
* Crashdamage <tmeador@nospam.invalid>: > With Mutt, I use this line to show my uptime in mail headers to > Windows boneheads: > > my_hdr X-Uptime: `uptime | sed -e 's/.*up \([^,]*\),.*/\1/'` > > Is there a way to this in slrn? You can do this with an s-lang macro in slrn, in fact you could insert the output of any external command. Here's a suitable macro to do this, uname is given as an example: http://www.geocities.com/tsca.geo/slang/ext_header.txt -- Andrew Preater
Re: slrn - Will it show uptime like Mutt?
Author: Crashdamage
Date: Sat, 28 Jun 2003 19:29
Date: Sat, 28 Jun 2003 19:29
21 lines
1601 bytes
1601 bytes
Thanks, from what I can tell it might, but I'm not sure. I don't do French, so I'll have to wait 'til my daughter who does has a chance to do a little translation for me. On 28 Jun 2003 17:53:59 GMT, Mark Hill <mark_usenet@yahoo.co.uk> wrote: > On 2003-06-28, > Crashdamage <tmeador@nospam.invalid> wrote: >> >> my_hdr X-Uptime: `uptime | sed -e 's/.*up \([^,]*\),.*/\1/'` >> >> Is there a way to this in slrn? > > I found the following macro in Google groups: > ><URL:http://groups.google.co.uk/groups?q=slrn+X-uptime&hl=en&lr=&ie=UTF-8&selm=slrn9vtlum.16i.davdi%40glop.davdi.perso&rnum=1> > > Maybe you can customise it to your needs? > > It seems to work. I'm using it right now. :) >
Re: slrn - Will it show uptime like Mutt?
Author: SINNER
Date: Sat, 28 Jun 2003 23:00
Date: Sat, 28 Jun 2003 23:00
17 lines
2076 bytes
2076 bytes
While strolling through news.software.readers, Crashdamage was overheard plotting:
> Thanks, from what I can tell it might, but I'm not sure. I don't do French,
> so I'll have to wait 'til my daughter who does has a chance to do a little
> translation for me.
>><URL:http://groups.google.co.uk/groups?q=slrn+X-uptime&hl=en&lr=&ie=UTF-8&selm=slrn9vtlum.16i.davdi%40glop.davdi.perso&rnum=1>
You dont need to understand french. Place that script in a file called
uptime.sl and interpret it in your slrnrc.
--
David
Lester Bangs: Don't let those swill merchants rewrite you.
-- "Almost Famous"
Re: slrn - Will it show uptime like Mutt?
Author: Crashdamage
Date: Sun, 29 Jun 2003 00:33
Date: Sun, 29 Jun 2003 00:33
32 lines
2220 bytes
2220 bytes
On Sat, 28 Jun 2003 23:00:48 GMT, SINNER wrote:
> While strolling through news.software.readers, Crashdamage was overheard
> plotting:
>> Thanks, from what I can tell it might, but I'm not sure. I don't do French,
>> so I'll have to wait 'til my daughter who does has a chance to do a little
>> translation for me.
>
> You dont need to understand french. Place that script in a file called
> uptime.sl and interpret it in your slrnrc.
OK, I'd already done that and yeah it works, but it trashes my
"X-Newsreader SLRN 0.9.7.4 (Linux)"
header line when I use it. Also, I can't figure how to add my entire
uptime command including the sed command to strip out extra info (this
actually is a line I ripped off Sven Guckes' muttrc):
"`uptime | sed -e 's/.*up \([^,]*\),.*/\1/'`"
I added it to the command line like this:
uptime="";
cmd = sprintf("uptime | sed -e 's/.*up \([^,]*\),.*/\1/'" );
and I thought that would do it, but it gets ignored and still puts the
whole verbose "uptime" command in the header.
I've also played around with the other scripts suggested, but no
go...I'm open to other suggestions...
Re: slrn - Will it show uptime like Mutt?
Author: surtin
Date: Sun, 29 Jun 2003 04:15
Date: Sun, 29 Jun 2003 04:15
16 lines
2362 bytes
2362 bytes
On Sun, 29 Jun 2003 00:33:05 GMT, Crashdamage wrote: > OK, I'd already done that and yeah it works, but it trashes my > > "X-Newsreader SLRN 0.9.7.4 (Linux)" > > header line when I use it. The code erases all of the other custom headers you would've had and replaces them with X-Uptime. I tried to use the macro and it killed my X-Face... anyone know a work around? -- .::surtin::. People usually get what's coming to them ... unless it's been mailed.
Re: slrn - Will it show uptime like Mutt?
Author: Martin Brunzel
Date: Sun, 29 Jun 2003 10:18
Date: Sun, 29 Jun 2003 10:18
34 lines
2569 bytes
2569 bytes
* surtin schrieb:
> On Sun, 29 Jun 2003 00:33:05 GMT, Crashdamage wrote:
>> OK, I'd already done that and yeah it works, but it trashes my
>>
>> "X-Newsreader SLRN 0.9.7.4 (Linux)"
>>
>> header line when I use it.
>
> The code erases all of the other custom headers you would've had and replaces
> them with X-Uptime. I tried to use the macro and it killed my X-Face... anyone
> know a work around?
| uptime = sprintf("X-Uptime: %s",uptime);
| set_string_variable ("followup_custom_headers", uptime);
Example for X-Newsreader:
| uptime = sprintf("X-Newsreader: SLRN 0.9.7.4 (Linux)\nX-Uptime: %s",uptime);
| set_string_variable ("followup_custom_headers", uptime);
Maybe you're interested in /usr/doc/slrn/manual.txt, 4.2.30.
(There are more *_custom_headers!)
The way for \n-ing multiple headers is demonstrated in the
sample-slrnrc.
Since followup_custom_headers is a variable, it is quite
obvious to me, why setting it twice does not work: The second
attempt will just overwrite the first. Maybe you're more
successful when invoking "followup_custom_headers()" twice, I
have not tested this yet.
Martin
Re: slrn - Will it show uptime like Mutt?
Author: Emmanuele Bassi
Date: Sun, 29 Jun 2003 10:58
Date: Sun, 29 Jun 2003 10:58
108 lines
4703 bytes
4703 bytes
* surtin [2003-06-29 06:15]:
>> header line when I use it.
>
> The code erases all of the other custom headers you would've had and replaces
> them with X-Uptime. I tried to use the macro and it killed my X-Face... anyone
> know a work around?
Since that macro is quite old, more than a "work around", it should need
an update.
The macro is untested. It works by simply adding new headers to the
"Headers" variable.
I'm afraid it could collide with my "Identity" macro, and with every
other macro that pokes around with headers... Other than that, it should
work (did I mention it is untested? :-))
#v+
% This macro needs SLRN >= 0.9.7.3 and S-Lang > 1.4.x
implements("myheaders");
% Variables {{{
private variable
custom_headers_dfl,
followup_headers_dfl,
private variable
Headers = Assoc_Tyoe [];
%}}}
% Custom headers: the key in the associative array is the header name,
% whilst the value is the command that should be used to generate the
% header's payload. Using the "set_preference" function by J.B.
% Nicholson-Owens, it should be easy to add more custom headers without
% actually touching this macro every time.
Headers["X-Uptime"] = "uptime";
Headers["X-OS-Name"] = "uname -sr";
private define get_command(command) %{{{
{
variable cmd_fp, output;
cmd_fp = popen(command, "r");
if (NULL == cmd_fp)
return "";
output = strjoin(fgetslines(cmd_fp), "");
return output;
} %}}}
private define retrieve_default() %{{{
{
custom_headers_dfl = get_variable_value("custom_headers");
followup_headers_dfl = get_variable_value("followup_custom_headers");
} %}}}
static define add_command_header() %{{{
{
variable custom_headers = custom_headers_dfl;
variable followup_headers = followup_headers_dfl
!if (0 == strlen(custom_headers))
custom_headers = custom_headers + "\n";
!if (0 == strlen(followup_headers))
followup_headers = followup_headers + "\n";
foreach (Headers) using ("keys")
{
variable name = ();
variable payload = get_command(Headers[name]);
!if (0 == strlen(payload))
{
custom_headers = sprintf("%s%s: %s\n",
custom_headers,
name, payload);
followup_headers = sprintf("%s%s: %s\n",
followup_headers,
name, payload);
}
}
set_string_variable("custom_headers", custom_headers);
set_string_variable("followup_headers", followup_headers);
} %}}}
% Register hooks {{{
!if (1 == register_hook("startup_hook", "myheaders->retrieve_default"))
error ("register_hook(startup_hook) for retrieve_default failed");
!if (1 == register_hook("post_hook", "myheaders->add_command_header"))
error ("register_hook(post_hook) for add_command_header failed");
!if (1 == register_hook("followup_hook", "myheaders->add_command_header"))
error ("register_hook(followup_hook) for add_command_header failed");
%}}}
#v-
I'll give it a test later, just to be sure it doesn't turn your box into
a microwave oven...
Bye,
Emmanuele.
--
Emmanuele Bassi [ http://digilander.libero.it/ebassi/slrn.html ]
GnuPG Key fingerprint = 4DD0 C90D 4070 F071 5738 08BD 8ECC DB8F A432 0FF4
Re: slrn - Will it show uptime like Mutt?
Author: Crashdamage
Date: Sun, 29 Jun 2003 14:37
Date: Sun, 29 Jun 2003 14:37
31 lines
2321 bytes
2321 bytes
On Sat, 28 Jun 2003 19:17:18 +0100, Andrew Preater <preater@deadspam.com> wrote: > * Crashdamage <tmeador@nospam.invalid>: >> With Mutt, I use this line to show my uptime in mail headers to >> Windows boneheads: >> >> my_hdr X-Uptime: `uptime | sed -e 's/.*up \([^,]*\),.*/\1/'` >> >> Is there a way to this in slrn? > > You can do this with an s-lang macro in slrn, in fact you could insert > the output of any external command. Here's a suitable macro to do > this, uname is given as an example: > > http://www.geocities.com/tsca.geo/slang/ext_header.txt Thanks, but no good so far. That link goes to 2 macros, an old version and a newer "improved" one. I haven't had much tome ot play withthem, but so far I can't get either to go. I'm still too much of a noob and no programmer. This stuff mostly is over my head, and I need to do more studying. Strictly speaking, putting my uptime in headers isn't worth the trouble, but it'll teach me some stuff I should probably learn. I'll keep messin' around...I've been trying Emmanuale Bossi's macro with no luck yet either, errors somewhere, but I just started. I also found the "set_preferences" macro by J.B. Nicholson-Owens he mentions and I'll try to get it going too. BTW, does anyone know why the sed command to srtip away verbose uptime info is ignored? Works in Mutt, and I don't understand why it would make a differnce using it in a macro, but it does.
Re: slrn - Will it show uptime like Mutt?
Author: surtin
Date: Sun, 29 Jun 2003 19:35
Date: Sun, 29 Jun 2003 19:35
30 lines
2995 bytes
2995 bytes
On Sun, 29 Jun 2003 10:58:33 GMT, Emmanuele Bassi wrote: > Since that macro is quite old, more than a "work around", it should need > an update. Anything new is always welcome ;) > The macro is untested. It works by simply adding new headers to the > "Headers" variable. > > Other than that, it should work (did I mention it is untested? :-)) I got this when trying to test it... S-Lang Error: Syntax Error: Expecting ;: found 'private', line 9, file: /home/surtin/News/macros/new_uptime.sl S-Lang Error: Syntax Error: called from line 9, file: /home/surtin/News/macros/new_uptime.sl slrn fatal error: [...] > I'll give it a test later, just to be sure it doesn't turn your box into > a microwave oven... Not a microwave oven, just didn't work. Probably was something I didn't do? -- .::surtin::. People usually get what's coming to them ... unless it's been mailed.
Re: slrn - Will it show uptime like Mutt?
Author: Andrew Preater
Date: Sun, 29 Jun 2003 20:44
Date: Sun, 29 Jun 2003 20:44
51 lines
2901 bytes
2901 bytes
* Crashdamage <tmeador@nospam.invalid>:
> Andrew Preater <preater@deadspam.com> wrote:
>> Here's a suitable macro to do this, uname is given as an example:
>>
>> http://www.geocities.com/tsca.geo/slang/ext_header.txt
>
> Thanks, but no good so far. That link goes to 2 macros, an old
> version and a newer "improved" one. I haven't had much tome ot play
> withthem, but so far I can't get either to go.
The "old" one does work, check my headers! I didn't really want to
use it (look at the state of that uptime...) but given the thread it
was too tempting. All I have:
$ grep uptime_header .slrnrc
interpret "News/uptime_header.sl"
The nitty-gritty in that macro:
#v+
define ext_header2 ()
{
variable eh,fp;system ("uptime > /tmp/tmp.slrn1.hea");
fp = fopen("/tmp/tmp.slrn1.hea", "r");
fgets (&eh,fp);
set_string_variable("followup_custom_headers",sprintf ("X-Uptime: %s",eh));
}
define followup_hook (){ ext_header2; }
#v-
Of course it clobbers all of my other custom headers, so my new vim
6.2 isn't announced loud and proud.
> I'm still too much of a noob and no programmer. This stuff mostly is
> over my head, and I need to do more studying.
Me too. I've only learned what little I know by using others' macros
& playing around with them. It would be really nice to be able to pop
a command in backtick in my slrnrc --> WISH!
> BTW, does anyone know why the sed command to srtip away verbose
> uptime info is ignored?
Sorry, I don't know. I can confirm it does happen, because I tried
the same as you first time I found that header ;) Never got to the
bottom of it.
--
Andrew Preater
Re: slrn - Will it show uptime like Mutt?
Author: Matt H
Date: Sun, 29 Jun 2003 21:56
Date: Sun, 29 Jun 2003 21:56
88 lines
3839 bytes
3839 bytes
On Sun, 29 Jun 2003 00:33:05 GMT,
Crashdamage <tmeador@nospam.invalid> wrote:
>
> On Sat, 28 Jun 2003 23:00:48 GMT, SINNER wrote:
>> While strolling through news.software.readers, Crashdamage was overheard
>> plotting:
>>> Thanks, from what I can tell it might, but I'm not sure. I don't do French,
>>> so I'll have to wait 'til my daughter who does has a chance to do a little
>>> translation for me.
>>
>> You dont need to understand french. Place that script in a file called
>> uptime.sl and interpret it in your slrnrc.
>
> OK, I'd already done that and yeah it works, but it trashes my
>
> "X-Newsreader SLRN 0.9.7.4 (Linux)"
This because it completely overwrites 'custom_headers', at the end of this post
I have included a fixed version of hooks.sl that will keep any previous value
of custom_headers and only add the uptime to it.
> header line when I use it. Also, I can't figure how to add my entire
> uptime command including the sed command to strip out extra info (this
> actually is a line I ripped off Sven Guckes' muttrc):
>
> "`uptime | sed -e 's/.*up \([^,]*\),.*/\1/'`"
>
> I added it to the command line like this:
>
> uptime="";
> cmd = sprintf("uptime | sed -e 's/.*up \([^,]*\),.*/\1/'" );
>
> and I thought that would do it, but it gets ignored and still puts the
> whole verbose "uptime" command in the header.
Can you try putting the `uptime | sed -e 's/.*up \([^,]*\),.*/\1/'` into a shell
script and then executing the script instead of the uptime command? I think that
would proabably work.
Here is the fixed version of hooks.sl that will not destroy 'custom_header'.
% hooks.sl
define get_uptime () {
variable uptime;
variable buf;
variable fp;
variable cmd;
uptime = "";
cmd = sprintf("uptime");
fp = popen(cmd,"r");
if (fp == NULL) {
message("Can not include uptime...");
}
else {
buf = "";
while (-1 != fgets(&buf, fp)) {
uptime = sprintf("%s%s", uptime, buf);
} () = pclose(fp);
} return uptime;
}
define post_hook_uptime () {
variable uptime;
variable old_custom_header;
old_custom_header = get_variable_value ("custom_headers");
uptime = get_uptime();
uptime = sprintf("X-Uptime: %s", uptime);
set_string_variable("custom_headers", sprintf("%s%s%s", old_custom_header, "\n", uptime));
}
define followup_hook_uptime () {
variable uptime;
uptime = get_uptime();
uptime = sprintf("X-Uptime: %s", uptime);
set_string_variable("followup_custom_headers", uptime);
}
define post_hook () {
post_hook_uptime();
}
define followup_hook () {
followup_hook_uptime();
}
Re: slrn - Will it show uptime like Mutt?
Author: Matt H
Date: Sun, 29 Jun 2003 22:22
Date: Sun, 29 Jun 2003 22:22
14 lines
1775 bytes
1775 bytes
On Sun, 29 Jun 2003 22:29:23 GMT, Crashdamage <tmeador@nospam.invalid> wrote: > But neither one works like I'd like. Both knock out any custom headers > and ingore the sed command to strip away unecessary uptime info, so I'll > work on getting Emannuele Bassi's new macro working. That, particulary > when used with the "set_preferences" macro, seems like they'll make a > nice combination that will do what I want - hopefully including picking > up on that sed string - and make future header changes easy. This might help, Message-ID: <slrnbfuo41.ci4.nntp@distraction.ath.cx>
Re: slrn - Will it show uptime like Mutt?
Author: Crashdamage
Date: Sun, 29 Jun 2003 22:29
Date: Sun, 29 Jun 2003 22:29
45 lines
3129 bytes
3129 bytes
On Sun, 29 Jun 2003 21:44:44 +0100, Andrew Preater <preater@deadspam.com> wrote: > * Crashdamage <tmeador@nospam.invalid>: >> Andrew Preater <preater@deadspam.com> wrote: >>> Here's a suitable macro to do this, uname is given as an example: >>> >>> http://www.geocities.com/tsca.geo/slang/ext_header.txt >> >> Thanks, but no good so far. That link goes to 2 macros, an old >> version and a newer "improved" one. I haven't had much tome ot play >> withthem, but so far I can't get either to go. > > The "old" one does work, check my headers! I didn't really want to > use it (look at the state of that uptime...) I got it working too, just a typo. So now I've got uptime to work with this macro and the other one Mark Hill suggested from a Google search (the one in French). But neither one works like I'd like. Both knock out any custom headers and ingore the sed command to strip away unecessary uptime info, so I'll work on getting Emannuele Bassi's new macro working. That, particulary when used with the "set_preferences" macro, seems like they'll make a nice combination that will do what I want - hopefully including picking up on that sed string - and make future header changes easy. That is, when I get some time - absolutlety buried at my business right now. Takes lotsa time when you don't really know just what you're doing and gotta learn as you go... >...of course it clobbers all of my other custom headers, so my new vim > 6.2 isn't announced loud and proud. > >> I'm still too much of a noob and no programmer. This stuff mostly is >> over my head, and I need to do more studying. > > Me too. I've only learned what little I know by using others' macros > & playing around with them. It would be really nice to be able to pop > a command in backtick in my slrnrc --> WISH! > >> BTW, does anyone know why the sed command to srtip away verbose >> uptime info is ignored? > > Sorry, I don't know. I can confirm it does happen, because I tried > the same as you first time I found that header ;) Never got to the > bottom of it. >
Re: slrn - Will it show uptime like Mutt?
Author: Crashdamage
Date: Sun, 29 Jun 2003 22:49
Date: Sun, 29 Jun 2003 22:49
44 lines
2661 bytes
2661 bytes
Matt, you posted this while I was writing my last reply...
On Sun, 29 Jun 2003 21:56:18 GMT, Matt H <nntp@cox.net> wrote:
>>> While strolling through news.software.readers, Crashdamage was overheard
>>> plotting:
>>> french. Place that script in a file called
>>> uptime.sl and interpret it in your slrnrc.
>>
>> OK, I'd already done that and yeah it works, but it trashes my
>>
>> "X-Newsreader SLRN 0.9.7.4 (Linux)"
>
> This because it completely overwrites 'custom_headers', at the end of this
>post.
Yeah, I figured that out pretty quick...
> I have included a fixed version of hooks.sl that will keep any previous value
> of custom_headers and only add the uptime to it.
Many thanks! I've copied it and I'll try it in a little while.
>> header line when I use it. Also, I can't figure how to add my entire
>> uptime command including the sed command to strip out extra info (this
>> actually is a line I ripped off Sven Guckes' muttrc):
>>
>> "`uptime | sed -e 's/.*up \([^,]*\),.*/\1/'`"
>>
>> I added it to the command line like this:
>>
>> uptime="";
>> cmd = sprintf("uptime | sed -e 's/.*up \([^,]*\),.*/\1/'" );
>>
>> and I thought that would do it, but it gets ignored and still puts the
>> whole verbose "uptime" command in the header.
>
> Can you try putting the `uptime | sed -e 's/.*up \([^,]*\),.*/\1/'` into a shell
> script and then executing the script instead of the uptime command? I think that
> would proabably work.
Well, I'm afraid this noob needs a little more instruction on just how
to do that...
Re: slrn - Will it show uptime like Mutt?
Author: Crashdamage
Date: Sun, 29 Jun 2003 23:43
Date: Sun, 29 Jun 2003 23:43
27 lines
2440 bytes
2440 bytes
On Sun, 29 Jun 2003 22:22:09 GMT, Matt H <nntp@cox.net> wrote: > On Sun, 29 Jun 2003 22:29:23 GMT, > Crashdamage <tmeador@nospam.invalid> wrote: > >> But neither one works like I'd like. Both knock out any custom headers >> and ingore the sed command to strip away unecessary uptime info, so I'll >> work on getting Emannuele Bassi's new macro working. That, particulary >> when used with the "set_preferences" macro, seems like they'll make a >> nice combination that will do what I want - hopefully including picking >> up on that sed string - and make future header changes easy. > > This might help, > Message-ID: <slrnbfuo41.ci4.nntp@distraction.ath.cx> Thanks, I'll look into it later. Meanwhile, I tried your macro - it works, partially. It's ok on new posts, leaves "X-Newsreader: SLRN..." custom_header alone and adds the uptime header, just perfect (except, of course, for the verbose uptime). But on followups, the uptime is there but the X-Newsreader followup_custom_header is still trashed. A little cut+paste action to try and fix it didn't work - don't even ask what I tried, it was raw noob stuff, that's all that needs to be said about that. Anyway, it's close, very close... But thanks for the help. A little help with using a shell script to run that sed string would *really* be appreciated.
Re: slrn - Will it show uptime like Mutt?
Author: Emmanuele Bassi
Date: Sun, 29 Jun 2003 23:48
Date: Sun, 29 Jun 2003 23:48
34 lines
2359 bytes
2359 bytes
* surtin [2003-06-29 21:35]: >> Other than that, it should work (did I mention it is untested? :-)) > > I got this when trying to test it... > > S-Lang Error: Syntax Error: Expecting ;: found 'private', line 9, file: /home/surtin/News/macros/new_uptime.sl > S-Lang Error: Syntax Error: called from line 9, file: /home/surtin/News/macros/new_uptime.sl > slrn fatal error: Just a pair of typo. It happens when you're... well... me. :-)))) It's: #v+ private variable Headers = Assoc_Type []; private variable custom_headers_dfl, followup_headers_dfl; #v- With this should load correctly, unless there are more typo waiting. HTH, Emmanuele. -- Emmanuele Bassi [ http://digilander.libero.it/ebassi/slrn.html ] GnuPG Key fingerprint = 4DD0 C90D 4070 F071 5738 08BD 8ECC DB8F A432 0FF4
Re: slrn - Will it show uptime like Mutt?
Author: Emmanuele Bassi
Date: Mon, 30 Jun 2003 00:13
Date: Mon, 30 Jun 2003 00:13
29 lines
2555 bytes
2555 bytes
* Emmanuele Bassi [2003-06-30 01:50]:
> With this should load correctly, unless there are more typo waiting.
Okay, it's official: I should post macros only after testing them,
not just after thinking them. :-)
There were another pair of bugs, but, after all, the macro works
as it should (as you can see from my headers).
Since sending it twice would mean having a crowd of angry people
mounting a gallows right outside my front door, I put it online,
here:
http://digilander.libero.it/ebassi/slrn/headers.sl
I've included the set_header function, that works like this:
my_headers->set_header ("X-Uname", "uname -srv");
I'll add a bit more documentation as soon as I can.
Bye,
Emmanuele.
--
Emmanuele Bassi [ http://digilander.libero.it/ebassi/slrn/ ]
GnuPG Key fingerprint = 4DD0 C90D 4070 F071 5738 08BD 8ECC DB8F A432 0FF4
Re: slrn - Will it show uptime like Mutt?
Author: Matt H
Date: Tue, 01 Jul 2003 00:32
Date: Tue, 01 Jul 2003 00:32
16 lines
1892 bytes
1892 bytes
On Sun, 29 Jun 2003 22:49:09 GMT, Crashdamage <tmeador@nospam.invalid> wrote: > > Well, I'm afraid this noob needs a little more instruction on just how > to do that... create a file 'getuptime.sh' ================================================== #!/bin/sh echo `uptime | sed -e 's/.*up \([^,]*\),.*/\1/'` ================================================== and then make it executable with 'chmod +x getuptime.sh' and use that instead of 'uptime'.
Re: slrn - Will it show uptime like Mutt?
Author: Matt H
Date: Tue, 01 Jul 2003 04:12
Date: Tue, 01 Jul 2003 04:12
83 lines
4123 bytes
4123 bytes
On Sun, 29 Jun 2003 23:43:09 GMT,
Crashdamage <tmeador@nospam.invalid> wrote:
> On Sun, 29 Jun 2003 22:22:09 GMT, Matt H <nntp@cox.net> wrote:
>> On Sun, 29 Jun 2003 22:29:23 GMT,
>> Crashdamage <tmeador@nospam.invalid> wrote:
>>
>>> But neither one works like I'd like. Both knock out any custom headers
>>> and ingore the sed command to strip away unecessary uptime info, so I'll
>>> work on getting Emannuele Bassi's new macro working. That, particulary
>>> when used with the "set_preferences" macro, seems like they'll make a
>>> nice combination that will do what I want - hopefully including picking
>>> up on that sed string - and make future header changes easy.
>>
>> This might help,
>> Message-ID: <slrnbfuo41.ci4.nntp@distraction.ath.cx>
>
> Thanks, I'll look into it later.
>
> Meanwhile, I tried your macro - it works, partially. It's ok on new posts,
> leaves "X-Newsreader: SLRN..." custom_header alone and adds the uptime
> header, just perfect (except, of course, for the verbose uptime). But on
> followups, the uptime is there but the X-Newsreader followup_custom_header
> is still trashed.
> A little cut+paste action to try and fix it didn't work - don't even ask
> what I tried, it was raw noob stuff, that's all that needs to be said about
> that. Anyway, it's close, very close...
Okay, here's one that keeps custom_headers and followup_custom_headers:
======================================================================
% hooks.sl
define get_uptime () {
variable uptime;
variable buf;
variable fp;
variable cmd;
uptime = "";
cmd = sprintf("uptime");
fp = popen(cmd,"r");
if (fp == NULL) {
message("Can not include uptime...");
}
else {
buf = "";
while (-1 != fgets(&buf, fp)) {
uptime = sprintf("%s%s", uptime, buf);
} () = pclose(fp);
} return uptime;
}
define post_hook_uptime () {
variable uptime;
variable och;
och = get_variable_value ("custom_headers");
uptime = get_uptime();
uptime = sprintf("X-Uptime: %s", uptime);
set_string_variable("custom_headers", sprintf("%s%s%s", och, "\n", uptime));
}
define followup_hook_uptime () {
variable uptime;
variable ofch;
ofch = get_variable_value("followup_custom_headers");
uptime = get_uptime();
uptime = sprintf("X-Uptime: %s", uptime);
set_string_variable("followup_custom_headers", sprintf("%s%s%s", ofch, "\n", uptime));
}
define post_hook () {
post_hook_uptime();
}
define followup_hook () {
followup_hook_uptime();
% end hooks.sl
===============================================================================
Let me know if there are any problems with this one, and if I can I'll try
to fix them.
Re: slrn - Will it show uptime like Mutt?
Author: Crashdamage
Date: Tue, 01 Jul 2003 09:24
Date: Tue, 01 Jul 2003 09:24
26 lines
2591 bytes
2591 bytes
On Tue, 01 Jul 2003 04:12:56 GMT, Matt H <nntp@cox.net> wrote: >> I tried your macro - it works, partially. It's ok on new posts, >> leaves "X-Newsreader: SLRN..." custom_header alone and adds the uptime >> header, just perfect (except, of course, for the verbose uptime). But on >> followups, the uptime is there but the X-Newsreader followup_custom_header >> is still trashed. >> A little cut+paste action to try and fix it didn't work - don't even ask >> what I tried, it was raw noob stuff, that's all that needs to be said about >> that. Anyway, it's close, very close... > > Okay, here's one that keeps custom_headers and followup_custom_headers: >====================================================================== (Cut) >=============================================================================== > Let me know if there are any problems with this one, and if I can I'll try > to fix them. Hey, many thanks! I'll try it out, along with the uptime.sh script as soon as I have time. That new macro looks *very* similar to the hack I tried...too bad I didn't keep it. I must've been close after all, at least I was thinking along the right lines. Who knows, if I'd put a little more time into it, I might've gotten it working myself. That woulda been a small miracle. Anyway, I will try to put it all together and test as soon as I can.
Re: slrn - Will it show uptime like Mutt?
Author: Crashdamage
Date: Wed, 02 Jul 2003 02:50
Date: Wed, 02 Jul 2003 02:50
26 lines
2388 bytes
2388 bytes
On Tue, 01 Jul 2003 04:12:56 GMT, Matt H <nntp@cox.net> wrote: >> I tried your macro - it works, partially. It's ok on new posts, >> leaves "X-Newsreader: SLRN..." custom_header alone and adds the uptime >> header, just perfect (except, of course, for the verbose uptime). But on >> followups, the uptime is there but the X-Newsreader followup_custom_header >> is still trashed. > > Okay, here's one that keeps custom_headers and followup_custom_headers: >====================================================================== (Big cut...) > > % end hooks.sl >=============================================================================== > > Let me know if there are any problems with this one, and if I can I'll try > to fix them. Hey Hey! As you can see from my header, it works perfect! And ,aking the entire uptime sed command string I had into a shell script worked great and trims it right down to the point. Too bad a thunderstorm/poweroutage screwed my uptime. Was something like 103 days...oh well...it only takes a few days up to freak Windoze lusers anyway. Nice job, and many thanks for your help and patience.
Re: slrn - Will it show uptime like Mutt?
Author: Bradley Reed
Date: Fri, 04 Jul 2003 02:32
Date: Fri, 04 Jul 2003 02:32
32 lines
2599 bytes
2599 bytes
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tue, 01 Jul 2003 04:12:56 GMT, Matt wrote: > > Okay, here's one that keeps custom_headers and followup_custom_headers: >====================================================================== > % hooks.sl > <Much snipped> This version almost works. It keeps custom_headers and followup_custom_headers, but it keeps the value of a previous posting/followup X-Uptime header and adds a second, then a third, etc. So if you make four followups, on the first it will work fine, on the second you will have 2 X-Uptime lines, on the third - three, and on the fourth you will have four X-Uptime lines. I manually edited my headers so this post shouldn't display the problem. Brad -----BEGIN PGP SIGNATURE----- iD8DBQE/BOjTkDp4KjYna1ARApOMAJ0Uc/v3BBAnO6WyBqkE9y+KxhG34ACfUobr 3ZtnYDqxOlcu4W09nJHJ65A= =+1Gn -----END PGP SIGNATURE-----
Re: slrn - Will it show uptime like Mutt?
Author: J.B. Moreno
Date: Fri, 04 Jul 2003 03:37
Date: Fri, 04 Jul 2003 03:37
13 lines
1673 bytes
1673 bytes
Crashdamage <tmeador@nospam.invalid> wrote: > X-Newsreader: SLRN 0.9.7.4 (Linux) > User-Agent: slrn/0.9.7.4 (Linux) > Meanwhile, I tried your macro - it works, partially. It's ok on new posts, > leaves "X-Newsreader: SLRN..." custom_header alone and adds the uptime Why are you including X-Newsreader when slrn itself is adding the more correct User-Agent? -- JBM "Everything is futile." -- Marvin of Borg
Re: slrn - Will it show uptime like Mutt?
Author: Crashdamage
Date: Fri, 04 Jul 2003 10:08
Date: Fri, 04 Jul 2003 10:08
23 lines
2396 bytes
2396 bytes
On Thu, 3 Jul 2003 23:37:15 -0400, J.B. Moreno <planB@newsreaders.com> wrote: > Crashdamage <tmeador@nospam.invalid> wrote: > >> X-Newsreader: SLRN 0.9.7.4 (Linux) >> User-Agent: slrn/0.9.7.4 (Linux) > > Why are you including X-Newsreader when slrn itself is adding the more > correct User-Agent? Just trying to get the word out about slrn and Linux to as many as possible. Many people, especially using Winshaft, have newsreaders that aren't setup to show User-Agent but will show X-**** (or the reverse). Or maybe seeing it twice will get their attention. If it really bothers you 'cause you think it's just too redundant, I'll take it out. Back at ya - Why are you displaying the verbose uptime when the fix to strip away the uneeded info has been posted in this thread? I just noticed the multiple X-Uptime flaw in Matt H's otherwise very nice macro last night. You have to re-tart slrn to reset it or manually edit the extras. Too bad I'm not smart enough to fix it. Tried a couple of things, but no go...I'm not that slick yet. If no one posts a fix, I'll use it anyway. I don't post enough stuff to make it a real hassle.
Re: slrn - Will it show uptime like Mutt?
Author: Emmanuele Bassi
Date: Fri, 04 Jul 2003 10:12
Date: Fri, 04 Jul 2003 10:12
21 lines
2456 bytes
2456 bytes
* Crashdamage [2003-07-04 12:08]: > I just noticed the multiple X-Uptime flaw in Matt H's otherwise very nice > macro last night. You have to re-tart slrn to reset it or manually edit > the extras. Too bad I'm not smart enough to fix it. Tried a couple of > things, but no go...I'm not that slick yet. If no one posts a fix, I'll > use it anyway. I don't post enough stuff to make it a real hassle. This macro: http://digilander.libero.it/ebassi/slrn/headers.sl Doesn't have that side effect/bug. I'll have to document it a bit more, though. Bye, Emmanuele. -- Emmanuele Bassi [ http://digilander.libero.it/ebassi/slrn.html ] GnuPG Key fingerprint = 4DD0 C90D 4070 F071 5738 08BD 8ECC DB8F A432 0FF4
Re: slrn - Will it show uptime like Mutt?
Author: SINNER
Date: Fri, 04 Jul 2003 14:09
Date: Fri, 04 Jul 2003 14:09
28 lines
2989 bytes
2989 bytes
Crashdamage Wrote in news.software.readers, on Fri, 04 Jul 2003 10:08:41 GMT: > On Thu, 3 Jul 2003 23:37:15 -0400, J.B. Moreno <planB@newsreaders.com> wrote: >> Crashdamage <tmeador@nospam.invalid> wrote: >>> X-Newsreader: SLRN 0.9.7.4 (Linux) >>> User-Agent: slrn/0.9.7.4 (Linux) >> Why are you including X-Newsreader when slrn itself is adding the more >> correct User-Agent? > Just trying to get the word out about slrn and Linux to as many as possible. > Many people, especially using Winshaft, have newsreaders that aren't setup > to show User-Agent but will show X-**** (or the reverse). Or maybe seeing > it twice will get their attention. If it really bothers you 'cause you > think it's just too redundant, I'll take it out. The preferred convention in User-Agent. OE hides almost all headers by default. I have Xnews set to display whichever is being used, same in slrn, so with your posts I get to see 2 lines instead of one. > Back at ya - Why are you displaying the verbose uptime when the fix to strip > away the uneeded info has been posted in this thread? There is no 'preferred convention' for uptime in the headers. -- David To err is human, to moo bovine.
Re: slrn - Will it show uptime like Mutt?
Author: Mike Vanecek
Date: Fri, 04 Jul 2003 14:24
Date: Fri, 04 Jul 2003 14:24
22 lines
2073 bytes
2073 bytes
On Fri, 04 Jul 2003 10:12:38 GMT, Emmanuele Bassi wrote: > * Crashdamage [2003-07-04 12:08]: > >> I just noticed the multiple X-Uptime flaw in Matt H's otherwise very nice >> macro last night. You have to re-tart slrn to reset it or manually edit >> the extras. Too bad I'm not smart enough to fix it. Tried a couple of >> things, but no go...I'm not that slick yet. If no one posts a fix, I'll >> use it anyway. I don't post enough stuff to make it a real hassle. > > This macro: > > http://digilander.libero.it/ebassi/slrn/headers.sl > > Doesn't have that side effect/bug. I'll have to document it a bit more, > though. > > Bye, > Emmanuele. Neat, thank you. BTW, you might want to put the url in the header for doco purposes.
Re: slrn - Will it show uptime like Mutt?
Author: J.B. Moreno
Date: Fri, 04 Jul 2003 15:32
Date: Fri, 04 Jul 2003 15:32
28 lines
2417 bytes
2417 bytes
SINNER <99nesorjd@gates_of_hell.INVALID> wrote: > Crashdamage Wrote in news.software.readers, on Fri, 04 Jul 2003 10:08:41 GMT: > > J.B. Moreno <planB@newsreaders.com> wrote: > >> Crashdamage <tmeador@nospam.invalid> wrote: -snip- > >> Why are you including X-Newsreader when slrn itself is adding the more > >> correct User-Agent? > > > Just trying to get the word out about slrn and Linux to as many as possible. > > Many people, especially using Winshaft, have newsreaders that aren't setup > > to show User-Agent but will show X-**** (or the reverse). Or maybe seeing > > it twice will get their attention. If it really bothers you 'cause you > > think it's just too redundant, I'll take it out. Please do. > The preferred convention in User-Agent. OE hides almost all headers by > default. I have Xnews set to display whichever is being used, same in > slrn, so with your posts I get to see 2 lines instead of one. Me too -- and it also interferes with accurate client stats, as it's likely to be counted twice. -- JBM "Everything is futile." -- Marvin of Borg
Re: slrn - Will it show uptime like Mutt?
Author: Crashdamage
Date: Fri, 04 Jul 2003 18:57
Date: Fri, 04 Jul 2003 18:57
30 lines
2267 bytes
2267 bytes
On Fri, 04 Jul 2003 10:12:38 GMT, Emmanuele Bassi wrote: > * Crashdamage [2003-07-04 12:08]: > >> I just noticed the multiple X-Uptime flaw in Matt H's otherwise very nice >> macro last night. > > This macro: > > http://digilander.libero.it/ebassi/slrn/headers.sl > > Doesn't have that side effect/bug. I'll have to document it a bit more, > though. > > Bye, > Emmanuele. Many thanks, not only to you, but to all who have answered in this thread. As you can see from my header, the uptime is growing again on this rock-steady box. And the macro does indeed work perfectly. Tried it before and got an error and left it at that to try Matt H's, but when I recopied again today it was fine. Musta made a copy/paste error I guess, should've tried it again before. Anyway, I think I've got my headers setup like I wanted now. Learned a little along the way too, always a good thing. Now to get that set_preferences macro working...
Re: slrn - Will it show uptime like Mutt?
Author: Crashdamage
Date: Fri, 04 Jul 2003 19:07
Date: Fri, 04 Jul 2003 19:07
10 lines
1703 bytes
1703 bytes
On Fri, 4 Jul 2003 11:32:47 -0400, J.B. Moreno <planB@newsreaders.com> wrote: >> Crashdamage Wrote in news.software.readers, on Fri, 04 Jul 2003 10:08:41 GMT >> If it really bothers you 'cause you think it's just too redundant, I'll take >> it out. > > Please do. > Done. Was a bad idea I got from a Windoze user that can't see User-Agent. Shoulda known better...
Re: slrn - Will it show uptime like Mutt?
Author: Bradley Reed
Date: Fri, 04 Jul 2003 23:25
Date: Fri, 04 Jul 2003 23:25
31 lines
2841 bytes
2841 bytes
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Fri, 04 Jul 2003 10:12:38 GMT, Emmanuele wrote: > * Crashdamage [2003-07-04 12:08]: > >> I just noticed the multiple X-Uptime flaw in Matt H's otherwise very nice >> macro last night. You have to re-tart slrn to reset it or manually edit >> the extras. Too bad I'm not smart enough to fix it. Tried a couple of >> things, but no go...I'm not that slick yet. If no one posts a fix, I'll >> use it anyway. I don't post enough stuff to make it a real hassle. > > This macro: > > http://digilander.libero.it/ebassi/slrn/headers.sl > > Doesn't have that side effect/bug. I'll have to document it a bit more, > though. > Thanks for the link! Brad -----BEGIN PGP SIGNATURE----- iD8DBQE/Bg50kDp4KjYna1ARAsWMAJ4jO4KJfiW6Jpijgh5EmD5/3K9opwCghjlC Qt+oOz6nKdQiHFL+hpuzh/o= =4WcJ -----END PGP SIGNATURE-----
Re: slrn - Will it show uptime like Mutt?
Author: Igor Ivanov
Date: Sun, 17 Aug 2003 14:13
Date: Sun, 17 Aug 2003 14:13
43 lines
2170 bytes
2170 bytes
Matt H wrote:
> % hooks.sl
>
> define get_uptime () {
> variable uptime, buf, fp, cmd;
>
> uptime = "";
> cmd = sprintf("uptime");
> fp = popen(cmd,"r");
> if (fp == NULL) {
> message("Can not include uptime...");
> }
> else {
> buf = "";
> while (-1 != fgets(&buf, fp)) {
> uptime = sprintf("%s%s", uptime, buf);
> }
> () = pclose(fp);
> }
> return uptime;
> }
You can read all lines with "fgetslines" function:
define get_uptime () {
variable fp, uptime;
fp = popen("uptime", "r");
if (fp == NULL) {
message("Can not include uptime...");
return "";
} else {
uptime = fgetslines(fp);
() = pclose(fp);
return strjoin(uptime, "");
}
}
--
If all the world's economists were laid end to end, we wouldn't reach a
conclusion.
-- William Baumol
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads