home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / comm / tcp / amitcp / src / l / inet-handler / c.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-05  |  1.1 KB  |  66 lines

  1. /*
  2.  * c.c
  3.  *
  4.  * Author: Tomi Ollila <too@cs.hut.fi>
  5.  *
  6.  * Copyright (c) 1993 AmiTCP/IP Group, <amitcp-group@hut.fi>
  7.  *               All rights reserved
  8.  *
  9.  * Created: Wed Sep 15 14:12:12 1993 too
  10.  * Last modified: Sat Oct 16 16:53:29 1993 too
  11.  *
  12.  * $Id: c.c,v 1.1 1993/10/24 12:50:39 too Exp too $
  13.  *
  14.  * HISTORY
  15.  * $Log: c.c,v $
  16.  * Revision 1.1  1993/10/24  12:50:39  too
  17.  * Initial revision
  18.  *
  19.  */
  20.  
  21. #include "c.h"
  22.  
  23. void bzero(char * mem, int len)
  24. {
  25.   char *i;
  26.   
  27.   for(i = mem; len > 0; i++, len--)
  28.     *i = '\0';
  29. }
  30.  
  31. #if 0
  32. #define isupper(x) ((x) >= 'A' && (x) <= 'Z')
  33. #define tolower(x) ((x) & 0x5F) /* this is only used w/ isupper() */
  34.  
  35. int strncasecmp(char * a, char * b, int n)
  36. {
  37.   char la; char lb;
  38.  
  39.   la = *a; if (isupper(la)) la = tolower(la);
  40.   lb = *b; if (isupper(la)) la = tolower(la);
  41.   
  42.   while (--n > 0) { /* don't check last one */
  43.     if ((la == '\0') || (la != lb))
  44.       break;
  45.     a++;
  46.     b++;
  47.     la = *a; if (isupper(la)) la = tolower(la);
  48.     lb = *b; if (isupper(la)) la = tolower(la);
  49.   }
  50.   return (lb - la);
  51. }
  52.  
  53. #endif
  54.  
  55. int atoi(char * a)
  56. {
  57.   int i = 0;
  58.  
  59.   while (isdigit(*a)) {
  60.     i *= 10;
  61.     i += *a - '0';
  62.     a++;
  63.   }
  64.   return i;
  65. }
  66.