]> sigrok.org Git - libserialport.git/blobdiff - examples/list_ports.c
change type of result variables to ssize_t
[libserialport.git] / examples / list_ports.c
index b8ff863b0f81cd0075a9eb98ec98dedade219bb9..f183719538ad6ac20acb3e1d9e4353f445884b17 100644 (file)
@@ -1,7 +1,9 @@
 #include <libserialport.h>
 #include <stdio.h>
 
-/* Example of how to get a list of serial ports on the system. */
+/* Example of how to get a list of serial ports on the system.
+ *
+ * This example file is released to the public domain. */
 
 int main(int argc, char **argv)
 {
@@ -15,8 +17,7 @@ int main(int argc, char **argv)
         * pointer will be updated to refer to the array created. */
        enum sp_return result = sp_list_ports(&port_list);
 
-       if (result != SP_OK)
-       {
+       if (result != SP_OK) {
                printf("sp_list_ports() failed!\n");
                return -1;
        }
@@ -24,8 +25,7 @@ int main(int argc, char **argv)
        /* Iterate through the ports. When port_list[i] is NULL
         * this indicates the end of the list. */
        int i;
-       for (i = 0; port_list[i] != NULL; i++)
-       {
+       for (i = 0; port_list[i] != NULL; i++) {
                struct sp_port *port = port_list[i];
 
                /* Get the name of the port. */