summaryrefslogtreecommitdiff
path: root/main.c
blob: 30b175561e787ad92066226698733cfdc26f2ab3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "string.h"
#include "timer.h"
#include "daemon.h"

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
#include <string.h>

int main(int argc, char **argv) {  
  if (argc == 1) {
    int sockfd = socket_create();
    Daemon d;
    d.sockfd = sockfd;
    daemon_init(&d);
    daemon_run(&d);
    return 0;
  }

  int sockfd = socket_create();
  socket_set_client(sockfd);
  write(sockfd, argv[1], sizeof(argv[1]));
 
  return 0;
}