2022-01-02 19:28:16 -05:00
|
|
|
#include "FileIO.h"
|
2022-01-03 14:48:50 -05:00
|
|
|
#include "util.h"
|
2022-01-02 19:28:16 -05:00
|
|
|
|
2022-01-09 23:37:48 -05:00
|
|
|
#include <string>
|
|
|
|
#include <iostream>
|
|
|
|
|
2022-01-02 19:28:16 -05:00
|
|
|
#include <stdint.h> /* uint8_t */
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
int
|
|
|
|
main (int argc, char **argv)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
rc = 1;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
while (argc-- > 1)
|
|
|
|
{
|
|
|
|
FileIO f (argv[argc], "r");
|
|
|
|
std::string buf = f.ReadToString ();
|
2022-01-08 23:36:08 -05:00
|
|
|
if (util_IsProbablyAscii (buf.c_str (), buf.size ()))
|
2022-01-09 23:37:48 -05:00
|
|
|
std::cout << buf << std::endl;
|
2022-01-02 19:28:16 -05:00
|
|
|
else
|
2022-01-08 23:36:08 -05:00
|
|
|
util_HexDump (buf.c_str (), buf.size ());
|
2022-01-02 19:28:16 -05:00
|
|
|
rc = 0;
|
|
|
|
}
|
|
|
|
}
|
2022-01-09 23:37:48 -05:00
|
|
|
catch (const std::string& e)
|
2022-01-02 19:28:16 -05:00
|
|
|
{
|
2022-01-09 23:37:48 -05:00
|
|
|
std::cerr << e << std::endl;
|
2022-01-02 19:28:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|