This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add the files from dist/meta to perl's repo
[metaconfig.git] / dist / U / d_scannl.U
CommitLineData
d8875586
MBT
1?RCS: $Id: d_scannl.U 1 2006-08-24 12:32:52Z rmanfredi $
2?RCS:
3?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
4?RCS:
5?RCS: You may redistribute only under the terms of the Artistic Licence,
6?RCS: as specified in the README file that comes with the distribution.
7?RCS: You may reuse parts of this distribution only within the terms of
8?RCS: that same Artistic Licence; a copy of which may be found at the root
9?RCS: of the source tree for dist 4.0.
10?RCS:
11?RCS: $Log: d_scannl.U,v $
12?RCS: Revision 3.0.1.2 1997/02/28 15:41:27 ram
13?RCS: patch61: added ?F: metalint hint
14?RCS:
15?RCS: Revision 3.0.1.1 1995/07/25 13:59:12 ram
16?RCS: patch56: made cc and ccflags optional dependencies
17?RCS:
18?RCS: Revision 3.0 1993/08/18 12:07:00 ram
19?RCS: Baseline for dist 3.0 netwide release.
20?RCS:
21?X:
22?X: Does the scanf routine read "\n" corretly ? This is was not
23?X: the case on AIX...
24?X:
25?MAKE:d_scannl: cat +cc +ccflags rm Setvar
26?MAKE: -pick add $@ %<
27?S:d_scannl:
28?S: This variable conditionally defines SCAN_NL, which indicates
29?S: wether the C library routines scanf() and friends can deal with
30?S: a '\n' in the input correctly. They do most of the time.
31?S:.
32?C:SCAN_NL:
33?C: This symbol is defined if the C library routines scanf() and friends
34?C: can deal with a '\n' in the input correctly, so that you can say
35?C: scanf("%d\n"); instead of scanf("%d"); getc(c); to handle the '\n'.
36?C:.
37?H:#$d_scannl SCAN_NL /* scanf("%d\n") works */
38?H:.
39?F:!try
40?LINT:set d_scannl
41: does scanf handle "\n" correctly ?
42echo " "
43val="$define"
44?X: I really want to say "\n" instead of '\n', becasue I am refering
45?X: to the string given as argument to scanf().
46echo 'Let'"'"'s see if scanf() handles "\\n" correctly...' >&4
47$cat >try.c <<'EOCP'
48int main()
49{
50 int i = 0, j = 0;
51 scanf("%d\n%d", &i, &j);
52 if (j != 3)
53 exit(1);
54 exit(0);
55}
56EOCP
57if $cc $ccflags -o try try.c >/dev/null 2>&1; then
58 if ./try <<'EOD'
592
603
61EOD
62 then
63 echo "Yes, it does."
64 else
65 echo "No, it doesn't."
66 val="$undef"
67 fi
68else
69 echo "(I can't seem to compile the test program. Assuming it does.)"
70fi
71set d_scannl
72eval $setvar
73$rm -f try.* try
74