Re: file signature

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Richard

    Re: file signature


    "Bill Cunningham" <nospam@nspam.i nvalidwrites:
    I can't use stdc to write a file signature for a file format can I?
    Wouldn't I have to get into the sys calls and maybe even kernel internals to
    do this with lynx. I am going to write a parser soon. But I want to parser
    to have a unique signature in it's header somewhere. 0x7f is I believe the
    signature for linux. I will write a 128 unique number generator in C with
    linux to get the number so it will not conflict with other file types like
    adobe's .pdf and so on. Can anyone suggest any source code to create a file
    signature and what else I might need to do?
    >
    Bill
    By stdc do you mean "standard c" Bill?

    I think you should ask in c.l.c : they are always willing to help people
    with their parsers and 128 unique number generators there!

    Enjoy!

    9/10

    Crosspost & Followup-To: comp.lang.c

    (ps not bad - almost as good as the one where you were telling the lads
    in linux development how you were about to write a device driver!)
  • Nick Keighley

    #2
    Re: file signature

    On 25 Sep, 01:56, Richard<rgr...@ gmail.comwrote:
    "Bill Cunningham" <nos...@nspam.i nvalidwrites:
        I can't use stdc to write a file signature for a file format can I?
    what's a file signature? Do you want a way of deducing the file type
    by reading some sort of meta-data? comp.programmin g is probably
    the place to go. This sort of file signature stuff is highly OS
    dependent.

    Windows: use the file extension
    old Mac OS: stick something in the resource fork of the file
    (yes you would need "kernel" calls for that!)
    unix: uses something called "magic" which is essentially
    stuff at the front of the file
    Wouldn't I have to get into the sys calls and maybe even kernel internals to
    do this with lynx.
    lynx?
    wiki: "The LynxOS RTOS is a Unix-like real-time operating system from
    LynuxWorks (formerly "Lynx Real-Time Systems"). Sometimes known as the
    Lynx Operating System, LynxOS features full POSIX conformance and,
    more recently,
    Linux compatibility. LynxOS is mostly used in real-time embedded
    systems, in applications for avionics, aerospace, the military,
    industrial process
    control and telecommunicati ons."

    I bet you didn't mean that
    I am going to write a parser soon.
    <giggle>
    But I want to parser
    to have a unique signature in it's header somewhere. 0x7f is I believe the
    signature for linux.
    no
    I will write a 128 unique number generator in C with
    linux to get the number so it will not conflict with other file types like
    adobe's .pdf and so on. Can anyone suggest any source code to create a file
    signature and what else I might need to do?
    the simplest think to do on Unix-like system is to put
    some fairly simple text on the first line and hide it
    in a comment. Suppose I was posting something that used ;
    as a comment I could tag my file like this

    ;!/bin/nil

    The perl programming langauge often tags its programs with

    #!/opt/perl5/perl

    the ! sequence tells the shell (the Operating System in effect)
    where to find the correct reader for that file type. Ask on a Unix ng
    for details.


    --
    Nick Keighley

    Comment

    • Richard

      #3
      Re: file signature

      Nick Keighley <nick_keighley_ nospam@hotmail. comwrites:
      On 25 Sep, 01:56, Richard<rgr...@ gmail.comwrote:
      >"Bill Cunningham" <nos...@nspam.i nvalidwrites:
      >
          I can't use stdc to write a file signature for a file format can I?
      >
      what's a file signature? Do you want a way of deducing the file type
      by reading some sort of meta-data? comp.programmin g is probably
      the place to go. This sort of file signature stuff is highly OS
      dependent.
      You did notice that I somewhat mischievously cross posted this from the
      linux application development group didn't you?
      >
      I am going to write a parser soon.
      >
      <giggle>
      And that's why ....

      Comment

      • Richard Heathfield

        #4
        Re: file signature

        Nick Keighley said:
        On 25 Sep, 01:56, Richard<rgr...@ gmail.comwrote:
        >"Bill Cunningham" <nos...@nspam.i nvalidwrites:
        >
        I can't use stdc to write a file signature for a file format can I?
        >
        what's a file signature? Do you want a way of deducing the file type
        by reading some sort of meta-data? comp.programmin g is probably
        the place to go. This sort of file signature stuff is highly OS
        dependent.
        >
        Windows: use the file extension
        No, don't do that.

        I once had to write a program that could tell the difference between PDF
        files and PDF files, because Adobe's johnny-come-lately "Portable Document
        Format" extension clashed horribly with a venerable and ancient vendor's
        "Program Description File" extension. The customer organisation then
        issued my program as the "official" PDF association, and my program
        performed the relevant action for dealing with the PDF (either starting
        the relevant application or aborting if the file format were not
        recognised), depending on whether it was a PDF, a PDF, or of course a PDF.

        --
        Richard Heathfield <http://www.cpax.org.uk >
        Email: -http://www. +rjh@
        Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
        "Usenet is a strange place" - dmr 29 July 1999

        Comment

        • Bill Cunningham

          #5
          Re: file signature


          "Nick Keighley" <nick_keighley_ nospam@hotmail. comwrote in message
          news:e5e3e123-01df-4771-92fa-eeff996a8752@y2 1g2000hsf.googl egroups.com...
          On 25 Sep, 01:56, Richard<rgr...@ gmail.comwrote:
          "Bill Cunningham" <nos...@nspam.i nvalidwrites:
          I can't use stdc to write a file signature for a file format can I?
          what's a file signature? Do you want a way of deducing the file type
          by reading some sort of meta-data? comp.programmin g is probably
          the place to go. This sort of file signature stuff is highly OS
          dependent.

          I believe I want to insert a magic number in an ELF header. Did I post
          this here? I remember comp.prog and col groups I posted it. This is here by
          mistake.

          Bill


          Comment

          • Keith Thompson

            #6
            Re: file signature

            "Bill Cunningham" <nospam@nspam.i nvalidwrites:
            "Nick Keighley" <nick_keighley_ nospam@hotmail. comwrote in message
            news:e5e3e123-01df-4771-92fa-eeff996a8752@y2 1g2000hsf.googl egroups.com...
            On 25 Sep, 01:56, Richard<rgr...@ gmail.comwrote:
            "Bill Cunningham" <nos...@nspam.i nvalidwrites:
            I can't use stdc to write a file signature for a file format can I?
            what's a file signature? Do you want a way of deducing the file type
            by reading some sort of meta-data? comp.programmin g is probably
            the place to go. This sort of file signature stuff is highly OS
            dependent.
            >
            I believe I want to insert a magic number in an ELF header. Did I post
            this here? I remember comp.prog and col groups I posted it. This is here by
            mistake.
            You posted in comp.os.linux.d evelopment.syst em. This is here because
            Richard Nolastname deliberately cross-posted and redirected followups
            to comp.lang.c.

            But as long as it's here, judging by the way you've struggled with the
            most elementary C programs, I suspect what you're attempting is beyond
            your abilities.

            --
            Keith Thompson (The_Other_Keit h) kst-u@mib.org <http://www.ghoti.net/~kst>
            Nokia
            "We must do something. This is something. Therefore, we must do this."
            -- Antony Jay and Jonathan Lynn, "Yes Minister"

            Comment

            • Bill Cunningham

              #7
              Re: file signature


              "Keith Thompson" <kst-u@mib.orgwrote in message
              news:lnej374xld .fsf@nuthaus.mi b.org...
              But as long as it's here, judging by the way you've struggled with the
              most elementary C programs, I suspect what you're attempting is beyond
              your abilities.
              Your quite probably right. I know you are without some kind of tutorial.
              elf.h used data types called uint_t for unsigned ints. I hope it is
              understood what I am wanting to attempt.

              Bill


              Comment

              • Nick Keighley

                #8
                Re: file signature

                On 25 Sep, 16:53, Richard Heathfield <r...@see.sig.i nvalidwrote:
                Nick Keighleysaid:
                >
                On 25 Sep, 01:56, Richard<rgr...@ gmail.comwrote:
                "Bill Cunningham" <nos...@nspam.i nvalidwrites:
                >
                I can't use stdc to write a file signature for a file format can I?
                >
                what's a file signature? Do you want a way of deducing the file type
                by reading some sort of meta-data? comp.programmin g is probably
                the place to go. This sort of file signature stuff is highly OS
                dependent.
                >
                Windows: use the file extension
                >
                No, don't do that.
                I rather meant- that was often what happened. I'm not particularly
                fond of it.

                --
                Nick Keighley

                Comment

                • Keith Thompson

                  #9
                  Re: file signature

                  "Bill Cunningham" <nospam@nspam.i nvalidwrites:
                  "Keith Thompson" <kst-u@mib.orgwrote in message
                  news:lnej374xld .fsf@nuthaus.mi b.org...
                  >But as long as it's here, judging by the way you've struggled with the
                  >most elementary C programs, I suspect what you're attempting is beyond
                  >your abilities.
                  >
                  Your quite probably right. I know you are without some kind of tutorial.
                  elf.h used data types called uint_t for unsigned ints.
                  No, elf.h (at least on my system) doesn't use anything called uint_t.
                  It does use uint16_t, uint32_t, and uint64_t, all of which are
                  declared in the standard header <stdint.h>.
                  I hope it is
                  understood what I am wanting to attempt.
                  I have no idea what you're attempting.

                  --
                  Keith Thompson (The_Other_Keit h) kst-u@mib.org <http://www.ghoti.net/~kst>
                  Nokia
                  "We must do something. This is something. Therefore, we must do this."
                  -- Antony Jay and Jonathan Lynn, "Yes Minister"

                  Comment

                  Working...