Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Peter Tyser | eabe6d9 | 2009-10-16 17:36:25 -0500 | [diff] [blame] | 2 | /* |
| 3 | * Copyright 2000-2009 |
| 4 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
Peter Tyser | eabe6d9 | 2009-10-16 17:36:25 -0500 | [diff] [blame] | 5 | */ |
| 6 | |
Peter Tyser | eabe6d9 | 2009-10-16 17:36:25 -0500 | [diff] [blame] | 7 | #include <command.h> |
Tom Rini | 5c1444f | 2024-04-27 08:10:59 -0600 | [diff] [blame] | 8 | #include <vsprintf.h> |
Peter Tyser | eabe6d9 | 2009-10-16 17:36:25 -0500 | [diff] [blame] | 9 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 10 | static int do_exit(struct cmd_tbl *cmdtp, int flag, int argc, |
| 11 | char *const argv[]) |
Peter Tyser | eabe6d9 | 2009-10-16 17:36:25 -0500 | [diff] [blame] | 12 | { |
Marek Vasut | fd09932 | 2022-12-20 07:25:59 +0100 | [diff] [blame] | 13 | int r; |
| 14 | |
| 15 | r = 0; |
Peter Tyser | eabe6d9 | 2009-10-16 17:36:25 -0500 | [diff] [blame] | 16 | if (argc > 1) |
Marek Vasut | fd09932 | 2022-12-20 07:25:59 +0100 | [diff] [blame] | 17 | r = simple_strtoul(argv[1], NULL, 10); |
Peter Tyser | eabe6d9 | 2009-10-16 17:36:25 -0500 | [diff] [blame] | 18 | |
Marek Vasut | fd09932 | 2022-12-20 07:25:59 +0100 | [diff] [blame] | 19 | return -r - 2; |
Peter Tyser | eabe6d9 | 2009-10-16 17:36:25 -0500 | [diff] [blame] | 20 | } |
| 21 | |
| 22 | U_BOOT_CMD( |
| 23 | exit, 2, 1, do_exit, |
| 24 | "exit script", |
| 25 | "" |
| 26 | ); |