~ubuntu-branches/ubuntu/oneiric/openafs/oneiric-201305130334

« back to all changes in this revision

Viewing changes to src/cmd/cmd.c

  • Committer: Bazaar Package Importer
  • Author(s): Russ Allbery
  • Date: 2008-09-22 19:07:02 UTC
  • mfrom: (12.1.14 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080922190702-59m13d7kn6gkw32d
Tags: 1.4.7.dfsg1-6
* Apply upstream patch to free /proc entries in the correct order.
  Thanks, Marc Dionne.  (Closes: #493914)
* Apply upstream deltas to support 2.6.27 kernels and to stop using
  COMMON_KERN_CFLAGS for all 2.6 kernels uniformly, which fixes
  problems on amd64 with newer kernels.  Thanks, Björn Torkelsson.
  (LP: #267504)
* Translation updates:
  - Swedish, thanks Martin Bagge.  (Closes: #493120)

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
#include <afs/param.h>
12
12
 
13
13
RCSID
14
 
    ("$Header: /cvs/openafs/src/cmd/cmd.c,v 1.11.2.1 2006/06/30 19:45:48 shadow Exp $");
 
14
    ("$Header: /cvs/openafs/src/cmd/cmd.c,v 1.11.2.3 2008/01/13 15:33:53 jaltman Exp $");
15
15
 
16
16
#include <sys/types.h>
17
17
#include <ctype.h>
30
30
static int dummy;               /* non-null ptr used for flag existence */
31
31
static struct cmd_syndesc *allSyntax = 0;
32
32
static int noOpcodes = 0;
33
 
static int (*beforeProc) (struct cmd_syndesc * ts, char *beforeRock) =
34
 
    0, (*afterProc) (struct cmd_syndesc * ts, char *afterRock) = 0;
35
 
static char *beforeRock, *afterRock;
 
33
static int (*beforeProc) (struct cmd_syndesc * ts, void *beforeRock) = NULL;
 
34
static int (*afterProc) (struct cmd_syndesc * ts, void *afterRock) = NULL;
 
35
static void *beforeRock, *afterRock;
36
36
static char initcmd_opcode[] = "initcmd";       /*Name of initcmd opcode */
37
37
 
38
38
/* take name and string, and return null string if name is empty, otherwise return
40
40
static char *
41
41
NName(char *a1, char *a2)
42
42
{
43
 
    static char tbuffer[80];
 
43
    static char tbuffer[300];
44
44
    if (strlen(a1) == 0) {
45
 
        return "";
 
45
        return "";
46
46
    } else {
47
 
        strcpy(tbuffer, a1);
48
 
        strcat(tbuffer, a2);
49
 
        return tbuffer;
 
47
        strncpy(tbuffer, a1, sizeof(tbuffer));
 
48
        strncat(tbuffer, a2, sizeof(tbuffer));
 
49
        tbuffer[sizeof(tbuffer)-1]='\0';
 
50
        return tbuffer;
50
51
    }
51
52
}
52
53
 
168
169
extern char *AFSVersion;
169
170
 
170
171
static int
171
 
VersionProc(register struct cmd_syndesc *as, char *arock)
 
172
VersionProc(register struct cmd_syndesc *as, void *arock)
172
173
{
173
174
    printf("%s\n", AFSVersion);
174
175
    return 0;
272
273
}
273
274
 
274
275
static int
275
 
AproposProc(register struct cmd_syndesc *as, char *arock)
 
276
AproposProc(register struct cmd_syndesc *as, void *arock)
276
277
{
277
278
    register struct cmd_syndesc *ts;
278
279
    char *tsub;
297
298
}
298
299
 
299
300
static int
300
 
HelpProc(register struct cmd_syndesc *as, char *arock)
 
301
HelpProc(register struct cmd_syndesc *as, void *arock)
301
302
{
302
303
    register struct cmd_syndesc *ts;
303
304
    register struct cmd_item *ti;
344
345
}
345
346
 
346
347
int
347
 
cmd_SetBeforeProc(int (*aproc) (struct cmd_syndesc * ts, char *beforeRock),
348
 
                  char *arock)
 
348
cmd_SetBeforeProc(int (*aproc) (struct cmd_syndesc * ts, void *beforeRock),
 
349
                  void *arock)
349
350
{
350
351
    beforeProc = aproc;
351
352
    beforeRock = arock;
353
354
}
354
355
 
355
356
int
356
 
cmd_SetAfterProc(int (*aproc) (struct cmd_syndesc * ts, char *afterRock),
357
 
                 char *arock)
 
357
cmd_SetAfterProc(int (*aproc) (struct cmd_syndesc * ts, void *afterRock),
 
358
                 void *arock)
358
359
{
359
360
    afterProc = aproc;
360
361
    afterRock = arock;
380
381
 
381
382
struct cmd_syndesc *
382
383
cmd_CreateSyntax(char *aname,
383
 
                 int (*aproc) (struct cmd_syndesc * ts, char *arock),
384
 
                 char *arock, char *ahelp)
 
384
                 int (*aproc) (struct cmd_syndesc * ts, void *arock),
 
385
                 void *arock, char *ahelp)
385
386
{
386
387
    register struct cmd_syndesc *td;
387
388
 
481
482
    strcpy(tp->name, aname);
482
483
    tp->type = atype;
483
484
    tp->flags = aflags;
484
 
    tp->items = (struct cmd_item *)0;
 
485
    tp->items = NULL;
485
486
    if (ahelp) {
486
487
        tp->help = (char *)malloc(strlen(ahelp) + 1);
487
488
        assert(tp->help);
556
557
        default:
557
558
            break;
558
559
        }
559
 
        tp->items = (struct cmd_item *)0;
 
560
        tp->items = NULL;
560
561
    }
561
562
}
562
563