コード例 #1
0
ファイル: history.c プロジェクト: Peter-J-Jansen/spinhawk
int history_prev() {
  if (history_ptr == NULL) {
    history_ptr = history_lines_end;
    if (history_ptr == NULL)
      return(-1);
    copy_to_historyCmdLine(history_ptr->cmdline);
    return(0);
  }
  if (history_ptr->prev == NULL)
    history_ptr = history_lines_end;
  else 
    history_ptr = history_ptr->prev;
  copy_to_historyCmdLine(history_ptr->cmdline);
  return(0);
}
コード例 #2
0
ファイル: history.c プロジェクト: Peter-J-Jansen/spinhawk
int history_next() {
  if (history_ptr == NULL) {
    history_ptr = history_lines_end;
    if (history_ptr == NULL)
      return(-1);
    copy_to_historyCmdLine(history_ptr->cmdline);
    return(0);
  }
  if (history_ptr->next == NULL)
    history_ptr = history_lines;
  else 
    history_ptr = history_ptr->next;
  copy_to_historyCmdLine(history_ptr->cmdline);
  return(0);
}
コード例 #3
0
ファイル: history.c プロジェクト: Orfheo/hyperion
int history_absolute_line(int x) {
  HISTORY *tmp = history_lines_end;
  int lowlimit;
  char buf[80];

  if (history_count == 0) {
    WRMSG(HHC02293, "I", "History empty");
    return -1;
  }

  lowlimit = history_count - HISTORY_MAX;

  if (x > history_count || x <= lowlimit) {
    MSGBUF(buf, "Only commands %d-%d are in history", lowlimit<0? 1 : lowlimit + 1, history_count);
    WRMSG(HHC02293, "I", buf);
    return (-1);
  }

  while (tmp->number != x)
    tmp = tmp->prev;

  copy_to_historyCmdLine(tmp->cmdline);
  history_ptr = NULL;
  return(0);
}
コード例 #4
0
ファイル: history.c プロジェクト: Peter-J-Jansen/spinhawk
int history_relative_line(int x) {
  HISTORY *tmp = history_lines_end;

  if (-x > HISTORY_MAX) {
    logmsg("History limited to last %d commands\n", HISTORY_MAX);
    return (-1);
  }

  if (-x > history_count) {
    logmsg("only %d commands in history\n", history_count);
    return (-1);
  }

  while (x<-1) {
    tmp = tmp->prev;
    x++;
  }
  copy_to_historyCmdLine(tmp->cmdline);
  history_ptr = NULL;
  return(0);
}
コード例 #5
0
ファイル: history.c プロジェクト: Peter-J-Jansen/spinhawk
int history_absolute_line(int x) {
  HISTORY *tmp = history_lines_end;
  int lowlimit;

  if (history_count == 0) {
    logmsg("history empty\n");
    return -1;
  }

  lowlimit = history_count - HISTORY_MAX;

  if (x > history_count || x <= lowlimit) {
    logmsg("only commands %d-%d are in history\n", lowlimit<0? 1 : lowlimit + 1, history_count);
    return (-1);
  }

  while (tmp->number != x)
    tmp = tmp->prev;

  copy_to_historyCmdLine(tmp->cmdline);
  history_ptr = NULL;
  return(0);
}
コード例 #6
0
ファイル: history.c プロジェクト: Orfheo/hyperion
int history_relative_line(int x) {
  HISTORY *tmp = history_lines_end;
  char buf[80];

  if (-x > HISTORY_MAX) {
    MSGBUF(buf, "History limited to last %d commands", HISTORY_MAX);
    WRMSG(HHC02293, "I", buf);
    return (-1);
  }

  if (-x > history_count) {
    MSGBUF(buf, "Only %d commands in history", history_count);
    WRMSG(HHC02293, "I", buf);
    return (-1);
  }

  while (x<-1) {
    tmp = tmp->prev;
    x++;
  }
  copy_to_historyCmdLine(tmp->cmdline);
  history_ptr = NULL;
  return(0);
}