Changeset f35749e in mainline for uspace/app/shutdown/shutdown.c
- Timestamp:
- 2025-02-28T23:38:26Z (2 months ago)
- Branches:
- master
- Children:
- 8300c72
- Parents:
- 4285f384
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/shutdown/shutdown.c
r4285f384 rf35749e 1 1 /* 2 * Copyright (c) 202 4Jiri Svoboda2 * Copyright (c) 2025 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 39 39 #include <fibril_synch.h> 40 40 #include <nchoice.h> 41 #include <shutdown.h> 41 42 #include <stdio.h> 42 43 #include <stdbool.h> … … 113 114 114 115 rc = nchoice_add(nchoice, "Power off", (void *)(uintptr_t)sd_poweroff, 116 0); 117 if (rc != EOK) { 118 printf(NAME ": Out of memory.\n"); 119 goto error; 120 } 121 122 rc = nchoice_add(nchoice, "Restart", (void *)(uintptr_t)sd_restart, 115 123 0); 116 124 if (rc != EOK) { … … 157 165 action = sd_poweroff; 158 166 continue; 167 } else if (str_cmp(*argv, "-r") == 0) { 168 --argc; 169 ++argv; 170 action = sd_restart; 171 continue; 159 172 } 160 173 … … 187 200 } 188 201 189 rc = system_shutdown(system); 202 switch (action) { 203 case sd_poweroff: 204 rc = system_poweroff(system); 205 break; 206 case sd_restart: 207 rc = system_restart(system); 208 break; 209 case sd_cancel: 210 assert(false); 211 rc = EINVAL; 212 break; 213 } 214 190 215 if (rc != EOK) { 191 216 system_close(system); … … 223 248 "\tshutdown [<options>]\n" 224 249 "options:\n" 225 "\t-p Power off\n"); 250 "\t-p Power off\n" 251 "\t-r Restart off\n"); 226 252 } 227 253
Note:
See TracChangeset
for help on using the changeset viewer.