The contents of this file are arranged by chapter. Because some chapters contain
both code with a numbered listing and code without, you'll want to use the
LPB Examples Guide (below) to locate specific code corresponding to the section in the book with which
you are working.
Chapter | Filename | Listing Reference | Description |
Chapter 3 | 3 |
ch03/pattest |
|
Pattern Matcher/Tester in
Perl |
3 |
ch03/splittest |
|
Regexp-based Data
Splitter in Perl |
Chapter 5 | 5 |
ch04/init-sendmail.sh |
5-1 |
Debian's
/etc/init.d/sendmail script |
5 |
ch04/inittab |
5-2 |
Sample /etc/inittab file |
Chapter 7 | 7 |
ch07/compute.c |
|
The compute.c
example file |
7 |
ch07/init.c |
|
The init.c example
file |
7 |
ch07/io.c |
|
The io.c example
file |
7 |
ch07/myprogram.h |
|
The myprogram.h example
file |
7 |
ch07/example01/Makefile |
|
Very first example
Makefile |
7 |
ch07/example02/Makefile |
|
Final "smarter" Makefile |
7 |
ch07/example03/Makefile |
|
Makefile with
wildcards |
7 |
ch07/example04/Makefile |
7-1 |
Makefile with dependency
generation |
7 |
ch07/example05/Makefile |
7-2 |
Revised Makefile |
7 |
ch07/example06/Makefile |
7-3 |
Finished multi-language
Makefile |
7 |
ch07/example07/Makefile |
7-4 |
Makefile to generate
HTML |
7 |
ch07/example07/page1.mac |
|
Sample
file |
7 |
ch07/example07/page2.mac |
|
Sample
file |
7 |
ch07/example07/stdinc.hmac |
|
Sample
file |
7 |
ch07/example08/Makefile |
7-5 |
Top-level recursive
Makefile |
7 |
ch07/example08/input/Makefile |
7-6 |
Lower-level
Makefile |
7 |
ch07/example08/format/Makefile |
7-6 |
Copy of the above
(identical) |
7 |
ch07/example08/input/test.cc |
|
Empty example
file |
7 |
ch07/example08/format/formattest.c |
|
Empty example
file |
Chapter 8 | 8 |
ch08/ch8-1.c |
|
Error-prone example program
|
8 |
ch08/ch8-1r1.c |
|
Revision 1 of example:
uses dynamic RAM |
8 |
ch08/ch8-1r2.c |
|
Revision 2 of example:
uses strdup() |
8 |
ch08/memleak.c |
|
Example program with a
memory leak |
8 |
ch08/ch8-2.c |
|
Fixed-size
buffer |
8 |
ch08/ch8-3.c |
8-1 |
Dynamic
Allocation with Linked List |
8 |
ch08/ch8-3r1.c |
8-2 |
Revised
linked list example |
8 |
ch08/ch8-3r2.c |
8-3 |
Linked list
with append at insert time |
8 |
ch08/ch8-4.c |
8-4 |
Example shell
in C |
8 |
ch08/ch8-5.txt |
8-5 |
Example
shell session |
Chapter 9 | 9 |
ch09/safecalls2.c |
9-1 |
Example extra
wrappers |
9 |
ch09/safecalls2.h |
|
Header file for
safecalls2.c |
9 |
ch09/ch9-1.c |
|
Example program that
demonstrates the safecalls |
9 |
ch09/example01/Makefile |
|
Example Makefile
to build ch9-1 with library |
9 |
ch09/example02/Makefile |
|
Makefile to
build ch9-1 with dynamic library |
9 |
ch09/example02/interceptor.c |
9-2 |
Sample
code for LD_PRELOAD |
Chapter 10 | 10 |
ch10/ch10-1.c |
|
First example to
debug |
10 |
ch10/ch10-2.c |
10-1 |
Second
example to debug |
10 |
ch10/ch10-3.c |
|
Third example |
10 |
ch10/ch10-4.c |
10-2 |
Example
with a bug |
10 |
ch10/ch10-2r1.c |
10-3 |
Fixed
example |
Chapter 11 | 11 |
ch11/ch11-1.c |
11-1 |
Demonstration of stat() and
lstat() |
11 |
ch11/ch11-1-sample.txt |
|
listing="11-2">Sample execution of ch11-1 |
11 |
ch11/ch11-2.pl |
|
Perl program to demonstrate opendir() and
friends |
11 |
ch11/ch11-2r1.pl |
|
Revised Perl program, with recursion |
11 |
ch11/ch11-2r1-sample.txt |
11-3 |
Sample execution of ch11-2r1.pl |
11 |
ch11/stream.c |
|
Sample code with stream
I/O |
11 |
ch11/syscall.c |
|
Sample code with system
call I/O |
Chapter 12 | 12 |
ch12/ch12-3.c |
|
Example of buggy code
creating a zombie process |
12 |
ch12/ch12-4.c |
12-1 |
First
wait() example |
12 |
ch12/ch12-5.c |
12-2 |
Signal
handler for waiting |
12 |
ch12/ch12-6.c |
12-3 |
Forking
with exec() and wait() |
12 |
ch12/ch12-7.c |
12-4 |
Reading
return codes |
12 |
ch12/ch12-8.c |
12-5 |
Sample
setuid program |
12 |
ch12/ch12-9.c |
12-6 |
Revoking
permissions |
Chapter 13 | 13 |
ch13/ch13-1.c |
|
Handler for
SIGTERM |
13 |
ch13/ch13-2.c |
13-1 |
A
multi-signal handler |
13 |
ch13/ch13-3.c |
13-2 |
Blocking
signals |
13 |
ch13/ch13-4.c |
13-3 |
Pending
signals |
13 |
ch13/ch13-5.c |
13-4 |
Example
with sigaction |
13 |
ch13/ch13-6.c |
13-5 |
Example of
sending a signal |
13 |
ch13/ch13-7.c |
13-6 |
Example
with inactivity timeout |
13 |
ch13/ch13-8.c |
13-7 |
Example
using setitimer() |
Chapter 14 | 14 |
ch14/ch14-01.c |
14-1 |
I/O program that
checks return values |
14 |
ch14/ch14-02.c |
14-2 |
I/O with system
call |
14 |
ch14/ch14-03.c |
14-3 |
System call I/O
for terminal interaction |
14 |
ch14/safecalls.h |
|
Header file for
safecalls.c |
14 |
ch14/safecalls.c |
14-4 |
A safe call wrapper
system |
14 |
ch14/ch14-05.c |
14-5 |
Sample
usage of safecalls.c |
14 |
ch14/ch14-06.c |
14-6 |
Creating a
sparse file |
14 |
ch14/ch14-07.c |
14-7 |
Example of
memory-mapped I/O |
14 |
ch14/ch14-08.c |
14-8 |
Example of
select() |
14 |
ch14/ch14-09.c |
14-9 |
Example of
poll() |
14 |
ch14/ch14-10.c |
14-10 |
Example
of locking |
Chapter 15 | 15 |
ch15/ch15-1.c |
15-1 |
Sample of
raw mode |
15 |
ch15/myscript.c |
15-2 |
Example
script replacement |
15 |
ch15/Makefile |
|
Makefile for ch15-2.c and
genrandom.c |
15 |
ch15/genrandom.c |
|
Random generator
program |
15 |
ch15/ch15-2.c |
15-3 |
Example
usage of curses |
15 |
ch15/ch15-3.c |
15-4 |
Example of
color with ncurses |
15 |
ch15/ch15-4.pl |
15-5 |
Using
curses in Perl |
15 |
ch15/assignments |
|
Sample data file for
ch15-4.pl |
15 |
ch15/categories |
|
Sample data file for
ch15-4.pl |
15 |
ch15/students |
|
Sample data file for
ch15-4.pl |
Chapter 16 | 16 |
ch16/ch16-1.c |
16-1 |
First semaphore
example |
16 |
ch16/ch16-2.c |
16-2 |
Revised semaphore
example |
16 |
ch16/ch16-3.c |
16-3 |
Shared memory
example |
16 |
ch16/ch16-4.c |
16-4 |
Revised
shared memory example |
Chapter 17 | 17 |
ch17/ch17-1.c |
17-1 |
Pipe
Example |
17 |
ch17/ch17-2.c |
17-2 |
Revised
pipe example |
17 |
ch17/ch17-3.c |
17-3 |
Using
redirection |
17 |
ch17/ch17-4.c |
17-4 |
Sample
usage of FIFOs |
Chapter 18 | 18 |
ch18/ch18-1.c |
18-1 |
Sample web
client |
18 |
ch18/ch18-2.c |
18-2 |
Sample
server |
18 |
ch18/ch18-3.c |
18-3 |
Sample
server code that forks |
18 |
ch18/networkinglib.h |
18-4 |
Network
library header |
18 |
ch18/networkinglib.c |
18-5 |
Network library
implementation |
18 |
ch18/newclient.c |
|
Simple client
rewrite |
18 |
ch18/newserver.c |
18-6 |
Revised
network server code |
Chapter 19 | 19 |
ch19/queue.c |
19-1 |
Server with
select() multiplexing |
19 |
ch19/queue.h |
19-2 |
Header file
queue.h |
19 |
ch19/ch19-1.c |
19-3 |
Main server
code |
Chapter 20 | 20 |
ch20/ch20-1.pl |
|
Simple line
sorter |
20 |
ch20/ch20-2.pl |
|
Another example
program |
20 |
ch20/ch20-3.pl |
|
Working with
files |
20 |
ch20/ch20-4.pl |
|
Anonymous
references |
20 |
ch20/ch20-5.pl |
|
Arrays and
references |
20 |
ch20/ch20-6.pl |
20-1 |
Example of nested
Arrays |
20 |
ch20/ch20-7.pl |
20-2 |
Example of
nested hashes |
20 |
ch20/ch20-8.pl |
20-3 |
Revised hash
example |
20 |
ch20/ch20-9.pl |
|
Anonymous subroutine
example |
20 |
ch20/ch20-10.pl |
20-4 |
Example of
OOP features |
20 |
ch20/FileObject.pm |
20-5 |
OOP
example module |
20 |
ch20/output-ch20-10.txt |
20-6 |
Sample output from
ch20-10 |
Chapter 21 | 21 |
ch21/ch21-1.pl |
|
Angle-bracket operator in
loop |
21 |
ch21/pattest-ch3 |
|
Regular expression pattern
testing program, as in chapter 3 |
21 |
ch21/pattest |
|
Revised pattest |
21 |
ch21/splittest |
|
Revised code, to use
split |
21 |
ch21/mygrep |
|
A Perl implementation of
grep |
21 |
ch21/mygrep2 |
|
Revised mygrep |
21 |
ch21/ch21-2.pl |
21-1 |
Example of
tie |
21 |
ch21/ch21-3.pl |
21-2 |
Revised tie
example |
21 |
ch21/FileObject.pm |
21-3 |
An
object with serialization |
21 |
ch21/ch21-4.pl |
21-4 |
Example
usage of FileObject |
21 |
ch21/ch21-5.pl |
21-5 |
Using the
Data Dumper |
Chapter 22 | 22 |
ch22/ch22-1.pl |
|
Hello world
example |
22 |
ch22/ch22-2.pl |
|
Interactive
example |
22 |
ch22/ch22-3.pl |
|
More complex interactive
example |
22 |
ch22/ch22-4.pl |
|
Example with the CGI form
functions |
22 |
ch22/ch22-5.pl |
22-1 |
CGI script
with multiple pages |
Chapter 23 | 23 |
ch23/ch23-1.pl |
23-1 |
Using the
DBI module |
23 |
ch23/ch23-2.pl |
23-2 |
Inserting
information |
23 |
ch23/ch23-3.pl |
23-3 |
DBI with
CGI: addressbook. SEE NOTE IN TEXT BEFORE RUNNING. |
Chapter 24 | 24 |
ch24/ch24-1.pl |
|
First Tk
example |
24 |
ch24/ch24-2.pl |
|
Example with multiple
top-level windows |
24 |
ch24/ch24-3.pl |
24-1 |
Color
picker |
24 |
ch24/ch24-4.pl |
24-2 |
Menu
bar |
24 |
ch24/ch24-5.pl |
24-3 |
Grid
geometry manager |
24 |
ch24/ch24-6.pl |
24-4 |
Sample
SpecTcl output |
Chapter 25 | 25 |
ch25/Makefile |
|
Sample
Makefile |
25 |
ch25/ch25-1.c |
25-1 |
Simple
Gnome example |
25 |
ch25/ch25-2.c |
25-2 |
Recognizing
a close event |
25 |
ch25/ch25-3.c |
25-3 |
Example
with GTK color selector |
Chapter 28 | 28 |
ch28/ch28-1.c |
28-1 |
Program to
profile |
28 |
ch28/profile.txt |
28-2 |
Profiler
output |
28 |
ch28/profile2.txt |
28-3 |
Example
with line granularity |
28 |
ch28/profile3.txt |
28-4 |
Output
from gprof -A -l -x |