home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / gnu / gcc / help / 3051 < prev    next >
Encoding:
Text File  |  1993-01-28  |  3.5 KB  |  111 lines

  1. Xref: sparky gnu.gcc.help:3051 comp.lang.c:20331
  2. Newsgroups: gnu.gcc.help,comp.lang.c
  3. Path: sparky!uunet!boulder!colorado.edu!ejh
  4. From: ejh@khonshu.colorado.edu (Edward J. Hartnett)
  5. Subject: setting up and using the GNU readline library, please help!
  6. Message-ID: <EJH.93Jan28155841@khonshu.colorado.edu>
  7. Sender: news@colorado.edu (The Daily Planet)
  8. Nntp-Posting-Host: khonshu.colorado.edu
  9. Organization: CIRES, University of Colorado
  10. Date: 28 Jan 93 15:58:41
  11. Lines: 98
  12.  
  13.  
  14. I have gotten the readline library which will allow me to have
  15. tcsh-like tab completion of filenames and commands in my C programs,
  16. but I'm having a hard time setting it up and getting it to work. If
  17. anyone could answer any or all of these questions, I sure would
  18. appreciate it!
  19.  
  20. 1 - I went into the doc section and there's a makefile there that will
  21. make the info files for the emacs info system. Here's the relevant
  22. lines from the makefile:
  23.  
  24. readline.info: rlman.texinfo rluser.texinfo rltech.texinfo
  25.     makeinfo rlman.texinfo
  26.  
  27.  
  28. Only problem is that I don't have makeinfo and I don't have rlman.
  29. What are these things? Are they GNU products? Do I need to get them
  30. and install them to use readline?
  31.  
  32. 2 - In the makefile that makes the proper .o files, cc is used instead
  33. of gcc. I have both. Is there any benifit in using one over the other?
  34. It seemed to work fine with cc so I'm assuming that's OK.
  35.  
  36. 3 - I tried to run one of the examples in my readline directory
  37. (actually I made up my own test program) and I got trouble because all
  38. the includes referenced readline/SOMETHING, for example:
  39.  
  40. #include <readline/readline.h>
  41.  
  42. So I moved the readline stuff into a subdirectory of my home
  43. directory, and called the subdirectory readline, then I moved the test
  44. program to my home directory and tried it and it didn't work! I can
  45. (and will) go thru all the .h files and substitute in the complete
  46. path to the readline files, but I'm wondering why this didn't work.
  47. Any ideas?
  48.  
  49.  
  50. 4 - I tried to put together a little test program, but ran into
  51. trouble. I'm a little rusty at C and there's no one around here that
  52. can help, so I throw myself on your mercy. The only part I wrote was
  53. the main which just calls do_gets. I just want to see the tab
  54. completion at work. Here's the program:
  55.  
  56. #include <stdio.h>
  57. #include </home/khonshu/ejh/subs/readline/readline.h>
  58.  
  59.  
  60. /* A static variable for holding the line. */
  61. static char *line_read = (char *)NULL;
  62. char *do_gets ()
  63.  
  64. main()
  65. {
  66.   do_gets();
  67. }
  68.     
  69.  
  70. /*This is the function do_gets which came with the readline library*/
  71. /* Read a string, and return a pointer to it.  Returns NULL on EOF. */
  72. char *do_gets ()
  73. {
  74.   /* If the buffer has already been allocated, return the memory
  75.      to the free pool. */
  76.   if (line_read != (char *)NULL)
  77.     {
  78.       free (line_read);
  79.       line_read = (char *)NULL;
  80.     }
  81.   
  82.   /* Get a line from the user. */
  83.   line_read = readline ("");
  84.   
  85.   /* If the line has any text in it, save it on the history. */
  86.   if (line_read && *line_read)
  87.     add_history (line_read);
  88.   
  89.   return (line_read);
  90. }
  91.  
  92.  
  93. Here's the errors I get doing the compile:
  94.  
  95. make
  96. gcc test_rl.c /home/khonshu/ejh/subs/readline/libreadline.a
  97. test_rl.c:9: parse error before `main'
  98. test_rl.c:18: warning: type mismatch with previous implicit declaration
  99. test_rl.c:11: warning: previous implicit declaration of `do_gets'
  100. test_rl.c:18: warning: `do_gets' was previously implicitly declared to return `int'
  101. *** Error code 1
  102. make: Fatal error: Command failed for target `test_rl'
  103.  
  104.  
  105. Can anyone out there help me?
  106. --
  107.     Don't blame me, I voted against Amendment 2!
  108.  
  109. Edward Hartnett                ejh@khonshu.colorado.edu
  110.  
  111.