I am writing my own shell program. I am currently implementing the cd command using chdir.
I want to implement the cd with the below options :
-PDo not follow symbolic links-LFollow symbolic links (default)
When a given path is entered on the shell, how to figure out if the path is a symbolic link or an absolute path progamatically?
Thanks
Check out the lstat() function , you need to use S_ISLNK on the st_mode field.