minor beautification
This commit is contained in:
1 parent
463c6ce880
commit
e4e0d92857
1 file changed
+4
-4
@@ -158,21 +158,21 @@ void term()
|
|||||||
int main(int argc,char** argv)
|
int main(int argc,char** argv)
|
||||||
{
|
{
|
||||||
// check parameters
|
// check parameters
|
||||||
if (argc < 2)
|
if ( argc < 2 )
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Usage: upsd <device>\n");
|
fprintf(stderr, "Usage: upsd <device>\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// open serial port
|
// open serial port
|
||||||
if ((fd = open(argv[1], O_RDONLY | O_NDELAY)) < 0)
|
if ( (fd = open(argv[1], O_RDONLY | O_NDELAY)) < 0 )
|
||||||
{
|
{
|
||||||
fprintf(stderr, "upsd: %s: %s\n", argv[1], sys_errlist[errno]);
|
fprintf(stderr, "upsd: %s: %s\n", argv[1], sys_errlist[errno]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// become a daemon
|
// become a daemon
|
||||||
switch (fork())
|
switch ( fork() )
|
||||||
{
|
{
|
||||||
case 0: /* I am the child. */
|
case 0: /* I am the child. */
|
||||||
setsid();
|
setsid();
|
||||||
@@ -197,7 +197,7 @@ int main(int argc,char** argv)
|
|||||||
// init line
|
// init line
|
||||||
init();
|
init();
|
||||||
|
|
||||||
while(1)
|
while ( 1 )
|
||||||
{
|
{
|
||||||
static int count = 0;
|
static int count = 0;
|
||||||
static int killtime = 0;
|
static int killtime = 0;
|
||||||
|
|||||||
Reference in new issue
Block a user