taskrambler  0.1.9
Web server and task management solution.
get_version.c File Reference
#include <string.h>
#include <stdlib.h>
#include "http/message.h"
+ Include dependency graph for get_version.c:

Go to the source code of this file.

Functions

int httpMessageGetVersion (HttpMessage this, int *major, int *minor)
 

Detailed Description

Author
Georg Hopp

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file get_version.c.

Function Documentation

int httpMessageGetVersion ( HttpMessage  this,
int *  major,
int *  minor 
)

Definition at line 29 of file get_version.c.

Referenced by httpMessageHasValidVersion().

30 {
31  char * major_ptr = this->version + 5;
32  char * minor_ptr = strchr(major_ptr, '.') + 1;
33  char version[] = "\0\0\0";
34 
35  if (NULL == minor_ptr ||
36  ((minor_ptr - major_ptr - 1) > 2) ||
37  strlen(minor_ptr) > 2)
38  return -1;
39 
40  memcpy(version, major_ptr, minor_ptr - major_ptr - 1);
41  *major = atoi(version);
42 
43  memset(version, 0, 3);
44  strcpy(version, minor_ptr);
45  *minor = atoi(version);
46 
47  return ((*major)<<7)|(*minor);
48 }

+ Here is the caller graph for this function: