1*a4f11372Smiod /* $OpenBSD: cmd.h,v 1.19 2023/02/23 19:48:22 miod Exp $ */ 2df1f5d3aSweingart 3df1f5d3aSweingart /* 4df1f5d3aSweingart * Copyright (c) 1997 Michael Shalayeff 5df1f5d3aSweingart * All rights reserved. 6df1f5d3aSweingart * 7df1f5d3aSweingart * Redistribution and use in source and binary forms, with or without 8df1f5d3aSweingart * modification, are permitted provided that the following conditions 9df1f5d3aSweingart * are met: 10df1f5d3aSweingart * 1. Redistributions of source code must retain the above copyright 11df1f5d3aSweingart * notice, this list of conditions and the following disclaimer. 12df1f5d3aSweingart * 2. Redistributions in binary form must reproduce the above copyright 13df1f5d3aSweingart * notice, this list of conditions and the following disclaimer in the 14df1f5d3aSweingart * documentation and/or other materials provided with the distribution. 15df1f5d3aSweingart * 16df1f5d3aSweingart * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17df1f5d3aSweingart * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18df1f5d3aSweingart * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19df1f5d3aSweingart * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 20df1f5d3aSweingart * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21df1f5d3aSweingart * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22df1f5d3aSweingart * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23df1f5d3aSweingart * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24df1f5d3aSweingart * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25df1f5d3aSweingart * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26df1f5d3aSweingart * SUCH DAMAGE. 27df1f5d3aSweingart * 28df1f5d3aSweingart */ 29df1f5d3aSweingart 308113530bStom #define CMD_BUFF_SIZE 133 31346e4808Sdrahn #define BOOTDEVLEN 1024 32cd073bdfSmickey 33cd073bdfSmickey struct cmd_table { 34cd073bdfSmickey char *cmd_name; 35cd073bdfSmickey char cmd_type; 36cd073bdfSmickey #define CMDT_CMD 0 37cd073bdfSmickey #define CMDT_VAR 1 38cd073bdfSmickey #define CMDT_SET 2 39cd073bdfSmickey #define CMDT_MDC 3 40c4071fd1Smillert int (*cmd_exec)(void); 41cd073bdfSmickey }; 42cd073bdfSmickey 43df1f5d3aSweingart struct cmd_state { 44346e4808Sdrahn char bootdev[BOOTDEVLEN]; /* device */ 45872a9688Smickey char image[MAXPATHLEN - 16]; /* image */ 46fd1bb5efSmickey int boothowto; /* howto */ 471ad1f950Smickey char *conf; /* /etc/boot.conf normally */ 48df1f5d3aSweingart int timeout; 49df1f5d3aSweingart 501ad1f950Smickey char path[MAXPATHLEN]; /* buffer for pathname compose */ 51dc461ba4Smickey const struct cmd_table *cmd; 52df1f5d3aSweingart int argc; 53df1f5d3aSweingart char *argv[8]; /* XXX i hope this is enough */ 54df1f5d3aSweingart }; 555c487e4aSmickey extern struct cmd_state cmd; 56df1f5d3aSweingart 57c4071fd1Smillert int getcmd(void); 58c4071fd1Smillert int read_conf(void); 59c4071fd1Smillert int bootparse(int); 60599546b3Sderaadt void boot(dev_t); 618113530bStom 62886f00e8Sclaudio int upgrade(void); 638113530bStom int docmd(void); /* No longer static: needed by regress test */ 64