#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.2.1).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 2003-01-17 16:09 MST by <bobm@utilica>.
# Source directory was `/home/bobm/Bugs/ModuleBug'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode       name
# ------ ---------- ------------------------------------------
#    679 -rw-r--r-- caller.c
#    637 -rw-r--r-- helper.c
#     17 -rw-r--r-- helper.h
#    610 -rw-r--r-- Makefile
#
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=FAILED
locale_dir=FAILED
first_param="$1"
for dir in $PATH
do
  if test "$gettext_dir" = FAILED && test -f $dir/gettext \
     && ($dir/gettext --version >/dev/null 2>&1)
  then
    set `$dir/gettext --version 2>&1`
    if test "$3" = GNU
    then
      gettext_dir=$dir
    fi
  fi
  if test "$locale_dir" = FAILED && test -f $dir/shar \
     && ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
  then
    locale_dir=`$dir/shar --print-text-domain-dir`
  fi
done
IFS="$save_IFS"
if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
then
  echo=echo
else
  TEXTDOMAINDIR=$locale_dir
  export TEXTDOMAINDIR
  TEXTDOMAIN=sharutils
  export TEXTDOMAIN
  echo="$gettext_dir/gettext -s"
fi
if touch -am -t 200112312359.59 $$.touch >/dev/null 2>&1 && test ! -f 200112312359.59 -a -f $$.touch; then
  shar_touch='touch -am -t $1$2$3$4$5$6.$7 "$8"'
elif touch -am 123123592001.59 $$.touch >/dev/null 2>&1 && test ! -f 123123592001.59 -a ! -f 123123592001.5 -a -f $$.touch; then
  shar_touch='touch -am $3$4$5$6$1$2.$7 "$8"'
elif touch -am 1231235901 $$.touch >/dev/null 2>&1 && test ! -f 1231235901 -a -f $$.touch; then
  shar_touch='touch -am $3$4$5$6$2 "$8"'
else
  shar_touch=:
  echo
  $echo 'WARNING: not restoring timestamps.  Consider getting and'
  $echo "installing GNU \`touch', distributed in GNU File Utilities..."
  echo
fi
rm -f 200112312359.59 123123592001.59 123123592001.5 1231235901 $$.touch
#
if mkdir _sh01528; then
  $echo 'x -' 'creating lock directory'
else
  $echo 'failed to create lock directory'
  exit 1
fi
# ============= caller.c ==============
if test -f 'caller.c' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'caller.c' '(file already exists)'
else
  $echo 'x -' extracting 'caller.c' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'caller.c' &&
/* Necessary header files */
#include <linux/types.h>
#include <linux/kernel.h>
X
#include "helper.h"
X
#include <linux/module.h>
X
MODULE_AUTHOR("Bob Montgomery, HP (bob_montgomery@hp.com)");
MODULE_DESCRIPTION("Module that calls another module");
MODULE_LICENSE("GPL");
X
/* Initialize the module */
int init_module(void)
{
X
X    printk(KERN_ALERT "caller in init_module, about to call helper...\n");
X
X    printk("helper(10) returns %d\n", helper(10));
X    
X    /* A non 0 return means init_module failed; module can't be loaded. */
X    return 0;
}
X         
/* Cleanup - undo whatever init_module did */
void cleanup_module(void)
{
X   printk(KERN_ALERT "caller in cleanup\n");
}  
SHAR_EOF
  (set 20 03 01 17 15 45 29 'caller.c'; eval "$shar_touch") &&
  chmod 0644 'caller.c' ||
  $echo 'restore of' 'caller.c' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'caller.c:' 'MD5 check failed'
0c0ce3ec2a96bba364fb8840442d079c  caller.c
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'caller.c'`"
    test 679 -eq "$shar_count" ||
    $echo 'caller.c:' 'original size' '679,' 'current size' "$shar_count!"
  fi
fi
# ============= helper.c ==============
if test -f 'helper.c' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'helper.c' '(file already exists)'
else
  $echo 'x -' extracting 'helper.c' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'helper.c' &&
/* Necessary header files */
#include <linux/types.h>
#include <linux/kernel.h>
X
#include "helper.h"
X
#include <linux/module.h>
X
MODULE_AUTHOR("Bob Montgomery, HP (bob_montgomery@hp.com)");
MODULE_DESCRIPTION("Helper module for caller");
MODULE_LICENSE("GPL");
X
X
int helper(int val)
{
X	return ++val;
}
X
/* Initialize the module */
int init_module(void)
{
X
X    printk(KERN_ALERT "helper initialized\n");
X         
X    /* A non 0 return means init_module failed; module can't be loaded. */
X    return 0;
}
X         
/* Cleanup - undo whatever init_module did */
void cleanup_module(void)
{
X   printk(KERN_ALERT "helper in cleanup\n");
}  
SHAR_EOF
  (set 20 03 01 17 15 45 14 'helper.c'; eval "$shar_touch") &&
  chmod 0644 'helper.c' ||
  $echo 'restore of' 'helper.c' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'helper.c:' 'MD5 check failed'
d939cdb55292168ae1e9a2b3226e2ce8  helper.c
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'helper.c'`"
    test 637 -eq "$shar_count" ||
    $echo 'helper.c:' 'original size' '637,' 'current size' "$shar_count!"
  fi
fi
# ============= helper.h ==============
if test -f 'helper.h' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'helper.h' '(file already exists)'
else
  $echo 'x -' extracting 'helper.h' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'helper.h' &&
int helper(int);
SHAR_EOF
  (set 20 03 01 17 15 45 47 'helper.h'; eval "$shar_touch") &&
  chmod 0644 'helper.h' ||
  $echo 'restore of' 'helper.h' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'helper.h:' 'MD5 check failed'
32c2e5f4c9b3f63d60cca99d08eba773  helper.h
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'helper.h'`"
    test 17 -eq "$shar_count" ||
    $echo 'helper.h:' 'original size' '17,' 'current size' "$shar_count!"
  fi
fi
# ============= Makefile ==============
if test -f 'Makefile' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'Makefile' '(file already exists)'
else
  $echo 'x -' extracting 'Makefile' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'Makefile' &&
# Makefile for a basic kernel module
#
all: caller.o helper.o
X         
KSRC=/lib/modules/`uname -r`/build
CC=gcc
CFLAGS= -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -g -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe  -ffixed-r13 -mfixed-range=f10-f15,f32-f127 -falign-functions=32
IFLAGS= -I $(KSRC)/include
MODFLAGS= -DMODULE -DMODVERSIONS -include $(KSRC)/include/linux/modversions.h
X
caller.o: caller.c helper.h
X	${CC} ${IFLAGS} ${CFLAGS} ${MODFLAGS} -c caller.c
X
helper.o: helper.c helper.h
X	${CC} ${IFLAGS} ${CFLAGS} ${MODFLAGS} -c helper.c
X
clean:
X	-rm caller.o
X	-rm helper.o
X
SHAR_EOF
  (set 20 03 01 17 15 46 27 'Makefile'; eval "$shar_touch") &&
  chmod 0644 'Makefile' ||
  $echo 'restore of' 'Makefile' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'Makefile:' 'MD5 check failed'
0903845f38aea4b2c2dd93afe2e5056a  Makefile
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'Makefile'`"
    test 610 -eq "$shar_count" ||
    $echo 'Makefile:' 'original size' '610,' 'current size' "$shar_count!"
  fi
fi
rm -fr _sh01528
exit 0
