aboutsummaryrefslogtreecommitdiffstats
path: root/src/cmdline.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-04-16 06:57:22 +0200
committerMattias Andrée <maandree@operamail.com>2015-04-16 06:57:22 +0200
commitf65ceb9d8f5cb1a2f1cf0c41b82f118790645872 (patch)
treef4d5304fa85016e47f9a89aed39308e673779434 /src/cmdline.c
parentmisc (diff)
downloadbus-f65ceb9d8f5cb1a2f1cf0c41b82f118790645872.tar.gz
bus-f65ceb9d8f5cb1a2f1cf0c41b82f118790645872.tar.bz2
bus-f65ceb9d8f5cb1a2f1cf0c41b82f118790645872.tar.xz
m + busname generation
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/cmdline.c')
-rw-r--r--src/cmdline.c12
1 files changed, 7 insertions, 5 deletions
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 <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-
-#include "bus.h"
+#include <string.h>
@@ -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")) {