Re: UNIX, C, Perl

Discussion in 'C Programming' started by James Kuyper, Sep 2, 2008.

  1. James Kuyper

    James Kuyper Guest

    Pilcrow wrote:
    > Given that UNIX, including networking, is almost entirely coded in C,
    > how come so many things are almost impossible in ordinary C? Examples:
    > Network and internet access, access to UNIX interprocess controls and
    > communication, ...


    They are not impossible in "ordinary C", they are impossible in strictly
    conforming C. The C that operating systems are written in will make
    heavy use of highly non-portable constructs that give access to all of
    these things. In some cases, those non-portable constructs will consist
    of calls to routines written in assembly language, or in-line assembly
    language, but a very large fraction of the system can be written
    entirely in non-portable C.

    > ... locale determination, EBCDIC/ASCII discrimination, etc.


    I'm not at all clear to me why you think that those can't be performed
    in ordinary C. What features are you asking for that aren't provided by
    <locale.h>? Perhaps if you described in more detail the desired
    functionality I could address the question better.

    > Almost all of these are easy in Perl. Why isn't there a mechanism like
    > perl modules to allow easy extentions for facilities like these?


    There are such mechanisms - they are called "header files" and
    "libraries", and together they serve a very similar purpose.

    > ... Isn't
    > anyone working on this problem? or is it all being left for proprietary
    > systems?


    There's no reasons why the libraries have to be proprietary, though many
    certainly are.
     
    James Kuyper, Sep 2, 2008
    #1
    1. Advertising

  2. James Kuyper

    Guest

    Re: UNIX, C, Perl

    Eric Sosman wrote:
    > Pilcrow wrote:
    > > [...] But perhaps
    > > an example of what I mean is appropriate. Last year I had a list of
    > > several hundred addresses in the USA for which I wanted the 5+4 postal
    > > zip codes. Using a standard module, 'WWW::Mechanize', from CPAN
    > > <http://en.wikipedia.org/wiki/CPAN>, I was able, in about an hour, to
    > > write a program (or a 'script'), in perl, that would access
    > > <http://zip4.usps.com/zip4/welcome.jsp>, programmatically enter each
    > > address, parse the response, extract the zip codes I needed, and update
    > > my list.

    >
    > Good: Problem solved, need satisfied, it's Miller Time.
    >
    > > How could I do the same sort of thing using C? Is there a repository of
    > > libraries for C, similar to CPAN for Perl? If not, is anyone working on
    > > it?

    >
    > One first wonders why you feel a need to re-solve a problem
    > already solved, just for the sheer joy of doing it in C. Will


    This isn't about a particular problem and it's solution, it's about
    the availability of problem-solving tools. He's asking how he could
    have used a similar approach to solving the problem in the first
    place, if he had chosen C rather than perl.
     
    , Sep 2, 2008
    #2
    1. Advertising

  3. James Kuyper

    Guest

    Re: UNIX, C, Perl

    Pilcrow wrote:
    ....
    > I am certainly glad to hear that these things are possible. But perhaps
    > an example of what I mean is appropriate. Last year I had a list of
    > several hundred addresses in the USA for which I wanted the 5+4 postal
    > zip codes. Using a standard module, 'WWW::Mechanize', from CPAN
    > <http://en.wikipedia.org/wiki/CPAN>, I was able, in about an hour, to
    > write a program (or a 'script'), in perl, that would access
    > <http://zip4.usps.com/zip4/welcome.jsp>, programmatically enter each
    > address, parse the response, extract the zip codes I needed, and update
    > my list.
    >
    > The program I wrote is generalized enough to be able to do the same with
    > any other similar list. This saved me the chore of manually entering
    > each address into the form on that web page and copying and pasting the
    > zip code to my list. That chore would have taken several days, since I
    > am a clumsy typist, and the list, as I have said, has several hundred
    > entries.
    >
    > How could I do the same sort of thing using C? Is there a repository of
    > libraries for C, similar to CPAN for Perl? If not, is anyone working on
    > it?


    There is no single repository for C libraries which plays the same
    role for C that CPAN does for perl, but I would guess that many
    similar repositories do exist for C code. What you're asking about is
    mostly a social issue having to do with how CPAN works; it isn't
    related to any technical differences between C and perl. Personally,
    the repository I have the most familiarity with is sourceforge.net,
    which handles a lot more than just C libraries.
     
    , Sep 2, 2008
    #3
  4. Re: UNIX, C, Perl

    In article <>,
    <> wrote:
    ....
    (ditzy Eric scribbled)
    >> One first wonders why you feel a need to re-solve a problem
    >> already solved, just for the sheer joy of doing it in C. Will

    >
    >This isn't about a particular problem and it's solution, it's about
    >the availability of problem-solving tools. He's asking how he could
    >have used a similar approach to solving the problem in the first
    >place, if he had chosen C rather than perl.


    Yes. Anyone with a couple of brain cells to rub together can see that.

    But it doesn't fit in with the CLC regs approach.

    Go back and re-read Eric's text. It is chock full of nasty sarcasm
    aimed at belittling the OP, while clearly feigning ignorance of what
    this thread is really about.
     
    Kenny McCormack, Sep 2, 2008
    #4
  5. James Kuyper

    Richard Guest

    Eric Sosman <> writes:

    > Pilcrow wrote:
    >> [...] But perhaps
    >> an example of what I mean is appropriate. Last year I had a list of
    >> several hundred addresses in the USA for which I wanted the 5+4 postal
    >> zip codes. Using a standard module, 'WWW::Mechanize', from CPAN
    >> <http://en.wikipedia.org/wiki/CPAN>, I was able, in about an hour, to
    >> write a program (or a 'script'), in perl, that would access
    >> <http://zip4.usps.com/zip4/welcome.jsp>, programmatically enter each
    >> address, parse the response, extract the zip codes I needed, and update
    >> my list.

    >
    > Good: Problem solved, need satisfied, it's Miller Time.
    >
    >> How could I do the same sort of thing using C? Is there a repository of
    >> libraries for C, similar to CPAN for Perl? If not, is anyone working on
    >> it?

    >
    > One first wonders why you feel a need to re-solve a problem
    > already solved, just for the sheer joy of doing it in C. Will


    Yes. I mean, who on earth EVER prototypes something in a high level
    language and then moves to something like C for, oh, I dont know,
    speed, memory usage etc. Are you always so ready to belittle people?


    > you then go on to solve it in Ada, Fortran, Lisp, Jovial, ...?
    > Or to put it another way: If you feel impelled to throw out your
    > working Perl solution and write a fresh one in C, what is it
    > about Perl that you find unsatisfactory?
    >
    > I'm not familiar with the libraries you mention, but there
    > are plenty of C libraries out there, perhaps including a few that
    > perform the kinds of tasks you're interested in.


    So you do not know. Just throw in a bit of sarcasm because you are
    bored?

    >
    >> I am sure that it is possible, since Perl itself is written in standard
    >> C, or at least GCC.

    >
    > I suspect you'll find that it's written in a C dialect --
    > maybe strictly-conforming C, maybe something looser -- and that
    > it also makes use of libraries of various kinds that are in turn
    > written in Lordknowswhat. Perhaps all you're really looking for
    > is the packaging of a bunch of libraries into a single convenient
    > framework so you don't have to hunt them up and integrate them?
    > That's a perfectly reasonable thing to want, but ... as part of
    > the definition of a general-purpose language?
    >
    > In your kitchen, I imagine you have an assortment of various
    > knives. You've probably got a few general-purpose knives, and a
    > few that are more specialized: heavy broad-bladed knives for chopping,
    > skinny flexible-bladed knives for filleting, knives with serrated
    > edges for slicing bread, knives with finer serrations for cutting
    > tomatoes ... Why do you have so many knives, instead of doing all
    > your cutting, slicing, and chopping with just one? Is it, perhaps,
    > because a knife that could handle *all* cutting tasks might have
    > usability problems?


    Who the hell do you think you are second guessing the OP? He came here
    for C help - not you strutting around and telling him what he wants.

    >
    > Stretching the analogy right up to the breaking point, here
    > are two competing views of what C should be:
    >
    > http://www.victorinox.com/index.cfm?site=victorinox.ch&page=158&lang=D
    >
    > http://www.thinkgeek.com/gadgets/tools/8b97/zoom/
    >
    > You'll notice that they differ mostly in degree.


    The only thing I noticed is that you made a right fool out of
    yourself. Congratulations and another clc stripe.
     
    Richard, Sep 2, 2008
    #5
  6. In article <g9k9a6$9tc$>,
    Richard <> wrote:
    ....
    >> Good: Problem solved, need satisfied, it's Miller Time.
    >>
    >>> How could I do the same sort of thing using C? Is there a repository of
    >>> libraries for C, similar to CPAN for Perl? If not, is anyone working on
    >>> it?

    >>
    >> One first wonders why you feel a need to re-solve a problem
    >> already solved, just for the sheer joy of doing it in C. Will

    >
    >Yes. I mean, who on earth EVER prototypes something in a high level
    >language and then moves to something like C for, oh, I dont know,
    >speed, memory usage etc. Are you always so ready to belittle people?
    >


    Answering for Eric: Yes. In a word. Yes. It is my biggest thrill in
    life.
     
    Kenny McCormack, Sep 2, 2008
    #6
  7. James Kuyper

    Guest

    Re: UNIX, C, Perl

    Pilcrow wrote:
    > On Tue, 2 Sep 2008 12:32:15 -0700 (PDT), wrote:
    >
    > >Pilcrow wrote:

    ....
    > >> How could I do the same sort of thing using C? Is there a repository of
    > >> libraries for C, similar to CPAN for Perl? If not, is anyone working on
    > >> it?

    > >
    > >There is no single repository for C libraries which plays the same
    > >role for C that CPAN does for perl, but I would guess that many

    >
    > why do you have to guess? ...


    Because I don't possess enough information to be certain, one way or
    the other. Do you? If your question was just rheotorical, as now seems
    to be the case, then all you're doing is trolling this newsgroup to
    promote perl as a superior alternative to C. I know too much about
    perl to fall for that one: perl has a number of advantages over C in
    particular contexts, and i use it routinely when those contexts apply,
    but it has nowhere near enough advantages to replace C in all
    contexts. I wouldn't dream of using it for any of the tasks that I
    currently use C for.

    > ... CPAN is so much integrated with Perl, that
    > whenever Perl is installed, the access to CPAN (cpan.pm) is
    > automatically included (unless you're installing ActiveState Perl, and a
    > similar facility is provided there).


    I can't figure out what relevance that has to my guesswork. It almost
    seems as if you're saying that a C repository cannot count as
    "similar" unless access to that repository is automatically installed
    when you install your C compiler; but I can't imagine that you're
    making such a fatuous suggestion.

    > >similar repositories do exist for C code. What you're asking about is
    > >mostly a social issue having to do with how CPAN works; it isn't
    > >related to any technical differences between C and perl. Personally,
    > >the repository I have the most familiarity with is sourceforge.net,
    > >which handles a lot more than just C libraries.

    >
    > Similar repositories? How do I search them? Do they include
    > documentation? Are they cross-platform compatible?


    The only such repository I'm familiar with is sourceforge.net. If you
    check out their web site, it's pretty obvious how to search it.
    Documentation seems to be the norm, not the exception, but I'm sure
    that the quality of the documentation is highly variable. I'm sure
    that cross-platform compatibility is also highly variable. That's
    pretty much unavoidable when source code comes from such a wide
    variety of sources.
     
    , Sep 3, 2008
    #7
  8. James Kuyper

    Ron Ford Guest

    Re: UNIX, C, Perl

    On Tue, 02 Sep 2008 21:25:09 -0700, Pilcrow posted:

    >>The only such repository I'm familiar with is sourceforge.net. If you
    >>check out their web site, it's pretty obvious how to search it.
    >>Documentation seems to be the norm, not the exception, but I'm sure
    >>that the quality of the documentation is highly variable. I'm sure
    >>that cross-platform compatibility is also highly variable. That's
    >>pretty much unavoidable when source code comes from such a wide
    >>variety of sources.

    >
    > I apologize. I don't think Perl is superior to C. Every Perl
    > programmer, however, knows of the existence of CPAN. I was trying to
    > find how I could find tested solutions in C, similar to the tested
    > solutions of CPAN, so that I don't have to reinvent the wheel with every
    > new task. I will try to explore sourceforge more thoroughly, which I
    > have already used for various utilities.


    You're not going to find CPAN here with the unterlanguage. It requires an
    ecumenism that doesn't exist for C. Not sure why.

    Every time time you "reinvent the wheel," you have to have a caller and a
    target. I find that crossing syntax avoids weaknesses in given syntaxes.

    Now that I think about it, the first reason for the lack of ecumenism is
    history and the second is that there are dozens of competing
    implementations of C while perl competes more convincingly for a
    narrowslice, like sysadmins.
    --
    What men value in this world is not rights but privileges. 7
    H. L. Mencken
     
    Ron Ford, Sep 3, 2008
    #8
  9. Re: UNIX, C, Perl

    On 3 Sep, 07:47, Ron Ford <> wrote:
    > On Tue, 02 Sep 2008 21:25:09 -0700, Pilcrow posted:


    > >>The only such repository I'm familiar with is sourceforge.net. If you
    > >>check out their web site, it's pretty obvious how to search it.
    > >>Documentation seems to be the norm, not the exception, but I'm sure
    > >>that the quality of the documentation is highly variable. I'm sure
    > >>that cross-platform compatibility is also highly variable. That's
    > >>pretty much unavoidable when source code comes from such a wide
    > >>variety of sources.

    >
    > > I apologize.  I don't think Perl is superior to C.  Every Perl
    > > programmer, however, knows of the existence of CPAN.  I was trying to
    > > find how I could find tested solutions in C, similar to the tested
    > > solutions of CPAN,


    C has no equivalent to CPAN. But then CPAN is pretty unique
    to perl. You could say it was one of perl's selling points.


    > > so that I don't have to reinvent the wheel with every
    > > new task.  I will try to explore sourceforge more thoroughly, which I
    > > have already used for various utilities.

    >
    > You're not going to find CPAN here with the unterlanguage.  It requires an
    > ecumenism that doesn't exist for C.  Not sure why.
    >
    > Every time time you "reinvent the wheel," you have to have a caller and a
    > target.  


    >I find that crossing syntax avoids weaknesses in given syntaxes.


    what does that mean? Is it even english?


    > Now that I think about it, the first reason for the lack of ecumenism is
    > history and the second is that there are dozens of competing
    > implementations of C while perl competes more convincingly for a
    > narrowslice, like sysadmins.


    effectivly there is only one perl implementation


    --
    Nick Keighley

    I have found that all ugly things are made by those who strive to make
    something beautiful and that all beautiful things are made by those
    who
    strive to make something useful.
    -- Oscar Wilde
     
    Nick Keighley, Sep 3, 2008
    #9
  10. James Kuyper

    Flash Gordon Guest

    Re: UNIX, C, Perl

    Pilcrow wrote, On 03/09/08 05:25:

    <snip>

    > I apologize. I don't think Perl is superior to C. Every Perl
    > programmer, however, knows of the existence of CPAN. I was trying to
    > find how I could find tested solutions in C, similar to the tested
    > solutions of CPAN, so that I don't have to reinvent the wheel with every
    > new task. I will try to explore sourceforge more thoroughly, which I
    > have already used for various utilities.


    Every Linux distribution comes with shed loads of libraries that are
    accessible through C. Every OS provides a number of system specific
    libraries for doing certain things (such as networking & graphics if the
    system supports them natively, as modern personal computers generally
    do). There are commercially available libraries for a number of tasks if
    you can pay the money and live with the licensing terms. There are
    things like Sourceforge. A number of posters here have their own
    libraries they make available. However, there are things which are
    fundamentally easier in Perl even if you have C libraries to do the
    donkey work for you.

    Oh, and modules in CPAN don't always work on all systems to which Perl
    has been ported (I had some problems with modules on SCO a few years
    back), so C libraries for specific tasks not always being portable to
    everywhere is no different.
    --
    Flash Gordon
     
    Flash Gordon, Sep 3, 2008
    #10
  11. James Kuyper

    Richard Bos Guest

    Re: UNIX, C, Perl

    Pilcrow <> wrote:

    > On Tue, 2 Sep 2008 12:32:15 -0700 (PDT), wrote:
    >
    > >There is no single repository for C libraries which plays the same
    > >role for C that CPAN does for perl, but I would guess that many

    >
    > why do you have to guess? CPAN is so much integrated with Perl, that
    > whenever Perl is installed, the access to CPAN (cpan.pm) is
    > automatically included


    That's a neat trick, given that I've installed PERL on machines without
    internet access.

    Richard
     
    Richard Bos, Sep 3, 2008
    #11
  12. James Kuyper

    Ron Ford Guest

    Re: UNIX, C, Perl

    On Wed, 3 Sep 2008 00:23:52 -0700 (PDT), Nick Keighley posted:

    > On 3 Sep, 07:47, Ron Ford <> wrote:
    >> On Tue, 02 Sep 2008 21:25:09 -0700, Pilcrow posted:

    >
    >>>>The only such repository I'm familiar with is sourceforge.net. If you
    >>>>check out their web site, it's pretty obvious how to search it.
    >>>>Documentation seems to be the norm, not the exception, but I'm sure
    >>>>that the quality of the documentation is highly variable. I'm sure
    >>>>that cross-platform compatibility is also highly variable. That's
    >>>>pretty much unavoidable when source code comes from such a wide
    >>>>variety of sources.

    >>
    >>> I apologize.  I don't think Perl is superior to C.  Every Perl
    >>> programmer, however, knows of the existence of CPAN.  I was trying to
    >>> find how I could find tested solutions in C, similar to the tested
    >>> solutions of CPAN,

    >
    > C has no equivalent to CPAN. But then CPAN is pretty unique
    > to perl. You could say it was one of perl's selling points.


    Absolutely. The rest of us, eg, c, c++, c sharp, c flat, fortran, fortran
    flat and karaoke, best note the strength of perl's syntax.


    >
    >
    >>> so that I don't have to reinvent the wheel with every
    >>> new task.  I will try to explore sourceforge more thoroughly, which I
    >>> have already used for various utilities.

    >>
    >> You're not going to find CPAN here with the unterlanguage.  It requires an
    >> ecumenism that doesn't exist for C.  Not sure why.
    >>
    >> Every time time you "reinvent the wheel," you have to have a caller and a
    >> target.  

    >
    >>I find that crossing syntax avoids weaknesses in given syntaxes.

    >
    > what does that mean? Is it even english?


    Since texans have monopolized vapidity, I'm afraid the answer is yes. I
    can't make the point without posting a syntax which is not c, but that just
    reminds me of texans, the not-constitution oil retards.

    >
    >
    >> Now that I think about it, the first reason for the lack of ecumenism is
    >> history and the second is that there are dozens of competing
    >> implementations of C while perl competes more convincingly for a
    >> narrowslice, like sysadmins.

    >
    > effectivly there is only one perl implementation


    Right.


    --
    We must respect the other fellow's religion, but only in the sense and to
    the extent that we respect his theory that his wife is beautiful and his
    children smart. 5
    H. L. Mencken
     
    Ron Ford, Sep 3, 2008
    #12
  13. James Kuyper

    Ron Ford Guest

    Re: UNIX, C, Perl

    On Wed, 03 Sep 2008 08:27:34 GMT, Richard Bos posted:

    > Pilcrow <> wrote:
    >
    >> On Tue, 2 Sep 2008 12:32:15 -0700 (PDT), wrote:
    >>
    >>>There is no single repository for C libraries which plays the same
    >>>role for C that CPAN does for perl, but I would guess that many

    >>
    >> why do you have to guess? CPAN is so much integrated with Perl, that
    >> whenever Perl is installed, the access to CPAN (cpan.pm) is
    >> automatically included

    >
    > That's a neat trick, given that I've installed PERL on machines without
    > internet access.
    >
    > Richard


    ..pm brings you farther with perl and a net connection than your installs.
    --
    Unquestionably, there is progress. The average American now pays out twice
    as much in taxes as he formerly got in wages. 1
    H. L. Mencken
     
    Ron Ford, Sep 3, 2008
    #13
  14. Re: UNIX, C, Perl

    On 3 Sep, 11:18, Ron Ford <> wrote:
    > On Wed, 3 Sep 2008 00:23:52 -0700 (PDT), Nick Keighley posted:
    > > On 3 Sep, 07:47, Ron Ford <> wrote:
    > >> On Tue, 02 Sep 2008 21:25:09 -0700, Pilcrow posted:


    <snip>

    > >> Every time time you "reinvent the wheel," you have to have a caller and a
    > >> target.  

    >
    > >>I find that crossing syntax avoids weaknesses in given syntaxes.

    >
    > > what does that mean? Is it even english?

    >
    > Since texans have monopolized vapidity, I'm afraid the answer is yes.  I
    > can't make the point without posting a syntax which is not c, but that just
    > reminds me of texans, the not-constitution oil retards.


    since this makes no more sense than the bit I tried to get you clarify
    I assume you don't actaully want to communicate.

    <snip>

    --
    Nick Keighley
     
    Nick Keighley, Sep 3, 2008
    #14
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dpackwood
    Replies:
    3
    Views:
    1,863
  2. Replies:
    12
    Views:
    1,702
    Dave Thompson
    Jan 10, 2005
  3. Replies:
    18
    Views:
    656
    Dave Thompson
    Jan 10, 2005
  4. joe
    Replies:
    8
    Views:
    216
    Matthias Weckman
    Nov 14, 2003
  5. Robert Wallace

    my own perl "dos->unix"/"unix->dos"

    Robert Wallace, Jan 21, 2004, in forum: Perl Misc
    Replies:
    7
    Views:
    312
    Michele Dondi
    Jan 22, 2004
Loading...

Share This Page