Wednesday, November 18, 2009

Programs









Programs

1-1 cpC: File Copying with the C Library 14

1-2 cpW: File Copying with Windows, First Implementation 16

1-3 cpCF: File Copying with a Windows Convenience Function 18

2-1 PrintMsg: Console Prompt and Print Utility Functions 40

2-2 ReportError for Reporting System Call Errors 42

2-3 cat: File Concatenation to Standard Output 43

2-4 atou: File Conversion with Error Reporting 45

2-5 Asc2Un Function 45

2-6 pwd: Printing the Current Directory 51

3-1 RecordAccess 61

3-2 lsW: File Listing and Directory Traversal 69

3-3 touch: Setting File Times 72

3-4 lsReg: Listing Registry Keys and Contents 84

4-1 ReportException: Exception Reporting Function 102

4-2 toupper: File Processing with Error Recovery 107

4-3 Excption: Processing Exceptions and Termination 109

4-4 The Filter Function 111

4-5 Ctrlc: Signal Handling Program 114

5-1 sortBT: Sorting with a Binary Search Tree 131

5-2 FillTree and Other Tree Management Functions 132

5-3 Asc2UnMM: File Conversion with Memory Mapping 141

5-4 sortFL: Sorting a File with Memory Mapping 142

5-5 sortMM: Based Pointers in an Index File 145

5-6 sortMM: Creating the Index File 148

5-7 atouEL: File Conversion with Explicit Linking 155

6-1 grepMP: Parallel Searching 180

6-2 timep: Process Times 183

6-3 JobShell: Create, List, and Kill Background Jobs 187

6-4 JobMgt: Creating New Job Information 190

6-5 JobMgt: Displaying Active Jobs 192

6-6 JobMgt: Getting the Process ID from a Job Number 193

7-1 grepMT: Multithreaded Pattern Searching 209

7-2 sortMT: Merge-Sort with Multiple Threads 213

8-1 simplePC: A Simple Producer and Consumer 241

8-2 eventPC: A Signaling Producer and Consumer 255

9-1 statsMX: Maintaining Thread Statistics 266

10-1 SynchObj.h: Part 1Threshold Barrier Definitions 289

10-2 ThbObject.c: Implementing the Threshold Barrier 290

10-3 SynchObj.h: Part 2Queue Definitions 292

10-4 QueueObj.c: The Queue Management Functions 294

10-5 ThreeStage.c: A Multistage Pipeline 299

10-6 q_get Modified for Cancellation 307

11-1 pipe: Interprocess Communication with Anonymous Pipes 318

11-2 clientNP: Named Pipe Connection-Oriented Client 329

11-3 serverNP: Multithreaded Named Pipe Server Program 330

11-4 SrvrBcst: Mailslot Client Thread Function 340

11-5 LocSrver: Mailslot Server 341

12-1 clientSK: Socket-Based Client 357

12-2 serverSK: Socket-Based Server with In-Process Servers 359

12-3 command: Sample In-Process Servers 364

12-4 SendReceiveSKST: Thread-Safe DLL 367

12-5 SendReceiveSKHA: Thread-Safe DLL with a State Structure 371

13-1 main: The Main Service Entry Point 381

13-2 SimpleService: A Service Wrapper 388

13-3 ServiceShell: A Service Control Program 395

14-1 atouOV: File Conversion with Overlapped I/O 408

14-2 atouEX: File Conversion with Extended I/O 416

14-3 TimeBeep.c: A Periodic Signal 420

14-4 serverCP.c: A Server Using a Completion Port 426

15-1 chmodW: Change File Permissions 440

15-2 lsFP: List File Permissions 441

15-3 InitUnFp: Initializing Security Attributes 443

15-4 ReadFilePermissions: Reading Security Attributes 448

15-5 ChangeFilePermissions: Changing Security Attributes 449

15-6 ServerNP: Securing a Named Pipe 451

16-1 sortMM.c: Before Win64 Migration, Part 1 467

16-2 sortMM.c: Before Win64 Migration, Part 2 468

A-1 EvryThng.h Include File 480

A-2 Envirmnt.h Include File 480

A-3 Support.h Include File 481

A-4 JobMgt.h Include File 483

A-5 ClntSrvr.h Include File 483

A-6 Exclude.h Include File 485

A-7 Options Function 486

A-8 SkipArg Function 487

A-9 GetArgs Function 488









    No comments: