Changes in uspace/app/shutdown/shutdown.c [f35749e:0d00e53] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/shutdown/shutdown.c
rf35749e r0d00e53 1 1 /* 2 * Copyright (c) 202 5Jiri Svoboda2 * Copyright (c) 2024 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 39 39 #include <fibril_synch.h> 40 40 #include <nchoice.h> 41 #include <shutdown.h>42 41 #include <stdio.h> 43 42 #include <stdbool.h> … … 114 113 115 114 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,123 115 0); 124 116 if (rc != EOK) { … … 165 157 action = sd_poweroff; 166 158 continue; 167 } else if (str_cmp(*argv, "-r") == 0) {168 --argc;169 ++argv;170 action = sd_restart;171 continue;172 159 } 173 160 … … 200 187 } 201 188 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 189 rc = system_shutdown(system); 215 190 if (rc != EOK) { 216 191 system_close(system); … … 248 223 "\tshutdown [<options>]\n" 249 224 "options:\n" 250 "\t-p Power off\n" 251 "\t-r Restart off\n"); 225 "\t-p Power off\n"); 252 226 } 253 227
Note:
See TracChangeset
for help on using the changeset viewer.