1*57699Sbostic /*- 2*57699Sbostic * Copyright (c) 1992 The Regents of the University of California. 3*57699Sbostic * All rights reserved. 4*57699Sbostic * 5*57699Sbostic * This code is derived from software contributed to Berkeley by 6*57699Sbostic * Rodney Ruddock of the University of Guelph. 7*57699Sbostic * 8*57699Sbostic * %sccs.include.redist.c% 9*57699Sbostic */ 10*57699Sbostic 11*57699Sbostic #ifndef lint 12*57699Sbostic static char sccsid[] = "@(#)rol.c 5.1 (Berkeley) 01/23/93"; 13*57699Sbostic #endif /* not lint */ 14*57699Sbostic 15*57699Sbostic #include "ed.h" 16*57699Sbostic 17*57699Sbostic /* 18*57699Sbostic * After the command check the rest of the line to see nothing illegal 19*57699Sbostic * is following. Any single instance of a printsfx suffix is the only 20*57699Sbostic * legal thing to follow ( that is, a 'l', 'n', or 'p'). If a suffix 21*57699Sbostic * occurs the execution of that suffix occurs back in the cmd_loop 22*57699Sbostic * function after the command that called this function finishes 23*57699Sbostic * successfully. 24*57699Sbostic */ 25*57699Sbostic 26*57699Sbostic int 27*57699Sbostic rol(inputt, errnum) 28*57699Sbostic 29*57699Sbostic FILE *inputt; 30*57699Sbostic int *errnum; 31*57699Sbostic 32*57699Sbostic { 33*57699Sbostic 34*57699Sbostic ss = getc(inputt); 35*57699Sbostic printsfx = 0; 36*57699Sbostic /* only one of the suffix is allowed */ 37*57699Sbostic if (ss == 'p') 38*57699Sbostic printsfx = 1; 39*57699Sbostic else if (ss == 'n') 40*57699Sbostic printsfx = 2; 41*57699Sbostic else if (ss == 'l') 42*57699Sbostic printsfx = 4; 43*57699Sbostic else 44*57699Sbostic ungetc(ss, inputt); 45*57699Sbostic 46*57699Sbostic while (1) 47*57699Sbostic { 48*57699Sbostic ss = getc(inputt); 49*57699Sbostic if ((ss != ' ') && (ss != '\n') && (ss != EOF)) 50*57699Sbostic { 51*57699Sbostic *errnum = -1; 52*57699Sbostic strcpy(help_msg, "illegal command option"); 53*57699Sbostic return(1); 54*57699Sbostic } 55*57699Sbostic if ((ss == '\n') || (ss == EOF)) 56*57699Sbostic break; 57*57699Sbostic } 58*57699Sbostic 59*57699Sbostic return(0); /* rest-of-line was okay */ 60*57699Sbostic } /* end-rol */ 61