/[rdesktop]/sourceforge.net/trunk/rdesktop/rdesktop.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/rdesktop/rdesktop.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 582 by n-ki, Fri Jan 23 14:37:51 2004 UTC revision 608 by astrand, Sun Feb 15 21:19:28 2004 UTC
# Line 732  hexdump(unsigned char *p, unsigned int l Line 732  hexdump(unsigned char *p, unsigned int l
732  }  }
733    
734  /*  /*
735    input: src is the string we look in for needle    input: src is the string we look in for needle.
736             Needle may be escaped by a backslash, in
737             that case we ignore that particular needle.
738    return value: returns next src pointer, for    return value: returns next src pointer, for
739          succesive executions, like in a while loop          succesive executions, like in a while loop
740          if retval is 0, then there are no more args.          if retval is 0, then there are no more args.
# Line 814  toupper_str(char *p) Line 816  toupper_str(char *p)
816  #define LTOA_BUFSIZE (sizeof(long) * 8 + 1)  #define LTOA_BUFSIZE (sizeof(long) * 8 + 1)
817    
818  char *  char *
819  ltoa(long N, int base)  l_to_a(long N, int base)
820  {  {
821          static char ret[LTOA_BUFSIZE];          static char ret[LTOA_BUFSIZE];
822    
823          register int i = 2;          char *head = ret, buf[LTOA_BUFSIZE], *tail = buf + sizeof(buf);
         long uarg;  
         char *tail, *head = ret, buf[LTOA_BUFSIZE];  
824    
825          if (36 < base || 2 > base)          register int divrem;
                 base = 10;  
826    
827          tail = &buf[LTOA_BUFSIZE - 1];          if (base < 36 || 2 > base)
828          *tail-- = '\0';                  base = 10;
829    
830          if (10 == base && N < 0L)          if (N < 0)
831          {          {
832                  *head++ = '-';                  *head++ = '-';
833                  uarg = -N;                  N = -N;
834          }          }
         else  
                 uarg = N;  
835    
836          if (uarg)          tail = buf + sizeof(buf);
837          {          *--tail = 0;
                 for (i = 1; uarg; ++i)  
                 {  
                         register ldiv_t r;  
838    
839                          r = ldiv(uarg, base);          do
840                          *tail-- = (char) (r.rem + ((9L < r.rem) ? ('A' - 10L) : '0'));          {
841                          uarg = r.quot;                  divrem = N % base;
842                  }                  *--tail = (divrem <= 9) ? divrem + '0' : divrem + 'a' - 10;
843                    N /= base;
844          }          }
845          else          while (N);
                 *tail-- = '0';  
846    
847          memcpy(head, ++tail, i);          strcpy(head, tail);
848          return ret;          return ret;
849  }  }
850    

Legend:
Removed from v.582  
changed lines
  Added in v.608

  ViewVC Help
Powered by ViewVC 1.1.26