Merge mlt++/CUSTOMISING into docs/melted++.
[melted] / src / miracle / miracle_commands.c
index 4a23e43..c95a4d0 100644 (file)
@@ -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';