Example #1
0
int main(int argc, char *argv[])
{
    program_name = argv[0];
    setbuf(stdout, NULL);

    char *infile = proc_args(argc, argv);
    FILE *in;
    if (strcmp(infile, "-") == 0)
        in = stdin;
    else
        in = fopen(infile, "r");
    if (!in)
        error(1, errno, "%s", infile);

    int nsamp = proc_head(in);

    FILE *bed = fopen(bed_file, "wb");
    if (!bed)
        error(1, errno, "%s", bed_file);
    int hl = write_bed_header(bed);
    if (hl != HEADER_ITEMS)
        error(1, errno, "%s%d", "Wrong header length: ", hl);
    int nmarker = procLines(in, bed, nsamp);

    printf("Genotypes [ %s ]\n", bed_file);
    printf("%d markers [ %s ]\n", nmarker, bim_file);
    printf("%d samples [ %s ]\n", nsamp, fam_file);

    fclose(in);
    fclose(bed);
    exit(EXIT_SUCCESS);
}
Example #2
0
File: main.c Project: gsrr/Python
int main(int argc, char **argv)
{
	setcfgfilename(argv[0]);
	readoptions();
	timer_init();
	atexit(cleanup);
#if UNIX
	signal(SIGINT, finish);
#endif
	gettermsize();
	getlang();
	if (argc > 1) {
#if ALLEGRO && WIN32 && !ALLEGRO_USE_CONSOLE
		freopen("stdout.tmp", "w", stdout);
#endif
		proc_args(argv+1, argc-1);
	}
	gettermoptions();
#ifdef SOCKET
	startup(socket_fd>0 ? 2+is_inet() : 0);
#else
	startup(0);
#endif
#if !NO_MENU
	writeconfig_message();
#endif
	return 0;
}
Example #3
0
int main(int argc, char *argv[])
{
    int i, r;

    i = proc_args(argc, argv);

    if (!args.subcmd)
        do_usage();

    if (args.dbfile)
    {
        if (args.needwrite)
        {
            fprintf(stderr, "you can't write to a database specified with -d.\n");
            return 1;
        }
        else
            r = init_named_db(args.dbfile);
    }
    else
        r = init_db(args.needwrite);

    if (r)
    {
        fprintf(stderr, "can't open database.\n");
        return 1;
    }

    i++; /* eat argv[0] */
    i = args.subcmd(argc - i, argv + i);

    close_db();

    return i;
}
Example #4
0
int main(int argc, char **argv) {
    config cfg;
    memset(&cfg, 0, sizeof(cfg));
    proc_args(&cfg, argc, argv);

    if (0 == strcmp(cfg.in_fname, cfg.out_fname)
        && (0 != strcmp("-", cfg.in_fname))) {
        fprintf(stderr, "Refusing to overwrite file '%s' with itself.\n", cfg.in_fname);
        exit(1);
    }

    cfg.in = handle_open(cfg.in_fname, IO_READ, cfg.buffer_size);
    if (cfg.in == NULL) { die("Failed to open input file for read"); }
    cfg.out = handle_open(cfg.out_fname, IO_WRITE, cfg.buffer_size);
    if (cfg.out == NULL) { die("Failed to open output file for write"); }

#if _WIN32
    /*
     * On Windows, stdin and stdout default to text mode. Switch them to
     * binary mode before sending data through them.
     */
    _setmode(STDOUT_FILENO, O_BINARY);
    _setmode(STDIN_FILENO, O_BINARY);
#endif

    if (cfg.cmd == OP_ENC) {
        return encode(&cfg);
    } else if (cfg.cmd == OP_DEC) {
        return decode(&cfg);
    } else {
        usage();
    }
}
Example #5
0
int main( int argc, char ** argv )
{
    unsigned int i, nreads=0, nwrites=0, cur_idx, addr; 
    float f;
    char op;
    proc_t * procs, * p;

    srand48( 5 );
    srand( 5 );
    proc_args( argc, argv );

    fprintf(stderr, "Number of references: %u\n", num_references );
    fprintf(stderr, "Number of processes: %u\n", num_procs );
    fprintf(stderr, "Maximum process size: %u\n", max_proc_size );

    fprintf(stderr, "Memory reference pattern: %s ", ref_pattern );
    if( strcmp(ref_pattern, "sequential") == 0 ) {
        fprintf(stderr, "(%u byte stride)", mem_stride );
    }
    fprintf(stderr, "\nR/W ratio: %.2f\n", rw_ratio );

    procs = (proc_t *)malloc( num_procs * sizeof(proc_t ) );
    for( i=0; i<num_procs; i++ ) {
        procs[i].id = i;
        procs[i].last_ref = 0;
    }

    cur_idx = 0;
    for( i=0; i < num_references; i++ ) {
        if( i % slice == 0 ) {
            cur_idx = (cur_idx+1) % num_procs;
            p = &(procs[ cur_idx ]);
        }

        f = drand48();
        if( f < rw_ratio ) {
            nreads++;
            op='R';
        }
        else{
            nwrites++;
            op='W';
        }

        if( strcmp( ref_pattern, "random" ) == 0 ) {
            addr = (2 * rand()) % max_proc_size ;
        }
        else{
            addr = (p->last_ref + mem_stride ) % max_proc_size ;
        }

        p->last_ref = addr;
        fprintf( stdout, "%u %c 0x%x\n", p->id, op, addr );
    }

    //fprintf(stderr, "nreads: %u, nwrites:  %u, r/w ratio: %.2f\n", nreads, nwrites, ((float)nreads)/(nreads+nwrites) );
    return 0;
}
Example #6
0
File: sctest.c Project: S010/test
int
main(int argc, char **argv) {
    int rc;
    proc_args(argc, argv);

    rc = sctest();
    
    return rc == 0 ? 0 : 1;
}
Example #7
0
int main(int argc, char **argv)
{
#ifdef _WIN32
    NtInitialize(&argc, &argv);
#endif
    init();
    proc_args(argc, argv);
    run();
    return 0;
}
Example #8
0
int main(int argc, char **argv) {
	sef_startup();
	if (argc == 1) {
		print_usage(argv);
		return 0;
	} else {
		proc_args(argc, argv);
	}
	return 0;

}
Example #9
0
int main(int argc, char **argv) {

 /* Initialize service */
 sef_startup();

 if (argc == 1) {
  print_usage(argv);
  return 0;
 }
 proc_args(argc, argv);

 return 0;
}
Example #10
0
int main(int argc, char **argv) {

	/* Initialize service */
	sef_startup();

	printf("lab4: MOUSE \n");

	if (argc == 1) {
		print_usage(argv);
		return 0;
	} else {
		proc_args(argc, argv);
	}
	return 0;
}
Example #11
0
File: lab4.c Project: PTJohe/LCOM
int main(int argc, char *argv[]) {
	/* Initialize service */
	sef_startup();

	/* Enable IO-sensitive operations for ourselves (used in lab3 to allow user level programs to executo I/O instructions)
	 sys_enable_iop(SELF);
	 */

	if (argc == 1) {
		print_usage(argv);
		return 0;
	} else {
		proc_args(argc, argv);
	}
	return 0;
}
Example #12
0
int main(int argc, char **argv) {

	sef_startup();

	/* Enable IO-sensitive operations for ourselves */
	sys_enable_iop(SELF);

	if ( argc == 1 ) {
		print_usage(argv);
		return 0;
	} else {
		proc_args(argc, argv);
	}
	return 0;

}
Example #13
0
int main(int argc, char **argv) {

	/* Initialize service */

	sef_startup();

	sys_enable_iop(SELF);

	if ( argc == 1 ) {
		print_usage(argv);
		return 0;
	} else {
		proc_args(argc, argv);
	}
	return 0;

}
Example #14
0
int main(int argc, char **argv) {


   /* Initialize service */

  sef_startup();

  //timer_test_config(0);//Operating mode errado
  //timer_test_square(60);
  //timer_test_int(60);
  if ( argc == 1 ) {
      print_usage(argv);
      return 0;
  } else {
      proc_args(argc, argv);
  }
  return 0;

}
Example #15
0
int main(int argc, char **argv) {

	/* Initialize service */

	sef_startup();

	//test_packet(20); //working (small bug)
	//test_async(2); //working
	//test_config(); //working
	//test_gesture(-10, 500); //working (negative numbers (small bug))


	if ( argc == 1 ) {
		print_usage(argv);
		return 0;
	} else {
		proc_args(argc, argv);
	}
	return 0;

}
Example #16
0
int main(int argc, char **argv) {
    config cfg;
    memset(&cfg, 0, sizeof(cfg));
    proc_args(&cfg, argc, argv);

    if (0 == strcmp(cfg.in_fname, cfg.out_fname)
        && (0 != strcmp("-", cfg.in_fname))) {
        printf("Refusing to overwrite file '%s' with itself.\n", cfg.in_fname);
        exit(1);
    }

    cfg.in = handle_open(cfg.in_fname, IO_READ, cfg.buffer_size);
    if (cfg.in == NULL) { die("Failed to open input file for read"); }
    cfg.out = handle_open(cfg.out_fname, IO_WRITE, cfg.buffer_size);
    if (cfg.out == NULL) { die("Failed to open output file for write"); }

    if (cfg.cmd == OP_ENC) {
        return encode(&cfg);
    } else if (cfg.cmd == OP_DEC) {
        return decode(&cfg);
    } else {
        usage();
    }
}
Example #17
0
int main(int argc, char **argv) {
	sef_startup();
	proc_args(argc, argv);
	return 0;
}