summaryrefslogtreecommitdiff
path: root/examples/IPC_SAP
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1999-06-07 07:45:57 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1999-06-07 07:45:57 +0000
commit79d663e579d40a74660e997a9479a8debb934c2c (patch)
tree17d838ced4c83cc133f29396f4d73525ae1ca5ed /examples/IPC_SAP
parentfceb0c5ca1b6e738e920811ab048e6261462c524 (diff)
downloadATCD-79d663e579d40a74660e997a9479a8debb934c2c.tar.gz
.
Diffstat (limited to 'examples/IPC_SAP')
-rw-r--r--examples/IPC_SAP/DEV_SAP/reader/reader.cpp35
-rw-r--r--examples/IPC_SAP/DEV_SAP/writer/writer.cpp46
2 files changed, 56 insertions, 25 deletions
diff --git a/examples/IPC_SAP/DEV_SAP/reader/reader.cpp b/examples/IPC_SAP/DEV_SAP/reader/reader.cpp
index 95eb2ea98e9..c6f8801380f 100644
--- a/examples/IPC_SAP/DEV_SAP/reader/reader.cpp
+++ b/examples/IPC_SAP/DEV_SAP/reader/reader.cpp
@@ -12,13 +12,20 @@ int
main (int argc, char *argv[])
{
if (argc < 2)
- ACE_ERROR_RETURN ((LM_ERROR, "usage: %s device-filename\n", argv[0]), 1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s device-filename\n",
+ argv[0]),
+ 1);
ACE_TTY_IO read_dev;
ACE_DEV_Connector con;
- if (con.connect (read_dev, ACE_DEV_Addr (argv[1])) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", argv[1]), 1);
+ if (con.connect (read_dev,
+ ACE_DEV_Addr (argv[1])) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ argv[1]),
+ 1);
ACE_TTY_IO::Serial_Params myparams;
myparams.baudrate = 9600;
@@ -30,20 +37,28 @@ main (int argc, char *argv[])
myparams.ctsenb = 0;
myparams.rcvenb = 1;
- int ret = read_dev.control (ACE_TTY_IO::SETPARAMS, &myparams);
-
- if (ret == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p control\n", argv[1]), 1);
+ if (read_dev.control (ACE_TTY_IO::SETPARAMS,
+ &myparams) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p control\n",
+ argv[1]),
+ 1);
// Read till character 'q'.
for (char readback = 'x'; readback != 'q'; )
{
- ssize_t bytes_read = read_dev.recv_n ((void *) &readback, 1);
+ ssize_t bytes_read =
+ read_dev.recv_n ((void *) &readback, 1);
if (bytes_read == 1)
- ACE_DEBUG ((LM_DEBUG, "read: %c\n", readback));
+ ACE_DEBUG ((LM_DEBUG,
+ "read: %c\n",
+ readback));
else if (bytes_read == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p recv\n", argv[1]), 1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p recv\n",
+
+ argv[1]), 1);
}
return 0;
diff --git a/examples/IPC_SAP/DEV_SAP/writer/writer.cpp b/examples/IPC_SAP/DEV_SAP/writer/writer.cpp
index fa119dc0ee0..a1629d58bb8 100644
--- a/examples/IPC_SAP/DEV_SAP/writer/writer.cpp
+++ b/examples/IPC_SAP/DEV_SAP/writer/writer.cpp
@@ -9,14 +9,21 @@ int
main (int argc, char *argv[])
{
if (argc < 2)
- ACE_ERROR_RETURN ((LM_ERROR, "usage: %s device-filename\n", argv[0]), 1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s device-filename\n",
- ACE_TTY_IO write_dev;
+ argv[0]), 1);
+ ACE_TTY_IO write_dev;
ACE_DEV_Connector con;
- if (con.connect (write_dev, ACE_DEV_Addr (argv[1])) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", argv[1]), 1);
+ if (con.connect (write_dev,
+ ACE_DEV_Addr (argv[1])) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+
+, "%p\n",
+ argv[1]),
+ 1);
ACE_TTY_IO::Serial_Params myparams;
myparams.baudrate = 9600;
@@ -28,28 +35,37 @@ main (int argc, char *argv[])
myparams.ctsenb = 0;
myparams.rcvenb = 1;
- int ret = write_dev.control (ACE_TTY_IO::SETPARAMS, &myparams);
+ if (write_dev.control (ACE_TTY_IO::SETPARAMS,
+ &myparams) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "control"),
+ 1);
- if (ret == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "control"), 1);
+ ACE_DEBUG ((LM_DEBUG,
+ "enter character to send, q terminates :\n"));
- ACE_DEBUG ((LM_DEBUG, "enter character to send, q terminates :\n"));
-
- for (char writeto = 'x';
+ for (char writeto;
ACE_OS::read (ACE_STDIN, &writeto, 1) != -1;
)
{
- ssize_t bytes_written = write_dev.send_n ((void *)&writeto, 1);
+ ssize_t bytes_written =
+ write_dev.send_n ((void *) &writeto,
+ 1);
if (bytes_written != 1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "send"), 1);
-
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "send"),
+ 1);
if (writeto == 'q')
break;
}
if (write_dev.close () == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "close"), 1);
-
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "close"),
+ 1);
return 0;
}