コード例 #1
0
int main(int ac, char **av)
{
    char *p, c;
    char buf[BUFSIZE];

    while ( (p = fgets(buf,BUFSIZE,stdin)) != NULL )
    {
        c = *p++;
        if ( *p++ != '=' )
            continue;
        switch ( c )
        {
        case 'G':
            parse_global(p);
            break;
        case 'T':
            parse_time_stats(p);
            break;
        case 'C':
            parse_client(p);
            break;
        case 'P':
            parse_pool(p);
            break;
        case 'S':
            parse_shared_pool(p);
            break;
        default:
            continue;
        }
    }
    return 0;
}
コード例 #2
0
ファイル: gdata.c プロジェクト: Bletchley13/MBA
void parse_gdata_stream(void *stream, R_STREAM_FILE *stream_file) {
        unsigned short len = 0;
	unsigned short leaf_type = 0;
	char *data = 0;
	SGDATAStream *data_stream = (SGDATAStream *) stream;
	SGlobal *global = 0;

        data_stream->globals_list = NULL;
	while (1) {
		stream_file_read(stream_file, 2, (char *)&len);
		if (len == 0)
			break;
		data = (char *) malloc(len);
		if (!data) return;
		stream_file_read(stream_file, len, data);

		leaf_type = *(unsigned short *) (data);
		if ((leaf_type == 0x110E) || (leaf_type == 0x1009)) {
			global = (SGlobal *) malloc(sizeof(SGlobal));
			if (!global) {
				free (data);
				return;
			}
			global->leaf_type = leaf_type;
			parse_global(data + 2, len, global);
                        DL_APPEND(data_stream->globals_list, global);
		}
	}

}