mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-24 11:41:58 +00:00
acme: correct modified message after initial load; more detail in
message http://codereview.appspot.com/123051
This commit is contained in:
parent
1961ee8223
commit
daea2c7d50
5 changed files with 29 additions and 14 deletions
|
@ -19,7 +19,8 @@ void keyboardthread(void*);
|
||||||
void waitthread(void*);
|
void waitthread(void*);
|
||||||
void xfidallocthread(void*);
|
void xfidallocthread(void*);
|
||||||
void newwindowthread(void*);
|
void newwindowthread(void*);
|
||||||
void plumbproc(void*);
|
void plumbproc(void*);
|
||||||
|
int timefmt(Fmt*);
|
||||||
|
|
||||||
Reffont **fontcache;
|
Reffont **fontcache;
|
||||||
int nfontcache;
|
int nfontcache;
|
||||||
|
@ -127,6 +128,8 @@ threadmain(int argc, char *argv[])
|
||||||
fontnames[1] = estrdup(fontnames[1]);
|
fontnames[1] = estrdup(fontnames[1]);
|
||||||
|
|
||||||
quotefmtinstall();
|
quotefmtinstall();
|
||||||
|
fmtinstall('t', timefmt);
|
||||||
|
|
||||||
cputype = getenv("cputype");
|
cputype = getenv("cputype");
|
||||||
objtype = getenv("objtype");
|
objtype = getenv("objtype");
|
||||||
home = getenv("HOME");
|
home = getenv("HOME");
|
||||||
|
@ -1067,3 +1070,14 @@ ismtpt(char *file)
|
||||||
n = strlen(mtpt);
|
n = strlen(mtpt);
|
||||||
return strncmp(file, mtpt, n) == 0 && ((n > 0 && mtpt[n-1] == '/') || file[n] == '/' || file[n] == 0);
|
return strncmp(file, mtpt, n) == 0 && ((n > 0 && mtpt[n-1] == '/') || file[n] == '/' || file[n] == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
timefmt(Fmt *f)
|
||||||
|
{
|
||||||
|
Tm *tm;
|
||||||
|
|
||||||
|
tm = localtime(va_arg(f->args, ulong));
|
||||||
|
return fmtprint(f, "%04d/%02d/%02d %02d:%02d:%02d",
|
||||||
|
tm->year+1900, tm->mon+1, tm->mday, tm->hour, tm->min, tm->sec);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ struct File
|
||||||
Rune *name; /* name of associated file */
|
Rune *name; /* name of associated file */
|
||||||
int nname; /* size of name */
|
int nname; /* size of name */
|
||||||
uvlong qidpath; /* of file when read */
|
uvlong qidpath; /* of file when read */
|
||||||
uint mtime; /* of file when read */
|
ulong mtime; /* of file when read */
|
||||||
int dev; /* of file when read */
|
int dev; /* of file when read */
|
||||||
int unread; /* file has not been read from disk */
|
int unread; /* file has not been read from disk */
|
||||||
int editclean; /* mark clean after edit command */
|
int editclean; /* mark clean after edit command */
|
||||||
|
@ -210,7 +210,7 @@ void textfill(Text*);
|
||||||
void textframescroll(Text*, int);
|
void textframescroll(Text*, int);
|
||||||
void textinit(Text*, File*, Rectangle, Reffont*, Image**);
|
void textinit(Text*, File*, Rectangle, Reffont*, Image**);
|
||||||
void textinsert(Text*, uint, Rune*, uint, int);
|
void textinsert(Text*, uint, Rune*, uint, int);
|
||||||
uint textload(Text*, uint, char*, int);
|
int textload(Text*, uint, char*, int);
|
||||||
Rune textreadc(Text*, uint);
|
Rune textreadc(Text*, uint);
|
||||||
void textredraw(Text*, Rectangle, Font*, Image*, int);
|
void textredraw(Text*, Rectangle, Font*, Image*, int);
|
||||||
void textreset(Text*);
|
void textreset(Text*);
|
||||||
|
|
|
@ -644,14 +644,14 @@ putfile(File *f, int q0, int q1, Rune *namer, int nname)
|
||||||
d = dirstat(name);
|
d = dirstat(name);
|
||||||
if(d!=nil && runeeq(namer, nname, f->name, f->nname)){
|
if(d!=nil && runeeq(namer, nname, f->name, f->nname)){
|
||||||
/* f->mtime+1 because when talking over NFS it's often off by a second */
|
/* f->mtime+1 because when talking over NFS it's often off by a second */
|
||||||
if(f->dev!=d->dev || f->qidpath!=d->qid.path || f->mtime+1<d->mtime){
|
if(f->dev!=d->dev || f->qidpath!=d->qid.path || abs(f->mtime-d->mtime) > 1){
|
||||||
f->dev = d->dev;
|
|
||||||
f->qidpath = d->qid.path;
|
|
||||||
f->mtime = d->mtime;
|
|
||||||
if(f->unread)
|
if(f->unread)
|
||||||
warning(nil, "%s not written; file already exists\n", name);
|
warning(nil, "%s not written; file already exists\n", name);
|
||||||
else
|
else
|
||||||
warning(nil, "%s modified%s%s since last read\n", name, d->muid[0]?" by ":"", d->muid);
|
warning(nil, "%s modified%s%s since last read\n\twas %t; now %t\n", name, d->muid[0]?" by ":"", d->muid, f->mtime, d->mtime);
|
||||||
|
f->dev = d->dev;
|
||||||
|
f->qidpath = d->qid.path;
|
||||||
|
f->mtime = d->mtime;
|
||||||
goto Rescue1;
|
goto Rescue1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -754,7 +754,8 @@ openfile(Text *t, Expand *e)
|
||||||
w = makenewwindow(t);
|
w = makenewwindow(t);
|
||||||
t = &w->body;
|
t = &w->body;
|
||||||
winsetname(w, e->name, e->nname);
|
winsetname(w, e->name, e->nname);
|
||||||
textload(t, 0, e->bname, 1);
|
if(textload(t, 0, e->bname, 1) >= 0)
|
||||||
|
t->file->unread = FALSE;
|
||||||
t->file->mod = FALSE;
|
t->file->mod = FALSE;
|
||||||
t->w->dirty = FALSE;
|
t->w->dirty = FALSE;
|
||||||
winsettag(t->w);
|
winsettag(t->w);
|
||||||
|
|
|
@ -188,7 +188,7 @@ textcolumnate(Text *t, Dirlist **dlp, int ndl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint
|
int
|
||||||
textload(Text *t, uint q0, char *file, int setqid)
|
textload(Text *t, uint q0, char *file, int setqid)
|
||||||
{
|
{
|
||||||
Rune *rp;
|
Rune *rp;
|
||||||
|
@ -203,16 +203,16 @@ textload(Text *t, uint q0, char *file, int setqid)
|
||||||
error("text.load");
|
error("text.load");
|
||||||
if(t->w->isdir && t->file->nname==0){
|
if(t->w->isdir && t->file->nname==0){
|
||||||
warning(nil, "empty directory name");
|
warning(nil, "empty directory name");
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
if(ismtpt(file)){
|
if(ismtpt(file)){
|
||||||
warning(nil, "will not open self mount point %s\n", file);
|
warning(nil, "will not open self mount point %s\n", file);
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
fd = open(file, OREAD);
|
fd = open(file, OREAD);
|
||||||
if(fd < 0){
|
if(fd < 0){
|
||||||
warning(nil, "can't open %s: %r\n", file);
|
warning(nil, "can't open %s: %r\n", file);
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
d = dirfstat(fd);
|
d = dirfstat(fd);
|
||||||
if(d == nil){
|
if(d == nil){
|
||||||
|
@ -303,7 +303,7 @@ textload(Text *t, uint q0, char *file, int setqid)
|
||||||
|
|
||||||
Rescue:
|
Rescue:
|
||||||
close(fd);
|
close(fd);
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint
|
uint
|
||||||
|
|
Loading…
Reference in a new issue