More formatting cleanups.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3337 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
James Golovich
2004-06-29 04:42:19 +00:00
parent 560068617a
commit 3d0e3d3c0f
6 changed files with 222 additions and 236 deletions

View File

@@ -216,7 +216,6 @@ static void ast_network_puts(const char *string)
} }
} }
/* /*
* write the string to the console, and all attached * write the string to the console, and all attached
* console clients * console clients

View File

@@ -41,6 +41,7 @@ static int syslog_level_map[] = {
LOG_ERR, LOG_ERR,
LOG_DEBUG LOG_DEBUG
}; };
#define SYSLOG_NLEVELS 6 #define SYSLOG_NLEVELS 6
#include <asterisk/logger.h> #include <asterisk/logger.h>
@@ -389,7 +390,8 @@ static struct ast_cli_entry rotate_logger_cli =
handle_logger_rotate, "Rotates and reopens the log files", handle_logger_rotate, "Rotates and reopens the log files",
logger_rotate_help }; logger_rotate_help };
static int handle_SIGXFSZ(int sig) { static int handle_SIGXFSZ(int sig)
{
/* Indicate need to reload */ /* Indicate need to reload */
pending_logger_reload = 1; pending_logger_reload = 1;
return 0; return 0;
@@ -446,7 +448,8 @@ void close_logger(void)
return; return;
} }
static void ast_log_vsyslog(int level, const char *file, int line, const char *function, const char *fmt, va_list args) { static void ast_log_vsyslog(int level, const char *file, int line, const char *function, const char *fmt, va_list args)
{
char buf[BUFSIZ]; char buf[BUFSIZ];
if (level >= SYSLOG_NLEVELS) { if (level >= SYSLOG_NLEVELS) {
@@ -489,7 +492,6 @@ void ast_log(int level, const char *file, int line, const char *function, const
localtime_r(&t, &tm); localtime_r(&t, &tm);
strftime(date, sizeof(date), dateformat, &tm); strftime(date, sizeof(date), dateformat, &tm);
if (level == __LOG_EVENT) { if (level == __LOG_EVENT) {
va_start(ap, fmt); va_start(ap, fmt);

View File

@@ -174,6 +174,7 @@ int ast_monitor_stop( struct ast_channel *chan, int need_lock )
{ {
char *execute; char *execute;
int soxmix =0; int soxmix =0;
if (need_lock) { if (need_lock) {
if (ast_mutex_lock(&chan->lock)) { if (ast_mutex_lock(&chan->lock)) {
ast_log(LOG_WARNING, "Unable to lock channel\n"); ast_log(LOG_WARNING, "Unable to lock channel\n");
@@ -193,29 +194,23 @@ int ast_monitor_stop( struct ast_channel *chan, int need_lock )
if (chan->monitor->filename_changed&&strlen(chan->monitor->filename_base)) { if (chan->monitor->filename_changed&&strlen(chan->monitor->filename_base)) {
if (ast_fileexists(chan->monitor->read_filename,NULL,NULL) > 0 ) { if (ast_fileexists(chan->monitor->read_filename,NULL,NULL) > 0 ) {
snprintf( filename, FILENAME_MAX, "%s-in", snprintf(filename, FILENAME_MAX, "%s-in", chan->monitor->filename_base);
chan->monitor->filename_base );
if (ast_fileexists( filename, NULL, NULL ) > 0) { if (ast_fileexists( filename, NULL, NULL ) > 0) {
ast_filedelete( filename, NULL ); ast_filedelete( filename, NULL );
} }
ast_filerename( chan->monitor->read_filename, filename, ast_filerename(chan->monitor->read_filename, filename, chan->monitor->format );
chan->monitor->format );
} else { } else {
ast_log( LOG_WARNING, "File %s not found\n", ast_log(LOG_WARNING, "File %s not found\n", chan->monitor->read_filename );
chan->monitor->read_filename );
} }
if (ast_fileexists(chan->monitor->write_filename,NULL,NULL) > 0) { if (ast_fileexists(chan->monitor->write_filename,NULL,NULL) > 0) {
snprintf( filename, FILENAME_MAX, "%s-out", snprintf(filename, FILENAME_MAX, "%s-out", chan->monitor->filename_base );
chan->monitor->filename_base );
if (ast_fileexists(filename, NULL, NULL) > 0 ) { if (ast_fileexists(filename, NULL, NULL) > 0 ) {
ast_filedelete(filename, NULL); ast_filedelete(filename, NULL);
} }
ast_filerename( chan->monitor->write_filename, filename, ast_filerename(chan->monitor->write_filename, filename, chan->monitor->format );
chan->monitor->format );
} else { } else {
ast_log( LOG_WARNING, "File %s not found\n", ast_log(LOG_WARNING, "File %s not found\n", chan->monitor->write_filename );
chan->monitor->write_filename );
} }
} }
@@ -248,21 +243,17 @@ int ast_monitor_stop( struct ast_channel *chan, int need_lock )
chan->monitor = NULL; chan->monitor = NULL;
} }
if( need_lock ) { if (need_lock)
ast_mutex_unlock(&chan->lock); ast_mutex_unlock(&chan->lock);
}
return 0; return 0;
} }
/* Change monitoring filename of a channel */ /* Change monitoring filename of a channel */
int ast_monitor_change_fname( struct ast_channel *chan, int ast_monitor_change_fname(struct ast_channel *chan, const char *fname_base, int need_lock)
const char *fname_base, int need_lock )
{ {
char tmp[256]; char tmp[256];
if ((!fname_base) || (!strlen(fname_base))) { if ((!fname_base) || (!strlen(fname_base))) {
ast_log( LOG_WARNING, ast_log(LOG_WARNING, "Cannot change monitor filename of channel %s to null", chan->name );
"Cannot change monitor filename of channel %s to null",
chan->name );
return -1; return -1;
} }
@@ -283,18 +274,14 @@ int ast_monitor_change_fname( struct ast_channel *chan,
system(tmp); system(tmp);
} }
snprintf( chan->monitor->filename_base, FILENAME_MAX, "%s/%s", snprintf(chan->monitor->filename_base, FILENAME_MAX, "%s/%s", directory ? "" : AST_MONITOR_DIR, fname_base );
directory ? "" : AST_MONITOR_DIR, fname_base );
} else { } else {
ast_log( LOG_WARNING, ast_log(LOG_WARNING, "Cannot change monitor filename of channel %s to %s, monitoring not started", chan->name, fname_base );
"Cannot change monitor filename of channel %s to %s, monitoring not started",
chan->name, fname_base );
} }
if( need_lock ) { if (need_lock)
ast_mutex_unlock(&chan->lock); ast_mutex_unlock(&chan->lock);
}
return 0; return 0;
} }
@@ -326,14 +313,12 @@ static int start_monitor_exec(struct ast_channel *chan, void *data)
} }
res = ast_monitor_start(chan, format, fname_base, 1); res = ast_monitor_start(chan, format, fname_base, 1);
if( res < 0 ) { if (res < 0)
res = ast_monitor_change_fname( chan, fname_base, 1 ); res = ast_monitor_change_fname( chan, fname_base, 1 );
}
ast_monitor_setjoinfiles(chan, joinfiles); ast_monitor_setjoinfiles(chan, joinfiles);
if( arg ) { if (arg)
free( arg ); free( arg );
}
return res; return res;
} }