vfs: check userland buffers before reading them.
[haiku.git] / src / bin / pkgman / CommonOptions.cpp
blob51af9f663085e9102308f015ac6d41179909d68a
1 /*
2 * Copyright 2014, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * All Rights Reserved. Distributed under the terms of the MIT License.
4 */
7 #include "CommonOptions.h"
9 #include <getopt.h>
10 #include <stdio.h>
11 #include <stdlib.h>
14 CommonOptions::CommonOptions()
16 fDebugLevel(0)
21 CommonOptions::~CommonOptions()
26 bool
27 CommonOptions::HandleOption(int option)
29 switch (option) {
30 case OPTION_DEBUG:
32 char* end;
33 fDebugLevel = strtol(optarg, &end, 0);
34 if (end == optarg) {
35 fprintf(stderr,
36 "*** invalid argument for option --debug\n");
37 exit(1);
39 return true;
42 default:
43 return false;