Changeset 35d2091 for commands.c
- Timestamp:
- Nov 12, 2010, 8:37:51 AM (13 years ago)
- Branches:
- master, release-1.10, release-1.7, release-1.8, release-1.9
- Children:
- 7473e38b
- Parents:
- 9d21120
- git-author:
- Alex Dehnert <adehnert@mit.edu> (11/11/10 23:04:57)
- git-committer:
- Nelson Elhage <nelhage@mit.edu> (11/12/10 08:37:51)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
commands.c
r1522e5d r35d2091 767 767 "Display an informative message", 768 768 "message <message>", 769 ""), 770 771 OWLCMD_ARGS("add-cmd-history", owl_command_add_cmd_history, OWL_CTX_ANY, 772 "Add a command to the history", 773 "add-cmd-history <cmd>", 774 ""), 775 776 OWLCMD_ARGS("with-history", owl_command_with_history, OWL_CTX_ANY, 777 "Run a command and store it into the history", 778 "with-history <cmd>", 769 779 ""), 770 780 … … 2633 2643 } 2634 2644 2645 char *owl_command_add_cmd_history(int argc, const char *const *argv, const char *buff) 2646 { 2647 owl_history *hist; 2648 const char *ptr; 2649 2650 if (argc < 2) { 2651 owl_function_makemsg("usage: %s <commands> ...", argv[0]); 2652 return NULL; 2653 } 2654 2655 ptr = skiptokens(buff, 1); 2656 hist = owl_global_get_cmd_history(&g); 2657 owl_history_store(hist, ptr); 2658 owl_history_reset(hist); 2659 /* owl_function_makemsg("History '%s' stored successfully", ptr+1); */ 2660 return NULL; 2661 } 2662 2663 char *owl_command_with_history(int argc, const char *const *argv, const char *buff) 2664 { 2665 owl_history *hist; 2666 const char *ptr; 2667 2668 if (argc < 2) { 2669 owl_function_makemsg("usage: %s <commands> ...", argv[2]); 2670 return NULL; 2671 } 2672 2673 ptr = skiptokens(buff, 1); 2674 if (!ptr) { 2675 owl_function_makemsg("Parse error finding command"); 2676 return NULL; 2677 } 2678 2679 hist = owl_global_get_cmd_history(&g); 2680 owl_history_store(hist, ptr); 2681 owl_history_reset(hist); 2682 return owl_function_command(ptr); 2683 } 2684 2635 2685 void owl_command_yes(void) 2636 2686 {
Note: See TracChangeset
for help on using the changeset viewer.