aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/acme/acme.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2008-04-17 16:04:19 -0400
committerRuss Cox <rsc@swtch.com>2008-04-17 16:04:19 -0400
commitcd5a73785d8f7533f1438a955daf23159d09a352 (patch)
treec9c9c688ca092d2639a41b30d448d7ff33f66d3f /src/cmd/acme/acme.c
parente63025d09486aea0f644578b5e05a093c130b7d2 (diff)
downloadplan9port-cd5a73785d8f7533f1438a955daf23159d09a352.tar.gz
plan9port-cd5a73785d8f7533f1438a955daf23159d09a352.tar.bz2
plan9port-cd5a73785d8f7533f1438a955daf23159d09a352.zip
acme: add -m option and avoid looking in the mirror
Diffstat (limited to 'src/cmd/acme/acme.c')
-rw-r--r--src/cmd/acme/acme.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/cmd/acme/acme.c b/src/cmd/acme/acme.c
index 87673cdb..07ce503a 100644
--- a/src/cmd/acme/acme.c
+++ b/src/cmd/acme/acme.c
@@ -28,6 +28,7 @@ Reffont *reffonts[2];
int snarffd = -1;
int mainpid;
int swapscrollbuttons = FALSE;
+char *mtpt;
enum{
NSnarf = 1000 /* less than 1024, I/O buffer size */
@@ -106,6 +107,11 @@ threadmain(int argc, char *argv[])
if(loadfile == nil)
goto Usage;
break;
+ case 'm':
+ mtpt = ARGF();
+ if(mtpt == nil)
+ goto Usage;
+ break;
case 'r':
swapscrollbuttons = TRUE;
break;
@@ -1056,3 +1062,13 @@ acmegetsnarf(void)
free(r);
free(s);
}
+
+int
+ismtpt(char *file)
+{
+ int n;
+
+ /* This is not foolproof, but it will stop a lot of them. */
+ n = strlen(mtpt);
+ return strncmp(file, mtpt, n) == 0 && ((n > 0 && mtpt[n-1] == '/') || file[n] == '/' || file[n] == 0);
+}