Deleted Added
full compact
misc.c (8739) misc.c (8837)
1/*
2 * Miscellaneous support routines..
3 *
1/*
2 * Miscellaneous support routines..
3 *
4 * $Id: misc.c,v 1.8 1995/05/23 18:06:15 jkh Exp $
4 * $Id: misc.c,v 1.9 1995/05/25 01:22:19 jkh Exp $
5 *
6 * Copyright (c) 1995
7 * Jordan Hubbard. All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright

--- 165 unchanged lines hidden (view full) ---

178 struct stat sb;
179 int final=0;
180 char *p, *path;
181
182 if (access(ipath, R_OK) == 0)
183 return 0;
184
185 path = strdup(ipath);
5 *
6 * Copyright (c) 1995
7 * Jordan Hubbard. All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright

--- 165 unchanged lines hidden (view full) ---

178 struct stat sb;
179 int final=0;
180 char *p, *path;
181
182 if (access(ipath, R_OK) == 0)
183 return 0;
184
185 path = strdup(ipath);
186 msgDebug("mkdir(%s)\n", path);
186 if (isDebug())
187 msgDebug("mkdir(%s)\n", path);
187 p = path;
188 if (p[0] == '/') /* Skip leading '/'. */
189 ++p;
190 for (;!final; ++p) {
191 if (p[0] == '\0' || (p[0] == '/' && p[1] == '\0'))
192 final++;
193 else if (p[0] != '/')
194 continue;
195 *p = '\0';
196 if (stat(path, &sb)) {
197 if (errno != ENOENT) {
198 msgConfirm("Couldn't stat directory %s: %s", path, strerror(errno));
199 return 1;
200 }
188 p = path;
189 if (p[0] == '/') /* Skip leading '/'. */
190 ++p;
191 for (;!final; ++p) {
192 if (p[0] == '\0' || (p[0] == '/' && p[1] == '\0'))
193 final++;
194 else if (p[0] != '/')
195 continue;
196 *p = '\0';
197 if (stat(path, &sb)) {
198 if (errno != ENOENT) {
199 msgConfirm("Couldn't stat directory %s: %s", path, strerror(errno));
200 return 1;
201 }
201 msgDebug("mkdir(%s..)\n", path);
202 if (isDebug())
203 msgDebug("mkdir(%s..)\n", path);
202 if (mkdir(path, S_IRWXU | S_IRWXG | S_IRWXO) < 0) {
203 msgConfirm("Couldn't create directory %s: %s", path,strerror(errno));
204 return 1;
205 }
206 }
207 *p = '/';
208 }
209 free(path);

--- 16 unchanged lines hidden (view full) ---

226 strcpy(mountpoint, mountp);
227 }
228 memset(&ufsargs,0,sizeof ufsargs);
229
230 if (Mkdir(mountpoint, NULL)) {
231 msgConfirm("Unable to make directory mountpoint for %s!", mountpoint);
232 return 1;
233 }
204 if (mkdir(path, S_IRWXU | S_IRWXG | S_IRWXO) < 0) {
205 msgConfirm("Couldn't create directory %s: %s", path,strerror(errno));
206 return 1;
207 }
208 }
209 *p = '/';
210 }
211 free(path);

--- 16 unchanged lines hidden (view full) ---

228 strcpy(mountpoint, mountp);
229 }
230 memset(&ufsargs,0,sizeof ufsargs);
231
232 if (Mkdir(mountpoint, NULL)) {
233 msgConfirm("Unable to make directory mountpoint for %s!", mountpoint);
234 return 1;
235 }
234 msgDebug("mount %s %s\n", device, mountpoint);
236 if (isDebug())
237 msgDebug("mount %s %s\n", device, mountpoint);
238 bzero(&ufsargs, sizeof(ufsargs));
235 ufsargs.fspec = device;
236 if (mount(MOUNT_UFS, mountpoint, 0, (caddr_t)&ufsargs) == -1) {
237 msgConfirm("Error mounting %s on %s : %s\n", device, mountpoint, strerror(errno));
238 return 1;
239 }
240 return 0;
241}
242

--- 30 unchanged lines hidden ---
239 ufsargs.fspec = device;
240 if (mount(MOUNT_UFS, mountpoint, 0, (caddr_t)&ufsargs) == -1) {
241 msgConfirm("Error mounting %s on %s : %s\n", device, mountpoint, strerror(errno));
242 return 1;
243 }
244 return 0;
245}
246

--- 30 unchanged lines hidden ---