browser: added function browser_get_selected()
browser_get_selected() checks if there is a file list and a valid
selection, and returns the selected entry.
browser_get_selected() checks if there is a file list and a valid
selection, and returns the selected entry.
screen_search: free second file list
Fix a memory leak: the concatened list was never freed.
Fix a memory leak: the concatened list was never freed.
filelist: provide more functions for working with a filelist
Avoid direct accesses to the filelist struct, provide an API for that.
Avoid direct accesses to the filelist struct, provide an API for that.
filelist: drop "mpdclient" prefix
The separate filelist library does not depend on mpdclient, so the
prefix is superfluous.
The separate filelist library does not depend on mpdclient, so the
prefix is superfluous.
browser: use mpdclient_filelist_find_song() in set_highlight()
A song should not be twice in the browser. Simplify set_highlight()
by finding the entry with mpdclient_filelist_find_song().
A song should not be twice in the browser. Simplify set_highlight()
by finding the entry with mpdclient_filelist_find_song().
browser: song must not be NULL in set_highlight()
The caller must not pass NULL to set_highlight(). Replaced check with
assertion.
The caller must not pass NULL to set_highlight(). Replaced check with
assertion.
filelist: song must not be NULL
A caller must not pass NULL to mpdclient_filelist_find_song().
Replace the check with an assertion.
A caller must not pass NULL to mpdclient_filelist_find_song().
Replace the check with an assertion.
mpdclient: moved code to filelist.c
Move everything which is solely filelist related to filelist.c and
filelist.h. Fix the indentation of that file, and provide the struct
name "filelist". Don't clear data in mpdclient_filelist_free() before
calling g_free(). Constify the "song" parameter to
mpdclient_filelist_find_song().
Move everything which is solely filelist related to filelist.c and
filelist.h. Fix the indentation of that file, and provide the struct
name "filelist". Don't clear data in mpdclient_filelist_free() before
calling g_free(). Constify the "song" parameter to
mpdclient_filelist_find_song().
code style, indent with tabs VII
Follow the same code style als MPD itself.
Follow the same code style als MPD itself.
fix terminal resizing (SIGWINCH)
When I replaced ncmpc's old main loop with g_main_loop from libglib,
SIGWINCH (i.e. window resizing) stopped working. This regression was
caused by the fact that ncurses' wgetch() function was only called
when there was actually data on STDIN. wgetch() has several side
effects besides reading data from STDIN, for example it checks whether
there has been a window resize.
Fix this with a custom SIGWINCH handler.
When I replaced ncmpc's old main loop with g_main_loop from libglib,
SIGWINCH (i.e. window resizing) stopped working. This regression was
caused by the fact that ncurses' wgetch() function was only called
when there was actually data on STDIN. wgetch() has several side
effects besides reading data from STDIN, for example it checks whether
there has been a window resize.
Fix this with a custom SIGWINCH handler.
removed the clock screen
Why should an audio player display a large clock?
Why should an audio player display a large clock?
screen_browser: removed entity.song!=NULL check
It is guaranteed that the "song" attribute is not NULL, remove the
check.
It is guaranteed that the "song" attribute is not NULL, remove the
check.
screen_browser: removed redundant highlight check
browser_select_entry() checked the entry's "highlight" flag twice: the
first time, it was toggled, and the second time, action was performed
based on the flag. Merge the two checks.
browser_select_entry() checked the entry's "highlight" flag twice: the
first time, it was toggled, and the second time, action was performed
based on the flag. Merge the two checks.
screen_browser: removed redundant entity type checks
The function browser_select_entry() returns early when the entity type
is not "SONG". No need to double check that.
The function browser_select_entry() returns early when the entity type
is not "SONG". No need to double check that.
screen_browser: moved code to browser_select_entry()
Moved code from browser_handle_select(). Call this new function also
from browser_handle_select_all(). This fixes a bug in select_all():
it actually did not select all, but stopped after the first song.
Moved code from browser_handle_select(). Call this new function also
from browser_handle_select_all(). This fixes a bug in select_all():
it actually did not select all, but stopped after the first song.
screen_browser: removed commented code
screen_browser: moved code to browser_playlist_changed()
Merge code from all 3 browser screens into one generic browser
function.
Merge code from all 3 browser screens into one generic browser
function.
screen_browser: moved code to screen_browser.c
Isolate the generic browser code from the directory browser.
Isolate the generic browser code from the directory browser.
screen_browser: added struct screen_browser
We are going to separate the browser functions from screen_file.c.
Move all variables which are going to be needed by this code.
We are going to separate the browser functions from screen_file.c.
Move all variables which are going to be needed by this code.
renamed screen_browse.h to screen_browser.h
code style, indent with tabs VI
Follow the same code style als MPD itself.
Follow the same code style als MPD itself.
added support for wide characters
This patch was taken from bug 476, author unknown
(http://www.musicpd.org/mantis/view.php?id=476). It changes the
definition of my_strlen(): instead of returning the number of UTF-8
characters, it counts the number of terminal cells occupied by a
string.
This patch was taken from bug 476, author unknown
(http://www.musicpd.org/mantis/view.php?id=476). It changes the
definition of my_strlen(): instead of returning the number of UTF-8
characters, it counts the number of terminal cells occupied by a
string.
code style, indent with tabs V
Follow the same code style als MPD itself.
Follow the same code style als MPD itself.
screen: don't handle CMD_PLAY
CMD_PLAY is mapped to the Enter key by default. Some screens
(mis-)use it for navigation, for entering a directory. The playlist
screen actually plays the file under the cursor. On all other
screens, pressing Enter may be confusing, since it is more of a
"confirmation" key instead of "play". We should probaby add
CMD_CONFIRM later, but for now, disable the general CMD_PLAY handler
in screen.c. This fixes bug 240.
CMD_PLAY is mapped to the Enter key by default. Some screens
(mis-)use it for navigation, for entering a directory. The playlist
screen actually plays the file under the cursor. On all other
screens, pressing Enter may be confusing, since it is more of a
"confirmation" key instead of "play". We should probaby add
CMD_CONFIRM later, but for now, disable the general CMD_PLAY handler
in screen.c. This fixes bug 240.
libmpdclient: added resolver library
The resolver library provides unified access to all resolvers
(getaddrinfo(), gethostbyname(), Unix domain sockets). Like
getaddrinfo(), it can return more than one address for a host name.
This fixes bug 1517 (http://www.musicpd.org/mantis/view.php?id=1517).
The resolver library provides unified access to all resolvers
(getaddrinfo(), gethostbyname(), Unix domain sockets). Like
getaddrinfo(), it can return more than one address for a host name.
This fixes bug 1517 (http://www.musicpd.org/mantis/view.php?id=1517).
quit with g_main_loop_quit()
Call g_main_loop_quit() on CMD_QUIT, instead of exit() with an
atexit() handler.
Call g_main_loop_quit() on CMD_QUIT, instead of exit() with an
atexit() handler.
playlist: reset id in playlist_clear()
The playlist is reset when the connection to the MPD server is
closed. After a successful reconnect, we have to reload the full
playlist. To remember this, also reset the id attribute.
The playlist is reset when the connection to the MPD server is
closed. After a successful reconnect, we have to reload the full
playlist. To remember this, also reset the id attribute.
playlist: removed "updated" flag
The caller may check the playlist.id instead of checking the old
"updated" flag.
The caller may check the playlist.id instead of checking the old
"updated" flag.
use the glib main event loop
This big patch replaces our custom main loop with the event based glib
main loop. This has several advantages: we can make all the tiny code
bits in the main loop independent from each others, we can add
additional file descriptors for polling (e.g. the mpdclient socket).
We don't need the ncurses timeout() anymore, because glib will poll
stdin for us.
This big patch replaces our custom main loop with the event based glib
main loop. This has several advantages: we can make all the tiny code
bits in the main loop independent from each others, we can add
additional file descriptors for polling (e.g. the mpdclient socket).
We don't need the ncurses timeout() anymore, because glib will poll
stdin for us.
screen: check MPD status only if connected
Fix several segmentation faults: when the connection to the MPD server
is lost, there were NULL pointer dereferences because
client->status==NULL. Check before accessing it.
Fix several segmentation faults: when the connection to the MPD server
is lost, there were NULL pointer dereferences because
client->status==NULL. Check before accessing it.
screen: moved code to screen_client_cmd()
Move all command handlers which need a connection to the MPD server to
screen_client_cmd(). This will allow us to unify error handling
later.
Move all command handlers which need a connection to the MPD server to
screen_client_cmd(). This will allow us to unify error handling
later.
main: connect while UI is displayed
Display the UI always, and show connection errors there. This fixes a
lot of consistency problems: error messages used to be printed to
stderr, but afterwards, the atexit() handlers deinitialized ncurses
and the screen was cleared. This patch is still problematic, but
constitutes a good step forward.
Display the UI always, and show connection errors there. This fixes a
lot of consistency problems: error messages used to be printed to
stderr, but afterwards, the atexit() handlers deinitialized ncurses
and the screen was cleared. This patch is still problematic, but
constitutes a good step forward.
libmpdclient: moved code to mpd_recv(), mpd_wait()
Create generic utility functions for doint I/O: two wait functions,
and mpd_recv() fills the input buffer. These functions are used in
mpd_newConnection() and mpd_getNextReturnElement().
Create generic utility functions for doint I/O: two wait functions,
and mpd_recv() fills the input buffer. These functions are used in
mpd_newConnection() and mpd_getNextReturnElement().
libmpdclient: smaller input buffer
Even for large responses, 16kB should be enough. There is no
performance gain for larger buffers, even if MPD is local.
Even for large responses, 16kB should be enough. There is no
performance gain for larger buffers, even if MPD is local.
libmpdclient: smaller error buffer
512 characters should be well enough for error messages which are
actually being displayed somewhere. Use sizeof(errorStr) instead of
MPD_BUFFER_MAX_LENGTH everywhere. Do proper length checking when
copying the output buffer to errorStr.
512 characters should be well enough for error messages which are
actually being displayed somewhere. Use sizeof(errorStr) instead of
MPD_BUFFER_MAX_LENGTH everywhere. Do proper length checking when
copying the output buffer to errorStr.
libmpdclient: use memmove() instead of strcpy() for moving the buffer
In general, don't treat the input buffer as a null-terminated string:
don't append '\0', don't use strchr() and strtok(). To delete
consumed portions of the buffer, strcpy() is bad anyway, because it
does not allow overlapping buffers.
In general, don't treat the input buffer as a null-terminated string:
don't append '\0', don't use strchr() and strtok(). To delete
consumed portions of the buffer, strcpy() is bad anyway, because it
does not allow overlapping buffers.
libmpdclient: don't strdup() MPD's welcome message
Why bother duplicating the buffer, when we can simply parse the
response directly from the input buffer?
Why bother duplicating the buffer, when we can simply parse the
response directly from the input buffer?
libmpdclient: use size_t and ssize_t
When working with buffer lengths and recv() results, we should declare
size_t and ssize_t variables, otherwise the code may fail on 64 bit
machines.
When working with buffer lengths and recv() results, we should declare
size_t and ssize_t variables, otherwise the code may fail on 64 bit
machines.
screen: removed empty methods
Declaring empty methods is of no use. If a method is empty, we should
set it to NULL in the screen_functions struct.
Declaring empty methods is of no use. If a method is empty, we should
set it to NULL in the screen_functions struct.
screen: removed NULL check
Since the screen's initialization is guaranteed, we can remove the
NULL check in center_playing_item().
Since the screen's initialization is guaranteed, we can remove the
NULL check in center_playing_item().
screen_artist: fix compilation errors
Unfortunately when I fixed the GCC warnings and refactored lots of the
code, the "artist" screen was disabled. This patch applies all API
changes and fixes all warnings.
Unfortunately when I fixed the GCC warnings and refactored lots of the
code, the "artist" screen was disabled. This patch applies all API
changes and fixes all warnings.
code style, indent with tabs IV
Follow the same code style als MPD itself.
Follow the same code style als MPD itself.
browse: when deselecting, don't search twice
When deselecting a song in the file browser, the local variable "idx"
was initialized and overwritten. Remove the initialization.
When deselecting a song in the file browser, the local variable "idx"
was initialized and overwritten. Remove the initialization.
playlist: added playlist_remove_reuse()
playlist_remove_reuse() removes a song from the playlist, but does not
free it.
Use this function in mpdclient_cmd_delete() to fix a segmentation
fault: the song pointer was still used after it was freed, by passing
it to mpdclient_playlist_callback(). Free the song manually now.
Reorganize and simply some code in mpdclient_cmd_delete().
playlist_remove_reuse() removes a song from the playlist, but does not
free it.
Use this function in mpdclient_cmd_delete() to fix a segmentation
fault: the song pointer was still used after it was freed, by passing
it to mpdclient_playlist_callback(). Free the song manually now.
Reorganize and simply some code in mpdclient_cmd_delete().
make several functions return void
playlist: use playlist_get() instead of playlist_get_song()
list_window: don't reset *highlight to 0
Since the list_window code sets highlight to 0 before it calls the
list_callback, the callback itself doesn't have to reset the flag.
Since the list_window code sets highlight to 0 before it calls the
list_callback, the callback itself doesn't have to reset the flag.
lyrics: don't check current.lines==NULL
current.lines is always initialized, and cannot be NULL, no need to
check it.
current.lines is always initialized, and cannot be NULL, no need to
check it.
help: return early from list_callback()
help: converted help_text_rows to a macro
Why bother counting the elements of help_text[] (with sentinel) at
runtime, when the compiler can do it at compile time?
Why bother counting the elements of help_text[] (with sentinel) at
runtime, when the compiler can do it at compile time?
lyrics: removed lyrics_text_rows, use current.lines->len instead
lyrics_text_rows wasn't set anyway, I somehow removed the code in a
patch some time ago.
lyrics_text_rows wasn't set anyway, I somehow removed the code in a
patch some time ago.
list_window: added list_window_center()
Merge code which used to be duplicated in the screens "play", "help",
"lyrics".
Merge code which used to be duplicated in the screens "play", "help",
"lyrics".
list_window: added list_window_scroll_cmd()
It is similar to list_window_cmd(), but it scrolls the window instead
of moving the selection. It is used by the "lyrics" and the "help"
screen.
It is similar to list_window_cmd(), but it scrolls the window instead
of moving the selection. It is used by the "lyrics" and the "help"
screen.
list_window: set repaint at the end of list_window_cmd()
screen: return early in switch_screen_mode() on error
When the selected screen does not exist, return before calling
close().
When the selected screen does not exist, return before calling
close().
screen: added macro NUM_SCREENS
Since the number of screens is known at compile time, define a macro
which calculates this, instead of having a sentinel element.
Since the number of screens is known at compile time, define a macro
which calculates this, instead of having a sentinel element.
screen: close only current screen in screen_exit()
Screens which are not active have already been closed, or have never
been opened. Don't call close again on them.
Screens which are not active have already been closed, or have never
been opened. Don't call close again on them.
screen: don't store "screen" as a pointer
There can only be onle screen struct instance at a time. Declare it
as a static struct, instead of a pointer to the struct. This
simplifies all accesses, and avoids the dynamic allocation.
There can only be onle screen struct instance at a time. Declare it
as a static struct, instead of a pointer to the struct. This
simplifies all accesses, and avoids the dynamic allocation.
screen: moved code to find_configured_screen()
screen: mode_fn cannot be NULL, removed checks
At startup, mode_fn is initialized with &screen_playlist, and it will
never be reset to NULL. Remove all checks.
At startup, mode_fn is initialized with &screen_playlist, and it will
never be reset to NULL. Remove all checks.
screen: before calling update(), check if it is defined
That seems to be a fn->paint was checked, then the code called
fn->update(). Fix this.
That seems to be a fn->paint was checked, then the code called
fn->update(). Fix this.
screen: removed screen_functions.get_lw()
If it is really important to set the curser, we should think of a
better way, instead of exporting one non-generic method. For now,
just set the cursor to the origin.
If it is really important to set the curser, we should think of a
better way, instead of exporting one non-generic method. For now,
just set the cursor to the origin.
replaced get_screen_X() with static screen_functions variable
Compile time initialization saves resources, compared to run-time
initialization. Declare all screen_function structs as global
variables, and remove all get functions.
Compile time initialization saves resources, compared to run-time
initialization. Declare all screen_function structs as global
variables, and remove all get functions.
code style, indent with tabs III
Follow the same code style als MPD itself.
Follow the same code style als MPD itself.
mpdclient: call playlist_clear() in mpdclient_playlist_update()
Instead of freeing the playlist with mpdclient_playlist_free(), call
playlist_clear() to empty the song list. This fixes a segmentation
fault which occured when you cleared the playlist.
Instead of freeing the playlist with mpdclient_playlist_free(), call
playlist_clear() to empty the song list. This fixes a segmentation
fault which occured when you cleared the playlist.
initial draw without delay
Due to a missing refresh() call, ncmpc painted the screen after one
second. Add refresh(), make ncmpc display immediately.
Due to a missing refresh() call, ncmpc painted the screen after one
second. Add refresh(), make ncmpc display immediately.
screen: added struct names
Let us declare struct names in addition to typedef names, so we can
forward-declare them.
Let us declare struct names in addition to typedef names, so we can
forward-declare them.
use a C99 compiler
lyrics: converted in-process plugins to external programs
In-process plugins are very problematic. It is much easier and
flexible to move the lyrics plugins to external programs, with a
trivial protocol. This is work in progress, among the things missing:
- protocol specification, including exit codes
- plugin installation
- plugin search directory
- run-time configuration (currently hard coded)
- automatic polling (using glib's main loop?)
- better and more robust error handling
In-process plugins are very problematic. It is much easier and
flexible to move the lyrics plugins to external programs, with a
trivial protocol. This is work in progress, among the things missing:
- protocol specification, including exit codes
- plugin installation
- plugin search directory
- run-time configuration (currently hard coded)
- automatic polling (using glib's main loop?)
- better and more robust error handling
use GPtrArray instead of GArray for playlist songs
playlist: hide direct accesses in inline functions
Added functions like playlist_length(), playlist_get(),
playlist_replace(), playlist_remove(). Don't access the
mpdclient_playlist struct directly.
Added functions like playlist_length(), playlist_get(),
playlist_replace(), playlist_remove(). Don't access the
mpdclient_playlist struct directly.
mpdclient: added mpdclient_playlist_init(), mpdclient_playlist_clear()
Moved code from mpdclient_new() and mpdclient_playlist_free(). In
mpdclient_disconnect(), call mpdclient_playlist_clear() instead of
mpdclient_playlist_free() (which is now called in mpdclient_free()).
Moved code from mpdclient_new() and mpdclient_playlist_free(). In
mpdclient_disconnect(), call mpdclient_playlist_clear() instead of
mpdclient_playlist_free() (which is now called in mpdclient_free()).
mpdclient: moved code to playlist.c
Move everything which manipulates the mpdclient_playlist struct to
playlist.c. Many of the functions get a mpdclient pointer instead of
a playlist; this will be changed later.
The functions mpdclient_playlist_update() and
mpdclient_playlist_update_changes() stay in mpdclient.c for now, since
they are tightly connected to the client code.
Move everything which manipulates the mpdclient_playlist struct to
playlist.c. Many of the functions get a mpdclient pointer instead of
a playlist; this will be changed later.
The functions mpdclient_playlist_update() and
mpdclient_playlist_update_changes() stay in mpdclient.c for now, since
they are tightly connected to the client code.
song: allocate mpd_song from glib slices
Since we compile ncmpc with glib, we can use its slice allocator for
efficient song allocation. I have added a way to disable this with a
macro.
Since we compile ncmpc with glib, we can use its slice allocator for
efficient song allocation. I have added a way to disable this with a
macro.
song: use struct mpd_song
Use a forward declared struct mpd_song instead of the typedef
mpd_Song.
Use a forward declared struct mpd_song instead of the typedef
mpd_Song.
libmpdclient: moved code to song.c
Move everything which manipulates the mpd_Song struct to song.c.
Thousands of lines of too much for libmpdclient.c!
Move everything which manipulates the mpd_Song struct to song.c.
Thousands of lines of too much for libmpdclient.c!
mpdclient: add struct names, for forward declarations
To relax the include dependencies, give all structs real names, in
addition to the typedef names. This way, other headers can
forward-declare them, and do not need to include mpdclient.h. In the
future, the typedefs will be removed.
To relax the include dependencies, give all structs real names, in
addition to the typedef names. This way, other headers can
forward-declare them, and do not need to include mpdclient.h. In the
future, the typedefs will be removed.
libmpdclient: const pointers
Pass const pointers whenever possible.
Pass const pointers whenever possible.
code style, indent with tabs II
Follow the same code style als MPD itself.
Follow the same code style als MPD itself.
list_window: update variables without looping
Apparently, somebody was too lazy to derive the formulas for cursor
movement, and wrote lots of while loops.
Apparently, somebody was too lazy to derive the formulas for cursor
movement, and wrote lots of while loops.
include cleanup
Include only headers which are really used.
Include only headers which are really used.
don't use libncursesw if libncurses was selected
No idea what this code was intended for, but if the user chooses
libncurses, ncmpc shouldn't override this manual choice if it finds
libncursesw.
No idea what this code was intended for, but if the user chooses
libncurses, ncmpc shouldn't override this manual choice if it finds
libncursesw.
added myself to AUTHORS
set version to 0.12~git
We are on git now, and since we are doing major changes, increase the
version number.
We are on git now, and since we are doing major changes, increase the
version number.
easy_download: fixed the type of write_data()
Fix the type of write_data() to fit curl_write_callback.
Fix the type of write_data() to fit curl_write_callback.
use GArray for playlist instead of GList
Using a doubly linked list for the local playlist copy is a huge waste
of both memory and CPU cycles. Use GArray instead of GList, which is
much faster in this case.
Using a doubly linked list for the local playlist copy is a huge waste
of both memory and CPU cycles. Use GArray instead of GList, which is
much faster in this case.
free info entity while iterating
Memory leak: the function mpdclient_playlist_update_changes() did not
free the entity which was returned by mpd_getNextInfoEntity(). Add a
mpd_freeInfoEntity() call at the end of each iteration.
Memory leak: the function mpdclient_playlist_update_changes() did not
free the entity which was returned by mpd_getNextInfoEntity(). Add a
mpd_freeInfoEntity() call at the end of each iteration.
manage tag string allocations in a pool
There are many duplicated strings in the tag database, e.g. many songs
having the same artist. Don't allocate such strings twice, manage all
strings in a pool.
There are many duplicated strings in the tag database, e.g. many songs
having the same artist. Don't allocate such strings twice, manage all
strings in a pool.
added support for unix domain sockets
If a host name starts with a slash, it is assumed to be a unix domain
socket path. The port is ignored. This code is disabled on WIN32,
until someone tests it.
If a host name starts with a slash, it is assumed to be a unix domain
socket path. The port is ignored. This code is disabled on WIN32,
until someone tests it.
lyrics: missing "break"
If get_text_line() fails, we should break from the loop.
If get_text_line() fails, we should break from the loop.
lyrics: converted global variables to static
The variables "lyrics_text_rows" and "lw" were declared in
src_lyrics.h as static, but they were only actually used in
screen_lyrics.c. Move both there.
The variables "lyrics_text_rows" and "lw" were declared in
src_lyrics.h as static, but they were only actually used in
screen_lyrics.c. Move both there.
fix unused parameter warnings
Add the "unused" attribute to all function parameters which are indeed
going to be ignored.
Add the "unused" attribute to all function parameters which are indeed
going to be ignored.
imported gcc.h from mpd
gcc.h contains a useful set of macros for setting attributes.
gcc.h contains a useful set of macros for setting attributes.
don't declare local variable "options"
In main.c, the global variable "options" is used all over, except in
main(), which contains a shadowing declaration of it. Remove this
local variable, and use the global "options" instead. Also don't
pollute conf.c's namespace with the global variable with a CPP hack
(to be removed when we have fixed more of ncmpc's namespace
pollution).
In main.c, the global variable "options" is used all over, except in
main(), which contains a shadowing declaration of it. Remove this
local variable, and use the global "options" instead. Also don't
pollute conf.c's namespace with the global variable with a CPP hack
(to be removed when we have fixed more of ncmpc's namespace
pollution).
use size_t and unsigned integers
fixed mixed declaration + code
Although they are allowedd in C99, try to avoid them. Move variable
declarations to the top of the current scope.
Although they are allowedd in C99, try to avoid them. Move variable
declarations to the top of the current scope.
fix shadow warnings
Rename local variables and function parameters, so they don't shadow
global variables.
Rename local variables and function parameters, so they don't shadow
global variables.
include cleanup
A header should include all headers which he needs. Move local
includes on top, and let foo.c include foo.h in the first line, to
automatically test its dependencies.
A header should include all headers which he needs. Move local
includes on top, and let foo.c include foo.h in the first line, to
automatically test its dependencies.
screen_auth() returns result
screen_auth() returns an int, and its result is actually being used.
Only the "return" was missing in its implementation. Return
_screen_auth()'s result.
screen_auth() returns an int, and its result is actually being used.
Only the "return" was missing in its implementation. Return
_screen_auth()'s result.
fix function prototypes
Add missing prototypes, and fix wrong prototypes. Convert lots of
functions to "static" when they are only used within the current
source file.
Add missing prototypes, and fix wrong prototypes. Convert lots of
functions to "static" when they are only used within the current
source file.