mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 09:38:19 +00:00
binpac: Adapted binpac to compile with MSVC for Windows environment.
This commit is contained in:
parent
dd3737b5c8
commit
faa1b7abbf
5 changed files with 29 additions and 13 deletions
|
@ -20,8 +20,10 @@
|
|||
#include "pac_record.h"
|
||||
#include "pac_type.h"
|
||||
#include "pac_utils.h"
|
||||
#include <libgen.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <filesystem>
|
||||
#include <string_view>
|
||||
|
||||
int line_number = 1;
|
||||
|
||||
|
@ -42,6 +44,11 @@ int char_token(int tok)
|
|||
|
||||
void include_file(const char *filename);
|
||||
|
||||
string dirname(std::string_view path)
|
||||
{
|
||||
return std::filesystem::path(path).parent_path().string();
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
/* EC -- embedded code state */
|
||||
|
@ -334,10 +341,10 @@ void include_file(const char *filename)
|
|||
{
|
||||
char* tmp = new char[strlen(input_filename.c_str()) + 1];
|
||||
strcpy(tmp, input_filename.c_str());
|
||||
char* dir = dirname(tmp);
|
||||
string dir = dirname(tmp);
|
||||
|
||||
if ( dir )
|
||||
full_filename = string(dir) + "/" + filename;
|
||||
if ( ! dir.empty() )
|
||||
full_filename = dir + "/" + filename;
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "%s:%d error: cannot include file \"%s\": %s\n",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue