Check-in [67a663abd1]

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

Overview
Comment:Removed much of the original source
Timelines: family | ancestors | descendants | both | new-driver
Files: files | file ages | folders
SHA1:67a663abd190b392e01a60e120110ad55f54f7c4
User & Date: rkeene 2013-03-05 03:08:12
Context
2013-03-05
14:14
Extended documentation check-in: 2ec5a6619d user: rkeene tags: new-driver
03:08
Removed much of the original source check-in: 67a663abd1 user: rkeene tags: new-driver
03:05
Rewrote mkstemp() implementation check-in: 6b27ab3d35 user: rkeene tags: new-driver
Changes

Name change from TODO to Docs/TODO.

Name change from TODO.ideas to Docs/TODO.ideas.

Deleted Makefile.in.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
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
130
131
132
133
134
135
136
137
CC = @CC@
CFLAGS = @CFLAGS@ @DEFS@
CPPFLAGS = @CPPFLAGS@

EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
PATH_SEPARATOR = @PATH_SEPARATOR@

LD = @CC@
AR = @AR@
RANLIB = @RANLIB@
LOADLIBES = 
LDLIBS += @LIBS@ @MODLIBS@ -lm @NOMODS@ @MODLIBSCOND@
LDFLAGS += @LDFLAGS@

SHOBJFLAGS = @SHOBJFLAGS@
SHOBJLDFLAGS = @SHOBJLDFLAGS@
SHOBJEXT = @SHOBJEXT@

MODLIBS = @MODLIBS@

INSTALL = @INSTALL@
@SET_MAKE@

prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
bindir = @bindir@
sysconfdir = @sysconfdir@
mandir = @mandir@
datadir = @datadir@

CONF = $(sysconfdir)/dact.conf
CFLAGS += -DDACT_CONFIG_FILE=\"$(CONF)\" -DEXEEXT=\"$(EXEEXT)\"
#CFLAGS += -O3
#LDFLAGS += -static

DEBUGALGO = comp_bitsums.c comp_factor.c comp_textrle.c
OBJS += dact_common.o comp_fail.o comp_plain.o buffer.o header.o sort.o dact.o module.o parse.o dendian.o crc.o net.o ui.o sfx.o libdact.o @LIBOBJS@
# Note that the following lacks "dact_shr.o" but otherwise MUST
# be kept in sync with OBJS
SHLIBOBJS += dact_common_shr.o comp_fail_shr.o comp_plain_shr.o buffer_shr.o header_shr.o sort_shr.o module_shr.o parse_shr.o dendian_shr.o crc_shr.o net_shr.o ui_shr.o sfx_shr.o libdact_shr.o @SHLIBOBJS@
ALGO = comp_snibble.c comp_delta.c comp_text.c comp_rle.c cipher_chaos.c cipher_sub.c cipher_psub.c @ALGO@

TOBUILD = dact$(EXEEXT) libdact.$(SHOBJEXT) libdact.a dact.conf

all: @DEFAULT@

module: @DEPEND@
	@MODS="$(ALGO:.c=.so)" LDLIBS="@ALLMODLIBS@" \
	  $(MAKE) $(TOBUILD)

static: @DEPEND@
	@OBJS="$(ALGO:.c=.o) $(CR_OBJ)" SHLIBOBJS="$(ALGO:.c=_shr.o)" LDLIBS="$(MODLIBS)" $(MAKE) $(TOBUILD)

dact.conf: Makefile
	@echo "version_check    off" > dact.conf
	@echo "#block_size      0" >> dact.conf
	@echo "#exclude_algo    0" >> dact.conf
	@echo "use_urls         on" >> dact.conf
	@echo "color_ui         off" >> dact.conf
	@echo "network_access   on" >> dact.conf
	@echo "binary_check     off" >> dact.conf
	@echo "module_dir       $(datadir)/dact" >> dact.conf
	@echo "module_load_all  off" >> dact.conf
@MODS@	@for so in $(MODS:.so=); do echo "load_module	$$so" >> dact.conf; done

dact$(EXEEXT): $(OBJS) $(MODS)
	$(CC) $(OBJS) $(LIBS) -o dact$(EXEEXT) $(LDLIBS) $(LDFLAGS)

libdact.$(SHOBJEXT): $(SHLIBOBJS)
	$(CC) $(CPPFLAGS) $(CFLAGS) $(SHOBJFLAGS) -o $@ $^ $(LDLIBS) $(LDFLAGS) $(SHOBJLDFLAGS)

libdact.a: $(OBJS)
	@AR@ rcu libdact.a $(filter-out dact.o, $^)
	-@RANLIB@ libdact.a

%_shr.o: %.c
	$(CC) $(CPPFLAGS) $(CFLAGS) $(SHOBJFLAGS) -c -o $@ $?

%.so: %.c %.lnk
	@echo $(CC) $(CPPFLAGS) $(CFLAGS) $(SHOBJFLAGS) -o $@ -DAS_MODULE $(SHOBJLDFLAGS) $(LDFLAGS) $< $(filter %.o, $^) `cat $(<:.c=.lnk)`; \
	$(CC) $(CPPFLAGS) $(CFLAGS) $(SHOBJFLAGS) -o $@ -DAS_MODULE $(SHOBJLDFLAGS) $(LDFLAGS) $< $(filter %.o, $^) `cat $(<:.c=.lnk)`

.PHONY: clean distclean install-bin install mrproper install-local install-bin-local uninstall depend
clean:
	rm -f dact dact$(EXEEXT) libdact.$(SHOBJEXT) libdact.$(SHOBJEXT).def libdact.$(SHOBJEXT).a libdact.a core *~ $(ALGO:.c=.so) *.o

distclean: clean
	rm -f Makefile config.h config.status config.log config.cache

mrproper: distclean
	rm -rf Makefile.dep configure autom4te.cache/ config.h.in

install-bin: dact$(EXEEXT)
	-$(INSTALL) -d $(bindir)
	$(INSTALL) -m 755 dact$(EXEEXT) $(bindir)/dact$(EXEEXT)

install: all install-bin
	-$(INSTALL) -d $(mandir)/man1
	-$(INSTALL) -d $(libdir)
	-$(INSTALL) -d $(datadir)/dact
	-$(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

depend: Makefile.dep

Makefile.dep: *.c *.h Makefile
	@echo "building Makefile.dep"
	@$(CC) $(CFLAGS) $(CPPFLAGS) -MM $(ALGO) $(OBJS:.o=.c) $(MODS:.so=.c) dact.c > Makefile.dep
	@$(CC) $(CFLAGS) $(CPPFLAGS) -MM $(ALGO) $(filter-out libdact.c, $(OBJS:.o=.c)) $(MODS:.so=.c) dact.c  | sed -e "s/^\([^ ]*\)\.o: /\1.so: /g" >> Makefile.dep

include Makefile.dep
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































































































































































































Deleted aclocal.m4.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
AC_DEFUN(DC_PROG_GCC, [
  AC_SUBST(DEPEND)

  if test -n "$GCC"; then
    CFLAGS="$CFLAGS -Wall"
    DEPEND="Makefile.dep"
  fi
])

AC_DEFUN(DC_CHK_URANDOM, [
  if test "$cross_compiling" = "no"; then
    AC_MSG_CHECKING(to see if you have /dev/urandom)
    if test -r "/dev/urandom"; then
      AC_MSG_RESULT(yes)
      AC_DEFINE([HAVE_DEV_URANDOM], [], [Have random device?])
    else
      AC_MSG_RESULT(no)
    fi
  fi
])

AC_DEFUN(DC_CHK_MODULE, [
  AC_SUBST(ALGO)
  AC_SUBST(MODLIBS)

  AC_CHECK_LIB($1, main, [
    ALGO="$2 $ALGO"
    MODLIBS="-l$1 $MODLIBS"
    AC_DEFINE($3, [], [Something])
  ])
])

AC_DEFUN(DC_CHK_MODULE_VAR, [
  AC_SUBST(ALGO)
  AC_SUBST($4)

  AC_CHECK_LIB($1, main, [
    ALGO="$2 $ALGO"
    $4="-l$1 $(eval echo $(echo \$$4))"
    AC_DEFINE($3, [], [Also something])
  ])
])

AC_DEFUN(DC_DO_WIN32, [
  AC_CHECK_HEADERS(windows.h windowsx.h winsock2.h)
  AC_CHECK_LIB(wsock32, main, [
    AC_DEFINE(HAVE_LIBWSOCK32, [], [Have libwsock32])
      LIBS="${LIBS} -lwsock32"
  ])
])

AC_DEFUN(DC_DO_NETSET, [
  AC_SEARCH_LIBS(socket, socket nsl ws2_32 wsock32, AC_DEFINE(HAVE_SOCKET, [], [Have socket()]))
  AC_SEARCH_LIBS(gethostbyname, nsl ws2_32 wsock32, AC_DEFINE(HAVE_GETHOSTBYNAME, [], [Have gethostbyname()]))
  AC_SEARCH_LIBS(inet_aton, xnet ws2_32 wsock32, AC_DEFINE(HAVE_INET_ATON, [], [Have inet_aton()]), AC_SEARCH_LIBS(inet_addr, nsl ws2_32 wsock32, AC_DEFINE(HAVE_INET_ADDR, [], [Have inet_addr()])))
])


AC_DEFUN(DC_ASK_CHKVERS, [
  AC_ARG_ENABLE(chkvers, [  --disable-chkvers       Completely disable the ability to check for new versions], [
    case "$enableval" in
      no)
      ;;
      *)
  AC_DEFINE(CHECK_VERSION, [], [Check for new versions over the network?])
      ;;
    esac
  ], AC_DEFINE(CHECK_VERSION, [], [Check for new versions over the network?]))
])

AC_DEFUN(DC_ASK_DEBIAN, [
  AC_ARG_ENABLE(debianupgrade, [  --enable-debianupgrade  Use the Debian upgrade procedure instead of the DACT one], [
    case "$enableval" in
      no)
      ;;
      *)
  		AC_DEFINE(DACT_DEBIAN_UPGRADE_PROC, [], [Use the Debian upgrade procedure instead of DACTs internal one])
      ;;
    esac
  ])
])

AC_DEFUN(DC_ASK_NETWORK, [
  AC_ARG_ENABLE(network, [  --disable-network       Disable DACT's network activity completely], [
    case "$enableval" in
      no)
	AC_DEFINE(NO_NETWORK, [], [Disable all network support])
      ;;
      *)
	DC_DO_NETSET
      ;;
    esac
  ], DC_DO_NETSET )
])

AC_DEFUN(DC_DO_DEBUG, [
  ALGO="$ALGO \$(DEBUGALGO)"
  AC_DEFINE(DEBUG, [1], [Debug])
])

AC_DEFUN(DC_ASK_DEBUG, [
  AC_ARG_ENABLE(debug, [  --enable-debug          Enable developmental code], [
    if test "$enable_version" != "no"; then
      DC_DO_DEBUG
    fi
  ], [
    case "`uname -n`" in
      rkeene | unleaded | *.saurik.com )
	DC_DO_DEBUG
      ;;
    esac
  ])
])

AC_DEFUN(DC_NO_MODULE, [
  DEFAULT="static"
  MODS="# "
])

AC_DEFUN(DC_ASK_MODULE, [
  AC_SUBST(DEFAULT)
  AC_SUBST(MODS)
  AC_SUBST(NOMODS)

  DC_CHK_DLOPEN
  AC_MSG_CHECKING(to use modules)
  AC_ARG_ENABLE(modules, [  --disable-modules       Disable use of modules], [
    case "$enableval" in
      no)
	AC_MSG_RESULT(no)
	DC_NO_MODULE
      ;;
      *)
	if test "$HAVEDLOPEN" = yes; then
	  AC_MSG_RESULT(yes)
	  AC_DEFINE(USE_MODULES, [1], [Enable use of dynamically loadable modules?])
          NOMODS="#"
	  DEFAULT="module"
	else
	  AC_MSG_RESULT(can't)
	  DC_NO_MODULE
	fi
      ;;
    esac
  ], [
	if test "$HAVEDLOPEN" = yes; then
	  AC_MSG_RESULT(yes)
	  AC_DEFINE(USE_MODULES, [1], [Enable use of dynamically loadable modules?])
          NOMODS="#"
	  DEFAULT="module"
	else
	  AC_MSG_RESULT(can't)
	  DC_NO_MODULE
	fi
  ])
])

AC_DEFUN(DC_DO_TYPE, [
	if test -z "$ac_cv_sizeof_long"; then
		AC_C_INLINE
		AC_CHECK_SIZEOF(long long, 8)
		AC_CHECK_SIZEOF(long, 4)
		AC_CHECK_SIZEOF(int, 4)
		AC_CHECK_SIZEOF(short, 2)
	fi
	FOUND=0
	for dc_cv_loop in \$ac_cv_sizeof_long_long \$ac_cv_sizeof_int \$ac_cv_sizeof_long \$ac_cv_sizeof_short; do
		dc_cv_size=`eval echo $dc_cv_loop`
		dc_cv_name=`echo $dc_cv_loop | sed s/\\\$ac_cv_sizeof_//`
		if test "$dc_cv_size" = "$3"; then
			if test "$dc_cv_name" = "int"; then 
				AC_CHECK_TYPE($1, $2 int)
			fi
			if test "$dc_cv_name" = "long"; then
				AC_CHECK_TYPE($1, $2 long)
			fi
			if test "$dc_cv_name" = "long_long"; then
				AC_CHECK_TYPE($1, $2 long long)
			fi
			if test "$dc_cv_name" = "short"; then
				AC_CHECK_TYPE($1, $2 short)
			fi
			FOUND=1
			break
		fi
	done
])

AC_DEFUN(DC_CHK_DLOPEN, [
	AC_CHECK_FUNC(dlopen, [
		AC_DEFINE(HAVE_DLOPEN, [1], [Have dlopen()?])
		HAVEDLOPEN=yes
	])
	if test "$ac_cv_func_dlopen" = "no"; then
		AC_CHECK_LIB(dl, dlopen, [
			AC_DEFINE(HAVE_DLOPEN, [1], [Have dlopen()?])
			ALLMODLIBS=-ldl
			AC_SUBST(ALLMODLIBS)
			HAVEDLOPEN=yes
		])
	fi
])




dnl Usage:
dnl    DC_TEST_SHOBJFLAGS(shobjflags, shobjldflags, action-if-not-found)
dnl
AC_DEFUN(DC_TEST_SHOBJFLAGS, [
  AC_SUBST(SHOBJFLAGS)
  AC_SUBST(SHOBJLDFLAGS)

  OLD_LDFLAGS="$LDFLAGS"
  SHOBJFLAGS=""

  LDFLAGS="$OLD_LDFLAGS $1 $2"

  AC_TRY_LINK([#include <stdio.h>
int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="$1"; SHOBJLDFLAGS="$2" ], [
  LDFLAGS="$OLD_LDFLAGS"
  $3
])

  LDFLAGS="$OLD_LDFLAGS"
])

AC_DEFUN(DC_GET_SHOBJFLAGS, [
  AC_SUBST(SHOBJFLAGS)
  AC_SUBST(SHOBJLDFLAGS)

  AC_MSG_CHECKING(how to create shared objects)

  if test -z "$SHOBJFLAGS" -a -z "$SHOBJLDFLAGS"; then
    DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -rdynamic], [
      DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared], [
        DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -rdynamic -mimpure-text], [
          DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -mimpure-text], [
            DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -rdynamic -Wl,-G,-z,textoff], [
              DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -Wl,-G,-z,textoff], [
                DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -dynamiclib -flat_namespace -undefined suppress -bind_at_load], [
                  DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-dynamiclib -flat_namespace -undefined suppress -bind_at_load], [
                    DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-Wl,-dynamiclib -Wl,-flat_namespace -Wl,-undefined,suppress -Wl,-bind_at_load], [
                      DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-dynamiclib -flat_namespace -undefined suppress], [
                        DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-dynamiclib], [
                          AC_MSG_RESULT(cant)
                          AC_MSG_ERROR([We are unable to make shared objects.])
                        ])
                      ])
                    ])
                  ])
                ])
              ])
            ])
          ])
        ])
      ])
    ])
  fi

  AC_MSG_RESULT($SHOBJLDFLAGS $SHOBJFLAGS)

  DC_SYNC_SHLIBOBJS
])

AC_DEFUN(DC_SYNC_SHLIBOBJS, [
  AC_SUBST(SHLIBOBJS)
  SHLIBOBJS=""
  for obj in $LIB@&t@OBJS; do
    SHLIBOBJS="$SHLIBOBJS `echo $obj | sed 's/\.o$/_shr.o/g'`"
  done
])

AC_DEFUN(DC_CHK_OS_INFO, [
	AC_CANONICAL_HOST
	AC_SUBST(SHOBJEXT)
	AC_SUBST(SHOBJFLAGS)
	AC_SUBST(SHOBJLDFLAGS)
	AC_SUBST(CFLAGS)
	AC_SUBST(CPPFLAGS)
	AC_SUBST(AREXT)

	AC_MSG_CHECKING(host operating system)
	AC_MSG_RESULT($host_os)

	SHOBJEXT="so"
	AREXT="a"

	case $host_os in
		darwin*)
			SHOBJEXT="dylib"
			;;
		hpux*)
			SHOBJEXT="sl"
			;;
		mingw32|mingw32msvc*)
			SHOBJEXT="dll"
			SHOBJFLAGS="-DPIC"
			CFLAGS="$CFLAGS -mms-bitfields"
			CPPFLAGS="$CPPFLAGS -mms-bitfields"
			SHOBJLDFLAGS='-shared -Wl,--enable-auto-image-base -Wl,--output-def,$[@].def,--out-implib,$[@].a'
			;;
		cygwin*)
			SHOBJEXT="dll"
			SHOBJFLAGS="-fPIC -DPIC"
			CFLAGS="$CFLAGS -mms-bitfields"
			CPPFLAGS="$CPPFLAGS -mms-bitfields"
			SHOBJLDFLAGS='-shared -Wl,--enable-auto-image-base -Wl,--output-def,$[@].def,--out-implib,$[@].a'
			;;

	esac
])
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































































































































































































































































































































































































































































































































































Changes to build/makearch.info.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

# Space sperated list of documents, if they exist, they will be
# prefixed with the contents of the DOC_HDR file and substitution
# will occur:
#     @@UTIL@@ becomes the utility name ${UTIL}
#     @@VERS@@ becomes the utility version
#     @@DATE@@ becomes the current date
DOCS="AUTHORS README TODO INSTALL ChangeLog TODO.ideas Docs/config_help.txt Docs/dact.txt Docs/INSTALL"
DOC_HDR="HEADER"

# This script is executed immediately prior to creation of the
# tarball
AFTER=""
BEFORE="build/cleanup"

# Files matching these (space-seperated) patterns are deleted
TMPS="*.out bob joe sally f *.exe build work *.dct autom4te.cache HEADER"







|









13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

# Space sperated list of documents, if they exist, they will be
# prefixed with the contents of the DOC_HDR file and substitution
# will occur:
#     @@UTIL@@ becomes the utility name ${UTIL}
#     @@VERS@@ becomes the utility version
#     @@DATE@@ becomes the current date
DOCS="AUTHORS README Docs/TODO INSTALL ChangeLog Docs/TODO.ideas Docs/config_help.txt Docs/dact.txt Docs/INSTALL"
DOC_HDR="HEADER"

# This script is executed immediately prior to creation of the
# tarball
AFTER=""
BEFORE="build/cleanup"

# Files matching these (space-seperated) patterns are deleted
TMPS="*.out bob joe sally f *.exe build work *.dct autom4te.cache HEADER"

Deleted cipher_chaos.lnk.

Deleted cipher_psub.lnk.

Deleted cipher_serpent.lnk.

Deleted cipher_sub.lnk.

Deleted comp_bitsums.lnk.

Deleted comp_bzlib.lnk.

1
-lbz2
<


Deleted comp_delta.lnk.

Deleted comp_factor.lnk.

Deleted comp_lzoox.lnk.

1
-llzo
<


Deleted comp_lzooy.lnk.

1
-llzo
<


Deleted comp_lzota.lnk.

1
-llzo
<


Deleted comp_mzlib.lnk.

1
-lz
<


Deleted comp_mzlib2.lnk.

1
-lz
<


Deleted comp_rle.lnk.

Deleted comp_snibble.lnk.

Deleted comp_text.lnk.

Deleted comp_textrle.lnk.

Deleted comp_zlib.lnk.

1
-lz
<


Deleted config.guess.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
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
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
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
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
#! /bin/sh
# Attempt to guess a canonical system name.
#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
#   2000, 2001, 2002, 2003 Free Software Foundation, Inc.

timestamp='2004-03-12'

# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.

# Originally written by Per Bothner <per@bothner.com>.
# Please send patches to <config-patches@gnu.org>.  Submit a context
# diff and a properly formatted ChangeLog entry.
#
# This script attempts to guess a canonical system name similar to
# config.sub.  If it succeeds, it prints the system name on stdout, and
# exits with 0.  Otherwise, it exits with 1.
#
# The plan is that this can be called by configure scripts if you
# don't specify an explicit build system type.

me=`echo "$0" | sed -e 's,.*/,,'`

usage="\
Usage: $0 [OPTION]

Output the configuration name of the system \`$me' is run on.

Operation modes:
  -h, --help         print this help, then exit
  -t, --time-stamp   print date of last modification, then exit
  -v, --version      print version number, then exit

Report bugs and patches to <config-patches@gnu.org>."

version="\
GNU config.guess ($timestamp)

Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."

help="
Try \`$me --help' for more information."

# Parse command line
while test $# -gt 0 ; do
  case $1 in
    --time-stamp | --time* | -t )
       echo "$timestamp" ; exit 0 ;;
    --version | -v )
       echo "$version" ; exit 0 ;;
    --help | --h* | -h )
       echo "$usage"; exit 0 ;;
    -- )     # Stop option processing
       shift; break ;;
    - )	# Use stdin as input.
       break ;;
    -* )
       echo "$me: invalid option $1$help" >&2
       exit 1 ;;
    * )
       break ;;
  esac
done

if test $# != 0; then
  echo "$me: too many arguments$help" >&2
  exit 1
fi

trap 'exit 1' 1 2 15

# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
# compiler to aid in system detection is discouraged as it requires
# temporary files to be created and, as you can see below, it is a
# headache to deal with in a portable fashion.

# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
# use `HOST_CC' if defined, but it is deprecated.

# Portable tmp directory creation inspired by the Autoconf team.

set_cc_for_build='
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
: ${TMPDIR=/tmp} ;
 { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
 { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
 { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
 { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
dummy=$tmp/dummy ;
tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
case $CC_FOR_BUILD,$HOST_CC,$CC in
 ,,)    echo "int x;" > $dummy.c ;
	for c in cc gcc c89 c99 ; do
	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
	     CC_FOR_BUILD="$c"; break ;
	  fi ;
	done ;
	if test x"$CC_FOR_BUILD" = x ; then
	  CC_FOR_BUILD=no_compiler_found ;
	fi
	;;
 ,,*)   CC_FOR_BUILD=$CC ;;
 ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
esac ;'

# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 1994-08-24)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
	PATH=$PATH:/.attbin ; export PATH
fi

UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown

# Note: order is significant - the case branches are not exclusive.

case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
    *:NetBSD:*:*)
	# NetBSD (nbsd) targets should (where applicable) match one or
	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
	# switched to ELF, *-*-netbsd* would select the old
	# object file format.  This provides both forward
	# compatibility and a consistent mechanism for selecting the
	# object file format.
	#
	# Note: NetBSD doesn't particularly care about the vendor
	# portion of the name.  We always set it to "unknown".
	sysctl="sysctl -n hw.machine_arch"
	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
	case "${UNAME_MACHINE_ARCH}" in
	    armeb) machine=armeb-unknown ;;
	    arm*) machine=arm-unknown ;;
	    sh3el) machine=shl-unknown ;;
	    sh3eb) machine=sh-unknown ;;
	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
	esac
	# The Operating System including object format, if it has switched
	# to ELF recently, or will in the future.
	case "${UNAME_MACHINE_ARCH}" in
	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
		eval $set_cc_for_build
		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
			| grep __ELF__ >/dev/null
		then
		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
		    # Return netbsd for either.  FIX?
		    os=netbsd
		else
		    os=netbsdelf
		fi
		;;
	    *)
	        os=netbsd
		;;
	esac
	# The OS release
	# Debian GNU/NetBSD machines have a different userland, and
	# thus, need a distinct triplet. However, they do not need
	# kernel version information, so it can be replaced with a
	# suitable tag, in the style of linux-gnu.
	case "${UNAME_VERSION}" in
	    Debian*)
		release='-gnu'
		;;
	    *)
		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
		;;
	esac
	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
	# contains redundant information, the shorter form:
	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
	echo "${machine}-${os}${release}"
	exit 0 ;;
    amd64:OpenBSD:*:*)
	echo x86_64-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    amiga:OpenBSD:*:*)
	echo m68k-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    arc:OpenBSD:*:*)
	echo mipsel-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    cats:OpenBSD:*:*)
	echo arm-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    hp300:OpenBSD:*:*)
	echo m68k-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    mac68k:OpenBSD:*:*)
	echo m68k-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    macppc:OpenBSD:*:*)
	echo powerpc-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    mvme68k:OpenBSD:*:*)
	echo m68k-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    mvme88k:OpenBSD:*:*)
	echo m88k-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    mvmeppc:OpenBSD:*:*)
	echo powerpc-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    pegasos:OpenBSD:*:*)
	echo powerpc-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    pmax:OpenBSD:*:*)
	echo mipsel-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    sgi:OpenBSD:*:*)
	echo mipseb-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    sun3:OpenBSD:*:*)
	echo m68k-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    wgrisc:OpenBSD:*:*)
	echo mipsel-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    *:OpenBSD:*:*)
	echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
	exit 0 ;;
    *:ekkoBSD:*:*)
	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
	exit 0 ;;
    macppc:MirBSD:*:*)
	echo powerppc-unknown-mirbsd${UNAME_RELEASE}
	exit 0 ;;
    *:MirBSD:*:*)
	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
	exit 0 ;;
    alpha:OSF1:*:*)
	case $UNAME_RELEASE in
	*4.0)
		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
		;;
	*5.*)
	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
		;;
	esac
	# According to Compaq, /usr/sbin/psrinfo has been available on
	# OSF/1 and Tru64 systems produced since 1995.  I hope that
	# covers most systems running today.  This code pipes the CPU
	# types through head -n 1, so we only detect the type of CPU 0.
	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
	case "$ALPHA_CPU_TYPE" in
	    "EV4 (21064)")
		UNAME_MACHINE="alpha" ;;
	    "EV4.5 (21064)")
		UNAME_MACHINE="alpha" ;;
	    "LCA4 (21066/21068)")
		UNAME_MACHINE="alpha" ;;
	    "EV5 (21164)")
		UNAME_MACHINE="alphaev5" ;;
	    "EV5.6 (21164A)")
		UNAME_MACHINE="alphaev56" ;;
	    "EV5.6 (21164PC)")
		UNAME_MACHINE="alphapca56" ;;
	    "EV5.7 (21164PC)")
		UNAME_MACHINE="alphapca57" ;;
	    "EV6 (21264)")
		UNAME_MACHINE="alphaev6" ;;
	    "EV6.7 (21264A)")
		UNAME_MACHINE="alphaev67" ;;
	    "EV6.8CB (21264C)")
		UNAME_MACHINE="alphaev68" ;;
	    "EV6.8AL (21264B)")
		UNAME_MACHINE="alphaev68" ;;
	    "EV6.8CX (21264D)")
		UNAME_MACHINE="alphaev68" ;;
	    "EV6.9A (21264/EV69A)")
		UNAME_MACHINE="alphaev69" ;;
	    "EV7 (21364)")
		UNAME_MACHINE="alphaev7" ;;
	    "EV7.9 (21364A)")
		UNAME_MACHINE="alphaev79" ;;
	esac
	# A Pn.n version is a patched version.
	# A Vn.n version is a released version.
	# A Tn.n version is a released field test version.
	# A Xn.n version is an unreleased experimental baselevel.
	# 1.2 uses "1.2" for uname -r.
	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
	exit 0 ;;
    Alpha*:OpenVMS:*:*)
	echo alpha-hp-vms
	exit 0 ;;
    Alpha\ *:Windows_NT*:*)
	# How do we know it's Interix rather than the generic POSIX subsystem?
	# Should we change UNAME_MACHINE based on the output of uname instead
	# of the specific Alpha model?
	echo alpha-pc-interix
	exit 0 ;;
    21064:Windows_NT:50:3)
	echo alpha-dec-winnt3.5
	exit 0 ;;
    Amiga*:UNIX_System_V:4.0:*)
	echo m68k-unknown-sysv4
	exit 0;;
    *:[Aa]miga[Oo][Ss]:*:*)
	echo ${UNAME_MACHINE}-unknown-amigaos
	exit 0 ;;
    *:[Mm]orph[Oo][Ss]:*:*)
	echo ${UNAME_MACHINE}-unknown-morphos
	exit 0 ;;
    *:OS/390:*:*)
	echo i370-ibm-openedition
	exit 0 ;;
    *:OS400:*:*)
        echo powerpc-ibm-os400
	exit 0 ;;
    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
	echo arm-acorn-riscix${UNAME_RELEASE}
	exit 0;;
    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
	echo hppa1.1-hitachi-hiuxmpp
	exit 0;;
    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
	if test "`(/bin/universe) 2>/dev/null`" = att ; then
		echo pyramid-pyramid-sysv3
	else
		echo pyramid-pyramid-bsd
	fi
	exit 0 ;;
    NILE*:*:*:dcosx)
	echo pyramid-pyramid-svr4
	exit 0 ;;
    DRS?6000:unix:4.0:6*)
	echo sparc-icl-nx6
	exit 0 ;;
    DRS?6000:UNIX_SV:4.2*:7*)
	case `/usr/bin/uname -p` in
	    sparc) echo sparc-icl-nx7 && exit 0 ;;
	esac ;;
    sun4H:SunOS:5.*:*)
	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
	exit 0 ;;
    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
	exit 0 ;;
    i86pc:SunOS:5.*:*)
	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
	exit 0 ;;
    sun4*:SunOS:6*:*)
	# According to config.sub, this is the proper way to canonicalize
	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
	# it's likely to be more like Solaris than SunOS4.
	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
	exit 0 ;;
    sun4*:SunOS:*:*)
	case "`/usr/bin/arch -k`" in
	    Series*|S4*)
		UNAME_RELEASE=`uname -v`
		;;
	esac
	# Japanese Language versions have a version number like `4.1.3-JL'.
	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
	exit 0 ;;
    sun3*:SunOS:*:*)
	echo m68k-sun-sunos${UNAME_RELEASE}
	exit 0 ;;
    sun*:*:4.2BSD:*)
	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
	case "`/bin/arch`" in
	    sun3)
		echo m68k-sun-sunos${UNAME_RELEASE}
		;;
	    sun4)
		echo sparc-sun-sunos${UNAME_RELEASE}
		;;
	esac
	exit 0 ;;
    aushp:SunOS:*:*)
	echo sparc-auspex-sunos${UNAME_RELEASE}
	exit 0 ;;
    # The situation for MiNT is a little confusing.  The machine name
    # can be virtually everything (everything which is not
    # "atarist" or "atariste" at least should have a processor
    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
    # to the lowercase version "mint" (or "freemint").  Finally
    # the system name "TOS" denotes a system which is actually not
    # MiNT.  But MiNT is downward compatible to TOS, so this should
    # be no problem.
    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
        echo m68k-atari-mint${UNAME_RELEASE}
	exit 0 ;;
    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
	echo m68k-atari-mint${UNAME_RELEASE}
        exit 0 ;;
    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
        echo m68k-atari-mint${UNAME_RELEASE}
	exit 0 ;;
    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
        echo m68k-milan-mint${UNAME_RELEASE}
        exit 0 ;;
    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
        echo m68k-hades-mint${UNAME_RELEASE}
        exit 0 ;;
    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
        echo m68k-unknown-mint${UNAME_RELEASE}
        exit 0 ;;
    m68k:machten:*:*)
	echo m68k-apple-machten${UNAME_RELEASE}
	exit 0 ;;
    powerpc:machten:*:*)
	echo powerpc-apple-machten${UNAME_RELEASE}
	exit 0 ;;
    RISC*:Mach:*:*)
	echo mips-dec-mach_bsd4.3
	exit 0 ;;
    RISC*:ULTRIX:*:*)
	echo mips-dec-ultrix${UNAME_RELEASE}
	exit 0 ;;
    VAX*:ULTRIX*:*:*)
	echo vax-dec-ultrix${UNAME_RELEASE}
	exit 0 ;;
    2020:CLIX:*:* | 2430:CLIX:*:*)
	echo clipper-intergraph-clix${UNAME_RELEASE}
	exit 0 ;;
    mips:*:*:UMIPS | mips:*:*:RISCos)
	eval $set_cc_for_build
	sed 's/^	//' << EOF >$dummy.c
#ifdef __cplusplus
#include <stdio.h>  /* for printf() prototype */
	int main (int argc, char *argv[]) {
#else
	int main (argc, argv) int argc; char *argv[]; {
#endif
	#if defined (host_mips) && defined (MIPSEB)
	#if defined (SYSTYPE_SYSV)
	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
	#endif
	#if defined (SYSTYPE_SVR4)
	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
	#endif
	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
	#endif
	#endif
	  exit (-1);
	}
EOF
	$CC_FOR_BUILD -o $dummy $dummy.c \
	  && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
	  && exit 0
	echo mips-mips-riscos${UNAME_RELEASE}
	exit 0 ;;
    Motorola:PowerMAX_OS:*:*)
	echo powerpc-motorola-powermax
	exit 0 ;;
    Motorola:*:4.3:PL8-*)
	echo powerpc-harris-powermax
	exit 0 ;;
    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
	echo powerpc-harris-powermax
	exit 0 ;;
    Night_Hawk:Power_UNIX:*:*)
	echo powerpc-harris-powerunix
	exit 0 ;;
    m88k:CX/UX:7*:*)
	echo m88k-harris-cxux7
	exit 0 ;;
    m88k:*:4*:R4*)
	echo m88k-motorola-sysv4
	exit 0 ;;
    m88k:*:3*:R3*)
	echo m88k-motorola-sysv3
	exit 0 ;;
    AViiON:dgux:*:*)
        # DG/UX returns AViiON for all architectures
        UNAME_PROCESSOR=`/usr/bin/uname -p`
	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
	then
	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
	       [ ${TARGET_BINARY_INTERFACE}x = x ]
	    then
		echo m88k-dg-dgux${UNAME_RELEASE}
	    else
		echo m88k-dg-dguxbcs${UNAME_RELEASE}
	    fi
	else
	    echo i586-dg-dgux${UNAME_RELEASE}
	fi
 	exit 0 ;;
    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
	echo m88k-dolphin-sysv3
	exit 0 ;;
    M88*:*:R3*:*)
	# Delta 88k system running SVR3
	echo m88k-motorola-sysv3
	exit 0 ;;
    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
	echo m88k-tektronix-sysv3
	exit 0 ;;
    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
	echo m68k-tektronix-bsd
	exit 0 ;;
    *:IRIX*:*:*)
	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
	exit 0 ;;
    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
	echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
	exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
    i*86:AIX:*:*)
	echo i386-ibm-aix
	exit 0 ;;
    ia64:AIX:*:*)
	if [ -x /usr/bin/oslevel ] ; then
		IBM_REV=`/usr/bin/oslevel`
	else
		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
	fi
	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
	exit 0 ;;
    *:AIX:2:3)
	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
		eval $set_cc_for_build
		sed 's/^		//' << EOF >$dummy.c
		#include <sys/systemcfg.h>

		main()
			{
			if (!__power_pc())
				exit(1);
			puts("powerpc-ibm-aix3.2.5");
			exit(0);
			}
EOF
		$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
		echo rs6000-ibm-aix3.2.5
	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
		echo rs6000-ibm-aix3.2.4
	else
		echo rs6000-ibm-aix3.2
	fi
	exit 0 ;;
    *:AIX:*:[45])
	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
		IBM_ARCH=rs6000
	else
		IBM_ARCH=powerpc
	fi
	if [ -x /usr/bin/oslevel ] ; then
		IBM_REV=`/usr/bin/oslevel`
	else
		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
	fi
	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
	exit 0 ;;
    *:AIX:*:*)
	echo rs6000-ibm-aix
	exit 0 ;;
    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
	echo romp-ibm-bsd4.4
	exit 0 ;;
    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
	exit 0 ;;                           # report: romp-ibm BSD 4.3
    *:BOSX:*:*)
	echo rs6000-bull-bosx
	exit 0 ;;
    DPX/2?00:B.O.S.:*:*)
	echo m68k-bull-sysv3
	exit 0 ;;
    9000/[34]??:4.3bsd:1.*:*)
	echo m68k-hp-bsd
	exit 0 ;;
    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
	echo m68k-hp-bsd4.4
	exit 0 ;;
    9000/[34678]??:HP-UX:*:*)
	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
	case "${UNAME_MACHINE}" in
	    9000/31? )            HP_ARCH=m68000 ;;
	    9000/[34]?? )         HP_ARCH=m68k ;;
	    9000/[678][0-9][0-9])
		if [ -x /usr/bin/getconf ]; then
		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
                    case "${sc_cpu_version}" in
                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
                      532)                      # CPU_PA_RISC2_0
                        case "${sc_kernel_bits}" in
                          32) HP_ARCH="hppa2.0n" ;;
                          64) HP_ARCH="hppa2.0w" ;;
			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
                        esac ;;
                    esac
		fi
		if [ "${HP_ARCH}" = "" ]; then
		    eval $set_cc_for_build
		    sed 's/^              //' << EOF >$dummy.c

              #define _HPUX_SOURCE
              #include <stdlib.h>
              #include <unistd.h>

              int main ()
              {
              #if defined(_SC_KERNEL_BITS)
                  long bits = sysconf(_SC_KERNEL_BITS);
              #endif
                  long cpu  = sysconf (_SC_CPU_VERSION);

                  switch (cpu)
              	{
              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
              	case CPU_PA_RISC2_0:
              #if defined(_SC_KERNEL_BITS)
              	    switch (bits)
              		{
              		case 64: puts ("hppa2.0w"); break;
              		case 32: puts ("hppa2.0n"); break;
              		default: puts ("hppa2.0"); break;
              		} break;
              #else  /* !defined(_SC_KERNEL_BITS) */
              	    puts ("hppa2.0"); break;
              #endif
              	default: puts ("hppa1.0"); break;
              	}
                  exit (0);
              }
EOF
		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
		    test -z "$HP_ARCH" && HP_ARCH=hppa
		fi ;;
	esac
	if [ ${HP_ARCH} = "hppa2.0w" ]
	then
	    # avoid double evaluation of $set_cc_for_build
	    test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
	    then
		HP_ARCH="hppa2.0w"
	    else
		HP_ARCH="hppa64"
	    fi
	fi
	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
	exit 0 ;;
    ia64:HP-UX:*:*)
	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
	echo ia64-hp-hpux${HPUX_REV}
	exit 0 ;;
    3050*:HI-UX:*:*)
	eval $set_cc_for_build
	sed 's/^	//' << EOF >$dummy.c
	#include <unistd.h>
	int
	main ()
	{
	  long cpu = sysconf (_SC_CPU_VERSION);
	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
	     results, however.  */
	  if (CPU_IS_PA_RISC (cpu))
	    {
	      switch (cpu)
		{
		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
		  default: puts ("hppa-hitachi-hiuxwe2"); break;
		}
	    }
	  else if (CPU_IS_HP_MC68K (cpu))
	    puts ("m68k-hitachi-hiuxwe2");
	  else puts ("unknown-hitachi-hiuxwe2");
	  exit (0);
	}
EOF
	$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
	echo unknown-hitachi-hiuxwe2
	exit 0 ;;
    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
	echo hppa1.1-hp-bsd
	exit 0 ;;
    9000/8??:4.3bsd:*:*)
	echo hppa1.0-hp-bsd
	exit 0 ;;
    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
	echo hppa1.0-hp-mpeix
	exit 0 ;;
    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
	echo hppa1.1-hp-osf
	exit 0 ;;
    hp8??:OSF1:*:*)
	echo hppa1.0-hp-osf
	exit 0 ;;
    i*86:OSF1:*:*)
	if [ -x /usr/sbin/sysversion ] ; then
	    echo ${UNAME_MACHINE}-unknown-osf1mk
	else
	    echo ${UNAME_MACHINE}-unknown-osf1
	fi
	exit 0 ;;
    parisc*:Lites*:*:*)
	echo hppa1.1-hp-lites
	exit 0 ;;
    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
	echo c1-convex-bsd
        exit 0 ;;
    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
	if getsysinfo -f scalar_acc
	then echo c32-convex-bsd
	else echo c2-convex-bsd
	fi
        exit 0 ;;
    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
	echo c34-convex-bsd
        exit 0 ;;
    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
	echo c38-convex-bsd
        exit 0 ;;
    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
	echo c4-convex-bsd
        exit 0 ;;
    CRAY*Y-MP:*:*:*)
	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
	exit 0 ;;
    CRAY*[A-Z]90:*:*:*)
	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
	      -e 's/\.[^.]*$/.X/'
	exit 0 ;;
    CRAY*TS:*:*:*)
	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
	exit 0 ;;
    CRAY*T3E:*:*:*)
	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
	exit 0 ;;
    CRAY*SV1:*:*:*)
	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
	exit 0 ;;
    *:UNICOS/mp:*:*)
	echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
	exit 0 ;;
    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
        exit 0 ;;
    5000:UNIX_System_V:4.*:*)
        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
	exit 0 ;;
    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
	exit 0 ;;
    sparc*:BSD/OS:*:*)
	echo sparc-unknown-bsdi${UNAME_RELEASE}
	exit 0 ;;
    *:BSD/OS:*:*)
	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
	exit 0 ;;
    *:FreeBSD:*:*)
	# Determine whether the default compiler uses glibc.
	eval $set_cc_for_build
	sed 's/^	//' << EOF >$dummy.c
	#include <features.h>
	#if __GLIBC__ >= 2
	LIBC=gnu
	#else
	LIBC=
	#endif
EOF
	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
	# GNU/KFreeBSD systems have a "k" prefix to indicate we are using
	# FreeBSD's kernel, but not the complete OS.
	case ${LIBC} in gnu) kernel_only='k' ;; esac
	echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
	exit 0 ;;
    i*:CYGWIN*:*)
	echo ${UNAME_MACHINE}-pc-cygwin
	exit 0 ;;
    i*:MINGW*:*)
	echo ${UNAME_MACHINE}-pc-mingw32
	exit 0 ;;
    i*:PW*:*)
	echo ${UNAME_MACHINE}-pc-pw32
	exit 0 ;;
    x86:Interix*:[34]*)
	echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
	exit 0 ;;
    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
	echo i${UNAME_MACHINE}-pc-mks
	exit 0 ;;
    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
	# How do we know it's Interix rather than the generic POSIX subsystem?
	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
	# UNAME_MACHINE based on the output of uname instead of i386?
	echo i586-pc-interix
	exit 0 ;;
    i*:UWIN*:*)
	echo ${UNAME_MACHINE}-pc-uwin
	exit 0 ;;
    p*:CYGWIN*:*)
	echo powerpcle-unknown-cygwin
	exit 0 ;;
    prep*:SunOS:5.*:*)
	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
	exit 0 ;;
    *:GNU:*:*)
	# the GNU system
	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
	exit 0 ;;
    *:GNU/*:*:*)
	# other systems with GNU libc and userland
	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
	exit 0 ;;
    i*86:Minix:*:*)
	echo ${UNAME_MACHINE}-pc-minix
	exit 0 ;;
    arm*:Linux:*:*)
	echo ${UNAME_MACHINE}-unknown-linux-gnu
	exit 0 ;;
    cris:Linux:*:*)
	echo cris-axis-linux-gnu
	exit 0 ;;
    ia64:Linux:*:*)
	echo ${UNAME_MACHINE}-unknown-linux-gnu
	exit 0 ;;
    m32r*:Linux:*:*)
	echo ${UNAME_MACHINE}-unknown-linux-gnu
	exit 0 ;;
    m68*:Linux:*:*)
	echo ${UNAME_MACHINE}-unknown-linux-gnu
	exit 0 ;;
    mips:Linux:*:*)
	eval $set_cc_for_build
	sed 's/^	//' << EOF >$dummy.c
	#undef CPU
	#undef mips
	#undef mipsel
	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
	CPU=mipsel
	#else
	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
	CPU=mips
	#else
	CPU=
	#endif
	#endif
EOF
	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
	;;
    mips64:Linux:*:*)
	eval $set_cc_for_build
	sed 's/^	//' << EOF >$dummy.c
	#undef CPU
	#undef mips64
	#undef mips64el
	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
	CPU=mips64el
	#else
	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
	CPU=mips64
	#else
	CPU=
	#endif
	#endif
EOF
	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
	;;
    ppc:Linux:*:*)
	echo powerpc-unknown-linux-gnu
	exit 0 ;;
    ppc64:Linux:*:*)
	echo powerpc64-unknown-linux-gnu
	exit 0 ;;
    alpha:Linux:*:*)
	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
	  EV5)   UNAME_MACHINE=alphaev5 ;;
	  EV56)  UNAME_MACHINE=alphaev56 ;;
	  PCA56) UNAME_MACHINE=alphapca56 ;;
	  PCA57) UNAME_MACHINE=alphapca56 ;;
	  EV6)   UNAME_MACHINE=alphaev6 ;;
	  EV67)  UNAME_MACHINE=alphaev67 ;;
	  EV68*) UNAME_MACHINE=alphaev68 ;;
        esac
	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
	exit 0 ;;
    parisc:Linux:*:* | hppa:Linux:*:*)
	# Look for CPU level
	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
	  *)    echo hppa-unknown-linux-gnu ;;
	esac
	exit 0 ;;
    parisc64:Linux:*:* | hppa64:Linux:*:*)
	echo hppa64-unknown-linux-gnu
	exit 0 ;;
    s390:Linux:*:* | s390x:Linux:*:*)
	echo ${UNAME_MACHINE}-ibm-linux
	exit 0 ;;
    sh64*:Linux:*:*)
    	echo ${UNAME_MACHINE}-unknown-linux-gnu
	exit 0 ;;
    sh*:Linux:*:*)
	echo ${UNAME_MACHINE}-unknown-linux-gnu
	exit 0 ;;
    sparc:Linux:*:* | sparc64:Linux:*:*)
	echo ${UNAME_MACHINE}-unknown-linux-gnu
	exit 0 ;;
    x86_64:Linux:*:*)
	echo x86_64-unknown-linux-gnu
	exit 0 ;;
    i*86:Linux:*:*)
	# The BFD linker knows what the default object file format is, so
	# first see if it will tell us. cd to the root directory to prevent
	# problems with other programs or directories called `ld' in the path.
	# Set LC_ALL=C to ensure ld outputs messages in English.
	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
			 | sed -ne '/supported targets:/!d
				    s/[ 	][ 	]*/ /g
				    s/.*supported targets: *//
				    s/ .*//
				    p'`
        case "$ld_supported_targets" in
	  elf32-i386)
		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
		;;
	  a.out-i386-linux)
		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
		exit 0 ;;
	  coff-i386)
		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
		exit 0 ;;
	  "")
		# Either a pre-BFD a.out linker (linux-gnuoldld) or
		# one that does not give us useful --help.
		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
		exit 0 ;;
	esac
	# Determine whether the default compiler is a.out or elf
	eval $set_cc_for_build
	sed 's/^	//' << EOF >$dummy.c
	#include <features.h>
	#ifdef __ELF__
	# ifdef __GLIBC__
	#  if __GLIBC__ >= 2
	LIBC=gnu
	#  else
	LIBC=gnulibc1
	#  endif
	# else
	LIBC=gnulibc1
	# endif
	#else
	#ifdef __INTEL_COMPILER
	LIBC=gnu
	#else
	LIBC=gnuaout
	#endif
	#endif
	#ifdef __dietlibc__
	LIBC=dietlibc
	#endif
EOF
	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
	test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
	;;
    i*86:DYNIX/ptx:4*:*)
	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
	# earlier versions are messed up and put the nodename in both
	# sysname and nodename.
	echo i386-sequent-sysv4
	exit 0 ;;
    i*86:UNIX_SV:4.2MP:2.*)
        # Unixware is an offshoot of SVR4, but it has its own version
        # number series starting with 2...
        # I am not positive that other SVR4 systems won't match this,
	# I just have to hope.  -- rms.
        # Use sysv4.2uw... so that sysv4* matches it.
	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
	exit 0 ;;
    i*86:OS/2:*:*)
	# If we were able to find `uname', then EMX Unix compatibility
	# is probably installed.
	echo ${UNAME_MACHINE}-pc-os2-emx
	exit 0 ;;
    i*86:XTS-300:*:STOP)
	echo ${UNAME_MACHINE}-unknown-stop
	exit 0 ;;
    i*86:atheos:*:*)
	echo ${UNAME_MACHINE}-unknown-atheos
	exit 0 ;;
	i*86:syllable:*:*)
	echo ${UNAME_MACHINE}-pc-syllable
	exit 0 ;;
    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
	echo i386-unknown-lynxos${UNAME_RELEASE}
	exit 0 ;;
    i*86:*DOS:*:*)
	echo ${UNAME_MACHINE}-pc-msdosdjgpp
	exit 0 ;;
    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
	else
		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
	fi
	exit 0 ;;
    i*86:*:5:[78]*)
	case `/bin/uname -X | grep "^Machine"` in
	    *486*)	     UNAME_MACHINE=i486 ;;
	    *Pentium)	     UNAME_MACHINE=i586 ;;
	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
	esac
	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
	exit 0 ;;
    i*86:*:3.2:*)
	if test -f /usr/options/cb.name; then
		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
	elif /bin/uname -X 2>/dev/null >/dev/null ; then
		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
			&& UNAME_MACHINE=i586
		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
			&& UNAME_MACHINE=i686
		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
			&& UNAME_MACHINE=i686
		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
	else
		echo ${UNAME_MACHINE}-pc-sysv32
	fi
	exit 0 ;;
    pc:*:*:*)
	# Left here for compatibility:
        # uname -m prints for DJGPP always 'pc', but it prints nothing about
        # the processor, so we play safe by assuming i386.
	echo i386-pc-msdosdjgpp
        exit 0 ;;
    Intel:Mach:3*:*)
	echo i386-pc-mach3
	exit 0 ;;
    paragon:*:*:*)
	echo i860-intel-osf1
	exit 0 ;;
    i860:*:4.*:*) # i860-SVR4
	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
	else # Add other i860-SVR4 vendors below as they are discovered.
	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
	fi
	exit 0 ;;
    mini*:CTIX:SYS*5:*)
	# "miniframe"
	echo m68010-convergent-sysv
	exit 0 ;;
    mc68k:UNIX:SYSTEM5:3.51m)
	echo m68k-convergent-sysv
	exit 0 ;;
    M680?0:D-NIX:5.3:*)
	echo m68k-diab-dnix
	exit 0 ;;
    M68*:*:R3V[567]*:*)
	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0)
	OS_REL=''
	test -r /etc/.relid \
	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
	  && echo i486-ncr-sysv4.3${OS_REL} && exit 0
	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
	  && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
          && echo i486-ncr-sysv4 && exit 0 ;;
    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
	echo m68k-unknown-lynxos${UNAME_RELEASE}
	exit 0 ;;
    mc68030:UNIX_System_V:4.*:*)
	echo m68k-atari-sysv4
	exit 0 ;;
    TSUNAMI:LynxOS:2.*:*)
	echo sparc-unknown-lynxos${UNAME_RELEASE}
	exit 0 ;;
    rs6000:LynxOS:2.*:*)
	echo rs6000-unknown-lynxos${UNAME_RELEASE}
	exit 0 ;;
    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
	echo powerpc-unknown-lynxos${UNAME_RELEASE}
	exit 0 ;;
    SM[BE]S:UNIX_SV:*:*)
	echo mips-dde-sysv${UNAME_RELEASE}
	exit 0 ;;
    RM*:ReliantUNIX-*:*:*)
	echo mips-sni-sysv4
	exit 0 ;;
    RM*:SINIX-*:*:*)
	echo mips-sni-sysv4
	exit 0 ;;
    *:SINIX-*:*:*)
	if uname -p 2>/dev/null >/dev/null ; then
		UNAME_MACHINE=`(uname -p) 2>/dev/null`
		echo ${UNAME_MACHINE}-sni-sysv4
	else
		echo ns32k-sni-sysv
	fi
	exit 0 ;;
    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
                      # says <Richard.M.Bartel@ccMail.Census.GOV>
        echo i586-unisys-sysv4
        exit 0 ;;
    *:UNIX_System_V:4*:FTX*)
	# From Gerald Hewes <hewes@openmarket.com>.
	# How about differentiating between stratus architectures? -djm
	echo hppa1.1-stratus-sysv4
	exit 0 ;;
    *:*:*:FTX*)
	# From seanf@swdc.stratus.com.
	echo i860-stratus-sysv4
	exit 0 ;;
    *:VOS:*:*)
	# From Paul.Green@stratus.com.
	echo hppa1.1-stratus-vos
	exit 0 ;;
    mc68*:A/UX:*:*)
	echo m68k-apple-aux${UNAME_RELEASE}
	exit 0 ;;
    news*:NEWS-OS:6*:*)
	echo mips-sony-newsos6
	exit 0 ;;
    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
	if [ -d /usr/nec ]; then
	        echo mips-nec-sysv${UNAME_RELEASE}
	else
	        echo mips-unknown-sysv${UNAME_RELEASE}
	fi
        exit 0 ;;
    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
	echo powerpc-be-beos
	exit 0 ;;
    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
	echo powerpc-apple-beos
	exit 0 ;;
    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
	echo i586-pc-beos
	exit 0 ;;
    SX-4:SUPER-UX:*:*)
	echo sx4-nec-superux${UNAME_RELEASE}
	exit 0 ;;
    SX-5:SUPER-UX:*:*)
	echo sx5-nec-superux${UNAME_RELEASE}
	exit 0 ;;
    SX-6:SUPER-UX:*:*)
	echo sx6-nec-superux${UNAME_RELEASE}
	exit 0 ;;
    Power*:Rhapsody:*:*)
	echo powerpc-apple-rhapsody${UNAME_RELEASE}
	exit 0 ;;
    *:Rhapsody:*:*)
	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
	exit 0 ;;
    *:Darwin:*:*)
	case `uname -p` in
	    *86) UNAME_PROCESSOR=i686 ;;
	    powerpc) UNAME_PROCESSOR=powerpc ;;
	esac
	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
	exit 0 ;;
    *:procnto*:*:* | *:QNX:[0123456789]*:*)
	UNAME_PROCESSOR=`uname -p`
	if test "$UNAME_PROCESSOR" = "x86"; then
		UNAME_PROCESSOR=i386
		UNAME_MACHINE=pc
	fi
	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
	exit 0 ;;
    *:QNX:*:4*)
	echo i386-pc-qnx
	exit 0 ;;
    NSR-?:NONSTOP_KERNEL:*:*)
	echo nsr-tandem-nsk${UNAME_RELEASE}
	exit 0 ;;
    *:NonStop-UX:*:*)
	echo mips-compaq-nonstopux
	exit 0 ;;
    BS2000:POSIX*:*:*)
	echo bs2000-siemens-sysv
	exit 0 ;;
    DS/*:UNIX_System_V:*:*)
	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
	exit 0 ;;
    *:Plan9:*:*)
	# "uname -m" is not consistent, so use $cputype instead. 386
	# is converted to i386 for consistency with other x86
	# operating systems.
	if test "$cputype" = "386"; then
	    UNAME_MACHINE=i386
	else
	    UNAME_MACHINE="$cputype"
	fi
	echo ${UNAME_MACHINE}-unknown-plan9
	exit 0 ;;
    *:TOPS-10:*:*)
	echo pdp10-unknown-tops10
	exit 0 ;;
    *:TENEX:*:*)
	echo pdp10-unknown-tenex
	exit 0 ;;
    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
	echo pdp10-dec-tops20
	exit 0 ;;
    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
	echo pdp10-xkl-tops20
	exit 0 ;;
    *:TOPS-20:*:*)
	echo pdp10-unknown-tops20
	exit 0 ;;
    *:ITS:*:*)
	echo pdp10-unknown-its
	exit 0 ;;
    SEI:*:*:SEIUX)
        echo mips-sei-seiux${UNAME_RELEASE}
	exit 0 ;;
    *:DragonFly:*:*)
	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
	exit 0 ;;
esac

#echo '(No uname command or uname output not recognized.)' 1>&2
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2

eval $set_cc_for_build
cat >$dummy.c <<EOF
#ifdef _SEQUENT_
# include <sys/types.h>
# include <sys/utsname.h>
#endif
main ()
{
#if defined (sony)
#if defined (MIPSEB)
  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
     I don't know....  */
  printf ("mips-sony-bsd\n"); exit (0);
#else
#include <sys/param.h>
  printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
          "4"
#else
	  ""
#endif
         ); exit (0);
#endif
#endif

#if defined (__arm) && defined (__acorn) && defined (__unix)
  printf ("arm-acorn-riscix"); exit (0);
#endif

#if defined (hp300) && !defined (hpux)
  printf ("m68k-hp-bsd\n"); exit (0);
#endif

#if defined (NeXT)
#if !defined (__ARCHITECTURE__)
#define __ARCHITECTURE__ "m68k"
#endif
  int version;
  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
  if (version < 4)
    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
  else
    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
  exit (0);
#endif

#if defined (MULTIMAX) || defined (n16)
#if defined (UMAXV)
  printf ("ns32k-encore-sysv\n"); exit (0);
#else
#if defined (CMU)
  printf ("ns32k-encore-mach\n"); exit (0);
#else
  printf ("ns32k-encore-bsd\n"); exit (0);
#endif
#endif
#endif

#if defined (__386BSD__)
  printf ("i386-pc-bsd\n"); exit (0);
#endif

#if defined (sequent)
#if defined (i386)
  printf ("i386-sequent-dynix\n"); exit (0);
#endif
#if defined (ns32000)
  printf ("ns32k-sequent-dynix\n"); exit (0);
#endif
#endif

#if defined (_SEQUENT_)
    struct utsname un;

    uname(&un);

    if (strncmp(un.version, "V2", 2) == 0) {
	printf ("i386-sequent-ptx2\n"); exit (0);
    }
    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
	printf ("i386-sequent-ptx1\n"); exit (0);
    }
    printf ("i386-sequent-ptx\n"); exit (0);

#endif

#if defined (vax)
# if !defined (ultrix)
#  include <sys/param.h>
#  if defined (BSD)
#   if BSD == 43
      printf ("vax-dec-bsd4.3\n"); exit (0);
#   else
#    if BSD == 199006
      printf ("vax-dec-bsd4.3reno\n"); exit (0);
#    else
      printf ("vax-dec-bsd\n"); exit (0);
#    endif
#   endif
#  else
    printf ("vax-dec-bsd\n"); exit (0);
#  endif
# else
    printf ("vax-dec-ultrix\n"); exit (0);
# endif
#endif

#if defined (alliant) && defined (i860)
  printf ("i860-alliant-bsd\n"); exit (0);
#endif

  exit (1);
}
EOF

$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0

# Apollos put the system type in the environment.

test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }

# Convex versions that predate uname can use getsysinfo(1)

if [ -x /usr/convex/getsysinfo ]
then
    case `getsysinfo -f cpu_type` in
    c1*)
	echo c1-convex-bsd
	exit 0 ;;
    c2*)
	if getsysinfo -f scalar_acc
	then echo c32-convex-bsd
	else echo c2-convex-bsd
	fi
	exit 0 ;;
    c34*)
	echo c34-convex-bsd
	exit 0 ;;
    c38*)
	echo c38-convex-bsd
	exit 0 ;;
    c4*)
	echo c4-convex-bsd
	exit 0 ;;
    esac
fi

cat >&2 <<EOF
$0: unable to guess system type

This script, last modified $timestamp, has failed to recognize
the operating system you are using. It is advised that you
download the most up to date version of the config scripts from

    ftp://ftp.gnu.org/pub/gnu/config/

If the version you run ($0) is already up to date, please
send the following data and any information you think might be
pertinent to <config-patches@gnu.org> in order to provide the needed
information to handle your system.

config.guess timestamp = $timestamp

uname -m = `(uname -m) 2>/dev/null || echo unknown`
uname -r = `(uname -r) 2>/dev/null || echo unknown`
uname -s = `(uname -s) 2>/dev/null || echo unknown`
uname -v = `(uname -v) 2>/dev/null || echo unknown`

/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`

hostinfo               = `(hostinfo) 2>/dev/null`
/bin/universe          = `(/bin/universe) 2>/dev/null`
/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
/bin/arch              = `(/bin/arch) 2>/dev/null`
/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`

UNAME_MACHINE = ${UNAME_MACHINE}
UNAME_RELEASE = ${UNAME_RELEASE}
UNAME_SYSTEM  = ${UNAME_SYSTEM}
UNAME_VERSION = ${UNAME_VERSION}
EOF

exit 1

# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
# End:
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted config.h.in.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
/* config.h.in.  Generated from configure.in by autoheader.  */

/* Check for new versions over the network? */
#undef CHECK_VERSION

/* Use the Debian upgrade procedure instead of DACTs internal one */
#undef DACT_DEBIAN_UPGRADE_PROC

/* Debug */
#undef DEBUG

/* Define to 1 if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H

/* Have bzdopen() ? */
#undef HAVE_BZDOPEN

/* Define to 1 if you have the <bzlib.h> header file. */
#undef HAVE_BZLIB_H

/* Have more versatile compress2() ? */
#undef HAVE_COMPRESS2

/* Have random device? */
#undef HAVE_DEV_URANDOM

/* Define to 1 if you have the <dirent.h> header file. */
#undef HAVE_DIRENT_H

/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H

/* Have dlopen()? */
#undef HAVE_DLOPEN

/* Define to 1 if you have the <errno.h> header file. */
#undef HAVE_ERRNO_H

/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
#undef HAVE_FSEEKO

/* Have gethostbyname() */
#undef HAVE_GETHOSTBYNAME

/* Define to 1 if you have the `getopt' function. */
#undef HAVE_GETOPT

/* Define to 1 if you have the <getopt.h> header file. */
#undef HAVE_GETOPT_H

/* Define to 1 if you have the `getpass' function. */
#undef HAVE_GETPASS

/* Have gzdopen() ? */
#undef HAVE_GZDOPEN

/* Have inet_addr() */
#undef HAVE_INET_ADDR

/* Have inet_aton() */
#undef HAVE_INET_ATON

/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H

/* Something */
#undef HAVE_LIBBZ2

/* Also something */
#undef HAVE_LIBLZO

/* Something */
#undef HAVE_LIBMCRYPT

/* Have libwsock32 */
#undef HAVE_LIBWSOCK32

/* Something */
#undef HAVE_LIBZ

/* Define to 1 if you have the <lzo1x.h> header file. */
#undef HAVE_LZO1X_H

/* Define to 1 if you have the <lzo1y.h> header file. */
#undef HAVE_LZO1Y_H

/* Define to 1 if you have the <lzo2a.h> header file. */
#undef HAVE_LZO2A_H

/* Define to 1 if you have the <lzoconf.h> header file. */
#undef HAVE_LZOCONF_H

/* Define to 1 if you have the <mcrypt.h> header file. */
#undef HAVE_MCRYPT_H

/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H

/* Define to 1 if you have the `mkstemp' function. */
#undef HAVE_MKSTEMP

/* Define to 1 if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H

/* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H

/* Have BZ2_ prefixed to all bzip2 symbols? */
#undef HAVE_NEW_BZ2

/* Have BZ2_bzdopen() ? */
#undef HAVE_NEW_BZDOPEN

/* Do not have BZ2_ prefixed to all bzip2 symbols? */
#undef HAVE_OLD_BZ2

/* Have socket() */
#undef HAVE_SOCKET

/* Define to 1 if you have the <stdarg.h> header file. */
#undef HAVE_STDARG_H

/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H

/* Define to 1 if you have the <stdio.h> header file. */
#undef HAVE_STDIO_H

/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H

/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H

/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H

/* Define to 1 if you have the `strsep' function. */
#undef HAVE_STRSEP

/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H

/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H

/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H

/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H

/* Define to 1 if you have the <sys/utsname.h> header file. */
#undef HAVE_SYS_UTSNAME_H

/* Define to 1 if you have the <sys/wait.h> header file. */
#undef HAVE_SYS_WAIT_H

/* Define to 1 if you have the `uname' function. */
#undef HAVE_UNAME

/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H

/* Define to 1 if you have the <windowsx.h> header file. */
#undef HAVE_WINDOWSX_H

/* Define to 1 if you have the <windows.h> header file. */
#undef HAVE_WINDOWS_H

/* Define to 1 if you have the <winsock2.h> header file. */
#undef HAVE_WINSOCK2_H

/* Define to 1 if you have the <zlib.h> header file. */
#undef HAVE_ZLIB_H

/* Disable all network support */
#undef NO_NETWORK

/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT

/* Define to the full name of this package. */
#undef PACKAGE_NAME

/* Define to the full name and version of this package. */
#undef PACKAGE_STRING

/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME

/* Define to the version of this package. */
#undef PACKAGE_VERSION

/* The size of a `int', as computed by sizeof. */
#undef SIZEOF_INT

/* The size of a `long', as computed by sizeof. */
#undef SIZEOF_LONG

/* The size of a `long long', as computed by sizeof. */
#undef SIZEOF_LONG_LONG

/* The size of a `short', as computed by sizeof. */
#undef SIZEOF_SHORT

/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS

/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME

/* Enable use of dynamically loadable modules? */
#undef USE_MODULES

/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS

/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
#undef _LARGEFILE_SOURCE

/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES

/* Define to `__inline__' or `__inline' if that's what the C compiler
   calls it, or to nothing if 'inline' is not supported under any name.  */
#ifndef __cplusplus
#undef inline
#endif

/* Define to `signed short' if <sys/types.h> does not define. */
#undef int16_t

/* Define to `signed short' if <sys/types.h> does not define. */
#undef int32_t

/* Define to `signed short' if <sys/types.h> does not define. */
#undef int64_t

/* Define to `long' if <sys/types.h> does not define. */
#undef off_t

/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef uint

/* Define to `unsigned short' if <sys/types.h> does not define. */
#undef uint16_t

/* Define to `unsigned short' if <sys/types.h> does not define. */
#undef uint32_t

/* Define to `unsigned short' if <sys/types.h> does not define. */
#undef uint64_t
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































































































































































































































































































































































Deleted config.sub.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
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
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
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
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
#! /bin/sh
# Configuration validation subroutine script.
#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
#   2000, 2001, 2002, 2003 Free Software Foundation, Inc.

timestamp='2004-03-12'

# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
# can handle that machine.  It does not imply ALL GNU software can.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.

# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.

# Please send patches to <config-patches@gnu.org>.  Submit a context
# diff and a properly formatted ChangeLog entry.
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed.

# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software.
# Each package is responsible for reporting which valid configurations
# it does not support.  The user should be able to distinguish
# a failure to support a valid configuration from a meaningless
# configuration.

# The goal of this file is to map all the various variations of a given
# machine specification into a single specification in the form:
#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or in some cases, the newer four-part form:
#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# It is wrong to echo any other type of specification.

me=`echo "$0" | sed -e 's,.*/,,'`

usage="\
Usage: $0 [OPTION] CPU-MFR-OPSYS
       $0 [OPTION] ALIAS

Canonicalize a configuration name.

Operation modes:
  -h, --help         print this help, then exit
  -t, --time-stamp   print date of last modification, then exit
  -v, --version      print version number, then exit

Report bugs and patches to <config-patches@gnu.org>."

version="\
GNU config.sub ($timestamp)

Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."

help="
Try \`$me --help' for more information."

# Parse command line
while test $# -gt 0 ; do
  case $1 in
    --time-stamp | --time* | -t )
       echo "$timestamp" ; exit 0 ;;
    --version | -v )
       echo "$version" ; exit 0 ;;
    --help | --h* | -h )
       echo "$usage"; exit 0 ;;
    -- )     # Stop option processing
       shift; break ;;
    - )	# Use stdin as input.
       break ;;
    -* )
       echo "$me: invalid option $1$help"
       exit 1 ;;

    *local*)
       # First pass through any local machine types.
       echo $1
       exit 0;;

    * )
       break ;;
  esac
done

case $# in
 0) echo "$me: missing argument$help" >&2
    exit 1;;
 1) ;;
 *) echo "$me: too many arguments$help" >&2
    exit 1;;
esac

# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
  nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
  kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
    os=-$maybe_os
    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
    ;;
  *)
    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
    if [ $basic_machine != $1 ]
    then os=`echo $1 | sed 's/.*-/-/'`
    else os=; fi
    ;;
esac

### Let's recognize common machines as not being operating systems so
### that things like config.sub decstation-3100 work.  We also
### recognize some manufacturers as not being operating systems, so we
### can provide default operating systems below.
case $os in
	-sun*os*)
		# Prevent following clause from handling this invalid input.
		;;
	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
	-apple | -axis)
		os=
		basic_machine=$1
		;;
	-sim | -cisco | -oki | -wec | -winbond)
		os=
		basic_machine=$1
		;;
	-scout)
		;;
	-wrs)
		os=-vxworks
		basic_machine=$1
		;;
	-chorusos*)
		os=-chorusos
		basic_machine=$1
		;;
 	-chorusrdb)
 		os=-chorusrdb
		basic_machine=$1
 		;;
	-hiux*)
		os=-hiuxwe2
		;;
	-sco5)
		os=-sco3.2v5
		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
		;;
	-sco4)
		os=-sco3.2v4
		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
		;;
	-sco3.2.[4-9]*)
		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
		;;
	-sco3.2v[4-9]*)
		# Don't forget version if it is 3.2v4 or newer.
		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
		;;
	-sco*)
		os=-sco3.2v2
		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
		;;
	-udk*)
		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
		;;
	-isc)
		os=-isc2.2
		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
		;;
	-clix*)
		basic_machine=clipper-intergraph
		;;
	-isc*)
		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
		;;
	-lynx*)
		os=-lynxos
		;;
	-ptx*)
		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
		;;
	-windowsnt*)
		os=`echo $os | sed -e 's/windowsnt/winnt/'`
		;;
	-psos*)
		os=-psos
		;;
	-mint | -mint[0-9]*)
		basic_machine=m68k-atari
		os=-mint
		;;
esac

# Decode aliases for certain CPU-COMPANY combinations.
case $basic_machine in
	# Recognize the basic CPU types without company name.
	# Some are omitted here because they have special meanings below.
	1750a | 580 \
	| a29k \
	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
	| am33_2.0 \
	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
	| c4x | clipper \
	| d10v | d30v | dlx | dsp16xx \
	| fr30 | frv \
	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
	| i370 | i860 | i960 | ia64 \
	| ip2k | iq2000 \
	| m32r | m32rle | m68000 | m68k | m88k | mcore \
	| mips | mipsbe | mipseb | mipsel | mipsle \
	| mips16 \
	| mips64 | mips64el \
	| mips64vr | mips64vrel \
	| mips64orion | mips64orionel \
	| mips64vr4100 | mips64vr4100el \
	| mips64vr4300 | mips64vr4300el \
	| mips64vr5000 | mips64vr5000el \
	| mipsisa32 | mipsisa32el \
	| mipsisa32r2 | mipsisa32r2el \
	| mipsisa64 | mipsisa64el \
	| mipsisa64r2 | mipsisa64r2el \
	| mipsisa64sb1 | mipsisa64sb1el \
	| mipsisa64sr71k | mipsisa64sr71kel \
	| mipstx39 | mipstx39el \
	| mn10200 | mn10300 \
	| msp430 \
	| ns16k | ns32k \
	| openrisc | or32 \
	| pdp10 | pdp11 | pj | pjl \
	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
	| pyramid \
	| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
	| sh64 | sh64le \
	| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \
	| strongarm \
	| tahoe | thumb | tic4x | tic80 | tron \
	| v850 | v850e \
	| we32k \
	| x86 | xscale | xstormy16 | xtensa \
	| z8k)
		basic_machine=$basic_machine-unknown
		;;
	m6811 | m68hc11 | m6812 | m68hc12)
		# Motorola 68HC11/12.
		basic_machine=$basic_machine-unknown
		os=-none
		;;
	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
		;;

	# We use `pc' rather than `unknown'
	# because (1) that's what they normally are, and
	# (2) the word "unknown" tends to confuse beginning users.
	i*86 | x86_64)
	  basic_machine=$basic_machine-pc
	  ;;
	# Object if more than one company name word.
	*-*-*)
		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
		exit 1
		;;
	# Recognize the basic CPU types with company name.
	580-* \
	| a29k-* \
	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
	| avr-* \
	| bs2000-* \
	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
	| clipper-* | cydra-* \
	| d10v-* | d30v-* | dlx-* \
	| elxsi-* \
	| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
	| h8300-* | h8500-* \
	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
	| i*86-* | i860-* | i960-* | ia64-* \
	| ip2k-* | iq2000-* \
	| m32r-* | m32rle-* \
	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
	| m88110-* | m88k-* | mcore-* \
	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
	| mips16-* \
	| mips64-* | mips64el-* \
	| mips64vr-* | mips64vrel-* \
	| mips64orion-* | mips64orionel-* \
	| mips64vr4100-* | mips64vr4100el-* \
	| mips64vr4300-* | mips64vr4300el-* \
	| mips64vr5000-* | mips64vr5000el-* \
	| mipsisa32-* | mipsisa32el-* \
	| mipsisa32r2-* | mipsisa32r2el-* \
	| mipsisa64-* | mipsisa64el-* \
	| mipsisa64r2-* | mipsisa64r2el-* \
	| mipsisa64sb1-* | mipsisa64sb1el-* \
	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
	| mipstx39-* | mipstx39el-* \
	| msp430-* \
	| none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
	| orion-* \
	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
	| pyramid-* \
	| romp-* | rs6000-* \
	| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
	| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
	| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
	| tahoe-* | thumb-* \
	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
	| tron-* \
	| v850-* | v850e-* | vax-* \
	| we32k-* \
	| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
	| xtensa-* \
	| ymp-* \
	| z8k-*)
		;;
	# Recognize the various machine names and aliases which stand
	# for a CPU type and a company and sometimes even an OS.
	386bsd)
		basic_machine=i386-unknown
		os=-bsd
		;;
	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
		basic_machine=m68000-att
		;;
	3b*)
		basic_machine=we32k-att
		;;
	a29khif)
		basic_machine=a29k-amd
		os=-udi
		;;
    	abacus)
		basic_machine=abacus-unknown
		;;
	adobe68k)
		basic_machine=m68010-adobe
		os=-scout
		;;
	alliant | fx80)
		basic_machine=fx80-alliant
		;;
	altos | altos3068)
		basic_machine=m68k-altos
		;;
	am29k)
		basic_machine=a29k-none
		os=-bsd
		;;
	amd64)
		basic_machine=x86_64-pc
		;;
	amd64-*)
		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
		;;
	amdahl)
		basic_machine=580-amdahl
		os=-sysv
		;;
	amiga | amiga-*)
		basic_machine=m68k-unknown
		;;
	amigaos | amigados)
		basic_machine=m68k-unknown
		os=-amigaos
		;;
	amigaunix | amix)
		basic_machine=m68k-unknown
		os=-sysv4
		;;
	apollo68)
		basic_machine=m68k-apollo
		os=-sysv
		;;
	apollo68bsd)
		basic_machine=m68k-apollo
		os=-bsd
		;;
	aux)
		basic_machine=m68k-apple
		os=-aux
		;;
	balance)
		basic_machine=ns32k-sequent
		os=-dynix
		;;
	c90)
		basic_machine=c90-cray
		os=-unicos
		;;
	convex-c1)
		basic_machine=c1-convex
		os=-bsd
		;;
	convex-c2)
		basic_machine=c2-convex
		os=-bsd
		;;
	convex-c32)
		basic_machine=c32-convex
		os=-bsd
		;;
	convex-c34)
		basic_machine=c34-convex
		os=-bsd
		;;
	convex-c38)
		basic_machine=c38-convex
		os=-bsd
		;;
	cray | j90)
		basic_machine=j90-cray
		os=-unicos
		;;
	cr16c)
		basic_machine=cr16c-unknown
		os=-elf
		;;
	crds | unos)
		basic_machine=m68k-crds
		;;
	cris | cris-* | etrax*)
		basic_machine=cris-axis
		;;
	crx)
		basic_machine=crx-unknown
		os=-elf
		;;
	da30 | da30-*)
		basic_machine=m68k-da30
		;;
	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
		basic_machine=mips-dec
		;;
	decsystem10* | dec10*)
		basic_machine=pdp10-dec
		os=-tops10
		;;
	decsystem20* | dec20*)
		basic_machine=pdp10-dec
		os=-tops20
		;;
	delta | 3300 | motorola-3300 | motorola-delta \
	      | 3300-motorola | delta-motorola)
		basic_machine=m68k-motorola
		;;
	delta88)
		basic_machine=m88k-motorola
		os=-sysv3
		;;
	dpx20 | dpx20-*)
		basic_machine=rs6000-bull
		os=-bosx
		;;
	dpx2* | dpx2*-bull)
		basic_machine=m68k-bull
		os=-sysv3
		;;
	ebmon29k)
		basic_machine=a29k-amd
		os=-ebmon
		;;
	elxsi)
		basic_machine=elxsi-elxsi
		os=-bsd
		;;
	encore | umax | mmax)
		basic_machine=ns32k-encore
		;;
	es1800 | OSE68k | ose68k | ose | OSE)
		basic_machine=m68k-ericsson
		os=-ose
		;;
	fx2800)
		basic_machine=i860-alliant
		;;
	genix)
		basic_machine=ns32k-ns
		;;
	gmicro)
		basic_machine=tron-gmicro
		os=-sysv
		;;
	go32)
		basic_machine=i386-pc
		os=-go32
		;;
	h3050r* | hiux*)
		basic_machine=hppa1.1-hitachi
		os=-hiuxwe2
		;;
	h8300hms)
		basic_machine=h8300-hitachi
		os=-hms
		;;
	h8300xray)
		basic_machine=h8300-hitachi
		os=-xray
		;;
	h8500hms)
		basic_machine=h8500-hitachi
		os=-hms
		;;
	harris)
		basic_machine=m88k-harris
		os=-sysv3
		;;
	hp300-*)
		basic_machine=m68k-hp
		;;
	hp300bsd)
		basic_machine=m68k-hp
		os=-bsd
		;;
	hp300hpux)
		basic_machine=m68k-hp
		os=-hpux
		;;
	hp3k9[0-9][0-9] | hp9[0-9][0-9])
		basic_machine=hppa1.0-hp
		;;
	hp9k2[0-9][0-9] | hp9k31[0-9])
		basic_machine=m68000-hp
		;;
	hp9k3[2-9][0-9])
		basic_machine=m68k-hp
		;;
	hp9k6[0-9][0-9] | hp6[0-9][0-9])
		basic_machine=hppa1.0-hp
		;;
	hp9k7[0-79][0-9] | hp7[0-79][0-9])
		basic_machine=hppa1.1-hp
		;;
	hp9k78[0-9] | hp78[0-9])
		# FIXME: really hppa2.0-hp
		basic_machine=hppa1.1-hp
		;;
	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
		# FIXME: really hppa2.0-hp
		basic_machine=hppa1.1-hp
		;;
	hp9k8[0-9][13679] | hp8[0-9][13679])
		basic_machine=hppa1.1-hp
		;;
	hp9k8[0-9][0-9] | hp8[0-9][0-9])
		basic_machine=hppa1.0-hp
		;;
	hppa-next)
		os=-nextstep3
		;;
	hppaosf)
		basic_machine=hppa1.1-hp
		os=-osf
		;;
	hppro)
		basic_machine=hppa1.1-hp
		os=-proelf
		;;
	i370-ibm* | ibm*)
		basic_machine=i370-ibm
		;;
# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
	i*86v32)
		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
		os=-sysv32
		;;
	i*86v4*)
		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
		os=-sysv4
		;;
	i*86v)
		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
		os=-sysv
		;;
	i*86sol2)
		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
		os=-solaris2
		;;
	i386mach)
		basic_machine=i386-mach
		os=-mach
		;;
	i386-vsta | vsta)
		basic_machine=i386-unknown
		os=-vsta
		;;
	iris | iris4d)
		basic_machine=mips-sgi
		case $os in
		    -irix*)
			;;
		    *)
			os=-irix4
			;;
		esac
		;;
	isi68 | isi)
		basic_machine=m68k-isi
		os=-sysv
		;;
	m88k-omron*)
		basic_machine=m88k-omron
		;;
	magnum | m3230)
		basic_machine=mips-mips
		os=-sysv
		;;
	merlin)
		basic_machine=ns32k-utek
		os=-sysv
		;;
	mingw32)
		basic_machine=i386-pc
		os=-mingw32
		;;
	miniframe)
		basic_machine=m68000-convergent
		;;
	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
		basic_machine=m68k-atari
		os=-mint
		;;
	mips3*-*)
		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
		;;
	mips3*)
		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
		;;
	mmix*)
		basic_machine=mmix-knuth
		os=-mmixware
		;;
	monitor)
		basic_machine=m68k-rom68k
		os=-coff
		;;
	morphos)
		basic_machine=powerpc-unknown
		os=-morphos
		;;
	msdos)
		basic_machine=i386-pc
		os=-msdos
		;;
	mvs)
		basic_machine=i370-ibm
		os=-mvs
		;;
	ncr3000)
		basic_machine=i486-ncr
		os=-sysv4
		;;
	netbsd386)
		basic_machine=i386-unknown
		os=-netbsd
		;;
	netwinder)
		basic_machine=armv4l-rebel
		os=-linux
		;;
	news | news700 | news800 | news900)
		basic_machine=m68k-sony
		os=-newsos
		;;
	news1000)
		basic_machine=m68030-sony
		os=-newsos
		;;
	news-3600 | risc-news)
		basic_machine=mips-sony
		os=-newsos
		;;
	necv70)
		basic_machine=v70-nec
		os=-sysv
		;;
	next | m*-next )
		basic_machine=m68k-next
		case $os in
		    -nextstep* )
			;;
		    -ns2*)
		      os=-nextstep2
			;;
		    *)
		      os=-nextstep3
			;;
		esac
		;;
	nh3000)
		basic_machine=m68k-harris
		os=-cxux
		;;
	nh[45]000)
		basic_machine=m88k-harris
		os=-cxux
		;;
	nindy960)
		basic_machine=i960-intel
		os=-nindy
		;;
	mon960)
		basic_machine=i960-intel
		os=-mon960
		;;
	nonstopux)
		basic_machine=mips-compaq
		os=-nonstopux
		;;
	np1)
		basic_machine=np1-gould
		;;
	nv1)
		basic_machine=nv1-cray
		os=-unicosmp
		;;
	nsr-tandem)
		basic_machine=nsr-tandem
		;;
	op50n-* | op60c-*)
		basic_machine=hppa1.1-oki
		os=-proelf
		;;
	or32 | or32-*)
		basic_machine=or32-unknown
		os=-coff
		;;
	os400)
		basic_machine=powerpc-ibm
		os=-os400
		;;
	OSE68000 | ose68000)
		basic_machine=m68000-ericsson
		os=-ose
		;;
	os68k)
		basic_machine=m68k-none
		os=-os68k
		;;
	pa-hitachi)
		basic_machine=hppa1.1-hitachi
		os=-hiuxwe2
		;;
	paragon)
		basic_machine=i860-intel
		os=-osf
		;;
	pbd)
		basic_machine=sparc-tti
		;;
	pbb)
		basic_machine=m68k-tti
		;;
	pc532 | pc532-*)
		basic_machine=ns32k-pc532
		;;
	pentium | p5 | k5 | k6 | nexgen | viac3)
		basic_machine=i586-pc
		;;
	pentiumpro | p6 | 6x86 | athlon | athlon_*)
		basic_machine=i686-pc
		;;
	pentiumii | pentium2 | pentiumiii | pentium3)
		basic_machine=i686-pc
		;;
	pentium4)
		basic_machine=i786-pc
		;;
	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
		;;
	pentiumpro-* | p6-* | 6x86-* | athlon-*)
		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
		;;
	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
		;;
	pentium4-*)
		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
		;;
	pn)
		basic_machine=pn-gould
		;;
	power)	basic_machine=power-ibm
		;;
	ppc)	basic_machine=powerpc-unknown
		;;
	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
		;;
	ppcle | powerpclittle | ppc-le | powerpc-little)
		basic_machine=powerpcle-unknown
		;;
	ppcle-* | powerpclittle-*)
		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
		;;
	ppc64)	basic_machine=powerpc64-unknown
		;;
	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
		;;
	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
		basic_machine=powerpc64le-unknown
		;;
	ppc64le-* | powerpc64little-*)
		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
		;;
	ps2)
		basic_machine=i386-ibm
		;;
	pw32)
		basic_machine=i586-unknown
		os=-pw32
		;;
	rom68k)
		basic_machine=m68k-rom68k
		os=-coff
		;;
	rm[46]00)
		basic_machine=mips-siemens
		;;
	rtpc | rtpc-*)
		basic_machine=romp-ibm
		;;
	s390 | s390-*)
		basic_machine=s390-ibm
		;;
	s390x | s390x-*)
		basic_machine=s390x-ibm
		;;
	sa29200)
		basic_machine=a29k-amd
		os=-udi
		;;
	sb1)
		basic_machine=mipsisa64sb1-unknown
		;;
	sb1el)
		basic_machine=mipsisa64sb1el-unknown
		;;
	sei)
		basic_machine=mips-sei
		os=-seiux
		;;
	sequent)
		basic_machine=i386-sequent
		;;
	sh)
		basic_machine=sh-hitachi
		os=-hms
		;;
	sh64)
		basic_machine=sh64-unknown
		;;
	sparclite-wrs | simso-wrs)
		basic_machine=sparclite-wrs
		os=-vxworks
		;;
	sps7)
		basic_machine=m68k-bull
		os=-sysv2
		;;
	spur)
		basic_machine=spur-unknown
		;;
	st2000)
		basic_machine=m68k-tandem
		;;
	stratus)
		basic_machine=i860-stratus
		os=-sysv4
		;;
	sun2)
		basic_machine=m68000-sun
		;;
	sun2os3)
		basic_machine=m68000-sun
		os=-sunos3
		;;
	sun2os4)
		basic_machine=m68000-sun
		os=-sunos4
		;;
	sun3os3)
		basic_machine=m68k-sun
		os=-sunos3
		;;
	sun3os4)
		basic_machine=m68k-sun
		os=-sunos4
		;;
	sun4os3)
		basic_machine=sparc-sun
		os=-sunos3
		;;
	sun4os4)
		basic_machine=sparc-sun
		os=-sunos4
		;;
	sun4sol2)
		basic_machine=sparc-sun
		os=-solaris2
		;;
	sun3 | sun3-*)
		basic_machine=m68k-sun
		;;
	sun4)
		basic_machine=sparc-sun
		;;
	sun386 | sun386i | roadrunner)
		basic_machine=i386-sun
		;;
	sv1)
		basic_machine=sv1-cray
		os=-unicos
		;;
	symmetry)
		basic_machine=i386-sequent
		os=-dynix
		;;
	t3e)
		basic_machine=alphaev5-cray
		os=-unicos
		;;
	t90)
		basic_machine=t90-cray
		os=-unicos
		;;
	tic54x | c54x*)
		basic_machine=tic54x-unknown
		os=-coff
		;;
	tic55x | c55x*)
		basic_machine=tic55x-unknown
		os=-coff
		;;
	tic6x | c6x*)
		basic_machine=tic6x-unknown
		os=-coff
		;;
	tx39)
		basic_machine=mipstx39-unknown
		;;
	tx39el)
		basic_machine=mipstx39el-unknown
		;;
	toad1)
		basic_machine=pdp10-xkl
		os=-tops20
		;;
	tower | tower-32)
		basic_machine=m68k-ncr
		;;
	tpf)
		basic_machine=s390x-ibm
		os=-tpf
		;;
	udi29k)
		basic_machine=a29k-amd
		os=-udi
		;;
	ultra3)
		basic_machine=a29k-nyu
		os=-sym1
		;;
	v810 | necv810)
		basic_machine=v810-nec
		os=-none
		;;
	vaxv)
		basic_machine=vax-dec
		os=-sysv
		;;
	vms)
		basic_machine=vax-dec
		os=-vms
		;;
	vpp*|vx|vx-*)
		basic_machine=f301-fujitsu
		;;
	vxworks960)
		basic_machine=i960-wrs
		os=-vxworks
		;;
	vxworks68)
		basic_machine=m68k-wrs
		os=-vxworks
		;;
	vxworks29k)
		basic_machine=a29k-wrs
		os=-vxworks
		;;
	w65*)
		basic_machine=w65-wdc
		os=-none
		;;
	w89k-*)
		basic_machine=hppa1.1-winbond
		os=-proelf
		;;
	xps | xps100)
		basic_machine=xps100-honeywell
		;;
	ymp)
		basic_machine=ymp-cray
		os=-unicos
		;;
	z8k-*-coff)
		basic_machine=z8k-unknown
		os=-sim
		;;
	none)
		basic_machine=none-none
		os=-none
		;;

# Here we handle the default manufacturer of certain CPU types.  It is in
# some cases the only manufacturer, in others, it is the most popular.
	w89k)
		basic_machine=hppa1.1-winbond
		;;
	op50n)
		basic_machine=hppa1.1-oki
		;;
	op60c)
		basic_machine=hppa1.1-oki
		;;
	romp)
		basic_machine=romp-ibm
		;;
	rs6000)
		basic_machine=rs6000-ibm
		;;
	vax)
		basic_machine=vax-dec
		;;
	pdp10)
		# there are many clones, so DEC is not a safe bet
		basic_machine=pdp10-unknown
		;;
	pdp11)
		basic_machine=pdp11-dec
		;;
	we32k)
		basic_machine=we32k-att
		;;
	sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
		basic_machine=sh-unknown
		;;
	sh64)
		basic_machine=sh64-unknown
		;;
	sparc | sparcv8 | sparcv9 | sparcv9b)
		basic_machine=sparc-sun
		;;
	cydra)
		basic_machine=cydra-cydrome
		;;
	orion)
		basic_machine=orion-highlevel
		;;
	orion105)
		basic_machine=clipper-highlevel
		;;
	mac | mpw | mac-mpw)
		basic_machine=m68k-apple
		;;
	pmac | pmac-mpw)
		basic_machine=powerpc-apple
		;;
	*-unknown)
		# Make sure to match an already-canonicalized machine name.
		;;
	*)
		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
		exit 1
		;;
esac

# Here we canonicalize certain aliases for manufacturers.
case $basic_machine in
	*-digital*)
		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
		;;
	*-commodore*)
		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
		;;
	*)
		;;
esac

# Decode manufacturer-specific aliases for certain operating systems.

if [ x"$os" != x"" ]
then
case $os in
        # First match some system type aliases
        # that might get confused with valid system types.
	# -solaris* is a basic system type, with this one exception.
	-solaris1 | -solaris1.*)
		os=`echo $os | sed -e 's|solaris1|sunos4|'`
		;;
	-solaris)
		os=-solaris2
		;;
	-svr4*)
		os=-sysv4
		;;
	-unixware*)
		os=-sysv4.2uw
		;;
	-gnu/linux*)
		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
		;;
	# First accept the basic system types.
	# The portable systems comes first.
	# Each alternative MUST END IN A *, to match a version number.
	# -sysv* is not here because it comes later, after sysvr4.
	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
	      | -aos* \
	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
	      | -chorusos* | -chorusrdb* \
	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
	      | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*)
	# Remember, each alternative MUST END IN *, to match a version number.
		;;
	-qnx*)
		case $basic_machine in
		    x86-* | i*86-*)
			;;
		    *)
			os=-nto$os
			;;
		esac
		;;
	-nto-qnx*)
		;;
	-nto*)
		os=`echo $os | sed -e 's|nto|nto-qnx|'`
		;;
	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
		;;
	-mac*)
		os=`echo $os | sed -e 's|mac|macos|'`
		;;
	-linux-dietlibc)
		os=-linux-dietlibc
		;;
	-linux*)
		os=`echo $os | sed -e 's|linux|linux-gnu|'`
		;;
	-sunos5*)
		os=`echo $os | sed -e 's|sunos5|solaris2|'`
		;;
	-sunos6*)
		os=`echo $os | sed -e 's|sunos6|solaris3|'`
		;;
	-opened*)
		os=-openedition
		;;
        -os400*)
		os=-os400
		;;
	-wince*)
		os=-wince
		;;
	-osfrose*)
		os=-osfrose
		;;
	-osf*)
		os=-osf
		;;
	-utek*)
		os=-bsd
		;;
	-dynix*)
		os=-bsd
		;;
	-acis*)
		os=-aos
		;;
	-atheos*)
		os=-atheos
		;;
	-syllable*)
		os=-syllable
		;;
	-386bsd)
		os=-bsd
		;;
	-ctix* | -uts*)
		os=-sysv
		;;
	-nova*)
		os=-rtmk-nova
		;;
	-ns2 )
		os=-nextstep2
		;;
	-nsk*)
		os=-nsk
		;;
	# Preserve the version number of sinix5.
	-sinix5.*)
		os=`echo $os | sed -e 's|sinix|sysv|'`
		;;
	-sinix*)
		os=-sysv4
		;;
        -tpf*)
		os=-tpf
		;;
	-triton*)
		os=-sysv3
		;;
	-oss*)
		os=-sysv3
		;;
	-svr4)
		os=-sysv4
		;;
	-svr3)
		os=-sysv3
		;;
	-sysvr4)
		os=-sysv4
		;;
	# This must come after -sysvr4.
	-sysv*)
		;;
	-ose*)
		os=-ose
		;;
	-es1800*)
		os=-ose
		;;
	-xenix)
		os=-xenix
		;;
	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
		os=-mint
		;;
	-aros*)
		os=-aros
		;;
	-kaos*)
		os=-kaos
		;;
	-none)
		;;
	*)
		# Get rid of the `-' at the beginning of $os.
		os=`echo $os | sed 's/[^-]*-//'`
		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
		exit 1
		;;
esac
else

# Here we handle the default operating systems that come with various machines.
# The value should be what the vendor currently ships out the door with their
# machine or put another way, the most popular os provided with the machine.

# Note that if you're going to try to match "-MANUFACTURER" here (say,
# "-sun"), then you have to tell the case statement up towards the top
# that MANUFACTURER isn't an operating system.  Otherwise, code above
# will signal an error saying that MANUFACTURER isn't an operating
# system, and we'll never get to this point.

case $basic_machine in
	*-acorn)
		os=-riscix1.2
		;;
	arm*-rebel)
		os=-linux
		;;
	arm*-semi)
		os=-aout
		;;
    c4x-* | tic4x-*)
        os=-coff
        ;;
	# This must come before the *-dec entry.
	pdp10-*)
		os=-tops20
		;;
	pdp11-*)
		os=-none
		;;
	*-dec | vax-*)
		os=-ultrix4.2
		;;
	m68*-apollo)
		os=-domain
		;;
	i386-sun)
		os=-sunos4.0.2
		;;
	m68000-sun)
		os=-sunos3
		# This also exists in the configure program, but was not the
		# default.
		# os=-sunos4
		;;
	m68*-cisco)
		os=-aout
		;;
	mips*-cisco)
		os=-elf
		;;
	mips*-*)
		os=-elf
		;;
	or32-*)
		os=-coff
		;;
	*-tti)	# must be before sparc entry or we get the wrong os.
		os=-sysv3
		;;
	sparc-* | *-sun)
		os=-sunos4.1.1
		;;
	*-be)
		os=-beos
		;;
	*-ibm)
		os=-aix
		;;
	*-wec)
		os=-proelf
		;;
	*-winbond)
		os=-proelf
		;;
	*-oki)
		os=-proelf
		;;
	*-hp)
		os=-hpux
		;;
	*-hitachi)
		os=-hiux
		;;
	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
		os=-sysv
		;;
	*-cbm)
		os=-amigaos
		;;
	*-dg)
		os=-dgux
		;;
	*-dolphin)
		os=-sysv3
		;;
	m68k-ccur)
		os=-rtu
		;;
	m88k-omron*)
		os=-luna
		;;
	*-next )
		os=-nextstep
		;;
	*-sequent)
		os=-ptx
		;;
	*-crds)
		os=-unos
		;;
	*-ns)
		os=-genix
		;;
	i370-*)
		os=-mvs
		;;
	*-next)
		os=-nextstep3
		;;
	*-gould)
		os=-sysv
		;;
	*-highlevel)
		os=-bsd
		;;
	*-encore)
		os=-bsd
		;;
	*-sgi)
		os=-irix
		;;
	*-siemens)
		os=-sysv4
		;;
	*-masscomp)
		os=-rtu
		;;
	f30[01]-fujitsu | f700-fujitsu)
		os=-uxpv
		;;
	*-rom68k)
		os=-coff
		;;
	*-*bug)
		os=-coff
		;;
	*-apple)
		os=-macos
		;;
	*-atari*)
		os=-mint
		;;
	*)
		os=-none
		;;
esac
fi

# Here we handle the case where we know the os, and the CPU type, but not the
# manufacturer.  We pick the logical manufacturer.
vendor=unknown
case $basic_machine in
	*-unknown)
		case $os in
			-riscix*)
				vendor=acorn
				;;
			-sunos*)
				vendor=sun
				;;
			-aix*)
				vendor=ibm
				;;
			-beos*)
				vendor=be
				;;
			-hpux*)
				vendor=hp
				;;
			-mpeix*)
				vendor=hp
				;;
			-hiux*)
				vendor=hitachi
				;;
			-unos*)
				vendor=crds
				;;
			-dgux*)
				vendor=dg
				;;
			-luna*)
				vendor=omron
				;;
			-genix*)
				vendor=ns
				;;
			-mvs* | -opened*)
				vendor=ibm
				;;
			-os400*)
				vendor=ibm
				;;
			-ptx*)
				vendor=sequent
				;;
			-tpf*)
				vendor=ibm
				;;
			-vxsim* | -vxworks* | -windiss*)
				vendor=wrs
				;;
			-aux*)
				vendor=apple
				;;
			-hms*)
				vendor=hitachi
				;;
			-mpw* | -macos*)
				vendor=apple
				;;
			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
				vendor=atari
				;;
			-vos*)
				vendor=stratus
				;;
		esac
		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
		;;
esac

echo $basic_machine$os
exit 0

# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
# End:
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted configure.

more than 10,000 changes

Deleted configure.in.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
dnl Process this file with autoconf to produce a configure script.
AC_REVISION($Revision $)
AC_INIT
AC_CONFIG_HEADER(config.h)

dnl Checks for programs.
AC_PROG_CC
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_CHECK_TOOL(AR, ar, [#])
AC_CHECK_TOOL(RANLIB, ranlib, [#])

DC_PROG_GCC

dnl Check for largefile support
AC_SYS_LARGEFILE
AC_FUNC_FSEEKO
AC_TYPE_OFF_T

dnl Check host OS info.
DC_CHK_OS_INFO

dnl Determine how to make shared objects
DC_GET_SHOBJFLAGS

dnl Checks for libraries.
DC_CHK_DLOPEN
DC_CHK_MODULE(z, comp_zlib.c comp_mzlib.c comp_mzlib2.c, HAVE_LIBZ)
DC_CHK_MODULE(bz2, comp_bzlib.c, HAVE_LIBBZ2)
DC_CHK_MODULE(mcrypt, cipher_serpent.c, HAVE_LIBMCRYPT)
DC_CHK_MODULE_VAR(lzo, comp_lzoox.c comp_lzooy.c comp_lzota.c, HAVE_LIBLZO, MODLIBSCOND)

DC_ASK_CHKVERS
DC_ASK_NETWORK
DC_ASK_DEBUG
DC_ASK_MODULE
DC_ASK_DEBIAN
DC_CHK_URANDOM

dnl Checks for header files.
AC_CHECK_HEADERS(zlib.h getopt.h stdio.h strings.h string.h unistd.h stdint.h inttypes.h bzlib.h sys/time.h sys/utsname.h sys/socket.h sys/wait.h lzoconf.h lzo1x.h lzo1y.h lzo2a.h dirent.h mcrypt.h dlfcn.h stdarg.h netinet/in.h arpa/inet.h netdb.h errno.h)
AC_HEADER_TIME

dnl Checks for typedefs.
AC_CHECK_TYPE(uint, unsigned int)

dnl Checks for structures.

dnl Checks for compiler characteristics.
AC_C_INLINE
AC_CHECK_SIZEOF(long long, 8)
AC_CHECK_SIZEOF(long, 4)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(short, 2)

DC_DO_TYPE(uint64_t, unsigned, 8)
DC_DO_TYPE(int64_t, signed, 8)
DC_DO_TYPE(uint32_t, unsigned, 4)
DC_DO_TYPE(int32_t, signed, 4)
DC_DO_TYPE(uint16_t, unsigned, 2)
DC_DO_TYPE(int16_t, signed, 2)

dnl Checks for library functions.
AC_CHECK_LIB(z, compress2, AC_DEFINE(HAVE_COMPRESS2, [], [Have more versatile compress2() ?]))
AC_CHECK_LIB(z, gzdopen, AC_DEFINE(HAVE_GZDOPEN, [], [Have gzdopen() ?]))
AC_CHECK_LIB(bz2, bzBuffToBuffCompress, AC_DEFINE(HAVE_OLD_BZ2, [], [Do not have BZ2_ prefixed to all bzip2 symbols?]))
AC_CHECK_LIB(bz2, BZ2_bzBuffToBuffCompress, AC_DEFINE(HAVE_NEW_BZ2, [], [Have BZ2_ prefixed to all bzip2 symbols?]))
AC_CHECK_LIB(bz2, bzdopen, AC_DEFINE(HAVE_BZDOPEN, [], [Have bzdopen() ?]))
AC_CHECK_LIB(bz2, BZ2_bzdopen, AC_DEFINE(HAVE_NEW_BZDOPEN, [], [Have BZ2_bzdopen() ?]))
AC_REPLACE_FUNCS(getopt strsep getpass mkstemp uname)

dnl Checks for system services.
DC_DO_WIN32

dnl Sync the SHLIBOBJS with LIBOBJS
DC_SYNC_SHLIBOBJS

AC_OUTPUT(Makefile)
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































































Deleted dact.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
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
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
/*
 * Copyright (C) 2001, 2002, and 2003  Roy Keene
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 *      email: dact@rkeene.org
 */

#include "dact.h"
#include <fcntl.h>
#include <stdio.h>
#include <ctype.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include "parse.h"
#include "dendian.h"
#include "crc.h"
#include "math.h"
#include "dact_common.h"
#include "algorithms.h"
#include "libdact.h"
#include "ciphers.h"
#include "module.h"
#include "header.h"
#include "parse.h"
#include "net.h"
#include "ui.h"
#ifdef HAVE_ZLIB_H
#include <zlib.h>
#endif
#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);
	printf("usage: %s [options...] [file ...]\n",argv[0]);
	printf("Options:\n");
	printf("  -d          Decompress instead of compressing.\n");
	printf("  -s          Give statistics rather than compress or decompress.\n");
	printf("  -f          Force unsafe things to happen.\n");
	printf("  -c          (De)compress to stdout.\n");
	printf("  -v          Increase verbosity.\n");
	printf("  -l          List available algorithms.\n");
	printf("  -n          Toggle use of CRCs.\n");
	printf("  -i          Use stdin to read information from instead of /dev/tty.\n");
#ifndef DACT_UNSAFE
	printf("  -C          Complain when compression errors occur.\n");
#endif
	printf("  -H          Write only header (no data).\n");
	printf("  -O          Toggle writing original file name.\n");
	printf("  -S          Use speed-size as a metric rather than size.\n");
	printf("  -h          Give this help.\n");
	printf("  -V          Display DACT version (%i.%i.%i-%s).\n", DACT_VER_MAJOR, DACT_VER_MINOR, DACT_VER_REVISION, DACT_VER_SUB);
	printf("  -N          Upgrade DACT.\n");
	printf("  -a          Upgrade DACT modules.\n");
	printf("  -x          Create self-extracting DACT file.\n");
	printf("  -b NN       Use a block size of NN bytes for compression.\n");
	printf("  -e NN       Exclude algorithm NN from being used.\n");
	printf("  -m CONF     Load config file CONF.\n");
	printf("  -o FILE     Send output to FILE.\n");
	printf("  -u URL      Specify download location as URL.\n");
	printf("  -p URL      Parse URL and print results, then exit.\n");
	printf("  -M COMMAND  Execute COMMAND as if it had appeared in a config file.\n");
	printf("  -D DESC     Specify a description of DESC.\n");
	printf("  -I NN       Use ONLY 2 algorithms, NN and 0.\n");
	printf("  -U FILE     Use FILE to select download location.\n");
	printf("  -E CIPHER   Use CIPHER to encrypt data (LIST  lists available ciphers.)\n");
	printf("  file...     File(s) to (de)compress.  (If none given, use standard input).\n");
	return(0);
}

int dact_upgrade_file(const char *name, const char *url_get, const char *url_ver, uint32_t version, const char *dest, const unsigned char *options) {
	int newver, ifd=-1, ofd=-1, x=-1;
	char *real_dest, *real_url_get, buf[4096];

	if (dest==NULL) {
		real_dest=parse_url_subst(DACT_BIN_DIR "@@FILE@@.so", name);
	} else {
		real_dest=parse_url_subst(dest, name);
	}
	real_url_get=parse_url_subst(url_get, name);

	newver=dact_upgrade_file_checkver(name, url_ver, options);
	if (newver>version) {
		if (options[DACT_OPT_UPGRADE]) {
			fprintf(stderr, "There is a new version of %s.  NEW: %i.%i.%i, CURR: %i.%i.%i, fetching...\n", name, DACT_VER_PARTS(newver), DACT_VER_PARTS(version));
			if ((ifd=open_net(real_url_get, O_RDONLY, 0))>=0) {
				if ((ofd=open_net(real_dest, O_WRONLY|O_CREAT|O_TRUNC, S_IRWXU))>=0) {
					while ((x=read(ifd, buf, sizeof(buf)))>0) {
						write(ofd, buf, x);
					}
					close(ifd);
					close(ofd);
					if (x<0) PERROR("read");
				} else {
					PERROR_L(ofd, "open");
				}
			} else {
				PERROR_L(ifd, "open");
			}
		} else {
			fprintf(stderr, "There is a new version of %s.  NEW: %i.%i.%i, CURR: %i.%i.%i\n", name, DACT_VER_PARTS(newver), DACT_VER_PARTS(version));
		}
	}
	free(real_dest);
	free(real_url_get);
	return(x);
}

int dact_upgrade_file_checkver(const char *name, const char *url_ver, const unsigned char *options) {
#ifdef CHECK_VERSION
	uint32_t rem_ver[4]={0, 0, 0, 0};
	int fd;
	char rem_vers[3][4]={{0,0,0,0},{0,0,0,0},{0,0,0,0}};
	char *urlbuf, verbuf[9];

	if (options[DACT_OPT_VERCHK]==0 && options[DACT_OPT_UPGRADE]==0) return(0);

	urlbuf=parse_url_subst(url_ver, name);
	if ((fd=open_net(urlbuf, O_RDONLY, 0))>=0) {
		read(fd, &verbuf, 9);
		close(fd);
		memcpy(rem_vers[0], verbuf, 3);
		memcpy(rem_vers[1], verbuf+3, 3);
		memcpy(rem_vers[2], verbuf+6, 3);
		rem_ver[0]=atoi(rem_vers[0]);
		rem_ver[1]=atoi(rem_vers[1]);
		rem_ver[2]=atoi(rem_vers[2]);
		rem_ver[3]=(rem_ver[0]<<16)|(rem_ver[1]<<8)|(rem_ver[2]);
	}
	free(urlbuf);
	return(rem_ver[3]);
#else
	return(0);
#endif
}

int dact_upgrade(unsigned char *options) {
#ifdef DACT_DEBIAN_UPGRADE_PROC
	char *buf;
	int status=0, i;

	if (getuid()==0) {
		buf=dact_ui_getuserinput("Executing `apt-get update' okay [y/N]? ", 5, 0);
		if (toupper(buf[0])!='Y') {
			PRINTERR("Failed to upgrade DACT.");
			free(buf);
			return(-1);
		}
		free(buf);

		if (fork()==0) {
			execl("/usr/bin/apt-get","apt-get","update",NULL);
			return(-1);  /* Couldn't run binary. */
		} else {
			i=wait(&status);
			if (WIFEXITED(status)) {
				if (WEXITSTATUS(status)) {
					PRINTERR("Failed to run `apt-get update'");
					return(-1);
				}
			}
		}

		if (fork()==0) {
			execl("/usr/bin/apt-get","apt-get","install","dact",NULL);
			return(-1);  /* Couldn't run binary. */
		} else {
			i=wait(&status);
			if (WIFEXITED(status)) {
				if (WEXITSTATUS(status)) {
					PRINTERR("Failed to run `apt-get install dact'");
					return(-1);
				}
			}
		}

		return(1);
	}
#else
	options[DACT_OPT_UPGRADE]=1;
	return(dact_upgrade_file("dact", DACT_BIN_URL, DACT_BIN_URL_VER, DACT_BIN_VER, DACT_BIN, options));
#endif
}

#if 0
int dact_upgrade(const char *options, uint32_t *crcs) {
	char *urlsubst, *buf, *dact_binfilebuf;
	char dact_binfile[256];
	int inFd, outFd;
	uint32_t i;


#ifdef DACT_DEBIAN_UPGRADE_PROC
	int status=0;

	if (getuid()==0) {
		buf=dact_ui_getuserinput("Executing `apt-get update' okay [y/N]? ", 5, 0);
		if (toupper(buf[0])!='Y') {
			PRINTERR("Failed to upgrade DACT.");
			free(buf);
			return(-1);
		}
		free(buf);

		if (fork()==0) {
			execl("/usr/bin/apt-get","apt-get","update",NULL);
			return(-1);  /* Couldn't run binary. */
		} else {
			i=wait(&status);
			if (WIFEXITED(status)) {
				if (WEXITSTATUS(status)) {
					PRINTERR("Failed to run `apt-get update'");
					return(-1);
				}
			}
		}

		if (fork()==0) {
			execl("/usr/bin/apt-get","apt-get","install","dact",NULL);
			return(-1);  /* Couldn't run binary. */
		} else {
			i=wait(&status);
			if (WIFEXITED(status)) {
				if (WEXITSTATUS(status)) {
					PRINTERR("Failed to run `apt-get install dact'");
					return(-1);
				}
			}
		}

		return(1);
	}
#endif

	if ((i=is_latest(options))) {
		PRINTERR("**+");
		PRINT_LINE; fprintf(stderr, "dact: **> CURR: DACT %i.%i.%i\n",DACT_VER_MAJOR, DACT_VER_MINOR, DACT_VER_REVISION);
		PRINT_LINE; fprintf(stderr, "dact: **> NEW:  DACT %i.%i.%i\n",i>>16,(i>>8)&0xff,i&0xff);
		PRINTERR("**>");
		PRINTERR("**-");
	}
	if ((inFd=open_net("http://www.rkeene.org/projects/rget/rget.cgi?project=dact&file=info", O_RDONLY))>=0) {
		fprintf(stderr, "------------------------\n");
		buf=malloc(1024);
		while (1) {
			i=read_f(inFd, buf, 1024);
			write(STDERR_FILENO, buf, i);
			if (i!=1024) break;
		}
		fprintf(stderr, "------------------------\n");
		close(inFd);
		free(buf);
	}

#ifdef GO32
	mkdir("c:/dact/", 0755);
	strcpy(dact_binfile,"c:/dact/dact.exe");
#else
	strncpy(dact_binfile,getenv("HOME"),sizeof(dact_binfile)-1);
	strncat(dact_binfile,"/.dact/",sizeof(dact_binfile)-strlen(dact_binfile)-1);
	mkdir(dact_binfile, 0755);
	dact_binfilebuf=parse_url_subst("@@OSNM@@-@@ARCH@@/", "");
	strncat(dact_binfile,dact_binfilebuf,sizeof(dact_binfile)-strlen(dact_binfile)-1);
	free(dact_binfilebuf);
	mkdir(dact_binfile, 0755);
	
	strncat(dact_binfile,"dact.bin",sizeof(dact_binfile)-strlen(dact_binfile)-1);
#endif
	urlsubst=parse_url_subst("http://www.rkeene.org/projects/rget/rget.cgi?os=@@OSNM@@&arch=@@ARCH@@&project=dact&file=bin&meth=gz","");
	if ((outFd=open_net(dact_binfile, O_WRONLY|O_TRUNC|O_CREAT, 0755))<0) {
		PERROR_L(outFd, "open_net");
		return(-1);
	}
	if ((inFd=open_net(urlsubst, O_RDONLY, 0))<0) {
		PERROR_L(inFd, "open_net");
		return(-1);
	}
	if (!dact_process_file(inFd, outFd, DACT_MODE_DECMP, options, "dact", crcs, DACT_BLK_SIZE_DEF, -1)) {
		close(inFd);
		close(outFd);
		unlink(dact_binfile);
		PRINTERR("Failed to upgrade DACT.");
		return(-1);
	}
	close(inFd);
	close(outFd);
	if (!options[DACT_OPT_BINCHK]) {
		PRINTERR("Note: You do not have binary_check  set to `on' in your dact.conf.");
	}
	return(1);
}

uint32_t is_latest (const char *options) {
#if defined(CHECK_VERSION)
	int fd;
	char ver_maj[4]={0,0,0,0}, ver_min[4]={0,0,0,0}, ver_rev[4]={0,0,0,0};
	char bigbuf[1024];
	int vers[3];

	if (options[DACT_OPT_VERCHK]==0) return(0);
	if (getuid()==0) return(0);

	if ((fd=createconnection_tcp("www.rkeene.org", 80))<0) return(0);

	write(fd, "GET http://www.rkeene.org/devel/dact/VERSION\n", 45);
	read(fd, &bigbuf,1024);

	memcpy(ver_maj,bigbuf,3);
	memcpy(ver_min,bigbuf+3,3);
	memcpy(ver_rev,bigbuf+6,3);

	closeconnection(fd);

	vers[0]=atoi(ver_maj);
	vers[1]=atoi(ver_min);
	vers[2]=atoi(ver_rev);

	if ( ((vers[0]<<16)|(vers[1]<<8)|vers[2]) > ((DACT_VER_MAJOR<<16)|(DACT_VER_MINOR<<8)|DACT_VER_REVISION) ) {
		return((vers[0]<<16)|(vers[1]<<8)|vers[2]);
	} else {
		return(0);
	}
#else
	return(0);
#endif
}
#endif

int dact_shutdown(int retval) {
	unload_modules();
	dact_ui_deinit();
	return(retval);
}

char *dact_getoutfilename(const char *orig, const int mode, const char *ext) {
	char *ret=NULL;
	size_t retlen;

	switch (mode) {
		case DACT_MODE_COMPR:
			retlen=strlen(orig)+strlen(ext)+10;
			ret=malloc(retlen);
			snprintf(ret, retlen, "%s%s", orig, ext);
			break;
		case DACT_MODE_DECMP:
			if (strcmp(&orig[strlen(orig)-4],".dct") && \
				strcmp(&orig[strlen(orig)-4], ".exe") && \
				strcmp(&orig[strlen(orig)-4], ".bin") && \
				strcmp(&orig[strlen(orig)-4], ".bz2") && \
				strcmp(&orig[strlen(orig)-5], ".tbz2") && \
				strcmp(&orig[strlen(orig)-4], ".tgz") && \
				strcmp(&orig[strlen(orig)-3], ".gz")) {
				return(NULL);
			}
/* XXX: I wonder if this breaks easily... */
			ret=strdup(orig);
			(*strrchr(ret, '.'))='\0';
			break;
		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";
	int filecnt=0;
	int in_fd, out_fd;
	int mode=DACT_MODE_COMPR, ciphernum=-1;
	uint32_t dact_blk_size=0;
	uint32_t crcs[6]={0};
	uint32_t i,x;

	dact_ui_init();
	dact_init();

/* hack, to make upgrade work even if DACT_OPT_BINCHK is enabled, we must
 *      get the new version before executing it.
 */
	if (argv[1]!=NULL) {
		if (!strcmp(argv[1],"-N")) return(dact_upgrade(options));
		if (!strcmp(argv[1],"-a")) options[DACT_OPT_UPGRADE]=1;
	}

	dact_config_loadfile(DACT_CONFIG_FILE, options, &dact_blk_size);
#ifndef NO_BINCHECK
	dact_binfilebuf[0]='\0';
	if (getenv("HOME")) {
		strncpy(dact_binfilebuf,getenv("HOME"),sizeof(dact_binfilebuf)-1);
	}
	strncat(dact_binfilebuf,"/.dact/dact.conf",sizeof(dact_binfilebuf)-strlen(dact_binfilebuf)-1);
	dact_config_loadfile(dact_binfilebuf, options, &dact_blk_size);
#endif

	if (options[DACT_OPT_BINCHK]) {
		dact_binfile=parse_url_subst(DACT_BIN, "");
		if (strcmp(argv[0],dact_binfile)) {
			if (!access(dact_binfile,X_OK)) {
				argv[0]=dact_binfile;
				/* This fixes a strange warning..*/
#ifndef __MINGW32__
				execv(dact_binfile, argv);
#else
				execv(dact_binfile, (const char **) argv);
#endif
			}
		}
	}

	while ((opt=getopt(argc,argv,"adfsvcnhixNVHCM:E:p:I:m:e:lb:u:U:TPOD:o:"))!=-1) {
		switch (opt) {
			case 'a':
				options[DACT_OPT_UPGRADE]=1;
				break;
			case 'd':
				mode=DACT_MODE_DECMP;
				break;
			case 'f':
				options[DACT_OPT_FORCE]++;
				break;
			case 's':
				mode=DACT_MODE_STAT;
				break;
			case 'i':
				dact_ui_setopt(DACT_UI_OPT_PASSSTDIN, 1);
				break;
			case 'x':
				if (strcmp(EXEEXT, "")==0) {
					ext=".bin";
				} else {
					ext=EXEEXT;
				}
				options[DACT_OPT_SFX]=!options[DACT_OPT_SFX];
				break;
			case 'c':
				options[DACT_OPT_STDOUT]=!options[DACT_OPT_STDOUT];
				break;
			case 'b':
				i=atoi2(optarg);
				if (i<DACT_BLK_SIZE_ABSMAX) dact_blk_size=i;
				break;
			case 'v':
				options[DACT_OPT_VERB]++;
				dact_ui_setopt(DACT_UI_OPT_LEVEL,dact_ui_getopt(DACT_UI_OPT_LEVEL)+1);
				break;
			case 'n':
				options[DACT_OPT_NOCRC]=!options[DACT_OPT_NOCRC];
				break;
			case 'p':
				PRINT_LINE; fprintf(stderr, "dact: %s\n",parse_url_subst(optarg,"@@file@@"));
				mode=DACT_MODE_RET;
				break;
			case 'C':
				options[DACT_OPT_COMPLN]++;
				break;
			case 'm':
				dact_config_loadfile(optarg, options, &dact_blk_size);
				break;
			case 'e':
				i=(atoi(optarg)&0xff);
				algorithms[i]=DACT_FAILED_ALGO;
				break;
			case 'H':
				options[DACT_OPT_HDONLY]=!options[DACT_OPT_HDONLY];
				break;
			case 'o':
				out_file=parse_url_subst(optarg, "");
				break;
			case 'M':
				dact_config_execute(optarg, options, &dact_blk_size);
				break;
			case 'N':
				PRINTERR("The `-N\' option must be the first and only argument passed to dact.");
				return(0);
				break;
			case 'E':
				strtolower(optarg);
				x=hash_fourbyte((unsigned char *) optarg, ' ');
				if (x==hash_fourbyte((unsigned char *) "list", ' ')) {
					PRINT_LINE; fprintf(stderr, "dact: Num | Name\n");
					for (i=0;i<CIPHER_COUNT;i++) {
						if (ciphers_name[i]!=NULL && ciphers[i]!=DACT_FAILED_ALGO) {
							PRINT_LINE; fprintf(stderr, "dact: %3i | %s\n",i,ciphers_name[i]);
						}
					}
					return(0);
				}
				for (i=0;i<CIPHER_COUNT;i++) {
					if (ciphers_name[i]!=NULL && ciphers[i]!=DACT_FAILED_ALGO) {
						if (x==hash_fourbyte((unsigned char *) ciphers_name[i], ' ')) {
							break;
						}
					}
				}
				if (i==CIPHER_COUNT) i=-1;
				ciphernum=i;
				if (ciphernum==-1) {
					PRINTERR("No such cipher.");
					return(-1);
				}
				break;
			case 'l':
				PRINT_LINE; fprintf(stderr, "dact: Num | Name\n");
				for (i=0;i<255;i++) {
					if (algorithms[i]==NULL || algorithms[i]==DACT_FAILED_ALGO) continue;
					PRINT_LINE; fprintf(stderr, "dact: %3i | %s\n",i,algorithm_names[i]);
			
				}
				mode=DACT_MODE_RET;
				break;
			case 'I':
				x=atoi(optarg);
				for (i=1;i<255;i++) {
					if (i!=x) algorithms[i]=NULL;
				}
				break;
			case 'V':
				printf("DACT %i.%i.%i-%s", DACT_VER_MAJOR, DACT_VER_MINOR, DACT_VER_REVISION, DACT_VER_SUB);
#if defined(__DATE__) && defined(__TIME__)
				printf("  built on %s at %s",__DATE__,__TIME__);
#endif
#ifdef DACT_CONTACT
				printf(" %s",DACT_CONTACT);
#endif
				printf("\n");
				return(0);
				break;
			case 'u':
				dact_hdr_ext_regs(DACT_HDR_URL, optarg, strlen(optarg));
				break;
			case 'U':
				dact_hdr_ext_regs(DACT_HDR_URLFILE, optarg, strlen(optarg));
				break;
			case 'D':
				dact_hdr_ext_regs(DACT_HDR_DESC, optarg, strlen(optarg));
				break;
			case 'T':
				options[DACT_OPT_TIME]=!options[DACT_OPT_TIME];
				break;
			case 'P':
				options[DACT_OPT_PERM]=!options[DACT_OPT_PERM];
				break;
			case 'O':
				options[DACT_OPT_ORIG]=!options[DACT_OPT_ORIG];
				break;
			case 'S':
				options[DACT_OPT_SZSPD]=!options[DACT_OPT_SZSPD];
				break;
			case '?':
			case ':':
			case 'h':
				return(print_help(argc,argv));
		}

	}

/* 
 * Check for a new version of DACT 
 */
	if ((i=dact_upgrade_file_checkver("dact", DACT_BIN_URL_VER, options))>DACT_BIN_VER) {
		PRINTERR("**+");
		PRINTERR("**> There is a new version of DACT available.");
		PRINTERR("**>");
		PRINT_LINE; fprintf(stderr, "dact: **> [CURR: DACT %i.%i.%i]\n",DACT_VER_MAJOR, DACT_VER_MINOR, DACT_VER_REVISION);
		PRINT_LINE; fprintf(stderr, "dact: **> [NEW:  DACT %i.%i.%i]\n",i>>16,(i>>8)&0xff,i&0xff);
		PRINTERR("**>");
		PRINTERR("**> Run `dact -N' to get it.");
		PRINTERR("**> or get the source at: http://www.rkeene.org/devel/dact.tar.gz");
		PRINTERR("**>");
		PRINTERR("**-");
	}

	if (mode==DACT_MODE_RET) return(0);

	in_files=&argv[optind];

/* Loop through extra parameters (files ...) and setup FDs for them */
	do {
		in_fd=-1;
		out_fd=-1;

		in_file=in_files[filecnt];
		if (in_file!=NULL) {
/* Determine resulting file name */
			if (out_file==NULL) out_file=dact_getoutfilename(in_file, mode, ext);
			if (strcmp("-",in_file)==0) {
				in_fd=STDIN_FILENO;
			} else {
				if (stat(in_file, &stat_buf)>=0) {
					if (S_ISDIR(stat_buf.st_mode)) {
						fprintf(stderr, "dact: %s is a directory.\n",in_file);
						continue;
					}
				}
				if ((in_fd=open_net(in_file, O_RDONLY, 0))<0) {
					fprintf(stderr, "dact: Can't open %s.\n",in_file);
					PERROR_L(in_fd, "open");
					continue;
				}
			}
			if (out_file!=NULL) {
				if (!strcmp("-",out_file)) options[DACT_OPT_STDOUT]=1;
/*
 *
 * This is a bad thing if this program is SUID root, which it NEVER EVER 
 * should be.
 *
 *  DO NOT MAKE DACT SUID ROOT OR YOU WILL BE HACKED
 * 
 * that should be a suffcient warning.
 * (this is a mere race condition, but a severe warning should prevent
 *  people from complaining about it to me.)
 *
 */
				if (access(out_file,F_OK)!=-1 && options[DACT_OPT_FORCE]==0 && options[DACT_OPT_STDOUT]==0) {
					fprintf(stderr, "dact: %s exists.\n",out_file);
					close(in_fd);
					continue;
				}
				if (!options[DACT_OPT_STDOUT]) {
					if ((out_fd=open_net(out_file,O_WRONLY|O_CREAT|O_TRUNC,0644))<0) {
						fprintf(stderr, "dact: Can't open %s for writing.\n",out_file);
						PERROR_L(out_fd, "open");
						continue;
					}
				}
			}
			if (options[DACT_OPT_STDOUT]) out_fd=STDOUT_FILENO;
		}

/* Use STDIN/STDOUT if no files specified ... unless an outfile was specified... */
		if (in_file==NULL && filecnt==0) {
/* ... But only if STDOUT isn't a terminal */
			if (isatty(STDOUT_FILENO) && options[DACT_OPT_FORCE]==0) {
				fprintf(stderr, "dact: Refusing to write compressed output to a terminal.\n");
			} else {
				out_fd=STDOUT_FILENO;
				in_fd=STDIN_FILENO;
			}
		}

/* Okay, we're all done, now pass these to something to do the real stuff */
		if (in_fd!=-1 && (out_fd!=-1 || mode==DACT_MODE_STAT)) {
			crcs[1]=crcs[0]=0;
			if (dact_process_file(in_fd, out_fd, mode, options, in_file, crcs, dact_blk_size, ciphernum)==0) {
				close(in_fd);
				close(out_fd);
				if (out_fd!=STDOUT_FILENO) {
					unlink(out_file);
				}
				return(dact_shutdown(-1));
			}
		}
/* Cleanup */
		if (out_fd!=-1) close(out_fd);
		if (in_fd!=-1) close(in_fd);
	} while (in_files[filecnt++]!=NULL);

	return(dact_shutdown(0));
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted dact_common.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
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
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
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
/*
 * Copyright (C) 2001, 2002, and 2003  Roy Keene
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 *      email: dact@rkeene.org
 */

#include "dact.h"
#define __DACT_C
#include <fcntl.h>
#include <stdio.h>
#include <ctype.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include "parse.h"
#include "dendian.h"
#include "crc.h"
#include "math.h"
#include "dact_common.h"
#include "algorithms.h"
#include "ciphers.h"
#include "module.h"
#include "header.h"
#include "parse.h"
#include "net.h"
#include "sfx.h"
#include "ui.h"
#ifdef HAVE_ZLIB_H
#include <zlib.h>
#endif
#ifdef HAVE_BZLIB_H
#include <bzlib.h>
#endif

char dact_nonetwork=0;

uint32_t dact_blksize_calc(int fsize) {
	uint32_t ret=0;

	if (fsize==0) return(DACT_BLK_SIZE_DEF);
	if (fsize<(204800)) {
		ret=(fsize+5);
	}
	if (ret==0) ret=(((int) ((((float) fsize)/102400.0)-(0.9999999)))*65535);
	if (ret>DACT_BLK_SIZE_MAX) ret=DACT_BLK_SIZE_MAX;
	return(ret);
}

int dact_config_execute(const char *cmd, unsigned char *options, uint32_t *blksize) {
	char *line=NULL, *line_s, *item_buf[4]={NULL, NULL, NULL, NULL};
	int i;

	line_s=line=strdup(cmd);
	if (line[0]=='#') return(0);
	while (line[strlen(line)-1]<32) line[strlen(line)-1]='\0';
	for (i=0;i<4;i++) item_buf[i]=NULL;
	for (i=0;i<4;i++) {
		if ((item_buf[i]=strsep(&line, "\t "))==NULL)  break;
		if (item_buf[i][0]==0) i--;
	}
	if (item_buf[0]==NULL || item_buf[1]==NULL) return(0); /* This means all commands must have arguments. */

	switch (elfcrc(0, (unsigned char *) item_buf[0], strlen(item_buf[0]))) {
		case 164209419: /* binary_check */
			options[DACT_OPT_BINCHK]=!!strcmp(item_buf[1],"off");
			break;
		case 9456603: /* version_check */
			options[DACT_OPT_VERCHK]=!!strcmp(item_buf[1],"off");
			break;
		case 204349618: /* module_dir */
			if ((sizeof(moduledirectory)-strlen(moduledirectory)-1)<=0) break;
			strncat(moduledirectory,":",sizeof(moduledirectory)-strlen(moduledirectory)-1);
			strncat(moduledirectory,item_buf[1],sizeof(moduledirectory)-strlen(moduledirectory)-1);
			break;
		case 247248556: /* module_load_all */
			if (strcmp(item_buf[1], "on")==0) {
				init_modules();
				load_modules_all(options);
			}
			break;
		case 48402100:  /* module_load */
		case 106360197: /* load_module */
			init_modules();
			load_module(item_buf[1], options);
			break;
		case 164097267: /* network_access */
#ifndef NO_NETWORK
			dact_nonetwork=!strcmp(item_buf[1],"off");
#endif
			break;
		case 209445231: /* exclude_algo */
			i=(atoi(item_buf[1])&0xff);
			algorithms[i]=DACT_FAILED_ALGO;
			break;
		case 168825941: /* block_size */
			if (blksize!=NULL) {
				*blksize=atoi2(item_buf[1]);
			}
			break;
		case 162975987: /* use_urls */
			options[DACT_OPT_URL]=!!strcmp(item_buf[1],"off");
			break;
		case 104235033: /* color_ui */
			dact_ui_setopt(DACT_UI_OPT_COLOR,!!strcmp(item_buf[1],"off"));
			break;
		case 164800901: /* module_upgrade */
			if (strcmp(item_buf[1],"on")==0) options[DACT_OPT_UPGRADE]=1;
			break;
		case 63160590: /* pass_use_stdin */
		case 191551086: /* use_stdin */
			dact_ui_setopt(DACT_UI_OPT_PASSSTDIN, 1);
			break;
#ifdef DEBUG
		default:
			fprintf(stderr, "Unknown command %s (%i)\n",item_buf[0],elfcrc(0,item_buf[0],strlen(item_buf[0])));
			break;
#endif
	}
	free(line_s);
	return(1);
}

void dact_config_loadfile(const char *path, unsigned char *options, uint32_t *blksize) {
	char *line=NULL;
	FILE *cfd;

	line=malloc(512);
	if ((cfd=fopen(path,"r"))==NULL) return;
	while (!feof(cfd)) {
		fgets(line, 511, cfd);
		dact_config_execute(line, options, blksize);
	}
	free(line);
	fclose(cfd);
}

uint32_t dact_blk_decompress(unsigned char *ret, const unsigned char *srcbuf, const uint32_t size, const unsigned char *options, const int algo, uint32_t bufsize) {
	uint32_t retval;

	if (algo==0xff) return(0);

	if (algorithms[algo]==NULL) {
		PRINTERR("Algorithm unavailble.");
		return(0);
	}

	retval=algorithms[algo](DACT_MODE_DECMP, NULL, srcbuf, ret, size, bufsize);

	return(retval);
}


uint32_t dact_blk_compress(unsigned char *algo, unsigned char *ret, const unsigned char *srcbuf, const uint32_t size, const unsigned char *options, uint32_t bufsize) {
	char *tmpbuf, *smallbuf=NULL;
	int i, highest_algo=0;
	char smallest_algo;
	uint32_t smallest_size=-1, x;
#ifndef DACT_UNSAFE
	char *verif_bf=NULL;
	uint32_t m;
	if ((verif_bf=malloc(size))==NULL) { PERROR("malloc"); return(0); }
#endif

	if ((tmpbuf=malloc(bufsize))==NULL) { PERROR("malloc"); return(0); }

	for (i=0;i<256;i++) {
		if (algorithms[i]!=NULL && algorithms[i]!=DACT_FAILED_ALGO) highest_algo=i;
	}

	for (i=0;i<=highest_algo;i++) {
		if (algorithms[i]!=NULL && algorithms[i]!=DACT_FAILED_ALGO) {
			x=algorithms[i](DACT_MODE_COMPR, NULL, srcbuf, tmpbuf, size, bufsize);
#ifndef DACT_UNSAFE
			if ((x<smallest_size || smallest_size==-1) && x!=-1) {
				m=algorithms[i](DACT_MODE_DECMP, NULL, tmpbuf, verif_bf, x, size);
				if (memcmp(verif_bf, srcbuf,m) || m!=size) {
					x=-1;
					DPRINTF("Verifcation failed! [algo=%i, %s]", i, algorithm_names[i]);
					if (options[DACT_OPT_COMPLN]) {
						dact_ui_status(DACT_UI_LVL_ALL, "Compression verification failed (ignoring)");
					}
				}
			}
#endif
			if ((x<smallest_size || smallest_size==-1) && x!=-1) {
				smallest_size=x;
				smallest_algo=i;
				if (smallbuf!=NULL) free(smallbuf);
				if ((smallbuf=malloc(smallest_size))==NULL) { 
					PERROR("malloc");
					free(tmpbuf);
#ifndef DACT_UNSAFE
					free(verif_bf);
#endif
					return(0);
				}
				memcpy(smallbuf, tmpbuf, smallest_size);
			}

			if (options[DACT_OPT_VERB]>2) {
				PRINT_LINE; fprintf(stderr, "dact: \033[%im----| %03i  | %-7i | %s\033[0m\n", (smallest_algo==i)*7 , i, x, algorithm_names[i]);
			}

		}
	}

	free(tmpbuf);
#ifndef DACT_UNSAFE
	free(verif_bf);
#endif
	if (smallest_size==-1) {
		return(0);
	}
	memcpy(algo, &smallest_algo, sizeof(char));
	memcpy(ret, smallbuf, smallest_size);
/* This was MISSING !  memory leak. */
	free(smallbuf);
	return(smallest_size);
}

uint64_t dact_process_file(const int src, const int dest, const int mode, const unsigned char *options, const char *filename, uint32_t *crcs, uint32_t dact_blksize, int cipher) {
	struct stat filestats;
	FILE *extd_urlfile;
	char *file_extd_urls[256];
	unsigned char algo;
	char ch;
	char *hdr_buf, *keybuf=NULL, *tmpbuf=NULL;
	unsigned char *in_buf, *out_buf;
	char version[3]={DACT_VER_MAJOR, DACT_VER_MINOR, DACT_VER_REVISION};
	char file_opts=0;
	uint32_t bytes_read, retsize;
	uint64_t filesize=0, fileoutsize=0, out_bufsize=0;
	uint32_t blk_cnt=0, file_extd_size=0, blksize=0, blksize_uncomp=0;
	uint32_t magic=0, file_extd_read=0, file_extd_urlcnt=0;
	int hdr_reg_size=28;
	int blksize_size;
	int x=0, new_fd, canlseek=0;
	ssize_t offset=0;

	if (fstat(src, &filestats)<0) {
		PERROR("fstat");
		return(0);
	}

	if (mode==DACT_MODE_COMPR) {
		blksize=dact_blksize;
		if (blksize==0) {
			blksize=dact_blksize_calc(filestats.st_size);
		}

		if (options[DACT_OPT_SFX]) {
			offset=sfx_init_compress(dest);
			if (offset<0) {
				PRINTERR("Couldn't initialize self-extracting header.");
				return(0);
			}
			dact_hdr_ext_regn(DACT_HDR_SFXLEN, offset, sizeof(offset));
		}

		out_bufsize=blksize*2;
		if (((in_buf=malloc(blksize))==NULL) || \
			((out_buf=malloc(out_bufsize))==NULL)) {
				PERROR("malloc");
				return(0);
		}

		dact_ui_setup(((float) (filestats.st_size/blksize)+0.9999));
		if (cipher!=-1) {
			dact_hdr_ext_regn(DACT_HDR_CIPHER, cipher, sizeof(cipher));
			keybuf=malloc(DACT_KEY_SIZE);
			ciphers[cipher](NULL, NULL, 0, keybuf, DACT_MODE_CINIT+DACT_MODE_CENC);
			
		}

		blksize_size=BYTESIZE(blksize);

		if (!options[DACT_OPT_ORIG] && filename!=NULL)
			dact_hdr_ext_regs(DACT_HDR_NAME, filename, strlen(filename));
		file_extd_size=(dact_hdr_ext_size()+14); /* The +14 is for crc0 and crc1 */
		write_de(dest, DACT_MAGIC_NUMBER, 4);
		write(dest, &version[0], 1);
		write(dest, &version[1], 1);
		write(dest, &version[2], 1);
		write_de(dest, 0, 8); /* Place holder for ORIG FILE SIZE */
		write_de(dest, 0, 4); /* Place holder for NUM BLOCKS */
		write_de(dest, blksize, 4);
		write_de(dest, file_opts, 1); /* XXX: Option byte... Or not? */
		write_de(dest, file_extd_size, 4); /* Place holder for SIZEOF EXTENDED DTA */
/* Fill the header with NOPs incase we can't come back and put the CRCs */
		ch=DACT_HDR_NOP;
		for (x=0;x<file_extd_size;x++) write(dest, &ch, 1);

		if (options[DACT_OPT_VERB]>1) {
			PRINTERR("Blk | Algo | Size    | Name");
			PRINTERR("----+------+---------+---------------------------");
		}

		memset(in_buf, 0, blksize);
		while ( (bytes_read=read_f(src, in_buf, blksize))>0) {
			filesize+=bytes_read;
			blk_cnt++;

			retsize=dact_blk_compress(&algo, out_buf, in_buf, blksize, options, out_bufsize);

/* CIPHER the data if an encryption algorithm is specified. */
			if (cipher!=-1) {
				tmpbuf=malloc(retsize*2);
				x=ciphers[cipher](out_buf, tmpbuf, retsize, keybuf, DACT_MODE_CENC);
				memcpy(out_buf,tmpbuf,x);
				free(tmpbuf);
			}

			if (retsize>0) {
				if (options[DACT_OPT_VERB]>1) {
					if (options[DACT_OPT_VERB]>2) {
						PRINTERR("^^^\\ /^^^^\\ /^^^^^^^\\ /^^^^^^^^^^^^^^^^^^^^^^^^^^");
					}
					PRINT_LINE; fprintf(stderr, "dact: %03i | %03i  | %-7i | %s\n",blk_cnt,algo,retsize,algorithm_names[algo]);
					if (options[DACT_OPT_VERB]>2) {
						PRINTERR("___/ \\____/ \\_______/ \\__________________________");
					}
				}


				dact_ui_incrblkcnt(1);
				dact_ui_status(DACT_UI_LVL_GEN, "Algorithm ");
				dact_ui_status_append(DACT_UI_LVL_GEN,algorithm_names[algo]);

				crcs[0]=crc(crcs[0], out_buf, retsize);
				/* Do not generate a CRC of the plaintext if encrypting */
				if (cipher==-1) {
					crcs[1]=crc(crcs[1], in_buf, blksize);
				}

				if (!options[DACT_OPT_HDONLY]) {
					write(dest, &algo, 1);
					write_de(dest, retsize, blksize_size);

					if (write(dest, out_buf, retsize)!=retsize) {
						PERROR("write");
						free(in_buf);
						free(out_buf);
						return(0);
					}
				}
			} else {
				PRINTERR("Compression resulted in 0-byte block.");
				free(in_buf);
				free(out_buf);
				return(0);
			}
			memset(in_buf, 0, blksize);
		}

		if (bytes_read<0) {
			PERROR("read");
		}

		free(in_buf);
		free(out_buf);

		/* Put the filesize and file block count in the header, if possible. */
		if (lseek_net(dest, offset+7, SEEK_SET)<0) {
/* If we can't rewind the stream, put magic+fileisze */
			write_de(dest, DACT_MAGIC_PEOF, 4);
			write_de(dest, filesize, 8);
		} else {
			write_de(dest, filesize, 8);
			write_de(dest, blk_cnt, 4);
		} 

		if (lseek_net(dest, offset+hdr_reg_size, SEEK_SET)>0) {
			if (!options[DACT_OPT_NOCRC]) {
				dact_hdr_ext_regn(DACT_HDR_CRC0, crcs[0], 4);
				dact_hdr_ext_regn(DACT_HDR_CRC1, crcs[1], 4);
			}
			write(dest, dact_hdr_ext_data(), dact_hdr_ext_size());
		}

		dact_hdr_ext_clear();

		return(filesize);
	}

	if (mode==DACT_MODE_DECMP) {

		dact_ui_status(DACT_UI_LVL_GEN, "Decompressing.");

		dact_hdr_ext_clear();

		read_de(src, &magic, 4, sizeof(magic));

		if (magic!=DACT_MAGIC_NUMBER) {
			dact_ui_status(DACT_UI_LVL_GEN, "Bad DACT magic, checking others...");
			return(dact_process_other(src,dest,magic,options));
		}

		read(src, &version[0], 1);
		read(src, &version[1], 1);
		read(src, &version[2], 1);
#ifndef DACT_DONT_SUPPORT_OLDDACT
		if (DACT_VERS(version[0], version[1], version[2])<DACT_VERS(0, 8, 39)) {
			PRINTERR("**WARNING** This file uses the old DACT file header, support will go away in future versions for this.");
			read_de(src, &filesize, 4, sizeof(filesize));
			hdr_reg_size=24;
		} else {
			read_de(src, &filesize, 8, sizeof(filesize));
		}
#else
		read_de(src, &filesize, 8, sizeof(filesize));
#endif
		read_de(src, &blk_cnt, 4, sizeof(blk_cnt));
		read_de(src, &blksize_uncomp, 4, sizeof(blksize_uncomp));
		read(src, &file_opts, 1);
		read_de(src, &file_extd_size, 4, sizeof(file_extd_size));



		while (file_extd_read<file_extd_size) {
			x=0;
			read(src, &ch, 1);
			if (ch!=DACT_HDR_NOP) read_de(src, &x, 2, sizeof(x)); 
			switch (ch) {
				case DACT_HDR_CRC0:
					read_de(src, &crcs[2], 4, sizeof(crcs[2]));
					if (crcs[4]!=0 && crcs[2]!=crcs[4]) {
						dact_ui_status(DACT_UI_LVL_GEN, "CRC error.");
						if (!options[DACT_OPT_NOCRC])
							return(0);
					}
					break;
				case DACT_HDR_CRC1:
					read_de(src, &crcs[3], 4, sizeof(crcs[3]));
					if (crcs[5]!=0 && crcs[3]!=crcs[5]) {
						dact_ui_status(DACT_UI_LVL_GEN, "CRC error.");
						if (!options[DACT_OPT_NOCRC])
							return(0);
					}
					break;
/*

XXX: Todo, make this do something...
		 		case DACT_HDR_NAME:
					break;
*/
				case DACT_HDR_URL:
					hdr_buf=malloc(x+1);
					read_f(src, hdr_buf, x);
					hdr_buf[x]=0;
					file_extd_urls[file_extd_urlcnt++]=parse_url_subst(hdr_buf,filename);
					free(hdr_buf);
					break;
				case DACT_HDR_URLFILE:
					hdr_buf=malloc(x+1);
					read_f(src, hdr_buf, x);
					hdr_buf[x]=0;
					extd_urlfile=fopen(hdr_buf, "r");
					free(hdr_buf);   /* We shouldn't need this anymore. */
					if (extd_urlfile==NULL) break;
					hdr_buf=malloc(4096);
					while (1) {
						fgets(hdr_buf, 4095, extd_urlfile);
						if (feof(extd_urlfile)) break;
						hdr_buf=strsep(&hdr_buf,"\n");
						file_extd_urls[file_extd_urlcnt++]=parse_url_subst(hdr_buf,filename);
					}
					free(hdr_buf);
					break;
				case DACT_HDR_DESC:
					hdr_buf=malloc(x+1);
					read_f(src, hdr_buf, x);
					hdr_buf[x]=0;
					fprintf(stderr, "DESC: %s\n",hdr_buf);
					free(hdr_buf);
					break;
				case DACT_HDR_CIPHER:
					read_de(src, &cipher, x, sizeof(cipher));
					break;
				case DACT_HDR_NOP:
					x=-2;
					break;
				case DACT_HDR_SFXLEN:
					read_de(src, &offset, x, sizeof(offset));
					break;
				default:
					hdr_buf=malloc(x);
					read_f(src, hdr_buf, x);
					free(hdr_buf);
					break;
			}



			file_extd_read+=(x+3);
		}

		if (options[DACT_OPT_URL]) {
			for (x=0;x<file_extd_urlcnt;x++) {
				dact_ui_status(DACT_UI_LVL_GEN,"Trying to get remote url ");
				dact_ui_status_append(DACT_UI_LVL_SPEC, file_extd_urls[x]);
				if ((new_fd=open_net(file_extd_urls[x],O_RDONLY,0))<0) {
					dact_ui_status(DACT_UI_LVL_GEN, "Failed.");
					continue;
				}
				close(src);
				crcs[4]=crcs[2];
				crcs[5]=crcs[3];
				return(dact_process_file(new_fd, dest, mode, options, filename, crcs, blksize_uncomp, cipher));
			}
		}


/* 
   XXX: Even if we don't resolve it here, we can resolve it later...
   Should we even bother to do it here if we can?

   XXX: When CAN'T we rewind a read stream?
		When it's a pipe

*/
		if (filesize==0) {
/* See if we can rewind our stream, so when we get to the end, we can come back! */
			if (lseek_net(src, offset+1, SEEK_SET)==(offset+1)) { /* MAJOR BUG HERE! was: lseek(src,1,SEEK_SET)==0 which will always be false. */
				canlseek=1;
#ifndef DACT_DONT_SUPPORT_OLDDACT
				if (DACT_VERS(version[0], version[1], version[2])<DACT_VERS(0, 8, 39)) {
					PRINTERR("**WARNING** This file uses the old DACT file header, support will go away in future versions for this.");
					lseek_net(src, -8, SEEK_END);
					read_de(src, &magic, 4, sizeof(magic));
					read_de(src, &filesize, 4, sizeof(filesize));
					hdr_reg_size=24;
				} else {
					lseek_net(src, -12, SEEK_END);
					read_de(src, &magic, 4, sizeof(magic));
					read_de(src, &filesize, 8, sizeof(filesize));
				}
#else
				lseek_net(src, -12, SEEK_END);
				read_de(src, &magic, 4, sizeof(magic));
				read_de(src, &filesize, 8, sizeof(filesize));
#endif
				if (magic!=DACT_MAGIC_PEOF) {
					dact_ui_status(DACT_UI_LVL_GEN, "File is corrupt.");
					filesize=0;
				}
				lseek_net(src, offset+hdr_reg_size+file_extd_size, SEEK_SET);
			} else {
				canlseek=0;
			}
		}

		out_bufsize=blksize_uncomp;
		if (((out_buf=malloc(out_bufsize))==NULL)) {
			PERROR("malloc");
			return(0);
		}

		blksize_size=BYTESIZE(blksize_uncomp);

		dact_ui_setup((int)(((float) filesize/(float) blksize_uncomp)+0.9999));

		if (cipher!=-1) {
			keybuf=malloc(DACT_KEY_SIZE);
			ciphers[cipher](NULL, NULL, 0, keybuf, DACT_MODE_CINIT+DACT_MODE_CDEC);
			
		}



		while (1) {
			if (read(src, &algo, 1)==0) break;
			if (algo==0xff) break; /* 0xff is reserved for EOF */

			read_de(src, &blksize, blksize_size, sizeof(blksize));

			if ((in_buf=malloc(blksize))==NULL) {
				PERROR("malloc");
				free(out_buf);
				return(0);
			}

			read_f(src, in_buf, blksize);

#ifndef DACT_DONT_SUPPORT_OLDDACT
			if (DACT_VERS(version[0], version[1], version[2])<DACT_VERS(0, 8, 39)) {
				PRINTERR("**WARNING** This file uses the old DACT file header, support will go away in future versions for this.");
				crcs[0]=elfcrc(crcs[0],in_buf,blksize);
			} else {
				crcs[0]=crc(crcs[0],in_buf,blksize);
			}
#else
			crcs[0]=crc(crcs[0],in_buf,blksize);
#endif

			if (cipher!=-1) {
				tmpbuf=malloc(blksize*2);
				x=ciphers[cipher](in_buf, tmpbuf, blksize, keybuf, DACT_MODE_CDEC);
				memcpy(in_buf,tmpbuf,x);
				free(tmpbuf);
			}

/*
 * If the filesize is not specified, try to find it in the stream...
 * this is pretty stupid, because if we can't rewind OUR read stream
 * we're SOL... do we really need the filesize that badly?  I guess
 * we do to truncate the last of it...  Adding more checks in here..
 *
 * This will never get used, canlseek will be 1 only if we can sucessfully
 * seek, in which case, we have done it above.
 */
#if 0
			if (filesize==0 && canlseek) {
				read_de(src, &magic, 4);
				read_de(src, &filesize, 4);
				if (read(src, &x, 1)==0) {
					if (magic!=DACT_MAGIC_PEOF) {
						dact_ui_status(DACT_UI_LVL_GEN, "Stream is corrupt.");
						free(in_buf);
						free(out_buf);
						return(0);
					}
				} else {
					lseek(src, -9, SEEK_CUR);
					filesize=0;
				}
			}
#endif


			if ((bytes_read=dact_blk_decompress(out_buf, in_buf, blksize, 0, algo, out_bufsize))==0) {
				if (cipher!=-1) {
					PRINTERR("Decompression resulted in 0-byte block.  Invalid key?");
				} else {
					PRINTERR("Decompression resulted in 0-byte block.");
				}
			}
			fileoutsize+=bytes_read;

/* If ciphering, don't try to calculate this (the plaintext) CRC. */
			if (cipher==-1) {
#ifndef DACT_DONT_SUPPORT_OLDDACT
				if (DACT_VERS(version[0], version[1], version[2])<DACT_VERS(0, 8, 39)) {
					PRINTERR("**WARNING** This file uses the old DACT file header, support will go away in future versions for this.");
					crcs[1]=elfcrc(crcs[1],out_buf,bytes_read);
				} else {
					crcs[1]=crc(crcs[1],out_buf,bytes_read);
				}
#else
				crcs[1]=crc(crcs[1],out_buf,bytes_read);
#endif
			}

			dact_ui_incrblkcnt(1);

			if (fileoutsize>filesize && filesize!=0) {
				write(dest, out_buf, blksize_uncomp-(fileoutsize-filesize));
			} else {
				write(dest, out_buf, bytes_read);
			}

			free(in_buf);
		}

		free(out_buf);

		if ((crcs[0]!=crcs[2] && crcs[0]!=0 && crcs[2]!=0) \
		  || (crcs[1]!=crcs[3] && crcs[1]!=0 && crcs[3]!=0)) {
			dact_ui_status(DACT_UI_LVL_GEN, "CRC error.");
			if (!options[DACT_OPT_NOCRC] || options[DACT_OPT_FORCE]<1)
				return(0);
		}

		dact_hdr_ext_clear();

		return(filesize);

	}


	if (mode==DACT_MODE_STAT) {
		read_de(src, &magic, 4, sizeof(magic));
		read(src, &version[0], 1);
		read(src, &version[1], 1);
		read(src, &version[2], 1);
#ifndef DACT_DONT_SUPPORT_OLDDACT
		if (DACT_VERS(version[0], version[1], version[2])<DACT_VERS(0, 8, 39)) {
			PRINTERR("**WARNING** This file uses the old DACT file header, support will go away in future versions for this.");
			read_de(src, &filesize, 4, sizeof(filesize));
			hdr_reg_size=24;
		} else {
			read_de(src, &filesize, 8, sizeof(filesize));
		}
#else
		read_de(src, &filesize, 8, sizeof(filesize));
#endif
		read_de(src, &blk_cnt, 4, sizeof(blk_cnt));
		read_de(src, &blksize, 4, sizeof(blksize));
		read(src, &file_opts, 1);
		read_de(src, &file_extd_size, 4, sizeof(file_extd_size));

		printf("File              :   %s\n", filename);
		printf("Magic             :   0x%08x",magic);
		if (magic!=DACT_MAGIC_NUMBER) {
			printf(" (bad magic)\n");
			return(0);
		} else {
			printf("\n");
		}

		if (filesize==0) {
			if (lseek_net(src, offset+1, SEEK_SET)==(offset+1)) {
#ifndef DACT_DONT_SUPPORT_OLDDACT
				if (DACT_VERS(version[0], version[1], version[2])<DACT_VERS(0, 8, 39)) {
					PRINTERR("**WARNING** This file uses the old DACT file header, support will go away in future versions for this.");
					lseek_net(src, -8, SEEK_END);
					read_de(src, &magic, 4, sizeof(magic));
					read_de(src, &filesize, 4, sizeof(filesize));
					hdr_reg_size=24;
				} else {
					lseek_net(src, -12, SEEK_END);
					read_de(src, &magic, 4, sizeof(magic));
					read_de(src, &filesize, 8, sizeof(filesize));
				}
#else
				lseek_net(src, -12, SEEK_END);
				read_de(src, &magic, 4, sizeof(magic));
				read_de(src, &filesize, 8, sizeof(filesize));
#endif
				if (magic!=DACT_MAGIC_PEOF) {
					PRINTERR("Bad end-of-file magic.  Corrupt or incomplete file?");
					filesize=0;
				}
			}
		}
		fileoutsize=lseek_net(src, 0, SEEK_END);
		fileoutsize-=offset;

		printf("Dact Version      :   %i.%i.%i\n",version[0],version[1],version[2]);
		printf("Block Size        :   %i\n", blksize);
		printf("Block Header Size :   %i\n", BYTESIZE(blksize)+1);
		printf("Compressed Size   :   %llu\n", fileoutsize);
		printf("Uncompressed Size :   %llu\n", filesize);
		printf("Ratio             :   %2.3f to 1.0\n", ((float) filesize)/((float) fileoutsize) );
		lseek_net(src, offset+hdr_reg_size, SEEK_SET);
		while (file_extd_read<file_extd_size) {
			x=0;
			read(src, &ch, 1);
			if (ch!=DACT_HDR_NOP) read_de(src, &x, 2, sizeof(x)); 
			switch (ch) {
				case DACT_HDR_CRC0:
					read_de(src, &crcs[2], 4, sizeof(crcs[2]));
					printf("CRC 0             :   0x%08x\n", crcs[2]);
					break;
				case DACT_HDR_CRC1:
					read_de(src, &crcs[3], 4, sizeof(crcs[3]));
					printf("CRC 1             :   0x%08x\n", crcs[3]);
					break;
		 		case DACT_HDR_NAME:
					hdr_buf=malloc(x+1);
					read_f(src, hdr_buf, x);
					hdr_buf[x]=0;
					printf("Original Name     :   %s\n", hdr_buf);
					free(hdr_buf);
					break;
				case DACT_HDR_URL:
					hdr_buf=malloc(x+1);
					read_f(src, hdr_buf, x);
					hdr_buf[x]=0;
					file_extd_urls[file_extd_urlcnt++]=parse_url_subst(hdr_buf,filename);
					free(hdr_buf);
					break;
				case DACT_HDR_URLFILE:
					hdr_buf=malloc(x+1);
					read_f(src, hdr_buf, x);
					hdr_buf[x]=0;
					printf("Download Loc File :   %s\n", hdr_buf);
					extd_urlfile=fopen(hdr_buf, "r");
					free(hdr_buf);   /* We shouldn't need this anymore. */
					if (extd_urlfile==NULL) break;
					hdr_buf=malloc(4096);
					while (1) {
						fgets(hdr_buf, 4095, extd_urlfile);
						if (feof(extd_urlfile)) break;
						hdr_buf=strsep(&hdr_buf,"\n");
						file_extd_urls[file_extd_urlcnt++]=parse_url_subst(hdr_buf,filename);
					}
					free(hdr_buf);
					break;
				case DACT_HDR_DESC:
					hdr_buf=malloc(x+1);
					read_f(src, hdr_buf, x);
					hdr_buf[x]=0;
					printf("Description       :   %s\n", hdr_buf);
					free(hdr_buf);
					break;
				case DACT_HDR_CIPHER:
					read_de(src, &cipher, x, sizeof(cipher));
					printf("Ciphered using    :   %s\n", ciphers_name[cipher]);
					break;
				case DACT_HDR_NOP:
					x=-2;
					break;
				case DACT_HDR_SFXLEN:
					read_de(src, &offset, x, sizeof(offset));
					printf("Program length    :   %lu\n", (unsigned long) offset);
					break;
				default:
					hdr_buf=malloc(x);
					read_f(src, hdr_buf, x);
					free(hdr_buf);
					break;
			}


			file_extd_read+=(x+3);
		}

		for (x=0;x<file_extd_urlcnt;x++) {
			printf("Download Location :   %s",file_extd_urls[x]);
			if (options[DACT_OPT_VERB]) {
				if ((new_fd=open_net(file_extd_urls[x],O_RDONLY, 0))<0) {
					printf(" [broken]\n");
					continue;
				}
				close(new_fd);
			}
			printf("\n");
		}

		blk_cnt=0;
		blksize_size=BYTESIZE(blksize);
		if (options[DACT_OPT_VERB]) {
			lseek_net(src, offset+hdr_reg_size+file_extd_size, SEEK_SET);
			printf("\n");
			printf("Break down: \n");
			printf("  Blk | Algo | Size    | Name\n");
			printf("  ----+------+---------+---------------------------\n");
			while (1) {
				if (read(src, &algo, 1)==0) break;
				if (algo==0xff) break; /* 0xff is reserved for EOF */

				read_de(src, &blksize, blksize_size, sizeof(blksize));
				lseek_net(src, blksize, SEEK_CUR);
				printf("  %03i | %03i  | %-7i | %s\n",blk_cnt,algo,blksize,algorithm_names[algo]);
				blk_cnt++;
			}
		}

		printf("\n");


		return(1);
	}

	return(0);
}

uint32_t dact_process_other(int src, const int dest, const uint32_t magic, const unsigned 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);
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted dact_common.h.

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, unsigned char *options, uint32_t *blksize);
void dact_config_loadfile(const char *path, unsigned char *options, uint32_t *blksize);
uint32_t dact_blk_decompress(unsigned char *ret, const unsigned char *srcbuf, const uint32_t size, const unsigned char *options, const int algo, uint32_t bufsize);
uint32_t dact_blk_compress(unsigned char *algo, unsigned char *ret, const unsigned char *srcbuf, const uint32_t size, const unsigned char *options, uint32_t bufsize);
uint64_t dact_process_file(const int src, const int dest, const int mode, const unsigned 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 unsigned char *options);
#endif
<
<
<
<
<
<
<
<
<
<
<
<
<


























Deleted header.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
 * Copyright (C) 2001, 2002, and 2003  Roy Keene
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 *      email: dact@rkeene.org
 */

#include "dact.h"
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include <stdio.h>
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include "header.h"

char *dact_hdr_ext_val=NULL;
uint32_t dact_hdr_ext_sze=0;
uint32_t dact_hdr_ext_pos=0;



int dact_hdr_ext_alloc(uint32_t size) {
	if (dact_hdr_ext_val==NULL) {
		if (!(dact_hdr_ext_val=malloc(DACT_HEADER_BLKSIZE))) {
			dact_hdr_ext_val=NULL;
			return(0);
		}
		dact_hdr_ext_sze=DACT_HEADER_BLKSIZE;
	}
	if ((dact_hdr_ext_pos+size)>(dact_hdr_ext_sze)) {
		dact_hdr_ext_sze=(((dact_hdr_ext_pos+size-1)/DACT_HEADER_BLKSIZE)+1)*DACT_HEADER_BLKSIZE;
		dact_hdr_ext_val=realloc(dact_hdr_ext_val,dact_hdr_ext_sze);
	}
	return(1);
}

int dact_hdr_ext_regs(const int id, const char *val, const uint32_t size) {
	if (!dact_hdr_ext_alloc(size+3)) return(0);
	dact_hdr_ext_val[dact_hdr_ext_pos]=(id&0xff);
	dact_hdr_ext_val[dact_hdr_ext_pos+1]=((size>>8)&0xff);
	dact_hdr_ext_val[dact_hdr_ext_pos+2]=(size&0xff);
	memcpy(dact_hdr_ext_val+dact_hdr_ext_pos+3,val,size);
	dact_hdr_ext_pos+=(size+3);
	return(1);
}

int dact_hdr_ext_regn(const int id, const uint32_t val, const uint32_t size) {
	int i;

	if (!dact_hdr_ext_alloc(size+3)) return(0);
	dact_hdr_ext_val[dact_hdr_ext_pos]=(id&0xff);
	dact_hdr_ext_val[dact_hdr_ext_pos+1]=((size>>8)&0xff);
	dact_hdr_ext_val[dact_hdr_ext_pos+2]=(size&0xff);
	for (i=0;i<size;i++) {
		dact_hdr_ext_val[dact_hdr_ext_pos+3+i]=((val>>((size-i-1)*8)) &0xff);
	}
	dact_hdr_ext_pos+=(size+3);
	return(1);

}

uint32_t dact_hdr_ext_size(void) {
	return(dact_hdr_ext_pos);
}

char *dact_hdr_ext_data(void) {
	memset(dact_hdr_ext_val+dact_hdr_ext_pos, DACT_HDR_NOP, dact_hdr_ext_sze-dact_hdr_ext_pos);
	return(dact_hdr_ext_val);
}

void dact_hdr_ext_clear(void) {
	if (dact_hdr_ext_val!=NULL) free(dact_hdr_ext_val);
	dact_hdr_ext_pos=0;
	dact_hdr_ext_sze=0;
	dact_hdr_ext_val=NULL;
	return;
}


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


























































































































































































Deleted header.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
 * Copyright (C) 2001, 2002, and 2003  Roy Keene
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 *      email: dact@rkeene.org
 */

#ifndef _HEADER_H
#define _HEADER_H
#include "dact.h"

#ifndef DACT_HEADER_BLKSIZE
#define DACT_HEADER_BLKSIZE	1024
#endif

int dact_hdr_ext_regs(const int id, const char *val, const uint32_t size);
int dact_hdr_ext_regn(const int id, const uint32_t val, const uint32_t size);
uint32_t dact_hdr_ext_size(void);
char *dact_hdr_ext_data(void);
int dact_hdr_ext_alloc(uint32_t size);
void dact_hdr_ext_clear(void);
#endif
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































Deleted libdact.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "dact.h"
#include "dact_common.h"
#include "libdact.h"
#include "net.h"

int dact_init(void) {
	static int called = 0;

	if (called) {
		return(0);
	}

	if (dact_init_net() < 0) {
		dact_nonetwork = 1;
	}

	called = 1;
	return(0);
}

void *dact_openfile(const char *pathname) {
	return(NULL);
}

int dact_BuffToBuffDecompress(void) {
	dact_init();
	return(0);
}
int dact_BuffToBuffCompress(void) {
	dact_init();
	return(0);
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































Deleted libdact.h.

1
2
3
4
5
6
7
8
9
#ifndef LIBDACT_H
#define LIBDACT_H

int dact_init(void);
void *dact_openfile(const char *pathname);
int dact_BuffToBuffDecompress(void);
int dact_BuffToBuffCompress(void);

#endif
<
<
<
<
<
<
<
<
<


















Deleted module.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
/*
 * Copyright (C) 2001, 2002, and 2003  Roy Keene
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 *      email: dact@rkeene.org
 */


#include "dact.h"
#include "module.h"
#ifdef USE_MODULES
#ifdef HAVE_DLFCN_H
#include <dlfcn.h>
#endif
#include <stdio.h>
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <fcntl.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif
#include "algorithms.h"
#include "ciphers.h"
#include "parse.h"
#include "net.h"
#include "ui.h"

char moduledirectory[2048] = "@@HOME@@/.dact/@@OSNM@@-@@ARCH@@/";
void *modules[256];
int modules_initialized = 0;
int modules_count = 0;

int init_modules (void) {
	int i;

	if (modules_initialized!=0) return(DACT_MOD_FAIL);
	modules_initialized=1;

	for (i=0;i<256;i++) {
		modules[i]=NULL;
	}
	return(DACT_MOD_OK);
}

int unload_modules (void) {
	int i;

	if (modules_initialized==0) return(DACT_MOD_FAIL);

	for (i=0;i<256;i++) {
		if (modules[i]!=NULL)
			dlclose(modules[i]);
	}
	return(DACT_MOD_OK);
}

int load_modules_all(const unsigned char *options) {
#ifdef HAVE_DIRENT_H
	struct dirent *dinfo;
	char *mdircpy, *tmpbuf, *mbuf, *fname, fullfname[1024];
	DIR *dirtype;

	mdircpy=parse_url_subst(moduledirectory, "");
	mbuf=mdircpy;
	while ((tmpbuf=strsep(&mbuf, ":"))) {
		if ((dirtype=opendir(tmpbuf))==NULL) continue;
		while ((dinfo=readdir(dirtype))!=NULL) {
			fname=dinfo->d_name;
			if (strcmp(fname+strlen(fname)-3,".so")==0) {
				strncpy(fullfname, tmpbuf, sizeof(fullfname));
				strncat(fullfname, "/", sizeof(fullfname)-strlen(fullfname));
				strncat(fullfname, fname, sizeof(fullfname)-strlen(fullfname));
				load_module(fullfname, options);
			}
		}
		closedir(dirtype);
	}
	free(mdircpy);
#else
	PRINTERR("I don't know how to handle this.")
#endif
	return(DACT_MOD_OK);
}

int load_module (char *modulename, const unsigned char *options) {
	char modulefile[256], *tmpbuf, *mbuf, *mdircpy;
	void *mh=NULL;
	uint32_t algo_num, module_type=DACT_MOD_TYPE_COMP;
	uint32_t dc_ver=0, dc_req=0, dact_ver;
	char *dc_url_get=NULL, *dc_url_ver=NULL, *dc_sign=NULL;

	if (strchr(modulename,'/')==NULL) {
		mdircpy=parse_url_subst(moduledirectory, "");
		mbuf=mdircpy;
		while ((tmpbuf=strsep(&mbuf, ":"))) {
			snprintf(modulefile, sizeof(modulefile)-1, "%s/%s.so",tmpbuf,modulename);
			if ((mh=dlopen(modulefile, RTLD_GLOBAL|RTLD_NOW))!=NULL) break;
		}
		free(mdircpy);
	} else {
		strncpy(modulefile, modulename, sizeof(modulefile)-1);
		if ((mh=dlopen(modulefile, RTLD_GLOBAL|RTLD_NOW))==NULL) {
			PRINTERRF("Could not load module: %s", dlerror());
			return(DACT_MOD_FAIL);
		}
	}
	if (!mh) return(DACT_MOD_FAIL);

	if (dlsym(mh,"DC_NUM")==NULL \
	|| dlsym(mh, "DC_NAME")==NULL \
	|| dlsym(mh, "DC_ALGO")==NULL) {
		dact_ui_status(DACT_UI_LVL_SPEC, modulefile);
		dact_ui_status_append(DACT_UI_LVL_SPEC, " is not a dact module.");
		dlclose(mh);
		return(DACT_MOD_FAIL);
	}

	if (dlsym(mh, "DC_TYPE")!=NULL) {
		memcpy(&module_type,dlsym(mh,"DC_TYPE"),sizeof(module_type));
	}

	memcpy(&algo_num,dlsym(mh,"DC_NUM"),sizeof(algo_num));

	if (dlsym(mh, "DC_VER")!=NULL) memcpy(&dc_ver, dlsym(mh, "DC_VER"), sizeof(dc_ver));
	if (dlsym(mh, "DC_REQUIRE")!=NULL) memcpy(&dc_req, dlsym(mh, "DC_REQUIRE"), sizeof(dc_req));
	if (dlsym(mh, "DC_URL_GET")!=NULL) memcpy(&dc_url_get, dlsym(mh, "DC_URL_GET"), sizeof(dc_url_get));
	if (dlsym(mh, "DC_URL_VER")!=NULL) memcpy(&dc_url_ver, dlsym(mh, "DC_URL_VER"), sizeof(dc_url_ver));
	if (dlsym(mh, "DC_SIGN")!=NULL) memcpy(&dc_sign, dlsym(mh, "DC_SIGN"), sizeof(dc_sign));

	if (dc_url_get!=NULL && dc_url_ver!=NULL && dc_ver!=0 && modulename[0]!='/') {
		dact_upgrade_file(modulename, dc_url_get, dc_url_ver, dc_ver, NULL, options);
	}

	if (dc_req!=0) {
		dact_ver=(DACT_VER_MAJOR<<16)|(DACT_VER_MINOR<<8)|(DACT_VER_REVISION);
		switch (dc_req&0xff000000) {
			case DACT_MOD_REQ_ATLEAST:
				if (dact_ver<(dc_req&0xffffff)) {
					fprintf(stderr, "%s requires atleast DACT %i.%i.%i, this is DACT %i.%i.%i\n",modulefile,DACT_VER_PARTS(dc_req), DACT_VER_MAJOR, DACT_VER_MINOR, DACT_VER_REVISION);
					dlclose(mh);
					return(DACT_MOD_FAIL);
				}
				break;
			case DACT_MOD_REQ_EXACTLY:
				if ((dc_req&0xffffff)!=dact_ver) {
					fprintf(stderr, "%s requires DACT %i.%i.%i, this is DACT %i.%i.%i\n",modulefile, DACT_VER_PARTS(dc_req), DACT_VER_MAJOR, DACT_VER_MINOR, DACT_VER_REVISION);
					dlclose(mh);
					return(DACT_MOD_FAIL);
				}
				break;
			case DACT_MOD_REQ_ATMOST:
				if (dact_ver>(dc_req&0xffffff)) {
					fprintf(stderr, "%s requires atmost DACT %i.%i.%i, this is DACT %i.%i.%i\n",modulefile,DACT_VER_PARTS(dc_req), DACT_VER_MAJOR, DACT_VER_MINOR, DACT_VER_REVISION);
					dlclose(mh);
					return(DACT_MOD_FAIL);
				}
				break;
		}
	}



	if (modules_count<255) {
		modules[modules_count++]=mh;
	}

	switch (module_type) {
		case DACT_MOD_TYPE_COMP:

			if (algo_num>=((sizeof(algorithms))/(sizeof(*algorithms)))) return(DACT_MOD_FAIL);
			if (algorithms[algo_num]!=DACT_FAILED_ALGO && algorithms[algo_num]!=NULL) {
				dlclose(mh);
				return(DACT_MOD_FAIL);
			}

			memcpy(&algorithms[algo_num],dlsym(mh, "DC_ALGO"),sizeof(algorithms[0]));
			memcpy(&algorithm_names[algo_num],dlsym(mh,"DC_NAME"),sizeof(algorithm_names[0]));


			return(DACT_MOD_OK);
		case DACT_MOD_TYPE_ENC:
			if (algo_num>=CIPHER_COUNT) {
				printf("Encryption algorithm number too high, ignoring %i\n", algo_num);
				return(DACT_MOD_FAIL);
			}
			if (ciphers[algo_num]!=DACT_FAILED_ALGO && ciphers[algo_num]!=NULL) {
				return(DACT_MOD_FAIL);
			}
			memcpy(&ciphers[algo_num],dlsym(mh, "DC_ALGO"),sizeof(algorithms[0]));
			memcpy(&ciphers_name[algo_num],dlsym(mh, "DC_NAME"),sizeof(ciphers_name[0]));
			return(DACT_MOD_OK);
	}
	return(DACT_MOD_FAIL);
}
#else
char moduledirectory[2048] = ".";
void *modules[256];
int modules_initialized = 0;
int modules_count = 0;

int init_modules(void) { return(DACT_MOD_FAIL); }
int unload_modules(void) { return(DACT_MOD_FAIL); }
int load_module(char *modulename, const unsigned char *options) { return(DACT_MOD_FAIL); }
int load_modules_all(const unsigned char *options) { return(DACT_MOD_FAIL); }



#endif
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































































































































































































































































































































































































Deleted module.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
 * Copyright (C) 2001, 2002, and 2003  Roy Keene
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 *      email: dact@rkeene.org
 */

#ifndef _MODULE_H
#define _MODULE_H

#include "dact.h"

int init_modules (void);
int unload_modules (void);
int load_module (char *modulename, const unsigned char *options);
int load_modules_all(const unsigned char *options);

#define DACT_MOD_OK 0
#define DACT_MOD_FAIL (-1)

#define DACT_MOD_TYPE_COMP 0
#define DACT_MOD_TYPE_ENC 1

#define DACT_MOD_REQ_ATLEAST	(0x01000000)
#define DACT_MOD_REQ_EXACTLY	(0x02000000)
#define DACT_MOD_REQ_ATMOST	(0x03000000)

extern char moduledirectory[2048];
extern void *modules[256];
extern int modules_initialized;
extern int modules_count;

#endif/*_MODULE_H*/
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































Deleted sfx.c.

1
2
3
4
5
6
7
8
9
10
#include "dact.h"
#include "sfx.h"

ssize_t sfx_init_compress(int fd) {
	return(-1);
}

ssize_t sfx_init_decompress(int fd) {
	return(-1);
}
<
<
<
<
<
<
<
<
<
<




















Deleted sfx.h.

1
2
3
4
5
6
7
8
9
#ifndef _DACT_SFX_H
#define _DACT_SFX_H

#include "dact.h"

ssize_t sfx_init_compress(int fd);
ssize_t sfx_init_decompress(int fd);

#endif
<
<
<
<
<
<
<
<
<


















Deleted work/Makefile.

1
2
3
4
5
all:
	cd ../; make all

%:
	cd ../; make $@
<
<
<
<
<










Deleted work/comp_range/CVS/Entries.

1
2
3
4
5
6
7
8
/.cvsignore/1.1/Sat Sep 23 03:30:13 2000//
/qsmodel.c/1.2/Sat Sep 23 03:32:32 2000//
/qsmodel.h/1.1/Sat Sep 23 03:16:13 2000//
/rangecod.h/1.1/Sat Sep 23 03:16:13 2000//
/port.h/1.3/Mon Sep 25 18:14:28 2000//
/rangecod.c/1.4/Mon Sep 25 18:14:28 2000//
/Makefile.in/1.2/Fri Mar 23 07:33:46 2001//
D
<
<
<
<
<
<
<
<
















Deleted work/comp_range/CVS/Repository.

1
dact/comp_range
<


Deleted work/comp_range/CVS/Root.

1
:pserver:rkeene@cvs.saurik.com:/cvs/dact
<


Deleted work/dact-upgrade.sh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#! /bin/sh

MACHINE=`uname -m | sed s/"i.86"/"i386"/ | dd conv=lcase 2>/dev/null`
OS=`uname -s | dd conv=lcase 2>/dev/null`
FILE="http://www.rkeene.org/devel/dact/precompiled/dact-$MACHINE-$OS.bin"
LFILE="dact-$MACHINE-$OS.bin"
VERSION=http://www.rkeene.org/devel/dact/VERSION

if [ "$1" = "detcomp" ]; then
  echo $LFILE
  exit
fi

if [ "$1" = "define" ]; then
  MCRO=_`echo $2 | tr [a-z]\. [A-Z]_ | sed s/"_C$"/"_H"/`
  echo "#ifndef $MCRO"
  echo "#define $MCRO"
  echo "#include \"dact.h\""
  echo ""
  egrep '^ *(char|int|void|uint32_t|uint16_t|unsigned|signed).* .*(.*).* {$' $2  | sed s/" {$"/';'/
  echo "#endif"
  exit
fi

CURRDIR=`pwd`
DIR=/tmp
while [ -d $DIR ]; do
  DIR=/tmp/dact-$RANDOM
done
mkdir $DIR
if [ ! -d $DIR ]; then
  echo "Could not make directory for temporary storage."
  exit 1
fi
cd $DIR



if which lynx 2>/dev/null >/dev/null; then
  lynx -nostatus -dump $VERSION > VERSION 2>/dev/null
  CMD="lynx -nostatus -dump $FILE > $LFILE"
elif which wget 2>/dev/null >/dev/null; then
  wget -q $VERSION 2>/dev/null >/dev/null
  CMD="wget -q $FILE"
else
  echo "No appropriate way to download."
  echo "The file is at:"
  echo "$FILE"
  cd $CURRDIR
  rmdir $DIR
  exit 1
fi

CURR_VER=`dact -h 2>&1 | head -1 | sed s/\ version// | cut -f 2 -d \  | cut -f 1 -d -`
VER_MAJ=`cut VERSION -c 1-3|sed s/"^00\?"//`
VER_MIN=`cut VERSION -c 4-6|sed s/"^00\?"//`
VER_REV=`cut VERSION -c 7-9|sed s/"^00\?"//`
NEW_VER=`echo "$VER_MAJ.$VER_MIN.$VER_REV"`
if [ "$NEW_VER" = "$CURR_VER" ]; then
  echo "Would download same version."
  rm VERSION
  cd $CURRDIR
  rmdir $DIR
  exit 1
fi
echo "Do you really want to upgrade from DACT $CURR_VER to DACT $NEW_VER ?"
read YN
YN=`echo $YN | dd conv=ucase bs=1 count=1 2>/dev/null`
if [ ! "$YN" = "Y" ]; then
  rm VERSION
  cd $CURRDIR
  rmdir $DIR
  exit
fi

eval $CMD

if [ -f $LFILE ]; then
 if head -2 $LFILE | grep "Not Found" 2>/dev/null >/dev/null; then
   rm $LFILE
 fi 
fi

if [ ! -f $LFILE ]; then
  echo "Unable to find an appropriate precompiled binary for a $MACHINE running $OS"
  echo "Contact Roy Keene <rkeene@rkeene.org> if you need further assistance."
  echo "The latest dact source can be found at:"
  echo "http://www.rkeene.org/devel/dact.tar.gz"
  rmdir $DIR
  cd $CURRDIR
  exit 1
fi

chmod 0755 $LFILE

ID=`id | cut -f 2 -d = | cut -f 1 -d "("`
if [ $ID = 0 ]; then
  cp $LFILE /usr/local/bin
  cat /usr/local/bin/dact > /usr/local/bin/dact.old 2>/dev/null
  rm -f /usr/local/bin/dact
  ln -s /usr/local/bin/$LFILE /usr/local/bin/dact
  chown root /usr/local/bin/dact.old /usr/local/bin/$LFILE
  chgrp root /usr/local/bin/dact.old /usr/local/bin/$LFILE
  chmod 0755  /usr/local/bin/dact.old /usr/local/bin/$LFILE
else
  mkdir $HOME/.dact/ 2>/dev/null >/dev/null
  cp $LFILE $HOME/.dact/dact.bin
fi

rm $LFILE
rm VERSION
cd $CURRDIR
rmdir $DIR
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































Deleted work/test.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "crc.h"

int main(int argc, char **argv) {
	uint32_t crcval=0;
	int fd;
	char *buf;
	int buflen=1024;
	int x;

	buflen=atoi(argv[1]);
	buf=malloc(buflen);
	fd=open(argv[2], O_RDONLY);
	while (1) {
		x=read(fd, buf, buflen);
		if (x<=0) break;
		crcval=crc(crcval, buf, x);
	}
	printf("adler32=%08x\n", crcval);
	return(0);
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































Deleted work/warnings.txt.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
make[1]: Entering directory `/home/rkeene/devel/dact'
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o comp_snibble.o comp_snibble.c
comp_snibble.c: In function `comp_snibble_compress':
comp_snibble.c:80: warning: `static' is not at beginning of declaration
comp_snibble.c:81: warning: `static' is not at beginning of declaration
comp_snibble.c:78: warning: unused parameter `prev_block'
comp_snibble.c: In function `comp_snibble_decompress':
comp_snibble.c:129: warning: `static' is not at beginning of declaration
comp_snibble.c:148: warning: comparison between signed and unsigned
comp_snibble.c:128: warning: unused parameter `prev_block'
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o comp_delta.o comp_delta.c
comp_delta.c: In function `comp_delta_compress':
comp_delta.c:90: warning: comparison between signed and unsigned
comp_delta.c:67: warning: unused parameter `prev_block'
comp_delta.c: In function `comp_delta_decompress':
comp_delta.c:102: warning: unused parameter `prev_block'
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o comp_text.o comp_text.c
comp_text.c: In function `comp_text_compress':
comp_text.c:68: warning: unused parameter `prev_block'
comp_text.c: In function `comp_text_decompress':
comp_text.c:137: warning: comparison between signed and unsigned
comp_text.c:115: warning: unused parameter `prev_block'
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o comp_rle.o comp_rle.c
comp_rle.c: In function `comp_rle_compress':
comp_rle.c:69: warning: unused parameter `prev_block'
comp_rle.c: In function `comp_rle_decompress':
comp_rle.c:120: warning: comparison between signed and unsigned
comp_rle.c:109: warning: unused parameter `prev_block'
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o cipher_chaos.o cipher_chaos.c
cipher_chaos.c: In function `cipher_chaos_init_getkey':
cipher_chaos.c:79: warning: unused parameter `mode'
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o cipher_sub.o cipher_sub.c
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o cipher_psub.o cipher_psub.c
cipher_psub.c: In function `cipher_psub_init_getkey':
cipher_psub.c:78: warning: unused parameter `mode'
cipher_psub.c: In function `cipher_psub_generatekey':
cipher_psub.c:100: warning: comparison between signed and unsigned
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o comp_lzoox.o comp_lzoox.c
comp_lzoox.c: In function `comp_lzoox_compress':
comp_lzoox.c:74: warning: unused parameter `prev_block'
comp_lzoox.c: In function `comp_lzoox_decompress':
comp_lzoox.c:85: warning: unused parameter `prev_block'
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o comp_lzooy.o comp_lzooy.c
comp_lzooy.c: In function `comp_lzooy_compress':
comp_lzooy.c:74: warning: unused parameter `prev_block'
comp_lzooy.c: In function `comp_lzooy_decompress':
comp_lzooy.c:85: warning: unused parameter `prev_block'
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o comp_lzota.o comp_lzota.c
comp_lzota.c: In function `comp_lzota_compress':
comp_lzota.c:74: warning: unused parameter `prev_block'
comp_lzota.c: In function `comp_lzota_decompress':
comp_lzota.c:85: warning: unused parameter `prev_block'
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o comp_bzlib.o comp_bzlib.c
comp_bzlib.c: In function `comp_bzlib_compress':
comp_bzlib.c:72: warning: unused parameter `prev_block'
comp_bzlib.c: In function `comp_bzlib_decompress':
comp_bzlib.c:90: warning: unused parameter `prev_block'
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o comp_zlib.o comp_zlib.c
comp_zlib.c: In function `comp_zlib_compress':
comp_zlib.c:79: warning: unused parameter `prev_block'
comp_zlib.c: In function `comp_zlib_decompress':
comp_zlib.c:97: warning: unused parameter `prev_block'
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o comp_mzlib.o comp_mzlib.c
comp_mzlib.c: In function `comp_mzlib_compress':
comp_mzlib.c:72: warning: unused parameter `prev_block'
comp_mzlib.c: In function `comp_mzlib_decompress':
comp_mzlib.c:123: warning: comparison between signed and unsigned
comp_mzlib.c:112: warning: unused parameter `prev_block'
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o comp_mzlib2.o comp_mzlib2.c
comp_mzlib2.c: In function `comp_mzlib2_algo':
comp_mzlib2.c:89: warning: unused parameter `mode'
comp_mzlib2.c:89: warning: unused parameter `prev_block'
comp_mzlib2.c:89: warning: unused parameter `curr_block'
comp_mzlib2.c:89: warning: unused parameter `out_block'
comp_mzlib2.c:89: warning: unused parameter `blk_size'
comp_mzlib2.c: In function `comp_mzlib2_compress':
comp_mzlib2.c:122: warning: comparison between signed and unsigned
comp_mzlib2.c:145: warning: comparison between signed and unsigned
comp_mzlib2.c:94: warning: unused parameter `prev_block'
comp_mzlib2.c: In function `comp_mzlib2_decompress':
comp_mzlib2.c:193: warning: comparison between signed and unsigned
comp_mzlib2.c:197: warning: comparison between signed and unsigned
comp_mzlib2.c:177: warning: unused parameter `prev_block'
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o comp_bitsums.o comp_bitsums.c
comp_bitsums.c: In function `comp_bitsums_compress':
comp_bitsums.c:66: warning: unused parameter `prev_block'
comp_bitsums.c:66: warning: unused parameter `curr_block'
comp_bitsums.c:66: warning: unused parameter `out_block'
comp_bitsums.c:66: warning: unused parameter `blk_size'
comp_bitsums.c: In function `comp_bitsums_decompress':
comp_bitsums.c:70: warning: unused parameter `prev_block'
comp_bitsums.c:70: warning: unused parameter `curr_block'
comp_bitsums.c:70: warning: unused parameter `out_block'
comp_bitsums.c:70: warning: unused parameter `blk_size'
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o comp_factor.o comp_factor.c
comp_factor.c: In function `comp_factor_compress':
comp_factor.c:62: warning: unused parameter `prev_block'
comp_factor.c:62: warning: unused parameter `curr_block'
comp_factor.c:62: warning: unused parameter `out_block'
comp_factor.c:62: warning: unused parameter `blk_size'
comp_factor.c: In function `comp_factor_decompress':
comp_factor.c:66: warning: unused parameter `prev_block'
comp_factor.c:66: warning: unused parameter `curr_block'
comp_factor.c:66: warning: unused parameter `out_block'
comp_factor.c:66: warning: unused parameter `blk_size'
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o comp_textrle.o comp_textrle.c
comp_textrle.c: In function `comp_textrle_compress':
comp_textrle.c:65: warning: unused variable `m'
comp_textrle.c:67: warning: unused variable `currchar'
comp_textrle.c:67: warning: unused variable `prevchar'
comp_textrle.c:68: warning: unused variable `charcnt'
comp_textrle.c:64: warning: unused parameter `prev_block'
comp_textrle.c: In function `comp_textrle_decompress':
comp_textrle.c:101: warning: comparison between signed and unsigned
comp_textrle.c:90: warning: unused parameter `prev_block'
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o dact_common.o dact_common.c
dact_common.c: In function `dact_blk_decompress':
dact_common.c:149: warning: unused parameter `options'
dact_common.c: In function `dact_blk_compress':
dact_common.c:186: warning: comparison between signed and unsigned
dact_common.c:186: warning: comparison between signed and unsigned
dact_common.c:196: warning: comparison between signed and unsigned
dact_common.c:196: warning: comparison between signed and unsigned
dact_common.c:222: warning: comparison between signed and unsigned
dact_common.c: In function `dact_process_file':
dact_common.c:285: warning: comparison between signed and unsigned
dact_common.c:333: warning: comparison between signed and unsigned
dact_common.c:349: warning: comparison of unsigned expression < 0 is always false
dact_common.c:478: warning: comparison between signed and unsigned
dact_common.c:740: warning: comparison between signed and unsigned
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o comp_fail.o comp_fail.c
comp_fail.c: In function `comp_fail_compress':
comp_fail.c:62: warning: unused parameter `prev_block'
comp_fail.c:62: warning: unused parameter `curr_block'
comp_fail.c:62: warning: unused parameter `out_block'
comp_fail.c:62: warning: unused parameter `blk_size'
comp_fail.c: In function `comp_fail_decompress':
comp_fail.c:66: warning: unused parameter `prev_block'
comp_fail.c:66: warning: unused parameter `curr_block'
comp_fail.c:66: warning: unused parameter `out_block'
comp_fail.c:66: warning: unused parameter `blk_size'
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o comp_plain.o comp_plain.c
comp_plain.c: In function `comp_plain_compress':
comp_plain.c:68: warning: unused parameter `prev_block'
comp_plain.c: In function `comp_plain_decompress':
comp_plain.c:73: warning: unused parameter `prev_block'
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o buffer.o buffer.c
buffer.c: In function `byte_buffer_purge':
buffer.c:176: warning: comparison between signed and unsigned
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o header.o header.c
header.c: In function `dact_hdr_ext_regn':
header.c:69: warning: comparison between signed and unsigned
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o sort.o sort.c
sort.c: In function `int_sort_really_fast':
sort.c:134: warning: comparison between signed and unsigned
sort.c:126: warning: unused parameter `mode'
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o dact.o dact.c
dact.c: In function `print_help':
dact.c:74: warning: unused parameter `argc'
dact.c: In function `dact_upgrade_file':
dact.c:131: warning: comparison between signed and unsigned
dact.c: In function `dact_process_other':
dact.c:425: warning: unused parameter `options'
dact.c: In function `main':
dact.c:524: warning: unused variable `dact_binfilebuf'
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o module.o module.c
module.c: In function `load_module':
module.c:229: warning: unused parameter `modulename'
module.c:229: warning: unused parameter `options'
module.c: In function `load_modules_all':
module.c:230: warning: unused parameter `options'
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o parse.o parse.c
parse.c: In function `parse_url':
parse.c:92: warning: comparison between signed and unsigned
parse.c: In function `demime64':
parse.c:439: warning: comparison between signed and unsigned
parse.c: In function `read_f':
parse.c:456: warning: comparison between signed and unsigned
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o dendian.o dendian.c
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o crc.o crc.c
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o net.o net.c
net.c: In function `createlisten':
net.c:331: warning: unused parameter `port'
net.c: In function `closeconnection':
net.c:332: warning: unused parameter `sockfd'
net.c: In function `createconnection_tcp':
net.c:333: warning: unused parameter `host'
net.c:333: warning: unused parameter `port'
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o ui.o ui.c
ui.c: In function `dact_ui_optmanip':
ui.c:125: warning: comparison between signed and unsigned
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o strsep.o strsep.c
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o getpass.o getpass.c
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o mkstemp.o mkstemp.c
i586-mingw32msvc-gcc comp_snibble.o comp_delta.o comp_text.o comp_rle.o cipher_chaos.o cipher_sub.o cipher_psub.o comp_lzoox.o comp_lzooy.o comp_lzota.o comp_bzlib.o comp_zlib.o comp_mzlib.o comp_mzlib2.o  comp_bitsums.o comp_factor.o comp_textrle.o  dact_common.o comp_fail.o comp_plain.o buffer.o header.o sort.o dact.o module.o parse.o dendian.o crc.o net.o ui.o  strsep.o getpass.o mkstemp.o -L/home/rkeene//root/windows-i386/lib  -lbz2 -lz  -lbz2 -lz  -lm  -llzo  -o dact.exe
i586-mingw32msvc-gcc -I/home/rkeene//root/windows-i386/include -Wall -DHAVE_CONFIG_H -DDACT_CONFIG_FILE=\"c:/dact//etc/dact.conf\" -DEXEEXT=\".exe\" -W -Wall -I/home/rkeene//root/windows-i386/include  -c -o libdact.o libdact.c
i586-mingw32msvc-ar rcu libdact.a comp_snibble.o comp_delta.o comp_text.o comp_rle.o cipher_chaos.o cipher_sub.o cipher_psub.o comp_lzoox.o comp_lzooy.o comp_lzota.o comp_bzlib.o comp_zlib.o comp_mzlib.o comp_mzlib2.o comp_bitsums.o comp_factor.o comp_textrle.o dact_common.o comp_fail.o comp_plain.o buffer.o header.o sort.o module.o parse.o dendian.o crc.o net.o ui.o strsep.o getpass.o mkstemp.o libdact.o
i586-mingw32msvc-ranlib libdact.a
make[1]: `dact.conf' is up to date.
make[1]: Leaving directory `/home/rkeene/devel/dact'
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































































































































































































































































































































Deleted work/win32-errors.txt.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
--------------------Configuration: dact - Win32 Debug--------------------
Compiling...
cipher_chaos.c
c:\temp\rsk13\dact-0.8.11\cipher_chaos.c(75) : warning C4101: 'b' : unreferenced local variable
cipher_psub.c
c:\temp\rsk13\dact-0.8.11\cipher_psub.c(75) : warning C4018: '<' : signed/unsigned mismatch
cipher_serpent.c
cipher_sub.c
c:\temp\rsk13\dact-0.8.11\cipher_sub.c(72) : warning C4013: 'open' undefined; assuming extern returning int
c:\temp\rsk13\dact-0.8.11\cipher_sub.c(74) : warning C4013: 'read' undefined; assuming extern returning int
c:\temp\rsk13\dact-0.8.11\cipher_sub.c(81) : warning C4013: 'close' undefined; assuming extern returning int
c:\temp\rsk13\dact-0.8.11\cipher_sub.c(89) : warning C4013: 'write' undefined; assuming extern returning int
comp_bitsums.c
comp_bzlib.c
comp_delta.c
c:\temp\rsk13\dact-0.8.11\comp_delta.c(91) : warning C4018: '>=' : signed/unsigned mismatch
comp_factor.c
comp_fail.c
comp_mzlib.c
comp_mzlib2.c
comp_plain.c
comp_rle.c
c:\temp\rsk13\dact-0.8.11\comp_rle.c(111) : warning C4018: '>' : signed/unsigned mismatch
comp_snibble.c
c:\temp\rsk13\dact-0.8.11\comp_snibble.c(142) : warning C4018: '<=' : signed/unsigned mismatch
comp_split.c
c:\temp\rsk13\dact-0.8.11\comp_split.c(62) : warning C4244: '=' : conversion from 'double ' to 'int ', possible loss of data
comp_text.c
c:\temp\rsk13\dact-0.8.11\comp_text.c(131) : warning C4018: '>=' : signed/unsigned mismatch
comp_textrle.c
c:\temp\rsk13\dact-0.8.11\comp_textrle.c(63) : warning C4101: 'prevchar' : unreferenced local variable
c:\temp\rsk13\dact-0.8.11\comp_textrle.c(61) : warning C4101: 'm' : unreferenced local variable
c:\temp\rsk13\dact-0.8.11\comp_textrle.c(97) : warning C4018: '>' : signed/unsigned mismatch
comp_zlib.c
crc.c
dact.c
c:\temp\rsk13\dact-0.8.11\dact.c(235) : warning C4003: not enough actual parameters for macro 'open_net'
c:\temp\rsk13\dact-0.8.11\dact.c(235) : warning C4013: 'open' undefined; assuming extern returning int
c:\temp\rsk13\dact-0.8.11\dact.c(235) : error C2059: syntax error : ')'
c:\temp\rsk13\dact-0.8.11\dact.c(235) : error C2143: syntax error : missing ';' before ')'
c:\temp\rsk13\dact-0.8.11\dact.c(235) : error C2059: syntax error : ')'
c:\temp\rsk13\dact-0.8.11\dact.c(240) : warning C4013: 'write' undefined; assuming extern returning int
c:\temp\rsk13\dact-0.8.11\dact.c(240) : error C2065: 'STDERR_FILENO' : undeclared identifier
c:\temp\rsk13\dact-0.8.11\dact.c(244) : warning C4013: 'close' undefined; assuming extern returning int
c:\temp\rsk13\dact-0.8.11\dact.c(252) : error C2143: syntax error : missing ')' before '('
c:\temp\rsk13\dact-0.8.11\dact.c(252) : error C2143: syntax error : missing ')' before 'string'
c:\temp\rsk13\dact-0.8.11\dact.c(252) : error C2091: function returns function
c:\temp\rsk13\dact-0.8.11\dact.c(252) : error C2143: syntax error : missing '{' before 'string'
c:\temp\rsk13\dact-0.8.11\dact.c(252) : error C2059: syntax error : '<Unknown>'
c:\temp\rsk13\dact-0.8.11\dact.c(252) : error C2059: syntax error : ')'
c:\temp\rsk13\dact-0.8.11\dact.c(253) : error C2059: syntax error : ','
c:\temp\rsk13\dact-0.8.11\dact.c(253) : error C2143: syntax error : missing ')' before 'string'
c:\temp\rsk13\dact-0.8.11\dact.c(253) : error C2143: syntax error : missing '{' before 'string'
c:\temp\rsk13\dact-0.8.11\dact.c(253) : error C2059: syntax error : '<Unknown>'
c:\temp\rsk13\dact-0.8.11\dact.c(254) : error C2059: syntax error : ','
c:\temp\rsk13\dact-0.8.11\dact.c(254) : error C2143: syntax error : missing ')' before 'constant'
c:\temp\rsk13\dact-0.8.11\dact.c(254) : error C2143: syntax error : missing '{' before 'constant'
c:\temp\rsk13\dact-0.8.11\dact.c(254) : error C2059: syntax error : '<Unknown>'
c:\temp\rsk13\dact-0.8.11\dact.c(254) : error C2059: syntax error : ')'
c:\temp\rsk13\dact-0.8.11\dact.c(255) : error C2059: syntax error : ','
c:\temp\rsk13\dact-0.8.11\dact.c(255) : error C2143: syntax error : missing ')' before 'string'
c:\temp\rsk13\dact-0.8.11\dact.c(255) : error C2143: syntax error : missing '{' before 'string'
c:\temp\rsk13\dact-0.8.11\dact.c(255) : error C2059: syntax error : '<Unknown>'
c:\temp\rsk13\dact-0.8.11\dact.c(257) : error C2099: initializer is not a constant
c:\temp\rsk13\dact-0.8.11\dact.c(258) : error C2059: syntax error : 'if'
c:\temp\rsk13\dact-0.8.11\dact.c(258) : error C2059: syntax error : ')'
c:\temp\rsk13\dact-0.8.11\dact.c(258) : error C2059: syntax error : '<'
c:\temp\rsk13\dact-0.8.11\dact.c(258) : error C2059: syntax error : ')'
c:\temp\rsk13\dact-0.8.11\dact.c(259) : error C2059: syntax error : 'if'
c:\temp\rsk13\dact-0.8.11\dact.c(259) : warning C4003: not enough actual parameters for macro 'open_net'
c:\temp\rsk13\dact-0.8.11\dact.c(259) : error C2059: syntax error : ')'
c:\temp\rsk13\dact-0.8.11\dact.c(259) : error C2059: syntax error : '<'
c:\temp\rsk13\dact-0.8.11\dact.c(259) : error C2059: syntax error : ')'
c:\temp\rsk13\dact-0.8.11\dact.c(260) : error C2059: syntax error : 'if'
c:\temp\rsk13\dact-0.8.11\dact.c(269) : error C2059: syntax error : 'if'
c:\temp\rsk13\dact-0.8.11\dact.c(272) : error C2059: syntax error : 'return'
c:\temp\rsk13\dact-0.8.11\dact.c(273) : error C2059: syntax error : '}'
c:\temp\rsk13\dact-0.8.11\dact.c(385) : warning C4013: 'mkstemp' undefined; assuming extern returning int
c:\temp\rsk13\dact-0.8.11\dact.c(562) : warning C4244: 'function' : conversion from 'double ' to 'unsigned int ', possible loss of data
c:\temp\rsk13\dact-0.8.11\dact.c(585) : warning C4018: '<' : signed/unsigned mismatch
c:\temp\rsk13\dact-0.8.11\dact.c(633) : warning C4018: '!=' : signed/unsigned mismatch
c:\temp\rsk13\dact-0.8.11\dact.c(691) : warning C4013: 'read' undefined; assuming extern returning int
c:\temp\rsk13\dact-0.8.11\dact.c(778) : warning C4018: '<' : signed/unsigned mismatch
c:\temp\rsk13\dact-0.8.11\dact.c(781) : warning C4003: not enough actual parameters for macro 'open_net'
c:\temp\rsk13\dact-0.8.11\dact.c(781) : error C2059: syntax error : ')'
c:\temp\rsk13\dact-0.8.11\dact.c(781) : error C2143: syntax error : missing ';' before ')'
c:\temp\rsk13\dact-0.8.11\dact.c(781) : error C2059: syntax error : ')'
c:\temp\rsk13\dact-0.8.11\dact.c(933) : error C2059: syntax error : 'if'
c:\temp\rsk13\dact-0.8.11\dact.c(1043) : warning C4003: not enough actual parameters for macro 'open_net'
c:\temp\rsk13\dact-0.8.11\dact.c(1058) : error C2059: syntax error : 'return'
c:\temp\rsk13\dact-0.8.11\dact.c(1059) : error C2059: syntax error : '}'
c:\temp\rsk13\dact-0.8.11\dact.c(1267) : warning C4003: not enough actual parameters for macro 'open_net'
dendian.c
c:\temp\rsk13\dact-0.8.11\dendian.c(39) : warning C4013: 'write' undefined; assuming extern returning int
c:\temp\rsk13\dact-0.8.11\dendian.c(56) : warning C4013: 'read' undefined; assuming extern returning int
header.c
c:\temp\rsk13\dact-0.8.11\header.c(65) : warning C4018: '<' : signed/unsigned mismatch
module.c
net.c
c:\temp\rsk13\dact-0.8.11\net.c(311) : error C2061: syntax error : identifier 'lseek_net'
c:\temp\rsk13\dact-0.8.11\net.c(311) : error C2059: syntax error : ';'
c:\temp\rsk13\dact-0.8.11\net.c(311) : error C2059: syntax error : 'type'
parse.c
c:\temp\rsk13\dact-0.8.11\parse.c(25) : fatal error C1083: Cannot open include file: 'sys/utsname.h': No such file or directory
sort.c
c:\temp\rsk13\dact-0.8.11\sort.c(130) : warning C4018: '<' : signed/unsigned mismatch
ui.c
c:\temp\rsk13\dact-0.8.11\ui.c(164) : warning C4013: 'getpass' undefined; assuming extern returning int
c:\temp\rsk13\dact-0.8.11\ui.c(164) : warning C4047: '=' : 'char *' differs in levels of indirection from 'int '
buffer.c
c:\temp\rsk13\dact-0.8.11\buffer.c(174) : warning C4018: '<' : signed/unsigned mismatch
Error executing cl.exe.

dact.exe - 46 error(s), 35 warning(s)

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