Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/vidcontrol/vidcontrol.c
Show First 20 Lines • Show All 1,287 Lines • ▼ Show 20 Lines | |||||
static void | static void | ||||
set_history(char *opt) | set_history(char *opt) | ||||
{ | { | ||||
int size; | int size; | ||||
size = atoi(opt); | size = atoi(opt); | ||||
if ((*opt == '\0') || size < 0) { | if ((*opt == '\0') || size < 0) { | ||||
revert(); | revert(); | ||||
errx(1, "argument must be a positive number"); | errx(1, "argument must be a non-negative number"); | ||||
emaste: The error string certainly didn't agree with the previous `size < 0` test, but is `vidcontrol… | |||||
Not Done Inline ActionsIt is technically possible to specify no history, but it will have the same effect as running vidcontrol -h <x> for all x <= screen_height. From sys/dev/vt/vt_buf.c: void vtbuf_sethistory_size(struct vt_buf *vb, unsigned int size) { term_pos_t p; /* With same size */ p.tp_row = vb->vb_scr_size.tp_row; p.tp_col = vb->vb_scr_size.tp_col; vtbuf_grow(vb, &p, size); } void vtbuf_grow(struct vt_buf *vb, const term_pos_t *p, unsigned int history_size) { term_char_t *old, *new, **rows, **oldrows, **copyrows, *row, *oldrow; unsigned int w, h, c, r, old_history_size; size_t bufsize, rowssize; int history_full; history_size = MAX(history_size, p->tp_row); ... } Since history_size will be at least screen_height large, should it be permissible to specify a history size of 0 or be consistent with the previous error string? guest-svmhdvn: It is technically possible to specify no history, but it will have the same effect as running… | |||||
Not Done Inline ActionsHmm, good point, although it might be useful to allow -h 0 to mean minimum history size. emaste: Hmm, good point, although it might be useful to allow `-h 0` to mean minimum history size. | |||||
} | } | ||||
if (ioctl(0, CONS_HISTORY, &size) == -1) { | if (ioctl(0, CONS_HISTORY, &size) == -1) { | ||||
revert(); | revert(); | ||||
err(1, "setting history buffer size"); | err(1, "setting history buffer size"); | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 161 Lines • Show Last 20 Lines |
The error string certainly didn't agree with the previous size < 0 test, but is vidcontrol -h 0 actually not permissible -- is it not possible to specify no history?