annotate lib/unlockpt.c @ 40231:9b3c79fdfe0b

strtod: fix clash with strtold Problem reported for RHEL 5 by Jesse Caldwell (Bug#34817). * lib/strtod.c (compute_minus_zero, minus_zero): Simplify by remving the macro / external variable, and having just a function. User changed. This avoids the need for an external variable that might clash.
author Paul Eggert <eggert@cs.ucla.edu>
date Mon, 11 Mar 2019 16:40:29 -0700
parents b06060465f09
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13030
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Unlock the slave side of a pseudo-terminal from its master side.
40057
b06060465f09 maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents: 19484
diff changeset
2 Copyright (C) 1998, 2010-2019 Free Software Foundation, Inc.
13030
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3 Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 This program is free software: you can redistribute it and/or modify
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 it under the terms of the GNU General Public License as published by
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 the Free Software Foundation; either version 3 of the License, or
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 (at your option) any later version.
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 GNU General Public License for more details.
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
19190
9759915b2aca all: prefer https: URLs
Paul Eggert <eggert@cs.ucla.edu>
parents: 18626
diff changeset
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
13030
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18 #include <config.h>
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20 #include <stdlib.h>
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21
15979
69cc1dcd696b unlockpt: Detect invalid argument.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
22 #include <fcntl.h>
13030
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 #include <unistd.h>
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 int
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 unlockpt (int fd)
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 {
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 /* Platforms which have the TIOCSPTLCK ioctl (Linux) already have the
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 unlockpt function. */
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30 #if HAVE_REVOKE
16935
498a2211d839 Write "Mac OS X" instead of "MacOS X".
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
31 /* Mac OS X 10.3, OpenBSD 3.8 do not have the unlockpt function, but they
13030
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 have revoke(). */
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33 char *name = ptsname (fd);
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 if (name == NULL)
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35 return -1;
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 return revoke (name);
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37 #else
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 /* Assume that the slave side of a pseudo-terminal is already unlocked
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39 by default. */
15979
69cc1dcd696b unlockpt: Detect invalid argument.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
40 if (fcntl (fd, F_GETFD) < 0)
69cc1dcd696b unlockpt: Detect invalid argument.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
41 return -1;
13030
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 return 0;
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43 #endif
e947b6ae7d08 New module 'unlockpt'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44 }