Progressively nuke tbz2tool, per bug #220701, comment #4.
authorFabian Groffen <grobian@gentoo.org>
Sat, 10 May 2008 09:37:08 +0000 (09:37 -0000)
committerFabian Groffen <grobian@gentoo.org>
Sat, 10 May 2008 09:37:08 +0000 (09:37 -0000)
svn path=/main/branches/prefix/; revision=10283

configure.in
src/Makefile.am
src/tbz2tool.c [deleted file]

index 45483b6c1453b68132f792a7ceaf4de574f15491..c7780c4af73a431c369bb72addcb5be1fc17f2d9 100644 (file)
@@ -149,15 +149,6 @@ AC_TRY_LINK([
                 ]
 )
 
-AC_ARG_ENABLE(tbz2tool,
-AC_HELP_STRING([--enable-tbz2tool],[build tbz2tool, tool for creating binpkgs (default yes)]),
-[case "${enableval}" in
-  yes)  enable_tbz2tool=true;;
-  no)  enable_tbz2tool=false;;
-  *)   AC_MSG_ERROR(bad value ${enableval} for --enable-tbz2tool);;
-esac],
-[enable_tbz2tool=true])
-
 AC_ARG_ENABLE(just-compiled-sources,
 AC_HELP_STRING([--enable-just-compiled-sources],[install just the bytecode, not the sources (default no)]),
 [case "${enableval}" in
@@ -250,7 +241,6 @@ AC_SUBST(EAPIPREFIX)
 AC_SUBST(DEFAULT_PATH)
 AC_SUBST(PORTAGE_BASE,['${exec_prefix}/lib/portage'])
 AM_CONDITIONAL(INSTALL_PYTHON_SOURCES, test x$enable_py_sources = xtrue)
-AM_CONDITIONAL(BUILD_TBZ2TOOL, test x$enable_tbz2tool = xtrue)
 
 AC_MSG_CHECKING([for a list of variables known by configure])
 pt_configvars=`sed -n -e "/^ac_subst_vars='/,/'$/p" ${srcdir}/configure | sed -e "s/^ac_subst_vars='//" -e "s/'$//"`
index 7543ce7e2562bcaee88bf969be07b6147514b974..ca57218bc9c02b2a4353a63897566521cfcd1e70 100644 (file)
@@ -2,12 +2,7 @@ SUBDIRS        =
 
 bin_PROGRAMS   = chpathtool
 bindir = @PORTAGE_BASE@/bin
-if BUILD_TBZ2TOOL
-bin_PROGRAMS += tbz2tool
-endif
 
 chpathtool_SOURCES = chpathtool.c
 
-tbz2tool_SOURCES = tbz2tool.c
-
 MAINTAINERCLEANFILES = Makefile.in
diff --git a/src/tbz2tool.c b/src/tbz2tool.c
deleted file mode 100644 (file)
index af76281..0000000
+++ /dev/null
@@ -1,228 +0,0 @@
-/* $Id$ */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-
-/*buffered reading/writing size*/
-#define BUFLEN 262144 
-char *myname="tbz2tool";
-struct stat *mystat=NULL;
-void *mybuf;
-FILE *datafile, *dbfile, *outfile, *infile;
-unsigned char endbuf[8];
-long seekto,insize;
-
-int exists(const char *myfile) {
-       int result;
-       result=stat(myfile,mystat);
-       if (result==-1)
-               return 0;
-       return 1;
-}
-
-void writefile(FILE *src, FILE *dest) {
-       int count=1;
-       while (count) {
-               count=fread(mybuf, 1, BUFLEN, src);
-               fwrite(mybuf, 1, count, dest);
-       }
-}
-
-void writefileto(FILE *src, FILE *dest, int endpos) {
-       int pos=ftell(src);
-       int thiscount;
-       while (pos < endpos) {
-               /* thiscount=how much to read */
-               thiscount=endpos-pos;
-               if (thiscount>BUFLEN)
-                       thiscount=BUFLEN;
-               thiscount=fread(mybuf, 1, thiscount , src);
-               /* thiscount=how much we actually did read */
-               if (thiscount==0)
-                       /* eof -- shouldn't happen */
-                       break;
-               /* update internal position counter */
-               pos+=thiscount;
-               fwrite(mybuf, 1, thiscount, dest);
-       }
-}
-
-int main(int argc, char **argv) {
-       if ((argc==2) && (!(strcmp(argv[1],"--help"))))
-               goto usage;
-       if (argc!=5) {
-               printf("%s: four arguments expected\n",myname);
-               goto error;
-       }
-       if (!(mystat=(struct stat *) malloc(sizeof(struct stat))))
-               goto memalloc;
-               
-       if (!(mybuf=(void *) malloc(BUFLEN))) {
-               free(mystat);
-               goto memalloc;
-       }
-       
-       /* JOIN MODE */
-       if (!(strcmp(argv[1],"join"))) {
-       
-               /* check if datafile exists */
-               if (!(exists(argv[2]))) {
-                       printf("%s: %s doesn't exist\n",myname,argv[2]);
-                       free(mystat);
-                       goto error;
-               }
-               
-               /* check if dbfile exists */
-               if (!(exists(argv[3]))) {
-                       printf("%s: %s doesn't exist\n",myname,argv[3]);
-                       free(mystat);
-                       goto error;
-               }
-               /* create end buffer for later use */
-               endbuf[0]=((mystat->st_size) & 0xff000000) >> 24;
-               endbuf[1]=((mystat->st_size) & 0x00ff0000) >> 16;
-               endbuf[2]=((mystat->st_size) & 0x0000ff00) >> 8;
-               endbuf[3]=(mystat->st_size) & 0x000000ff;
-               endbuf[4]='S';
-               endbuf[5]='T';
-               endbuf[6]='O';
-               endbuf[7]='P';
-       
-               /* if outfile exists, unlink first (safer) */
-               if (exists(argv[4])) 
-                       unlink(argv[4]);
-               
-               /* open datafile for reading */
-               if ((datafile=fopen(argv[2],"r"))==NULL) {
-                       free(mybuf);
-                       free(mystat);
-                       printf("%s: Error opening %s\n",myname,argv[2]);
-                       goto error;
-               }
-               
-               /* open dbfile for reading */
-               if ((dbfile=fopen(argv[3],"r"))==NULL) {
-                       fclose(datafile);
-                       free(mybuf);
-                       free(mystat);
-                       printf("%s: Error opening %s\n",myname,argv[3]);
-                       goto error;
-               }
-       
-               /* open outfile for writing */
-               if ((outfile=fopen(argv[4],"a"))==NULL) {
-                       fclose(dbfile);
-                       fclose(datafile);
-                       free(mybuf);
-                       free(mystat);
-                       printf("%s: Error opening %s\n",myname,argv[4]);
-                       goto error;
-               }
-       
-               writefile(datafile,outfile);
-               writefile(dbfile,outfile);
-               fwrite(endbuf,1,8,outfile);
-               fclose(outfile);
-               fclose(dbfile);
-               fclose(datafile);
-               free(mybuf);
-               free(mystat);
-               exit(0);        
-       
-       /* SPLIT MODE */
-       } else if (!(strcmp(argv[1],"split"))) {
-       
-               /* check if infile exists */
-               if (!(exists(argv[2]))) {
-                       printf("%s: %s doesn't exist\n",myname,argv[2]);
-                       free(mystat);
-                       goto error;
-               }
-               
-               /* store infile size for later use */
-
-               insize=mystat->st_size;
-               
-               /* if datafile exists, unlink first (safer) */
-               if (exists(argv[3])) 
-                       unlink(argv[3]);
-               
-               /* if dbfile exists, unlink first (safer) */
-               if (exists(argv[4])) 
-                       unlink(argv[4]);
-       
-               /* open infile for reading */
-               if ((infile=fopen(argv[2],"r"))==NULL) {
-                       free(mybuf);
-                       free(mystat);
-                       printf("%s: Error opening %s\n",myname,argv[2]);
-                       goto error;
-               }
-               
-               /* read in end buffer */
-               fseek(infile,-8,SEEK_END);      
-               fread(endbuf,1,8,infile);
-               /* quick end buffer read and verification */
-               if ( (endbuf[4]!='S') || (endbuf[5]!='T') || (endbuf[6]!='O') || (endbuf[7]!='P') )     {
-                       fclose(infile);
-                       free(mybuf);
-                       free(mystat);
-                       printf("%s: %s appears to be corrupt (end buffer invalid)\n",myname,argv[2]);
-                       goto error;
-               }
-               
-               seekto=0;
-               seekto=seekto+endbuf[0]*256*256*256;
-               seekto=seekto+endbuf[1]*256*256;
-               seekto=seekto+endbuf[2]*256;
-               seekto=seekto+endbuf[3];
-               
-               /* open datafile for writing */
-               if ((datafile=fopen(argv[3],"a"))==NULL) {
-                       fclose(infile);
-                       free(mybuf);
-                       free(mystat);
-                       printf("%s: Error opening %s\n",myname,argv[3]);
-                       goto error;
-               }
-       
-               /* open dbfile for writing */
-               if ((dbfile=fopen(argv[4],"a"))==NULL) {
-                       fclose(datafile);
-                       fclose(infile);
-                       free(mybuf);
-                       free(mystat);
-                       printf("%s: Error opening %s\n",myname,argv[4]);
-                       goto error;
-               }
-
-               rewind(infile);
-               writefileto(infile,datafile,insize-(seekto+8));
-               fseek(infile,-(seekto+8),SEEK_END);
-               writefileto(infile,dbfile,insize-8);
-               fclose(infile);
-               fclose(dbfile);
-               fclose(datafile);
-               free(mybuf);
-               free(mystat);
-               exit(0);        
-               
-       } else {
-               free(mybuf);
-               free(mystat);
-               goto usage;
-       }
-       
-       usage:
-       printf("Usage: %s join DATAFILE DBFILE OUTFILE (datafile + dbfile -> outfile)\n       %s split INFILE DATAFILE DBFILE (infile -> datafile + dbfile)\n",myname,myname);
-error:
-       exit(1);
-memalloc:
-       printf("%s: memory allocation error\n",myname);
-       exit(2);
-}