Re: XForms: strcmp

From: T.C. Zhao (tc_zhao@yahoo.com)
Date: Wed Nov 22 2000 - 21:17:02 EST

  • Next message: Matthias Rarey: "Re: XForms: spreadsheet??"

    # To subscribers of the xforms list from "T.C. Zhao" <tc_zhao@yahoo.com> :

    I don't believe you can use strcmp() to check for nulls.
    Just use ==.

    --- joel <joel@dabbles-n-doodads.com> wrote:
    > # To subscribers of the xforms list from joel
    > <joel@dabbles-n-doodads.com> :
    >
    > Using backtrace from ddd I get,
    >
    > #4 0x804ca3e in main () at shmoo_ctl_main.c:56
    > #3 0x40058939 in fl_do_forms () from libforms.so.0.89
    > #2 0x400495fe in fl_object_qread () from libforms.so.0.89
    > #1 0x804aabe in setup_Knob () at project_cb.c:15
    > #0 0x4024abf3 in strcmp () at strcmp.c:46
    >
    > The strcmp is located within a callback function that was generated
    > using fdesign.
    >
    > #include "shmoo.h" /* this contains #include <string.h> and
    > other needed
    > includes */
    >
    > void setup_Knob(FL_OBJECT *OB, long data)
    > {
    > char name[128];
    >
    > keys.newtestflag++;
    >
    > if((strcmp(project.proj_name,NULL)) == 0) <----------- this is
    > where the
    > fault occures
    > {
    > strcpy(project.proj_name,fl_show_input("A project has not
    > been defined",
    >
    > "please enter a project name"));
    >
    > strcpy(name,"/shmoo/projects/");
    > strcat(name,project.proj_name);
    > mkdir(name, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH |
    > S_IWOTH |
    > S_IXGRP | S_IXUSR | S_IXOTH);
    > }
    >
    >
    >
    > fl_show_form(fd_knobs->knobs,FL_PLACE_CENTERFREE,FL_FULLBORDER,"setup
    > knobs");
    > return;
    > }
    >
    >
    > Steve Lamont wrote:
    >
    > > # To subscribers of the xforms list from Steve Lamont
    > <spl@ncmir.ucsd.edu> :
    > >
    > > > I have a program using xforms that runs fine on HPUX. I
    > recompiled the
    > > > source on a Linux box and it compiled fine. When I run the
    > program the
    > > > first form opens as expected. When I click on a button the
    > program exits
    > > > with a segmentation fault. I used a debugger and found the
    > program was
    > > > crashing at a line that has a strcmp function. ...
    > >
    > > Can you provide a complete traceback? Is the strcmp() in your
    > program
    > > or in XForms somewhere?
    > >
    > > spl
    > > _________________________________________________
    > > To unsubscribe, send the message "unsubscribe" to
    > > xforms-request@bob.usuhs.mil or see
    > > http://bob.usuhs.mil/mailserv/xforms.html
    > > XForms Home Page: http://world.std.com/~xforms
    > > List Archive: http://bob.usuhs.mil/mailserv/list-archives/
    >
    > _________________________________________________
    > To unsubscribe, send the message "unsubscribe" to
    > xforms-request@bob.usuhs.mil or see
    > http://bob.usuhs.mil/mailserv/xforms.html
    > XForms Home Page: http://world.std.com/~xforms
    > List Archive: http://bob.usuhs.mil/mailserv/list-archives/
    >

    __________________________________________________
    Do You Yahoo!?
    Yahoo! Shopping - Thousands of Stores. Millions of Products.
    http://shopping.yahoo.com/
    _________________________________________________
    To unsubscribe, send the message "unsubscribe" to
    xforms-request@bob.usuhs.mil or see
    http://bob.usuhs.mil/mailserv/xforms.html
    XForms Home Page: http://world.std.com/~xforms
    List Archive: http://bob.usuhs.mil/mailserv/list-archives/



    This archive was generated by hypermail 2b29 : Wed Nov 22 2000 - 21:19:24 EST