1 |
ab11 |
1.1 |
// This may look like C code, but it is really -*- C++ -*- |
2 |
|
|
|
3 |
|
|
// tpopentest.cc. Test for -*- C++ -*- socket library |
4 |
|
|
// Copyright (C) 1992,1993,1994 Gnanasekaran Swaminathan <gs4t@virginia.edu> |
5 |
|
|
// |
6 |
|
|
// Permission is granted to use at your own risk and distribute this software |
7 |
|
|
// in source and binary forms provided the above copyright |
8 |
|
|
// notice and this paragraph are preserved on all copies. |
9 |
|
|
// This software is provided "as is" with no express or implied warranty. |
10 |
|
|
// |
11 |
|
|
// Version: 17Oct95 1.10 |
12 |
|
|
|
13 |
|
|
#include <iostream.h> |
14 |
|
|
#include <stdlib.h> |
15 |
|
|
#include <ctype.h> |
16 |
|
|
|
17 |
|
|
int main(int ac, char** av) |
18 |
|
|
{ |
19 |
|
|
if (ac != 2) { |
20 |
|
|
cerr << "USAGE: " << av[0] << " -iob\n"; |
21 |
|
|
return 1; |
22 |
|
|
} |
23 |
|
|
char buf[256]; |
24 |
|
|
|
25 |
|
|
switch (av[1][1]) { |
26 |
|
|
case 'i': |
27 |
|
|
cin.getline (buf, 255); |
28 |
|
|
cout << av[0] << ' ' << av[1] << ": " << buf << endl; |
29 |
|
|
break; |
30 |
|
|
case 'o': |
31 |
|
|
cout << av[0] << ' ' << av[1] << ": Hello O world!!!" << endl; |
32 |
|
|
break; |
33 |
|
|
case 'b': |
34 |
|
|
cin.getline(buf, 255); |
35 |
|
|
cout << buf << endl; |
36 |
|
|
system (buf); |
37 |
|
|
break; |
38 |
|
|
} |
39 |
|
|
} |