Find the answer to your Linux question:
Results 1 to 10 of 10
Hello..... I was wondering how to edit an open source program using C,Perl, Bash Scripts, Ruby,.......etc. I've searched over the internet for an example on editing such programs, but I ...
  1. #1
    Just Joined!
    Join Date
    Jun 2009
    Posts
    16

    How can I edit an open source program?

    Hello.....

    I was wondering how to edit an open source program using C,Perl, Bash Scripts, Ruby,.......etc.

    I've searched over the internet for an example on editing such programs, but I didn't find anything.....

    Let's say that I want to edit the source of webmin or Snort or anything....How can I do that???

    Thanks in advance....

  2. #2
    Linux Engineer Kieren's Avatar
    Join Date
    Aug 2007
    Location
    England
    Posts
    845
    You will first need to get an understanding of the languages used in the program. Then you can download the source code, learn how it was written, modify what you need and compile the new code (if needed)
    Linux User #453176

  3. #3
    Linux Engineer GNU-Fan's Avatar
    Join Date
    Mar 2008
    Posts
    935
    The three most common ways are:

    a) You ask the package manager of your operating system to fetch the sources. The advantage is that all dependencies will be solved by the manager software for you. This means you can compile and run the modified software very easily. This is very good if you want a drop-in replacement for the software you are running already.
    On the downside, the version installed may not be the most current.

    b) You go to the website of the project and download the source archive. The version you get will be genuine and more current, but you have to solve all dependencies for (libraries etc) for it in the correct versions.

    c) You install a version control system live SVN and point it to the source server of the project. This way you always have the very latest development version and if you get upload rights, you can push your modifications easily upstream. This means that these modification are in the next official release of the software, so the rest of the world profits from your works as well.


    It goes without saying that beginners should start with a), while c) is for experience d developers, as it is easy to break things not only for you but for others as well.
    Debian GNU/Linux -- You know you want it.

  4. #4
    Just Joined!
    Join Date
    Jun 2009
    Posts
    16
    Thanks Kerien for your reply.
    Quote Originally Posted by Kieren View Post
    You will first need to get an understanding of the languages used in the program.)
    I have some experience with C/C++, Perl and Shell Script languages.
    Quote Originally Posted by Kieren View Post
    Then you can download the source code
    Is it that with the extension: .src.rpm ?????
    Quote Originally Posted by Kieren View Post
    , learn how it was written, modify what you need and compile the new code (if needed)
    This is all great....but I need a start point to begin learning.
    I don't know what exactly can be edited by changing the source code.
    I don't know what file should be edited.
    I don't know how to open the source of a program.

    I'm totally lost here.

    I just need a tiny example on a small program to get started, or even a web page relevant to my situation.
    Thanks.

  5. #5
    Just Joined!
    Join Date
    Jun 2009
    Posts
    16
    Thanks GNU-Fan for ur reply...
    I'll go with (a)....
    But the previous 'don't know'issues are still standing in my way...

  6. #6
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    I guess I'm a bit confused on what you're asking.

    Pretty much every program we run on Linux is open-source. You can modify any of these programs.

    I will give you an example.

    We use the "echo" program a lot to print out text. You can find "echo" in your /bin directory.

    Now then, if "echo" was written in an interpreted language (Perl, Python, Ruby, Bash, etc.), you could just take the echo script and modify it. However, if we run "file" on it:
    Code:
    tanya:~ alex$ file /bin/echo
    /bin/echo: Mach-O universal binary with 2 architectures
    /bin/echo (for architecture i386):	Mach-O executable i386
    /bin/echo (for architecture ppc7400):	Mach-O executable ppc
    We see that it is a binary executable (I ran this on my Mac, but your output should show an ELF binary executable).

    So, we have this binary. We need to get its source code if we want to modify echo.

    Well, echo is a part of a package called coreutils. So we google, and we find that coreutils is hosted at:
    Coreutils - GNU core utilities

    On that page, they have instructions for downloading the source code. You download it, unpack it, and now you have a bunch of C source code. You modify it as you like and then recompile it. Congratulations! You now have a modified echo.

    Does this make sense?
    DISTRO=Arch
    Registered Linux User #388732

  7. #7
    Linux Engineer GNU-Fan's Avatar
    Join Date
    Mar 2008
    Posts
    935
    Quote Originally Posted by ahmad2080 View Post
    This is all great....but I need a start point to begin learning.
    I don't know what exactly can be edited by changing the source code.
    I don't know what file should be edited.
    I don't know how to open the source of a program.

    I'm totally lost here.
    From these question I gather that your level of experience in programming is standing in your way. You will have to address this, then everything else will become clear soon.

    As over 90% of Free/Open software is written in C or C++, you should begin here.
    Get a learning book or look for websites who teach that. (Dedicated teaching books are better for learning IMHO.)

    Once you have written your first own programs, modifying others' will be an easy task.
    Debian GNU/Linux -- You know you want it.

  8. #8
    Just Joined!
    Join Date
    Jun 2009
    Posts
    16
    Thanks everybody.....

    Cabhan:
    [QUOTE]
    You download it, unpack it, and now you have a bunch of C source code. You modify it as you like and then recompile it. Congratulations! You now have a modified echo.[\QUOTE]
    This is my problem.........a bunch of C source code files.......which should I modify, and what should I modify to do....whatever?????

    I'll take GNU-Fan's advice and get a learning book......
    but do u have suggessions? What book should I download? or what should I google?
    I've tried to google:
    -open source editing
    -open source programs to edit
    -.........
    nothing useful!!

  9. #9
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Program source code is text. Sometimes it is simple program code (C, C++, Java, Perl, Python, etc). Sometimes it is XML documents. There are a number of good editors for Linux, including vi (old, but on every system), emacs, nedit, and many others. Which editor you use is a matter of personal preference. Myself, I like nedit for coding tasks since it has very good language-sensitive syntax highlighting, brace matching, and multi-file search/replace functionality and an easy-to-use GUI. It was developed at US taxpayer expense at Fermi National Laboratory in Illinois. It is now hosted at sourceforge.net and is fully open-sourced.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  10. #10
    Linux Engineer GNU-Fan's Avatar
    Join Date
    Mar 2008
    Posts
    935
    Quote Originally Posted by ahmad2080 View Post
    I'll take GNU-Fan's advice and get a learning book......
    but do u have suggessions? What book should I download? or what should I google?
    Go to a library and borrow a "Learning C programming" book. The tutorials you find online are rarely of the same quality as a printed book.

    Very good books are
    The C++ programming language by Stroustrup
    The C++ Primer by Lippman, Lajoie
    Bruce Eckel's MindView, Inc: Thinking in C++ 2nd Edition by Bruce Eckel can be downloaded

    If you really can't/don't want to get a real book, maybe look at
    C Programming - Wikibooks, collection of open-content textbooks
    Debian GNU/Linux -- You know you want it.

Posting Permissions

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