|
|
1.1 ! root 1: /* ! 2: * Copyright (C) 2010 Michael Brown <[email protected]>. ! 3: * ! 4: * This program is free software; you can redistribute it and/or ! 5: * modify it under the terms of the GNU General Public License as ! 6: * published by the Free Software Foundation; either version 2 of the ! 7: * License, or any later version. ! 8: * ! 9: * This program is distributed in the hope that it will be useful, but ! 10: * WITHOUT ANY WARRANTY; without even the implied warranty of ! 11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! 12: * General Public License for more details. ! 13: * ! 14: * You should have received a copy of the GNU General Public License ! 15: * along with this program; if not, write to the Free Software ! 16: * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! 17: */ ! 18: ! 19: #include <string.h> ! 20: #include <stdio.h> ! 21: #include <ipxe/command.h> ! 22: #include <ipxe/parseopt.h> ! 23: #include <ipxe/login_ui.h> ! 24: ! 25: FILE_LICENCE ( GPL2_OR_LATER ); ! 26: ! 27: /** @file ! 28: * ! 29: * Login commands ! 30: * ! 31: */ ! 32: ! 33: /** "login" options */ ! 34: struct login_options {}; ! 35: ! 36: /** "login" option list */ ! 37: static struct option_descriptor login_opts[] = {}; ! 38: ! 39: /** "login" command descriptor */ ! 40: static struct command_descriptor login_cmd = ! 41: COMMAND_DESC ( struct login_options, login_opts, 0, 0, "" ); ! 42: ! 43: /** ! 44: * "login" command ! 45: * ! 46: * @v argc Argument count ! 47: * @v argv Argument list ! 48: * @ret rc Return status code ! 49: */ ! 50: static int login_exec ( int argc, char **argv ) { ! 51: struct login_options opts; ! 52: int rc; ! 53: ! 54: /* Parse options */ ! 55: if ( ( rc = parse_options ( argc, argv, &login_cmd, &opts ) ) != 0 ) ! 56: return rc; ! 57: ! 58: /* Show login UI */ ! 59: if ( ( rc = login_ui() ) != 0 ) { ! 60: printf ( "Could not set credentials: %s\n", ! 61: strerror ( rc ) ); ! 62: return rc; ! 63: } ! 64: ! 65: return 0; ! 66: } ! 67: ! 68: /** Login commands */ ! 69: struct command login_command __command = { ! 70: .name = "login", ! 71: .exec = login_exec, ! 72: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.