int main(int argc, char ** argv)/*{{{*/ { FILE *regfile, *namelistfile; int i, err, pairs, pairs_allc; char **keys, **values; char *string, *tofree, *token; if (! (argc >= 3) ) { fprintf(stderr, "\nError: Not enough input arguments...\n\n"); fprintf(stderr, "\nUSAGE: ./namelist_gen registry_file namelist_file_output [value_attribute] [key1=value1] [key2=value2]...\n\n"); return 1; } if (!(regfile = fopen(argv[1], "r"))) { fprintf(stderr,"\nError: Could not open file %s for reading.\n\n", argv[1]); return 1; } if (!(namelistfile = fopen(argv[2], "w+"))) { fprintf(stderr, "\nError: Could not create file %s for writing.\n\n", argv[2]); return 1; } pairs = argc-3; if ( pairs > 0 ) { keys = malloc(sizeof(char*) * pairs); values = malloc(sizeof(char*) * pairs); } else { pairs = 0; } for(i = 0; i < pairs; i++){ keys[i] = malloc(sizeof(char)*1024); values[i] = malloc(sizeof(char)*1024); string = strdup(argv[3+i]); tofree = string; token = strsep(&string, "="); sprintf(keys[i], "%s", token); token = strsep(&string, "="); sprintf(values[i], "%s", token); free(tofree); } ezxml_t registry = ezxml_parse_fp(regfile); err = generate_namelist(registry, namelistfile, pairs, keys, values); if ( pairs > 0 ) { free(keys); free(values); } fclose(regfile); fclose(namelistfile); return 0; }/*}}}*/
int main(int argc, char ** argv)/*{{{*/ { FILE * regfile; struct namelist * nls; struct dimension * dims; struct variable * vars; struct group_list * groups; struct package * pkgs; int err; if (argc != 2) { fprintf(stderr,"Reading registry file from standard input\n"); regfile = stdin; } else if (!(regfile = fopen(argv[1], "r"))) { fprintf(stderr,"\nError: Could not open file %s for reading.\n\n", argv[1]); return 1; } nls = NULL; dims = NULL; vars = NULL; ezxml_t registry = ezxml_parse_fp(regfile); // Cleanup registry structures err = push_attributes(registry); err = merge_structs_and_var_arrays(registry); err = merge_streams(registry); if (validate_reg_xml(registry)) { fprintf(stderr, "Validation failed.....\n"); return 1; } write_model_variables(registry); if (parse_reg_xml(registry)) { fprintf(stderr, "Parsing failed.....\n"); return 1; } return 0; }/*}}}*/
int main(int argc, char **argv, char **envp) { init_dept(); get_dept(getenv("REMOTE_ADDR")); printf("Content-type: text/html\n\n"); parse_args(envp); if(args_ln<1) return -1; int cat=atoi(args[0]); if(cat>=sizeof(url)) return -2; char *cmd; asprintf(&cmd, "curl '%s' 2>/dev/null |iconv -f UTF-8 -t ISO-8859-15", url[cat]); FILE *fd=popen(cmd, "r"); ezxml_t tree=ezxml_parse_fp(fd); pclose(fd); free(cmd); if(!tree) return 1; tree=ezxml_child(tree, "channel"); ezxml_t item=ezxml_child(tree, "item"); if(!item) return 2; printf("<html>\n<head><meta name=\"info_page\" content=\"index.html\">\n\n"); printf("<link rel=\"red\" href=\"eurosport.html\">\n"); printf("</head>\t<body>\n\t\t<table width=600 border=0 cellpadding=8 cellspacing=0 align=center>\n"); do { ezxml_t title=ezxml_child(item, "title"); char *url=ezxml_child(item, "link")->txt; if(!url) continue; url=index(url, '/')+3; if(!url) continue; url=index(url, '/')+1; if(!url) continue; printf("<tr><td><a href='eurosport2.cgi?%s&%d'>%s</a></td></tr>\n", url, cat, title->txt); } while((item=item->next)); printf("\t\t</table>\n\t\t<table width=600 border=0 cellpadding=8 cellspacing=0 align=center>"); printf("\t\t<tr><td><FONT family=\"Symbol\" color=\"#FF000020\"size=5>\x29</FONT> Index </td>" "</tr></table>\n</body>\n</html>\n"); end_dept(); return 0; }
ClParserPtrT clParserParseFp(FILE *fp) { return ezxml_parse_fp(fp); }