cat(1p): small reformatting
This commit is contained in:
		
							parent
							
								
									e530f10cd5
								
							
						
					
					
						commit
						da2ebdb1e1
					
				
							
								
								
									
										3
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								Makefile
									
									
									
									
									
								
							| @ -11,6 +11,9 @@ PREFIX=/usr/local/bin | ||||
| 
 | ||||
| build: build_dir cat false true | ||||
| 
 | ||||
| clean: build_dir | ||||
| 	rm -rf build/ | ||||
| 
 | ||||
| cat: build_dir | ||||
| 	cc -o build/cat src/cat.c | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										12
									
								
								src/cat.c
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								src/cat.c
									
									
									
									
									
								
							| @ -30,8 +30,6 @@ | ||||
| int main(int argc, char *argv[]) { | ||||
| 	bool u = false; | ||||
| 	int opt; | ||||
| 	int i = 1; | ||||
| 	FILE *file; | ||||
| 
 | ||||
| 	extern int optind; | ||||
| 	while ((opt = getopt(argc, argv, "u")) != -1) { | ||||
| @ -51,10 +49,10 @@ int main(int argc, char *argv[]) { | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	int i = 1; | ||||
| 	FILE *file; | ||||
| 
 | ||||
| 	for (i = optind; i < argc; i++) { | ||||
| 		int byte = 0; // variable for storing bytes as they are read
 | ||||
| 		char buf[4096]; // buffer for buffered 
 | ||||
| 		int p = 0; // index counter for bytes in buffered reading
 | ||||
| 	  /*
 | ||||
| 		 * From cat(1p): | ||||
| 		 * | ||||
| @ -91,6 +89,10 @@ int main(int argc, char *argv[]) { | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		int byte = 0; /* variable for storing bytes as they are read */ | ||||
| 		int p = 0; /* index counter for bytes in buffered reading */ | ||||
| 		char buf[4096]; /* buffer for buffered reading */ | ||||
| 
 | ||||
| 		while (byte != EOF) { | ||||
| 			byte = fgetc(file); | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user