Flowgrind
Advanced TCP traffic generator
fg_progname.c
Go to the documentation of this file.
1
6
/*
7
* Copyright (C) 2014 Alexander Zimmermann <alexander.zimmermann@netapp.com
8
*
9
* This file is part of Flowgrind.
10
*
11
* Flowgrind is free software: you can redistribute it and/or modify
12
* it under the terms of the GNU General Public License as published by
13
* the Free Software Foundation, either version 3 of the License, or
14
* (at your option) any later version.
15
*
16
* Flowgrind is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU General Public License for more details.
20
*
21
* You should have received a copy of the GNU General Public License
22
* along with Flowgrind. If not, see <http://www.gnu.org/licenses/>.
23
*
24
*/
25
26
#ifdef HAVE_CONFIG_H
27
#include "
config.h
"
28
#endif
/* HAVE_CONFIG_H */
29
30
#include <string.h>
31
32
#include "
fg_progname.h
"
33
#include "
fg_error.h
"
34
35
const
char
*
progname
= NULL;
36
37
void
set_progname
(
const
char
*argv0)
38
{
39
/* Sanity check. POSIX requires the invoking process to pass a non-NULL
40
* argv[0] */
41
if
(argv0 == NULL)
42
errx
(
"a NULL argv[0] was passed through an exec system call"
);
43
44
/* Strip path */
45
const
char
*slash = strrchr(argv0,
'/'
);
46
const
char
*base = (slash != NULL ? slash + 1 : argv0);
47
progname
= base;
48
}
fg_progname.h
Program name management.
fg_error.h
Error-reporting routines used by Flowgrind.
errx
#define errx(...)
To report an error w/o a system error message.
Definition:
fg_error.h:47
set_progname
void set_progname(const char *argv0)
Set global variable 'progname', based on argv[0].
Definition:
fg_progname.c:37
config.h
progname
const char * progname
String containing name the program is called with.
Definition:
fg_progname.c:35
src
fg_progname.c
Generated on Sat Jan 16 2021 18:15:29 for Flowgrind by
1.8.17