1*f3de9d7dShelg /* $OpenBSD: fuse-opt-add-opt.c,v 1.3 2018/07/20 12:05:08 helg Exp $ */
24cd66a05Ssyl /*
34cd66a05Ssyl * Copyright (c) Sylvestre Gallon <ccna.syl@gmail.com>
44cd66a05Ssyl *
54cd66a05Ssyl * Permission to use, copy, modify, and distribute this software for any
64cd66a05Ssyl * purpose with or without fee is hereby granted, provided that the above
74cd66a05Ssyl * copyright notice and this permission notice appear in all copies.
84cd66a05Ssyl *
94cd66a05Ssyl * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
104cd66a05Ssyl * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
114cd66a05Ssyl * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
124cd66a05Ssyl * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
134cd66a05Ssyl * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
144cd66a05Ssyl * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
154cd66a05Ssyl * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
164cd66a05Ssyl */
174cd66a05Ssyl
184cd66a05Ssyl #include <string.h>
194cd66a05Ssyl #include <fuse_opt.h>
204cd66a05Ssyl
214cd66a05Ssyl int
main(int ac,char ** av)224cd66a05Ssyl main(int ac, char **av)
234cd66a05Ssyl {
244cd66a05Ssyl char *opt = NULL;
254cd66a05Ssyl char *opt2;
264cd66a05Ssyl
274cd66a05Ssyl opt2 = strdup("-a,--bc,01234,-56789,-o test1");
284cd66a05Ssyl if (opt2 == NULL)
294cd66a05Ssyl return (0);
304cd66a05Ssyl
314cd66a05Ssyl if (fuse_opt_add_opt(&opt2, "test") != 0)
324cd66a05Ssyl return (1);
334cd66a05Ssyl
344cd66a05Ssyl if (fuse_opt_add_opt(&opt, "-a") != 0)
35a8f3d127Smpi return (2);
364cd66a05Ssyl if (fuse_opt_add_opt(&opt, "--bc") != 0)
37a8f3d127Smpi return (3);
384cd66a05Ssyl if (fuse_opt_add_opt(&opt, "01234") != 0)
39a8f3d127Smpi return (4);
404cd66a05Ssyl if (fuse_opt_add_opt(&opt, "-56789") != 0)
41a8f3d127Smpi return (5);
424cd66a05Ssyl if (fuse_opt_add_opt(&opt, "-o test1") != 0)
43a8f3d127Smpi return (6);
444cd66a05Ssyl if (fuse_opt_add_opt(&opt, "test") != 0)
45a8f3d127Smpi return (7);
464cd66a05Ssyl
474cd66a05Ssyl if (fuse_opt_add_opt(&opt, NULL) != -1)
48a8f3d127Smpi return (8);
494cd66a05Ssyl if (fuse_opt_add_opt(&opt, "") != -1)
50a8f3d127Smpi return (9);
514cd66a05Ssyl
524cd66a05Ssyl return (strcmp(opt, opt2));
534cd66a05Ssyl }
544cd66a05Ssyl
55