20 lines
505 B
C
20 lines
505 B
C
// 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
|
|
|