Exemple #1
0
int list_recursive(t_dlist *list, t_dlist *first, char ***pointed_square, int size, int tmp_lin, int tmp_col)
{
	int result;
	int lin;
	int col;
	char **square;

	square = *pointed_square;
	(void)first;
	lin = 0;
	col = 0;
	result = (is_right(&square, &lin, &col, size, list));
	print_it(list->content);
	ft_putnbr(result);
	/*if (result == 1 && list-> next != NULL)
	{
		tmp_lin = lin;
		tmp_col = col;
		list = list -> next;
		list_recursive (list, first, square, size, tmp_lin, tmp_col);
		}*/
	ft_putstr("salut");
	if (result == 0 && list->prev != NULL)
	{
		list = list -> prev;
		malloc_square(size);
		ft_putchar('M');
		result = is_right (&square, &tmp_lin +1, &tmp_col + 1, size, list);
		print_it(list->content);
		ft_putnbr(result);
	}
	if (result == 1 && list-> next != NULL)
	{
		ft_putstr("post_M");
		tmp_lin = lin;
		tmp_col = col;
		list = list -> next;
		list_recursive (list, first, &square, size, tmp_lin, tmp_col);
	}
	if (result == 0 && list->prev  == NULL)
	{
		ft_putstr("yolo");
		return (0);
	}
	if (result == 1 && list->next  == NULL)
	{
		ft_putnbr(8);
		return (1);
	}
	return (0);
}
Exemple #2
0
unsigned int	organize_and_print(t_struct_arg *args, const char *str,
				   unsigned int i, unsigned chars_to_save)
{
  t_params	*params;
  t_tmp_arg	*tmp;
  unsigned int	chars_written;

  params = (t_params*)malloc(sizeof(*params));
  tmp = (t_tmp_arg*)malloc(sizeof(*tmp));
  if (params == NULL || tmp == NULL)
    return (i);
  init_params_to_zero(params);
  if (is_parameter_number(str + i))
    i = find_good_param(params, &(args->arg_tmp), str, i);
  i = init_flags_width_prec(params, str, i + 1);
  i = init_length(params, str, i);
  if (params->is_width_in_arg == 1)
    params->width = va_arg(args->arg, int);
  if (params->is_precision_in_arg == 1)
    params->precision = va_arg(args->arg, int);
  if (params->is_other_param == 1)
    stock_arg(&(args->arg_tmp), tmp, str[i]);
  else if (params->is_other_param == 0)
    stock_arg(&(args->arg), tmp, str[i]);
  chars_written = print_it(tmp, params, str[i], chars_to_save);
  free(params);
  free(tmp);
  return (chars_written);
}
Exemple #3
0
unsigned int	check_print(t_struct_arg *args, const char *str,
				   unsigned int i, unsigned schars)
{
  t_params	*params;
  t_tmp_arg	*tmp;
  unsigned int	cwrite;

  if ((params = (t_params*)malloc(sizeof(*params))) == NULL ||
      (tmp = (t_tmp_arg*)malloc(sizeof(*tmp))) == NULL)
    return (i);
  init_params(params);
  if (is_params_nbr(str + i))
    i = find_good_param(params, &(args->arg_tmp), str, i);
  i = init_flags(params, str, i + 1);
  i = init_len(params, str, i);
  if (params->is_size == 1)
    params->width = va_arg(args->arg, int);
  if (params->is_prec == 1)
    params->precision = va_arg(args->arg, int);
  if (params->is_other == 1)
    stock_arg(&(args->arg_tmp), tmp, str[i]);
  else if (params->is_other == 0)
    stock_arg(&(args->arg), tmp, str[i]);
  cwrite = print_it(tmp, params, str[i], schars);
  free(params);
  free(tmp);
  return (cwrite);
}
Exemple #4
0
// Recursively print the hierarchy starting from the root.
// If there is only one aggregate object, the hierarchy will
// only be one level deep (i.e. the children of the one
// aggregate).  However, if there are other aggregates nested 
// within the top one, the printer will print each nested
// aggregate with further indentation.
void printer::print_it( std::ostream &out, Object *root )
    {
    if( root == NULL ) return;
    if( root->PluginType() == aggregate_plugin )
        {
        Aggregate *agg = (Aggregate *)root;
        out << indent() << "begin " << root->MyName() << endl;
        indent_n += 4;
        agg->Begin();
        for( int n = 0;  ; n++ )
            {
            Object *obj = agg->GetChild();
            if( obj == NULL ) break;
            if( limit > 0 && n == limit )
                {
                // Indicate that the list has been truncated.
                out << indent() << "..." << endl;
                break;
                }
            else print_it( out, obj );
            }
        indent_n -= 4;
        out << indent() << "end" << endl;
        }
    else if( root->PluginType() == primitive_plugin )
        {
        out << indent() << root->MyName() << endl;
        }
    }
Exemple #5
0
/**
 * gfs2_sb_print2 - Print out a superblock
 * @sb: the cpu-order buffer
 */
static void gfs2_sb_print2(struct gfs2_sb *sbp2)
{
	gfs2_meta_header_print(&sbp2->sb_header);

	pv(sbp2, sb_fs_format, "%u", "0x%x");
	pv(sbp2, sb_multihost_format, "%u", "0x%x");

	if (sbd.gfs1)
		pv(sbd1, sb_flags, "%u", "0x%x");
	pv(sbp2, sb_bsize, "%u", "0x%x");
	pv(sbp2, sb_bsize_shift, "%u", "0x%x");
	if (sbd.gfs1) {
		pv(sbd1, sb_seg_size, "%u", "0x%x");
		gfs2_inum_print2("jindex ino", &sbd1->sb_jindex_di);
		gfs2_inum_print2("rindex ino", &sbd1->sb_rindex_di);
	}
	else
		gfs2_inum_print2("master dir", &sbp2->sb_master_dir);
	gfs2_inum_print2("root dir  ", &sbp2->sb_root_dir);

	pv(sbp2, sb_lockproto, "%s", NULL);
	pv(sbp2, sb_locktable, "%s", NULL);
	if (sbd.gfs1) {
		gfs2_inum_print2("quota ino ", &gfs1_quota_di);
		gfs2_inum_print2("license   ", &gfs1_license_di);
	}
#ifdef GFS2_HAS_UUID
	print_it("  sb_uuid", "%s", NULL, str_uuid(sbp2->sb_uuid));
#endif
}
Exemple #6
0
bool printer::Run( string command, Camera &camera, Scene &scene )
    {
    indent_n = 0;
    cout << "\n----- Scene printed by " << MyName() << " plugin ------" << endl;
    print_it( cout, scene.object );
    cout << "\n" << endl;
    return true;
    }
int main (int argc, char * argv[])
{
	int input = 4;

	int * array = (int*)malloc(sizeof(int) * input);
	memset(array, 0, sizeof(array));
	print_it(input, input, array);
	free(array);
}
Exemple #8
0
int main(void)
{
        int n1, n2, n3;

        printf("Enter: ");
        scanf("%d %d %d", &n1, &n2, &n3);

        print_it(n1, n2, n3, av(n1, n2, n3));
}
void not_buggy(int size, int *b)
{
    int z = rand()%10;
    if(z == 5){
        free(b);
        b = NULL;
    }
    populate(20,b);
    print_it(20,b);
}
Exemple #10
0
/*
 *  Prints a string (%s)
 *  We need special handling because:
 *     a: the length of the string is unknown
 *     b: when .prec is used, we must not access any extra byte of the
 *        string (of course, if the original sprintf() does... what the
 *        hell, not my problem)
 *
 *  Return value: 0 = ok
 *                EOF = error
 */
static int type_s(xprintf_struct *s, int width, int prec,
                  const char *format_string, const char *arg_string)
{
  size_t string_len;

  if (arg_string == NULL)
    return print_it(s, (size_t)6, "(null)", 0);

  /* hand-made strlen() whitch stops when 'prec' is reached. */
  /* if 'prec' is -1 then it is never reached. */
  string_len = 0;
  while (arg_string[string_len] != 0 && (size_t)prec != string_len)
    string_len++;

  if (width != -1 && string_len < (size_t)width)
    string_len = (size_t)width;

  return print_it(s, string_len, format_string, arg_string);
}
static void print_it(int n, int size, int * array)
{
	if (n < 1)
	{
		int i;
		for ( i = 0; i < size; i++)
		{
			printf("%d", array[i]);
		}
		printf("\n");
	}
	else
	{
		array[n - 1] = 0;
		print_it(n - 1, size, array);
		array[n - 1] = 1;
		print_it(n - 1, size, array);
	}
}
Exemple #12
0
NOINLINE void test_handwritten()
{
    int counter = 2;
    char character = '!';
    double value = 0.5;

    print_it("val = ");
    print_it(value);
    print_it(", cnt = ");
    print_it(counter);
    print_it(", ch = ");
    print_it(character);
    print_it(", again v=");
    print_it(value);
    print_it(";\n");
}
Exemple #13
0
static int commit_buff (char *buff, char **d, FILE *out, int docstat)
{
  if (*d > buff)
  {
    **d = '\0';
    docstat = print_it (SP_STR, buff, out, docstat);
    *d = buff;
  }

  return docstat;
}
Exemple #14
0
int print_routine(char * name)
{
#if ASYNC_EXEC
	pthread_t tid;
	pthread_create(&tid, 0, print_it, name);	
	pthread_join(tid, 0);
#else
	print_it(name);
#endif
	return 0;
}
Exemple #15
0
NOINLINE void test_for_each_part()
{
    int counter = 2;
    char character = '!';
    double value = 0.5;

    for_each_part(auto x, "val = $value$, cnt = $counter$, ch = $character$, again v=$value$;\n", counter, character, value)
    {
        print_it(x);
    };
}
Exemple #16
0
NOINLINE void test_process_format()
{
    int counter = 2;
    char character = '!';
    double value = 0.5;

    auto print = [](auto x)
    {
        print_it(x);
    };
    process_format(print, "val = $value$, cnt = $counter$, ch = $character$, again v=$value$;\n", counter, character, value);
}
Exemple #17
0
static int flush_doc (int docstat, FILE *out)
{
  if (docstat & D_INIT)
    return D_INIT;

  if (fd_recurse++)
  {
    fprintf (stderr, "%s: Internal error, recursion in flush_doc()!\n", Progname);
    exit (1);
  }

  if (docstat & (D_PA))
    docstat = print_it (SP_END_PAR, NULL, out, docstat);

  if (docstat & (D_TAB))
    docstat = print_it (SP_END_TAB, NULL, out, docstat);

  if (docstat & (D_DL))
    docstat = print_it (SP_END_DL, NULL, out, docstat);

  if (docstat & (D_EM | D_BF | D_TT))
    docstat = print_it (SP_END_FT, NULL, out, docstat);

  docstat = print_it (SP_END_SECT, NULL, out, docstat);

  docstat = print_it (SP_NEWLINE, NULL, out, 0);

  fd_recurse--;
  return D_INIT;
}
Exemple #18
0
int				main(int argc, char **argv)
{
	t_ref		*d_ref;
	t_mlx		*d_mlx;

	if (argc != 2)
		return (0);
	if ((d_ref = init_ref(argv[1])) == NULL)
		free_ex(d_ref, 0, 0, argv[0]);
	if ((d_mlx = init_mlx(d_ref->win_i, d_ref->win_j, d_ref)) == NULL)
		free_ex(d_ref, d_mlx, 0, argv[0]);
	if (print_it(d_ref, d_mlx) == 0)
		free_ex(d_ref, d_mlx, 0, argv[0]);
	mlx_hook(d_mlx->win, 2, 0, (*key_hook), d_mlx);
	mlx_loop(d_mlx->mlx);
}
int main(int argc, char **argv)
	{
	long count;
	static unsigned char buf[BUFSIZE];
	static DES_cblock key ={0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0};
	static DES_cblock key2={0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12};
	static DES_cblock key3={0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34};
	DES_key_schedule sch,sch2,sch3;
	double d,tm[16],max=0;
	int rank[16];
	char *str[16];
	int max_idx=0,i,num=0,j;
#ifndef SIGALARM
	long ca,cb,cc,cd,ce;
#endif

	for (i=0; i<12; i++)
		{
		tm[i]=0.0;
		rank[i]=0;
		}

#ifndef TIMES
	TINYCLR_SSL_FPRINTF(OPENSSL_TYPE__FILE_STDERR,"To get the most accurate results, try to run this\n");
	TINYCLR_SSL_FPRINTF(OPENSSL_TYPE__FILE_STDERR,"program when this computer is idle.\n");
#endif

	DES_set_key_unchecked(&key,&sch);
	DES_set_key_unchecked(&key2,&sch2);
	DES_set_key_unchecked(&key3,&sch3);

#ifndef SIGALRM
	TINYCLR_SSL_FPRINTF(OPENSSL_TYPE__FILE_STDERR,"First we calculate the approximate speed ...\n");
	DES_set_key_unchecked(&key,sch);
	count=10;
	do	{
		long i;
		unsigned long data[2];

		count*=2;
		Time_F(START);
		for (i=count; i; i--)
			DES_encrypt1(data,&(sch[0]),DES_ENCRYPT);
		d=Time_F(STOP);
		} while (d < 3.0);
	ca=count;
	cb=count*3;
	cc=count*3*8/BUFSIZE+1;
	cd=count*8/BUFSIZE+1;

	ce=count/20+1;
#define COND(d) (count != (d))
#define COUNT(d) (d)
#else
#define COND(c) (run)
#define COUNT(d) (count)
        signal(SIGALRM,sig_done);
        alarm(10);
#endif

#ifdef PART1
	time_it(des_encrypt_u4_cisc_idx,  "des_encrypt_u4_cisc_idx  ", 0);
	time_it(des_encrypt_u16_cisc_idx, "des_encrypt_u16_cisc_idx ", 1);
	time_it(des_encrypt_u4_risc1_idx, "des_encrypt_u4_risc1_idx ", 2);
	num+=3;
#endif
#ifdef PART2
	time_it(des_encrypt_u16_risc1_idx,"des_encrypt_u16_risc1_idx", 3);
	time_it(des_encrypt_u4_risc2_idx, "des_encrypt_u4_risc2_idx ", 4);
	time_it(des_encrypt_u16_risc2_idx,"des_encrypt_u16_risc2_idx", 5);
	num+=3;
#endif
#ifdef PART3
	time_it(des_encrypt_u4_cisc_ptr,  "des_encrypt_u4_cisc_ptr  ", 6);
	time_it(des_encrypt_u16_cisc_ptr, "des_encrypt_u16_cisc_ptr ", 7);
	time_it(des_encrypt_u4_risc1_ptr, "des_encrypt_u4_risc1_ptr ", 8);
	num+=3;
#endif
#ifdef PART4
	time_it(des_encrypt_u16_risc1_ptr,"des_encrypt_u16_risc1_ptr", 9);
	time_it(des_encrypt_u4_risc2_ptr, "des_encrypt_u4_risc2_ptr ",10);
	time_it(des_encrypt_u16_risc2_ptr,"des_encrypt_u16_risc2_ptr",11);
	num+=3;
#endif

#ifdef PART1
	str[0]=" 4  c i";
	print_it("des_encrypt_u4_cisc_idx  ",0);
	max=tm[0];
	max_idx=0;
	str[1]="16  c i";
	print_it("des_encrypt_u16_cisc_idx ",1);
	if (max < tm[1]) { max=tm[1]; max_idx=1; }
	str[2]=" 4 r1 i";
	print_it("des_encrypt_u4_risc1_idx ",2);
	if (max < tm[2]) { max=tm[2]; max_idx=2; }
#endif
#ifdef PART2
	str[3]="16 r1 i";
	print_it("des_encrypt_u16_risc1_idx",3);
	if (max < tm[3]) { max=tm[3]; max_idx=3; }
	str[4]=" 4 r2 i";
	print_it("des_encrypt_u4_risc2_idx ",4);
	if (max < tm[4]) { max=tm[4]; max_idx=4; }
	str[5]="16 r2 i";
	print_it("des_encrypt_u16_risc2_idx",5);
	if (max < tm[5]) { max=tm[5]; max_idx=5; }
#endif
#ifdef PART3
	str[6]=" 4  c p";
	print_it("des_encrypt_u4_cisc_ptr  ",6);
	if (max < tm[6]) { max=tm[6]; max_idx=6; }
	str[7]="16  c p";
	print_it("des_encrypt_u16_cisc_ptr ",7);
	if (max < tm[7]) { max=tm[7]; max_idx=7; }
	str[8]=" 4 r1 p";
	print_it("des_encrypt_u4_risc1_ptr ",8);
	if (max < tm[8]) { max=tm[8]; max_idx=8; }
#endif
#ifdef PART4
	str[9]="16 r1 p";
	print_it("des_encrypt_u16_risc1_ptr",9);
	if (max < tm[9]) { max=tm[9]; max_idx=9; }
	str[10]=" 4 r2 p";
	print_it("des_encrypt_u4_risc2_ptr ",10);
	if (max < tm[10]) { max=tm[10]; max_idx=10; }
	str[11]="16 r2 p";
	print_it("des_encrypt_u16_risc2_ptr",11);
	if (max < tm[11]) { max=tm[11]; max_idx=11; }
#endif
	TINYCLR_SSL_PRINTF("options    des ecb/s\n");
	TINYCLR_SSL_PRINTF("%s %12.2f 100.0%%\n",str[max_idx],tm[max_idx]);
	d=tm[max_idx];
	tm[max_idx]= -2.0;
	max= -1.0;
	for (;;)
		{
		for (i=0; i<12; i++)
			{
			if (max < tm[i]) { max=tm[i]; j=i; }
			}
		if (max < 0.0) break;
		TINYCLR_SSL_PRINTF("%s %12.2f  %4.1f%%\n",str[j],tm[j],tm[j]/d*100.0);
		tm[j]= -2.0;
		max= -1.0;
		}

	switch (max_idx)
		{
	case 0:
		TINYCLR_SSL_PRINTF("-DDES_DEFAULT_OPTIONS\n");
		break;
	case 1:
		TINYCLR_SSL_PRINTF("-DDES_UNROLL\n");
		break;
	case 2:
		TINYCLR_SSL_PRINTF("-DDES_RISC1\n");
		break;
	case 3:
		TINYCLR_SSL_PRINTF("-DDES_UNROLL -DDES_RISC1\n");
		break;
	case 4:
		TINYCLR_SSL_PRINTF("-DDES_RISC2\n");
		break;
	case 5:
		TINYCLR_SSL_PRINTF("-DDES_UNROLL -DDES_RISC2\n");
		break;
	case 6:
		TINYCLR_SSL_PRINTF("-DDES_PTR\n");
		break;
	case 7:
		TINYCLR_SSL_PRINTF("-DDES_UNROLL -DDES_PTR\n");
		break;
	case 8:
		TINYCLR_SSL_PRINTF("-DDES_RISC1 -DDES_PTR\n");
		break;
	case 9:
		TINYCLR_SSL_PRINTF("-DDES_UNROLL -DDES_RISC1 -DDES_PTR\n");
		break;
	case 10:
		TINYCLR_SSL_PRINTF("-DDES_RISC2 -DDES_PTR\n");
		break;
	case 11:
		TINYCLR_SSL_PRINTF("-DDES_UNROLL -DDES_RISC2 -DDES_PTR\n");
		break;
		}
	TINYCLR_SSL_EXIT(0);
#if defined(LINT) || defined(OPENSSL_SYS_MSDOS)
	return(0);
#endif
	}
int test_signature()
{
    printf("Testing RSA functions with EVP_DigestSign and EVP_DigestVerify\n");

    EVP_RSA_SIGN_Init();

    int return_value = -1;

    /* Sign and Verify HMAC keys */
    EVP_PKEY *pri_key = NULL, *pub_key = NULL;
    unsigned char* sig = NULL;

    do
    {
        int rc = EVP_RSA_SIGN_make_keys_by_create(&pri_key, &pub_key);
        //EVP_RSA_SIGN_make_keys_to_file("RSAPrivateKey.pem", "RSAPublicKey.pem");
        //int rc = EVP_RSA_SIGN_make_keys_by_file(&pri_key, &pub_key, "clientPriKeyNew.pem", "clientPubKeyNew.pem");
        //int rc = EVP_RSA_SIGN_make_keys_by_file(&pri_key, &pub_key, "clientPriKeyOld.pem", "clientPubKeyOld.pem");
        //int rc = EVP_RSA_SIGN_make_keys_by_hmac(&pri_key, &pub_key, "wangqingsong");
        assert(rc == 0);
        if(rc != 0)
            break;

        assert(pri_key != NULL);
        if(pri_key == NULL)
            break;

        assert(pub_key != NULL);
        if(pub_key == NULL)
            break;

        const byte msg[] = "Now is the time for all good men to come to the aide of their country";
        size_t slen = 0;

        /* Using the skey or signing key */
        rc = EVP_RSA_SIGN_Signature(msg, strlen(msg), &sig, &slen, pri_key);
        assert(rc == 0);
        if(rc == 0) {
            printf("Signature OK\n");
        } else {
            printf("Failed to create signature, return code %d\n", rc);
            break;
        }

        print_it("Signature", sig, slen);
#if 0
        /* Tamper with signature */
        printf("Tampering with signature\n");
        sig[0] ^= 0x01;
#endif

#if 0
        /* Tamper with signature */
        printf("Tampering with signature\n");
        sig[slen - 1] ^= 0x01;
#endif

        /* Using the vkey or verifying key */
        rc = EVP_RSA_SIGN_Verify(msg, strlen(msg), sig, slen, pub_key);
        /* if the key is created by hmac , you need use this function to verify
         * signature*/
        //rc = EVP_RSA_SIGN_Verify_Hmac(msg, strlen(msg), sig, slen, pub_key);
        if(rc == 0) {
            printf("Verified OK\n");
        } else {
            printf("Failed to verify signature, return code %d\n", rc);
            break;
        }
        print_it("Verify", sig, slen);

        return_value = 0;
    }while(0);

    if(sig)
        OPENSSL_free(sig);

    if(pri_key)
        EVP_PKEY_free(pri_key);

    if(pub_key)
        EVP_PKEY_free(pub_key);

    return return_value;
}
Exemple #21
0
static int handle_docline (char *l, FILE *out, int docstat)
{
  char buff[BUFFSIZE];
  char *s, *d;
  l = skip_ws (l);

  if (Debug)
    fprintf (stderr, "%s: handle_docline `%s'\n", Progname, l);
  
  if (!strncmp (l, ".pp", 3))
    return print_it (SP_NEWPAR, NULL, out, docstat);
  else if (!strncmp (l, ".ts", 3))
    return print_it (SP_START_TAB, NULL, out, docstat);
  else if (!strncmp (l, ".te", 3))
    return print_it (SP_END_TAB, NULL, out, docstat);
  else if (!strncmp (l, ".dl", 3))
    return print_it (SP_START_DL, NULL, out, docstat);
  else if (!strncmp (l, ".de", 3))
    return print_it (SP_END_DL, NULL, out, docstat);
  else if (!strncmp (l, ".il", 3))
    return print_it (SP_START_IL, NULL, out, docstat);
  else if (!strncmp (l, ".ie", 3))
    return print_it (SP_END_IL, NULL, out, docstat);
  else if (!strncmp (l, ". ", 2))
    *l = ' ';

  for (s = l, d = buff; *s; s++)
  {
    if (!strncmp (s, "\\(as", 4))
    {
      *d++ = '*';
      s += 3;
    }
    else if (!strncmp (s, "\\(rs", 4))
    {
      *d++ = '\\';
      s += 3;
    }
    else if (!strncmp (s, "\\fI", 3))
    {
      docstat = commit_buff (buff, &d, out, docstat);
      docstat = print_it (SP_START_EM, NULL, out, docstat);
      s += 2;
    }
    else if (!strncmp (s, "\\fB", 3))
    {
      docstat = commit_buff (buff, &d, out, docstat);
      docstat = print_it (SP_START_BF, NULL, out, docstat);
      s += 2;
    }
    else if (!strncmp (s, "\\fC", 3))
    {
      docstat = commit_buff (buff, &d, out, docstat);
      docstat = print_it (SP_START_TT, NULL, out, docstat);
      s += 2;
    }
    else if (!strncmp (s, "\\fP", 3))
    {
      docstat = commit_buff (buff, &d, out, docstat);
      docstat = print_it (SP_END_FT, NULL, out, docstat);
      s += 2;
    }
    else if (!strncmp (s, ".dt", 3))
    {
      if (docstat & D_DD)
      {
	docstat = commit_buff (buff, &d, out, docstat);
	docstat = print_it (SP_END_DD, NULL, out, docstat);
      }
      docstat = commit_buff (buff, &d, out, docstat);
      docstat = print_it (SP_DT, NULL, out, docstat);
      s += 3;
    }
    else if (!strncmp (s, ".dd", 3))
    {
      if ((docstat & D_IL) && (docstat & D_DD))
      {
	docstat = commit_buff (buff, &d, out, docstat);
	docstat = print_it (SP_END_DD, NULL, out, docstat);
      }
      docstat = commit_buff (buff, &d, out, docstat);
      docstat = print_it (SP_DD, NULL, out, docstat);
      s += 3;
    }
    else if (*s == '$')
    {
      int output_dollar = 0;
      char *ref;
      char save;

      ++s;
      if (*s == '$')
      {
	output_dollar = 1;
	++s;
      }
      if (*s == '$')
      {
	*d++ = '$';
      }
      else
      {
	ref = s;
	while (isalnum ((unsigned char) *s) || (*s && strchr("-_<>", *s)))
	  ++s;

	docstat = commit_buff (buff, &d, out, docstat);
	save = *s;
	*s = 0;
	print_ref (out, output_dollar, ref);
	*s = save;
	--s;
      }
    }
    else
      *d++ = *s;
  }

  docstat = commit_buff (buff, &d, out, docstat);
  return print_it (SP_NEWLINE, NULL, out, docstat);
}
int main(int argc, char **argv)
{
	/*
	 * VARIABLES
	 */

	/* simple counter */
	int i = 1;

	/* getopt_long-options */
	static struct option long_options[] = {
		{"dist", required_argument, 0, 'd'},
		{"in", required_argument, 0, 'i'},
		{"out", required_argument, 0, 'o'},
		{0, 0, 0, 0}
	};

	/* Filepointers to in and outfile */
	FILE *in;
	FILE *out = NULL;

	/* a string containing the name of the distro we are working on */
	const char *distro = NULL;

	/* filenames, of in and outfiles */
	const char *infile = NULL;
	const char *outfile = NULL;

	/* temporary data storage */
	const char *data;

	/* space to get the line we are parsing */
	char line[LINE_LEN];

	/* if parsing an #exec, fill this string with #exec data */
	char exec_buffer[EXEC_BUFFER_LEN];

	/* The maximum exec_buffer lengt we have left to fill */
	int exec_buffer_free = EXEC_BUFFER_LEN - 1;

	/* Current line number in input */
	int lineno = 0;

	/* Stack - please use the macros defined below, if possible */
	struct {
		enum_block block_type;
		int process_elses;
		int print_out;
		int lineno;
	} stack[16];

	int stack_top = 0;

#define POP_STACK --stack_top
#define PUSH_STACK(type) ( stack[stack_top].process_elses = BLOCK_PRINTS_OUT, \
                           stack[stack_top].print_out = BLOCK_PRINTS_OUT, \
                           stack[stack_top].lineno = lineno, \
                           stack[stack_top++].block_type = type)
#define BLOCK_PRINTS_OUT ( stack_top ? stack[stack_top-1].print_out : 1 )
#define STACK_EMPTY ( stack_top == 0 )
#define STACK_TOP ( stack[stack_top-1] )
#define IN_BLOCK (  stack_top ? stack[stack_top-1].block_type : 0 )

	/*
	 *  CODE
	 */

	/* parse and fill path struct */
	path = str_split(getenv("PATH"), ':');
	if (!path) {
		fprintf(stderr, "  **\tERROR: could not get $PATH\n");
		exit(1);
	}

	/* Parse initial arguments */
	while (-1 !=
	       (i = getopt_long(argc, argv, "hi:o:d:", long_options, NULL))) {
		switch (i) {
			/* set the distro manually */
		case 'd':
			distro = optarg;
			break;
			/* set the file to parse */
		case 'i':
			infile = optarg;
			break;
			/* set the outfile manually */
		case 'o':
			outfile = optarg;
			break;
		default:
			fprintf(stdout, "Ups, what's that? <0%o>\n", i);
		}
	}

	/* if not set, probe it */
	if (!distro)
		distro = probe_distribution();
	if (!distro) {
		fprintf(stderr, "  **\tUnknown DISTRIBUTION\n");
		exit(1);
	}
	fprintf(stderr, "  **\tDistribution set: \"%s\"\n", distro);

	/* load the overlay */
	{
		int j;
		char file[200];

		/* reset the ovelay */
		for (j = 0; j < 1000; j++) {
			overlay[j].opt = NULL;
			overlay[j].value = NULL;
		}

		/* and distro dependent overlay, found in workdir */
		sprintf(file, "%s.overlay", distro);
		load_overlay_file(file);

		/* a standard path for overlay */
		strcpy(file, INITNG_ROOT);
		strcat(file, "/initng.overlay");
		load_overlay_file(file);

		/*printf("Overlays found:\n");
		   for(j=0;j<1000 && overlay[j].opt;j++)
		   {
		   printf(" \"%s\" == \"%s\"\n", overlay[j].opt, overlay[j].value);
		   } */

	}

	/* open input for writing */
	if (!infile) {
		fprintf(stderr, "  **\tYou have to set input file with -i\n");
		exit(1);
	}
	if (!(in = fopen(infile, "r"))) {
		fprintf(stderr, "  **\tcould not open input file!\n");
		exit(1);
	}

	/* make sure input is service.s */
	if (!strstr(infile, ".s")) {
		printf("install_service_file only handles *.s files!\n");
		exit(1);
	}

	/* open output for writing */
	if (!outfile) {
		if (strstr(infile, ".s")) {
			outfile = strndup(infile, strlen(infile) - 2);
		} else {
			fprintf(stderr, "  **\tout with -o not set, "
				"defaulting to stdout.\n");
			out = stdout;
		}
	}
	if (!out && !(out = fopen(outfile, "w"))) {
		fprintf(stderr, "  **\tcould not open output file!\n");
		exit(1);
	}

	/* Print header */
	fprintf(out, "#!/sbin/runiscript\n"
		"# This is an init script file, used by initng.\n\n");

	/* Okay, go parse every line */
	while (fgets(line, LINE_LEN, in)) {
		lineno++;

		/*
		 * This is an internal set, to force an standard default path,
		 * please us an direct @/usr/sbin/gdm@ instead.
		 */
		if (match("#atdefpath", line)) {
			D_("found #atdefpath. updating at default path\n");

			/* get the data after #atdefpath data */
			data = skip_spaces(line + LEN("#atdefpath"));

			/* free previous fore path */
			if (at_default_path)
				free(at_default_path);

			/* allocate an new one */
			at_default_path = malloc(strlen(data) + 1);

			/* copy the data */
			i = 0;
			while (data[i] && data[i] != ' ' && data[i] != '\t'
			       && data[i] != '\n') {
				at_default_path[i] = data[i];
				i++;
			}
			at_default_path[i] = '\0';

			D_("at_default_path updated to %s\n", at_default_path);

			/* explain */
			at_default_paths = str_split(at_default_path, ':');
			continue;
		}

		/* If this is an ordinary line, not starting with an # */
		if (STACK_EMPTY && line[0] != '#') {
			/* youst print it to outfile */
			print_it(out, line);
			continue;	/* read next line */
		}

		/* either in_block != 0 or line started with '#' */
		if (IN_BLOCK == EXEC_BLOCK) {
			/* in_block == EXEC_BLOCK */
			if (match("#endexec", line)) {
				D_("found #endexec, line %i\n", lineno);
				/* Do the exec shit */
				if (BLOCK_PRINTS_OUT) {
					data =
					    do_exec(exec_buffer,
						    strlen(exec_buffer));
					if (data) {
						print_it(out, data);
						free((void *)data);
					}
				}
				POP_STACK;
				continue;
			} else {
				strncat(exec_buffer, line, exec_buffer_free);
				exec_buffer_free -= strlen(line);
				continue;
			}

		} else {

			/* #exec is an internal run, and output will be
			 * outputed to outfile */
			if (match("#exec", line)) {
				D_("found #exec, line %i\n", lineno);
				exec_buffer[0] = '\0';
				exec_buffer_free = EXEC_BUFFER_LEN - 1;
				PUSH_STACK(EXEC_BLOCK);
				continue;
			}

			else if (match("#endexec", line)) {
				fprintf(stderr, "ERROR: #endexec without "
					"#exec, line %i\n", lineno);
				fclose(out);
				if (outfile)
					unlink(outfile);
				exit(1);
			}

			/* #ifd debian, meens utput this to outfile if
			 * distro == debian */
			else if (match("#ifd", line)) {
				D_("found #ifd, line %i\n", lineno);
				PUSH_STACK(IF_BLOCK);
				STACK_TOP.print_out = 0;
				if (STACK_TOP.process_elses
				    && match_distro(line, distro)) {
					D_("actual distro %s matches line "
					   "%i: %s\n", distro, lineno, line);
					STACK_TOP.print_out = 1;
					STACK_TOP.process_elses = 0;
				}
				continue;
			}

			else if (match("#elsed", line)) {
				if (IN_BLOCK != IF_BLOCK) {
					fprintf(stderr, "ERROR: unexpected "
						"#elsed, line %i\n", lineno);
					fclose(out);
					if (outfile)
						unlink(outfile);
					exit(1);
				}
				if (STACK_TOP.process_elses) {
					if (empty_elsed(line) ||
					    match_distro(line, distro)) {
						STACK_TOP.print_out = 1;
						STACK_TOP.process_elses = 0;
					}
				} else {
					STACK_TOP.print_out = 0;
				}
			}

			else if (match("#endd", line)) {
				if (IN_BLOCK != IF_BLOCK) {
					fprintf(stderr, "ERROR: unexpected "
						"#endd, line %i\n", lineno);
					fclose(out);
					if (outfile)
						unlink(outfile);
					exit(1);
				}
				POP_STACK;
			} else {
				/* it's just an ordinary line */
				if (BLOCK_PRINTS_OUT)
					print_it(out, line);
				continue;	/* read next line */
			}
		}
	}

	if (!STACK_EMPTY) {
		while (!STACK_EMPTY) {
			if (IN_BLOCK == EXEC_BLOCK)
				fprintf(stderr, "ERROR: missing #endexec for "
					"#exec on line %i\n",
					STACK_TOP.lineno);
			else
				fprintf(stderr, "ERROR: missing #endd for "
					"#ifd on line %i\n", STACK_TOP.lineno);
			POP_STACK;
		}
		fclose(out);
		if (outfile)
			unlink(outfile);
		exit(1);
	}

#if 0 /* We don't really need to free anything, 'coz we will exit soon */
	/* free the overlay table */
	for (i = 0; i < 1000 && overlay[i].opt; i++) {
		free((char *)overlay[i].opt);	/* const-cast */
		overlay[i].opt = NULL;
		if (overlay[i].value) {
			free((char *)overlay[i].value);	/* const-cast */
			overlay[i].value = NULL;
		}
	}
#endif

	/* close bouth input and output file */
	fclose(in);
	fclose(out);

	if (outfile) {
		chmod(outfile, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP |
		      S_IXGRP | S_IROTH | S_IXOTH);
	}

	return 0;
}
Exemple #23
0
int main(int argc, char **argv)
	{
	long count;
	static unsigned char buf[BUFSIZE];
	static char key[16]={	0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
				0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0};
	BF_KEY sch;
	double d,tm[16],max=0;
	int rank[16];
	char *str[16];
	int max_idx=0,i,num=0,j;
#ifndef SIGALARM
	long ca,cb,cc,cd,ce;
#endif

	for (i=0; i<12; i++)
		{
		tm[i]=0.0;
		rank[i]=0;
		}

#ifndef TIMES
	fprintf(stderr,"To get the most accurate results, try to run this\n");
	fprintf(stderr,"program when this computer is idle.\n");
#endif

	BF_set_key(&sch,16,key);

#ifndef SIGALRM
	fprintf(stderr,"First we calculate the approximate speed ...\n");
	count=10;
	do	{
		long i;
		unsigned long data[2];

		count*=2;
		Time_F(START);
		for (i=count; i; i--)
			BF_encrypt(data,&sch);
		d=Time_F(STOP);
		} while (d < 3.0);
	ca=count;
	cb=count*3;
	cc=count*3*8/BUFSIZE+1;
	cd=count*8/BUFSIZE+1;

	ce=count/20+1;
#define COND(d) (count != (d))
#define COUNT(d) (d)
#else
#define COND(c) (run)
#define COUNT(d) (count)
        signal(SIGALRM,sig_done);
        alarm(10);
#endif

	time_it(BF_encrypt_normal,	"BF_encrypt_normal ", 0);
	time_it(BF_encrypt_ptr,		"BF_encrypt_ptr    ", 1);
	time_it(BF_encrypt_ptr2,	"BF_encrypt_ptr2   ", 2);
	num+=3;

	str[0]="<nothing>";
	print_it("BF_encrypt_normal ",0);
	max=tm[0];
	max_idx=0;
	str[1]="ptr      ";
	print_it("BF_encrypt_ptr ",1);
	if (max < tm[1]) { max=tm[1]; max_idx=1; }
	str[2]="ptr2     ";
	print_it("BF_encrypt_ptr2 ",2);
	if (max < tm[2]) { max=tm[2]; max_idx=2; }

	printf("options    BF ecb/s\n");
	printf("%s %12.2f 100.0%%\n",str[max_idx],tm[max_idx]);
	d=tm[max_idx];
	tm[max_idx]= -2.0;
	max= -1.0;
	for (;;)
		{
		for (i=0; i<3; i++)
			{
			if (max < tm[i]) { max=tm[i]; j=i; }
			}
		if (max < 0.0) break;
		printf("%s %12.2f  %4.1f%%\n",str[j],tm[j],tm[j]/d*100.0);
		tm[j]= -2.0;
		max= -1.0;
		}

	switch (max_idx)
		{
	case 0:
		printf("-DBF_DEFAULT_OPTIONS\n");
		break;
	case 1:
		printf("-DBF_PTR\n");
		break;
	case 2:
		printf("-DBF_PTR2\n");
		break;
		}
	exit(0);
#if defined(LINT) || defined(OPENSSL_SYS_MSDOS)
	return(0);
#endif
	}
Exemple #24
0
int
main(int argc, char* argv[])
{
	char * passwd;
  uint64_t N = 1 << 14;
  uint32_t r = 8;
  uint32_t p = 1;
  char buf[65];
  size_t buflen = 64;
  int result;
  int i = 0;
  int punctuation = 1; // Whether to allow punctuation in the output
  int addbang = 0; // The the first character '!'
  int addfive = 0; // Make the 5th character '5'
  int length = 10; // Desired password length

  if (argc < 2) {
    usage();
  }

  // Disable punctuation in output for sites that are jerks
  if (strcmp(argv[1], "chase.com") == 0 ||
      strcmp(argv[1], "fandango.com") == 0 ||
      //strcmp(argv[1], "apple.com") == 0 ||
      strcmp(argv[1], "comcast.com") == 0 ||
      strcmp(argv[1], "verizonwireless.com") == 0 ||
      strcmp(argv[1], "gap.com") == 0 ||
      strcmp(argv[1], "audible.com") == 0 ||
      strcmp(argv[1], "purpletie.com") == 0 ||
      strcmp(argv[1], "opentable.com") == 0 ||
      strcmp(argv[1], "videoeta.com") == 0 ||
      strcmp(argv[1], "topcoder.com") == 0 ||
      strcmp(argv[1], "hondafinancialservices.com") == 0 ||
      strcmp(argv[1], "americanexpress.com") == 0 ||
      argc == 3) {
    punctuation = 0;
  }
  else if (strcmp(argv[1], "kaiserpermanente.org") == 0) {
    addbang = 1;
  }
  else if (strcmp(argv[1], "schwab.com") == 0) {
    // Schwab may have the stupidest password requirements I've ever
    // encountered.
    length = 8;
    addfive = 1;
    punctuation = 0;
  }
  else if (strcmp(argv[1], "deltadentalins.com") == 0 ||
           strcmp(argv[1], "mozilla.org") == 0 ||
           strcmp(argv[1], "morganstanleysmithbarney.com") == 0) {
    addfive = 1;
  }

	/* Prompt for a password. */
	if (tarsnap_readpass(&passwd, "Please enter passphrase", NULL, 1)) {
		exit(1);
  }

  result = crypto_scrypt(passwd, strlen(passwd), argv[1], strlen(argv[1]), N, r,
                         p, buf, buflen);
  buf[64] = 0;

  if (result != 0) {
    fprintf(stderr, "Something went wrong!\n");
    print_error(errno);
    exit(1);
  } else {
    print_it(buf, punctuation, addbang, length, addfive);
    printf("\n");
  }

	/* Zero and free the password. */
	memset(passwd, 0, strlen(passwd));
	free(passwd);

  return 0;
}
Exemple #25
0
//hlavni funkce starajici se o chod aplikace
int main(int argc, char **argv )
{
	unsigned int cnt = 0,old_score=1;
	char_cnt = 0;
	last_ch = 0;
	//iniciaizace HW
	initialize_hardware();
	keyboard_init();
	
	int random_number,i,j;
	Tshape myshape;
	Tmatrix matrix,pane,pom;
	int pom_matrix[8][8] = {0};
	char c=0;
	int latest_line;

	//srand(2);
	//vytvoreni noveho utvaru
	myshape = create_shape(rand()%8);
	//posun na zacatek
	matrix = move_it(myshape,pom_matrix);
	//ulozeni noveho utvaru
	pane = save_it(matrix,pom_matrix);


	set_led_d6(1);                       // rozsviceni D6
	set_led_d5(1);                       // rozsviceni D5

	//inicializace LED displeje
	P6DIR=0xff;
	P4DIR=0x0f;
	P2DIR=0xf0;
	P4OUT=0x00;
	P2OUT=0x00;
	P6OUT=0xff;
	while (1)
	{
		delay_ms(1);
		cnt++;
		//pri zmacknuti klavesy
		if (c!=last_ch){
			c=last_ch;
			//pokud byla zmacknuta 6
			if (c=='6'){
				//posunu se
				x++;
				//pokusim se ulozit na to misto utvar
				matrix = move_it(myshape,pom_matrix);
				//pokud nelze ulozit	
				if (matrix.count!=4){
					//vratim se
					x--;
					//a ulozim
					matrix = move_it(myshape,pom_matrix);				
				}
			}
			//pri zmacknuti 4  
			else if (c=='4'){
				//posunu se
				x--;
				//pokusim se ulozit
				matrix = move_it(myshape,pom_matrix);
				//pokud bych vypsal mene jak 4 znaky z utvaru
				if (matrix.count!=4){
					//posouvam se zpatky
					x++;
					matrix = move_it(myshape,pom_matrix);
				}
			}
			//pokud nactu 8
			else if (c=='8'){
				//posunu se
				y++;
				//pokusim se ulozit
				matrix = move_it(myshape,pom_matrix);
				if (matrix.count!=4){
					//pokud nelze posun, posunu se nazpet
					y--;
					matrix = move_it(myshape,pom_matrix);
					matrix.last_line = 1;
				}			
			}
			//rotace
			else if (c=='5'){
				//pouzivam prvne rotate_back kvuli "hezci" rotaci
				myshape = rotate_back(myshape);
				//pokusim se ulozit dany utvar
				matrix = move_it(myshape,pom_matrix);
				//pokud pri posunu nelze vypsat vsechny 4 prvky daneho utvaru
				if (matrix.count!=4){
					//posunu se zpatky
					myshape = rotate(myshape);
					matrix = move_it(myshape,pom_matrix);
				}		
			}
			else
			{
				continue;
			}
			//ulozim do vysledneho hraciho pole
			pane = save_it(matrix,pom_matrix);
			//pokud jsem nacetl posledni radek
			if (matrix.last_line==1)
			{
				//ulozim si hraci pole do pomocne matice
				for (i=0;i<8;i++)
				{
					for (j=0;j<8;j++)
					{
						pom_matrix[i][j] = pane.shape[i][j];
					}
				}
				matrix.last_line=0;
				//smazu radky
				pane=delete_rows(pane);

				x=0;
				y=0;
				//vygeneruji novy utvar
				myshape = create_shape(rand()%8);
				int i,t;
				//ulozim do pomocne matice hraci pole
				for (i=0;i<8;i++)
					for (t=0;t<8;t++)
						pom_matrix[i][t]=pane.shape[i][t];
				//posunu nove vygenerovany utvar na zacatek hraciho pole
				matrix = move_it(myshape,pom_matrix);
				//ulozim tento stav
				pane = save_it(matrix,pom_matrix);
				
			}
			c=last_ch;
		}
		//tisknuti skore
		if (old_score!=score && (cnt%100)==0){
			old_score=score;
			print_score("Score: ");
		}
		
		if (cnt > 1000)
		{
			cnt = 0;
			flip_led_d6();                   // negace portu na ktere je LED
		}
		
		print_it(pane.shape);
		keyboard_idle();                   // obsluha klavesnice
		terminal_idle();                   // obsluha terminalu
  } 
	
	return 0;
}
int main(int argc,char *argv[])
{
    int
	rc;

    char
	*k,
	*v,
	*line,
	buf[BUFSIZ];

    ght_hash_table_t
	*p_table=NULL;

    /* create hash table of size 256 */
    p_table=ght_create(256);
    if (p_table == NULL)
    {
	print_it("Error: Could not create hash table\n");
	return(1);
    }

    print_menu();
    for (;;)
    {
	print_prompt();


	line=fgets(buf,sizeof(buf)-1,stdin);
	if (line == NULL)
	    break;

	switch(*line)
	{
	    case 'i':
	    {
		k=read_data("Enter key: ");
		v=read_data("Enter value: ");
		if (k && v)
		{
		    /* insert to hash table */
		    rc=ght_insert(p_table,
			    v,
			    strlen(k),
			    k);
		    if (rc == 0)
		    {
			print_it("Inserted: Key=%s, Value=%s\n",
				k,v);
			free(k);
		    }
		    else
		    {
			print_it("Error: ght_insert() failed\n");
			(void) free((char *) k);
			(void) free((char *) v);
		    }
		}
		else
		{
		    if (k)
			(void) free((char *) k);
		    if (v)
			(void) free((char *) v);

		}

		break;
	    }

	    case 'r': /* replace */
	    {
		k=read_data("Enter key: ");
		v=read_data("Enter new value: ");
		if (k && v)
		{
		    char *
			 old_val;
		    /* Replace a key in the hash table */
		    old_val = (char*)ght_replace(p_table,
						 v,
						 strlen(k),
						 k);
		    if (old_val != NULL)
		    {
			print_it("Replaced: Key=%s, Old Value=%s, Value=%s\n",
				k,old_val, v);
			free(old_val);
			free(k);
		    }
		    else
		    {
			print_it("Error: ght_replace() failed\n");
			(void) free((char *) k);
			(void) free((char *) v);
		    }
		}
		else
		{
		    if (k)
			(void) free((char *) k);
		    if (v)
			(void) free((char *) v);

		}
		break;
	    }

	    case 'h':
	    {
		print_menu();
		break;
	    }

	    case 'n': /* number of elements */
	    {
		print_it("Number elements in hash table: %d\n",
			ght_size(p_table));
		break;
	    }

	    case 's': /* size of hash table */
	    {
		print_it("Hash table size: %d\n",
			ght_table_size(p_table));

		break;
	    }

	    case 't': /* dump */
	    {
		const void
		    *pk,
		    *pv;

		ght_iterator_t
		    iterator;

		for (pv=(char *) ght_first(p_table,&iterator, &pk);
		     pv;
		     pv=(char *) ght_next(p_table,&iterator, &pk))
		{
		    print_it("%s => %s\n",(char *) pk,(char *) pv);
		}
		break;
	    }

	    case 'd':
	    {
		k=read_data("Enter key to delete: ");
		if (k)
		{
		    v=ght_remove(p_table,
			    strlen(k),
			    k);
		    if (v)
		    {
			print_it("Removed %s => %s",k,v);
			(void) free((char *) v);
		    }
		    else
		    {
			print_it("Error: could not find data for key %s\n",
				k);
		    }
		    (void) free((char *) k);
		}

		break;
	    }

	    case 'l':
	    {
		k=read_data("Enter key: ");
		if (k)
		{
		    v=(char *) ght_get(p_table,strlen(k),k);
		    if (v)
		    {
			print_it("Found: %s => %s\n",k,v);
		    }
		    else
		    {
			print_it("No data found for key: %s\n",k);
		    }
		    (void) free((char *) k);

		}
		break;
	    }

	    case 'q':
	    {
		if (p_table)
		{
		    const void
			*pv,
			*pk;

		    ght_iterator_t
			iterator;

		    for (pv=(char *) ght_first(p_table,&iterator, &pk);
			 pv;
			 pv=(char *) ght_next(p_table,&iterator, &pk))
		    {
			(void) free((char *) pv);
		    }
		    ght_finalize(p_table);
		}

		return(0);
		break;
	    }

	    default:
	    {
		print_it("Unknown option\n");
		break;
	    }
	}
    }
    return(0);
}