Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
trying dputs
- X-seq: zsh-workers 33718
- From: Ray Andrews <rayandrews@xxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: trying dputs
- Date: Wed, 19 Nov 2014 17:48:04 -0800
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
int
bin_whence(char *nam, char **argv, Options ops, int func)
{
HashNode hn;
Patprog pprog;
int returnval = 0;
int printflags = 0;
int aliasflags;
int csh, all, v, wd;
int informed;
char *cnam, **allmatched = 0;
If I steal 'opts->args' with a test string like this:
//char *garbage = "utter garbage";
//ops->args = &garbage;
... I get what I expect from this:
dputs("\nargs: %s", *(ops->args));
... but if I leave the pointer unmolested, I get a zsh
segmentation fault. Why is that? I'd expect to either
get a real string, or NULL. It's as if 'ops->args' is
dangling.
The function works fine even with the dummy string, so
I'm pretty sure 'ops->args' isn't needed. Still, I'd
say it shouldn't barf if I try to print it.
/* Check some option information */
csh = OPT_ISSET(ops,'c');
v = OPT_ISSET(ops,'v');
all = OPT_ISSET(ops,'a');
wd = OPT_ISSET(ops,'w');
if (OPT_ISSET(ops,'w'))
Messages sorted by:
Reverse Date,
Date,
Thread,
Author