1f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle/*
2f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle * Copyright (C) 2010 The Android Open Source Project
3f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle *
4f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle * Licensed under the Apache License, Version 2.0 (the "License");
5f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle * you may not use this file except in compliance with the License.
6f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle * You may obtain a copy of the License at
7f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle *
8f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle *      http://www.apache.org/licenses/LICENSE-2.0
9f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle *
10f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle * Unless required by applicable law or agreed to in writing, software
11f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle * distributed under the License is distributed on an "AS IS" BASIS,
12f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle * See the License for the specific language governing permissions and
14f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle * limitations under the License.
15f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle */
16f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle
17f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle#include <stdio.h>
18f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle#include <stdlib.h>
19f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle#include <string.h>
20f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle#include <unistd.h>
21f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle
22f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle#include "utils.h"
23f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle
24f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttlevoid strpadcpy(char *d, const char *s, char p, size_t l)
25f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle{
26f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle	while (*s && l-- > 0)
27f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle		*d++ = *s++;
28f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle
29f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle	while (l-- > 0)
30f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle		*d++ = ' ';
31f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle}
32f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle
33f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttlevoid warn(char *msg)
34f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle{
35f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle	fprintf(stderr, "%s", msg);
36f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle}
37f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle
38f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttlevoid die(char *msg)
39f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle{
40f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle	fprintf(stderr, "%s", msg);
41f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle	exit(EXIT_FAILURE);
42f79b2dff1024db4f6326f3422236bed169dd902fThomas Tuttle}
43