File: 41-ugly-redo-ring.c_bug128668

package info (click to toggle)
mgetty 1.2.1-1.2
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 6,416 kB
  • sloc: ansic: 42,743; sh: 6,516; perl: 6,262; makefile: 1,462; tcl: 756; lisp: 283
file content (49 lines) | stat: -rw-r--r-- 1,621 bytes parent folder | download | duplicates (4)
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
#! /bin/sh -e
## 
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description. 

[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
patch_opts="${patch_opts:--f --no-backup-if-mismatch}"

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi  
case "$1" in
       -patch) patch $patch_opts -p1 < $0;;
       -unpatch) patch $patch_opts -p1 -R < $0;;
        *)
                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
		exit 1;;
esac            

exit 0
@DPATCH@
--- a/ring.c
+++ b/ring.c
@@ -226,6 +226,8 @@ int wait_for_ring _P6((fd, msn_list, tim
 char	buf[BUFSIZE], ch, *p;
 int	i, w, r;
 int	rc = SUCCESS;
+boolean got_name = FALSE;
+boolean got_nmbr = FALSE;
 boolean	got_dle;		/* for <DLE><char> events (voice mode) */
 
     lprintf( L_MESG, "wfr: waiting for ``RING''" );
@@ -330,7 +332,14 @@ boolean	got_dle;		/* for <DLE><char> eve
 	 * instead of waiting for the next "real" RING
 	 * (but don't do this for V253 DRON/DROF modems!)
 	 */
-	if ( strncmp( buf, "NMBR", 4 ) == 0 && drox_count == 0 ) { break; }
+	if ( strncmp( buf, "NMBR", 4 ) == 0 && drox_count == 0 ) { got_nmbr = TRUE; }
+ 	if ( strncmp( buf, "NAME", 4 ) == 0 ) { got_name = TRUE; }
+
+ 	if ( got_nmbr && got_name ) break;	/* got both name & number */
+
+ 	/* special case -> break; do not expect caller name */
+ 	if ( got_nmbr && CallerId[0] == 'P' ) break; /* private */
+ 	if ( got_nmbr && CallerId[0] == 'O' ) break; /* out of area */
 
 	/* V.253 ring cadences */
 	if ( strncmp( buf, "DRON", 4 ) == 0 ||