Compare commits

..

No commits in common. "baa75a261950c78d6a719152b22636ecfb467d44" and "6c558654f3a6fd5fe360831436359805536d14e0" have entirely different histories.

3 changed files with 14 additions and 17 deletions

View File

@ -22,6 +22,11 @@
#include <sysexits.h> /* EX_IOERR, EX_OK, EX_OSERR, EX_USAGE */
#include <unistd.h> /* pledge(2), getopt(3) */
#ifdef __OpenBSD__
# include <errno.h> /* errno */
# include <string.h> /* strerror(3) */
#endif
char *program_name = "npc";
static int
@ -43,7 +48,7 @@ int main(int argc, char *argv[]) {
program_name = argv[0] == NULL ? program_name : argv[0];
if (pledge("stdio", NULL) == -1) {
perror(program_name);
(void)fprintf(stderr, "%s: %s\n", program_name, strerror(errno));
return EX_OSERR;
}
#endif

View File

@ -19,7 +19,7 @@
#include <ctype.h>
#include <stddef.h> /* NULL */
#include <stdio.h> /* fprintf(3), perror(3) */
#include <stdio.h> /* fprintf(3), perror(2) */
#include <stdlib.h> /* size_t, EXIT_FAILURE */
#include <string.h> /* strcmp(3) */
#include <sysexits.h> /* EX_OSERR, EX_USAGE */

View File

@ -16,28 +16,20 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*/
#include <stdio.h> /* fprintf(3), perror(3), stderr */
#include <sysexits.h> /* EX_OK, EX_OSERR, EX_USAGE */
#ifdef __OpenBSD__
# include <unistd.h> /* pledge(2) */
#endif
#include <stdio.h> /* fprintf(3), stderr */
#include <sysexits.h> /* EX_OK, EX_USAGE */
char *program_name = "strcmp";
int main(int argc, char *argv[]) {
program_name = argv[0] == NULL ? program_name : argv[0];
int i;
#ifdef __OpenBSD__
if (pledge("stdio", NULL) != -1) {
perror(program_name);
return EX_OSERR;
}
#endif
if (argc < 3) {
(void)fprintf(stderr, "Usage: %s string string...\n", program_name);
(void)fprintf(
stderr,
"Usage: %s string string...\n",
argv[0] == NULL ? program_name : argv[0]
);
return EX_USAGE;
}