summaryrefslogtreecommitdiff
path: root/braille.c
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2011-09-03 14:05:25 +0200
committerAxel Beckert <abe@deuxchevaux.org>2011-09-03 14:05:25 +0200
commit9d943c7539f59f42ba8f8052497dc541fe5f0167 (patch)
treec8725127bf7a68d3d7fe57adca45c204b25adf21 /braille.c
parent0e9a09d7718f02726b12924f7ddb05a992202aa3 (diff)
downloadscreen-9d943c7539f59f42ba8f8052497dc541fe5f0167.tar.gz
Imported Upstream version 4.0.2upstream/4.0.2
Diffstat (limited to 'braille.c')
-rw-r--r--braille.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/braille.c b/braille.c
index a0c1bc6..9951087 100644
--- a/braille.c
+++ b/braille.c
@@ -24,8 +24,6 @@
*
****************************************************************
*/
-#include "rcs.h"
-RCS_ID("$Id: braille.c,v 1.1 1995/09/06 15:45:26 jnweiger Exp jnweiger $")
#include <stdio.h>
#include <fcntl.h>
@@ -229,17 +227,23 @@ char *tablename;
FILE *fp;
char buffer[80], a[10];
- if ((fp = fopen(tablename, "r")) == 0)
+ if ((fp = secfopen(tablename, "r")) == 0)
{
- Msg(0, "Braille table not found: %s ", tablename);
+ Msg(errno, "Braille table not found: %s ", tablename);
return -1;
}
bzero(bd.bd_btable, 256);
+ /* format:
+ * Dec Hex Braille Description
+ * 7 07 (12-45--8) BEL
+ */
while (fgets(buffer, sizeof(buffer), fp))
{
if (buffer[0] == '#')
continue;
- sscanf(buffer,"%d %x %s", &i, &j, a);
+ sscanf(buffer,"%d %x %8s", &i, &j, a);
+ if (i < 0 || i > 255)
+ continue;
for (j=1, p=1, c=0; j<9; j++, p*=2)
if (a[j] == '0' + j)
c += p;