From e49f4c789b12d8b12193ab529f378aa944c183ab Mon Sep 17 00:00:00 2001 From: Ralf Corsepius Date: Thu, 27 Jan 2005 10:14:57 +0000 Subject: 2005-01-27 Ralf Corsepius * libmisc/untar/untar.h: New prototype to eleminate warnings. * libmisc/untar/untar.c: Cosmetics, add symlinks. --- cpukit/libmisc/untar/untar.c | 16 ++++++++-------- cpukit/libmisc/untar/untar.h | 4 +++- 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'cpukit/libmisc') diff --git a/cpukit/libmisc/untar/untar.c b/cpukit/libmisc/untar/untar.c index ad3b789f08..441f250d46 100644 --- a/cpukit/libmisc/untar/untar.c +++ b/cpukit/libmisc/untar/untar.c @@ -44,7 +44,7 @@ * 297 32 bytes Group name ('\0' terminated, 31 maxmum length) * 329 8 bytes Major device ID (in octal ascii) * 337 8 bytes Minor device ID (in octal ascii) - * 345 167 bytes Padding + * 345 155 bytes Prefix * 512 (s+p)bytes File contents (s+p) := (((s) + 511) & ~511), * round up to 512 bytes * @@ -108,8 +108,8 @@ octal2ulong(char *octascii, int len) * * * Inputs: * * * - * unsigned char *tar_buf - Pointer to TAR buffer. * - * unsigned long size - Length of TAR buffer. * + * char *tar_buf - Pointer to TAR buffer. * + * size_t size - Length of TAR buffer. * * * * * * Output: * @@ -123,7 +123,7 @@ octal2ulong(char *octascii, int len) * 12/30/1998 - Creation (JWJ) * *************************************************************************/ int -Untar_FromMemory(unsigned char *tar_buf, unsigned long size) +Untar_FromMemory(char *tar_buf, size_t size) { FILE *fp; char *bufr; @@ -169,7 +169,7 @@ Untar_FromMemory(unsigned char *tar_buf, unsigned long size) * the archive. The checksum is computed over the entire * header, but the checksum field is substituted with blanks. ******************************************************************/ - hdr_chksum = (int)octal2ulong(&bufr[148], 8); + hdr_chksum = octal2ulong(&bufr[148], 8); sum = 0; for (i=0; i<512; i++) { @@ -197,7 +197,7 @@ Untar_FromMemory(unsigned char *tar_buf, unsigned long size) { strncpy(linkname, &bufr[157], MAX_NAME_FIELD_SIZE); linkname[MAX_NAME_FIELD_SIZE] = '\0'; - /* symlink(fname, linkname); */ + symlink(linkname, fname); } else if (linkflag == LF_NORMAL) { @@ -210,7 +210,7 @@ Untar_FromMemory(unsigned char *tar_buf, unsigned long size) else { unsigned long sizeToGo = file_size; - unsigned long len; + size_t len; /*************************************************************** * Read out the data. There are nblocks of data where nblocks @@ -335,7 +335,6 @@ Untar_FromFile(char *tar_name) break; } - /****************************************************************** * We've decoded the header, now figure out what it contains and * do something with it. @@ -344,6 +343,7 @@ Untar_FromFile(char *tar_name) { strncpy(linkname, &bufr[157], MAX_NAME_FIELD_SIZE); linkname[MAX_NAME_FIELD_SIZE] = '\0'; + symlink(linkname,fname); } else if (linkflag == LF_NORMAL) { diff --git a/cpukit/libmisc/untar/untar.h b/cpukit/libmisc/untar/untar.h index bd6e202e9d..e3f4a59555 100644 --- a/cpukit/libmisc/untar/untar.h +++ b/cpukit/libmisc/untar/untar.h @@ -11,6 +11,8 @@ #ifndef __UNTAR_H__ #define __UNTAR_H__ +#include + #ifdef __cplusplus extern "C" { #endif @@ -21,7 +23,7 @@ extern "C" { #define UNTAR_INVALID_HEADER 3 -int Untar_FromMemory(unsigned char *tar_buf, unsigned long size); +int Untar_FromMemory(char *tar_buf, size_t size); int Untar_FromFile(char *tar_name); #ifdef __cplusplus -- cgit v1.2.3