char buf[BUFSIZ];
progname = argv[0];
if (argc == 2 && strcmp(argv[1], "-") == 0) /* pick - */
while (fgets(buf, sizeof buf, stdin) != NULL) {
buf[strlen(buf)-1] = '\0'; /* drop newline */
pick(buf);
}
for (i = 1; i < argc; i++)
pick(argv[i]);
exit(0);
}
pick(s) /* offer choice of s */
char *s;
{
fprintf(stderr, "%s? ", s);
if (ttyin() == 'y')
printf("%s\n", s);
}
#include "ttyin2.c"
#include "efopen.c"
3.8.44 prpages
# prpages: compute number of pages that pr will print
wc $* |
awk '!/ total$/ { n += int(($1+55) / 56) }
END { print n }'
3.8.45 put
# put: install file into history
PATH=/bin:/usr/bin
case $# in
1) HIST=$1.H ;;