summaryrefslogtreecommitdiff
path: root/hscript/disk.cc
blob: d4914306f2e6ae288d0f24dd6c12b12aa8cecc18 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
 * disk.cc - Implementation of the Key classes for disk manipulation
 * libhscript, the HorizonScript library for
 * Project Horizon
 *
 * Copyright (c) 2019 Adélie Linux and contributors.  All rights reserved.
 * This code is licensed under the AGPL 3.0 license, as noted in the
 * LICENSE-code file in the root directory of this repository.
 *
 * SPDX-License-Identifier: AGPL-3.0-only
 */

#include <algorithm>
#include <string>
#include "disk.hh"
#include "util/output.hh"

using namespace Horizon::Keys;

Key *Mount::parseFromData(const std::string data, int lineno, int *errors,
                          int *warnings) {
    std::string dev, where, opt;
    long spaces = std::count(data.cbegin(), data.cend(), ' ');
    if(spaces < 1 || spaces > 2) {
        if(errors) *errors += 1;
        output_error("installfile:" + std::to_string(lineno),
                     "mount: expected either 2 or 3 elements, got: " +
                     std::to_string(spaces), "");
        return nullptr;
    }
    return new Mount(lineno, dev, where, opt);
}

bool Mount::validate() const {
    return false;
}

bool Mount::execute() const {
    return false;
}