% -*- mode: slang; mode: fold; -*-
%
% INSERT THE OUTPUT OF AN EXTERNAL COMMAND INTO AN X-HEADER           %{{{
% the name says it all. Use eg. ddate, uptime, etc with it.
% Put the macro in /usr/share/macros/macros.sl
% (or wherever you wish), and add the following to .slrnrc:
%
%   set macro_directory "/usr/share/macros"
%   interpret "macros.sl"
%
% In older slrn versions you might want to comment the
% `register hook' line and use the `define followup...`
% function instead.
% 
% NOTE: If you want to simplify the macro by using popen(),
%       remember: it won't work under Windows
%       
% NOTE: This macro overwrites any previously existing followup
%       custom headers. To learn how to avoid it, have a look
%       at the 'licznik.sl' macro at the address given below:
% 
% by Tomasz.Sienicki@post.cybercity.dk
% more macros @ http://www.geocities.com/tsca.geo/tsca.slang
% $Id: ext_header.txt,v 1.3 2003/06/30 09:35:25 tsca Exp $
%                                                                     %}}}

define ext_header ()
{
  variable eh,fp, 

  % name of your custom header. END IT WITH A ":"!
  eh_xheadname = "X-Myinfo:",

  % command creating the content of your custom header
  eh_xheadcont = "uname -rnsm",
 %eh_xheadcont = "ddate",

% ----------------------------------------------------------------------
  eh_tempfile = "/tmp/.eh_slrn.tmp";

  !if (string_match (eh_xheadname, "[^:]:$",1)) error 
      ("Colon problem in the X-Header name! Re-edit the `ext_header' macro!");
  system (eh_xheadcont + "> " + eh_tempfile);
  fp = fopen( eh_tempfile, "r"); fgets (&eh,fp);

  set_string_variable("followup_custom_headers",
                       sprintf ("%s %s", eh_xheadname, eh));
}
  % define followup_hook() { ext_header; }
  register_hook ("followup_hook", "ext_header") ;

% ---------------------------------------------------------------------------
% END OF FILE

    Source: geocities.com/tsca.geo/slang

               ( geocities.com/tsca.geo)