static char sccsid
[] = "@(#)decode.c 4.1 10/9/80";
/* decode() - read a line from standard input and decode it */
integ
= scallf
= reflag
= colonflag
= ncolonflag
= percentflag
= 0;
proc
[0] = cmd
= args
[0] = var
[0] = '\0';
if (eqany(*p
, "/?")) { /* regular expression */
if (*p
== '\n' || *p
== c
) return(0);
while(*p
!= c
&& *p
!= '\n') *q
++ = *p
++;
if (*p
== '!') { /* shell escape */
for (q
= p
; *q
!= '\n'; q
++) ;
while (*p
!= '\n') { /* decode item by item */
if (number(*p
)) { /* decimal number */
error("Too many numbers");
if (varchar(*p
) || eqany(*p
, COMMANDS
)) {
/* proc, variable or command */
while (varchar(*q
) || number(*q
) || eqany(*q
,COMMANDS
))
if (*q
== '(') { /* procedure call */
error("Too many procedure calls");
if (*q
== ':') { /* procedure name */
if (*q
== '$') { /* variable name */
if (((q
-p
== 1 && eqany(*p
,COMMANDS
) &&
(proc
[0]=='\0' || eqany(*p
, "abcd"))) ||
(integ
&& eqany(*p
,COMMANDS
)) ||
&& !(*p
=='-' && *(p
+1) == '>'))
if (eqany(cmd
, "Macers")) {
/* otherwise, its a variable */
error("Too many variable names");
if (cmd
== '\0') cmd
= *p
? *p
: '/';
p
++; /* otherwise ignore p */