parameter is optional, defaults to '.'
This commit is contained in:
		
							
								
								
									
										13
									
								
								shperm.c
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								shperm.c
									
									
									
									
									
								
							| @@ -121,15 +121,22 @@ void dumpLines() { | ||||
| } | ||||
|  | ||||
| int main(int argc, char* argv[]) { | ||||
|     if (argc != 2) { | ||||
|         fprintf(stderr, "Usage: %s <file or directory>\n", argv[0]); | ||||
|     if (argc > 2) { | ||||
|         fprintf(stderr, "Usage: %s [file or directory]\n", argv[0]); | ||||
|         exit(1); | ||||
|     } | ||||
|  | ||||
|     char* path; | ||||
|     char* startpath; | ||||
|     path = malloc(PATH_MAX); | ||||
|  | ||||
|     if (realpath(argv[1], path)) { | ||||
|     if (argc == 1) { | ||||
|     	startpath = "."; | ||||
|     } else { | ||||
|     	startpath = argv[1]; | ||||
|     } | ||||
|      | ||||
|     if (realpath(startpath, path)) { | ||||
|         char* base; | ||||
|         do { | ||||
|             struct stat sb; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user