BZ #13792: License manual example source files under GPL.
authorRoland McGrath <roland@hack.frob.com>
Sat, 3 Mar 2012 00:50:06 +0000 (16:50 -0800)
committerRoland McGrath <roland@hack.frob.com>
Sat, 3 Mar 2012 00:52:01 +0000 (16:52 -0800)
44 files changed:
ChangeLog
manual/Makefile
manual/examples/README [new file with mode: 0644]
manual/examples/add.c
manual/examples/argp-ex1.c
manual/examples/argp-ex2.c
manual/examples/argp-ex3.c
manual/examples/argp-ex4.c
manual/examples/atexit.c
manual/examples/db.c
manual/examples/dir.c
manual/examples/dir2.c
manual/examples/execinfo.c
manual/examples/filecli.c
manual/examples/filesrv.c
manual/examples/fmtmsgexpl.c
manual/examples/genpass.c
manual/examples/inetcli.c
manual/examples/inetsrv.c
manual/examples/isockad.c
manual/examples/longopt.c
manual/examples/memopen.c
manual/examples/memstrm.c
manual/examples/mkfsock.c
manual/examples/mkisock.c
manual/examples/mygetpass.c
manual/examples/pipe.c
manual/examples/popen.c
manual/examples/rprintf.c
manual/examples/search.c
manual/examples/select.c
manual/examples/setjmp.c
manual/examples/sigh1.c
manual/examples/sigusr.c
manual/examples/stpcpy.c
manual/examples/strdupa.c
manual/examples/strftim.c
manual/examples/strncat.c
manual/examples/subopt.c
manual/examples/swapcontext.c
manual/examples/termios.c
manual/examples/testopt.c
manual/examples/testpass.c
manual/examples/timeval_subtract.c

index 1fa12aa..2ca5280 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,53 @@
 2012-03-02  Roland McGrath  <roland@hack.frob.com>
 
        [BZ #13792]
+       * manual/examples/README: New file, says the example source files
+       can be used under GPL>=2.
+       * manual/Makefile (%.c.texi): Eat the leading part of the file until a
+       line containing just "*/".
+       * manual/examples/add.c: Add copyright header (GPL>=2).
+       * manual/examples/argp-ex1.c: Likewise.
+       * manual/examples/argp-ex2.c: Likewise.
+       * manual/examples/argp-ex3.c: Likewise.
+       * manual/examples/argp-ex4.c: Likewise.
+       * manual/examples/atexit.c: Likewise.
+       * manual/examples/db.c: Likewise.
+       * manual/examples/dir.c: Likewise.
+       * manual/examples/dir2.c: Likewise.
+       * manual/examples/execinfo.c: Likewise.
+       * manual/examples/filecli.c: Likewise.
+       * manual/examples/filesrv.c: Likewise.
+       * manual/examples/fmtmsgexpl.c: Likewise.
+       * manual/examples/genpass.c: Likewise.
+       * manual/examples/inetcli.c: Likewise.
+       * manual/examples/inetsrv.c: Likewise.
+       * manual/examples/isockad.c: Likewise.
+       * manual/examples/longopt.c: Likewise.
+       * manual/examples/memopen.c: Likewise.
+       * manual/examples/memstrm.c: Likewise.
+       * manual/examples/mkfsock.c: Likewise.
+       * manual/examples/mkisock.c: Likewise.
+       * manual/examples/mygetpass.c: Likewise.
+       * manual/examples/pipe.c: Likewise.
+       * manual/examples/popen.c: Likewise.
+       * manual/examples/rprintf.c: Likewise.
+       * manual/examples/search.c: Likewise.
+       * manual/examples/select.c: Likewise.
+       * manual/examples/setjmp.c: Likewise.
+       * manual/examples/sigh1.c: Likewise.
+       * manual/examples/sigusr.c: Likewise.
+       * manual/examples/stpcpy.c: Likewise.
+       * manual/examples/strdupa.c: Likewise.
+       * manual/examples/strftim.c: Likewise.
+       * manual/examples/strncat.c: Likewise.
+       * manual/examples/subopt.c: Likewise.
+       * manual/examples/swapcontext.c: Likewise.
+       * manual/examples/termios.c: Likewise.
+       * manual/examples/testopt.c: Likewise.
+       * manual/examples/testpass.c: Likewise.
+       * manual/examples/timeval_subtract.c: Likewise.
+
+       [BZ #13792]
        * manual/time.texi (Elapsed Time): Move timeval_subtract example
        function to ...
        * manual/timeval_subtract.c.texi: ... here, new file.
index 0137afd..e291509 100644 (file)
@@ -122,7 +122,8 @@ stamp-version: $(common-objpfx)config.make
 
 # Generate Texinfo files from the C source for the example programs.
 %.c.texi: examples/%.c
-       sed -e 's,[{}],@&,g'                            \
+       sed -e '1,/^\*\/$$/d'                           \
+           -e 's,[{}],@&,g'                            \
            -e 's,/\*\(@.*\)\*/,\1,g'                   \
            -e 's,/\*  *,/* @r{,g' -e 's,  *\*/,} */,'  \
            -e 's/\(@[a-z][a-z]*\)@{\([^}]*\)@}/\1{\2}/g'\
diff --git a/manual/examples/README b/manual/examples/README
new file mode 100644 (file)
index 0000000..7d0070f
--- /dev/null
@@ -0,0 +1,8 @@
+These are source files for example code that appears in The GNU C
+Library Reference Manual.
+
+While the manual itself is licensed under the terms of the GNU Free
+Documentation License, you can use these source files on their own
+under the terms of the GNU General Public License as published by
+the Free Software Foundation; version 2 of the License, or (at your
+option) any later version.
index e4b1bba..d4b9af9 100644 (file)
@@ -1,3 +1,20 @@
+/* Example of a Variadic Function
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <stdarg.h>
 #include <stdio.h>
 
index 931a826..01c3639 100644 (file)
@@ -1,4 +1,19 @@
-/* Argp example #1 -- a minimal program using argp */
+/* Argp example #1 -- a minimal program using argp
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
 
 /* This is (probably) the smallest possible program that
    uses argp.  It won't do much except give an error
index 097ce76..0e038bb 100644 (file)
@@ -1,4 +1,19 @@
-/* Argp example #2 -- a pretty minimal program using argp */
+/* Argp example #2 -- a pretty minimal program using argp
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
 
 /* This program doesn't use any options or arguments, but uses
    argp to be compliant with the GNU standard command line
index d5896ee..689d7cf 100644 (file)
@@ -1,4 +1,19 @@
-/* Argp example #3 -- a program with options and arguments using argp */
+/* Argp example #3 -- a program with options and arguments using argp
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
 
 /* This program uses the same features as example 2, and uses options and
    arguments.
index 2b61358..b946dd1 100644 (file)
@@ -1,4 +1,19 @@
-/* Argp example #4 -- a program with somewhat more complicated options */
+/* Argp example #4 -- a program with somewhat more complicated options
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
 
 /* This program uses the same features as example 3, but has more
    options, and somewhat more structure in the -help output.  It
index 42bba71..5f07c87 100644 (file)
@@ -1,7 +1,24 @@
+/* Cleanups on Exit
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <stdio.h>
 #include <stdlib.h>
 
-void 
+void
 bye (void)
 {
   puts ("Goodbye, cruel world....");
index 1a1cb0c..d6405e5 100644 (file)
@@ -1,3 +1,20 @@
+/* User and Group Database Example
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <grp.h>
 #include <pwd.h>
 #include <sys/types.h>
index 8ab77dc..9ca63fe 100644 (file)
@@ -1,3 +1,20 @@
+/* Simple Program to List a Directory
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 /*@group*/
 #include <stdio.h>
 #include <sys/types.h>
index a75c885..7f095c8 100644 (file)
@@ -1,3 +1,20 @@
+/* Simple Program to List a Directory, Mark II
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 /*@group*/
 #include <stdio.h>
 #include <dirent.h>
index 5a04901..18a3a29 100644 (file)
@@ -1,3 +1,20 @@
+/* Obtain a backtrace and print it.
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <execinfo.h>
 #include <stdio.h>
 #include <stdlib.h>
index 9f64445..71dc461 100644 (file)
@@ -1,3 +1,20 @@
+/* Example of Reading Datagrams
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <stdio.h>
 #include <errno.h>
 #include <unistd.h>
index 32507c6..e1f80aa 100644 (file)
@@ -1,3 +1,20 @@
+/* Datagram Socket Example
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <stdio.h>
 #include <errno.h>
 #include <stdlib.h>
index 42b8bb5..fd7b16b 100644 (file)
@@ -1,3 +1,20 @@
+/* How to use fmtmsg and addseverity.
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <fmtmsg.h>
 
 int
index a7626db..cb4d99f 100644 (file)
@@ -1,31 +1,48 @@
+/* Encrypting Passwords
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <stdio.h>
 #include <time.h>
 #include <unistd.h>
 #include <crypt.h>
 
-int 
+int
 main(void)
 {
   unsigned long seed[2];
   char salt[] = "$1$........";
-  const char *const seedchars = 
+  const char *const seedchars =
     "./0123456789ABCDEFGHIJKLMNOPQRST"
     "UVWXYZabcdefghijklmnopqrstuvwxyz";
   char *password;
   int i;
-  
-  /* Generate a (not very) random seed.  
+
+  /* Generate a (not very) random seed.
      You should do it better than this...  */
   seed[0] = time(NULL);
   seed[1] = getpid() ^ (seed[0] >> 14 & 0x30000);
-  
+
   /* Turn it into printable characters from `seedchars'.  */
   for (i = 0; i < 8; i++)
     salt[3+i] = seedchars[(seed[i/5] >> (i%5)*6) & 0x3f];
-  
+
   /* Read in the user's password and encrypt it.  */
   password = crypt(getpass("Password:"), salt);
-  
+
   /* Print the results.  */
   puts(password);
   return 0;
index 35dfb37..afd4a91 100644 (file)
@@ -1,3 +1,20 @@
+/* Byte Stream Socket Example
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <stdio.h>
 #include <errno.h>
 #include <stdlib.h>
@@ -11,7 +28,7 @@
 #define MESSAGE                "Yow!!! Are we having fun yet?!?"
 #define SERVERHOST     "mescaline.gnu.org"
 
-void 
+void
 write_to_server (int filedes)
 {
   int nbytes;
index 3d544c0..d245f0d 100644 (file)
@@ -1,3 +1,20 @@
+/* Byte Stream Connection Server Example
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <stdio.h>
 #include <errno.h>
 #include <stdlib.h>
index 9c21149..b7c73a7 100644 (file)
@@ -1,10 +1,27 @@
+/* Internet Socket Example using sockaddr_in.
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <netdb.h>
 
-void 
+void
 init_sockaddr (struct sockaddr_in *name,
               const char *hostname,
               uint16_t port)
@@ -14,7 +31,7 @@ init_sockaddr (struct sockaddr_in *name,
   name->sin_family = AF_INET;
   name->sin_port = htons (port);
   hostinfo = gethostbyname (hostname);
-  if (hostinfo == NULL) 
+  if (hostinfo == NULL)
     {
       fprintf (stderr, "Unknown host %s.\n", hostname);
       exit (EXIT_FAILURE);
index 989e887..6e7d4d9 100644 (file)
@@ -1,3 +1,20 @@
+/* Example of Parsing Long Options with getopt_long.
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <getopt.h>
index 682830f..3fa29d5 100644 (file)
@@ -1,3 +1,20 @@
+/* String Streams
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <stdio.h>
 
 static char buffer[] = "foobar";
index 1674c36..be83660 100644 (file)
@@ -1,3 +1,20 @@
+/* open_memstream example.
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <stdio.h>
 
 int
index 615ecd8..e5c3b28 100644 (file)
@@ -1,3 +1,20 @@
+/* Example of Local-Namespace Sockets
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <stddef.h>
 #include <stdio.h>
 #include <errno.h>
index 2fd8b3d..68cf348 100644 (file)
@@ -1,9 +1,26 @@
+/* Internet Socket Example
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 
-int 
+int
 make_socket (uint16_t port)
 {
   int sock;
index 6fe06f4..a927a13 100644 (file)
@@ -1,3 +1,20 @@
+/* Reading Passwords
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <termios.h>
 #include <stdio.h>
 
@@ -14,12 +31,12 @@ my_getpass (char **lineptr, size_t *n, FILE *stream)
   new.c_lflag &= ~ECHO;
   if (tcsetattr (fileno (stream), TCSAFLUSH, &new) != 0)
     return -1;
-  
+
   /* Read the password.  */
   nread = getline (lineptr, n, stream);
 
   /* Restore terminal.  */
   (void) tcsetattr (fileno (stream), TCSAFLUSH, &old);
-  
+
   return nread;
 }
index 92d339a..b03c90f 100644 (file)
@@ -1,3 +1,20 @@
+/* Creating a Pipe
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <sys/types.h>
 #include <unistd.h>
 #include <stdio.h>
index 1b9ee82..6716dc2 100644 (file)
@@ -1,3 +1,20 @@
+/* Pipe to a Subprocess
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <stdio.h>
 #include <stdlib.h>
 
index 2b8f6bf..14de9d2 100644 (file)
@@ -1,3 +1,20 @@
+/* Printf Extension Example
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <printf.h>
index 182e6e4..e376567 100644 (file)
@@ -1,3 +1,20 @@
+/* Searching and Sorting Example
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -35,7 +52,7 @@ int count = sizeof (muppets) / sizeof (struct critter);
 
 /* This is the comparison function used for sorting and searching. */
 
-int 
+int
 critter_cmp (const struct critter *c1, const struct critter *c2)
 {
   return strcmp (c1->name, c2->name);
@@ -44,7 +61,7 @@ critter_cmp (const struct critter *c1, const struct critter *c2)
 
 /* Print information about a critter. */
 
-void 
+void
 print_critter (const struct critter *c)
 {
   printf ("%s, the %s\n", c->name, c->species);
@@ -54,7 +71,7 @@ print_critter (const struct critter *c)
 /*@group*/
 /* Do the lookup into the sorted array. */
 
-void 
+void
 find_critter (const char *name)
 {
   struct critter target, *result;
index a65ed77..6351630 100644 (file)
@@ -1,3 +1,20 @@
+/* Waiting for Input or Output
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 /*@group*/
 #include <errno.h>
 #include <stdio.h>
index 023339c..ffd7744 100644 (file)
@@ -1,10 +1,27 @@
+/* Introduction to Non-Local Exits
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <setjmp.h>
 #include <stdlib.h>
 #include <stdio.h>
 
 jmp_buf main_loop;
 
-void 
+void
 abort_to_main_loop (int status)
 {
   longjmp (main_loop, status);
@@ -21,7 +38,7 @@ main (void)
 }
 
 
-void 
+void
 do_command (void)
 {
   char buffer[128];
index 2c6e95b..d05afd9 100644 (file)
@@ -1,3 +1,20 @@
+/* Signal Handlers that Return
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
 volatile sig_atomic_t keep_going = 1;
 
 /* The signal handler just clears the flag and re-enables itself. */
-void 
+void
 catch_alarm (int sig)
 {
   keep_going = 0;
   signal (sig, catch_alarm);
 }
 
-void 
+void
 do_stuff (void)
 {
   puts ("Doing stuff while waiting for alarm....");
index 11e3cee..5bfbc80 100644 (file)
@@ -1,3 +1,20 @@
+/* Using kill for Communication
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 /*@group*/
 #include <signal.h>
 #include <stdio.h>
 /* When a @code{SIGUSR1} signal arrives, set this variable.  */
 volatile sig_atomic_t usr_interrupt = 0;
 
-void 
+void
 synch_signal (int sig)
 {
   usr_interrupt = 1;
 }
 
 /* The child process executes this function. */
-void 
+void
 child_function (void)
 {
   /* Perform initialization. */
index b832263..f94cb63 100644 (file)
@@ -1,3 +1,20 @@
+/* stpcpy example.
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <string.h>
 #include <stdio.h>
 
index 7d6ef39..f01e115 100644 (file)
@@ -1,3 +1,20 @@
+/* strdupa example.
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <paths.h>
 #include <string.h>
 #include <stdio.h>
index 7f95ef0..9342817 100644 (file)
@@ -1,3 +1,20 @@
+/* Time Functions Example
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <time.h>
 #include <stdio.h>
 
index 948d662..fb7b707 100644 (file)
@@ -1,3 +1,20 @@
+/* strncat example.
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <string.h>
 #include <stdio.h>
 
index a87bee1..ecf75f9 100644 (file)
@@ -1,3 +1,20 @@
+/* Parsing of Suboptions Example
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
index f733510..c993d14 100644 (file)
@@ -1,3 +1,20 @@
+/* Complete Context Control
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
index 6db5990..40d4325 100644 (file)
@@ -1,3 +1,20 @@
+/* Noncanonical Mode Example
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
 
 struct termios saved_attributes;
 
-void 
+void
 reset_input_mode (void)
 {
   tcsetattr (STDIN_FILENO, TCSANOW, &saved_attributes);
 }
 
-void 
+void
 set_input_mode (void)
 {
   struct termios tattr;
index 44ca8e4..081742d 100644 (file)
@@ -1,3 +1,20 @@
+/* Example of Parsing Arguments with getopt.
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 /*@group*/
 #include <ctype.h>
 #include <stdio.h>
index 5bd616d..4e05a90 100644 (file)
@@ -1,9 +1,26 @@
+/* Verify a password.
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
 #include <crypt.h>
 
-int 
+int
 main(void)
 {
   /* Hashed form of "GNU libc manual".  */
@@ -11,7 +28,7 @@ main(void)
 
   char *result;
   int ok;
-  
+
 /*@group*/
   /* Read in the user's password and encrypt it,
      passing the expected password in as the salt.  */
index 683322f..f0f2375 100644 (file)
@@ -1,3 +1,20 @@
+/* struct timeval subtraction.
+   Copyright (C) 1991-2012 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
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program 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 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/>.
+*/
+
 /* Subtract the `struct timeval' values X and Y,
    storing the result in RESULT.
    Return 1 if the difference is negative, otherwise 0.  */