Skip to content
This repository was archived by the owner on Oct 23, 2021. It is now read-only.

Commit 805262e

Browse files
committed
v0.21
1 parent ed94ded commit 805262e

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

Changes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
v0.21 2015-11-06
2+
* Fixed #3
3+
14
v0.20 2015-11-04
25
* Hide local device
36

src/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#ifndef __CONFIG_H__
2020
#define __CONFIG_H__
2121

22-
#define VERSION ("0.20")
22+
#define VERSION ("0.21")
2323

2424
/* Never modify this { */
2525
#define SUDODEV_GROUP ("sudodev")

src/sudodev.c

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ cmpDeviceName (const void * const a, const void * const b)
5656
/* ========================================================================== *
5757
* Show usage
5858
* ========================================================================== */
59-
void
60-
usage (const char * const string)
59+
int
60+
usage (void)
6161
{
6262
int line;
6363
const char * const text[] =
@@ -73,15 +73,12 @@ usage (const char * const string)
7373
NULL /* Last element should be NULL */
7474
};
7575

76-
if (string)
77-
{
78-
say (mode, MSG_I, string);
79-
}
80-
8176
for (line = 0; text[line]; ++line)
8277
{
8378
say (mode, MSG_I, text[line]);
8479
}
80+
81+
return 1;
8582
}
8683

8784
/* ========================================================================== *
@@ -445,7 +442,7 @@ del (void)
445442

446443
for (index = 0; devices[index]; ++index)
447444
{
448-
say (mode, MSG_I, "[%3d] %s\n", index + 1, devices[index]->name);
445+
say (mode, MSG_I, "[%3d] %s", index + 1, devices[index]->name);
449446

450447
if (!(strncmp (UNKNOWNSTR, devices[index]->name, UNKNOWNSTRLEN)))
451448
{
@@ -591,7 +588,7 @@ main (const int argc, const char * const * const argv)
591588

592589
if (argc != 2)
593590
{
594-
usage (NULL);
591+
usage ();
595592
exit (1);
596593
}
597594

@@ -611,7 +608,7 @@ main (const int argc, const char * const * const argv)
611608
}
612609
if (status)
613610
{
614-
exit (0);
611+
goto CLEAN;
615612
}
616613

617614
if (-1 == (status = attempt ("^del(ete)?$", action, del)))
@@ -621,13 +618,18 @@ main (const int argc, const char * const * const argv)
621618
}
622619
if (status)
623620
{
624-
exit (0);
621+
goto CLEAN;
625622
}
626623

627-
usage (NULL);
624+
if (-1 == (status = attempt ("^h(elp)?$", action, usage)))
625+
{
626+
say (mode, MSG_E, "attempt failed\n");
627+
exit (1);
628+
}
628629

630+
CLEAN:
629631
free (action);
630632

631-
return 0;
633+
return status;
632634
}
633635

0 commit comments

Comments
 (0)