#endif /* BB_CP_MV || BB_DU */
-#if defined (BB_CP_MV) || defined (BB_DU) || defined (BB_LN) || defined (BB_AR)
+#if defined (BB_CP_MV) || defined (BB_DU) || defined (BB_LN)
/*
* Return TRUE if a fileName is a directory.
* Nonexistant files return FALSE.
}
#endif /* BB_TAR || BB_AR */
-#if defined BB_TAR || defined BB_CP_MV || defined BB_AR || defined BB_DD
+#if defined BB_AR || defined BB_CP_MV || defined BB_DD || defined BB_NC || defined BB_TAR
/*
* Write all of the supplied buffer out to a file.
* This does multiple writes as necessary.
-#if defined (BB_TAR) || defined (BB_MKDIR) || defined (BB_AR)
+#if defined (BB_TAR) || defined (BB_MKDIR)
/*
* Attempt to create the directories along the specified path, except for
* the final component. The mode is given for the final directory only,
/* open device */
fd = open(device, O_RDONLY);
if (fd < 0)
- error_msg_and_die( "open failed for `%s': %s\n", device, strerror (errno));
+ perror_msg_and_die( "open failed for `%s'", device);
/* Find out how many processes there are */
if (ioctl (fd, DEVPS_GET_NUM_PIDS, &num_pids)<0)
- error_msg_and_die( "\nDEVPS_GET_PID_LIST: %s\n", strerror (errno));
+ perror_msg_and_die( "\nDEVPS_GET_PID_LIST");
/* Allocate some memory -- grab a few extras just in case
* some new processes start up while we wait. The kernel will
/* Now grab the pid list */
if (ioctl (fd, DEVPS_GET_PID_LIST, pid_array)<0)
- error_msg_and_die( "\nDEVPS_GET_PID_LIST: %s\n", strerror (errno));
+ perror_msg_and_die( "\nDEVPS_GET_PID_LIST");
/* Now search for a match */
for (i=1, j=0; i<pid_array[0] ; i++) {
info.pid = pid_array[i];
if (ioctl (fd, DEVPS_GET_PID_INFO, &info)<0)
- error_msg_and_die( "\nDEVPS_GET_PID_INFO: %s\n", strerror (errno));
+ perror_msg_and_die( "\nDEVPS_GET_PID_INFO");
/* Make sure we only match on the process name */
p=info.command_line+1;
/* close device */
if (close (fd) != 0)
- error_msg_and_die( "close failed for `%s': %s\n",device, strerror (errno));
+ perror_msg_and_die( "close failed for `%s'", device);
return pidList;
}
dir = opendir("/proc");
if (!dir)
- error_msg_and_die( "Cannot open /proc: %s\n", strerror (errno));
+ perror_msg_and_die( "Cannot open /proc");
while ((next = readdir(dir)) != NULL) {
FILE *status;
char *t;
if (s == NULL)
- error_msg_and_die("xstrndup bug");
+ error_msg_and_die("xstrndup bug\n");
t = xmalloc(n+1);
strncpy(t,s,n);
{
FILE *fp;
if ((fp = fopen(path, mode)) == NULL) {
- error_msg("%s: %s\n", path, strerror(errno));
+ perror_msg("%s", path);
errno = 0;
}
return fp;
{
FILE *fp;
if ((fp = fopen(path, mode)) == NULL)
- error_msg_and_die("%s: %s\n", path, strerror(errno));
+ perror_msg_and_die("%s", path);
return fp;
}
#endif
return strcmp(applet1->name, applet2->name);
}
+#if defined BB_NC
+ssize_t safe_read(int fd, void *buf, size_t count)
+{
+ ssize_t n;
+
+ do {
+ n = read(fd, buf, count);
+ } while (n < 0 && errno == EINTR);
+
+ return n;
+}
+#endif
+
/* END CODE */
/*
Local Variables: