Coder Social home page Coder Social logo

libusershell_econf's Introduction

usershell_econf

This is a small library replacing the setusershell(), getusershell() and endusershell() functions of glibc with a variant, which uses libeconf to read the valid shells following the Configuration Files Specification of the Linux Userspace API Group.

Building and installing usershell_econf

Building

usershell_econf requires libeconf in version 0.4.9 or newer and meson version 0.58 or newer.

Building with meson is quite simple:

$ meson setup build
$ meson compile -C build
$ meson test -C build

If you want to build with the address sanitizer enabled, add -Db_sanitize=address as an argument to meson setup build.

Installing

$ sudo meson install -C build

Usage

There are two ways to use the new functions:

Override glibc functions

The glibc functions can be replaced without further code changes by additionally linking the application against libusershell_econf. It is important that the linker does not optimize away the library, this can happen if e.g. as-needed is used for linking.

Use new function names

To avoid problems, it's recommended to modify the applications source code and exchange all function calls by appending _econf to them:

  • setusershell() -> setusershell_econf()
  • getusershell() -> getusershell_econf()
  • endusershell() -> endusershell_econf()

Additional you need to include an additional header file: #include <usershell_econf.h>

and link against libusershell_econf.

Example code:

...
#include <usershell_econf.h>
...
int
main (void)
{
  char *shell;

...

  setusershell_econf ();
  while ((shell = getusershell_econf ()) != NULL)
    printf ("[%s]\n", shell);
  endusershell_econf ();
...
}

Licensing

See the file COPYING for full text and copying restrictions.

libusershell_econf's People

Contributors

thkukuk avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.