summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoraaron <>2000-12-15 14:15:27 +0000
committeraaron <>2000-12-15 14:15:27 +0000
commit891cc7cb8a6b51c9682509cda3b1a0a1fcd5ca7b (patch)
tree18630aa78735731f4c77400e45f07601a7a64940 /src
parent6d650c0999a20e109cfad0362536ed667b18086f (diff)
downloadopenbsd-891cc7cb8a6b51c9682509cda3b1a0a1fcd5ca7b.tar.gz
openbsd-891cc7cb8a6b51c9682509cda3b1a0a1fcd5ca7b.tar.bz2
openbsd-891cc7cb8a6b51c9682509cda3b1a0a1fcd5ca7b.zip
.Sh EXAMPLE -> .Sh EXAMPLES. Move this section before SEE ALSO where it
belongs. Closes PR/1554 from bk@rt.fm.
Diffstat (limited to 'src')
-rw-r--r--src/lib/libc/stdlib/getopt.356
1 files changed, 28 insertions, 28 deletions
diff --git a/src/lib/libc/stdlib/getopt.3 b/src/lib/libc/stdlib/getopt.3
index ef132cafc5..878290f542 100644
--- a/src/lib/libc/stdlib/getopt.3
+++ b/src/lib/libc/stdlib/getopt.3
@@ -29,7 +29,7 @@
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE. 30.\" SUCH DAMAGE.
31.\" 31.\"
32.\" $OpenBSD: getopt.3,v 1.13 2000/04/20 13:50:02 aaron Exp $ 32.\" $OpenBSD: getopt.3,v 1.14 2000/12/15 14:15:27 aaron Exp $
33.\" 33.\"
34.Dd April 19, 1994 34.Dd April 19, 1994
35.Dt GETOPT 3 35.Dt GETOPT 3
@@ -126,6 +126,33 @@ When all options have been processed (i.e., up to the first non-option
126argument), 126argument),
127.Fn getopt 127.Fn getopt
128returns \-1. 128returns \-1.
129.Sh EXAMPLES
130.Bd -literal -compact
131extern char *optarg;
132extern int optind;
133int bflag, ch, fd;
134
135bflag = 0;
136while ((ch = getopt(argc, argv, "bf:")) != -1) {
137 switch (ch) {
138 case 'b':
139 bflag = 1;
140 break;
141 case 'f':
142 if ((fd = open(optarg, O_RDONLY, 0)) < 0) {
143 (void)fprintf(stderr,
144 "myname: %s: %s\en", optarg, strerror(errno));
145 exit(1);
146 }
147 break;
148 case '?':
149 default:
150 usage();
151 }
152}
153argc -= optind;
154argv += optind;
155.Ed
129.Sh SEE ALSO 156.Sh SEE ALSO
130.Xr getopt 1 , 157.Xr getopt 1 ,
131.Xr getsubopt 3 158.Xr getsubopt 3
@@ -162,33 +189,6 @@ function multiple times.
162This is an extension to the 189This is an extension to the
163.St -p1003.2 190.St -p1003.2
164specification. 191specification.
165.Sh EXAMPLE
166.Bd -literal -compact
167extern char *optarg;
168extern int optind;
169int bflag, ch, fd;
170
171bflag = 0;
172while ((ch = getopt(argc, argv, "bf:")) != -1) {
173 switch (ch) {
174 case 'b':
175 bflag = 1;
176 break;
177 case 'f':
178 if ((fd = open(optarg, O_RDONLY, 0)) < 0) {
179 (void)fprintf(stderr,
180 "myname: %s: %s\en", optarg, strerror(errno));
181 exit(1);
182 }
183 break;
184 case '?':
185 default:
186 usage();
187 }
188}
189argc -= optind;
190argv += optind;
191.Ed
192.Sh HISTORY 192.Sh HISTORY
193The 193The
194.Fn getopt 194.Fn getopt