2017-08-19 11:10:48 +00:00
|
|
|
//
|
|
|
|
// This is an example of creating a PDF file from scratch. It illustrates use of several QPDF
|
|
|
|
// operations for creating objects and streams. It also serves as an illustration of how to use
|
|
|
|
// StreamDataProvider with different types of filters.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include <qpdf/Pl_Buffer.hh>
|
|
|
|
#include <qpdf/Pl_DCT.hh>
|
|
|
|
#include <qpdf/Pl_RunLength.hh>
|
2019-06-21 03:35:23 +00:00
|
|
|
#include <qpdf/QIntC.hh>
|
2012-06-23 02:07:58 +00:00
|
|
|
#include <qpdf/QPDF.hh>
|
|
|
|
#include <qpdf/QPDFObjectHandle.hh>
|
2018-06-18 19:06:51 +00:00
|
|
|
#include <qpdf/QPDFPageDocumentHelper.hh>
|
2012-06-23 02:07:58 +00:00
|
|
|
#include <qpdf/QPDFWriter.hh>
|
|
|
|
#include <qpdf/QUtil.hh>
|
2023-05-20 11:22:32 +00:00
|
|
|
#include <cstdlib>
|
2012-06-23 02:07:58 +00:00
|
|
|
#include <iostream>
|
2022-02-04 16:03:52 +00:00
|
|
|
#include <memory>
|
2012-06-23 02:07:58 +00:00
|
|
|
|
2022-07-26 11:37:50 +00:00
|
|
|
static char const* whoami = nullptr;
|
2012-06-23 02:07:58 +00:00
|
|
|
|
|
|
|
// This is a simple StreamDataProvider that writes image data for an orange square of the given
|
|
|
|
// width and height.
|
|
|
|
class ImageProvider: public QPDFObjectHandle::StreamDataProvider
|
|
|
|
{
|
|
|
|
public:
|
2017-08-19 11:10:48 +00:00
|
|
|
ImageProvider(std::string const& color_space, std::string const& filter);
|
2023-05-20 13:25:46 +00:00
|
|
|
~ImageProvider() override = default;
|
|
|
|
void provideStreamData(QPDFObjGen const&, Pipeline* pipeline) override;
|
2019-06-21 03:35:23 +00:00
|
|
|
size_t getWidth() const;
|
|
|
|
size_t getHeight() const;
|
2012-06-23 02:07:58 +00:00
|
|
|
|
|
|
|
private:
|
2023-06-01 13:12:39 +00:00
|
|
|
size_t width{400};
|
|
|
|
size_t stripe_height{80};
|
2017-08-19 11:10:48 +00:00
|
|
|
std::string color_space;
|
|
|
|
std::string filter;
|
2023-06-01 13:12:39 +00:00
|
|
|
size_t n_stripes{6};
|
2017-08-19 11:10:48 +00:00
|
|
|
std::vector<std::string> stripes;
|
2023-06-01 13:12:39 +00:00
|
|
|
J_COLOR_SPACE j_color_space{JCS_UNKNOWN};
|
2012-06-23 02:07:58 +00:00
|
|
|
};
|
|
|
|
|
2017-08-19 11:10:48 +00:00
|
|
|
ImageProvider::ImageProvider(std::string const& color_space, std::string const& filter) :
|
|
|
|
color_space(color_space),
|
2023-06-01 13:12:39 +00:00
|
|
|
filter(filter)
|
2012-06-23 02:07:58 +00:00
|
|
|
{
|
2017-08-19 11:10:48 +00:00
|
|
|
if (color_space == "/DeviceCMYK") {
|
|
|
|
j_color_space = JCS_CMYK;
|
2023-05-27 22:49:18 +00:00
|
|
|
stripes.emplace_back("\xff\x00\x00\x00", 4);
|
|
|
|
stripes.emplace_back("\x00\xff\x00\x00", 4);
|
|
|
|
stripes.emplace_back("\x00\x00\xff\x00", 4);
|
|
|
|
stripes.emplace_back("\xff\x00\xff\x00", 4);
|
|
|
|
stripes.emplace_back("\xff\xff\x00\x00", 4);
|
|
|
|
stripes.emplace_back("\x00\x00\x00\xff", 4);
|
2017-08-19 11:10:48 +00:00
|
|
|
} else if (color_space == "/DeviceRGB") {
|
|
|
|
j_color_space = JCS_RGB;
|
2023-05-27 22:49:18 +00:00
|
|
|
stripes.emplace_back("\xff\x00\x00", 3);
|
|
|
|
stripes.emplace_back("\x00\xff\x00", 3);
|
|
|
|
stripes.emplace_back("\x00\x00\xff", 3);
|
|
|
|
stripes.emplace_back("\xff\x00\xff", 3);
|
|
|
|
stripes.emplace_back("\xff\xff\x00", 3);
|
|
|
|
stripes.emplace_back("\x00\x00\x00", 3);
|
2017-08-19 11:10:48 +00:00
|
|
|
} else if (color_space == "/DeviceGray") {
|
|
|
|
j_color_space = JCS_GRAYSCALE;
|
2023-05-27 22:49:18 +00:00
|
|
|
stripes.emplace_back("\xee", 1);
|
|
|
|
stripes.emplace_back("\xcc", 1);
|
|
|
|
stripes.emplace_back("\x99", 1);
|
|
|
|
stripes.emplace_back("\x66", 1);
|
|
|
|
stripes.emplace_back("\x33", 1);
|
|
|
|
stripes.emplace_back("\x00", 1);
|
2017-08-19 11:10:48 +00:00
|
|
|
}
|
2012-06-23 02:07:58 +00:00
|
|
|
}
|
|
|
|
|
2019-06-21 03:35:23 +00:00
|
|
|
size_t
|
2017-08-19 11:10:48 +00:00
|
|
|
ImageProvider::getWidth() const
|
|
|
|
{
|
|
|
|
return width;
|
|
|
|
}
|
|
|
|
|
2019-06-21 03:35:23 +00:00
|
|
|
size_t
|
2017-08-19 11:10:48 +00:00
|
|
|
ImageProvider::getHeight() const
|
|
|
|
{
|
|
|
|
return stripe_height * n_stripes;
|
|
|
|
}
|
|
|
|
|
2012-06-23 02:07:58 +00:00
|
|
|
void
|
2022-07-24 13:16:37 +00:00
|
|
|
ImageProvider::provideStreamData(QPDFObjGen const&, Pipeline* pipeline)
|
2012-06-23 02:07:58 +00:00
|
|
|
{
|
2022-02-04 16:03:52 +00:00
|
|
|
std::vector<std::shared_ptr<Pipeline>> to_delete;
|
2017-08-19 11:10:48 +00:00
|
|
|
Pipeline* p = pipeline;
|
2022-02-04 16:03:52 +00:00
|
|
|
std::shared_ptr<Pipeline> p_new;
|
2017-08-19 11:10:48 +00:00
|
|
|
|
|
|
|
if (filter == "/DCTDecode") {
|
2022-02-04 16:03:52 +00:00
|
|
|
p_new = std::make_shared<Pl_DCT>(
|
2017-08-19 11:10:48 +00:00
|
|
|
"image encoder",
|
|
|
|
pipeline,
|
2019-06-21 03:35:23 +00:00
|
|
|
QIntC::to_uint(width),
|
|
|
|
QIntC::to_uint(getHeight()),
|
|
|
|
QIntC::to_int(stripes[0].length()),
|
|
|
|
j_color_space);
|
2022-02-04 16:03:52 +00:00
|
|
|
to_delete.push_back(p_new);
|
|
|
|
p = p_new.get();
|
2017-08-19 11:10:48 +00:00
|
|
|
} else if (filter == "/RunLengthDecode") {
|
|
|
|
p_new = std::make_shared<Pl_RunLength>("image encoder", pipeline, Pl_RunLength::a_encode);
|
2022-02-04 16:03:52 +00:00
|
|
|
to_delete.push_back(p_new);
|
|
|
|
p = p_new.get();
|
2012-06-23 02:07:58 +00:00
|
|
|
}
|
2017-08-19 11:10:48 +00:00
|
|
|
|
2019-06-21 03:35:23 +00:00
|
|
|
for (size_t i = 0; i < n_stripes; ++i) {
|
|
|
|
for (size_t j = 0; j < width * stripe_height; ++j) {
|
2022-05-03 22:09:49 +00:00
|
|
|
p->writeString(stripes[i]);
|
2017-08-19 11:10:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
p->finish();
|
2012-06-23 02:07:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
usage()
|
|
|
|
{
|
|
|
|
std::cerr << "Usage: " << whoami << " filename" << std::endl
|
2022-02-08 14:18:08 +00:00
|
|
|
<< "Creates a simple PDF and writes it to filename" << std::endl;
|
2012-06-23 02:07:58 +00:00
|
|
|
exit(2);
|
|
|
|
}
|
|
|
|
|
|
|
|
static QPDFObjectHandle
|
|
|
|
createPageContents(QPDF& pdf, std::string const& text)
|
|
|
|
{
|
|
|
|
// Create a stream that displays our image and the given text in our font.
|
2017-08-19 11:10:48 +00:00
|
|
|
std::string contents = "BT /F1 24 Tf 72 320 Td (" + text +
|
|
|
|
") Tj ET\n"
|
|
|
|
"q 244 0 0 144 184 100 cm /Im1 Do Q\n";
|
2022-09-26 18:29:26 +00:00
|
|
|
return pdf.newStream(contents);
|
2012-06-23 02:07:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QPDFObjectHandle
|
|
|
|
newName(std::string const& name)
|
|
|
|
{
|
|
|
|
return QPDFObjectHandle::newName(name);
|
|
|
|
}
|
|
|
|
|
2019-06-21 03:35:23 +00:00
|
|
|
QPDFObjectHandle
|
|
|
|
newInteger(size_t val)
|
2012-06-23 02:07:58 +00:00
|
|
|
{
|
2019-06-21 03:35:23 +00:00
|
|
|
return QPDFObjectHandle::newInteger(QIntC::to_int(val));
|
2012-06-23 02:07:58 +00:00
|
|
|
}
|
|
|
|
|
2018-06-18 19:06:51 +00:00
|
|
|
void
|
|
|
|
add_page(
|
|
|
|
QPDFPageDocumentHelper& dh,
|
|
|
|
QPDFObjectHandle font,
|
2017-08-19 11:10:48 +00:00
|
|
|
std::string const& color_space,
|
|
|
|
std::string const& filter)
|
2012-06-23 02:07:58 +00:00
|
|
|
{
|
2018-06-18 19:06:51 +00:00
|
|
|
QPDF& pdf(dh.getQPDF());
|
|
|
|
|
2017-08-19 11:10:48 +00:00
|
|
|
// Create a stream to encode our image. QPDFWriter will fill in the length and will respect our
|
|
|
|
// filters based on stream data mode. Since we are not specifying, QPDFWriter will compress with
|
|
|
|
// /FlateDecode if we don't provide any other form of compression.
|
2023-05-20 12:24:10 +00:00
|
|
|
auto* p = new ImageProvider(color_space, filter);
|
2022-04-09 18:49:10 +00:00
|
|
|
std::shared_ptr<QPDFObjectHandle::StreamDataProvider> provider(p);
|
2019-06-21 03:35:23 +00:00
|
|
|
size_t width = p->getWidth();
|
|
|
|
size_t height = p->getHeight();
|
2022-09-26 18:29:26 +00:00
|
|
|
QPDFObjectHandle image = pdf.newStream();
|
2022-04-03 20:10:27 +00:00
|
|
|
auto image_dict =
|
|
|
|
// line-break
|
|
|
|
"<<"
|
|
|
|
" /Type /XObject"
|
|
|
|
" /Subtype /Image"
|
|
|
|
" /BitsPerComponent 8"
|
|
|
|
">>"_qpdf;
|
2022-05-17 22:28:50 +00:00
|
|
|
image_dict.replaceKey("/ColorSpace", newName(color_space));
|
|
|
|
image_dict.replaceKey("/Width", newInteger(width));
|
|
|
|
image_dict.replaceKey("/Height", newInteger(height));
|
2022-02-26 15:42:47 +00:00
|
|
|
image.replaceDict(image_dict);
|
2017-08-19 11:10:48 +00:00
|
|
|
|
2012-06-23 02:07:58 +00:00
|
|
|
// Provide the stream data.
|
2017-08-19 11:10:48 +00:00
|
|
|
image.replaceStreamData(provider, QPDFObjectHandle::parse(filter), QPDFObjectHandle::newNull());
|
2012-06-23 02:07:58 +00:00
|
|
|
|
|
|
|
// Create direct objects as needed by the page dictionary.
|
2022-02-05 14:18:58 +00:00
|
|
|
QPDFObjectHandle procset = "[/PDF /Text /ImageC]"_qpdf;
|
2012-06-23 02:07:58 +00:00
|
|
|
|
|
|
|
QPDFObjectHandle rfont = QPDFObjectHandle::newDictionary();
|
|
|
|
rfont.replaceKey("/F1", font);
|
|
|
|
|
|
|
|
QPDFObjectHandle xobject = QPDFObjectHandle::newDictionary();
|
|
|
|
xobject.replaceKey("/Im1", image);
|
|
|
|
|
|
|
|
QPDFObjectHandle resources = QPDFObjectHandle::newDictionary();
|
2022-05-17 22:28:50 +00:00
|
|
|
resources.replaceKey("/ProcSet", procset);
|
|
|
|
resources.replaceKey("/Font", rfont);
|
|
|
|
resources.replaceKey("/XObject", xobject);
|
2012-06-23 02:07:58 +00:00
|
|
|
|
|
|
|
// Create the page content stream
|
2017-08-19 11:10:48 +00:00
|
|
|
QPDFObjectHandle contents = createPageContents(pdf, color_space + " with filter " + filter);
|
2012-06-23 02:07:58 +00:00
|
|
|
|
|
|
|
// Create the page dictionary
|
|
|
|
QPDFObjectHandle page = pdf.makeIndirectObject("<<"
|
2022-02-26 15:42:47 +00:00
|
|
|
" /Type /Page"
|
|
|
|
" /MediaBox [0 0 612 392]"
|
|
|
|
">>"_qpdf);
|
2022-05-17 22:28:50 +00:00
|
|
|
page.replaceKey("/Contents", contents);
|
|
|
|
page.replaceKey("/Resources", resources);
|
2012-06-23 02:07:58 +00:00
|
|
|
|
|
|
|
// Add the page to the PDF file
|
2018-06-18 19:06:51 +00:00
|
|
|
dh.addPage(page, false);
|
2017-08-19 11:10:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
check(
|
|
|
|
char const* filename,
|
|
|
|
std::vector<std::string> const& color_spaces,
|
|
|
|
std::vector<std::string> const& filters)
|
|
|
|
{
|
|
|
|
// Each stream is compressed the way it is supposed to be. We will add additional tests in
|
|
|
|
// qpdf.test to exercise QPDFWriter more fully. In this case, we want to make sure that we
|
|
|
|
// actually have RunLengthDecode and DCTDecode where we are supposed to and FlateDecode where we
|
|
|
|
// provided no filters.
|
|
|
|
|
|
|
|
// Each image is correct. For non-lossy image compression, the uncompressed image data should
|
|
|
|
// exactly match what ImageProvider provided. For the DCTDecode data, allow for some fuzz to
|
|
|
|
// handle jpeg compression as well as its variance on different systems.
|
|
|
|
|
|
|
|
// These tests should use QPDFObjectHandle's stream data retrieval methods, but don't try to
|
|
|
|
// fully exercise them here. That is done elsewhere.
|
|
|
|
|
|
|
|
size_t n_color_spaces = color_spaces.size();
|
|
|
|
size_t n_filters = filters.size();
|
|
|
|
|
|
|
|
QPDF pdf;
|
|
|
|
pdf.processFile(filename);
|
2022-02-26 15:42:47 +00:00
|
|
|
auto pages = QPDFPageDocumentHelper(pdf).getAllPages();
|
2017-08-19 11:10:48 +00:00
|
|
|
if (n_color_spaces * n_filters != pages.size()) {
|
|
|
|
throw std::logic_error("incorrect number of pages");
|
|
|
|
}
|
|
|
|
size_t pageno = 1;
|
|
|
|
bool errors = false;
|
2022-02-26 15:42:47 +00:00
|
|
|
for (auto& page: pages) {
|
|
|
|
auto images = page.getImages();
|
2017-08-19 11:10:48 +00:00
|
|
|
if (images.size() != 1) {
|
|
|
|
throw std::logic_error("incorrect number of images on page");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check filter and color space.
|
|
|
|
std::string desired_color_space = color_spaces[(pageno - 1) / n_color_spaces];
|
2022-02-26 15:42:47 +00:00
|
|
|
std::string desired_filter = filters[(pageno - 1) % n_filters];
|
2017-08-19 11:10:48 +00:00
|
|
|
// In the default mode, QPDFWriter will compress with /FlateDecode if no filters are
|
|
|
|
// provided.
|
|
|
|
if (desired_filter == "null") {
|
|
|
|
desired_filter = "/FlateDecode";
|
|
|
|
}
|
|
|
|
QPDFObjectHandle image = images.begin()->second;
|
|
|
|
QPDFObjectHandle image_dict = image.getDict();
|
|
|
|
QPDFObjectHandle color_space = image_dict.getKey("/ColorSpace");
|
|
|
|
QPDFObjectHandle filter = image_dict.getKey("/Filter");
|
|
|
|
bool this_errors = false;
|
2022-01-26 08:00:23 +00:00
|
|
|
if (!filter.isNameAndEquals(desired_filter)) {
|
2017-08-19 11:10:48 +00:00
|
|
|
this_errors = errors = true;
|
|
|
|
std::cout << "page " << pageno << ": expected filter " << desired_filter
|
|
|
|
<< "; actual filter = " << filter.unparse() << std::endl;
|
|
|
|
}
|
2022-01-26 08:00:23 +00:00
|
|
|
if (!color_space.isNameAndEquals(desired_color_space)) {
|
2017-08-19 11:10:48 +00:00
|
|
|
this_errors = errors = true;
|
|
|
|
std::cout << "page " << pageno << ": expected color space " << desired_color_space
|
|
|
|
<< "; actual color space = " << color_space.unparse() << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!this_errors) {
|
|
|
|
// Check image data
|
|
|
|
auto actual_data = image.getStreamData(qpdf_dl_all);
|
2023-05-20 12:24:10 +00:00
|
|
|
auto* p = new ImageProvider(desired_color_space, "null");
|
2022-04-09 18:49:10 +00:00
|
|
|
std::shared_ptr<QPDFObjectHandle::StreamDataProvider> provider(p);
|
2017-08-19 11:10:48 +00:00
|
|
|
Pl_Buffer b_p("get image data");
|
2022-07-24 13:16:37 +00:00
|
|
|
provider->provideStreamData(QPDFObjGen(), &b_p);
|
2022-04-09 18:49:10 +00:00
|
|
|
std::shared_ptr<Buffer> desired_data(b_p.getBuffer());
|
2017-08-19 11:10:48 +00:00
|
|
|
|
|
|
|
if (desired_data->getSize() != actual_data->getSize()) {
|
|
|
|
std::cout << "page " << pageno << ": image data length mismatch" << std::endl;
|
|
|
|
this_errors = errors = true;
|
|
|
|
} else {
|
|
|
|
// Compare bytes. For JPEG, allow a certain number of the bytes to be off desired by
|
|
|
|
// more than a given tolerance. Any of the samples may be a little off because of
|
|
|
|
// lossy compression, and around sharp edges, things can be quite off. For non-lossy
|
|
|
|
// compression, do not allow any tolerance.
|
|
|
|
unsigned char const* actual_bytes = actual_data->getBuffer();
|
|
|
|
unsigned char const* desired_bytes = desired_data->getBuffer();
|
|
|
|
size_t len = actual_data->getSize();
|
|
|
|
unsigned int mismatches = 0;
|
|
|
|
int tolerance = (desired_filter == "/DCTDecode" ? 10 : 0);
|
2019-06-21 03:35:23 +00:00
|
|
|
size_t threshold = (desired_filter == "/DCTDecode" ? len / 40U : 0);
|
2017-08-19 11:10:48 +00:00
|
|
|
for (size_t i = 0; i < len; ++i) {
|
|
|
|
int delta = actual_bytes[i] - desired_bytes[i];
|
|
|
|
if ((delta > tolerance) || (delta < -tolerance)) {
|
|
|
|
++mismatches;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (mismatches > threshold) {
|
|
|
|
std::cout << "page " << pageno << ": " << desired_color_space << ", "
|
|
|
|
<< desired_filter << ": mismatches: " << mismatches << " of " << len
|
|
|
|
<< std::endl;
|
|
|
|
this_errors = errors = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
++pageno;
|
|
|
|
}
|
|
|
|
if (errors) {
|
|
|
|
throw std::logic_error("errors found");
|
|
|
|
} else {
|
|
|
|
std::cout << "all checks passed" << std::endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
create_pdf(char const* filename)
|
|
|
|
{
|
|
|
|
QPDF pdf;
|
|
|
|
|
|
|
|
// Start with an empty PDF that has no pages or non-required objects.
|
|
|
|
pdf.emptyPDF();
|
|
|
|
|
|
|
|
// Add an indirect object to contain a font descriptor for the built-in Helvetica font.
|
2022-04-03 20:10:27 +00:00
|
|
|
QPDFObjectHandle font = pdf.makeIndirectObject(
|
|
|
|
// line-break
|
|
|
|
"<<"
|
|
|
|
" /Type /Font"
|
|
|
|
" /Subtype /Type1"
|
|
|
|
" /Name /F1"
|
|
|
|
" /BaseFont /Helvetica"
|
|
|
|
" /Encoding /WinAnsiEncoding"
|
|
|
|
">>"_qpdf);
|
2017-08-19 11:10:48 +00:00
|
|
|
|
|
|
|
std::vector<std::string> color_spaces;
|
2023-05-27 22:49:18 +00:00
|
|
|
color_spaces.emplace_back("/DeviceCMYK");
|
|
|
|
color_spaces.emplace_back("/DeviceRGB");
|
|
|
|
color_spaces.emplace_back("/DeviceGray");
|
2017-08-19 11:10:48 +00:00
|
|
|
std::vector<std::string> filters;
|
2023-05-27 22:49:18 +00:00
|
|
|
filters.emplace_back("null");
|
|
|
|
filters.emplace_back("/DCTDecode");
|
|
|
|
filters.emplace_back("/RunLengthDecode");
|
2018-06-18 19:06:51 +00:00
|
|
|
QPDFPageDocumentHelper dh(pdf);
|
2022-02-26 15:42:47 +00:00
|
|
|
for (auto const& color_space: color_spaces) {
|
|
|
|
for (auto const& filter: filters) {
|
|
|
|
add_page(dh, font, color_space, filter);
|
2017-08-19 11:10:48 +00:00
|
|
|
}
|
|
|
|
}
|
2012-06-23 02:07:58 +00:00
|
|
|
|
|
|
|
QPDFWriter w(pdf, filename);
|
|
|
|
w.write();
|
2017-08-19 11:10:48 +00:00
|
|
|
|
|
|
|
// For test suite, verify that everything is the way it is supposed to be.
|
|
|
|
check(filename, color_spaces, filters);
|
2012-06-23 02:07:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char* argv[])
|
|
|
|
{
|
|
|
|
whoami = QUtil::getWhoami(argv[0]);
|
|
|
|
|
|
|
|
if (argc != 2) {
|
2022-02-08 14:18:08 +00:00
|
|
|
usage();
|
2012-06-23 02:07:58 +00:00
|
|
|
}
|
|
|
|
char const* filename = argv[1];
|
|
|
|
|
|
|
|
try {
|
2022-02-08 14:18:08 +00:00
|
|
|
create_pdf(filename);
|
2012-06-23 02:07:58 +00:00
|
|
|
} catch (std::exception& e) {
|
2022-02-08 14:18:08 +00:00
|
|
|
std::cerr << e.what() << std::endl;
|
|
|
|
exit(2);
|
2012-06-23 02:07:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|