/[pupa]/pupa/util/misc.c
ViewVC logotype

Diff of /pupa/util/misc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by okuji, Thu Jan 2 20:12:32 2003 UTC revision 1.3 by okuji, Fri Jan 31 03:26:56 2003 UTC
# Line 1  Line 1 
1  /*  /*
2   *  PUPA  --  Preliminary Universal Programming Architecture for GRUB   *  PUPA  --  Preliminary Universal Programming Architecture for GRUB
3   *  Copyright (C) 2002 Yoshinori K. Okuji <okuji@enbug.org>   *  Copyright (C) 2002,2003 Yoshinori K. Okuji <okuji@enbug.org>
4   *   *
5   *  PUPA is free software; you can redistribute it and/or modify   *  PUPA is free software; you can redistribute it and/or modify
6   *  it under the terms of the GNU General Public License as published by   *  it under the terms of the GNU General Public License as published by
# Line 136  pupa_util_read_image (const char *path) Line 136  pupa_util_read_image (const char *path)
136    if (fread (img, 1, size, fp) != size)    if (fread (img, 1, size, fp) != size)
137      pupa_util_error ("cannot read %s", path);      pupa_util_error ("cannot read %s", path);
138    
139      fclose (fp);
140      
141    return img;    return img;
142  }  }
143    
144  void  void
145    pupa_util_load_image (const char *path, char *buf)
146    {
147      FILE *fp;
148      size_t size;
149      
150      pupa_util_info ("reading %s", path);
151    
152      size = pupa_util_get_image_size (path);
153      
154      fp = fopen (path, "rb");
155      if (! fp)
156        pupa_util_error ("cannot open %s", path);
157    
158      if (fread (buf, 1, size, fp) != size)
159        pupa_util_error ("cannot read %s", path);
160    
161      fclose (fp);
162    }
163    
164    void
165  pupa_util_write_image (const char *img, size_t size, FILE *out)  pupa_util_write_image (const char *img, size_t size, FILE *out)
166  {  {
167    pupa_util_info ("writing 0x%x bytes", size);    pupa_util_info ("writing 0x%x bytes", size);

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26