File: dumptable.c

package info (click to toggle)
autopartkit 1.07
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,060 kB
  • ctags: 198
  • sloc: ansic: 2,489; sh: 843; makefile: 103
file content (41 lines) | stat: -rw-r--r-- 710 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <stdio.h>
#include <stdlib.h>
#include "autopartkit.h"

void
list_dump(diskspace_req_t *list)
{
  int total = 0;
  int i;
  if (!list)
  {
    printf("No list!\n");
    return;
  }
  printf("Dumping diskspace_request list:\n");
  for (i=0; list && list[i].mountpoint; i++)
  {
    printf(" %s %s %d %d\n", list[i].mountpoint, list[i].fstype,
	   list[i].minsize, list[i].maxsize);
    total += list[i].minsize;
  }
  printf(" total %d\n", total);
}

int
main(int argc, char *argv[])
{
  diskspace_req_t *list;
  char *infile;
  if (2 == argc)
    infile = argv[1];
  else
    infile = "default.table";

  list = load_partitions(infile);
  list_dump(list);
  free_partition_list(list);

  return 0;
}