void main(int argc, char *argv[]) {

    if (argc==2) {
        pid_t pid = fork();

        if (pid == 0) {
            check_even(atoi(argv[1]));
        }
        else if (pid > 0) {
            check_4(atoi(argv[1]));
        }
    } else printf("Not the right amount of arguments. Sintax: ./eje1 numero \n");

}
Esempio n. 2
0
/*=============================================
 * nodes_callback -- callback for node traversal
 *  for checking indis, fams, sours, evens, othes
 * Created: 2001/01/14, Perry Rapp
 *===========================================*/
static BOOLEAN
nodes_callback(TRAV_RECORDS_FUNC_ARGS(key, rec, param))
{
    param=param;	/* NOTUSED */
    if (noisy)
        report_progress("Node: %s", key);
    switch (key[0]) {
    case 'I':
        return todo.check_indis ? check_indi((CNSTRING)key, (RECORD)rec) : TRUE;
    case 'F':
        return todo.check_fams ? check_fam((CNSTRING)key, (RECORD)rec) : TRUE;
    case 'S':
        return todo.check_sours ? check_sour((CNSTRING)key, (RECORD)rec) : TRUE;
    case 'E':
        return todo.check_evens ? check_even((CNSTRING)key, (RECORD)rec) : TRUE;
    case 'X':
        return todo.check_othes ? check_othe((CNSTRING)key, (RECORD)rec) : TRUE;
    }
    ASSERT(0); /* traverse_db_key_recs is broken */
    return TRUE;
}