Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset b48e680f in mainline for uspace/lib/c/generic/io/console.c


Ignore:
Timestamp:
2021-11-03T10:23:28Z (3 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
ec8a1bf
Parents:
ce862ac
git-author:
Jiri Svoboda <jiri@…> (2021-11-02 19:19:50)
git-committer:
Jiri Svoboda <jiri@…> (2021-11-03 10:23:28)
Message:

Allow console application to set the terminal window caption

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/io/console.c

    rce862ac rb48e680f  
    4040#include <errno.h>
    4141#include <stdlib.h>
     42#include <str.h>
    4243#include <vfs/vfs_sess.h>
    4344#include <io/console.h>
     
    128129        async_req_1_0(exch, CONSOLE_SET_CURSOR_VISIBILITY, (show != false));
    129130        async_exchange_end(exch);
     131}
     132
     133/** Set console caption.
     134 *
     135 * Set caption text for the console (if the console suports captions).
     136 *
     137 * @param ctrl Console
     138 * @param caption Caption text
     139 * @return EOK on success or an error code
     140 */
     141errno_t console_set_caption(console_ctrl_t *ctrl, const char *caption)
     142{
     143        async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
     144        ipc_call_t answer;
     145        aid_t req = async_send_0(exch, CONSOLE_SET_CAPTION, &answer);
     146        errno_t retval = async_data_write_start(exch, caption, str_size(caption));
     147
     148        if (retval != EOK) {
     149                async_forget(req);
     150                async_exchange_end(exch);
     151                return retval;
     152        }
     153
     154        async_wait_for(req, &retval);
     155        async_exchange_end(exch);
     156        return EOK;
    130157}
    131158
Note: See TracChangeset for help on using the changeset viewer.