~ubuntu-branches/ubuntu/warty/dnprogs/warty

« back to all changes in this revision

Viewing changes to dnetd/dnetd.c

  • Committer: Bazaar Package Importer
  • Author(s): Patrick Caulfield
  • Date: 2004-05-30 10:13:57 UTC
  • Revision ID: james.westby@ubuntu.com-20040530101357-1geqhhh0teccu0cm
Tags: 2.27
* Fix signal handling in sethost so it doesn't die with an embarrassing
  "Alarm clock" message.
* Add dependancy on modutils. Closes: #251508

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/******************************************************************************
2
2
    (c) 1999 P.J. Caulfield               patrick@tykepenguin.cix.co.uk
3
 
    
 
3
 
4
4
    This program is free software; you can redistribute it and/or modify
5
5
    it under the terms of the GNU General Public License as published by
6
6
    the Free Software Foundation; either version 2 of the License, or
76
76
    int   err;
77
77
    int   i;
78
78
    char  name[PATH_MAX];
79
 
            
 
79
 
80
80
    // Split the daemon command into a command and its args
81
81
    argp = strtok(daemon_name, " ");
82
82
    while (argp && argc < MAX_ARGS)
169
169
    // make default binaries directory name
170
170
    strcpy(binary_dir, BINARY_PREFIX);
171
171
    strcat(binary_dir, "/sbin");
172
 
    
 
172
 
173
173
    // Deal with command-line arguments. Do these before the check for root
174
174
    // so we can check the version number and get help without being root.
175
175
    opterr = 0;
176
176
    optind = 0;
177
177
    while ((opt=getopt(argc,argv,"?vVhp:sdl:")) != EOF)
178
178
    {
179
 
        switch(opt) 
 
179
        switch(opt)
180
180
        {
181
 
        case 'h': 
 
181
        case 'h':
182
182
            usage(argv[0], stdout);
183
183
            exit(0);
184
184
 
202
202
            printf("\ntaskd from dnprogs version %s\n\n", VERSION);
203
203
            exit(1);
204
204
            break;
205
 
            
 
205
 
206
206
        case 'p':
207
207
            if (stat(optarg, &st) < 0)
208
208
            {
216
216
            }
217
217
            strcpy(binary_dir, optarg);
218
218
            break;
219
 
            
 
219
 
220
220
        case 'l':
221
221
            if (optarg[0] != 's' &&
222
222
                optarg[0] != 'm' &&
236
236
    // Needed for dnetd on Eduardo's kernel to
237
237
    // be able to do MIRROR
238
238
    dnet_set_optdata(condata, sizeof(condata));
239
 
    
 
239
 
240
240
    fd = dnet_daemon(0, NULL, verbosity, debug?0:1);
241
241
    if (fd > -1)
242
242
    {
254
254
            exec_daemon(fd, daemon_name);
255
255
            return 0;
256
256
        }
257
 
        
 
257
 
258
258
        // Dispatch the object internally
259
259
        // If it's a named object then run a task script
260
260
        getsockname(fd, (struct sockaddr *)&sockaddr, &namlen);