• Embed Doc
  • Readcast
  • Collections
  • 20
    CommentGo Back
Download
Table of Contents

Beginning Linux Programming, Second Edition.............................................................................................1 Foreword..............................................................................................................................................................5 Introduction.........................................................................................................................................................6

Welcome.................................................................................................................................................6 Who's this Book For?..............................................................................................................................6 What's Covered in the Book...................................................................................................................6 What You Need to Use this Book...........................................................................................................8 Source Code............................................................................................................................................9 Conventions............................................................................................................................................9 Tell Us What You Think.......................................................................................................................10 Why Should I Return the Reply Card?.................................................................................................10

Chapter 1: Getting Started.............................................................................................................................11

Overview...............................................................................................................................................11
What is UNIX?.....................................................................................................................................11
What is Linux?......................................................................................................................................11
Distributions..........................................................................................................................................11
The GNU Project and the Free Software Foundation...........................................................................12
Programming Linux..............................................................................................................................13
UNIX Programs....................................................................................................................................13
The C Compiler..............................................................................................................................14
Try It Out \u2212 Our First UNIX C Program........................................................................................14
How It Works..................................................................................................................................15
Getting Help..........................................................................................................................................15
Try It Out \u2212 Manual Pages and info................................................................................................16
Development System Roadmap............................................................................................................17
Programs.........................................................................................................................................17
Header Files....................................................................................................................................18
Library Files...................................................................................................................................19
Static Libraries...............................................................................................................................19
Try It Out \u2212 Static Libraries............................................................................................................20
Shared Libraries.............................................................................................................................22
UNIX Philosophy.................................................................................................................................23
Simplicity.......................................................................................................................................23
Focus..............................................................................................................................................23
Reusable Components....................................................................................................................23
Filters..............................................................................................................................................23
Open File Formats..........................................................................................................................23
Flexibility.......................................................................................................................................23
Summary...............................................................................................................................................24

Chapter 2: Shell Programming.......................................................................................................................25

Overview...............................................................................................................................................25
What is a Shell?....................................................................................................................................26
Pipes and Redirection...........................................................................................................................27
Redirecting Output.........................................................................................................................27
Redirecting Input............................................................................................................................28
Pipes...............................................................................................................................................28

i
Table of Contents
Chapter 2: Shell Programming

The Shell as a Programming Language................................................................................................29
Interactive Programs.......................................................................................................................29
Creating a Script.............................................................................................................................30
Making a Script Executable...........................................................................................................31
Shell Syntax..........................................................................................................................................32
Variables.........................................................................................................................................33
Conditions......................................................................................................................................36
Control Structures...........................................................................................................................38
Functions........................................................................................................................................49
Try It Out \u2212 A Simple Function......................................................................................................50
How It Works..................................................................................................................................50
Try It Out \u2212 Returning a Value.......................................................................................................51
How It Works..................................................................................................................................52
Commands......................................................................................................................................52
Command Execution......................................................................................................................62
Here Documents.............................................................................................................................66
Try It Out \u2212 Using Here Documents...............................................................................................66
Try It Out \u2212 Another Use for a Here Document.............................................................................67
How It Works..................................................................................................................................67
Debugging Scripts..........................................................................................................................67
Putting it All Together..........................................................................................................................68
Requirements..................................................................................................................................68
Design.............................................................................................................................................69
Try It Out \u2212 A CD Application.......................................................................................................70
Notes................................................................................................................................................76
Summary...............................................................................................................................................77

Chapter 3: Working with Files.......................................................................................................................78

Overview...............................................................................................................................................78
UNIX File Structure..............................................................................................................................78
Directories......................................................................................................................................79
Files and Devices............................................................................................................................79
System Calls and Device Drivers.........................................................................................................81
Library Functions..................................................................................................................................82
Low\u2212level File Access..........................................................................................................................82
write.................................................................................................................................................83
read..................................................................................................................................................83
open.................................................................................................................................................84
Initial Permissions...........................................................................................................................85
umask...............................................................................................................................................86
close.................................................................................................................................................87
ioctl..................................................................................................................................................87
Try It Out \u2212 A File Copy Program..................................................................................................87
Other System Calls for Managing Files.........................................................................................89
The Standard I/O Library......................................................................................................................91
fopen................................................................................................................................................92
fread.................................................................................................................................................92
fwrite...............................................................................................................................................93
fclose...............................................................................................................................................93

ii
of 00

Leave a Comment

You must be to leave a comment.
Submit
Characters: ...

thanks that was cool

they have a great cms here

U hebt een hoogste inkepingsplaats

you people need to get a life

Ik verontschuldig me voor het houden niet omhoog met uw guestbook.

You must be to leave a comment.
Submit
Characters: ...