Changeset 10647 for trunk/Ohana/src/opihi/lib.shell/exec_loop.c
- Timestamp:
- Dec 11, 2006, 10:15:41 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/lib.shell/exec_loop.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/lib.shell/exec_loop.c
r9469 r10647 8 8 9 9 /* increase the shell level (Nlists) by one */ 10 Nlists ++; 11 ThisList = Nlists; 12 REALLOCATE (lists, List, MAX (ThisList, 0) + 1); 13 10 ThisList = increase_list_depth(); 11 if (ThisList == 0) abort(); 12 14 13 /* copy the macro to the current list */ 15 lists[ThisList].Nlines = loop[0].Nlines; 16 ALLOCATE (lists[ThisList].line, char *, MAX (lists[ThisList].Nlines, 1)); 17 for (j = 0; j < lists[ThisList].Nlines; j++) { 18 lists[ThisList].line[j] = strcreate (loop[0].line[j]); 14 for (j = 0; j < loop[0].Nlines; j++) { 15 add_listentry (ThisList, loop[0].line[j]); 19 16 } 20 17 … … 26 23 loop_continue = loop_break = FALSE; 27 24 status = TRUE; 28 Nlines = lists[ThisList].Nlines;29 for (n = 0; (n < Nlines) && !interrupt; n++) {30 lists[ThisList].n = n;31 line = lists[ThisList].line[n];32 25 26 while (!interrupt) { 27 line = get_next_listentry (ThisList); 28 if (line == NULL) break; 33 29 status = multicommand (line); 34 35 if (line != NULL) free (line); 36 n = lists[ThisList].n; 37 Nlines = lists[ThisList].Nlines; 30 free (line); 38 31 if (auto_break && !status) loop_break = TRUE; 39 32 if (loop_break || loop_continue) break; … … 42 35 43 36 /* free remaining lines on the list, free the list, decrement the shell level */ 44 for (n ++; n < Nlines; n ++) { 45 free (lists[ThisList].line[n]); 46 } 47 free (lists[ThisList].line); 48 Nlists --; 49 REALLOCATE (lists, List, MAX (Nlists, 0) + 1); 37 /*** can we free a list which is not the bottom lists? */ 38 decrease_list_depth(); 50 39 51 40 if (loop_break) return (FALSE);
Note:
See TracChangeset
for help on using the changeset viewer.
