1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-28 05:29:48 +00:00

Convert REINPLACE_CMD to patch files

This commit is contained in:
Sunpoet Po-Chuan Hsieh 2020-11-24 20:48:31 +00:00
parent 8ac5a94e3b
commit b3b0592d94
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=556188
9 changed files with 1025 additions and 9 deletions

View File

@ -5,8 +5,8 @@ PORTNAME= mp3asm
PORTVERSION= 0.1.3.1
PORTREVISION= 1
CATEGORIES= audio
MASTER_SITES= SF/${PORTNAME}/${PORTNAME}/${PORTVERSION:R}-${PORTVERSION:E}
DISTNAME= ${PORTNAME}-${PORTVERSION:R}-${PORTVERSION:E}
MASTER_SITES= SF/mp3asm/mp3asm/${PORTVERSION:R}-${PORTVERSION:E}
DISTNAME= mp3asm-${PORTVERSION:R}-${PORTVERSION:E}
MAINTAINER= sunpoet@FreeBSD.org
COMMENT= MP3 frame level editor
@ -14,21 +14,18 @@ COMMENT= MP3 frame level editor
LICENSE= GPLv2
LICENSE_FILE= ${WRKSRC}/COPYING
OPTIONS_DEFINE= DOCS
USES= gmake tar:bzip2
GNU_CONFIGURE= yes
USES= gmake tar:bzip2
PLIST_FILES= bin/mp3asm
PORTDOCS= Changelog README
WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION:R:R}
WRKSRC= ${WRKDIR}/mp3asm-${PORTVERSION:R:R}
OPTIONS_DEFINE= DOCS
post-patch:
@${RM} ${WRKSRC}/config.cache
@${REINPLACE_CMD} -e '/^CFLAGS=/d' ${WRKSRC}/configure
@${REINPLACE_CMD} -e 's|getprogname|mp3info_&|' ${WRKSRC}/src/mp3asm.c
@${REINPLACE_CMD} -e '/^#include <argz.h>/d' ${WRKSRC}/src/mp3asm.h
@${REINPLACE_CMD} -e 's|\([ (!]\)\(log[\.;]\)|\1mp3asm_\2|g' ${WRKSRC}/src/*.c ${WRKSRC}/src/mp3asm.h
post-install-DOCS-on:
${MKDIR} ${STAGEDIR}${DOCSDIR}

View File

@ -0,0 +1,18 @@
--- configure.orig 2001-04-12 04:21:33 UTC
+++ configure
@@ -962,7 +962,6 @@ fi
ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
-CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
echo "configure:968: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
@@ -1018,7 +1017,6 @@ else
fi
-CFLAGS="-g -O -Wall"
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6

View File

@ -0,0 +1,272 @@
--- src/frame.c.orig 2002-05-25 22:04:48 UTC
+++ src/frame.c
@@ -69,31 +69,31 @@ isheader (unsigned char head[4])
{
if ((head[0] == 0xff) && ((head[1] & 0xe0) != 0xe0))
{
- sprintf(log.buf, "%s: No syncbits found at the start of header %x%x%x%x.\n", me, head[0], head[1], head[2], head[3]);
+ sprintf(mp3asm_log.buf, "%s: No syncbits found at the start of header %x%x%x%x.\n", me, head[0], head[1], head[2], head[3]);
print_log (10);
return (0);
}
if ((head[1] & 0x18) == 0x08)
{
- sprintf(log.buf, "%s: Bad mpeg audio version specified in %x%x%x%x.\n", me, head[0], head[1], head[2], head[3]);
+ sprintf(mp3asm_log.buf, "%s: Bad mpeg audio version specified in %x%x%x%x.\n", me, head[0], head[1], head[2], head[3]);
print_log (10);
return (0);
}
if (!(head[1] & 0x06))
{
- sprintf(log.buf, "%s: Bad mpeg layer specified in %x%x%x%x.\n", me, head[0], head[1], head[2], head[3]);
+ sprintf(mp3asm_log.buf, "%s: Bad mpeg layer specified in %x%x%x%x.\n", me, head[0], head[1], head[2], head[3]);
print_log (10);
return (0);
}
if ((head[2] & 0xf0) == 0xf0)
{
- sprintf(log.buf, "%s: No valid bitrate specified in %x%x%x%x.\n", me, head[0], head[1], head[2], head[3]);
+ sprintf(mp3asm_log.buf, "%s: No valid bitrate specified in %x%x%x%x.\n", me, head[0], head[1], head[2], head[3]);
print_log (10);
return (0);
}
if ((head[2] & 0x0c) == 0x0c)
{
- sprintf(log.buf, "%s: No valid sampling frequency specified in %x%x%x%x.\n", me, head[0], head[1], head[2], head[3]);
+ sprintf(mp3asm_log.buf, "%s: No valid sampling frequency specified in %x%x%x%x.\n", me, head[0], head[1], head[2], head[3]);
print_log (10);
return (0);
}
@@ -129,7 +129,7 @@ search_first_header (buffer_t *buffer, stream_t *strea
switch (read_buf(buffer, head, i, 4))
{
case 0:
- sprintf(log.buf, "%s: No valid mp3header found in this buffer.\n", me);
+ sprintf(mp3asm_log.buf, "%s: No valid mp3header found in this buffer.\n", me);
print_log (10);
return(-1); /* fill the buffer */
@@ -140,7 +140,7 @@ search_first_header (buffer_t *buffer, stream_t *strea
{
if (samestream (head, (*heads)[k].head))
{
- sprintf (log.buf, "other header: %x.%x.%x.%x, count = %d\n", (*heads)[k].head[0], (*heads)[k].head[1], (*heads)[k].head[2], (*heads)[k].head[3], (*heads)[k].count);
+ sprintf (mp3asm_log.buf, "other header: %x.%x.%x.%x, count = %d\n", (*heads)[k].head[0], (*heads)[k].head[1], (*heads)[k].head[2], (*heads)[k].head[3], (*heads)[k].count);
print_log (10);
if ((*heads)[k].count == 3)
{
@@ -167,7 +167,7 @@ search_first_header (buffer_t *buffer, stream_t *strea
break;
default:
- sprintf(log.buf, "%s: Unable to read from buffer.\n", me);
+ sprintf(mp3asm_log.buf, "%s: Unable to read from buffer.\n", me);
print_all (0);
return(-2); /* flush the buffer */
}
@@ -190,7 +190,7 @@ search_header (buffer_t *buffer, stream_t *stream)
switch (read_buf(buffer, head, i, 4))
{
case 0:
- sprintf(log.buf, "%s: No valid mp3header found in this buffer.\n", me);
+ sprintf(mp3asm_log.buf, "%s: No valid mp3header found in this buffer.\n", me);
print_log (10);
return(-1); /* fill the buffer */
@@ -209,7 +209,7 @@ search_header (buffer_t *buffer, stream_t *stream)
break;
default:
- sprintf(log.buf, "%s: Unable to read from buffer.\n", me);
+ sprintf(mp3asm_log.buf, "%s: Unable to read from buffer.\n", me);
print_all (0);
return(-2); /* flush the buffer */
}
@@ -301,7 +301,7 @@ parse_frame_header (stream_t *stream)
{
frame_t *frame = stream->last;
- sprintf (log.buf, "%x.%x.%x.%x\n", frame->head[0], frame->head[1], frame->head[2], frame->head[3]);
+ sprintf (mp3asm_log.buf, "%x.%x.%x.%x\n", frame->head[0], frame->head[1], frame->head[2], frame->head[3]);
print_log (10);
if (stream->count < 0)
@@ -483,10 +483,10 @@ read_frame (stream_t *stream, buffer_t *filebuf, buffe
parse_frame_header(stream);
- sprintf (log.buf, "Reading frame %ld\n", stream->count + 1);
+ sprintf (mp3asm_log.buf, "Reading frame %ld\n", stream->count + 1);
print_log (10);
#ifdef FRAME_DEBUG
- sprintf(log.buf, "Frame %ld: %d kbps, header to header size = %d\n", stream->count + 1, frame->kbps, frame->hsize);
+ sprintf(mp3asm_log.buf, "Frame %ld: %d kbps, header to header size = %d\n", stream->count + 1, frame->kbps, frame->hsize);
print_log (10);
#endif
@@ -518,14 +518,14 @@ read_frame (stream_t *stream, buffer_t *filebuf, buffe
}
#ifdef SIDE_DEBUG
- sprintf(log.buf, "sideinfo = ");
+ sprintf(mp3asm_log.buf, "sideinfo = ");
print_log (10);
for ( k = 0; k < stream->isize; k++)
{
- sprintf(log.buf, ".%x", frame->info[k]);
+ sprintf(mp3asm_log.buf, ".%x", frame->info[k]);
print_log (10);
}
- sprintf(log.buf, " \n");
+ sprintf(mp3asm_log.buf, " \n");
print_log (10);
#endif
@@ -545,7 +545,7 @@ read_frame (stream_t *stream, buffer_t *filebuf, buffe
if (temp)
{
- sprintf (log.buf, "Too much space between headers: %d bytes!\n", temp);
+ sprintf (mp3asm_log.buf, "Too much space between headers: %d bytes!\n", temp);
print_all (0);
cut_buf(filebuf, databuf, temp);
}
@@ -553,13 +553,13 @@ read_frame (stream_t *stream, buffer_t *filebuf, buffe
rem_buf(filebuf, 4 + stream->isize + 2 * stream->crc);
#ifdef FRAME_DEBUG
- sprintf(log.buf, " Backref: %d, datasize: %d\n", frame->backref, frame->dsize);
+ sprintf(mp3asm_log.buf, " Backref: %d, datasize: %d\n", frame->backref, frame->dsize);
print_log (10);
#endif
if (databuf->used < frame->backref)
{
- sprintf(log.buf, "Error: bad stream formattin, bad backref!\n");
+ sprintf(mp3asm_log.buf, "Error: bad stream formattin, bad backref!\n");
print_all (0);
frame->dsize = 0;
/* free_frame (stream, frame);
@@ -575,7 +575,7 @@ read_frame (stream_t *stream, buffer_t *filebuf, buffe
if (databuf->used < frame->dsize) /*skip frame data!!!*/
{
- sprintf(log.buf, "Error: bad stream formattin, databuffer underrun.\n");
+ sprintf(mp3asm_log.buf, "Error: bad stream formattin, databuffer underrun.\n");
print_all (0);
frame->dsize = 0;
/* free_frame (stream, frame);
@@ -590,7 +590,7 @@ read_frame (stream_t *stream, buffer_t *filebuf, buffe
}
#ifdef POINTER_DEBUG
- sprintf (log.buf, "frame %ld; prev: %p, next: %p, info: %p, data: %p\n", stream->count + 1, frame->prev, frame->next, frame->info, frame->data);
+ sprintf (mp3asm_log.buf, "frame %ld; prev: %p, next: %p, info: %p, data: %p\n", stream->count + 1, frame->prev, frame->next, frame->info, frame->data);
print_log (10);
#endif
@@ -613,7 +613,7 @@ process_frames (stream_t *stream, long startframe, lon
unsigned long count = 0;
#ifdef POINTER_DEBUG
- sprintf (log.buf, "frame %ld; prev: %p, next: %p, info: %p, data: %p\n", count, frame->prev, frame->next, frame->info, frame->data);
+ sprintf (mp3asm_log.buf, "frame %ld; prev: %p, next: %p, info: %p, data: %p\n", count, frame->prev, frame->next, frame->info, frame->data);
print_log (10);
#endif /* POINTER_DEBUG */
@@ -632,7 +632,7 @@ process_frames (stream_t *stream, long startframe, lon
frame = NULL;
}
stream->count--;
- sprintf (log.buf, "Removed frame %ld\n", count);
+ sprintf (mp3asm_log.buf, "Removed frame %ld\n", count);
print_log (10);
}
else
@@ -785,7 +785,7 @@ calc_backref (stream_t *stream)
frame->info[0] |= backref;
}
#ifdef FRAME_DEBUG
- sprintf (log.buf, "frame %d: hsize: %d, dsize: %d, backref: %d\n", count, frame->hsize, frame->dsize, frame->backref);
+ sprintf (mp3asm_log.buf, "frame %d: hsize: %d, dsize: %d, backref: %d\n", count, frame->hsize, frame->dsize, frame->backref);
print_log (10);
#endif
backref += (frame->hsize - 4 - stream->isize - frame->dsize);
@@ -794,7 +794,7 @@ calc_backref (stream_t *stream)
backref = limit;
else if (backref < 0)
{
- sprintf (log.buf, "Unable to decently format stream, frame size (%d) exceeds available space (%d)\n", frame->dsize, frame->dsize + backref);
+ sprintf (mp3asm_log.buf, "Unable to decently format stream, frame size (%d) exceeds available space (%d)\n", frame->dsize, frame->dsize + backref);
print_log (2);
if ((limit - highest + backref) < 0) /* local underrun */
@@ -863,7 +863,7 @@ write_frames (stream_t *stream, FILE *file)
{
count = frame->hsize;
#ifdef WRITE_DEBUG
- sprintf (log.buf, "FRAME: %d\n", fcount);
+ sprintf (mp3asm_log.buf, "FRAME: %d\n", fcount);
print_log (10);
#endif
write_buf (frame->head, framebuf, 4);
@@ -871,7 +871,7 @@ write_frames (stream_t *stream, FILE *file)
write_buf (frame->info, framebuf, stream->isize);
count -= stream->isize;
#ifdef WRITE_DEBUG
- sprintf (log.buf, "wrote header & sideinfo (%d) to framebuf\n", 4 + stream->isize);
+ sprintf (mp3asm_log.buf, "wrote header & sideinfo (%d) to framebuf\n", 4 + stream->isize);
print_log (10);
#endif
@@ -888,7 +888,7 @@ write_frames (stream_t *stream, FILE *file)
backref -= temp;
count -= temp;
#ifdef WRITE_DEBUG
- sprintf (log.buf, "wrote %d null bytes to framebuf (backref = %d, count = %d)\n", temp, backref, count);
+ sprintf (mp3asm_log.buf, "wrote %d null bytes to framebuf (backref = %d, count = %d)\n", temp, backref, count);
print_log (10);
#endif
}
@@ -900,7 +900,7 @@ write_frames (stream_t *stream, FILE *file)
offset += count;
backref -= count;
#ifdef WRITE_DEBUG
- sprintf (log.buf, "wrote %d bytes from data to framebuf (backref = %d, offset = %d, count = 0)\n", count, backref, offset);
+ sprintf (mp3asm_log.buf, "wrote %d bytes from data to framebuf (backref = %d, offset = %d, count = 0)\n", count, backref, offset);
print_log (10);
#endif
count = 0;
@@ -913,28 +913,28 @@ write_frames (stream_t *stream, FILE *file)
backref -= temp;
count -= temp;
#ifdef WRITE_DEBUG
- sprintf (log.buf, "wrote %d bytes from data to framebuf (backref = %d, count = %d)\n", temp, backref, count);
+ sprintf (mp3asm_log.buf, "wrote %d bytes from data to framebuf (backref = %d, count = %d)\n", temp, backref, count);
print_log (10);
#endif
}
}
backref += (dataframe->hsize - stream->isize - 4);
#ifdef WRITE_DEBUG
- sprintf (log.buf, "backref: %d\n", backref);
+ sprintf (mp3asm_log.buf, "backref: %d\n", backref);
print_log (10);
#endif
dataframe = dataframe->next;
offset = 0;
dfcount++;
#ifdef WRITE_DEBUG
- sprintf (log.buf, "DATAFRAME: %d\n", dfcount);
+ sprintf (mp3asm_log.buf, "DATAFRAME: %d\n", dfcount);
print_log (10);
#endif
}
if (!dataframe && count)
{
write_buf (padding, framebuf, count);
- sprintf (log.buf, "padded frame %d with %d null bytes\n", fcount, count);
+ sprintf (mp3asm_log.buf, "padded frame %d with %d null bytes\n", fcount, count);
print_log (10);
}
write_file_from_buf (framebuf, file, frame->hsize);

View File

@ -0,0 +1,70 @@
--- src/mp3asm.c.orig 2001-04-12 04:16:24 UTC
+++ src/mp3asm.c
@@ -49,17 +49,17 @@ extern void parse_args (int argc, char *argv[]);
int verbosity, inputs, quiet, info;
char *me;
-logfile_t log;
+logfile_t mp3asm_log;
input_t **input;
output_t *output;
/*
- * getprogname: sets me to be the name of the executable.
+ * mp3info_getprogname: sets me to be the name of the executable.
*
*/
char *
-getprogname(const char *argv0)
+mp3info_getprogname(const char *argv0)
{
char *string;
(string = strrchr(argv0, '/')) ? string++ : (string = (char *)argv0);
@@ -97,8 +97,8 @@ init_global (char *progname)
{
me = strcpy((char *)tmalloc(strlen(progname) + 1), progname);
- log.name = NULL;
- log.file = NULL;
+ mp3asm_log.name = NULL;
+ mp3asm_log.file = NULL;
verbosity = 0;
quiet = 0;
@@ -129,7 +129,7 @@ open_inputs (void)
input[i]->stream = read_stream (input[i]->file);
if (!input[i]->stream)
{
- sprintf (log.buf, "bad input file specified\n");
+ sprintf (mp3asm_log.buf, "bad input file specified\n");
print_std (-1);
exit (EX_NOINPUT);
}
@@ -152,7 +152,7 @@ write_output (void)
if (!inputs)
{
- sprintf (log.buf, "Please provide valid inputfiles...\n");
+ sprintf (mp3asm_log.buf, "Please provide valid inputfiles...\n");
print_std (-1);
exit (EX_USAGE);
}
@@ -169,7 +169,7 @@ write_output (void)
}
else
{
- sprintf (log.buf, "Unable to use a non-existent id3 tag.\n");
+ sprintf (mp3asm_log.buf, "Unable to use a non-existent id3 tag.\n");
print_std (0);
}
}
@@ -200,7 +200,7 @@ write_output (void)
int
main(int argc, char *argv[])
{
- init_global (getprogname(argv[0]));
+ init_global (mp3info_getprogname(argv[0]));
parse_args (argc, argv);

View File

@ -0,0 +1,19 @@
--- src/mp3asm.h.orig 2001-03-20 01:45:48 UTC
+++ src/mp3asm.h
@@ -30,7 +30,6 @@
#include <stdlib.h>
#include <string.h>
#include <sysexits.h>
-#include <argz.h>
#include <ctype.h>
#define LOGBUFSIZE 4096
@@ -46,7 +45,7 @@ extern int verbosity;
extern int quiet;
extern int info; /* if set to 1 -> print header info on all files and exit */
extern char *me; /* name of the executable */
-extern logfile_t log; /* file to log to */
+extern logfile_t mp3asm_log; /* file to log to */
extern int inputs;
#endif /* HAVE_MP3ASM_H */

View File

@ -0,0 +1,158 @@
--- src/parse.c.orig 2001-04-12 03:37:01 UTC
+++ src/parse.c
@@ -43,9 +43,9 @@ static void
bad_flag (char *string, int i)
{
if (!i)
- sprintf (log.buf, "%s: Bad flag specified: \"%s\"\n", me, string);
+ sprintf (mp3asm_log.buf, "%s: Bad flag specified: \"%s\"\n", me, string);
else
- sprintf (log.buf, "%s: Bad flag specified: \"%s\" from \"%s\"\n", me, string+i, string);
+ sprintf (mp3asm_log.buf, "%s: Bad flag specified: \"%s\" from \"%s\"\n", me, string+i, string);
print_std (-1);
exit (EX_USAGE);
}
@@ -53,7 +53,7 @@ bad_flag (char *string, int i)
static void
arg_needed (char flag)
{
- sprintf (log.buf, "%s: No argument specified for flag %c\n", me, flag);
+ sprintf (mp3asm_log.buf, "%s: No argument specified for flag %c\n", me, flag);
print_std (-1);
exit (EX_USAGE);
}
@@ -61,7 +61,7 @@ arg_needed (char flag)
static void
double_flag (char flag)
{
- sprintf (log.buf, "%s: Flag specified twice: \"%c\"\n", me, flag);
+ sprintf (mp3asm_log.buf, "%s: Flag specified twice: \"%c\"\n", me, flag);
print_std (-1);
exit (EX_USAGE);
}
@@ -69,7 +69,7 @@ double_flag (char flag)
static void
bad_arg (char *string)
{
- sprintf (log.buf, "%s: Bad argument given: \"%s\"\n", me, string);
+ sprintf (mp3asm_log.buf, "%s: Bad argument given: \"%s\"\n", me, string);
print_std (-1);
exit (EX_USAGE);
}
@@ -139,7 +139,7 @@ report (char *arg)
{
char *name = tmalloc (1024 * sizeof (char));
if (!gethostname (name, 1024))
- sprintf (log.buf, "Sending notification to the authorities; Illegal use of copyrighted material on %s\n", name);
+ sprintf (mp3asm_log.buf, "Sending notification to the authorities; Illegal use of copyrighted material on %s\n", name);
free (name);
return (0);
}
@@ -147,9 +147,9 @@ report (char *arg)
static int
use_log (char *arg)
{
- if (log.name)
+ if (mp3asm_log.name)
return (1);
- log.name = strcpy (tmalloc (strlen (arg) + 1), arg);
+ mp3asm_log.name = strcpy (tmalloc (strlen (arg) + 1), arg);
return (0);
}
@@ -190,11 +190,11 @@ usage (void)
{
int k = 0;
- sprintf (log.buf, "Usage: %s [options] inputfile.mp3 [...]\n", me);
+ sprintf (mp3asm_log.buf, "Usage: %s [options] inputfile.mp3 [...]\n", me);
print_std (0);
while (parse[k].flag)
{
- sprintf (log.buf, " -%c %s\n", parse[k].flag, parse[k].help);
+ sprintf (mp3asm_log.buf, " -%c %s\n", parse[k].flag, parse[k].help);
print_std (0);
k++;
}
@@ -259,7 +259,7 @@ parse_argument (int argc, char *argv[])
input[inputs - 1]->name = tmalloc (strlen (argv[i]) + 1);
strcpy (input[inputs - 1]->name, argv[i]);
- /*sprintf (log.buf, "%d input: %s\n", inputs - 1, input[inputs - 1]->name);
+ /*sprintf (mp3asm_log.buf, "%d input: %s\n", inputs - 1, input[inputs - 1]->name);
print_std (5);*/
new_input ();
}
@@ -285,7 +285,7 @@ check_options ()
if ((input[i]->endframe && (input[i]->startframe > input[i]->endframe)) || (input[i]->startframe && (input[i]->startframe == input[i]->endframe)))
{
- sprintf (log.buf, "%s: Invalid options given. The number of frames to skip should be smaller than the number of the last frame to read for \"%s\".\n", me, input[i]->name);
+ sprintf (mp3asm_log.buf, "%s: Invalid options given. The number of frames to skip should be smaller than the number of the last frame to read for \"%s\".\n", me, input[i]->name);
print_std (-1);
exit (EX_USAGE);
}
@@ -293,7 +293,7 @@ check_options ()
if (input[i]->use_id3) {
if (id3)
{
- sprintf (log.buf, "%s: Invalid options given. More than one id3 tag specified for use.\n", me);
+ sprintf (mp3asm_log.buf, "%s: Invalid options given. More than one id3 tag specified for use.\n", me);
print_std (-1);
exit (EX_USAGE);
}
@@ -305,7 +305,7 @@ check_options ()
{
if (input[inputs -1]->startframe ||input[inputs -1]->endframe || input[inputs -1]->readframes || input[inputs -1]->use_id3)
{
- sprintf (log.buf, "%s: Flags specified for input file, but no input file has been given.\n", me);
+ sprintf (mp3asm_log.buf, "%s: Flags specified for input file, but no input file has been given.\n", me);
print_std (-1);
exit(EX_USAGE);
}
@@ -314,37 +314,37 @@ check_options ()
}
if (!inputs)
{
- sprintf (log.buf, "%s: No input files specified.\n", me);
+ sprintf (mp3asm_log.buf, "%s: No input files specified.\n", me);
print_std (-1);
exit (EX_USAGE);
}
/* else
{
- sprintf (log.buf, "inputs: %d\n", inputs);
+ sprintf (mp3asm_log.buf, "inputs: %d\n", inputs);
print_std (5);
}*/
if (!info)
{
- sprintf (log.buf, "%s: Program from Olli Fromme & _Death_.\n", me);
+ sprintf (mp3asm_log.buf, "%s: Program from Olli Fromme & _Death_.\n", me);
print_std (-1);
if (!output->name)
- sprintf (log.buf, "%s: Checking the following mp3 files for header errors:\n", me);
+ sprintf (mp3asm_log.buf, "%s: Checking the following mp3 files for header errors:\n", me);
else
- sprintf(log.buf, "%s: Taking input from:\n", me);
+ sprintf(mp3asm_log.buf, "%s: Taking input from:\n", me);
print_std (1);
for (i = 0; i < inputs; ++i)
{
- sprintf (log.buf, "%s: input %d: %s from frame %ld to %ld [%ld].\n", me, i, input[i]->name, input[i]->startframe, input[i]->endframe, input[i]->readframes);
+ sprintf (mp3asm_log.buf, "%s: input %d: %s from frame %ld to %ld [%ld].\n", me, i, input[i]->name, input[i]->startframe, input[i]->endframe, input[i]->readframes);
print_std (2);
}
if (!output->name)
- sprintf (log.buf, "%s: No output file specified.\n", me);
+ sprintf (mp3asm_log.buf, "%s: No output file specified.\n", me);
else
- sprintf (log.buf, "%s: Outputting to %s.\n", me, output->name);
+ sprintf (mp3asm_log.buf, "%s: Outputting to %s.\n", me, output->name);
print_std (1);
}
}

View File

@ -0,0 +1,149 @@
--- src/stream.c.orig 2001-08-18 18:46:34 UTC
+++ src/stream.c
@@ -213,36 +213,36 @@ read_stream (FILE *file)
void
print_stream_inf(stream_t *stream, char *name)
{
- sprintf (log.buf, "%s: Info on file %s:\n", me, name);
+ sprintf (mp3asm_log.buf, "%s: Info on file %s:\n", me, name);
print_all (1);
- sprintf (log.buf, " MPEG %d layer %d", stream->maj_version, stream->layer);
+ sprintf (mp3asm_log.buf, " MPEG %d layer %d", stream->maj_version, stream->layer);
print_all (1);
if (!stream->cbr)
- sprintf (log.buf, " VBR [avg. %.0f kbps], ", stream->avkbps);
+ sprintf (mp3asm_log.buf, " VBR [avg. %.0f kbps], ", stream->avkbps);
else
- sprintf (log.buf, " at %.0f kbps, ", stream->avkbps);
+ sprintf (mp3asm_log.buf, " at %.0f kbps, ", stream->avkbps);
print_all (1);
- sprintf (log.buf, "sampled at %d.\n", stream->freq);
+ sprintf (mp3asm_log.buf, "sampled at %d.\n", stream->freq);
print_all (1);
- sprintf(log.buf, " ");
+ sprintf(mp3asm_log.buf, " ");
print_all (1);
switch (stream->mode)
{
case 0:
- sprintf(log.buf, "Stereo, ");
+ sprintf(mp3asm_log.buf, "Stereo, ");
break;
case 1:
- sprintf(log.buf, "Joint Stereo, ");
+ sprintf(mp3asm_log.buf, "Joint Stereo, ");
break;
case 2:
- sprintf(log.buf, "Dual Channel, ");
+ sprintf(mp3asm_log.buf, "Dual Channel, ");
break;
case 3:
- sprintf(log.buf, "Mono, ");
+ sprintf(mp3asm_log.buf, "Mono, ");
break;
}
print_all (1);
@@ -250,36 +250,36 @@ print_stream_inf(stream_t *stream, char *name)
switch (stream->crc)
{
case 0:
- sprintf(log.buf, "not protected by CRC.\n");
+ sprintf(mp3asm_log.buf, "not protected by CRC.\n");
break;
case 1:
- sprintf(log.buf, "protected by CRC.\n");
+ sprintf(mp3asm_log.buf, "protected by CRC.\n");
break;
}
print_all (1);
- sprintf(log.buf, " ");
+ sprintf(mp3asm_log.buf, " ");
print_all (1);
if (stream->private)
- sprintf(log.buf, "private, ");
+ sprintf(mp3asm_log.buf, "private, ");
else
- sprintf(log.buf, "not private, ");
+ sprintf(mp3asm_log.buf, "not private, ");
print_all (1);
if (stream->copyright)
- sprintf(log.buf, "copyrighted, ");
+ sprintf(mp3asm_log.buf, "copyrighted, ");
else
- sprintf(log.buf, "not copyrighted, ");
+ sprintf(mp3asm_log.buf, "not copyrighted, ");
print_all (1);
if (stream->original)
- sprintf(log.buf, "original.\n");
+ sprintf(mp3asm_log.buf, "original.\n");
else
- sprintf(log.buf, "not original.\n");
+ sprintf(mp3asm_log.buf, "not original.\n");
print_all (1);
- sprintf(log.buf, " %ld frames at %d samples per frame, infosize = %d.\n", stream->count, stream->samples, stream->isize);
+ sprintf(mp3asm_log.buf, " %ld frames at %d samples per frame, infosize = %d.\n", stream->count, stream->samples, stream->isize);
print_all (1);
}
@@ -292,13 +292,13 @@ process_input (stream_t *stream, long startframe, long
{
if (startframe >= stream->count)
{
- sprintf (log.buf, "Cannot skip %ld frames... No frames left to write.\n", startframe);
+ sprintf (mp3asm_log.buf, "Cannot skip %ld frames... No frames left to write.\n", startframe);
print_all (0);
exit(EX_USAGE);
}
if (endframe > stream->count)
{
- sprintf (log.buf, "File has less frames (%ld) than specified (%ld)... Reading till end.\n", stream->count, endframe);
+ sprintf (mp3asm_log.buf, "File has less frames (%ld) than specified (%ld)... Reading till end.\n", stream->count, endframe);
print_all (0);
}
@@ -345,31 +345,31 @@ merge_streams (stream_t *streama, stream_t *streamb)
{
if (streama->maj_version != streamb->maj_version)
{
- sprintf (log.buf, "Incompatible streams: Cannot combine streams with different major versions.\n");
+ sprintf (mp3asm_log.buf, "Incompatible streams: Cannot combine streams with different major versions.\n");
print_all (-1);
exit (EX_USAGE);
}
else if (streama->min_version != streamb->min_version)
{
- sprintf (log.buf, "Incompatible streams: Cannot combine streams with different minor versions.\n");
+ sprintf (mp3asm_log.buf, "Incompatible streams: Cannot combine streams with different minor versions.\n");
print_all (-1);
exit (EX_USAGE);
}
else if (streama->layer != streamb->layer)
{
- sprintf (log.buf, "Incompatible streams: Cannot combine streams that are not the same layer.\n");
+ sprintf (mp3asm_log.buf, "Incompatible streams: Cannot combine streams that are not the same layer.\n");
print_all (-1);
exit (EX_USAGE);
}
else if (streama->freq != streamb->freq)
{
- sprintf (log.buf, "Incompatible streams: Cannot combine streams with different frequencies.\n");
+ sprintf (mp3asm_log.buf, "Incompatible streams: Cannot combine streams with different frequencies.\n");
print_all (-1);
exit (EX_USAGE);
}
else if (streama->mode != streamb->mode)
{
- sprintf (log.buf, "Incompatible streams: Cannot combine streams with different modes.\n");
+ sprintf (mp3asm_log.buf, "Incompatible streams: Cannot combine streams with different modes.\n");
print_all (-1);
exit (EX_USAGE);
}

View File

@ -0,0 +1,11 @@
--- src/tag.c.orig 2001-04-12 03:34:39 UTC
+++ src/tag.c
@@ -74,7 +74,7 @@ write_tag_v1 (stream_t *stream, FILE *file)
{
if (fwrite(stream->tag, sizeof(unsigned char), 128, file) < 0)
{
- sprintf (log.buf, "%s: Error writing tag to file.\n", me);
+ sprintf (mp3asm_log.buf, "%s: Error writing tag to file.\n", me);
print_all (-1);
perror ("fwrite");
return (-1);

View File

@ -8,3 +8,325 @@
/*
* tmalloc: mallocs cleanly
@@ -77,31 +77,31 @@ trealloc (void *ptr, size_t size)
}
/*
- * print_std: prints log.buf to stderr
+ * print_std: prints mp3asm_log.buf to stderr
* takes min verbosity needed to show
*/
void
print_std (int verb)
{
if ((verb < 0) || ((verb <= verbosity) && !quiet))
- fprintf (stderr, "%s", log.buf);
+ fprintf (stderr, "%s", mp3asm_log.buf);
return;
}
/*
- * print_log: prints log.buf to stderr
+ * print_log: prints mp3asm_log.buf to stderr
* takes min verbosity needed to show
*/
void
print_log (int verb)
{
- if ((verb <= verbosity) && log.file && log.file)
- fprintf (log.file, "%s", log.buf);
+ if ((verb <= verbosity) && mp3asm_log.file && mp3asm_log.file)
+ fprintf (mp3asm_log.file, "%s", mp3asm_log.buf);
return;
}
/*
- * print_all: prints log.buf to stderr & file
+ * print_all: prints mp3asm_log.buf to stderr & file
* takes min verbosity needed to show
*/
void
@@ -123,7 +123,7 @@ mp3ropen(char *name) /* infile */
if (!file)
{
- sprintf(log.buf, "%s: Unable to read from %s.\n", me, name);
+ sprintf(mp3asm_log.buf, "%s: Unable to read from %s.\n", me, name);
print_all (-1);
exit (EX_NOINPUT);
}
@@ -145,7 +145,7 @@ mp3wopen(char **name, int layer)
while (!access (name2, F_OK))
{
- sprintf (log.buf, "File %s already exists.\n", name2);
+ sprintf (mp3asm_log.buf, "File %s already exists.\n", name2);
print_all (0);
if (!basename)
@@ -153,7 +153,7 @@ mp3wopen(char **name, int layer)
char *po = name2 + strlen (*name) - 4;
if (strncasecmp (po, ".mp", 3))
{
- sprintf (log.buf, "%s: Unable to write to %s, this is not an mp1/2/3 file\n", me, name2);
+ sprintf (mp3asm_log.buf, "%s: Unable to write to %s, this is not an mp1/2/3 file\n", me, name2);
print_all (-1);
exit (EX_CANTCREAT);
}
@@ -183,14 +183,14 @@ mp3wopen(char **name, int layer)
file = fopen (name2, "wx");
if (!file)
{
- sprintf (log.buf, "%s: Unable to write to %s\n", me, name2);
+ sprintf (mp3asm_log.buf, "%s: Unable to write to %s\n", me, name2);
print_all (-1);
exit (EX_CANTCREAT);
}
free (*name); /* change filename, we wont want it printin the wrong inf */
name = &name2;
- sprintf (log.buf, "Writing to %s\n", *name);
+ sprintf (mp3asm_log.buf, "Writing to %s\n", *name);
print_all (0);
return (file);
@@ -204,15 +204,15 @@ mp3wopen(char **name, int layer)
int
logopen(void) /* for appending only, logfile... */
{
- if(!log.name)
+ if(!mp3asm_log.name)
return (1); /* other functions will not use it either then */
- log.file = fopen(log.name, "w");
- if (!log.file)
+ mp3asm_log.file = fopen(mp3asm_log.name, "w");
+ if (!mp3asm_log.file)
{
- sprintf(log.buf, "Unable to write to %s, not logging output\n", log.name);
+ sprintf(mp3asm_log.buf, "Unable to write to %s, not logging output\n", mp3asm_log.name);
print_std (-1);
- log.name = NULL;
+ mp3asm_log.name = NULL;
return (0);
}
return(1);
@@ -247,7 +247,7 @@ init_buf (int size)
buffer->end = 0;
buffer->eof = 0;
#ifdef DEBUG_BUFFER
- sprintf(log.buf, "BUFFER: initialised buffer\nBUFFER: begin: %d end: %d used: %d size: %d\n", buffer->begin, buffer->end, buffer->used, buffer->size);
+ sprintf(mp3asm_log.buf, "BUFFER: initialised buffer\nBUFFER: begin: %d end: %d used: %d size: %d\n", buffer->begin, buffer->end, buffer->used, buffer->size);
print_log (10);
#endif /* DEBUG_BUFFER */
@@ -264,7 +264,7 @@ free_buf(buffer_t *buffer)
{
if (buffer->used)
{
- sprintf(log.buf, "Warning: Emptying a not completely empty buffer (%p,%d/%d)\n", buffer, buffer->used, buffer->size);
+ sprintf(mp3asm_log.buf, "Warning: Emptying a not completely empty buffer (%p,%d/%d)\n", buffer, buffer->used, buffer->size);
print_all (0);
}
free(buffer->data);
@@ -303,14 +303,14 @@ fill_buf_from_file (buffer_t *buffer, FILE *file)
continue;
else
{
- sprintf (log.buf, "%s: Error reading from file to buffer.\n", me);
+ sprintf (mp3asm_log.buf, "%s: Error reading from file to buffer.\n", me);
print_all (-1);
perror ("read()");
return (-1);
}
}
#ifdef DEBUG_BUFFER
- sprintf (log.buf, "BUFFER: Reading from file to buffer: %d \n", readb);
+ sprintf (mp3asm_log.buf, "BUFFER: Reading from file to buffer: %d \n", readb);
print_log (10);
#endif /* DEBUG_BUFFER */
@@ -325,7 +325,7 @@ fill_buf_from_file (buffer_t *buffer, FILE *file)
}
#ifdef DEBUG_BUFFER
- sprintf(log.buf, "BUFFER: begin: %d end: %d used: %d size: %d\n", buffer->begin, buffer->end, buffer->used, buffer->size);
+ sprintf(mp3asm_log.buf, "BUFFER: begin: %d end: %d used: %d size: %d\n", buffer->begin, buffer->end, buffer->used, buffer->size);
print_log (10);
#endif /* DEBUG_BUFFER */
@@ -345,7 +345,7 @@ read_buf (buffer_t *buffer, unsigned char *data, int o
if ((offset + count) > (buffer->used))
{
- sprintf(log.buf, "%s: Request for more bytes (%d + %d) than there are in buffer (%d/%d).\n", me, count, offset, buffer->used, buffer->size);
+ sprintf(mp3asm_log.buf, "%s: Request for more bytes (%d + %d) than there are in buffer (%d/%d).\n", me, count, offset, buffer->used, buffer->size);
print_log (10);
return (0);
}
@@ -359,13 +359,13 @@ read_buf (buffer_t *buffer, unsigned char *data, int o
ptr =(unsigned char *)(buffer->data + location);
#ifdef DEBUG_BUFFER
- sprintf (log.buf, "BUFFER: Reading %d from buffer (@%d from %d/%d)\n", count1, location, buffer->used, buffer->size);
+ sprintf (mp3asm_log.buf, "BUFFER: Reading %d from buffer (@%d from %d/%d)\n", count1, location, buffer->used, buffer->size);
print_log (10);
#endif /* DEBUG_BUFFER */
if (data != memcpy(data , ptr, count1 * sizeof(unsigned char)))
{
- sprintf (log.buf, "%s: Error reading from buffer.\n", me);
+ sprintf (mp3asm_log.buf, "%s: Error reading from buffer.\n", me);
print_all (-1);
return (-1);
}
@@ -378,7 +378,7 @@ read_buf (buffer_t *buffer, unsigned char *data, int o
}
#ifdef DEBUG_BUFFER
- sprintf(log.buf, "BUFFER: begin: %d end: %d used: %d size: %d\n", buffer->begin, buffer->end, buffer->used, buffer->size);
+ sprintf(mp3asm_log.buf, "BUFFER: begin: %d end: %d used: %d size: %d\n", buffer->begin, buffer->end, buffer->used, buffer->size);
print_log (10);
#endif /* DEBUG_BUFFER */
return (1);
@@ -397,7 +397,7 @@ rem_buf (buffer_t *buffer, int count)
if (count > buffer->used)
{
#ifdef DEBUG_BUFFER
- sprintf(log.buf, "%s: Cant free bytes that rnt in the buffer.\n", me);
+ sprintf(mp3asm_log.buf, "%s: Cant free bytes that rnt in the buffer.\n", me);
print_log (10);
#endif /* DEBUG_BUFFER */
return (0);
@@ -411,7 +411,7 @@ rem_buf (buffer_t *buffer, int count)
buffer->used -= count;
}
#ifdef DEBUG_BUFFER
- sprintf(log.buf, "BUFFER: freed %d from buffer (%d)\nBUFFER: begin: %d end: %d used: %d size: %d\n", count, buffer->size, buffer->begin, buffer->end, buffer->used, buffer->size);
+ sprintf(mp3asm_log.buf, "BUFFER: freed %d from buffer (%d)\nBUFFER: begin: %d end: %d used: %d size: %d\n", count, buffer->size, buffer->begin, buffer->end, buffer->used, buffer->size);
print_log (10);
#endif /* DEBUG_BUFFER */
@@ -431,14 +431,14 @@ cut_buf (buffer_t *buffera, buffer_t *bufferb, int cou
if (count > buffera->used)
{
#ifdef DEBUG_BUFFER
- sprintf(log.buf, "%s: Request for more bytes (%d) than there are in buffer A (%d/%d).\n", me, count, buffera->used, buffera->size);
+ sprintf(mp3asm_log.buf, "%s: Request for more bytes (%d) than there are in buffer A (%d/%d).\n", me, count, buffera->used, buffera->size);
print_log (10);
#endif /* DEBUG_BUFFER */
return (0);
}
if (count > (bufferb->size - bufferb->used))
{
- sprintf(log.buf, "%s: Request for buffer overload received (%d + %d > %d\n", me, count, bufferb->used, bufferb->size);
+ sprintf(mp3asm_log.buf, "%s: Request for buffer overload received (%d + %d > %d\n", me, count, bufferb->used, bufferb->size);
print_all (-1);
return (-1);
}
@@ -454,7 +454,7 @@ cut_buf (buffer_t *buffera, buffer_t *bufferb, int cou
count1 = bufferb->size - bufferb->end;
#ifdef DEBUG_BUFFER
- sprintf (log.buf, "BUFFER: Reading %d from buffer (@%d from %d/%d) to buffer (@%d from %d/%d) \n", count1, buffera->begin, buffera->used, buffera->size, bufferb->end, bufferb->used, bufferb->size);
+ sprintf (mp3asm_log.buf, "BUFFER: Reading %d from buffer (@%d from %d/%d) to buffer (@%d from %d/%d) \n", count1, buffera->begin, buffera->used, buffera->size, bufferb->end, bufferb->used, bufferb->size);
print_log (10);
#endif /* DEBUG_BUFFER */
@@ -474,9 +474,9 @@ cut_buf (buffer_t *buffera, buffer_t *bufferb, int cou
}
#ifdef DEBUG_BUFFER
- sprintf(log.buf, "BUFFER: 1) begin: %d end: %d used: %d size: %d\n", buffera->begin, buffera->end, buffera->used, buffera->size);
+ sprintf(mp3asm_log.buf, "BUFFER: 1) begin: %d end: %d used: %d size: %d\n", buffera->begin, buffera->end, buffera->used, buffera->size);
print_log (10);
- sprintf(log.buf, "BUFFER: 2) begin: %d end: %d used: %d size: %d\n", bufferb->begin, bufferb->end, bufferb->used, bufferb->size);
+ sprintf(mp3asm_log.buf, "BUFFER: 2) begin: %d end: %d used: %d size: %d\n", bufferb->begin, bufferb->end, bufferb->used, bufferb->size);
print_log (10);
#endif /* DEBUG_BUFFER */
@@ -494,7 +494,7 @@ write_buf (unsigned char *data, buffer_t *buffer, int
if (count > (buffer->size - buffer->used))
{
- sprintf(log.buf, "%s: Request for buffer overload received (%d + %d > %d\n", me, count, buffer->used, buffer->size);
+ sprintf(mp3asm_log.buf, "%s: Request for buffer overload received (%d + %d > %d\n", me, count, buffer->used, buffer->size);
print_all (-1);
return (-1);
}
@@ -507,7 +507,7 @@ write_buf (unsigned char *data, buffer_t *buffer, int
count1 = buffer->size - buffer->end;
#ifdef DEBUG_BUFFER
- sprintf (log.buf, "BUFFER: Reading %d from data (%p) to buffer (@%d from %d/%d) \n", count1, data, buffer->end, buffer->used, buffer->size);
+ sprintf (mp3asm_log.buf, "BUFFER: Reading %d from data (%p) to buffer (@%d from %d/%d) \n", count1, data, buffer->end, buffer->used, buffer->size);
print_log (10);
#endif /* DEBUG_BUFFER */
@@ -522,7 +522,7 @@ write_buf (unsigned char *data, buffer_t *buffer, int
}
#ifdef DEBUG_BUFFER
- sprintf(log.buf, "BUFFER: 2) begin: %d end: %d used: %d size: %d\n", buffer->begin, buffer->end, buffer->used, buffer->size);
+ sprintf(mp3asm_log.buf, "BUFFER: 2) begin: %d end: %d used: %d size: %d\n", buffer->begin, buffer->end, buffer->used, buffer->size);
print_log (10);
#endif /* DEBUG_BUFFER */
@@ -548,7 +548,7 @@ print_buf (buffer_t *buffer, int count)
{
while (count1)
{
- fprintf (log.file, "%x", *ptr);
+ fprintf (mp3asm_log.file, "%x", *ptr);
count1 --;
count --;
ptr ++;
@@ -557,7 +557,7 @@ print_buf (buffer_t *buffer, int count)
ptr = buffer->data;
count1 = count;
}
- fprintf (log.file, "\n");
+ fprintf (mp3asm_log.file, "\n");
return (1);
}
@@ -587,14 +587,14 @@ write_file_from_buf (buffer_t *buffer, FILE *file, int
continue;
else
{
- sprintf (log.buf, "%s: Error writing from buffer to file.\n", me);
+ sprintf (mp3asm_log.buf, "%s: Error writing from buffer to file.\n", me);
print_all (-1);
perror ("fwrite");
return (-1);
}
}
#ifdef DEBUG_BUFFER
- sprintf (log.buf, "BUFFER: writing to file from buffer: %d \n", writeb);
+ sprintf (mp3asm_log.buf, "BUFFER: writing to file from buffer: %d \n", writeb);
print_log (10);
#endif /* DEBUG_BUFFER */
@@ -609,7 +609,7 @@ write_file_from_buf (buffer_t *buffer, FILE *file, int
}
#ifdef DEBUG_BUFFER
- sprintf(log.buf, "BUFFER: begin: %d end: %d used: %d size: %d\n", buffer->begin, buffer->end, buffer->used, buffer->size);
+ sprintf(mp3asm_log.buf, "BUFFER: begin: %d end: %d used: %d size: %d\n", buffer->begin, buffer->end, buffer->used, buffer->size);
print_log (10);
#endif /* DEBUG_BUFFER */
@@ -630,11 +630,11 @@ print_data (unsigned char *data, int count)
while (count)
{
- fprintf (log.file, "%x", *ptr);
+ fprintf (mp3asm_log.file, "%x", *ptr);
count --;
ptr ++;
}
- fprintf (log.file, "\n");
+ fprintf (mp3asm_log.file, "\n");
return (1);
}