open http://tiswww.case.edu/php/chet/readline/rltop.html
sudo mv -i /opt/local /opt/local-off
sudo mv -i /usr/local /usr/local-off
cd ~/Desktop
fwftp
curl -L -O ftp://ftp.cwru.edu/pub/bash/readline-6.1.tar.gz
fwdef
tar -xzf readline-6.1.tar.gz
cd readline-6.1
./configure
make
sudo mv -i /usr/local-off /usr/local
sudo make install
sudo mv -i /opt/local-off /opt/local
find ~/Desktop/readline-6.1 -name "*dylib"
ls -1 /usr/local/lib/*readline*
[[ -d /usr/local ]] && sudo mkdir -p /usr/local/src || echo 'mkdir failed!'
sudo cp ~/Desktop/readline-6.1.tar.gz /usr/local/src
tar -C /usr/local/src -xzf ~/Desktop/readline-6.1.tar.gz
find /usr/local/src/readline-6.1 -name "*compat.c"
otool -L /usr/local/lib/*readline*6*
open http://www.cdecl.org
cd ~/Desktop
curl -L -O http://cdecl.org/files/cdecl-blocks-2.5.tar.gz
tar -xzf cdecl-blocks-2.5.tar.gz
cd cdecl-blocks-2.5
sed -i "" -E \
-e 's/^( *CFLAGS *=.+)/\1 -Wall -Ddodebug -Ddoyydebug -DUSE_READLINE/' \
-e 's|^ *LIBS *=.+|LIBS= -L/usr/local/lib -lreadline -L/usr/lib -lncurses|' \
-e 's|^ *BINDIR *=.+|BINDIR= /usr/local/bin|' \
-e 's|^ *MANDIR *=.+|MANDIR= /usr/local/share/man/man1|' \
-e 's|^ *CATDIR *=.+|CATDIR = /usr/local/share/man/cat1|' \
Makefile
cat <<-'EOF' | sed -e 's/^ *//' -e 's/ *$//' | /bin/ed -s cdgram.y
H
1i
%{
int yylex(void);
%}
.
wq
EOF
sed -i "" -E \
-e 's/^( *rl_completion_entry_function *= *\()( *Function *)(\* *\)keyword_completion;)/\1 rl_compentry_func_t \3/' \
-e 's/while +\(command += +commands\[index\]\) +{/while ((command = commands[index])) {/' \
-e 's/while +\(option += +options\[index\]\) +{/while ((option = options[index])) {/' \
-e 's/} +else +while +\(keyword += +keywords\[index\]\) +{/} else while ((keyword = keywords[index])) {/' \
-e 's/^([[:space:]]+if \(type \&\& \(strcmp\(type, "void"\) == 0\)\))/\1 {/' \
-e 's/^([[:space:]]+if \(strcmp\(type, "void"\) == 0\))/\1 {/' \
-e 's/^([[:space:]]+"pointer to void"\);)/\1 }/' \
cdecl.c
cat <<-'EOF' | sed -e 's/^ *//' -e 's/ *$//' | /bin/ed -s cdecl.c
H
/^[[:space:]]\{0,\}#[[:space:]]\{0,\}include[[:space:]]\{0,\}<readline\/readline.h>/a
#include </usr/local/src/readline-6.1/compat.c>
#include </usr/local/include/readline/readline.h>
#include </usr/local/include/readline/history.h>
#include <unistd.h>
//#include </usr/local/include/readline/rltypedefs.h>
int dotmpfile_from_string(char *s);
.
/^[[:space:]]\{0,\}#[[:space:]]\{0,\}include[[:space:]]\{0,\}<readline\/readline.h>/d
wq
EOF
cat <<-'EOF' | sed -e 's/^ *//' -e 's/ *$//' | /bin/ed -s cdecl.c
H
/^[[:space:]]\{0,\}char crosscheck\[9\]\[9\] = {/i
char crossXYZcheck[9][9] = {
/* L, I, S, C, V, U, S, F, D, */
/* long */ {_, _, _, _, _, _, _, _, _},
/* int */ {_, _, _, _, _, _, _, _, _},
/* short */ {X, _, _, _, _, _, _, _, _},
/* char */ {X, X, X, _, _, _, _, _, _},
/* void */ {X, X, X, X, _, _, _, _, _},
/* unsigned */ {R, _, R, R, X, _, _, _, _},
/* signed */ {P, P, P, P, X, X, _, _, _},
/* float */ {A, X, X, X, X, X, X, _, _},
/* double */ {P, X, X, X, X, X, X, X, _}
};
.
/^[[:space:]]\{0,\}char crosscheck\[9\]\[9\] = {/,+12d
g/crossXYZcheck/s//crosscheck/
wq
EOF
make
make test
echo $?
sudo make install
ls -l "$(type -P cdecl)"
otool -L "$(type -P cdecl)"
type -a c++decl cdecl
ls -l $(type -P c++decl cdecl)
man cdecl
cdecl --help
cdecl
explain int (*(*foo)(void ))[3]
declare bar as volatile pointer to array 64 of const int
cast foo into block(int, long long) returning double
explain char ** const * const x
declare x as const pointer to const pointer to pointer to char
[ctrl-c]