/* For ^X ^C */ static void genexmsgmulti(BW *bw, int saved, int skipped) { if (saved) if (skipped) joe_snprintf_0(msgbuf, SIZEOF(msgbuf), joe_gettext(_("Some files have not been saved."))); else joe_snprintf_0(msgbuf, SIZEOF(msgbuf), joe_gettext(_("All modified files have been saved."))); else joe_snprintf_0(msgbuf, SIZEOF(msgbuf), joe_gettext(_("No modified files, so no updates needed."))); msgnw(bw->parent, msgbuf); exmsg = vsncpy(NULL,0,sz(msgbuf)); }
static void show_messages_found_count(BW *bw, int n) { if (n) joe_snprintf_1(msgbuf, JOE_MSGBUFSIZE, joe_gettext(_("%d messages found")), n); else joe_snprintf_0(msgbuf, JOE_MSGBUFSIZE, joe_gettext(_("No messages found"))); msgnw(bw->parent, msgbuf); }
int try_lock(BW *bw,B *b) { /* First time we modify the file */ /* If we're a plain file, acquire lock */ if (!nolocks && plain_file(b)) { unsigned char bf1[256]; unsigned char bf[300]; int x; /* It's a plain file- try to lock it */ if (lock_it(b->name,bf1)) { for(x=0;bf1[x] && bf1[x]!=':';++x); bf1[x]=0; if(bf1[0]) joe_snprintf_1(bf,sizeof(bf),joe_gettext(LOCKMSG1),bf1); else joe_snprintf_0(bf, sizeof(bf), joe_gettext(LOCKMSG2)); if (mkqw(bw->parent, sz(bf), steal_lock, NULL, b, NULL)) { uquery(bw); if (!b->locked) return 0; } else return 0; } else { /* Remember to unlock it */ b->locked = 1; } } return 1; }
int steal_lock(BW *bw,int c,B *b,int *notify) { if (yncheck(steallock_key, c)) { unsigned char bf1[256]; unsigned char bf[300]; unlock_it(b->name); if (lock_it(b->name,bf1)) { int x; for(x=0;bf1[x] && bf1[x]!=':';++x); bf1[x]=0; if(bf1[0]) joe_snprintf_1(bf,sizeof(bf),joe_gettext(LOCKMSG1),bf1); else joe_snprintf_0(bf, sizeof(bf), joe_gettext(LOCKMSG2)); if (mkqw(bw->parent, sz(bf), steal_lock, NULL, b, notify)) { return 0; } else { if (notify) *notify = -1; return -1; } } else { b->locked=1; if (notify) *notify = 1; return 0; } } else if (yncheck(ignorelock_key, c)) { b->locked=1; b->ignored_lock=1; if (notify) *notify = 1; return 0; } else if (yncheck(canceledit_key, c)) { if (notify) *notify = 1; return 0; } else { if (mkqw(bw->parent, sz(joe_gettext(LOCKMSG2)), steal_lock, NULL, b, notify)) { return 0; } else return -1; } }