On Sat, 25 Aug 2001, Alexander Skwar wrote:

 
> You can also use uptime with some "clever" regexp.

This is a little c programm thats reads the /proc/uptime out. You can
change the output by your self.

If you make the following batch file:

#!/bin/sh
uname -r #for the kernel version
/usr/local/bin/siguptime #for the uptime


And in you .muttrc this:

set signature="/usr/local/bin/sig|"

cu
Rainer
-- 
You have a deep interest in all that is artistic.
#include <stdio.h>

#define uptime_file  "/proc/uptime"


int read_uptime(float *uptime);



int main(void)
{
  float *uptime;
  int day;
  int hour;
  int min;


  *uptime = 1;
  
  if (read_uptime(uptime))
    exit(1);

  day = *uptime / 86400;
  hour = *uptime / 3600;
  min = *uptime / 60 - hour * 60;

  if (day)
    printf("%dd", day);
  printf("%2.d:%d\n", hour,min);
  return 0;
}


int read_uptime(float *uptime)
{
  FILE *pfile;
  int uptime_error = 0;

  if (!(pfile = fopen(uptime_file,"r")))
    uptime_error = 1;
  else
    {
      fscanf(pfile,"%f", uptime);
      fclose(pfile);
    }
  return uptime_error;
}

PGP signature

Reply via email to