summaryrefslogtreecommitdiffstats
path: root/common/hush.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2007-10-01 23:15:52 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2007-10-01 23:15:52 +0200
commit53d327d834111a494d776ef617834e2c4740db70 (patch)
tree9990ac06d15bf35cfcc42aeb2ad8ce07fdf5481b /common/hush.c
parentf4f3479f1307dfa0ca2e19387c9c2654a32ee7a4 (diff)
downloadbarebox-53d327d834111a494d776ef617834e2c4740db70.tar.gz
barebox-53d327d834111a494d776ef617834e2c4740db70.tar.xz
fix indention in hush.c
Diffstat (limited to 'common/hush.c')
-rw-r--r--common/hush.c130
1 files changed, 66 insertions, 64 deletions
diff --git a/common/hush.c b/common/hush.c
index b59bd446a6..e3ee1f5cea 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -1159,70 +1159,72 @@ static int parse_stream(o_string *dest, struct p_context *ctx,
debug_printf("leaving parse_stream (triggered)\n");
return 0;
}
- if (m!=2) switch (ch) {
- case '#':
- if (dest->length == 0 && !dest->quote) {
- while(ch=b_peek(input),ch!=EOF && ch!='\n') { b_getch(input); }
- } else {
- b_addqchr(dest, ch, dest->quote);
- }
- break;
- case '\\':
- if (next == EOF) {
- syntax();
- return 1;
- }
- b_addqchr(dest, '\\', dest->quote);
- b_addqchr(dest, b_getch(input), dest->quote);
- break;
- case '$':
- if (handle_dollar(dest, ctx, input)!=0) return 1;
- break;
- case '\'':
- dest->nonnull = 1;
- while(ch=b_getch(input),ch!=EOF && ch!='\'') {
- if(input->__promptme == 0) return 1;
- b_addchr(dest,ch);
- }
- if (ch==EOF) {
- syntax();
- return 1;
- }
- break;
- case '"':
- dest->nonnull = 1;
- dest->quote = !dest->quote;
- break;
- case ';':
- done_word(dest, ctx);
- done_pipe(ctx,PIPE_SEQ);
- break;
- case '&':
- done_word(dest, ctx);
- if (next=='&') {
- b_getch(input);
- done_pipe(ctx,PIPE_AND);
- } else {
- syntax_err();
- return 1;
- }
- break;
- case '|':
- done_word(dest, ctx);
- if (next=='|') {
- b_getch(input);
- done_pipe(ctx,PIPE_OR);
- } else {
- /* we could pick up a file descriptor choice here
- * with redirect_opt_num(), but bash doesn't do it.
- * "echo foo 2| cat" yields "foo 2". */
- syntax_err();
- return 1;
- }
- break;
- default:
- syntax(); /* this is really an internal logic error */
- return 1;
+ if (m!=2) {
+ switch (ch) {
+ case '#':
+ if (dest->length == 0 && !dest->quote) {
+ while(ch=b_peek(input),ch!=EOF && ch!='\n') { b_getch(input); }
+ } else {
+ b_addqchr(dest, ch, dest->quote);
+ }
+ break;
+ case '\\':
+ if (next == EOF) {
+ syntax();
+ return 1;
+ }
+ b_addqchr(dest, '\\', dest->quote);
+ b_addqchr(dest, b_getch(input), dest->quote);
+ break;
+ case '$':
+ if (handle_dollar(dest, ctx, input)!=0) return 1;
+ break;
+ case '\'':
+ dest->nonnull = 1;
+ while(ch=b_getch(input),ch!=EOF && ch!='\'') {
+ if(input->__promptme == 0) return 1;
+ b_addchr(dest,ch);
+ }
+ if (ch==EOF) {
+ syntax();
+ return 1;
+ }
+ break;
+ case '"':
+ dest->nonnull = 1;
+ dest->quote = !dest->quote;
+ break;
+ case ';':
+ done_word(dest, ctx);
+ done_pipe(ctx,PIPE_SEQ);
+ break;
+ case '&':
+ done_word(dest, ctx);
+ if (next=='&') {
+ b_getch(input);
+ done_pipe(ctx,PIPE_AND);
+ } else {
+ syntax_err();
+ return 1;
+ }
+ break;
+ case '|':
+ done_word(dest, ctx);
+ if (next=='|') {
+ b_getch(input);
+ done_pipe(ctx,PIPE_OR);
+ } else {
+ /* we could pick up a file descriptor choice here
+ * with redirect_opt_num(), but bash doesn't do it.
+ * "echo foo 2| cat" yields "foo 2". */
+ syntax_err();
+ return 1;
+ }
+ break;
+ default:
+ syntax(); /* this is really an internal logic error */
+ return 1;
+ }
}
}
}