gnokii-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] Additional programs and language bindings branch, master, updated.


From: Daniele Forsi
Subject: [SCM] Additional programs and language bindings branch, master, updated. bf971c8bfa3cd17f01e3fa7445d01b56bf7001e7
Date: Tue, 15 Dec 2009 11:26:28 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Additional programs and language bindings".

The branch, master has been updated
       via  bf971c8bfa3cd17f01e3fa7445d01b56bf7001e7 (commit)
      from  5ab51b6ffa3b4f2f6923fdf5d1b5f1c71168a216 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/gnokii/gnokii-extras.git/commit/?id=bf971c8bfa3cd17f01e3fa7445d01b56bf7001e7


commit bf971c8bfa3cd17f01e3fa7445d01b56bf7001e7
Author: Daniele Forsi <address@hidden>
Date:   Tue Dec 15 12:23:40 2009 +0100

    Add missing readme for press_key and improve error handling for command 
line arguments

diff --git a/snippets/ChangeLog b/snippets/ChangeLog
index 9a0d262..feeb922 100644
--- a/snippets/ChangeLog
+++ b/snippets/ChangeLog
@@ -1,3 +1,8 @@
+2009/12/15
+ * other/
+    o add missing press_key.readme, clarify usage string in press_key.c and
+      check for bad arguments                                (Daniele Forsi)
+
 2009/11/02
  * misc/memory_names
     o print descriptions of memory names, not the names again; add missing
diff --git a/snippets/other/press_key.c b/snippets/other/press_key.c
index b847f17..a2dc028 100644
--- a/snippets/other/press_key.c
+++ b/snippets/other/press_key.c
@@ -112,11 +112,20 @@ int main(int argc, char *argv[]) {
        char            key;
 
        if (argc != 3) {
-               fprintf(stderr, _("Usage: %s {seconds} {key}\nPurpose: simulate 
pressing a key for a number of seconds\n"), argv[0]);
+               fprintf(stderr, _("Usage: %s {seconds} {key}\nPurpose: simulate 
keeping a single key pressed for a number of seconds\n"), argv[0]);
                exit(-1);
        }
 
        seconds = atoi(argv[1]);
+       if (seconds < 1) {
+               fprintf(stderr, _("Argument for {seconds} must be an integer 
greater than 0\n"));
+               exit(-1);
+       }
+
+       if (strlen(argv[2]) != 1) {
+               fprintf(stderr, _("Argument for {key} must be a single 
character\n"));
+               exit(-1);
+       }
        key = argv[2][0];
 
        businit();
diff --git a/snippets/other/press_key.readme b/snippets/other/press_key.readme
new file mode 100644
index 0000000..c87cd81
--- /dev/null
+++ b/snippets/other/press_key.readme
@@ -0,0 +1,18 @@
+Emulates pressing a single key and keeping it pressed for the given number of
+seconds.
+
+Accepted keys (case insensitive) are:
+ 0123456789#* as the corresponding key
+ P as power key
+ G as green key
+ R as red key
+ +- as volume up/down keys
+ U as up arrow key
+ D as down arrow key
+ M as menu key
+ N as names key or C key depending on phone
+
+Usage:
+$ press_key 4 p
+This turns the phone off (it also turns on old Nokias like 3210 if they are
+connected to a charger)

-----------------------------------------------------------------------

Summary of changes:
 snippets/ChangeLog              |    5 +++++
 snippets/other/press_key.c      |   11 ++++++++++-
 snippets/other/press_key.readme |   18 ++++++++++++++++++
 3 files changed, 33 insertions(+), 1 deletions(-)
 create mode 100644 snippets/other/press_key.readme


hooks/post-receive
-- 
Additional programs and language bindings




reply via email to

[Prev in Thread] Current Thread [Next in Thread]