« first day (423 days earlier)      last day (4526 days later) » 

3:00 AM
I'm an old school robot. I don't have those fancy modern gizmos.
 
@Ollie I would suggest calling exit() or something to fail obnoxiously and detectably when a call fails.
you have gyros and shit clearly visible in your head!!!
 
user457812
@Ollie Are you checking to make sure the result of getenv isn't NULL?
 
@Ollie you might be calling stat() on a null filename
that too
the way it's written you can't tell where it's failing, with a little work you can narrow it down.
 
i have a char pulling the filename in and then am running stat on that
I cant even remember what getenv does
 
user457812
...
 
3:03 AM
need to look that up
 
user457812
That's scary.
 
yeah, you check entry against null but not entry->d_name
you also don't check to see if malloc failed (unlikely)
 
i removed that bit of code because it annoyed me
 
user457812
That sounds like a dumb reason to remove something
 
getenv checks the environment vars
 
user457812
3:05 AM
Especially since it's the part that ensures your balls don't get caved in by the iron boot of the OS.
 
I'm pretty sure that it is something to do with the way that i get the oath
 
try a echo $PWD in the shell in minix
 
brings up nothing
path*
 
user457812
Well, your problem's been found.
 
3:06 AM
@nil it's good to have a literary type around, you really add color to the conversation
 
user457812
You need to check getenv isn't returning NULL
 
user457812
@keithlayne I'm pretty sure testicular collapse is something anyone could come up with.
 
or worse, an empty string (don't know the behavior if it fails)
@nil my bad yo
 
user457812
Hm, I think if an environment variable has an empty string it's considered unset, isn't it?
 
"testicular collapse" lol
 
3:07 AM
how to i check getenv?
 
Anyone else would just say "broken balls".
 
do*
 
that's the question, best for the docs
does minix have man?
 
yeah
it has man EVERYTHING!
 
user457812
Uh, well, okay.
 
3:08 AM
ok
 
on linux getenv returns null on no match (says man)
 
ok i dont understand why it is finding nothing
 
> As typically implemented, getenv() returns a pointer to a string within the environment list. The caller must take care not to modify this string, since that would change the environment of the process.
gotta love C.
 
but would that cause it to kick up a mem address error
if only i could use a nice ide
 
user457812
3:09 AM
.. Wow, it's seriously returning a pointer to the original string?
 
if it returned a null pointer?
YES
 
if only i could use an ide
oh yeah of course
that makes sence
 
user457812
Could use vim and a ton of plugins. Works for me, anyway.
 
Meh, IDEs.
 
that's another thing you didn't check...the input to the function
 
3:10 AM
Could use a debugger.
 
user457812
Debuggers are for chumps.
 
which you immediately pass to opendir()
@CatPlusPlus we got this, okay?
 
Yeah, printf the hell out of that thing.
 
user457812
printf all the things!
 
ahhh
 
3:11 AM
@CatPlusPlus trying come in all "I'm the Cat" and shit and steal my non-rep
:)
 
Echo $PWD returns /home/ollie in fedora but nothing in minix
 
user457812
What does using pwd do?
 
so my error is probably the way that im calling the function
 
as we said, add a check in main, split the function calls and say, if getenv returns null, printf("FUCKMEFUCKMEFUCKMEFUCKMEFUCKMEFUCKMEFUCKME!!\n");
 
split the function in main?
(please remember im new to this C business
 
3:13 AM
char* pwd = getenv("PWD");
if (!pwd) printf("FUCKMEFUCKMEFUCKMEFUCKMEFUCKMEFUCKMEFUCKME!!\n");
 
user457812
Tried getcwd (or getwd, though I wouldn't recommend that)? I don't know if Minix provides that or not.
 
else return listdir(pwd);
never mind
I just did your homework for you, I accept credit or cash only.
 
thanks man
i now need to work out an alternate for pwd
haha
 
user457812
I just told you an alternative -_-
 
@nil it's in unistd.h....
 
user457812
3:15 AM
Bangs head against desk vigorously until smashed into a fine pulp
 
minix should (might?) have it.
 
minix should have many things
 
> #include <unistd.h>
char *getcwd(char *buf, size_t size);
char *getwd(char *buf);
char *get_current_dir_name(void);
 
user457812
Yeah, I can't really say anything about what Minix does/doesn't support, so I have to qualify it
 
what does google say? searching....
 
user457812
3:17 AM
Google is for chumps.
 
i have unistd
 
user457812
I have a strange urge to try eating haggis.
 
look in it. Or try man on getcwd, getwd, or get_current_dir_name
@nil don't be gross. There are children here.
 
user457812
Where? Are they edible?
 
haha
i have a feeling cwd won't work for me
 
3:19 AM
the other, other, other white meat
 
as im recursively searching directorys
so would it just scan the same dir over and over
 
user457812
Unless you call chdir.
 
I have a feeling @nil has done everything he can short of teleporting to you and programming it himself
 
user457812
I'm actually just trying to drive him insane so he'll smash his computer in with a hammer.
 
you're doing recursion, so you shouldn't have to chdir as long as the logic is good.
 
3:22 AM
ah man this has confused the hell out of me
i am the worst programming barring kenny loggins
 
eat some haggis. It'll clear everything up
 
ill drink a magners that may work
 
wow...how did you manage to bring him into this?
 
user457812
@keithlayne That is the hope, but he's using strings to recurse when I think it'd be better to just use file descriptors after the first directory.
 
he is technically a mucis programmer
 
user457812
3:23 AM
Ew
 
and with danger zone he should have been shot
 
user457812
I don't want anything to do with a mucus programmer
 
are you saying what has taken me days of no sleep is actually a load of old horse shit
 
oh yeah, use the inode structure instead of strings, I would think. It'll be easier and more efficient.
 
user457812
@Ollie Probably, but I'd say that about most software.
 
3:24 AM
yes, but I don't want that to discourage you
it is a rite of passage
 
i thought i was nailing this until a few days ago
 
I had a similar feeling once about a girl
 
nil i meant music programmer
 
user457812
You're currently unfamiliar with what you're working with in a lot of ways, it's to be expected that your code is going to suck
 
mucus is way funnier
 
3:25 AM
ok so moral of my extremely shitty code is that i need to use chdir and cwd?
 
no...
 
i think im getting dyslexia from over tiredness
 
user457812
No, you might use getcwd (not 'cwd') for the first directory just to get the path, but after that you won't be dealing with strings to handle recursion
 
read the inode docs and use that for great good
 
user457812
chdir isn't needed at all.
 
3:26 AM
that's what inodes are for
 
if i have to read anything else about inodes i may end up stabbing myself in the eye with a knife i use to cut chiles!
 
that's a risk you have to take
 
user457812
I doubt your eye would actually notice
 
ahaha
 
user457812
If chili stuff gets on the eyeball, it probably won't actually hurt. It's once it gets to the membrane that your brain is likely going "YOU ARE AN ASSHOLE."
 
3:28 AM
ok edit to summary of my shitty code, if i just change the PWD part to use CWD will it work?
@nil HAHAHAHAHAH!
 
user457812
No.. where did this CWD thing come from?
 
getcwd
 
that's more like it
 
user457812
My advice: slow down and think.
 
user457812
Granted, real programmers don't think.
 
3:30 AM
char cwd;
getcwd(cwd);
listdir(cwd);
 
user457812
I would actually write up code just to show you what I'd do, but then I would be completing your assignment for you
 
...nv(cwd));*
 
user457812
... What
 
user457812
Why is getenv in there
 
haha
 
user457812
3:31 AM
And why is cwd a char?
 
listdir(cwd)
 
user457812
I will cut you!
 
with a chile cutting knife?
im copying an example on a man page
i told you, im the worst barring kenny loggins and probably steve jobs now...
 
user457812
I'm going to take a break from this because otherwise I am going to become frustrated and start insulting you, which is not what I want to do.
 
haha im sorry
im shit
I wish i wasnt
but i am
 
user457812
3:33 AM
The fact that you're even trying is good, but there is also the fact that I suck at helping people
 
long size;
char *buf;
char *ptr;
ptr = getcwd(buf, (size_t)size);
 
not good. what is buf pointing to?
 
I dont want to be anywhere near you when i start having to find the last block of a file and working out the internal fragmentation
 
char buf[100]; // or some big number.
 
use the form (if there is one) that doesn't require you to pass a buffer.
or that
 
3:37 AM
ok
how about
getcwd(cwd, MAXPATHLEN);
char cwd[MAXPATHLEN]
 
how have you defined cwd?
ok
 
that's more like it
 
MAXPATHLEN=1024
 
Except when it isn't :-)
 
would that make it so it tried to start at say /home/ollie/Documents/ and then 800 blanks?
 
3:41 AM
I'm not sure what you mean, but it is really important in C that if you pass a pointer to somthing it has to point somewhere.
 
would my method work?
 
Although by an interesting twist of fate today I was able to compile pwd.c with my cross compiler. And it worked.
 
i just got very confused, ive declared const int maxlen and char cwd then called getcwd(cwd, maxlen); and its telling me that i havent declared cwd
 
As an extension to the POSIX.1-2001 standard, Linux (libc4, libc5, glibc) getcwd() allocates the
buffer dynamically using malloc(3) if buf is NULL. In this case, the allocated buffer has the
length size unless size is zero, when buf is allocated as big as necessary. The caller should
free(3) the returned buffer.
 
@Rich good info.
 
3:48 AM
2 hours ago, by nil
I like most languages, unless they're Python-esque
we agree on something.
 
I assume you declared cwd before the cal to getcwd?
l
 
Where did all the newbs go?
 
to bed
 
im here
ok so i figured it out and still got the sigsegv error
i put in an if statement to print me something if cwd was null and it didnt return me my error message
 
@keithlayne I'm not in bed yet.
 
3:51 AM
effing n00b
 
@RMartinhoFernandes ur not a newb.
 
I thought you just plugged in?
 
Let's see: I started learning C++ nine months ago, and I never wrote an application in C++.
 
and robots don't go to bed.
 
user406009
Anyone have any idea of the cost of using abstract base classes everywhere, example being like this?
 
3:52 AM
I'm definitely still a C++ neophyte.
 
@RMartinhoFernandes quit bragging
@EthanSteinberg I think it causes a global collapse of financial institutions
 
Ok so i fixed the problem but lost the recursiveness
k
 
is anyone here , who doesn't hate java?
 
baby steps....
my mom
 
its because my function is listdir(cwd) in main
 
3:54 AM
@Ollie don't ask C++ questions here. If u want to do that sort of thing, go to the Java room.
 
I need to call the fuction to call itself to the directory it is being given
 
@IntermediateHacker we wouldn't be having this conversation if it were a C++ question, we would have pointed him to boost an hour ago.
 
@keithlayne lol.
 
Hey, what's going on?
I will never start proofreading my tweets. That's for lasers.
 
@IntermediateHacker is about to catch a GFY in da FACE
 
3:56 AM
what's GFY?
 
@RMartinhoFernandes ha ha he spelled lazer wrong
 
@IntermediateHacker Go Fuck Yourself.
 
nice
 
damn internet acronyms.
 
What?
@keithlayne Man, that's gonna end badly!
You shouldn't have done that!
 
3:58 AM
can't we all just get along?
 
People will see only that message without context and I'll get freaking suspended!
The flag system is broken!
 

« first day (423 days earlier)      last day (4526 days later) »