* Copyright (C) 2005 Red Hat, Inc.
* Copyright (C) 2005 Matthias Clasen <mclasen@redhat.com>
*
- * Licensed under the Academic Free License version 2.0
- * Or under the following terms:
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * SPDX-License-Identifier: LGPL-2.1-or-later or AFL-2.0
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <strings.h>
#include <libgen.h>
#include "xdgmime.h"
else
{
if (verbose > 0)
- printf ("%s, '%s' test: expected %s, got %s\n",
- filename, test, mt_expected, mt);
+ fprintf (stderr, "%s, '%s' test: expected %s, got %s\n",
+ filename, test, mt_expected, mt);
}
}
if (file == NULL)
{
- printf ("Could not open %s\n", path);
+ fprintf (stderr, "Could not open %s\n", path);
error++;
return;
if (data == NULL)
{
- printf ("Failed to allocate memory for file %s\n", filename);
+ fprintf (stderr, "Failed to allocate memory for file %s\n", filename);
error++;
fclose (file);
if (ferror (file))
{
- printf ("Error reading file %s\n", path);
+ fprintf (stderr, "Error reading file %s\n", path);
error++;
free (data);
if (file == NULL)
{
- printf ("Could not open %s\n", filename);
+ fprintf (stderr, "Could not open %s\n", filename);
exit (1);
}
space = strchr (rest, ' ');
if (!space)
{
- printf ("Malformed line in %s:%d\n\t%s\n", filename, lineno, line);
+ fprintf (stderr, "Malformed line in %s:%d\n\t%s\n", filename, lineno, line);
continue;
}
read_from_file (argv[i]);
}
- if (error > 0 || failed > 0)
- {
- printf ("%d errors, %d comparisons, %d failed",
- error, total, failed);
- if (xfailed > 0)
- printf (" (%d expected)", xfailed);
- if (xmatch > 0)
- printf (", %d unexpected successes", xmatch);
- printf ("\n");
-
- if (xmatch > 0)
- return 1;
- if (xfailed == failed)
- return 0;
- return 1;
- }
-
+ printf ("%d errors, %d comparisons, %d failed",
+ error, total, failed);
+ if (xfailed > 0)
+ printf (" (%d expected)", xfailed);
+ if (xmatch > 0)
+ printf (", %d unexpected successes", xmatch);
+ printf ("\n");
+
+ if (error > 0 || xmatch > 0 || failed != xfailed)
+ return 1;
return 0;
}