acton_prep.c File Reference

#include "local.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "popt.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/un.h>
#include <sys/wait.h>
#include <time.h>
#include <unistd.h>
#include <errno.h>
#include "acq200_root.h"

Go to the source code of this file.

Data Structures

struct  Action
struct  EnvMap

Defines

#define VERSION   "acton_prep $Revision: 1.4 $ B1000"
#define USAGE   "\acton_prep [opts] [command] [args]\n\opts: --norecycle do not recycle data on completion.\n\\n\Command: any ARM side command to run, with <args>\n\\n\The command is run with the following environment variables set:\n\PREP_ID=id\n\PREP_PATH=path to prep data files\n\PREP_FILE=parth to prep data file XXP\n\PREP_START=start\n\PREP_SAM=length in samples\n\PREP_SHORTS=length in shots\n"
#define DATA   "/dev/prep/data"
#define PREP_STATUS   "/dev/prep/status"
#define MAXLINE   80
#define MAXENV_ITEM   128
#define MAPLEN   (sizeof(map)/sizeof(struct EnvMap))

Functions

static int getSampleSize (void)
static struct Actionparse (const char *line)
static void actionID (char *value, struct Action *action)
static void actionPath (char *value, struct Action *action)
static void actionFile (char *value, struct Action *action)
static void actionStart (char *value, struct Action *action)
static void actionSam (char *value, struct Action *action)
static void actionShorts (char *value, struct Action *action)
static void actionScc (char *value, struct Action *action)
static void actionTv (char *value, struct Action *action)
static void actionTod (char *value, struct Action *action)
static void do_putenv (struct EnvMap *map, struct Action *action)
static void init_map (struct EnvMap *map, struct Action *def_action)
static void init_env (void)
static void do_action (struct Action *action, char **child_def)
static void acton_prep (char **child_def)
int main (int argc, const char *argv[])

Variables

int norecycle
int acq200_debug
struct poptOption opt_table []
struct EnvMap map []


Define Documentation

#define DATA   "/dev/prep/data"

Definition at line 66 of file acton_prep.c.

Referenced by actionFile(), and actionPath().

#define MAPLEN   (sizeof(map)/sizeof(struct EnvMap))

Definition at line 166 of file acton_prep.c.

Referenced by do_action(), and init_env().

#define MAXENV_ITEM   128

Definition at line 70 of file acton_prep.c.

Referenced by init_map().

#define MAXLINE   80

Definition at line 68 of file acton_prep.c.

Referenced by acton_prep(), and main().

#define PREP_STATUS   "/dev/prep/status"

Definition at line 67 of file acton_prep.c.

Referenced by acton_prep().

#define USAGE   "\acton_prep [opts] [command] [args]\n\opts: --norecycle do not recycle data on completion.\n\\n\Command: any ARM side command to run, with <args>\n\\n\The command is run with the following environment variables set:\n\PREP_ID=id\n\PREP_PATH=path to prep data files\n\PREP_FILE=parth to prep data file XXP\n\PREP_START=start\n\PREP_SAM=length in samples\n\PREP_SHORTS=length in shots\n"

Definition at line 24 of file acton_prep.c.

Referenced by main().

#define VERSION   "acton_prep $Revision: 1.4 $ B1000"

Definition at line 22 of file acton_prep.c.

Referenced by main().


Function Documentation

static void actionFile ( char *  value,
struct Action action 
) [static]

Definition at line 126 of file acton_prep.c.

References DATA, Action::id, and Action::start.

static void actionID ( char *  value,
struct Action action 
) [static]

Definition at line 120 of file acton_prep.c.

References Action::id.

static void actionPath ( char *  value,
struct Action action 
) [static]

Definition at line 123 of file acton_prep.c.

References DATA, Action::id, and Action::start.

Referenced by do_action().

static void actionSam ( char *  value,
struct Action action 
) [static]

Definition at line 132 of file acton_prep.c.

References Action::len.

static void actionScc ( char *  value,
struct Action action 
) [static]

Definition at line 141 of file acton_prep.c.

References Action::scc.

static void actionShorts ( char *  value,
struct Action action 
) [static]

Definition at line 135 of file acton_prep.c.

References getSampleSize(), and Action::len.

static void actionStart ( char *  value,
struct Action action 
) [static]

Definition at line 129 of file acton_prep.c.

References Action::start.

static void actionTod ( char *  value,
struct Action action 
) [static]

Definition at line 150 of file acton_prep.c.

References Action::tv_sec.

static void actionTv ( char *  value,
struct Action action 
) [static]

Definition at line 145 of file acton_prep.c.

References Action::tv_sec, and Action::tv_usec.

static void acton_prep ( char **  child_def  )  [static]

Definition at line 231 of file acton_prep.c.

References do_action(), MAXLINE, parse(), and PREP_STATUS.

Referenced by main().

static void do_action ( struct Action action,
char **  child_def 
) [static]

Definition at line 197 of file acton_prep.c.

References actionPath(), do_putenv(), MAPLEN, norecycle, and Action::status.

Referenced by acton_prep().

static void do_putenv ( struct EnvMap map,
struct Action action 
) [static]

Definition at line 169 of file acton_prep.c.

References EnvMap::action, EnvMap::buf, and EnvMap::value.

Referenced by do_action(), and init_map().

static int getSampleSize ( void   )  [static]

Definition at line 97 of file acton_prep.c.

Referenced by actionShorts().

static void init_env ( void   )  [static]

Definition at line 184 of file acton_prep.c.

References Action::id, init_map(), and MAPLEN.

Referenced by main().

static void init_map ( struct EnvMap map,
struct Action def_action 
) [static]

Definition at line 175 of file acton_prep.c.

References EnvMap::buf, do_putenv(), EnvMap::key, MAXENV_ITEM, and EnvMap::value.

Referenced by init_env().

int main ( int  argc,
const char *  argv[] 
)

Definition at line 246 of file acton_prep.c.

References acton_prep(), init_env(), norecycle, opt_table, USAGE, and VERSION.

static struct Action* parse ( const char *  line  )  [static, read]


Variable Documentation

struct EnvMap map[]

Initial value:

 {
        { .key = "PREP_ID=", .action = actionID },
        { .key = "PREP_PATH=", .action = actionPath },
        { .key = "PREP_FILE=", .action = actionFile },
        { .key = "PREP_START=", .action = actionStart },
        { .key = "PREP_SAM=",   .action = actionSam },
        { .key = "PREP_SHORTS=", .action = actionShorts },
        { .key = "PREP_SCC=",    .action = actionScc },
        { .key = "PREP_TV=",     .action = actionTv },
        { .key = "PREP_TIME=",   .action = actionTod }
}

Definition at line 155 of file acton_prep.c.

int norecycle

Definition at line 53 of file acton_prep.c.

Referenced by do_action(), and main().

struct poptOption opt_table[]

Initial value:

 {
        { "norecycle", 0,  POPT_ARG_NONE, 0,            'r' },
        { "version", 'v',  POPT_ARG_NONE, 0,            'v' },
        { "usage",    0,   POPT_ARG_NONE, 0,            'u' }, 
        { "verbose", 'd',  POPT_ARG_INT,  &acq200_debug, 0, 0},
        POPT_AUTOHELP
        POPT_TABLEEND
}

Definition at line 57 of file acton_prep.c.

Referenced by main().


Generated on Wed Feb 3 08:08:33 2010 for mdsshell by  doxygen 1.5.7.1