Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
updater
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Michal Čihař
updater
Commits
ac497b19
Verified
Commit
ac497b19
authored
Jan 28, 2016
by
Michal 'vorner' Vaner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Interface of the argument parser
parent
22f5ae8f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
124 additions
and
0 deletions
+124
-0
src/lib/Makefile.dir
src/lib/Makefile.dir
+4
-0
src/lib/arguments.c
src/lib/arguments.c
+24
-0
src/lib/arguments.h
src/lib/arguments.h
+63
-0
src/opkg-trans/Makefile.dir
src/opkg-trans/Makefile.dir
+4
-0
src/opkg-trans/main.c
src/opkg-trans/main.c
+29
-0
No files found.
src/lib/Makefile.dir
View file @
ac497b19
LIBRARIES
+=
src/lib/libupdater
libupdater_MODULES
:=
\
arguments
src/lib/arguments.c
0 → 100644
View file @
ac497b19
/*
* Copyright 2016, CZ.NIC z.s.p.o. (http://www.nic.cz/)
*
* This file is part of NUCI configuration server.
*
* NUCI is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NUCI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NUCI. If not, see <http://www.gnu.org/licenses/>.
*/
#include "arguments.h"
struct
cmd_op
*
cmd_args_parse
(
int
argc
,
char
*
argv
[])
{
// TODO
}
src/lib/arguments.h
0 → 100644
View file @
ac497b19
/*
* Copyright 2016, CZ.NIC z.s.p.o. (http://www.nic.cz/)
*
* This file is part of NUCI configuration server.
*
* NUCI is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NUCI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NUCI. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UPDATER_ARGUMENTS_H
#define UPDATER_ARGUMENTS_H
// An operation type to be performed
enum
cmd_op_type
{
// Terminate with non-zero exit code.
COT_CRASH
,
// Terminate with zero exit code.
COT_EXIT
,
// Print help.
COT_HELP
,
// Clean up any unfinished journal work and roll back whatever can be.
COT_JOURNAL_ABORT
,
// Resume interrupted operation from journal, if any is there.
COT_JOURNAL_RESUME
,
// Install a package. A parameter is passed, with the path to the .ipk file.
COT_INSTALL
,
// Remove a package from the system. A parameter is passed with the name of the package.
COT_REMOVE
};
// A whole operation to be performed, with any needed parameter.
struct
cmd_op
{
// What to do.
enum
cmd_op_type
type
;
// With what. If the type doesn't expect a parameter, it is set to NULL.
const
char
*
parameter
;
};
/*
* Parse the command line arguments (or any other string array,
* as passed) and produce list of requested operations. Note that
* the operations don't have to correspond one to one with the
* arguments.
*
* The result is allocated on the heap. The parameters are not
* allocated, they point to the strings passed in argv.
*
* The result is always terminated by an operation of type COT_CRASH
* or COT_EXIT.
*/
struct
cmd_op
*
cmd_args_parse
(
int
argc
,
char
*
argv
[])
__attribute__
((
nonnull
))
__attribute__
((
returns_nonnull
));
#endif
src/opkg-trans/Makefile.dir
View file @
ac497b19
BINARIES
+=
src/opkg-trans/opkg-trans
opkg-trans_MODULES
:=
main
opkg-trans_LOCAL_LIBS
:=
updater
src/opkg-trans/main.c
0 → 100644
View file @
ac497b19
/*
* Copyright 2016, CZ.NIC z.s.p.o. (http://www.nic.cz/)
*
* This file is part of NUCI configuration server.
*
* NUCI is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NUCI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NUCI. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../lib/arguments.h"
#include <stdlib.h>
int
main
(
int
argc
,
char
*
argv
[])
{
struct
cmd_op
*
ops
=
cmd_args_parse
(
argc
,
argv
);
// TODO: Perform the operations
free
(
ops
);
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment