File tree Expand file tree Collapse file tree 3 files changed +41
-4
lines changed
Expand file tree Collapse file tree 3 files changed +41
-4
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ build_script:
3636 mkdir build
3737 cd build
3838 if ($env:GENERATOR -ne "MSYS Makefiles") {
39- cmake -D ENABLE_TRACE=ON -D BUILD_CLAR=ON -D MSVC_CRTDBG=ON .. -G"$env:GENERATOR"
39+ cmake -D ENABLE_TRACE=ON -D BUILD_CLAR=ON -D BUILD_EXAMPLES=ON -D MSVC_CRTDBG=ON .. -G"$env:GENERATOR"
4040 cmake --build . --config Debug
4141 }
4242 - cmd : |
Original file line number Diff line number Diff line change 1616# define UNUSED (x ) x
1717#endif
1818
19+ static int readline (char * * out )
20+ {
21+ int c , error = 0 , length = 0 , allocated = 0 ;
22+ char * line = NULL ;
23+
24+ errno = 0 ;
25+
26+ while ((c = getchar ()) != EOF ) {
27+ if (length == allocated ) {
28+ allocated += 16 ;
29+
30+ if ((line = realloc (line , allocated )) == NULL ) {
31+ error = -1 ;
32+ goto error ;
33+ }
34+ }
35+
36+ if (c == '\n' )
37+ break ;
38+
39+ line [length ++ ] = c ;
40+ }
41+
42+ if (errno != 0 ) {
43+ error = -1 ;
44+ goto error ;
45+ }
46+
47+ line [length ] = '\0' ;
48+ * out = line ;
49+ line = NULL ;
50+ error = length ;
51+ error :
52+ free (line );
53+ return error ;
54+ }
55+
1956int cred_acquire_cb (git_cred * * out ,
2057 const char * UNUSED (url ),
2158 const char * UNUSED (username_from_url ),
@@ -26,14 +63,14 @@ int cred_acquire_cb(git_cred **out,
2663 int error ;
2764
2865 printf ("Username: " );
29- if (getline (& username , NULL , stdin ) < 0 ) {
66+ if (readline (& username ) < 0 ) {
3067 fprintf (stderr , "Unable to read username: %s" , strerror (errno ));
3168 return -1 ;
3269 }
3370
3471 /* Yup. Right there on your terminal. Careful where you copy/paste output. */
3572 printf ("Password: " );
36- if (getline (& password , NULL , stdin ) < 0 ) {
73+ if (readline (& password ) < 0 ) {
3774 fprintf (stderr , "Unable to read password: %s" , strerror (errno ));
3875 free (username );
3976 return -1 ;
Original file line number Diff line number Diff line change 1919cd build
2020gcc --version
2121cmake --version
22- cmake -D ENABLE_TRACE=ON -D BUILD_CLAR=ON .. -G" $GENERATOR "
22+ cmake -D ENABLE_TRACE=ON -D BUILD_CLAR=ON -D BUILD_EXAMPLES=ON .. -G" $GENERATOR "
2323cmake --build . --config RelWithDebInfo
You can’t perform that action at this time.
0 commit comments