Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/shutdown/shutdown.c

    rf35749e r0d00e53  
    11/*
    2  * Copyright (c) 2025 Jiri Svoboda
     2 * Copyright (c) 2024 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    3939#include <fibril_synch.h>
    4040#include <nchoice.h>
    41 #include <shutdown.h>
    4241#include <stdio.h>
    4342#include <stdbool.h>
     
    114113
    115114        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,
    123115            0);
    124116        if (rc != EOK) {
     
    165157                        action = sd_poweroff;
    166158                        continue;
    167                 } else if (str_cmp(*argv, "-r") == 0) {
    168                         --argc;
    169                         ++argv;
    170                         action = sd_restart;
    171                         continue;
    172159                }
    173160
     
    200187        }
    201188
    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);
    215190        if (rc != EOK) {
    216191                system_close(system);
     
    248223            "\tshutdown [<options>]\n"
    249224            "options:\n"
    250             "\t-p Power off\n"
    251             "\t-r Restart off\n");
     225            "\t-p Power off\n");
    252226}
    253227
Note: See TracChangeset for help on using the changeset viewer.