view smpp-send/settings.c @ 240:c7a3ba56c636

themwi-short-dial: fix bug in printf arguments
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 14 Aug 2023 15:37:59 -0800
parents f11c3e40c87a
children
line wrap: on
line source

/*
 * This module implements functions for various settings that come before
 * msg or msg-udh lines.
 */

#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include "error.h"

extern char src_addr[21], dest_addr[21];
extern u_char src_ton, src_npi, dest_ton, dest_npi;
extern u_char esm_class, pid_byte, dcs_byte;
extern u_char prio_flag, reg_deliv, replace_flag;

extern int input_lineno;

void
set_src_addr(argc, argv)
	char **argv;
{
	if (strlen(argv[1]) > 20) {
		fprintf(stderr, ERR_PREFIX
			"phone number argument is too long\n", input_lineno);
		exit(1);
	}
	strcpy(src_addr, argv[1]);
}

void
set_src_ton(argc, argv)
	char **argv;
{
	char *endp;

	src_ton = strtoul(argv[1], &endp, 0);
	if (*endp) {
		fprintf(stderr, ERR_PREFIX "invalid byte value argument\n",
			input_lineno);
		exit(1);
	}
}

void
set_src_npi(argc, argv)
	char **argv;
{
	char *endp;

	src_npi = strtoul(argv[1], &endp, 0);
	if (*endp) {
		fprintf(stderr, ERR_PREFIX "invalid byte value argument\n",
			input_lineno);
		exit(1);
	}
}

void
set_dest_addr(argc, argv)
	char **argv;
{
	if (strlen(argv[1]) > 20) {
		fprintf(stderr, ERR_PREFIX
			"phone number argument is too long\n", input_lineno);
		exit(1);
	}
	strcpy(dest_addr, argv[1]);
}

void
set_dest_ton(argc, argv)
	char **argv;
{
	char *endp;

	dest_ton = strtoul(argv[1], &endp, 0);
	if (*endp) {
		fprintf(stderr, ERR_PREFIX "invalid byte value argument\n",
			input_lineno);
		exit(1);
	}
}

void
set_dest_npi(argc, argv)
	char **argv;
{
	char *endp;

	dest_npi = strtoul(argv[1], &endp, 0);
	if (*endp) {
		fprintf(stderr, ERR_PREFIX "invalid byte value argument\n",
			input_lineno);
		exit(1);
	}
}

void
set_pid_byte(argc, argv)
	char **argv;
{
	char *endp;

	pid_byte = strtoul(argv[1], &endp, 0);
	if (*endp) {
		fprintf(stderr, ERR_PREFIX "invalid byte value argument\n",
			input_lineno);
		exit(1);
	}
}

void
set_dcs_byte(argc, argv)
	char **argv;
{
	char *endp;

	dcs_byte = strtoul(argv[1], &endp, 0);
	if (*endp) {
		fprintf(stderr, ERR_PREFIX "invalid byte value argument\n",
			input_lineno);
		exit(1);
	}
}

void
set_esm_class(argc, argv)
	char **argv;
{
	char *endp;

	esm_class = strtoul(argv[1], &endp, 0);
	if (*endp) {
		fprintf(stderr, ERR_PREFIX "invalid byte value argument\n",
			input_lineno);
		exit(1);
	}
}

void
set_priority(argc, argv)
	char **argv;
{
	char *endp;

	prio_flag = strtoul(argv[1], &endp, 0);
	if (*endp) {
		fprintf(stderr, ERR_PREFIX "invalid byte value argument\n",
			input_lineno);
		exit(1);
	}
}

void
set_reg_deliv(argc, argv)
	char **argv;
{
	char *endp;

	reg_deliv = strtoul(argv[1], &endp, 0);
	if (*endp) {
		fprintf(stderr, ERR_PREFIX "invalid byte value argument\n",
			input_lineno);
		exit(1);
	}
}

void
set_replace_flag(argc, argv)
	char **argv;
{
	char *endp;

	replace_flag = strtoul(argv[1], &endp, 0);
	if (*endp) {
		fprintf(stderr, ERR_PREFIX "invalid byte value argument\n",
			input_lineno);
		exit(1);
	}
}