acme: add -m option and avoid looking in the mirror

This commit is contained in:
Russ Cox 2008-04-17 16:04:19 -04:00
parent e63025d094
commit cd5a73785d
6 changed files with 25 additions and 2 deletions

View file

@ -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);
}