Read without ads and support Scribd by becoming a Scribd Premium Reader.
 
Table of Contents
Beginning Linux Programming, Second Edition.............................................................................................1Foreword..............................................................................................................................................................5Introduction.........................................................................................................................................................6
Welcome.................................................................................................................................................6Who's this Book For?..............................................................................................................................6What's Covered in the Book...................................................................................................................6What You Need to Use this Book...........................................................................................................8Source Code............................................................................................................................................9Conventions............................................................................................................................................9Tell Us What You Think.......................................................................................................................10Why Should I Return the Reply Card?.................................................................................................10
Chapter 1: Getting Started.............................................................................................................................11
Overview...............................................................................................................................................11What is UNIX?.....................................................................................................................................11What is Linux?......................................................................................................................................11Distributions..........................................................................................................................................11The GNU Project and the Free Software Foundation...........................................................................12Programming Linux..............................................................................................................................13UNIX Programs....................................................................................................................................13The C Compiler..............................................................................................................................14Try It Out − Our First UNIX C Program........................................................................................14How It Works..................................................................................................................................15Getting Help..........................................................................................................................................15Try It Out − Manual Pages and info................................................................................................16Development System Roadmap............................................................................................................17Programs.........................................................................................................................................17Header Files....................................................................................................................................18Library Files...................................................................................................................................19Static Libraries...............................................................................................................................19Try It Out − Static Libraries............................................................................................................20Shared Libraries.............................................................................................................................22UNIX Philosophy.................................................................................................................................23Simplicity.......................................................................................................................................23Focus..............................................................................................................................................23Reusable Components....................................................................................................................23Filters..............................................................................................................................................23Open File Formats..........................................................................................................................23Flexibility.......................................................................................................................................23Summary...............................................................................................................................................24
Chapter 2: Shell Programming.......................................................................................................................25
Overview...............................................................................................................................................25What is a Shell?....................................................................................................................................26Pipes and Redirection...........................................................................................................................27Redirecting Output.........................................................................................................................27Redirecting Input............................................................................................................................28Pipes...............................................................................................................................................28
i
 
Table of Contents
Chapter 2: Shell Programming
The Shell as a Programming Language................................................................................................29Interactive Programs.......................................................................................................................29Creating a Script.............................................................................................................................30Making a Script Executable...........................................................................................................31Shell Syntax..........................................................................................................................................32Variables.........................................................................................................................................33Conditions......................................................................................................................................36Control Structures...........................................................................................................................38Functions........................................................................................................................................49Try It Out − A Simple Function......................................................................................................50How It Works..................................................................................................................................50Try It Out − Returning a Value.......................................................................................................51How It Works..................................................................................................................................52Commands......................................................................................................................................52Command Execution......................................................................................................................62Here Documents.............................................................................................................................66Try It Out − Using Here Documents...............................................................................................66Try It Out − Another Use for a Here Document.............................................................................67How It Works..................................................................................................................................67Debugging Scripts..........................................................................................................................67Putting it All Together..........................................................................................................................68Requirements..................................................................................................................................68Design.............................................................................................................................................69Try It Out − A CD Application.......................................................................................................70Notes................................................................................................................................................76Summary...............................................................................................................................................77
Chapter 3: Working with Files.......................................................................................................................78
Overview...............................................................................................................................................78UNIX File Structure..............................................................................................................................78Directories......................................................................................................................................79Files and Devices............................................................................................................................79System Calls and Device Drivers.........................................................................................................81Library Functions..................................................................................................................................82Low−level File Access..........................................................................................................................82write.................................................................................................................................................83read..................................................................................................................................................83open.................................................................................................................................................84Initial Permissions...........................................................................................................................85umask...............................................................................................................................................86close.................................................................................................................................................87ioctl..................................................................................................................................................87Try It Out − A File Copy Program..................................................................................................87Other System Calls for Managing Files.........................................................................................89The Standard I/O Library......................................................................................................................91fopen................................................................................................................................................92fread.................................................................................................................................................92fwrite...............................................................................................................................................93fclose...............................................................................................................................................93
ii
Search History:
Searching...
Result 00 of 00
00 results for result for
  • p.
  • Notes
    Load more