/usr/share/doc/libirman/examples/test_func.c is in libirman-dev 0.5.2-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | /* test_func.c - test/demo of LIBIRMAN's mid level functions */
/* Copyright (C) 1998 Tom Wheeley, see file COPYING for details */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include "irman.h"
int main(int argc, char **argv)
{
unsigned char *code = NULL;
unsigned char *oldcode = NULL;
char *text;
if (argc < 2) {
fprintf(stderr, "usage: test_func device\n");
fprintf(stderr, " where device is the serial port at which the infra red receiver resides\n");
fprintf(stderr, " eg /dev/ttyS1 for COM2 on a PC running Linux\n");
exit(0);
}
errno = 0;
if (ir_init(argv[1]) < 0) {
fprintf(stderr, "error initialising Irman: `%s'\n", ir_strerror(errno));
exit(1);
}
printf("ok\n");
errno = 0;
for(;;) {
code = ir_get_code();
if (code) {
text = ir_code_to_text(code);
printf("rx `%s'\n", text);
/* error handling dullness */
} else {
if (errno == IR_EDUPCODE) {
printf("rx `%s' (dup)\n", oldcode == NULL ?
"(null - bug)" :
ir_code_to_text(oldcode));
} else {
fprintf(stderr, "error reading code: `%s'\n", ir_strerror(errno));
ir_finish();
exit(1);
}
errno = 0;
}
oldcode = code;
}
ir_finish();
return 0;
}
/* end of test_func.c */
|