Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mdmngr
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
IOPSYS
mdmngr
Commits
8775e22b
Commit
8775e22b
authored
7 years ago
by
Jakob Olsson
Browse files
Options
Downloads
Patches
Plain Diff
working version of parse_args, add shared debug var
parent
2ff4568a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
common.c
+2
-2
2 additions, 2 deletions
common.c
common.h
+2
-3
2 additions, 3 deletions
common.h
dongle.c
+18
-20
18 additions, 20 deletions
dongle.c
with
22 additions
and
25 deletions
common.c
+
2
−
2
View file @
8775e22b
...
@@ -49,7 +49,7 @@ struct blob_buf json_to_blob(struct json_object *response, struct blob_buf bb)
...
@@ -49,7 +49,7 @@ struct blob_buf json_to_blob(struct json_object *response, struct blob_buf bb)
return
bb
;
return
bb
;
}
}
void
set
_debug
(
int
debug_arg
)
void
check
_debug
(
void
)
{
{
debug
=
debug
_arg
;
printf
(
"debug: %d
\n
"
,
debug
)
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
common.h
+
2
−
3
View file @
8775e22b
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
#include
<stdio.h>
#include
<stdio.h>
#include
<stdbool.h>
#include
<stdbool.h>
#include
<unistd.h>
#include
<unistd.h>
#include
<getopt.h>
#include
<sys/types.h>
#include
<sys/types.h>
#include
<sys/stat.h>
#include
<sys/stat.h>
#include
<fcntl.h>
#include
<fcntl.h>
...
@@ -20,7 +19,7 @@
...
@@ -20,7 +19,7 @@
#include
<libubox/blobmsg.h>
#include
<libubox/blobmsg.h>
#include
<libubus.h>
#include
<libubus.h>
int
debug
;
extern
int
debug
;
#define debug_print(...) \
#define debug_print(...) \
do \
do \
...
@@ -58,5 +57,5 @@ int print_to_ubus(struct json_object *parsed_response, struct ubus_context *ctx,
...
@@ -58,5 +57,5 @@ int print_to_ubus(struct json_object *parsed_response, struct ubus_context *ctx,
*/
*/
struct
blob_buf
json_to_blob
(
struct
json_object
*
response
,
struct
blob_buf
bb
);
struct
blob_buf
json_to_blob
(
struct
json_object
*
response
,
struct
blob_buf
bb
);
void
set
_debug
(
int
debug_arg
);
void
check
_debug
(
void
);
#endif
#endif
This diff is collapsed.
Click to expand it.
dongle.c
+
18
−
20
View file @
8775e22b
#include
<getopt.h>
#include
"common.h"
#include
"common.h"
#include
"dongle_apn.h"
#include
"dongle_apn.h"
#include
"dongle_pin.h"
#include
"dongle_pin.h"
...
@@ -15,30 +17,26 @@ int parse_args(int argc, char **argv)
...
@@ -15,30 +17,26 @@ int parse_args(int argc, char **argv)
{
{
char
ch
;
char
ch
;
printf
(
"hallå1
\n
"
);
while
((
ch
=
getopt_long
(
argc
,
argv
,
"d:"
,
long_options
,
NULL
))
!=
-
1
)
{
while
((
ch
=
getopt_long
(
argc
,
argv
,
":d:"
,
long_options
,
NULL
))
!=
-
1
)
{
int
debug_arg
;
printf
(
"hallå2
\n
"
);
switch
(
ch
)
{
switch
(
ch
)
{
case
'd'
:
case
'd'
:
debug_arg
=
atoi
(
optarg
);
debug
=
atoi
(
optarg
);
if
(
debug_arg
>
1
||
debug_arg
<
0
)
{
if
(
debug
>
1
||
debug
<
0
)
{
debug_print
(
"%s: option '-%c' is invalid.
\n
"
,
argv
[
0
],
optopt
);
printf
(
"%s: option '-%c' is invalid.
\n
"
,
argv
[
0
],
optopt
);
//cant exactly do debug print in here...
goto
fail
;
}
break
;
case
':'
:
debug_print
(
stderr
,
"%s: option '-%c' requires an argument
\n
"
,
argv
[
0
],
optopt
);
goto
fail
;
break
;
case
'?'
:
debug_print
(
stderr
,
"%s: option '-%c' is invalid: ignored
\n
"
,
argv
[
0
],
optopt
);
goto
fail
;
goto
fail
;
}
break
;
printf
(
"hallå3
\n
"
);
//set_debug(debug_arg);
break
;
case
':'
:
debug_print
(
stderr
,
"%s: option '-%c' requires an argument
\n
"
,
argv
[
0
],
optopt
);
goto
fail
;
break
;
case
'?'
:
debug_print
(
stderr
,
"%s: option '-%c' is invalid: ignored
\n
"
,
argv
[
0
],
optopt
);
goto
fail
;
break
;
}
}
}
}
return
0
;
return
0
;
fail:
fail:
return
-
1
;
return
-
1
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment