1#! /bin/sh 2 3if test -z "$CPP"; then 4 CPP="cc -E" 5fi 6if test -z "$srcdir"; then 7 srcdir=. 8fi 9 10rm -f core* 11 12sed < $srcdir/osdef.h.in -n -e '/^extern/s@.*[)* ][)* ]*\([^ *]*\) __P.*@/[)*, ]\1[ (]/i\\\ 13\\/\\[^a-zA-Z_\\]\1 __P\\/d@p' > osdef1.sed 14cat << EOF > osdef0.c 15#include "config.h" 16#include <sys/types.h> 17#include <stdio.h> 18#include <signal.h> 19#include <sys/stat.h> 20#include <pwd.h> 21#ifdef SHADOWPW 22#include <shadow.h> 23#endif 24#ifndef sun 25#include <sys/ioctl.h> 26#endif 27#ifdef linux 28#include <string.h> 29#include <stdlib.h> 30#endif 31#ifndef NAMEDPIPE 32#include <sys/socket.h> 33#endif 34#ifndef NOSYSLOG 35#include <syslog.h> 36#endif 37#include "os.h" 38#if defined(UTMPOK) && defined (GETTTYENT) && !defined(GETUTENT) 39#include <ttyent.h> 40#endif 41#ifdef SVR4 42# include <sys/resource.h> 43#endif 44EOF 45cat << EOF > osdef2.sed 461i\\ 47/* 481i\\ 49 * This file is automagically created from osdef.sh -- DO NOT EDIT 501i\\ 51 */ 52EOF 53$CPP -I. -I$srcdir osdef0.c | sed -n -f osdef1.sed >> osdef2.sed 54sed -f osdef2.sed < $srcdir/osdef.h.in > osdef.h 55rm osdef0.c osdef1.sed osdef2.sed 56 57if test -f core*; then 58 file core* 59 echo " Sorry, your sed is broken. Call the system administrator." 60 echo " Meanwhile, you may try to compile screen with an empty osdef.h file." 61 echo " But if your compiler needs to have all functions declared, you should" 62 echo " retry 'make' now and only remove offending lines from osdef.h later." 63 exit 1 64fi 65if eval test "`diff osdef.h $srcdir/osdef.h.in | wc -l`" -eq 4; then 66 echo " Hmm, sed is very pessimistic about your system header files." 67 echo " But it did not dump core -- strange! Let's continue carefully..." 68 echo " If this fails, you may want to remove offending lines from osdef.h" 69 echo " or try with an empty osdef.h file, if your compiler can do without" 70 echo " function declarations." 71fi 72