Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mirror
ccan
Commits
32a31d9e
Commit
32a31d9e
authored
Jan 19, 2010
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make manifest code do chdir into appropriate directory.
parent
d1d6625c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
17 deletions
+19
-17
tools/ccanlint/ccanlint.c
tools/ccanlint/ccanlint.c
+3
-2
tools/ccanlint/ccanlint.h
tools/ccanlint/ccanlint.h
+1
-1
tools/ccanlint/compulsory_tests/check_depends_built.c
tools/ccanlint/compulsory_tests/check_depends_built.c
+1
-13
tools/ccanlint/file_analysis.c
tools/ccanlint/file_analysis.c
+14
-1
No files found.
tools/ccanlint/ccanlint.c
View file @
32a31d9e
...
...
@@ -244,13 +244,14 @@ int main(int argc, char *argv[])
unsigned
int
score
=
0
,
total_score
=
0
;
struct
manifest
*
m
;
struct
ccanlint
*
i
;
const
char
*
prefix
=
""
;
const
char
*
prefix
=
""
,
*
dir
=
"."
;
/* I'd love to use long options, but that's not standard. */
/* FIXME: getopt_long ccan package? */
while
((
c
=
getopt
(
argc
,
argv
,
"sd:vn"
))
!=
-
1
)
{
switch
(
c
)
{
case
'd'
:
dir
=
optarg
;
prefix
=
talloc_append_string
(
talloc_basename
(
NULL
,
optarg
),
": "
);
...
...
@@ -274,7 +275,7 @@ int main(int argc, char *argv[])
if
(
optind
<
argc
)
usage
(
argv
[
0
]);
m
=
get_manifest
(
talloc_autofree_context
());
m
=
get_manifest
(
talloc_autofree_context
()
,
dir
);
init_tests
();
...
...
tools/ccanlint/ccanlint.h
View file @
32a31d9e
...
...
@@ -34,7 +34,7 @@ struct manifest {
struct
list_head
dep_objs
;
};
struct
manifest
*
get_manifest
(
const
void
*
ctx
);
struct
manifest
*
get_manifest
(
const
void
*
ctx
,
const
char
*
dir
);
struct
ccanlint
{
struct
list_node
list
;
...
...
tools/ccanlint/compulsory_tests/check_depends_built.c
View file @
32a31d9e
...
...
@@ -24,22 +24,10 @@ static const char *can_build(struct manifest *m)
/* FIXME: recursive ccanlint if they ask for it. */
static
bool
expect_obj_file
(
const
char
*
dir
)
{
char
*
olddir
;
struct
manifest
*
dep_man
;
bool
has_c_files
;
olddir
=
talloc_getcwd
(
dir
);
if
(
!
olddir
)
err
(
1
,
"Getting current directory"
);
/* We will fail below if this doesn't exist. */
if
(
chdir
(
dir
)
!=
0
)
return
false
;
dep_man
=
get_manifest
(
dir
);
if
(
chdir
(
olddir
)
!=
0
)
err
(
1
,
"Returning to original directory '%s'"
,
olddir
);
talloc_free
(
olddir
);
dep_man
=
get_manifest
(
dir
,
dir
);
/* If it has C files, we expect an object file built from them. */
has_c_files
=
!
list_empty
(
&
dep_man
->
c_files
);
...
...
tools/ccanlint/file_analysis.c
View file @
32a31d9e
...
...
@@ -151,9 +151,10 @@ char *report_on_lines(struct list_head *files,
return
sofar
;
}
struct
manifest
*
get_manifest
(
const
void
*
ctx
)
struct
manifest
*
get_manifest
(
const
void
*
ctx
,
const
char
*
dir
)
{
struct
manifest
*
m
=
talloc
(
ctx
,
struct
manifest
);
char
*
olddir
;
unsigned
int
len
;
m
->
info_file
=
NULL
;
...
...
@@ -169,6 +170,13 @@ struct manifest *get_manifest(const void *ctx)
list_head_init
(
&
m
->
dep_dirs
);
list_head_init
(
&
m
->
dep_objs
);
olddir
=
talloc_getcwd
(
NULL
);
if
(
!
olddir
)
err
(
1
,
"Getting current directory"
);
if
(
chdir
(
dir
)
!=
0
)
err
(
1
,
"Failed to chdir to %s"
,
dir
);
m
->
basename
=
talloc_getcwd
(
m
);
if
(
!
m
->
basename
)
err
(
1
,
"Getting current directory"
);
...
...
@@ -182,6 +190,11 @@ struct manifest *get_manifest(const void *ctx)
m
->
basename
++
;
add_files
(
m
,
""
);
if
(
chdir
(
olddir
)
!=
0
)
err
(
1
,
"Returning to original directory '%s'"
,
olddir
);
talloc_free
(
olddir
);
return
m
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment