Tex2page support:
Macros stolen from Dorai Sitaram Makefile target "html" Hyperlinks freebsd.org for POSIX syscalls
This commit is contained in:
parent
baa65dee1d
commit
7584f719cc
|
@ -0,0 +1 @@
|
|||
html
|
|
@ -18,13 +18,16 @@ man.ind: man.idx
|
|||
makeindex $<
|
||||
|
||||
clean:
|
||||
-rm *.log
|
||||
-rm *.log
|
||||
rm -r html
|
||||
|
||||
INSTALL_DATA= install -c -m 644
|
||||
|
||||
tar:
|
||||
tar cf - *.tex sty | gzip > man.tar.gz
|
||||
|
||||
html:
|
||||
tex2page man
|
||||
|
||||
install: man.ps
|
||||
@echo WARNING:
|
||||
|
|
|
@ -0,0 +1,105 @@
|
|||
% css.t2p
|
||||
% Dorai Sitaram
|
||||
% 19 Jan 2001
|
||||
% A basic style for HTML documents generated
|
||||
% with tex2page.
|
||||
|
||||
\cssblock
|
||||
|
||||
body {
|
||||
color: black;
|
||||
background-color: #e5e5e5;
|
||||
/*background-color: beige;*/
|
||||
margin-top: 2em;
|
||||
margin-left: 8%;
|
||||
margin-right: 8%;
|
||||
}
|
||||
|
||||
h1,h2,h3,h4,h5,h6 {
|
||||
margin-top: .5em;
|
||||
}
|
||||
|
||||
.partheading {
|
||||
font-size: 70%;
|
||||
}
|
||||
|
||||
.chapterheading {
|
||||
font-size: 70%;
|
||||
}
|
||||
|
||||
pre {
|
||||
margin-left: 2em;
|
||||
}
|
||||
|
||||
ol {
|
||||
list-style-type: decimal;
|
||||
}
|
||||
|
||||
ol ol {
|
||||
list-style-type: lower-alpha;
|
||||
}
|
||||
|
||||
ol ol ol {
|
||||
list-style-type: lower-roman;
|
||||
}
|
||||
|
||||
ol ol ol ol {
|
||||
list-style-type: upper-alpha;
|
||||
}
|
||||
|
||||
.scheme {
|
||||
color: brown;
|
||||
}
|
||||
|
||||
.scheme .keyword {
|
||||
color: #990000;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.scheme .builtin {
|
||||
color: #990000;
|
||||
}
|
||||
|
||||
.scheme .variable {
|
||||
color: navy;
|
||||
}
|
||||
|
||||
.scheme .global {
|
||||
color: purple;
|
||||
}
|
||||
|
||||
.scheme .selfeval {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.scheme .comment {
|
||||
color: teal;
|
||||
}
|
||||
|
||||
.navigation {
|
||||
color: red;
|
||||
text-align: right;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.disable {
|
||||
/* color: #e5e5e5; */
|
||||
color: gray;
|
||||
}
|
||||
|
||||
.smallcaps {
|
||||
font-size: 75%;
|
||||
}
|
||||
|
||||
.smallprint {
|
||||
color: gray;
|
||||
font-size: 75%;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.smallprint hr {
|
||||
text-align: left;
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
\endcssblock
|
|
@ -7,7 +7,13 @@
|
|||
|
||||
\maketitle
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Some code-changes for tex2page and latex output. NF
|
||||
\texonly
|
||||
\chapter*{Acknowledgements}
|
||||
\endtexonly
|
||||
\htmlonly
|
||||
\\ \ex{Acknowledgements} \\ \\
|
||||
\endhtmlonly
|
||||
|
||||
Who should I thank?
|
||||
My so-called ``colleagues,'' who laugh at me behind my back,
|
||||
|
|
|
@ -49,9 +49,9 @@ We place new releases at well-known network sites,
|
|||
and allow them to propagate from there.
|
||||
We currently release scsh to the following Internet sites:
|
||||
\begin{inset}\begin{flushleft}
|
||||
\ex{ftp://ftp-swiss.ai.mit.edu/pub/su/} \\
|
||||
\ex{http://www-swiss.ai.mit.edu/scsh/scsh.html}
|
||||
\ex{http://www.cs.indiana.edu/scheme-repository/} \\
|
||||
\ex{\urlh{ftp://ftp-swiss.ai.mit.edu/pub/su/}{ftp://ftp-swiss.ai.mit.edu/pub/su/}} \\
|
||||
\ex{\urlh{http://www-swiss.ai.mit.edu/scsh/scsh.html}{http://www-swiss.ai.mit.edu/scsh/scsh.html}} \\
|
||||
\ex{\urlh{http://www.cs.indiana.edu/scheme-repository/}{http://www.cs.indiana.edu/scheme-repository/}} \\
|
||||
\end{flushleft}
|
||||
\end{inset}
|
||||
These sites are
|
||||
|
|
|
@ -0,0 +1,126 @@
|
|||
% man.t2p
|
||||
% Dorai Sitaram
|
||||
% Feb 6, 2000
|
||||
|
||||
% This file contains the tex2page macros needed to process
|
||||
% the scsh LaTeX document scsh-n.n.n/doc/scsh-manual/man.tex.
|
||||
% Copy (or link) this file alongside man.tex and run
|
||||
%
|
||||
% tex2page man
|
||||
|
||||
\input css.t2p
|
||||
\dontuseimgforhtmlmath
|
||||
|
||||
\let\pagebreak\relax
|
||||
|
||||
\let\small\relax
|
||||
|
||||
%\let\PRIMtableofcontents\tableofcontents
|
||||
%\def\tableofcontents{\chapter*{Contents}\PRIMtableofcontents}
|
||||
|
||||
\def\subtitle#1{\def\savesubtitle{#1}}
|
||||
|
||||
\def\maketitle{
|
||||
\subject{\TIIPtitle}
|
||||
{\bf \hr}
|
||||
\rightline{\savesubtitle}
|
||||
\bigskip\bigskip
|
||||
\bigskip\bigskip
|
||||
{\bf\TIIPauthor}
|
||||
{\bf\hr}
|
||||
}
|
||||
|
||||
\let\PRIMdocument\document
|
||||
|
||||
\def\document{\PRIMdocument
|
||||
|
||||
\let\ttchars\relax
|
||||
\let\ttt\tt
|
||||
|
||||
%\def\~{\rawhtml~\endrawhtml}
|
||||
\def\~{\char`\~}
|
||||
\def\cd#1{{\tt\def\\{\char`\\}\defcsactive\${\char`\$}\defcsactive\&{\char`\&}#1}}
|
||||
\def\cddollar{\undefcsactive\$}
|
||||
\def\cdmath{\undefcsactive\$}
|
||||
\def\codeallowbreaks{\relax}
|
||||
\def\defvarx#1#2{\index{#1}\leftline{{\tt #1} \qquad #2}}
|
||||
|
||||
\let\PRIMflushright\flushright
|
||||
|
||||
\def\flushright{\PRIMflushright\TIIPtabularborder=0 }
|
||||
|
||||
\let\PRIMfigure\figure
|
||||
\let\PRIMendfigure\endfigure
|
||||
|
||||
\def\figure{\par\hrule\PRIMfigure}
|
||||
\def\endfigure{\PRIMendfigure\hrule\par}
|
||||
|
||||
\let\PRIMtable\table
|
||||
\let\PRIMendtable\endtable
|
||||
|
||||
\def\table{\par\hrule\PRIMtable}
|
||||
\def\endtable{\PRIMendtable\hrule\par}
|
||||
|
||||
\imgdef\vdots{\bf.\par.\par.}
|
||||
|
||||
\evalh{
|
||||
|
||||
(define all-blanks?
|
||||
(lambda (s)
|
||||
(andmap
|
||||
char-whitespace?
|
||||
(string->list s))))
|
||||
|
||||
}
|
||||
|
||||
|
||||
\def\spaceifnotempty{\evalh{
|
||||
|
||||
(let ((x (ungroup (get-token))))
|
||||
(unless (all-blanks? x)
|
||||
(emit #\space)))
|
||||
|
||||
}}
|
||||
|
||||
\def\dfnix#1#2#3#4{\leftline{{\tt(#1\spaceifnotempty{#2}{\it#2})} \quad $\longrightarrow$ \quad {\it #3} \qquad (#4)} \index}
|
||||
|
||||
\def\ex#1{{\tt #1}}
|
||||
\def\l#1{lambda (#1)}
|
||||
\def\lx#1{lambda {#1}}
|
||||
%\def\notenum#1{}
|
||||
%\def\project#1{}
|
||||
\def\var#1{{\it #1\/}}
|
||||
\def\vari#1#2{\mbox{{\it #1\/}\undefcsactive\$$_{#2}$}}
|
||||
|
||||
\renewenvironment{boxedfigure}{\def\srecomment#1{\\#1\\}%
|
||||
\begin{figure}\pagestyle}{\end{figure}}
|
||||
|
||||
\newenvironment{centercode}{\begin{code}}{\end{code}}
|
||||
|
||||
\def\setupcode{\tt%
|
||||
\def\\{\char`\\}%
|
||||
\defcsactive\${\$}%
|
||||
\def\evalto{==> }%
|
||||
\defcsactive\%{\%}\obeywhitespace}
|
||||
|
||||
\newenvironment{code}{\begin{quote}\bgroup\setupcode\GOBBLEOPTARG}
|
||||
{\egroup\end{quote}}
|
||||
|
||||
\newenvironment{codebox}{\begin{tableplain}\bgroup\setupcode\GOBBLEOPTARG}
|
||||
{\egroup\end{tableplain}}
|
||||
|
||||
\renewenvironment{desc}{\begin{quote}}{\end{quote}}
|
||||
|
||||
\renewenvironment{exampletable}{%
|
||||
\def\header#1{\\\leftline{#1}\\}%
|
||||
\def\splitline#1#2{\\\leftline{#1}\\\leftline{#2}}%
|
||||
\begin{tabular}{}}{\end{tabular}}
|
||||
|
||||
\newenvironment{tightcode}{\begin{code}}{\end{code}}
|
||||
\renewenvironment{widecode}{\begin{code}}{\end{code}}
|
||||
|
||||
\renewenvironment{inset}{\begin{quote}}{\end{quote}}
|
||||
\renewenvironment{leftinset}{\begin{quote}}{\end{quote}}
|
||||
\renewenvironment{tightinset}{\begin{quote}}{\end{quote}}
|
||||
\renewenvironment{tightleftinset}{\begin{quote}}{\end{quote}}
|
||||
}
|
|
@ -4,13 +4,15 @@
|
|||
|
||||
\documentclass[twoside]{report}
|
||||
\usepackage{code,boxedminipage,makeidx,palatino,ct,
|
||||
headings,mantitle,array,matter,mysize10}
|
||||
headings,mantitle,array,matter,mysize10,tex2page}
|
||||
|
||||
\texonly
|
||||
\usepackage[dvipdfm,hyperindex,hypertex,
|
||||
pdftitle={scsh manual, release 0.5.3},
|
||||
pdfauthor={Olin Shivers and Brian D.~Carlstrom}
|
||||
colorlinks=true,linkcolor=blue,pagecolor=blue,urlcolor=blue,
|
||||
pdfstartview=FitH,pdfview=FitH]{hyperref}
|
||||
pdftitle={scsh manual, release 0.5.3},
|
||||
pdfauthor={Olin Shivers and Brian D.~Carlstrom}
|
||||
colorlinks=true,linkcolor=blue,pagecolor=blue,urlcolor=blue,
|
||||
pdfstartview=FitH,pdfview=FitH]{hyperref}
|
||||
\endtexonly
|
||||
|
||||
% These fonts are good choices for screen-readable pdf, but the man needs
|
||||
% a pass over the layout, since the this tt font will blow out the width
|
||||
|
@ -22,19 +24,19 @@
|
|||
%\renewcommand{\ttdefault}{pcr}
|
||||
|
||||
% Style issues
|
||||
\parskip = 3pt plus 3pt
|
||||
\sloppy
|
||||
\parskip = 3pt plus 3pt
|
||||
\sloppy
|
||||
|
||||
%\includeonly{syscalls}
|
||||
|
||||
\input{decls}
|
||||
\makeindex
|
||||
\makeindex
|
||||
%%% End preamble
|
||||
|
||||
\begin{document}
|
||||
|
||||
\frontmatter
|
||||
\include{front}
|
||||
\frontmatter
|
||||
\include{front}
|
||||
|
||||
\mainmatter
|
||||
\include{intro}
|
||||
|
|
|
@ -11,7 +11,7 @@ The basic elements of this notation are \emph{process forms},
|
|||
\section{Extended process forms and i/o redirections}
|
||||
An \emph{extended process form} is a specification of a {\Unix} process to
|
||||
run, in a particular I/O environment:
|
||||
\codex{\var{epf} {\synteq} (\var{pf} $\var{redir}_1$ {\ldots} $\var{redir}_n$)}
|
||||
\codex{\var{epf} {\synteq} (\var{pf} $ \var{redir}_1$ {\ldots} $ \var{redir}_n $)}
|
||||
where \var{pf} is a process form and the $\var{redir}_i$ are redirection specs.
|
||||
A \emph{redirection spec} is one of:
|
||||
\begin{inset}
|
||||
|
@ -140,7 +140,7 @@ That is, it is equivalent to:
|
|||
%
|
||||
\codex{(begin (apply exec-path `(\var{prog} \vari{arg}1 {\ldots} \vari{arg}n)))}
|
||||
%
|
||||
\ex{Exec-path} is the version of the \ex{exec()} system call that
|
||||
\ex{Exec-path} is the version of the \ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=exec&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{exec()}} system call that
|
||||
uses scsh's path list to search for an executable.
|
||||
The program and the arguments must be either strings, symbols, or integers.
|
||||
Symbols and integers are coerced to strings.
|
||||
|
@ -438,7 +438,7 @@ Our scsh programmer decides to run \ex{myprog} with stdout and stderr redirected
|
|||
\emph{via {\Unix} pipes} to the ports \ex{port1} and \ex{port2}, respectively.
|
||||
He gets into trouble when he subsequently says \ex{(read port2)}.
|
||||
The {\Scheme} \ex{read} routine reads the open paren, and then hangs in a
|
||||
\ex{read()} system call trying to read a matching close paren.
|
||||
\ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=read&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{read()}} system call trying to read a matching close paren.
|
||||
But before \ex{myprog} sends the close paren down the stderr
|
||||
pipe, it first tries to write a megabyte of data to the stdout pipe.
|
||||
However, {\Scheme} is not reading that pipe---it's stuck waiting for input on
|
||||
|
|
|
@ -398,7 +398,7 @@ would implement a simple-minded version of the Unix \ex{echo} program:
|
|||
%
|
||||
The idea would be that the command
|
||||
\codex{ekko Hi there.}
|
||||
would by expanded by the \ex{exec(2)} kernel call into
|
||||
would by expanded by the \ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=exec&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{exec(2)}} kernel call into
|
||||
%
|
||||
\begin{code}
|
||||
/usr/local/bin/scsh -e main -s ekko Hi there.\end{code}
|
||||
|
@ -408,7 +408,7 @@ call the entry point on the command-line list
|
|||
\codex{(main '("ekko" "Hi" "there."))}
|
||||
and exit.
|
||||
|
||||
Unfortunately, the {\Unix} \ex{exec(2)} syscall's support for scripts is
|
||||
Unfortunately, the {\Unix} \ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=exec&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{exec(2)}} syscall's support for scripts is
|
||||
not very general or well-designed.
|
||||
It will not handle multiple arguments;
|
||||
the \ex{\#!} line is usually required to contain no more than 32 characters;
|
||||
|
@ -555,7 +555,7 @@ Writing it this way makes it possible to compile the program
|
|||
(for-each (\l{arg} (display arg) (display " "))
|
||||
(cdr args)))\end{code}
|
||||
%
|
||||
The \ex{exec(2)} expansion of the \ex{\#!} line together with
|
||||
The \ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=exec&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{exec(2)}} expansion of the \ex{\#!} line together with
|
||||
the scsh expansion of the ``\verb|\ ekko|'' meta-argument
|
||||
(see section~\ref{sec:meta-arg}) gives the following command-line expansion:
|
||||
\begin{code}
|
||||
|
|
|
@ -31,8 +31,15 @@ Besides the the facilities described in this chapter, scsh also provides
|
|||
More documentation on these procedures can be found at URLs
|
||||
\begin{tightinset}
|
||||
% The gratuitous mbox makes xdvi render the hyperlinks better.
|
||||
\texonly
|
||||
\mbox{\url{http://srfi.schemers.org/srfi-13/srfi-13.html}}\\
|
||||
\url{http://srfi.schemers.org/srfi-13/srfi-13.txt}
|
||||
\endtexonly
|
||||
% Changed the \mbox into \urlh for tex2page to avoid problems runing tex2page
|
||||
\htmlonly
|
||||
\urlh{http://srfi.schemers.org/srfi-13/srfi-13.html}{http://srfi.schemers.org/srfi-13/srfi-13.html}\\
|
||||
\urlh{http://srfi.schemers.org/srfi-13/srfi-13.txt}{http://srfi.schemers.org/srfi-13/srfi-13.txt}
|
||||
\endhtmlonly
|
||||
\end{tightinset}
|
||||
|
||||
\itum{The SRFI-14 character-set library}
|
||||
|
@ -44,8 +51,15 @@ Besides the the facilities described in this chapter, scsh also provides
|
|||
More documentation on this library can be found at URLs
|
||||
\begin{tightinset}
|
||||
% The gratuitous mbox makes xdvi render the hyperlinks better.
|
||||
\texonly
|
||||
\mbox{\url{http://srfi.schemers.org/srfi-14/srfi-14.html}}\\
|
||||
\url{http://srfi.schemers.org/srfi-14/srfi-14.txt}
|
||||
\endtexonly
|
||||
% Changed the \mbox into \urlh for tex2page to avoid problems runing tex2page
|
||||
\htmlonly
|
||||
\urlh{http://srfi.schemers.org/srfi-14/srfi-14.html}{http://srfi.schemers.org/srfi-14/srfi-14.html}\\
|
||||
\urlh{http://srfi.schemers.org/srfi-14/srfi-14.txt}{http://srfi.schemers.org/srfi-14/srfi-14.txt}
|
||||
\endhtmlonly
|
||||
\end{tightinset}
|
||||
|
||||
\end{itemize}
|
||||
|
|
|
@ -375,7 +375,7 @@ descriptor to a port with \ex{fdes->outport} or \ex{fdes->inport}, the port
|
|||
has its revealed field incremented.
|
||||
|
||||
Not all file descriptors are created by requests to make ports. Some are
|
||||
inherited on process invocation via \ex{exec(2)}, and are simply part of the
|
||||
inherited on process invocation via \ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=exec&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{exec(2)}}, and are simply part of the
|
||||
global environment. Subprocesses may depend upon them, so if a port is later
|
||||
allocated for these file descriptors, is should be considered as a revealed
|
||||
port. For example, when the {\Scheme} shell's process starts up, it opens ports
|
||||
|
@ -388,7 +388,7 @@ port.
|
|||
|
||||
Unrevealed file ports have the nice property that they can be closed when all
|
||||
pointers to the port are dropped. This can happen during gc, or at an
|
||||
\ex{exec()}---since all memory is dropped at an \ex{exec()}. No one knows the
|
||||
\ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=exec&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{exec()}}---since all memory is dropped at an \ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=exec&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{exec()}}. No one knows the
|
||||
file descriptor associated with the port, so the exec'd process certainly
|
||||
can't refer to it.
|
||||
|
||||
|
@ -399,11 +399,11 @@ the garbage collector. This is critical, since shell programming
|
|||
absolutely requires access to the {\Unix} file descriptors, as their
|
||||
numerical values are a critical part of the process interface.
|
||||
|
||||
A port's underlying file descriptor can be shifted around with \ex{dup(2)}
|
||||
A port's underlying file descriptor can be shifted around with \ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=dup&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{dup(2)}}
|
||||
when convenient. That is, the actual file descriptor on top of which a port is
|
||||
constructed can be shifted around underneath the port by the scsh kernel when
|
||||
necessary. This is important, because when the user is setting up file
|
||||
descriptors prior to a \ex{exec(2)}, he may explicitly use a file descriptor
|
||||
descriptors prior to a \ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=exec&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{exec(2)}}, he may explicitly use a file descriptor
|
||||
that has already been allocated to some port. In this case, the scsh kernel
|
||||
just shifts the port's file descriptor to some new location with \ex{dup},
|
||||
freeing up its old descriptor. This prevents errors from happening in the
|
||||
|
@ -431,8 +431,8 @@ alive and well so that it can subsequently be dup'd into descriptor 0 for
|
|||
\ex{prog}'s stdin.
|
||||
|
||||
The port-shifting machinery makes the following guarantee: a port is only
|
||||
moved when the underlying file descriptor is closed, either by a \ex{close()}
|
||||
or a \ex{dup2()} operation. Otherwise a port/file-descriptor association is
|
||||
moved when the underlying file descriptor is closed, either by a \ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=close&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{close()}}
|
||||
or a \ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=dup2&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{dup2()}} operation. Otherwise a port/file-descriptor association is
|
||||
stable.
|
||||
|
||||
Under normal circumstances, all this machinery just works behind the scenes to
|
||||
|
@ -524,17 +524,17 @@ Decrement the port's revealed count.
|
|||
\defunx{dup->outport} {fd/port [newfd]} {port}
|
||||
\defunx{dup->fdes} {fd/port [newfd]} {fd}
|
||||
\begin{desc}
|
||||
These procedures provide the functionality of C's \ex{dup()} and \ex{dup2()}.
|
||||
These procedures provide the functionality of C's \ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=dup&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{dup()}} and \ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=dup2&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{dup2()}}.
|
||||
The different routines return different types of values:
|
||||
\ex{dup->inport}, \ex{dup->outport}, and \ex{dup->fdes} return
|
||||
input ports, output ports, and integer file descriptors, respectively.
|
||||
\ex{dup}'s return value depends on on the type of
|
||||
\var{fd/port}---it maps fd$\rightarrow$fd and port$\rightarrow$port.
|
||||
|
||||
These procedures use the {\Unix} \ex{dup()} syscall to replicate
|
||||
These procedures use the {\Unix} \ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=dup&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{dup()}} syscall to replicate
|
||||
the file descriptor or file port \var{fd/port}.
|
||||
If a \var{newfd} file descriptor is given, it is used as the target of
|
||||
the dup operation, \ie, the operation is a \ex{dup2()}.
|
||||
the dup operation, \ie, the operation is a \ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=dup2&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{dup2()}}.
|
||||
In this case, procedures that return a port (such as \ex{dup->inport})
|
||||
will return one with the revealed count set to one.
|
||||
For example, \ex{(dup (current-input-port) 5)} produces
|
||||
|
@ -953,14 +953,14 @@ It is not without reason that the FreeBSD man pages refer to {\Posix}
|
|||
file locking as ``completely stupid.''
|
||||
|
||||
Scsh moves Scheme ports from file descriptor to file descriptor with
|
||||
\ex{dup()} and \ex{close()} as required by the runtime,
|
||||
\ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=dup&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{dup()}} and \ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=close&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{close()}} as required by the runtime,
|
||||
so it is impossible to keep file locks open across one of these shifts.
|
||||
Hence we can only offer {\Posix} advisory file locking directly on raw
|
||||
integer file descriptors;
|
||||
regrettably, there are no facilities for locking Scheme ports.
|
||||
|
||||
Note that once a Scheme port is revealed in scsh, the runtime will not
|
||||
shift the port around with \ex{dup()} and \ex{close()}.
|
||||
shift the port around with \ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=dup&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{dup()}} and \ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=close&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{close()}}.
|
||||
This means the file-locking procedures can then be applied to the port's
|
||||
associated file descriptor.
|
||||
}
|
||||
|
@ -1117,7 +1117,7 @@ while \ex{delete-filesys-object} simply returns.
|
|||
If you override an existing object, then \var{old-fname}
|
||||
and \var{new-fname} must type-match---either both directories,
|
||||
or both non-directories.
|
||||
This is required by the semantics of {\Unix} \ex{rename()}.
|
||||
This is required by the semantics of {\Unix} \ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=rename&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{rename()}}.
|
||||
|
||||
\remark{
|
||||
There is an unfortunate atomicity problem with the \ex{rename-file}
|
||||
|
@ -1125,7 +1125,7 @@ while \ex{delete-filesys-object} simply returns.
|
|||
specify no-override, but create file \ex{new-fname} sometime between
|
||||
\ex{rename-file}'s existence check and the actual rename operation,
|
||||
your file will be clobbered with \ex{old-fname}. There is no way to fix
|
||||
this problem, given the semantics of {\Unix} \ex{rename()};
|
||||
this problem, given the semantics of {\Unix} \ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=rename&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{rename()}};
|
||||
at least it is highly unlikely to occur in practice.
|
||||
}
|
||||
\end{defundescx}
|
||||
|
@ -1165,7 +1165,7 @@ while \ex{delete-filesys-object} simply returns.
|
|||
These procedures are not {\Posix}.
|
||||
Interestingly enough, \ex{sync\=file\=system} doesn't actually
|
||||
do what it is claimed to do. We just threw it in for humor value.
|
||||
See the \ex{sync(2)} man page for {\Unix} enlightenment.
|
||||
See the \ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=sync&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{sync(2)}} man page for {\Unix} enlightenment.
|
||||
\end{desc}
|
||||
|
||||
\begin{defundesc} {truncate-file} {fname/fd/port len} \undefined
|
||||
|
@ -1290,7 +1290,7 @@ For example,
|
|||
calls do not take a \var{chase?} flag.
|
||||
|
||||
Note that these procedures use the process' \emph{effective} user
|
||||
and group ids for permission checking. {\Posix} defines an \ex{access()}
|
||||
and group ids for permission checking. {\Posix} defines an \ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=access&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{access()}}
|
||||
function that uses the process' real uid and gids. This is handy
|
||||
for setuid programs that would like to find out if the actual user
|
||||
has specific rights; scsh ought to provide this functionality (but doesn't
|
||||
|
@ -1310,7 +1310,7 @@ For example,
|
|||
These should be disentangled.
|
||||
|
||||
Some of these problems could be avoided if {\Posix} had a real-uid
|
||||
variant of the \ex{access()} call we could use, but the atomicity
|
||||
variant of the \ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=access&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{access()}} call we could use, but the atomicity
|
||||
issue is still a problem. In the final analysis, the only way to
|
||||
find out if you have the right to perform an operation on a file
|
||||
is to try and open it for the desired operation. These permission-checking
|
||||
|
@ -1467,7 +1467,7 @@ All wild-card characters in \var{str} are quoted with a backslash.
|
|||
|
||||
\ex{file-match} provides a more powerful file-matching service, at the
|
||||
expense of a less convenient notation. It is intermediate in
|
||||
power between most shell matching machinery and recursive \ex{find(1)}.
|
||||
power between most shell matching machinery and recursive \ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=find&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{find(1)}}.
|
||||
|
||||
Each pattern is a regexp. The procedure searches from \var{root},
|
||||
matching the first-level files against pattern \vari{pat}1, the
|
||||
|
@ -1716,7 +1716,7 @@ a slash character---it is used directly. So a program with a name like
|
|||
\ex{"bin/prog"} always executes the program \ex{bin/prog} in the current working
|
||||
directory. See \verb|$path| and \verb|exec-path-list|, below.
|
||||
|
||||
Note that there is no analog to the C function \ex{execv()}.
|
||||
Note that there is no analog to the C function \ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=execv&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{execv()}}.
|
||||
To get the effect just do
|
||||
\codex{(apply exec prog arglist)}
|
||||
|
||||
|
@ -1724,7 +1724,7 @@ All of these procedures flush buffered output and close unrevealed ports
|
|||
before executing the new binary.
|
||||
To avoid flushing buffered output, see \verb|%exec| below.
|
||||
|
||||
Note that the C \ex{exec()} procedure allows the zeroth element of the
|
||||
Note that the C \ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=exec&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{exec()}} procedure allows the zeroth element of the
|
||||
argument vector to be different from the file being executed, \eg
|
||||
%
|
||||
\begin{inset}
|
||||
|
@ -1802,7 +1802,7 @@ Suspend the current process with a SIGSTOP signal.
|
|||
\defun {fork} {[thunk]} {proc or \sharpf}
|
||||
\defunx {\%fork} {[thunk]} {proc or \sharpf}
|
||||
\begin{desc}
|
||||
\ex{fork} with no arguments is like C \ex{fork()}.
|
||||
\ex{fork} with no arguments is like C \ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=fork&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{fork()}}.
|
||||
In the parent process, it returns the child's \emph{process object}
|
||||
(see below for more information on process objects).
|
||||
In the child process, it returns {\sharpf}.
|
||||
|
@ -2242,7 +2242,7 @@ I can't remember how \ex{set-priority} and \ex{priority} work, so no
|
|||
\begin{desc}
|
||||
These routines get and set the effective and real user and group ids.
|
||||
The \ex{set-uid} and \ex{set-gid} routines correspond to the {\Posix}
|
||||
\ex{setuid()} and \ex{setgid()} procedures.
|
||||
\ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=setuid&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{setuid()}} and \ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=setgid&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{setgid()}} procedures.
|
||||
\end{desc}
|
||||
|
||||
|
||||
|
@ -2787,7 +2787,7 @@ String & A {\Posix} time zone string understood by the OS
|
|||
``\ex{UTC+\emph{hh}:\emph{mm}:\emph{ss}}'';
|
||||
the trailing \ex{:\emph{mm}:\emph{ss}} portion is deleted if it is zeroes.
|
||||
|
||||
\oops{The Posix facility for converting dates to times, \ex{mktime()},
|
||||
\oops{The Posix facility for converting dates to times, \ex{\urlh{http://www.FreeBSD.org/cgi/man.cgi?query=mktime&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html}{mktime()}},
|
||||
has a broken design: it indicates an error by returning -1, which
|
||||
is also a legal return value (for date 23:59:59 UCT, 12/31/1969).
|
||||
Scsh resolves the ambiguity in a paranoid fashion: it always
|
||||
|
|
|
@ -7,8 +7,10 @@ made to scsh.
|
|||
We invite interested hackers to do any of them, and send us the code;
|
||||
we'll put you on the team.
|
||||
Visit the Scheme Underground Web page for more information on good hacks at
|
||||
\begin{tightinset}\verb|http://www.ai.mit.edu/projects/su/|
|
||||
\end{tightinset}
|
||||
\begin{inset} \begin{flushleft}
|
||||
\ex{\urlh{http://www.ai.mit.edu/projects/su/}{http://www.ai.mit.edu/projects/su/}}
|
||||
\end{flushleft}
|
||||
\end{inset}
|
||||
Scsh is a tool that lets you write fun programs that do real things in
|
||||
an elegant language; go wild.
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
\documentclass[twoside]{report}
|
||||
\usepackage{code,boxedminipage,draftfooters,makeidx,palatino,ct,
|
||||
headings,mantitle,array,matter,a4}
|
||||
headings,mantitle,array,matter,a4,tex2page}
|
||||
|
||||
% Style issues
|
||||
\parskip = 3pt plus 3pt
|
||||
|
|
Loading…
Reference in New Issue