- int cmd_size = (strlen(diff_cmd) +
- strlen(name_sq) * 2 +
- strlen(diff_opts) +
- strlen(diff_arg) +
- strlen(name_1_sq) + strlen(name_2_sq)
- - 5);
- char *cmd = xmalloc(cmd_size);
- int next_at = 0;
+ int cmd_size = (strlen(diff_cmd) + strlen(diff_opts) +
+ strlen(diff_arg) - 13);
+ for (i = 0; i < 2; i++) {
+ input_name_sq[i] = sq_expand(temp[i].name);
+ if (!strcmp(temp[i].name, "/dev/null")) {
+ path0[i] = "/dev/null";
+ path1[i] = "";
+ mode[i][0] = 0;
+ } else {
+ path0[i] = i ? "l/" : "k/";
+ path1[i] = name_sq;
+ sprintf(mode[i], " (mode:%s)", temp[i].mode);
+ }
+ cmd_size += (strlen(path0[i]) + strlen(path1[i]) +
+ strlen(mode[i]) + strlen(input_name_sq[i]));
+ }
+
+ cmd = xmalloc(cmd_size);