restrict zero write widths
authorKirk McKusick <mckusic@ucbvax.Berkeley.EDU>
Wed, 11 Mar 1981 06:49:25 +0000 (22:49 -0800)
committerKirk McKusick <mckusic@ucbvax.Berkeley.EDU>
Wed, 11 Mar 1981 06:49:25 +0000 (22:49 -0800)
SCCS-vsn: usr.bin/pascal/src/proc.c 1.7
SCCS-vsn: usr.bin/pascal/src/pcproc.c 1.4

usr/src/usr.bin/pascal/src/pcproc.c
usr/src/usr.bin/pascal/src/proc.c

index 0b6bd7d..a514691 100644 (file)
@@ -1,6 +1,6 @@
 /* Copyright (c) 1979 Regents of the University of California */
 
 /* Copyright (c) 1979 Regents of the University of California */
 
-static char sccsid[] = "@(#)pcproc.c 1.3 %G%";
+static char sccsid[] = "@(#)pcproc.c 1.4 %G%";
 
 #include "whoami.h"
 #ifdef PC
 
 #include "whoami.h"
 #ifdef PC
@@ -307,6 +307,12 @@ pcproc(r)
                                        error("Negative widths are not allowed");
                                        continue;
                                }
                                        error("Negative widths are not allowed");
                                        continue;
                                }
+                               if ( opt('s') &&
+                                   ((fmtspec & CONPREC) && prec == 0 ||
+                                   (fmtspec & CONWIDTH) && field == 0)) {
+                                       standard();
+                                       error("Zero widths are non-standard");
+                               }
                        }
                        if (filetype != nl+T1CHAR) {
                                if (fmt == 'O' || fmt == 'X') {
                        }
                        if (filetype != nl+T1CHAR) {
                                if (fmt == 'O' || fmt == 'X') {
index 7d302a3..a89f3bc 100644 (file)
@@ -1,6 +1,6 @@
 /* Copyright (c) 1979 Regents of the University of California */
 
 /* Copyright (c) 1979 Regents of the University of California */
 
-static char sccsid[] = "@(#)proc.c 1.6 %G%";
+static char sccsid[] = "@(#)proc.c 1.7 %G%";
 
 #include "whoami.h"
 #ifdef OBJ
 
 #include "whoami.h"
 #ifdef OBJ
@@ -276,6 +276,12 @@ proc(r)
                                        error("Negative widths are not allowed");
                                        continue;
                                }
                                        error("Negative widths are not allowed");
                                        continue;
                                }
+                               if ( opt('s') &&
+                                   ((fmtspec & CONPREC) && prec == 0 ||
+                                   (fmtspec & CONWIDTH) && field == 0)) {
+                                       standard();
+                                       error("Zero widths are non-standard");
+                               }
                        }
                        if (filetype != nl+T1CHAR) {
                                if (fmt == 'O' || fmt == 'X') {
                        }
                        if (filetype != nl+T1CHAR) {
                                if (fmt == 'O' || fmt == 'X') {