2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License
18 * @author Adam Malinowski <a.malinowsk2@partner.samsung.com>
19 * @brief Main source file of screenshooter
32 Command parseArguments(int argc, const char **argv, int *width, int *height, char **filename) {
33 Command ret = Capture;
37 struct poptOption optionsTable[] = {
39 { "version", 'v', POPT_ARG_NONE, NULL, 'v', "show version of this binary and exit", NULL },
41 { "width", 'w', POPT_ARG_INT, width, 'w', "set width of captured image", NULL },
42 { "height", 'h', POPT_ARG_INT, height, 'h', "set height of captured image", NULL },
43 { "file", 'f', POPT_ARG_STRING, filename, 'f', "file name to store captured image in", NULL },
45 { NULL, 0, 0, NULL, 0, NULL, NULL }
48 optCon = poptGetContext(NULL, argc, argv, optionsTable, 0);
49 poptSetOtherOptionHelp(optCon, "command");
51 poptPrintUsage(optCon, stderr, 0);
56 while ((c = poptGetNextOpt(optCon)) >= 0) {
65 fprintf(stderr, "%s: %s\n", poptBadOption(optCon, POPT_BADOPTION_NOALIAS), poptStrerror(c));
70 poptFreeContext(optCon);
75 int main(int argc, const char **argv) {
76 int width, height, ret = EXIT_SUCCESS;
79 Command command = parseArguments(argc, argv, &width, &height, &filename);
82 // TODO: add cupturing function
85 // TODO: add version function