How to do the completion of the cmmandds in C

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • madhumathikv
    New Member
    • Aug 2007
    • 11

    How to do the completion of the cmmandds in C

    Hi,
    How to do completion of the commands..
    For example there are commands in linux such as


    $svn [tab][tab]

    it will display
    svnadmin svndiff svndumpfilter svnlook svnpath svnserve svnsync svnversion



    How to implement this in C.
    please any one help.
    Thanks,

    Madhu
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    That is a function of the operating system not the program, and therefore not the C/C++ code.

    As far as I am aware Linux and Windows do this, other OS's may to.

    Comment

    • madhumathikv
      New Member
      • Aug 2007
      • 11

      #3
      Hi,
      I know it OS dependent... But in my project , I should do the implementation of it..
      I am asking whether any in-built method is there to do that completion..






      Originally posted by Banfa
      That is a function of the operating system not the program, and therefore not the C/C++ code.

      As far as I am aware Linux and Windows do this, other OS's may to.

      Comment

      • oler1s
        Recognized Expert Contributor
        • Aug 2007
        • 671

        #4
        Originally posted by madhumathikv
        Hi,
        I know it OS dependent... But in my project , I should do the implementation of it..
        I am asking whether any in-built method is there to do that completion..
        No. There is no method that equates to a program that can do auto command completion.

        Comment

        • RRick
          Recognized Expert Contributor
          • Feb 2007
          • 463

          #5
          GNU (in linux) has a library that performs command line history and autocompletion. This library can be called from C programs.

          Take a look at http://tiswww.case.edu/php/chet/readline/rltop.html for more info.

          Comment

          • Motoma
            Recognized Expert Specialist
            • Jan 2007
            • 3236

            #6
            Originally posted by madhumathikv
            Hi,
            How to do completion of the commands..
            For example there are commands in linux such as


            $svn [tab][tab]

            it will display
            svnadmin svndiff svndumpfilter svnlook svnpath svnserve svnsync svnversion



            How to implement this in C.
            please any one help.
            Thanks,

            Madhu
            One way to implement this would be to capture keystrokes (without printing them), compile a list of all executable files in your $PATH directories, and apply regular expressions (or simple string comparison) to that list with the string that has been entered already.

            Comment

            Working...