3 * $Id: cvssh.c,v 1.2 1999/04/21 09:07:55 mdw Exp $
5 * Login shell for an anonymous CVS user
7 * (c) 1999 Mark Wooding
10 /*----- Licensing notice --------------------------------------------------*
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software Foundation,
24 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 /*----- Revision history --------------------------------------------------*
30 * Revision 1.2 1999/04/21 09:07:55 mdw
31 * Fiddle with copyright messages so that they're correct.
33 * Revision 1.1 1999/04/21 09:04:24 mdw
34 * Add `cvssh' shell for anonymous CVS support.
38 /*----- Header files ------------------------------------------------------*/
44 #include <sys/types.h>
48 #include <sys/utsname.h>
50 /*----- Main code ---------------------------------------------------------*/
52 const static char help[] = "\
53 Welcome to the anonymous CVS server.\n\
55 To use the CVS server, set your `CVSROOT' environment variable to\n\
56 `%s@%s:%s', and use the `cvs checkout' and `cvs update'\n\
57 commands. See the manual for more information on how to use CVS.\n\
66 home = getenv("HOME");
70 struct passwd *pw = getpwuid(getuid());
72 p = (pw ? pw->pw_name : "anoncvs");
74 home = (pw ? pw->pw_dir : "/cvs");
81 h = gethostbyname(u.nodename);
88 printf(help, p, host, home);
92 int main(int argc, char *argv[])
94 if (argc == 2 && (strcmp(argv[1], ".ssh/rc")) == 0)
96 if (argc != 3 || strcmp(argv[1], "-c") || strcmp(argv[2], "cvs server"))
98 execl("/bin/cvs", "cvs", "-A", "server", (char *)0);
99 perror("cvssh (exec)");
103 /*----- That's all, folks -------------------------------------------------*/