- for ( res = to = strplhead->str_names + strplhead->str_nalloc, from = str;
- ( (*to++ = *from++) != '\0'); )
- continue;
- strplhead->str_nalloc += len;
- return (res);
+ res = (struct strdesc *)(strplhead->str_names + strplhead->str_nalloc);
+ /*
+ * Save the string information that is always present
+ */
+ res->sd_stroff = strfilepos;
+ res->sd_strlen = len;
+ res->sd_place = place;
+ /*
+ * Now, save the string itself. If str is null, then
+ * the characters have already been dumped to the file
+ */
+ if ((place & STR_CORE) && str)
+ movestr(res[0].sd_string, str, len);
+ if (place & STR_FILE){
+ if (str){
+ fwrite(str, 1, len, strfile);
+ }
+ strfilepos += len;
+ }
+ /*
+ * Adjust the in core string pool size
+ */
+ strplhead->str_nalloc += tlen;
+ return(res);