Scripts diversos de C
This commit is contained in:
parent
b2c4a8b35e
commit
de55532d39
Binary file not shown.
|
@ -0,0 +1,33 @@
|
|||
#include <alsa/asoundlib.h>
|
||||
|
||||
int main() {
|
||||
snd_mixer_t *mixer;
|
||||
|
||||
if (snd_mixer_open(&mixer, 1) ||
|
||||
snd_mixer_attach(mixer, "default") ||
|
||||
snd_mixer_selem_register(mixer, NULL, NULL) ||
|
||||
snd_mixer_load(mixer)) exit(42);
|
||||
|
||||
snd_mixer_selem_id_t *id;
|
||||
|
||||
snd_mixer_selem_id_alloca(&id);
|
||||
|
||||
snd_mixer_selem_id_set_index(id, 0);
|
||||
|
||||
snd_mixer_selem_id_set_name(id, "Master");
|
||||
|
||||
snd_mixer_elem_t *elem = snd_mixer_find_selem(mixer, id);
|
||||
|
||||
if (!elem) {
|
||||
exit(5);
|
||||
}
|
||||
long min, max, vol;
|
||||
|
||||
snd_mixer_selem_get_playback_volume_range(elem, &min, &max);
|
||||
|
||||
snd_mixer_selem_get_playback_volume(elem,
|
||||
SND_MIXER_SCHN_FRONT_LEFT, &vol);
|
||||
|
||||
printf("%li%%", ((vol - min)*100 + (max - min)/2) / (max - min));
|
||||
snd_mixer_close(mixer);
|
||||
}
|
Binary file not shown.
|
@ -11,12 +11,13 @@
|
|||
int main(int argc, const char const *argv[]) {
|
||||
const char const *shell[] = { "/bin/sh", NULL };
|
||||
|
||||
// move glibc stuff in place
|
||||
/* move glibc stuff in place */
|
||||
e("unshare",unshare(CLONE_NEWNS));
|
||||
e("mount",mount(SRC "/usr", "/usr", NULL, MS_BIND, NULL));
|
||||
e("mount",mount(SRC "/opt", "/opt", NULL, MS_BIND, NULL));
|
||||
e("mount",mount(SRC "/var/db/xbps", "/var/db/xbps", NULL, MS_BIND, NULL));
|
||||
|
||||
// drop the rights suid gave us
|
||||
/* drop the rights suid gave us */
|
||||
e("setuid",setreuid(getuid(),getuid()));
|
||||
e("setgid",setregid(getgid(),getgid()));
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue