-
Eric Vidal authoredEric Vidal authored
ssexec_start.c 3.49 KiB
/*
* ssexec_start.c
*
* Copyright (c) 2018-2021 Eric Vidal <eric@obarun.org>
*
* All rights reserved.
*
* This file is part of Obarun. It is subject to the license terms in
* the LICENSE file found in the top-level directory of this
* distribution.
* This file may not be copied, modified, propagated, or distributed
* except according to the terms contained in the LICENSE file./
*/
#include <stdint.h>
#include <oblibs/log.h>
#include <oblibs/types.h>
#include <oblibs/graph.h>
#include <oblibs/sastr.h>
#include <skalibs/sgetopt.h>
#include <66/ssexec.h>
#include <66/config.h>
#include <66/graph.h>
#include <66/state.h>
#include <66/svc.h>
#include <66/sanitize.h>
#include <66/service.h>
#include <66/enum.h>
int ssexec_start(int argc, char const *const *argv, ssexec_t *info)
{
log_flow() ;
uint32_t flag = 0 ;
graph_t graph = GRAPH_ZERO ;
uint8_t siglen = 3 ;
int n = 0 ;
unsigned int areslen = 0, list[SS_MAX_SERVICE], visit[SS_MAX_SERVICE], nservice = 0 ;
resolve_service_t ares[SS_MAX_SERVICE] ;
FLAGS_SET(flag, STATE_FLAGS_TOPROPAGATE|STATE_FLAGS_TOPARSE|STATE_FLAGS_WANTUP) ;
{
subgetopt l = SUBGETOPT_ZERO ;
for (;;) {
int opt = subgetopt_r(argc,argv, OPTS_START, &l) ;
if (opt == -1) break ;
switch (opt) {
case 'h' :
info_help(info->help, info->usage) ;
return 0 ;
case 'P' :
FLAGS_CLEAR(flag, STATE_FLAGS_TOPROPAGATE) ;
siglen++ ;
break ;
default :
log_usage(info->usage, "\n", info->help) ;