comparison calypso/targetfd.c @ 4:deeeef558279

fcsim-calypso-be put together
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 14 Mar 2021 05:07:34 +0000
parents
children
comparison
equal deleted inserted replaced
3:45ea06eaa9fd 4:deeeef558279
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <unistd.h>
4
5 int target_fd;
6
7 parse_target_fd_opt(argc, argv)
8 char **argv;
9 {
10 extern char *optarg;
11 int c;
12
13 while ((c = getopt(argc, argv, "C:")) != EOF) {
14 switch (c) {
15 case 'C':
16 target_fd = atoi(optarg);
17 continue;
18 case '?':
19 default:
20 /* error msg already printed */
21 exit(1);
22 }
23 }
24 if (!target_fd) {
25 fprintf(stderr, "error: target fd must be given with -C\n");
26 exit(1);
27 }
28 return(0);
29 }