Compare commits

..

No commits in common. "ffbc4a13d4c1756c371cb3ce518fb34a7ec16b36" and "4ed0ab33b9efdc7b5804acf3a38f7a879faf6f40" have entirely different histories.

4 changed files with 8 additions and 54 deletions

View File

@ -6,14 +6,9 @@
*
*/
#define _POSIX_C_SOURCE 600L /* for fileno(3) */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/select.h>
#include "ecoute.h"
/*==------------------------------------------------------------------==*/
@ -84,42 +79,6 @@ foo = 42;
return foo;
}
/*==------------------------------------------------------------------==*/
/*
* detection de la frappe d'une touche clavier -- remember kbhit() ?
*/
int is_a_key_hitted(void)
{
int fd,retv;
fd_set in_fds;
struct timeval tv;
fd = fileno(stdin);
#if DEBUG_LEVEL
fprintf(stderr, "%s: fileno -> %d\n", __func__, fd);
#endif
FD_ZERO(&in_fds); FD_SET(fd, &in_fds);
tv.tv_sec = tv.tv_usec = 0;
retv = select(1, &in_fds, NULL, NULL, &tv);
#if DEBUG_LEVEL
fprintf(stderr, "%s: select -> %d\n", __func__, retv);
#endif
if (-1 == retv) {
perror("select()");
}
else if (0 == retv) {
/* no key hit */
}
else {
/* got a keypress */
return 1;
}
return 0;
}
/*==------------------------------------------------------------------==*/
void termine_ecran(void)
{
endwin(); exit(0);

View File

@ -57,7 +57,7 @@ int foo, len_nom, len_ext;
fprintf(stderr, "type_du_fichier(%s)\n", nom);
#endif
len_nom = strlen(nom);
for (foo=0; foo<(int)NBR_TYPES; foo++) {
for (foo=0; foo<NBR_TYPES; foo++) {
len_ext = strlen(types_de_fichiers[foo].extension);
if ( (len_nom > len_ext) &&
!strcmp(nom+(len_nom-len_ext), types_de_fichiers[foo].extension) ) {
@ -80,7 +80,7 @@ int foo;
if (type == SON_UNKNOW) return "unknow";
for (foo=0; foo<(int)NBR_TYPES; foo++) {
for (foo=0; foo<NBR_TYPES; foo++) {
if (type==types_de_fichiers[foo].numtype)
return (types_de_fichiers[foo].extension)+1;
}
@ -93,7 +93,7 @@ int foo;
if (type == SON_UNKNOW) return "unknow";
for (foo=0; foo<(int)NBR_TYPES; foo++) {
for (foo=0; foo<NBR_TYPES; foo++) {
if (type==types_de_fichiers[foo].numtype)
return (types_de_fichiers[foo].descr);
}
@ -175,6 +175,7 @@ int foo;
WINDOW *popup;
char chaine[100];
struct stat st;
long magicbits;
/*
* ncurses initial stuff

View File

@ -20,7 +20,7 @@ ao_sample_format format;
ao_device * device;
char chaine[120];
short * samples;
int lu, key;
int lu;
long total_lu;
#if DEBUG_LEVEL
@ -103,13 +103,7 @@ while ( (lu=sf_read_short(sndf, samples, T_BUFFER)) > 0 )
wrefresh(popup);
/* HERE WE HAVE TO DETECT A 'STOP LISTEN' FUNCTION. */
if (is_a_key_hitted()) {
key = getch();
fprintf(stderr, "%s key pressed 0x%X\n", __func__, key);
if ('X' == key) {
break;
}
}
}
/*

View File

@ -8,8 +8,8 @@ nécessite donc un peu de nettoyage.
## DumpGDBM
Pour le [debug](DumpGDBM) des fichiers `key/data` géres par GDBM.
Ligne de commande avec une interface _readline_.
Pour le [debug](DumpGDBM) des fichiers `key/data` géres par GDBM. Ligne de commande
aver une interface _readline_.
```
tth@redlady:~/Devel/KlugyTools/DumpGDBM$ ./dumpgdbm -i exemple.gdbm