8-bit characters are not ignored
[unix-history] / usr / src / contrib / ed / rol.c
... / ...
CommitLineData
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
12static char sccsid[] = "@(#)rol.c 5.3 (Berkeley) %G%";
13#endif /* not lint */
14
15#include <sys/types.h>
16
17#include <regex.h>
18#include <setjmp.h>
19#include <stdio.h>
20#include <string.h>
21
22#ifdef DBI
23#include <db.h>
24#endif
25
26#include "ed.h"
27#include "extern.h"
28
29/*
30 * After the command check the rest of the line to see nothing illegal
31 * is following. Any single instance of a printsfx suffix is the only
32 * legal thing to follow ( that is, a 'l', 'n', or 'p'). If a suffix
33 * occurs the execution of that suffix occurs back in the cmd_loop
34 * function after the command that called this function finishes
35 * successfully.
36 */
37int
38rol(inputt, errnum)
39 FILE *inputt;
40 int *errnum;
41{
42 ss = getc(inputt);
43 printsfx = 0;
44
45 /* Only one of the suffix is allowed. */
46 if (ss == 'p')
47 printsfx = 1;
48 else
49 if (ss == 'n')
50 printsfx = 2;
51 else
52 if (ss == 'l')
53 printsfx = 4;
54 else
55 ungetc(ss, inputt);
56
57 for (;;) {
58 ss = getc(inputt);
59 if ((ss != ' ') && (ss != '\n') && (ss != EOF)) {
60 *errnum = -1;
61 strcpy(help_msg, "illegal command option");
62 return (1);
63 }
64 if ((ss == '\n') || (ss == EOF))
65 break;
66 }
67
68 /* Rest-of-line was okay. */
69 return (0);
70}