示例#1
0
/* adds a line to the ln_history buffer at hst_pos and sets hst_pos to end of history. */
void add_line_to_hist(ChatContext *ctx)
{
    if (ctx->len >= MAX_STR_SIZE)
        return;

    if (ctx->hst_tot >= MAX_LINE_HIST)
        shift_hist_back(ctx);

    ++ctx->hst_tot;
    ctx->hst_pos = ctx->hst_tot;

    wmemcpy(ctx->ln_history[ctx->hst_tot - 1], ctx->line, ctx->len + 1);
}
示例#2
0
/* adds a line to the ln_history buffer at hst_pos and sets hst_pos to end of history. */
void add_line_to_hist(const wchar_t *buf, size_t len, wchar_t (*hst)[MAX_STR_SIZE], int *hst_tot, 
                      int *hst_pos)
{
    if (len > MAX_STR_SIZE)
        return;

    if (*hst_tot >= MAX_LINE_HIST)
        shift_hist_back(hst, hst_tot);

    ++(*hst_tot);
    *hst_pos = *hst_tot;

    wmemcpy(hst[*hst_tot-1], buf, len + 1);
}