3 * $Id: cvssh.c,v 1.1 1999/04/21 09:04:24 mdw Exp $
5 * Login shell for an anonymous CVS user
7 * (c) 1999 Mark Wooding
10 /*----- Licensing notice --------------------------------------------------*
12 * This file is part of the background resolver (resolve).
14 * resolve is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * resolve is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with resolve; if not, write to the Free Software Foundation,
26 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 /*----- Revision history --------------------------------------------------*
32 * Revision 1.1 1999/04/21 09:04:24 mdw
33 * Add `cvssh' shell for anonymous CVS support.
37 /*----- Header files ------------------------------------------------------*/
43 #include <sys/types.h>
47 #include <sys/utsname.h>
49 /*----- Main code ---------------------------------------------------------*/
51 const static char help[] = "\
52 Welcome to the anonymous CVS server.\n\
54 To use the CVS server, set your `CVSROOT' environment variable to\n\
55 `%s@%s:%s', and use the `cvs checkout' and `cvs update'\n\
56 commands. See the manual for more information on how to use CVS.\n\
65 home = getenv("HOME");
69 struct passwd *pw = getpwuid(getuid());
71 p = (pw ? pw->pw_name : "anoncvs");
73 home = (pw ? pw->pw_dir : "/cvs");
80 h = gethostbyname(u.nodename);
87 printf(help, p, host, home);
91 int main(int argc, char *argv[])
93 if (argc == 2 && (strcmp(argv[1], ".ssh/rc")) == 0)
95 if (argc != 3 || strcmp(argv[1], "-c") || strcmp(argv[2], "cvs server"))
97 execl("/bin/cvs", "cvs", "-A", "server", (char *)0);
98 perror("cvssh (exec)");
102 /*----- That's all, folks -------------------------------------------------*/