aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-06-18 17:36:11 +0200
committerJay Berkenbilt <ejb@ql.org>2022-06-18 17:36:11 +0200
commit28cc3692e37b9f231d58c0c24e5e90674988ef64 (patch)
tree59211a37b064fc6222ef023f9d1c0eed808b16b9 /include
parentd2e68b57c8084b7790f598461f7145147abc4404 (diff)
downloadqpdf-28cc3692e37b9f231d58c0c24e5e90674988ef64.tar.zst
Expose exit code values to C API via Constants.h
Diffstat (limited to 'include')
-rw-r--r--include/qpdf/Constants.h12
-rw-r--r--include/qpdf/QPDFJob.hh8
-rw-r--r--include/qpdf/qpdfjob-c.h7
3 files changed, 21 insertions, 6 deletions
diff --git a/include/qpdf/Constants.h b/include/qpdf/Constants.h
index 8cc67210..5d2113bd 100644
--- a/include/qpdf/Constants.h
+++ b/include/qpdf/Constants.h
@@ -27,6 +27,18 @@
* interfaces.
*/
+/* Exit Codes from QPDFJob and the qpdf CLI */
+
+enum qpdf_exit_code_e {
+ qpdf_exit_success = 0,
+ /* Normal exit codes */
+ qpdf_exit_error = 2,
+ qpdf_exit_warning = 3,
+ /* For --is-encrypted and --requires-password */
+ qpdf_exit_is_not_encrypted = 2,
+ qpdf_exit_correct_password = 3,
+};
+
/* Error Codes */
enum qpdf_error_code_e {
diff --git a/include/qpdf/QPDFJob.hh b/include/qpdf/QPDFJob.hh
index 5c6d6856..39c7a612 100644
--- a/include/qpdf/QPDFJob.hh
+++ b/include/qpdf/QPDFJob.hh
@@ -47,11 +47,11 @@ class QPDFJob
{
public:
// Exit codes -- returned by getExitCode() after calling run()
- static int constexpr EXIT_ERROR = 2;
- static int constexpr EXIT_WARNING = 3;
+ static int constexpr EXIT_ERROR = qpdf_exit_error;
+ static int constexpr EXIT_WARNING = qpdf_exit_warning;
// For is-encrypted and requires-password
- static int constexpr EXIT_IS_NOT_ENCRYPTED = 2;
- static int constexpr EXIT_CORRECT_PASSWORD = 3;
+ static int constexpr EXIT_IS_NOT_ENCRYPTED = qpdf_exit_is_not_encrypted;
+ static int constexpr EXIT_CORRECT_PASSWORD = qpdf_exit_correct_password;
// QPDFUsage is thrown if there are any usage-like errors when
// calling Config methods.
diff --git a/include/qpdf/qpdfjob-c.h b/include/qpdf/qpdfjob-c.h
index 93ab3e28..b9fe8ccb 100644
--- a/include/qpdf/qpdfjob-c.h
+++ b/include/qpdf/qpdfjob-c.h
@@ -49,7 +49,9 @@ extern "C" {
* command-line with the given arguments and returns the exit code
* that qpdf would use. argv must be a null-terminated array of
* null-terminated UTF8-encoded strings. If calling this from
- * wmain on Windows, use qpdfjob_run_from_wide_argv instead.
+ * wmain on Windows, use qpdfjob_run_from_wide_argv instead. Exit
+ * code values are defined in Constants.h in the qpdf_exit_code_e
+ * type.
*/
QPDF_DLL
int qpdfjob_run_from_argv(char const* const argv[]);
@@ -66,7 +68,8 @@ extern "C" {
/* This function runs QPDFJob from a job JSON file. See the "QPDF
* Job" section of the manual for details. The JSON string must be
* UTF8-encoded. It returns the error code that qpdf would return
- * with the equivalent command-line invocation.
+ * with the equivalent command-line invocation. Exit code values
+ * are defined in Constants.h in the qpdf_exit_code_e type.
*/
QPDF_DLL
int qpdfjob_run_from_json(char const* json);