summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-07-15 09:32:16 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-15 09:32:16 -0700
commite64e1b79d7c50a234e97d59aadc7a4911de91efe (patch)
treefc7be9745df4438cc20933d05b314fb5c32c2a2f
parent7d80694af1a68ee1915e36bad9b26fa9fe054f06 (diff)
downloadgit-e64e1b79d7c50a234e97d59aadc7a4911de91efe.tar.gz
Add "--inetd" flag to git-daemon
All credit go to Alexey Nezhdanov <snake@penza-gsm.ru>, I just ended up re-implementing his idea.
-rw-r--r--daemon.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/daemon.c b/daemon.c
index c5a46b73f0..74a1934dc2 100644
--- a/daemon.c
+++ b/daemon.c
@@ -3,7 +3,7 @@
#include <sys/socket.h>
#include <netinet/in.h>
-static const char daemon_usage[] = "git-daemon [--port=n]";
+static const char daemon_usage[] = "git-daemon [--inetd | --port=n]";
static int upload(char *dir, int dirlen)
{
@@ -96,6 +96,7 @@ static int serve(int port)
int main(int argc, char **argv)
{
int port = DEFAULT_GIT_PORT;
+ int inetd_mode = 0;
int i;
for (i = 1; i < argc; i++) {
@@ -110,8 +111,17 @@ int main(int argc, char **argv)
continue;
}
}
+
+ if (!strcmp(arg, "--inetd")) {
+ inetd_mode = 1;
+ continue;
+ }
+
usage(daemon_usage);
}
+ if (inetd_mode)
+ return execute();
+
return serve(port);
}