-#include "git-compat-util.h"
+#include "builtin.h"
 #include "transport.h"
 #include "run-command.h"
 
        size_t rpos = 0;
        int escape = 0;
        char special = 0;
-       size_t pslen = 0;
-       size_t pSlen = 0;
        size_t psoff = 0;
        struct strbuf ret = STRBUF_INIT;
 
        /* Calculate prefix length for \s and lengths for \s and \S */
        if (!strncmp(service, "git-", 4))
                psoff = 4;
-       pSlen = strlen(service);
-       pslen = pSlen - psoff;
 
        /* Pass the service to command. */
        setenv("GIT_EXT_SERVICE", service, 1);
        for (i = 0; i < arguments; i++)
                ret[i] = temparray[i];
        ret[arguments] = NULL;
-       return (const char **)ret;
+       return ret;
 }
 
 static void send_git_request(int stdin_fd, const char *serv, const char *repo,
        char buffer[MAXCOMMAND];
 
        while (1) {
-               size_t length;
+               size_t i;
                if (!fgets(buffer, MAXCOMMAND - 1, stdin)) {
                        if (ferror(stdin))
                                die("Comammand input error");
                        exit(0);
                }
                /* Strip end of line characters. */
-               length = strlen(buffer);
-               while (isspace((unsigned char)buffer[length - 1]))
-                       buffer[--length] = 0;
+               i = strlen(buffer);
+               while (i > 0 && isspace(buffer[i - 1]))
+                       buffer[--i] = 0;
 
                if (!strcmp(buffer, "capabilities")) {
                        printf("*connect\n\n");
 
 int cmd_remote_ext(int argc, const char **argv, const char *prefix)
 {
-       if (argc < 3) {
-               fprintf(stderr, "Error: URL missing");
-               exit(1);
-       }
+       if (argc != 3)
+               die("Expected two arguments");
 
        return command_loop(argv[2]);
 }