LibC: Add stubs for glob and globfree

This commit is contained in:
Tim Schumacher 2021-05-27 12:43:01 +02:00 committed by Brian Gianforcaro
parent f672b4c151
commit 6c650d1b8d
3 changed files with 61 additions and 0 deletions

View file

@ -12,6 +12,7 @@ set(LIBC_SOURCES
ifaddrs.cpp
getopt.cpp
getsubopt.cpp
glob.cpp
grp.cpp
inttypes.cpp
ioctl.cpp

View file

@ -0,0 +1,25 @@
/*
* Copyright (c) 2021, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/Format.h>
#include <assert.h>
#include <glob.h>
extern "C" {
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/glob.html
int glob(char const*, int, int (*)(char const* epath, int eerrno), glob_t*)
{
dbgln("FIXME: Implement glob()");
TODO();
}
void globfree(glob_t*)
{
dbgln("FIXME: Implement globfree()");
TODO();
}
}

View file

@ -0,0 +1,35 @@
/*
* Copyright (c) 2021, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <sys/types.h>
__BEGIN_DECLS
typedef struct {
size_t gl_pathc;
char** gl_pathv;
size_t gl_offs;
} glob_t;
#define GLOB_APPEND (1 << 0)
#define GLOB_DOOFS (1 << 1)
#define GLOB_ERR (1 << 2)
#define GLOB_MARK (1 << 3)
#define GLOB_NOCHECK (1 << 4)
#define GLOB_NOESCAPE (1 << 5)
#define GLOB_NOSORT (1 << 6)
#define GLOB_ABORTED 1
#define GLOB_NOMATCH 2
#define GLOB_NOSPACE 3
int glob(char const* pattern, int flags, int (*errfunc)(char const* epath, int eerrno), glob_t* pglob);
void globfree(glob_t* pglob);
__END_DECLS