?RCS: $Id: ssizetype.U,v 3.0.1.3 1997/02/28 16:24:21 ram Exp $ ?RCS: ?RCS: Copyright (c) 1991-1993, Raphael Manfredi ?RCS: ?RCS: You may redistribute only under the terms of the Artistic Licence, ?RCS: as specified in the README file that comes with the distribution. ?RCS: You may reuse parts of this distribution only within the terms of ?RCS: that same Artistic Licence; a copy of which may be found at the root ?RCS: of the source tree for dist 3.0. ?RCS: ?RCS: Original Author: Andy Dougherty ?RCS: ?RCS: $Log: ssizetype.U,v $ ?RCS: Revision 3.0.1.3 1997/02/28 16:24:21 ram ?RCS: patch61: integrated perl5 concerns for mis-configured sfio ?RCS: ?RCS: Revision 3.0.1.2 1994/10/29 16:30:28 ram ?RCS: patch36: added ?F: line for metalint file checking ?RCS: patch36: added 'ldflags' to the test compile line (ADO) ?RCS: ?RCS: Revision 3.0.1.1 1994/08/29 16:33:06 ram ?RCS: patch32: created by ADO ?RCS: ?MAKE:ssizetype: Myread Typedef sizetype cat rm Compile run ?MAKE: -pick add $@ %< ?S:ssizetype: ?S: This variable defines ssizetype to be something like ssize_t, ?S: long or int. It is used by functions that return a count ?S: of bytes or an error condition. It must be a signed type. ?S: We will pick a type such that sizeof(SSize_t) == sizeof(Size_t). ?S:. ?C:SSize_t: ?C: This symbol holds the type used by functions that return ?C: a count of bytes or an error condition. It must be a signed type. ?C: It is usually ssize_t, but may be long or int, etc. ?C: It may be necessary to include or ?C: to get any typedef'ed information. ?C: We will pick a type such that sizeof(SSize_t) == sizeof(Size_t). ?C:. ?H:#define SSize_t $ssizetype /* signed count of bytes */ ?H:. : see what type is used for signed size_t set ssize_t ssizetype int stdio.h sys/types.h eval $typedef dflt="$ssizetype" ?X: Now check out whether sizeof(SSize_t) == sizeof(Size_t) $cat > try.c < #include #define Size_t $sizetype #define SSize_t $dflt int main() { if (sizeof(Size_t) == sizeof(SSize_t)) printf("$dflt\n"); else if (sizeof(Size_t) == sizeof(int)) printf("int\n"); else printf("long\n"); exit(0); } EOM echo " " set try if eval $compile_ok && $run ./try > /dev/null; then ssizetype=`$run ./try` echo "I'll be using $ssizetype for functions returning a byte count." >&4 else $cat >&4 <