- switch (vol) {
- case (VOL_AMD):
- return("OpenBSD Ancestral Manual Documents");
- case (VOL_IND):
- return("OpenBSD Manual Master Index");
- case (VOL_KM):
- return("OpenBSD Kernel Manual");
- case (VOL_LOCAL):
- return("OpenBSD Local Manual");
- case (VOL_PRM):
- return("OpenBSD Programmer's Manual");
- case (VOL_PS1):
- return("OpenBSD Programmer's Supplementary Documents");
- case (VOL_SMM):
- return("OpenBSD System Manager's Manual");
- case (VOL_URM):
- return("OpenBSD Reference Manual");
- case (VOL_USD):
- return("OpenBSD User's Supplementary Documents");
- default:
- break;
+ /*
+ * Count up visible word characters. Control sequences
+ * (starting with the CSI) aren't counted. A space
+ * generates a non-printing word, which is valid (the
+ * space is printed according to regular spacing rules).
+ */
+
+ /* LINTED */
+ for (jhy = 0; j < (int)p->col; j++) {
+ if ((j && ' ' == p->buf[j]) || '\t' == p->buf[j])
+ break;
+
+ /* Back over the the last printed character. */
+ if (8 == p->buf[j]) {
+ assert(j);
+ vend -= (*p->width)(p, p->buf[j - 1]);
+ continue;
+ }
+
+ /* Regular word. */
+ /* Break at the hyphen point if we overrun. */
+ if (vend > vis && vend < bp &&
+ ASCII_HYPH == p->buf[j])
+ jhy = j;
+
+ vend += (*p->width)(p, p->buf[j]);
+ }
+
+ /*
+ * Find out whether we would exceed the right margin.
+ * If so, break to the next line.
+ */
+ if (vend > bp && 0 == jhy && vis > 0) {
+ vend -= vis;
+ (*p->endline)(p);
+ if (TERMP_NOBREAK & p->flags) {
+ p->viscol = p->rmargin;
+ (*p->advance)(p, p->rmargin);
+ vend += p->rmargin - p->offset;
+ } else {
+ p->viscol = 0;
+ vbl = p->offset;
+ }
+
+ /* Remove the p->overstep width. */
+
+ bp += (int)/* LINTED */
+ p->overstep;
+ p->overstep = 0;
+ }
+
+ /*
+ * Skip leading tabs, they were handled above.
+ */
+ while (i < (int)p->col && '\t' == p->buf[i])
+ i++;
+
+ /* Write out the [remaining] word. */
+ for ( ; i < (int)p->col; i++) {
+ if (vend > bp && jhy > 0 && i > jhy)
+ break;
+ if ('\t' == p->buf[i])
+ break;
+ if (' ' == p->buf[i]) {
+ j = i;
+ while (' ' == p->buf[i])
+ i++;
+ vbl += (i - j) * (*p->width)(p, ' ');
+ break;
+ }
+ if (ASCII_NBRSP == p->buf[i]) {
+ vbl += (*p->width)(p, ' ');
+ continue;
+ }
+
+ /*
+ * Now we definitely know there will be
+ * printable characters to output,
+ * so write preceding white space now.
+ */
+ if (vbl) {
+ (*p->advance)(p, vbl);
+ p->viscol += vbl;
+ vbl = 0;
+ }
+
+ if (ASCII_HYPH == p->buf[i]) {
+ (*p->letter)(p, '-');
+ p->viscol += (*p->width)(p, '-');
+ } else {
+ (*p->letter)(p, p->buf[i]);
+ p->viscol += (*p->width)(p, p->buf[i]);
+ }
+ }
+ vend += vbl;
+ vis = vend;
+ }
+
+ p->col = 0;
+ p->overstep = 0;
+
+ if ( ! (TERMP_NOBREAK & p->flags)) {
+ p->viscol = 0;
+ (*p->endline)(p);
+ return;