21 lines
No EOL
502 B
C
21 lines
No EOL
502 B
C
#define _POSIX_C_SOURCE 200809L
|
|
|
|
#include <unistd.h>
|
|
|
|
int main(int argc, char * argv[]) {
|
|
char c;
|
|
int recurse = 0; /* -R */
|
|
/* 0: -P, 01: -L, 02: -H */
|
|
int recurse_follow = 0;
|
|
int follow_link = 0; /* -h */
|
|
|
|
while((c = getopt(argc, argv, "RHLPh")) != -1) {
|
|
switch(c) {
|
|
case 'R': recurse = 1; break;
|
|
case 'P': recurse_follow = 0; break;
|
|
case 'L': recurse_follow = 01; break;
|
|
case 'H': recurse_follow = 02; break;
|
|
case 'h': follow_link = 1; break;
|
|
}
|
|
}
|
|
} |