summaryrefslogtreecommitdiff
path: root/mcon/U/d_scannl.U
blob: 74c0a3fdf7828307b43357aeac28424a60652a9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
?RCS: $Id$
?RCS:
?RCS: Copyright (c) 1991-1997, 2004-2006, 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 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" corretly ? 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', becasue I am refering
?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