150 likes | 283 Views
System Programming Assignment 1 Shell and File Operation. Lecturer : Pao-Ann Hsiung Teaching Assistants: Shang-Wei Lin and Jying-Lwen Chiu Embedded Systems Laboratory National Chung Cheng University Chiayi, Taiwan-62102. Outline. Objective Assignments & Requirements Grading Policies
E N D
System ProgrammingAssignment 1Shell and File Operation Lecturer:Pao-Ann Hsiung Teaching Assistants: Shang-Wei Lin and Jying-Lwen Chiu Embedded Systems Laboratory National Chung Cheng University Chiayi, Taiwan-62102
Outline • Objective • Assignments & Requirements • Grading Policies • Turn In
Objective • To be familiar with file operations in UNIX-like environments • To understand how a shell is implemented • To understand how APIs are implemented • To organize your program structure well
Assignments • You are asked to implement a simple shell and two APIs to help process files • find • To find a keyword in a specified file or directory • 在特定的檔案或資料夾中所有的檔案尋找關鍵字 • replace • To replace a word by another word in a specified file or directory • 在特定的檔案或資料夾中所有的檔案,用一個關鍵字取代另一個關鍵字
Assignments (cont’d) • find [-cr] keywordtarget • c : upper/lower case sensitive • r : used when the target is a directory • keyword : the word you want to find • target :the target file or directory
Assignments (cont’d) • replace [-cr] word1word2target • c : upper/lower case sensitive • r : used when the target is a directory • word1 : the word you want to replace by • word2 : the word you want to replace • target : the target file or directory
Requirements • The final program after compilation will be named “shell” • After executing this shell, it will print “##” to prompt users and wait for input commands (find or replace)
Requirements (cont’d) • The results of the find command will be shown in the stdout as follows: • In xxx Line xxx : Char xx ~ xx • You are responsible for writing a makefile suitable for your whole program • The document of your program will be named ‘readme.doc’
Grading Policies • You have to give me: • A documentation (5 pages) about 15% • How you do it • Your thoughts after this assignment • The program files • Source code 60% • Makefile 10% • Error Controls & Extra Functions 15%
Turn In • FTP • 140.123.102.96 : 21305 • SP2007/SP2007 • Put學號_姓名.zip into “Assignment_1” directory • Documentations • Program files • Makefile • Due date • 2007/03/27 23:59:59