Lines Matching +full:0 +full:xbe
44 CMD_ADD = 0,
54 typedef int (*cmd_func_t)(int argc, char *argv[], ximgact_binmisc_entry_t *xbe);
56 int add_cmd(int argc, char *argv[], ximgact_binmisc_entry_t *xbe);
57 int name_cmd(int argc, char *argv[], ximgact_binmisc_entry_t *xbe);
58 int noname_cmd(int argc, char *argv[], ximgact_binmisc_entry_t *xbe);
124 { NULL, 0, NULL, 0 }
141 int error = 0; in usage()
152 for(i = 0; i < nitems(cmds); i++) { in usage()
183 printxbe(ximgact_binmisc_entry_t *xbe) in printxbe() argument
185 uint32_t i, flags = xbe->xbe_flags; in printxbe()
187 if (xbe->xbe_version != IBE_VERSION) { in printxbe()
188 fprintf(stderr, "Error: XBE version mismatch\n"); in printxbe()
192 printf("name: %s\n", xbe->xbe_name); in printxbe()
193 printf("interpreter: %s\n", xbe->xbe_interpreter); in printxbe()
197 printf("magic size: %u\n", xbe->xbe_msize); in printxbe()
198 printf("magic offset: %u\n", xbe->xbe_moffset); in printxbe()
201 for(i = 0; i < xbe->xbe_msize; i++) { in printxbe()
207 printf("0x%02x ", xbe->xbe_magic[i]); in printxbe()
213 for(i = 0; i < xbe->xbe_msize; i++) { in printxbe()
219 printf("0x%02x ", xbe->xbe_mask[i]); in printxbe()
235 for(i = 0; i < nitems(cmds); i++) { in demux_cmd()
236 if (!strcasecmp(cmds[i].name, argv[0])) { in demux_cmd()
249 size_t cnt = 0; in strlit2bin_cpy()
251 while((c = *s++) != '\0') { in strlit2bin_cpy()
262 *d = (c - (isdigit(c) ? '0' : ('A' - 10))) << 4; in strlit2bin_cpy()
264 *d++ |= c - (isdigit(c) ? '0' : ('A' - 10)); in strlit2bin_cpy()
281 add_cmd(__unused int argc, char *argv[], ximgact_binmisc_entry_t *xbe) in add_cmd() argument
287 if (argc == 0) in add_cmd()
289 if (strlen(argv[0]) > IBE_NAME_MAX) in add_cmd()
292 strlcpy(&xbe->xbe_name[0], argv[0], IBE_NAME_MAX); in add_cmd()
299 getoptstr(xbe->xbe_interpreter, IBE_INTERP_LEN_MAX, in add_cmd()
311 xbe->xbe_flags |= IBF_USE_MASK; in add_cmd()
315 xbe->xbe_flags |= IBF_ENABLED; in add_cmd()
319 xbe->xbe_moffset = atol(optarg); in add_cmd()
323 xbe->xbe_msize = atol(optarg); in add_cmd()
324 if (xbe->xbe_msize == 0 || in add_cmd()
325 xbe->xbe_msize > IBE_MAGIC_MAX) in add_cmd()
327 "(Must be > 0 and < %u.)\n", in add_cmd()
328 xbe->xbe_msize); in add_cmd()
332 xbe->xbe_flags |= IBF_PRE_OPEN; in add_cmd()
340 if (xbe->xbe_msize == 0) { in add_cmd()
349 if (xbe->xbe_msize == 0) { in add_cmd()
356 sz = strlit2bin_cpy(xbe->xbe_magic, magic, IBE_MAGIC_MAX); in add_cmd()
358 if (sz == -1 || (uint32_t)sz != xbe->xbe_msize) { in add_cmd()
364 sz = strlit2bin_cpy(xbe->xbe_mask, mask, IBE_MAGIC_MAX); in add_cmd()
366 if (sz == -1 || (uint32_t)sz != xbe->xbe_msize) in add_cmd()
375 if (!strnlen(xbe->xbe_interpreter, IBE_INTERP_LEN_MAX)) { in add_cmd()
379 return (0); in add_cmd()
383 name_cmd(int argc, char *argv[], ximgact_binmisc_entry_t *xbe) in name_cmd() argument
385 if (argc == 0) in name_cmd()
387 if (strlen(argv[0]) > IBE_NAME_MAX) in name_cmd()
390 strlcpy(&xbe->xbe_name[0], argv[0], IBE_NAME_MAX); in name_cmd()
392 return (0); in name_cmd()
397 __unused ximgact_binmisc_entry_t *xbe) in noname_cmd() argument
400 return (0); in noname_cmd()
406 int error = 0, cmd = -1; in main()
409 size_t xbe_in_sz = 0; in main()
410 size_t xbe_out_sz = 0, *xbe_out_szp = NULL; in main()
428 if (cmd < 0) in main()
429 usage("Error: Unknown command \"%s\"", argv[0]); in main()
488 if (cmd == CMD_LIST && xbe_out_sz > 0) { in main()
495 &xbe_out_sz, NULL, 0); in main()
514 for(i = 0; i < howmany(xbe_out_sz, sizeof(xbe_out)); i++) in main()