Results 1 to 9 of 9

Thread: Finding a programs code

Hybrid View

  1. #1
    Join Date
    Aug 2008
    Beans
    212

    Finding a programs code

    Hello,

    I have been studying C for a while and would like to start looking at code for other programs to see how they work and further my studies. Since linux is open source I would assume that we would have access to the code for all the open source programs. If this is allowed, is there a way that I could take a program that I use on my computer, like a cd player, and get the code to study it? If so, how would I go about doing it? What are some simple types of programs written in C that I could start with? Thanks for any advice.

  2. #2
    Join Date
    Jan 2008
    Beans
    51
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: Finding a programs code

    If you go to a website like sourceforge you can download the code. The program itself doesn't often contain its own source (if you download it the 'traditional' way, you often have to compile it yourself so the source is there)

  3. #3
    Join Date
    Jun 2008
    Location
    Tennessee
    Beans
    3,310
    Distro
    Kubuntu 12.10 Quantal Quetzal

    Re: Finding a programs code

    In Ubuntu the easiest way is to use apt-src. Assuming you have source repositories enabled (they are by default, I believe), you just type:
    Code:
    apt-src install packagename
    And the sourcecode for "packagename" will be downloaded and extracted to its own folder in the current directory.

    Not everything is written in C, in fact the repos contain stuff written in just about every language out there. The kernel and most of the system software is written in C, if I'm not mistaken.

    What kind of software are you wanting to study? System stuff, GUI apps, utilities, services?

  4. #4
    Join Date
    Aug 2008
    Beans
    212

    Re: Finding a programs code

    Hi,

    Thanks for the replies. I am interested in programs that are fairly small and not too complicated to learn how they work. I was thinking maybe something like a cd player/ripper or some systems type stuff. At this point I am just trying to learn from programs that are being used by people. From there I will be able to find put what really interests me.

  5. #5
    Join Date
    Jun 2008
    Location
    Tennessee
    Beans
    3,310
    Distro
    Kubuntu 12.10 Quantal Quetzal

    Re: Finding a programs code

    Thinking further about it, you might want to start with examining source for basic console commands; the thing about simple gui programs is that they tend to be mostly glue code to pull together various components from external libraries. It's harder to make sense of unless you understand those libraries and what they provide. Of course it takes only a few seconds to download a nominal source package and open it in a text editor, so don't just take my word for it.

  6. #6
    Join Date
    Feb 2007
    Beans
    4,045
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Finding a programs code

    coreutils contain many of the small programs you find on unix-systems; ls, mv, cp, cut, chmod, etc.
    Code:
    apt-get source coreutils

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •