- continue;
- /*
- * FIXME:
- * I think directly manipulating argv[] is probably bogus
- */
- if (!strncmp(argv[i], "--write-batch",
- strlen("--write-batch"))) {
- /* Safer to change it here than script */
- /*
- * Change to --read-batch=prefix
- * to get ready for remote
- */
- strlcat(buff, "--read-batch=", sizeof(buff));
- strlcat(buff, batch_prefix, sizeof(buff));
+ continue;
+ if (i != 0)
+ write(fd, " ", 1);
+ if (!strncmp(argv[i], "--write-batch=", 14)) {
+ write(fd, "--read-batch=", 13);
+ write(fd, batch_prefix, strlen(batch_prefix));
+ } else if (i == argc - 1) {
+ char *p = find_colon(argv[i]);
+ if (p) {
+ if (*++p == ':')
+ p++;
+ } else
+ p = argv[i];
+ write(fd, "${1:-", 5);
+ write(fd, p, strlen(p));
+ write(fd, "}", 1);