diff options
author | Roland McGrath <roland@hack.frob.com> | 2012-03-02 16:50:06 -0800 |
---|---|---|
committer | Roland McGrath <roland@hack.frob.com> | 2012-03-02 16:52:01 -0800 |
commit | d9a17c075e61609bee2b2c3014b53f8630f533a4 (patch) | |
tree | 5a5e4fea365808b94153776a884cab7481383e92 /manual/examples/search.c | |
parent | 7181dda8d5bf4f793181f7a672b8605adcb6b700 (diff) | |
download | glibc-d9a17c075e61609bee2b2c3014b53f8630f533a4.tar.gz |
BZ #13792: License manual example source files under GPL.
Diffstat (limited to 'manual/examples/search.c')
-rw-r--r-- | manual/examples/search.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/manual/examples/search.c b/manual/examples/search.c index 182e6e4a3f..e37656721b 100644 --- a/manual/examples/search.c +++ b/manual/examples/search.c @@ -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; |