config/make.tmpl: pass -nix flag also to LDFLAGS of configure
[AROS.git] / tools / mkfsaffs / mkfsaffs.c
blob86465ecb60e6b14265474dc85ecf3fa78e4465ab
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include <unistd.h>
10 #ifdef linux
11 # include <linux/fs.h>
12 # include <fcntl.h>
13 # include <sys/ioctl.h>
14 #endif
16 #include <adflib.h>
19 int main(int argc, char *argv[])
21 struct Device *hd;
22 struct Volume *vol;
23 int fd;
24 long size;
26 printf("mkfsaffs v0.02\n");
28 if (argc != 3)
30 printf("Usage: mkfsaffs <devname> <volname>\n");
31 exit(1);
34 adfEnvInitDefault();
36 #ifdef linux
37 fd = open(argv[1],O_RDONLY);
38 if (fd < 0)
40 printf("open failed\n");
41 exit (1);
43 if (ioctl(fd,BLKGETSIZE,&size) < 0)
45 printf("Could not get size\n");
46 exit(1);
48 close(fd);
49 #else
50 printf("OS not supported!\n");
51 #endif
53 hd = adfCreateDumpDevice(argv[1], size, 1,1);
54 if (!hd) {
55 fprintf(stderr, "can't mount device\n");
56 adfEnvCleanUp(); exit(1);
59 adfCreateHdFile( hd, argv[2], FSMASK_FFS );
61 vol = adfMount(hd, 0, FALSE);
62 if (!vol) {
63 adfUnMountDev(hd);
64 fprintf(stderr, "can't mount volume\n");
65 adfEnvCleanUp(); exit(1);
67 adfVolumeInfo(vol);
69 /* unmounts */
70 adfUnMount(vol);
71 adfUnMountDev(hd);
74 adfEnvCleanUp();
76 return 0;