tnef 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/tnef/AUTHORS +7 -0
- data/ext/tnef/BUGS.in +5 -0
- data/ext/tnef/COPYING +340 -0
- data/ext/tnef/ChangeLog +1550 -0
- data/ext/tnef/INSTALL +234 -0
- data/ext/tnef/Makefile.am +7 -0
- data/ext/tnef/Makefile.in +699 -0
- data/ext/tnef/NEWS +177 -0
- data/ext/tnef/README +39 -0
- data/ext/tnef/THANKS +1 -0
- data/ext/tnef/TODO +7 -0
- data/ext/tnef/acinclude.m4 +47 -0
- data/ext/tnef/aclocal.m4 +1012 -0
- data/ext/tnef/configure +6815 -0
- data/ext/tnef/configure.in +67 -0
- data/ext/tnef/depcomp +584 -0
- data/ext/tnef/doc/FAQ +25 -0
- data/ext/tnef/doc/Makefile.am +6 -0
- data/ext/tnef/doc/Makefile.in +623 -0
- data/ext/tnef/doc/file-format.tex +139 -0
- data/ext/tnef/doc/tnef.1.in +183 -0
- data/ext/tnef/doc/www/Makefile.am +14 -0
- data/ext/tnef/doc/www/Makefile.in +542 -0
- data/ext/tnef/doc/www/cgi-bin/Makefile.am +14 -0
- data/ext/tnef/doc/www/cgi-bin/Makefile.in +340 -0
- data/ext/tnef/doc/www/htdocs/Makefile.am +14 -0
- data/ext/tnef/doc/www/htdocs/Makefile.in +340 -0
- data/ext/tnef/extconf.rb +3 -0
- data/ext/tnef/install-sh +507 -0
- data/ext/tnef/missing +367 -0
- data/ext/tnef/mkinstalldirs +161 -0
- data/ext/tnef/src/Makefile.am +48 -0
- data/ext/tnef/src/Makefile.in +700 -0
- data/ext/tnef/src/alloc.c +107 -0
- data/ext/tnef/src/alloc.h +54 -0
- data/ext/tnef/src/attr.c +270 -0
- data/ext/tnef/src/attr.h +74 -0
- data/ext/tnef/src/common.h +101 -0
- data/ext/tnef/src/config.h.in +111 -0
- data/ext/tnef/src/date.c +66 -0
- data/ext/tnef/src/date.h +43 -0
- data/ext/tnef/src/debug.c +45 -0
- data/ext/tnef/src/debug.h +32 -0
- data/ext/tnef/src/file.c +259 -0
- data/ext/tnef/src/file.h +48 -0
- data/ext/tnef/src/main.c +386 -0
- data/ext/tnef/src/mapi-names.data +430 -0
- data/ext/tnef/src/mapi-types.data +19 -0
- data/ext/tnef/src/mapi_attr.c +419 -0
- data/ext/tnef/src/mapi_attr.h +78 -0
- data/ext/tnef/src/mkdata.awk +100 -0
- data/ext/tnef/src/options.c +32 -0
- data/ext/tnef/src/options.h +67 -0
- data/ext/tnef/src/path.c +397 -0
- data/ext/tnef/src/path.h +34 -0
- data/ext/tnef/src/replace/Makefile.am +8 -0
- data/ext/tnef/src/replace/Makefile.in +435 -0
- data/ext/tnef/src/replace/basename.c +45 -0
- data/ext/tnef/src/replace/dummy.c +7 -0
- data/ext/tnef/src/replace/getopt_long.c +940 -0
- data/ext/tnef/src/replace/getopt_long.h +141 -0
- data/ext/tnef/src/replace/malloc.c +41 -0
- data/ext/tnef/src/replace/strdup.c +51 -0
- data/ext/tnef/src/rtf.c +362 -0
- data/ext/tnef/src/rtf.h +36 -0
- data/ext/tnef/src/tnef-names.data +34 -0
- data/ext/tnef/src/tnef-types.data +12 -0
- data/ext/tnef/src/tnef.c +396 -0
- data/ext/tnef/src/tnef.h +45 -0
- data/ext/tnef/src/util.c +112 -0
- data/ext/tnef/src/util.h +42 -0
- data/ext/tnef/src/write.c +136 -0
- data/ext/tnef/src/write.h +25 -0
- data/ext/tnef/src/xstrdup.c +41 -0
- data/ext/tnef/tests/Makefile.am +4 -0
- data/ext/tnef/tests/Makefile.in +530 -0
- data/ext/tnef/tests/cmdline/AUTHORS +8 -0
- data/ext/tnef/tests/cmdline/AUTHORS.baseline +8 -0
- data/ext/tnef/tests/cmdline/Makefile.am +33 -0
- data/ext/tnef/tests/cmdline/Makefile.in +455 -0
- data/ext/tnef/tests/cmdline/basic.baseline +4 -0
- data/ext/tnef/tests/cmdline/basic.test +39 -0
- data/ext/tnef/tests/cmdline/body-test.html.baseline +95 -0
- data/ext/tnef/tests/cmdline/body.baseline +929 -0
- data/ext/tnef/tests/cmdline/body.test +55 -0
- data/ext/tnef/tests/cmdline/debug.baseline +155 -0
- data/ext/tnef/tests/cmdline/debug.test +14 -0
- data/ext/tnef/tests/cmdline/directory.baseline +3 -0
- data/ext/tnef/tests/cmdline/directory.test +35 -0
- data/ext/tnef/tests/cmdline/help.baseline +63 -0
- data/ext/tnef/tests/cmdline/help.test +12 -0
- data/ext/tnef/tests/cmdline/interactive.test +5 -0
- data/ext/tnef/tests/cmdline/list.baseline +5 -0
- data/ext/tnef/tests/cmdline/list.test +21 -0
- data/ext/tnef/tests/cmdline/maxsize.baseline +828 -0
- data/ext/tnef/tests/cmdline/maxsize.test +43 -0
- data/ext/tnef/tests/cmdline/message.html.baseline +95 -0
- data/ext/tnef/tests/cmdline/mime-types.baseline +3 -0
- data/ext/tnef/tests/cmdline/mime-types.test +11 -0
- data/ext/tnef/tests/cmdline/overwrite.baseline +8 -0
- data/ext/tnef/tests/cmdline/overwrite.test +40 -0
- data/ext/tnef/tests/cmdline/rtf-test.rtf.baseline +0 -0
- data/ext/tnef/tests/cmdline/stdin.baseline +2 -0
- data/ext/tnef/tests/cmdline/stdin.test +18 -0
- data/ext/tnef/tests/cmdline/test.tnef +0 -0
- data/ext/tnef/tests/cmdline/triples-test-2.rtf.baseline +0 -0
- data/ext/tnef/tests/cmdline/triples-test-2.txt.baseline +0 -0
- data/ext/tnef/tests/cmdline/triples-test.txt.baseline +0 -0
- data/ext/tnef/tests/cmdline/use-path.baseline +0 -0
- data/ext/tnef/tests/cmdline/use-path.test +5 -0
- data/ext/tnef/tests/cmdline/verbose.baseline +5 -0
- data/ext/tnef/tests/cmdline/verbose.test +19 -0
- data/ext/tnef/tests/cmdline/version.baseline +17 -0
- data/ext/tnef/tests/cmdline/version.test +14 -0
- data/ext/tnef/tests/files/MAPI_ATTACH_DATA_OBJ.test +9 -0
- data/ext/tnef/tests/files/MAPI_OBJECT.test +9 -0
- data/ext/tnef/tests/files/Makefile.am +16 -0
- data/ext/tnef/tests/files/Makefile.in +636 -0
- data/ext/tnef/tests/files/baselines/AUTHORS.baseline +8 -0
- data/ext/tnef/tests/files/baselines/AUTOEXEC.BAT.baseline +0 -0
- data/ext/tnef/tests/files/baselines/CONFIG.SYS.baseline +0 -0
- data/ext/tnef/tests/files/baselines/MAPI_ATTACH_DATA_OBJ-body.rtf.baseline +0 -0
- data/ext/tnef/tests/files/baselines/MAPI_ATTACH_DATA_OBJ.baseline +229 -0
- data/ext/tnef/tests/files/baselines/MAPI_OBJECT-body.rtf.baseline +0 -0
- data/ext/tnef/tests/files/baselines/MAPI_OBJECT.baseline +153 -0
- data/ext/tnef/tests/files/baselines/Makefile.am +35 -0
- data/ext/tnef/tests/files/baselines/Makefile.in +361 -0
- data/ext/tnef/tests/files/baselines/README.baseline +31 -0
- data/ext/tnef/tests/files/baselines/TechlibDEC99-JAN00.doc.baseline +0 -0
- data/ext/tnef/tests/files/baselines/TechlibDEC99.doc.baseline +0 -0
- data/ext/tnef/tests/files/baselines/TechlibNOV99.doc.baseline +0 -0
- data/ext/tnef/tests/files/baselines/Untitled_Attachment.baseline +0 -0
- data/ext/tnef/tests/files/baselines/VIA_Nytt_1402.doc.baseline +0 -0
- data/ext/tnef/tests/files/baselines/VIA_Nytt_1402.pdf.baseline +0 -0
- data/ext/tnef/tests/files/baselines/VIA_Nytt_14021.htm.baseline +1914 -0
- data/ext/tnef/tests/files/baselines/body-body.html.baseline +95 -0
- data/ext/tnef/tests/files/baselines/body.baseline +124 -0
- data/ext/tnef/tests/files/baselines/boot.ini.baseline +6 -0
- data/ext/tnef/tests/files/baselines/data-before-name-body.rtf.baseline +0 -0
- data/ext/tnef/tests/files/baselines/data-before-name.baseline +213 -0
- data/ext/tnef/tests/files/baselines/garbage-at-end.baseline +73 -0
- data/ext/tnef/tests/files/baselines/generpts.src.baseline +1691 -0
- data/ext/tnef/tests/files/baselines/long-filename-body.rtf.baseline +26 -0
- data/ext/tnef/tests/files/baselines/long-filename.baseline +218 -0
- data/ext/tnef/tests/files/baselines/message.rtf.baseline +0 -0
- data/ext/tnef/tests/files/baselines/missing-filenames-body.rtf.baseline +20 -0
- data/ext/tnef/tests/files/baselines/missing-filenames.baseline +252 -0
- data/ext/tnef/tests/files/baselines/multi-name-property.baseline +243 -0
- data/ext/tnef/tests/files/baselines/one-file.baseline +155 -0
- data/ext/tnef/tests/files/baselines/rtf-body.rtf.baseline +0 -0
- data/ext/tnef/tests/files/baselines/rtf.baseline +167 -0
- data/ext/tnef/tests/files/baselines/triples-body.rtf.baseline +0 -0
- data/ext/tnef/tests/files/baselines/triples.baseline +254 -0
- data/ext/tnef/tests/files/baselines/two-files.baseline +186 -0
- data/ext/tnef/tests/files/body.test +9 -0
- data/ext/tnef/tests/files/data-before-name.test +9 -0
- data/ext/tnef/tests/files/datafiles/MAPI_ATTACH_DATA_OBJ.list +4 -0
- data/ext/tnef/tests/files/datafiles/MAPI_ATTACH_DATA_OBJ.tnef +0 -0
- data/ext/tnef/tests/files/datafiles/MAPI_OBJECT.list +2 -0
- data/ext/tnef/tests/files/datafiles/MAPI_OBJECT.tnef +0 -0
- data/ext/tnef/tests/files/datafiles/Makefile.am +27 -0
- data/ext/tnef/tests/files/datafiles/Makefile.in +351 -0
- data/ext/tnef/tests/files/datafiles/body.list +1 -0
- data/ext/tnef/tests/files/datafiles/body.tnef +0 -0
- data/ext/tnef/tests/files/datafiles/data-before-name.list +4 -0
- data/ext/tnef/tests/files/datafiles/data-before-name.tnef +0 -0
- data/ext/tnef/tests/files/datafiles/garbage-at-end.list +0 -0
- data/ext/tnef/tests/files/datafiles/garbage-at-end.tnef +0 -0
- data/ext/tnef/tests/files/datafiles/long-filename.list +1 -0
- data/ext/tnef/tests/files/datafiles/long-filename.tnef +0 -0
- data/ext/tnef/tests/files/datafiles/missing-filenames.list +1 -0
- data/ext/tnef/tests/files/datafiles/missing-filenames.tnef +0 -0
- data/ext/tnef/tests/files/datafiles/multi-name-property.list +0 -0
- data/ext/tnef/tests/files/datafiles/multi-name-property.tnef +0 -0
- data/ext/tnef/tests/files/datafiles/one-file.list +1 -0
- data/ext/tnef/tests/files/datafiles/one-file.tnef +0 -0
- data/ext/tnef/tests/files/datafiles/rtf.list +1 -0
- data/ext/tnef/tests/files/datafiles/rtf.tnef +0 -0
- data/ext/tnef/tests/files/datafiles/triples.list +1 -0
- data/ext/tnef/tests/files/datafiles/triples.tnef +0 -0
- data/ext/tnef/tests/files/datafiles/two-files.list +2 -0
- data/ext/tnef/tests/files/datafiles/two-files.tnef +0 -0
- data/ext/tnef/tests/files/file-util.sh +38 -0
- data/ext/tnef/tests/files/garbage-at-end.test +9 -0
- data/ext/tnef/tests/files/long-filename.test +9 -0
- data/ext/tnef/tests/files/missing-filenames.test +9 -0
- data/ext/tnef/tests/files/multi-name-property.test +9 -0
- data/ext/tnef/tests/files/one-file.test +9 -0
- data/ext/tnef/tests/files/rtf.test +9 -0
- data/ext/tnef/tests/files/triples.test +9 -0
- data/ext/tnef/tests/files/two-files.test +9 -0
- data/ext/tnef/tests/util.sh +32 -0
- data/ext/tnef/tnef.spec.in +44 -0
- data/lib/tnef.rb +30 -0
- data/lib/tnef/executable.rb +27 -0
- data/lib/tnef/version.rb +3 -0
- metadata +243 -0
@@ -0,0 +1,101 @@
|
|
1
|
+
/*
|
2
|
+
* common.h -- 'common' declarations etc.
|
3
|
+
*
|
4
|
+
* Copyright (C)1999-2006 Mark Simpson <damned@theworld.com>
|
5
|
+
*
|
6
|
+
* This program is free software; you can redistribute it and/or modify
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
8
|
+
* the Free Software Foundation; either version 2, or (at your option)
|
9
|
+
* any later version.
|
10
|
+
*
|
11
|
+
* This program is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
* GNU General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU General Public License
|
17
|
+
* along with this program; if not, you can either send email to this
|
18
|
+
* program's maintainer or write to: The Free Software Foundation,
|
19
|
+
* Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA.
|
20
|
+
*
|
21
|
+
*/
|
22
|
+
#ifndef COMMON_H
|
23
|
+
#define COMMON_H 1
|
24
|
+
|
25
|
+
#if HAVE_CONFIG_H
|
26
|
+
# include "config.h"
|
27
|
+
#endif
|
28
|
+
|
29
|
+
#include <assert.h>
|
30
|
+
#include <stdio.h>
|
31
|
+
|
32
|
+
#if STDC_HEADERS
|
33
|
+
# include <stdarg.h>
|
34
|
+
# include <stdlib.h>
|
35
|
+
# include <memory.h>
|
36
|
+
# if HAVE_STRING_H
|
37
|
+
# include <string.h>
|
38
|
+
# endif
|
39
|
+
# if HAVE_STRINGS_H
|
40
|
+
# include <strings.h>
|
41
|
+
# endif
|
42
|
+
#else
|
43
|
+
extern int strcmp (const char *, const char *);
|
44
|
+
extern char *strcpy (char *, const char *);
|
45
|
+
extern char *strcat (char *, const char *);
|
46
|
+
extern void abort (void);
|
47
|
+
extern void exit (int);
|
48
|
+
extern void* memset (void* ptr, int c, size_t size);
|
49
|
+
extern void* malloc (size_t size);
|
50
|
+
# if !HAVE_MEMMOVE
|
51
|
+
# define memmove (d,s,n) bcopy((s),(d),(n))
|
52
|
+
# else
|
53
|
+
extern void *memmove (void *, const void*, size_t)
|
54
|
+
# endif
|
55
|
+
#endif
|
56
|
+
|
57
|
+
#ifdef HAVE_SYS_STAT_H
|
58
|
+
# include <sys/stat.h>
|
59
|
+
#endif
|
60
|
+
|
61
|
+
extern char* xstrdup (const char* str);
|
62
|
+
|
63
|
+
/* ********** SIZES ********** */
|
64
|
+
|
65
|
+
/*
|
66
|
+
* typedefs for the types specified in the grammar:
|
67
|
+
* BYTE -- 1 byte -- char
|
68
|
+
* WORD -- 2 bytes -- short/int
|
69
|
+
* DWORD -- 4 bytes -- int/long
|
70
|
+
*/
|
71
|
+
typedef signed char int8;
|
72
|
+
typedef unsigned char uint8;
|
73
|
+
#if (SIZEOF_INT == 4)
|
74
|
+
typedef short int16;
|
75
|
+
typedef unsigned short uint16;
|
76
|
+
typedef int int32;
|
77
|
+
typedef unsigned int uint32;
|
78
|
+
#else
|
79
|
+
typedef int int16;
|
80
|
+
typedef unsigned int uint16;
|
81
|
+
typedef long int32;
|
82
|
+
typedef unsigned long uint32;
|
83
|
+
#endif /* SIZEOF_INT == 4 */
|
84
|
+
|
85
|
+
/* ********** SIZES ********** */
|
86
|
+
|
87
|
+
/* ********** REPLACED FUNCS ********** */
|
88
|
+
#if !HAVE_DECL_BASENAME
|
89
|
+
extern char *basename (char *path);
|
90
|
+
#endif
|
91
|
+
|
92
|
+
#if HAVE_VPRINTF
|
93
|
+
# define VPRINTF(s,f,a) vfprintf((s),(f),(a))
|
94
|
+
#elif HAVE_DOPRNT
|
95
|
+
# define VPRINTF(s,f,a) _doprnt((f),(a),(s))
|
96
|
+
#else
|
97
|
+
# error Neither vpritnf nor _doprnt defined
|
98
|
+
#endif
|
99
|
+
/* ********** REPLACED FUNCS ********** */
|
100
|
+
|
101
|
+
#endif /* COMMON_H */
|
@@ -0,0 +1,111 @@
|
|
1
|
+
/* src/config.h.in. Generated from configure.in by autoheader. */
|
2
|
+
|
3
|
+
/* Define to 1 if you have the `basename' function. */
|
4
|
+
#undef HAVE_BASENAME
|
5
|
+
|
6
|
+
/* Define to 1 if you have the declaration of `basename', and to 0 if you
|
7
|
+
don't. */
|
8
|
+
#undef HAVE_DECL_BASENAME
|
9
|
+
|
10
|
+
/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
|
11
|
+
#undef HAVE_DOPRNT
|
12
|
+
|
13
|
+
/* Define to 1 if you have the `getopt_long' function. */
|
14
|
+
#undef HAVE_GETOPT_LONG
|
15
|
+
|
16
|
+
/* Define to 1 if you have the <inttypes.h> header file. */
|
17
|
+
#undef HAVE_INTTYPES_H
|
18
|
+
|
19
|
+
/* Define to 1 if you have the `intl' library (-lintl). */
|
20
|
+
#undef HAVE_LIBINTL
|
21
|
+
|
22
|
+
/* Define to 1 if you have the <libintl.h> header file. */
|
23
|
+
#undef HAVE_LIBINTL_H
|
24
|
+
|
25
|
+
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
|
26
|
+
to 0 otherwise. */
|
27
|
+
#undef HAVE_MALLOC
|
28
|
+
|
29
|
+
/* Define to 1 if you have the `memmove' function. */
|
30
|
+
#undef HAVE_MEMMOVE
|
31
|
+
|
32
|
+
/* Define to 1 if you have the <memory.h> header file. */
|
33
|
+
#undef HAVE_MEMORY_H
|
34
|
+
|
35
|
+
/* Define to 1 if you have the `memset' function. */
|
36
|
+
#undef HAVE_MEMSET
|
37
|
+
|
38
|
+
/* Define to 1 if you have the <stdint.h> header file. */
|
39
|
+
#undef HAVE_STDINT_H
|
40
|
+
|
41
|
+
/* Define to 1 if you have the <stdlib.h> header file. */
|
42
|
+
#undef HAVE_STDLIB_H
|
43
|
+
|
44
|
+
/* Define to 1 if you have the `strdup' function. */
|
45
|
+
#undef HAVE_STRDUP
|
46
|
+
|
47
|
+
/* Define to 1 if you have the <strings.h> header file. */
|
48
|
+
#undef HAVE_STRINGS_H
|
49
|
+
|
50
|
+
/* Define to 1 if you have the <string.h> header file. */
|
51
|
+
#undef HAVE_STRING_H
|
52
|
+
|
53
|
+
/* Define to 1 if you have the `strrchr' function. */
|
54
|
+
#undef HAVE_STRRCHR
|
55
|
+
|
56
|
+
/* Define to 1 if you have the `strtoul' function. */
|
57
|
+
#undef HAVE_STRTOUL
|
58
|
+
|
59
|
+
/* Define to 1 if you have the <sys/stat.h> header file. */
|
60
|
+
#undef HAVE_SYS_STAT_H
|
61
|
+
|
62
|
+
/* Define to 1 if you have the <sys/types.h> header file. */
|
63
|
+
#undef HAVE_SYS_TYPES_H
|
64
|
+
|
65
|
+
/* Define to 1 if you have the <unistd.h> header file. */
|
66
|
+
#undef HAVE_UNISTD_H
|
67
|
+
|
68
|
+
/* Define to 1 if you have the `vprintf' function. */
|
69
|
+
#undef HAVE_VPRINTF
|
70
|
+
|
71
|
+
/* Name of package */
|
72
|
+
#undef PACKAGE
|
73
|
+
|
74
|
+
/* Define to the address where bug reports for this package should be sent. */
|
75
|
+
#undef PACKAGE_BUGREPORT
|
76
|
+
|
77
|
+
/* Define to the full name of this package. */
|
78
|
+
#undef PACKAGE_NAME
|
79
|
+
|
80
|
+
/* Define to the full name and version of this package. */
|
81
|
+
#undef PACKAGE_STRING
|
82
|
+
|
83
|
+
/* Define to the one symbol short name of this package. */
|
84
|
+
#undef PACKAGE_TARNAME
|
85
|
+
|
86
|
+
/* Define to the home page for this package. */
|
87
|
+
#undef PACKAGE_URL
|
88
|
+
|
89
|
+
/* Define to the version of this package. */
|
90
|
+
#undef PACKAGE_VERSION
|
91
|
+
|
92
|
+
/* The size of `int', as computed by sizeof. */
|
93
|
+
#undef SIZEOF_INT
|
94
|
+
|
95
|
+
/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
|
96
|
+
#undef STAT_MACROS_BROKEN
|
97
|
+
|
98
|
+
/* Define to 1 if you have the ANSI C header files. */
|
99
|
+
#undef STDC_HEADERS
|
100
|
+
|
101
|
+
/* Version number of package */
|
102
|
+
#undef VERSION
|
103
|
+
|
104
|
+
/* Define to empty if `const' does not conform to ANSI C. */
|
105
|
+
#undef const
|
106
|
+
|
107
|
+
/* Define to rpl_malloc if the replacement function should be used. */
|
108
|
+
#undef malloc
|
109
|
+
|
110
|
+
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
111
|
+
#undef size_t
|
data/ext/tnef/src/date.c
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
/*
|
2
|
+
* date.c -- functions for dealing with dates.
|
3
|
+
*
|
4
|
+
* Copyright (C)1999-2006 Mark Simpson <damned@theworld.com>
|
5
|
+
*
|
6
|
+
* This program is free software; you can redistribute it and/or modify
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
8
|
+
* the Free Software Foundation; either version 2, or (at your option)
|
9
|
+
* any later version.
|
10
|
+
*
|
11
|
+
* This program is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
* GNU General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU General Public License
|
17
|
+
* along with this program; if not, you can either send email to this
|
18
|
+
* program's maintainer or write to: The Free Software Foundation,
|
19
|
+
* Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA.
|
20
|
+
*
|
21
|
+
*/
|
22
|
+
#ifdef HAVE_CONFIG_H
|
23
|
+
# include "config.h"
|
24
|
+
#endif /* HAVE_CONFIG_H */
|
25
|
+
|
26
|
+
#include "common.h"
|
27
|
+
|
28
|
+
#include "date.h"
|
29
|
+
#include "util.h"
|
30
|
+
|
31
|
+
/* Array of days of the week for translating a date */
|
32
|
+
const char* day_of_week[] = { "Sun", "Mon", "Tue",
|
33
|
+
"Wed", "Thu", "Fri", "Sat" };
|
34
|
+
|
35
|
+
extern const char *
|
36
|
+
dow_str(int dow)
|
37
|
+
{
|
38
|
+
assert (dow >= 0 && dow <= 6);
|
39
|
+
return day_of_week[dow];
|
40
|
+
}
|
41
|
+
|
42
|
+
const char *
|
43
|
+
date_to_str (struct date *dt)
|
44
|
+
{
|
45
|
+
static char buf[32];
|
46
|
+
sprintf (buf, "%s %04d/%02d/%02d %02d:%02d:%02d",
|
47
|
+
dow_str(dt->dow),
|
48
|
+
dt->year, dt->month, dt->day,
|
49
|
+
dt->hour, dt->min, dt->sec);
|
50
|
+
return buf;
|
51
|
+
}
|
52
|
+
|
53
|
+
void
|
54
|
+
date_read (struct date *dt, const unsigned char *buf)
|
55
|
+
{
|
56
|
+
size_t i = 0;
|
57
|
+
unsigned char *tmp = (unsigned char *)buf;
|
58
|
+
dt->year = GETINT16 (tmp + i); i += sizeof (uint16);
|
59
|
+
dt->month = GETINT16 (tmp + i); i += sizeof (uint16);
|
60
|
+
dt->day = GETINT16 (tmp + i); i += sizeof (uint16);
|
61
|
+
dt->hour = GETINT16 (tmp + i); i += sizeof (uint16);
|
62
|
+
dt->min = GETINT16 (tmp + i); i += sizeof (uint16);
|
63
|
+
dt->sec = GETINT16 (tmp + i); i += sizeof (uint16);
|
64
|
+
dt->dow = GETINT16 (tmp + i); i += sizeof (uint16);
|
65
|
+
}
|
66
|
+
|
data/ext/tnef/src/date.h
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
/*
|
2
|
+
* date.h -- functions for dealing with dates.
|
3
|
+
*
|
4
|
+
* Copyright (C)1999-2006 Mark Simpson <damned@theworld.com>
|
5
|
+
*
|
6
|
+
* This program is free software; you can redistribute it and/or modify
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
8
|
+
* the Free Software Foundation; either version 2, or (at your option)
|
9
|
+
* any later version.
|
10
|
+
*
|
11
|
+
* This program is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
* GNU General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU General Public License
|
17
|
+
* along with this program; if not, you can either send email to this
|
18
|
+
* program's maintainer or write to: The Free Software Foundation,
|
19
|
+
* Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA.
|
20
|
+
*
|
21
|
+
*/
|
22
|
+
#ifndef DATE_H
|
23
|
+
#define DATE_H
|
24
|
+
|
25
|
+
#if HAVE_CONFIG_H
|
26
|
+
# include "config.h"
|
27
|
+
#endif /* HAVE_CONFIG_H */
|
28
|
+
|
29
|
+
#include "common.h"
|
30
|
+
|
31
|
+
/* Store a date according to file specification */
|
32
|
+
struct date
|
33
|
+
{
|
34
|
+
int16 year, month, day;
|
35
|
+
int16 hour, min, sec;
|
36
|
+
int16 dow;
|
37
|
+
};
|
38
|
+
|
39
|
+
extern const char *date_to_str (struct date* dt);
|
40
|
+
extern void date_read (struct date *dt, const unsigned char *buf);
|
41
|
+
|
42
|
+
#endif /* DATE_H */
|
43
|
+
|
@@ -0,0 +1,45 @@
|
|
1
|
+
/*
|
2
|
+
* debug.c -- functions for debug output
|
3
|
+
*
|
4
|
+
* Copyright (C)1999-2006 Mark Simpson <damned@theworld.com>
|
5
|
+
*
|
6
|
+
* This program is free software; you can redistribute it and/or modify
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
8
|
+
* the Free Software Foundation; either version 2, or (at your option)
|
9
|
+
* any later version.
|
10
|
+
*
|
11
|
+
* This program is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
* GNU General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU General Public License
|
17
|
+
* along with this program; if not, you can either send email to this
|
18
|
+
* program's maintainer or write to: The Free Software Foundation,
|
19
|
+
* Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA.
|
20
|
+
*
|
21
|
+
*/
|
22
|
+
#ifdef HAVE_CONFIG_H
|
23
|
+
# include "config.h"
|
24
|
+
#endif /* HAVE_CONFIG_H */
|
25
|
+
|
26
|
+
#include "common.h"
|
27
|
+
|
28
|
+
#include "debug.h"
|
29
|
+
#include "options.h"
|
30
|
+
|
31
|
+
/* print message only when debug on */
|
32
|
+
void
|
33
|
+
debug_print (const char *fmt, ...)
|
34
|
+
{
|
35
|
+
if (DEBUG_ON)
|
36
|
+
{
|
37
|
+
va_list args;
|
38
|
+
va_start (args, fmt);
|
39
|
+
VPRINTF(stdout, fmt, args);
|
40
|
+
va_end (args);
|
41
|
+
|
42
|
+
fflush( NULL ); /* make sure it gets output */
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
/*
|
2
|
+
* debug.h -- functions for debug output
|
3
|
+
*
|
4
|
+
* Copyright (C)1999-2006 Mark Simpson <damned@theworld.com>
|
5
|
+
*
|
6
|
+
* This program is free software; you can redistribute it and/or modify
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
8
|
+
* the Free Software Foundation; either version 2, or (at your option)
|
9
|
+
* any later version.
|
10
|
+
*
|
11
|
+
* This program is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
* GNU General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU General Public License
|
17
|
+
* along with this program; if not, you can either send email to this
|
18
|
+
* program's maintainer or write to: The Free Software Foundation,
|
19
|
+
* Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA.
|
20
|
+
*
|
21
|
+
*/
|
22
|
+
#ifndef DEBUG_H
|
23
|
+
#define DEBUG_H
|
24
|
+
|
25
|
+
#if HAVE_CONFIG_H
|
26
|
+
# include "config.h"
|
27
|
+
#endif /* HAVE_CONFIG_H */
|
28
|
+
|
29
|
+
extern void debug_print (const char *fmt, ...);
|
30
|
+
|
31
|
+
#endif /* DEBUG_H */
|
32
|
+
|
data/ext/tnef/src/file.c
ADDED
@@ -0,0 +1,259 @@
|
|
1
|
+
/*
|
2
|
+
* file.c -- functions for dealing with file output
|
3
|
+
*
|
4
|
+
* Copyright (C)1999-2006 Mark Simpson <damned@theworld.com>
|
5
|
+
*
|
6
|
+
* This program is free software; you can redistribute it and/or modify
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
8
|
+
* the Free Software Foundation; either version 2, or (at your option)
|
9
|
+
* any later version.
|
10
|
+
*
|
11
|
+
* This program is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
* GNU General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU General Public License
|
17
|
+
* along with this program; if not, you can either send email to this
|
18
|
+
* program's maintainer or write to: The Free Software Foundation,
|
19
|
+
* Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA.
|
20
|
+
*
|
21
|
+
*/
|
22
|
+
#ifdef HAVE_CONFIG_H
|
23
|
+
# include "config.h"
|
24
|
+
#endif /* HAVE_CONFIG_H */
|
25
|
+
|
26
|
+
#include "common.h"
|
27
|
+
|
28
|
+
#include "alloc.h"
|
29
|
+
#include "date.h"
|
30
|
+
#include "debug.h"
|
31
|
+
#include "file.h"
|
32
|
+
#include "mapi_attr.h"
|
33
|
+
#include "options.h"
|
34
|
+
#include "path.h"
|
35
|
+
|
36
|
+
#define TNEF_DEFAULT_FILENAME "tnef-tmp"
|
37
|
+
|
38
|
+
/* ask user for confirmation of the action */
|
39
|
+
static int
|
40
|
+
confirm_action (const char *prompt, ...)
|
41
|
+
{
|
42
|
+
if (INTERACTIVE)
|
43
|
+
{
|
44
|
+
int confirmed = 0;
|
45
|
+
char buf[BUFSIZ + 1];
|
46
|
+
va_list args;
|
47
|
+
va_start (args, prompt);
|
48
|
+
|
49
|
+
VPRINTF(stdout, prompt, args);
|
50
|
+
fgets (buf, BUFSIZ, stdin);
|
51
|
+
if (buf[0] == 'y' || buf[0] == 'Y') confirmed = 1;
|
52
|
+
|
53
|
+
va_end (args);
|
54
|
+
|
55
|
+
return confirmed;
|
56
|
+
}
|
57
|
+
return 1;
|
58
|
+
}
|
59
|
+
|
60
|
+
void
|
61
|
+
file_write (File *file, const char* directory)
|
62
|
+
{
|
63
|
+
char *path = NULL;
|
64
|
+
|
65
|
+
assert (file);
|
66
|
+
if (!file) return;
|
67
|
+
|
68
|
+
if (file->name == NULL)
|
69
|
+
{
|
70
|
+
file->name = strdup( TNEF_DEFAULT_FILENAME );
|
71
|
+
debug_print ("No file name specified, using default %s.\n", TNEF_DEFAULT_FILENAME);
|
72
|
+
}
|
73
|
+
|
74
|
+
if ( file->path == NULL )
|
75
|
+
{
|
76
|
+
file->path = munge_fname( file->name );
|
77
|
+
|
78
|
+
if (file->path == NULL)
|
79
|
+
{
|
80
|
+
file->path = strdup( TNEF_DEFAULT_FILENAME );
|
81
|
+
debug_print ("No path name available, using default %s.\n", TNEF_DEFAULT_FILENAME);
|
82
|
+
}
|
83
|
+
}
|
84
|
+
|
85
|
+
path = concat_fname( directory, file->path );
|
86
|
+
|
87
|
+
if (path == NULL)
|
88
|
+
{
|
89
|
+
path = strdup( TNEF_DEFAULT_FILENAME );
|
90
|
+
debug_print ("No path generated, using default %s.\n", TNEF_DEFAULT_FILENAME);
|
91
|
+
}
|
92
|
+
|
93
|
+
debug_print ("%sWRITING\t|\t%s\t|\t%s\n",
|
94
|
+
((LIST_ONLY==0)?"":"NOT "), file->name, path);
|
95
|
+
|
96
|
+
if (!LIST_ONLY)
|
97
|
+
{
|
98
|
+
FILE *fp = NULL;
|
99
|
+
|
100
|
+
if (!confirm_action ("extract %s?", file->name)) return;
|
101
|
+
if (!OVERWRITE_FILES)
|
102
|
+
{
|
103
|
+
if (file_exists (path))
|
104
|
+
{
|
105
|
+
if (!NUMBER_FILES)
|
106
|
+
{
|
107
|
+
fprintf (stderr,
|
108
|
+
"tnef: %s: Could not create file: File exists\n",
|
109
|
+
path);
|
110
|
+
return;
|
111
|
+
}
|
112
|
+
else
|
113
|
+
{
|
114
|
+
char *tmp = find_free_number (path);
|
115
|
+
debug_print ("Renaming %s to %s\n", path, tmp);
|
116
|
+
XFREE (path);
|
117
|
+
path = tmp;
|
118
|
+
}
|
119
|
+
}
|
120
|
+
}
|
121
|
+
|
122
|
+
fp = fopen (path, "wb");
|
123
|
+
if (fp == NULL)
|
124
|
+
{
|
125
|
+
perror (path);
|
126
|
+
exit (1);
|
127
|
+
}
|
128
|
+
if (fwrite (file->data, 1, file->len, fp) != file->len)
|
129
|
+
{
|
130
|
+
perror (path);
|
131
|
+
exit (1);
|
132
|
+
}
|
133
|
+
fclose (fp);
|
134
|
+
}
|
135
|
+
|
136
|
+
if (LIST_ONLY || VERBOSE_ON)
|
137
|
+
{
|
138
|
+
if (LIST_ONLY && VERBOSE_ON)
|
139
|
+
{
|
140
|
+
/* FIXME: print out date and stuff */
|
141
|
+
const char *date_str = date_to_str(&file->dt);
|
142
|
+
fprintf (stdout, "%11lu\t|\t%s\t|\t%s\t|\t%s",
|
143
|
+
(unsigned long)file->len,
|
144
|
+
date_str+4, /* skip the day of week */
|
145
|
+
file->name,
|
146
|
+
path);
|
147
|
+
}
|
148
|
+
else
|
149
|
+
{
|
150
|
+
fprintf (stdout, "%s\t|\t%s", file->name, path);
|
151
|
+
}
|
152
|
+
if ( SHOW_MIME )
|
153
|
+
{
|
154
|
+
fprintf (stdout, "\t|\t%s", file->mime_type ? file->mime_type : "unknown");
|
155
|
+
fprintf (stdout, "\t|\t%s", file->content_id ? file->content_id : "");
|
156
|
+
}
|
157
|
+
fprintf (stdout, "\n");
|
158
|
+
}
|
159
|
+
XFREE(path);
|
160
|
+
}
|
161
|
+
|
162
|
+
static void
|
163
|
+
file_add_mapi_attrs (File* file, MAPI_Attr** attrs)
|
164
|
+
{
|
165
|
+
int i;
|
166
|
+
for (i = 0; attrs[i]; i++)
|
167
|
+
{
|
168
|
+
MAPI_Attr* a = attrs[i];
|
169
|
+
|
170
|
+
if (a->num_values)
|
171
|
+
{
|
172
|
+
|
173
|
+
switch (a->name)
|
174
|
+
{
|
175
|
+
case MAPI_ATTACH_LONG_FILENAME:
|
176
|
+
if (file->name) XFREE(file->name);
|
177
|
+
file->name = strdup( (char*)a->values[0].data.buf );
|
178
|
+
break;
|
179
|
+
|
180
|
+
case MAPI_ATTACH_DATA_OBJ:
|
181
|
+
file->len = a->values[0].len;
|
182
|
+
if (file->data) XFREE (file->data);
|
183
|
+
file->data = CHECKED_XMALLOC (unsigned char, file->len);
|
184
|
+
memmove (file->data, a->values[0].data.buf, file->len);
|
185
|
+
break;
|
186
|
+
|
187
|
+
case MAPI_ATTACH_MIME_TAG:
|
188
|
+
if (file->mime_type) XFREE (file->mime_type);
|
189
|
+
file->mime_type = CHECKED_XMALLOC (char, a->values[0].len);
|
190
|
+
memmove (file->mime_type, a->values[0].data.buf, a->values[0].len);
|
191
|
+
break;
|
192
|
+
|
193
|
+
case MAPI_ATTACH_CONTENT_ID:
|
194
|
+
if (file->content_id) XFREE(file->content_id);
|
195
|
+
file->content_id = CHECKED_XMALLOC (char, a->values[0].len);
|
196
|
+
memmove (file->content_id, a->values[0].data.buf, a->values[0].len);
|
197
|
+
break;
|
198
|
+
|
199
|
+
default:
|
200
|
+
break;
|
201
|
+
}
|
202
|
+
}
|
203
|
+
}
|
204
|
+
}
|
205
|
+
|
206
|
+
void
|
207
|
+
file_add_attr (File* file, Attr* attr)
|
208
|
+
{
|
209
|
+
assert (file && attr);
|
210
|
+
if (!(file && attr)) return;
|
211
|
+
|
212
|
+
/* we only care about some things... we will skip most attributes */
|
213
|
+
switch (attr->name)
|
214
|
+
{
|
215
|
+
case attATTACHMODIFYDATE:
|
216
|
+
copy_date_from_attr (attr, &file->dt);
|
217
|
+
break;
|
218
|
+
|
219
|
+
case attATTACHMENT:
|
220
|
+
{
|
221
|
+
MAPI_Attr **mapi_attrs = mapi_attr_read (attr->len, attr->buf);
|
222
|
+
if (mapi_attrs)
|
223
|
+
{
|
224
|
+
file_add_mapi_attrs (file, mapi_attrs);
|
225
|
+
mapi_attr_free_list (mapi_attrs);
|
226
|
+
XFREE (mapi_attrs);
|
227
|
+
}
|
228
|
+
}
|
229
|
+
break;
|
230
|
+
|
231
|
+
case attATTACHTITLE:
|
232
|
+
file->name = strdup( (char*)attr->buf );
|
233
|
+
break;
|
234
|
+
|
235
|
+
case attATTACHDATA:
|
236
|
+
file->len = attr->len;
|
237
|
+
file->data = CHECKED_XMALLOC(unsigned char, attr->len);
|
238
|
+
memmove (file->data, attr->buf, attr->len);
|
239
|
+
break;
|
240
|
+
|
241
|
+
default:
|
242
|
+
break;
|
243
|
+
}
|
244
|
+
}
|
245
|
+
|
246
|
+
void
|
247
|
+
file_free (File *file)
|
248
|
+
{
|
249
|
+
if (file)
|
250
|
+
{
|
251
|
+
XFREE (file->name);
|
252
|
+
XFREE (file->data);
|
253
|
+
XFREE (file->mime_type);
|
254
|
+
XFREE (file->content_id);
|
255
|
+
XFREE (file->path);
|
256
|
+
memset (file, '\0', sizeof (File));
|
257
|
+
}
|
258
|
+
}
|
259
|
+
|