summaryrefslogtreecommitdiff
path: root/manual/examples/search.c
diff options
context:
space:
mode:
Diffstat (limited to 'manual/examples/search.c')
-rw-r--r--manual/examples/search.c23
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;