MCPcopy Index your code
hub / github.com/git/git / cmd_main

Function cmd_main

daemon.c:1258–1482  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1256}
1257
1258int cmd_main(int argc, const char **argv)
1259{
1260 int listen_port = 0;
1261 struct string_list listen_addr = STRING_LIST_INIT_DUP;
1262 int serve_mode = 0, inetd_mode = 0;
1263 const char *pid_file = NULL, *user_name = NULL, *group_name = NULL;
1264 int detach = 0;
1265 struct credentials *cred = NULL;
1266 int i;
1267 int ret;
1268
1269 for (i = 1; i < argc; i++) {
1270 const char *arg = argv[i];
1271 const char *v;
1272
1273 if (skip_prefix(arg, "--listen=", &v)) {
1274 string_list_append_nodup(&listen_addr, xstrdup_tolower(v));
1275 continue;
1276 }
1277 if (skip_prefix(arg, "--port=", &v)) {
1278 char *end;
1279 unsigned long n;
1280 n = strtoul(v, &end, 0);
1281 if (*v && !*end) {
1282 listen_port = n;
1283 continue;
1284 }
1285 }
1286 if (!strcmp(arg, "--serve")) {
1287 serve_mode = 1;
1288 continue;
1289 }
1290 if (!strcmp(arg, "--inetd")) {
1291 inetd_mode = 1;
1292 continue;
1293 }
1294 if (!strcmp(arg, "--verbose")) {
1295 verbose = 1;
1296 continue;
1297 }
1298 if (!strcmp(arg, "--syslog")) {
1299 log_destination = LOG_DESTINATION_SYSLOG;
1300 continue;
1301 }
1302 if (skip_prefix(arg, "--log-destination=", &v)) {
1303 if (!strcmp(v, "syslog")) {
1304 log_destination = LOG_DESTINATION_SYSLOG;
1305 continue;
1306 } else if (!strcmp(v, "stderr")) {
1307 log_destination = LOG_DESTINATION_STDERR;
1308 continue;
1309 } else if (!strcmp(v, "none")) {
1310 log_destination = LOG_DESTINATION_NONE;
1311 continue;
1312 } else
1313 die("unknown log destination '%s'", v);
1314 }
1315 if (!strcmp(arg, "--export-all")) {

Callers

nothing calls this directly

Calls 15

string_list_append_nodupFunction · 0.85
xstrdup_tolowerFunction · 0.85
strtoul_uiFunction · 0.85
strtol_iFunction · 0.85
enable_serviceFunction · 0.85
make_service_overridableFunction · 0.85
openlogFunction · 0.85
set_die_routineFunction · 0.85
prepare_credentialsFunction · 0.85
is_directoryFunction · 0.85
die_errnoFunction · 0.85
daemonizeFunction · 0.85

Tested by

no test coverage detected