int main(int argc, char *argv[]) { char *product; char *fns; unsigned int cap_no = 1; int len; if (argc != 2 && argc != 1) { printf("Usage: %s <nothing OR string of comma-separated functions in trusted service's API>", argv[0]); return -1; } if (argc == 2) { char fn_name[FN_NAME_SZ]; char *orig_fns; /* conservative amount of space for fn names: ~500 chars */ len = strlen(fn_string)+STR_SIZE; product = malloc(len); assert(product); orig_fns = fns = argv[1]; while (NULL != fns) { fns = string_to_token(fn_name, fns, ',', FN_NAME_SZ); create_stanza(product, len, fn_name, cap_no); printf("%s\n", product); cap_no++; } fns = orig_fns; printf("%s", footer1); while (NULL != fns) { char new_name[FN_NAME_SZ] = "\n"; fns = string_to_token(fn_name, fns, ',', FN_NAME_SZ); sprintf(new_name, "%s"UCAP_EXT, fn_name); create_cap_data(product, len, new_name); printf("%s\n", product); } printf("%s", footer2); } else { printf("%s", footer1); printf("%s", footer2); } /* * Make the static capability table. cap_no because we need * an entry per static capability made. /4 because we are * repeating the occurance of 4 bytes, not one (see footer). */ // printf(footer, ((cap_no)*SIZEOFUSERCAP)/4); return 0; }
int main() { ifstream f("hello.txt"); init(f,source_code); string_to_token(source_code,t_vec); print();//´òÓ¡token cout << endl; system("pause"); return 1; }