install-printf.c revision a8fbdf5424be099ba1b2b1ec261c02b8759d6b0c
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2013 Zbigniew Jędrzejewski-Szmek
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "formats-util.h"
#include "install-printf.h"
#include "install.h"
#include "macro.h"
#include "specifier.h"
#include "unit-name.h"
#include "user-util.h"
UnitFileInstallInfo *i = userdata;
assert(i);
}
UnitFileInstallInfo *i = userdata;
assert(i);
}
UnitFileInstallInfo *i = userdata;
char *instance;
int r;
assert(i);
if (r < 0)
return r;
if (!instance) {
if (!instance)
return -ENOMEM;
}
return 0;
}
char *t;
/* If we are UID 0 (root), this will not result in NSS,
* otherwise it might. This is good, as we want to be able to
* run this in PID 1, where our user ID is 0, but where NSS
* lookups are not allowed. */
t = getusername_malloc();
if (!t)
return -ENOMEM;
*ret = t;
return 0;
}
return -ENOMEM;
return 0;
}
/* This is similar to unit_full_printf() but does not support
* anything path-related.
*
* %n: the full id of the unit (foo@bar.waldo)
* %N: the id of the unit without the suffix (foo@bar)
* %p: the prefix (foo)
* %i: the instance (bar)
* %U the UID of the running user
* %u the username of running user
* %m the machine ID of the running system
* %H the host name of the running system
* %b the boot ID of the running system
* %v `uname -r` of the running system
*/
{}
};
assert(i);
}