summaryrefslogtreecommitdiff
path: root/man/sd_login_monitor_new.xml
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-07-27 08:24:45 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-08-02 15:45:24 +0200
commit787f78b6a106d34bbf52eabb02995733ea6a7d4d (patch)
treeb23f4929a95d2c641526084e9330c933348ac2af /man/sd_login_monitor_new.xml
parent2c47fff6d2d9750ddf9e97fc45714aa8984b5eb6 (diff)
downloadsystemd-787f78b6a106d34bbf52eabb02995733ea6a7d4d.tar.gz
man: move more examples to stand-alone files and use 2-space indentation consistenty
Moving them out makes it easier to run them through a compiler, use automatic indentation, and opens the possibility to provide a download link in the future. I verified that all examples compile cleanly. (2-space indentation is used because the examples are already significantly indented in the man page, and we need to keep them narrow so that they display well on standard terminals.)
Diffstat (limited to 'man/sd_login_monitor_new.xml')
-rw-r--r--man/sd_login_monitor_new.xml26
1 files changed, 13 insertions, 13 deletions
diff --git a/man/sd_login_monitor_new.xml b/man/sd_login_monitor_new.xml
index 23f685bb31..d914e51d0d 100644
--- a/man/sd_login_monitor_new.xml
+++ b/man/sd_login_monitor_new.xml
@@ -115,13 +115,13 @@
code block is left:</para>
<programlisting>{
- __attribute__((cleanup(sd_login_monitor_unrefp)) sd_login_monitor *m = NULL;
- int r;
- …
- r = sd_login_monitor_default(&amp;m);
- if (r &lt; 0)
- fprintf(stderr, "Failed to allocate login monitor object: %s\n", strerror(-r));
- …
+ __attribute__((cleanup(sd_login_monitor_unrefp)) sd_login_monitor *m = NULL;
+ int r;
+ …
+ r = sd_login_monitor_default(&amp;m);
+ if (r &lt; 0)
+ fprintf(stderr, "Failed to allocate login monitor object: %s\n", strerror(-r));
+ …
}</programlisting>
<para><function>sd_login_monitor_flush()</function> may be used to
@@ -176,13 +176,13 @@
int msec;
sd_login_monitor_get_timeout(m, &amp;t);
if (t == (uint64_t) -1)
- msec = -1;
+ msec = -1;
else {
- struct timespec ts;
- uint64_t n;
- clock_gettime(CLOCK_MONOTONIC, &amp;ts);
- n = (uint64_t) ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
- msec = t > n ? (int) ((t - n + 999) / 1000) : 0;
+ struct timespec ts;
+ uint64_t n;
+ clock_gettime(CLOCK_MONOTONIC, &amp;ts);
+ n = (uint64_t) ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
+ msec = t > n ? (int) ((t - n + 999) / 1000) : 0;
}</programlisting>
<para>The code above does not do any error checking for brevity's