X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmiracle%2Fmiracle_commands.c;h=c95a4d04bb44a2de32694b195ab255241739a4c5;hb=8fed66dc54b72d56b6eda6cc266d16eb33979020;hp=4a23e439c2c6a7599f66e85efc62df4906667b03;hpb=9390e8b584f3f717f0a326893c0e37cf187a0a51;p=melted diff --git a/src/miracle/miracle_commands.c b/src/miracle/miracle_commands.c index 4a23e43..c95a4d0 100644 --- a/src/miracle/miracle_commands.c +++ b/src/miracle/miracle_commands.c @@ -94,9 +94,13 @@ response_codes miracle_add_unit( command_argument cmd_arg ) char *arg = cmd_arg->argument; g_units[ i ] = miracle_unit_init( i, arg ); if ( g_units[ i ] != NULL ) + { miracle_unit_set_notifier( g_units[ i ], valerie_parser_get_notifier( cmd_arg->parser ), cmd_arg->root_dir ); - return g_units[ i ] != NULL ? RESPONSE_SUCCESS : RESPONSE_ERROR; + valerie_response_printf( cmd_arg->response, 10, "U%1d\n\n", i ); + } + return g_units[ i ] != NULL ? RESPONSE_SUCCESS_N : RESPONSE_ERROR; } + valerie_response_printf( cmd_arg->response, 1024, "no more units can be created\n\n" ); return RESPONSE_ERROR; } @@ -130,6 +134,7 @@ response_codes miracle_list_units( command_argument cmd_arg ) valerie_response_printf( cmd_arg->response, 1024, "U%d %02d %s %d\n", i, node, constructor, online ); } } + valerie_response_printf( cmd_arg->response, 1024, "\n" ); return error; } @@ -167,7 +172,7 @@ response_codes miracle_list_clips( command_argument cmd_arg ) { snprintf( fullname, 1023, "%s%s/%s", cmd_arg->root_dir, dir_name, de[i]->d_name ); if ( lstat( fullname, &info ) == 0 && - ( S_ISREG( info.st_mode ) || ( strstr( fullname, ".clip" ) && info.st_mode | S_IXUSR ) ) ) + ( S_ISREG( info.st_mode ) || S_ISLNK( info.st_mode ) || ( strstr( fullname, ".clip" ) && info.st_mode | S_IXUSR ) ) ) valerie_response_printf( cmd_arg->response, 1024, "\"%s\" %llu\n", de[i]->d_name, (unsigned long long) info.st_size ); free( de[ i ] ); } @@ -210,7 +215,7 @@ response_codes miracle_set_global_property( command_argument cmd_arg ) strncpy( cmd_arg->root_dir, value, 1023 ); /* add a trailing slash if needed */ - if ( cmd_arg->root_dir[ len - 1 ] != '/') + if ( len && cmd_arg->root_dir[ len - 1 ] != '/') { cmd_arg->root_dir[ len ] = '/'; cmd_arg->root_dir[ len + 1 ] = '\0';