10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
c = Create
d = Delete
l = Lowercase
o = Extract to stdout
r = Rename
s = Safe
t = List
u = Uppercase
x = Extract
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define fatal(...) do { fprintf(stderr,__VA_ARGS__); putchar('\n'); exit(1); } while(0)
|
>
|
|
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
c = Create
d = Delete
l = Lowercase
o = Extract to stdout
r = Rename
s = Safe
t = List
w = Wildcards
u = Uppercase
x = Extract to files
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define fatal(...) do { fprintf(stderr,__VA_ARGS__); putchar('\n'); exit(1); } while(0)
|
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
} else {
o=0;
for(n=2;n<argc;n++) {
if(!strcmp(name,argv[n])) {
o=1;
if(opt['r'] && ++n<argc) strcpy(name,argv[n]);
break;
}
if(opt['r']) n++;
}
}
if(opt['d']) o=!o;
}
if(o && opt['t']) {
|
>
>
>
>
>
>
>
>
>
>
>
>
|
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
} else {
o=0;
for(n=2;n<argc;n++) {
if(!strcmp(name,argv[n])) {
o=1;
if(opt['r'] && ++n<argc) strcpy(name,argv[n]);
break;
} else if(opt['w']) {
for(c=d=0;;c++,d++) {
if(argv[n][c]=='*') {
d+=strlen(name)-strlen(argv[n]);
if(d>=strlen(name) || d<c) break;
} else if(argv[n][c]!=name[d] && argv[n][c]!='?') {
break;
} else if(!name[d]) {
o=1;
break;
}
}
}
if(opt['r']) n++;
}
}
if(opt['d']) o=!o;
}
if(o && opt['t']) {
|