- Timestamp:
- 08/13/07 20:19:03 (1 year ago)
- Files:
-
- ondir/trunk/conf.c (modified) (1 diff)
- ondir/trunk/conf.h (modified) (1 diff)
- ondir/trunk/ondir.1 (modified) (2 diffs)
- ondir/trunk/ondir.c (modified) (4 diffs)
- ondir/trunk/ondirrc.eg (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
ondir/trunk/conf.c
r431 r446 71 71 72 72 /* read stuff */ 73 if (!(tok = strtok(buffer, " \t")) || (strcmp(tok, "enter") && strcmp(tok, "leave"))) 74 fatal("%s:%i: expected enter or leave", file, line); 73 tok = strtok(buffer, " \t"); 74 if (!tok) 75 fatal("%s:%i: unexpected end of line", file, line); 76 77 if (!strcmp(tok, "final")) { 78 current->final = 1; 79 tok = strtok(NULL, " \t"); 80 } 81 82 if (strcmp(tok, "enter") && strcmp(tok, "leave")) 83 fatal("%s:%i: line should start with final, enter or leave", file, line); 75 84 76 85 if (!strcmp(tok, "enter")) ondir/trunk/conf.h
r333 r446 18 18 struct odpath_t { 19 19 const char **paths, *content; 20 int npaths ;20 int npaths, final; 21 21 pathtype_t type; 22 22 struct odpath_t *next; ondir/trunk/ondir.1
r333 r446 1 1 .\" ondir is licensed under the GPL, version 2. A copy of the GPL should have been distributed with the source in the file COPYING 2 .TH "ondir" "1" "0.2. 0" "Alec Thomas" "Shell utility"2 .TH "ondir" "1" "0.2.3" "Alec Thomas" "Shell utility" 3 3 .SH "NAME" 4 4 .LP … … 36 36 # Comment 37 37 .br 38 enter \fB<path>[:<path>[:...]]\fR38 [final] enter \fB<path>[:<path>[:...]]\fR 39 39 .br 40 40 \fB<shell script body>\fR 41 41 .br 42 leave \fB<path>[:<path>[:...]]\fR42 [final] leave \fB<path>[:<path>[:...]]\fR 43 43 .br 44 44 \fB<shell script body>\fR 45 45 .LP 46 46 Any line with leading whitespace is assumed to belong to the last valid enter or leave section. 47 .LP 48 \fBfinal\fB indicates that the section will be the last one executed for the matching directory. Directories further down the hierarchy will still be matched. 47 49 .LP 48 50 \fB<path>\fR is the path to match. Regular expression support has been included since version 0.2.1 thanks to Arvind (?). A path must match completely to be considered a match. Because : is the path delimiter, it can not be used in any regular expressions. ondir/trunk/ondir.c
r445 r446 82 82 struct odpath_t *p; 83 83 84 for (p = find_path(NULL, working, PT_LEAVE, match); p; p = find_path(p, working, PT_LEAVE, match)) { 84 for (p = find_path(NULL, working, PT_LEAVE, match); p; 85 p = find_path(p, working, PT_LEAVE, match)) { 85 86 char *sub; 86 87 … … 108 109 printf("%s\n", sub); 109 110 free(sub); 111 if (p->final) 112 break; 110 113 } 111 114 #ifdef USE_ONENTERLEAVE … … 130 133 strncpy(working, dst, len); 131 134 working[len] = 0; 132 for (p = find_path(NULL, working, PT_ENTER, match); p; p = find_path(p, working, PT_ENTER, match)) { 135 for (p = find_path(NULL, working, PT_ENTER, match); p; 136 p = find_path(p, working, PT_ENTER, match)) { 133 137 char *sub; 134 138 int i = 0; … … 157 161 printf("%s", sub); 158 162 free(sub); 163 if (p->final) 164 break; 159 165 } 160 166 #ifdef USE_ONENTERLEAVE ondir/trunk/ondirrc.eg
r333 r446 8 8 9 9 # Back to normal 10 leave /opt/music:/opt/movies10 final leave /opt/music:/opt/movies 11 11 umask $OLDUMASK 12 unset OLDUMASK
