pappl-mainloop(3)

pappl-mainloop3

Pappl main loop functions

Usage

#include <pappl/pappl.h>

int
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);

Library

Printer Application Framework (libpappl, "pkg-config --cflags --libs pappl")

Overview

The

mainloop function starts the printer application and supports standard command-line arguments and behaviors.

Functions

papplMainloop

Run a standard main loop for printer applications.

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
);

This function runs a standard main loop for a printer application. The "argc" and "argv" arguments are those provided to the main function.

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".

The "footer_html" argument specifies HTML text to use in the footer of the web interface. If NULL, the footer is omitted.

The "num_drivers", "drivers", and "driver_cb" arguments specify a list of drivers and the driver callback for printers. Specify 0 and NULL 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.

The "usage_cb" argument specifies a callback that displays a usage/help summary. If NULL, a generic summary is shown as needed.

The "subcmd_name" and "subcmd_cb" arguments specify the name and a callback for a custom sub-command. If NULL, no custom sub-commands will be supported.

The "system_cb" argument specifies a function that will create a new pappl_system_t object. If NULL, a default system object is created.

The "data" argument provides application-specific data for each of the callbacks.

papplMainloopShutdown

Request a shutdown of a running system.

void papplMainloopShutdown (void);

This function requests that the system started by papplMainloop be shutdown.

Types

pappl_ml_subcmd_cb_t

Sub-command callback

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);

pappl_ml_system_cb_t

System callback

typedef pappl_system_t * (*pappl_ml_system_cb_t)(int num_options, cups_option_t *options, void *data);

pappl_ml_usage_cb_t

Program usage callback

typedef void (*pappl_ml_usage_cb_t)(void *data);

Releases

4 releases since Debian 11 (Bullseye); the text changed 2 times.

  1. 11
  2. 12–13
  3. Arch

From pappl 1.4.12-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.