Compare commits
3 Commits
4ed0ab33b9
...
ffbc4a13d4
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ffbc4a13d4 | ||
![]() |
b372e0428d | ||
![]() |
4a3408633d |
@ -6,9 +6,14 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define _POSIX_C_SOURCE 600L /* for fileno(3) */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <sys/select.h>
|
||||||
|
|
||||||
#include "ecoute.h"
|
#include "ecoute.h"
|
||||||
|
|
||||||
/*==------------------------------------------------------------------==*/
|
/*==------------------------------------------------------------------==*/
|
||||||
@ -79,6 +84,42 @@ foo = 42;
|
|||||||
return foo;
|
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)
|
void termine_ecran(void)
|
||||||
{
|
{
|
||||||
endwin(); exit(0);
|
endwin(); exit(0);
|
||||||
|
@ -57,7 +57,7 @@ int foo, len_nom, len_ext;
|
|||||||
fprintf(stderr, "type_du_fichier(%s)\n", nom);
|
fprintf(stderr, "type_du_fichier(%s)\n", nom);
|
||||||
#endif
|
#endif
|
||||||
len_nom = strlen(nom);
|
len_nom = strlen(nom);
|
||||||
for (foo=0; foo<NBR_TYPES; foo++) {
|
for (foo=0; foo<(int)NBR_TYPES; foo++) {
|
||||||
len_ext = strlen(types_de_fichiers[foo].extension);
|
len_ext = strlen(types_de_fichiers[foo].extension);
|
||||||
if ( (len_nom > len_ext) &&
|
if ( (len_nom > len_ext) &&
|
||||||
!strcmp(nom+(len_nom-len_ext), types_de_fichiers[foo].extension) ) {
|
!strcmp(nom+(len_nom-len_ext), types_de_fichiers[foo].extension) ) {
|
||||||
@ -80,7 +80,7 @@ int foo;
|
|||||||
|
|
||||||
if (type == SON_UNKNOW) return "unknow";
|
if (type == SON_UNKNOW) return "unknow";
|
||||||
|
|
||||||
for (foo=0; foo<NBR_TYPES; foo++) {
|
for (foo=0; foo<(int)NBR_TYPES; foo++) {
|
||||||
if (type==types_de_fichiers[foo].numtype)
|
if (type==types_de_fichiers[foo].numtype)
|
||||||
return (types_de_fichiers[foo].extension)+1;
|
return (types_de_fichiers[foo].extension)+1;
|
||||||
}
|
}
|
||||||
@ -93,7 +93,7 @@ int foo;
|
|||||||
|
|
||||||
if (type == SON_UNKNOW) return "unknow";
|
if (type == SON_UNKNOW) return "unknow";
|
||||||
|
|
||||||
for (foo=0; foo<NBR_TYPES; foo++) {
|
for (foo=0; foo<(int)NBR_TYPES; foo++) {
|
||||||
if (type==types_de_fichiers[foo].numtype)
|
if (type==types_de_fichiers[foo].numtype)
|
||||||
return (types_de_fichiers[foo].descr);
|
return (types_de_fichiers[foo].descr);
|
||||||
}
|
}
|
||||||
@ -175,7 +175,6 @@ int foo;
|
|||||||
WINDOW *popup;
|
WINDOW *popup;
|
||||||
char chaine[100];
|
char chaine[100];
|
||||||
struct stat st;
|
struct stat st;
|
||||||
long magicbits;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ncurses initial stuff
|
* ncurses initial stuff
|
||||||
|
@ -20,7 +20,7 @@ ao_sample_format format;
|
|||||||
ao_device * device;
|
ao_device * device;
|
||||||
char chaine[120];
|
char chaine[120];
|
||||||
short * samples;
|
short * samples;
|
||||||
int lu;
|
int lu, key;
|
||||||
long total_lu;
|
long total_lu;
|
||||||
|
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
@ -103,7 +103,13 @@ while ( (lu=sf_read_short(sndf, samples, T_BUFFER)) > 0 )
|
|||||||
wrefresh(popup);
|
wrefresh(popup);
|
||||||
|
|
||||||
/* HERE WE HAVE TO DETECT A 'STOP LISTEN' FUNCTION. */
|
/* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -8,8 +8,8 @@ nécessite donc un peu de nettoyage.
|
|||||||
|
|
||||||
## DumpGDBM
|
## DumpGDBM
|
||||||
|
|
||||||
Pour le [debug](DumpGDBM) des fichiers `key/data` géres par GDBM. Ligne de commande
|
Pour le [debug](DumpGDBM) des fichiers `key/data` géres par GDBM.
|
||||||
aver une interface _readline_.
|
Ligne de commande avec une interface _readline_.
|
||||||
|
|
||||||
```
|
```
|
||||||
tth@redlady:~/Devel/KlugyTools/DumpGDBM$ ./dumpgdbm -i exemple.gdbm
|
tth@redlady:~/Devel/KlugyTools/DumpGDBM$ ./dumpgdbm -i exemple.gdbm
|
||||||
|
Loading…
Reference in New Issue
Block a user