Esempio n. 1
0
/*
 * print_flag_set
 * Prints a set of flags which are set in an integer. The names and values of
 * the possible flags are taken from an array passed as the fourth argument.
 * All flags in the array are expected to be distinct, and non-zero.
 */
static char *
print_flag_set(char *buffer_start, char *c, long flags,
		const struct flag_desc *desc)
{
	bool is_zero = flags == 0;
	while (flags != 0 && desc->printable_name != NULL) {
		if (is_zero && desc->flag == 0)
			return print_flag(buffer_start, c,
						desc->printable_name);
		if ((flags & desc->flag) != 0) {
			c = print_flag(buffer_start, c, desc->printable_name);
			flags &= ~desc->flag;
		}
		desc++;
	}

	if (flags != 0) {
		if (c != buffer_start)
			c = print_cstr(c, " | ");
		c = print_hex(c, flags);
	}

	if (c == buffer_start)
		c = print_cstr(c, "0");

	return c;
}
Esempio n. 2
0
static void print_ptable(offset_manager_t *mngr) {
  offset_poly_table_t *table;
  uint32_t i, n;

  table = &mngr->ptable;
  printf("===== ptable ====\n");
  n = table->npolys;
  for (i=0; i<n; i++) {
    printf("poly[%"PRIu32"] := ", i);
    show_poly(table->def[i]);
    printf("        (eterm: t!%"PRId32, table->eterm[i]);
    printf(", active: ");
    print_flag(tst_bit(table->active, i));
    printf(", mark: ");
    print_flag(tst_bit(table->mark, i));
    printf(")\n");
    printf("   normal form: ");
    print_normal_form(&mngr->vtable, table->def[i]);
    printf("\n");
    printf("   vars: ");
    print_var_array(table->vars[i]);
    printf("\n");
  }
  printf("\n");
}
Esempio n. 3
0
const char* buildflagset_print(buildflagset_t* set)
{
  assert(set != NULL);
  assert(set->flags != NULL);

  char* p = set->text_buffer;

  // First the mutually exclusive flags.
  if(set->have_os_flags)
    print_flag(_os_flags[set->enum_os_flags], true, set, &p);

  if(set->have_arch_flags)
    print_flag(_arch_flags[set->enum_arch_flags], true, set, &p);

  if(set->have_size_flags)
    print_flag(_size_flags[set->enum_size_flags], true, set, &p);

  // Next the normal flags, in any order.
  size_t i = HASHMAP_BEGIN;
  flag_t* flag;

  while((flag = flagtab_next(set->flags, &i)) != NULL)
    print_flag(flag->name, flag->value, set, &p);

  if(p == set->text_buffer) // No flags, all configs match.
    print_str("all configs", set, &p);

  // Check buffer was big enough for it all.
  size_t size_needed = (p - set->text_buffer) + 1; // +1 for terminator.

  if(size_needed > set->buffer_size)
  {
    // Buffer we have isn't big enough, make it bigger then go round again.
    if(set->buffer_size > 0)
      ponyint_pool_free_size(set->buffer_size, set->text_buffer);

    set->text_buffer = (char*)ponyint_pool_alloc_size(size_needed);
    set->buffer_size = size_needed;
    set->text_buffer[0] = '\0';
    buildflagset_print(set);
  }

  // Add terminator.
  assert(set->text_buffer != NULL);
  set->text_buffer[size_needed - 1] = '\0';
  return set->text_buffer;
}
Esempio n. 4
0
static fssh_status_t
command_info(int argc, const char* const* argv)
{
	fssh_dev_t volumeID = get_volume_id();
	if (volumeID < 0)
		return volumeID;

	fssh_fs_info info;
	fssh_status_t status = _kern_read_fs_info(volumeID, &info);
	if (status != FSSH_B_OK)
		return status;

	printf("root inode:   %" FSSH_B_PRIdINO "\n", info.root);
	printf("flags:        ");
	print_flag(info.flags, FSSH_B_FS_HAS_QUERY, "Q", "-");
	print_flag(info.flags, FSSH_B_FS_HAS_ATTR, "A", "-");
	print_flag(info.flags, FSSH_B_FS_HAS_MIME, "M", "-");
	print_flag(info.flags, FSSH_B_FS_IS_SHARED, "S", "-");
	print_flag(info.flags, FSSH_B_FS_IS_PERSISTENT, "P", "-");
	print_flag(info.flags, FSSH_B_FS_IS_REMOVABLE, "R", "-");
	print_flag(info.flags, FSSH_B_FS_IS_READONLY, "-", "W");

	printf("\nblock size:   %" FSSH_B_PRIdOFF "\n", info.block_size);
	printf("I/O size:     %" FSSH_B_PRIdOFF "\n", info.io_size);
	printf("total size:   %s (%" FSSH_B_PRIdOFF " blocks)\n",
		byte_string(info.total_blocks, info.block_size), info.total_blocks);
	printf("free size:    %s (%" FSSH_B_PRIdOFF " blocks)\n",
		byte_string(info.free_blocks, info.block_size), info.free_blocks);
	printf("total nodes:  %" FSSH_B_PRIdOFF "\n", info.total_nodes);
	printf("free nodes:   %" FSSH_B_PRIdOFF "\n", info.free_nodes);
	printf("volume name:  %s\n", info.volume_name);
	printf("fs name:      %s\n", info.fsh_name);

	return FSSH_B_OK;
}
Esempio n. 5
0
void print_hdr(pkt *Pkt)
{
    //  printf("--HDR--\n");
    printf("Seq: %u\n", Pkt->Hdr->seq);
    printf("Checksum: %u\n", Pkt->Hdr->checksum);
    printf("Flag: %u :: ", (uint32_t)Pkt->Hdr->flag);
    print_flag(Pkt->Hdr->flag);
    printf("\n");
}
Esempio n. 6
0
inline void backto_os(){
	init_flag_position();	
	__asm__("pop %si");
	screen_init();
	__asm__("pop %si");
	print_welcome_msg();
	__asm__("pop %si");
	print_message();
	__asm__("pop %si");
	print_flag(); //root@wangqin4377@:   position
	__asm__("pop %si");
}
Esempio n. 7
0
//--------------------------------- SHELL core os.c---------
char listen_key(){
//	unsigned short int init_pos = get_pointer_pos();
	flag_len=17;
	char i = gets( key);
	screen_sc_T = 1;
	Print_flag_mark = 1;
	if( strcmp( key, "clear\0")){			// char *,const char *
		clear();
		return i;
	}

	if( strcmp( key, "python\0")){
		python();
		Print_flag_mark = 1;
		return i;
	}

	if( strcmp( key, "start\0")){
		clear();
		set_pointer_pos();
		Print_flag_mark = 0;
		Process();
		return i;
	}

	if( strcmp( key, "help\0")){
		//can't refer 2 two times, so...
		init_flag_position();	
		screen_init();
		print_welcome_msg();
		print_message();
		print_flag(); //root@wangqin4377@:   position

		return i;
	}
//---------------------------------mark: man xxx, run xxx,asc xx...
		
	if( synCheck( key, "run\0")){
		run( key);
		return i;
	}

	if( key[0] == '\0'){
		return i;
	}
	
	flag_scroll();
	set_pointer_pos();
	print_str("  No such file or Directory", 27);
	screen_sc_T = 2;
	return i;
}
Esempio n. 8
0
static void print_serial_flags(int serial_flags, enum print_mode mode,
				const char *prefix, const char *postfix)
{
	int i;
	const char *spd, *pr;

	pr = prefix;

	spd = get_spd(serial_flags, mode);
	if (spd)
		print_flag(&pr, spd);

	for (i = CMD_FLAG_FIRST; i <= CMD_FLAG_LAST; i++) {
		if ((serial_flags & setbits[i])
		 && (mode > PRINT_SUMMARY || !cmd_noprint(i))
		) {
			print_flag(&pr, nth_string(commands, i));
		}
	}

	puts(pr == prefix ? "" : postfix);
}
Esempio n. 9
0
int main(int argc, char *argv[])
{
    srand(time(NULL));
    long long number;
    int moneys = 100;
    long wager;
    long long long_answer = ((long)rand() << 32) | (long)rand();
    if (long_answer > 10) long_answer+=11;
    puts("Lex Trebeq: And now it's time for Final Jeopardy!");
    fflush(0);
    sleep(3);
    puts("            The current scores are: IBM Watson with $102,600, Stephen Hawking with $110,400, and YOU with an astonishing $100.");
    fflush(0);
    sleep(3);
    puts("            The category is 'Numbers greater than 10'");
    fflush(0);
    sleep(3);
    printf("Enter your answer: ");
    fflush(0);
    scanf("%lld", &number);
    printf("Enter your wager: ");
    fflush(0);
    scanf("%ld", &wager);
    if ((int)wager > 100 || wager < 0){
        puts("You can't even bet that much money...");
        return 0;
        fflush(0);
    }
    dot_sleep(8);
    puts("And the answers are in!");
    fflush(0);
    sleep(3);
    if (number == long_answer){
        puts("Wow good job you weren't even supposed to be able to do that!!");
        moneys += wager;
    } else {
        moneys -= wager;
        printf("I'm sorry %lld was not the right answer. It was actually %lld.\n", number, long_answer);
    }
    fflush(0);
    sleep(3);
    if (moneys <= 110400){
        printf("It looks like despite your answer there was no way for you to win. You lose! (%d)", moneys);
    } else {
        dot_sleep(5);
        printf("Although it looks like through some miracle, you have won with $%d... HOW DOES THAT WORK??\nAnyway you'll be going home with one of our fabulous FLAGS!!!!!\n", moneys);
        sleep(5);
        print_flag();
    }
    return 0;
}
Esempio n. 10
0
static void dns_dump(const void *ip, const struct xt_entry_match *match) {
    const struct xt_dns *dns = (struct xt_dns *)match->data;
    print_flag("qr", dns->qr, XT_DNS_FLAG_QR, dns->invflags);
    print_flag_opcode(dns->opcode, dns->setflags, dns->invflags);
    print_flag("aa", dns->aa, XT_DNS_FLAG_AA, dns->invflags);
    print_flag("tc", dns->tc, XT_DNS_FLAG_TC, dns->invflags);
    print_flag("rd", dns->rd, XT_DNS_FLAG_RD, dns->invflags);
    print_flag("ra", dns->ra, XT_DNS_FLAG_RA, dns->invflags);
    print_flag("ad", dns->ad, XT_DNS_FLAG_AD, dns->invflags);
    print_flag("cd", dns->cd, XT_DNS_FLAG_CD, dns->invflags);
    print_flag_rcode(dns->rcode, dns->setflags, dns->invflags);
    print_flag_qname(dns->qname, dns->setflags, dns->invflags);
    print_flag_qtype(ntohs(dns->qtype), dns->setflags, dns->invflags);
    print_flag("rmatch", dns->rmatch, XT_DNS_FLAG_RMATCH, dns->invflags);
    print_maxsize(dns->maxsize, dns->invflags);
}
Esempio n. 11
0
int main() {
  char flag[MAX][MAX];
  int ans;

  ans= create_sweden(flag, H);

  if (ans == 1)
    ans= ans && (print_flag(flag, H, W) == 1);

  if (ans != 1)
    printf("Unexpected value returned.\n");

  return 0;
}
Esempio n. 12
0
void print_flags(u_int8_t flags) {
    flag_count = 0;
    if(flags & TH_FIN) print_flag("FIN");
    if(flags & TH_SYN) print_flag("SYN");
    if(flags & TH_RST) print_flag("RST");
    if(flags & TH_PUSH) print_flag("PUSH");
    if(flags & TH_ACK) print_flag("ACK");
    if(flags & TH_URG) print_flag("URG");
}
Esempio n. 13
0
File: server.c Progetto: ytz2/cs820
/*once receive the search parameters from message 1
 * we should print out the agent fd, threadid and options
 */
void print_search_para(int fd, search *mysearch) {
	fprintf(stderr, "Client's Options, thread fd:%d thread id: %lu\n", fd,
			(unsigned long) pthread_self());
	print_flag(mysearch->options_flags, DOT_ACCESS, "-a");
	print_flag(mysearch->options_flags, AT_BEGIN, "-b");
	print_flag(mysearch->options_flags, AT_END, "-e");
	print_flag(mysearch->options_flags, NOT_FOLLOW_LINK, "-f");
	print_flag(mysearch->options_flags, CASE_INSENSITIVE, "-i");
	print_flag(mysearch->options_flags, SHOW_PATH, "-p");
	print_flag(mysearch->options_flags, NO_ERR_MSG, "-q");
	print_flag(mysearch->options_flags, INVERSE_PRINT, "-i");
	fprintf(stderr, "%s\t%d\n", "-d", mysearch->max_dir_depth);
	fprintf(stderr, "%s\t%d\n", "-l",
			mysearch->line_buffer_size == DEFAULT_LINE_BUFFER ?
					-1 : mysearch->line_buffer_size);
	fprintf(stderr, "%s\t%d\n", "-m", mysearch->max_line_number);
	fprintf(stderr, "%s\t%d\n", "-n", mysearch->column_number);
	fprintf(stderr, "%s\t%d\n", "-t", mysearch->thread_limits);
}
Esempio n. 14
0
int main(int argc, char **argv) {
	char pass[30];
	int size = 0;

	puts("Show me what you got !");
	puts("Enter the password Morty : ");
	size = read(0, pass, 29);
	pass[size] = '\0';

	if (verify_password(pass) == 0) {
		puts("There you go!");
		print_flag();
	} else {
		puts("Come on Morty, try harder");
	}

	return 0;
}
Esempio n. 15
0
static void print_attrs(struct rtattr *attrs[])
{
	print_flag(attrs, "protect", MACSEC_SECY_ATTR_PROTECT);

	if (attrs[MACSEC_SECY_ATTR_VALIDATE]) {
		__u8 val = rta_getattr_u8(attrs[MACSEC_SECY_ATTR_VALIDATE]);

		print_string(PRINT_ANY, "validate",
			     "validate %s ", validate_str[val]);
	}

	print_flag(attrs, "sc", MACSEC_RXSC_ATTR_ACTIVE);
	print_flag(attrs, "sa", MACSEC_SA_ATTR_ACTIVE);
	print_flag(attrs, "encrypt", MACSEC_SECY_ATTR_ENCRYPT);
	print_flag(attrs, "send_sci", MACSEC_SECY_ATTR_INC_SCI);
	print_flag(attrs, "end_station", MACSEC_SECY_ATTR_ES);
	print_flag(attrs, "scb", MACSEC_SECY_ATTR_SCB);
	print_flag(attrs, "replay", MACSEC_SECY_ATTR_REPLAY);

	if (attrs[MACSEC_SECY_ATTR_WINDOW]) {
		__u32 win = rta_getattr_u32(attrs[MACSEC_SECY_ATTR_WINDOW]);

		print_uint(PRINT_ANY, "window", "window %u ", win);
	}

	if (attrs[MACSEC_SECY_ATTR_CIPHER_SUITE]) {
		__u64 cid = rta_getattr_u64(attrs[MACSEC_SECY_ATTR_CIPHER_SUITE]);

		print_string(PRINT_FP, NULL, "%s", _SL_);
		print_string(PRINT_ANY, "cipher_suite",
			     "    cipher suite: %s,", cs_id_to_name(cid));
	}

	if (attrs[MACSEC_SECY_ATTR_ICV_LEN]) {
		__u8 icv_len = rta_getattr_u8(attrs[MACSEC_SECY_ATTR_ICV_LEN]);

		print_uint(PRINT_ANY, "icv_length",
		     " using ICV length %u\n", icv_len);
	}
}
Esempio n. 16
0
int main(int argc, char *argv[]) {
  setvbuf(stdout, NULL, _IONBF, 0);

  cash = get_rand();

  puts("Welcome to ONLINE ROULETTE!");
  printf("Here, have $%ld to start on the house! You'll lose it all anyways >:)\n", cash);
  puts("");

  long bet;
  long choice;
  while(cash > 0) {
      bet = get_bet();
      cash -= bet;
      choice = get_choice();
      puts("");

      play_roulette(choice, bet);

      if (wins >= MAX_WINS) {
	printf("Wow you won %lu times? Looks like its time for you cash you out.\n", wins);
	printf("Congrats you made $%lu. See you next time!\n", cash);
	exit(-1);
      }

      if(cash > ONE_BILLION) {
	printf("*** Current Balance: $%lu ***\n", cash);
	if (wins >= HOTSTREAK) {
	  puts("Wow, I can't believe you did it.. You deserve this flag!");
	  print_flag();
	  exit(0);
	}
	else {
	  puts("Wait a second... You're not even on a hotstreak! Get out of here cheater!");
	  exit(-1);
	}
	}
  }
  puts("Haha, lost all the money I gave you already? See ya later!");
  return 0;
}
Esempio n. 17
0
void			ft_base(t_dt *data)
{
	static void	(*func[])(t_dt *) = { PRINTF_FUNC1, PRINTF_FUNC2 };
	char		*ptr;

	while (*data->tail)
	{
		if (*data->tail == '%')
		{
			ptr = NULL;
			get_options(data);
			if (*data->tail)
				ptr = ft_strchr(PRINTF_ARGS, *data->tail);
			(ptr) ? func[ptr - PRINTF_ARGS](data) : print_flag(data);
			ft_memset(&data->flag, 0, sizeof(data->flag));
		}
		else
			write_char(data, *data->tail);
		data->tail++;
	}
}
Esempio n. 18
0
int main()
{

#ifdef NTL_SPMM_ULL

   if (sizeof(NTL_ULL_TYPE) < 2*sizeof(long)) {
      printf("999999999999999 ");
      print_flag();
      return 0;
   }

#endif


   long n, k;

   n = 200;
   k = 10*NTL_ZZ_NBITS;

   ZZ p;

   RandomLen(p, k);


   ZZ_p::init(p);         // initialization

   ZZ_pX f, g, h, r1, r2, r3;

   random(g, n);    // g = random polynomial of degree < n
   random(h, n);    // h =             "   "
   random(f, n);    // f =             "   "

   SetCoeff(f, n);  // Sets coefficient of X^n to 1
   

   // For doing arithmetic mod f quickly, one must pre-compute
   // some information.

   ZZ_pXModulus F;
   build(F, f);

   PlainMul(r1, g, h);  // this uses classical arithmetic
   PlainRem(r1, r1, f);

   MulMod(r2, g, h, F);  // this uses the FFT

   MulMod(r3, g, h, f);  // uses FFT, but slower

   // compare the results...

   if (r1 != r2) {
      printf("999999999999999 ");
      print_flag();
      return 0;
   }
   else if (r1 != r3) {
      printf("999999999999999 ");
      print_flag();
      return 0;
   }

   double t;
   long i, j;
   long iter;

   const int nprimes = 30;
   const long L = 12; 
   const long N = 1L << L;
   long r;
   

   for (r = 0; r < nprimes; r++) UseFFTPrime(r);

   vec_long aa[nprimes], AA[nprimes];

   for (r = 0; r < nprimes; r++) {
      aa[r].SetLength(N);
      AA[r].SetLength(N);

      for (i = 0; i < N; i++)
         aa[r][i] = RandomBnd(GetFFTPrime(r));


      FFTFwd(AA[r].elts(), aa[r].elts(), L, r);
      FFTRev1(AA[r].elts(), AA[r].elts(), L, r);
   }

   iter = 1;

   do {
     t = GetTime();
     for (j = 0; j < iter; j++) {
        for (r = 0; r < nprimes; r++) {
           long *AAp = AA[r].elts();
           long *aap = aa[r].elts();
           long q = GetFFTPrime(r);
           mulmod_t qinv = GetFFTPrimeInv(r);

           FFTFwd(AAp, aap, L, r);
           FFTRev1(AAp, aap, L, r);
           for (i = 0; i < N; i++) AAp[i] = NormalizedMulMod(AAp[i], aap[i], q, qinv);
        }
     }
     t = GetTime() - t;
     iter = 2*iter;
   } while(t < 1);

   iter = iter/2;

   iter = long((1.5/t)*iter) + 1;


   double tvec[5];
   long w;

   for (w = 0; w < 5; w++) {
     t = GetTime();
     for (j = 0; j < iter; j++) {
        for (r = 0; r < nprimes; r++) {
           long *AAp = AA[r].elts();
           long *aap = aa[r].elts();
           long q = GetFFTPrime(r);
           mulmod_t qinv = GetFFTPrimeInv(r);

           FFTFwd(AAp, aap, L, r);
           FFTRev1(AAp, aap, L, r);
           for (i = 0; i < N; i++) AAp[i] = NormalizedMulMod(AAp[i], aap[i], q, qinv);
        }
     }
     t = GetTime() - t;
     tvec[w] = t;
   }

   t = clean_data(tvec);

   t = floor((t/iter)*1e13);

   if (t < 0 || t >= 1e15)
      printf("999999999999999 ");
   else
      printf("%015.0f ", t);

   printf(" [%ld] ", iter);

   print_flag();

   return 0;
}
Esempio n. 19
0
int main()
{

#if (defined(NTL_CRT_ALTCODE) && !(defined(NTL_HAVE_LL_TYPE) && NTL_ZZ_NBITS == NTL_BITS_PER_LONG))

   {
      printf("999999999999999 ");
      print_flag();
      return 0;
   }


#endif

   SetSeed(ZZ(0));

   long n, k;

   n = 1024;
   k = 30*NTL_SP_NBITS; 

   ZZ p;

   RandomLen(p, k);
   if (!IsOdd(p)) p++;


   ZZ_p::init(p);         // initialization

   ZZ_pX f, g, h, r1, r2, r3;

   random(g, n);    // g = random polynomial of degree < n
   random(h, n);    // h =             "   "
   random(f, n);    // f =             "   "

   SetCoeff(f, n);  // Sets coefficient of X^n to 1

   // For doing arithmetic mod f quickly, one must pre-compute
   // some information.

   ZZ_pXModulus F;
   build(F, f);

   PlainMul(r1, g, h);  // this uses classical arithmetic
   PlainRem(r1, r1, f);

   MulMod(r2, g, h, F);  // this uses the FFT

   MulMod(r3, g, h, f);  // uses FFT, but slower

   // compare the results...

   if (r1 != r2) {
      printf("999999999999999 ");
      print_flag();
      return 0;
   }
   else if (r1 != r3) {
      printf("999999999999999 ");
      print_flag();
      return 0;
   }

   double t;
   long i;
   long iter;

   ZZ_pX a, b, c;
   random(a, n);
   random(b, n);
   long da = deg(a);
   long db = deg(b);
   long dc = da + db;
   long l = NextPowerOfTwo(dc+1);

   FFTRep arep, brep, crep;
   ToFFTRep(arep, a, l, 0, da);
   ToFFTRep(brep, b, l, 0, db);

   mul(crep, arep, brep);

   ZZ_pXModRep modrep;
   FromFFTRep(modrep, crep);

   FromZZ_pXModRep(c, modrep, 0, dc);

   iter = 1;

   do {
     t = GetTime();
     for (i = 0; i < iter; i++) {
        FromZZ_pXModRep(c, modrep, 0, dc);
     }
     t = GetTime() - t;
     iter = 2*iter;
   } while(t < 1);

   iter = iter/2;

   iter = long((3/t)*iter) + 1;

   double tvec[5];
   long w;

   for (w = 0; w < 5; w++) {
     t = GetTime();
     for (i = 0; i < iter; i++) {
        FromZZ_pXModRep(c, modrep, 0, dc);
     }
     t = GetTime() - t;
     tvec[w] = t;
   } 


   t = clean_data(tvec);

   t = floor((t/iter)*1e12);

   // The following is just to test some tuning Wizard logic --
   // be sure to get rid of this!!
#if (defined(NTL_CRT_ALTCODE))
   // t *= 1.12;
#endif

   if (t < 0 || t >= 1e15)
      printf("999999999999999 ");
   else
      printf("%015.0f ", t);

   printf(" [%ld] ", iter);

   print_flag();

   return 0;
}
Esempio n. 20
0
void  print_person( int reference, Str_prt_params *ps_ptr )
{
	Person *pptr ;
	Couple *cptr ;
	short cblk ;						/* block number					*/
	int coup, father, mother, ch, spouse ;
										/* references					*/
	char *ch_ptr ;						/* ptr to array of child refs	*/
	char *coupls_ptr ;					/* ptr to array of couplings	*/
	short first_ch ;					/* flag to print "sibling" or	*/
										/* "children" before first one	*/
	char temp_str[100] ;
	short dist_down ;
	short dummy ;
	short omit_baptism_details = TRUE ;
	short omit_will_details = TRUE ;
	short omit_death_details = TRUE ;
	short omit_wed_details ;
	short omit_divorce_details ;
	short i ;

	busy( BUSY_MORE ) ;
	pptr = get_pdata_ptr( reference, &dummy ) ;
	ps_ptr->ref1 = reference ;
	
	if( ps_ptr->use_gdos )
		setup_font( ps_ptr, largefont ) ;

	ps_ptr->last_x_end = 0 ;
	ps_ptr->y_pos = 0 ;
	ps_ptr->downlines = 1 ;
	ps_ptr->tabpos = 0 ;
	sprintf( temp_str, "%s    %s", pptr->forenames, pptr->family_name ) ;
	ps_ptr->align = RIGHT ;
	ps_ptr->x_pos = ps_ptr->chs_across ;
	print_str( NULL, 0, temp_str, 0, ps_ptr ) ;
	ps_ptr->align = RIGHT ;
	ps_ptr->x_pos = ps_ptr->chs_across ;
	ps_ptr->tabpos = 0 ;
	print_int( NULL, 0, pptr->reference, 0, ps_ptr ) ;

	dist_down = ps_ptr->y_pos * ps_ptr->cell_height ;
	if( ps_ptr->use_gdos )  setup_font( ps_ptr, fontinfo ) ;
	ps_ptr->y_pos = ( dist_down + ps_ptr->cell_height - 1 ) 
													/ ps_ptr->cell_height ;
	ps_ptr->align = LEFT_WRAP ;
	ps_ptr->x_pos = 0 ;
	ps_ptr->max_len = 0 ;
	ps_ptr->last_x_end = 0 ;
	ps_ptr->tabpos = 28 ;	
	print_date( pers_form.fm_ptr, BIRTH_SOURCE, pptr->birth_date, 0, ps_ptr ) ;

//	ps_ptr->align = LEFT_WRAP ;
	ps_ptr->x_pos = 4 ;
	ps_ptr->tabpos = 24 ;
	print_str( pers_form.fm_ptr, BIRTH_PLACE, pptr->birth_place, 1, ps_ptr ) ;

//	ps_ptr->align = LEFT_WRAP ;
	ps_ptr->x_pos = 4 ;
	ps_ptr->tabpos = 24 ;
//	ps_ptr->downlines = 1 ;
	print_str( birth_form.fm_ptr, BI_SOURCE_TITLE, pptr->birth_source, 1, ps_ptr ) ;

	if( pptr->occupation )  down_n_lines( 1, ps_ptr ) ;

	ps_ptr->x_pos = 0 ;
	ps_ptr->tabpos = 28 ;
	print_str( pers_form.fm_ptr, OCCUPATION, pptr->occupation, 1, ps_ptr ) ;

	down_n_lines( 1, ps_ptr ) ;

	if( coup = pptr->parents )
	{
		father = couples[coup].male_reference ;
		names_ref( father, temp_str, 40, FALSE ) ;
											/* format names into string	*/
		ps_ptr->x_pos = 0 ;
		ps_ptr->tabpos = 28 ;
		print_str( pers_form.fm_ptr, FATHER, temp_str, 0, ps_ptr ) ;
		mother = couples[coup].female_reference ;
		names_ref( mother, temp_str, 40, FALSE ) ;
											/* format names into string	*/
		print_str( pers_form.fm_ptr, MOTHER, temp_str, 0, ps_ptr ) ;

		cptr = get_cdata_ptr( coup, &cblk ) ;
		if( ch_ptr = cptr->children )
		{
			first_ch = TRUE ;
			while( ch = form_ref( &ch_ptr ) )
			{
				if( ch != reference )
				{
					if( first_ch )
					{
						first_ch = FALSE ;
						ps_ptr->x_pos = 4 ;
						ps_ptr->tabpos = 0 ;
						print_str( pers_form.fm_ptr, SIB_STRING, NULL, 0, ps_ptr ) ;
						ps_ptr->x_pos = 28 ;
					}
					names_ref( ch, temp_str, 40, FALSE ) ;
					print_str( NULL, 0, temp_str, 0, ps_ptr ) ;
				}
			}
		}
		if( ps_ptr->y_pos < printer_lines )  down_n_lines( 1, ps_ptr ) ;
	}

	if( pptr->baptism_date || pptr->baptism_place || pptr->baptism_source )
		omit_baptism_details = FALSE ;
	ps_ptr->x_pos = 0 ;
	ps_ptr->tabpos = 28 ;
	print_date( pers_form.fm_ptr, BAPTISM, pptr->baptism_date,
										omit_baptism_details, ps_ptr ) ;
	ps_ptr->x_pos = 4 ;
	ps_ptr->tabpos = 24 ;
	print_str( baptism_form.fm_ptr, BA_PLACE, pptr->baptism_place, 1, ps_ptr ) ;
	print_str( baptism_form.fm_ptr, BA_SOURCE, pptr->baptism_source, 1, ps_ptr ) ;
	if( !omit_baptism_details )
		if( ps_ptr->y_pos < printer_lines )  down_n_lines( 1, ps_ptr ) ;
	
	if( coupls_ptr = pptr->couplings )
	{
		while( coup = form_ref( &coupls_ptr ) )
		{
			omit_wed_details = TRUE ;
			omit_divorce_details = TRUE ;

			cptr = get_cdata_ptr( coup, &cblk ) ;
			if( cptr->male_reference == reference )
				spouse = cptr->female_reference ;
			else  spouse = cptr->male_reference ;
			names_ref( spouse, temp_str, 40, FALSE ) ;
			ps_ptr->x_pos = 0 ;
			ps_ptr->tabpos = 28 ;
			print_str( pers_form.fm_ptr, SPOUSE, temp_str, 0, ps_ptr ) ;
			
			if( cptr->wedding_date || cptr->wedding_place || cptr->wedding_place
									|| cptr->wedd_wit1 || cptr->wedd_wit2 )
				omit_wed_details = FALSE ;
			ps_ptr->x_pos = 4 ;
			ps_ptr->tabpos = 24 ;
			print_date( coup_form.fm_ptr, C_SOURCE, cptr->wedding_date,
				omit_wed_details, ps_ptr ) ;
			print_str( coup_form.fm_ptr, W_PLACE, cptr->wedding_place, 1, ps_ptr ) ;			
			print_str( co_src_form.fm_ptr, W_SOURCE, cptr->wedding_source, 1, ps_ptr ) ;	
			ps_ptr->x_pos = 8 ;
			ps_ptr->tabpos = 20 ;
			print_str( co_src_form.fm_ptr, WWIT1, cptr->wedd_wit1, 1, ps_ptr ) ;
			print_str( co_src_form.fm_ptr, WWIT2, cptr->wedd_wit2, 1, ps_ptr ) ;
			
			if( cptr->divorce_date || cptr->divorce_source )
				omit_divorce_details = FALSE ;
				
			ps_ptr->x_pos = 4 ;
			ps_ptr->tabpos = 24 ;
			print_date( coup_form.fm_ptr, C_DIVORCE, cptr->divorce_date,
				omit_divorce_details, ps_ptr ) ;
			ps_ptr->x_pos = 8 ;
			ps_ptr->tabpos = 20 ;
			print_str( divorce_form.fm_ptr, DI_SOURCE_TITLE, cptr->divorce_source, 1, ps_ptr ) ;					
			
			if( ch_ptr = cptr->children )
			{
				first_ch = TRUE ;
				while( ch = form_ref( &ch_ptr ) )
				{
					if( first_ch )
					{
						first_ch = FALSE ;
						ps_ptr->x_pos = 4 ;
						ps_ptr->tabpos = 0 ;
						print_str( pers_form.fm_ptr, CH_STRING, NULL, 0, ps_ptr ) ;
						ps_ptr->x_pos = 28 ;
					}
					names_ref( ch, temp_str, 40, FALSE ) ;
					print_str( NULL, 0, temp_str, 0, ps_ptr ) ;
				}
			}
			if( ps_ptr->y_pos < printer_lines )  down_n_lines( 1, ps_ptr ) ;
		}
	}

	if( pptr->will_date || pptr->will_wit1 || pptr->will_wit2
			|| pptr->will_exe1 || pptr->will_exe2
			|| pptr->will_sol || pptr->will_bens
			|| pptr->will_bens2 || pptr->will_bens3 )
			omit_will_details = FALSE ;
	if( pptr->death_date || pptr->death_place || pptr->death_source
			|| pptr->burial_date || pptr->burial_place || !omit_will_details )
		omit_death_details = FALSE ;
	ps_ptr->x_pos = 0 ;
	ps_ptr->tabpos = 28 ;
	print_date( pers_form.fm_ptr, DEATH, pptr->death_date,
										omit_death_details, ps_ptr ) ;
	ps_ptr->x_pos = 4 ;
	ps_ptr->tabpos = 24 ;
	print_str( death_form.fm_ptr, D_PLACE, pptr->death_place, 1, ps_ptr ) ;
	print_str( death_form.fm_ptr, BC_PLACE, pptr->burial_place, 1, ps_ptr ) ;
	print_date( death_form.fm_ptr, BCDATE, pptr->burial_date, 1, ps_ptr ) ;
	print_str( death_form.fm_ptr, D_SOURCE, pptr->death_source, 1, ps_ptr ) ;

	print_date( death_form.fm_ptr, D_WILL, pptr->will_date, omit_will_details,
																ps_ptr ) ;
	ps_ptr->x_pos = 8 ;
	ps_ptr->tabpos = 20 ;
	print_str( death_form.fm_ptr, DWIT1, pptr->will_wit1, 1, ps_ptr ) ;
	print_str( death_form.fm_ptr, DWIT2, pptr->will_wit2, 1, ps_ptr ) ;
	print_str( death_form.fm_ptr, EXEC1, pptr->will_exe1, 1, ps_ptr ) ;
	print_str( death_form.fm_ptr, EXEC2, pptr->will_exe2, 1, ps_ptr ) ;
	print_str( death_form.fm_ptr, SOLIC, pptr->will_sol, 1, ps_ptr ) ;
	print_str( death_form.fm_ptr, BENEF, pptr->will_bens, 1, ps_ptr ) ;
	print_str( death_form.fm_ptr, BENEF2, pptr->will_bens2, 1, ps_ptr ) ;
	print_str( death_form.fm_ptr, BENEF3, pptr->will_bens3, 1, ps_ptr ) ;

	ps_ptr->x_pos = 4 ;
	ps_ptr->tabpos = 24 ;
	for( i=7; i>=0; i-- )  print_flag( i, pptr->flags, ps_ptr ) ;
	
	if( pptr->notes )
	{
		ps_ptr->tabpos = 0 ;
		ps_ptr->x_pos = 0 ;
//		ps_ptr->downlines = 1 ;
		ps_ptr->align = LEFT ;
		
		print_str( NULL, 0, NULL, 0, ps_ptr ) ;
		
		ps_ptr->downlines = 2 ;
		
		print_str( pers_form.fm_ptr, NOTES, NULL, 0, ps_ptr ) ;
	
		print_notes_indented( pptr, ps_ptr ) ;
	}

	end_page( ps_ptr, FALSE ) ;
	busy( BUSY_LESS ) ;
}
Esempio n. 21
0
int main()
{
   long n, i, j, iter, s, k;
   double t;


   for (i = 0; i < 10000; i++) {
      GF2X a, b, c, d;
      long da = RandomBnd(5*NTL_BITS_PER_LONG);
      long db = RandomBnd(5*NTL_BITS_PER_LONG);
      long dc = RandomBnd(5*NTL_BITS_PER_LONG);
      long dd = RandomBnd(5*NTL_BITS_PER_LONG);
      random(a, da);  random(b, db);  random(c, dc);  random(d, dd);

      if ((a + b)*(c + d) != c*a + d*a + c*b + d*b) {
	 printf("999999999999999 ");
	 print_flag();
	 return 0;
      }
   }
   

   n = 16;
   s = 56;

   GF2X *a = new GF2X[s];
   GF2X *b = new GF2X[s];

   GF2X c;

   for (k = 0; k < s; k++) {
      random(a[k], (n + (k % 7))*NTL_BITS_PER_LONG);
      random(b[k], (n + (k % 8))*NTL_BITS_PER_LONG);
   }

   for (k = 0; k < s; k++) mul(c, a[k], b[k]);


   iter = 1;

   do {
     t = GetTime();
     for (i = 0; i < iter; i++) {
        for (j = 0; j < 1; j++) for (k = 0; k < s; k++) mul(c, a[k], b[k]);
     }
     t = GetTime() - t;
     iter = 2*iter;
   } while(t < 1);

   iter = iter/2;

   iter = long((2/t)*iter) + 1;

   double tvec[5];
   long w;

   for (w = 0; w < 5; w++) {
     t = GetTime();
     for (i = 0; i < iter; i++) {
        for (j = 0; j < 1; j++) for (k = 0; k < s; k++) mul(c, a[k], b[k]);
     }
     t = GetTime() - t;
     tvec[w] = t;
   }


   t = clean_data(tvec);

   t = floor((t/iter)*1e14);

   if (t < 0 || t >= 1e15)
      printf("999999999999999 ");
   else
      printf("%015.0f ", t);

   printf(" [%ld] ", iter);

   print_flag();

   return 0;
}
Esempio n. 22
0
int
main (int argc, char **argv)
{
	int i, col, r;
	const char *name = "ucl_chartable";
	bool need_or;
	char valbuf[2048];

	col = 0;

	if (argc > 1) {
		name = argv[1];
	}

	printf ("static const unsigned int %s[256] = {\n", name);

	for (i = 0; i < 256; i ++) {
		need_or = false;
		r = 0;
		/* UCL_CHARACTER_VALUE_END */

		if (i == ' ' || i == '\t') {
			r += print_flag ("UCL_CHARACTER_WHITESPACE", &need_or, valbuf + r);
		}
		if (isspace (i)) {
			r += print_flag ("UCL_CHARACTER_WHITESPACE_UNSAFE", &need_or, valbuf + r);
		}
		if (isalnum (i) || i >= 0x80 || i == '/' || i == '_') {
			r += print_flag ("UCL_CHARACTER_KEY_START", &need_or, valbuf + r);
		}
		if (isalnum (i) || i == '-' || i == '_' || i == '/' || i == '.' || i >= 0x80) {
			r += print_flag ("UCL_CHARACTER_KEY", &need_or, valbuf + r);
		}
		if (i == 0 || i == '\r' || i == '\n' || i == ']' || i == '}' || i == ';' || i == ',' || i == '#') {
			r += print_flag ("UCL_CHARACTER_VALUE_END", &need_or, valbuf + r);
		}
		else {
			if (isprint (i) || i >= 0x80) {
				r += print_flag ("UCL_CHARACTER_VALUE_STR", &need_or, valbuf + r);
			}
			if (isdigit (i) || i == '-') {
				r += print_flag ("UCL_CHARACTER_VALUE_DIGIT_START", &need_or, valbuf + r);
			}
			if (isalnum (i) || i == '.' || i == '-' || i == '+') {
				r += print_flag ("UCL_CHARACTER_VALUE_DIGIT", &need_or, valbuf + r);
			}
		}
		if (i == '"' || i == '\\' || i == '/' || i == 'b' ||
			i == 'f' || i == 'n' || i == 'r' || i == 't' || i == 'u') {
			r += print_flag ("UCL_CHARACTER_ESCAPE", &need_or, valbuf + r);
		}
		if (i == ' ' || i == '\t' || i == ':' || i == '=') {
			r += print_flag ("UCL_CHARACTER_KEY_SEP", &need_or, valbuf + r);
		}
		if (i == '\n' || i == '\r' || i == '\\' || i == '\b' || i == '\t' ||
				i == '"' || i == '\f') {
			r += print_flag ("UCL_CHARACTER_JSON_UNSAFE", &need_or, valbuf + r);
		}
		if (i == '\n' || i == '\r' || i == '\\' || i == '\b' || i == '\t' ||
				i == '"' || i == '\f' || i == '=' || i == ':' || i == '{' || i == '[' || i == ' ') {
			r += print_flag ("UCL_CHARACTER_UCL_UNSAFE", &need_or, valbuf + r);
		}

		if (!need_or) {
			r += print_flag ("UCL_CHARACTER_DENIED", &need_or, valbuf + r);
		}

		if (isprint (i)) {
			r += sprintf (valbuf + r, " /* %c */", i);
		}
		if (i != 255) {
			r += sprintf (valbuf + r, ", ");
		}
		col += r;
		if (col > 80) {
			printf ("\n%s", valbuf);
			col = r;
		}
		else {
			printf ("%s", valbuf);
		}
	}
	printf ("\n}\n");

	return 0;
}
Esempio n. 23
0
int main()
{

#ifdef NTL_LONG_LONG


   if (sizeof(NTL_LL_TYPE) < 2*sizeof(long)) {
      printf("999999999999999 ");
      print_flag();
      return 0;
   }

#endif

   SetSeed(ZZ(0));

   long i, k;

   
   k = 10*NTL_ZZ_NBITS;

   for (i = 0; i < 10000; i++) {
      ZZ a, b, c, d;
      long da = RandomBnd(k);
      long db = RandomBnd(k);
      long dc = RandomBnd(k);
      long dd = RandomBnd(k);
      RandomLen(a, da);  RandomLen(b, db);  RandomLen(c, dc);  RandomLen(d, dd);

      if ((a + b)*(c + d) != c*a + d*a + c*b + d*b) {
	 printf("999999999999999 ");
	 print_flag();
	 return 0;
      }
   }

   

   for (i = 0; i < 10000; i++) {
      ZZ a, b, c;
      
      long da = RandomBnd(k);
      long db = RandomBnd(k);
      long dc = RandomBnd(k) + 2;
      
      RandomLen(a, da);  RandomLen(b, db);  RandomLen(c, dc); 

      if ( ( a * b ) % c != ((a % c) * (b % c)) % c ) {
	 printf("999999999999999 ");
	 print_flag();
	 return 0;
      }
   }

   k = 1024;

   ZZ x1, x2, x3;
   double t;
   long j;

   RandomLen(x1, k);
   RandomLen(x2, k);
   

   long iter;

   mul(x3, x1, x2);

   iter = 1;

   do {
     t = GetTime();
     for (i = 0; i < iter; i++) {
        for (j = 0; j < 500; j++) mul(x3, x1, x2);
      }
     t = GetTime() - t;
     iter = 2*iter;
   } while(t < 1);


   iter = iter/2;
   iter = long((3/t)*iter) + 1;

   double tvec[5];
   long w;

   for (w = 0; w < 5; w++) {
     t = GetTime();
     for (i = 0; i < iter; i++) {
        for (j = 0; j < 500; j++) mul(x3, x1, x2);
      }
     t = GetTime() - t;
     tvec[w] = t;
   }

   t = clean_data(tvec);

   t = floor((t/iter)*1e14);

   if (t < 0 || t >= 1e15)
      printf("999999999999999 ");
   else
      printf("%015.0f ", t);

   printf(" [%ld] ", iter);

   print_flag();

   return 0;
}
Esempio n. 24
0
/* device creation */
static void macsec_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
{
	if (!tb)
		return;

	if (tb[IFLA_MACSEC_SCI]) {
		if (is_json_context()) {
			SPRINT_BUF(b1);

			snprintf(b1, sizeof(b1), "%016llx",
				 ntohll(rta_getattr_u64(tb[IFLA_MACSEC_SCI])));
			print_string(PRINT_JSON, "sci", NULL, b1);
		} else {
			fprintf(f, "sci %016llx ",
				ntohll(rta_getattr_u64(tb[IFLA_MACSEC_SCI])));
		}
	}

	print_flag(tb, "protect", IFLA_MACSEC_PROTECT);

	if (tb[IFLA_MACSEC_CIPHER_SUITE]) {
		__u64 csid
			= rta_getattr_u64(tb[IFLA_MACSEC_CIPHER_SUITE]);

		print_string(PRINT_ANY,
			     "cipher_suite",
			     "cipher %s ",
			     cs_id_to_name(csid));
	}

	if (tb[IFLA_MACSEC_ICV_LEN]) {
		if (is_json_context()) {
			char b2[4];

			snprintf(b2, sizeof(b2), "%hhu",
				 rta_getattr_u8(tb[IFLA_MACSEC_ICV_LEN]));
			print_uint(PRINT_JSON, "icv_len", NULL, atoi(b2));
		} else {
			fprintf(f, "icvlen %hhu ",
				rta_getattr_u8(tb[IFLA_MACSEC_ICV_LEN]));
		}
	}

	if (tb[IFLA_MACSEC_ENCODING_SA]) {
		if (is_json_context()) {
			char b2[4];

			snprintf(b2, sizeof(b2), "%hhu",
				 rta_getattr_u8(tb[IFLA_MACSEC_ENCODING_SA]));
			print_uint(PRINT_JSON, "encoding_sa", NULL, atoi(b2));
		} else {
			fprintf(f, "encodingsa %hhu ",
				rta_getattr_u8(tb[IFLA_MACSEC_ENCODING_SA]));
		}
	}

	if (tb[IFLA_MACSEC_VALIDATION]) {
		__u8 val = rta_getattr_u8(tb[IFLA_MACSEC_VALIDATION]);

		print_string(PRINT_ANY,
			     "validation",
			     "validate %s ",
			     validate_str[val]);
	}

	const char *inc_sci, *es, *replay;

	if (is_json_context()) {
		inc_sci = "inc_sci";
		replay = "replay_protect";
		es = "es";
	} else {
		inc_sci = "send_sci";
		es = "end_station";
		replay = "replay";
	}

	print_flag(tb, "encrypt", IFLA_MACSEC_ENCRYPT);
	print_flag(tb, inc_sci, IFLA_MACSEC_INC_SCI);
	print_flag(tb, es, IFLA_MACSEC_ES);
	print_flag(tb, "scb", IFLA_MACSEC_SCB);
	print_flag(tb, replay, IFLA_MACSEC_REPLAY_PROTECT);

	if (tb[IFLA_MACSEC_WINDOW])
		print_int(PRINT_ANY,
			  "window",
			  "window %d ",
			  rta_getattr_u32(tb[IFLA_MACSEC_WINDOW]));
}
Esempio n. 25
0
int main()
{
   _newntl_gmp_hack = 0;


   long n, k;

   n = 200;
   k = 10*newNTL_ZZ_NBITS;

   ZZ p;

   RandomLen(p, k);


   ZZ_p::init(p);         // initialization

   ZZ_pX f, g, h, r1, r2, r3;

   random(g, n);    // g = random polynomial of degree < n
   random(h, n);    // h =             "   "
   random(f, n);    // f =             "   "

   SetCoeff(f, n);  // Sets coefficient of X^n to 1

   // For doing arithmetic mod f quickly, one must pre-compute
   // some information.

   ZZ_pXModulus F;
   build(F, f);

   PlainMul(r1, g, h);  // this uses classical arithmetic
   PlainRem(r1, r1, f);

   MulMod(r2, g, h, F);  // this uses the FFT

   MulMod(r3, g, h, f);  // uses FFT, but slower

   // compare the results...

   if (r1 != r2) {
      printf("999999999999999 ");
      print_flag();
      return 0;
   }
   else if (r1 != r3) {
      printf("999999999999999 ");
      print_flag();
      return 0;
   }

   double t;
   long i;
   long iter;

   n = 1024;
   k = 1024;
   RandomLen(p, k);

   ZZ_p::init(p);

   ZZ_pX j1, j2, j3;

   random(j1, n);
   random(j2, n);

   mul(j3, j1, j2);

   iter = 1;

   do {
     t = GetTime();
     for (i = 0; i < iter; i++) {
        FFTMul(j3, j1, j2);
     }
     t = GetTime() - t;
     iter = 2*iter;
   } while(t < 1);

   iter = iter/2;

   iter = long((2/t)*iter) + 1;

   double tvec[5];
   long w;

   for (w = 0; w < 5; w++) {
     t = GetTime();
     for (i = 0; i < iter; i++) {
        FFTMul(j3, j1, j2);
     }
     t = GetTime() - t;
     tvec[w] = t;
   } 


   t = clean_data(tvec);

   t = floor((t/iter)*1e12);

   if (t < 0 || t >= 1e15)
      printf("999999999999999 ");
   else
      printf("%015.0f ", t);

   printf(" [%ld] ", iter);

   print_flag();

   return 0;
}
Esempio n. 26
0
//--------------------------------- SHELL core os.c---------
char listen_key(){
//	unsigned short int init_pos = get_pointer_pos();
	flag_len=17;
	char i = gets( key);
	screen_sc_T = 1;
	Print_flag_mark = 1;
	if( strcmp( key, "clear\0")){			// char *,const char *
		clear();
		return i;
	}

	if( strcmp( key, "time\0")){
		time();
		return i;
	}

	if( strcmp( key, "date\0")){
		date();
		return i;
	}

	if( strcmp( key, "python\0")){
		python();
		return i;
	}
	if( strcmp( key, "start\0")){
		screen_init();
		Print_flag_mark = 0;
		Process();
		return i;
	}

	if( strcmp( key, "help\0")){
		//can't refer 2 two times, so...
		init_flag_position();	
		screen_init();
		print_welcome_msg();
		print_message();
		print_flag(); //root@wangqin4377@:   position

		return i;
	}
//---------------------------------mark: man xxx, run xxx,asc xx...

	if( synCheck( key, "asc\0")){
		asc( key);
		return i;
	}

	if( synCheck( key, "man\0")){
		man( key);
		return i;
	}	
	
	if( synCheck( key, "run\0")){
		run( key);
		return i;
	}

	if( synCheck( key, "syscall\0")){
		syscall_test();
		return i;
	}


	if( synCheck( key, "int\0")){
		if( strcmp( key, "int 33h")){
			__asm__(  "int $0x33");
			return i;
		}
		if( strcmp( key, "int 34h")){
			__asm__(  "int $0x34");
			return i;
		}
		if( strcmp( key, "int 35h")){
			__asm__(  "int $0x35");
			return i;
		}
		if( strcmp( key, "int 36h")){
			__asm__(  "int $0x36");
			return i;
		}
	}

	if( key[0] == '\0'){
		return i;
	}
	
	flag_scroll();
	set_pointer_pos();
	print_str("  No such file or Directory", 27);
	screen_sc_T = 2;
	return i;
}
Esempio n. 27
0
int main(int argc, char *argv[])
{
    srand(time(NULL));
    bool giveme = false;
    long zero = 0;
    char buf[100];
    bool gotflag = false;
    puts("Welcome to hell, we have real strong JumpFu here");
start:
    DBUG("start")
    puts("Where to?");
    fflush(0);
    zero = 0;
    fgets(buf, 117, stdin);
    buf[99] = 0;
    if (strncmp(buf+10, "WHO GOES THERE", strlen("WHO GOES THERE")) == 10)
        goto six;
    else
        goto two;
one:
    DBUG("one")
    puts("WELCOME BACK");
    goto start;
two:
    DBUG("two")
    puts("Who are you? Where are you even going?");
    fflush(0);
    if (buf[69]=='8')
        goto eleven;
    if (buf[69]=='9')
        goto five;
    goto one;
three:
    DBUG("three")
    puts("Here we go again...");
    fflush(0);
    goto eight;
four:
    DBUG("four")
    if (!zero)
        goto nine;
five:
    DBUG("five")
    giveme = true;
    if (!zero)
        goto eight;
six:
    DBUG("six")
    giveme = false;
seven: //lucky number seven
    DBUG("seven")
    if (giveme){
        gotflag = true;
        print_flag();
        goto end;
    }else{
        puts("NO!!! GO AWAY");
        fflush(0);
    }
eight:
    DBUG("eight")
    puts("Goodnight! See you later!");
    fflush(0);
    sleep(1);
    if (rand() % 2)
        goto one;
    else
        goto twelve;
nine:
    DBUG("nine")
    goto two;
ten:
    DBUG("ten")
    if (!zero)
        goto end;
    goto one;
eleven:
    DBUG("eleven")
    if (strncmp(&zero, "risky!", strlen("risky")))
        goto eight;
    goto six;
twelve:
    DBUG("twelve")
    if (zero)
        goto seven;
    else
        goto ten;
end:
    DBUG("end")
    if (!gotflag)
        puts("Looks like you are leavin here empty handed.");
    else
        puts("Nice work. You won.");
    fflush(0);
    return 0;
}