diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2019-12-16 21:19:30 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2019-12-16 21:19:30 +0100 |
commit | 10f1958417a4944a60a08230eae6a639209d52f8 (patch) | |
tree | 7662166d1cf40507e65fba6dbb9ee73a7c652afc /manual/examples | |
parent | 963c37d5c0eb62b38f8764b23931c0dcdd497a13 (diff) | |
parent | a2e487ce1c59d19345d9ecacc58de79febd869e4 (diff) |
Merge branch 'master' of git://sourceware.org/git/glibc into upstreamupstream
Diffstat (limited to 'manual/examples')
43 files changed, 140 insertions, 84 deletions
diff --git a/manual/examples/add.c b/manual/examples/add.c index 88d3e3d5f7..d9f9dae139 100644 --- a/manual/examples/add.c +++ b/manual/examples/add.c @@ -1,5 +1,5 @@ /* Example of a Variadic Function - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <stdarg.h> diff --git a/manual/examples/argp-ex1.c b/manual/examples/argp-ex1.c index 900af1aec9..68852051ef 100644 --- a/manual/examples/argp-ex1.c +++ b/manual/examples/argp-ex1.c @@ -1,5 +1,5 @@ /* Argp example #1 -- a minimal program using argp - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* This is (probably) the smallest possible program that diff --git a/manual/examples/argp-ex2.c b/manual/examples/argp-ex2.c index 2465d418a8..450745c71d 100644 --- a/manual/examples/argp-ex2.c +++ b/manual/examples/argp-ex2.c @@ -1,5 +1,5 @@ /* Argp example #2 -- a pretty minimal program using argp - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* This program doesn't use any options or arguments, but uses diff --git a/manual/examples/argp-ex3.c b/manual/examples/argp-ex3.c index efec8e8507..3a73d761fa 100644 --- a/manual/examples/argp-ex3.c +++ b/manual/examples/argp-ex3.c @@ -1,5 +1,5 @@ /* Argp example #3 -- a program with options and arguments using argp - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* This program uses the same features as example 2, and uses options and diff --git a/manual/examples/argp-ex4.c b/manual/examples/argp-ex4.c index f560e38bfb..76bcdeaaf4 100644 --- a/manual/examples/argp-ex4.c +++ b/manual/examples/argp-ex4.c @@ -1,5 +1,5 @@ /* Argp example #4 -- a program with somewhat more complicated options - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* This program uses the same features as example 3, but has more diff --git a/manual/examples/atexit.c b/manual/examples/atexit.c index 718651e8bd..f8ebdd9783 100644 --- a/manual/examples/atexit.c +++ b/manual/examples/atexit.c @@ -1,5 +1,5 @@ /* Cleanups on Exit - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <stdio.h> diff --git a/manual/examples/db.c b/manual/examples/db.c index 93602dece5..22fbb672c3 100644 --- a/manual/examples/db.c +++ b/manual/examples/db.c @@ -1,5 +1,5 @@ /* User and Group Database Example - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <grp.h> diff --git a/manual/examples/dir.c b/manual/examples/dir.c index f9d314a780..c869a1b871 100644 --- a/manual/examples/dir.c +++ b/manual/examples/dir.c @@ -1,5 +1,5 @@ /* Simple Program to List a Directory - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /*@group*/ diff --git a/manual/examples/dir2.c b/manual/examples/dir2.c index 1403bb4ea9..0f3f224132 100644 --- a/manual/examples/dir2.c +++ b/manual/examples/dir2.c @@ -1,5 +1,5 @@ /* Simple Program to List a Directory, Mark II - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /*@group*/ diff --git a/manual/examples/execinfo.c b/manual/examples/execinfo.c index 112134a70e..7526d5a0e7 100644 --- a/manual/examples/execinfo.c +++ b/manual/examples/execinfo.c @@ -1,5 +1,5 @@ /* Obtain a backtrace and print it. - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <execinfo.h> diff --git a/manual/examples/filecli.c b/manual/examples/filecli.c index dcdb82590d..094dd216cb 100644 --- a/manual/examples/filecli.c +++ b/manual/examples/filecli.c @@ -1,5 +1,5 @@ /* Example of Reading Datagrams - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <stdio.h> diff --git a/manual/examples/filesrv.c b/manual/examples/filesrv.c index 7d9f507be2..3dc0df3138 100644 --- a/manual/examples/filesrv.c +++ b/manual/examples/filesrv.c @@ -1,5 +1,5 @@ /* Datagram Socket Example - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <stdio.h> diff --git a/manual/examples/fmtmsgexpl.c b/manual/examples/fmtmsgexpl.c index 8c1e058204..e7089a52ec 100644 --- a/manual/examples/fmtmsgexpl.c +++ b/manual/examples/fmtmsgexpl.c @@ -1,5 +1,5 @@ /* How to use fmtmsg and addseverity. - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <fmtmsg.h> diff --git a/manual/examples/genpass.c b/manual/examples/genpass.c index 23d20789fc..faba2a1f3e 100644 --- a/manual/examples/genpass.c +++ b/manual/examples/genpass.c @@ -1,5 +1,5 @@ /* Encrypting Passwords - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <stdio.h> diff --git a/manual/examples/inetcli.c b/manual/examples/inetcli.c index bcc060b7ca..685f49bc20 100644 --- a/manual/examples/inetcli.c +++ b/manual/examples/inetcli.c @@ -1,5 +1,5 @@ /* Byte Stream Socket Example - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <stdio.h> diff --git a/manual/examples/inetsrv.c b/manual/examples/inetsrv.c index ea590fe7b8..85788dc333 100644 --- a/manual/examples/inetsrv.c +++ b/manual/examples/inetsrv.c @@ -1,5 +1,5 @@ /* Byte Stream Connection Server Example - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <stdio.h> diff --git a/manual/examples/isockad.c b/manual/examples/isockad.c index 4a55e7a696..7b0261c626 100644 --- a/manual/examples/isockad.c +++ b/manual/examples/isockad.c @@ -1,5 +1,5 @@ /* Internet Socket Example using sockaddr_in. - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <stdio.h> diff --git a/manual/examples/longopt.c b/manual/examples/longopt.c index 4f33d52558..f776957534 100644 --- a/manual/examples/longopt.c +++ b/manual/examples/longopt.c @@ -1,5 +1,5 @@ /* Example of Parsing Long Options with getopt_long. - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <stdio.h> diff --git a/manual/examples/memopen.c b/manual/examples/memopen.c index 7ffd06b3eb..4c35a09ed5 100644 --- a/manual/examples/memopen.c +++ b/manual/examples/memopen.c @@ -1,5 +1,5 @@ /* String Streams - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <stdio.h> diff --git a/manual/examples/memstrm.c b/manual/examples/memstrm.c index 65147c8734..8359c59a44 100644 --- a/manual/examples/memstrm.c +++ b/manual/examples/memstrm.c @@ -1,5 +1,5 @@ /* open_memstream example. - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <stdio.h> diff --git a/manual/examples/mkdirent.c b/manual/examples/mkdirent.c index cb19c1f3cc..871f27fdca 100644 --- a/manual/examples/mkdirent.c +++ b/manual/examples/mkdirent.c @@ -1,5 +1,5 @@ /* Example for creating a struct dirent object for use with glob. - Copyright (C) 2016-2018 Free Software Foundation, Inc. + Copyright (C) 2016-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <dirent.h> diff --git a/manual/examples/mkfsock.c b/manual/examples/mkfsock.c index ebce75f4bf..4372225103 100644 --- a/manual/examples/mkfsock.c +++ b/manual/examples/mkfsock.c @@ -1,5 +1,5 @@ /* Example of Local-Namespace Sockets - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <stddef.h> diff --git a/manual/examples/mkisock.c b/manual/examples/mkisock.c index 1a13c54271..171c64a634 100644 --- a/manual/examples/mkisock.c +++ b/manual/examples/mkisock.c @@ -1,5 +1,5 @@ /* Internet Socket Example - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <stdio.h> diff --git a/manual/examples/mygetpass.c b/manual/examples/mygetpass.c index 3f465ac8ea..2896860528 100644 --- a/manual/examples/mygetpass.c +++ b/manual/examples/mygetpass.c @@ -1,5 +1,5 @@ /* Reading passphrases manually. - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <termios.h> diff --git a/manual/examples/ofdlocks.c b/manual/examples/ofdlocks.c index d6b30d68b2..c2b5e5c047 100644 --- a/manual/examples/ofdlocks.c +++ b/manual/examples/ofdlocks.c @@ -1,5 +1,5 @@ /* Open File Description Locks Usage Example - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #define _GNU_SOURCE diff --git a/manual/examples/pipe.c b/manual/examples/pipe.c index 25fed7f754..b5ecab21ca 100644 --- a/manual/examples/pipe.c +++ b/manual/examples/pipe.c @@ -1,5 +1,5 @@ /* Creating a Pipe - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <sys/types.h> diff --git a/manual/examples/popen.c b/manual/examples/popen.c index 566dbf3918..9bcc27696d 100644 --- a/manual/examples/popen.c +++ b/manual/examples/popen.c @@ -1,5 +1,5 @@ /* Pipe to a Subprocess - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <stdio.h> diff --git a/manual/examples/rprintf.c b/manual/examples/rprintf.c index 917db0866a..ee28830c0c 100644 --- a/manual/examples/rprintf.c +++ b/manual/examples/rprintf.c @@ -1,5 +1,5 @@ /* Printf Extension Example - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <stdio.h> diff --git a/manual/examples/search.c b/manual/examples/search.c index 624cf50290..7c648641dd 100644 --- a/manual/examples/search.c +++ b/manual/examples/search.c @@ -1,5 +1,5 @@ /* Searching and Sorting Example - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <stdlib.h> diff --git a/manual/examples/select.c b/manual/examples/select.c index 2a92d5358f..2e968d7f36 100644 --- a/manual/examples/select.c +++ b/manual/examples/select.c @@ -1,5 +1,5 @@ /* Waiting for Input or Output - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /*@group*/ diff --git a/manual/examples/setjmp.c b/manual/examples/setjmp.c index cc9ccc7663..105944c185 100644 --- a/manual/examples/setjmp.c +++ b/manual/examples/setjmp.c @@ -1,5 +1,5 @@ /* Introduction to Non-Local Exits - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <setjmp.h> diff --git a/manual/examples/sigh1.c b/manual/examples/sigh1.c index 9fe0fd2394..2385b7a55f 100644 --- a/manual/examples/sigh1.c +++ b/manual/examples/sigh1.c @@ -1,5 +1,5 @@ /* Signal Handlers that Return - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <signal.h> diff --git a/manual/examples/sigusr.c b/manual/examples/sigusr.c index 7dfb4cf251..7d6f450dd1 100644 --- a/manual/examples/sigusr.c +++ b/manual/examples/sigusr.c @@ -1,5 +1,5 @@ /* Using kill for Communication - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /*@group*/ diff --git a/manual/examples/stpcpy.c b/manual/examples/stpcpy.c index ab0befdf58..5c53920a63 100644 --- a/manual/examples/stpcpy.c +++ b/manual/examples/stpcpy.c @@ -1,5 +1,5 @@ /* stpcpy example. - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <string.h> diff --git a/manual/examples/strdupa.c b/manual/examples/strdupa.c index 7dc4180cf1..085dc2470d 100644 --- a/manual/examples/strdupa.c +++ b/manual/examples/strdupa.c @@ -1,5 +1,5 @@ /* strdupa example. - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <paths.h> diff --git a/manual/examples/strftim.c b/manual/examples/strftim.c index 2b7e48a1c9..20492aa281 100644 --- a/manual/examples/strftim.c +++ b/manual/examples/strftim.c @@ -1,5 +1,5 @@ /* Time Functions Example - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <time.h> diff --git a/manual/examples/subopt.c b/manual/examples/subopt.c index a3fba4b537..c6d0a1fcf8 100644 --- a/manual/examples/subopt.c +++ b/manual/examples/subopt.c @@ -1,5 +1,5 @@ /* Parsing of Suboptions Example - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <stdio.h> diff --git a/manual/examples/swapcontext.c b/manual/examples/swapcontext.c index d0b7b2b374..70c57445f3 100644 --- a/manual/examples/swapcontext.c +++ b/manual/examples/swapcontext.c @@ -1,5 +1,5 @@ /* Complete Context Control - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <signal.h> diff --git a/manual/examples/termios.c b/manual/examples/termios.c index e4e5a5540c..5e0dfccc09 100644 --- a/manual/examples/termios.c +++ b/manual/examples/termios.c @@ -1,5 +1,5 @@ /* Noncanonical Mode Example - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <unistd.h> diff --git a/manual/examples/testopt.c b/manual/examples/testopt.c index 6249f2a2ed..ea2111540b 100644 --- a/manual/examples/testopt.c +++ b/manual/examples/testopt.c @@ -1,5 +1,5 @@ /* Example of Parsing Arguments with getopt. - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /*@group*/ diff --git a/manual/examples/testpass.c b/manual/examples/testpass.c index f8883fea17..2bf282a943 100644 --- a/manual/examples/testpass.c +++ b/manual/examples/testpass.c @@ -1,5 +1,5 @@ /* Verify a passphrase. - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <stdio.h> diff --git a/manual/examples/timeval_subtract.c b/manual/examples/timeval_subtract.c index 77265bb252..edca57739a 100644 --- a/manual/examples/timeval_subtract.c +++ b/manual/examples/timeval_subtract.c @@ -1,5 +1,5 @@ /* struct timeval subtraction. - Copyright (C) 1991-2018 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, if not, see <http://www.gnu.org/licenses/>. + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Subtract the `struct timeval' values X and Y, diff --git a/manual/examples/twalk.c b/manual/examples/twalk.c new file mode 100644 index 0000000000..afa2b6e8a4 --- /dev/null +++ b/manual/examples/twalk.c @@ -0,0 +1,56 @@ +/* Implement twalk using twalk_r. + Copyright (C) 2019 Free Software Foundation, Inc. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <https://www.gnu.org/licenses/>. +*/ + +#include <search.h> + +struct twalk_with_twalk_r_closure +{ + void (*action) (const void *, VISIT, int); + int depth; +}; + +static void +twalk_with_twalk_r_action (const void *nodep, VISIT which, void *closure0) +{ + struct twalk_with_twalk_r_closure *closure = closure0; + + switch (which) + { + case leaf: + closure->action (nodep, which, closure->depth); + break; + case preorder: + closure->action (nodep, which, closure->depth); + ++closure->depth; + break; + case postorder: + /* The preorder action incremented the depth. */ + closure->action (nodep, which, closure->depth - 1); + break; + case endorder: + --closure->depth; + closure->action (nodep, which, closure->depth); + break; + } +} + +void +twalk (const void *root, void (*action) (const void *, VISIT, int)) +{ + struct twalk_with_twalk_r_closure closure = { action, 0 }; + twalk_r (root, twalk_with_twalk_r_action, &closure); +} |