Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
saeed
SSHC
Commits
1b8f4045
Commit
1b8f4045
authored
Mar 29, 2018
by
saeed
Browse files
modification on getobs
parent
f24c960c
Changes
2
Hide whitespace changes
Inline
Side-by-side
compile.sh
View file @
1b8f4045
...
...
@@ -10,7 +10,7 @@ if [ $issh -eq 1 ];then
fi
if
[
$iobs
-eq
1
]
;
then
gcc
-o
getobs
-O2
-march
=
native
-std
=
c99
-Wall
-D_GNU_SOURCE
getobs.c
gcc
-o
getobs
-O2
-march
=
native
-std
=
c99
-Wall
-D_GNU_SOURCE
-Dsort
=
1
getobs.c
fi
if
[
$isvg
-eq
1
]
;
then
...
...
getobs.c
View file @
1b8f4045
...
...
@@ -17,7 +17,7 @@ int main(int argc,char *argv[])
int
portno
=
80
;
char
*
host
=
"oceandata.smhi.se"
;
//char message[] = "GET /ssh/viken/OBSERVATION?from=2017100100&too=2018032000 HTTP/1.1\r\nHost: oceandata.smhi.se\r\nConnection:close\r\n\r\n";
char
message
[]
=
"GET /ssh/goteborg/OBSERVATION?from=20170
1
0100&too=201803
28
00 HTTP/1.0
\r\n
Host: oceandata.smhi.se
\r\n\r\n
"
;
char
message
[]
=
"GET /ssh/goteborg/OBSERVATION?from=20170
3
0100&too=201803
01
00 HTTP/1.0
\r\n
Host: oceandata.smhi.se
\r\n\r\n
"
;
int
M
=
sizeof
(
message
);
//printf("%s\n",message);
//printf("%d\n",M);
...
...
@@ -146,35 +146,40 @@ int main(int argc,char *argv[])
int
icom
=
0
,
iicom
=
0
;
char
**
cout
=
split
(
st
,
','
,
&
icom
);
char
**
ccout
=
NULL
;
int
*
atime
=
(
int
*
)
malloc
(
sizeof
(
int
)
*
icom
);
float
*
adata
=
(
float
*
)
malloc
(
sizeof
(
float
)
*
icom
);
if
(
icom
>
1
){
char
**
ccout
=
NULL
;
int
*
atime
=
(
int
*
)
malloc
(
sizeof
(
int
)
*
icom
);
float
*
adata
=
(
float
*
)
malloc
(
sizeof
(
float
)
*
icom
);
for
(
int
i
=
0
;
i
<
(
icom
);
++
i
){
ccout
=
split
(
cout
[
i
],
':'
,
&
iicom
);
rtrim
(
ccout
[
2
],
'}'
);
ltrim
(
ccout
[
0
],
'\"'
);
rtrim
(
ccout
[
0
],
'\"'
);
for
(
int
i
=
0
;
i
<
(
icom
);
++
i
){
ccout
=
split
(
cout
[
i
],
':'
,
&
iicom
);
rtrim
(
ccout
[
2
],
'}'
);
ltrim
(
ccout
[
0
],
'\"'
);
rtrim
(
ccout
[
0
],
'\"'
);
//printf("%d\t%s\t%f\t%f\n",stoi(ccout[0]),ccout[2],atof(ccout[2]),stof(ccout[2]));
//printf("%d\t%f\n",stoi(ccout[0]) ,stof(ccout[2]));
atime
[
i
]
=
stoi
(
ccout
[
0
]);
adata
[
i
]
=
stof
(
ccout
[
2
]);
free
(
ccout
);
}
free
(
content
);
free
(
cout
);
//printf("%d\t%f\n",stoi(ccout[0]) ,stof(ccout[2]));
atime
[
i
]
=
stoi
(
ccout
[
0
]);
adata
[
i
]
=
stof
(
ccout
[
2
]);
free
(
ccout
);
}
#if sort
sortfull
(
atime
,
adata
,
icom
);
#endif
for
(
int
i
=
0
;
i
<
(
icom
);
++
i
){
printf
(
"%d
\t
%f
\n
"
,
atime
[
i
]
,
adata
[
i
]);
}
free
(
atime
);
free
(
adata
);
}
//printf("%s",content);
free
(
content
);
free
(
cout
);
/* process response */
//printf("Response:\n%s\n",response);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment