[BACK]Return to misc.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / m4

Diff for /src/usr.bin/m4/misc.c between version 1.11 and 1.12

version 1.11, 1999/09/14 08:21:37 version 1.12, 1999/09/14 08:35:17
Line 80 
Line 80 
  */   */
 ptrdiff_t  ptrdiff_t
 indx(s1, s2)  indx(s1, s2)
 const char *s1;          const char *s1;
 const char *s2;          const char *s2;
 {  {
         char *r;          char *t;
   
         r = strstr(s1, s2);          t = strstr(s1, s2);
         if (r)          if (t == NULL)
                 return (r - s1);  
         else  
                 return (-1);                  return (-1);
           else
                   return (t - s1);
 }  }
 /*  /*
  *  putback - push character back onto input   *  putback - push character back onto input
  */   */
 void  void
 putback(c)  putback(c)
 pbent c;          pbent c;
 {  {
         if (bp >= endpbb)          if (bp >= endpbb)
                 enlarge_bufspace();                  enlarge_bufspace();
Line 110 
Line 110 
  */   */
 void  void
 pbstr(s)  pbstr(s)
 register char *s;          char *s;
 {  {
         size_t n;          size_t n;
   
         n = strlen(s);          n = strlen(s);
         while (endpbb - bp < n)          while (endpbb - bp <= n)
                 enlarge_bufspace();                  enlarge_bufspace();
         while (n > 0)          while (n > 0)
                 *bp++ = s[--n];                  *bp++ = s[--n];
Line 126 
Line 126 
  */   */
 void  void
 pbnum(n)  pbnum(n)
 int n;          int n;
 {  {
         register int num;          int num;
   
         num = (n < 0) ? -n : n;          num = (n < 0) ? -n : n;
         do {          do {
Line 205 
Line 205 
  */   */
 void  void
 chrsave(c)  chrsave(c)
 char c;          char c;
 {  {
         if (ep >= endest)          if (ep >= endest)
                 enlarge_strspace();                  enlarge_strspace();
Line 233 
Line 233 
  */   */
 void  void
 getdiv(n)  getdiv(n)
 int n;          int n;
 {  {
         register int c;          int c;
   
         if (active == outfile[n])          if (active == outfile[n])
                 errx(1, "undivert: diversion still active");                  errx(1, "undivert: diversion still active");
Line 258 
Line 258 
 void  void
 killdiv()  killdiv()
 {  {
         register int n;          int n;
   
         for (n = 0; n < MAXOUT; n++)          for (n = 0; n < MAXOUT; n++)
                 if (outfile[n] != NULL) {                  if (outfile[n] != NULL) {
Line 268 
Line 268 
   
 char *  char *
 xalloc(n)  xalloc(n)
 unsigned long n;          unsigned long n;
 {  {
         register char *p = malloc(n);          char *p = malloc(n);
   
         if (p == NULL)          if (p == NULL)
                 err(1, "malloc");                  err(1, "malloc");
Line 279 
Line 279 
   
 char *  char *
 xstrdup(s)  xstrdup(s)
 const char *s;          const char *s;
 {  {
         register char *p = strdup(s);          char *p = strdup(s);
         if (p == NULL)          if (p == NULL)
                 err(1, "strdup");                  err(1, "strdup");
         return p;          return p;

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12