24 template <
class Agent>
inline void
31 fprintf (stderr,
"Failed to create Agent\n");
47 const char* fname = 0;
53 if ((argv[argp][0] ==
'-')
54 && (argv[argp][1] ==
'l')
55 && (argp + 1 < argc)) {
58 }
else if ((argv[argp][0] ==
'-')
59 && (argv[argp][1] ==
'c')
60 && (argp + 1 < argc)) {
63 }
else if (fname == 0) {
66 fprintf (stderr,
"Bad argument '%s'\nUsage: %s [name.ycp]\n",
90 fprintf (stderr,
"Failed to create Parser\n");
98 fprintf (stderr,
"Failed to create Y2StdioComponent\n");
103 if (fname && load_scr)
105 int len = strlen (fname);
107 && strcmp (&fname[len-4],
".ycp") == 0)
109 char* cname = strdup (fname);
110 strcpy (&cname[len-4],
".scr");
111 if (access (cname, R_OK) == 0)
115 || !confval->isTerm ())
117 fprintf (stderr,
"Failed to read '%s'\n", cname);
118 fprintf (stderr,
"Read result: %s\n", confval->toString().c_str());
121 YCPTerm term = confval->asTerm();
122 for (
int i = 0; i < term->
size (); i++)
131 FILE* infile = stdin;
134 infile = fopen (fname,
"r");
137 fprintf (stderr,
"Failed to open '%s'\n", fname);
152 value = parser->
parse ();
157 YCPValue result = value->evaluate ();
158 printf (
"(%s)\n", result->toString ().c_str ());
166 delete user_interface;
virtual YCPValue otherCommand(const YCPTerm &term)
Definition: SCRAgent.cc:67
static YCPValue readconf(const char *filename)
Definition: SCRAgent.cc:74
void run_agent_instance(int, char *[], bool, SCRAgent *)
Definition: run_agent.h:79
void setInput(FILE *file, const char *filename=0)
Definition: Parser.cc:89
YCodePtr parse(SymbolTable *gTable=0, SymbolTable *lTable=0)
Definition: Parser.cc:156
void setBuffered()
Definition: Parser.cc:119
Interface to a component via stdio.
Definition: Y2StdioComponent.h:36
Communication handle to a YaST2 component.
Definition: Y2Component.h:262
void run_agent(int argc, char *argv[], bool load_scr)
Definition: run_agent.h:25
YCPValue value(int n) const
Definition: YCPTerm.h:191
int size() const
Definition: YCPTerm.h:189
bool isNull() const
Definition: YCPElement.h:347
SuSE Configuration Repository Agent.
Definition: SCRAgent.h:37
void set_log_conf(string confname)
Definition: y2log.cc:494
void set_log_filename(string filename)
Definition: y2log.cc:352
Wrapper for YCPTermRep This class realizes an automatic memory management via YCPElement. Access the functionality of YCPTermRep with the arrow operator. See YCPTermRep.
Definition: YCPTerm.h:177
Wrapper for YCPValueRep This class realizes an automatic memory management via YCPElement. Access the functionality of YCPValueRep with the arrow operator. See YCPValueRep.
Definition: YCPValue.h:275
static Parser * parser
Definition: ycpc.cc:47
const char * process_options(int argc, char *argv[])
Definition: run_agent.h:45
YCP language parser.
Definition: Parser.h:64