salut,
j'avais appris un peut les basses du language C lors d'une formation.
j'avais essaye de coder quel truc preso par la suite sans grand resultat.
ca fait des mois que je me dit qu'il faut que je trouve quelque chose a coder, mais simplement koi ?
j'ai install debian GNU/hurd recamment et j'ai besoin de la derniere version de util-linux, la 2.13
je tente de cree un packet avec debuild mais ca plante.
je me dit tien c'est peut etre une solution, faire un patch sur ce soft.
j'ai regarder rapidement sur google et apparament le pb est recurrent donc y apporter un solution pour etre un tres bon exercice
et du coups je m'implique un peut dans la communauter open source, chose que j'ai envie depuis longtemps.
simplement ca fait telement longtemps que j'ai plus coder que j'ai oublier beaucoup de chose, ca doit faire presque deux ans.
je sais pas trop par ou prendre le probleme.
donc pour ce qui pour mon environnement de dev, j'utilise debian, a la base c'est une stable mais vue tout les packets testing qu'il ma fallu installer pour ma carte ati et aussi pour code::blocks, ide que j'aimerai bien approfondire un peut plus.
au debut je me disait que emacs etait bien mieux, mais finalement je me suis rendu compte que je perdais telement de temps a chercher les commande qu'un ide graphique serai plus approprier.
pour rentre dans le vif du sujet, j'ai le message suivant lors d'un debuild :
donc a premiere vue la struct floppy_struct vous la merde,
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 fdformat.c:17:22: error: linux/fd.h: No such file or directory fdformat.c: In function 'format_disk': fdformat.c:28: error: storage size of 'descr' isn't known fdformat.c:33: error: 'FDFMTBEG' undeclared (first use in this function) fdformat.c:33: error: (Each undeclared identifier is reported only once fdformat.c:33: error: for each function it appears in.) fdformat.c:34: error: invalid use of undefined type 'struct floppy_struct' fdformat.c:37: error: 'FDFMTTRK' undeclared (first use in this function) fdformat.c:42: error: invalid use of undefined type 'struct floppy_struct' fdformat.c:48: error: 'FDFMTEND' undeclared (first use in this function) fdformat.c: In function 'verify_disk': fdformat.c:58: error: invalid use of undefined type 'struct floppy_struct' fdformat.c:58: error: invalid use of undefined type 'struct floppy_struct' fdformat.c:63: error: invalid use of undefined type 'struct floppy_struct' fdformat.c:78: error: 'FD_FILL_BYTE' undeclared (first use in this function) fdformat.c: In function 'main': fdformat.c:139: error: 'FDGETPRM' undeclared (first use in this function) fdformat.c:142: error: invalid use of undefined type 'struct floppy_struct' fdformat.c:143: error: invalid use of undefined type 'struct floppy_struct' fdformat.c:143: error: invalid use of undefined type 'struct floppy_struct' fdformat.c:143: error: invalid use of undefined type 'struct floppy_struct' make[3]: *** [fdformat.o] Error 1
donc je regarde le code de fdformat.c
(un code avec casiment aucun commentaire, ce qui n'aide pas a ca comprenhension/
donc voila un code plutot difficile a comprendre, j'ai essaie de le compiler avec code::blocks mais il est bourré d'erreur
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152 /* /* fdformat.c - Low-level formats a floppy disk - Werner Almesberger */ /* 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL> * - added Native Language Support * 1999-03-20 Arnaldo Carvalho de Melo <acme@conectiva.com.br> & - more i18n/nls translatable strings marked */ #include <stdio.h> #include <string.h> #include <fcntl.h> #include <errno.h> #include <unistd.h> #include <stdlib.h> #include <sys/stat.h> #include <sys/ioctl.h> #include <linux/fd.h> #include "nls.h" struct floppy_struct param; #define SECTOR_SIZE 512 #define PERROR(msg) { perror(msg); exit(1); } static void format_disk(int ctrl, char *name) { struct format_descr descr; int track; printf(_("Formatting ... ")); fflush(stdout); if (ioctl(ctrl,FDFMTBEG,NULL) < 0) PERROR("\nioctl(FDFMTBEG)"); for (track = 0; track < param.track; track++) { descr.track = track; descr.head = 0; if (ioctl(ctrl,FDFMTTRK,(long) &descr) < 0) PERROR("\nioctl(FDFMTTRK)"); printf("%3d\b\b\b",track); fflush(stdout); if (param.head == 2) { descr.head = 1; if (ioctl(ctrl,FDFMTTRK,(long) &descr) < 0) PERROR("\nioctl(FDFMTTRK)"); } } if (ioctl(ctrl,FDFMTEND,NULL) < 0) PERROR("\nioctl(FDFMTEND)"); printf(_("done\n")); } static void verify_disk(char *name) { unsigned char *data; int fd,cyl_size,cyl,count; cyl_size = param.sect*param.head*512; if ((data = (unsigned char *) malloc(cyl_size)) == NULL) PERROR("malloc"); printf(_("Verifying ... ")); fflush(stdout); if ((fd = open(name,O_RDONLY)) < 0) PERROR(name); for (cyl = 0; cyl < param.track; cyl++) { int read_bytes; printf("%3d\b\b\b",cyl); fflush(stdout); read_bytes = read(fd,data,cyl_size); if(read_bytes != cyl_size) { if(read_bytes < 0) perror(_("Read: ")); fprintf(stderr, _("Problem reading cylinder %d, expected %d, read %d\n"), cyl, cyl_size, read_bytes); exit(1); } for (count = 0; count < cyl_size; count++) if (data[count] != FD_FILL_BYTE) { printf(_("bad data in cyl %d\nContinuing ... "),cyl); fflush(stdout); break; } } printf(_("done\n")); if (close(fd) < 0) PERROR("close"); } static void usage(char *name) { char *this; if ((this = strrchr(name,'/')) != NULL) name = this+1; fprintf(stderr,_("usage: %s [ -n ] device\n"),name); exit(1); } int main(int argc,char **argv) { int ctrl; int verify; struct stat st; char *progname, *p; progname = argv[0]; if ((p = strrchr(progname, '/')) != NULL) progname = p+1; setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); if (argc == 2 && (!strcmp(argv[1], "-V") || !strcmp(argv[1], "--version"))) { printf(_("%s (%s)\n"), progname, PACKAGE_STRING); exit(0); } verify = 1; if (argc > 1 && argv[1][0] == '-') { if (argv[1][1] != 'n') usage(progname); verify = 0; argc--; argv++; } if (argc != 2) usage(progname); if (stat(argv[1],&st) < 0) PERROR(argv[1]); if (!S_ISBLK(st.st_mode)) { fprintf(stderr,_("%s: not a block device\n"),argv[1]); exit(1); /* do not test major - perhaps this was an USB floppy */ } if (access(argv[1],W_OK) < 0) PERROR(argv[1]); ctrl = open(argv[1],O_WRONLY); if (ctrl < 0) PERROR(argv[1]); if (ioctl(ctrl,FDGETPRM,(long) ¶m) < 0) PERROR(_("Could not determine current format type")); printf(_("%s-sided, %d tracks, %d sec/track. Total capacity %d kB.\n"), (param.head == 2) ? _("Double") : _("Single"), param.track, param.sect,param.size >> 1); format_disk(ctrl, argv[1]); close(ctrl); if (verify) verify_disk(argv[1]); return 0; }
donc voila, je part avec la meilleur volonte du monde mais je me trouve avec quelque chose qui semble inbuvable.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 /home/kusanagi/util-linux-2.13.1.1-src/util-linux-2.13.1.1/disk-utils/fdformat.c|19|error: nls.h: Aucun fichier ou répertoire de ce type| /home/kusanagi/util-linux-2.13.1.1-src/util-linux-2.13.1.1/disk-utils/fdformat.c||In function format_disk:| /home/kusanagi/util-linux-2.13.1.1-src/util-linux-2.13.1.1/disk-utils/fdformat.c|31|warning: implicit declaration of function _| /home/kusanagi/util-linux-2.13.1.1-src/util-linux-2.13.1.1/disk-utils/fdformat.c|31|warning: passing argument 1 of printf makes pointer from integer without a cast| /home/kusanagi/util-linux-2.13.1.1-src/util-linux-2.13.1.1/disk-utils/fdformat.c|49|warning: passing argument 1 of printf makes pointer from integer without a cast| /home/kusanagi/util-linux-2.13.1.1-src/util-linux-2.13.1.1/disk-utils/fdformat.c||In function verify_disk:| /home/kusanagi/util-linux-2.13.1.1-src/util-linux-2.13.1.1/disk-utils/fdformat.c|60|warning: passing argument 1 of printf makes pointer from integer without a cast| /home/kusanagi/util-linux-2.13.1.1-src/util-linux-2.13.1.1/disk-utils/fdformat.c|71|warning: passing argument 1 of perror makes pointer from integer without a cast| /home/kusanagi/util-linux-2.13.1.1-src/util-linux-2.13.1.1/disk-utils/fdformat.c|74|warning: passing argument 2 of fprintf makes pointer from integer without a cast| /home/kusanagi/util-linux-2.13.1.1-src/util-linux-2.13.1.1/disk-utils/fdformat.c|79|warning: passing argument 1 of printf makes pointer from integer without a cast| /home/kusanagi/util-linux-2.13.1.1-src/util-linux-2.13.1.1/disk-utils/fdformat.c|84|warning: passing argument 1 of printf makes pointer from integer without a cast| /home/kusanagi/util-linux-2.13.1.1-src/util-linux-2.13.1.1/disk-utils/fdformat.c||In function usage:| /home/kusanagi/util-linux-2.13.1.1-src/util-linux-2.13.1.1/disk-utils/fdformat.c|94|warning: passing argument 2 of fprintf makes pointer from integer without a cast| /home/kusanagi/util-linux-2.13.1.1-src/util-linux-2.13.1.1/disk-utils/fdformat.c||In function main:| /home/kusanagi/util-linux-2.13.1.1-src/util-linux-2.13.1.1/disk-utils/fdformat.c|110|warning: implicit declaration of function setlocale| /home/kusanagi/util-linux-2.13.1.1-src/util-linux-2.13.1.1/disk-utils/fdformat.c|110|error: LC_ALL undeclared (first use in this function)| /home/kusanagi/util-linux-2.13.1.1-src/util-linux-2.13.1.1/disk-utils/fdformat.c|110|error: (Each undeclared identifier is reported only once| /home/kusanagi/util-linux-2.13.1.1-src/util-linux-2.13.1.1/disk-utils/fdformat.c|110|error: for each function it appears in.)| /home/kusanagi/util-linux-2.13.1.1-src/util-linux-2.13.1.1/disk-utils/fdformat.c|111|warning: implicit declaration of function bindtextdomain| /home/kusanagi/util-linux-2.13.1.1-src/util-linux-2.13.1.1/disk-utils/fdformat.c|111|error: PACKAGE undeclared (first use in this function)| /home/kusanagi/util-linux-2.13.1.1-src/util-linux-2.13.1.1/disk-utils/fdformat.c|111|error: LOCALEDIR undeclared (first use in this function)| /home/kusanagi/util-linux-2.13.1.1-src/util-linux-2.13.1.1/disk-utils/fdformat.c|112|warning: implicit declaration of function textdomain| /home/kusanagi/util-linux-2.13.1.1-src/util-linux-2.13.1.1/disk-utils/fdformat.c|116|error: PACKAGE_STRING undeclared (first use in this function)| /home/kusanagi/util-linux-2.13.1.1-src/util-linux-2.13.1.1/disk-utils/fdformat.c|116|warning: passing argument 1 of printf makes pointer from integer without a cast| /home/kusanagi/util-linux-2.13.1.1-src/util-linux-2.13.1.1/disk-utils/fdformat.c|130|warning: passing argument 2 of fprintf makes pointer from integer without a cast| /home/kusanagi/util-linux-2.13.1.1-src/util-linux-2.13.1.1/disk-utils/fdformat.c|140|warning: passing argument 1 of perror makes pointer from integer without a cast| /home/kusanagi/util-linux-2.13.1.1-src/util-linux-2.13.1.1/disk-utils/fdformat.c|143|warning: passing argument 1 of printf makes pointer from integer without a cast| ||=== Build finished: 7 errors, 16 warnings ===|
deja s'il y avait des explication sur la struct floppy_struct parm ca aiderai peut etre pour demarrer, mais aucun commentaire.
donc je sais pas trop koi faire, attendre qu'un autre sorte un patch et l'utiliser, et avoir encore quelque mois de plus sans faire de prog.
essaye de comprendre comme fonctionne ce bout de code, mais la je sais pas par ou commencer.
demander des explication au mainteneur, possible bien sur, mais bon le code qui n'est peut etre pas tres long et peut tres compliquer puique qui gere le formatage des diskettes.
desoler pour de topic vraiment tres tres long.
au niveau des balises, c'est un peut limite mais bon
une colorisation syntaxique aurai etait peut etre plus claire.
bref
j'aimerai avoir votre point de vue sur la question.
salutation,
major_kusanagi.
Partager