Skip to contentSkip to conversation

EXIT_SUCCESS.3const EXIT_FAILURE.3const: Add pages

PATCH Superseded Thomas Voss 2 participants 11 messages Nov 16, 2022 – Nov 17, 2022 Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 EXIT_SUCCESS.3const EXIT_FAILURE.3const: Add pages

I see we have manuals for constants, types, and more now! That sure brings a smile to my face :). I guess I might help out a bit will filling out some of the missing manuals.

---
 man3const/EXIT_FAILURE.3const |  1 +
 man3const/EXIT_SUCCESS.3const | 58 +++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+)
 create mode 100644 man3const/EXIT_FAILURE.3const
 create mode 100644 man3const/EXIT_SUCCESS.3const
man3const/EXIT_FAILURE.3const new file +1 -0
new file mode 100644
index 000000000..ba0d62df9
@@ -0,0 +1 @@
+.so man3const/EXIT_SUCCESS.3const
man3const/EXIT_SUCCESS.3const new file +58 -0

58 lines not on this page · raw message

Signature · 1 line
2.38.1
#1 lore raw

Hi Thomas,

Quoted 2 lines · Thomas Voss

I see we have manuals for constants, types, and more now! That sure brings a smile to my face :).

It's good to see that there's audience that likes these. :)

Quoted 2 lines

I guess I might help out a bit will filling out some of
the missing manuals.

Sure.

Quoted 28 lines
---
  man3const/EXIT_FAILURE.3const |  1 +
  man3const/EXIT_SUCCESS.3const | 58 +++++++++++++++++++++++++++++++++++
  2 files changed, 59 insertions(+)

create mode 100644 man3const/EXIT_FAILURE.3const create mode 100644 man3const/EXIT_SUCCESS.3const

man3const/EXIT_FAILURE.3const new file +1 -0
new file mode 100644
index 000000000..ba0d62df9
@@ -0,0 +1 @@
+.so man3const/EXIT_SUCCESS.3const
man3const/EXIT_SUCCESS.3const new file +6 -0
new file mode 100644
index 000000000..dd6f908e5
@@ -0,0 +1,58 @@
+.\" Copyright (c) 2022 by Thomas Voss <[email protected]>
+.\"
+.\" SPDX-License-Identifier: Linux-man-pages-copyleft
+.\"
+.\"
+.TH EXIT_SUCCESS 3const (date) "Linux man-pages (unreleased)"

man3const/EXIT_SUCCESS.3const line 16

Quoted 10 lines
man3const/EXIT_SUCCESS.3const new file +10 -0
+.SH NAME
+EXIT_SUCCESS, EXIT_FAILURE \- termination status constants
+.SH LIBRARY
+Standard C library
+.RI ( libc )
+.SH SYNOPSIS
+.nf
+.B #include <stdlib.h>
+.PP
+.B "#define EXIT_SUCCESS  /* ... */"

Although ISO C leaves the value unspecified, POSIX guarantees it is 0, so I'd document it as such.

The exact definition in glibc is (in my system):

    $ grepc EXIT_SUCCESS /usr/include/stdlib.h
    /usr/include/stdlib.h:93:
    #define	EXIT_SUCCESS	0	/* Successful exit status.  */

So I'd document it as:

.B "#define EXIT_SUCCESS 0"

man3const/EXIT_SUCCESS.3const line 17

Quoted 1 line
man3const/EXIT_SUCCESS.3const new file +1 -0
+.B "#define EXIT_FAILURE  /* ... */"

The /* ... */ should not be in bold (which makes me realize I did it wrong in EOF.3const, sorry). Also, POSIX specifies that it should be a non-zero value, so I'd document it as:

.BR "#define EXIT_FAILURE" " /* non-zero */"

man3const/EXIT_SUCCESS.3const line 20

Quoted 3 lines
man3const/EXIT_SUCCESS.3const new file +3 -0
+.fi
+.SH DESCRIPTION
+.BR EXIT_SUCCESS " and " EXIT_FAILURE

We use separate lines for separate identifiers:

.B EXIT_SUCCESS
and
.B EXIT_FAILURE

man3const/EXIT_SUCCESS.3const line 23

Quoted 3 lines
man3const/EXIT_SUCCESS.3const new file +3 -0
+represent a successful and unsuccessful exit status respectively.
+Both macros are constant expressions of type
+.I int

Being "constant expressions of type int" is is true of most constants in C, so I think I'd skip it.

Quoted 18 lines
man3const/EXIT_SUCCESS.3const new file +18 -0
+which can be used as arguments to the
+.BR exit ()
+function.
+.SH CONFORMING TO
+C99 and later;
+POSIX.1-2001 and later.
+.SH EXAMPLES
+.\" SRC BEGIN (EXIT_SUCCESS.c)
+.EX
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main(int argc, char *argv[])
+{
+    FILE *fp;
+
+    if (argc != 2) {

man3const/EXIT_SUCCESS.3const line 51

Quoted 10 lines
man3const/EXIT_SUCCESS.3const new file +10 -0
+        fprintf(stderr, "Usage: %s <file>\en", argv[0]);
+        exit(EXIT_FAILURE);
+    }
+
+    if ((fp = fopen(argv[1], "r")) == NULL) {
+        perror(argv[1]);
+        exit(EXIT_FAILURE);
+    }
+
+    /* Other code omitted */

But please don't omit fclose(3).

man3const/EXIT_SUCCESS.3const line 58

Quoted 7 lines
man3const/EXIT_SUCCESS.3const new file +7 -0
+
+    exit(EXIT_SUCCESS);
+}
+.EE
+.\" SRC END
+.SH SEE ALSO
+.BR exit (3)

Thanks!

Alex

Signature · 1 line
<http://www.alejandro-colomar.es/>
#2 lore raw
Quoted 63 lines · Alejandro Colomar

Hi Thomas,

Quoted 2 lines · Thomas Voss

I see we have manuals for constants, types, and more now!  That sure brings a smile to my face :).

It's good to see that there's audience that likes these.  :)

Quoted 2 lines

 I guess I might help out a bit will filling out some of the missing manuals.

Sure.

Quoted 28 lines

---
  man3const/EXIT_FAILURE.3const |  1 + man3const/EXIT_SUCCESS.3const | 58 +++++++++++++++++++++++++++++++++++

  2 files changed, 59 insertions(+)

  create mode 100644 man3const/EXIT_FAILURE.3const create mode 100644 man3const/EXIT_SUCCESS.3const

man3const/EXIT_FAILURE.3const new file +1 -0
new file mode 100644
index 000000000..ba0d62df9
@@ -0,0 +1 @@
+.so man3const/EXIT_SUCCESS.3const
man3const/EXIT_SUCCESS.3const new file +6 -0
new file mode 100644
index 000000000..dd6f908e5
@@ -0,0 +1,58 @@
+.\" Copyright (c) 2022 by Thomas Voss <[email protected]>
+.\"
+.\" SPDX-License-Identifier: Linux-man-pages-copyleft
+.\"
+.\"
+.TH EXIT_SUCCESS 3const (date) "Linux man-pages (unreleased)"

man3const/EXIT_SUCCESS.3const line 16

Quoted 10 lines
man3const/EXIT_SUCCESS.3const new file +10 -0
+.SH NAME
+EXIT_SUCCESS, EXIT_FAILURE \- termination status constants
+.SH LIBRARY
+Standard C library
+.RI ( libc )
+.SH SYNOPSIS
+.nf
+.B #include <stdlib.h>
+.PP
+.B "#define EXIT_SUCCESS  /* ... */"

Although ISO C leaves the value unspecified, POSIX guarantees it is 0, so I'd document it as such.

The exact definition in glibc is (in my system):

     $ grepc EXIT_SUCCESS /usr/include/stdlib.h
     /usr/include/stdlib.h:93:
     #define    EXIT_SUCCESS    0    /* Successful exit status.  */

So I'd document it as:

Quoted 7 lines

.B "#define EXIT_SUCCESS  0"

man3const/EXIT_SUCCESS.3const line 17

Quoted 1 line
man3const/EXIT_SUCCESS.3const new file +1 -0
+.B "#define EXIT_FAILURE  /* ... */"

The /* ... */ should not be in bold (which makes me realize I did it wrong in EOF.3const, sorry).  Also, POSIX specifies that it should be a non-zero value, so I'd document it as:

.BR "#define EXIT_FAILURE" "  /* non-zero */"

Quick self-correction:

In man-pages(7), our guide style says we should use nonzero rather than non-zero.

Signature · 1 line
<http://www.alejandro-colomar.es/>
#3 lore raw

PATCH v2 1/1 EXIT_SUCCESS.3const EXIT_FAILURE.3const: Add pages

---

Quoted 2 lines

Being "constant expressions of type int" is is true of most constants in C, so I think I'd skip it.

I think it's pretty obvious to most people, but the manual doesn't have too much to say so it's not exactly taking up any space and I don't think it hurts to mention, but it also doesn't matter too much :P. Here's a v2 with the changes you pointed out.

 man3const/EXIT_FAILURE.3const |  1 +
 man3const/EXIT_SUCCESS.3const | 59 +++++++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+)
 create mode 100644 man3const/EXIT_FAILURE.3const
 create mode 100644 man3const/EXIT_SUCCESS.3const
man3const/EXIT_FAILURE.3const new file +1 -0
new file mode 100644
index 000000000..ba0d62df9
@@ -0,0 +1 @@
+.so man3const/EXIT_SUCCESS.3const
man3const/EXIT_SUCCESS.3const new file +59 -0

59 lines not on this page · raw message

Signature · 1 line
2.38.1
#4 lore raw

Hi Thomas,

Quoted 35 lines · Thomas Voss

---

Quoted 2 lines

Being "constant expressions of type int" is is true of most constants in C, so I think I'd skip it.

I think it's pretty obvious to most people, but the manual doesn't have too much to say so it's not exactly taking up any space and I don't think it hurts to mention, but it also doesn't matter too much :P. Here's a v2 with the changes you pointed out.

  man3const/EXIT_FAILURE.3const |  1 +
  man3const/EXIT_SUCCESS.3const | 59 +++++++++++++++++++++++++++++++++++
  2 files changed, 60 insertions(+)

create mode 100644 man3const/EXIT_FAILURE.3const create mode 100644 man3const/EXIT_SUCCESS.3const

man3const/EXIT_FAILURE.3const new file +1 -0
new file mode 100644
index 000000000..ba0d62df9
@@ -0,0 +1 @@
+.so man3const/EXIT_SUCCESS.3const
man3const/EXIT_SUCCESS.3const new file +6 -0
new file mode 100644
index 000000000..f125afb32
@@ -0,0 +1,59 @@
+.\" Copyright (c) 2022 by Thomas Voss <[email protected]>
+.\"
+.\" SPDX-License-Identifier: Linux-man-pages-copyleft
+.\"
+.\"
+.TH EXIT_SUCCESS 3const (date) "Linux man-pages (unreleased)"

man3const/EXIT_SUCCESS.3const line 16

Quoted 10 lines
man3const/EXIT_SUCCESS.3const new file +10 -0
+.SH NAME
+EXIT_SUCCESS, EXIT_FAILURE \- termination status constants
+.SH LIBRARY
+Standard C library
+.RI ( libc )
+.SH SYNOPSIS
+.nf
+.B #include <stdlib.h>
+.PP
+.BR "#define EXIT_SUCCESS "  0

I prefer 2 spaces between the macro name and the expansion, so please one more space before the quote.

man3const/EXIT_SUCCESS.3const line 17

Quoted 1 line
man3const/EXIT_SUCCESS.3const new file +1 -0
+.BR "#define EXIT_FAILURE "  /* nonzero */

"/* nonzero */" needs to be quoted too.

man3const/EXIT_SUCCESS.3const line 25

Quoted 8 lines
man3const/EXIT_SUCCESS.3const new file +8 -0
+.fi
+.SH DESCRIPTION
+.B EXIT_SUCCESS
+and
+.B EXIT_FAILURE
+represent a successful and unsuccessful exit status respectively and can be used
+as arguments to the
+.BR exit ()

.BR exit (3)

Quoted 24 lines
man3const/EXIT_SUCCESS.3const new file +24 -0
+function.
+.SH CONFORMING TO
+C99 and later;
+POSIX.1-2001 and later.
+.SH EXAMPLES
+.\" SRC BEGIN (EXIT_SUCCESS.c)
+.EX
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main(int argc, char *argv[])
+{
+    FILE *fp;
+
+    if (argc != 2) {
+        fprintf(stderr, "Usage: %s <file>\en", argv[0]);
+        exit(EXIT_FAILURE);
+    }
+
+    if ((fp = fopen(argv[1], "r")) == NULL) {
+        perror(argv[1]);
+        exit(EXIT_FAILURE);
+    }

man3const/EXIT_SUCCESS.3const line 59

Quoted 10 lines
man3const/EXIT_SUCCESS.3const new file +10 -0
+
+    /* Other code omitted */
+
+    fclose(fp);
+    exit(EXIT_SUCCESS);
+}
+.EE
+.\" SRC END
+.SH SEE ALSO
+.BR exit (3)

Also interesting:

.BR sysexits.h (3head)

Cheers,

Alex

Signature · 1 line
<http://www.alejandro-colomar.es/>
#5 lore raw

PATCH v3 1/1 EXIT_SUCCESS.3const EXIT_FAILURE.3const: Add pages

---
 man3const/EXIT_FAILURE.3const |  1 +
 man3const/EXIT_SUCCESS.3const | 60 +++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+)
 create mode 100644 man3const/EXIT_FAILURE.3const
 create mode 100644 man3const/EXIT_SUCCESS.3const
man3const/EXIT_FAILURE.3const new file +1 -0
new file mode 100644
index 000000000..ba0d62df9
@@ -0,0 +1 @@
+.so man3const/EXIT_SUCCESS.3const
man3const/EXIT_SUCCESS.3const new file +60 -0

60 lines not on this page · raw message

Signature · 1 line
2.38.1
#6 lore raw
In reply to Alejandro Colomar

Hi Thomas,

You missed a few comments in v3. Please check below. But mostly looks good.

Cheers,
Alex

Quoted 23 lines · Alejandro Colomar
Quoted 23 lines
man3const/EXIT_FAILURE.3const new file +1 -0
new file mode 100644
index 000000000..ba0d62df9
@@ -0,0 +1 @@
+.so man3const/EXIT_SUCCESS.3const
man3const/EXIT_SUCCESS.3const new file +10 -0
new file mode 100644
index 000000000..f125afb32
@@ -0,0 +1,59 @@
+.\" Copyright (c) 2022 by Thomas Voss <[email protected]>
+.\"
+.\" SPDX-License-Identifier: Linux-man-pages-copyleft
+.\"
+.\"
+.TH EXIT_SUCCESS 3const (date) "Linux man-pages (unreleased)"
+.SH NAME
+EXIT_SUCCESS, EXIT_FAILURE \- termination status constants
+.SH LIBRARY
+Standard C library
Quoted 8 lines

man3const/EXIT_SUCCESS.3const line 16

Quoted 6 lines
man3const/EXIT_SUCCESS.3const new file +6 -0
+.RI ( libc )
+.SH SYNOPSIS
+.nf
+.B #include <stdlib.h>
+.PP
+.BR "#define EXIT_SUCCESS "  0

I prefer 2 spaces between the macro name and the expansion, so please one more space before the quote.

this

Quoted 4 lines

man3const/EXIT_SUCCESS.3const line 17

Quoted 2 lines
man3const/EXIT_SUCCESS.3const new file +1 -0
+.BR "#define EXIT_FAILURE "  /* nonzero */

"/* nonzero */" needs to be quoted too.

this

Quoted 11 lines

man3const/EXIT_SUCCESS.3const line 25

Quoted 9 lines
man3const/EXIT_SUCCESS.3const new file +8 -0
+.fi
+.SH DESCRIPTION
+.B EXIT_SUCCESS
+and
+.B EXIT_FAILURE
+represent a successful and unsuccessful exit status respectively and can be used
+as arguments to the
+.BR exit ()

.BR exit (3)

this

Quoted 45 lines
Quoted 25 lines
man3const/EXIT_SUCCESS.3const new file +24 -0
+function.
+.SH CONFORMING TO
+C99 and later;
+POSIX.1-2001 and later.
+.SH EXAMPLES
+.\" SRC BEGIN (EXIT_SUCCESS.c)
+.EX
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main(int argc, char *argv[])
+{
+    FILE *fp;
+
+    if (argc != 2) {
+        fprintf(stderr, "Usage: %s <file>\en", argv[0]);
+        exit(EXIT_FAILURE);
+    }
+
+    if ((fp = fopen(argv[1], "r")) == NULL) {
+        perror(argv[1]);
+        exit(EXIT_FAILURE);
+    }

man3const/EXIT_SUCCESS.3const line 59

Quoted 10 lines
man3const/EXIT_SUCCESS.3const new file +10 -0
+
+    /* Other code omitted */
+
+    fclose(fp);
+    exit(EXIT_SUCCESS);
+}
+.EE
+.\" SRC END
+.SH SEE ALSO
+.BR exit (3)

Also interesting:

.BR sysexits.h (3head)

Cheers,

Alex

Signature · 1 line
<http://www.alejandro-colomar.es/>
#7 lore raw

PATCH 1/1 EXIT_SUCCESS.3const EXIT_FAILURE.3const: Add pages

---
Alright, hopefully this is it. Feels a bit weird not using mdoc(7) for once :P.

 man3const/EXIT_FAILURE.3const |  1 +
 man3const/EXIT_SUCCESS.3const | 60 +++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+)
 create mode 100644 man3const/EXIT_FAILURE.3const
 create mode 100644 man3const/EXIT_SUCCESS.3const
man3const/EXIT_FAILURE.3const new file +1 -0
new file mode 100644
index 000000000..ba0d62df9
@@ -0,0 +1 @@
+.so man3const/EXIT_SUCCESS.3const
man3const/EXIT_SUCCESS.3const new file +60 -0

60 lines not on this page · raw message

Signature · 1 line
2.38.1
#8 lore raw
Quoted 3 lines · Thomas Voss

---
Alright, hopefully this is it. Feels a bit weird not using mdoc(7) for once :P.

Heh. One last minor nitpick.

Quoted 34 lines
  man3const/EXIT_FAILURE.3const |  1 +
  man3const/EXIT_SUCCESS.3const | 60 +++++++++++++++++++++++++++++++++++
  2 files changed, 61 insertions(+)

create mode 100644 man3const/EXIT_FAILURE.3const create mode 100644 man3const/EXIT_SUCCESS.3const

man3const/EXIT_FAILURE.3const new file +1 -0
new file mode 100644
index 000000000..ba0d62df9
@@ -0,0 +1 @@
+.so man3const/EXIT_SUCCESS.3const
man3const/EXIT_SUCCESS.3const new file +14 -0
new file mode 100644
index 000000000..c0b478e89
@@ -0,0 +1,60 @@
+.\" Copyright (c) 2022 by Thomas Voss <[email protected]>
+.\"
+.\" SPDX-License-Identifier: Linux-man-pages-copyleft
+.\"
+.\"
+.TH EXIT_SUCCESS 3const (date) "Linux man-pages (unreleased)"
+.SH NAME
+EXIT_SUCCESS, EXIT_FAILURE \- termination status constants
+.SH LIBRARY
+Standard C library
+.RI ( libc )
+.SH SYNOPSIS
+.nf
+.B #include <stdlib.h>

man3const/EXIT_SUCCESS.3const line 24

Quoted 10 lines
man3const/EXIT_SUCCESS.3const new file +10 -0
+.PP
+.BR "#define EXIT_SUCCESS  "  0
+.BR "#define EXIT_FAILURE  "  "/* nonzero */"
+.fi
+.SH DESCRIPTION
+.B EXIT_SUCCESS
+and
+.B EXIT_FAILURE
+represent a successful and unsuccessful exit status respectively and can be used
+as arguments to the

I'd add a comma: s/respectively and/respectively, and/

After that, I'd break the line after the comma (and un-break it after "used").

See man-pages(7):
Use semantic newlines
In the source of a manual page, new sentences should be started on new lines, long sentences should be split into lines at clause breaks (commas, semicolons, colons, and so on), and long clauses should be split at phrase bound‐
aries. This convention, sometimes known as "semantic
newlines", makes it easier to see the effect of patches, which often operate at the level of individual sentences, clauses, or phrases.

Cheers,

Alex

Quoted 36 lines
man3const/EXIT_SUCCESS.3const new file +36 -0
+.BR exit (3)
+function.
+.SH CONFORMING TO
+C99 and later;
+POSIX.1-2001 and later.
+.SH EXAMPLES
+.\" SRC BEGIN (EXIT_SUCCESS.c)
+.EX
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main(int argc, char *argv[])
+{
+    FILE *fp;
+
+    if (argc != 2) {
+        fprintf(stderr, "Usage: %s <file>\en", argv[0]);
+        exit(EXIT_FAILURE);
+    }
+
+    if ((fp = fopen(argv[1], "r")) == NULL) {
+        perror(argv[1]);
+        exit(EXIT_FAILURE);
+    }
+
+    /* Other code omitted */
+
+    fclose(fp);
+    exit(EXIT_SUCCESS);
+}
+.EE
+.\" SRC END
+.SH SEE ALSO
+.BR exit (3),
+.BR sysexits.h (3head)
Signature · 1 line
<http://www.alejandro-colomar.es/>
#9 lore raw

PATCH v5 1/1 EXIT_SUCCESS.3const EXIT_FAILURE.3const: Add pages

---
Ok, surely this is the last one! Time to read man-pages(7).

 man3const/EXIT_FAILURE.3const |  1 +
 man3const/EXIT_SUCCESS.3const | 60 +++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+)
 create mode 100644 man3const/EXIT_FAILURE.3const
 create mode 100644 man3const/EXIT_SUCCESS.3const
man3const/EXIT_FAILURE.3const new file +1 -0
new file mode 100644
index 000000000..ba0d62df9
@@ -0,0 +1 @@
+.so man3const/EXIT_SUCCESS.3const
man3const/EXIT_SUCCESS.3const new file +60 -0

60 lines not on this page · raw message

Signature · 1 line
2.38.1
#10 lore raw

Hi Thomas,

Quoted 3 lines · Thomas Voss

---
Ok, surely this is the last one!

Patch applied. Thanks!

Quoted 1 line

Time to read man-pages(7).

:)

Cheers,

Alex

Quoted 80 lines
  man3const/EXIT_FAILURE.3const |  1 +
  man3const/EXIT_SUCCESS.3const | 60 +++++++++++++++++++++++++++++++++++
  2 files changed, 61 insertions(+)

create mode 100644 man3const/EXIT_FAILURE.3const create mode 100644 man3const/EXIT_SUCCESS.3const

man3const/EXIT_FAILURE.3const new file +1 -0
new file mode 100644
index 000000000..ba0d62df9
@@ -0,0 +1 @@
+.so man3const/EXIT_SUCCESS.3const
man3const/EXIT_SUCCESS.3const new file +60 -0
new file mode 100644
index 000000000..fd3595f83
@@ -0,0 +1,60 @@
+.\" Copyright (c) 2022 by Thomas Voss <[email protected]>
+.\"
+.\" SPDX-License-Identifier: Linux-man-pages-copyleft
+.\"
+.\"
+.TH EXIT_SUCCESS 3const (date) "Linux man-pages (unreleased)"
+.SH NAME
+EXIT_SUCCESS, EXIT_FAILURE \- termination status constants
+.SH LIBRARY
+Standard C library
+.RI ( libc )
+.SH SYNOPSIS
+.nf
+.B #include <stdlib.h>
+.PP
+.BR "#define EXIT_SUCCESS  "  0
+.BR "#define EXIT_FAILURE  "  "/* nonzero */"
+.fi
+.SH DESCRIPTION
+.B EXIT_SUCCESS
+and
+.B EXIT_FAILURE
+represent a successful and unsuccessful exit status respectively,
+and can be used as arguments to the
+.BR exit (3)
+function.
+.SH CONFORMING TO
+C99 and later;
+POSIX.1-2001 and later.
+.SH EXAMPLES
+.\" SRC BEGIN (EXIT_SUCCESS.c)
+.EX
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main(int argc, char *argv[])
+{
+    FILE *fp;
+
+    if (argc != 2) {
+        fprintf(stderr, "Usage: %s <file>\en", argv[0]);
+        exit(EXIT_FAILURE);
+    }
+
+    if ((fp = fopen(argv[1], "r")) == NULL) {
+        perror(argv[1]);
+        exit(EXIT_FAILURE);
+    }
+
+    /* Other code omitted */
+
+    fclose(fp);
+    exit(EXIT_SUCCESS);
+}
+.EE
+.\" SRC END
+.SH SEE ALSO
+.BR exit (3),
+.BR sysexits.h (3head)
Signature · 1 line
<http://www.alejandro-colomar.es/>