From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28375 invoked by alias); 20 Nov 2014 01:48:12 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 33718 Received: (qmail 2873 invoked from network); 20 Nov 2014 01:48:09 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, T_HDRS_LCASE,T_MANY_HDRS_LCASE autolearn=ham version=3.3.2 X-Authority-Analysis: v=2.1 cv=AduIQRnG c=1 sm=1 tr=0 a=5FaaCEzylGLpkmKDZB0s2g==:117 a=5FaaCEzylGLpkmKDZB0s2g==:17 a=G8GL833Es-AA:10 a=IkcTkHD0fZMA:10 a=h5WVT1OF_D3YUEkhZSQA:9 a=QEXdDO2ut3YA:10 Message-id: <546D4854.1030604@eastlink.ca> Date: Wed, 19 Nov 2014 17:48:04 -0800 From: Ray Andrews User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Icedove/31.2.0 MIME-version: 1.0 To: Zsh hackers list Subject: trying dputs Content-type: text/plain; charset=utf-8; format=flowed Content-transfer-encoding: 7bit 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'))