Check-in [b34363088f]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Moved `dact_process_other' to dact_common.c to build correctly, oops.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b34363088f3e1b064271c0a6395c2acf58dab4a9
User & Date: rkeene 2004-12-20 21:49:26.000
Context
2005-03-05
11:33
Updated library build process a bit. check-in: 24ea444e34 user: rkeene tags: trunk
2004-12-20
21:49
Moved `dact_process_other' to dact_common.c to build correctly, oops. check-in: b34363088f user: rkeene tags: trunk
02:28
Updated build process extensively. Cygwin and mingw32 should both be able to create shared objects (DLLs) now. dact 0.8.41 check-in: 43763b1acf user: rkeene tags: trunk, 0.8.41
Changes
Unified Diff Ignore Whitespace Patch
Changes to Makefile.in.
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
	-$(INSTALL) -d $(sysconfdir)
	$(INSTALL) -m 644 dact.conf $(CONF)
	$(INSTALL) -m 644 Docs/dact.1 $(mandir)/man1/dact.1
	-$(INSTALL) -m 755 libdact.$(SHOBJEXT) $(libdir)/libdact.$(SHOBJEXT)
	-$(INSTALL) -m 644 libdact.$(SHOBJEXT).def $(libdir)/libdact.$(SHOBJEXT).def
	-$(INSTALL) -m 644 libdact.$(SHOBJEXT).a $(libdir)/libdact.$(SHOBJEXT).a
	-$(INSTALL) -m 644 libdact.a $(libdir)/libdact.a
@MODS@	for so in *.so; do $(INSTALL) -m 755 $$so $(datadir)/dact/$$so; done
	./patch-magic-file $(datadir)/magic

install-bin-local: dact$(EXEEXT)
	-$(INSTALL) -d $(HOME)/.dact/`uname -s | tr A-Z a-z`-`uname -m`
	$(INSTALL) -m 755 dact$(EXEEXT) $(HOME)/.dact/`uname -s | tr A-Z a-z`-`uname -m`/dact$(EXEEXT)

install-local: all install-bin-local
	-$(INSTALL) -d $(HOME)/.dact/`uname -s | tr A-Z a-z`-`uname -m`
	$(INSTALL) -m 644 dact.conf $(HOME)/.dact/dact.conf
	-$(INSTALL) -m 644 libdact.a $(HOME)/.dact/`uname -s | tr A-Z a-z`-`uname -m`/dact$(EXEEXT)
	-$(INSTALL) -m 755 libdact.$(SHOBJEXT) $(HOME)/.dact/`uname -s | tr A-Z a-z`-`uname -m`/dact$(EXEEXT)
@MODS@	for so in *.so; do $(INSTALL) -m 755 $$so $(HOME)/.dact/`uname -s | tr A-Z a-z`-`uname -m`/$$so; done

uninstall:
	rm -f $(bindir)/dact$(EXEEXT)
	rm -f $(mandir)/man1/dact.1 $(CONF)
	rm -f $(libdir)/libdact.a $(libdir)/libdact.$(SHOBJEXT)
@MODS@	rm -rf $(datadir)/dact








|











|







103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
	-$(INSTALL) -d $(sysconfdir)
	$(INSTALL) -m 644 dact.conf $(CONF)
	$(INSTALL) -m 644 Docs/dact.1 $(mandir)/man1/dact.1
	-$(INSTALL) -m 755 libdact.$(SHOBJEXT) $(libdir)/libdact.$(SHOBJEXT)
	-$(INSTALL) -m 644 libdact.$(SHOBJEXT).def $(libdir)/libdact.$(SHOBJEXT).def
	-$(INSTALL) -m 644 libdact.$(SHOBJEXT).a $(libdir)/libdact.$(SHOBJEXT).a
	-$(INSTALL) -m 644 libdact.a $(libdir)/libdact.a
@MODS@	for so in $(MODS); do $(INSTALL) -m 755 $$so $(datadir)/dact/$$so; done
	./patch-magic-file $(datadir)/magic

install-bin-local: dact$(EXEEXT)
	-$(INSTALL) -d $(HOME)/.dact/`uname -s | tr A-Z a-z`-`uname -m`
	$(INSTALL) -m 755 dact$(EXEEXT) $(HOME)/.dact/`uname -s | tr A-Z a-z`-`uname -m`/dact$(EXEEXT)

install-local: all install-bin-local
	-$(INSTALL) -d $(HOME)/.dact/`uname -s | tr A-Z a-z`-`uname -m`
	$(INSTALL) -m 644 dact.conf $(HOME)/.dact/dact.conf
	-$(INSTALL) -m 644 libdact.a $(HOME)/.dact/`uname -s | tr A-Z a-z`-`uname -m`/dact$(EXEEXT)
	-$(INSTALL) -m 755 libdact.$(SHOBJEXT) $(HOME)/.dact/`uname -s | tr A-Z a-z`-`uname -m`/dact$(EXEEXT)
@MODS@	for so in $(MODS); do $(INSTALL) -m 755 $$so $(HOME)/.dact/`uname -s | tr A-Z a-z`-`uname -m`/$$so; done

uninstall:
	rm -f $(bindir)/dact$(EXEEXT)
	rm -f $(mandir)/man1/dact.1 $(CONF)
	rm -f $(libdir)/libdact.a $(libdir)/libdact.$(SHOBJEXT)
@MODS@	rm -rf $(datadir)/dact

Changes to dact.c.
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifdef HAVE_BZLIB_H
#include <bzlib.h>
#endif


int print_help(int argc, char **argv);
int dact_shutdown(int retval);
uint32_t dact_process_other(int src, const int dest, const uint32_t magic, const char *options);
int main(int argc, char **argv);

extern char *optarg;
extern int optind, opterr, optopt;

int print_help(int argc, char **argv) {
	printf("DACT %i.%i.%i-%s by Keene Enterprises <dact@rkeene.org>\n", DACT_VER_MAJOR, DACT_VER_MINOR, DACT_VER_REVISION, DACT_VER_SUB);







<







59
60
61
62
63
64
65

66
67
68
69
70
71
72
#ifdef HAVE_BZLIB_H
#include <bzlib.h>
#endif


int print_help(int argc, char **argv);
int dact_shutdown(int retval);

int main(int argc, char **argv);

extern char *optarg;
extern int optind, opterr, optopt;

int print_help(int argc, char **argv) {
	printf("DACT %i.%i.%i-%s by Keene Enterprises <dact@rkeene.org>\n", DACT_VER_MAJOR, DACT_VER_MINOR, DACT_VER_REVISION, DACT_VER_SUB);
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
		case DACT_MODE_STAT:
			return(NULL);
			break;
	}
	return(ret);
}

uint32_t dact_process_other(int src, const int dest, const uint32_t magic, const char *options) {
	char *buf, tmpbuf[128]="/tmp/dactXXXXXX";
	uint32_t filesize=0, x;
	int tmpfd=0;
#if defined(HAVE_LIBBZ2) && (defined(HAVE_BZDOPEN) || defined(HAVE_NEW_BZDOPEN))
	BZFILE *bzfd;
#endif
#if defined(HAVE_LIBZ) && defined(HAVE_GZDOPEN)
	gzFile gzfd;
#endif

	filesize=0;  /* Fix a warning, that is all. */

/*
 * bad and broke stuff XXX FIXME XXX FIXME XXX FIXME
 * There has to be a better way to do this... I just want
 * to rewind my socket/pipe 4 bytes... 4 bytes is all I ask
 * Is that so much to ask for?  Well?!  Is it?!  I don't
 * think it is.
 * I give up on this.
 *
 * Someone please fix it.
 *  -- Roy Keene <dact@rkeene.org>
 */
	if (lseek_net(src, 0, SEEK_SET)<0) {
/*
 * lseek_net() should make this obsolete.
 *  ... EXCEPT! when reading from stdin.
 */
		tmpfd=mkstemp(tmpbuf);
		write_de(tmpfd, magic, 4);
		buf=malloc(1024);
		while (1) {
			x=read_f(src, buf, 1024);
			write(tmpfd, buf, x);
			if (x<1024) break;
		}
		close(src);
		src=tmpfd;
		lseek_net(src, 0, SEEK_SET); /* Now bitch. */
		free(buf);
	}
#if defined(HAVE_LIBZ) && defined(HAVE_GZDOPEN)

	if ((magic&0xffff0000)==0x1f8b0000) { /* gzip */
		dact_ui_status(DACT_UI_LVL_GEN, "Gunzipping...");
		buf=malloc(1024);

		gzfd=gzdopen(src, "r");
/*XXX: need to dact_ui_setup() */
		while (1) {
			dact_ui_incrblkcnt(1);
			x=gzread(gzfd,buf,1024);
			filesize+=write(dest, buf, x);
			if (x<1024) break;
		}
		free(buf);
		if (tmpfd!=0) unlink(tmpbuf);
		return(filesize);
	}
#endif

#if defined(HAVE_LIBBZ2) && (defined(HAVE_BZDOPEN) || defined(HAVE_NEW_BZDOPEN))
	if ((magic&0xffffff00)==0x425a6800) { /* bzip2 */ 
		dact_ui_status(DACT_UI_LVL_GEN, "Bunzipping...");
		buf=malloc(1024);

#ifdef HAVE_NEW_BZDOPEN
		bzfd=BZ2_bzdopen(src, "r");
#else
		bzfd=bzdopen(src, "r");
#endif
/*XXX: need to dact_ui_setup() */
		while(1) {
			dact_ui_incrblkcnt(1);
#ifdef HAVE_NEW_BZDOPEN
			x=BZ2_bzread(bzfd, buf, 1024);
#else
			x=bzread(bzfd, buf, 1024);
#endif
			filesize+=write(dest, buf, x);
			if (x<1024) break;
		}
		free(buf);
		if (tmpfd!=0) unlink(tmpbuf);
		return(filesize);
	}
#endif
	return(0);
}

int main(int argc, char **argv) {
	unsigned char options[20]={0};
	signed char opt;
	struct stat stat_buf;
	char **in_files, *in_file=NULL, *out_file=NULL;
	char dact_binfilebuf[256], *dact_binfile;
	char *ext=".dct";







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







397
398
399
400
401
402
403



























































































404
405
406
407
408
409
410
		case DACT_MODE_STAT:
			return(NULL);
			break;
	}
	return(ret);
}




























































































int main(int argc, char **argv) {
	unsigned char options[20]={0};
	signed char opt;
	struct stat stat_buf;
	char **in_files, *in_file=NULL, *out_file=NULL;
	char dact_binfilebuf[256], *dact_binfile;
	char *ext=".dct";
Changes to dact.h.
215
216
217
218
219
220
221
222
223
224
225


int print_help(int argc, char **argv);
int dact_upgrade_file_checkver(const char *name, const char *url_ver, const char *options);
int dact_upgrade_file(const char *name, const char *url_get, const char *url_ver, uint32_t version, const char *dest, const char *options);
int dact_shutdown(int retval);
char *dact_getoutfilename(const char *orig, const int mode, const char *ext);
uint32_t dact_process_other(int src, const int dest, const uint32_t magic, const char *options);
int main(int argc, char **argv);

#endif/*_DACT_H*/







<



215
216
217
218
219
220
221

222
223
224


int print_help(int argc, char **argv);
int dact_upgrade_file_checkver(const char *name, const char *url_ver, const char *options);
int dact_upgrade_file(const char *name, const char *url_get, const char *url_ver, uint32_t version, const char *dest, const char *options);
int dact_shutdown(int retval);
char *dact_getoutfilename(const char *orig, const int mode, const char *ext);

int main(int argc, char **argv);

#endif/*_DACT_H*/
Changes to dact_common.c.
878
879
880
881
882
883
884





























































































		return(1);
	}

	return(0);
}


































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975


		return(1);
	}

	return(0);
}

uint32_t dact_process_other(int src, const int dest, const uint32_t magic, const char *options) {
	char *buf, tmpbuf[128]="/tmp/dactXXXXXX";
	uint32_t filesize=0, x;
	int tmpfd=0;
#if defined(HAVE_LIBBZ2) && (defined(HAVE_BZDOPEN) || defined(HAVE_NEW_BZDOPEN))
	BZFILE *bzfd;
#endif
#if defined(HAVE_LIBZ) && defined(HAVE_GZDOPEN)
	gzFile gzfd;
#endif

	filesize=0;  /* Fix a warning, that is all. */

/*
 * bad and broke stuff XXX FIXME XXX FIXME XXX FIXME
 * There has to be a better way to do this... I just want
 * to rewind my socket/pipe 4 bytes... 4 bytes is all I ask
 * Is that so much to ask for?  Well?!  Is it?!  I don't
 * think it is.
 * I give up on this.
 *
 * Someone please fix it.
 *  -- Roy Keene <dact@rkeene.org>
 */
	if (lseek_net(src, 0, SEEK_SET)<0) {
/*
 * lseek_net() should make this obsolete.
 *  ... EXCEPT! when reading from stdin.
 */
		tmpfd=mkstemp(tmpbuf);
		write_de(tmpfd, magic, 4);
		buf=malloc(1024);
		while (1) {
			x=read_f(src, buf, 1024);
			write(tmpfd, buf, x);
			if (x<1024) break;
		}
		close(src);
		src=tmpfd;
		lseek_net(src, 0, SEEK_SET); /* Now bitch. */
		free(buf);
	}
#if defined(HAVE_LIBZ) && defined(HAVE_GZDOPEN)

	if ((magic&0xffff0000)==0x1f8b0000) { /* gzip */
		dact_ui_status(DACT_UI_LVL_GEN, "Gunzipping...");
		buf=malloc(1024);

		gzfd=gzdopen(src, "r");
/*XXX: need to dact_ui_setup() */
		while (1) {
			dact_ui_incrblkcnt(1);
			x=gzread(gzfd,buf,1024);
			filesize+=write(dest, buf, x);
			if (x<1024) break;
		}
		free(buf);
		if (tmpfd!=0) unlink(tmpbuf);
		return(filesize);
	}
#endif

#if defined(HAVE_LIBBZ2) && (defined(HAVE_BZDOPEN) || defined(HAVE_NEW_BZDOPEN))
	if ((magic&0xffffff00)==0x425a6800) { /* bzip2 */ 
		dact_ui_status(DACT_UI_LVL_GEN, "Bunzipping...");
		buf=malloc(1024);

#ifdef HAVE_NEW_BZDOPEN
		bzfd=BZ2_bzdopen(src, "r");
#else
		bzfd=bzdopen(src, "r");
#endif
/*XXX: need to dact_ui_setup() */
		while(1) {
			dact_ui_incrblkcnt(1);
#ifdef HAVE_NEW_BZDOPEN
			x=BZ2_bzread(bzfd, buf, 1024);
#else
			x=bzread(bzfd, buf, 1024);
#endif
			filesize+=write(dest, buf, x);
			if (x<1024) break;
		}
		free(buf);
		if (tmpfd!=0) unlink(tmpbuf);
		return(filesize);
	}
#endif
	return(0);
}
Changes to dact_common.h.
1
2
3
4
5
6
7
8
9
10
11

12
#ifndef _DACT_COMMON_H
#define _DACT_COMMON_H
#include "dact.h"

extern char dact_nonetwork;

int dact_config_execute(const char *cmd, char *options, uint32_t *blksize);
void dact_config_loadfile(const char *path, char *options, uint32_t *blksize);
uint32_t dact_blk_decompress(char *ret, const char *srcbuf, const uint32_t size, const char *options, const int algo, uint32_t bufsize);
uint32_t dact_blk_compress(char *algo, char *ret, const char *srcbuf, const uint32_t size, const char *options, uint32_t bufsize);
uint64_t dact_process_file(const int src, const int dest, const int mode, const char *options, const char *filename, uint32_t *crcs, uint32_t dact_blksize, int cipher);

#endif











>

1
2
3
4
5
6
7
8
9
10
11
12
13
#ifndef _DACT_COMMON_H
#define _DACT_COMMON_H
#include "dact.h"

extern char dact_nonetwork;

int dact_config_execute(const char *cmd, char *options, uint32_t *blksize);
void dact_config_loadfile(const char *path, char *options, uint32_t *blksize);
uint32_t dact_blk_decompress(char *ret, const char *srcbuf, const uint32_t size, const char *options, const int algo, uint32_t bufsize);
uint32_t dact_blk_compress(char *algo, char *ret, const char *srcbuf, const uint32_t size, const char *options, uint32_t bufsize);
uint64_t dact_process_file(const int src, const int dest, const int mode, const char *options, const char *filename, uint32_t *crcs, uint32_t dact_blksize, int cipher);
uint32_t dact_process_other(int src, const int dest, const uint32_t magic, const char *options);
#endif