From e21969bf3e0a1e5d88e1200a36903da52e85107d Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 12 Jun 2019 16:35:27 +0200 Subject: Slightly more consistent naming --- src/main.c | 14 +++++++------- src/rpc.c | 6 +++--- src/rpc.h | 6 +++--- src/warn.c | 6 +++--- src/warn.h | 4 ++-- 5 files changed, 18 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/main.c b/src/main.c index a823e03..9ca1da9 100644 --- a/src/main.c +++ b/src/main.c @@ -90,7 +90,7 @@ int main( int argc, char **argv ) if ( config.dpmsTimeout > 0 && config.dpmsTimeout < defaultSleep ) { defaultSleep = config.dpmsTimeout; } - int listenFd = rpcOpen(); + int listenFd = rpc_open(); if ( listenFd == -1 ) return 1; lastActivity = now(); @@ -190,11 +190,11 @@ int main( int argc, char **argv ) if ( remaining <= 2 ) { killSession( usr ); } else if ( remaining <= 65 ) { - warnUser( usr, WARN_LOGOUT, remaining ); + warn_showDefaultWarning( usr, WARN_LOGOUT, remaining ); CAP_SLEEP( remaining ); } else if ( remaining < 310 ) { if ( remaining % 30 < 10 ) { - warnUser( usr, WARN_LOGOUT_LOW, remaining ); + warn_showDefaultWarning( usr, WARN_LOGOUT_LOW, remaining ); } CAP_SLEEP( remaining - ( ( remaining - 30 ) / 60 * 60 + 2 ) ); } else { @@ -274,7 +274,7 @@ int main( int argc, char **argv ) w = WARN_POWEROFF; } for ( idx = 0; idx < count; ++idx ) { - warnUser( &users[idx], w, remaining ); + warn_showDefaultWarning( &users[idx], w, remaining ); } } CAP_SLEEP( remaining - ( ( remaining - 30 ) / 60 * 60 + 2 ) ); @@ -286,7 +286,7 @@ int main( int argc, char **argv ) do { const time_t oldDeadline = nextAction.deadline; // Handle requests - rpcHandle( listenFd ); + rpc_handle( listenFd ); // Might have set a new scheduled action if ( nextAction.deadline != oldDeadline ) { int delta = nextAction.deadline - monoNOW; @@ -294,7 +294,7 @@ int main( int argc, char **argv ) } // Sleep until next run //printf( "Sleeping %d seconds\n ", sleepTime ); - rpcWait( listenFd, sleepTime > 5 ? sleepTime : 5 ); + rpc_wait( listenFd, sleepTime > 5 ? sleepTime : 5 ); // Detect time changes endWall = time( NULL ); endMono = now(); @@ -561,7 +561,7 @@ void main_queueAction( enum Shutdown action, int delta ) void main_warnAll( const char *message ) { for ( int idx = 0; idx < userCount; ++idx ) { - showWarning( &users[idx], "Warning", message ); + warn_showCustomWarning( &users[idx], "Warning", message ); } } diff --git a/src/rpc.c b/src/rpc.c index 823bcca..40c2b0d 100644 --- a/src/rpc.c +++ b/src/rpc.c @@ -32,7 +32,7 @@ _Static_assert( sizeof(rpcPipe) == ( sizeof(int) * 2 ), "Structsize mismatch" ); static void handleClient( int fd, struct ucred *user ); -int rpcOpen( void ) +int rpc_open( void ) { int fd = socket( AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0 ); if ( fd == -1 ) { @@ -67,7 +67,7 @@ int rpcOpen( void ) return fd; } -void rpcWait( int listenFd, int seconds ) +void rpc_wait( int listenFd, int seconds ) { struct pollfd pd[2] = { { .fd = listenFd, .events = POLLIN | POLLHUP | POLLRDHUP }, @@ -78,7 +78,7 @@ void rpcWait( int listenFd, int seconds ) } } -void rpcHandle( int listenFd ) +void rpc_handle( int listenFd ) { int fd; while ( ( fd = accept( listenFd, NULL, NULL ) ) != -1 ) { diff --git a/src/rpc.h b/src/rpc.h index 42851ac..9511cd0 100644 --- a/src/rpc.h +++ b/src/rpc.h @@ -3,11 +3,11 @@ #include -int rpcOpen( void ); +int rpc_open( void ); -void rpcHandle( int listenFd ); +void rpc_handle( int listenFd ); -void rpcWait( int listenFd, int seconds ); +void rpc_wait( int listenFd, int seconds ); bool rpc_send( const char *data ); diff --git a/src/warn.c b/src/warn.c index 7b1ec8e..c02829e 100644 --- a/src/warn.c +++ b/src/warn.c @@ -40,7 +40,7 @@ static struct action actions[WARN_ENUM_END] = { }, }; -void warnUser( struct user *usr, enum Warning what, int seconds ) +void warn_showDefaultWarning( struct user *usr, enum Warning what, int seconds ) { const time_t NOW = now(); if ( what < 0 || what >= WARN_ENUM_END ) @@ -57,10 +57,10 @@ void warnUser( struct user *usr, enum Warning what, int seconds ) seconds %= 60; char buffer[1000]; snprintf( buffer, sizeof(buffer), warning->message, minutes, seconds, minutes, seconds ); - showWarning( usr, warning->title, buffer ); + warn_showCustomWarning( usr, warning->title, buffer ); } -void showWarning( const struct user *usr, const char *title, const char *body ) +void warn_showCustomWarning( const struct user *usr, const char *title, const char *body ) { // Text or X11 warning if ( *usr->display ) { diff --git a/src/warn.h b/src/warn.h index 43af832..094fe5f 100644 --- a/src/warn.h +++ b/src/warn.h @@ -12,9 +12,9 @@ enum Warning WARN_ENUM_END, }; -void warnUser( struct user *usr, enum Warning what, int seconds ); +void warn_showDefaultWarning( struct user *usr, enum Warning what, int seconds ); -void showWarning( const struct user *usr, const char *title, const char *body ); +void warn_showCustomWarning( const struct user *usr, const char *title, const char *body ); #endif -- cgit v1.2.3-55-g7522