summaryrefslogtreecommitdiffstats
path: root/gnu
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1994-10-07 13:13:32 +0000
committerache <ache@FreeBSD.org>1994-10-07 13:13:32 +0000
commitc680e0960e96d41131b7ba77d6199e38f7c5bb4e (patch)
tree66a6285992d8a1ecf4ca053efecba1e8be4764cc /gnu
parent50d3916b0ce34bf8c1c5e61cb3bdef08d5a1fab3 (diff)
downloadFreeBSD-src-c680e0960e96d41131b7ba77d6199e38f7c5bb4e.zip
FreeBSD-src-c680e0960e96d41131b7ba77d6199e38f7c5bb4e.tar.gz
Fix many problems with 8bit chars (sign extend in ctype macros)
Fix main problem with 8-bit chars in directories names: because signed_sum left uninitialized, wrong checksum occurse
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/tar/gnu.c4
-rw-r--r--gnu/usr.bin/tar/list.c4
-rw-r--r--gnu/usr.bin/tar/port.c2
-rw-r--r--gnu/usr.bin/tar/regex.c41
4 files changed, 21 insertions, 30 deletions
diff --git a/gnu/usr.bin/tar/gnu.c b/gnu/usr.bin/tar/gnu.c
index ef51f2b..3bb1d68 100644
--- a/gnu/usr.bin/tar/gnu.c
+++ b/gnu/usr.bin/tar/gnu.c
@@ -95,9 +95,9 @@ read_dir_file ()
{
int dev;
int ino;
- char *strp;
+ unsigned char *strp;
FILE *fp;
- char buf[512];
+ unsigned char buf[512];
static char *path = 0;
if (path == 0)
diff --git a/gnu/usr.bin/tar/list.c b/gnu/usr.bin/tar/list.c
index a0c65a3..121f250 100644
--- a/gnu/usr.bin/tar/list.c
+++ b/gnu/usr.bin/tar/list.c
@@ -323,7 +323,7 @@ recurse:
recsum = from_oct (8, header->header.chksum);
- sum = 0;
+ signed_sum = sum = 0;
p = header->charptr;
for (i = sizeof (*header); --i >= 0;)
{
@@ -504,7 +504,7 @@ decode_header (header, st, stdp, wantug)
long
from_oct (digs, where)
register int digs;
- register char *where;
+ register unsigned char *where;
{
register long value;
diff --git a/gnu/usr.bin/tar/port.c b/gnu/usr.bin/tar/port.c
index 10ec32e..b55cf32 100644
--- a/gnu/usr.bin/tar/port.c
+++ b/gnu/usr.bin/tar/port.c
@@ -837,7 +837,7 @@ quote_copy_string (string)
from_here = string;
while (*from_here)
{
- c = *from_here++;
+ c = *from_here++ & 0xff;
if (c == '\\')
{
if (!copying)
diff --git a/gnu/usr.bin/tar/regex.c b/gnu/usr.bin/tar/regex.c
index cb94d59..febdb71 100644
--- a/gnu/usr.bin/tar/regex.c
+++ b/gnu/usr.bin/tar/regex.c
@@ -28,6 +28,7 @@
/* We need this for `regex.h', and perhaps for the Emacs include files. */
#include <sys/types.h>
+#include <ctype.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -101,13 +102,8 @@ init_syntax_once ()
bzero (re_syntax_table, sizeof re_syntax_table);
- for (c = 'a'; c <= 'z'; c++)
- re_syntax_table[c] = Sword;
-
- for (c = 'A'; c <= 'Z'; c++)
- re_syntax_table[c] = Sword;
-
- for (c = '0'; c <= '9'; c++)
+ for (c = 0; c < CHAR_SET_SIZE; c++)
+ if (isalnum(c))
re_syntax_table[c] = Sword;
re_syntax_table['_'] = Sword;
@@ -125,33 +121,28 @@ init_syntax_once ()
#include "regex.h"
/* isalpha etc. are used for the character classes. */
-#include <ctype.h>
-
-#ifndef isascii
-#define isascii(c) 1
-#endif
#ifdef isblank
-#define ISBLANK(c) (isascii (c) && isblank (c))
+#define ISBLANK(c) isblank (c)
#else
#define ISBLANK(c) ((c) == ' ' || (c) == '\t')
#endif
#ifdef isgraph
-#define ISGRAPH(c) (isascii (c) && isgraph (c))
+#define ISGRAPH(c) isgraph (c)
#else
-#define ISGRAPH(c) (isascii (c) && isprint (c) && !isspace (c))
+#define ISGRAPH(c) (isprint (c) && !isspace (c))
#endif
-#define ISPRINT(c) (isascii (c) && isprint (c))
-#define ISDIGIT(c) (isascii (c) && isdigit (c))
-#define ISALNUM(c) (isascii (c) && isalnum (c))
-#define ISALPHA(c) (isascii (c) && isalpha (c))
-#define ISCNTRL(c) (isascii (c) && iscntrl (c))
-#define ISLOWER(c) (isascii (c) && islower (c))
-#define ISPUNCT(c) (isascii (c) && ispunct (c))
-#define ISSPACE(c) (isascii (c) && isspace (c))
-#define ISUPPER(c) (isascii (c) && isupper (c))
-#define ISXDIGIT(c) (isascii (c) && isxdigit (c))
+#define ISPRINT(c) isprint (c)
+#define ISDIGIT(c) isdigit (c)
+#define ISALNUM(c) isalnum (c)
+#define ISALPHA(c) isalpha (c)
+#define ISCNTRL(c) iscntrl (c)
+#define ISLOWER(c) islower (c)
+#define ISPUNCT(c) ispunct (c)
+#define ISSPACE(c) isspace (c)
+#define ISUPPER(c) isupper (c)
+#define ISXDIGIT(c) isxdigit (c)
#ifndef NULL
#define NULL 0
OpenPOWER on IntegriCloud