goto success;
}
- if( strncmp(ppsz_command[0], "new", 3 ) == 0 )
+ if( !strcmp(ppsz_command[0], "new") )
{
int i_type;
if( i_command < 3 ) goto syntax_error;
/* Get type */
- if( strncmp(ppsz_command[2], "vod", 3 ) == 0 )
+ if( !strcmp(ppsz_command[2], "vod") )
{
i_type = VOD_TYPE;
}
- else if( strncmp(ppsz_command[2], "broadcast", 9 ) == 0 )
+ else if( !strcmp(ppsz_command[2], "broadcast") )
{
i_type = BROADCAST_TYPE;
}
- else if( strncmp(ppsz_command[2], "schedule", 8 ) == 0 )
+ else if( !strcmp(ppsz_command[2], "schedule") )
{
i_type = SCHEDULE_TYPE;
}
else
{
- p_message = vlm_MessageNew( "new", "%s: Choose between vod, "
- "broadcast or schedule", ppsz_command[1] );
+ p_message =
+ vlm_MessageNew( "new", "%s: Choose between vod, "
+ "broadcast or schedule", ppsz_command[1] );
goto error;
}
/* Check for forbidden media names */
- if( strncmp(ppsz_command[1], "all", 3 ) == 0 ||
- strncmp(ppsz_command[1], "media", 5) == 0 ||
- strncmp(ppsz_command[1], "schedule", 8) == 0 )
+ if( !strcmp(ppsz_command[1], "all") ||
+ !strcmp(ppsz_command[1], "media") ||
+ !strcmp(ppsz_command[1], "schedule") )
{
p_message = vlm_MessageNew( "new", "\"all\", \"media\" and "
- "\"schedule\" are reserved names" );
+ "\"schedule\" are reserved names" );
goto error;
}
/* Properties will be dealt with later on */
}
- else if( strncmp(ppsz_command[0], "setup", 5) == 0 )
+ else if( !strcmp(ppsz_command[0], "setup") )
{
if( i_command < 2 ) goto syntax_error;
/* Properties will be dealt with later on */
}
- else if( strncmp(ppsz_command[0], "del", 3) == 0 )
+ else if( !strcmp(ppsz_command[0], "del") )
{
vlm_media_t *p_media;
vlm_schedule_t *p_schedule;
{
vlm_MediaDelete( p_vlm, p_media, NULL );
}
- else if( strncmp(ppsz_command[1], "media", 5 ) == 0 )
+ else if( !strcmp(ppsz_command[1], "media") )
{
while( p_vlm->i_media ) vlm_MediaDelete( p_vlm, p_vlm->media[0],
NULL );
}
- else if( strncmp(ppsz_command[1], "schedule", 8) == 0 )
+ else if( !strcmp(ppsz_command[1], "schedule") )
{
while( p_vlm->i_schedule )
vlm_ScheduleDelete( p_vlm, p_vlm->schedule[0], NULL );
}
- else if( strncmp(ppsz_command[1], "all", 3 ) == 0 )
+ else if( !strcmp(ppsz_command[1], "all") )
{
while( p_vlm->i_media ) vlm_MediaDelete( p_vlm, p_vlm->media[0],
NULL );
goto success;
}
- else if( strncmp(ppsz_command[0], "show", 4) == 0 )
+ else if( !strcmp(ppsz_command[0], "show") )
{
vlm_media_t *p_media;
vlm_schedule_t *p_schedule;
goto success;
}
- else if( strncmp( ppsz_command[0], "help", 4 ) == 0 )
+ else if( !strcmp(ppsz_command[0], "help") )
{
if( i_command != 1 ) goto syntax_error;
goto success;
}
- else if( strncmp(ppsz_command[0], "control", 7) == 0 )
+ else if( !strcmp(ppsz_command[0], "control") )
{
vlm_media_t *p_media;
char *psz_command, *psz_arg = 0, *psz_instance = 0;
int i_index = 2;
- if( strncmp(ppsz_command[2], "play", 4) &&
- strncmp(ppsz_command[2], "stop", 4) &&
- strncmp(ppsz_command[2], "pause", 5) &&
- strncmp(ppsz_command[2], "seek", 4) )
+ if( strcmp( ppsz_command[2], "play" ) &&
+ strcmp( ppsz_command[2], "stop" ) &&
+ strcmp( ppsz_command[2], "pause" ) &&
+ strcmp( ppsz_command[2], "seek" ) )
{
i_index++;
psz_instance = ppsz_command[2];
}
}
- else if( strncmp(ppsz_command[0], "save", 4) == 0 )
+ else if( !strcmp(ppsz_command[0], "save") )
{
FILE *file;
}
}
- else if( strncmp(ppsz_command[0], "load", 4) == 0 )
+ else if( !strcmp(ppsz_command[0], "load") )
{
FILE *file;
}
/* Common code between "new" and "setup" */
- if( strncmp(ppsz_command[0], "new", 3) == 0 ||
- strncmp(ppsz_command[0], "setup", 5) == 0 )
+ if( !strcmp(ppsz_command[0], "new") ||
+ !strcmp(ppsz_command[0], "setup") )
{
- int i_command_start = strncmp(ppsz_command[0], "new",3 ) ? 2 : 3;
+ int i_command_start = strcmp(ppsz_command[0], "new") ? 2 : 3;
vlm_media_t *p_media;
vlm_schedule_t *p_schedule;
{
for( i = i_command_start ; i < i_command ; i++ )
{
- if( strncmp( ppsz_command[i], "enabled" , 7 ) == 0 ||
- strncmp( ppsz_command[i], "disabled" , 8 ) == 0 )
+ if( !strcmp( ppsz_command[i], "enabled" ) ||
+ !strcmp( ppsz_command[i], "disabled" ) )
{
vlm_ScheduleSetup( p_schedule, ppsz_command[i], NULL );
}
/* Beware: everything behind append is considered as
* command line */
- else if( strncmp( ppsz_command[i], "append", 6 ) == 0 )
+ else if( !strcmp( ppsz_command[i], "append" ) )
{
if( ++i >= i_command ) break;
}
else
{
- if( i + 1 >= i_command && !strncmp(ppsz_command[0],
- "new", 3) )
+ if( i + 1 >= i_command && !strcmp(ppsz_command[0], "new") )
{
vlm_ScheduleDelete( p_vlm, p_schedule, NULL );
- p_message = vlm_MessageNew( ppsz_command[0],
- "Wrong properties syntax" );
+ p_message =
+ vlm_MessageNew( ppsz_command[0],
+ "Wrong properties syntax" );
goto error;
}
else if( i + 1 >= i_command )
{
- p_message = vlm_MessageNew( ppsz_command[0],
- "Wrong properties syntax" );
+ p_message =
+ vlm_MessageNew( ppsz_command[0],
+ "Wrong properties syntax" );
goto error;
}
{
for( i = i_command_start ; i < i_command ; i++ )
{
- if( strncmp( ppsz_command[i], "enabled", 7 ) == 0 ||
- strncmp( ppsz_command[i], "disabled", 8 ) == 0 )
+ if( !strcmp( ppsz_command[i], "enabled" ) ||
+ !strcmp( ppsz_command[i], "disabled" ) )
{
vlm_MediaSetup( p_vlm, p_media, ppsz_command[i], NULL );
}
- else if( i + 1 >= i_command && !strncmp( ppsz_command[i],
- "mux", 3 ) )
+ else if( i + 1 >= i_command &&
+ !strcmp( ppsz_command[i], "mux") )
{
if( p_media->i_type != VOD_TYPE )
{
i++;
}
}
- else if( strncmp( ppsz_command[i], "loop" , 4 ) == 0 ||
- strncmp( ppsz_command[i], "unloop" , 6) == 0 )
+ else if( !strcmp( ppsz_command[i], "loop" ) ||
+ !strcmp( ppsz_command[i], "unloop" ) )
{
if( p_media->i_type != BROADCAST_TYPE )
{
}
else
{
- if( i + 1 >= i_command && !strncmp(ppsz_command[0],
- "new", 3) )
+ if( i + 1 >= i_command &&
+ !strcmp(ppsz_command[0], "new") )
{
vlm_MediaDelete( p_vlm, p_media, NULL );
- p_message = vlm_MessageNew( ppsz_command[0],
- "Wrong properties syntax" );
+ p_message =
+ vlm_MessageNew( ppsz_command[0],
+ "Wrong properties syntax" );
goto error;
}
else if( i + 1 >= i_command )
{
- p_message = vlm_MessageNew( ppsz_command[0],
- "Wrong properties syntax" );
+ p_message =
+ vlm_MessageNew( ppsz_command[0],
+ "Wrong properties syntax" );
goto error;
}
vlm_MediaSetup( p_vlm, p_media, ppsz_command[i],
- ppsz_command[i+1] );
+ ppsz_command[i+1] );
i++;
}
}
{
if( !psz_cmd) return VLC_EGENERIC;
- if( strncmp( psz_cmd, "loop", 4 ) == 0 )
+ if( !strcmp( psz_cmd, "loop" ) )
{
media->b_loop = VLC_TRUE;
}
- else if( strncmp( psz_cmd, "unloop", 6 ) == 0 )
+ else if( !strcmp( psz_cmd, "unloop" ) )
{
media->b_loop = VLC_FALSE;
}
- else if( strncmp( psz_cmd, "enabled", 7 ) == 0 )
+ else if( !strcmp( psz_cmd, "enabled" ) )
{
media->b_enabled = VLC_TRUE;
}
- else if( strncmp( psz_cmd, "disabled", 8 ) == 0 )
+ else if( !strcmp( psz_cmd, "disabled" ) )
{
media->b_enabled = VLC_FALSE;
}
- else if( strncmp( psz_cmd, "mux", 3 ) == 0 )
+ else if( !strcmp( psz_cmd, "mux" ) )
{
if( media->psz_mux ) free( media->psz_mux );
media->psz_mux = NULL;
if( psz_value ) media->psz_mux = strdup( psz_value );
}
- else if( strncmp( psz_cmd, "input" , 5) == 0 )
+ else if( !strcmp( psz_cmd, "input" ) )
{
char *input;
TAB_APPEND( media->i_input, media->input, input );
}
- else if( strncmp( psz_cmd, "output", 6 ) == 0 )
+ else if( !strcmp( psz_cmd, "output" ) )
{
if( media->psz_output != NULL )
{
}
media->psz_output = strdup( psz_value );
}
- else if( strncmp( psz_cmd, "option", 6 ) == 0 )
+ else if( !strcmp( psz_cmd, "option" ) )
{
char *psz_option;
psz_option = strdup( psz_value );
p_instance = vlm_MediaInstanceSearch( vlm, media, psz_id );
- if( strncmp( psz_command, "play", 4 ) == 0 && !p_instance )
+ if( !strcmp( psz_command, "play" ) && !p_instance )
{
if( !media->b_enabled || media->i_input == 0 ) return 0;
if( !p_instance ) return VLC_EGENERIC;
- if( strncmp( psz_command, "seek", 4 ) == 0 )
+ if( !strcmp( psz_command, "seek" ) )
{
vlc_value_t val;
float f_percentage;
return VLC_SUCCESS;
}
}
- else if( strncmp( psz_command, "stop", 4 ) == 0 )
+ else if( !strcmp( psz_command, "stop" ) )
{
TAB_REMOVE( media->i_instance, media->instance, p_instance );
return VLC_SUCCESS;
}
- else if( strncmp( psz_command, "pause", 5 ) == 0 )
+ else if( !strcmp( psz_command, "pause" ) )
{
vlc_value_t val;
static int vlm_ScheduleSetup( vlm_schedule_t *schedule, char *psz_cmd,
char *psz_value )
{
- if( strncmp( psz_cmd, "enabled", 7 ) == 0 )
+ if( !strcmp( psz_cmd, "enabled" ) )
{
schedule->b_enabled = VLC_TRUE;
}
- else if( strncmp( psz_cmd, "disabled", 8 ) == 0 )
+ else if( !strcmp( psz_cmd, "disabled" ) )
{
schedule->b_enabled = VLC_FALSE;
}
#if !defined( UNDER_CE )
- else if( strncmp( psz_cmd, "date", 4 ) == 0 )
+ else if( !strcmp( psz_cmd, "date" ) )
{
struct tm time;
char *p;
/* date should be year/month/day-hour:minutes:seconds */
p = strchr( psz_value, '-' );
- if( strncmp( psz_value, "now", 3 ) == 0 )
+ if( !strcmp( psz_value, "now" ) )
{
schedule->i_date = 0;
}
schedule->i_date = ((mtime_t) date) * 1000000;
}
}
- else if( strncmp( psz_cmd, "period" , 6) == 0 )
+ else if( !strcmp( psz_cmd, "period" ) )
{
struct tm time;
char *p;
schedule->i_period = ((mtime_t) date) * 1000000;
}
#endif /* UNDER_CE */
- else if( strncmp( psz_cmd, "repeat", 6 ) == 0 )
+ else if( !strcmp( psz_cmd, "repeat" ) )
{
int i;
return 1;
}
}
- else if( strncmp( psz_cmd, "append" , 6) == 0 )
+ else if( !strcmp( psz_cmd, "append" ) )
{
char *command = strdup( psz_value );
i_time = i_time / 12;
date.tm_year = (int)i_time;
- snprintf( buffer, 30,"%d/%d/%d-%d:%d:%d", date.tm_year, date.tm_mon,
+ sprintf( buffer, "%d/%d/%d-%d:%d:%d", date.tm_year, date.tm_mon,
date.tm_mday, date.tm_hour, date.tm_min, date.tm_sec);
vlm_MessageAdd( msg_schedule, vlm_MessageNew("period", buffer) );
}
- else if( psz_filter && strncmp( psz_filter, "media" , 5) == 0 )
+ else if( psz_filter && !strcmp( psz_filter, "media" ) )
{
int i, j;
vlm_message_t *msg;
return msg;
}
- else if( psz_filter && strncmp( psz_filter, "schedule", 8) == 0 )
+ else if( psz_filter && !strcmp( psz_filter, "schedule" ) )
{
int i;
vlm_message_t *msg;