File: strutil.c

package info (click to toggle)
amiwm 0.21pl2-1
  • links: PTS
  • area: non-free
  • in suites: buster
  • size: 1,004 kB
  • sloc: ansic: 9,800; perl: 443; makefile: 253; yacc: 241; lex: 215; sh: 211
file content (36 lines) | stat: -rw-r--r-- 541 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "libami.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h>
#include <ctype.h>

#ifndef AMIGAOS

UBYTE ToUpper(UBYTE ch)
{
  static int firstcall=1;
  if(firstcall) {
    setlocale(LC_CTYPE, "");
    firstcall=0;
  }
  return toupper(ch);
}

LONG StrToLong(STRPTR str, LONG *n)
{
  STRPTR end;

  *n=strtol((char *)str, (char **)&end, 0);
  return end-str;
}

LONG Stricmp(STRPTR a, STRPTR b)
{
  while(*a && *b)
    if(ToUpper(*a++)!=ToUpper(*b++))
      return FALSE;
  return !(*a || *b);
}

#endif