From f65ceb9d8f5cb1a2f1cf0c41b82f118790645872 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 16 Apr 2015 06:57:22 +0200 Subject: m + busname generation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/cmdline.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/cmdline.c') diff --git a/src/cmdline.c b/src/cmdline.c index fbee2d6..40d0136 100644 --- a/src/cmdline.c +++ b/src/cmdline.c @@ -21,11 +21,12 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ +#include "bus.h" + #include #include #include - -#include "bus.h" +#include @@ -108,18 +109,19 @@ int main(int argc, char *argv[]) { bus_t bus; + char *file; argv0 = *argv; /* Create a new bus with selected name. */ if ((argc == 3) && !strcmp(argv[1], "create")) { - t(bus_create(argv[2], 0) ? 0 : -1); + t(bus_create(argv[2], 0, NULL)); /* Create a new bus with random name. */ } else if ((argc == 2) && !strcmp(argv[1], "create")) { - const char *file = bus_create(NULL, 0); - t(file ? 0 : -1); + t(bus_create(NULL, 0, &file)); printf("%s\n", file); + free(file); /* Remove a bus. */ } else if ((argc == 3) && !strcmp(argv[1], "remove")) { -- cgit v1.2.3-70-g09d2