stop using __u32 etc. uint32_t is there for a reason
[oweals/busybox.git] / shell / hush.c
index cea1d3c60fcaba1967672bc1eaac3242343f18cb..9bc0013d743728af9ce7a91dc9295dc2016a872b 100644 (file)
@@ -312,7 +312,8 @@ static char *indenter(int i)
 static void __syntax(char *file, int line) {
        bb_error_msg("syntax error %s:%d", file, line);
 }
-#define syntax() __syntax(__FILE__, __LINE__)
+// NB: was __FILE__, but that produces full path sometimess, so...
+#define syntax() __syntax("hush.c", __LINE__)
 
 /* Index of subroutines: */
 /*   function prototypes for builtins */
@@ -398,7 +399,7 @@ static int set_local_var(const char *s, int flg_export);
 /* Table of built-in functions.  They can be forked or not, depending on
  * context: within pipes, they fork.  As simple commands, they do not.
  * When used in non-forking context, they can change global variables
- * in the parent shell process.  If forked, of course they can not.
+ * in the parent shell process.  If forked, of course they cannot.
  * For example, 'unset foo | whatever' will parse and run, but foo will
  * still be set at the end. */
 static const struct built_in_command bltins[] = {
@@ -506,7 +507,7 @@ static int builtin_export(struct child_prog *child)
        char *name = child->argv[1];
 
        if (name == NULL) {
-               return (builtin_env(child));
+               return builtin_env(child);
        }
 
        name = strdup(name);
@@ -717,7 +718,7 @@ static int builtin_source(struct child_prog *child)
        /* XXX search through $PATH is missing */
        input = fopen(child->argv[1], "r");
        if (!input) {
-               bb_error_msg("Couldn't open file '%s'", child->argv[1]);
+               bb_error_msg("cannot open '%s'", child->argv[1]);
                return EXIT_FAILURE;
        }
 
@@ -729,7 +730,7 @@ static int builtin_source(struct child_prog *child)
        status = parse_file_outer(input);
        mark_closed(fileno(input));
        fclose(input);
-       return (status);
+       return status;
 }
 
 static int builtin_umask(struct child_prog *child)
@@ -1120,7 +1121,7 @@ static void pseudo_exec(struct child_prog *child)
 #endif
                debug_printf("exec of %s\n",child->argv[0]);
                execvp(child->argv[0],child->argv);
-               bb_perror_msg("couldn't exec: %s",child->argv[0]);
+               bb_perror_msg("cannot exec: %s",child->argv[0]);
                _exit(1);
        } else if (child->group) {
                debug_printf("runtime nesting to group\n");
@@ -1224,7 +1225,7 @@ static int checkjobs(struct pipe* fg_pipe)
                                        if (i==fg_pipe->num_progs-1)
                                                rcode=WEXITSTATUS(status);
                                        (fg_pipe->num_progs)--;
-                                       return(rcode);
+                                       return rcode;
                                }
                        }
                }
@@ -2268,7 +2269,7 @@ static int parse_group(o_string *dest, struct p_context *ctx,
                return 1;  /* syntax error, groups and arglists don't mix */
        }
        initialize_context(&sub);
-       switch(ch) {
+       switch (ch) {
                case '(': endch=')'; child->subshell=1; break;
                case '{': endch='}'; break;
                default: syntax();   /* really logic error */
@@ -2767,7 +2768,7 @@ int hush_main(int argc, char **argv)
 #endif
 
 final_return:
-       return(opt?opt:last_return_code);
+       return opt ? opt : last_return_code;
 }
 
 static char *insert_var_value(char *inp)