copy from intranet.

This commit is contained in:
lijia
2019-07-10 17:54:02 +08:00
commit f36a4fca25
353 changed files with 130721 additions and 0 deletions

57
src/fragroute/mod_echo.c Normal file
View File

@@ -0,0 +1,57 @@
/*
* mod_echo.c
*
* Copyright (c) 2001 Dug Song <dugsong@monkey.org>
*
* $Id: mod_echo.c 2000 2008-04-27 06:17:35Z aturner $
*/
#include "config.h"
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "argv.h"
#include "mod.h"
void *
echo_open(int argc, char *argv[])
{
char *p;
if (argc < 2)
return (NULL);
if ((p = argv_copy(argv + 1)) == NULL)
return (NULL);
return (p);
}
int
echo_apply(void *d, struct pktq *pktq)
{
char *p = (char *)d;
printf("%s\n", p);
return (0);
}
void *
echo_close(void *d)
{
if (d != NULL)
free(d);
return (NULL);
}
struct mod mod_echo = {
"echo", /* name */
"echo <string> ...", /* usage */
echo_open, /* open */
echo_apply, /* apply */
echo_close /* close */
};