master
pabr 2018-02-11 00:10:10 +01:00
rodzic c9f01ba87c
commit 5ad83f3bee
3 zmienionych plików z 39 dodań i 5 usunięć

Wyświetl plik

@ -1019,6 +1019,7 @@ void usage(const char *name, FILE *f, int c, const char *info=NULL) {
" -h Display this help message and exit\n" " -h Display this help message and exit\n"
" -v Output debugging info at startup and exit\n" " -v Output debugging info at startup and exit\n"
" -d Output debugging info during operation\n" " -d Output debugging info during operation\n"
" --version Display version and exit\n"
" --fd-pp FDNUM Dump preprocessed IQ data to file descriptor\n" " --fd-pp FDNUM Dump preprocessed IQ data to file descriptor\n"
" --fd-info FDNUM Output demodulator status to file descriptor\n" " --fd-info FDNUM Output demodulator status to file descriptor\n"
" --fd-const FDNUM Output constellation and symbols to file descr\n" " --fd-const FDNUM Output constellation and symbols to file descr\n"
@ -1041,6 +1042,9 @@ void usage(const char *name, FILE *f, int c, const char *info=NULL) {
exit(c); exit(c);
} }
#ifndef VERSION
#define VERSION "undefined"
#endif
int main(int argc, const char *argv[]) { int main(int argc, const char *argv[]) {
config cfg; config cfg;
@ -1054,6 +1058,10 @@ int main(int argc, const char *argv[]) {
cfg.debug2 = cfg.debug; cfg.debug2 = cfg.debug;
cfg.debug = true; cfg.debug = true;
} }
else if ( ! strcmp(argv[i], "--version") ) {
printf("%s\n", VERSION);
return 0;
}
else if ( ! strcmp(argv[i], "-f") && i+1<argc ) else if ( ! strcmp(argv[i], "-f") && i+1<argc )
cfg.Fs = atof(argv[++i]); cfg.Fs = atof(argv[++i]);
else if ( ! strcmp(argv[i], "--sr") && i+1<argc ) else if ( ! strcmp(argv[i], "--sr") && i+1<argc )

Wyświetl plik

@ -194,11 +194,16 @@ void usage(const char *name, FILE *f, int c, const char *info=NULL) {
" --s16 Output 16-bit ints\n" " --s16 Output 16-bit ints\n"
" -v Output debugging info at startup and exit\n" " -v Output debugging info at startup and exit\n"
" -d Output debugging info during operation\n" " -d Output debugging info during operation\n"
" --version Display version and exit\n"
); );
if ( info ) fprintf(f, "** Error while processing '%s'\n", info); if ( info ) fprintf(f, "** Error while processing '%s'\n", info);
exit(c); exit(c);
} }
#ifndef VERSION
#define VERSION "undefined"
#endif
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
config cfg; config cfg;
@ -209,6 +214,10 @@ int main(int argc, char *argv[]) {
cfg.verbose = true; cfg.verbose = true;
else if ( ! strcmp(argv[i], "-d") ) else if ( ! strcmp(argv[i], "-d") )
cfg.debug = true; cfg.debug = true;
else if ( ! strcmp(argv[i], "--version") ) {
printf("%s\n", VERSION);
exit(0);
}
else if ( ! strcmp(argv[i], "--cr") && i+1<argc ) { else if ( ! strcmp(argv[i], "--cr") && i+1<argc ) {
++i; ++i;
// DVB-S // DVB-S

Wyświetl plik

@ -3,18 +3,35 @@
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#ifndef VERSION
#define VERSION "undefined"
#endif
void usage(const char *name, FILE *f, int c, const char *info=NULL) {
fprintf(stderr, "Usage: %s [options]\n", name);
fprintf(stderr, "Output numbered MPEG TS packets on stdout.\n");
fprintf
(f, "\nOptions:\n"
" --version Display version and exit\n"
" -c INT Number of packets to output\n"
);
if ( info ) fprintf(f, "Error while processing '%s'\n", info);
exit(c);
}
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
const int SIZE = 188; const int SIZE = 188;
int count = -1; int count = -1;
for ( int i=1; i<argc; ++i ) { for ( int i=1; i<argc; ++i ) {
if ( !strcmp(argv[i],"-c") && i+1<argc ) if ( ! strcmp(argv[i],"-c") && i+1<argc )
count = atoi(argv[++i]); count = atoi(argv[++i]);
else { else if ( ! strcmp(argv[i], "--version") ) {
fprintf(stderr, "Usage: %s [-c PACKETCOUNT]\n", argv[0]); printf("%s\n", VERSION);
fprintf(stderr, "Output numbered MPEG TS packets on stdout.\n"); exit(0);
exit(1);
} }
else
usage(argv[0], stderr, 1, argv[i]);
} }
for ( unsigned long t=0; count<0 || count--; ++t ) { for ( unsigned long t=0; count<0 || count--; ++t ) {