/* $RCSfile: str.c,v $$Revision: 4.1 $$Date: 92/08/07 18:29:26 $
*
- * Copyright (c) 1991-1997, Larry Wall
+ * Copyright (c) 1991-2001, Larry Wall
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
#include "util.h"
void
-str_numset(str,num)
-register STR *str;
-double num;
+str_numset(register STR *str, double num)
{
str->str_nval = num;
str->str_pok = 0; /* invalidate pointer */
}
char *
-str_2ptr(str)
-register STR *str;
+str_2ptr(register STR *str)
{
register char *s;
str->str_pok = 1;
#ifdef DEBUGGING
if (debug & 32)
- fprintf(stderr,"0x%lx ptr(%s)\n",str,str->str_ptr);
+ fprintf(stderr,"0x%lx ptr(%s)\n",(unsigned long)str,str->str_ptr);
#endif
return str->str_ptr;
}
double
-str_2num(str)
-register STR *str;
+str_2num(register STR *str)
{
if (!str)
return 0.0;
str->str_nok = 1;
#ifdef DEBUGGING
if (debug & 32)
- fprintf(stderr,"0x%lx num(%g)\n",str,str->str_nval);
+ fprintf(stderr,"0x%lx num(%g)\n",(unsigned long)str,str->str_nval);
#endif
return str->str_nval;
}
void
-str_sset(dstr,sstr)
-STR *dstr;
-register STR *sstr;
+str_sset(STR *dstr, register STR *sstr)
{
if (!sstr)
str_nset(dstr,No,0);
}
void
-str_nset(str,ptr,len)
-register STR *str;
-register char *ptr;
-register int len;
+str_nset(register STR *str, register char *ptr, register int len)
{
GROWSTR(&(str->str_ptr), &(str->str_len), len + 1);
bcopy(ptr,str->str_ptr,len);
}
void
-str_set(str,ptr)
-register STR *str;
-register char *ptr;
+str_set(register STR *str, register char *ptr)
{
register int len;
}
void
-str_chop(str,ptr) /* like set but assuming ptr is in str */
-register STR *str;
-register char *ptr;
+str_chop(register STR *str, register char *ptr) /* like set but assuming ptr is in str */
+
+
{
if (!(str->str_pok))
str_2ptr(str);
}
void
-str_ncat(str,ptr,len)
-register STR *str;
-register char *ptr;
-register int len;
+str_ncat(register STR *str, register char *ptr, register int len)
{
if (!(str->str_pok))
str_2ptr(str);
}
void
-str_scat(dstr,sstr)
-STR *dstr;
-register STR *sstr;
+str_scat(STR *dstr, register STR *sstr)
{
if (!(sstr->str_pok))
str_2ptr(sstr);
}
void
-str_cat(str,ptr)
-register STR *str;
-register char *ptr;
+str_cat(register STR *str, register char *ptr)
{
register int len;
}
char *
-str_append_till(str,from,delim,keeplist)
-register STR *str;
-register char *from;
-register int delim;
-char *keeplist;
+str_append_till(register STR *str, register char *from, register int delim, char *keeplist)
{
register char *to;
register int len;
}
STR *
-str_new(len)
-int len;
+str_new(int len)
{
register STR *str;
}
void
-str_grow(str,len)
-register STR *str;
-int len;
+str_grow(register STR *str, int len)
{
if (len && str)
GROWSTR(&(str->str_ptr), &(str->str_len), len + 1);
/* make str point to what nstr did */
void
-str_replace(str,nstr)
-register STR *str;
-register STR *nstr;
+str_replace(register STR *str, register STR *nstr)
{
- Safefree(str->str_ptr);
+ safefree(str->str_ptr);
str->str_ptr = nstr->str_ptr;
str->str_len = nstr->str_len;
str->str_cur = nstr->str_cur;
}
void
-str_free(str)
-register STR *str;
+str_free(register STR *str)
{
if (!str)
return;
}
int
-str_len(str)
-register STR *str;
+str_len(register STR *str)
{
if (!str)
return 0;
}
char *
-str_gets(str,fp)
-register STR *str;
-register FILE *fp;
+str_gets(register STR *str, register FILE *fp)
{
#if defined(USE_STDIO_PTR) && defined(STDIO_PTR_LVALUE) && defined(STDIO_CNT_LVALUE)
/* Here is some breathtakingly efficient cheating */
}
void
-str_inc(str)
-register STR *str;
+str_inc(register STR *str)
{
register char *d;
}
void
-str_dec(str)
-register STR *str;
+str_dec(register STR *str)
{
register char *d;
/* make a string that will exist for the duration of the expression eval */
STR *
-str_mortal(oldstr)
-STR *oldstr;
+str_mortal(STR *oldstr)
{
register STR *str = str_new(0);
static long tmps_size = -1;
}
STR *
-str_make(s)
-char *s;
+str_make(char *s)
{
register STR *str = str_new(0);
}
STR *
-str_nmake(n)
-double n;
+str_nmake(double n)
{
register STR *str = str_new(0);