Code written; VERY preliminary....
This commit is contained in:
parent
a762870fb3
commit
8a1e77eae1
1 changed files with 21 additions and 5 deletions
|
@ -27,14 +27,14 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
/* $Amigan: phoned/phonectl/phonectl.c,v 1.2 2005/06/01 00:43:07 dcp1990 Exp $ */
|
/* $Amigan: phoned/phonectl/phonectl.c,v 1.3 2005/06/03 00:22:11 dcp1990 Exp $ */
|
||||||
/* system includes */
|
/* system includes */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <optarg.h>
|
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
#include <getopt.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
@ -42,10 +42,26 @@
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
/* us */
|
/* us */
|
||||||
#include <phonectl.h>
|
#define DEFSOCK "/tmp/phoned.sock"
|
||||||
|
|
||||||
int main(argc, argv)
|
int main(argc, argv)
|
||||||
int argc;
|
int argc;
|
||||||
char* argv[];
|
char* argv[];
|
||||||
{
|
{
|
||||||
|
int s;
|
||||||
|
char buff[1024];
|
||||||
|
struct sockaddr_un it;
|
||||||
|
if(argc < 1) exit(-1);
|
||||||
|
s = socket(AF_LOCAL, SOCK_STREAM, 0);
|
||||||
|
strcpy(it.sun_path, DEFSOCK);
|
||||||
|
it.sun_family = AF_LOCAL;
|
||||||
|
if(connect(s, (struct sockaddr *)&it, 1 + strlen(it.sun_path) + sizeof(it.sun_family))
|
||||||
|
== -1) {
|
||||||
|
perror("conn");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
write(s, argv[1], strlen(argv[1]) + 1);
|
||||||
|
read(s, buff, sizeof buff);
|
||||||
|
printf("%s\n", buff);
|
||||||
|
close(s);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue