/[osn-commons]/trunk/uar/main.c
ViewVC logotype

Diff of /trunk/uar/main.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 32 by rakinar2, Wed Aug 7 18:57:45 2024 UTC revision 33 by rakinar2, Thu Aug 8 16:57:39 2024 UTC
# Line 196  static void Line 196  static void
196  initialize (char *argv0)  initialize (char *argv0)
197  {  {
198      atexit (&cleanup);      atexit (&cleanup);
199        progname = argv0;
     progname = strrchr (argv0, '/');  
   
     if (progname != NULL)  
         progname++;  
     else  
         progname = argv0;  
200  }  }
201    
202  static bool __attribute__ ((unused))  /* Create archive callback. */
203  create_archive_callback (struct uar_archive *uar __attribute__ ((unused)),  static bool
204    create_archive_callback (struct uar_archive *uar,
205                           struct uar_file *file __attribute__ ((unused)),                           struct uar_file *file __attribute__ ((unused)),
206                           const char *fullname __attribute__ ((unused)),                           const char *uar_name __attribute__ ((unused)),
207                           const char *fullpath)                           const char *fs_name, enum uar_error_level level,
208                             const char *message)
209  {  {
210      if (!params.verbose)      if (level == UAR_ELEVEL_NONE)
211          return true;          {
212                if (params.verbose)
213                    fprintf (stdout, "%s\n", fs_name);
214            }
215        else if (level == UAR_ELEVEL_WARNING)
216            perr ("warning: %s: %s\n", fs_name,
217                  message != NULL ? message : uar_strerror (uar));
218        else if (level == UAR_ELEVEL_ERROR)
219            perr ("error: %s: %s\n", fs_name,
220                  message != NULL ? message : uar_strerror (uar));
221    
     fprintf (stdout, "%s\n", fullpath);  
222      return true;      return true;
223  }  }
224    
# Line 237  create_archive (void) Line 241  create_archive (void)
241              return;              return;
242          }          }
243    
244        uar_set_create_callback (uar, &create_archive_callback);
245    
246      for (size_t i = 0; i < params.ntargets; i++)      for (size_t i = 0; i < params.ntargets; i++)
247          {          {
248              struct stat stinfo = { 0 };              struct stat stinfo = { 0 };
# Line 249  create_archive (void) Line 255  create_archive (void)
255                      return;                      return;
256                  }                  }
257    
258              struct uar_file *file = uar_stream_add_entry (              struct uar_file *file
259                  uar, basename (params.rtargets[i]), params.rtargets[i], &stinfo,                  = uar_stream_add_entry (uar, basename (params.rtargets[i]),
260                  &create_archive_callback);                                          params.rtargets[i], &stinfo);
261    
262              if (file == NULL || uar_has_error (uar))              if (file == NULL || uar_has_error (uar))
263                  {                  {

Legend:
Removed from v.32  
changed lines
  Added in v.33

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26