pefv700@perv.pe.utexas.edu (03/28/91)
I am trying to use the tsearch(3C) routines tsearch, tfind, and tdelete. I first call tsearch (Recall: char *tsearch((char *)key, (char **)rootp, compar)) with the following for "key" and "rootp" (dbx) ex *saveitem *saveitem = { ut_line = "ftp18903" ut_name = "" ut_host = "" ut_time = 670105915 (dbx) ex root root = (nil) if ((matchitem = (struct utmp *)tsearch((char *)saveitem, (char **)&root, linecmp)) == (struct utmp *)NULL) { The results of the call are that matchitem is the same as root: (dbx) ex root root = 0x4df0 (dbx) ex matchitem matchitem = 0x4df0 (dbx) ex *root *root = { ut_line = "wk " ut_name = "" ut_host = "" ut_time = 0 } A subsequent tfind with the same ut_line member as in *saveitem above (so that linecmp(saveitem, &wtbuf) returns 0) if ((matchitem = (struct utmp *)tfind((char *)&wtbuf, (char **)&root, linecmp)) != (struct utmp *)NULL) { results in: (dbx) ex matchitem matchitem = 0x4df0 (dbx) ex *matchitem *matchitem = { ut_line = "wk " ut_name = "" ut_host = "" ut_time = 8 } Well, it returned it as it was before (except for the 8) but it's obviously not doing what I want it to do. Any ideas? Chris