Get rid of nk/copy_cmdarg.h
This commit is contained in:
parent
12631c59bb
commit
9cd65f35d9
9
cfg.rl
9
cfg.rl
@ -15,9 +15,16 @@
|
|||||||
#include "sockd.h"
|
#include "sockd.h"
|
||||||
#include "nk/log.h"
|
#include "nk/log.h"
|
||||||
#include "nk/privs.h"
|
#include "nk/privs.h"
|
||||||
#include "nk/copy_cmdarg.h"
|
|
||||||
#include "nk/io.h"
|
#include "nk/io.h"
|
||||||
|
|
||||||
|
static void copy_cmdarg(char *dest, const char *src,
|
||||||
|
size_t destlen, const char *argname)
|
||||||
|
{
|
||||||
|
ssize_t olen = snprintf(dest, destlen, "%s", src);
|
||||||
|
if (olen < 0 || (size_t)olen > destlen)
|
||||||
|
suicide("snprintf failed on %s", argname);
|
||||||
|
}
|
||||||
|
|
||||||
struct cfgparse {
|
struct cfgparse {
|
||||||
char buf[MAX_BUF];
|
char buf[MAX_BUF];
|
||||||
size_t buflen;
|
size_t buflen;
|
||||||
|
1
ndhc.c
1
ndhc.c
@ -24,7 +24,6 @@
|
|||||||
#include "nk/log.h"
|
#include "nk/log.h"
|
||||||
#include "nk/privs.h"
|
#include "nk/privs.h"
|
||||||
#include "nk/io.h"
|
#include "nk/io.h"
|
||||||
#include "nk/copy_cmdarg.h"
|
|
||||||
|
|
||||||
#include "ndhc.h"
|
#include "ndhc.h"
|
||||||
#include "ndhc-defines.h"
|
#include "ndhc-defines.h"
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
// Copyright 2015 Nicholas J. Kain <njkain at gmail dot com>
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
#ifndef NCMLIB_COPY_CMDARG_H_
|
|
||||||
#define NCMLIB_COPY_CMDARG_H_
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include "nk/log.h"
|
|
||||||
|
|
||||||
static inline void copy_cmdarg(char *dest, const char *src,
|
|
||||||
size_t destlen, const char *argname)
|
|
||||||
{
|
|
||||||
ssize_t olen = snprintf(dest, destlen, "%s", src);
|
|
||||||
if (olen < 0 || (size_t)olen > destlen)
|
|
||||||
suicide("snprintf failed on %s", argname);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user