The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-20-2007
noobie noobie is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 3
implemenation of cwd()

i'm writing my own shell and implementing a few unix commands.
I'm using the readline() for input and strtk() to tokenize it. I need to implement the cwd command as an option in the shell..
Here's the layout :

while true do
Read a line of input using readline()
tokenize the input
switch token[0] do
case cd
change to specified directory in token[1]
end
case pwd
print the current working directory
end
.....and so on


My C skills are a bit rusty...could use all the help i can get
Thanks in advance
  #2 (permalink)  
Old 09-20-2007
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,800
chdir() changes directory

fgets(<string>, <size in bytes>, stdin) reads a line from the terminal - one way of many ways to do this - there is no readline in ANSI C

getcwd() gives you the current directory you are in
Closed Thread

Bookmarks

Tags
unix commands

« ip address | help »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:32 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0