/usr/share/stex/src/fixbibtex.ss is in stex 1.2.1+git20171204.g5e4f0ca-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #! /usr/bin/scheme --program
;;; fixbibtex.ss
;;; fixbibtex removes the line breaks inserted by bibtex, sometimes
;;; in the middle of tex commands or urls.
(import (chezscheme))
(unless (= (length (command-line-arguments)) 1)
(printf "usage: fixbibtex <filename>\n")
(exit 1))
(define fn (car (command-line-arguments)))
(let ([s (call-with-port (open-input-file fn) get-string-all)])
(with-input-from-string s
(lambda ()
(with-output-to-file fn
(lambda ()
(define (s0 c)
(unless (eof-object? c)
(case c
[(#\\) (write-char c) (s1 (read-char))]
[(#\%) (s2 (read-char))]
[else (write-char c) (s0 (read-char))])))
(define (s1 c) ; seen \
(unless (eof-object? c)
(write-char c)
(s0 (read-char))))
(define (s2 c) ; seen %
(case c
[(#\newline) (s0 (read-char))]
[else (write-char #\%) (s0 c)]))
(s0 (read-char)))
'replace))))
|