aboutsummaryrefslogtreecommitdiffstats
path: root/asterisk.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-07-12 13:54:10 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-07-12 13:54:10 +0000
commitae2d1543f2dfd6833d84c1cef442172c7b06ee17 (patch)
tree217d817a6525bafc7759955c597eba0e86f272a5 /asterisk.c
parent385ad924dd71eb8cc5c9869c0e14c4c398d6bcf1 (diff)
remove some more bad examples of using printf
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@37419 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'asterisk.c')
-rw-r--r--asterisk.c62
1 files changed, 25 insertions, 37 deletions
diff --git a/asterisk.c b/asterisk.c
index abb0a4392..1c5218685 100644
--- a/asterisk.c
+++ b/asterisk.c
@@ -734,15 +734,9 @@ static int ast_tryconnect(void)
Called by soft_hangup to interrupt the poll, read, or other
system call. We don't actually need to do anything though.
Remember: Cannot EVER ast_log from within a signal handler
- SLD: seems to be some pthread activity relating to the printf anyway:
- which is leading to a deadlock?
*/
static void urg_handler(int num)
{
-#if 0
- if (option_debug > 2)
- printf("-- Asterisk Urgent handler\n");
-#endif
signal(num, urg_handler);
return;
}
@@ -1000,46 +994,40 @@ static void consolehandler(char *s)
{
printf(term_end());
fflush(stdout);
+
/* Called when readline data is available */
- if (s && !ast_all_zeros(s))
+ if (!ast_all_zeros(s))
ast_el_add_history(s);
- /* Give the console access to the shell */
- if (s) {
- /* The real handler for bang */
- if (s[0] == '!') {
- if (s[1])
- ast_safe_system(s+1);
- else
- ast_safe_system(getenv("SHELL") ? getenv("SHELL") : "/bin/sh");
- } else
+ /* The real handler for bang */
+ if (s[0] == '!') {
+ if (s[1])
+ ast_safe_system(s+1);
+ else
+ ast_safe_system(getenv("SHELL") ? getenv("SHELL") : "/bin/sh");
+ } else
ast_cli_command(STDOUT_FILENO, s);
- } else
- fprintf(stdout, "\nUse \"quit\" to exit\n");
}
static int remoteconsolehandler(char *s)
{
int ret = 0;
+
/* Called when readline data is available */
- if (s && !ast_all_zeros(s))
+ if (!ast_all_zeros(s))
ast_el_add_history(s);
- /* Give the console access to the shell */
- if (s) {
- /* The real handler for bang */
- if (s[0] == '!') {
- if (s[1])
- ast_safe_system(s+1);
- else
- ast_safe_system(getenv("SHELL") ? getenv("SHELL") : "/bin/sh");
- ret = 1;
- }
- if ((strncasecmp(s, "quit", 4) == 0 || strncasecmp(s, "exit", 4) == 0) &&
- (s[4] == '\0' || isspace(s[4]))) {
- quit_handler(0, 0, 0, 0);
- ret = 1;
- }
- } else
- fprintf(stdout, "\nUse \"quit\" to exit\n");
+ /* The real handler for bang */
+ if (s[0] == '!') {
+ if (s[1])
+ ast_safe_system(s+1);
+ else
+ ast_safe_system(getenv("SHELL") ? getenv("SHELL") : "/bin/sh");
+ ret = 1;
+ }
+ if ((strncasecmp(s, "quit", 4) == 0 || strncasecmp(s, "exit", 4) == 0) &&
+ (s[4] == '\0' || isspace(s[4]))) {
+ quit_handler(0, 0, 0, 0);
+ ret = 1;
+ }
return ret;
}
@@ -2431,7 +2419,7 @@ int main(int argc, char *argv[])
consolehandler((char *)buf);
} else {
if (write(STDOUT_FILENO, "\nUse EXIT or QUIT to exit the asterisk console\n",
- strlen("\nUse EXIT or QUIT to exit the asterisk console\n")) < 0) {
+ strlen("\nUse EXIT or QUIT to exit the asterisk console\n")) < 0) {
/* Whoa, stdout disappeared from under us... Make /dev/null's */
int fd;
fd = open("/dev/null", O_RDWR);