1 /* 2 * Copyright (c) Sylvestre Gallon <ccna.syl@gmail.com> 3 * 4 * Permission to use, copy, modify, and distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 */ 16 17 #include <string.h> 18 #include <fuse_opt.h> 19 20 int 21 main(int ac, char **av) 22 { 23 char *opt = NULL; 24 char *opt2; 25 26 opt2 = strdup("-a,\\,a\\,b\\,c,\\\\\\,\\\\\\,\\,\\,\\,\\\\\\\\\\,"); 27 if (opt2 == NULL) 28 return (0); 29 30 if (fuse_opt_add_opt_escaped(&opt2, "test") != 0) 31 return (1); 32 33 if (fuse_opt_add_opt_escaped(&opt, "-a") != 0) 34 return (1); 35 if (fuse_opt_add_opt_escaped(&opt, ",a,b,c") != 0) 36 return (1); 37 if (fuse_opt_add_opt_escaped(&opt, "\\,\\,,,,\\\\,") != 0) 38 return (1); 39 if (fuse_opt_add_opt_escaped(&opt, "test") != 0) 40 return (1); 41 42 if (fuse_opt_add_opt_escaped(&opt, NULL) != -1) 43 return (1); 44 if (fuse_opt_add_opt_escaped(&opt, "") != -1) 45 return (1); 46 47 return (strcmp(opt, opt2)); 48 } 49 50