Commit Graph

53 Commits

Author SHA1 Message Date
Tilghman Lesher 1b2aebad4a Merged revisions 48179 via svnmerge from
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-12-01 19:41:02 +00:00
Luigi Rizzo f148916c23 Move this macro from cli.c to cli.h so apps can use it
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-18 20:08:17 +00:00
Luigi Rizzo 95a99a2469 remove a debugging message
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47818 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-17 22:56:58 +00:00
Luigi Rizzo c32cae7e50 convert "help" to new style,
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-17 22:53:57 +00:00
Luigi Rizzo 619c4ef0ec standardize "module show [like]"
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47815 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-17 22:02:15 +00:00
Luigi Rizzo 4589662f7f describe a bit the patterns that you can have in the commands,
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-17 21:50:55 +00:00
Luigi Rizzo 6f9b6ba0b1 merge the implemenmtation of "core set debug" and "core set verbose".
No externally visible changes.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47790 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-17 12:26:15 +00:00
Luigi Rizzo 867e3d6e5d introduce a bit of regexp support in the internal CLI api.
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-17 11:12:13 +00:00
Luigi Rizzo 0c8f2f1e4c remove an unused function
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47769 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-16 21:57:23 +00:00
Luigi Rizzo 5fb52f8244 reduce indentation on a large function.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47732 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-16 14:58:24 +00:00
Luigi Rizzo e58079b067 use atomic instructions to update the inuse counters
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-16 14:41:28 +00:00
Luigi Rizzo 84a5921ab5 make kevin (and 64 bit machines) happy and
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-16 14:21:30 +00:00
Luigi Rizzo 9ddef9890a small simplifications and localization of variables.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47667 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-15 17:17:07 +00:00
Luigi Rizzo b588fc320e new-style "core show channels"
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47665 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-15 17:05:55 +00:00
Luigi Rizzo db923f638e more changes to new style of "module load" and "load".
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-15 16:39:38 +00:00
Luigi Rizzo f28f07e1b2 move another deprecated command to the new style
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47663 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-15 16:20:23 +00:00
Luigi Rizzo 0e9753f401 move "core set debug" to the new style, and remove duplicated
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-15 16:13:30 +00:00
Luigi Rizzo 6edcca7b8d one more step cleaning the internal CLI interface:
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-15 15:02:56 +00:00
Luigi Rizzo 1781f41b3b update the internal cli api following comments from kevin.
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-15 14:11:28 +00:00
Luigi Rizzo fbcc8f4de2 add missing casts and remove an unused function.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47630 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-14 22:08:20 +00:00
Luigi Rizzo 3d86c80c15 fix completion for "module reload mod_1 mod_2 ... "
(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-14 17:00:39 +00:00
Luigi Rizzo a9259cd8f4 partly convert to new style set-verbose, with completion fixes
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47619 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-14 16:55:27 +00:00
Luigi Rizzo 6e4ed956bc replace two deprecated functions with calls to the standard ones,
with fixes to argc/argv



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47616 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-14 16:38:35 +00:00
Luigi Rizzo dfd4448412 remove duplicated implementation for a deprecated function, use the
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-14 16:31:57 +00:00
Luigi Rizzo abdb8002df new-style for 'core show uptime', include 'complete' support and better error checking
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47609 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-14 16:09:08 +00:00
Luigi Rizzo 7d38228d6e apply previous fix to old-style cli entries as well.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47608 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-14 15:55:18 +00:00
Luigi Rizzo ff5160e35c fix "core set debug atleast ",
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-14 15:39:03 +00:00
Luigi Rizzo fbb143b829 Bring in the improved internal API for the CLI.
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-14 15:23:35 +00:00
Joshua Colp 209628c6e2 Return module show to a working state. (issue #8353 reported by jserve)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47544 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-13 16:41:45 +00:00
Luigi Rizzo 06c9ef6411 stop looking for new entries when we know we are done.
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-13 12:04:05 +00:00
Luigi Rizzo b2e2f3f957 free memory when unregistering an entry.
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-13 12:01:25 +00:00
Joshua Colp 0282cc1a4d A trunk that builds is a productive trunk.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47464 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-10 19:51:15 +00:00
Tilghman Lesher 691363656f Merged revisions 47436 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r47436 | tilghman | 2006-11-10 10:51:55 -0600 (Fri, 10 Nov 2006) | 2 lines

Discussion of these CLI changes resulted in more consistency (Bug 8236)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47439 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-10 17:01:06 +00:00
Russell Bryant 7209032ffe Merged revisions 47377 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r47377 | russell | 2006-11-09 11:28:15 -0500 (Thu, 09 Nov 2006) | 2 lines

fix tab completion for "core debug channel" and "core no debug channel"

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47378 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-09 16:30:06 +00:00
Russell Bryant adf6bb1d9a Merged revisions 47375 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r47375 | russell | 2006-11-09 11:24:02 -0500 (Thu, 09 Nov 2006) | 3 lines

Fix "core show channel".  Also, fix tab completion for both "core show channel"
and "core show channels".

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47376 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-09 16:26:47 +00:00
Russell Bryant 2ea9bb223f Merged revisions 47372 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r47372 | russell | 2006-11-09 11:18:33 -0500 (Thu, 09 Nov 2006) | 3 lines

Fix "core debug channel <whatever>".  I guess someone needs to go through and
audit every CLI command that changed number of arguments ...

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47374 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-09 16:20:43 +00:00
Russell Bryant f3c0a35b6e Merged revisions 47366 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r47366 | russell | 2006-11-09 10:49:39 -0500 (Thu, 09 Nov 2006) | 3 lines

Fix another CLI command, "core show uptime" ...
(issue #8323, reported by johnlange, fixed by myself)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47367 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-09 15:51:15 +00:00
Russell Bryant 18693a45dc Merged revisions 47196 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r47196 | russell | 2006-11-04 13:10:22 -0500 (Sat, 04 Nov 2006) | 2 lines

Fix another bug in "core set debug" ...

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47198 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-04 18:12:31 +00:00
Russell Bryant 9297a1a8f9 Merged revisions 47195 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r47195 | russell | 2006-11-04 12:59:39 -0500 (Sat, 04 Nov 2006) | 2 lines

Really fix the "core set debug" and "core set verbose" CLI commands.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47197 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-04 18:11:18 +00:00
Russell Bryant 7ee7429cf7 Merged revisions 47192 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r47192 | russell | 2006-11-04 12:38:24 -0500 (Sat, 04 Nov 2006) | 3 lines

fix the "atleast" option to the "core set verbose" and "core set debug"
CLI commands

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47193 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-04 17:40:42 +00:00
Luigi Rizzo 55f22da63f Fix "core show channels" and "core show modules".
Not sure it applies like this to 1.4 because of 
deprecate versions of the same command(s).



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47129 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-03 18:13:26 +00:00
Tilghman Lesher 10875731ec Merged revisions 47051 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r47051 | tilghman | 2006-11-02 17:00:20 -0600 (Thu, 02 Nov 2006) | 2 lines

Reverse change of "show" to "list" and make several other commands more consistent with "category verb arguments"

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47052 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-02 23:16:09 +00:00
Kevin P. Fleming 749029de38 Merged revisions 46200 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r46200 | kpfleming | 2006-10-25 09:32:08 -0500 (Wed, 25 Oct 2006) | 2 lines

apparently developers are still not aware that they should be use ast_copy_string instead of strncpy... fix up many more users, and fix some bugs in the process

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46201 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-25 14:44:50 +00:00
Russell Bryant bd53e7ee4c Extend the thread storage API such that a custom initialization function can
be called for each thread specific object after they are allocated.  Note that
there was already the ability to define a custom cleanup function.  Also, if
the custom cleanup function is used, it *MUST* call free on the thread
specific object at the end.  There is no way to have this magically done that
I can think of because the cleanup function registered with the pthread
implementation will only call the function back with a pointer to the
thread specific object, not the parent ast_threadstorage object.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45623 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-19 01:00:57 +00:00
Jason Parker 3ca6a02f89 Merged revisions 44053 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r44053 | qwell | 2006-09-29 15:35:09 -0700 (Fri, 29 Sep 2006) | 3 lines

Fix a bug with the removal of 'atleast' argument to 'core verbose' and 'core debug'.
Add that argument back in.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@44054 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-09-29 22:36:29 +00:00
Kevin P. Fleming 9892363a64 Merged revisions 43978 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r43978 | kpfleming | 2006-09-29 08:45:40 -0500 (Fri, 29 Sep 2006) | 2 lines

proper fix for ast_group_t change

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43979 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-09-29 13:46:33 +00:00
Joshua Colp 550a4dab79 Merged revisions 43913 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r43913 | file | 2006-09-28 13:14:07 -0400 (Thu, 28 Sep 2006) | 2 lines

Warning be gone!

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43914 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-09-28 17:15:38 +00:00
Kevin P. Fleming 8677abe99b Merged revisions 43898 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r43898 | kpfleming | 2006-09-28 11:38:25 -0500 (Thu, 28 Sep 2006) | 10 lines

Merged revisions 43895 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r43895 | kpfleming | 2006-09-28 11:32:44 -0500 (Thu, 28 Sep 2006) | 2 lines

eliminate compiler warning introduced by recent changes

........

................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43900 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-09-28 16:43:40 +00:00
Joshua Colp 98873d34bd Merged revisions 43707 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r43707 | file | 2006-09-26 16:47:26 -0400 (Tue, 26 Sep 2006) | 10 lines

Merged revisions 43705 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r43705 | file | 2006-09-26 16:38:06 -0400 (Tue, 26 Sep 2006) | 2 lines

Use proper type to represent the group variable (issue #8025 reported by makoto)

........

................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43709 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-09-26 20:51:36 +00:00
Jason Parker c2f9a779ac Merged revisions 43492 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r43492 | qwell | 2006-09-22 10:25:05 -0700 (Fri, 22 Sep 2006) | 2 lines

Make sure we explicitly set the CLI command to not be deprecated, if it isn't.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43493 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-09-22 17:26:10 +00:00