Compare commits
	
		
			3 Commits
		
	
	
		
			6c558654f3
			...
			baa75a2619
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| baa75a2619 | |||
| d6d9c2088e | |||
| ea2efdf5b9 | 
| @ -22,11 +22,6 @@ | |||||||
| #include <sysexits.h> /* EX_IOERR, EX_OK, EX_OSERR, EX_USAGE */ | #include <sysexits.h> /* EX_IOERR, EX_OK, EX_OSERR, EX_USAGE */ | ||||||
| #include <unistd.h> /* pledge(2), getopt(3) */ | #include <unistd.h> /* pledge(2), getopt(3) */ | ||||||
| 
 | 
 | ||||||
| #ifdef __OpenBSD__ |  | ||||||
| #	include <errno.h> /* errno */ |  | ||||||
| #	include <string.h> /* strerror(3) */ |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| char *program_name = "npc"; | char *program_name = "npc"; | ||||||
| 
 | 
 | ||||||
| static int | static int | ||||||
| @ -48,7 +43,7 @@ int main(int argc, char *argv[]) { | |||||||
| 	program_name = argv[0] == NULL ? program_name : argv[0]; | 	program_name = argv[0] == NULL ? program_name : argv[0]; | ||||||
| 
 | 
 | ||||||
| 	if (pledge("stdio", NULL) == -1) { | 	if (pledge("stdio", NULL) == -1) { | ||||||
| 		(void)fprintf(stderr, "%s: %s\n", program_name, strerror(errno)); | 		perror(program_name); | ||||||
| 		return EX_OSERR; | 		return EX_OSERR; | ||||||
| 	} | 	} | ||||||
| #endif | #endif | ||||||
|  | |||||||
| @ -19,7 +19,7 @@ | |||||||
| 
 | 
 | ||||||
| #include <ctype.h> | #include <ctype.h> | ||||||
| #include <stddef.h> /* NULL */ | #include <stddef.h> /* NULL */ | ||||||
| #include <stdio.h> /* fprintf(3), perror(2) */ | #include <stdio.h> /* fprintf(3), perror(3) */ | ||||||
| #include <stdlib.h> /* size_t, EXIT_FAILURE */ | #include <stdlib.h> /* size_t, EXIT_FAILURE */ | ||||||
| #include <string.h> /* strcmp(3) */ | #include <string.h> /* strcmp(3) */ | ||||||
| #include <sysexits.h> /* EX_OSERR, EX_USAGE */ | #include <sysexits.h> /* EX_OSERR, EX_USAGE */ | ||||||
|  | |||||||
							
								
								
									
										22
									
								
								src/strcmp.c
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								src/strcmp.c
									
									
									
									
									
								
							| @ -16,20 +16,28 @@ | |||||||
|  * You should have received a copy of the GNU Affero General Public License |  * You should have received a copy of the GNU Affero General Public License | ||||||
|  * along with this program. If not, see https://www.gnu.org/licenses/.
 |  * along with this program. If not, see https://www.gnu.org/licenses/.
 | ||||||
|  */ |  */ | ||||||
| #include <stdio.h> /* fprintf(3), stderr */ | #include <stdio.h> /* fprintf(3), perror(3), stderr */ | ||||||
| #include <sysexits.h> /* EX_OK, EX_USAGE */ | #include <sysexits.h> /* EX_OK, EX_OSERR, EX_USAGE */ | ||||||
|  | 
 | ||||||
|  | #ifdef __OpenBSD__ | ||||||
|  | #	include <unistd.h> /* pledge(2) */ | ||||||
|  | #endif | ||||||
| 
 | 
 | ||||||
| char *program_name = "strcmp"; | char *program_name = "strcmp"; | ||||||
| 
 | 
 | ||||||
| int main(int argc, char *argv[]) { | int main(int argc, char *argv[]) { | ||||||
|  | 	program_name = argv[0] == NULL ? program_name : argv[0]; | ||||||
| 	int i; | 	int i; | ||||||
| 
 | 
 | ||||||
|  | #ifdef __OpenBSD__ | ||||||
|  | 	if (pledge("stdio", NULL) != -1) { | ||||||
|  | 		perror(program_name); | ||||||
|  | 		return EX_OSERR; | ||||||
|  | 	} | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| 	if (argc < 3) { | 	if (argc < 3) { | ||||||
| 		(void)fprintf( | 		(void)fprintf(stderr, "Usage: %s string string...\n", program_name); | ||||||
| 			stderr, |  | ||||||
| 			"Usage: %s string string...\n", |  | ||||||
| 			argv[0] == NULL ? program_name : argv[0] |  | ||||||
| 		); |  | ||||||
| 
 | 
 | ||||||
| 		return EX_USAGE; | 		return EX_USAGE; | ||||||
| 	} | 	} | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user