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
0919bbe2
Commit
0919bbe2
authored
Jan 30, 2018
by
saeed
Browse files
sshval.c
parent
b8199a37
Changes
1
Hide whitespace changes
Inline
Side-by-side
sshval.c
View file @
0919bbe2
#include<stdio.h>
#include<stdlib.h>
#define LF 256
long
int
numLines
(
FILE
*
FS
){
long
int
nl
=
0L
;
...
...
@@ -42,8 +44,7 @@ int Strcmp(char *sa, char *sb){
}
int
main
(
int
argc
,
char
*
argv
[]){
if
(
argc
!=
3
){
printf
(
"Usage %s filename (stationame)
\n
"
,
argv
[
0
]);
return
1
;
...
...
@@ -55,13 +56,13 @@ int main(int argc, char *argv[]){
FILE
*
FS
=
NULL
;
FS
=
fopen
(
filename
,
"r"
);
if
(
FS
==
NULL
){
printf
(
"error in opening the file
\n
"
);
printf
(
"error in opening the file
%s
\n
"
,
filename
);
return
1
;
}
long
int
nline
=
numLines
(
FS
);
char
cc
=
' '
;
char
field
[
128
]
=
""
;
char
field
[
LF
]
=
""
;
int
ne
=
0
;
int
nfl
=
0
;
int
nl
=
0
;
...
...
@@ -104,12 +105,12 @@ int main(int argc, char *argv[]){
cfl
[
nfl
]
=
malloc
(
sizeof
(
char
)
*
ne
);
for
(
int
ii
=
0
;
ii
<
ne
;
++
ii
)
cfl
[
nfl
][
ii
]
=
field
[
ii
];
nfl
+=
1
;
for
(
int
ii
=
0
;
ii
<
127
;
++
ii
)
field
[
ii
]
=
' '
;
for
(
int
ii
=
0
;
ii
<
(
LF
-
1
)
;
++
ii
)
field
[
ii
]
=
' '
;
ne
=
0
;
}
}
for
(
int
ii
=
0
;
ii
<
127
;
++
ii
)
field
[
ii
]
=
' '
;
for
(
int
ii
=
0
;
ii
<
(
LF
-
1
)
;
++
ii
)
field
[
ii
]
=
' '
;
//now we read date time;
ne
=
0
;
...
...
@@ -152,7 +153,7 @@ int main(int argc, char *argv[]){
}
if
(
icontent
==
NULL
&&
ic
==
0
)
printf
(
"something wrong happend. perhaps the station %s is not in the csv file %s
\n
"
,
station
,
filename
);
if
(
fcontent
==
NULL
&&
ic
>
0
)
printf
(
"something wrong happend. perhaps the station %s is not in the csv file %s
\n
"
,
station
,
filename
);
if
(
fcontent
==
NULL
&&
ic
>
0
)
printf
(
"something wrong happend. perhaps the station %s is not in the csv file %s
\n
"
,
station
,
filename
);
fclose
(
FS
);
...
...
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