| Line | 
                Branch | 
                Exec | 
                Source | 
            
            
                | 1 | 
                
                 | 
                 | 
                /* | 
            
            
                | 2 | 
                
                 | 
                 | 
                ** EPITECH PROJECT, 2024 | 
            
            
                | 3 | 
                
                 | 
                 | 
                ** zappy | 
            
            
                | 4 | 
                
                 | 
                 | 
                ** File description: | 
            
            
                | 5 | 
                
                 | 
                 | 
                ** inventory.c | 
            
            
                | 6 | 
                
                 | 
                 | 
                */ | 
            
            
                | 7 | 
                
                 | 
                 | 
                 | 
            
            
                | 8 | 
                
                 | 
                 | 
                #include "server.h" | 
            
            
                | 9 | 
                
                 | 
                 | 
                #include "unused.h" | 
            
            
                | 10 | 
                
                 | 
                 | 
                 | 
            
            
                | 11 | 
                
                 | 
                 | 
                static const char fmt[] = "[food %d, linemate %d, \ | 
            
            
                | 12 | 
                
                 | 
                 | 
                deraumere %d, sibur %d, mendiane %d, phiras %d, thystame %d]\n"; | 
            
            
                | 13 | 
                
                 | 
                 | 
                 | 
            
            
                | 14 | 
                
                 | 
                1 | 
                void inventory(client_t *client, UNUSED server_t *server) | 
            
            
                | 15 | 
                
                 | 
                 | 
                { | 
            
            
                | 16 | 
                
                 | 
                 | 
                    int ret = 0; | 
            
            
                | 17 | 
                
                 | 
                 | 
                 | 
            
            
                | 18 | 
                
                 | 
                1 | 
                    ret = asprintf(&client->payload, fmt, | 
            
            
                | 19 | 
                
                 | 
                 | 
                        client->inventory.food, | 
            
            
                | 20 | 
                
                 | 
                 | 
                        client->inventory.linemate, | 
            
            
                | 21 | 
                
                 | 
                 | 
                        client->inventory.deraumere, | 
            
            
                | 22 | 
                
                 | 
                 | 
                        client->inventory.sibur, | 
            
            
                | 23 | 
                
                 | 
                 | 
                        client->inventory.mendiane, | 
            
            
                | 24 | 
                
                 | 
                 | 
                        client->inventory.phiras, | 
            
            
                | 25 | 
                
                 | 
                 | 
                        client->inventory.thystame | 
            
            
                | 26 | 
                
                 | 
                 | 
                    ); | 
            
            
                | 27 | 
                
                    
                        1/2
                        
                            ✗ Branch 0 not taken. 
                            ✓ Branch 1 taken 1 times. 
                         
                     
                 | 
                1 | 
                    if (ret == -1) { | 
            
            
                | 28 | 
                
                 | 
                ✗ | 
                        perror("asprintf"); | 
            
            
                | 29 | 
                
                 | 
                ✗ | 
                        return; | 
            
            
                | 30 | 
                
                 | 
                 | 
                    } | 
            
            
                | 31 | 
                
                 | 
                1 | 
                    client_time_handler(client, INVENTORY); | 
            
            
                | 32 | 
                
                 | 
                 | 
                } | 
            
            
                | 33 | 
                
                 | 
                 | 
                 |