Deutsch   English   Français   Italiano  
<lkbjchFebk9U1@mid.individual.net>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: ted@loft.tnolan.com (Ted Nolan <tednolan>)
Newsgroups: comp.lang.c
Subject: Command line globber/tokenizer library for C?
Date: 10 Sep 2024 19:01:37 GMT
Organization: loft
Lines: 28
Message-ID: <lkbjchFebk9U1@mid.individual.net>
X-Trace: individual.net Aq16sE0EdMmV/nrnw0MxWwApLOHMKYg0XUmf/kzXukk3VvlZ1w
X-Orig-Path: not-for-mail
Cancel-Lock: sha1:x3k2YeIzwqbjlAblOHom8N+BXfU= sha256:BwFTJp0z5SLH9U0b0sqZovTquQXFHmDQ52ho4WjNhtE=
X-Newsreader: trn 4.0-test76 (Apr 2, 2001)
Bytes: 1362

I have the case where my C program is handed a string which is basically
a command line.

Is there a common open source C library for tokenizing and globbing
this into an argc/argv as a shell would do?  I've googled, but I get
too much C++ & other language stuff.

Note that I'm not asking for getopt(), that comes afterwards, and
I'm not asking for any variable interpolation, but just that a string
like, say

	hello -world "This is foo.*" foo.*

becomes something like
	
	my_argv[0]	"hello"
	my_argv[1]	"-world"
	my_argv[2] "This is foo.*"
	my_argv[3] foo.h
	my_argv[4] foo.c
	my_argv[5] foo.txt

	my_argc = 6

I could live without the globbing if that's a bridge too far.
-- 
columbiaclosings.com
What's not in Columbia anymore..