Then read the SDL docs from the SDL site on the SDL joystick functions. We aren't here to teach SDL. There are plenty of examples all over the web to do that.
Several months ago, I worked on a small project where I made a VERY simple pong clone. I did it in SDL, and it compiles for Linux, Windows, and PSP. It has working Makefiles and everything, and it might be enough to get you started.
I'm not saying that it is coded well or anything (I never free my font surfaces), but it compiles and works as intended.