MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / history_get

Function history_get

extern/editline/src/readline.c:1384–1413  ·  view source on GitHub ↗

* returns history ``num''th event * * returned pointer points to static variable */

Source from the content-addressed store, hash-verified

1382 * returned pointer points to static variable
1383 */
1384HIST_ENTRY *
1385history_get(int num)
1386{
1387 static HIST_ENTRY she;
1388 HistEvent ev;
1389 int curr_num;
1390
1391 if (h == NULL || e == NULL)
1392 rl_initialize();
1393
1394 /* save current position */
1395 if (history(h, &ev, H_CURR) != 0)
1396 return NULL;
1397 curr_num = ev.num;
1398
1399 /* start from the oldest */
1400 if (history(h, &ev, H_LAST) != 0)
1401 return NULL; /* error */
1402
1403 /* look forwards for event matching specified offset */
1404 if (history(h, &ev, H_NEXT_EVDATA, num, &she.data))
1405 return NULL;
1406
1407 she.line = ev.str;
1408
1409 /* restore pointer to where it was */
1410 (void)history(h, &ev, H_SET, curr_num);
1411
1412 return &she;
1413}
1414
1415
1416/*

Callers 1

get_history_eventFunction · 0.85

Calls 2

rl_initializeFunction · 0.85
historyClass · 0.85

Tested by

no test coverage detected