install-printf.c revision 3f0b2f0f452e94444e4fb7b62030ea05738bb1b6
/*-*- 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 <assert.h>
#include <stdlib.h>
#include "specifier.h"
#include "unit-name.h"
#include "util.h"
#include "install-printf.h"
InstallInfo *i = userdata;
assert(i);
return unit_name_to_prefix_and_instance(i->name);
}
InstallInfo *i = userdata;
assert(i);
return unit_name_to_prefix(i->name);
}
InstallInfo *i = userdata;
char *instance;
int r;
assert(i);
if (r < 0)
return NULL;
return instance;
else
return strdup("");
}
InstallInfo *i = userdata;
const char *username;
assert(i);
if (i->user)
else
/* get USER env from env or our own uid */
switch (specifier) {
case 'u':
break;
case 'U': {
/* fish username from passwd */
int r;
if (r < 0)
return NULL;
return NULL;
break;
}}
return printed;
}
/* 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 configured user or running user
* %u the username of the configured user or 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
*/
};
assert(i);
}