Previous 15994 Revisions Next

r5844 Tuesday 22nd September, 2009 at 12:39:42 UTC by Dirk Best
[IMGTOOL] Added support for last access time, softlinks, hardlinks and comments
[src/mess/tools/imgtool]library.h main.c

src/mess/tools/imgtool/library.h
r5843r5844
6363
6464   time_t creation_time;
6565   time_t lastmodified_time;
66   time_t lastaccess_time;
6667
68   char softlink[1024];
69   char comment[256];
70
6771   /* flags */
6872   unsigned int eof : 1;
6973   unsigned int corrupt : 1;
7074   unsigned int directory : 1;
75   unsigned int hardlink : 1;
7176} imgtool_dirent;
7277
7378typedef struct
src/mess/tools/imgtool/main.c
r5843r5844
188188   imgtool_directory *imgenum = NULL;
189189   imgtool_dirent ent;
190190   char buf[512];
191   char last_modified[19];
191192   const char *path;
192193   int partition_index = 0;
193194
r5843r5844
208209      goto done;
209210
210211   memset(&ent, 0, sizeof(ent));
212   last_modified[0] = '\0';
211213   total_count = 0;
212214   total_size = 0;
213215
214   fprintf(stdout, "Contents of %s:\n", argv[1]);
216   fprintf(stdout, "Contents of %s:%s\n", argv[1], path ? path : "");
215217
216218   imgtool_image_info(image, buf, sizeof(buf));
217219   if (buf[0])
218220      fprintf(stdout, "%s\n", buf);
219   fprintf(stdout, "------------------------  ------ ---------------\n");
221   fprintf(stdout, "------------------------------  -------- ---------------  ------------------\n");
220222
221223   while (((err = imgtool_directory_get_next(imgenum, &ent)) == 0) && !ent.eof)
222224   {
r5843r5844
225227      else
226228         snprintf(buf, sizeof(buf), "%u", (unsigned int) ent.filesize);
227229
228      fprintf(stdout, "%-20s\t%8s %15s\n", ent.filename, buf, ent.attr);
230      if (ent.lastmodified_time != 0)
231         strftime(last_modified, sizeof(last_modified), "%d-%b-%y %H:%M:%S",
232            localtime(&ent.lastmodified_time));
233
234      if (ent.hardlink)
235         strcat(ent.filename, " <hl>");
236
237      fprintf(stdout, "%-30s  %8s  %15s  %18s\n", ent.filename, buf, ent.attr, last_modified);
238
239      if (ent.softlink && ent.softlink[0] != '\0')
240         fprintf(stdout, "-> %s\n", ent.softlink);
241
242      if (ent.comment && ent.comment[0] != '\0')
243         fprintf(stdout, ": %s\n", ent.comment);
244
229245      total_count++;
230246      total_size += ent.filesize;
247
248      memset(&ent, 0, sizeof(ent));
231249   }
232250
233251   freespace_err = imgtool_partition_get_free_space(partition, &freespace);

Previous 15994 Revisions Next


© 1998-2018 The MESS Team