void Execution_Tracer::print() { lprintf( "printing history\n"); The_Squeak_Interpreter()->print_all_stack_traces(dittoing_stdout_printer); lprintf( "\n\n\nprinting last bytecodes\n"); Oop entries = get(); check_it(entries); print_entries(entries, debug_printer); }
void process_Pindel(std::string pindel_vcf, int min_number_supporting, int min_length, std::string output) { std::vector<strvcfentry> entries; //= parse_vcf(delly_vcf); //get delly calls parse_pindel(pindel_vcf, entries, min_number_supporting, min_length); print_header(pindel_vcf, output); print_entries(output, entries); }
void process_Lumpy( std::string lumpy_bede, int min_number_supporting, float max_eval, std::string output) { std::vector<strvcfentry> entries ;//= parse_vcf(delly_vcf); //get delly calls parse_lumpy(lumpy_bede, entries,min_number_supporting, pow(10,max_eval)); print_header(lumpy_bede, output); print_entries(output, entries); }
int main() { llist entries; int status; html_header(); html_begin("Query Results"); status = read_cgi_input(&entries); printf("<h1>Status = %d</h1>\n",status); h1("Query results"); print_entries(entries); html_end(); list_clear(&entries); return 0; }
int main() { llist entries; int status; html_header(); html_begin("Test CGI"); h1("CGI Test Program"); printf("<hr>\n"); h2("CGI Environment Variables"); print_cgi_env(); status = read_cgi_input(&entries); printf("<h2>Status = %d</h2>\n",status); h2("CGI Entries"); print_entries(entries); html_end(); list_clear(&entries); return 0; }
int main() { llist entries; int status; char *form; status = read_cgi_input(&entries); form = cgi_val(entries, "submitSearch"); if (strcmp(form, "View") == 0) view(entries); else if (strcmp(form, "FileSelect") == 0) fileSelect(entries); else { html_header(); html_begin_body_options("Query Results", "bgcolor=#ffffff"); printf("<h1>Status = %d</h1>\n",status); h1("Query results"); print_entries(entries); html_end(); } list_clear(&entries); return 0; }
void SummaryBalance::summarize (Treelog& msg) const { TREELOG_MODEL (msg); // We write the summary to a string at first. std::ostringstream tmp; tmp.precision (precision); tmp.flags (std::ios::right | std::ios::fixed); if (description.name () != default_description) tmp << description << "\n\n"; // Find width of tags. const std::string total_title = "Balance (= In - Out - Increase)"; const std::string content_title = "Total increase in content"; size_t max_size = std::max (total_title.size (), content_title.size ()); for (unsigned int i = 0; i < fetch.size (); i++) max_size = std::max (max_size, fetch[i]->name_size ()); // Find width and total values int max_digits = 0; const double total_input = find_total (input, max_digits); const double total_output = find_total (output, max_digits); const double total_content = find_total (content, max_digits); const double total = total_input - total_output - total_content; max_digits = std::max (max_digits, FetchPretty::width (total_input)); max_digits = std::max (max_digits, FetchPretty::width (total_output)); max_digits = std::max (max_digits, FetchPretty::width (total_content)); max_digits = std::max (max_digits, FetchPretty::width (total)); // Find total width. const int width = max_digits + (precision > 0 ? 1 : 0) + precision; // Find width of dimensions. size_t dim_size = 0; for (unsigned int i = 0; i < fetch.size (); i++) dim_size = std::max (dim_size, fetch[i]->dimension ().name ().size ()); // Print all entries. symbol shared_dim = Attribute::User (); if (input.size () > 0) { const symbol dim = print_entries (tmp, input, max_size, width); print_balance (tmp, "Total input", total_input, dim, dim_size, max_size, width); shared_dim = dim; tmp << "\n"; } if (output.size () > 0) { const symbol dim = print_entries (tmp, output, max_size, width); print_balance (tmp, "Total output", total_output, dim, dim_size, max_size, width); if (shared_dim == Attribute::User ()) shared_dim = dim; else if (dim != shared_dim) shared_dim = Attribute::Unknown (); tmp << "\n"; } if (content.size () > 0) { const symbol dim = print_entries (tmp, content, max_size, width); print_balance (tmp, content_title, total_content, dim, dim_size, max_size, width); if (shared_dim == Attribute::User ()) shared_dim = dim; else if (dim != shared_dim) shared_dim = Attribute::Unknown (); tmp << "\n"; } print_balance (tmp, total_title, total, shared_dim, dim_size, max_size, width); tmp << std::string (max_size + 3, ' ') << std::string (width, '='); // Where? if (file == "") msg.message (tmp.str ()); else { std::ofstream out (file.name ().c_str ()); out << tmp.str (); if (! out.good ()) msg.error ("Could not write to '" + file + "'"); } }
int main (int argc, char *argv[]) { WispObject *database; int do_long_listing = 0; int matches_found = 0; int arguments_found = 0; char *database_filename = (char *)NULL; if (strcmp (argv[0], "rolodex") == 0) { database_filename = getenv ("ROLODEX"); if (database_filename == (char *)NULL) database_filename = rolodex_file; } else { struct passwd *entry; entry = getpwuid (getuid ()); if (entry) { database_filename = (char *) xmalloc (strlen (user_file_template) + strlen (entry->pw_dir) + 4); sprintf (database_filename, user_file_template, entry->pw_dir); } } if (!database_filename) { fprintf (stderr, "Who are you?\n"); return (-1); } database = read_database (database_filename); while (--argc) { char *arg = *++argv; if (strcmp (arg, "-l") == 0) { do_long_listing = 1; } else { WispObject *matches; arguments_found++; matches = find_matches (database, "name:", arg); if (matches != NIL) { matches_found += list_length (matches); print_entries (stdout, matches, do_long_listing); } matches = find_matches (database, "email:", arg); if (matches != NIL) { matches_found += list_length (matches); print_entries (stdout, matches, do_long_listing); } matches = find_matches (database, "e-mail:", arg); if (matches != NIL) { matches_found += list_length (matches); print_entries (stdout, matches, do_long_listing); } } } if (!arguments_found) { /* Just find birthdays for today's date. */ WispObject *matches; char todays_date[20], yesterdays_date[20], tomorrows_date[20]; time_t ticks; struct tm *now; ticks = (time_t)time ((time_t *)NULL); now = localtime (&ticks); sprintf (todays_date, "%02d/%02d", 1 + now->tm_mon, now->tm_mday); ticks -= 60 * 60 * 24; now = localtime (&ticks); sprintf (yesterdays_date, "%02d/%02d", 1 + now->tm_mon, now->tm_mday); ticks += 2 * (60 * 60 * 24); now = localtime (&ticks); sprintf (tomorrows_date, "%02d/%02d", 1 + now->tm_mon, now->tm_mday); matches = find_date_matches (database, "birthday:", todays_date); if (matches != NIL) { matches_found += list_length (matches); print_entries (stdout, matches, do_long_listing); } matches = find_date_matches (database, "birthday:", yesterdays_date); if (matches != NIL) { matches_found += list_length (matches); print_entries (stdout, matches, do_long_listing); } matches = find_date_matches (database, "birthday:", tomorrows_date); if (matches != NIL) { matches_found += list_length (matches); print_entries (stdout, matches, do_long_listing); } } return (matches_found != 0); }
int main(int argc, char **argv) { zut_lookup_t lk = {0}; zut_readdir_t rd = {0}; boolean_t checking = B_FALSE; boolean_t looking = B_FALSE; boolean_t reading = B_FALSE; boolean_t bflag = B_FALSE; long rddir_bufsize = BIGBUF; int error = 0; int check; int fd; int c; while ((c = getopt(argc, argv, "lisaerb:ASE")) != -1) { switch (c) { case 'l': looking = B_TRUE; break; case 'i': lk.zl_reqflags |= ZUT_IGNORECASE; looking = B_TRUE; break; case 's': lk.zl_reqflags |= ZUT_GETSTAT; looking = B_TRUE; break; case 'a': rd.zr_reqflags |= ZUT_ACCFILTER; reading = B_TRUE; break; case 'e': rd.zr_reqflags |= ZUT_EXTRDDIR; reading = B_TRUE; break; case 'r': reading = B_TRUE; break; case 'b': reading = B_TRUE; bflag = B_TRUE; rddir_bufsize = strtol(optarg, NULL, 0); break; case 'A': checking = B_TRUE; check = _PC_ACCESS_FILTERING; break; case 'S': checking = B_TRUE; check = _PC_SATTR_ENABLED; break; case 'E': checking = B_TRUE; check = _PC_SATTR_EXISTS; break; case '?': default: usage(argv[0]); /* no return */ } } if ((checking && looking) || (checking && reading) || (looking && reading) || (!reading && bflag) || (!checking && !reading && !looking)) usage(argv[0]); /* no return */ if (rddir_bufsize < LILBUF || rddir_bufsize > MAXBUF) { (void) fprintf(stderr, "Sorry, buffer size " "must be >= %d and less than or equal to %d bytes.\n", (int)LILBUF, MAXBUF); exit(EINVAL); } if (checking) { char pathbuf[MAXPATHLEN]; long result; if (argc - optind < 1) usage(argv[0]); /* no return */ (void) strlcpy(pathbuf, argv[optind], MAXPATHLEN); result = pathconf(pathbuf, check); (void) printf("pathconf(2) check for %s\n", pathbuf); switch (check) { case _PC_SATTR_ENABLED: (void) printf("System attributes "); if (result != 0) (void) printf("Enabled\n"); else (void) printf("Not enabled\n"); break; case _PC_SATTR_EXISTS: (void) printf("System attributes "); if (result != 0) (void) printf("Exist\n"); else (void) printf("Do not exist\n"); break; case _PC_ACCESS_FILTERING: (void) printf("Access filtering "); if (result != 0) (void) printf("Available\n"); else (void) printf("Not available\n"); break; } return (result); } if ((fd = open(ZUT_DEV, O_RDONLY)) < 0) { perror(ZUT_DEV); return (ENXIO); } if (reading) { char *buf; if (argc - optind < 1) usage(argv[0]); /* no return */ (void) strlcpy(rd.zr_dir, argv[optind], MAXPATHLEN); if (argc - optind > 1) { (void) strlcpy(rd.zr_file, argv[optind + 1], MAXNAMELEN); rd.zr_reqflags |= ZUT_XATTR; } if ((buf = malloc(rddir_bufsize)) == NULL) { error = errno; perror("malloc"); (void) close(fd); return (error); } rd.zr_buf = (uint64_t)(uintptr_t)buf; rd.zr_buflen = rddir_bufsize; while (!rd.zr_eof) { int ierr; if ((ierr = ioctl(fd, ZUT_IOC_READDIR, &rd)) != 0) { (void) fprintf(stderr, "IOCTL error: %s (%d)\n", strerror(ierr), ierr); free(buf); (void) close(fd); return (ierr); } if (rd.zr_retcode) { (void) fprintf(stderr, "readdir result: %s (%d)\n", strerror(rd.zr_retcode), rd.zr_retcode); free(buf); (void) close(fd); return (rd.zr_retcode); } if (rd.zr_reqflags & ZUT_EXTRDDIR) print_extd_entries(&rd); else print_entries(&rd); } free(buf); } else { int ierr; if (argc - optind < 2) usage(argv[0]); /* no return */ (void) strlcpy(lk.zl_dir, argv[optind], MAXPATHLEN); (void) strlcpy(lk.zl_file, argv[optind + 1], MAXNAMELEN); if (argc - optind > 2) { (void) strlcpy(lk.zl_xfile, argv[optind + 2], MAXNAMELEN); lk.zl_reqflags |= ZUT_XATTR; } if ((ierr = ioctl(fd, ZUT_IOC_LOOKUP, &lk)) != 0) { (void) fprintf(stderr, "IOCTL error: %s (%d)\n", strerror(ierr), ierr); (void) close(fd); return (ierr); } (void) printf("\nLookup of "); if (lk.zl_reqflags & ZUT_XATTR) { (void) printf("extended attribute \"%s\" of ", lk.zl_xfile); } (void) printf("file \"%s\" ", lk.zl_file); (void) printf("in directory \"%s\" ", lk.zl_dir); if (lk.zl_retcode) { (void) printf("failed: %s (%d)\n", strerror(lk.zl_retcode), lk.zl_retcode); (void) close(fd); return (lk.zl_retcode); } (void) printf("succeeded.\n"); if (lk.zl_reqflags & ZUT_IGNORECASE) { (void) printf("----------------------------\n"); (void) printf("dirent flags: 0x%0x\n", lk.zl_deflags); (void) printf("real name: %s\n", lk.zl_real); } if (lk.zl_reqflags & ZUT_GETSTAT) { (void) printf("----------------------------\n"); print_stats(&lk.zl_statbuf); print_xvs(lk.zl_xvattrs); } } (void) close(fd); return (0); }