1pappl-mainloop(3)          pappl main loop functions         pappl-mainloop(3)
2
3
4

NAME

6       pappl-mainloop - pappl main loop functions
7

LIBRARY

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

SYNOPSIS

13       #include <pappl/pappl.h>
14
15       int
16       papplMainloop(int argc, char *argv[], const char *version,  const  char
17       *footer_html,     int     num_drivers,     pappl_driver_t     *drivers,
18       pappl_driver_cb_t driver_cb,  pappl_ml_autoadd_cb_t  autoadd_cb,  const
19       char *subcmd_name, pappl_ml_subcmd_cb_t subcmd_cb, pappl_ml_system_cb_t
20       system_cb, pappl_ml_usage_cb_t usage_cb, void *data);
21

DESCRIPTION

23       The
24
25       mainloop function starts the printer application and supports  standard
26       command-line arguments and behaviors.
27

FUNCTIONS

29   papplMainloop
30       Run a standard main loop for printer applications.
31
32       int  papplMainloop (
33           int argc,
34           char *argv[],
35           const char *version,
36           const char *footer_html,
37           int num_drivers,
38           pappl_pr_driver_t *drivers,
39           pappl_pr_autoadd_cb_t autoadd_cb,
40           pappl_pr_driver_cb_t driver_cb,
41           const char *subcmd_name,
42           pappl_ml_subcmd_cb_t subcmd_cb,
43           pappl_ml_system_cb_t system_cb,
44           pappl_ml_usage_cb_t usage_cb,
45           void *data
46       );
47
48       This function runs a standard main loop for a printer application.  The
49       "argc" and "argv" arguments are those provided to the main function.
50
51       The "version" argument specifies  a  numeric  version  number  for  the
52       printer  application  that  conforms  to semantic versioning guidelines
53       with up to four numbers, for example "1.2.3.4".
54
55       The "footer_html" argument specifies HTML text to use in the footer  of
56       the web interface.  If NULL, the footer is omitted.
57
58       The  "num_drivers", "drivers", and "driver_cb" arguments specify a list
59       of drivers and the driver callback for printers.  Specify 0 and NULL if
60       the  drivers  are  configured in the system callback.  The "autoadd_cb"
61       argument specifies a callback for  automatically  adding  new  printers
62       with  the  "autoadd" sub-command and for auto-detecting the driver when
63       adding manually.
64
65       The "usage_cb" argument specifies a callback that displays a usage/help
66       summary.  If NULL, a generic summary is shown as needed.
67
68       The  "subcmd_name"  and  "subcmd_cb"  arguments  specify the name and a
69       callback for a custom sub-command.  If  NULL,  no  custom  sub-commands
70       will be supported.
71
72       The  "system_cb"  argument  specifies a function that will create a new
73       pappl_system_t object.  If NULL, a default system object is created.
74
75       The "data" argument provides application-specific data for each of  the
76       callbacks.
77
78   papplMainloopShutdown
79       Request a shutdown of a running system.
80
81       void papplMainloopShutdown (void);
82
83       This  function  requests  that  the  system started by papplMainloop be
84       shutdown.
85

TYPES

87   pappl_ml_subcmd_cb_t
88       Sub-command callback
89
90       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);
91
92   pappl_ml_system_cb_t
93       System callback
94
95       typedef pappl_system_t * (*pappl_ml_system_cb_t)(int num_options, cups_option_t *options, void *data);
96
97   pappl_ml_usage_cb_t
98       Program usage callback
99
100       typedef void (*pappl_ml_usage_cb_t)(void *data);
101

SEE ALSO

103       pappl(1), pappl-client(3), pappl-device(3), pappl-job(3), pappl-log(3),
104       pappl-mainline(3),  pappl-makeresheader(1), pappl-printer(3), pappl-re‐
105       source(3), pappl-system(3), https://www.msweet.org/pappl
106
108       Copyright © 2019-2022 by Michael R Sweet.
109
110       PAPPL is licensed under the Apache License Version  2.0  with  an  (op‐
111       tional)  exception  to  allow linking against GPL2/LGPL2 software (like
112       older versions of CUPS), so it can be used freely in any project  you'd
113       like.   See the files "LICENSE" and "NOTICE" in the source distribution
114       for more information.
115
116
117
1182022-11-07                 pappl main loop functions         pappl-mainloop(3)
Impressum