/** * Function to call with a human-readable format of an address * * @param cls closure * @param address NULL on error, otherwise 0-terminated printable UTF-8 string */ static void process_resolved_address (void *cls, const char *address) { struct AddressRecord * ar = cls; struct PrintContext *pc = ar->pc; if (NULL != address) { if (NULL == ar->result) ar->result = GNUNET_strdup (address); return; } ar->atsc = NULL; pc->num_addresses++; if (pc->num_addresses == pc->address_list_size) dump_pc (pc); }
/** * Print information about the peer. * Currently prints the GNUNET_PeerIdentity and the transport address. * * @param cls the 'struct PrintContext' * @param peer identity of the peer * @param hello addresses of the peer * @param err_msg error message */ static void print_peer_info (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HELLO_Message *hello, const char *err_msg) { struct GNUNET_CRYPTO_HashAsciiEncoded enc; struct PrintContext *pc; if (NULL == peer) { pic = NULL; /* end of iteration */ if (NULL != err_msg) { FPRINTF (stderr, _("Error in communication with PEERINFO service: %s\n"), err_msg); } if (NULL == pc_head) tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL); return; } if ((GNUNET_YES == be_quiet) || (NULL == hello)) { GNUNET_CRYPTO_hash_to_enc (&peer->hashPubKey, &enc); printf ("%s\n", (const char *) &enc); return; } pc = GNUNET_malloc (sizeof (struct PrintContext)); GNUNET_CONTAINER_DLL_insert (pc_head, pc_tail, pc); pc->peer = *peer; GNUNET_HELLO_iterate_addresses (hello, GNUNET_NO, &count_address, pc); if (0 == pc->off) { dump_pc (pc); return; } pc->address_list_size = pc->off; pc->address_list = GNUNET_malloc (sizeof (struct AddressRecord) * pc->off); GNUNET_HELLO_iterate_addresses (hello, GNUNET_NO, &print_address, pc); }
int main (void){ icmd(); start:; schwierigket=0; //standart frontpage system("title Mastermind"); printf("Mastermind Programmiert von Simon Diepold\n"); printf("drcke eine belibige Taste..."); getchar(); system("cls"); printf("Whlen sie eine schwierigkeits Stufe:\n" "Einfach(1) [4 Stellen, keine gleichen Zahlen,8 Versuche]\n" "Herausfordernd(2) [4 Stellen, 6 Versuche]\n" "Schwer(3) [8 Stellen, 6 Versuche]\n" "Beenden(4) [beendet das Programm]\n" ); while(1){ schwierigket=getchar(); if(schwierigket==0x31 ||schwierigket==0x32 || schwierigket==0x33 || schwierigket==0x34){ if(schwierigket==0x34){ goto end; } schwierigket-=0x30; ziffern=level[(schwierigket-1)]; break; } } system("cls"); //zufallsgenerator if(schwierigket==1){ random(backup); } else if (schwierigket==2){ randomLV2(backup); } else if (schwierigket==3){ randomLV3(backup); } xprintf(); versuch = 0; beginn:; int i=0; int x=0; while(i<8){ result[i]=0; i++; } i=0; while(i<8){ computer[i]=backup[i]; i++; } i=0; playerinput(player,ziffern); x=check(ziffern); if (x==ziffern){ printf("\ndu hast gewonnen! Gratulation!"); getch(); system("cls"); goto start; }else{ x+=compare(ziffern); set_posotion((ziffern+1),(versuch+1)); i=0; while(i<x){ result[i]+=0x30; printf("%c",result[i]); i++; } printf(" \n"); if(versuch==rounds[schwierigket-1]){ printf("\nleider verloren. Die Lsung ist:"); dump_pc(); getch(); system("cls"); goto start; } versuch++; goto beginn; } end:; return 0; }