MCPcopy Create free account
hub / github.com/git/git / command_loop

Function command_loop

builtin/remote-ext.c:166–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164#define MAXCOMMAND 4096
165
166static int command_loop(const char *child)
167{
168 char buffer[MAXCOMMAND];
169
170 while (1) {
171 size_t i;
172 const char *arg;
173
174 if (!fgets(buffer, MAXCOMMAND - 1, stdin)) {
175 if (ferror(stdin))
176 die("Command input error");
177 exit(0);
178 }
179 /* Strip end of line characters. */
180 i = strlen(buffer);
181 while (i > 0 && isspace(buffer[i - 1]))
182 buffer[--i] = 0;
183
184 if (!strcmp(buffer, "capabilities")) {
185 printf("*connect\n\n");
186 fflush(stdout);
187 } else if (skip_prefix(buffer, "connect ", &arg)) {
188 printf("\n");
189 fflush(stdout);
190 return run_child(child, arg);
191 } else {
192 fprintf(stderr, "Bad command");
193 return 1;
194 }
195 }
196}
197
198int cmd_remote_ext(int argc,
199 const char **argv,

Callers 1

cmd_remote_extFunction · 0.70

Calls 2

run_childFunction · 0.85
dieFunction · 0.50

Tested by

no test coverage detected