Merge remote-tracking branch 'pootle/master'
[gammu.git] / tests / dump-features.c
blobc55335c202d78d063df409092b7469c82a6e755d
1 /* Sample code to dump all feature codes and their descriptions */
3 #include <gammu.h>
4 #include <stdlib.h>
5 #include <stdio.h>
6 #include <string.h>
8 int main(int argc, char **argv)
10 GSM_Feature feature;
11 gboolean numeric = FALSE;
12 int rc = 0;
13 const char *featurestring;
15 if (argc >= 2 && strcmp(argv[1], "-n") == 0) {
16 numeric = TRUE;
19 for (feature = F_CAL33; feature < F_LAST_VALUE; feature++) {
20 featurestring = GSM_FeatureToString(feature);
21 if (featurestring == NULL) {
22 fprintf(stderr, "Unknown feature message for %d!\n", feature);
23 rc = 1;
24 } else {
25 if (feature != GSM_FeatureFromString(featurestring)) {
26 fprintf(stderr, "Could not map string %s back to %d!\n", featurestring, feature);
27 rc = 2;
30 if (numeric) {
31 printf("%d. %s\n", feature, featurestring);
32 } else {
33 printf("# %s\n", featurestring);
37 return rc;
40 /* Editor configuration
41 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: