void sortname(File *f) { int i, cmp, w; int dupwarned; w = whichmenu(f); dupwarned = FALSE; dellist(&file, w); if(f == cmd) i = 0; else{ for(i=0; i<file.nused; i++){ cmp = Strcmp(&f->name, &file.filepptr[i]->name); if(cmp==0 && !dupwarned){ dupwarned = TRUE; warn_S(Wdupname, &f->name); }else if(cmp<0 && (i>0 || cmd==0)) break; } } inslist(&file, i, f); if(downloaded) outTsS(Hmovname, f->tag, &f->name); }
void closeup(Flayer *l) { Text *t=(Text *)l->user1; int m; m = whichmenu(t->tag); if(m < 0) return; flclose(l); if(l == which){ which = 0; current(flwhich(Pt(0, 0))); } if(l == work) work = 0; if(--t->nwin == 0){ rclear(&t->rasp); free((uchar *)t); text[m] = 0; }else if(l == &t->l[t->front]){ for(m=0; m<NL; m++) /* find one; any one will do */ if(t->l[m].textfn){ t->front = m; return; } panic("close"); } }
void delfile(File *f) { int w = whichmenu(f); if(w < 0) /* e.g. x/./D */ return; if(downloaded) outTs(Hdelname, f->tag); dellist(&file, w); fileclose(f); }
void checkqid(File *f) { int i, w; File *g; w = whichmenu(f); for(i=1; i<file.nused; i++){ g = file.filepptr[i]; if(w == i) continue; if(f->dev==g->dev && f->qidpath==g->qidpath) warn_SS(Wdupfile, &f->name, &g->name); } }
void state(File *f, int cleandirty) { if(f == cmd) return; f->unread = FALSE; if(downloaded && whichmenu(f)>=0){ /* else flist or menu */ if(f->mod && cleandirty!=Dirty) outTs(Hclean, f->tag); else if(!f->mod && cleandirty==Dirty) outTs(Hdirty, f->tag); } if(cleandirty == Clean) f->mod = FALSE; else f->mod = TRUE; }
void filelooper(Cmd *cp, int XY) { File *f, *cur; int i; if(Glooping++) error(EnestXY); nest++; settempfile(); cur = curfile; for(i = 0; i<tempfile.nused; i++){ f = tempfile.filepptr[i]; if(f==cmd) continue; if(cp->re==0 || filematch(f, cp->re)==XY) cmdexec(f, cp->ccmd); } if(cur && whichmenu(cur)>=0) /* check that cur is still a file */ current(cur); --Glooping; --nest; }