From: Bernardo Pascoal Figueiredo <bernardopascoalfigueiredo@tecnico.ulisboa.pt>
To: musl@lists.openwall.com
Subject: Implementation of GLOB_TILDE
Date: Tue, 17 Jan 2017 15:44:41 +0000 [thread overview]
Message-ID: <3e4dd55ae9eb7ec89aac886ad962786b@mail.tecnico.ulisboa.pt> (raw)
[-- Attachment #1: Type: text/plain, Size: 1001 bytes --]
Hi,
I'm sending as attachment a a patch that implments the GLOB_TILDE
extension to
the glob function.
This functions is helpful to compile some software that otherwise would
not
compile(without patching) with musl like i3wm.
I tested the code(test file as attachment) and the results seem to be
correct.
I have a few questions though:
* How do I contribute to musl? Should I just send patches to this
mailing list
or should I make pull requests?
* I defined GLOB_TILDE as 0x100, but I think this won't work on
architectures
that have sizeof(int) == 2, as the flags argument in glob is an int.
* I think it's best to define GLOB_TILDE in glob.h inside a '#if
defined(_GNU_SOURCE) || defined(_BSD_SOURCE)' what do you think?
* I had to copy strlcat and strlcpy to glob.c so I could use them. I
had to do
this because musl isn't compile as _GNU_SOURCE or _BSD_SOURCE so
string.h
doesn't expose these functions. How should I fix this?
Thanks,
Bernardo Figueiredo
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: test.c --]
[-- Type: text/x-c; name=test.c, Size: 581 bytes --]
#include <glob.h>
#include <stdbool.h>
#include <stdio.h>
int no_error(const char *p, int e) {
return 0;
}
int test_glob(const char *p) {
glob_t g;
int result = false;
result = glob(p, GLOB_TILDE, no_error, &g);
printf("result:%d", result);
if(result == 0) {
for(int i = 0; i < g.gl_pathc; ++i) {
printf(" '%s'", g.gl_pathv[i]);
}
}
printf("\n");
}
int main(int argc, char **argv) {
(void) argc; (void) argv;
test_glob("~");
test_glob("~/p*");
test_glob("~bpf");
test_glob("~bpf/p*");
return 0;
}
next reply other threads:[~2017-01-17 15:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-17 15:44 Bernardo Pascoal Figueiredo [this message]
2017-01-17 15:49 ` Bernardo Pascoal Figueiredo
2017-01-17 19:39 ` Rich Felker
2017-01-18 19:51 ` Bernardo Pascoal Figueiredo
2017-01-20 9:56 ` Bernardo Pascoal Figueiredo
2017-07-28 16:36 Nelo-Thara Wallus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3e4dd55ae9eb7ec89aac886ad962786b@mail.tecnico.ulisboa.pt \
--to=bernardopascoalfigueiredo@tecnico.ulisboa.pt \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).