I don't know if this makes any different or not, but I believe that it should be sizeof(skill_type) instead of pSkill...
Richard Lindsey Network Administrator INTERA, Inc. 9111A Research Blvd. Austin, TX 78758 (512) 425-2006 [EMAIL PROTECTED] -----Original Message----- From: Valnir [mailto:[EMAIL PROTECTED] Sent: Friday, January 23, 2004 1:40 PM To: ROM List Subject: Re: ROM Mailing List Archive... ok.. I am SO close to getting this thing right using "qsort"... having a little problem though and I think it deals with "sizeof()".. Thoughts / Input?? -V --------------------------------------------------------------- SKILL_DATA *skills[MAX_SKILL]; SKILL_DATA *pSkill; int sn = 0; for( i = 1; i < MAX_SKILL; i++ ) { if ( IS_NULLSTR( skill_table[i].name ) ) continue; pSkill = (SKILL_DATA *)i; skills[sn++] = pSkill; } qsort(skills, sn, sizeof(pSkill), srt_skills); /* rest of function is usually here. */ int srt_skills(const void *p1, const void *p2) { struct skill_type sk1; struct skill_type sk2; sk1 = *(struct skill_type *)p1; sk2 = *(struct skill_type *)p2; if (sk1.name == NULL) return 2; else if (sk2.name == NULL) return 1; return ( strcmp( sk1.name, sk2.name ) ); } /* GDB output */ #0 strcmp (p1=0x1 <Address 0x1 out of bounds>, p2=0x2 <Address 0x2 out of bounds>) at ../sysdeps/generic/strcmp.c:38 38 ../sysdeps/generic/strcmp.c: No such file or directory. (gdb) where #0 strcmp (p1=0x1 <Address 0x1 out of bounds>, p2=0x2 <Address 0x2 out of bounds>) at ../sysdeps/generic/strcmp.c:38 #1 0x80b86ae in srt_skills (p1=0xbfffd198, p2=0xbfffd19c) at skills.c:2162 #2 0x400687f1 in msort_with_tmp (b=0xbfffd198, n=2, s=4, cmp=0x80b8654 <srt_skills>, t=0x8161d30 "") at msort.c:58 #3 0x400687a5 in msort_with_tmp (b=0xbfffd198, n=4, s=4, cmp=0x80b8654 <srt_skills>, t=0x8161d30 "") at msort.c:49 #4 0x400687a5 in msort_with_tmp (b=0xbfffd198, n=8, s=4, cmp=0x80b8654 <srt_skills>, t=0x8161d30 "") at msort.c:49 #5 0x400687a5 in msort_with_tmp (b=0xbfffd198, n=16, s=4, cmp=0x80b8654 <srt_skills>, t=0x8161d30 "") at msort.c:49 #6 0x400687a5 in msort_with_tmp (b=0xbfffd198, n=33, s=4, cmp=0x80b8654 <srt_skills>, t=0x8161d30 "") at msort.c:49 #7 0x400687a5 in msort_with_tmp (b=0xbfffd198, n=67, s=4, cmp=0x80b8654 <srt_skills>, t=0x8161d30 "") at msort.c:49 #8 0x400687a5 in msort_with_tmp (b=0xbfffd198, n=134, s=4, cmp=0x80b8654 <srt_skills>, t=0x8161d30 "") at msort.c:49 #9 0x400687a5 in msort_with_tmp (b=0xbfffd198, n=268, s=4, cmp=0x80b8654 <srt_skills>, t=0x8161d30 "") at msort.c:49 #10 0x40068943 in qsort (b=0xbfffd198, n=268, s=4, cmp=0x80b8654 <srt_skills>) at msort.c:118 #11 0x80b43ea in save_skills (ch=0x40a131f4, argument=0xbfffeaa2 "") at skills.c:226 #12 0x809aa43 in interpret (ch=0x40a131f4, argument=0xbfffea9c "sksave") at interp.c:748 #13 0x807833d in substitute_alias (d=0x40a11368, argument=0x40a11785 "sksave") at alias.c:95 #14 0x8079861 in game_loop_unix (control=4) at comm.c:863 #15 0x80793ef in main (argc=2, argv=0xbffffcd4) at comm.c:472 ------------------------------------------------------------------------ ---- ------------ ----- Original Message ----- From: "Richard Lindsey" <[EMAIL PROTECTED]> To: "Valnir" <[EMAIL PROTECTED]>; <[email protected]> Sent: Friday, January 23, 2004 11:36 AM Subject: ROM Mailing List Archive... Here ya go, I had to go out and retrack it down a week or so ago :D http://www.the-infinite.org/lists/romlist/ Richard Lindsey Network Administrator INTERA, Inc. 9111A Research Blvd. Austin, TX 78758 (512) 425-2006 [EMAIL PROTECTED] -----Original Message----- From: Valnir [mailto:[EMAIL PROTECTED] Sent: Friday, January 23, 2004 10:35 AM To: [email protected] Subject: Re: Skill List Sorting. That would be great, thanks! (not sure where the archive is, link to that would be good too!) -Valnir ----- Original Message ----- From: "Jesse Boulianne" <[EMAIL PROTECTED]> To: "Leath, Chad (C.L.)" <[EMAIL PROTECTED]>; "'Valnir'" <[EMAIL PROTECTED]> Cc: <[email protected]> Sent: Friday, January 23, 2004 11:25 AM Subject: Re: Skill List Sorting. > There's also a snippet out there for sorting the wizhelp by level and > alphabetically. It's quite nice, actually. > I can post it, as I've installed it. > Of course, you'd have to modify it to reflect the skill_table. :) > > ----- Original Message ----- > From: "Leath, Chad (C.L.)" <[EMAIL PROTECTED]> > To: "'Valnir'" <[EMAIL PROTECTED]> > Cc: <[email protected]> > Sent: Friday, January 23, 2004 11:29 AM > Subject: RE: Skill List Sorting. > > > > There is a post in the archives about using qsort to sort and display > > commands. This could be changed to sort your skills. > > > > -----Original Message----- > > From: Valnir [mailto:[EMAIL PROTECTED] > > Sent: Friday, January 23, 2004 11:27 AM > > To: [email protected] > > Subject: Skill List Sorting. > > > > > > Here is a problem plaguing me. > > > > The SKILLS list on our mud is getting a little out of hand and I need to > > find a way to sort it. Alphabetically if possible. Any help would be > GREATLY > > appreciated! > > > > - Valnir > > > > > > -- > > ROM mailing list > > [email protected] > > http://www.rom.org/cgi-bin/mailman/listinfo/rom > > > > -- > > ROM mailing list > > [email protected] > > http://www.rom.org/cgi-bin/mailman/listinfo/rom > > > > -- ROM mailing list [email protected] http://www.rom.org/cgi-bin/mailman/listinfo/rom -- ROM mailing list [email protected] http://www.rom.org/cgi-bin/mailman/listinfo/rom

