wlmsettag.c C-Language Source Code

#include 
#include 
#include 
#include 
/* ################################################################ */
/* Program for launching and tagging an application */
main (argc,argv)
  char **argv;
  int argc;
{
  int rc,flags;

  if (argc != 3) {
    usage(argv[0]);
    exit(1);
  }

  flags= WLM_VERSION|SWLMTAGINHERITFORK|SWLMTAGINHERITEXEC;

  if(wlm_initialize(WLM_VERSION)){
    perror("wlm_initialize");
    exit(1);
  }

  if(wlm_set_tag(argv[1],&flags)){
    perror("wlm_set_tag");
    exit(2);
  }

  if (execlp(argv[2],argv[2],0)){
    perror("execlp"); printf("Problem launching app...\n");
    exit(3);
  }
  exit(0);
}
/* ################################################################ */
usage(char *cp)
{
  printf("\n %s takes 2 arguments:\n",cp);
  printf("Usage: %s tag_name program_name \n",cp);
  printf("where: tag_name is the rule tag that program_name will inherit \
  \n");
}