void lastDirSet(void) { char *dir; if((dir = cwd(0)) != 0) { ctxtSet(CTXT_TAG_LASTDIR, 1, dir); free(dir); } else error_out_of_memory(); }
int ctxtAddStatus(const Context_Tag tag) { char value[3]; ctxtCheckInfoTag(tag); *(unsigned*)value = CTXT_INFO(tag, sizemax) | 0x8001; value[sizeof(unsigned)] = 0; return ctxtSet(tag, 0, value); }
int ctxtPush(const Context_Tag tag, const char * const buf) { ctxt_info_t *info; ctxtCheckInfoTag(tag); assert(buf); info = &CTXT_INFO_STRUCT(tag); if(info->c_nummax == (unsigned)-1) { /* numbers will wrap -> recalculate them */ ctxtRenumberItems(tag); if(info->c_nummax == (unsigned)-1) return E_NoItems; } if(ctxtSet(tag, info->c_nummax + 1, buf) == E_None) return E_None; return E_NoMem; }
void histSet(const int num, const char * const str) { if(ctxtIsValid()) ctxtSet(CTXT_TAG_HISTORY, realNum(CTXT_TAG_HISTORY, num), str); }