-#if LOGFILE
-/*
- * Close the logfile.
- * If we haven't read all of standard input into it, do that now.
- */
- public void
-end_logfile()
-{
- static int tried = 0;
-
- if (logfile < 0)
- return;
- if (!tried && ch_fsize == NULL_POSITION)
- {
- tried = 1;
- ierror("finishing logfile");
- while (ch_forw_get() != EOI)
- if (sigs)
- break;
- }
- close(logfile);
- logfile = -1;
-}
-
-/*
- * Start a log file AFTER less has already been running.
- * Invoked from the - command; see toggle_option().
- * Write all the existing buffered data to the log file.
- */
- public void
-sync_logfile()
-{
- register struct buf *bp;
- register int n;
- long block;
- long last_block;
-
- last_block = (last_piped_pos + BUFSIZ - 1) / BUFSIZ;
- for (block = 0; block <= last_block; block++)
- for (bp = buf_head; bp != END_OF_CHAIN; bp = bp->next)
- if (bp->block == block)
- {
- n = bp->datasize;
- if (bp->data[n-1] == EOI)
- n--;
- write(logfile, bp->data, n);
- break;
- }
-}
-
-#endif
-