void Tag_Tree::debug() { cout<<"show tags-----------------------------"<<endl; int size1=this->tags.size(); for(int i=0;i<size1;i++) { cout<<"th:"<<i<<">>>>"<<endl; cout<<"tag "<<this->tags.arr[i]<<endl; cout<<"tag.name "<<(*this->tags.arr[i]).name<<endl; cout<<"tag.pre "<<(*this->tags.arr[i]).pre<<endl; cout<<"tag.fol "<<(*this->tags.arr[i]).folow<<endl; cout<<"tag.left:tag.right "<<(*this->tags.arr[i]).left<<" "<<(*this->tags.arr[i]).right<<endl; } const int size2=this->attrs.size(); for(int j=0;j<size2;j++) { cout<<"th:"<<j<<">>>>"<<endl; cout<<"attr.name "<<(*(this->attrs.arr[j])).name<<endl; cout<<"attr.value "<<(*(this->attrs.arr[j])).value<<endl; } cout<<"show tags-----------------------------"<<endl; cout<<"show tags-----------------------------"<<endl; for(int j=0;j<size1;j++) { cout<<"tags.name "<<(*(this->tags.arr[j])).name<<endl; show_child(this->tags.arr[j]) ; cout<<"show attrs---------" <<endl; show_attr(this->tags.arr[j]) ; } }
int Xshow(cmd_t *cmd) { if (strlen(cmd->args) == 0) show(); else show_attr(&cmd->args[0]); return (CMD_CONT); }
int main(int argc, char *argv[]) { if (argc != 2) { printf("Usage: ./ls xxx\n"); return; } show_attr(argv[1]); }
static void show_symbol (gfc_symbol *sym) { gfc_formal_arglist *formal; gfc_interface *intr; int i,len; if (sym == NULL) return; fprintf (dumpfile, "|| symbol: '%s' ", sym->name); len = strlen (sym->name); for (i=len; i<12; i++) fputc(' ', dumpfile); ++show_level; show_indent (); fputs ("type spec : ", dumpfile); show_typespec (&sym->ts); show_indent (); fputs ("attributes: ", dumpfile); show_attr (&sym->attr, sym->module); if (sym->value) { show_indent (); fputs ("value: ", dumpfile); show_expr (sym->value); } if (sym->as) { show_indent (); fputs ("Array spec:", dumpfile); show_array_spec (sym->as); } if (sym->generic) { show_indent (); fputs ("Generic interfaces:", dumpfile); for (intr = sym->generic; intr; intr = intr->next) fprintf (dumpfile, " %s", intr->sym->name); } if (sym->result) { show_indent (); fprintf (dumpfile, "result: %s", sym->result->name); } if (sym->components) { show_indent (); fputs ("components: ", dumpfile); show_components (sym); } if (sym->f2k_derived) { show_indent (); if (sym->hash_value) fprintf (dumpfile, "hash: %d", sym->hash_value); show_f2k_derived (sym->f2k_derived); } if (sym->formal) { show_indent (); fputs ("Formal arglist:", dumpfile); for (formal = sym->formal; formal; formal = formal->next) { if (formal->sym != NULL) fprintf (dumpfile, " %s", formal->sym->name); else fputs (" [Alt Return]", dumpfile); } } if (sym->formal_ns && (sym->formal_ns->proc_name != sym) && sym->attr.proc != PROC_ST_FUNCTION && !sym->attr.entry) { show_indent (); fputs ("Formal namespace", dumpfile); show_namespace (sym->formal_ns); } --show_level; }
static void do_args(int argc, char *argv[]) { char *name = "", *value = "", *filter = ""; char *pool = NULL, *identity = NULL, *addresses = NULL; value_type_t value_type = VALUE_NONE; int timeout = 0; bool utc = FALSE, hexout = FALSE; enum { OP_UNDEF, OP_USAGE, OP_STATUS, OP_STATUS_ATTR, OP_ADD, OP_ADD_ATTR, OP_DEL, OP_DEL_ATTR, OP_SHOW_ATTR, OP_RESIZE, OP_LEASES, OP_PURGE, OP_BATCH } operation = OP_UNDEF; /* reinit getopt state */ optind = 0; while (TRUE) { int c; struct option long_opts[] = { { "help", no_argument, NULL, 'h' }, { "utc", no_argument, NULL, 'u' }, { "status", no_argument, NULL, 'w' }, { "add", required_argument, NULL, 'a' }, { "replace", required_argument, NULL, 'c' }, { "del", required_argument, NULL, 'd' }, { "resize", required_argument, NULL, 'r' }, { "leases", no_argument, NULL, 'l' }, { "purge", required_argument, NULL, 'p' }, { "statusattr", no_argument, NULL, '1' }, { "addattr", required_argument, NULL, '2' }, { "delattr", required_argument, NULL, '3' }, { "showattr", no_argument, NULL, '4' }, { "batch", required_argument, NULL, 'b' }, { "start", required_argument, NULL, 's' }, { "end", required_argument, NULL, 'e' }, { "addresses", required_argument, NULL, 'y' }, { "timeout", required_argument, NULL, 't' }, { "filter", required_argument, NULL, 'f' }, { "addr", required_argument, NULL, 'v' }, { "mask", required_argument, NULL, 'v' }, { "server", required_argument, NULL, 'v' }, { "subnet", required_argument, NULL, 'n' }, { "string", required_argument, NULL, 'g' }, { "hex", required_argument, NULL, 'x' }, { "hexout", no_argument, NULL, '5' }, { "pool", required_argument, NULL, '6' }, { "identity", required_argument, NULL, '7' }, { 0,0,0,0 } }; c = getopt_long(argc, argv, "", long_opts, NULL); switch (c) { case EOF: break; case 'h': operation = OP_USAGE; break; case 'w': operation = OP_STATUS; break; case '1': operation = OP_STATUS_ATTR; break; case 'u': utc = TRUE; continue; case 'c': replace_pool = TRUE; /* fallthrough */ case 'a': name = optarg; operation = is_attribute(name) ? OP_ADD_ATTR : OP_ADD; if (replace_pool && operation == OP_ADD_ATTR) { fprintf(stderr, "invalid pool name: " "reserved for '%s' attribute.\n", optarg); usage(); exit(EXIT_FAILURE); } continue; case '2': name = optarg; operation = OP_ADD_ATTR; continue; case 'd': name = optarg; operation = is_attribute(name) ? OP_DEL_ATTR : OP_DEL; continue; case '3': name = optarg; operation = OP_DEL_ATTR; continue; case '4': operation = OP_SHOW_ATTR; continue; case 'r': name = optarg; operation = OP_RESIZE; continue; case 'l': operation = OP_LEASES; continue; case 'p': name = optarg; operation = OP_PURGE; continue; case 'b': name = optarg; if (operation == OP_BATCH) { fprintf(stderr, "--batch commands can not be nested\n"); exit(EXIT_FAILURE); } operation = OP_BATCH; continue; case 's': DESTROY_IF(start); start = host_create_from_string(optarg, 0); if (start == NULL) { fprintf(stderr, "invalid start address: '%s'.\n", optarg); usage(); exit(EXIT_FAILURE); } continue; case 'e': DESTROY_IF(end); end = host_create_from_string(optarg, 0); if (end == NULL) { fprintf(stderr, "invalid end address: '%s'.\n", optarg); usage(); exit(EXIT_FAILURE); } continue; case 't': timeout = atoi(optarg); if (timeout == 0 && strcmp(optarg, "0") != 0) { fprintf(stderr, "invalid timeout '%s'.\n", optarg); usage(); exit(EXIT_FAILURE); } continue; case 'f': filter = optarg; continue; case 'y': addresses = optarg; continue; case 'g': value_type = VALUE_STRING; value = optarg; continue; case 'n': value_type = VALUE_SUBNET; value = optarg; continue; case 'v': value_type = VALUE_ADDR; value = optarg; continue; case 'x': value_type = VALUE_HEX; value = optarg; continue; case '5': hexout = TRUE; continue; case '6': pool = optarg; continue; case '7': identity = optarg; continue; default: usage(); exit(EXIT_FAILURE); break; } break; } switch (operation) { case OP_USAGE: usage(); break; case OP_STATUS: status(); break; case OP_STATUS_ATTR: status_attr(hexout); break; case OP_ADD: if (addresses != NULL) { add_addresses(name, addresses, timeout); } else if (start != NULL && end != NULL) { add(name, start, end, timeout); } else { fprintf(stderr, "missing arguments.\n"); usage(); exit(EXIT_FAILURE); } break; case OP_ADD_ATTR: if (value_type == VALUE_NONE) { fprintf(stderr, "missing arguments.\n"); usage(); exit(EXIT_FAILURE); } if (identity && !pool) { fprintf(stderr, "--identity option can't be used without --pool.\n"); usage(); exit(EXIT_FAILURE); } add_attr(name, pool, identity, value, value_type); break; case OP_DEL: del(name); break; case OP_DEL_ATTR: if (identity && !pool) { fprintf(stderr, "--identity option can't be used without --pool.\n"); usage(); exit(EXIT_FAILURE); } del_attr(name, pool, identity, value, value_type); break; case OP_SHOW_ATTR: show_attr(); break; case OP_RESIZE: if (end == NULL) { fprintf(stderr, "missing arguments.\n"); usage(); exit(EXIT_FAILURE); } resize(name, end); break; case OP_LEASES: leases(filter, utc); break; case OP_PURGE: purge(name); break; case OP_BATCH: if (name == NULL) { fprintf(stderr, "missing arguments.\n"); usage(); exit(EXIT_FAILURE); } batch(argv[0], name); break; default: usage(); exit(EXIT_FAILURE); } }