File output on powerpoint presentation
Christos Zoulas
christos at zoulas.com
Wed May 3 18:10:42 EEST 2006
On May 3, 2:59pm, rvokal at redhat.com (Radek =?ISO-8859-1?Q?Vok=E1l?=) wrote:
-- Subject: Re: File output on powerpoint presentation
Here's a patch. Please let me know if it works for you!
Thanks,
christos
Index: softmagic.c
===================================================================
RCS file: /src/pub/file/src/softmagic.c,v
retrieving revision 1.78
diff -u -u -r1.78 softmagic.c
--- softmagic.c 12 Mar 2006 22:09:33 -0000 1.78
+++ softmagic.c 3 May 2006 14:55:09 -0000
@@ -53,6 +53,7 @@
const unsigned char *, size_t, size_t);
private int mconvert(struct magic_set *, union VALUETYPE *, struct magic *);
private int check_mem(struct magic_set *, unsigned int);
+private int print_sep(struct magic_set *, int);
/*
* softmagic - lookup one file in database
@@ -141,21 +142,20 @@
continue;
}
- if (!firstline) { /* we found another match */
- /* put a newline and '-' to do some simple formatting*/
- if (file_printf(ms, "\n- ") == -1)
+ /*
+ * If we are going to print something, we'll need to print
+ * a blank before we print something else.
+ */
+ if (magic[magindex].desc[0]) {
+ need_separator = 1;
+ if (print_sep(ms, firstline) == -1)
return -1;
}
if ((ms->c.off[cont_level] = mprint(ms, &p, &magic[magindex]))
== -1)
return -1;
- /*
- * If we printed something, we'll need to print
- * a blank before we print something else.
- */
- if (magic[magindex].desc[0])
- need_separator = 1;
+
/* and any continuations that match */
if (check_mem(ms, ++cont_level) == -1)
return -1;
@@ -189,6 +189,14 @@
break;
default:
/*
+ * If we are going to print something,
+ * make sure that we have a separator first.
+ */
+ if (magic[magindex].desc[0]) {
+ if (print_sep(ms, firstline) == -1)
+ return -1;
+ }
+ /*
* This continuation matched.
* Print its message, with
* a blank before it if
@@ -249,7 +257,7 @@
mprint(struct magic_set *ms, union VALUETYPE *p, struct magic *m)
{
uint32_t v;
- int32_t t=0 ;
+ int32_t t = 0;
switch (m->type) {
@@ -1503,3 +1511,15 @@
return matched;
}
+
+private int
+print_sep(struct magic_set *ms, int firstline)
+{
+ if (firstline)
+ return 0;
+ /*
+ * we found another match
+ * put a newline and '-' to do some simple formatting
+ */
+ return file_printf(ms, "\n- ");
+}
More information about the File
mailing list