Follow us on Twitter!
Few are those who can see with their own eyes and hear with their own hearts. - Albert Einstein
Thursday, April 24, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 31
Guests Online: 25
Members Online: 6

Registered Members: 82902
Newest Member: kcutta77
Latest Articles
View Thread

HellBound Hackers | Computer General | Programming

Author

C, parsing /etc/passwd, getting userids


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 06-09-08 13:09
Hello, I've been working on creating a linux shell. I figured that I should have it customizable like other shells. So, I figured that I should put a customizable file in the home directory. I am going to use getuid() to get the current user id and then find a matching user id in /etc/passwd and take the corresponding home directory. However, I don't seem to be parsing correctly. This is what I have: http://pastebin.c. . .. That's the code and what happens when I run it. Does anyone have any ideas? I can't seem to find any logic in it at all.

Edit:
Nevermind, I got it. Using fscanf with %s sucks, had to go through with fgetc(f);.

Edited by on 06-09-08 20:53