#import <stdio.h>
#import <appkit/appkit.h>
#import "../Boolean.h"
#import <syslog.h>
#import <time.h>

void main(int argc, char **argv)
{
   id server;
   BOOL up;

   if(argc < 2)
       exit(0);

   up = atoi(argv[1]);

   server = [NXConnection connectToName:"PPPMeter"];

   if(!server)
   {
      openlog("pppstatus", 0, LOG_LOCAL2);
      syslog(LOG_DEBUG,"failed to tell PPPMeter %stime:%ld", (up? "up" : "down"), time((time_t *)0));
      exit(1);
   }
   
   if(atoi(argv[1]))
       [server setBoolState: YES];
   else
       [server setBoolState: NO];

   exit(0);
}
