123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- /*
- * Copyright (c) 2019 Stefan Strobel <stefan.strobel@shimatta.net>
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at https://mozilla.org/MPL/2.0/.
- */
- /**
- * @file shellmatta_opt.c
- * @brief option parser implementation of the shellmatta
- * @author Stefan Strobel <stefan.strobel@shimatta.net>
- */
- /**
- * @addtogroup shellmatta_opt
- * @{
- */
- #include "shellmatta_opt.h"
- #include "shellmatta_utils.h"
- #include "shellmatta.h"
- #include <string.h>
- /**
- * @brief scans the current input and parses options in getopt style
- * @param[in] handle shellmatta handle
- * @param[in] optionString option string e.g. "cd:e::"
- * @param[out] option pointer to store the detected option to
- * @param[out] argument pointer to store the argument string to (can be NULL)
- * @param[out] argLen pointer to store the argument lengh to (can be NULL)
- */
- shellmatta_retCode_t shellmatta_opt( shellmatta_handle_t handle,
- char *optionString,
- char *option,
- char **argument,
- uint32_t *argLen)
- {
- shellmatta_retCode_t ret = SHELLMATTA_USE_FAULT;
- shellmatta_instance_t *inst = (shellmatta_instance_t*)handle;
- /** -# check parameters for plausibility */
- if( (NULL != inst)
- && (SHELLMATTA_MAGIC == inst->magic)
- && (NULL != optionString)
- && (NULL != option))
- {
-
- }
- (void)argument;
- (void)argLen;
- return ret;
- }
- /**
- * @brief scans the current input and parses options in getopt_long style
- * @param[in] handle shellmatta handle
- * @param[in] longOptions option structure - pointer to array of type #shellmatta_opt_long_t
- * @param[out] option pointer to store the detected option to
- * @param[out] argument pointer to store the argument string to (can be NULL)
- * @param[out] argLen pointer to store the argument lengh to (can be NULL)
- */
- shellmatta_retCode_t shellmatta_opt_long( shellmatta_handle_t handle,
- shellmatta_opt_long_t *longOptions,
- char *option,
- char **argument,
- uint32_t *argLen)
- {
- shellmatta_retCode_t ret = SHELLMATTA_USE_FAULT;
- shellmatta_instance_t *inst = (shellmatta_instance_t*)handle;
- /** -# check parameters for plausibility */
- if( (NULL != inst)
- && (SHELLMATTA_MAGIC == inst->magic)
- && (NULL != longOptions)
- && (NULL != option))
- {
-
- }
- (void)argument;
- (void)argLen;
- return ret;
- }
- /**
- * @brief initializes the option parser instance
- * @param[in, out] inst pointer to a shellmatta instance
- */
- shellmatta_retCode_t shellmatta_opt_init(shellmatta_instance_t *inst)
- {
- /*! -# initialize all relevant option parser variables */
- inst->optionParser.offset = 0u;
- return SHELLMATTA_OK;
- }
- /**
- * @}
- */
|