to implement a Unix/Linux file tree system simulator

the following link is a code help

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

https://www.eecs.wsu.edu/~cs360/lab2.help.html

also, those pages from the book show the requirements of this assignment.

214 Summary
97
The strtok() function divides a string into substrings by the specified delimiter char”/”. The substrings
reside in the original string, thus destroying the original string. In order to preserve the original
pathname, the user must pass a copy of pathname to the strtok() function. In order to access the
tokenized substrings, the user must ensure that they are accessible by one of the following schemes.
substrings.
The copied pathname is a global variable, e.g. char path[128], which contains the tokenized
If the copied pathname path[ ] is local in a function, access the substrings only in the function
(8).2. dir_name
and base_name: For the simulator program, it is also often necessary to decompose a
pathname into dir_name, and base_name, where dir_name is the directory part of pathname and
base_name is the last component of pathname. As an example, if pathname=”/a/b/c”, then
dir_name=”/a/b” and base_name=”c”. This can be done by the library functions dirname() and
basename(), both of which destroy the pathname also. The following code segments show how to
decompose a pathname into dir_name and base_name.
#include
char dname [64), bname [64]; // for decomposed dir_name and base_name
int dbname (char *pathname)
{
char temp (128); 1/ dirname() basename () destroy original pathname
strcpy(temp, pathname);
strcpy(dname
dirname (temp));
strcpy(temp, pathname);
strcpy (bname, basename (temp));
}
2.13.7 Sample Solution
Sample solution of the programming project is available online at the book’s website for download.
Source code of the project solution is available to instructors upon request from the author.
2.14 Summary
This chapter covers the background information needed for systems programming. It introduces
several GUI based text editors
, such as vim, gedit and EMACS, to allow readers to edit files. It
shows how to use the EMACS editor in both command and GUI mode to edit, compile and execute C
programs. It explains program development steps. These include the compile-link steps of GCC, static
and dynamic linking, format and contents of binary executable files, program execution and termina-
tion. It explains function call conventions and run-time stack usage in detail. These include parameter
passing, local variables and stack frames. It also shows how to link C programs with assembly code. It
covers the GNU make facility
and shows how to write makefiles by examples
. It shows how to use the
GDB debugger to debug C programs. It points out the common errors in C programs and suggests
techniques. It describes structures and pointer in C. It covers link lists and list processing by detailed
ways to prevent such errors during program development. Then it covers advanced programming
2.14 Summary
2 Programming Background
The strtoko function din
reside in the originals
96
pathname, the user mu
tokenized substrings, th
childPtr.
siblingPtr.
А
The copied pathnam
Fig. 2.32 A file system
tree
where uppercase names A.
B, C, E are DIRs and
lowercase names x, y, z are
FILEs. The tree can be
represented by the (text)
lines
B
substrings.
. If the copied pathnama
Z
E
(8).2. dir_name and ba
pathname into dir_nam
base_name is the last
dir_name=”/a/b” and E
basename(), both of w
decompose a pathname
The pathnames are generated by PRE-ORDER traversal of a binary tree:
print node
name;
print node.left name;
print node.right name;
// current node
// left pointer = childPtr
// right pointer = siblingPtr
#include

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper
Still stressed from student homework?
Get quality assistance from academic writers!

Order your essay today and save 25% with the discount code LAVENDER