projects
/
henge
/
webcc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c665823
)
APC Main Driver 1.0
author
ksg
<ken@mihrtec.com>
Fri, 26 Aug 2016 21:19:09 +0000
(14:19 -0700)
committer
ksg
<ken@mihrtec.com>
Fri, 26 Aug 2016 21:19:09 +0000
(14:19 -0700)
src/apc/main.c
patch
|
blob
|
history
diff --git
a/src/apc/main.c
b/src/apc/main.c
index
a53a6cb
..
95e9ea9
100644
(file)
--- a/
src/apc/main.c
+++ b/
src/apc/main.c
@@
-12,8
+12,11
@@
\date Aug 2016
----------------------------------------------------------------------------*/
/* Standard */
\date Aug 2016
----------------------------------------------------------------------------*/
/* Standard */
-#include <errno.h>
+#include <stdio.h> //print
+#include <errno.h> //errors
+#include <string.h> //strnlen
/* Posix */
/* Posix */
+#include <stdlib.h> //exit
#include <unistd.h> //getopt
int main(int, char*[]);
#include <unistd.h> //getopt
int main(int, char*[]);
@@
-32,7
+35,9
@@
int main
( int argc,
char* argv[]
)
( int argc,
char* argv[]
)
-#define MAXERR "-%c allows at most " #MAX_STR_LEN " input characters", opt
+#define S(S)#S
+#define MAXSTR 255
+#define MAXERR "-%c allows at most " S(MAXSTR) " input characters", opt
#define USAGE "Usage: %s [-r root]\n", argv[0]
#define DONE -1
{ int opt;
#define USAGE "Usage: %s [-r root]\n", argv[0]
#define DONE -1
{ int opt;
@@
-43,7
+48,7
@@
int main
break;
case 'r' :
case 'o' :
break;
case 'r' :
case 'o' :
- if (strnlen(optarg, MAX
_STR_LEN) != MAX_STR_LEN
)
+ if (strnlen(optarg, MAX
STR) != MAXSTR
)
{ cargs[opt] = optarg;
goto getopt;
}
{ cargs[opt] = optarg;
goto getopt;
}