home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / alt / sources / d / 1424 < prev    next >
Encoding:
Internet Message Format  |  1992-11-17  |  3.7 KB

  1. Path: sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!spool.mu.edu!olivea!charnel!psgrain!hippo!ucthpx!aim1!aim1!gram
  2. From: gram@aim1.aztec.co.za (Graham Wheeler)
  3. Newsgroups: alt.sources.d
  4. Subject: Pick/ Gram's Commander
  5. Message-ID: <gram.721999904@aim1>
  6. Date: 17 Nov 92 11:31:44 GMT
  7. Organization: Aztec Information Management
  8. Lines: 72
  9.  
  10. Hi all
  11.  
  12. I have recently finished pick v2.1, which includes, amongst other things, the
  13. ability to read a list of arguments from standard input and write them to
  14. standard output; that is, you can now use pick as an interactive filter!
  15.  
  16. Also, pick inspired me to write Gram's Commander. I did this last weekend;
  17. it is a lot like the Norton Commander, and works great. This weekend
  18. I wrote version 2, which is completely user-configurable. You can create 
  19. your own commands, and assign them to whichever key you like. A couple
  20. of examples:
  21.  
  22. KEY ^M 40 41 42 43 44 45 46 47 48 49     "Do file dependent action on current file"
  23. MKEY D 0 51 17 18     "Delete the selected files/directories"
  24. KEY d 17 18     "Delete the current file or directory"
  25. KEY \F 50     "Find files matching pattern"
  26.  
  27. 17    : o    : d    ::    @QDeleting@ : rmdir @f : @i(read) : @i(paint)
  28. 18    :     : rxl    ::    @QDeleting@ : @U@ : @i(read) : @i(paint)
  29. 42    :     : rl    :[Mm]akefile:    make -f @f @cMake what? @:@i(wait): @i(read) : @i(paint)
  30. 50    :     :     ::        find . -name '@cPattern? @' -print| @EPAGER@/bin/pg@ : rm @t : @i(clr) :@i(paint)
  31. 51    :     :     ::        @i(read) :@i(paint)
  32.  
  33. These come from the default setup. The first four lines specify that the ENTER
  34. key is associated with commands 40 through 49, the d key with commands 17
  35. and 18, and the F key (escaped to distinguish it from F1, F2, etc) is 
  36. associated with command 50. The text strings are the help that will be shown
  37. when the help command is executed.
  38.  
  39. MKEY D specifies that D is a multi-key; that is, the action associated with
  40. this key is:
  41.  
  42.     execute command 0 (no command)
  43.     loop through each selected file, setting @f to be the file name,
  44.         and execute either command 17 or command 18
  45.     execute command 51
  46.  
  47. The entries beginning with numbers are the actual commands. Looking at 17 and
  48. 18, the `d' and `rxl' implies that command 18 can be applied to regular,
  49. executable and link files, while 17 can be applied to directories only.
  50. In the former case, the internal @U@ action is used (an unlink (2)), while
  51. in the latter case a `sh rmdir' is used. In each case, the directory is
  52. reread and the screen is repainted (actually these commands are disabled 
  53. while in the body of an MKEY loop), and finally action 51 is done (which
  54. *does* read the directory and repaint the screen). The reason 17 and 18 
  55. include a reread and repaint is that they are also used with key `d' to
  56. remove individual files.
  57.  
  58. It is quite ugly, and in version 3 it will be a lot cleaner and more 
  59. powerful, but it is still quite useable. I will post it soon, but I would
  60. like to port it to some more platforms first. So, some questions:
  61.  
  62. * does anyone have a program that will take ANSI C and convert the
  63.     prototypes to #ifdef ANSI C (original) #else (KI&R style) #endif
  64.     constructs (the ansi2knr that comes with Ghostscript seems to
  65.     do nothing at all)
  66.  
  67. * is anyone out there interested in testing/porting this to their (preferably
  68.     SVR3 or BSD) platform, and letting me know what changes were needed?
  69.  
  70. Note that the program currently runs on SVR4/386 and SCO SVR3.2.
  71.  
  72. Please reply soon, as I would like to get this done by next week.
  73.  
  74. Cheers
  75. Graham
  76.  
  77. -- 
  78. Graham Wheeler                     | "That which is weak conquers the strong,
  79. Network Systems Programmer         | that which is soft conquers the hard."
  80. Aztec Information Management       |         Lao Tzu - Tao Te Ching Ch. 78
  81. gram@aim1.aztec.co.za              | There's no justice, there's just us
  82.