writing linux utilities - Linux

This is a discussion on writing linux utilities - Linux ; Hi everybody., I would like to know about writing linux utilities.i have searched some utilities source and walked through it.What is initialize_main() function doing. Thankyou...

+ Reply to Thread
Results 1 to 6 of 6

Thread: writing linux utilities

  1. writing linux utilities

    Hi everybody.,
    I would like to know about writing linux
    utilities.i have searched some utilities source and walked through
    it.What is initialize_main() function doing.

    Thankyou


  2. Re: writing linux utilities

    sujai.sankar@gmail.com wrote:
    > Hi everybody.,
    > I would like to know about writing linux
    > utilities.i have searched some utilities source and walked through
    > it.What is initialize_main() function doing.


    Dunno. It's not a standard function name. It does what it's written for.
    Only the source will tell.

    A "Linux utility" is a program that does something useful. Whether it
    des this only for you or whether it would completely erase poverty in
    the world is irrelevant for this fact.

    A lot of Linux utilities are written in C, some are written in C++,
    especially if they have a GUI. Some are written in one of the numerous
    interpreted languages (Shell, Perl, Python, Tcl, Tk, ...)

    So, if you have a problem that you want to solve using a Linux box, you
    write a program in any language that you are familiar with (and which is
    supported by your Linux distro), and ... voila ... you have a Linux
    utility. If you think it is useful to others, consider publishing it,
    e.g. on sourceforge.
    Note that, unfortunately for developers, a lot of problems are already
    solved ;-) But it may be interesting to build a better version or build
    another version only to find that you are not worse than the other guy/girl.

    Most important: have fun,

    Josef
    --
    Josef Möllers (Pinguinpfleger bei FSC)
    If failure had no penalty success would not be a prize
    -- T. Pratchett


  3. Re: writing linux utilities

    sujai.sankar@gmail.com writes:
    > I would like to know about writing linux
    > utilities.


    You should read this book http://catb.org/~esr/writings/taoup/
    to get a general overview and some background.

    > I have searched some utilities source and walked through
    > it. What is initialize_main() function doing.


    This is a function specific to that program. Search it in the sources.


    --
    __Pascal Bourguignon__ http://www.informatimago.com/

    HEALTH WARNING: Care should be taken when lifting this product,
    since its mass, and thus its weight, is dependent on its velocity
    relative to the user.

  4. Re: writing linux utilities

    Hi josef.,
    Thanku for ur reply.I have seen in some 10 to 20 source
    files such as echo,ls,tee,etc.They are using it like
    initialize_main(&argc,&argv).What you have said is right.I am trying to
    write a utility for my own use and if i feel it will be useful for all
    definitely i will make it free to all.Moreover i am having fun trying
    these things and learning as well.
    Josef Moellers wrote:
    > sujai.sankar@gmail.com wrote:
    > > Hi everybody.,
    > > I would like to know about writing linux
    > > utilities.i have searched some utilities source and walked through
    > > it.What is initialize_main() function doing.

    >
    > Dunno. It's not a standard function name. It does what it's written for.
    > Only the source will tell.
    >
    > A "Linux utility" is a program that does something useful. Whether it
    > des this only for you or whether it would completely erase poverty in
    > the world is irrelevant for this fact.
    >
    > A lot of Linux utilities are written in C, some are written in C++,
    > especially if they have a GUI. Some are written in one of the numerous
    > interpreted languages (Shell, Perl, Python, Tcl, Tk, ...)
    >
    > So, if you have a problem that you want to solve using a Linux box, you
    > write a program in any language that you are familiar with (and which is
    > supported by your Linux distro), and ... voila ... you have a Linux
    > utility. If you think it is useful to others, consider publishing it,
    > e.g. on sourceforge.
    > Note that, unfortunately for developers, a lot of problems are already
    > solved ;-) But it may be interesting to build a better version or build
    > another version only to find that you are not worse than the other guy/girl.
    >
    > Most important: have fun,
    >
    > Josef
    > --
    > Josef Möllers (Pinguinpfleger bei FSC)
    > If failure had no penalty success would not be a prize
    > -- T. Pratchett



  5. Re: writing linux utilities

    sujai.sankar@gmail.com wrote:
    > Thanku for ur reply.I have seen in some 10 to 20 source
    > files such as echo,ls,tee,etc.They are using it like
    > initialize_main(&argc,&argv).What you have said is right.I am trying to
    > write a utility for my own use and if i feel it will be useful for all
    > definitely i will make it free to all.


    If you really don't know how to find a function in source code, I
    recommend you first read some books on programming and try to create a
    basic program - like the one that only prints a single line on screen,
    before undergoing a task of creating a useful utility.

    Good luck,

    --
    Milan Babuskov
    http://njam.sourceforge.net
    http://swoes.blogspot.com

  6. Re: writing linux utilities

    sujai.sankar@gmail.com wrote:
    > Hi josef.,
    > Thanku for ur reply.I have seen in some 10 to 20 source
    > files such as echo,ls,tee,etc.They are using it like
    > initialize_main(&argc,&argv).


    I assume that these utilities share a common base of ... ahem ...
    utility functions. Without having looked into the sources, I assume that
    over the years (these are quite old, mature standard utilities), the
    programmers have realized that all these utilities need some common
    functionality and, in order to have a consistent interface, they have
    introduced a common function "initialize_main" to handle options etc.

    In addition, these are utilities that may very well be written to be
    portable across numerous operating systems (the are not specific Linux
    utilities but GNU utilities(*)) and, as such, require different option
    handling besides the simple question whether options are introduced by a
    dash (-) or a slash (/). So, by placing option handling in one function,
    you can adapt the option handling of the entire suite to a new OS by
    "just" rewriting this single function.

    Josef

    (*)A loser once claimed that a program could not be said to be portable
    if you had to rewrite parts of it, but IMHO portability is not a binary
    attribute: a program can be more or less portable.
    --
    Josef Möllers (Pinguinpfleger bei FSC)
    If failure had no penalty success would not be a prize
    -- T. Pratchett


+ Reply to Thread