#include "names.h"
#ifndef lint
-FILE_RCSID("@(#)$File: ascmagic.c,v 1.46 2006/10/20 21:04:15 christos Exp $")
+FILE_RCSID("@(#)$File: ascmagic.c,v 1.47 2007/01/12 17:38:27 christos Exp $")
#endif /* lint */
typedef unsigned long unichar;
int n_cr = 0;
int n_nel = 0;
- int last_line_end = -1;
+ size_t last_line_end = (size_t)-1;
int has_long_lines = 0;
/*
looks_ascii(const unsigned char *buf, size_t nbytes, unichar *ubuf,
size_t *ulen)
{
- int i;
+ size_t i;
*ulen = 0;
private int
looks_latin1(const unsigned char *buf, size_t nbytes, unichar *ubuf, size_t *ulen)
{
- int i;
+ size_t i;
*ulen = 0;
looks_extended(const unsigned char *buf, size_t nbytes, unichar *ubuf,
size_t *ulen)
{
- int i;
+ size_t i;
*ulen = 0;
private int
looks_utf8(const unsigned char *buf, size_t nbytes, unichar *ubuf, size_t *ulen)
{
- int i, n;
+ size_t i;
+ int n;
unichar c;
int gotone = 0;
size_t *ulen)
{
int bigend;
- int i;
+ size_t i;
if (nbytes < 2)
return 0;
private void
from_ebcdic(const unsigned char *buf, size_t nbytes, unsigned char *out)
{
- int i;
+ size_t i;
for (i = 0; i < nbytes; i++) {
out[i] = ebcdic_to_ascii[buf[i]];
#endif
#ifndef lint
-FILE_RCSID("@(#)$File: compress.c,v 1.45 2006/10/31 19:37:17 christos Exp $")
+FILE_RCSID("@(#)$File: compress.c,v 1.46 2007/01/12 17:38:27 christos Exp $")
#endif
private struct {
{ "BZh", 3, { "bzip2", "-cd", NULL }, 1 }, /* bzip2-ed */
};
-private int ncompr = sizeof(compr) / sizeof(compr[0]);
+private size_t ncompr = sizeof(compr) / sizeof(compr[0]);
#define NODATA ((size_t)~0)
}
n = (size_t)z.total_out;
- inflateEnd(&z);
+ (void)inflateEnd(&z);
/* let's keep the nul-terminate tradition */
(*newch)[n] = '\0';
(void)close(2);
#endif
- execvp(compr[method].argv[0],
- (char *const *)(intptr_t)compr[method].argv);
+ (void)execvp(compr[method].argv[0],
+ (char *const *)(intptr_t)compr[method].argv);
#ifdef DEBUG
(void)fprintf(stderr, "exec `%s' failed (%s)\n",
compr[method].argv[0], strerror(errno));
switch (fork()) {
case 0: /* child */
(void)close(fdout[0]);
- if (swrite(fdin[1], old, n) != n) {
+ if (swrite(fdin[1], old, n) != (ssize_t)n) {
#ifdef DEBUG
(void)fprintf(stderr,
"Write failed (%s)\n",
#include "readelf.h"
#ifndef lint
-FILE_RCSID("@(#)$File: readelf.c,v 1.61 2006/11/15 15:53:23 christos Exp $")
+FILE_RCSID("@(#)$File: readelf.c,v 1.62 2007/01/12 17:38:28 christos Exp $")
#endif
#ifdef ELFCORE
#define xph_type (class == ELFCLASS32 \
? getu32(swap, ph32.p_type) \
: getu32(swap, ph64.p_type))
-#define xph_offset (class == ELFCLASS32 \
+#define xph_offset (off_t)(class == ELFCLASS32 \
? getu32(swap, ph32.p_offset) \
: getu64(swap, ph64.p_offset))
#define xph_align (size_t)((class == ELFCLASS32 \
* This is a PT_NOTE section; loop through all the notes
* in the section.
*/
- if (lseek(fd, (off_t)xph_offset, SEEK_SET) == (off_t)-1) {
+ if (lseek(fd, xph_offset, SEEK_SET) == (off_t)-1) {
file_badseek(ms);
return -1;
}
* This is a PT_NOTE section; loop through all the notes
* in the section.
*/
- if (lseek(fd, (off_t)xph_offset, SEEK_SET)
+ if (lseek(fd, xph_offset, SEEK_SET)
== (off_t)-1) {
file_badseek(ms);
return -1;
*
* Created 25 August 1985 by John Gilmore, ihnp4!hoptoad!gnu.
*
- * $File: tar.h,v 1.9 2006/05/03 15:19:25 christos Exp $ # checkin only
+ * $File: tar.h,v 1.10 2007/01/12 17:38:28 christos Exp $ # checkin only
*/
/*
#define EX_BADARCH 3 /* bad archive */
#define EX_SYSTEM 4 /* system gave unexpected error */
-
-/*
- * Global variables
- */
-TAR_EXTERN union record *ar_block; /* Start of block of archive */
-TAR_EXTERN union record *ar_record; /* Current record of archive */
-TAR_EXTERN union record *ar_last; /* Last+1 record of archive block */
-TAR_EXTERN char ar_reading; /* 0 writing, !0 reading archive */
-TAR_EXTERN int blocking; /* Size of each block, in records */
-TAR_EXTERN int blocksize; /* Size of each block, in bytes */
-TAR_EXTERN char *ar_file; /* File containing archive */
-TAR_EXTERN char *name_file; /* File containing names to work on */
-TAR_EXTERN char *tar; /* Name of this program */
-
-/*
- * Flags from the command line
- */
-TAR_EXTERN char f_reblock; /* -B */
-TAR_EXTERN char f_create; /* -c */
-TAR_EXTERN char f_debug; /* -d */
-TAR_EXTERN char f_sayblock; /* -D */
-TAR_EXTERN char f_follow_links; /* -h */
-TAR_EXTERN char f_ignorez; /* -i */
-TAR_EXTERN char f_keep; /* -k */
-TAR_EXTERN char f_modified; /* -m */
-TAR_EXTERN char f_oldarch; /* -o */
-TAR_EXTERN char f_use_protection; /* -p */
-TAR_EXTERN char f_sorted_names; /* -s */
-TAR_EXTERN char f_list; /* -t */
-TAR_EXTERN char f_namefile; /* -T */
-TAR_EXTERN char f_verbose; /* -v */
-TAR_EXTERN char f_extract; /* -x */
-TAR_EXTERN char f_compress; /* -z */
-
-/*
- * We now default to Unix Standard format rather than 4.2BSD tar format.
- * The code can actually produce all three:
- * f_standard ANSI standard
- * f_oldarch V7
- * neither 4.2BSD
- * but we don't bother, since 4.2BSD can read ANSI standard format anyway.
- * The only advantage to the "neither" option is that we can cmp(1) our
- * output to the output of 4.2BSD tar, for debugging.
- */
-#define f_standard (!f_oldarch)
-
/*
* Structure for keeping track of filenames and lists thereof.
*/
char name[NAMSIZ+1];
};
-TAR_EXTERN struct name *namelist; /* Points to first name in list */
-TAR_EXTERN struct name *namelast; /* Points to last name in list */
-
-TAR_EXTERN int archive; /* File descriptor for archive file */
-TAR_EXTERN int errors; /* # of files in error */
-
/*
*
* Due to the next struct declaration, each routine that includes
short linkcount;
char name[NAMSIZ+1];
};
-
-TAR_EXTERN struct link *linklist; /* Points to first link in list */
-
-
-/*
- * Error recovery stuff
- */
-TAR_EXTERN char read_error_flag;
-
-
-#if 0
-/*
- * Declarations of functions available to the world.
- */
-/*LINTLIBRARY*/
-#define annorec(stream, msg) anno(stream, msg, 0) /* Cur rec */
-#define annofile(stream, msg) anno(stream, msg, 1) /* Saved rec */
-#endif
ms = magic_open(MAGIC_NONE);
if (ms == NULL) {
- printf("ERROR: out of memory\n");
+ (void) printf("ERROR: out of memory\n");
return 1;
}
if (magic_load(ms, NULL) == -1) {
- printf("ERROR: %s\n", magic_error(ms));
+ (void) printf("ERROR: %s\n", magic_error(ms));
return 1;
}
for (i = 1; i < argc; i++) {
if ((m = magic_file(ms, argv[i])) == NULL)
- printf("ERROR: %s\n", magic_error(ms));
+ (void) printf("ERROR: %s\n", magic_error(ms));
else
- printf("%s: %s\n", argv[i], m);
+ (void) printf("%s: %s\n", argv[i], m);
}
magic_close(ms);