[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: PHONET and bluetooth!
From: |
Pawel Kot |
Subject: |
Re: PHONET and bluetooth! |
Date: |
Wed, 15 Nov 2006 15:45:07 +0100 |
Hi,
On 11/15/06, Pawel Kot <address@hidden> wrote:
However we need to work on error codes.
What do you think about the following change (to be applied across
whole gnokii CLI):
Index: gnokii/gnokii-app.h
===================================================================
RCS file: /cvsroot/gnokii/gnokii/gnokii/gnokii-app.h,v
retrieving revision 1.42
diff -u -r1.42 gnokii-app.h
--- gnokii/gnokii-app.h 5 Nov 2006 22:05:53 -0000 1.42
+++ gnokii/gnokii-app.h 15 Nov 2006 14:40:59 -0000
@@ -213,5 +213,6 @@
extern int enterchar(gn_data *data, struct gn_statemachine *state);
extern void list_gsm_networks(void);
extern int getnetworkinfo(gn_data *data, struct gn_statemachine *state);
+extern int gnokii_atoi(char *string);
#endif /* __gnokii_app_h_ */
Index: gnokii/gnokii-sms.c
===================================================================
RCS file: /cvsroot/gnokii/gnokii/gnokii/gnokii-sms.c,v
retrieving revision 1.9
diff -u -r1.9 gnokii-sms.c
--- gnokii/gnokii-sms.c 6 Nov 2006 17:42:14 -0000 1.9
+++ gnokii/gnokii-sms.c 15 Nov 2006 14:41:01 -0000
@@ -590,6 +591,8 @@
" location
start and ending with end;\n"
" if end
option is omitted, just one entry\n"
" is read;\n"
+ " start
must be a number, end may be a number\n"
+ " or 'end' string;\n"
" if 'end'
is used entries are being read\n"
" until
empty location\n"
" -F file save sms
to the file overwriting it if\n"
@@ -627,7 +630,9 @@
return -1;
}
- start_message = atoi(argv[optind]);
+ start_message = gnokii_atoi(argv[optind]);
+ if (start_message == -1)
+ getsms_usage(stderr, -1);
end_message = parse_end_value_option(argc, argv, optind + 1,
start_message);
memset(&filename, 0, sizeof(filename));
Index: gnokii/gnokii-utils.c
===================================================================
RCS file: /cvsroot/gnokii/gnokii/gnokii/gnokii-utils.c,v
retrieving revision 1.4
diff -u -r1.4 gnokii-utils.c
--- gnokii/gnokii-utils.c 3 Oct 2006 21:35:53 -0000 1.4
+++ gnokii/gnokii-utils.c 15 Nov 2006 14:41:02 -0000
@@ -143,3 +143,16 @@
tcsetattr(fileno(stdin), TCSANOW, &it);
#endif
}
+
+/* does the same thing as atoi but returns -1 in case input string
+ * was not a number
+ */
+int gnokii_atoi(char *string)
+{
+ char *aux = NULL;
+ int num = strtol(string, &aux, 10);
+ if (*aux)
+ return -1;
+ else
+ return num;
+}
pkot
--
Pawel Kot
- Re: PHONET and bluetooth!, (continued)
- Re: PHONET and bluetooth!, Pawel Kot, 2006/11/13
- Re: PHONET and bluetooth!, andrew teo, 2006/11/13
- Re: PHONET and bluetooth!, Pawel Kot, 2006/11/13
- Re: PHONET and bluetooth!, andrew teo, 2006/11/15
- Re: PHONET and bluetooth!, andrew teo, 2006/11/15
- Re: PHONET and bluetooth!, Daniele Forsi, 2006/11/15
- Re: PHONET and bluetooth!, andrew teo, 2006/11/15
- Re: PHONET and bluetooth!, Pawel Kot, 2006/11/15
- Re: PHONET and bluetooth!, andrew teo, 2006/11/15
- Re: PHONET and bluetooth!,
Pawel Kot <=
- Re: PHONET and bluetooth!, andrew teo, 2006/11/15
- Re: PHONET and bluetooth!, Pawel Kot, 2006/11/15
- Re: PHONET and bluetooth!, Daniele Forsi, 2006/11/16
- Re: PHONET and bluetooth!, Pawel Kot, 2006/11/16
Re: PHONET and bluetooth!, Jack, 2006/11/14