Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tg
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
tg
Commits
f773c0cf
Commit
f773c0cf
authored
Oct 03, 2013
by
vysheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tab replaced with spaces
parent
9c70da9e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
34 deletions
+34
-34
interface.c
interface.c
+5
-5
loop.c
loop.c
+15
-15
main.c
main.c
+14
-14
No files found.
interface.c
View file @
f773c0cf
...
@@ -115,11 +115,11 @@ char *command_generator (const char *text, int state) {
...
@@ -115,11 +115,11 @@ char *command_generator (const char *text, int state) {
index
=
-
1
;
index
=
-
1
;
rl_line_buffer
[
rl_point
]
=
'\0'
;
/* the effect should be such
rl_line_buffer
[
rl_point
]
=
'\0'
;
/* the effect should be such
* that the cursor position
* that the cursor position
* is at the end of line for
* is at the end of line for
* the auto completion regex
* the auto completion regex
* above (note the $ at end)
* above (note the $ at end)
*/
*/
mode
=
get_complete_mode
();
mode
=
get_complete_mode
();
}
else
{
}
else
{
...
...
loop.c
View file @
f773c0cf
...
@@ -26,25 +26,25 @@ int main_loop (void) {
...
@@ -26,25 +26,25 @@ int main_loop (void) {
FD_SET
(
0
,
&
inp
);
FD_SET
(
0
,
&
inp
);
tv
.
tv_sec
=
1
;
tv
.
tv_sec
=
1
;
tv
.
tv_usec
=
0
;
tv
.
tv_usec
=
0
;
int
lfd
=
0
;
int
lfd
=
0
;
if
(
select
(
lfd
+
1
,
&
inp
,
&
outp
,
NULL
,
&
tv
)
<
0
)
{
if
(
select
(
lfd
+
1
,
&
inp
,
&
outp
,
NULL
,
&
tv
)
<
0
)
{
if
(
errno
==
EINTR
)
{
if
(
errno
==
EINTR
)
{
/* resuming from interrupt, so not an error situation,
/* resuming from interrupt, so not an error situation,
this generally happens when you suspend your
this generally happens when you suspend your
messenger with "C-z" and then "fg". This is allowed "
messenger with "C-z" and then "fg". This is allowed "
*/
*/
rl_reset_line_state
();
rl_reset_line_state
();
rl_forced_update_display
();
rl_forced_update_display
();
continue
;
continue
;
}
}
perror
(
"select()"
);
perror
(
"select()"
);
break
;
break
;
}
}
if
(
FD_ISSET
(
0
,
&
inp
))
{
if
(
FD_ISSET
(
0
,
&
inp
))
{
rl_callback_read_char
();
rl_callback_read_char
();
}
}
}
}
return
0
;
return
0
;
...
@@ -57,9 +57,9 @@ int loop (void) {
...
@@ -57,9 +57,9 @@ int loop (void) {
if
(
!
user
&&
!
auth_token
)
{
if
(
!
user
&&
!
auth_token
)
{
printf
(
"Telephone number (with '+' sign): "
);
printf
(
"Telephone number (with '+' sign): "
);
if
(
getline
(
&
user
,
&
size
,
stdin
)
==
-
1
)
{
if
(
getline
(
&
user
,
&
size
,
stdin
)
==
-
1
)
{
perror
(
"getline()"
);
perror
(
"getline()"
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
user
[
strlen
(
user
)
-
1
]
=
'\0'
;
user
[
strlen
(
user
)
-
1
]
=
'\0'
;
set_default_username
(
user
);
set_default_username
(
user
);
}
}
...
...
main.c
View file @
f773c0cf
...
@@ -93,7 +93,7 @@ char *get_config_directory (void) {
...
@@ -93,7 +93,7 @@ char *get_config_directory (void) {
config_directory
=
(
char
*
)
calloc
(
length
,
sizeof
(
char
));
config_directory
=
(
char
*
)
calloc
(
length
,
sizeof
(
char
));
sprintf
(
config_directory
,
"%s/"
CONFIG_DIRECTORY
,
sprintf
(
config_directory
,
"%s/"
CONFIG_DIRECTORY
,
get_home_directory
());
get_home_directory
());
return
config_directory
;
return
config_directory
;
}
}
...
@@ -136,26 +136,26 @@ void running_for_first_time (void) {
...
@@ -136,26 +136,26 @@ void running_for_first_time (void) {
if
(
stat
(
config_filename
,
config_file_stat
)
!=
0
)
{
if
(
stat
(
config_filename
,
config_file_stat
)
!=
0
)
{
// config file missing, so touch it
// config file missing, so touch it
config_file_fd
=
open
(
config_filename
,
O_CREAT
|
O_RDWR
,
S_IRWXU
);
config_file_fd
=
open
(
config_filename
,
O_CREAT
|
O_RDWR
,
S_IRWXU
);
if
(
config_file_fd
==
-
1
)
{
if
(
config_file_fd
==
-
1
)
{
perror
(
"open[config_file]"
);
perror
(
"open[config_file]"
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
if
(
fchmod
(
config_file_fd
,
CONFIG_DIRECTORY_MODE
)
!=
0
)
{
if
(
fchmod
(
config_file_fd
,
CONFIG_DIRECTORY_MODE
)
!=
0
)
{
perror
(
"fchmod["
CONFIG_FILE
"]"
);
perror
(
"fchmod["
CONFIG_FILE
"]"
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
if
(
write
(
config_file_fd
,
DEFAULT_CONFIG_CONTENTS
,
strlen
(
DEFAULT_CONFIG_CONTENTS
))
<=
0
)
{
if
(
write
(
config_file_fd
,
DEFAULT_CONFIG_CONTENTS
,
strlen
(
DEFAULT_CONFIG_CONTENTS
))
<=
0
)
{
perror
(
"write[config_file]"
);
perror
(
"write[config_file]"
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
close
(
config_file_fd
);
close
(
config_file_fd
);
printf
(
"[%s] created
\n
"
,
config_filename
);
printf
(
"[%s] created
\n
"
,
config_filename
);
/* create downloads directory */
/* create downloads directory */
if
(
mkdir
(
downloads_directory
,
0755
)
!=
0
)
{
if
(
mkdir
(
downloads_directory
,
0755
)
!=
0
)
{
perror
(
"creating download directory"
);
perror
(
"creating download directory"
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
}
}
set_setup_mode
();
set_setup_mode
();
...
...
Write
Preview
Markdown
is supported
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