.TH pappl-mainloop 3 "pappl main loop functions" "2020-12-08" "pappl main loop functions" .SH NAME pappl-mainloop \- pappl main loop functions .SH LIBRARY Printer Application Framework (libpappl, "pkg-config --cflags --libs pappl") .SH SYNOPSIS .B #include .PP .I int .br .BI papplMainloop "(int argc, char *argv[], const char *version, const char *footer_html, int num_drivers, pappl_driver_t *drivers, pappl_driver_cb_t driver_cb, pappl_ml_autoadd_cb_t autoadd_cb, const char *subcmd_name, pappl_ml_subcmd_cb_t subcmd_cb, pappl_ml_system_cb_t system_cb, pappl_ml_usage_cb_t usage_cb, void *data);" .SH DESCRIPTION The .PP PAPPL mainloop function starts the printer application and supports standard command-line arguments and behaviors. .SH FUNCTIONS .SS papplMainloop Run a standard main loop for printer applications. .PP .nf int papplMainloop ( int argc, char *argv[], const char *version, const char *footer_html, int num_drivers, pappl_pr_driver_t *drivers, pappl_pr_autoadd_cb_t autoadd_cb, pappl_pr_driver_cb_t driver_cb, const char *subcmd_name, pappl_ml_subcmd_cb_t subcmd_cb, pappl_ml_system_cb_t system_cb, pappl_ml_usage_cb_t usage_cb, void *data ); .fi .PP This function runs a standard main loop for a printer application. The "argc" and "argv" arguments are those provided to the \fBmain\fR function. .PP The "version" argument specifies a numeric version number for the printer application that conforms to semantic versioning guidelines with up to four numbers, for example "1.2.3.4". .PP The "footer_html" argument specifies HTML text to use in the footer of the web interface. If \fBNULL\fR, the footer is omitted. .PP The "num_drivers", "drivers", and "driver_cb" arguments specify a list of drivers and the driver callback for printers. Specify \fB0\fR and \fBNULL\fR if the drivers are configured in the system callback. The "autoadd_cb" argument specifies a callback for automatically adding new printers with the "autoadd" sub-command and for auto-detecting the driver when adding manually. .PP The "usage_cb" argument specifies a callback that displays a usage/help summary. If \fBNULL\fR, a generic summary is shown as needed. .PP The "subcmd_name" and "subcmd_cb" arguments specify the name and a callback for a custom sub-command. If \fBNULL\fR, no custom sub-commands will be supported. .PP The "system_cb" argument specifies a function that will create a new \fBpappl_system_t\fR object. If \fBNULL\fR, a default system object is created. .PP The "data" argument provides application-specific data for each of the callbacks. .SH TYPES .SS pappl_ml_subcmd_cb_t Sub-command callback .PP .nf typedef int (*pappl_ml_subcmd_cb_t)(const char *base_name, int num_options, cups_option_t *options, int num_files, char **files, void *data); .fi .SS pappl_ml_system_cb_t System callback .PP .nf typedef pappl_system_t * (*pappl_ml_system_cb_t)(int num_options, cups_option_t *options, void *data); .fi .SS pappl_ml_usage_cb_t Program usage callback .PP .nf typedef void (*pappl_ml_usage_cb_t)(void *data); .fi .SH SEE ALSO .BR pappl (1), .BR pappl-client (3), .BR pappl-device (3), .BR pappl-job (3), .BR pappl-log (3), .BR pappl-mainline (3), .BR pappl-makeresheader (1), .BR pappl-printer (3), .BR pappl-resource (3), .BR pappl-system (3), https://www.msweet.org/pappl .SH COPYRIGHT Copyright \[co] 2019-2020 by Michael R Sweet. .PP .B PAPPL is licensed under the Apache License Version 2.0 with an (optional) exception to allow linking against GPL2/LGPL2 software (like older versions of CUPS), so it can be used .I freely in any project you'd like. See the files "LICENSE" and "NOTICE" in the source distribution for more information.