aboutsummaryrefslogtreecommitdiff
path: root/vendor/x11iraf/xpm/XpmRdFToData.c
blob: d30292b72fcab870bc6e9815c19fbe7f2720dda7 (plain) (blame)
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
/* Copyright 1990,91 GROUPE BULL -- See license conditions in file COPYRIGHT */
/*****************************************************************************\
* XpmRdFToData.c:                                                             *
*                                                                             *
*  XPM library                                                                *
*  Parse an XPM file and create an array of strings corresponding to it.      *
*                                                                             *
*  Developed by Dan Greening dgreen@cs.ucla.edu / dgreen@sti.com              *
\*****************************************************************************/

#include "xpmP.h"

int
XpmReadFileToData(filename, data_return)
    char *filename;
    char ***data_return;
{
    XpmAttributes attributes;
    XpmImage image;
    int ErrorStatus;

    attributes.valuemask = XpmReturnExtensions;

    /*
     * initialize return value
     */
    if (data_return)
	*data_return = NULL;

    ErrorStatus = XpmReadFileToXpmImage(filename, &image, &attributes, NULL);
    if (ErrorStatus != XpmSuccess)
	return (ErrorStatus);

    ErrorStatus =
	XpmCreateDataFromXpmImage(data_return, &image, &attributes);

    XpmFreeAttributes(&attributes);
    XpmFreeXpmImage(&image);

    return (ErrorStatus);
}