shithub: vdiff

Download patch

ref: a0b6286313c067b883ce1330499cf02f5cca6c0f
parent: 6632edc3102c6e436b9123f3515b86ff754626f6
author: phil9 <telephil9@gmail.com>
date: Fri Feb 2 00:22:58 EST 2024

import latest changes from 9front tree

--- a/vdiff.c
+++ b/vdiff.c
@@ -61,17 +61,21 @@
 int lcount;
 int maxlength;
 int Δpan;
+int nstrip;
 const char ellipsis[] = "...";
 
 void
 plumb(char *f, int l)
 {
-	int fd;
-	char wd[256], addr[300]={0};
+	int fd, i;
+	char *p, wd[256], addr[300]={0};
 
 	fd = plumbopen("send", OWRITE);
 	if(fd<0)
 		return;
+	for(i = 0; i < nstrip; i++)
+		if((p = strchr(f, '/')) != nil)
+			f = p+1;
 	getwd(wd, sizeof wd);
 	snprint(addr, sizeof addr, "%s:%d", f, l);
 	plumbsendtext(fd, "vdiff", "edit", wd, addr);
@@ -415,7 +419,7 @@
 void
 usage(void)
 {
-	fprint(2, "%s [-b]\n", argv0);
+	fprint(2, "%s [-b] [-p n]\n", argv0);
 	exits("usage");
 }
 
@@ -439,6 +443,9 @@
 	ARGBEGIN{
 	case 'b':
 		b = 1;
+		break;
+	case 'p':
+		nstrip = atoi(EARGF(usage()));
 		break;
 	default:
 		usage();