diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2007-09-04 19:32:54 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2007-09-04 19:32:54 +0000 |
commit | 5fb9e2fc36b09b6ae0dcfdf71f10a07476b8c10b (patch) | |
tree | c9411efcb03918d5d92843aab9b6803bad287536 /cpukit/libmisc/untar | |
parent | 2007-09-04 Joel Sherrill <joel.sherrill@OARcorp.com> (diff) | |
download | rtems-5fb9e2fc36b09b6ae0dcfdf71f10a07476b8c10b.tar.bz2 |
2007-09-04 Joel Sherrill <joel.sherrill@oarcorp.com>
* libmisc/untar/untar.c, libmisc/untar/untar.h: Add const to char *.
Use printk.
Diffstat (limited to 'cpukit/libmisc/untar')
-rw-r--r-- | cpukit/libmisc/untar/untar.c | 39 | ||||
-rw-r--r-- | cpukit/libmisc/untar/untar.h | 4 |
2 files changed, 25 insertions, 18 deletions
diff --git a/cpukit/libmisc/untar/untar.c b/cpukit/libmisc/untar/untar.c index fcaadae5ab..c264e409a9 100644 --- a/cpukit/libmisc/untar/untar.c +++ b/cpukit/libmisc/untar/untar.c @@ -1,8 +1,7 @@ /* FIXME: * 1. Symbolic links are not created. - * 2. Untar_FromMemory has printfs. - * 3. Untar_FromMemory uses FILE *fp. - * 4. How to determine end of archive? + * 2. Untar_FromMemory uses FILE *fp. + * 3. How to determine end of archive? * * Written by: Jake Janovetz <janovetz@tempest.ece.uiuc.edu> * @@ -24,6 +23,7 @@ #include <sys/stat.h> #include <fcntl.h> #include <rtems/untar.h> +#include <rtems/bspIo.h> /************************************************************************** @@ -66,7 +66,10 @@ * unsigned long. Only support 32-bit numbers for now. *************************************************************************/ unsigned long -_rtems_octal2ulong(const char *octascii, size_t len) +_rtems_octal2ulong( + const char *octascii, + size_t len +) { size_t i; unsigned long num; @@ -95,7 +98,7 @@ _rtems_octal2ulong(const char *octascii, size_t len) * * * Inputs: * * * - * char *tar_buf - Pointer to TAR buffer. * + * const char * tar_buf - Pointer to TAR buffer. * * size_t size - Length of TAR buffer. * * * * * @@ -105,15 +108,15 @@ _rtems_octal2ulong(const char *octascii, size_t len) * UNTAR_INVALID_CHECKSUM for an invalid header checksum. * * UNTAR_INVALID_HEADER for an invalid header. * * * - ************************************************************************** - * Change History: * - * 12/30/1998 - Creation (JWJ) * - *************************************************************************/ + **************************************************************************/ int -Untar_FromMemory(char *tar_buf, size_t size) +Untar_FromMemory( + const char *tar_buf, + size_t size +) { FILE *fp; - char *bufr; + const char *bufr; size_t n; char fname[100]; char linkname[100]; @@ -181,7 +184,7 @@ Untar_FromMemory(char *tar_buf, size_t size) nblocks = (((file_size) + 511) & ~511) / 512; if ((fp = fopen(fname, "w")) == NULL) { - fprintf(stdout,"Untar failed to create file %s\n", fname); + printk("Untar: failed to create file %s\n", fname); ptr += 512 * nblocks; } else @@ -199,7 +202,7 @@ Untar_FromMemory(char *tar_buf, size_t size) n = fwrite(&tar_buf[ptr], 1, len, fp); if (n != len) { - fprintf(stdout,"Error during write\n"); + printk("untar: Error during write\n"); break; } ptr += 512; @@ -229,7 +232,7 @@ Untar_FromMemory(char *tar_buf, size_t size) * * * Inputs: * * * - * char *tar_name - TAR filename. * + * const char *tar_name - TAR filename. * * * * * * Output: * @@ -243,7 +246,9 @@ Untar_FromMemory(char *tar_buf, size_t size) * 12/30/1998 - Creation (JWJ) * *************************************************************************/ int -Untar_FromFile(char *tar_name) +Untar_FromFile( + const char *tar_name +) { int fd; char *bufr; @@ -357,7 +362,9 @@ Untar_FromFile(char *tar_name) * header, but the checksum field is substituted with blanks. ************************************************************************/ int -_rtems_tar_header_checksum(const char *bufr) +_rtems_tar_header_checksum( + const char *bufr +) { int i, sum; diff --git a/cpukit/libmisc/untar/untar.h b/cpukit/libmisc/untar/untar.h index 839b5008b7..8e3fdf55e4 100644 --- a/cpukit/libmisc/untar/untar.h +++ b/cpukit/libmisc/untar/untar.h @@ -24,8 +24,8 @@ extern "C" { #define UNTAR_INVALID_HEADER 3 -int Untar_FromMemory(char *tar_buf, size_t size); -int Untar_FromFile(char *tar_name); +int Untar_FromMemory(const char *tar_buf, size_t size); +int Untar_FromFile(const char *tar_name); /************************************************************************** * This converts octal ASCII number representations into an |