cvs server: Diffing . Index: client.c =================================================================== RCS file: /home2/cvsroot/ccvs/src/client.c,v retrieving revision 1.276 diff -u -r1.276 client.c --- client.c 2000/01/05 16:35:45 1.276 +++ client.c 2000/04/20 09:45:58 @@ -3536,7 +3536,11 @@ if (use_socket_style) { if (shutdown (server_sock, 2) < 0) +#ifdef __BEOS__ + ; /* Be hasn't yet implemented the shutdown syscall */ +#else error (1, 0, "shutting down server socket: %s", SOCK_STRERROR (SOCK_ERRNO)); +#endif } else #endif /* NO_SOCKET_TO_FD */ @@ -3545,8 +3549,12 @@ if (server_fd != -1) { if (shutdown (server_fd, 1) < 0) +#ifdef __BEOS__ +; +#else error (1, 0, "shutting down connection to %s: %s", CVSroot_hostname, SOCK_STRERROR (SOCK_ERRNO)); +#endif /* * This test will always be true because we dup the descriptor */ @@ -3891,6 +3899,7 @@ /* Unrecognized response from server. */ if (shutdown (sock, 2) < 0) { +#ifndef __BEOS__ error (0, 0, "unrecognized auth response from %s: %s", CVSroot_hostname, read_buf); @@ -3898,6 +3907,7 @@ "shutdown() failed, server %s: %s", CVSroot_hostname, SOCK_STRERROR (SOCK_ERRNO)); +#endif } error (1, 0, "unrecognized auth response from %s: %s", @@ -3910,8 +3920,12 @@ if (verify_only) { if (shutdown (sock, 2) < 0) +#ifdef __BEOS__ +; +#else error (0, 0, "shutdown() failed, server %s: %s", CVSroot_hostname, SOCK_STRERROR (SOCK_ERRNO)); +#endif return; } else @@ -3937,6 +3951,7 @@ rejected: if (shutdown (sock, 2) < 0) { +#ifndef __BEOS__ error (0, 0, "authorization failed: server %s rejected access", CVSroot_hostname); @@ -3944,6 +3959,7 @@ "shutdown() failed (server %s): %s", CVSroot_hostname, SOCK_STRERROR (SOCK_ERRNO)); +#endif } error (0, 0, Index: login.c =================================================================== RCS file: /home2/cvsroot/ccvs/src/login.c,v retrieving revision 1.56 diff -u -r1.56 login.c --- login.c 1999/11/30 05:11:12 1.56 +++ login.c 2000/04/20 09:46:00 @@ -19,10 +19,14 @@ declaration won't work (some Crays declare the 2#$@% thing as varadic, believe it or not). On Cray, getpass will be declared in either stdlib.h or unistd.h. */ -#ifndef _CRAY +#if !defined(_CRAY) && !defined(__BEOS__) extern char *getpass (); #endif +#ifdef __BEOS__ +#include <termios.h> +#endif + #ifndef CVS_PASSWORD_FILE #define CVS_PASSWORD_FILE ".cvspass" #endif @@ -31,6 +35,45 @@ static char *cvs_password = NULL; static char *construct_cvspass_filename PROTO ((void)); + +#ifdef __BEOS__ +char *getpass(const char *prompt) { +#define _PASSWORD_LEN 256 +#define TCSASOFT 0 + struct termios oterm, term; + register int ch; + register char *p; + static char buf[_PASSWORD_LEN + 1]; + sigset_t oset, nset; + + /* + * note - blocking signals isn't necessarily the + * right thing, but we leave it for now. + */ + sigemptyset(&nset); + sigaddset(&nset, SIGINT); + sigaddset(&nset, SIGTSTP); + (void)sigprocmask(SIG_BLOCK, &nset, &oset); + + (void)tcgetattr(fileno(stdin), &oterm); + term = oterm; + term.c_lflag &= ~ECHO; + (void)tcsetattr(fileno(stdin), TCSAFLUSH|TCSASOFT, &term); + (void)fputs(prompt, stderr); + rewind(stderr); /* implied flush */ + for (p = buf; (ch = getc(stdin)) != EOF && ch != '\n';) + if (p < buf + _PASSWORD_LEN) + *p++ = ch; + *p = '\0'; + + (void)write(fileno(stderr), "\n", 1); + (void)tcsetattr(fileno(stdin), TCSAFLUSH|TCSASOFT, &oterm); + (void)sigprocmask(SIG_SETMASK, &oset, NULL); + + return(buf); +} + +#endif /* The return value will need to be freed. */ static char *
Sure, I know there are apparently a few binaries of cvs floating around that
should work with BeOS, but I would rather build from source. Basically
everything is ok, once NO_SOCKET_TO_FD is defined. However Be hasn't
implemented getpass or shutdown (properly) yet. The attached diff (I hope
it's not actually encoded, I'm still playing around with Mail-It, and am very
used to pine) merely facilitates the building of cvs on BeOS by including a
getpass function (nearly verbatim from FreeBSD's libc), and "appropiate"
preprocessor directives around the error checking after a call to shutdown.
- alex