This commit was manufactured by cvs2svn to create tag 'FreeBSD-release/1.0'.
[unix-history] / usr.bin / find / operator.c
index b62add6..a706b88 100644 (file)
@@ -1,6 +1,6 @@
 /*-
 /*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
  *
  * This code is derived from software contributed to Berkeley by
  * Cimarron D. Taylor of the University of California, Berkeley.
  *
  * This code is derived from software contributed to Berkeley by
  * Cimarron D. Taylor of the University of California, Berkeley.
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)operator.c 5.4 (Berkeley) 5/24/91";
+static char sccsid[] = "@(#)operator.c 8.1 (Berkeley) 6/6/93";
 #endif /* not lint */
 
 #include <sys/types.h>
 #endif /* not lint */
 
 #include <sys/types.h>
+
+#include <err.h>
+#include <fts.h>
 #include <stdio.h>
 #include <stdio.h>
+
 #include "find.h"
     
 /*
 #include "find.h"
     
 /*
@@ -53,10 +57,10 @@ yanknode(planp)
        PLAN *node;             /* top node removed from the plan */
     
        if ((node = (*planp)) == NULL)
        PLAN *node;             /* top node removed from the plan */
     
        if ((node = (*planp)) == NULL)
-               return(NULL);
+               return (NULL);
        (*planp) = (*planp)->next;
        node->next = NULL;
        (*planp) = (*planp)->next;
        node->next = NULL;
-       return(node);
+       return (node);
 }
  
 /*
 }
  
 /*
@@ -77,7 +81,7 @@ yankexpr(planp)
     
        /* first pull the top node from the plan */
        if ((node = yanknode(planp)) == NULL)
     
        /* first pull the top node from the plan */
        if ((node = yanknode(planp)) == NULL)
-               return(NULL);
+               return (NULL);
     
        /*
         * If the node is an '(' then we recursively slurp up expressions
     
        /*
         * If the node is an '(' then we recursively slurp up expressions
@@ -88,7 +92,7 @@ yankexpr(planp)
        if (node->type == N_OPENPAREN)
                for (tail = subplan = NULL;;) {
                        if ((next = yankexpr(planp)) == NULL)
        if (node->type == N_OPENPAREN)
                for (tail = subplan = NULL;;) {
                        if ((next = yankexpr(planp)) == NULL)
-                               err("%s: %s", "(", "missing closing ')'");
+                               err(1, "(: missing closing ')'");
                        /*
                         * If we find a closing ')' we store the collected
                         * subplan in our '(' node and convert the node to
                        /*
                         * If we find a closing ')' we store the collected
                         * subplan in our '(' node and convert the node to
@@ -98,8 +102,7 @@ yankexpr(planp)
                         */
                        if (next->type == N_CLOSEPAREN) {
                                if (subplan == NULL)
                         */
                        if (next->type == N_CLOSEPAREN) {
                                if (subplan == NULL)
-                                       err("%s: %s",
-                                           "()", "empty inner expression");
+                                       errx(1, "(): empty inner expression");
                                node->p_data[0] = subplan;
                                node->type = N_EXPR;
                                node->eval = f_expr;
                                node->p_data[0] = subplan;
                                node->type = N_EXPR;
                                node->eval = f_expr;
@@ -114,7 +117,7 @@ yankexpr(planp)
                                tail->next = NULL;
                        }
                }
                                tail->next = NULL;
                        }
                }
-       return(node);
+       return (node);
 }
  
 /*
 }
  
 /*
@@ -141,7 +144,7 @@ paren_squish(plan)
                 * '(' someplace.
                 */
                if (expr->type == N_CLOSEPAREN)
                 * '(' someplace.
                 */
                if (expr->type == N_CLOSEPAREN)
-                       err("%s: %s", ")", "no beginning '('");
+                       errx(1, "): no beginning '('");
 
                /* add the expression to our result plan */
                if (result == NULL)
 
                /* add the expression to our result plan */
                if (result == NULL)
@@ -152,7 +155,7 @@ paren_squish(plan)
                }
                tail->next = NULL;
        }
                }
                tail->next = NULL;
        }
-       return(result);
+       return (result);
 }
  
 /*
 }
  
 /*
@@ -192,9 +195,9 @@ not_squish(plan)
                                node = yanknode(&plan);
                        }
                        if (node == NULL)
                                node = yanknode(&plan);
                        }
                        if (node == NULL)
-                               err("%s: %s", "!", "no following expression");
+                               errx(1, "!: no following expression");
                        if (node->type == N_OR)
                        if (node->type == N_OR)
-                               err("%s: %s", "!", "nothing between ! and -o");
+                               errx(1, "!: nothing between ! and -o");
                        if (notlevel % 2 != 1)
                                next = node;
                        else
                        if (notlevel % 2 != 1)
                                next = node;
                        else
@@ -210,7 +213,7 @@ not_squish(plan)
                }
                tail->next = NULL;
        }
                }
                tail->next = NULL;
        }
-       return(result);
+       return (result);
 }
  
 /*
 }
  
 /*
@@ -246,12 +249,12 @@ or_squish(plan)
                 */
                if (next->type == N_OR) {
                        if (result == NULL)
                 */
                if (next->type == N_OR) {
                        if (result == NULL)
-                               err("%s: %s", "-o", "no expression before -o");
+                               errx(1, "-o: no expression before -o");
                        next->p_data[0] = result;
                        next->p_data[1] = or_squish(plan);
                        if (next->p_data[1] == NULL)
                        next->p_data[0] = result;
                        next->p_data[1] = or_squish(plan);
                        if (next->p_data[1] == NULL)
-                               err("%s: %s", "-o", "no expression after -o");
-                       return(next);
+                               errx(1, "-o: no expression after -o");
+                       return (next);
                }
 
                /* add the node to our result plan */
                }
 
                /* add the node to our result plan */
@@ -263,5 +266,5 @@ or_squish(plan)
                }
                tail->next = NULL;
        }
                }
                tail->next = NULL;
        }
-       return(result);
+       return (result);
 }
 }