4343#include "src/common/libutil/jpath.h"
4444#include "src/common/libjob/job.h"
4545#include "src/common/libjob/unwrap.h"
46+ #include "src/common/libjob/idf58.h"
4647#include "src/common/libutil/read_all.h"
4748#include "src/common/libutil/monotime.h"
4849#include "src/common/libutil/fsd.h"
@@ -1462,11 +1463,7 @@ size_t read_jobspec (const char *name, void **bufp)
14621463
14631464static void print_jobid (flux_jobid_t id )
14641465{
1465- char buf [32 ];
1466- if (flux_job_id_encode (id , "f58" , buf , sizeof (buf )) < 0 )
1467- printf ("%ju\n" , (uintmax_t ) id );
1468- else
1469- printf ("%s\n" , buf );
1466+ printf ("%s\n" , idf58 (id ));
14701467}
14711468
14721469int cmd_submit (optparse_t * p , int argc , char * * argv )
@@ -3426,13 +3423,6 @@ int cmd_stats (optparse_t *p, int argc, char **argv)
34263423 return (0 );
34273424}
34283425
3429- static char * to_f58 (flux_jobid_t id , char * buf , int len )
3430- {
3431- if (flux_job_id_encode (id , "f58" , buf , len ) < 0 )
3432- (void ) snprintf (buf , len , "%ju" , (uintmax_t ) id );
3433- return buf ;
3434- }
3435-
34363426int cmd_wait (optparse_t * p , int argc , char * * argv )
34373427{
34383428 flux_t * h ;
@@ -3441,7 +3431,6 @@ int cmd_wait (optparse_t *p, int argc, char **argv)
34413431 flux_jobid_t id = FLUX_JOBID_ANY ;
34423432 bool success ;
34433433 const char * errstr ;
3444- char buf [32 ];
34453434 int rc = 0 ;
34463435
34473436 if ((argc - optindex ) > 1 ) {
@@ -3472,16 +3461,14 @@ int cmd_wait (optparse_t *p, int argc, char **argv)
34723461 log_msg_exit ("flux_job_wait_get_id: %s" ,
34733462 future_strerror (f , errno ));
34743463 if (!success ) {
3475- fprintf (stderr , "%s: %s\n" ,
3476- to_f58 (id , buf , sizeof (buf )),
3477- errstr );
3464+ fprintf (stderr , "%s: %s\n" , idf58 (id ), errstr );
34783465 rc = 1 ;
34793466 }
34803467 else {
34813468 if (optparse_hasopt (p , "verbose" ))
34823469 fprintf (stderr ,
34833470 "%s: job completed successfully\n" ,
3484- to_f58 (id , buf , sizeof ( buf ) ));
3471+ idf58 (id ));
34853472 }
34863473 flux_future_destroy (f );
34873474 }
@@ -3502,7 +3489,7 @@ int cmd_wait (optparse_t *p, int argc, char **argv)
35023489 if (id == FLUX_JOBID_ANY ) {
35033490 if (flux_job_wait_get_id (f , & id ) < 0 )
35043491 log_err_exit ("flux_job_wait_get_id" );
3505- printf ("%s\n" , to_f58 (id , buf , sizeof ( buf ) ));
3492+ printf ("%s\n" , idf58 (id ));
35063493 }
35073494 if (!success )
35083495 log_msg_exit ("%s" , errstr );
@@ -3902,7 +3889,6 @@ int cmd_last (optparse_t *p, int argc, char **argv)
39023889 int optindex = optparse_option_index (p );
39033890 flux_future_t * f ;
39043891 flux_t * h ;
3905- char buf [32 ];
39063892 json_t * jobs ;
39073893 size_t index ;
39083894 json_t * entry ;
@@ -3941,12 +3927,8 @@ int cmd_last (optparse_t *p, int argc, char **argv)
39413927 }
39423928 if (json_array_size (jobs ) == 0 )
39433929 log_msg_exit ("job history is empty" );
3944- json_array_foreach (jobs , index , entry ) {
3945- flux_jobid_t id = json_integer_value (entry );
3946- if (flux_job_id_encode (id , "f58" , buf , sizeof (buf )) < 0 )
3947- log_err_exit ("error encoding job ID" );
3948- printf ("%s\n" , buf );
3949- }
3930+ json_array_foreach (jobs , index , entry )
3931+ printf ("%s\n" , idf58 (json_integer_value (entry )));
39503932 flux_future_destroy (f );
39513933 flux_close (h );
39523934 return 0 ;
0 commit comments