summaryrefslogtreecommitdiff
path: root/main/cli.c
AgeCommit message (Collapse)Author
2007-06-14Convert uses of strdup() to ast_strdup()Russell Bryant
(issue #9983, eliel) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@69436 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-06-13Use read/write lock based lists for group counting.Joshua Colp
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@69130 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-06-06Issue 9869 - replace malloc and memset with ast_calloc, and other coding ↵Tilghman Lesher
guidelines changes git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@67864 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-06-05Found a bug where when "core set debug #" is used, the verbosity is read as theMark Michelson
old value instead of the old debug value, leading to an erroneous status message after setting. This was purely a cosmetic issue and had no other underlying problems. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@67557 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-04-25Merged revisions 61805 via svnmerge from Joshua Colp
https://origsvn.digium.com/svn/asterisk/branches/1.4 ................ r61805 | file | 2007-04-25 15:21:54 -0400 (Wed, 25 Apr 2007) | 10 lines Merged revisions 61804 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r61804 | file | 2007-04-25 14:52:50 -0400 (Wed, 25 Apr 2007) | 2 lines Merge rewritten group counting support. No more storing data on the variable list of the channels. That was bad, mmmk? (issue #7497 reported by sabbathbh) ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@61806 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-03-02Add the channel's Language to the "show channel" CLI command and the DumpChanRussell Bryant
application. (issue #9187, Junky) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@57474 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-02-22Merged revisions 56008 via svnmerge from Joshua Colp
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r56008 | file | 2007-02-21 19:35:55 -0500 (Wed, 21 Feb 2007) | 2 lines Print out deprecation notice on usage output of CLI commands. (issue #8925 reported by blitzrage) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@56009 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-02-13This introduces a new dialplan function, DEVSTATE, which allows you to do someRussell Bryant
pretty cool things. First, you can get the device state of anything in the dialplan: NoOp(SIP/mypeer has state ${DEVSTATE(SIP/mypeer)}) NoOp(The conference room 1234 has state ${DEVSTATE(MeetMe:1234)}) Most importantly, this allows you to create custom device states so you can control phone lamps directly from the dialplan. Set(DEVSTATE(Custom:mycustomlamp)=BUSY) ... exten => mycustomlamp,hint,Custom:mycustomlamp git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@54261 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-02-13- Constify the format string passed to ast_cli()Russell Bryant
- Simplify printing out the warranty and license git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@54147 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-01-29Add core show channels count CLI command. (issue #8932 reported by ↵Joshua Colp
mr_mehul_shah) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@52525 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-01-23Cosmetic changes. Make main source files better conform to coding guidelines ↵Joshua Colp
and standards. (issue #8679 reported by johann8384) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@51486 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-01-18Fix filename completion for "module load" and "load" CLI commands.Jason Parker
Issue 8846 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@51249 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-19remove now useless extern declarations.Luigi Rizzo
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48580 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-18convert the final clients of ast_build_string to use ast_str_*()Luigi Rizzo
Now the only module left using it is chan_sip.c git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48559 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-16another conversion from ast_build_str to ast_strLuigi Rizzo
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48517 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-15simplify the ast_dynamic_str_*.... routines byLuigi Rizzo
renaming them to ast_str ... and putting the struct ast_threadstorage pointer into the struct ast_str. This makes the code a lot more readable. At this point we can use these routines also to replace ast_build_string(). git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48510 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-12Make sure tab-completion works even when we have typed a fullyLuigi Rizzo
matching word (e.g. "sip<TAB>"); this is implemented by this one-line change - for (;; dst++, src += n) { + for (;src < argindex; dst++, src += n) { However this code is not exactly trivial to understand, so i am also adding some comments to help figuring out what it does. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48408 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-06Constify a bunch of the usage strings for CLI commands.Russell Bryant
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48302 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-01Merged revisions 48179 via svnmerge from Tilghman Lesher
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r48179 | tilghman | 2006-12-01 13:38:59 -0600 (Fri, 01 Dec 2006) | 2 lines Double-unlock error (reported by blitzrage on IRC) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48180 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-18Move this macro from cli.c to cli.h so apps can use itLuigi Rizzo
without duplicating the macro or the code: /*! * In many cases we need to print singular or plural * words depending on a count. This macro helps us e.g. * printf("we have %d object%s", n, ESS(n)); */ #define ESS(x) ((x) == 1 ? "" : "s") git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47827 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-17remove a debugging messageLuigi Rizzo
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47818 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-17convert "help" to new style,Luigi Rizzo
fix completion of arguments past the first one that i broke earlier today. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47817 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-17standardize "module show [like]"Luigi Rizzo
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47815 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-17describe a bit the patterns that you can have in the commands,Luigi Rizzo
and add support for wildcard (spelled as '%'). On passing fix a bug in the expansion code which was hidden and appeared when implementing the wildcard The fix is just the line 'src != argindex', in case someone wants to test this on 1.4 - but i would just keep this in trunk. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47813 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-17merge the implemenmtation of "core set debug" and "core set verbose".Luigi Rizzo
No externally visible changes. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47790 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-17introduce a bit of regexp support in the internal CLI api.Luigi Rizzo
Now you can specify a cli command as "console autoanswer [on|off]" which means the on|off argument is optional, or "console {mute|unmute}" which means the mute|unmute argument is mandatory. The blocks in [] or {} do not necessarily need to be at the end of the string. Completions for the variant parts are generated automatically. This should significantly simplify the implementation of the various handlers. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47787 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-16remove an unused functionLuigi Rizzo
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47769 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-16reduce indentation on a large function.Luigi Rizzo
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47732 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-16use atomic instructions to update the inuse countersLuigi Rizzo
for CLI entriesC. The lock is not protecting this field. I wonder if the field should be declared 'volatile' as well. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47731 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-16make kevin (and 64 bit machines) happy andLuigi Rizzo
remove a cast from char* to int in handling the return values from new-style handlers. On passing, note that main/loader.c::ast_load_resource() always return 0 so errors are not propagated up. I am not sure this is the intended behaviour. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47727 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-15small simplifications and localization of variables.Luigi Rizzo
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47667 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-15new-style "core show channels"Luigi Rizzo
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47665 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-15more changes to new style of "module load" and "load".Luigi Rizzo
Under FreeBSD, the filename_completion used in the above commands does not work. Not sure why, but on passing i note that the function is part of readline and is not reentrant, so it needs to be fixed one way or another. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47664 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-15move another deprecated command to the new styleLuigi Rizzo
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47663 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-15move "core set debug" to the new style, and remove duplicatedLuigi Rizzo
code for the deprecated handler. On passing fix a long standing bug in find_cli() which would not find the longest match - this part (trivial, basically just update matchlen on a match) must go in 1.4 and possibly 1.2 as well. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47662 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-15one more step cleaning the internal CLI interface:Luigi Rizzo
the NEW_CLI macro now supports extra arguments (to deprecate other commands). use this to implement unload and reload, and remove some unused functions. usual completion fixes (as these function accept multiple arguments). The summary is still a bit inconsistent. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47654 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-15update the internal cli api following comments from kevin.Luigi Rizzo
This change basically simplifies the interface of the new-style handler removing almost all the tricks used in the previous implementation to achieve backward compatibility (which is still present and guaranteed.) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47652 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-14add missing casts and remove an unused function.Luigi Rizzo
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47630 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-14fix completion for "module reload mod_1 mod_2 ... "Luigi Rizzo
(should do the same for the other similar commands, "reload", "module unload" and so on. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47620 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-14partly convert to new style set-verbose, with completion fixesLuigi Rizzo
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47619 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-14replace two deprecated functions with calls to the standard ones,Luigi Rizzo
with fixes to argc/argv git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47616 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-14remove duplicated implementation for a deprecated function, use theLuigi Rizzo
original one instead with appropriate changes in argc/argv. This is not always applicable, but in some simple cases it is. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47614 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-14new-style for 'core show uptime', include 'complete' support and better ↵Luigi Rizzo
error checking git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47609 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-14apply previous fix to old-style cli entries as well.Luigi Rizzo
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47608 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-14fix "core set debug atleast ",Luigi Rizzo
and fix the simple case where a command can have multiple completions, the first ones coming from keywords in previous CLI entries. There is no solution yet for the complex case of N1 completions from a CLI entry, followed by N2 from the next one, and so on, because the _complete() handlers do not tell us how many matches it generates, so we don't know how many to skip when interrogating the other handlers. The only solution is to avoid, as much as possible, multiple CLI entries with the same prefix. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47607 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-14Bring in the improved internal API for the CLI.Luigi Rizzo
WATCH OUT: this changes the binary interface (ABI) for modules, so e.g. users of g729 codecs need a rebuilt module (but read below). The new way to write CLI handlers is described in detail in cli.h, and there are a few converted handlers in cli.c, look for NEW_CLI. After converting a couple of commands i am convinced that it is reasonably convenient to use, and it makes it easier to fix the pending CLI issues. On passing, note a bug with the current 'complete' architecture: if a command is a prefix of multiple CLI entries, we miss some of the possible options. As an example, "core set debug" can continue with "channel" from one CLI entry, and "off" or "atleast" from another one. We address this problem in a separate commit (when i have figured out a fix, that is). ABI issues: I asked Kevin if it was ok to make this change and he said yes. While it would have been possible to make the change without breaking the module ABI, the code would have been more convoluted. I am happy to restore the old ABI (while still being able to use the "new style" handlers) if there is demand. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47606 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-13Return module show to a working state. (issue #8353 reported by jserve)Joshua Colp
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47544 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-13stop looking for new entries when we know we are done.Luigi Rizzo
there is no functional change, so it is not necessary to bother merging this to 1.4 now. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47537 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-13free memory when unregistering an entry.Luigi Rizzo
needs to be merged to 1.4 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47536 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-10A trunk that builds is a productive trunk.Joshua Colp
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47464 65c4cc65-6c06-0410-ace0-fbb531ad65f3