trying something different
< Newer Topic
:: Older Topic >
Pages:<< prev 1 next >>
#1 Sep 19, 2013 9:19 pm
Magician
GroupMembers
Posts128
JoinedApr 9, 2010
Ok I have decided to try and use smaugfuss 1.9 and port all of CalareyMuds features over to that, and of course so far I'm having a bit of trouble
I'm trying to port over the easy stuff first
the part that I'm working on now is importing the ingredients that are able to be harvested, and I'm getting an error
here is the error
here is the code
My feeble brain and I are thinking it's something wrong in mud.h with
but of course I could be absolutely wrong in my thinking lol
I'm trying to port over the easy stuff first
the part that I'm working on now is importing the ingredients that are able to be harvested, and I'm getting an error
here is the error
build.c:4111: error: invalid use of incomplete type âstruct ingred_dataâ mud.h:164: error: forward declaration of âstruct ingred_dataâ
here is the code
while( ingred ) { sprintf( buf, "%d: %s\r\n", ingred->vnum, ( pObjIndex = get_obj_index( ingred->vnum ) ) ? pObjIndex->short_descr : "???" ); send_to_char( buf, ch ); ingred = ingred->next; }
My feeble brain and I are thinking it's something wrong in mud.h with
typedef struct ingred_data INGRED_DATA;
but of course I could be absolutely wrong in my thinking lol
#2 Sep 20, 2013 12:25 am
Geomancer
GroupAdministrators
Posts1,917
JoinedJul 26, 2005
in that function that is causing the bug message what do you have for ingred, also make sure that in mud.h or somewhere you have the data for struct ingred_data. The typedef struct just more or less tells it that where it finds INGRED_DATA point it to struct ingred_data
#3 Sep 23, 2013 3:46 am
Conjurer
GroupMembers
Posts398
JoinedMar 8, 2005
In early C compilers, "typedef (stuff) foo" was implemented as #defined foo (stuff)
Later, they added actual type checking.
Later, they added actual type checking.
#4 Sep 23, 2013 2:49 pm
Magician
GroupMembers
Posts128
JoinedApr 9, 2010
Ah thanks I forgot a piece of the code that told it what ingred was
#5 Sep 23, 2013 8:52 pm
Magician
GroupMembers
Posts128
JoinedApr 9, 2010
Hey Remcon since I know you've looked at the Calarey code
I'm trying to move over the mana system into Smaugfuss 1.9, but I'm having trouble finding out how much mana an area is set with each of the settings( stable, stagnant, etc)
basically, how does the mud know how much mana an area has for tapping.
I'm trying to move over the mana system into Smaugfuss 1.9, but I'm having trouble finding out how much mana an area is set with each of the settings( stable, stagnant, etc)
basically, how does the mud know how much mana an area has for tapping.
#6 Sep 25, 2013 3:25 pm
Last edited Sep 25, 2013 3:31 pm by ayuri
Magician
GroupMembers
Posts239
JoinedJun 13, 2008
I went and grabbed a copy of CaleryMud 2.0 (hope thats the right codebase) and started to poke about a bit.
I'm noticing in build.c some references to climate_mana
Just a snippet:
Also seeing a lot of stuff such as:
So I'm betting thats about what you'd want to look at.
Each area has mana set by functions in build.c thats set by do_climate
From there, it seems the player spells are looking at the area->weather->mana.
Also you'd want to poke about in update.c as it has what looks like mana regeneration code for the area.
Don't forget the usual places like db.c where your loading and saving (most likely saving) the values set for the areas.
**Edit You said some was stable, stagnate, etc etc. Didn't see anything along those lines in my quick look. Could you expand on those a bit? Like what spell uses them?
***EDIT EDIT: Ok I think I follow now, your talking about AIR, WIND, etc etc. Those seem to be using MAX_CLIMATE. Also found in build.c
Hope it helps some,
ayuri
I'm noticing in build.c some references to climate_mana
Just a snippet:
/* * set climate mana */ else if( !str_cmp( arg, "mana" ) ) { int i; argument = one_argument( argument, arg ); for( i = 0; i < MAX_CLIMATE; i++ ) { if( str_cmp( arg, mana_settings[i] ) ) continue; area->weather->climate_mana = i; ch_printf( ch, "The climate mana " "for %s is now %s.\n\r", area->name, mana_settings[i] ); break; } if( i == MAX_CLIMATE ) { ch_printf( ch, "Possible mana " "settings:\n\r" ); for( i = 0; i < MAX_CLIMATE; i++ ) { ch_printf( ch, "\t%s\n\r", mana_settings[i] ); } } return; }
Also seeing a lot of stuff such as:
ch->in_room->area->weather->mana += ( int )mana / 10; ch->mana -= ( mana / 2 );
So I'm betting thats about what you'd want to look at.
Each area has mana set by functions in build.c thats set by do_climate
From there, it seems the player spells are looking at the area->weather->mana.
Also you'd want to poke about in update.c as it has what looks like mana regeneration code for the area.
Don't forget the usual places like db.c where your loading and saving (most likely saving) the values set for the areas.
**Edit You said some was stable, stagnate, etc etc. Didn't see anything along those lines in my quick look. Could you expand on those a bit? Like what spell uses them?
***EDIT EDIT: Ok I think I follow now, your talking about AIR, WIND, etc etc. Those seem to be using MAX_CLIMATE. Also found in build.c
Hope it helps some,
ayuri
#7 Sep 25, 2013 9:40 pm
Geomancer
GroupAdministrators
Posts1,917
JoinedJul 26, 2005
mystickdreamer is using 3.0 CaleryMud i think I'll look sometime just to check Sorry been kind of busy and thanks ayuri for looking into it
#8 Sep 25, 2013 9:51 pm
Magician
GroupMembers
Posts239
JoinedJun 13, 2008
Remcon,
I may not be up to the level you are but I can at least try to follow the path. I was only able to find 2.0, but alas I was at work and our webfilter catches a lot of sites. Kinda amazed they haven't hit smaugmuds yet!
I'm willing to bet that they didn't change all that much from 2.0 to 3.0 however. Just look at how things are done in swr to swfote
Geeze, since I've been showing up here I have this inkling to try to get my game up and running....
*walks off into the distance chanting 'One FOTE, two FOTE, where's all the FOTE's?'
ayuri
I may not be up to the level you are but I can at least try to follow the path. I was only able to find 2.0, but alas I was at work and our webfilter catches a lot of sites. Kinda amazed they haven't hit smaugmuds yet!
I'm willing to bet that they didn't change all that much from 2.0 to 3.0 however. Just look at how things are done in swr to swfote
Geeze, since I've been showing up here I have this inkling to try to get my game up and running....
*walks off into the distance chanting 'One FOTE, two FOTE, where's all the FOTE's?'
ayuri
#9 Sep 25, 2013 10:10 pm
Geomancer
GroupAdministrators
Posts1,917
JoinedJul 26, 2005
in mud.h under the struct weather_data you can find
Thats the main things that will be needed.
Just do a grep in the cm3/src folder for those looking for things that have to do with them and the weather system.
this is for example what I got from doing a grep mana *
then you kind of look for the stuff that deals with weather etc...
int mana; /* base amount of mana in the zone */ int mana_vector; int climate_mana;
Thats the main things that will be needed.
Just do a grep in the cm3/src folder for those looking for things that have to do with them and the weather system.
this is for example what I got from doing a grep mana *
$ grep \>mana * act_comm.c: ch_printf( ch, "%5d/%-5d ", gch->mana, gch->max_mana ); act_info.c: mana = ( ch->in_room->area->weather->mana + 3 * weath_unit - 1 ) / weath_unit; act_info.c: if( ch->mana > ( int )ch->max_mana / 20 ) act_info.c: mana = ( ch->in_room->area->weather->mana + 3 * weath_unit - 1 ) / weath_unit; act_info.c: if( ch->mana > ( int )ch->max_mana / 20 ) act_wiz.c: ch_printf_color( ch, "&cMana: &p%d&w/&r%d\n\r", obj->mana, obj->raw_mana ); act_wiz.c: sprintf( mnbuf, "%d/%d", victim->mana, victim->max_mana ); act_wiz.c: vch->mana = vch->max_mana; act_wiz.c: victim->mana = victim->max_mana; act_wiz.c: ch_printf( ch, "%3d", pArea->weather->mana ); act_wiz.c: ch_printf( ch, "%3d", pArea->weather->mana_vector ); birth.c: ch->max_mana = UMAX( 20, ch->nation->mana * get_curr_int( ch ) ); birth.c: ch->mana = ch->max_mana; birth.c: ch->mana = ch->max_mana; birth.c: ch->mana = ch->max_mana; birth.c: ch->mana = ch->max_mana; build.c: obj->mana = value; build.c: sprintf( buf, "Mana: %d\n\r", ingred->mana ); build.c: ingred->mana = 0; build.c: ingred->mana = atoi( arg4 ); build.c: fprintf( fp, "Mana %d\n", ingred->mana ); build.c: sprintf( buf, "&gHitpoints: &G%d &gMana: &G%d\r\n", nation->hit, nation->mana ); build.c: nation->mana = 0; build.c: nation->mana = atoi( arg4 ); build.c: fprintf( fp, "Mana %d\n", nation->mana ); comm.c: stat = ch->mana; db.c: pArea->weather->mana = 0; db.c: pArea->weather->mana_vector = 0; db.c: obj->mana = 0; db.c: ch->mana = 100; db.c: ingred->mana = 0; db.c: KEY( "Mana", ingred->mana, fread_number( fp ) ); db.c: nation->mana = 0; db.c: KEY( "Mana", nation->mana, fread_number( fp ) ); db.c: pArea->weather->mana = number_range( -weath_unit, weath_unit ) + cf * number_range( 0, weath_unit ); db.c: pArea->weather->mana_vector = cf + number_range( -rand_factor, rand_factor ); elkandu.c: if( obj->mana < amt && type != MAG_TIME && type != MAG_ALL && type != MAG_LIGHT && type != MAG_UNHOLY ) elkandu.c: if( obj->mana < amt || IS_OBJ_STAT( obj, ITEM_MAGIC ) || ch->curr_talent[TAL_CATALYSM] < 40 ) elkandu.c: lose_hp( ch, obj->mana * 3 + ( obj->raw_mana / 20 ) ); elkandu.c: if( obj->mana < amt ) elkandu.c: if( obj->mana < amt ) elkandu.c: if( obj->mana < amt ) elkandu.c: if( obj->mana < amt ) elkandu.c: if( obj->mana < amt ) elkandu.c: obj->mana -= amt; elkandu.c: obj->mana += 50; elkandu.c: if( obj->mana && ch->curr_talent[TAL_SEEKING] >= 40 ) elkandu.c: ch_printf( ch, "%d points of energy have been absorbed into this item.\n\r", obj->mana ); elkandu.c: ch->mana = ch->max_mana + power; elkandu.c: ch->mana -= power; elkandu.c: victim->mana += power; elkandu.c: if( obj->mana < 500 && type != MAG_ANTIMAGIC ) elkandu.c: if( obj->mana < 500 ) elkandu.c: obj->mana -= 500; elkandu.c: obj->mana = 0; elkandu.c: obj->mana -= 500; elkandu.c: victim->max_mana = UMAX( 20, victim->nation->mana * get_curr_int( victim ) + victim->base_mana ); elkandu.c: victim->mana = UMIN( victim->max_mana, victim->mana ); elkandu.c: if( obj->mana < 50 ) elkandu.c: amount = obj->mana / 50; elkandu.c: obj->mana -= 50 * amount; fight.c: if( ch->mana < 0 ) handler.c: clone->mana = obj->mana; handler.c: if( obj1->pIndexData == obj2->pIndexData && QUICKMATCH( obj1->name, obj2->name ) && QUICKMATCH( obj1->short_descr, obj2->short_descr ) && QUICKMATCH( obj1->description, obj2->description ) && QUICKMATCH( obj1->action_desc, obj2->action_desc ) && obj1->item_type == obj2->item_type && xSAME_BITS( obj1->extra_flags, obj2->extra_flags ) && obj1->weight == obj2->weight && obj1->wear_loc == obj2->wear_loc && obj1->raw_mana == obj2->raw_mana && obj1->mana == obj2->mana && obj1->timer == obj2->timer && obj1->value[0] == obj2->value[0] && obj1->value[1] == obj2->value[1] && obj1->value[2] == obj2->value[2] && obj1->value[3] == obj2->value[3] && obj1->value[4] == obj2->value[4] && obj1->value[5] == obj2->value[5] && !obj1->first_extradesc && !obj2->first_extradesc && !obj1->first_content && !obj2->first_content && !obj1->gem && !obj2->gem && obj1->count + obj2->count > 0 ) /* prevent count overflow */ magic.c: return ch->mana; magic.c:if( !IS_NPC( ch ) && ch->mana < mana ) magic.c:victim->mana = URANGE( 0, victim->mana + af.modifier, victim->max_mana ); magic.c ch->in_room->area->weather->mana * 10 ) - amount ); magic.c:ch->mana += amount; magic.c:ch->in_room->area->weather->mana -= ( int )amount / 100; magic.c:if( weath->mana < 200 ) magic.c:storm *= weath->mana; magic.c:ch->mana += 100 + ( int )storm / 4000; makeobjs.c: mob->max_mana = UMAX( 100, mob->perm_int * nation->mana ); makeobjs.c: mob->mana = mob->max_mana; mud_comm.c:victim->mana, mud_prog.c:return mprog_veval( chkchar->mana, opr, atoi( rval ), mob ); player.c: ch->mana, ch->max_mana, xIS_SET( ch->act, PLR_AUTOLOOT ) ? '*' : ' ' ); player.c: ch->hit, ch->max_hit, ch->mana, ch->max_mana, ch->move, ch->max_move ); player.c: ch->hit, ch->max_hit, ch->mana, ch->max_mana, ch->move, ch->max_move ); save.c: fprintf( fp, "HpManaMove %d %d %d %d %d %d\n", ch->hit, ch->max_hit, ch->mana, ch->max_mana, ch->move, ch->max_move ); save.c: if( obj->mana ) save.c: fprintf( fp, "Mana %d\n", obj->mana ); save.c: ch->mana = fread_number( fp ); save.c: KEY( "Mana", obj->mana, fread_number( fp ) ); skills.c: if( !IS_NPC( ch ) && ch->mana < mana ) skills.c: ch->mana -= mana / 2; skills.c: ch->in_room->area->weather->mana += ( int )mana / 10; skills.c: ch->mana -= mana; skills.c: ch->in_room->area->weather->mana += ( int )mana / 10; skills.c: ch->mana -= mana; skills.c: ch->in_room->area->weather->mana += ( int )mana / 10; skills.c: &&ch->in_room->area->weather->mana < -100 ) skills.c:if( ingred->mana > 0 skills.c: &&ingred->mana < ch->in_room->area->weather->mana ) skills.c:if( victim->mana < 50 ) skills.c:victim->mana -= 5; skills.c:victim->in_room->area->weather->mana += 1; skills.c: if( !IS_NPC( ch ) && ch->mana < mana ) skills.c: ch->mana -= ( mana / 2 ); skills.c: ch->in_room->area->weather->mana += ( int )mana / 10; skills.c: ch->mana -= ( mana / 2 ); skills.c: ch->in_room->area->weather->mana += ( int )mana / 10; skills.c: ch->mana -= mana; skills.c: ch->in_room->area->weather->mana += ( int )mana / 10; skills.c: if( !IS_NPC( ch ) && ch->mana < mana ) skills.c: ch->mana -= ( mana / 2 ); skills.c: ch->in_room->area->weather->mana += ( int )mana / 10; skills.c: ch->mana -= ( mana / 2 ); skills.c: ch->in_room->area->weather->mana += ( int )mana / 10; skills.c: ch->mana -= mana; skills.c: ch->in_room->area->weather->mana += ( int )mana / 10; skills.c:obj->mana += obj2->mana; skills.c: obj->mana /= div; special.c:obj->mana += 1; special.c: obj->mana += 1; special.c: &&ch->in_room->area->weather->mana < -100 ) special.c:if( ingred->mana > 0 special.c: &&ingred->mana < ch->in_room->area->weather->mana ) talent.c:ch->mana -= UMAX( 0, i ); talent.c:ch->in_room->area->weather->mana += ( int )i / 100; talent.c:if( ch->mana < -1000 ) talent.c:TALENT( ch, TAL_CATALYSM ) + ch->in_room->area->weather->mana, talent.c:victim->mana -= amt; talent.c:ch->mana += amt; talent.c:if( ch->mana <= 0 ) talent.c:ch->max_mana = UMAX( 20, ch->nation->mana * get_curr_int( ch ) + ch->base_mana ); talent.c:ch->mana = ch->max_mana; talent.c:if( ch->mana <= 0 ) talent.c:victim->max_mana = UMAX( 20, victim->nation->mana * get_curr_int( victim ) + victim->base_mana ); talent.c:victim->mana = UMIN( victim->max_mana, victim->mana ); talent.c:if( ch->mana <= 0 ) talent.c:if( victim->mana < 100 ) talent.c:if( victim->mana < 100 ) talent.c:if( victim->mana < 50 ) talent.c:if( obj->mana < 500 ) talent.c:obj->mana -= 500; talent.c:if( obj->mana < 500 ) talent.c:obj->mana -= 500; talent.c:lose_hp( ch, obj->mana * 3 + ( obj->raw_mana / 30 ) ); talent.c:amt = ch->mana / magic; talent.c:ch->mana = ch->max_mana + amt; talent.c:ch->mana -= amt; talent.c:victim->mana += amt; talent.c:if( ch->mana < victim->perm_con * 10 ) talent.c:if( ch->mana - ( pMobIndex->perm_con * 50 ) < 0 ) talent.c:use_magic( ch, TAL_HEALING, ch->mana ); talent.c:if( obj->mana && ch->curr_talent[TAL_SEEKING] >= 40 ) talent.c:obj->mana ); talent.c:if( obj->mana < amt ) talent.c:if( obj->mana < amt ) talent.c:if( obj->mana < amt ) talent.c:if( obj->mana < amt ) talent.c:if( obj->mana < amt ) talent.c:if( obj->mana < amt ) talent.c:obj->mana -= amt; update.c: if( ch->mana < 0 ) update.c: if( ch->mana < -1000 ) update.c: check_rebirth( ch, ch->mana * -1 ); update.c: if( ch->mana > 0 ) update.c: ch->mana -= 100; update.c: ch->mana -= 30; update.c: i = number_range( 0, ch->in_room->area->weather->mana * 10 ); update.c: ch->in_room->area->weather->mana -= ( int )i / 10; update.c: return UMIN( gain, ch->max_mana - ch->mana ); update.c: if( ch->mana < 0 || IS_SET( ch->mood, MOOD_READY ) ) update.c: if( ch->mana < ch->max_mana ) update.c: ch->mana += mana_gain( ch ); update.c: else if( ch->mana > ch->max_mana ) update.c: lose_hp( ch, ( ch->mana - ch->max_mana ) ); update.c: ch->mana = ch->max_mana; update.c: ch->max_mana = UMAX( 20, ch->nation->mana * get_curr_int( ch ) + ch->base_mana ); update.c: obj->mana++; update.c: obj->mana++; update.c: dM += ( neigh->address->weather->mana - weather->mana ) / neigh_factor; update.c: weather->mana_vector += ( int )dM; update.c: weather->mana_vector = URANGE( -max_vector, weather->mana_vector, max_vector ); update.c: pArea->weather->mana += pArea->weather->mana_vector; update.c: pArea->weather->mana += 50; update.c: pArea->weather->mana = URANGE( -limit, pArea->weather->mana, limit ); update.c: mana = weath->mana; update.c: dM = weath->mana_vector;
then you kind of look for the stuff that deals with weather etc...
#10 Sep 25, 2013 10:14 pm
Geomancer
GroupAdministrators
Posts1,917
JoinedJul 26, 2005
Remcon, I may not be up to the level you are but I can at least try to follow the path. I was only able to find 2.0, but alas I was at work and our webfilter catches a lot of sites. Kinda amazed they haven't hit smaugmuds yet! I'm willing to bet that they didn't change all that much from 2.0 to 3.0 however. Just look at how things are done in swr to swfote Geeze, since I've been showing up here I have this inkling to try to get my game up and running.... *walks off into the distance chanting 'One FOTE, two FOTE, where's all the FOTE's?'
You do fine lol, yea I recall having a problem finding one i could download to start with. You could have downloaded one I have that has some bugs fixed and is on here.
Not sure on how many changes were done between the two but yea it can be massive lol.
You should
#11 Sep 26, 2013 9:39 am
Magician
GroupMembers
Posts128
JoinedApr 9, 2010
lol thanks ya'll
the reason I asked is because I'm porting everything over into smaugfuss1.9 and I was having problems adding mana to the weather system, since it's vastly different (imo)
just not sure how to do that
in the meantime I'm porting everything else over, boy it's a lot more than I thought lol
the reason I asked is because I'm porting everything over into smaugfuss1.9 and I was having problems adding mana to the weather system, since it's vastly different (imo)
just not sure how to do that
in the meantime I'm porting everything else over, boy it's a lot more than I thought lol
#12 Oct 2, 2013 7:49 pm
Magician
GroupMembers
Posts128
JoinedApr 9, 2010
OK so I'm stuck again.
I'm getting these errors
Here is the code
I'm getting these errors
Compiling o/birth.o.... birth.c: In function âconst char* find_token(const char*, const char*, int)â: birth.c:69: error: assignment of read-only location â*(token + ((long unsigned int)((long unsigned int)n)))â birth.c:73: error: assignment of read-only location â*(token + ((long unsigned int)((long unsigned int)n)))â make[1]: *** [o/birth.o] Error 1 make: *** [all] Error 2
Here is the code
const char *find_token( const char *token, const char *str, int num ) { int i, count, found, n; count = 0; n = 0; token = STRALLOC( "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" ); found = FALSE; for( i = 0; i < MAX_STRING_LENGTH; i++ ) { if( str[i] == '\0' ) break; if( str[i] == ',' ) { count++; if( found ) break; } if( count == num && !found ) { found = TRUE; } if( found && str[i] != ',' ) { token[n] = str[i]; n++; } } token[n] = '\0'; return token; }
#13 Oct 2, 2013 8:08 pm
Geomancer
GroupAdministrators
Posts1,917
JoinedJul 26, 2005
hmm and what is the reason for this code right off? I would say the problem is the const char *token is what it is complaining about. You shouldn't STRALLOC on a string like that either.
#14 Oct 3, 2013 1:34 am
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008
and yeah I know that would be the simplest way to do things, but if I could figure out whats causing it, because it didn't used too then my life would be alot easier and wouldn't have to deal with players complaining.
#15 Oct 3, 2013 9:30 am
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008
whoops wrong thread my bad
#16 Oct 3, 2013 10:21 am
Conjurer
GroupMembers
Posts398
JoinedMar 8, 2005
You are trying to modify a variable which was passed in as "const", namely token.
#17 Oct 4, 2013 11:52 am
Magician
GroupMembers
Posts128
JoinedApr 9, 2010
This is part of the character generator code
best I can figure from looking at the code
it's in birth.c in case you wanted to look at it,
is that it has to deal with eyes, hair, skin, etc
and I understand token is being passed as a constant then trying to be modified, but I don't understand how to fix it
best I can figure from looking at the code
it's in birth.c in case you wanted to look at it,
is that it has to deal with eyes, hair, skin, etc
and I understand token is being passed as a constant then trying to be modified, but I don't understand how to fix it
#18 Oct 4, 2013 12:24 pm
Conjurer
GroupMembers
Posts398
JoinedMar 8, 2005
The first problem is, you're passing in a string called "token", but then you're throwing it away and trying to allocate a new one on top of it, which hides the value you were passed in... why pass in a value that you never use?
I'm not sure exactly what your code is supposed to do, but here's a before-coffee attempt at writing it differently. It is untested, of course. But the main thing is... why bother passing in token if you don't use it?
It seems to me like you could just use a system call for this as well... a loop around index() or strstr() perhaps...
I'm not sure exactly what your code is supposed to do, but here's a before-coffee attempt at writing it differently. It is untested, of course. But the main thing is... why bother passing in token if you don't use it?
It seems to me like you could just use a system call for this as well... a loop around index() or strstr() perhaps...
char *find_token( const char *token, const char *str, int num ) { int found = 0; int count = 0; char * thing = STRALLOC( "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" ); for( char *s = str, char *t = thing; *s; s++ ) { if( *s ) break; if( *s == ',' ) { count++; if( found ) break; } if( count == num && !found ) found = 1; if( found && *s != ',' ) { if( t > (thing + strlen(thing) - 1) ) { /* You need some error handling in case you run off the end of the string */ fprintf( stderr, "Too many tokens found, fix me!\n" ); abort(); } *t = *s; t++; } } *t = '\0'; return thing; }
Pages:<< prev 1 next >>