Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
1082eabb
Unverified
Commit
1082eabb
authored
Nov 06, 2017
by
Edward Thomson
Committed by
GitHub
Nov 06, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4397 from pks-t/pks/appveyor-examples
appveyor: build examples
parents
8233f6e3
bf15dbf6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
4 deletions
+41
-4
appveyor.yml
+1
-1
examples/network/common.c
+39
-2
script/appveyor-mingw.sh
+1
-1
No files found.
appveyor.yml
View file @
1082eabb
...
...
@@ -36,7 +36,7 @@ build_script:
mkdir build
cd build
if ($env:GENERATOR -ne "MSYS Makefiles") {
cmake -D ENABLE_TRACE=ON -D BUILD_CLAR=ON -D MSVC_CRTDBG=ON .. -G"$env:GENERATOR"
cmake -D ENABLE_TRACE=ON -D BUILD_CLAR=ON -D
BUILD_EXAMPLES=ON -D
MSVC_CRTDBG=ON .. -G"$env:GENERATOR"
cmake --build . --config Debug
}
-
cmd
:
|
...
...
examples/network/common.c
View file @
1082eabb
...
...
@@ -16,6 +16,43 @@
# define UNUSED(x) x
#endif
static
int
readline
(
char
**
out
)
{
int
c
,
error
=
0
,
length
=
0
,
allocated
=
0
;
char
*
line
=
NULL
;
errno
=
0
;
while
((
c
=
getchar
())
!=
EOF
)
{
if
(
length
==
allocated
)
{
allocated
+=
16
;
if
((
line
=
realloc
(
line
,
allocated
))
==
NULL
)
{
error
=
-
1
;
goto
error
;
}
}
if
(
c
==
'\n'
)
break
;
line
[
length
++
]
=
c
;
}
if
(
errno
!=
0
)
{
error
=
-
1
;
goto
error
;
}
line
[
length
]
=
'\0'
;
*
out
=
line
;
line
=
NULL
;
error
=
length
;
error:
free
(
line
);
return
error
;
}
int
cred_acquire_cb
(
git_cred
**
out
,
const
char
*
UNUSED
(
url
),
const
char
*
UNUSED
(
username_from_url
),
...
...
@@ -26,14 +63,14 @@ int cred_acquire_cb(git_cred **out,
int
error
;
printf
(
"Username: "
);
if
(
getline
(
&
username
,
NULL
,
stdin
)
<
0
)
{
if
(
readline
(
&
username
)
<
0
)
{
fprintf
(
stderr
,
"Unable to read username: %s"
,
strerror
(
errno
));
return
-
1
;
}
/* Yup. Right there on your terminal. Careful where you copy/paste output. */
printf
(
"Password: "
);
if
(
getline
(
&
password
,
NULL
,
stdin
)
<
0
)
{
if
(
readline
(
&
password
)
<
0
)
{
fprintf
(
stderr
,
"Unable to read password: %s"
,
strerror
(
errno
));
free
(
username
);
return
-
1
;
...
...
script/appveyor-mingw.sh
View file @
1082eabb
...
...
@@ -19,5 +19,5 @@ fi
cd
build
gcc
--version
cmake
--version
cmake
-D
ENABLE_TRACE
=
ON
-D
BUILD_CLAR
=
ON ..
-G
"
$GENERATOR
"
cmake
-D
ENABLE_TRACE
=
ON
-D
BUILD_CLAR
=
ON
-D
BUILD_EXAMPLES
=
ON
..
-G
"
$GENERATOR
"
cmake
--build
.
--config
RelWithDebInfo
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