diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-10-08 08:33:00 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-10-08 08:33:00 -0600 |
commit | fdb1d0a4df496e7a3232a950d5c72231363cf67a (patch) | |
tree | 5d18c1b4f9241f17396ec663ff4425bf21e6b57a /apps/examples/qencoder/qe_main.c | |
parent | 1753a0251a941fa4d1a5b95aec631209e9957670 (diff) | |
download | nuttx-fdb1d0a4df496e7a3232a950d5c72231363cf67a.tar.gz nuttx-fdb1d0a4df496e7a3232a950d5c72231363cf67a.tar.bz2 nuttx-fdb1d0a4df496e7a3232a950d5c72231363cf67a.zip |
Remove non-portable references to syslog from apps/examples
Diffstat (limited to 'apps/examples/qencoder/qe_main.c')
-rw-r--r-- | apps/examples/qencoder/qe_main.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/apps/examples/qencoder/qe_main.c b/apps/examples/qencoder/qe_main.c index 0bcf56763..5085c7197 100644 --- a/apps/examples/qencoder/qe_main.c +++ b/apps/examples/qencoder/qe_main.c @@ -108,13 +108,13 @@ static void qe_devpath(FAR const char *devpath) #ifdef CONFIG_NSH_BUILTIN_APPS static void qe_help(void) { - message("\nUsage: qe [OPTIONS]\n\n"); - message("OPTIONS include:\n"); - message(" [-p devpath] QE device path\n"); - message(" [-n samples] Number of samples\n"); - message(" [-t msec] Delay between samples (msec)\n"); - message(" [-r] Reset the position to zero\n"); - message(" [-h] Shows this message and exits\n\n"); + printf("\nUsage: qe [OPTIONS]\n\n"); + printf("OPTIONS include:\n"); + printf(" [-p devpath] QE device path\n"); + printf(" [-n samples] Number of samples\n"); + printf(" [-t msec] Delay between samples (msec)\n"); + printf(" [-r] Reset the position to zero\n"); + printf(" [-h] Shows this message and exits\n\n"); } #endif @@ -178,7 +178,7 @@ static void parse_args(int argc, FAR char **argv) ptr = argv[index]; if (ptr[0] != '-') { - message("Invalid options format: %s\n", ptr); + printf("Invalid options format: %s\n", ptr); exit(0); } @@ -188,7 +188,7 @@ static void parse_args(int argc, FAR char **argv) nargs = arg_decimal(&argv[index], &value); if (value < 0 || value > INT_MAX) { - message("Sample count out of range: %ld\n", value); + printf("Sample count out of range: %ld\n", value); exit(1); } @@ -206,7 +206,7 @@ static void parse_args(int argc, FAR char **argv) nargs = arg_decimal(&argv[index], &value); if (value < 0 || value > INT_MAX) { - message("Sample delay out of range: %ld\n", value); + printf("Sample delay out of range: %ld\n", value); exit(1); } @@ -224,7 +224,7 @@ static void parse_args(int argc, FAR char **argv) exit(EXIT_SUCCESS); default: - message("Unsupported option: %s\n", ptr); + printf("Unsupported option: %s\n", ptr); qe_help(); exit(EXIT_FAILURE); } @@ -262,11 +262,11 @@ int qe_main(int argc, char *argv[]) * this test. */ - message("qe_main: Initializing external encoder(s)\n"); + printf("qe_main: Initializing external encoder(s)\n"); ret = qe_devinit(); if (ret != OK) { - message("qe_main: qe_devinit failed: %d\n", ret); + printf("qe_main: qe_devinit failed: %d\n", ret); exitval = EXIT_FAILURE; goto errout; } @@ -285,13 +285,13 @@ int qe_main(int argc, char *argv[]) /* Open the encoder device for reading */ - message("qe_main: Hardware initialized. Opening the encoder device: %s\n", + printf("qe_main: Hardware initialized. Opening the encoder device: %s\n", g_qeexample.devpath); fd = open(g_qeexample.devpath, O_RDONLY); if (fd < 0) { - message("qe_main: open %s failed: %d\n", g_qeexample.devpath, errno); + printf("qe_main: open %s failed: %d\n", g_qeexample.devpath, errno); exitval = EXIT_FAILURE; goto errout_with_dev; } @@ -300,11 +300,11 @@ int qe_main(int argc, char *argv[]) if (g_qeexample.reset) { - message("qe_main: Resetting the count...\n"); + printf("qe_main: Resetting the count...\n"); ret = ioctl(fd, QEIOC_RESET, 0); if (ret < 0) { - message("qe_main: ioctl(QEIOC_RESET) failed: %d\n", errno); + printf("qe_main: ioctl(QEIOC_RESET) failed: %d\n", errno); exitval = EXIT_FAILURE; goto errout_with_dev; } @@ -315,10 +315,10 @@ int qe_main(int argc, char *argv[]) */ #if defined(CONFIG_NSH_BUILTIN_APPS) - message("qe_main: Number of samples: %d\n", g_qeexample.nloops); + printf("qe_main: Number of samples: %d\n", g_qeexample.nloops); for (nloops = 0; nloops < g_qeexample.nloops; nloops++) #elif defined(CONFIG_EXAMPLES_QENCODER_NSAMPLES) - message("qe_main: Number of samples: %d\n", CONFIG_EXAMPLES_QENCODER_NSAMPLES); + printf("qe_main: Number of samples: %d\n", CONFIG_EXAMPLES_QENCODER_NSAMPLES); for (nloops = 0; nloops < CONFIG_EXAMPLES_QENCODER_NSAMPLES; nloops++) #else for (;;) @@ -328,14 +328,14 @@ int qe_main(int argc, char *argv[]) * through the loop. */ - msgflush(); + fflush(stdout); /* Get the positions data using the ioctl */ ret = ioctl(fd, QEIOC_POSITION, (unsigned long)((uintptr_t)&position)); if (ret < 0) { - message("qe_main: ioctl(QEIOC_POSITION) failed: %d\n", errno); + printf("qe_main: ioctl(QEIOC_POSITION) failed: %d\n", errno); exitval = EXIT_FAILURE; goto errout_with_dev; } @@ -344,7 +344,7 @@ int qe_main(int argc, char *argv[]) else { - message("qe_main: %3d. %d\n", nloops+1, position); + printf("qe_main: %3d. %d\n", nloops+1, position); } /* Delay a little bit */ @@ -360,7 +360,7 @@ errout_with_dev: close(fd); errout: - message("Terminating!\n"); - msgflush(); + printf("Terminating!\n"); + fflush(stdout); return exitval; } |