"Fossies" - the Fresh Open Source Software Archive

Member "linux_logo-6.0/libsysinfo-0.3.0/all/parsing.c" (8 May 2020, 711 Bytes) of package /linux/misc/linux_logo-6.0.tar.gz:


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 #include <string.h>
    2 
    3 char empty_string[]="";
    4 
    5     /* take line, give back part after colon */
    6 char *parse_line(char *string) {
    7 
    8     char *temp_ptr;
    9 
   10     temp_ptr=strstr(string,":");
   11     if (temp_ptr==NULL) {
   12         /* special handling... */
   13         /* atoi, aof, strcmp, etc can't handle NULL */
   14         /* Found via zzuf fuzz checking */
   15         return empty_string;
   16     }
   17 
   18     /* skip past the colon */
   19     temp_ptr++;
   20         /* skip any white-space */
   21     while (( temp_ptr[0] == ' ') || ( temp_ptr[0] == '\t')) {
   22         temp_ptr++;
   23     }
   24 
   25     return temp_ptr;
   26 }
   27 
   28 char *clip_lf(char *string,int size) {
   29 
   30     char *temp_ptr;
   31     int i=0;
   32 
   33     temp_ptr=string;
   34 
   35     while ((*temp_ptr!=0) && (*temp_ptr!='\n') && (i<(size-1))) {
   36         i++;
   37         temp_ptr++;
   38     }
   39     *temp_ptr=0;
   40 
   41     return string;
   42 }