?RCS: $Id: d_scannl.U 167 2013-05-08 17:58:00Z rmanfredi $ ?RCS: ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi ?RCS: ?RCS: You may redistribute only under the terms of the Artistic License, ?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 License; a copy of which may be found at the root ?RCS: of the source tree for dist 4.0. ?RCS: ?RCS: $Log: d_scannl.U,v $ ?RCS: Revision 3.0.1.2 1997/02/28 15:41:27 ram ?RCS: patch61: added ?F: metalint hint ?RCS: ?RCS: Revision 3.0.1.1 1995/07/25 13:59:12 ram ?RCS: patch56: made cc and ccflags optional dependencies ?RCS: ?RCS: Revision 3.0 1993/08/18 12:07:00 ram ?RCS: Baseline for dist 3.0 netwide release. ?RCS: ?X: ?X: Does the scanf routine read "\n" correctly ? This is was not ?X: the case on AIX... ?X: ?MAKE:d_scannl: cat +cc +ccflags rm Setvar ?MAKE: -pick add $@ %< ?S:d_scannl: ?S: This variable conditionally defines SCAN_NL, which indicates ?S: wether the C library routines scanf() and friends can deal with ?S: a '\n' in the input correctly. They do most of the time. ?S:. ?C:SCAN_NL: ?C: This symbol is defined if the C library routines scanf() and friends ?C: can deal with a '\n' in the input correctly, so that you can say ?C: scanf("%d\n"); instead of scanf("%d"); getc(c); to handle the '\n'. ?C:. ?H:#$d_scannl SCAN_NL /* scanf("%d\n") works */ ?H:. ?F:!try ?LINT:set d_scannl : does scanf handle "\n" correctly ? echo " " val="$define" ?X: I really want to say "\n" instead of '\n', because I am referring ?X: to the string given as argument to scanf(). echo 'Let'"'"'s see if scanf() handles "\\n" correctly...' >&4 $cat >try.c <<'EOCP' int main() { int i = 0, j = 0; scanf("%d\n%d", &i, &j); if (j != 3) exit(1); exit(0); } EOCP if $cc $ccflags -o try try.c >/dev/null 2>&1; then if ./try <<'EOD' 2 3 EOD then echo "Yes, it does." else echo "No, it doesn't." val="$undef" fi else echo "(I can't seem to compile the test program. Assuming it does.)" fi set d_scannl eval $setvar $rm -f try.* try