reposerve server half way done
[reposerve] / server / src / main.c
index 12bb01f..ab5c055 100644 (file)
 static const char *guess_repo_name(const char *path);
 static int parse_args(int argc, char **argv);
 
-static const char *repo_path, *repo_name;
+static const char *repo_name;
 static int lis = -1;
 static int port = 64357;
 
 static struct client *clients;
 
+const char *repo_path;
+
+
 int main(int argc, char **argv)
 {
        struct sockaddr_in addr;
@@ -101,7 +104,7 @@ int main(int argc, char **argv)
                                perror("failed to accept connection");
                                continue;
                        }
-                       if(!(c = malloc(sizeof *c))) {
+                       if(!(c = calloc(1, sizeof *c))) {
                                perror("failed to allocate memory for client structure");
                                close(s);
                                continue;
@@ -109,6 +112,8 @@ int main(int argc, char **argv)
                        c->s = s;
                        c->next = clients;
                        clients = c;
+
+                       send_string(c, "reposerve-0.1 protocol:0\n");
                }
        }