forked from bonsai/harakit
		
	dj(1): revert some formatting changes
This commit is contained in:
		
							parent
							
								
									c2e6744e2b
								
							
						
					
					
						commit
						a3ceb845e3
					
				
							
								
								
									
										94
									
								
								src/dj.c
									
									
									
									
									
								
							
							
						
						
									
										94
									
								
								src/dj.c
									
									
									
									
									
								
							@ -142,7 +142,7 @@ parse(char *s) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	errno = 0;
 | 
						errno = 0;
 | 
				
			||||||
	r = strtol(s, &s, 0);
 | 
						r = strtol(s, &s, 0);
 | 
				
			||||||
	return (*s == '\0' && errno == 0) ? r : -1; /* no chars left unparsed */
 | 
						return (*s == '\0' /* no chars left unparsed */ && errno == 0) ? r : -1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int
 | 
					static int
 | 
				
			||||||
@ -182,59 +182,59 @@ int main(int argc, char *argv[]) {
 | 
				
			|||||||
		io[i].seek = 0;
 | 
							io[i].seek = 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!(argc < 0)) { usage(program_name); }
 | 
						if (argc > 0) {
 | 
				
			||||||
 | 
							int c;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int c;
 | 
							program_name = argv[0];
 | 
				
			||||||
 | 
							while ((c = getopt(argc, argv, "a:b:B:c:i:hHns:S:o:")) != -1) {
 | 
				
			||||||
 | 
								switch (c) {
 | 
				
			||||||
 | 
									case 'i': case 'o': /* input, output */
 | 
				
			||||||
 | 
										i = (c == 'o');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	program_name = argv[0];
 | 
										/* optarg == "-" (stdin/stdout) */
 | 
				
			||||||
	while ((c = getopt(argc, argv, "a:b:B:c:i:hHns:S:o:")) != -1) {
 | 
										if (optarg[0] == '-' && optarg[1] == '\0') { 
 | 
				
			||||||
		switch (c) {
 | 
											io[i].fd = i == 0 ? STDIN_FILENO : STDOUT_FILENO;
 | 
				
			||||||
			case 'i': case 'o': /* input, output */
 | 
											io[i].fn = i == 0 ? stdin_name   : stdout_name;
 | 
				
			||||||
				i = (c == 'o');
 | 
											break;
 | 
				
			||||||
 | 
										} else {
 | 
				
			||||||
 | 
											int fd;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				/* optarg == "-" (stdin/stdout) */
 | 
											if (
 | 
				
			||||||
				if (optarg[0] == '-' && optarg[1] == '\0') { 
 | 
												(fd = open(optarg, io[i].fl, creat_mode)) != -1
 | 
				
			||||||
					io[i].fd = i == 0 ? STDIN_FILENO : STDOUT_FILENO;
 | 
												&& (fdisstd(io[i].fd) || close(io[i].fd) == 0)
 | 
				
			||||||
					io[i].fn = i == 0 ? stdin_name   : stdout_name;
 | 
											) {
 | 
				
			||||||
					break;
 | 
												io[i].fd = fd;
 | 
				
			||||||
				} else {
 | 
												io[i].fn = optarg;
 | 
				
			||||||
					int fd;
 | 
												break;
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					if (
 | 
										return oserr(optarg, errno); /* break; */
 | 
				
			||||||
						(fd = open(optarg, io[i].fl, creat_mode)) != -1
 | 
									case 'n': noerror = 1; break; /* retry failed reads once */
 | 
				
			||||||
						&& (fdisstd(io[i].fd) || close(io[i].fd) == 0)
 | 
									case 'H': fmt = fmt_human; break; /* human-readable output */
 | 
				
			||||||
					) {
 | 
									case 'a': /* input buffer padding */
 | 
				
			||||||
						io[i].fd = fd;
 | 
										if (optarg[0] == '\0' || optarg[1] == '\0') {
 | 
				
			||||||
						io[i].fn = optarg;
 | 
											align = optarg[0];
 | 
				
			||||||
						break;
 | 
											break;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
										/* FALLTHROUGH */
 | 
				
			||||||
 | 
									case 'c': /* number of reads */
 | 
				
			||||||
 | 
									case 'b': case 'B': /* input/output block size */
 | 
				
			||||||
 | 
									case 's': case 'S': /* (s)kip/(S)eek in input/output */
 | 
				
			||||||
 | 
										if (c == 'c' && (count = parse(optarg)) >= 0) { break; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				return oserr(optarg, errno); /* break; */
 | 
										i = (c >= 'A' && c <= 'Z');
 | 
				
			||||||
			case 'n': noerror = 1; break; /* retry failed reads once */
 | 
										c |= 0x20; /* 0b 0010 0000 (ASCII make lowercase) */
 | 
				
			||||||
			case 'H': fmt = fmt_human; break; /* human-readable output */
 | 
					 | 
				
			||||||
			case 'a': /* input buffer padding */
 | 
					 | 
				
			||||||
				if (optarg[0] == '\0' || optarg[1] == '\0') {
 | 
					 | 
				
			||||||
					align = optarg[0];
 | 
					 | 
				
			||||||
					break;
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
				/* FALLTHROUGH */
 | 
					 | 
				
			||||||
			case 'c': /* number of reads */
 | 
					 | 
				
			||||||
			case 'b': case 'B': /* input/output block size */
 | 
					 | 
				
			||||||
			case 's': case 'S': /* (s)kip/(S)eek in input/output */
 | 
					 | 
				
			||||||
				if (c == 'c' && (count = parse(optarg)) >= 0) { break; }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
				i = (c >= 'A' && c <= 'Z');
 | 
										if (
 | 
				
			||||||
				c |= 0x20 /* ASCII make lowercase 0b 0010 0000 */
 | 
											(c == 'b' && (io[i].bs = parse(optarg)) > 0)
 | 
				
			||||||
 | 
											|| (c == 's' && (io[i].seek = parse(optarg)) >= 0)
 | 
				
			||||||
 | 
										) { break; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (
 | 
										/* FALLTHROUGH */
 | 
				
			||||||
					(c == 'b' && (io[i].bs = parse(optarg)) > 0)
 | 
									default:
 | 
				
			||||||
					|| (c == 's' && (io[i].seek = parse(optarg)) >= 0)
 | 
										return usage(program_name);
 | 
				
			||||||
				) { break; }
 | 
								}
 | 
				
			||||||
 | 
					 | 
				
			||||||
				/* FALLTHROUGH */
 | 
					 | 
				
			||||||
			default:
 | 
					 | 
				
			||||||
				return usage(program_name);
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -272,7 +272,9 @@ int main(int argc, char *argv[]) {
 | 
				
			|||||||
			if (Io_write(&io[1])->bufuse == t && !noerror && io[1].error == 0) {
 | 
								if (Io_write(&io[1])->bufuse == t && !noerror && io[1].error == 0) {
 | 
				
			||||||
				Io_write(&io[1]); /* second chance */
 | 
									Io_write(&io[1]); /* second chance */
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if (io[1].error != 0) { return oserr(io[1].fn, io[1].error); }
 | 
								if (io[1].error != 0) {
 | 
				
			||||||
 | 
									return oserr(io[1].fn, io[1].error);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		} while ((io[1].seek -= (t - io[1].bufuse)) > 0 && io[1].bufuse != t);
 | 
							} while ((io[1].seek -= (t - io[1].bufuse)) > 0 && io[1].bufuse != t);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		io[1].bufuse = 0;
 | 
							io[1].bufuse = 0;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user