latest modifs apparently
This commit is contained in:
parent
000ec9984f
commit
f9220d6bcd
|
@ -1 +0,0 @@
|
|||
g1m_open.3.txt
|
|
@ -0,0 +1,51 @@
|
|||
G1M_OPEN(3)
|
||||
=========
|
||||
Thomas "Cakeisalie5" Touhey
|
||||
:Email: thomas@touhey.fr
|
||||
:man source: libg1m
|
||||
:man manual: libg1m manual
|
||||
|
||||
NAME
|
||||
----
|
||||
g1m_open, g1m_fopen - open and decode a file
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
[source,c]
|
||||
----
|
||||
#include <libg1m.h>
|
||||
|
||||
int g1m_open(g1m_t **handle, const char *path,
|
||||
g1m_type_t expected_types);
|
||||
int g1m_fopen(g1m_t **handle, FILE *stream,
|
||||
g1m_type_t expected_types);
|
||||
----
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
Open and decode a file. If everything goes well, the handle is stored at
|
||||
**handle*. If you are expecting one or more types in particular, set
|
||||
*expected_types* to the OR'd types (e.g. _g1m_type_mcs | g1m_type_storage_),
|
||||
then, if the wrong type is found, the file will not be decoded to the end,
|
||||
only to the point where it can be identified. If you aren't expecting any
|
||||
type in particular, set *expected_types* to zero.
|
||||
|
||||
*g1m_open* will open the file at the given path, decode it, and close it,
|
||||
whereas *g1m_fopen* will take an opened stream (with libc) and will not
|
||||
close it. Only reading is required (writing and seeking capabilities are
|
||||
not). In case of a decoding error (magic problem, memory allocation error,
|
||||
...), the stream is unusable as the number of read bytes by libg1m is not
|
||||
known.
|
||||
|
||||
RETURN VALUE
|
||||
------------
|
||||
This function returns zero if everything went well, and the error code
|
||||
otherwise.
|
||||
|
||||
ERRORS
|
||||
------
|
||||
See *g1m_error*(3).
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
*libg1m*(3)
|
|
@ -48,37 +48,9 @@ int g1m_mcs_insert(g1m_handle_t *handle, g1m_mcsfile_t **tofile,
|
|||
continue;
|
||||
}
|
||||
|
||||
/* loop assertions */
|
||||
if (file->g1m_mcsfile_head.g1m_mcshead_type != head->g1m_mcshead_type)
|
||||
/* Assertions. */
|
||||
if (!casio_match_mcsfiles(&file->casio_mcsfile_head, head))
|
||||
continue;
|
||||
if (head->g1m_mcshead_type) {
|
||||
if (istyp) {
|
||||
if (head->g1m_mcshead_id
|
||||
!= file->g1m_mcsfile_head.g1m_mcshead_id)
|
||||
continue;
|
||||
} else if (strcmp(file->g1m_mcsfile_head.g1m_mcshead_name,
|
||||
head->g1m_mcshead_name))
|
||||
continue;
|
||||
} else switch (head->g1m_mcshead_info) {
|
||||
case g1m_mcsinfo_mcs:
|
||||
if (strncmp((char*)head->g1m_mcshead_group,
|
||||
(char*)file->g1m_mcsfile_head.g1m_mcshead_group, 16))
|
||||
continue;
|
||||
if (strncmp((char*)head->g1m_mcshead_dirname,
|
||||
(char*)file->g1m_mcsfile_head.g1m_mcshead_dirname, 8))
|
||||
continue;
|
||||
if (strncmp((char*)head->g1m_mcshead_name,
|
||||
(char*)file->g1m_mcsfile_head.g1m_mcshead_name, 8))
|
||||
continue;
|
||||
break;
|
||||
case g1m_mcsinfo_cas:
|
||||
case g1m_mcsinfo_caspro:
|
||||
if (strncmp((char*)head->g1m_mcshead_datatype,
|
||||
(char*)file->g1m_mcsfile_head.g1m_mcshead_datatype, 2))
|
||||
continue;
|
||||
break;
|
||||
default: continue;
|
||||
}
|
||||
|
||||
/* slot was found! */
|
||||
g1m_free_mcsfile(file);
|
||||
|
|
Reference in New Issue