encoder/decoder tool for the Usenet yEnc encoding format; input and ok

from jolan@
This commit is contained in:
fgsch 2005-01-25 23:32:22 +00:00
parent 88c27a415b
commit 904c709836
12 changed files with 273 additions and 0 deletions

30
news/yencode/Makefile Normal file
View File

@ -0,0 +1,30 @@
# $OpenBSD: Makefile,v 1.1.1.1 2005/01/25 23:32:22 fgsch Exp $
COMMENT= encoder/decoder tool for the Usenet yEnc encoding format
DISTNAME= yencode-0.46
CATEGORIES= news
MASTER_SITES= http://www.yencode.org/download/source/
HOMEPAGE= http://www.yencode.org/
MODULES= converters/libiconv
WANTLIB= c intl
# GPL
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
CONFIGURE_STYLE= gnu
CONFIGURE_ARGS= --with-libiconv-prefix="${LOCALBASE}"
CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \
CFLAGS="${CFLAGS} -I${LOCALBASE}/include" \
LDFLAGS="-L${LOCALBASE}/lib"
NO_REGRESS= Yes
.include <bsd.port.mk>

4
news/yencode/distinfo Normal file
View File

@ -0,0 +1,4 @@
MD5 (yencode-0.46.tar.gz) = 6af054f69c781cafa620063878a831ea
RMD160 (yencode-0.46.tar.gz) = d431a9e62e0143f9a514b8427178579725d4816f
SHA1 (yencode-0.46.tar.gz) = b27a37dc4de8f76ea404b22f72cb6f591c63267f
SIZE (yencode-0.46.tar.gz) = 241762

View File

@ -0,0 +1,35 @@
$OpenBSD: patch-lib_getopt_c,v 1.1.1.1 2005/01/25 23:32:22 fgsch Exp $
--- lib/getopt.c.orig Mon Mar 11 03:31:47 2002
+++ lib/getopt.c Sat Jan 22 21:51:01 2005
@@ -55,11 +55,11 @@ extern int strncmp();
/* This needs to come after some library #include
to get __GNU_LIBRARY__ defined. */
-#ifdef __GNU_LIBRARY__
+#if defined(__GNU_LIBRARY__) || defined(__OpenBSD__)
/* Don't include stdlib.h for non-GNU C libraries because some of them
contain conflicting prototypes for getopt. */
#include <stdlib.h>
-#endif /* GNU C library. */
+#endif /* GNU C library. || OpenBSD */
/* This version of `getopt' appears to the caller like standard Unix `getopt'
but it behaves differently for the user, since it allows the user
@@ -157,7 +157,7 @@ static enum
/* Value of POSIXLY_CORRECT environment variable. */
static char *posixly_correct;
-#ifdef __GNU_LIBRARY__
+#if defined(__GNU_LIBRARY__) || defined(__OpenBSD__)
/* We want to avoid inclusion of string.h with non-GNU libraries
because there are many ways it can cause trouble.
On some systems, it contains special magic macros that don't work
@@ -197,7 +197,7 @@ extern int strlen (const char *);
#endif /* not __STDC__ */
#endif /* __GNUC__ */
-#endif /* not __GNU_LIBRARY__ */
+#endif /* not (__GNU_LIBRARY__) || (__OpenBSD__) */
/* Handle permutation of arguments. */

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-lib_screen_c,v 1.1.1.1 2005/01/25 23:32:22 fgsch Exp $
--- lib/screen.c.orig Sat Jan 22 21:43:52 2005
+++ lib/screen.c Sat Jan 22 21:49:26 2005
@@ -20,7 +20,7 @@
#include "misc.h"
-#ifndef TIOCGWINSZ
+#if !defined(TIOCGWINSZ) || defined(__OpenBSD__)
#include <sys/ioctl.h>
#endif

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-lib_xmalloc_c,v 1.1.1.1 2005/01/25 23:32:22 fgsch Exp $
--- lib/xmalloc.c.orig Sat Jan 22 21:43:38 2005
+++ lib/xmalloc.c Sat Jan 22 21:44:46 2005
@@ -27,6 +27,7 @@
#if !defined (ALREADY_HAVE_XMALLOC)
#include <stdio.h>
+#include <stdlib.h>
#include <sys/types.h>
extern void *malloc (), *realloc ();

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-src_support_c,v 1.1.1.1 2005/01/25 23:32:22 fgsch Exp $
--- src/support.c.orig Sat Jan 22 21:52:35 2005
+++ src/support.c Sat Jan 22 21:53:14 2005
@@ -38,7 +38,7 @@ yencode_and_write_buffer(FILE *out, cons
register int linect = 0;
register unsigned char c;
- fprintf(out, "=ybegin line=%d size=%u name=%s\r\n", opt_line_length, buflen, filename);
+ fprintf(out, "=ybegin line=%d size=%zu name=%s\r\n", opt_line_length, buflen, filename);
CRC_START(crc);
for (ct = 0; ct < buflen; ct++)
{
@@ -66,7 +66,7 @@ yencode_and_write_buffer(FILE *out, cons
fputc('\n', out);
}
CRC_FINISH(crc);
- fprintf(out, "=yend size=%u crc32=%08x\r\n", buflen, crc);
+ fprintf(out, "=yend size=%zu crc32=%08x\r\n", buflen, crc);
}
/*--- yencode_and_write_buffer() ----------------------------------------------------------------*/

View File

@ -0,0 +1,30 @@
$OpenBSD: patch-src_ydecode_c,v 1.1.1.1 2005/01/25 23:32:22 fgsch Exp $
--- src/ydecode.c.orig Sat Jan 22 21:53:56 2005
+++ src/ydecode.c Sat Jan 22 22:02:31 2005
@@ -573,7 +573,7 @@ ydecode_single(YDECFILE *y)
_("ybegin"), comma1(*y->header->size),
_("actual"), comma2(decodedsize));
errors++;
- snprintf(errmsg, sizeof(errmsg), "size-%u", decodedsize);
+ snprintf(errmsg, sizeof(errmsg), "size-%zu", decodedsize);
}
if (y->footer->crc32 && (*y->footer->crc32 != crc32))
{
@@ -814,7 +814,7 @@ ydecode_multi(int *first_pos)
"(%s=%s %s=%s)",
_("yend"), comma1(*y->footer->size),
_("actual"), comma2(decpart));
- snprintf(errmsg, sizeof(errmsg), "psize-%u", decpart);
+ snprintf(errmsg, sizeof(errmsg), "psize-%zu", decpart);
errors++;
}
if (y->footer->pcrc32 && (*y->footer->pcrc32 != pcrc32))
@@ -847,7 +847,7 @@ ydecode_multi(int *first_pos)
"(%s=%s %s=%s)",
_("ybegin"), comma1(*y->header->size),
_("actual"), comma2(decodedsize));
- snprintf(errmsg, sizeof(errmsg), "size-%u", decodedsize);
+ snprintf(errmsg, sizeof(errmsg), "size-%zu", decodedsize);
errors++;
}
if (y->footer->crc32 && (*y->footer->crc32 != crc32))

View File

@ -0,0 +1,37 @@
$OpenBSD: patch-src_yencode_c,v 1.1.1.1 2005/01/25 23:32:22 fgsch Exp $
--- src/yencode.c.orig Sat Jan 22 21:53:50 2005
+++ src/yencode.c Sat Jan 22 22:01:09 2005
@@ -370,7 +370,7 @@ yencode_file(YENCFILE *f, FILE *in, size
/* Write headers */
if (opt_multipart_size)
{
- headers = fprintf(out, "=ybegin part=%d total=%d line=%d size=%u name=%s\r\n",
+ headers = fprintf(out, "=ybegin part=%d total=%d line=%d size=%zu name=%s\r\n",
part, totalparts, opt_line_length, insize, STRIP_PATH(f->input_filename));
{
size_t remaining = insize - decsize;
@@ -386,7 +386,7 @@ yencode_file(YENCFILE *f, FILE *in, size
}
else
{
- headers = fprintf(out, "=ybegin line=%d size=%u name=%s\r\n",
+ headers = fprintf(out, "=ybegin line=%d size=%zu name=%s\r\n",
opt_line_length, insize, STRIP_PATH(f->input_filename));
}
@@ -400,13 +400,13 @@ yencode_file(YENCFILE *f, FILE *in, size
/* Write footers */
if (opt_multipart_size)
{
- headers += fprintf(out, "=yend part=%d total=%d size=%u pcrc32=%08X",
+ headers += fprintf(out, "=yend part=%d total=%d size=%zu pcrc32=%08X",
part, totalparts, decpart, pcrc32);
}
else
{
CRC_FINISH(crc32);
- headers += fprintf(out, "=yend size=%u crc32=%08X\r\n", insize, crc32);
+ headers += fprintf(out, "=yend size=%zu crc32=%08X\r\n", insize, crc32);
f->ok = 1;
f->crc = crc32;
}

View File

@ -0,0 +1,26 @@
$OpenBSD: patch-src_ypost_usenet_c,v 1.1.1.1 2005/01/25 23:32:22 fgsch Exp $
--- src/ypost/usenet.c.orig Fri Mar 15 12:10:49 2002
+++ src/ypost/usenet.c Sat Jan 22 22:18:35 2005
@@ -159,7 +159,7 @@ usenet_message_id(void)
if (uname(&uts))
ErrERR(_("unable to determine hostname"));
- snprintf(id, sizeof(id), "<%lx%x%x@%s>", time(NULL), getpid(), idcount++, uts.nodename);
+ snprintf(id, sizeof(id), "<%x%x%x@%s>", time(NULL), getpid(), idcount++, uts.nodename);
return (id);
}
/*--- usenet_message_id() -----------------------------------------------------------------------*/
@@ -268,11 +268,11 @@ usenet_make_subject(YENCFILE *y, int par
sdprintf(&subj, "\"%s\" ", STRIP_PATH(y->input_filename));
if (y->totalparts < 2) /* Single part subject */
- sdprintf(&subj, "%u yEnc bytes", y->filesize);
+ sdprintf(&subj, "%zu yEnc bytes", y->filesize);
else /* Multi part subject */
{
/* Get part number as a string */
- sdprintf(&subj, "yEnc (%s/%d) %u bytes", pad_number(part, y->totalparts, 1), y->totalparts, y->filesize);
+ sdprintf(&subj, "yEnc (%s/%zd) %zu bytes", pad_number(part, y->totalparts, 1), y->totalparts, y->filesize);
}
if (opt_comment)
sdprintf(&subj, " [%s]", opt_comment);

View File

@ -0,0 +1,42 @@
$OpenBSD: patch-src_ypost_ypost_c,v 1.1.1.1 2005/01/25 23:32:22 fgsch Exp $
--- src/ypost/ypost.c.orig Sat Jan 22 21:54:17 2005
+++ src/ypost/ypost.c Sat Jan 22 21:59:11 2005
@@ -733,7 +733,7 @@ output_file_info(void)
}
printf(" support data: %s\n", y->support_data ? "yes" : "no");
for (part = 0; part < y->totalparts; part++)
- printf(" part %03d: begin=%lu end=%lu size=%u\n", part + 1, y->part[part]->begin,
+ printf(" part %03d: begin=%lu end=%lu size=%zu\n", part + 1, y->part[part]->begin,
y->part[part]->end, y->part[part]->size);
}
charline('-');
@@ -818,10 +818,10 @@ post_file(YENCFILE *y)
** Write the yEnc "=ybegin" line
*/
if (y->totalparts == 1)
- sock_printf("=ybegin line=%d size=%u name=%s\n",
+ sock_printf("=ybegin line=%d size=%zu name=%s\n",
opt_line_length, y->filesize, STRIP_PATH(y->input_filename));
else
- sock_printf("=ybegin part=%d total=%d line=%d size=%u name=%s\n",
+ sock_printf("=ybegin part=%d total=%zd line=%d size=%zu name=%s\n",
part_current, y->totalparts, opt_line_length, y->filesize, STRIP_PATH(y->input_filename));
/*
@@ -924,13 +924,13 @@ post_file(YENCFILE *y)
** Write the yEnc "=yend" line
*/
if (y->totalparts == 1)
- sock_printf("=yend size=%u crc32=%08X\n", y->filesize, y->crc);
+ sock_printf("=yend size=%zu crc32=%08X\n", y->filesize, y->crc);
else
{
if (part_current == y->totalparts)
- sock_printf("=yend size=%u part=%d pcrc32=%08X crc32=%08X\n", y->part[part_current-1]->size, part_current, pcrc, y->crc);
+ sock_printf("=yend size=%zu part=%d pcrc32=%08X crc32=%08X\n", y->part[part_current-1]->size, part_current, pcrc, y->crc);
else
- sock_printf("=yend size=%u part=%d pcrc32=%08X\n", y->part[part_current-1]->size, part_current, pcrc);
+ sock_printf("=yend size=%zu part=%d pcrc32=%08X\n", y->part[part_current-1]->size, part_current, pcrc);
}
/*

17
news/yencode/pkg/DESCR Normal file
View File

@ -0,0 +1,17 @@
yencode is an encoder/decoder package for the Usenet yEnc encoding
format.
Some features:
* Encoder can output single part or multipart encoded archives of
any size.
* Smart decoder can handle multiple files, including files specified
out of order or with nonsense file names.
* Included Usenet posting software posts files to Usenet quickly
and easily, including automatic retries and resumption of aborted
postings, plus automatic creation of encoded multipart archives and
SFV/CRC checksum files, if desired.
* Optional scan mode: automatically locate and decode single or
multipart encoded archives in specified directories or recursively.
* Supports SFV file creation for multiple-file archives.
* Fully compliant with the current yEnc specifications.

8
news/yencode/pkg/PLIST Normal file
View File

@ -0,0 +1,8 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2005/01/25 23:32:22 fgsch Exp $
bin/ydecode
bin/yencode
bin/ypost
@man man/man1/ydecode.1
@man man/man1/yencode.1
@man man/man1/ypost.1
@man man/man5/ypostrc.5