"Fossies" - the Fresh Open Source Software Archive

Member "xc/xstring.c" (10 Feb 1995, 1805 Bytes) of package /linux/privat/old/laspack.tgz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /****************************************************************************/
    2 /*                                xstring.c                                 */
    3 /****************************************************************************/
    4 /*                                                                          */
    5 /* eXtension of standard STRING.h                                           */
    6 /*                                                                          */
    7 /* Copyright (C) 1992-1994 Tomas Skalicky. All rights reserved.             */
    8 /*                                                                          */
    9 /****************************************************************************/
   10 
   11 #include <stddef.h>
   12 #include <string.h>
   13 #include <ctype.h>
   14 
   15 #include "xc/xtypes.h"
   16 
   17 char *str2lwr(char *String)
   18 /* transforms string characters into lower cases */
   19 {
   20     char *PtrChar;
   21 
   22     if (String != NULL) {
   23         PtrChar = String;
   24         while (*PtrChar != '\0') {
   25         *PtrChar = (char)tolower(*PtrChar);
   26             PtrChar++;
   27         }
   28     }
   29 
   30     if (String != NULL)
   31         return(String);
   32     else
   33         return(NULL);
   34 }
   35 
   36 char *str2upr(char *String)
   37 /* transforms string characters into upper cases */
   38 {
   39     char *PtrChar;
   40 
   41     if (String != NULL) {
   42         PtrChar = String;
   43         while (*PtrChar != '\0') {
   44         *PtrChar = (char)toupper(*PtrChar);
   45             PtrChar++;
   46         }
   47     }
   48 
   49     if (String != NULL)
   50         return(String);
   51     else
   52         return(NULL);
   53 }
   54 
   55 
   56 char *strcatchar(char *String, char Ch)
   57 /* concatenates a character on a string */
   58 {
   59     size_t Len;
   60 
   61     if (String != NULL) {
   62         Len = strlen(String);
   63         String[Len] = Ch;
   64         String[Len + 1] = '\0';
   65     }
   66 
   67     if (String != NULL)
   68         return(String);
   69     else
   70         return(NULL);
   71 }