#include "cm_common.h"

int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        fprintf(stderr, "Usage: %s <file>", argv[0]);
        return -1;
    }
    char *file = argv[1];
    char *data = NULL;

    data = read_file_data(file);
    if (data != NULL)
    {
        cJSON *cfg_json = cJSON_Parse(data);
        if (cfg_json == NULL)
        {
            free(data);
            data = lnxall_read_encrypted_file(file, NULL);
            if (data != NULL)
            {
                cfg_json = cJSON_Parse(data);
            }
        }

        if (cfg_json != NULL)
        {
            fputs(data, stdout);
        }
        cJSON_Delete(cfg_json);
        free(data);
    }
    return 0;
}
