Improve my shell by adding hierarchical directories.

Hi.

im learning unix, and i have problem with my shell . i want to add hierarchical directories. so theshell have mkdir, rmdir and chdir commands.

the coding in C language.

i looked at the source of mkdir for example, and its very long and complicated. i need simple implementation for these functions to add them to my shell, so i can make directories for example while inside the shell !

Thanks

Hi.

The shell (well actually the OS) has programs to create (mkdir), remove (rmdir) and change (cd) directories.

Beyond that, I'm not sure what you're asking.

What do you mean by "my shell"? And what has C got to do with any of this?

this is the shell

If anyone is to help you, you have to start making some sense.

The file you uploaded is 2 bytes in size - about as much use as a trap door in a lifeboat.

If you're trying to do something in C why are you talking about shells? And why are you looking at the source code for mkdir, etc., when all you have to do is call it?

And what does learning UNIX have to do with writing a C program?

fixed the link

The source code for many home-brewed interactive shells is available on the Internet. You just need to search for it.

If you want to look at the source code for the Bourne shell, it is available at V7 Bourne Shell source code

there is no chdir mkdir ..etc in that shell

OK, then how did this shell support making, changing and removing directories?

Meanwhile here is the source code for the Kenneth Almquest clone of the Bourne shell in FreeBSD 2.0, which is approx 15 years old, for you to examine.

Hi.

File V7/usr/src/cmd/sh/xec.c contains:

				case SYSCD:
					IF flags&rshflg
					THEN	failed(com[0],restricted);
					ELIF (a1==0 ANDF (a1=homenod.namval)==0) ORF chdir(a1)<0
					THEN	failed(a1,baddir);
					FI
					break;

The mkdir command is usually a program external to the shell.

Good luck ... cheers, drl

As this is homework and you just post there, Im closing this thread.
Please continue here :