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