integration du terminal dans le machin
This commit is contained in:
36
core/utils.c
36
core/utils.c
@@ -6,13 +6,47 @@
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
extern int verbosity;
|
||||
|
||||
/* --------------------------------------------------------------- */
|
||||
/* maybe not a really goof initialisation... */
|
||||
int special_dumper(FILE *fp, unsigned char octet)
|
||||
{
|
||||
static int idx = 0;
|
||||
static unsigned char buffer[16];
|
||||
|
||||
int foo, c;
|
||||
|
||||
#if DEBUG_LEVEL > 1
|
||||
fprintf(stderr, "%s $%x %c\n", __func__, octet, octet);
|
||||
#endif
|
||||
|
||||
buffer[idx++] = octet;
|
||||
|
||||
if (idx==16) {
|
||||
fprintf(fp, "dmp : ");
|
||||
for (foo=0; foo<16; foo++) {
|
||||
fprintf(fp, "%02x ", buffer[foo]);
|
||||
if (7==foo) fprintf(fp, " ");
|
||||
}
|
||||
fprintf(fp, " - |");
|
||||
for (foo=0; foo<16; foo++) {
|
||||
c = buffer[foo];
|
||||
fprintf(fp, "%c", isprint(c) ? c : ' ');
|
||||
}
|
||||
fprintf(fp, "|\n"); fflush(fp);
|
||||
idx = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* maybe not a really good initialisation... */
|
||||
int seed_my_rand(int foo)
|
||||
{
|
||||
long v1, v2;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
* core/utils.h
|
||||
*/
|
||||
|
||||
int special_dumper(FILE *fp, unsigned char octet);
|
||||
|
||||
int seed_my_rand(int foo);
|
||||
int random1000(int type);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user