はてブロ@ama_ch

https://twitter.com/ama_ch

screenを縦に横に分割しまくろう

screenてデフォルトだと水平分割しかできないんですよね。MacBookのような横に長い画面だと、左右に分割した方が効率が良いのは明らかです。うーん何とかしたい!
おしえて!google先生
「screen 分割 左右」とか「screen 分割 (縦|垂直)」とか「screen vsplit」などと検索しまくった末に、垂直に分割できるcvsがあるらしいので早速導入してみました。


参考にしたページ:
:wq - blog » Blog Archive » Compiling screen from CVS on OSX for vertical split.
CodeSnippets: Vertical & horizontal split for man screen


以下のコマンドを実行します。

% cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/screen co screen
% cd screen/src
% patch < /opt/local/var/macports/sources/rsync.macports.org/release/ports/sysutils/screen/files/patch-maxargs
% patch < /opt/local/var/macports/sources/rsync.macports.org/release/ports/sysutils/screen/files/patch-windowsize
% patch < /opt/local/var/macports/sources/rsync.macports.org/release/ports/sysutils/screen/files/patch-pty.c
% ./configure --enable-colors256
% make
% sudo make install

あとは普通にscreenを起動して、「escape |」で垂直分割が使えました。「|」はアルファベットの「エル」ではなく縦棒の方なので注意が必要です。
これでscreenを縦に横に分割しまくれるようになりました。僕がEmacsで大好きな3ペイン表示も余裕です!やったね!!


せっかく分割ができるようになったので、分割操作も含めたウィンドウ操作のキーバインドEmacs風に設定してみましょう。
.screenrcに以下の設定を記述します。

bind -c REGION o focus down
bind -c REGION p focus up
bind -c REGION 0 remove
bind -c REGION 1 only
bind -c REGION 2 split
bind -c REGION 3 split -v
bind -c REGION \^ resize +2
bind -c REGION } resize +2
bind -c REGION { resize -2
bind x command -c REGION

これでまるでEmacsがごとくウィンドウを操作できます!
便利すぎて鼻血が出るのでぜひ導入しましょう!


インストール作業ログ:

14:32 ama-ch% cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/screen co screen                                                                                      [~]
cvs checkout: Updating screen
U screen/COPYING
U screen/mktar.pl
cvs checkout: Updating screen/incoming
cvs checkout: Updating screen/incoming/howto
U screen/incoming/howto/emulate_vims_help.txt
cvs checkout: Updating screen/patches
U screen/patches/bill_pursell_fFtT_402.patch
U screen/patches/screen-4.0.2.dif
U screen/patches/screen-__P.diff
U screen/patches/screen-gcc4.diff
cvs checkout: Updating screen/src
U screen/src/.iscreenrc
U screen/src/COPYING
U screen/src/ChangeLog
U screen/src/FAQ
U screen/src/INSTALL
U screen/src/Makefile
U screen/src/Makefile.in
U screen/src/NEWS
U screen/src/NEWS.3.5
U screen/src/NEWS.3.6
U screen/src/NEWS.3.7
U screen/src/NEWS.3.9
U screen/src/README
U screen/src/TODO
U screen/src/acls.c
U screen/src/acls.h
U screen/src/ansi.c
U screen/src/ansi.h
U screen/src/attacher.c
U screen/src/braille.c
U screen/src/braille.h
U screen/src/braille_tsi.c
U screen/src/comm.c
U screen/src/comm.h.dist
U screen/src/comm.sh
U screen/src/config.h.in
U screen/src/configure
U screen/src/configure.in
U screen/src/display.c
U screen/src/display.h
U screen/src/encoding.c
U screen/src/extern.h
U screen/src/fileio.c
U screen/src/help.c
U screen/src/image.h
U screen/src/input.c
U screen/src/install.sh
U screen/src/kmapdef.c.dist
U screen/src/layer.c
U screen/src/layer.h
U screen/src/loadav.c
U screen/src/logfile.c
U screen/src/logfile.h
U screen/src/mark.c
U screen/src/mark.h
U screen/src/misc.c
U screen/src/nethack.c
U screen/src/os.h
U screen/src/osdef.h.in
U screen/src/osdef.sh
U screen/src/patchlevel.h
U screen/src/process.c
U screen/src/pty.c
U screen/src/putenv.c
U screen/src/resize.c
U screen/src/sched.c
U screen/src/sched.h
U screen/src/screen.c
U screen/src/screen.h
U screen/src/search.c
U screen/src/socket.c
U screen/src/teln.c
U screen/src/term.c
U screen/src/term.h.dist
U screen/src/term.sh
U screen/src/termcap.c
U screen/src/tty.c.dist
U screen/src/tty.sh
U screen/src/utmp.c
U screen/src/window.c
U screen/src/window.h
cvs checkout: Updating screen/src/BUGS
cvs checkout: Updating screen/src/CONVERT
cvs checkout: Updating screen/src/PATCHES
cvs checkout: Updating screen/src/PATCHES/DONE
cvs checkout: Updating screen/src/TEST
cvs checkout: Updating screen/src/config
cvs checkout: Updating screen/src/doc
U screen/src/doc/FAQ
U screen/src/doc/Makefile.in
U screen/src/doc/README.DOTSCREEN
U screen/src/doc/fdpat.ps
U screen/src/doc/install.sh
U screen/src/doc/make.help
U screen/src/doc/screen.1
U screen/src/doc/screen.info
U screen/src/doc/screen.info-1
U screen/src/doc/screen.info-2
U screen/src/doc/screen.info-3
U screen/src/doc/screen.info-4
U screen/src/doc/screen.info-5
U screen/src/doc/screen.texinfo
U screen/src/doc/window_to_display.ps
cvs checkout: Updating screen/src/etc
U screen/src/etc/ccdefs
U screen/src/etc/completer.zsh
U screen/src/etc/countmail
U screen/src/etc/etcscreenrc
U screen/src/etc/gr-braille.tbl
U screen/src/etc/gs-braille.tbl
U screen/src/etc/mkinstalldirs
U screen/src/etc/newsyntax
U screen/src/etc/newsyntax38
U screen/src/etc/screenrc
U screen/src/etc/toolcheck
U screen/src/etc/us-braille.tbl
cvs checkout: Updating screen/src/terminfo
U screen/src/terminfo/8bits
U screen/src/terminfo/README
U screen/src/terminfo/checktc.c
U screen/src/terminfo/screencap
U screen/src/terminfo/screeninfo.src
U screen/src/terminfo/test.txt
U screen/src/terminfo/tetris.c
cvs checkout: Updating screen/src/terminfo/s
cvs checkout: Updating screen/src/utf8encodings
U screen/src/utf8encodings/01
U screen/src/utf8encodings/02
U screen/src/utf8encodings/03
U screen/src/utf8encodings/04
U screen/src/utf8encodings/18
U screen/src/utf8encodings/19
U screen/src/utf8encodings/a1
U screen/src/utf8encodings/bf
U screen/src/utf8encodings/c2
U screen/src/utf8encodings/c3
U screen/src/utf8encodings/c4
U screen/src/utf8encodings/c6
U screen/src/utf8encodings/c7
U screen/src/utf8encodings/c8
U screen/src/utf8encodings/cc
U screen/src/utf8encodings/cd
U screen/src/utf8encodings/d6
14:33 ama-ch% cd screen/src                                                                                                                                                    [~]
14:43 ama-ch% patch < /opt/local/var/macports/sources/rsync.macports.org/release/ports/sysutils/screen/files/patch-maxargs                                          [~/screen/src]
patching file ansi.c
14:43 ama-ch% patch < /opt/local/var/macports/sources/rsync.macports.org/release/ports/sysutils/screen/files/patch-windowsize                                       [~/screen/src]
patching file resize.c
Hunk #1 FAILED at 682.
1 out of 1 hunk FAILED -- saving rejects to file resize.c.rej
14:44 ama-ch% patch < /opt/local/var/macports/sources/rsync.macports.org/release/ports/sysutils/screen/files/patch-pty.c                                            [~/screen/src]
patching file pty.c
14:44 ama-ch% ./configue --enable-colors256                                                                                                                         [~/screen/src]
./configure is correct? [n,y,a,e]: y
this is screen version 4.0.3
checking for prefix by checking for screen... /opt/local/bin/screen
checking for gcc... gcc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking whether gcc needs -traditional... no
checking for library containing strerror... none required
checking for gawk... gawk
checking for a BSD-compatible install... /usr/bin/install -c
configure: checking for buggy tools...
- sh  is 'GNU bash, version 3.2.17(1)-release (i386-apple-darwin9.0)'.
checking if a system-wide socket dir should be used... yes
checking for the socket dir... (eff_uid ? "/tmp/uscreens" : "/tmp/screens")
configure: checking for MIPS...
configure: checking for Ultrix...
rm: conftest.dSYM: is a directory
configure: checking for butterfly...
rm: conftest.dSYM: is a directory
configure: checking for POSIX.1...
- you have a POSIX system
rm: conftest.dSYM: is a directory
configure: checking for System V...
configure: checking for sequent/ptx...
rm: conftest.dSYM: is a directory
configure: checking SVR4...
checking for ANSI C header files... rm: conftest.dSYM: is a directory
rm: conftest.dSYM: is a directory
no
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
configure: checking for Solaris 2.x...
rm: conftest.dSYM: is a directory
configure: checking BSD job jontrol...
- you have jobcontrol
configure: checking setreuid...
configure: checking seteuid...
configure: checking select...
configure: checking fifos...
- your fifos are usable
configure: checking for broken fifo implementation...
- your implementation is ok
configure: checking sockets...
- your sockets are usable
configure: checking socket implementation...
- you are normal
- both sockets and fifos usable. let's take fifos.
configure: checking select return value...
- select is ok
configure: checking for tgetent...
configure: checking libcurses...
- you use the terminfo database
configure: checking ospeed...
configure: checking for /dev/ptc...
configure: checking for SVR4 ptys...
checking for getpt... no
configure: checking for ptyranges...
rm: conftest.dSYM: is a directory
configure: checking default tty permissions/group...
- pty mode: 0620, group: 4
configure: checking getutent...
configure: checking getutent with -lgen...
configure: checking ut_host...
checking utempter.h usability... no
checking utempter.h presence... no
checking for utempter.h... no
configure: checking for libutil(s)...
configure: checking getloadavg...
rm: conftest.dSYM: is a directory
assuming posix signal definition
configure: checking for crypt and sec libraries...
configure: checking crypt...
configure: checking IRIX sun library...
configure: checking syslog...
rm: conftest.dSYM: is a directory
configure: checking wait union...
configure: checking for termio or termios...
configure: checking getspnam...
configure: checking getttyent...
configure: checking fdwalk...
configure: checking whether memcpy/memmove/bcopy handles overlapping arguments...
checking long file names... yes
checking for vsprintf... yes
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking for setenv... yes
checking for nl_langinfo(CODESET)... yes
checking for library containing gethostname... none required
checking for rename... yes
checking for fchmod... yes
checking for fchown... yes
checking for strerror... yes
checking for lstat... yes
checking for _exit... yes
checking for utimes... yes
checking for vsnprintf... yes
checking for getcwd... yes
checking for setlocale... yes
checking for strftime... yes
checking for the global screenrc file... "/opt/local/etc/screenrc"
checking for the utf8-encodings location... "/opt/local/share/screen/utf8encodings"
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/Makefile
config.status: creating config.h
config.status: executing default commands

Now please check the pathnames in the Makefile and in the user
configuration section in config.h.
Then type 'make' to make screen. Good luck.

14:48 ama-ch% make                                                                                                                                                  [~/screen/src]
CPP="gcc -E " srcdir=. sh ./osdef.sh
AWK=gawk CC="gcc -g -O2" srcdir=. sh ./comm.sh
AWK=gawk srcdir=. sh ./term.sh
gcc -c -I. -I.    -g -O2 screen.c
In file included from screen.h:144,
                 from screen.c:81:
display.h:210: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
In file included from screen.h:145,
                 from screen.c:81:
window.h:249: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
gcc -c -I. -I.    -g -O2 ansi.c
In file included from screen.h:144,
                 from ansi.c:31:
display.h:210: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
In file included from screen.h:145,
                 from ansi.c:31:
window.h:249: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
gcc -c -I. -I.    -g -O2 fileio.c
In file included from screen.h:144,
                 from fileio.c:33:
display.h:210: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
In file included from screen.h:145,
                 from fileio.c:33:
window.h:249: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
gcc -c -I. -I.    -g -O2 mark.c
In file included from screen.h:144,
                 from mark.c:27:
display.h:210: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
In file included from screen.h:145,
                 from mark.c:27:
window.h:249: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
gcc -c -I. -I.    -g -O2 misc.c
In file included from screen.h:144,
                 from misc.c:29:
display.h:210: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
In file included from screen.h:145,
                 from misc.c:29:
window.h:249: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
gcc -c -I. -I.    -g -O2 resize.c
In file included from screen.h:144,
                 from resize.c:37:
display.h:210: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
In file included from screen.h:145,
                 from resize.c:37:
window.h:249: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
gcc -c -I. -I.    -g -O2 socket.c
In file included from screen.h:144,
                 from socket.c:37:
display.h:210: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
In file included from screen.h:145,
                 from socket.c:37:
window.h:249: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
socket.c: In function ‘FinishAttach’:
socket.c:1321: warning: passing argument 3 of ‘display_wlist’ from incompatible pointer type
gcc -c -I. -I.    -g -O2 search.c
In file included from screen.h:144,
                 from search.c:27:
display.h:210: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
In file included from screen.h:145,
                 from search.c:27:
window.h:249: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
sh ./tty.sh tty.c
gcc -c -I. -I.    -g -O2 tty.c
In file included from screen.h:144,
                 from tty.c:57:
display.h:210: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
In file included from screen.h:145,
                 from tty.c:57:
window.h:249: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
gcc -c -I. -I.    -g -O2 term.c
gcc -c -I. -I.    -g -O2 window.c
In file included from screen.h:144,
                 from window.c:34:
display.h:210: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
In file included from screen.h:145,
                 from window.c:34:
window.h:249: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
gcc -c -I. -I.    -g -O2 utmp.c
In file included from screen.h:144,
                 from utmp.c:29:
display.h:210: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
In file included from screen.h:145,
                 from utmp.c:29:
window.h:249: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
utmp.c:82: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
utmp.c:83: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
utmp.c:84: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
utmp.c:85: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
utmp.c:87: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
utmp.c: In function ‘RemoveLoginSlot’:
utmp.c:309: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
utmp.c:309: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
utmp.c: In function ‘SetUtmp’:
utmp.c:405: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
utmp.c: In function ‘RemoveUtmp’:
utmp.c:499: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
utmp.c:499: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
utmp.c: At top level:
utmp.c:643: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
utmp.c:672: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
utmp.c:682: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
utmp.c: In function ‘getutslot’:
utmp.c:686: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
utmp.c: In function ‘pututslot’:
utmp.c:695: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
utmp.c: In function ‘makedead’:
utmp.c:714: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
utmp.c: In function ‘makeuser’:
utmp.c:729: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
gcc -c -I. -I.    -g -O2 loadav.c
In file included from screen.h:144,
                 from loadav.c:41:
display.h:210: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
In file included from screen.h:145,
                 from loadav.c:41:
window.h:249: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
gcc -c -I. -I.    -g -O2 putenv.c
gcc -c -I. -I.    -g -O2 help.c
In file included from screen.h:144,
                 from help.c:28:
display.h:210: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
In file included from screen.h:145,
                 from help.c:28:
window.h:249: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
gcc -c -I. -I.    -g -O2 termcap.c
In file included from screen.h:144,
                 from termcap.c:26:
display.h:210: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
In file included from screen.h:145,
                 from termcap.c:26:
window.h:249: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
gcc -c -I. -I.    -g -O2 input.c
In file included from screen.h:144,
                 from input.c:26:
display.h:210: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
In file included from screen.h:145,
                 from input.c:26:
window.h:249: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
input.c: In function ‘Input’:
input.c:145: warning: assignment from incompatible pointer type
gcc -c -I. -I.    -g -O2 attacher.c
In file included from screen.h:144,
                 from attacher.c:30:
display.h:210: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
In file included from screen.h:145,
                 from attacher.c:30:
window.h:249: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
gcc -c -I. -I.    -g -O2 pty.c
In file included from screen.h:144,
                 from pty.c:30:
display.h:210: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
In file included from screen.h:145,
                 from pty.c:30:
window.h:249: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
gcc -c -I. -I.    -g -O2 process.c
In file included from screen.h:144,
                 from process.c:44:
display.h:210: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
In file included from screen.h:145,
                 from process.c:44:
window.h:249: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
process.c: In function ‘DoAction’:
process.c:2073: warning: passing argument 3 of ‘display_wlist’ from incompatible pointer type
process.c:2075: warning: passing argument 3 of ‘display_wlist’ from incompatible pointer type
process.c:2077: warning: passing argument 3 of ‘display_wlist’ from incompatible pointer type
process.c:2079: warning: passing argument 3 of ‘display_wlist’ from incompatible pointer type
process.c:2081: warning: passing argument 3 of ‘display_wlist’ from incompatible pointer type
process.c:3970: warning: comparison between pointer and integer
process.c:4138: warning: assignment makes pointer from integer without a cast
process.c: In function ‘NextWindow’:
process.c:4955: warning: initialization from incompatible pointer type
process.c:4963: warning: comparison of distinct pointer types lacks a cast
process.c: In function ‘PreviousWindow’:
process.c:4977: warning: initialization from incompatible pointer type
process.c:4985: warning: comparison of distinct pointer types lacks a cast
process.c: In function ‘SelectLayoutFin’:
process.c:5499: warning: assignment makes pointer from integer without a cast
gcc -c -I. -I.    -g -O2 display.c
In file included from screen.h:144,
                 from display.c:32:
display.h:210: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
In file included from screen.h:145,
                 from display.c:32:
window.h:249: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
display.c: In function ‘CreateLayout’:
display.c:4455: warning: return from incompatible pointer type
display.c: In function ‘SaveLayout’:
display.c:4471: warning: assignment from incompatible pointer type
display.c: In function ‘NewLayout’:
display.c:4549: warning: assignment from incompatible pointer type
gcc -c -I. -I.    -g -O2 comm.c
gcc -c -I. -I.    -g -O2 kmapdef.c
gcc -c -I. -I.    -g -O2 acls.c
In file included from screen.h:144,
                 from acls.c:45:
display.h:210: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
In file included from screen.h:145,
                 from acls.c:45:
window.h:249: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
gcc -c -I. -I.    -g -O2 braille.c
In file included from screen.h:144,
                 from braille.c:33:
display.h:210: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
In file included from screen.h:145,
                 from braille.c:33:
window.h:249: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
gcc -c -I. -I.    -g -O2 braille_tsi.c
In file included from screen.h:144,
                 from braille_tsi.c:30:
display.h:210: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
In file included from screen.h:145,
                 from braille_tsi.c:30:
window.h:249: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
gcc -c -I. -I.    -g -O2 logfile.c
In file included from screen.h:144,
                 from logfile.c:30:
display.h:210: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
In file included from screen.h:145,
                 from logfile.c:30:
window.h:249: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
gcc -c -I. -I.    -g -O2 layer.c
In file included from screen.h:144,
                 from layer.c:27:
display.h:210: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
In file included from screen.h:145,
                 from layer.c:27:
window.h:249: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
gcc -c -I. -I.    -g -O2 sched.c
In file included from screen.h:144,
                 from sched.c:31:
display.h:210: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
In file included from screen.h:145,
                 from sched.c:31:
window.h:249: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
gcc -c -I. -I.    -g -O2 teln.c
gcc -c -I. -I.    -g -O2 nethack.c
In file included from screen.h:144,
                 from nethack.c:25:
display.h:210: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
In file included from screen.h:145,
                 from nethack.c:25:
window.h:249: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
gcc -c -I. -I.    -g -O2 encoding.c
In file included from screen.h:144,
                 from encoding.c:27:
display.h:210: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
In file included from screen.h:145,
                 from encoding.c:27:
window.h:249: warning: ‘utmp’ is deprecated (declared at /usr/include/utmp.h:97)
gcc  -o screen screen.o ansi.o fileio.o mark.o misc.o resize.o socket.o search.o tty.o term.o window.o utmp.o loadav.o putenv.o help.o termcap.o input.o attacher.o pty.o process.o display.o comm.o kmapdef.o acls.o braille.o braille_tsi.o logfile.o layer.o sched.o teln.o nethack.o encoding.o -lcurses 
14:49 ama-ch% sudo make install                                                                                                                                     [~/screen/src]
Password:
./etc/mkinstalldirs /opt/local/bin `sed < config.h -n -e '/define SCREENENCODINGS/s/^.*"\([^"]*\)"/\1/p'`
cd doc ; make installdirs
./../etc/mkinstalldirs /opt/local/man/man1 /opt/local/info
mkdir /opt/local/info
if [ -f /opt/local/bin/screen-4.0.3 ] && [ ! -f /opt/local/bin/screen-4.0.3.old ]; \
		then mv /opt/local/bin/screen-4.0.3 /opt/local/bin/screen-4.0.3.old; fi
/usr/bin/install -c screen /opt/local/bin/screen-4.0.3
chown root /opt/local/bin/screen-4.0.3 && chmod 4755 /opt/local/bin/screen-4.0.3
if [ -f /opt/local/bin/screen ] && [ ! -f /opt/local/bin/screen.old ]; then mv /opt/local/bin/screen /opt/local/bin/screen.old; fi
rm -f /opt/local/bin/screen
(cd /opt/local/bin && ln -f -s screen-4.0.3 screen)
cp ./utf8encodings/?? `sed < config.h -n -e '/define SCREENENCODINGS/s/^.*"\([^"]*\)"/\1/p'`
cd doc ; make install
./../etc/mkinstalldirs /opt/local/man/man1 /opt/local/info
/usr/bin/install -c -m 644 ./screen.1 /opt/local/man/man1/screen.1
make screen.info
makeinfo ./screen.texinfo -o screen.info
if test -f screen.info; then d=.; else d=.; fi; \
	if test -f $d/screen.info; then \
	for f in $d/screen.info*; do /usr/bin/install -c -m 644 $f /opt/local/info;done; \
	if /bin/sh -c 'install-info --version' >/dev/null 2>&1; then \
	  install-info --info-dir=/opt/local/info $d/screen.info; \
	else true; fi; \
	fi
* Screen: (screen). Full-screen window manager.
install-info(./screen.info): no backup file /var/backups/infodir.bak available.
install-info(./screen.info): no default file /usr/share/base-files/info.dir available, giving up.
make[1]: [install] Error 1 (ignored)
if [ -d /usr/lib/terminfo ]; then \
		PATH="$PATH:/usr/5bin" tic ./terminfo/screeninfo.src; \
		chmod 644 /usr/lib/terminfo/s/screen*; \
	fi
termcap entry (./terminfo/screencap) should be installed manually.
You may also want to install ./etc/etcscreenrc in /opt/local/etc/screenrc

コマンドからファイル印刷のまとめ

nkf + e2psを使ってファイルを印刷する方法。
e2psはテキストファイルをPostScriptに変換するツールなんだけど、UTF-8に対応していないのでnkfもインストールした。


nkfMacPortsで。

% sudo port install nkf


e2psをWtSeries : UNIXツールからダウンロードして、解凍。

% cd e2ps-4.34

そのままMacでmakeするとエラーが出るので、ps-font.cの14〜52行の行末にバックスラッシュを追加する。
参考:Debian GNU/Linux から Mac OS X に移行したメモ
ps-font.c

char *gsFonts = "Times-Roman\
Times-Italic\
Times-Bold\
Times-BoldItalic\
--- 中略 ---
Ryumin-Light.Hiragana\
Ryumin-Light.Katakana\
Gothic-Meduim.Hiragana\
Gothic-Medium.Katakana\
";

これでmakeが通るようになる。

% cd e2ps-4.34
% make
% sudo make install


これでインストールは完了!あとはこんな風に使う。

% nkf -e foo.txt | e2ps -size 11 -box | lpr -P bar

このコマンドでフォントサイズ11,枠線ありの設定になる。
ubulog: Emacsから印刷するを参考にさせていただきました。


最後に、e2psのREADMEから使い方を抜粋。

○使い方
・e2ps [引数] [ファイル名・・・]
    ファイルを(複数)指定しても,標準入力でテキストデータを入力しても
    構いません.結果はPostScriptファイルとして出力されます.
・e2lpr は,直接プリンタへ出力します.
・e2ps -h で引数のヘルプが出ます.主に使用する引数を以下の通りです.

    -p			: ポートレイト (縦向き)
    -p2			: ポートレイト2面印刷 (デフォルト)
    -p4			: ポートレイト4面印刷		例: 1 2	
							    3 4
    -pv4		: ポートレイト4面縦順印刷	例: 1 3	
							    2 4
    -l			: ランドスケープ (横向き)
    -l2			: ランドスケープ2面印刷
    -l4			: ランドスケープ4面印刷
    -lv4		: ランドスケープ4面縦順印刷
    -box		: ページの枠を印刷
    -size fontsize	: フォントサイズ (10.0)
    -line line		: ページの最大行数 (66)
    -nh			: ヘッダをなくす
    -Pprinter		: プリンタ設定 (lp)
    -h | --help		: ヘルプを表示する
    -v | --version	: バージョンを表示する


○難しい引数の解説
・-af		(デフォルト: Courier)
・-abf		(デフォルト: Courier-Bold)
・-abif		(デフォルト: Courier-BoldOblique)
    PostScritpのアスキーフォント(太字,太字斜体)を指定します.
    -fl 引数で,フォントのリストが見られますが,すべて使えるわけでは
    ありません.指定できるフォントは,プリンタに依存します.
	例:
	-af Times-Roman		Times-Romanフォントで印刷されます

・-afw		(デフォルト: 0.6)
・-afh		(デフォルト: 1.0)
・-kfw		(デフォルト: 1.2)
・-kfh		(デフォルト: 1.0)
    印刷する文字の幅や高さの倍率を指定します.
    -afw, -afh がアスキーフォントの幅と高さで,
    -kfw, -kfh が漢字フォントの幅と高さです.
    -ahf,-kfh ともに,1.0以上の値は無視されます.
    Courierフォントは,高さに対してもともと 0.6倍の幅であるため,
    アスキーフォントのデフォルト値が 0.6 になっています.
    漢字フォントは,幅も高さも同じ大きさですが,通常の印刷では
    Courierフォントに合わせて 1.2倍の幅にして印刷しています.
    そのため,デフォルト値が 1.2 になっています.
    	例:
	-afw 0.3	アスキーフォントが通常の半分の幅で印刷されます
	-afw 1.2	アスキーフォントが通常の2倍の幅で印刷されます
	-afh 0.5	アスキーフォントが通常の半分の高さで印刷されます
	-afh 1.2	アスキーフォントは通常と同じ高さで印刷されます
	-kfw 1.0	漢字フォントが隙間なく密に印刷されます
	-kfw 0.5	漢字フォントが通常の半分の幅で印刷されます
	-kfw 2.0	漢字フォントが隙間が通常よりも広く印刷されます
	-kfh 0.5	漢字フォントが通常の半分の高さで印刷されます
	-kfh 1.2	漢字フォントは通常と同じ高さで印刷されます
・-ohp
    OHPに印刷するように,フォントを大きく(25.0)して,へッダを印刷
    しないようにします.

・-date
    ページ左上に印刷される日付の文字列を指定します.
    日本語も指定できます.

・-head
    ページ中央上に印刷されるファイル名の文字列を指定します.
    日本語も指定できます.

・-page
    ページ右上に印刷されるページの文字列を指定します.
    「指定した文字+ページ数」のように印刷されます.
    日本語も指定できます.