The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
apps.c File Reference

libapps: read the .app files of the desktop's programs. More...

#include "apps.h"
#include "conf.h"
#include <ctype.h>
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>

Macros

#define SUFFIX   ".app"
#define SECTION   "app"
#define PATH_LEN   256
#define ID_MAX_LEN   64
#define CATEGORY_COUNT   ((int)(sizeof(categories) / sizeof(categories[0])))

Functions

void apps_free (app_list_t *list)
app_list_t * apps_load (const char *dir)
 read the .app files of a directory (APPS_DIR for the system ones).
const app_t * apps_find (const app_list_t *list, const char *id)
 the program with this id.
int app_split_exec (const char *exec, char *buffer, char *argv[APP_ARGS_MAX+1])
 split exec into words.

Detailed Description

libapps: read the .app files of the desktop's programs.

Macro Definition Documentation

◆ SUFFIX

#define SUFFIX   ".app"

◆ SECTION

#define SECTION   "app"

◆ PATH_LEN

#define PATH_LEN   256

◆ ID_MAX_LEN

#define ID_MAX_LEN   64

◆ CATEGORY_COUNT

#define CATEGORY_COUNT   ((int)(sizeof(categories) / sizeof(categories[0])))

Function Documentation

◆ apps_free()

void apps_free ( app_list_t * list)

◆ apps_load()

app_list_t * apps_load ( const char * dir)

read the .app files of a directory (APPS_DIR for the system ones).

a file without a name or exec is skipped, with a warning on stderr.

Returns
the list (empty if there is no directory), or NULL (no memory).

◆ apps_find()

const app_t * apps_find ( const app_list_t * list,
const char * id )

the program with this id.

Returns
it, or NULL.

◆ app_split_exec()

int app_split_exec ( const char * exec,
char * buffer,
char * argv[APP_ARGS_MAX+1] )

split exec into words.

Parameters
bufferreceives the words (it must hold strlen(exec) + 1 bytes).
argvreceives up to APP_ARGS_MAX words and a NULL.
Returns
the number of words, or -1 (none, too many, or a quote that is not closed).