summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac4
-rw-r--r--src/pjctl.c21
2 files changed, 13 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac
index 9a622c5..467fb9a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,9 +16,7 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
# Check for programs
AC_PROG_CC
-PKG_PROG_PKG_CONFIG()
-PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.28])
-PKG_CHECK_MODULES(GIO, [gio-2.0])
+#PKG_PROG_PKG_CONFIG()
if test "x$GCC" = "xyes"; then
GCC_CFLAGS="-Wall -g -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden"
diff --git a/src/pjctl.c b/src/pjctl.c
index 51a668e..2b21111 100644
--- a/src/pjctl.c
+++ b/src/pjctl.c
@@ -23,7 +23,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <glib.h>
+#include <stddef.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -59,6 +59,8 @@ struct pjctl {
int fd;
};
+#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
+
#define remove_from_list(elem) \
do { \
(elem)->next->prev = (elem)->prev; \
@@ -112,7 +114,7 @@ handle_pjlink_error(char *param)
static int
send_next_cmd(struct pjctl *pjctl)
{
- gssize ret;
+ ssize_t ret;
struct queue_command *cmd;
/* Are we're ready? */
@@ -195,7 +197,7 @@ handle_data(struct pjctl *pjctl, char *data, int len)
&data[PJLINK_PARAMETER]);
free(cmd->command);
- g_free(cmd);
+ free(cmd);
send_next_cmd(pjctl);
@@ -297,7 +299,7 @@ source(struct pjctl *pjctl, char **argv, int argc)
return -1;
}
- for (i = 0; i < G_N_ELEMENTS(switches); ++i) {
+ for (i = 0; i < ARRAY_SIZE(switches); ++i) {
offset = strlen(switches[i]);
if (strncmp(argv[1], switches[i], offset) == 0) {
type = i+1;
@@ -359,7 +361,7 @@ avmute(struct pjctl *pjctl, char **argv, int argc)
return -1;
}
- for (i = 0; i < G_N_ELEMENTS(targets); ++i) {
+ for (i = 0; i < ARRAY_SIZE(targets); ++i) {
int len = strlen(targets[i]);
if (strncmp(argv[1], targets[i], len) == 0) {
type = i+1;
@@ -518,10 +520,11 @@ status(struct pjctl *pjctl, char **argv, int argc)
struct queue_command *cmd;
int i;
- for (i = 0; i < G_N_ELEMENTS(cmds); ++i) {
- cmd = g_memdup(&cmds[i], sizeof *cmd);
+ for (i = 0; i < ARRAY_SIZE(cmds); ++i) {
+ cmd = malloc(sizeof *cmd);
if (!cmd)
return -1;
+ memcpy(cmd, &cmds[i], sizeof *cmd);
if (asprintf(&cmd->command, "%%1%s ?\r", cmds[i].command) < 0)
return -1;
insert_at_head(&pjctl->queue, cmd);
@@ -548,7 +551,7 @@ usage(struct pjctl *pjctl)
printf("usage: pjctl <hostname> command [args..]\n\n");
printf("commands:\n");
- for (i = 0; i < G_N_ELEMENTS(commands); ++i)
+ for (i = 0; i < ARRAY_SIZE(commands); ++i)
printf(" %s %s\n", commands[i].name, commands[i].help);
}
@@ -569,7 +572,7 @@ main(int argc, char **argv)
return 1;
}
- for (i = 0; i < G_N_ELEMENTS(commands); ++i) {
+ for (i = 0; i < ARRAY_SIZE(commands); ++i) {
if (strcmp(argv[2], commands[i].name) == 0) {
if (commands[i].func(&pjctl, &argv[2], argc-2) < 0)
return 1;